JSONP streaming now works as well

JSONP streaming now works as well

--- src/cfpb/qu/views.clj
+++ src/cfpb/qu/views.clj
@@ -33,7 +33,7 @@
 ;; Allow for encoding of UrlLike's in JSON.
 (add-encoder UrlLike encode-str)

-(def ^:dynamic *stream-size* *stream-size*)
+(def ^:dynamic *stream-size* 1024)

 (def footer-info {:qu_version (:version project)
                   :build_number (:build-number project)
@@ -389,11 +389,19 @@
     (send-stream request response in *stream-size*)
     (ring-response response)))

-(defmethod slice-query "text/javascript" [_ resource {:keys [callback]}]
-  (let [callback (if (str/blank? callback) "callback" callback)]
-    (str callback "("
-         (hal/resource->representation resource :json)
-         ");")))
+(defmethod slice-query "text/javascript" [_ resource {:keys [request callback]}]
+  (let [callback (if (str/blank? callback) "callback" callback)
+        resource (hal/json-representation resource)
+        response (response/content-type "text/json; charset=utf-8" {})
+        in (PipedInputStream. *stream-size*)
+        out (PipedOutputStream. in)]
+    (future
+      (with-open [out (io/writer out)]
+        (.write out (str callback "("))
+        (json/generate-stream resource out)
+        (.write out ");")))
+    (send-stream request response in *stream-size*)
+    (ring-response response)))

 (defmethod slice-query "application/xml" [_ resource {:keys [request]}]
   (let [resource (hal/xml-representation resource)


Revert "include :proj in math_main output"

This reverts commit 730829f0c1c382138856bcb869adfd7eb54534c6.

--- src/polismath/conv_man.clj
+++ src/polismath/conv_man.clj
@@ -47,7 +47,6 @@
                                :n
                                :n-cmts
                                :pca
-                               :proj
                                :repness
                                :consensus
                                :zid


fix starting pieces to be standard

fix starting pieces to be standard


* src/clj/cljs/core.clj: special case IFn -invoke first param to be bound to "this""

--- src/clj/cljs/core.clj
+++ src/clj/cljs/core.clj
@@ -229,9 +229,17 @@
                                       sigs))
                                (cons `(set! ~(symbol (str prototype-prefix pprefix)) true)
                                      (map (fn [[f & meths]]
-                                            (let [pf (if (= psym 'cljs.core.IFn)
+                                            (let [ifn? (= psym 'cljs.core.IFn)
+                                                  pf (if ifn?
                                                        (str prototype-prefix 'call)
-                                                       (str prototype-prefix pprefix f))]
+                                                       (str prototype-prefix pprefix f))
+                                                  adapt-params (fn [[[tname :as args] & body]]
+                                                                 `([~@args]
+                                                                     (~'js* "~{} = this" ~tname)
+                                                                     ~@body))
+                                                  meths (if ifn?
+                                                          (map adapt-params meths)
+                                                          meths)]
                                               `(set! ~(symbol pf) (fn* ~@meths))))
                                           sigs)))))]
         `(do ~@(mapcat assign-impls impl-map))))))


cljs.repl/repl:     * need to wrap -setup call in cljs.compiler/with-core-cljs so that bootstrapping        evals works

--- src/clj/cljs/repl.clj
+++ src/clj/cljs/repl.clj
@@ -701,13 +701,15 @@
              is-special-fn? (set (keys special-fns))
              request-prompt (Object.)
              request-exit (Object.)
-             opts (try
-                    (if-let [merge-opts (:merge-opts (-setup repl-env opts))]
-                      (merge opts merge-opts)
-                      opts)
-                    (catch Throwable e
-                      (caught e repl-env opts)
-                      opts))
+             opts (comp/with-core-cljs opts
+                    (fn []
+                      (try
+                        (if-let [merge-opts (:merge-opts (-setup repl-env opts))]
+                          (merge opts merge-opts)
+                          opts)
+                        (catch Throwable e
+                          (caught e repl-env opts)
+                          opts))))
              read-eval-print
              (fn []
                (let [input (binding [*ns* (create-ns ana/*cljs-ns*)


first platform then url

first platform then url

--- src/clj/hsm/utils.clj
+++ src/clj/hsm/utils.clj
@@ -189,7 +189,7 @@
     :id (id-of request)
     :host-pl hosted-pl
     :url (:uri request)
-    :platform      (or (or hosted-pl (pl->lang (id-of request :platform)) ) "Python")
+    :platform      (or (or (pl->lang (id-of request :platform)) hosted-pl ) "Python")
     :json? (type-of request :json)
     :user (whois request)
     :limit-by     (or (Integer/parseInt (or (get-in request [:params :limit]) "100")) 100)


Update core.cljs

Update core.cljs

--- src/cljs/ls/core.cljs
+++ src/cljs/ls/core.cljs
@@ -2,7 +2,7 @@
   (:require [reagent.core :as r]
             [soda-ash.core :as sa]))

-(enable-console-print!)
+(enable-console-print!

 ;; Let's see if we can trigger a proper deploy

@@ -59,4 +59,4 @@
     [main]
     (.getElementById js/document "app")))

-(start)+(start)


Added spy-* macros

Added spy-* macros

--- src/cooljure/core.clj
+++ src/cooljure/core.clj
@@ -63,3 +63,39 @@
      ~@body
      (catch Exception e# ~default) ))

+; AWTWAT TODO:  need tests
+(defmacro spy-expr
+  "Evaluates expr and outputs the form and its result to the debug log; returns
+  the result of expr."
+  [expr]
+  `(let [out-val# ~expr]
+      (println (str '~expr " => " out-val#))
+      out-val#) )
+
+; AWTWAT TODO:  need tests
+(defmacro spy-msg
+  "Evaluates expr and outputs the form and its result to the debug log; returns
+  the result of expr."
+  [msg expr]
+  `(let [out-val# ~expr]
+      (println (str ~msg " => " out-val#))
+      out-val# ))
+
+; AWTWAT TODO:  need tests
+(defmacro spy-val
+  "Evaluates expr and outputs the form and its result to the debug log; returns
+  the result of expr."
+  [expr]
+  `(let [out-val# ~expr]
+      (println out-val#)
+      out-val# ))
+
+; AWTWAT TODO:  need tests
+(defmacro spy-first
+  "Evaluates expr and outputs the form and its result to the debug log; returns
+  the result of expr."
+  [expr msg]
+  `(let [out-val# ~expr]
+      (println (str ~msg " => " out-val#))
+      out-val# ))
+


[#2228] Improve logs on flow calls exceptions

--- backend/src/akvo/lumen/lib/import/flow.clj
+++ backend/src/akvo/lumen/lib/import/flow.clj
@@ -8,6 +8,10 @@
             [akvo.lumen.lib.import.flow-v3 :as v3]
             [clojure.tools.logging :as log]))

+(defn- read-flow-urls [flow-api]
+  {:internal (:internal-url flow-api)
+   :keycloak (:url flow-api)
+   :auth0 (:auth0-url flow-api)})

 (defmethod import/dataset-importer "AKVO_FLOW"
   [{:strs [instance surveyId formId token email version] :as spec}
@@ -32,7 +36,9 @@
               (do
                 (log/error e)
                 (throw (ex-info (or (:cause e) (str "Null cause from instance: " instance))
-                                (assoc ex-d :instance instance))))
+                                (assoc ex-d
+                                       :instance instance
+                                       :flow-urls (read-flow-urls flow-api)))))
               (throw e)))))
       (records [this]
         (try
@@ -42,5 +48,7 @@
           (catch Throwable e
             (if-let [ex-d (ex-data e)]
               (throw (ex-info (or (:cause e) (str "Null cause from instance: " instance))
-                              (assoc ex-d :instance instance)))
+                              (assoc ex-d
+                                     :instance instance
+                                     :flow-urls (read-flow-urls flow-api))))
               (throw e))))))))


Add minor cosmetic improvements.

Add minor cosmetic improvements.

--- src/decimal/core.cljs
+++ src/decimal/core.cljs
@@ -9,24 +9,24 @@
 (def ^:static +decimal+ (js/Decimal.noConflict))
 (def ^:dynamic *decimal* +decimal+)

-(def round-mapping {
-  :round-up 0
-  :round-down 1
-  :round-ceil 2
-  :round-floor 3
-  :round-half-up 4
-  :round-half-down 5
-  :round-half-even 6
-  :round-half-ceil 7
-  :round-half-floor 8
-  :euclid 9})
-
-(def modulo-mapping {
-  :round-up 0
-  :round-down 1
-  :round-floor 3
-  :round-half-even 6
-  :euclid 9})
+(def round-mapping
+  {:round-up 0
+   :round-down 1
+   :round-ceil 2
+   :round-floor 3
+   :round-half-up 4
+   :round-half-down 5
+   :round-half-even 6
+   :round-half-ceil 7
+   :round-half-floor 8
+   :euclid 9})
+
+(def modulo-mapping
+  {:round-up 0
+   :round-down 1
+   :round-floor 3
+   :round-half-even 6
+   :euclid 9})

 (defn config!
   "Set the global configuration for the decimal constructor.
@@ -91,15 +91,15 @@
   function also accepts. You can read more about here:
   http://mikemcl.github.io/decimal.js/#Dconfig"
   [options]
-  (let [final-options {:precision (:precision options (.-precision +decimal+))
-                       :rounding ((:rounding options) round-mapping (.-rounding +decimal+))
-                       :modulo ((:modulo options :round-down) modulo-mapping (.-modulo +decimal+))
-                       :minE (:min-e options (.-minE +decimal+))
-                       :maxE (:max-e options (.-maxE +decimal+))
-                       :toExpNeg (:to-exp-neg options (.-toExpNeg +decimal+))
-                       :toExpPos (:to-exp-pos options (.-toExpPos +decimal+))
-                       :crypto (:crypto options (.-crypto +decimal+))}]
-    (.set +decimal+ (clj->js final-options))
+  (let [opts #js {:precision (:precision options (.-precision +decimal+))
+                  :rounding ((:rounding options) round-mapping (.-rounding +decimal+))
+                  :modulo ((:modulo options :round-down) modulo-mapping (.-modulo +decimal+))
+                  :minE (:min-e options (.-minE +decimal+))
+                  :maxE (:max-e options (.-maxE +decimal+))
+                  :toExpNeg (:to-exp-neg options (.-toExpNeg +decimal+))
+                  :toExpPos (:to-exp-pos options (.-toExpPos +decimal+))
+                  :crypto (:crypto options (.-crypto +decimal+))}]
+    (.set +decimal+ opts)
     nil))

 (defn config
@@ -107,15 +107,15 @@
   of decimals that can be used for create new instances
   with provided configuration."
   [options]
-  (let [final-options {:precision (:precision options (.-precision +decimal+))
-                       :rounding ((:rounding options) round-mapping (.-rounding +decimal+))
-                       :modulo ((:modulo options :round-down) modulo-mapping (.-modulo +decimal+))
-                       :minE (:min-e options (.-minE +decimal+))
-                       :maxE (:max-e options (.-maxE +decimal+))
-                       :toExpNeg (:to-exp-neg options (.-toExpNeg +decimal+))
-                       :toExpPos (:to-exp-pos options (.-toExpPos +decimal+))
-                       :crypto (:crypto options (.-crypto +decimal+))}]
-    (.clone +decimal+ (clj->js final-options))))
+  (let [opts #js {:precision (:precision options (.-precision +decimal+))
+                  :rounding ((:rounding options) round-mapping (.-rounding +decimal+))
+                  :modulo ((:modulo options :round-down) modulo-mapping (.-modulo +decimal+))
+                  :minE (:min-e options (.-minE +decimal+))
+                  :maxE (:max-e options (.-maxE +decimal+))
+                  :toExpNeg (:to-exp-neg options (.-toExpNeg +decimal+))
+                  :toExpPos (:to-exp-pos options (.-toExpPos +decimal+))
+                  :crypto (:crypto options (.-crypto +decimal+))}]
+    (.clone +decimal+ opts)))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Protocols & Constructor
@@ -243,7 +243,7 @@
   to the value of x and NaN if the value of this Decimal or
   the value of x is NaN"
   [v x]
-   (.cmp (-decimal v) x))
+  (.cmp (-decimal v) x))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Operations
@@ -621,7 +621,7 @@
   work, except that a Decimal with the value minus zero will convert to
   positive zero."
   [v]
-   (.toNumber (-decimal v)))
+  (.toNumber (-decimal v)))

 (defn to-string
   "Returns a string representing the value of this Decimal.
@@ -630,12 +630,12 @@
   `to-exp-pos`, or a negative exponent equal to or less than `to-exp-neg`, then
   exponential notation will be returned."
   [v]
-   (.toString (-decimal v)))
+  (.toString (-decimal v)))

 (defn value-of
   "As toString, but zero is signed."
   [v]
-   (.valueOf (-decimal v)))
+  (.valueOf (-decimal v)))

 (defn to-precision
   "Returns a string representing the value of this Decimal in


[docs] quick docstring additions/improvements

--- keras/src/think/cortex/keras/core.clj
+++ keras/src/think/cortex/keras/core.clj
@@ -15,12 +15,17 @@

 (defn read-model
+  "Reads a JSON keras model into a Clojure map. Just a literal representation
+  with no additional munging at this point."
   [fname]
   (json/parse-string (slurp fname) keyword))

-(defmulti model-item->desc (fn [item]
-                             (keyword (:class_name item))))
+(defmulti model-item->desc
+  "Multimethod that dispatched on keyword version of Keras model item key
+  to generate the corresponding Cortex description for the item/layer."
+  (fn [item]
+    (keyword (:class_name item))))

 (defmethod model-item->desc :Convolution2D
@@ -60,12 +65,14 @@

 (defmethod model-item->desc :Dropout
+  ;; Cortex uses keep probability, Keras uses drop probability.
   [{:keys [config]}]
   (assoc (first
           (desc/dropout (- 1.0 (:p config))))
          :id (keyword (:name config))))

 (defmethod model-item->desc :Flatten
+  ;; Cortex doesn't require a flatten in its model description.
   [_]
   [])

@@ -84,6 +91,8 @@
       [retval])))

 (defn model->simple-description
+  "Returns a simple (unbuilt) model description given the hashmap literal
+  representation of a Keras JSON model description."
   [model]
   (let [model  (if (= (:class_name model) "Sequential")
                  (:config model)
@@ -340,6 +349,9 @@

 (defn load-weights-for-description
+  "Given a `desc-seq`, which consists of pairs of layers from the unbuilt and built
+  versions of the model description, and the name of the hdf5 file which stores the
+  weights, loads the weights for the model."
   [desc-seq weights-fname]
   (resource/with-resource-context
     (load-weights desc-seq (hdf5/open-file weights-fname))))
@@ -412,7 +424,7 @@

 (defn- associate-layer-outputs
   "Output a layer output per desc associated with that desc.
-Output may be nil for a given desc."
+  Output may be nil for a given desc."
   [desc-seq output-seq]
   (loop [desc (first desc-seq)
          desc-seq (rest desc-seq)


Fix enterprise form test

Fix enterprise form test

--- src/frontend/core.clj
+++ src/frontend/core.clj
@@ -92,6 +92,7 @@
               #"/integrations.*"
               #"/invite-teammates"
               #"/jobs"
+              #"/mobile"
               #"/pricing"
               #"/privacy"
               #"/security.*"


Work on docs

Work on docs

--- src/fx_clj/enlive.clj
+++ src/fx_clj/enlive.clj
@@ -15,27 +15,26 @@
       (do-transform n xform))))

 (defn at!
-  "An enlive-like transformation function. Takes a context node and pairs of
-  css selector strings and transform arguments.  If a single transform argument
-  is supplied after node (instead of sel-xform-pairs), that transformation will
-  be applied to the provided node.
+"An enlive-like transformation function. Takes a context node and pairs of
+css selector strings and transform arguments.  If a single transform argument
+is supplied after node (instead of sel-xform-pairs), that transformation will
+be applied to the provided node.

-  Available transforms include:
-    the property-map transform: a map that could be passed to [[pset!]]
-    [[add-class!]]
-    [[remove-class!]]
+Available transforms include:
+- the property-map transform: a map that could be passed to [[pset!]]
+- [[add-class!]]
+- [[remove-class!]]

-  Examples:
+Examples:

-  ```clojure
-  (at! my-node \"#my-element\" {:text \"Some text\"})
-  (at! my-node \"#my-element\" (add-class! \"some-class\"))
-  (at! my-node {:text \"Some text\"})
-  ```
+```clojure
+(at! my-node \"#my-element\" {:text \"Some text\"})
+(at! my-node \"#my-element\" (add-class! \"some-class\"))
+(at! my-node {:text \"Some text\"})
+```

-  Note: Additional transforms can be registered (see the
-  fx-clj.core.extensibility namespace for details).
-  "
+Note: Additional transforms can be registered (see the
+fx-clj.core.extensibility namespace for details)."
   {:doc/format :markdown}
   [node & sel-xform-pairs]
   (if (= 1 (count sel-xform-pairs))


RDC - Use vector destructuring.

RDC - Use vector destructuring.

--- src/icfp2015/unit.clj
+++ src/icfp2015/unit.clj
@@ -18,7 +18,7 @@

 (defn rotate
   "Rotate a unit around a pivot point"
-  [rotation, {:keys [pi pj] :as pivot}]
+  [rotation, [[pi pj]]]
   nil)

 (def rotations


try-proof updated, but something's wrong

--- src/latte/core.clj
+++ src/latte/core.clj
@@ -325,6 +325,7 @@
 (defmacro try-proof
   "Tries (but does not register) a proof of theorem named `thm-name` using the given proof `method`
   and `steps`."
+  {:style/indent [2 :form :form [1]]}
   [thm-name method & steps]
   (let [def-env {}
         [status thm] (defenv/fetch-definition def-env thm-name)]
@@ -337,7 +338,7 @@
                 :theorem thm-name
                 :error (dissoc proof-term :msg)}]
           `(do
-             [:ok {:qed (quote ~thm-name)}]))))))
+             [:ok {:proof-of (quote ~thm-name)}]))))))

 (defmacro proof
   "Provides a proof of theorem named `thm-name` using the given proof `method`


Tighten up some code

Tighten up some code

--- src/io/aviso/rook.clj
+++ src/io/aviso/rook.clj
@@ -129,9 +129,7 @@
   "Middleware which adds provided argument resolvers to [:rook :default-arg-resolvers] collection."
   [handler & arg-resolvers]
   (fn [request]
-    (handler (assoc request
-               :rook (merge (:rook request)
-                            {:default-arg-resolvers (concat (:default-arg-resolvers (:rook request)) arg-resolvers)})))))
+    (handler (update-in request [:rook :default-arg-resolvers] concat arg-resolvers))))

 (defn- get-available-paths
   "Scan namespace for available routes - only those that have available function are returned.


wasn't calling setSelectionRange on node

--- labs/architecture-examples/om/src/todomvc/item.cljs
+++ labs/architecture-examples/om/src/todomvc/item.cljs
@@ -26,7 +26,7 @@
     (>! (:edit chans) todo)
     (let [node (dom/get-node owner "editField")]
       (.focus node)
-      (.setSelectionRange (.. node -value -length) (.. node -value -length))))
+      (.setSelectionRange node (.. node -value -length) (.. node -value -length))))
   (om/replace! todo [:edit-text] (:title todo)))

 (defn handle-key-down [e todo opts]


Rename first-arg -> flag.

Rename first-arg -> flag.

--- src/leiningen/run.clj
+++ src/leiningen/run.clj
@@ -23,11 +23,11 @@
 Aliases can be defined in project.clj as
     :run-aliases {:alias a.namespace
                   :alias2 another.namespace}"
-  [project & [first-arg & args]]
-  (let [first-arg (read-string first-arg)
-        alias (and (keyword? first-arg) (first-arg (:run-aliases project)))]
-    (cond alias              (apply run project "-m" (cons alias args))
-          (= first-arg '-m) (apply run-main project args)
-          (:main project)    (apply run-main project (:main project)
-                                    first-arg args)
+  [project & [flag & args]]
+  (let [flag (read-string flag)
+        alias (and (keyword? flag) (flag (:run-aliases project)))]
+    (cond alias           (apply run project "-m" (cons alias args))
+          (= flag '-m)    (apply run-main project args)
+          (:main project) (apply run-main project (:main project)
+                                 flag args)
           :else (abort "No :main namespace specified in project.clj."))))


much more efficient and intuitive autoscroll trigger (use on-wheel instead of scroll on window)

--- frontend/components/build_steps.cljs
+++ frontend/components/build_steps.cljs
@@ -161,30 +161,34 @@
                          [:container-selected {:container-id (get-in @(om/get-shared owner [:_app-state-do-not-use]) state/current-container-path)
                                                :animate? false}]))))

-(defn mount-autoscroll [owner]
-  (let [container (om/get-node owner)
-        ;; autoscroll when the container_parent's tail-end is showing
-        scroll-listener #(let [new-autoscroll? (> (goog.dom/getDocumentHeight)
-                                                  (.-bottom (.getBoundingClientRect container)))]
-                           (when (not= new-autoscroll? (om/get-state owner [:autoscroll?]))
-                             (om/set-state! owner [:autoscroll?] new-autoscroll?)))]
-    (om/set-state! owner [:scroll-listener-key] (goog.events/listen
-                                                 (sel1 "main.app-main")
-                                                 "scroll"
-                                                 scroll-listener))))
+(defn check-autoscroll [owner deltaY]
+  (cond
+
+   ;; autoscrolling and scroll up? That means stop autoscrolling.
+   (and (neg? deltaY)
+        (om/get-state owner [:autoscroll?]))
+   (om/set-state! owner [:autoscroll?] false)
+
+   ;; not autoscrolling and scroll down? If they scrolled all of the way down, better autoscroll
+   (and (pos? deltaY)
+        (not (om/get-state owner [:autoscroll?])))
+   (let [container (om/get-node owner)]
+     (when (> (.-height (goog.dom/getViewportSize))
+              (.-bottom (.getBoundingClientRect container)))
+       (om/set-state! owner [:autoscroll?] true)))
+
+   :else nil))

 (defn container-build-steps [{:keys [containers current-container-id]} owner]
   (reify
     om/IInitState
     (init-state [_]
-      {:autoscroll? false})
+      {:autoscroll? true})
     om/IDidMount
     (did-mount [_]
-      (mount-autoscroll owner)
       (mount-browser-resize owner))
     om/IWillUnmount
     (will-unmount [_]
-      (goog.events/unlistenByKey (om/get-state owner [:scroll-listener-key]))
       (goog.events/unlistenByKey (om/get-state owner [:browser-resize-key])))
     om/IDidUpdate
     (did-update [_ _ _]
@@ -205,6 +209,7 @@
         (html
          [:div#container_scroll_parent ;; hides horizontal scrollbar
           [:div#container_parent {:on-wheel (fn [e]
+                                              (check-autoscroll owner (aget e "deltaY"))
                                               (when (not= 0 (aget e "deltaX"))
                                                 (.preventDefault e)
                                                 (let [body (sel1 "body")]


client-maps used for matching events to deliver per client

--- src/clj/com/matthiasnehlsen/inspect/matcher.clj
+++ src/clj/com/matthiasnehlsen/inspect/matcher.clj
@@ -37,9 +37,7 @@
   (let [uid (strip-uid (:client-uuid full-event))
         n (:n params)
         client-map (into {} (map (fn [t] [t n]) (seq @known-event-types)))]
-
-    (swap! client-maps assoc-in [uid] client-map)
-    (log/info client-maps)))
+    (swap! client-maps assoc-in [uid] client-map)))

 (defn send-event-types
   "send set with known event types to connected UIs"
@@ -54,11 +52,11 @@
     (let [event (:event full-event)]
       (inspect-fn :ws/event-in full-event)
       (match event
-             [:cmd/get-next params] (get-next params full-event)
+             [:cmd/get-next params]   (get-next params full-event)
              [:cmd/initialize params] (initialize-inspector params full-event)
-             [:cmd/get-event-types] (send-event-types uids chsk-send!)
-             [:chsk/ws-ping]    () ; currently just do nothing with ping (no logging either)
-             :else              (log/debug "Unmatched event:" (pp/pprint event))))))
+             [:cmd/get-event-types]   (send-event-types uids chsk-send!)
+             [:chsk/ws-ping]          () ; currently just do nothing with ping (no logging either)
+             :else                    (log/debug "Unmatched event:" (pp/pprint event))))))

 (defn send-loop
   "run loop, call chsk-send! with message on channel"
@@ -66,15 +64,13 @@
   (go-loop [] (let [msg (<! channel)
                     origin (:origin msg)]
                 (when-not (= msg :stop-loop)
-
                   (when-not (contains? @known-event-types origin)
                     (swap! known-event-types conj origin)
                     (send-event-types uids chsk-send!))
-
                   (doseq [uid (:any @uids)]
-                    (when (pos? (get @clients uid 0))
+                    (when (pos? (get-in @client-maps [uid origin] 0))
                       (chsk-send! uid [:info/msg (assoc msg :payload (with-out-str (pp/pprint (:payload msg))))])
-                      (swap! clients update-in [uid] dec)))
+                      (swap! client-maps update-in [uid origin] dec)))
                   (recur)))))

 (defrecord Matcher [inspect-chan inspect-fn chsk-router]


indenting

indenting

--- src/com/narkisr/celestial/puppet_standalone.clj
+++ src/com/narkisr/celestial/puppet_standalone.clj
@@ -17,38 +17,27 @@
     (try+
       (with-connection session (f session))
       (catch #(= (.getMessage %) "Auth fail") e
-        (throw+ {:type ::auth :host host} "Failed to login make sure to ssh-copy-id to the remote host"))
-      )))
+        (throw+ {:type ::auth :host host}
+                "Failed to login make sure to ssh-copy-id to the remote host")))))

 (defn put [host file dest]
   (with-session host
     (fn [session]
       (let [channel (ssh-sftp session)]
         (with-channel-connection channel
-          (sftp channel {} :put file dest)
-          )))))
+          (sftp channel {} :put file dest))))))

 (defn copy [server module]
   (put (:host server) (str (module :src) (module :name) ".tar.gz")  "/tmp"))

-#_(defn execute [{:keys [host]} & batch]
-  (with-session host
+(defn execute [{:keys [host]} & batches]
+  (with-session host
     (fn [session]
-      (with-connection session
-        (let [{:keys [out exit] :as result} (ssh session {:in  (join "\n" batch ) })]
-          (if (= exit 0)
-            (debug out)
-            (throw+ (assoc result :type ::exec) "Failed to execute remotly")))))))
-
-(defn execute [server & batches]
-  (let [agent (ssh-agent {}) session (session agent (server :host) {:username "root"}) ]
-    (with-connection session
       (doseq [b batches]
         (let [{:keys [exit out] :as res} (ssh session {:in  (join "\n" b) })]
           (if (= exit 0)
             (debug out)
-            (throw+ (merge res {:type ::provision-failed} (meta b)))
-            ))))))
+            (throw+ (merge res {:type ::provision-failed} (meta b)))))))))

 (defn step [n & steps] ^{:step n} steps)

@@ -59,9 +48,9 @@
     (use 'com.narkisr.celestial.core)
     (copy server module)
     (execute server
-       (step :extract "cd /tmp" (<< "tar -xzf ~(:name module).tar.gz"))
-       (step :run (<< "cd /tmp/~(:name module)") "./run.sh")
-       (step :cleanup "cd /tmp" (<< "rm -rf ~(:name module)*"))) ))
+             (step :extract "cd /tmp" (<< "tar -xzf ~(:name module).tar.gz"))
+             (step :run (<< "cd /tmp/~(:name module)") "./run.sh")
+             (step :cleanup "cd /tmp" (<< "rm -rf ~(:name module)*"))) ))

 #_(.apply-


reworked resolve-path to always return a PathList, reworked commands to more explicitly choose whether to work with possible multiple paths or only a single path

--- src/mapfs/core.clj
+++ src/mapfs/core.clj
@@ -65,6 +65,15 @@
 (defn regex?
   [r]
   (instance? java.util.regex.Pattern r))
+
+(defn- get-absolute-path
+  [path]
+  (reduce
+    #(case %2
+       :.. (pop %1)
+       :. %1
+       (conj %1 %2))
+    @CURRENT_DIR path))

 (defn- resolve-path
   [parts]
@@ -77,28 +86,36 @@
         (if (empty? ks)
           nil
           (PathList. (map #(conj base-path %) ks))))
-      (reduce #(case %2
-                 :.. (pop %1)
-                 :. %1
-                 (conj %1 %2))
-              @CURRENT_DIR p))))
+      (PathList. [(get-absolute-path p)]))))
+
+(defn- resolve-single-path
+  [parts]
+  (let [paths (resolve-path parts)
+        c (count (.paths paths))
+        p (first (.paths paths))]
+    (if (not= 1 c)
+      (throw (Exception. (str "Error: Multiple paths found"))))
+      p))

 (defn ls
   "List keys in current directory of filesystem, or given path."
   [& key-path]
   (let [p (resolve-path key-path)
-        values (if (pathlist? p)
-                 (sort (.paths p))
-                 (map #(conj p %) (sort (keys (get-in @FS_ROOT p)))))]
-  (->>
-    values
-    (map
-      #(let [v (get-in @FS_ROOT %)
-             k (last %)]
-         (if (is-dir? v)
-         (str "D " k)
-         (str "- " k))))
-    (str/join "\n"))))
+        paths (.paths p)
+        values
+        (if (= 1 (count paths))
+          (map #(conj (first paths) %)
+               (sort (keys (get-in @FS_ROOT (first paths)))))
+          (sort paths))]
+    (->>
+      values
+      (map
+        #(let [v (get-in @FS_ROOT %)
+               k (last %)]
+           (if (is-dir? v)
+             (str "D " k)
+             (str "- " k))))
+      (str/join "\n"))))

 (defn pwd
   "Print current working directory."
@@ -114,7 +131,7 @@
 (defn cd
   "Changes working directory to new path. Can use :.. as relative location, one up in path."
   [key-path]
-  (let [new-path (resolve-path key-path)]
+  (let [new-path (resolve-single-path key-path)]
     (when-not (keypath-exists? @FS_ROOT new-path)
       (throw (Exception. (str "Error: Keypath not found: " new-path))))
     (when-not (map? (get-in @FS_ROOT new-path))
@@ -123,36 +140,43 @@
     (str "Current path: " new-path)))

 (defn cp
-  "Copy value from [src path] to [dest path]. src and dest should be relative path vectors."
+  "Copy value from [src path] to [dest path]. src and dest should be
+  relative path vectors."
   [src dest]
   (let [src-path (resolve-path src)
-        dest-path (resolve-path dest)]
-    (swap! FS_ROOT assoc-in dest-path (get-in @FS_ROOT src-path))
-    (str "Copied value from " src-path " to " dest-path)))
+        dest-path (resolve-single-path dest)]
+    (->>
+      (.paths src-path)
+      (map
+        #(do
+           (swap! FS_ROOT assoc-in dest-path
+                  (get-in @FS_ROOT %))
+           (str "Copied value from " % " to " dest-path)))
+      (str/join "\n"))))

 (defn cat
   "Prints value of :key-name associated in current directory."
   [key-path]
-  (get-in @FS_ROOT
-          (resolve-path key-path)))
+  (let [p (resolve-single-path key-path)]
+    (get-in @FS_ROOT p)))

 (defn put
   "Associates a new value in current directory with key-name/value."
   [key-name value]
-  (let [path (resolve-path key-name)
-        existed (get-in @FS_ROOT path)]
-    (swap! FS_ROOT assoc-in (into @CURRENT_DIR [key-name]) value)
-    (if (nil? existed)
+  (let [path (resolve-single-path key-name)
+        existed (keypath-exists? @FS_ROOT path)]
+    (swap! FS_ROOT assoc-in path value)
+    (if existed
       (str "Added value for " key-name)
       (str "Updated value for key " key-name))))

 (defn rename
   "Rename file to path. Arguments should be [:src :key :path] [:dest :key :path]."
   [src dest]
-  (let [src-path (resolve-path src)
+  (let [src-path (resolve-single-path src)
         src-val (get-in @FS_ROOT src-path)
         [base f] (path-split src-path)
-        dest-path (resolve-path dest)]
+        dest-path (resolve-single-path dest)]
     (cp src-path dest-path)
     (if (zero? (count base))
       (swap! FS_ROOT dissoc f)
@@ -169,7 +193,7 @@
 (defn rmdir
   "Removes a directory"
   [key-name]
-  (let [path (resolve-path [key-name])
+  (let [path (resolve-single-path [key-name])
         v (get-in @FS_ROOT path)]
     (cond
       (nil? v)
@@ -183,10 +207,11 @@
       :else
       (str "Error: Path is not a directory: " path))))

+;; todo - switch to using pathlist
 (defn rm
   "Removes a value"
   [key-name]
-  (let [path (resolve-path [key-name])
+  (let [path (resolve-single-path [key-name])
         v (get-in @FS_ROOT path)]
     (cond
       (nil? v)


Better name generation with Elder Scrolls data

--- src/main/cljc/clojure_club/rpg_spec/mgrimm.cljc
+++ src/main/cljc/clojure_club/rpg_spec/mgrimm.cljc
@@ -5,6 +5,26 @@
     [clojure.core.reducers :as r]
     [clojure.spec.alpha :as s]
     [clojure.spec.gen.alpha :as g]))
+
+;; Elder Scrolls names ---------------------------------------------------------
+
+(def altmer   {:pre #{:Core :Corri :Cyre :Gan :Kala :Kelkemme :Lilland :Lovi :Mith :Saru :Sau :Soli}
+               :suf #{:dalf :las :lian :llon :man :mon :nar :ra :riil :ril :ron :tar}})
+(def argonian {:pre #{:Alex :Antigon :August :Calig :Claud :Demetr :Dioclet :German :Her :Jul :Ner :Pil :Tib}
+               :suf #{:acles :andros :ate :erius :ian :iar :icus :ides :ios :ius :os :ula :us}})
+(def bosmer   {:pre #{:An :Ara :Ar :Co :Elis :Karo :Lego :Li :Pali :Ria :Sil :Ta}
+               :suf #{:cher :dell :driel :gan :gorn :las :man :nis :nor :rim :tan :van}})
+(def breton   {:pre #{:Agr :Alab :And :Bed :Dun :Edw :Gond :Mord :Per :Rod :Theod :Trist :Uth}
+               :suf #{:ane :ard :astyr :istair :istyr :ore :oryan :yctor :yn :ynak :yrick :yval :ywyr}})
+(def dunmer   {:pre #{:Azar :Cas :Ereb :Hel :Nis :Shal :Shur :Tur :Ul :Vanik :Zan :Zir}
+               :suf #{:ain :ath :far :ien :ik :il :imal :imar :kan :on :par :seth}})
+(def khajiit  {:pre #{:Ab' :Ak' :Akh' :Am :Fa' :Hus :Mo :Moham :Moj :Na :Om :Sha :Sin :Za' :Zan'}
+               :suf #{:ar :bar :bil :der :dul :gh :ir :kir :med :nir :noud :sien :soud :taba :tabe :urabi}})
+(def nord     {:pre #{:Al :Asg :Bj :Er :Fenr :Har :Ingm :Jurg :Kj :Moj :Sor :Torb :Ulr}
+               :suf #{:ald :an :ar :arik :arke :arne :eld :en :ens :er :ik :is :orn}})
+(def names #{altmer argonian bosmer breton dunmer khajiit nord})
+
+;; -----------------------------------------------------------------------------

 (s/def ::1d6 (s/int-in 2 7))
 (s/def ::4d6 (s/tuple ::1d6 ::1d6 ::1d6 ::1d6))
@@ -19,15 +39,7 @@
 (s/def ::wis ::trait)
 (s/def ::con ::trait)
 (s/def ::traits (s/keys :req [::str ::dex ::int ::cha ::wis ::con]))
-
-(s/def ::name-prefix
-  (s/with-gen string? #(s/gen #{"bry" "cuth" "gor" "kal" "le" "mar" "men" "roc'" "tom" "war"})))
-(s/def ::name-suffix
-  (s/with-gen string? #(s/gen #{"ber" "eli" "-guth" "ginlaf" "ham" "mann" "mond" "roy" "son" "sung" "thel"})))
-(s/def ::name
-  (s/with-gen string?  #(s/gen (into #{} (map (comp string/capitalize str)
-                                              (g/sample (s/gen ::name-prefix) 100)
-                                              (g/sample (s/gen ::name-suffix) 100))))))
+(s/def ::name (s/with-gen string?  #(s/gen (into #{} (apply map str (vals (rand-nth (seq names))))))))

 (s/def ::gender #{:male :female})
 (s/def ::race #{:dwarf :elf :gnome :half-elf :half-orc :halfling :human})


Fix server<->client Unicode data issue on MS-Windows (#945)

Co-authored-by: ikappaki <28348cf8e7167611a09ffcf6c74327ce95f30181@users.noreply.github.com>

--- src/main/shadow/cljs/devtools/server/common.clj
+++ src/main/shadow/cljs/devtools/server/common.clj
@@ -41,7 +41,7 @@
       (fn [in]
         (let [r (transit/reader
                   (if (string? in)
-                    (ByteArrayInputStream. (.getBytes in))
+                    (ByteArrayInputStream. (.getBytes in "UTF-8"))
                     in)
                   :json)]
           (try
@@ -61,7 +61,7 @@
               w (transit/writer out :json)]
           (try
             (transit/write w data)
-            (.toString out)
+            (.toString out "UTF-8")
             (catch Exception e
               (log/warn-ex e ::transit-str-failed {:data data})
               (throw e))))))


Fixed an ArrayIndexOutOfBoundsException.

--- clojure/src/net/auxesia/population.clj
+++ clojure/src/net/auxesia/population.clj
@@ -73,12 +73,12 @@
 	elitism-size (int (Math/round (* (:elitism population) size)))
 	r-mutate (fn [x] (if (<= (rand) (:mutation population))
 			   (chromosome/mutate x)
-			     x))]
+			   x))]
     (loop [buffer (subvec chromosomes 0 elitism-size)
 	   idx (inc elitism-size)]
       (if (>= idx size)
 	(assoc population :population
-	       (sort-by (fn [x] (:fitness x)) (subvec buffer 0 size)))
+	       (vec (sort-by (fn [x] (:fitness x)) (take size buffer))))
 	(if (<= (rand) (:crossover population))
 	  ;; Perform a crossover
 	  (let [c1 (tournament-selection chromosomes)
@@ -86,5 +86,5 @@
 	    (recur (into buffer (map #(r-mutate %) (chromosome/mate c1 c2)))
 		   (inc (inc idx))))
 	  ;; Perform a straight copy with mutation
-	  (recur (conj buffer (r-mutate (nth chromosomes idx)))
+	  (recur (conj buffer (r-mutate (get chromosomes idx)))
 		 (inc idx)))))))


Comment out prn for production build

Comment out prn for production build

--- src/re_natal_esp32control_app/android/core.cljs
+++ src/re_natal_esp32control_app/android/core.cljs
@@ -27,13 +27,13 @@
   (.alert (.-Alert ReactNative) title))

 (defn handle-discovered-peripheral [data]
-  (prn :discovered data)
+  #_(prn :discovered data)
   (dispatch [:add-device (js->clj data :keywordize-keys true)]))

 (defn ble-scan []
   (-> (.scan BleManager (clj->js []) 5 true)
       (.then (fn []
-               (prn :finished-scan)))))
+               #_(prn :finished-scan)))))

 (defn device-button [device]
   [touchable-highlight
@@ -114,7 +114,7 @@
       :component-will-mount #(-> (.connect BleManager (:id @current-device))
                                  (.then (fn [peri-info]
                                           (reset! connected? true)
-                                          (prn :peri-info peri-info))))
+                                          #_(prn :peri-info peri-info))))
       :component-will-unmount #(.disconnect BleManager (:id @current-device))})))

 (defn top-page []


fix typo in catch argument

fix typo in catch argument

--- src/lt/objs/eval.cljs
+++ src/lt/objs/eval.cljs
@@ -146,7 +146,7 @@
     (reader/read-string r)
     (catch js/Error e
       r)
-    (catch js/globa.Error e
+    (catch js/global.Error e
       r)))

 ;;****************************************************


Remove debugging println.

Remove debugging println.

--- test/onyx/plugin/input_fault_tolerance_test.clj
+++ test/onyx/plugin/input_fault_tolerance_test.clj
@@ -112,11 +112,6 @@
              (onyx.api/submit-job peer-config)
              :job-id
              (onyx.test-helper/feedback-exception! peer-config))
-
-        (println "DIFF" (sort (clojure.set/difference
-                         (set (sort (map :user/name people)))
-                         (set (sort (mapcat #(apply concat %) (map :names @test-state))))
-                         )))

         (is (= (sort (mapcat #(apply concat %) (map :names @test-state)))
                (sort (map :user/name people)))))


docstring

docstring

--- src/mireact/core.cljs
+++ src/mireact/core.cljs
@@ -49,8 +49,7 @@
   (apply transact! c update k f args))

 (defn set!
-  "Asynchronously set the components state to newval, at k if
-  provided."
+  "Set the components state to newval, at k if provided."
   ([c newval]
    (.setState c (js-obj state-key newval)))
   ([c k newval]


Fix typo gardient -> gradient

Fix typo gardient -> gradient

--- cortex/test/cljc/cortex/util_test.cljc
+++ cortex/test/cljc/cortex/util_test.cljc
@@ -29,5 +29,5 @@
   (is (not (converges? (range 10) 15)))
   (is (converges? (range 10) 15 {:tolerance 10})))

-(deftest test-mse-gardient
+(deftest test-mse-gradient
   (is (m/equals [-2 0 2] (mse-gradient-fn [10 11 12] [11 11 11]))))


do static-fns optimization for cljs

do static-fns optimization for cljs

--- repl.clj
+++ repl.clj
@@ -8,4 +8,5 @@

 (cljs.repl/repl (cljs.repl.node/repl-env)
   :watch "src"
-  :output-dir "out")
+  :output-dir "out"
+  :static-fns true)


explicitly exit when done

explicitly exit when done

--- src/riffmuse/core.clj
+++ src/riffmuse/core.clj
@@ -91,4 +91,5 @@
                   (println header)
                   (println riff-output))
                 (catch IllegalArgumentException e
-                  (println invalid-scale)))))))
+                  (println invalid-scale)))))
+    (System/exit 0)))


Test serialization with some of the important guts inline in the test.

--- clj_record/test/serialization_test.clj
+++ clj_record/test/serialization_test.clj
@@ -24,12 +24,11 @@

 (defdbtest serialized-attributes-support-common-clojure-types
   (restoring-ref (manufacturer/model-metadata)
-    ;(callbacks/add-callback "manufacturer" :before-save (callb/transform-value :name serialization/serialize))
-    ;(callbacks/add-callback "manufacturer" :after-load (callb/transform-value :name serialization/deserialize))
+    (callbacks/add-callback "manufacturer" :before-save (callb/transform-value :name serialization/serialize))
+    (callbacks/add-callback "manufacturer" :after-load (callb/transform-value :name serialization/deserialize))
     (let [record (manufacturer/create valid-manufacturer)]
       (are (=
         (do (manufacturer/update (assoc record :name _1)) _1)
         ((manufacturer/get-record (record :id)) :name))
-        "some string" ; Cheating? This passes without serialization implemented.
-        ;23
-        ))))
+        "some string"
+        23))))


fix db request

fix db request

--- datomic-dsl/src/datomic_dsl/create.clj
+++ datomic-dsl/src/datomic_dsl/create.clj
@@ -3,16 +3,14 @@
    [datomic.api :as d]))

 (defn create-schema
-  "Given a schema name and some schema attribute key-value pairs,
-  create an insertable dotomic schema."
+  "Given a schema name and some schema attribute key-value pairs, create an insertable datomic schema."
   [schema-name & attributes]
   (let [fields (apply hash-map attributes)]
     (mapcat (fn [[attribute-name attribute-type]]
               [{:db/id (d/tempid :db.part/db)
                 :db/ident (keyword schema-name attribute-name)
                 :db/valueType (keyword "db.type" attribute-type)
-                :db/carfinality :db.cardiability/one
+                :db/cardinality :db.cardinality/one
                 :db/doc (str "A " schema-name "'s " attribute-name)
-                :db/install/_attribute :db.part/db}])
+                :db.install/_attribute :db.part/db}])
             fields)))
-


add `opts` to `known-variables` params, to parity w/ `render` (#279)

--- src/selmer/parser.clj
+++ src/selmer/parser.clj
@@ -404,8 +404,9 @@
                  (rest tags)))
         vars))))

-(defn known-variables [input]
-  (->> (parse parse-input (java.io.StringReader. input) {})
+(defn known-variables [input & [opts]]
+  (->> (or opts {})
+       (parse parse-input (java.io.StringReader. input))
        meta
        :all-tags
        parse-variables))


formatting

formatting

--- src/selmer/parser.clj
+++ src/selmer/parser.clj
@@ -224,13 +224,13 @@
             *filter-open*  filter-open
             *filter-close* filter-close
             *tag-second*   tag-second
-            *tag-second-pattern* (pattern tag-second)
-            *filter-open-pattern* (pattern "\\" tag-open "\\" filter-open "\\s*")
+            *tag-second-pattern*   (pattern tag-second)
+            *filter-open-pattern*  (pattern "\\" tag-open "\\" filter-open "\\s*")
             *filter-close-pattern* (pattern "\\s*\\" filter-close "\\" tag-close)
-            *filter-pattern* (pattern "\\" tag-open "\\" filter-open "\\s*.*\\s*\\" filter-close "\\" tag-close)
-            *include-pattern* (pattern "\\" tag-open "\\" tag-second "\\s*include.*")
-            *extends-pattern* (pattern "\\" tag-open "\\" tag-second "\\s*extends.*")
-            *block-pattern* (pattern "\\" tag-open "\\" tag-second "\\s*block.*")
-            *block-super-pattern* (pattern "\\" tag-open "\\" filter-open "\\s*block.super\\s*\\" filter-close "\\" tag-close)
-            *endblock-pattern* (pattern "\\" tag-open "\\" tag-second "\\s*endblock.*")]
+            *filter-pattern*       (pattern "\\" tag-open "\\" filter-open "\\s*.*\\s*\\" filter-close "\\" tag-close)
+            *include-pattern*      (pattern "\\" tag-open "\\" tag-second "\\s*include.*")
+            *extends-pattern*      (pattern "\\" tag-open "\\" tag-second "\\s*extends.*")
+            *block-pattern*        (pattern "\\" tag-open "\\" tag-second "\\s*block.*")
+            *block-super-pattern*  (pattern "\\" tag-open "\\" filter-open "\\s*block.super\\s*\\" filter-close "\\" tag-close)
+            *endblock-pattern*     (pattern "\\" tag-open "\\" tag-second "\\s*endblock.*")]
     (parse-fn input params)))


Fix bug that fails to pass resolved :kind to s/every-impl

--- src/specium/core.cljc
+++ src/specium/core.cljc
@@ -95,12 +95,14 @@
   (let [desc (or (::s/describe opts)
                  `(s/every ~pred
                            ~@(c/into [] (comp (remove #(= (key %) ::s/describe))
-                                             cat)
+                                              cat)
                                     opts)))
+        resolved-kind (some-> kind resolve*)
         nopts (-> opts
                   (dissoc :gen ::s/describe)
-                  (assoc ::s/kind-form kind ::s/describe desc))
-        cpreds (cond-> [(or (some-> kind resolve*) coll?)]
+                  (assoc :kind resolved-kind ::s/kind-form kind
+                         ::s/describe desc))
+        cpreds (cond-> [(or resolved-kind coll?)]
                  count (conj #(= count (bounded-count count %)))

                  (or min-count max-count)


Bug fixes caused by change from dates to maps

--- src/tick/schedule.clj
+++ src/tick/schedule.clj
@@ -6,11 +6,11 @@

 (defn schedule-next [next-time {:keys [clock executor callback]}]
   (when next-time
-    (let [dly (.until (.instant clock) next-time ChronoUnit/MILLIS)]
+    (let [dly (.until (.instant clock) (:tick/date next-time) ChronoUnit/MILLIS)]
       (.schedule executor ^Callable callback dly TimeUnit/MILLISECONDS))))

 (defn callback [state timeline {:keys [clock trigger executor promise] :as opts}]
-  (let [[due next-timeline] (split-with #(not (.isAfter (.toInstant %) (.instant clock))) timeline)]
+  (let [[due next-timeline] (split-with #(not (.isAfter (.toInstant (:tick/date %)) (.instant clock))) timeline)]

     (if-not (empty? next-timeline)
       ;; Schedule next
@@ -112,14 +112,14 @@
      ^Runnable
      (fn []
        (loop [timeline timeline]
-         (when-let [t (first timeline)]
+         (when-let [tick (first timeline)]
            (when (= (:status @state) :running)
              ;; Advance clock
              (swap! state assoc
-                    :clock (Clock/fixed (.toInstant t) (.getZone clock))
+                    :clock (Clock/fixed (.toInstant (:tick/date tick)) (.getZone clock))
                     :timeline (next timeline))
              ;; Call trigger
-             (trigger t)
+             (trigger tick)
              (recur (next timeline))))))))

   (pause [this] :unsupported)


always performing `use keyspace'

always performing `use keyspace'

--- src/clojure/src/leela/blackbox/storage/cassandra.clj
+++ src/clojure/src/leela/blackbox/storage/cassandra.clj
@@ -29,8 +29,8 @@
     (if-not (describe-keyspace session keyspace)
       (do (when-not creat (throw (IllegalArgumentException. "refusing to re-create keyspace")))
           (create-leela-keyspace session keyspace))
-      (do (when creat (throw (IllegalArgumentException. "refusing to create keyspace [creat flag is false]")))
-          (use-keyspace session keyspace)))
+      (when creat (throw (IllegalArgumentException. "refusing to create keyspace [creat flag is false]"))))
+    (use-keyspace session keyspace)
     session))

 (defmacro with-consistency [tag & body]


Fixing implementation of Ryssels Algorithm

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

--- src/conexp/contrib/experimental/ryssel_algorithm.clj
+++ src/conexp/contrib/experimental/ryssel_algorithm.clj
@@ -15,27 +15,42 @@

 ;;;

-(defn- minimal-covers [base-set sets]
-  (let [covers (if (subset? base-set (reduce union sets))
-                 [sets]
-                 [])]
+(defn- covers? [base-set sets]
+  (subset? base-set (reduce union sets)))
+
+(defn- minimum-covers [base-set sets]
+  (let [covers (if (covers? base-set sets)
+                 #{sets}
+                 #{})]
     (loop [covers         covers,
-           minimal-covers []]
+           minimum-covers #{}]
       (if (empty? covers)
-        minimal-covers
+        minimum-covers
         (let [next-cover     (first covers),
-              smaller-covers (filter #(subset? base-set (reduce union %))
+              smaller-covers (filter #(covers? base-set %)
                                      (map #(disj next-cover %) next-cover))]
           (if (not-empty smaller-covers)
-            (recur (concat smaller-covers (rest covers))
-                   minimal-covers)
-            (recur (rest covers)
-                   (conj minimal-covers next-cover))))))))
+            (recur (into (disj covers next-cover)
+                         smaller-covers)
+                   minimum-covers)
+            (let [covers (disj covers next-cover),
+                  covers (set (mapcat #(if (subset? next-cover %)
+                                         (filter (fn [X]
+                                                   (covers? base-set X))
+                                                 (map (fn [x] (disj % x))
+                                                      next-cover))
+                                         (list %))
+                                      covers))]
+              (recur covers
+                     (conj minimum-covers next-cover)))))))))

-(defn- cover [base-set candidates m extent]
-  (minimal-covers (difference base-set (extent m))
-                  (map #(difference base-set (extent %))
-                       candidates)))
+(defn- cover [ctx candidates m]
+  (let [base-set      (objects ctx),
+        object-covers (minimum-covers (difference base-set (attribute-derivation ctx #{m}))
+                                      (set-of (difference base-set (attribute-derivation ctx #{n}))
+                                              [n candidates]))]
+    (map #(apply union (map (fn [X] (object-derivation ctx (difference base-set X))) %))
+         object-covers)))

 (defn ryssel-base
   "Returns the set of implications computed by Ryssels Algorithm."
@@ -60,7 +75,7 @@
                                                       (proper-subset? (attribute-extent p)
                                                                       (attribute-extent m)))))]),
               candidates   (disj candidates (attribute-extent m)),
-              covers       (cover (objects ctx) candidates m attribute-extent),
+              covers       (cover ctx candidates m),
               implications (union implications
                                   (set-of (make-implication X #{m})
                                           [X covers


Remove per-resource metrics

Remove per-resource metrics

--- src/tyranitar/web.clj
+++ src/tyranitar/web.clj
@@ -15,8 +15,6 @@
             [clojure.tools.logging :refer [info warn error]]
             [environ.core :refer [env]]
             [nokia.ring-utils.error :refer [wrap-error-handling error-response]]
-            [nokia.ring-utils.metrics :refer [wrap-per-resource-metrics replace-outside-app
-                                              replace-guid replace-mongoid replace-number]]
             [nokia.ring-utils.ignore-trailing-slash :refer [wrap-ignore-trailing-slash]]
             [metrics.ring.expose :refer [expose-metrics-as-json]]
             [metrics.ring.instrument :refer [instrument]]
@@ -145,5 +143,4 @@
       (wrap-keyword-params)
       (wrap-params)
       (wrap-json-response)
-      (wrap-per-resource-metrics [replace-guid replace-mongoid replace-number (replace-outside-app "/1.x")])
       (expose-metrics-as-json)))


Avoid use of magic numbers

Avoid use of magic numbers

--- src/whitman/utils.clj
+++ src/whitman/utils.clj
@@ -5,6 +5,8 @@
                       Date
                       GregorianCalendar
                       TimeZone]))
+
+(def seconds-in-hour (* 60 60))

 (def version
   (if (.exists (io/as-file "project.clj"))
@@ -32,4 +34,4 @@
   (let [mn (midnight dt)
         mnsec (seconds-since-epoch mn)
         dtsec (seconds-since-epoch dt)]
-    (quot (- dtsec mnsec) (* 60 60))))
+    (quot (- dtsec mnsec) seconds-in-hour)))


Use of class without require (#280)

Use of class without require (#280)

--- src/yada/resource.clj
+++ src/yada/resource.clj
@@ -8,7 +8,9 @@
    [yada.charset :as charset]
    [yada.context :refer [content-type]]
    [yada.schema :as ys]
-   [yada.util :refer [arity]])
+   [yada.util :refer [arity]]
+   [yada.media-type]
+   [manifold.stream.core])
   (:import java.util.Date
            yada.charset.CharsetMap
            yada.media_type.MediaTypeMap


dirty hack to make the asynchronous git-test more stable. was making another commit before checking actually started (which was the scenario we wanted to test...

--- test/lambdacd/git_test.clj
+++ test/lambdacd/git_test.clj
@@ -49,7 +49,9 @@
   (testing "that is polls the git repository until a version that is different from the current one is found"
     (let [create-output (create-test-repo)
           git-src-dir (:dir create-output)
-          wait-channel (async/go (wait-for-git (repo-uri-for git-src-dir) "master"))
+          wait-channel (let [ch (async/go (wait-for-git (repo-uri-for git-src-dir) "master"))]
+                         (Thread/sleep 500) ;; dirty hack to make sure we started waiting before making the next commit
+                         ch)
           new-commit-hash (commit-to git-src-dir)
           wait-result  (get-value-or-timeout-from wait-channel)]
       (is (= new-commit-hash (:current-revision wait-result)))


Update version of project

Update version of project

--- ssclj/jar/project.clj
+++ ssclj/jar/project.clj
@@ -1,4 +1,4 @@
-(defproject com.sixsq.slipstream/ssclj "3.1-SNAPSHOT"
+(defproject com.sixsq.slipstream/ssclj "3.2-SNAPSHOT"
   :description    "Clojure REST resources"
   :url            "http://sixsq.com"
   :license {:name "Apache License, Version 2.0"


fix typo

fix typo

--- src/pc/views/blog/ideas_are_made_with_precursor.clj
+++ src/pc/views/blog/ideas_are_made_with_precursor.clj
@@ -74,7 +74,7 @@

     [:article
      [:h3 "Iteration is important."]
-     [:p  "Without watching Justin build this prototype, it's hard to tell how many iterations we through. "
+     [:p  "Without watching Justin build this prototype, it's hard to tell how many iterations he went through. "
           "Too many can be just as dangerous as too few, but I think this strikes a good balance. "]]
     [:figure (common/card "jyo208" "17592197310592?cx=584&cy=581&z=0.55&replay=true")]


(PE-5433) Removed test for verifying environment

--- test/puppetlabs/services/master/master_core_test.clj
+++ test/puppetlabs/services/master/master_core_test.clj
@@ -4,8 +4,7 @@
             [ring.mock.request :as mock]))

 (deftest test-master-routes
-  (let [handler     (fn ([req] {:request req})
-                        ([env req] {:request req :environment env}))
+  (let [handler     (fn ([req] {:request req}))
         app         (compojure-app handler)
         request     (fn r ([path] (r :get path))
                           ([method path] (app (mock/request method path))))]
@@ -33,9 +32,4 @@
             (str "Did not get 200 for method: "
                  method
                  ", path: "
-                 path))
-        (is (= "foo" (:environment resp))
-            (str "Did not get expected response for method: "
-                 method
-                 ", path: "
                  path))))))


CMR-5060 Cleanup.

CMR-5060 Cleanup.

--- umm-spec-lib/src/cmr/umm_spec/umm_g/data_granule.clj
+++ umm-spec-lib/src/cmr/umm_spec/umm_g/data_granule.clj
@@ -3,7 +3,8 @@
    DataGranule and generating UMM-G JSON DataGranule from umm-lib granule model DataGranule."
   (:require
    [cmr.umm.umm-granule :as g]
-   [clojure.string :as string])
+   [clojure.string :as string]
+   [cmr.umm-spec.util :as util])
   (:import cmr.umm.umm_granule.UmmGranule))

 (defn umm-g-data-granule->DataGranule
@@ -30,6 +31,6 @@
                       [{:Identifier producer-gran-id
                         :IdentifierType "ProducerGranuleId"}])
        :ProductionDateTime production-date-time
-       :ArchiveAndDistributionInformation [{:Name "Not provided"
+       :ArchiveAndDistributionInformation [{:Name util/not-provided
                                             :Size size
-                                            :SizeUnit "MB"}]})))
+                                            :SizeUnit "NA"}]})))


added design spike for checking sine function

--- test/simple_symbolic_regression_clojure/gp_test.clj
+++ test/simple_symbolic_regression_clojure/gp_test.clj
@@ -44,9 +44,9 @@

 (fact "random-token produces a random token, including ERCs if told to"
     (random-token [1]) => 1
-    (into #{} (repeatedly 100 #(random-token [1 2 3 4]))) => #{1 2 3 4}
-    (into #{} (repeatedly 100 #(random-token ['(rand-int 5)]))) => #{0 1 2 3 4}
-    (into #{} (repeatedly 100 #(random-token [:x :+ '(rand-int 5)]))) => #{0 1 2 3 4 :x :+}
+    (into #{} (repeatedly 1000 #(random-token [1 2 3 4]))) => #{1 2 3 4}
+    (into #{} (repeatedly 1000 #(random-token ['(rand-int 5)]))) => #{0 1 2 3 4}
+    (into #{} (repeatedly 1000 #(random-token [:x :+ '(rand-int 5)]))) => #{0 1 2 3 4 :x :+}
   )

 (fact "random-token returns nil when passed an empty collection"
@@ -177,3 +177,19 @@
   ))

+;; Populations & Search
+
+;; y=sin(x)
+;; population of ~1000
+;; training cases: ~100
+;; initial size: ~20
+;; mutation + crossover
+
+(fact "we can calculate a sin(x)"
+  (Math/sin 0.0) => 0.0
+  (Math/sin (/ Math/PI 2)) => 1.0
+  (Math/sin Math/PI) => (roughly 0.0 0.001)
+  )
+
+(fact "it happens"
+  )


read up through 10.5 Locks

read up through 10.5 Locks

--- src/joy/ch10.clj
+++ src/joy/ch10.clj
@@ -1,5 +1,8 @@
 (ns joy.ch10
-  (:import java.util.concurrent.Executors))
+  (:refer-clojure :exclude [aget aset count seq])
+  (:require [clojure.core :as clj])
+  (:import  [java.util.concurrent.Executors]
+            [java.util.concurrent.locks.ReentrantLock]))

 (def thread-pool (Executors/newFixedThreadPool
                   (+ 2 (.availableProcessors
@@ -167,3 +170,113 @@
 (set-error-handler! log-agent handle-log-error)

 (set-error-mode! log-agent :continue)
+
+;; 10.4
+(def ^:dynamic *time* (atom 0))
+(defn tick [] (swap! *time* inc))
+(dothreads! tick :threads 1000 :times 100)
+@*time*
+
+(defn manipulable-memoize [function]
+  (let [cache (atom {})]
+    (with-meta
+      (fn [& args]
+        (or (second (find @cache args))
+            (let [ret (apply function args)]
+              (swap! cache assoc args ret)
+              ret)))
+      {:cache cache})))
+
+;; find returns a key value pair, if exits
+(find {:a 1 :b 2} :a) ;; => [:a 1]
+(find {:a 1 :b 2} :c) ;; => nil
+
+(def slowly (fn [x] (Thread/sleep 1000) x))
+
+(time [(slowly 9) (slowly 9)])
+
+(def sometimes-slowly (manipulable-memoize slowly))
+
+(time [(sometimes-slowly 108) (sometimes-slowly 108)])
+
+(meta sometimes-slowly)
+(let [cache (:cache (meta sometimes-slowly))]
+  (swap! cache dissoc '(108)))
+
+;; 10.5 Locks
+(defprotocol SafeArray
+  (aset [this i f])
+  (aget [this i])
+  (count [this])
+  (seq [this]))
+
+(defn make-dumb-array [t sz]
+  (let [a (make-array t sz)]
+    (reify
+      SafeArray
+      (count [_] (clj/count a))
+      (seq [_] (clj/seq a))
+      (aget [_ i] (clj/aget a i))
+      (aset [this i f]
+        (clj/aset a
+                  i
+                  (f (aget this i)))))))
+
+(defn pummel [a]
+  (dothreads! #(dotimes [i (count a)] (aset a i inc))
+              :threads 100))
+
+(def D (make-dumb-array Integer/TYPE 8))
+
+(pummel D)
+
+(seq D)
+
+(defn make-safe-array [t sz]
+  (let [a (make-array t sz)]
+    (reify
+      SafeArray
+      (count [_] (clj/count a))
+      (seq [_] (clj/seq a))
+      (aget [_ i]
+        (locking a
+          (clj/aget a i)))
+      (aset [this i f]
+        (locking a
+          (clj/aset a
+                    i
+                    (f (aget this i))))))))
+
+(def A (make-safe-array Integer/TYPE 8))
+
+(pummel A)
+
+(seq A)
+
+(defn lock-i [target-index num-locks]
+  (mod target-index num-locks))
+
+;; not sure why it can't find reentrantlock, it doesn't have trouble with the import statement
+#_(defn make-smart-array [t sz]
+  (let [a (make-array t sz)
+        Lsz (/ sz 2)
+        L (into-array (take Lsz
+                            (repeatedly #(ReentrantLock.))))]
+    (reify
+      SafeArray
+      (count [_] (clj/count a))
+      (seq [_] (clj/seq a))
+      (aget [_ i]
+        (let [lk (clj/aget L (lock-i (inc i) Lsz))]
+          (.lock lk)
+          (try
+            (clj/aget a i)
+            (finally (.unlock lk)))))
+      (aset [this i f]
+        (let [lk (clj/aget L (lock-i (inc i) Lsz))]
+          (.lock lk)
+          (try
+            (clj/aset a
+                      i
+                      (f (aget this i)))
+            (finally (.unlock lk))))))))


-- pass arguments correctly to exception->response (#144)

--- waiter/src/waiter/core.clj
+++ waiter/src/waiter/core.clj
@@ -831,7 +831,7 @@
                                 (async/tap state-chan-mult state-chan)
                                 (state/start-service-chan-maintainer
                                   {} instance-rpc-chan state-chan query-app-maintainer-chan start-service remove-service retrieve-channel)))
-   :state-query-chans (pc/fnk [[:state query-app-maintainer-chan scheduler]
+   :state-query-chans (pc/fnk [[:state query-app-maintainer-chan]
                                autoscaler autoscaling-multiplexer gc-for-transient-metrics scheduler-broken-services-gc scheduler-maintainer scheduler-services-gc]
                         {:app-maintainer-state query-app-maintainer-chan
                          :autoscaler-state (:query autoscaler)
@@ -890,7 +890,7 @@
                                     (try
                                       (cors/preflight-handler cors-validator max-age request)
                                       (catch Exception e
-                                        (utils/exception->response request "Error in CORS pre-flight handler" e))))))
+                                        (utils/exception->response (ex-info "Error in CORS pre-flight handler" {} e) request))))))
    :default-websocket-handler-fn (pc/fnk [[:routines determine-priority-fn prepend-waiter-url request->descriptor-fn service-id->password-fn start-new-service-fn]
                                           [:settings instance-request-properties]
                                           [:state instance-rpc-chan passwords router-id websocket-client]]


improves header value assertion messages (#815)

--- waiter/integration/waiter/content_encoding_test.clj
+++ waiter/integration/waiter/content_encoding_test.clj
@@ -39,11 +39,11 @@
                             :x-kitchen-fail-after fail-after-size)
               {:keys [headers] :as response} (make-request waiter-url "/gzip" :headers req-headers)]
           (assert-response-status response 200)
-          (is (= (get headers "content-type") "text/plain"))
-          (is (= (get headers "content-encoding") "gzip"))
-          ;; ideally (is (= (get headers "Transfer-Encoding") "chunked"))
-          (is (nil? (get headers "Content-Length")))
-          (is (not (nil? (get headers "x-cid"))))
+          (is (= (get headers "content-type") "text/plain") (str headers))
+          (is (= (get headers "content-encoding") "gzip") (str headers))
+          ;; ideally (is (= (get headers "transfer-encoding") "chunked") (str headers))
+          (is (nil? (get headers "content-length")) (str headers))
+          (is (not (nil? (get headers "x-cid"))) (str headers))
           (let [{:keys [body] :as response}
                 (make-request waiter-url "/gzip" :headers req-headers :decompress-body true :verbose true)
                 body-length (count (bytes (byte-array (map (comp byte int) (str body)))))]
@@ -87,11 +87,11 @@
                             :x-kitchen-fail-after fail-after-size)
               {:keys [headers] :as response} (make-request waiter-url "/gzip" :headers req-headers :verbose true)]
           (assert-response-status response 200)
-          (is (= (get headers "content-type") "text/plain"))
-          (is (= (get headers "content-encoding") "gzip"))
-          (is (nil? (get headers "Transfer-Encoding")))
-          (is (not (nil? (get headers "content-length"))))
-          (is (not (nil? (get headers "x-cid"))))
+          (is (= (get headers "content-type") "text/plain") (str headers))
+          (is (= (get headers "content-encoding") "gzip") (str headers))
+          (is (nil? (get headers "transfer-encoding")) (str headers))
+          (is (not (nil? (get headers "content-length"))) (str headers))
+          (is (not (nil? (get headers "x-cid"))) (str headers))
           (let [{:keys [body] :as response}
                 (make-request waiter-url "/gzip" :headers req-headers :decompress-body true :verbose true)
                 body-length (count (bytes (byte-array (map (comp byte int) (str body)))))]
@@ -132,10 +132,10 @@
               body-length (count (bytes (byte-array (map (comp byte int) (str body)))))]
           (assert-response-status response 200)
           (is (== 100000 body-length))
-          (is (= (get headers "content-type") "text/plain"))
-          (is (nil? (get headers "Content-Encoding")))
-          (is (nil? (get headers "Content-Length")))
-          (is (not (nil? (get headers "x-cid")))))
+          (is (= (get headers "content-type") "text/plain") (str headers))
+          (is (nil? (get headers "content-encoding")) (str headers))
+          (is (nil? (get headers "content-length")) (str headers))
+          (is (not (nil? (get headers "x-cid"))) (str headers)))
         (finally
           (delete-service waiter-url service-id))))))

@@ -152,10 +152,10 @@
               body-length (count (bytes (byte-array (map (comp byte int) (str body)))))]
           (assert-response-status response 200)
           (is (< body-length 100000))
-          (is (= (get headers "content-type") "text/plain"))
-          (is (nil? (get headers "Content-Encoding")))
-          (is (nil? (get headers "Content-Length")))
-          (is (not (nil? (get headers "x-cid")))))
+          (is (= (get headers "content-type") "text/plain") (str headers))
+          (is (nil? (get headers "content-encoding")) (str headers))
+          (is (nil? (get headers "content-length")) (str headers))
+          (is (not (nil? (get headers "x-cid"))) (str headers)))
         (finally
           (delete-service waiter-url service-id))))))

@@ -173,7 +173,7 @@
           (assert-response-status response 200)
           (is (== 100000 body-length))
           (is (= (get headers "content-type") "text/plain") (str headers))
-          (is (nil? (get headers "Content-Encoding")) (str headers))
+          (is (nil? (get headers "content-encoding")) (str headers))
           ;; TODO flaky: this is sometimes missing (is (not (nil? (get headers "content-length"))) (str headers))
           (is (not (nil? (get headers "x-cid"))) (str headers)))
         (finally


misc(frontend): cosmetic change on repo impl ns

--- frontend/src/uxbox/main/repo/impl.cljs
+++ frontend/src/uxbox/main/repo/impl.cljs
@@ -39,7 +39,7 @@
 (defn send!
   [{:keys [body headers auth method query url response-type]
     :or {auth true response-type :text}}]
-  (let [headers (merge {"accept" "application/transit+json,*/*"}
+  (let [headers (merge {"Accept" "application/transit+json,*/*"}
                        (when (map? body) +headers+)
                        headers)
         request {:method method


add command-line option for bash/ksh function output

--- src/nml/core.clj
+++ src/nml/core.clj
@@ -4,18 +4,48 @@
   (:require [clojure.tools.cli :as cli   ])
   (:gen-class))

-(declare nml-get nml-name nml-parse nml-set nml-str nml-uniq)
+(declare nml-get nml-name nml-parse nml-set nml-str nml-uniq strmap)
+
+;; formatting
+
+(defn- fmt-bash [m & a]
+  (let [fname (or (first a) "nmlquery")
+        ms    (sort m)
+        eq   #(string/replace % "\"" "\\\"")
+        f0    (fn [[dataref values]]
+                (let [v (eq values)]
+                  (str "'" dataref "') echo \"" v "\";;")))
+        f1    (fn [[name nvseq]]
+                (let [x (strmap f0 nvseq)]
+                  (str "'" name "') case \"$2\" in " x "*) echo '';;esac;;" )))]
+    (str fname "(){ case \"$1\" in " (strmap f1 ms) "*) echo '';;esac; }\n")))
+
+(defn- fmt-ksh [m]
+  (fmt-bash m))
+
+(defn- fmt-namelist [m]
+  (let [f0 (fn [[dataref values]]
+             (str "  " dataref "=" values "\n"))
+        f1 (fn [[name nvseq]]
+             (str "&" name "\n" (strmap f0 (sort nvseq)) "/\n"))]
+    (strmap f1 (sort m))))

 ;; defs

+(def formats
+  {"bash"     fmt-bash
+   "ksh"      fmt-ksh
+   "namelist" fmt-namelist})
+
 (def msgs
-  {
+  {:bad-format    "Bad output format."
    :create+in     "-i/--in not valid with -c/--create."
    :get+set       "-g/--get and -s/--set may not be mixed."
+   :multi-format  "-f/--format may be specified only once."
    :multi-in      "-i/--in may be specified only once."
    :multi-out     "-o/--out may be specified only once."
-   :set+no-prefix "-n/--no-prefix not valid with -s/--set."
-   })
+   :set+no-prefix "-n/--no-prefix not valid with -s/--set."})
+

 (def parse (insta/parser (clojure.java.io/resource "grammar")))

@@ -38,15 +68,10 @@
   (apply str (map f coll)))

 (defn- usage [summary]
-  (doseq [x [""
-             "Usage: nml [options]"
-             ""
-             "Options:"
-             ""
-             summary
-             ""]]
-    (println x))
-  (System/exit 0))
+  (let [f (str "Valid output formats are: " (string/join ", " (keys formats)))]
+    (doseq [x ["\nUsage: nml [options]\n\nOptions:\n" summary "" f ""]]
+      (println x))
+    (System/exit 0)))

 ;; nml private defns

@@ -133,7 +158,7 @@
   (let [tree  (nml-parse s :s)
         child :nvseq
         f     (fn [& v] (into [child] (nml-uniq v)))]
-      (insta/transform {child f} tree)))
+    (insta/transform {child f} tree)))

 (defn- nml-uniq [values]
   (loop [head (first values) tail (rest values) tree []]
@@ -162,6 +187,10 @@

 ;; cli

+(defn- assoc-f [m k v]
+  (if (k m) (fail (msgs :multi-format)))
+  (assoc m k v))
+
 (defn- assoc-g [m k v]
   (let [gets (:get m [])]
     (assoc m :get (into gets [v]))))
@@ -178,50 +207,34 @@
   (let [sets (:set m [])]
     (assoc m :set (into sets [v]))))

-(defn- parse-get [x]
+(defn- parse-f [x]
+  (if-not (contains? formats x) (fail (msgs :bad-format)))
+  x)
+
+(defn- parse-g [x]
   (string/split x #":" 2))

-(defn- parse-set [x]
+(defn- parse-s [x]
   (let [[nml+key val] (string/split x #"=" 2)
-        [nml key] (parse-get nml+key)]
+        [nml key] (parse-g nml+key)]
     [nml key val]))

 (def cliopts
-  [["-c" "--create"    "Create new namelist"                                                                ]
-   ["-g" "--get n:k"   "Get value of key 'k' in namelist 'n'"         :assoc-fn assoc-g :parse-fn parse-get ]
-   ["-h" "--help"      "Show usage information"                                                             ]
-   ["-i" "--in file"   "Input file (default: stdin)"                  :assoc-fn assoc-i                     ]
-   ["-n" "--no-prefix" "Report values without 'namelist:key=' prefix"                                       ]
-   ["-o" "--out file"  "Output file (default: stdout)"                :assoc-fn assoc-o                     ]
-   ["-s" "--set n:k=v" "Set value of key 'k' in namelist 'n' to 'v'"  :assoc-fn assoc-s :parse-fn parse-set ]
-   ["-v" "--version"   "Show version information"                                                           ]])
-
-;; formatting
-
-(defn- fmt-bash [m fname]
-  (let [ms  (sort m)
-        eq #(string/replace % "\"" "\\\"")
-        f0  (fn [[dataref values]]
-              (let [v (eq values)]
-                (str "'" dataref "') echo \"" v "\";;")))
-        f1  (fn [[name nvseq]]
-              (let [x (strmap f0 nvseq)]
-                (str "'" name "') case \"$2\" in " x "*) echo '';;esac;;" )))]
-    (str fname "(){ case \"$1\" in " (strmap f1 ms) "*) echo '';;esac; }\n")))
-
-(defn- fmt-namelist [m]
-  (let [f0 (fn [[dataref values]]
-             (str "  " dataref "=" values "\n"))
-        f1 (fn [[name nvseq]]
-             (str "&" name "\n" (strmap f0 (sort nvseq)) "/\n"))]
-    (strmap f1 (sort m))))
+  [["-c" "--create"     "Create new namelist"                                                              ]
+   ["-f" "--format fmt" "Output in the specified format (see below)"   :assoc-fn assoc-f :parse-fn parse-f ]
+   ["-g" "--get n:k"    "Get value of key 'k' in namelist 'n'"         :assoc-fn assoc-g :parse-fn parse-g ]
+   ["-h" "--help"       "Show usage information"                                                           ]
+   ["-i" "--in file"    "Input file (default: stdin)"                  :assoc-fn assoc-i                   ]
+   ["-n" "--no-prefix"  "Report values without 'namelist:key=' prefix"                                     ]
+   ["-o" "--out file"   "Output file (default: stdout)"                :assoc-fn assoc-o                   ]
+   ["-s" "--set n:k=v"  "Set value of key 'k' in namelist 'n' to 'v'"  :assoc-fn assoc-s :parse-fn parse-s ]
+   ["-v" "--version"    "Show version information"                                                         ]])

 ;; main

 (defn -main [& args]
   (alter-var-root #'*read-eval* (constantly false))
   (let [{:keys [options arguments summary]} (cli/parse-opts args cliopts)
-        fmt  fmt-namelist
         gets (:get options)
         sets (:set options)
         in   (or (:in  options) *in* )
@@ -232,7 +245,8 @@
     (if (and gets sets) (fail (msgs :get+set)))
     (if (and sets (:no-prefix options)) (fail (msgs :set+no-prefix)))
     (if (and (:create options) (:in options)) (fail (msgs :create+in)))
-    (let [m (nml-map (if (:create options) "" (read-file in)))]
+    (let [fmt (let [f (:format options)] (if f (formats f) fmt-namelist))
+          m   (nml-map (if (:create options) "" (read-file in)))]
       (cond gets  (nml-out out (nml-gets m gets (:no-prefix options)))
             sets  (nml-out out (fmt (nml-sets m sets)))
             :else (nml-out out (fmt m))))))


Remove print of config

Remove print of config

--- src/qcon/web.clj
+++ src/qcon/web.clj
@@ -39,8 +39,6 @@
   Lifecycle
   (init [_ system] system)
   (start [_ system]
-
-    (clojure.pprint/pprint config)
     (let [loader (get-template-loader system config)
           plan (io/file (-> config :jig/project :project-file (.getParentFile)) "plan.org")]
       (-> system


better icons for prev/pause/next track

better icons for prev/pause/next track

--- cljs/sledge/core.cljs
+++ cljs/sledge/core.cljs
@@ -12,6 +12,9 @@
             ))

 (enable-console-print!)
+
+;; we need to be a whole lot clearer about whether we're playing,
+;; what we're playing (now/next), and why we're not playing

 (def app-state
   (atom
@@ -186,11 +189,43 @@
       (.stopPropagation e)
       r)))

+(defn svg [& elements]
+  (into
+   [:svg {:xmlns "http://www.w3.org/2000/svg"
+          :version "1.1"
+          :width "24px"
+          :height "20px"
+          :viewBox "-10 -10 120 120"
+          :xmlnsXlink "http://www.w3.org/1999/xlink"
+          }]
+   elements))
+
+(defn polygon [& points]
+  [:polygon {:className "button"
+             :points (string/join " " points)
+             :fill "#006765"}])
+
+(defn svg-play []
+  (svg [:g {:transform "translate(15 0)"}
+        (polygon 0,0 80,50 0,100 0,0)]))
+
+(defn svg-pause []
+  (svg [:g {:transform "translate(15 0)"}
+        (polygon 0,0 25,0 25,100 0,100 0,0)
+        (polygon 40,0 65,0 65,100 40,100 40,0)]))
+
+(defn svg-skip-track [ & [backward?]]
+  (svg [:g {:transform (if backward? "rotate(180 50 50)" "translate(0 0)")}
+        (polygon 0,0 35,50 0,100 0,0)
+        (polygon 40,0 80,50 40,100 40,0)
+        (polygon 85,0 95,0 95,100 85,100 85,0)]))
+
 (defn transport-buttons-view [app owner]
   (reify
     om/IRender
     (render [this]
       (let [queue (om/observe owner (player-queue))
+            playing? (:playing (player-state))
             track (current-track)]
         (html
          [:div {:id "transport"
@@ -208,9 +243,12 @@
             (get track "artist")]]

           [:span {:className "buttons"}
-           [:button {:onClick (swallowing player-pause) } ">"]
-           [:button {:onClick (swallowing player-next) } ">>|"]
-           [:button {:onClick (swallowing player-prev) } "|<<"]]
+           [:button {:onClick (swallowing player-prev) }
+            (svg-skip-track :backwards)]
+           [:button {:onClick (swallowing player-pause) }
+            (if playing? (svg-pause) (svg-play))]
+           [:button {:onClick (swallowing player-next) }
+            (svg-skip-track)]]
           [:span {:className "offset"}
            [:span {:className "elapsed-time time"}
             (mmss (:track-offset (player-state)))]


asserting successful upload

asserting successful upload

--- src/vc/guest.clj
+++ src/vc/guest.clj
@@ -50,7 +50,7 @@
   {:pre [(tools-installed? hostname)]}
   (with-service
     (let [url (.initiateFileTransferToGuest (manager hostname :file) (npa auth) dst (GuestFileAttributes.) (.length input) true)]
-      (client/put url {:body input :insecure? true}))))
+      (assert (:status (client/put url {:body input :insecure? true})) 200))))

 (defn download-file
   "download a file from a guest system returns a stream"


Transducer variant of nth for reduced memory in ClojureScript

--- src/advent_2018/day_09.cljc
+++ src/advent_2018/day_09.cljc
@@ -1,4 +1,7 @@
 (ns advent-2018.day-09)
+
+(defn nth' [coll n]
+  (transduce (drop n) (completing #(reduced %2)) nil coll))

 (defn create-game [players]
   {:players players
@@ -35,7 +38,7 @@

 (defn solve [players last-marble]
   (let [game (-> (iterate advance (create-game players))
-               (nth (dec last-marble)))]
+               (nth' (dec last-marble)))]
     (apply max (vals (:scores game)))))

 (defn part-1 []


add make-declared-type-ref

add make-declared-type-ref

--- src/app/model/protocols.clj
+++ src/app/model/protocols.clj
@@ -16,6 +16,19 @@
   (primitive? [this])
   (typeName [this])
   (baseType [this]))
+
+(defrecord RTypeRef [array primitive type-name base-type]
+  TypeRef
+  (array? [this] array)
+  (primitive? [this] primitive)
+  (typeName [this] type-name)
+  (baseType [this] base-type))
+
+(defn make-array-type-ref [type-ref]
+  (RTypeRef. true false nil type-ref))
+
+(defn make-declared-type-ref [qname]
+  (RTypeRef. false false qname nil))

 (defprotocol TypeDecl
   "Defiinition of a type (a Class, an Interface or an Enum)"


Minor refactoring: use slurp function declared in file-utils library

--- src/branch_handler/core.clj
+++ src/branch_handler/core.clj
@@ -9,24 +9,18 @@
 (require '[clojure.tools.cli       :as cli])
 (require '[clojure.tools.logging   :as log])

+(require '[clj-fileutils.fileutils :as file-utils])
+
 (def verbose false)
 (def port 3000)
 (def workdir "work")

 (def jenkins-url (System/getenv "JENKINS_URL"))

-(defn slurp-
-    [filename]
-    (try
-        (slurp filename)
-        (catch Exception e
-            (log/error e)
-            nil)))
-
 (defn read-request-body
     "Read all informations from the request body."
     [request]
-    (slurp- (:body request)))
+    (file-utils/slurp- (:body request)))

 (defn log-request
     [request]
@@ -91,6 +85,9 @@

 (defn start-jenkins-jobs
     [action]
+    (let [original-data (:original-data action)]
+        (clojure.pprint/pprint original-data)
+        )
 )

 (defn create-or-delete-jenkins-job


Refactoring: grid-part function used by all chart types

--- src/clj_flotr/generator.clj
+++ src/clj_flotr/generator.clj
@@ -74,6 +74,13 @@
               backgroundColor: '" (or legend-background "#D2E8FF") "',
           }"))

+(defn grid-part
+    [horizontal-lines vertical-lines]
+    (str "grid: {
+              verticalLines:   " (bool->string vertical-lines) ",
+              horizontalLines: " (bool->string horizontal-lines) "
+          },"))
+
 (defn pie-chart
     "Creates a simple pie chart. Please look at the function named
      'test-pie-charts' how to use pie-chart."
@@ -90,11 +97,9 @@
                   (data-series-for-pie-chart data)
                   "], {"
             (str "
-                  HtmlText: false,
-                  grid: {
-                      verticalLines:   " (bool->string vertical-lines) ",
-                      horizontalLines: " (bool->string horizontal-lines) "
-                  },
+                  HtmlText: false,"
+                  (grid-part horizontal-lines vertical-lines)
+                  "
                   xaxis: {showLabels: false},
                   yaxis: {showLabels: false},
                   pie: {show: true, explode: 5},"
@@ -119,11 +124,9 @@
                   (data-series-for-line-chart data)
                   "], {"
             (str "
-                  HtmlText: false,
-                  grid: {
-                      verticalLines:   " (bool->string vertical-lines) ",
-                      horizontalLines: " (bool->string horizontal-lines) "
-                  },
+                  HtmlText: false,"
+                  (grid-part horizontal-lines vertical-lines)
+                  "
                   xaxis: {showLabels: true},
                   yaxis: {showLabels: true},"
                   (legend-part show-legend legend-position legend-background)
@@ -144,11 +147,9 @@
                   (data-series-for-stacked-bars data)
                   "], {"
             (str "
-                  HtmlText: false,
-                  grid: {
-                      verticalLines:   " (bool->string vertical-lines) ",
-                      horizontalLines: " (bool->string horizontal-lines) "
-                  },
+                  HtmlText: false,"
+                  (grid-part horizontal-lines vertical-lines)
+                  "
                   xaxis: {showLabels: true},
                   yaxis: {showLabels: true},
                   bars: {show: true, stacked: true, barWidth: " (or bar-width "0.5") "},"


Rendering Git tree into Markdown list hierarchy works!

--- src/cljs/repodoc/utils.cljs
+++ src/cljs/repodoc/utils.cljs
@@ -219,20 +219,22 @@
   (clojure.string/join (map
                          (fn [item]
                            (let [path (:path item)
-                                 parts (clojure.string/split path "/")
+                                 parts (rest (clojure.string/split path "/"))
                                  level (count parts)
                                  base (last parts)]
                              (str
-                               (parts-to-md-list parts)
-                               " | " (:title item) " | "
-                               (format_time (new js/Date (:mtime item)) DATEFORMAT)
+                               (clojure.string/join (repeat level "  "))
+                               "* "
+                               base
+                               (if (= (:type item) "blob")
+                                 (str " | " (:title item) " | "
+                                      (format_time (new js/Date (:mtime item)) DATEFORMAT)))
                                "\n")))
                          data)))

 (defn serialize-md
   [data]
-  (println data)
-  (render-md data))
+  (render-md (get-tree data)))

 (defn serialize
   [serializer data]


Add test for tagged value canonization.

Add test for tagged value canonization.

--- test/puget/printer_test.clj
+++ test/puget/printer_test.clj
@@ -49,6 +49,14 @@
              "#puget.printer_test.TestRecord{:bar \\y, :foo \\x}\n")))))

+(deftest canonical-tagged-value
+  (let [tval (reify data/TaggedValue
+               (edn-tag [this] 'foo)
+               (edn-value [this] :bar/baz))
+        doc (canonize tval)]
+    (is (tagged-value-doc? doc))))
+
+
 (deftest default-canonize
   (testing "Unknown values"
     (let [usd (java.util.Currency/getInstance "USD")]


tests fixed a bit

tests fixed a bit

--- test/webdriver/api_test.clj
+++ test/webdriver/api_test.clj
@@ -55,130 +55,90 @@
   (is (visible "//button[@id='button-visible']"))
   (is (not (visible "//button[@id='button-hidden']")))
   (is (not (visible "//div[@id='div-hidden']")))
-  (try+
-   (is (thrown? clojure.lang.ExceptionInfo
-                (visible "//test[@id='dunno-foo-bar']")))))
+  (is (thrown? clojure.lang.ExceptionInfo
+               (visible "//test[@id='dunno-foo-bar']"))))

 (deftest test-enabled
-  (let [url (-> "html/test.html" io/resource str)]
-    (with-session
-      (go url)
-      (is (disabled "//input[@id='input-disabled']"))
-      (is (enabled "//input[@id='input-not-disabled']"))
-      (is (disabled "//textarea[@id='textarea-disabled']"))
-      (try+
-       (is (thrown? clojure.lang.ExceptionInfo
-                    (enabled "//test[@id='dunno-foo-bar']")))))))
+  (is (disabled "//input[@id='input-disabled']"))
+  (is (enabled "//input[@id='input-not-disabled']"))
+  (is (disabled "//textarea[@id='textarea-disabled']"))
+  (is (thrown? clojure.lang.ExceptionInfo
+               (enabled "//test[@id='dunno-foo-bar']"))))

 (deftest test-exists
-  (let [url (-> "html/test.html" io/resource str)]
-    (with-session {} {}
-      (go url)
-      (with-xpath
-        (is (exists "//html"))
-        (is (exists "//body"))
-        (is (not (exists "//test[@id='dunno-foo-bar']")))))))
+  (with-xpath
+    (is (exists "//html"))
+    (is (exists "//body"))
+    (is (not (exists "//test[@id='dunno-foo-bar']")))))

 (deftest test-alert
-  (let [url (-> "html/test.html" io/resource str)]
-    (wait-running :message "The server did not start.")
-    (with-session {} {}
-      (go url)
-      (click "//button[@id='button-alert']")
-      (skip-phantom
-       (with-alert-text alert
-         (is (= alert "Hello!")))
-       (is (has-alert))
-       (accept-alert)
-       (is (not (has-alert)))
-       (click "//button[@id='button-alert']")
-       (is (has-alert))
-       (dismiss-alert)
-       (is (not (has-alert)))))))
+  (click "//button[@id='button-alert']")
+  (skip-phantom
+   (with-alert-text alert
+     (is (= alert "Hello!")))
+   (is (has-alert))
+   (accept-alert)
+   (is (not (has-alert)))
+   (click "//button[@id='button-alert']")
+   (is (has-alert))
+   (dismiss-alert)
+   (is (not (has-alert)))))

 (deftest test-attributes
-  (let [url (-> "html/test.html" io/resource str)]
-    (wait-running :message "The server did not start.")
-    (with-session {} {}
-      (go url)
-      (testing "common attributes"
-        (with-xpath
-          (with-attrs "//input[@id='input-attr']"
-            [id type value name style
-             disabled data-foo data-bar]
-            (is (= id "input-attr"))
-            (is (= type "text"))
-            (is (= value "hello"))
-            (is (= style "border: 5px; width: 150px;"))
-            (is (= disabled "true"))
-            (is (= data-foo "foo"))
-            (is (= data-bar "bar")))))
-      (testing "event attributes"
-        (with-xpath
-          (with-attrs "//input[@id='input-attr']" [onclick]
-            (is (= onclick "alert(123)")))))
-      (testing "missing attributes"
-        (with-xpath
-          (with-attrs "//input[@id='input-attr']"
-            [foo bar baz dunno]
-            (is (= foo nil))
-            (is (= baz nil))
-            (is (= bar nil))
-            (is (= dunno nil))))))))
+  (testing "common attributes"
+    (with-attrs "//input[@id='input-attr']"
+      [id type value name style
+       disabled data-foo data-bar]
+      (is (= id "input-attr"))
+      (is (= type "text"))
+      (is (= value "hello"))
+      (is (= style "border: 5px; width: 150px;"))
+      (is (= disabled "true"))
+      (is (= data-foo "foo"))
+      (is (= data-bar "bar"))))
+  (testing "event attributes"
+    (with-attrs "//input[@id='input-attr']" [onclick]
+      (is (= onclick "alert(123)"))))
+  (testing "missing attributes"
+    (with-attrs "//input[@id='input-attr']"
+      [foo bar baz dunno]
+      (is (= foo nil))
+      (is (= baz nil))
+      (is (= bar nil))
+      (is (= dunno nil)))))

 (deftest test-title
-  (let [url (-> "html/test.html" io/resource str)]
-    (wait-running :message "The server did not start.")
-    (with-session {} {}
-      (testing "empty page"
-        (with-title title
-          (is (= title ""))))
-      (testing "go URL"
-        (go url)
-        (with-title title
-          (is (= title "Webdriver Test Document")))))))
+  (with-title title
+    (is (= title "Webdriver Test Document"))))

 (deftest test-url
-  (let [url (-> "html/test.html" io/resource str)]
-    (wait-running :message "The server did not start.")
-    (with-session {} {}
-      (testing "empty page"
-        (with-url url
-          (is (or (= url "about:blank")
-                  (= url "data:,")))))
-      (testing "go URL"
-        (go url)
-        (with-url url
-          (is (str/ends-with? url "/resources/html/test.html")))))))
+  (with-url url
+    (is (str/ends-with? url "/resources/html/test.html"))))

 (deftest test-css-props
-  (let [url (-> "html/test.html" io/resource str)]
-    (wait-running :message "The server did not start.")
-    (with-session {} {}
-      (go url)
-      (testing "single css"
-        (with-css "//div[@id='div-css-simple']" display
-          (is (= display "block"))))
-      (testing "multiple css"
-        (with-csss "//div[@id='div-css-simple']"
-          [display background-color width height]
-          (is (= display "block"))
-          (is (or (= background-color "rgb(204, 204, 204)")
-                  (= background-color "rgba(204, 204, 204, 1)")))
-          (is (= width "150px"))
-          (is (= height "250px"))))
-      (testing "styled css"
-        (with-csss "//div[@id='div-css-styled']"
-          [display width height]
-          (is (= display "block"))
-          (is (= width "333px"))
-          (is (= height "111px"))))
-      (testing "missing css"
-        (with-csss "//div[@id='div-css-styled']"
-          [foo bar baz]
-          (is (nil? foo))
-          (is (nil? bar))
-          (is (nil? baz)))))))
+  (testing "single css"
+    (with-css "//div[@id='div-css-simple']" display
+      (is (= display "block"))))
+  (testing "multiple css"
+    (with-csss "//div[@id='div-css-simple']"
+      [display background-color width height]
+      (is (= display "block"))
+      (is (or (= background-color "rgb(204, 204, 204)")
+              (= background-color "rgba(204, 204, 204, 1)")))
+      (is (= width "150px"))
+      (is (= height "250px"))))
+  (testing "styled css"
+    (with-csss "//div[@id='div-css-styled']"
+      [display width height]
+      (is (= display "block"))
+      (is (= width "333px"))
+      (is (= height "111px"))))
+  (testing "missing css"
+    (with-csss "//div[@id='div-css-styled']"
+      [foo bar baz]
+      (is (nil? foo))
+      (is (nil? bar))
+      (is (nil? baz)))))

 (deftest test-wait-text
   (let [url (-> "html/test.html" io/resource str)]


[#1719] Fix: Add dataset-id on update op, transformation spec

--- backend/src/akvo/lumen/lib/transformation/engine.clj
+++ backend/src/akvo/lumen/lib/transformation/engine.clj
@@ -203,7 +203,7 @@
             (db.transformation/drop-table tenant-conn {:table-name previous-table-name})))
         (let [transformation (assoc (first transformations) :dataset-id dataset-id)
               {:keys [success? message columns execution-log] :as transformation-result}
-              (try-apply-operation deps table-name columns transformation)]
+              (try-apply-operation deps table-name columns (assoc transformation :dataset-id dataset-id))]
           (if success?
             (recur (rest transformations) columns (into full-execution-log execution-log) (inc tx-index))
             (do
@@ -251,7 +251,7 @@
                                      (set (map #(get % "columnName") columns)))))]
         (if avoid-tranformation?
           (recur (rest transformations) columns version applied-txs)
-          (let [op (try-apply-operation {:tenant-conn conn :caddisfly caddisfly} table-name columns transformation)]
+          (let [op (try-apply-operation {:tenant-conn conn :caddisfly caddisfly} table-name columns (assoc transformation :dataset-id dataset-id))]
             (when-not (:success? op)
               (throw
                (ex-info (format "Failed to update due to transformation mismatch: %s . TX: %s" (:message op) transformation) {})))


Align REPL Figwheel control comments

Align REPL Figwheel control comments

--- sidecar/src/figwheel_sidecar/repl.clj
+++ sidecar/src/figwheel_sidecar/repl.clj
@@ -342,16 +342,16 @@

 (defn repl-function-docs  []
   "Figwheel Controls:
-          (stop-autobuild)           ;; stops Figwheel autobuilder
-          (start-autobuild [id ...]) ;; starts autobuilder focused on optional ids
-          (switch-to-build id ...)   ;; switches autobuilder to different build
-          (reset-autobuild)          ;; stops, cleans, and starts autobuilder
-          (build-once [id ...])      ;; builds source once time
-          (clean-builds [id ..])      ;; deletes compiled cljs target files
-          (fig-status)               ;; displays current state of system
+          (stop-autobuild)                ;; stops Figwheel autobuilder
+          (start-autobuild [id ...])      ;; starts autobuilder focused on optional ids
+          (switch-to-build id ...)        ;; switches autobuilder to different build
+          (reset-autobuild)               ;; stops, cleans, and starts autobuilder
+          (build-once [id ...])           ;; builds source one time
+          (clean-builds [id ..])          ;; deletes compiled cljs target files
+          (fig-status)                    ;; displays current state of system
           (add-dep [org.om/om \"0.8.1\"]) ;; add a dependency. very experimental
   Switch REPL build focus:
-          :cljs/quit                 ;; allows you to switch REPL to another build
+          :cljs/quit                      ;; allows you to switch REPL to another build
     Docs: (doc function-name-here)
     Exit: Control+C or :cljs/quit
  Results: Stored in vars *1, *2, *3, *e holds last exception object")


Start using apache commons codecs impl for urlsafe base64 encoding.

--- src/buddy/core/codecs.clj
+++ src/buddy/core/codecs.clj
@@ -75,47 +75,30 @@
   [^String s]
   (String. (base64->bytes s) "UTF8"))

+(defn bytes->safebase64
+  "Given a string, convert it to completely
+  urlsafe base64 version."
+  [^bytes s]
+  (Base64/encodeBase64URLSafeString s))
+
 (defn str->safebase64
   "Given a string, convert it to completely
   urlsafe base64 version."
   [^String s]
-  (-> (str->base64 s)
-      (str/replace #"\s" "")
-      (str/replace "=" "")
-      (str/replace "+" "-")
-      (str/replace "/" "_")))
-
-(defn bytes->safebase64
-  "Given a string, convert it to completely
-  urlsafe base64 version."
-  [^bytes s]
-  (-> (bytes->base64 s)
-      (str/replace #"\s" "")
-      (str/replace "=" "")
-      (str/replace "+" "-")
-      (str/replace "/" "_")))
+  (-> (str->bytes s)
+      (bytes->safebase64)))

 (defn safebase64->str
   "Given urlsafe base64 string decode it to string."
+  {:deprecated true}
   [^String s]
-  (-> (case (mod (count s) 4)
-        2 (str s "==")
-        3 (str s "=")
-        s)
-      (str/replace "-" "+")
-      (str/replace "_" "/")
-      (base64->str)))
+  (base64->str s))

 (defn safebase64->bytes
   "Given urlsafe base64 string decode it to bytes array."
+  {:deprecated true}
   [^String s]
-  (-> (case (mod (count s) 4)
-        2 (str s "==")
-        3 (str s "=")
-        s)
-      (str/replace "-" "+")
-      (str/replace "_" "/")
-      (base64->bytes)))
+  (base64->bytes s))

 (defn long->bytes
   [^Long input]


[#5] Remove figwheel_helper.

[#5] Remove figwheel_helper.

--- src-cljs-dev/kmg/figwheel_helper.cljs
+++ src-cljs-dev/kmg/figwheel_helper.cljs
@@ -1,15 +0,0 @@
-(ns kmg.figwheel-helper
-  (:require [figwheel.client :as fw]
-            [kmg.client :as kmg]
-            [enfocus.core :as ef :refer (set-attr from at get-prop do-> after
-                                                  remove-node content substitute)]
-            [enfocus.events :as events :refer (listen)])
-  (:require-macros [enfocus.macros :as em]))
-
-(fw/watch-and-reload
- :jsload-callback (fn []
-;;                    (start) ;; (stop-and-start-my app)
-                    (kmg/refresh)
-                    ))
-
-(set! (.-onload js/window) #(em/wait-for-load (kmg/start)))


Show ui v2 banner on account page

Show ui v2 banner on account page

--- src-cljs/frontend/components/app.cljs
+++ src-cljs/frontend/components/app.cljs
@@ -154,7 +154,7 @@
                  ;;     expanding all datastructures.
                  (om/build inspector/inspector app))

-               (when (and (= :dashboard (:navigation-point app))
+               (when (and (#{:dashboard :account} (:navigation-point app))
                           (feature/enabled? :ui-v2-opt-in-banner)
                           (not (feature/enabled-in-cookie? :ui-v2)))
                  (om/build opt-in/ui-v2-opt-in-banner app))