use om/computed

use om/computed

--- src/tango/cljs/runtime/core.cljs
+++ src/tango/cljs/runtime/core.cljs
@@ -300,8 +300,8 @@
   Object
   (render
     [this]
-    (let [classes (sort-by :class/position (:classes (om/props this)))
-          selected-class (:selected-class (om/props this))]
+    (let [classes (sort-by :class/position (om/props this))
+          {:keys [selected]} (om/get-computed this)]
       (dom/div nil
         (dom/h2 {:className "sub-header"} "Klasser")
         (dom/div nil
@@ -331,7 +331,7 @@
               (dom/th #js {:width "20"} "Status")))
           (apply dom/tbody nil (map #((om/factory ClassRow)
                                       (assoc % :selected? (if (= (:class/id %)
-                                                                 (:class/id selected-class))
+                                                                 (:class/id selected))
                                                             true
                                                             false))) classes)))))))

@@ -571,8 +571,11 @@
                   (dom/h4 nil (str "Competition Id : " (:competition/id selected-competition)))
                   ((om/factory AdminViewComponent) {:status status}))

-          :classes ((om/factory ClassesView) {:classes (:competition/classes selected-competition)
-                                              :selected-class (:app/selected-class p)})
+          :classes ((om/factory ClassesView) (om/computed (:competition/classes selected-competition)
+                                                          {:selected (:app/selected-class p)})
+                     ;{:classes (:competition/classes selected-competition)
+                     ; :selected-class (:app/selected-class p)}
+                     )

           :create-class ((om/factory CreateClassView) (:app/selected-class p))


normgenes only _required_ for tnseq

normgenes only _required_ for tnseq

--- src/aerobio/validate/expsheet.clj
+++ src/aerobio/validate/expsheet.clj
@@ -56,10 +56,13 @@

 (defn gbk? [x] (contains? (get-exp-sheet-data (x :EID) :gbks) (x :ncid)))
 (defn gtf? [x] (contains? (get-exp-sheet-data (x :EID) :gtfs) (x :ncid)))
-(defn normgenes? [x] (contains? (get-exp-sheet-data (x :EID) :norms) (x :ncid)))
 (defn index? [x] (contains? (get-exp-sheet-data (x :EID) :indices) (x :ncid)))
 (defn bt1index? [x]
   (contains? (get-exp-sheet-data (x :EID) :bt1indices) (x :ncid)))
+(defn normgenes? [x]
+  (or (not= (ac/get-exp-info (x :EID) :exp) :tnseq)
+      (contains? (get-exp-sheet-data (x :EID) :norms) (x :ncid))))
+

 (s/def ::gbk? gbk?)
 (s/def ::gtf? gtf?)


Fix test-unit-at failure (attempt #1)

Fix test-unit-at failure (attempt #1)

--- test/cljs/zetawar/subs_test.cljs
+++ test/cljs/zetawar/subs_test.cljs
@@ -207,6 +207,7 @@
                  :unit-type/max-range
                  :unit-type/can-capture
                  :unit-type/armor-type
+                 :unit-type/buildable-at
                  :unit-type/image}
                (into #{} unit-type-keys)))))))


update execution-result to support :type & failure reasons

--- src/thi/ng/fabric/async.cljc
+++ src/thi/ng/fabric/async.cljc
@@ -107,7 +107,7 @@
 (def default-context-opts
   {:collect-thresh 0
    :signal-thresh  0
-   :timeout        100
+   :timeout        5
    :max-ops        1e6})

 (defn vertex
@@ -161,11 +161,13 @@
     vertex))

 (defn execution-result
-  [p t0 colls sigs]
-  (deliver
-   p {:collections colls
-      :signals     sigs
-      :time        (* (- (System/nanoTime) t0) 1e-6)}))
+  [type p colls sigs t0 & [opts]]
+  (->> {:collections colls
+        :signals     sigs
+        :type        type
+        :time        (* (- (System/nanoTime) t0) 1e-6)}
+       (merge opts)
+       (deliver p)))

 (defn async-context
   [opts]
@@ -186,7 +188,7 @@
             (loop [verts (vertices g)]
               (when-let [v (first verts)]
                 (when (should-collect? v c-thresh)
-                  ((-> v :state deref ::collect-fn) vertex))
+                  (collect! v))
                 (when (should-signal? v s-thresh)
                   (signal! v))
                 (recur (next verts))))
@@ -195,15 +197,23 @@
                 (let [t (timeout max-t)
                       [[evt v ex] port] (alts! [ctrl t])]
                   (if (= port t)
-                    (do (info "graph converged, done...")
-                        (execution-result res t0 colls sigs))
+                    (execution-result :converged res colls sigs t0)
                     (case evt
                       :collect (recur (inc colls) sigs)
                       :signal  (recur colls (inc sigs))
-                      :error   (warn ex "@ vertex" v)
-                      (do (info "wrong event" evt v)))))
-                (do (info "reached max ops: " max-ops)
-                    (execution-result res t0 colls sigs)))))
+                      :error   (do (warn ex "@ vertex" v)
+                                   (execution-result
+                                    :error res colls sigs t0
+                                    {:reason           :error
+                                     :reason-exception ex
+                                     :reason-vertex    v}))
+                      (do (info "wrong event" evt v)
+                          (execution-result
+                           :interrupted res colls sigs t0
+                           {:reason        :unknown
+                            :reason-event  evt
+                            :reason-vertex v})))))
+                (execution-result :terminated res colls sigs t0))))
           res)))))

 (def g (compute-graph))


user enabling/disabling added to core api

--- src/cerber/oauth2/core.clj
+++ src/cerber/oauth2/core.clj
@@ -90,6 +90,22 @@
   [login]
   (= 1 (user/revoke-user login)))

+(defn disable-user
+  "Disables user.
+  Disabled user is not able to authenticate and all user related tokens become invalid."
+
+  [login]
+  (when-let [user (find-user login)]
+    (and (user/disable-user user) user)))
+
+(defn enable-user
+  "Enables user.
+  Enabled user is able to authenticate and all user related tokens become valid."
+
+  [login]
+  (when-let [user (find-user login)]
+    (and (user/enable-user user) user)))
+
 (defn modify-user-status
   "Decides whether to enable or disable user with given login."


issue #5 austin only for dev build

issue #5 austin only for dev build

--- src/clj/hit_wl/handler.clj
+++ src/clj/hit_wl/handler.clj
@@ -106,24 +106,26 @@
                     :password (creds/hash-bcrypt "stefan123")
                     :roles #{::user}}})

-(defn init-cljs-repl []
+
+(comment
+  (defn init-cljs-repl []
   (def repl-env (reset! cemerick.austin.repls/browser-repl-env
                         (cemerick.austin/repl-env)))
   (pprint repl-env))

-(comment
-  (-> js/document .-body (.setAttribute "style" "background:white")))
-(defn start-cljs-repl
-  "this will start cljs repl inside clj repl
+  (-> js/document .-body (.setAttribute "style" "background:white"))
+  (defn start-cljs-repl
+    "this will start cljs repl inside clj repl
    which will work from cider only if server was started from same
    repl as they need to share repl-env var set session"[]
-  (cemerick.austin.repls/cljs-repl hit-wl.handler/repl-env))
+   (cemerick.austin.repls/cljs-repl hit-wl.handler/repl-env)))

 (defn init-middleware [handler]
   ;;dummy middleware handler to execute some init logic on app startup
   (db/init (get-db-config))
-  (when (= (:env app-config) :dev)
-    (init-cljs-repl))
+  (comment
+    (when (= (:env app-config) :dev)
+      (init-cljs-repl)))
   handler)

 (def app


Put caller save back in. The order is still a little wonky.

--- src/clj/minijava/munch.clj
+++ src/clj/minijava/munch.clj
@@ -1,5 +1,5 @@
 =(ns minijava.munch
-  (:use (minijava exp ir gas))
+  (:use (minijava exp ir gas alloc))
   (:require [minijava.temp :as tm])
   (:import clojure.lang.Keyword))

@@ -161,16 +161,20 @@
         ;; itself.
         ret  (tm/temp)]
     ;; Call-save hack: push these registers
-    ;;(doseq [r (disj regs :EAX)]
-    ;;  (emit (pushl r)))
+    (doseq [r (seq (disj regs :EAX))]
+      (emit (pushl r)))
+    ;; Push arguments onto stack
     (doseq [f (reverse formals)]
       (emit (pushl f)))
+    ;; Make the call
     (emit (call (munch label)))
+    ;; Pop arguments off of stack
+    (emit (addl (CONST (* (count formals) 4)) (tm/temp :ESP)))
+    ;; Call-save hack: pop these registers
+    (doseq [r (reverse (seq (disj regs :EAX)))]
+      (emit (popl r)))
+    ;; Get return value
     (emit (movl (tm/temp :EAX) ret))
-    ;; Call-save hack: pop these registers
-    ;;(doseq [r (disj regs :EAX)]
-    ;;  (emit (popl r)))
-    (emit (addl (CONST (* (count formals) 4)) (tm/temp :ESP)))
     ;; want to return the return value as a temp from this function.
     ;; liveness analysis will probably remove this movl instruction
     ;; later, but for now, thats what we'll do.  this depends upon the


Remove do

Remove do

--- src/clj/nightcode/core.clj
+++ src/clj/nightcode/core.clj
@@ -75,9 +75,8 @@

 (defn -main [& args]
   (when (= "Linux" (System/getProperty "os.name"))
-    (do
-      (System/setProperty "prism.lcdtext" "false")
-      (System/setProperty "prism.text" "t2k")))
+    (System/setProperty "prism.lcdtext" "false")
+    (System/setProperty "prism.text" "t2k"))
   (swap! runtime-state assoc :web-port (e/start-web-server!))
   (Application/launch nightcode.core (into-array String args)))


started introducing memdb

started introducing memdb

--- src/clj/ow/factum/core.clj
+++ src/clj/ow/factum/core.clj
@@ -6,8 +6,14 @@
             [ow.factum.logic :as l]
             [ow.factum.entities :as e]))

-(defrecord FactEngine [eventstore])
+(defrecord FactEngine [externaldb memdb])

 (defn ldb [this & {:keys [timestamp]}]
-  (l/get-logic-db (:eventstore this)
+  (l/get-logic-db (:externaldb this)
                   :timestamp timestamp))
+
+(defn start-polling [this & {:keys [interval]}]
+  )
+
+(defn stop-polling [this]
+  )


refine integer collection coercion

refine integer collection coercion

--- src/clj_money/coercion.clj
+++ src/clj_money/coercion.clj
@@ -19,6 +19,32 @@
   [rule-key & paths]
   (map #(rule rule-key %) paths))

+(defmulti parse-integer-collection
+  (fn [value]
+    (cond
+      (string? value) :string
+      (and (coll? value) (every? integer? value)) :integer-collection
+      (coll? value) :collection)))
+
+(defmethod parse-integer-collection :string
+  [value]
+  [(try
+     (Integer. value)
+     (catch NumberFormatException e
+       value))])
+
+(defmethod parse-integer-collection :integer-collection
+  [value]
+  value)
+
+(defmethod parse-integer-collection :collection
+  [value]
+  (map #(try
+          (Integer. %)
+          (catch NumberFormatException e
+            %))
+       value))
+
 (register-coerce-fn :integer    #(if (integer? %) % (Integer. %)))
 (register-coerce-fn :decimal    #(if (decimal? %) % (try
                                                       (bigdec %)
@@ -26,14 +52,7 @@
                                                         %))))
 (register-coerce-fn :keyword    #(if (keyword? %) % (keyword %)))
 (register-coerce-fn :local-date #(if (string? %) (parse-local-date %) %))
-(register-coerce-fn :integer-collection #(if (and (seq %) (every? (fn [v] (integer? v)) %))
-                                           %
-                                           (mapv (fn [value]
-                                                   (try
-                                                     (Integer. value)
-                                                     (catch IllegalArgumentException e
-                                                       value)))
-                                                 %)))
+(register-coerce-fn :integer-collection parse-integer-collection)

 (defn coerce
   "Given a model and a list of coercion rules, applies the rules to the model"


Exclaim This \!\!\!\!\!\!\!\!

Exclaim This \!\!\!\!\!\!\!\!

--- src/cljs/bmihw/manage.cljs
+++ src/cljs/bmihw/manage.cljs
@@ -15,7 +15,6 @@
 (defn drunk?
   [{drunk "drunk" :as event}]
   (or (nil? drunk) (= drunk "true") drunk))
-

 (defn add-event
   [{id :id user "username" target "target-username" keyword "keyword" content "content" :as event}]


update wording on unit tip

update wording on unit tip

--- src/cljs/lokate/point.cljs
+++ src/cljs/lokate/point.cljs
@@ -38,7 +38,7 @@
           (dom/div #js {:className "location"}
             (if (empty? (:pos point))
               (dom/span #js {:className "location-tip"}
-                "Right click or long press on the map to add a location for your unit!")
+                "Right click or long press on the map to add a location to your unit!")
               (display-pos (:pos point)))))))))

 (defn notes-save []


Add three tracks for displaying terrain stats

--- src/cljs/zetawar/subs.cljs
+++ src/cljs/zetawar/subs.cljs
@@ -453,6 +453,20 @@
   (when-let [[q r] @(selected-hex conn)]
     @(unit-at conn q r)))

+(deftrack terrain-stats [conn unit-q unit-r terrain-q terrain-r]
+  (let [unit @(unit-at conn unit-q unit-r)
+        terrain @(terrain-at conn terrain-q terrain-r)]
+    (game/unit-terrain-stats @conn unit terrain)))
+
+(deftrack selected-stats [conn]
+  (when-let [[q r] @(selected-hex conn)]
+    @(terrain-stats conn q r q r)))
+
+(deftrack targeted-stats [conn]
+  (when-let [[terrain-q terrain-r] @(targeted-hex conn)]
+    (let [[unit-q unit-r] @(selected-hex conn)]
+      @(terrain-stats conn unit-q unit-r terrain-q terrain-r))))
+
 (deftrack unit-selected? [conn]
   (when-let [[q r] @(selected-hex conn)]
     @(unit-at? conn q r)))


fix html link

fix html link

--- src/clojure/nossal/web.clj
+++ src/clojure/nossal/web.clj
@@ -43,7 +43,7 @@
       [:link {:rel "mask-icon" :href "/safari-pinned-tab.svg" :color "#747f90"}]
       [:link {:rel "alternate" :href "https://noss.al" :hreflang "en-us"}]
       [:link {:rel "preconnect" :href "https://fonts.gstatic.com"}]
-      [:lunk {:rel "stylesheet" :href "https://fonts.googleapis.com/css2?family=Anton&display=swap"}]
+      [:link {:rel "stylesheet" :href "https://fonts.googleapis.com/css2?family=Anton&display=swap"}]
       (map (fn [l] [:link l]) links)
       (map (fn [styl] [:style (styl :attr) (styl :content)]) styles)
       [:noscript


logging pid at trace; ignore stream futures when proc times out

--- src/co/nclk/linen/node.clj
+++ src/co/nclk/linen/node.clj
@@ -56,10 +56,17 @@
      (str "Hostname: " (:public_ip node))]))

+(defn private-field [obj fn-name-string]
+  (let [m (.. obj getClass (getDeclaredField fn-name-string))]
+    (. m (setAccessible true))
+    (. m (get obj))))
+
 (defn wait-with-log
   [proc timeout runid]
-  (let [[out err]
-        (for [stream (proc-output-streams proc)]
+  (log :trace {:pid (private-field proc "pid") :runid runid})
+  (let [streams (proc-output-streams proc)
+        [out err]
+        (for [stream streams]
           (future
             (loop [lines []]
               (let [line (.readLine stream)]
@@ -70,10 +77,13 @@
                     (recur (conj lines line))))))))
         exit (if timeout
                (if-let [timed-out? (not (.waitFor proc timeout TimeUnit/MILLISECONDS))]
-                 -1 (.exitValue proc))
+                 (do
+                   (.destroyForcibly proc)
+                   -1)
+                 (.exitValue proc))
                (.waitFor proc))
-        out (clojure.string/join "\n" @out)
-        err (clojure.string/join "\n" @err)]
+        out (when-not (neg? exit) (clojure.string/join "\n" @out))
+        err (when-not (neg? exit) (clojure.string/join "\n" @err))]
     {:stdout out :stderr err :exit exit}))


added note about nils in hansen-stat

added note about nils in hansen-stat

--- src/clj/forma/trends/analysis.clj
+++ src/clj/forma/trends/analysis.clj
@@ -56,9 +56,11 @@
 (defn hansen-stat
   "Returns the Hansen (1992) test statistic, based on (1) the
   first-order conditions, and (2) the cumulative first-order
-  conditions. The try statement will most likely fail if `foc-mat` is
-  singular, which will occur when the hansen-stat is applied to a
-  constant timeseries.
+  conditions. The try statement will most likely throw an exception if
+  `foc-mat` is singular, which will occur when the hansen-stat is
+  applied to a constant timeseries.  If the matrix is singular,
+  `hansen-stat` will return nil, which will be filtered in the
+  subsequent cascalog join.

   Example:
     (hansen-stat ndvi) => 0.9113


Upgrade to Java 11

Upgrade to Java 11

--- src/clj/zhluminus/routes/home.clj
+++ src/clj/zhluminus/routes/home.clj
@@ -30,12 +30,14 @@

 (defn replaceLinks [body]
   (let[
-          list1 [ "https://www.zerohedge.com" ]
-          newbody1 (str/replace body (nth list1 0) (str "/story?url=") )
-          newbody2 (str/replace newbody1 "/s3/files" "https://www.zerohedge.com/s3/files" )
+          list1 [ "https://www.zerohedge.com/news" "https://www.zerohedge.com/article" ]
+          newbody1 (str/replace body (nth list1 0) (str "/story?url=%2Fnews") )
+          newbody2 (str/replace newbody1 (nth list1 1) (str "/story?url=%2Farticle") )
+
+          newbody3 (str/replace newbody2 "\"/s3/files" "\"https://www.zerohedge.com/s3/files" )
   ]
   ;(println root)
-  newbody2
+  newbody3
   )
 )


Organizations pages

Organizations pages

--- src/cljs/elevent_client/core.cljs
+++ src/cljs/elevent_client/core.cljs
@@ -1193,7 +1193,9 @@
                  [input-atom :text
                   (r/wrap LastName swap! form assoc :LastName)]]]]
               [:button.ui.primary.button
-               {:type :submit :on-click #(register @form)}
+               {:type :submit
+                :class (when (seq errors) "disabled")
+                :on-click #(register @form)}
                "Register"]]]]])))))

 (defn event-schedule-page [event-id]
@@ -1305,6 +1307,61 @@
                "Add"
                [:i.right.chevron.icon]]]]]))]]]])))

+(defn organizations-page []
+  [:div.sixteen.wide.column
+   [:div.ui.segment
+    [:div.ui.vertical.segment
+     [:h1.ui.header
+      "Organizations"
+      [:a.ui.right.floated.small.button
+       {:href (organization-add-route)}
+       "Add Organization"]]]
+    [:div.ui.vertical.segment
+     [:div.ui.divided.items
+      (for [organization (map #(d/entity @organizations-db
+                                         %)
+                              (d/q '[:find [?organization-id ...]
+                                     :where [?organization-id]]
+                                   @organizations-db))]
+        ^{:key (:OrganizationId organization)}
+        [:div.item
+         [:div.content
+          [:a.header
+           (:Name organization)]
+          [:div.extra
+           [:a.ui.right.floated.small.icon.button
+            {:href (str "#/events?organization="
+                        (:OrganizationId organization))} ; TODO: make this work
+            "View events"]]]])]]]])
+
+(defn organization-edit-page []
+  (let [form (atom {})
+        validator (validation-set (presence-of :Name))]
+    (fn []
+      (let [{:keys [Name]} @form
+            errors (validator @form)
+            create-organization
+            (fn [form]
+              (organizations-endpoint :create
+                                      form
+                                      #(set! js/location "#/organizations")))]
+        [:div.sixteen.wide.column
+         [:div.ui.segment
+          [:form.ui.form
+           [:div.ui.vertical.segment
+            [:h2.ui.dividing.header
+             "Add an Organization"]
+            [:div.field
+             [:div.required.field {:class (when (and Name (:Name errors))
+                                            "error")}
+              [:label "Organization Name"]
+              [input-atom :text (r/wrap Name swap! form assoc :Name)]]]
+            [:button.ui.primary.button
+             {:type :submit
+              :class (when (seq errors) "disabled")
+              :on-click #(create-organization @form)}
+             "Add"]]]]]))))
+
 (defn sign-in-page []
   (let [form (atom {})
         validator (validation-set (format-of :email :format #"@")


GAWB-2103 redirect user after registration (#821)

--- src/cljs/main/broadfcui/main.cljs
+++ src/cljs/main/broadfcui/main.cljs
@@ -78,40 +78,46 @@
                                                   :text [:span {} "FireCloud Forum" icons/external-link-icon]}]})]
           (when (= :registered (:registration-status @state))
             [header/GlobalSubmissionStatus])]]
-        (case (:registration-status @state)
-          nil [:div {:style {:margin "2em 0" :textAlign "center"}}
-               [comps/Spinner {:text "Loading user information..."}]]
-          :error [:div {:style {:margin "2em 0"}}
-                  (style/create-server-error-message (.-errorMessage this))]
-          :not-registered (profile-page/render
-                           {:new-registration? true
-                            :on-done #(do (nav/go-to-path :library)
-                                          (js-invoke (aget js/window "location") "reload"))})
-          :update-registered (profile-page/render
-                              {:update-registration? true
-                               :on-done #(do (nav/go-to-path :workspaces)
-                                             (js-invoke (aget js/window "location") "reload"))})
-          :registered
-          (if component
-            [component (make-props)]
-            [:h2 {} "Page not found."]))]))
+        (let [original-destination (aget js/window "location" "hash")
+              on-done (fn [fall-through]
+                        (when (empty? original-destination)
+                          (nav/go-to-path fall-through))
+                        (this :-get-registration-status))]
+          (case (:registration-status @state)
+            nil [:div {:style {:margin "2em 0" :textAlign "center"}}
+                 [comps/Spinner {:text "Loading user information..."}]]
+            :error [:div {:style {:margin "2em 0"}}
+                    (style/create-server-error-message (.-errorMessage this))]
+            :not-registered (profile-page/render
+                             {:new-registration? true
+                              :on-done #(on-done :library)})
+            :update-registered (profile-page/render
+                                {:update-registration? true
+                                 :on-done #(on-done :workspaces)})
+            :registered
+            (if component
+              [component (make-props)]
+              [:h2 {} "Page not found."])))]))
    :component-did-mount
    (fn [{:keys [this state]}]
      (when (nil? (:registration-status @state))
-       (endpoints/profile-get
-        (fn [{:keys [success? status-text get-parsed-response]}]
-          (let [parsed-values (when success? (common/parse-profile (get-parsed-response false)))]
-            (cond
-              (and success? (>= (int (:isRegistrationComplete parsed-values)) 3))
-              (swap! state assoc :registration-status :registered)
-              (and success? (some? (:isRegistrationComplete parsed-values))) ; partial profile case
-              (swap! state assoc :registration-status :update-registered)
-              success? ; unregistered case
-              (swap! state assoc :registration-status :not-registered)
-              :else
-              (do
-                (set! (.-errorMessage this) status-text)
-                (swap! state assoc :registration-status :error))))))))})
+       (this :-get-registration-status)))
+   :-load-registration-status
+   (fn [{:keys [this state]}]
+     (endpoints/profile-get
+      (fn [{:keys [success? status-text get-parsed-response]}]
+        (let [parsed-values (when success? (common/parse-profile (get-parsed-response false)))]
+          (cond
+            (and success? (>= (int (:isRegistrationComplete parsed-values)) 3))
+            (swap! state assoc :registration-status :registered)
+            (and success? (some? (:isRegistrationComplete parsed-values))) ; partial profile case
+            (swap! state assoc :registration-status :update-registered)
+            success?                                        ; unregistered case
+            (swap! state assoc :registration-status :not-registered)
+            :else
+            (do
+              (set! (.-errorMessage this) status-text)
+              (swap! state assoc :registration-status :error)))))))})

 (defn- show-system-status-dialog [maintenance-mode?]
   (comps/push-ok-cancel-modal


apply for child component

apply for child component

--- src/cljs/material/components.cljs
+++ src/cljs/material/components.cljs
@@ -29,7 +29,7 @@

 (defn form-control
   [props & childs]
-  (f/form-control (clj->js props) childs))
+  (apply f/form-control (clj->js props) childs))

 (defn form-label
   [props label]
@@ -41,15 +41,15 @@

 (defn form-group
   [props & childs]
-  (f/form-group (clj->js props) childs))
+  (apply f/form-group (clj->js props) childs))

 (defn form-helper-text
   [props & childs]
-  (f/form-helper-text (clj->js props) childs))
+  (apply f/form-helper-text (clj->js props) childs))

 (defn toolbar
   [props & childs]
-  (f/toolbar (clj->js props) childs))
+  (apply f/toolbar (clj->js props) childs))

 (defn drawer
   [props & childs]
@@ -57,23 +57,23 @@

 (defn menu
   [props & childs]
-  (f/menu (clj->js props) childs))
+  (apply f/menu (clj->js props) childs))

 (defn menu-item
   [props & childs]
-  (f/menu-item (clj->js props) childs))
+  (apply f/menu-item (clj->js props) childs))

 (defn menu-list
   [props & childs]
-  (f/menu-list (clj->js props) childs))
+  (apply f/menu-list (clj->js props) childs))

 (defn paper
   [props & childs]
-  (f/paper (clj->js props) childs))
+  (apply f/paper (clj->js props) childs))

 (defn dialog
   [props & childs]
-  (f/dialog (clj->js props) childs))
+  (apply f/dialog (clj->js props) childs))

 (defn dialog-title
   [props title]
@@ -81,11 +81,11 @@

 (defn dialog-content
   [props & childs]
-  (f/dialog-content (clj->js props) childs))
+  (apply f/dialog-content (clj->js props) childs))

 (defn dialog-actions
   [props & childs]
-  (f/dialog-actions (clj->js props) childs))
+  (apply f/dialog-actions (clj->js props) childs))

 (defn input
   [props]
@@ -101,7 +101,7 @@

 (defn avatar
   [props & childs]
-  (f/avatar (clj->js props) childs))
+  (apply f/avatar (clj->js props) childs))

 (defn chip
   [props]
@@ -109,15 +109,15 @@

 (defn list
   [props & childs]
-  (f/list (clj->js props) childs))
+  (apply f/list (clj->js props) childs))

 (defn list-subheader
   [props & childs]
-  (f/list-subheader (clj->js props) childs))
+  (apply f/list-subheader (clj->js props) childs))

 (defn list-item
   [props & childs]
-  (f/list-item (clj->js props) childs))
+  (apply f/list-item (clj->js props) childs))

 (defn list-item-icon
   [props icon]
@@ -129,7 +129,7 @@

 (defn list-item-secondary-action
   [props & childs]
-  (f/list-item-secondary-action (clj->js props) childs))
+  (apply f/list-item-secondary-action (clj->js props) childs))

 (defn icon-button
   [props icon]
@@ -137,7 +137,7 @@

 (defn button
   [props & childs]
-  (f/button (clj->js props) childs))
+  (apply f/button (clj->js props) childs))

 (defn hidden
   [props comp]
@@ -149,7 +149,7 @@

 (defn typography
   [props & childs]
-  (f/typography (clj->js props) childs))
+  (apply f/typography (clj->js props) childs))

 (defn svg
   ([props d] (f/svg-icon (clj->js props) (html [:path {:d d}])))
@@ -157,11 +157,11 @@

 (defn table
   [props & childs]
-  (f/table (clj->js props) childs))
+  (apply f/table (clj->js props) childs))

 (defn table-head
   [props & childs]
-  (f/table-head (clj->js props) childs))
+  (apply f/table-head (clj->js props) childs))

 (defn table-cell
   [props comp]
@@ -169,19 +169,19 @@

 (defn table-body
   [props & childs]
-  (f/table-body (clj->js props) childs))
+  (apply f/table-body (clj->js props) childs))

 (defn table-row
   [props & childs]
-  (f/table-row (clj->js props) childs))
+  (apply f/table-row (clj->js props) childs))

 (defn table-footer
   [props & childs]
-  (f/table-footer (clj->js props) childs))
+  (apply f/table-footer (clj->js props) childs))

 (defn expansion-panel
   [props & childs]
-  (f/expansion-panel (clj->js props) childs))
+  (apply f/expansion-panel (clj->js props) childs))

 (defn expansion-panel-details
   [props comp]
@@ -189,19 +189,19 @@

 (defn expansion-panel-summary
   [props & childs]
-  (f/expansion-panel-summary (clj->js props) childs))
+  (apply f/expansion-panel-summary (clj->js props) childs))

 (defn expansion-panel-actions
   [props & childs]
-  (f/expansion-panel-actions (clj->js props) childs))
+  (apply f/expansion-panel-actions (clj->js props) childs))

 (defn grid
   [props & childs]
-  (f/grid (clj->js props) childs))
+  (apply f/grid (clj->js props) childs))

 (defn card
   [props & childs]
-  (f/card (clj->js props) childs))
+  (apply f/card (clj->js props) childs))

 (defn card-header
   [props]
@@ -209,11 +209,11 @@

 (defn card-content
   [props & childs]
-  (f/card-content (clj->js props) childs))
+  (apply f/card-content (clj->js props) childs))

 (defn card-actions
   [props & childs]
-  (f/card-actions (clj->js props) childs))
+  (apply f/card-actions (clj->js props) childs))

 (defn card-media
   [props]
@@ -225,11 +225,11 @@

 (defn stepper
   [props & childs]
-  (f/stepper (clj->js props) childs))
+  (apply f/stepper (clj->js props) childs))

 (defn step
   [props & childs]
-  (f/step (clj->js props) childs))
+  (apply f/step (clj->js props) childs))

 (defn step-label
   [props label]
@@ -237,11 +237,11 @@

 (defn step-content
   [props & childs]
-  (f/step-content (clj->js props) childs))
+  (apply f/step-content (clj->js props) childs))

 (defn select
   [props & childs]
-  (f/select (clj->js props) childs))
+  (apply f/select (clj->js props) childs))

 (defn tooltip
   [props comp]
@@ -256,7 +256,7 @@
   ([] (f/snackbar-content nil)))

 (defn text-field
-  ([props & childs] (f/text-field (clj->js props) childs))
+  ([props & childs] (apply f/text-field (clj->js props) childs))
   ([] (f/text-field nil)))

 (defn tab
@@ -265,7 +265,7 @@

 (defn tabs
   [props & childs]
-  (f/tabs (clj->js props) childs))
+  (apply f/tabs (clj->js props) childs))

 (defn popper
   [props grow-fn]
@@ -281,7 +281,7 @@

 (defn no-ssr
   [props & childs]
-  (f/no-ssr (clj->js props) childs))
+  (apply f/no-ssr (clj->js props) childs))

 (defn radio
   ([props] (f/radio (clj->js props)))
@@ -289,11 +289,11 @@

 (defn radio-group
   [props & childs]
-  (f/radio-group (clj->js props) childs))
+  (apply f/radio-group (clj->js props) childs))

 (defn switch
   [props & childs]
-  (f/switch (clj->js props) childs))
+  (apply f/switch (clj->js props) childs))

 (defn linear-progress
   ([props] (f/linear-progress (clj->js props)))
@@ -311,7 +311,7 @@

 (defn pie-chart
   [props & childs]
-  (f/pie-chart (clj->js props) childs))
+  (apply f/pie-chart (clj->js props) childs))

 (defn tooltip-chart
   [props]
@@ -319,7 +319,7 @@

 (defn pie
   [props & childs]
-  (f/pie (clj->js props) childs))
+  (apply f/pie (clj->js props) childs))

 (defn cell
   [props]


ui fix

ui fix

--- src/cljs/salava/user/ui/data.cljs
+++ src/cljs/salava/user/ui/data.cljs
@@ -34,7 +34,7 @@
     [:div {:id "cancel-account"}
      [:h1.uppercase-header (t :user/Mydata)]
      [:div
-      [:p (str (t :user/Deleteinstruction)  (t :user/Todeletedata) " ") [:a {:href (path-for "/user/cancel")} (t :user/Removeaccount)]]
+      [:p (str (t :user/Deleteinstruction) " " (t :user/Todeletedata) " ") [:a {:href (path-for "/user/cancel")} (str (t :user/Removeaccount) ".")]]
       ]

      [:div.panel {:id "profile"}


Use artifact list to speed up existence checking

--- src/clojars/tools/upload_repo.clj
+++ src/clojars/tools/upload_repo.clj
@@ -3,19 +3,27 @@
             [clojars.cloudfiles :as cf])
   (:gen-class))

-(defn upload-file [conn path file]
-  (if (cf/artifact-exists? conn path)
-    (println "==> Remote artifact exists, ignoring:" path)
-    (cf/put-file conn path file)))
+(defn upload-file [conn path file existing]
+  (if (existing path)
+    (println "!!> Remote artifact exists, ignoring:" path)
+    (do
+      (println "==> Uploading:" path)
+      (cf/put-file conn path file))))
+
+(defn get-existing [conn]
+  (println "Retrieving current artifact list (this will take a while)")
+  (into #{} (cf/artifact-seq conn)))

 (defn upload-repo [conn repo]
-  (->> (file-seq repo)
-    (filter (memfn isFile))
-    (run! #(upload-file conn
-             (cf/remote-path
-               (.getAbsolutePath repo)
-               (.getAbsolutePath %))
-             %))))
+  (let [existing (get-existing conn)]
+    (->> (file-seq repo)
+      (filter (memfn isFile))
+      (run! #(upload-file conn
+               (cf/remote-path
+                 (.getAbsolutePath repo)
+                 (.getAbsolutePath %))
+               %
+               existing)))))

 (defn -main [& args]
   (if (not= 4 (count args))


variant type

variant type

--- src/clojure/nossal/shop/spec.cljc
+++ src/clojure/nossal/shop/spec.cljc
@@ -41,10 +41,11 @@
 (s/def ::characteristics (s/and
                           (s/map-of ::name ::description)
                           #(instance? clojure.lang.PersistentTreeMap %)))
-
+(s/def ::variant-type #{:color :size})
 (s/def ::variant (s/keys :req [::id
                                ::name
                                ::price
+                               ::variant-type
                                ::stock-count
                                ::available?
                                ::images]))


Mark function as private

Mark function as private

--- src/io/aviso/twixt/jade.clj
+++ src/io/aviso/twixt/jade.clj
@@ -82,7 +82,7 @@
                              (or (.getMessage e) (-> e .getClass .getName)))
                      e))))))))

-(defn complete-path
+(defn- complete-path
   "Computes the complete path for a partial path, relative to an existing asset.
   Alternately, if the path starts with a leading slash (an absolute path), the the leading path is stripped.


Isolating URL pieces for each faction.

Isolating URL pieces for each faction.

--- scraper/src/scraper/core.clj
+++ scraper/src/scraper/core.clj
@@ -48,18 +48,20 @@
 (def url-col (agent []))

 (defn -main
-      "Entry point to scraper methods. Pulls in data from project1999's wiki to insert into an SQLite DB."
-      [& args]
-      ;The main wiki page detailing the first 200 factions. This is where we will get a list of faction links to scrape
-      ;(dorun (map #(tag %) (next parse "http://wiki.project1999.com/index.php?title=Category:Factions")))
-      ;(map
-      ;  #(assoc-in factions [(get-attribute % :title)] {:href (get-attribute % :href)})
-      ;  (-> (parse "http://wiki.project1999.com/index.php?title=Category:Factions")
-      ;      (by-attribute {:class "mw-content-ltr"})
-      ;      (first)
-      ;      (by-tag :table)
-      ;      (first)
-      ;      (by-tag :a))
-      ;  )
-  (dotimes [i 10] (future (send-off url-col (parse "http://wiki.project1999.com/index.php?title=Category:Factions"))))
-      )+  "Entry point to scraper methods. Pulls in data from project1999's wiki to insert into an SQLite DB."
+  [& args]
+  ;The main wiki page detailing the first 200 factions. This is where we will get a list of faction links to scrape
+  ;(dorun (map #(tag %) (next parse "http://wiki.project1999.com/index.php?title=Category:Factions")))
+  (let [the-factions (map
+                       #(assoc-in factions [(get-attribute % :title)] {:href (get-attribute % :href)})
+                       (-> (parse "http://wiki.project1999.com/index.php?title=Category:Factions")
+                           (by-attribute {:class "mw-content-ltr"})
+                           (first)
+                           (by-tag :table)
+                           (first)
+                           (by-tag :a))
+                       )]
+    (map #(println (get-in [% :href])) the-factions)
+    ;(dotimes [i 10] (future (send-off url-col (parse "http://wiki.project1999.com/index.php?title=Category:Factions"))))
+    )
+  )


Refactor the thumbnail and original route handling

These two are now consistent with the others and no longer rely on
image-request-handler.

--- src/vignette/http/routes.clj
+++ src/vignette/http/routes.clj
@@ -89,6 +89,7 @@
          route->offset
          route->adjust-window-offsets
          route->thumbnail-map
+         route->original-map
          route->thumbnail-auto-height-map
          route->options
          route-params->image-type
@@ -123,10 +124,16 @@
                                  request)))
         (GET thumbnail-route
              request
-             (image-request-handler system :thumbnail request))
+             (handle-thumbnail system
+                               (route->thumbnail-map
+                                 (:route-params request)
+                                 request)))
         (GET original-route
              request
-             (image-request-handler system :original request))
+             (handle-original system
+                              (route->original-map
+                                (:route-params request)
+                                request)))

         ; legacy routes
         (GET alr/thumbnail-route
@@ -219,6 +226,13 @@
 (defn route->image-type
   [request-map]
   (assoc request-map :image-type (route-params->image-type request-map)))
+
+(defn route->original-map
+  [request-map request]
+  (-> request-map
+      (assoc :request-type :original)
+      (route->image-type)
+      (route->options request)))

 (defn route->thumbnail-map
   [request-map request &[options]]


added translate-position! and three-vec

added translate-position! and three-vec

--- src/spacetime/core.cljs
+++ src/spacetime/core.cljs
@@ -103,14 +103,20 @@
   [camera]
   (js/THREE.PointerLockControls. camera))

+(defn translate-position!
+  "Translate the position of the object where position
+  is an x y z vector"
+  [obj pos]
+  (.translateX obj (nth pos 0))
+  (.translateY obj (nth pos 1))
+  (.translateZ obj (nth pos 2)))
+
 (defn translate-controls!
   "Translate the position of the pointerlock controls where position
   is an x y z vector"
   [controls position]
   (let [object (.getObject controls)]
-    (.translateX object (nth position 0))
-    (.translateY object (nth position 1))
-    (.translateZ object (nth position 2))))
+    (translate-position! object position)))

 (defn get-position
   "Return a vector of [x y z] if  object has property 'position' that is
@@ -127,6 +133,11 @@
   [controls position]
   (let [object (.getObject controls)]
     (apply  #(.position.set object %1 %2 %3) position)))
+
+(defn three-vec
+  "Create a THREE/Vector from a 3-element clojure vector coords"
+  [[x y z]]
+  (js/THREE.Vector3. x y z ))

 ;; (do
 ;;   ;; requestPointLock can not be called automatically. Must be called from


handle simulator error when building game-state

--- src/wombats/sockets/game.clj
+++ src/wombats/sockets/game.clj
@@ -192,34 +192,47 @@

 (defn- build-simulation-game-state
   [socket-user wombat-id simulator-template-id datomic]
-  (let [simulator-template
-        ((:get-simulator-arena-template-by-id datomic)
-         simulator-template-id)
-
-        user
-        ((:get-entire-user-by-id datomic)
-         (:user/id socket-user))
-
-        wombat
-        ((:get-wombat-by-id datomic)
-         wombat-id)]
-
-    {:arena-config (:simulator-template/arena-template simulator-template)
-     :players {(gen-id) {:player {:player/color "gray"}
-                         :stats initial-stats
-                         :user {:user/github-username (:user/github-username user)
-                                :user/github-access-token (:user/github-access-token user)}
-                         :wombat {:wombat/id (:wombat/id wombat)
-                                  :wombat/name (:wombat/name wombat)
-                                  :wombat/url (:wombat/url wombat)}
-                         :state {:code nil
-                                 :command nil
-                                 :error nil
-                                 :saved-state {}}}}
-     :frame {:frame/frame-number 0
-             :frame/round-number 1
-             :frame/round-start-time nil
-             :frame/arena (:simulator-template/arena simulator-template)}}))
+
+  (try
+    (let [simulator-template
+          ((:get-simulator-arena-template-by-id datomic)
+           simulator-template-id)
+
+          user
+          ((:get-entire-user-by-id datomic)
+           (:user/id socket-user))
+
+          wombat
+          ((:get-wombat-by-id datomic)
+           wombat-id)]
+
+      (when-not simulator-template
+        (throw (Exception. "no simulator template found")))
+
+      (when-not user
+        (throw (Exception. "no user found")))
+
+      (when-not wombat
+        (throw (Exception. "no wombat found")))
+
+      {:arena-config (:simulator-template/arena-template simulator-template)
+       :players {(gen-id) {:player {:player/color "gray"}
+                           :stats initial-stats
+                           :user {:user/github-username (:user/github-username user)
+                                  :user/github-access-token (:user/github-access-token user)}
+                           :wombat {:wombat/id (:wombat/id wombat)
+                                    :wombat/name (:wombat/name wombat)
+                                    :wombat/url (:wombat/url wombat)}
+                           :state {:code nil
+                                   :command nil
+                                   :error nil
+                                   :saved-state {}}}}
+       :frame {:frame/frame-number 0
+               :frame/round-number 1
+               :frame/round-start-time nil
+               :frame/arena (:simulator-template/arena simulator-template)}})
+    (catch Exception e
+      {:error (.getMessage e)})))

 (defn t-sim
   [game-state]
@@ -231,15 +244,21 @@
   [datomic]
   (fn [{:keys [chan-id :user/id] :as socket-user}
       {:keys [simulator-template-id wombat-id]}]
-
-    (send-message
-     chan-id
-     (-> (build-simulation-game-state socket-user
-                                      wombat-id
-                                      simulator-template-id
-                                      datomic)
-         (i/initialize-game-state)
-         (m/simulation-message)))))
+    (let [game-state (build-simulation-game-state socket-user
+                                                  wombat-id
+                                                  simulator-template-id
+                                                  datomic)]
+
+      (if (:error game-state)
+        (send-message
+         chan-id
+         (-> game-state
+             (m/simulation-message)))
+        (send-message
+         chan-id
+         (-> game-state
+             (i/initialize-game-state)
+             (m/simulation-message)))))))

 (defn- process-simulation-frame
   [datomic]


More efficient generation for :embed spec

--- src/plumula/delta/spec/helper.cljc
+++ src/plumula/delta/spec/helper.cljc
@@ -1,5 +1,6 @@
 (ns plumula.delta.spec.helper
   (:require [clojure.spec.alpha :as s]
+            [clojure.spec.gen.alpha :as gen]
             [clojure.string :as string])
   #?(:cljs (:require-macros [plumula.delta.spec.helper])))

@@ -8,11 +9,14 @@

 (def text
   ""
-  (s/and string? #(-> % count pos?)))
+  (s/and string? seq))

 (def embed
   ""
-  (s/map-of keyword? any? :kind #(= (count %) 1)))
+  (-> (s/map-of keyword? any? :kind #(= (count %) 1))
+      (s/with-gen #(gen/fmap (fn [[k v]] {k v})
+                             (gen/tuple (gen/gen-for-pred keyword?)
+                                        (gen/gen-for-pred any?))))))

 (def attributes
   ""


critter rule 1

critter rule 1

--- src/critter_cljs/core.cljs
+++ src/critter_cljs/core.cljs
@@ -6,24 +6,57 @@

 ;; define your app data so that it doesn't get over-written on reload

+(defn init-critters []
+    (let [names ["Slipper" "Allegra" "Squeaky" "Sarah Jane" "Totoro"]]
+        (map #(hash-map :name % :x (rand-int 500) :y (rand-int 500)) names)))
+
 (defonce app-state (atom {
-    :critters [
-        {:name "Slipper" :x 50 :y 50 :id 1}
-        {:name "Allegra" :x 100 :y 150 :id 2}]
+    :critters (init-critters)
     :width 500
     :height 500 }))

 ; +/- x
 (defn rand-center [x] (- (rand (* 2 x)) x))
+(defn mean [xs] (/ (apply + xs) (count xs)))

 (defn to-random-nearby [it]
-    (let [{:keys [x y]} it]
-        (assoc it :x (+ (rand-center 5) x) :y (+ (rand-center 5) y))))
+    (let [{:keys [x y]} it]
+        (assoc it :x (+ (rand-center 5) x)
+                  :y (+ (rand-center 5) y))))

+(defn center-of-points [ps]
+    {:x (mean (map :x ps))
+     :y (mean (map :y ps))})
+
+(defn to-point-fn [f] (fn [a b]
+    (assoc a :x (f (:x a) (:x b))
+             :y (f (:y a) (:y b)))))
+
+(defn polar->cartesian [{:keys [r angle]}]
+    {:x (* r (Math/cos angle))
+     :y (* r (Math/sin angle))})
+
+(defn cartesian->polar [{:keys [x y]}]
+    {:r     (Math/sqrt (+ (* x x) (* y y)))
+     :angle (Math/atan2 y x)})
+
+(def add-point (to-point-fn +))
+(def subtract-point (to-point-fn -))
+
+(defn abs-point [a]
+    assoc a :x (Math/abs (:x a))
+            :y (Math/abs (:y a)))
+
+(defn move-towards [r start end]
+    (let [angle (:angle (cartesian->polar (subtract-point start end)))
+          diff (polar->cartesian {:angle angle :r r})]
+        (subtract-point start diff)))

 (defn move-critters! []
     (let [{:keys [width height critters]} @app-state
-        next-critters (map to-random-nearby critters)]
+          critter-target (center-of-points critters)
+          move-towards-target #(move-towards 10 % critter-target)
+          next-critters (map move-towards-target critters)]
         (swap! app-state assoc :critters next-critters)))

 (defn app-loop! []


Cleaner implementation of settings-list :shower:

--- src/metabase/models/setting.clj
+++ src/metabase/models/setting.clj
@@ -278,17 +278,13 @@
   "Return a list of all Settings (as created with `defsetting`).
    This excludes Settings created with the option `:internal`."
   []
-  (->> (all-ns)
-       (mapcat ns-interns)
-       vals
-       (map meta)
-       (filter ::is-setting?)
-       (filter (complement (u/rpartial get-in [::options :internal]))) ; filter out :internal Settings
-       (map (fn [{k :name, description ::description, default ::default-value}]
-              {:key         (keyword k)
-               :description description
-               :default     (or (when (get-from-env-var k)
-                                  (format "Using $MB_%s" (-> (name k)
-                                                             (s/replace "-" "_")
-                                                             s/upper-case)))
-                                default)}))))
+  (for [namespce (all-ns)
+        [_ varr] (ns-interns namespce)
+        :let     [{k :name, description ::description, default ::default-value, :as metta} (meta varr)]
+        :when    (and (::is-setting? metta)
+                      (not (get-in metta [::options :internal])))]
+    {:key         (keyword k)
+     :description description
+     :default     (or (when (get-from-env-var k)
+                        (format "Using $MB_%s" (s/upper-case (s/replace (name k) "-" "_"))))
+                      default)}))


Refactor wrap-require-authorization to recieve uri

--- src/cylon/oauth/client.clj
+++ src/cylon/oauth/client.clj
@@ -48,7 +48,7 @@
   to the request. If a role is specified, also check that the role
   exists in the scope of the client. If role isn't specified, the
   identity and access-token are still retrieved."
-  [h client & [role]]
+  [h uri client & [role]]
   (fn [req]
     (let [{:keys [access-token scope]}
           (s/with-fn-validation (get-access-token+ client req))]
@@ -56,7 +56,7 @@
        (nil? access-token)
        (do
          (debugf "No access token, so soliciting one from client %s" client)
-         (solicit-access-token  client req (:signup-uri client)))
+         (solicit-access-token  client req uri))
        (expired? client req access-token)
        (do
          (debugf "access token has expired, seeking to refresh it")
@@ -76,27 +76,4 @@

 (defn wrap-require-authorization
   [h client  & [role]]
-  (fn [req]
-    (let [{:keys [access-token scope]}
-          (s/with-fn-validation (get-access-token+ client req))]
-      (cond
-       (nil? access-token)
-       (do
-         (debugf "No access token, so soliciting one from client %s" client)
-         (solicit-access-token  client req (:authorize-uri client)))
-       (expired? client req access-token)
-       (do
-         (debugf "access token has expired, seeking to refresh it")
-         ;; The thinking here is that any refresh token that was returned
-         ;; to the client will still be held by the client and can be
-         ;; used to refresh the access-token
-         (refresh-access-token client req))
-
-       (and role (not (contains? scope role)))
-       ;; TODO Must do something better than this
-       {:status 401 :body "Sorry, you just don't have enough privileges to access this page"}
-
-       :otherwise
-       (h (assoc req
-            :identity (get-identity client req)
-            :access-token access-token))))))
+  (wrap-require-authorization-base h (:authorize-uri client) client role))


Refactor

Refactor

--- backend/src/akvo/lumen/transformation/split_column.clj
+++ backend/src/akvo/lumen/transformation/split_column.clj
@@ -84,17 +84,16 @@
                                   (add-column tenant-conn {:table-name      table-name
                                                            :column-type     (:type c)
                                                            :new-column-name (:id c)}))
-              update-db-columns (->> (select-rnum-and-column tenant-conn {:table-name table-name :column-name column-name})
-                                     (map
-                                      #(let [value       ((keyword column-name) %)
-                                             values      (as-> (string/split value re-pattern*) values
-                                                           (if (empty? values)
-                                                             (cons value (repeat nil))
-                                                             values))
-                                             update-vals (map (fn [a b]
-                                                                [(keyword (:id a)) b]) new-columns values)]
-                                         (update-row tenant-conn table-name (:rnum %) update-vals)))
-                                     doall)]
+              update-db-columns (doseq [row (select-rnum-and-column tenant-conn {:table-name table-name :column-name column-name})]
+                                  (let [value       ((keyword column-name) row)
+                                        values      (as-> (string/split value re-pattern*) values
+                                                      (if (empty? values)
+                                                        (cons value (repeat nil))
+                                                        values))
+                                        update-vals (map (fn [column v]
+                                                           [(keyword (:id column)) v])
+                                                         new-columns values)]
+                                    (update-row tenant-conn table-name (:rnum row) update-vals)))]
           {:success?      true
            :execution-log [(format "Splitted column %s with pattern %s" column-name pattern)]
            :columns       (into columns (vec new-columns))})


Remove superfluous arguments.

Remove superfluous arguments.

--- src/dsbdp/data_processing_dsl.clj
+++ src/dsbdp/data_processing_dsl.clj
@@ -13,7 +13,7 @@
   (:require [dsbdp.byte-array-conversion :refer :all]))

 (defn create-data-processing-sub-fn
-  [data-processing-definition input offset]
+  [data-processing-definition input]
   (into
     '()
     (reverse
@@ -34,7 +34,7 @@
                       (println "Could not resolve symbol:" s)
                       v)))
             (list? data-proc-def-element)
-              (conj v (into '() (reverse (create-data-processing-sub-fn data-proc-def-element input offset))))
+              (conj v (into '() (reverse (create-data-processing-sub-fn data-proc-def-element input))))
             :default (conj v data-proc-def-element)))
         [] data-processing-definition))))

@@ -46,36 +46,36 @@
    For determining the type, this function calls data-proc-sub-fn with a 1530 byte dummy byte-array filled with 0."
   [data-proc-sub-fn]
   (let [dummy-ba (byte-array 1530 (byte 0))
-        ret (data-proc-sub-fn dummy-ba 0)]
+        ret (data-proc-sub-fn dummy-ba)]
     (type ret)))

 (defn create-data-processing-fn-body-for-java-map-output-type
   "Create a data processing function body for emitting data into a Java map."
-  [input offset rules]
+  [input rules]
   (reduce
     (fn [v rule]
       (conj v `(.put
                 ~(name (first rule))
-                ~(create-data-processing-sub-fn (second rule) input offset))))
+                ~(create-data-processing-sub-fn (second rule) input))))
     '[doto (java.util.HashMap.)] rules))

 (defn create-data-processing-fn-body-for-clj-map-output-type
   "Create a data processing function body for emitting data into a Clojure map."
-  [input offset rules]
+  [input rules]
   (reduce
     (fn [v rule]
       (conj v `(assoc
                  ~(name (first rule))
-                 ~(create-data-processing-sub-fn (second rule) input offset))))
+                 ~(create-data-processing-sub-fn (second rule) input))))
     '[-> {}] rules))

 (defn create-data-processing-fn-body-for-csv-str-output-type
   "Create a data processing function body for emitting data into a CSV string."
-  [input offset rules]
+  [input rules]
   (let [extracted-strings (reduce
                             (fn [v rule]
-                              (let [data-proc-sub-fn (create-data-processing-sub-fn (second rule) input offset)
-                                    data-proc-sub-fn-ret-type (get-data-processing-sub-fn-ret-type (eval `(fn [~input ~offset] ~data-proc-sub-fn)))]
+                              (let [data-proc-sub-fn (create-data-processing-sub-fn (second rule) input)
+                                    data-proc-sub-fn-ret-type (get-data-processing-sub-fn-ret-type (eval `(fn [~input] ~data-proc-sub-fn)))]
                                 (conj v (if (= java.lang.String data-proc-sub-fn-ret-type)
                                           `(str "\"" ~data-proc-sub-fn "\"")
                                           data-proc-sub-fn))))
@@ -85,12 +85,12 @@

 (defn create-data-processing-fn-body-for-json-str-output-type
   "Create a data processing function body for emitting data into a JSON string."
-  [input offset rules]
+  [input rules]
   (let [extracted-strings (conj
                             (reduce
                               (fn [v rule]
-                                (let [data-proc-sub-fn (create-data-processing-sub-fn (second rule) input offset)
-                                      data-proc-sub-fn-ret-type (get-data-processing-sub-fn-ret-type (eval `(fn [~input ~offset] ~data-proc-sub-fn)))]
+                                (let [data-proc-sub-fn (create-data-processing-sub-fn (second rule) input)
+                                      data-proc-sub-fn-ret-type (get-data-processing-sub-fn-ret-type (eval `(fn [~input] ~data-proc-sub-fn)))]
                                   (conj v "\"" (name (first rule)) "\":"
                                           (if (= java.lang.String data-proc-sub-fn-ret-type)
                                             `(str "\"" ~data-proc-sub-fn "\"")
@@ -106,18 +106,17 @@
   [dsl-expression]
 ;  (println "Got DSL expression:" dsl-expression)
   (let [input-sym 'input
-        offset-sym 'offset
         fn-body-vec (let [output-type (:output-type dsl-expression)
                           rules (:rules dsl-expression)]
                       (condp = (name output-type)
-                        "java-map" (create-data-processing-fn-body-for-java-map-output-type input-sym offset-sym rules)
-                        "clj-map" (create-data-processing-fn-body-for-clj-map-output-type input-sym offset-sym rules)
-                        "csv-str" (create-data-processing-fn-body-for-csv-str-output-type input-sym offset-sym rules)
-                        "json-str" (create-data-processing-fn-body-for-json-str-output-type input-sym offset-sym rules)
+                        "java-map" (create-data-processing-fn-body-for-java-map-output-type input-sym rules)
+                        "clj-map" (create-data-processing-fn-body-for-clj-map-output-type input-sym rules)
+                        "csv-str" (create-data-processing-fn-body-for-csv-str-output-type input-sym rules)
+                        "json-str" (create-data-processing-fn-body-for-json-str-output-type input-sym rules)
                         (do
                           (println "Unknown output type:" output-type)
                           (println "Defaulting to :java-map as output type.")
-                          (create-data-processing-fn-body-for-java-map-output-type input-sym offset-sym rules))))
+                          (create-data-processing-fn-body-for-java-map-output-type input-sym rules))))
 ;        _ (println "Created data processing function vector from DSL:" fn-body-vec)
         fn-body (reverse (into '() fn-body-vec))
         _ (println "Created data processing function body:" fn-body)


Add hydrate-root to client ns

Add hydrate-root to client ns

--- src/reagent/dom/client.cljs
+++ src/reagent/dom/client.cljs
@@ -18,6 +18,8 @@
   (.unmount root))

 (defn- reagent-root [^js js-props]
+  ;; This will flush initial r/after-render callbacks.
+  ;; Later that queue will be flushed on Reagent render-loop.
   (let [el (gobj/get js-props "comp")]
     (react/useEffect (fn []
                        (binding [util/*always-update* false]
@@ -37,3 +39,11 @@
          ;; render, and handles the *always-update* binding correctly?
          comp (fn [] (p/as-element compiler el))]
      (.render root (react/createElement reagent-root #js {:comp comp})))))
+
+(defn hydrate-root
+  ([container el]
+   (hydrate-root container el nil))
+  ([container el {:keys [compiler on-recoverable-error identifier-prefix]
+                  :or {compiler tmpl/*current-default-compiler*}}]
+   (let [comp (fn [] (p/as-element compiler el))]
+     (react-dom-client/hydrateRoot container (react/createElement reagent-root #js {:comp comp})))))


[#10369] App freezes on transaction signing after entering wrong password

Signed-off-by: Andrey Shovkoplyas <b713972e59b8e606e23253c4a13e948139fea4d1@gmail.com>

--- src/status_im/signing/core.cljs
+++ src/status_im/signing/core.cljs
@@ -335,7 +335,9 @@
   {:events       [:signing/transaction-completed]
    :interceptors [(re-frame/inject-cofx :random-id-generator)]}
   [cofx response tx-obj hashed-password]
-  (let [cofx-in-progress-false (assoc-in cofx [:db :signing/in-progress?] false)
+  (let [cofx-in-progress-false (-> cofx
+                                   (assoc-in [:db :signing/in-progress?] false)
+                                   (assoc-in [:db :signing/sign :in-progress?] false))
         {:keys [result error]} (types/json->clj response)]
     (log/debug "transaction-completed" error tx-obj)
     (if error


On Hold status for Run Rows

On Hold status for Run Rows

--- src-cljs/frontend/components/pieces/run_row.cljs
+++ src-cljs/frontend/components/pieces/run_row.cljs
@@ -309,7 +309,8 @@
                         (case status
                           (:run-status/running
                            :run-status/not-run
-                           :run-status/needs-setup)
+                           :run-status/needs-setup
+                           :run-status/on-hold)
                           (and started-at (nil? stopped-at))

                           (:run-status/succeeded
@@ -336,7 +337,8 @@
                        :run-status/failed
                        :run-status/canceled
                        :run-status/not-run
-                       :run-status/needs-setup})
+                       :run-status/needs-setup
+                       :run-status/on-hold})
   (s/def :run/started-at (s/nilable inst?))
   (s/def :run/stopped-at (s/nilable inst?))
   (s/def :trigger-info/vcs-revision (s/with-gen
@@ -383,6 +385,7 @@
     (let [statuses [:run-status/needs-setup
                     :run-status/not-run
                     :run-status/running
+                    :run-status/on-hold
                     :run-status/succeeded
                     :run-status/failed
                     :run-status/canceled]]


treat label formatter as option

treat label formatter as option

--- src/unspun/components/bars.cljs
+++ src/unspun/components/bars.cljs
@@ -19,7 +19,7 @@

 (defn animate-function [key f initial-value]
   (letfn [(upd [state]
-            (let [[_ _ value] (:rum/args state)]
+            (let [[_ value] (:rum/args state)]
               #_(.start (animated-spring (key state) #js {:toValue (f value) :friction 10 :tension 60}))
               (.start (animated-timing (key state) #js {:toValue (f value) :duration 200
                                                         :easing  (ease-out ease)}))
@@ -36,7 +36,7 @@
     (view {:style header-style})))

-(defn bar-value-label [{:keys [font-size font-weight text-color on-edge]} palette formatter value]
+(defn bar-value-label [{:keys [font-size font-weight text-color on-edge formatter]} palette value]
   (view {:style {:flex           1
                  :position       "absolute"
                  on-edge         0
@@ -49,40 +49,46 @@
                        :fontWeight font-weight}}
               (formatter value))))

+(defn percentage [value]
+  (str (to-pc value) "%"))
+
 (def inner-top-label (partial bar-value-label {:font-size   26
                                                :font-weight "400"
                                                :text-color  :text-icons
-                                               :on-edge     :bottom}))
+                                               :on-edge     :bottom
+                                               :formatter   percentage}))

 (def outer-bottom-label (partial bar-value-label {:font-size   26
                                                   :font-weight "400"
                                                   :text-color  :dark-primary
-                                                  :on-edge     :top}))
+                                                  :on-edge     :top
+                                                  :formatter percentage}))

 (defcs top-bar < rum/static
                  (animate-function ::height #(- 1 %) 0.5)
-                 "The top and bottom bars split the vertical space in the ratio (1-value) : value.
+                 "The top and bottom bars split the vertical flex space in the ratio (1-value) : value.
+                 Both are animated views which morph between changed values.
                  Here we only allow 2 bars so we can label them inside if there is space, or above if not.
                  The top bar colours are chosen to be the same as the background"
-  [state palette formatter value]
+  [state palette value]
   (animated-view {:style {:flex            (::height state)
                           :backgroundColor (:primary palette)}}
                  (when (< value 0.1)
-                   (inner-top-label palette formatter value))))
+                   (inner-top-label palette value))))

 (defcs bottom-bar < rum/static
                     (animate-function ::height identity 0.5)
-  [state palette formatter value]
+  [state palette value]
   (animated-view {:style {:flex            (::height state)
                           :backgroundColor (:light-primary palette)}}
                  (when (>= value 0.1)
-                   (outer-bottom-label palette formatter value))))
+                   (outer-bottom-label palette value))))

 (defcs labelled-vertical-bar < rum/static
-  [state palette formatter value]
+  [state palette value]
   (view {:style {:flex 1}}
-        (top-bar palette formatter value)
-        (bottom-bar palette formatter value)
+        (top-bar palette value)
+        (bottom-bar palette value)
         ))

 (defcs page < rum/reactive [state]
@@ -126,9 +132,9 @@
                                        :textAlign    "right"
                                        :paddingRight 10}}
                               "Without"))
-                  (view {:style {:flex 0.2}} (labelled-vertical-bar palette #(str (to-pc %) "%") br))
+                  (view {:style {:flex 0.2}} (labelled-vertical-bar palette br))
                   (view {:style {:flex 0.04}})
-                  (view {:style {:flex 0.2}} (labelled-vertical-bar palette #(str (to-pc %) "%") er))
+                  (view {:style {:flex 0.2}} (labelled-vertical-bar palette er))
                   (view {:style {:flex           0.3
                                  :justifyContent "center"}}
                         (text {:style {:color     (:text-icons palette)


Fixes crypto

Fixes crypto

--- src/great_things_done/crypto.cljs
+++ src/great_things_done/crypto.cljs
@@ -1,7 +1,8 @@
 (ns great-things-done.crypto
   "Encryption/Decryption node modulde based on https://gist.github.com/chris-rock/993d8a22c7138d1f0d2e#file-crypto-ctr-js")

-(def ^:private crypto (js/require "crypto"))
+(def ^:private remote (js/require "remote"))
+(def ^:private crypto (.require remote "crypto"))

 ;; function encrypt(text){
 ;;   var cipher = crypto.createCipher(algorithm,password)
@@ -15,7 +16,7 @@
   [text password & {:keys [algorithm]
                     :or {algorithm "aes-256-ctr"}}]
   (let [cipher  (.createCipher crypto algorithm password)
-        crypted (.update cipher text "utf8" "hex")]
+        crypted (.update cipher (str text) "utf8" "hex")]
     (+ crypted (.final cipher "hex"))))

 ;; function decrypt(text){
@@ -30,5 +31,5 @@
   [text password & {:keys [algorithm]
                     :or {algorithm "aes-256-ctr"}}]
   (let [decipher  (.createDecipher crypto algorithm password)
-        decrypted (.update decipher text "hex" "utf8")]
+        decrypted (.update decipher (str text) "hex" "utf8")]
     (+ decrypted (.final decipher "utf8"))))


:print handling

:print handling

--- src/leiningen/ancient/upgrade.clj
+++ src/leiningen/ancient/upgrade.clj
@@ -156,16 +156,18 @@

 (defn- with-backup
   "Wraps a given function to produce/restore backup files. Returns true
-   if new data was written to disk."
+   if new data was written to disk. Will not create backups if `:print` is specified."
   [upgrade-fn]
   (fn [settings path]
     (let [^File f (io/file path)
           ^String path (.getCanonicalPath f)]
       (verbose "Upgrading artifacts in: " path)
-      (when-let [backup (create-backup-file! f settings)]
-        (if (upgrade-fn settings path)
-          (do (delete-backup-file! backup) true)
-          (do (replace-with-backup! f backup) nil))))))
+      (if (:print settings)
+        (upgrade-fn settings path)
+        (when-let [backup (create-backup-file! f settings)]
+          (if (upgrade-fn settings path)
+            (do (delete-backup-file! backup) true)
+            (do (replace-with-backup! f backup) nil)))))))

 (def upgrade-project-file!
   "Run upgrade on the given project file using the given settings."


Some modifications for context-for-clop

Some modifications for context-for-clop

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

--- stuff/code/context-for-clop.clj
+++ stuff/code/context-for-clop.clj
@@ -85,11 +85,14 @@
            start#)
         1000.0)))

-(defn test-context-for-clop-versions [number-of-contexts size-limit]
+(defn test-context-for-clop-versions [number-of-contexts size-of-base-set]
   (doseq [ctx  (take number-of-contexts
                      (remove #(or (empty? (objects %))
                                   (empty? (attributes %)))
-                             (repeatedly #(rand-context size-limit size-limit (rand 1.0)))))]
+                             (repeatedly #(reduce-context
+                                           (rand-context (rand-int (expt 2 size-of-base-set))
+                                                         size-of-base-set
+                                                         (rand 1.0))))))]
     (let [cntr   (atom 0)
           clop   #(do (swap! cntr inc)
                       (context-attribute-closure ctx %)),
@@ -99,7 +102,9 @@
                      (reset! atom 0)
                      val))]
       (cl-format *out*
-                 "~5d ~5d | ~7,3f ~5d | ~7,3f ~5d | ~7,3f ~5d | ~7,3f ~5d~%"
+                 "~5d ~5d ~5d ~5d ~8,3f ~5d ~8,3f ~5d ~8,3f ~5d ~8,3f ~5d~%"
+                 (count (objects ctx))
+                 (count (attributes ctx))
                  (count (concepts ctx))
                  (count (pseudo-intents ctx))
                  (time* (context-for-clop-v0 clop M))


Logelei-1 oneof

Logelei-1 oneof

--- src/examples/logelei_1.clj
+++ src/examples/logelei_1.clj
@@ -259,14 +259,11 @@
 ; x = x owns the mule

 (def phi6
-  '(and
-     (or a b c)
-     (or (not a) (not b))
-     (or (not a) (not c))
-     (or (not b) (not c)) ; exactly one of #{a b c}
+  (list 'and
+     (oneof '[a b c])
      #_(xor c (not a))      ; a and c make the same proposition
-     (xor (not c) a)
-     (xor c (not a))))
+     '(xor (not c) a)
+     '(xor c (not a))))

 (tt phi6)

@@ -289,7 +286,7 @@

 (def phi7
   '(impl
-     (and (not c) (if m c))
+     (and (not c) (cimpl m c))
      (not m)))

 (tt phi7)


Add a means of defining an agent sensor in terms of a functional form. Useful to for lexical capture.

--- metlog-agent/src/metlog_agent/core.clj
+++ metlog-agent/src/metlog_agent/core.clj
@@ -41,11 +41,18 @@

 (def default-sensor-attrs {:poll-interval (minutes 1)})

+(defmacro defsensor*
+  ([ name attrs fn-form ]
+   (let [attrs (merge default-sensor-attrs attrs)]
+     `(add-sensor-def '~name (merge ~attrs {:sensor-fn ~fn-form}))))
+
+  ([ name fn-form ]
+   `(defsensor* ~name {} ~fn-form)))
+
 (defmacro defsensor [ name & body ]
-  (let [attrs (merge default-sensor-attrs
-                     (if (map? (first body)) (first body) {}))
-        body (if (map? (first body)) (next body) body)]
-    `(add-sensor-def '~name (merge ~attrs {:sensor-fn (fn [] ~@body)}))))
+  (if (map? (first body))
+    `(defsensor* ~name ~(first body) (fn [] ~@(rest body)))
+    `(defsensor* ~name {}  (fn [] ~@body))))

 (defn all-sensors []
   (let [ current-sensor-defs @sensor-defs ]


change for selection field

change for selection field

--- src/graphql_clj/parser.clj
+++ src/graphql_clj/parser.clj
@@ -70,15 +70,10 @@
                    [:selection-set args])
    :Selection (fn selection [& args]
                 (println "Selection: " args)
-                (let [selection (into {} args)
-                      props (dissoc selection :selection-set)
-                      selection-set (:selection-set selection)]
-                  (if selection-set
-                    (into [:selection props] selection-set)
-                    [:selection props])))
+                (into [:selection] args))
    :Field (fn field [& args]
             (println "Field: " args)
-            (into {} args))
+            [:field (into {} args)])
    :Arguments (fn arguments [& args]
                 (println "Arguments: " args)
                 [:arguments (into {} args)])
@@ -98,16 +93,23 @@
    transformation-test
    parse-tree))

-(defn evaluate-selection [selection]
-  [:user "test user"])
-
-(defn collect-fields [object-type selection-set visited-fragments]
-  (map evaluate-selection selection-set))
+(defn collect-selection [m selection]
+  )
+
+(defn collect-fields
+  "CollectFields(objectType, selectionSet, visitedFragments)"
+  [object-type selection-set visited-fragments]
+  (reduce collect-selection {} selection-set))
+
+(defn get-field-entry [object-type object fields]
+  )

 (defn execute-query [query]
   (let [selection-set (:selection-set query)
-        visitied-fragments nil]
-    (into {} (collect-fields :root selection-set visitied-fragments))))
+        visitied-fragments nil
+        fields (collect-fields :root selection-set visitied-fragments)]
+    (println "fields: " fields)
+    {:user "test user"}))

 (defn execute-definition
   [definition]


todos

todos

--- src/tango/import_engine.clj
+++ src/tango/import_engine.clj
@@ -4,7 +4,8 @@
             [taoensso.timbre :as log]
             [tango.import :as import]
             [clojure.core.match :refer [match]]
-            [tango.datomic-storage :as d]))
+            [tango.datomic-storage :as d]
+            [tango.generate-recalled :as gen]))

 ;; TODO - default to #(java.util.UUID/randomUUID)
 (defn- start-message-handler [in-channel out-channel {:keys [id-generator-fn datomic-uri]}]
@@ -33,9 +34,20 @@
                      ;; TODO - verify all indata i.e. p needs a :content here
                      (let [import-result (import/import-file-stream
                                            (:content p)
-                                           id-generator-fn)]
-                       (async/put! out-channel (merge message {:topic   :file/imported
-                                                               :payload import-result}))))
+                                           id-generator-fn)
+                           recalled-html (gen/generate-recalled-html import-result)
+                           ;; TODO - filter known
+                           ;; - read filtered from file
+                           ;; - filter recalled-html on activity number
+                           ;; - conj and save new known generated numbers
+                           ;; - map spit on filtered recalled
+                           ]
+                       (do
+                         ;; Insert code here for now
+                         ;; use (log/info to find problems, check that core.clj :log-level is
+                         ;; as expected
+                         (async/put! out-channel (merge message {:topic   :file/imported
+                                                                 :payload import-result})))))
                    [:file/ping p]
                    (async/put! out-channel (merge message {:topic :file/pong}))
                    :else (async/>!!


RR: id as default field

RR: id as default field

--- src/hatti/views/table.cljs
+++ src/hatti/views/table.cljs
@@ -21,7 +21,8 @@
 (defn get-extra-fields
    "Extra fields that will be displayed on the table."
   [is-filtered-dataview?]
-  (let [extra-field  [{:full-name _rank :label "#" :name _rank :type "integer"}]]
+  (let [extra-field  [{:full-name _id :label "id" :name _id :type
+                                  "integer"}]]
     (if is-filtered-dataview?
       extra-field
       (conj extra-field forms/submission-time-field))))


Function to calculate value from typical range

--- src/test_utils/sandbox.cljs
+++ src/test_utils/sandbox.cljs
@@ -321,6 +321,14 @@
 (defn rand-ratio []
   (tuc/draw-normal 3.09 0.42))

+(defn value-from-typical-range [typical-min typical-max]
+  "Generate a normally-distributed, random value with the range typical-min to typical-max, inclusive."
+  {:pre (< typical-min typical-max)}
+  (let [mean (/ (+ typical-min typical-max) 2)
+        ;; Typical range (assumed normal) is within 3-sigma of the mean
+        sigma (/ mean 6)]
+    (tuc/draw-normal mean sigma)))
+
 (defn typical-monitor-pressure [units]
   (cond (= units :psi)
         (first (p-mon-seq))
@@ -331,51 +339,28 @@

 (defn typical-monitor-temperature [units]
   (cond (= units :C)
-        (let [typical-min 50
-              typical-max 80
-              mean (/ (+ typical-min typical-max) 2)
-              sigma (/ mean 3)]
-          (tuc/draw-normal mean sigma))
+        (value-from-typical-range 50 80)
         (= units :F)
         (+ (* (typical-monitor-temperature :C) 1.8) 32)))

 (defn typical-surface-treating-pressure [units]
   (cond (= units :psi)
-        (let [typical-min 5000
-              typical-max 9000
-              mean (/ (+ typical-min typical-max) 2)
-              sigma (/ mean 3)]
-          (tuc/draw-normal mean sigma))
+        (value-from-typical-range 5000 9000)
         (= units :kPa)
         (* (typical-surface-treating-pressure :psi) 6.89476)
         (= units :MPa)
         (/ (typical-surface-treating-pressure :kPa) 1000)))

 (defn typical-injection-rate [units]
-  (cond (= units :bbl-per-min)
-        (let [typical-min 75
-              typical-max 100
-              mean (/ (+ typical-min typical-max) 2)
-              sigma (/ mean 3)]
-          (tuc/draw-normal mean sigma))
+  (cond (or (= units :bbl-per-min)
+            (= units :bpm))
+        (value-from-typical-range 75 100)
         (= units :l-per-s)
-        (let [typical-min 198.75
-              typical-max 265
-              mean (/ (+ typical-min typical-max) 2)
-              sigma (/ mean 3)]
-          (tuc/draw-normal mean sigma))
+        (value-from-typical-range 198.75 265)
         (= units :cu-ft-per-s)
-        (let [typical-min 7.05
-              typical-max 9.4
-              mean (/ (+ typical-min typical-max) 2)
-              sigma (/ mean 3)]
-          (tuc/draw-normal mean sigma))))
+        (value-from-typical-range 7.05 9.4)))

 (defn typical-proppant-concentration [units]
    (cond (= units :ppga)
-         (let [typical-min 0.2
-               typical-max 10
-               mean (/ (+ typical-min typical-max) 2)
-               sigma (/ mean 3)]
-           (tuc/draw-normal mean sigma))))
+         (value-from-typical-range 0.2 10)))


probably passing

probably passing

--- test/clj/fractals/example_test.clj
+++ test/clj/fractals/example_test.clj
@@ -14,9 +14,6 @@
   (prop/for-all [v (gen/vector gen/int)]
                 (= (sort v) (sort (sort v)))))

-(defspec prop-sorted-first-less-than-last
-  100
-  (prop/for-all [v (gen/not-empty (gen/vector gen/int))]))

 (s/conform even? 1000)


Fix indentation of gen-structure-digits in tests

--- test/cljc/imbarcode/core_test.cljc
+++ test/cljc/imbarcode/core_test.cljc
@@ -69,10 +69,10 @@

 (def gen-structure-digits
   (gen/fmap #(apply str %)
-   (gen/tuple barcode
-              (gen/fmap #(apply str %)
-                        (gen/vector (gen/choose 0 9) 18))
-              routing-code)))
+            (gen/tuple barcode
+                       (gen/fmap #(apply str %)
+                                 (gen/vector (gen/choose 0 9) 18))
+                       routing-code)))

 (defspec encode-spec 1000
   (prop/for-all [structure-digits gen-structure-digits]


Emacs fixed some whitespace

Emacs fixed some whitespace

--- test/foreclojure/test/register.clj
+++ test/foreclojure/test/register.clj
@@ -6,7 +6,7 @@
   (:use [midje.sweet])
   (:use [foreclojure.utils :only [form-row assuming flash-error]])
   (:use [somnium.congomongo :only [insert! fetch-one]]))
-
+

@@ -28,37 +28,36 @@
                          (session/flash-put! :email anything) => nil]
       (fact "about do-register - good inputs"
           (do-register uname pwd pwd email) => truthy
-            (provided
+            (provided
               (response/redirect "/") => 1))
       (fact "about do-register - userexists"
           (do-register uname pwd pwd email) => truthy
-            (provided
+            (provided
               (fetch-one :users :where {:user uname}) => {:user "username"}
               (flash-error "/register" "User already exists") => 1))
       (fact "about do-register - username too long"
           (do-register lngname pwd pwd email) => truthy
-            (provided
+            (provided
               (flash-error "/register" "Username must be 4-13 characters long") => 1))
       (fact "about do-register - username not alphanumeric"
           (do-register bname pwd pwd email) => truthy
-            (provided
+            (provided
               (flash-error "/register" "Username must be alphanumeric") => 1))
       (fact "about do-register - short password"
           (do-register uname shpwd shpwd email) => truthy
-            (provided
+            (provided
               (flash-error "/register" "Password must be at least seven characters long") => 1))
       (fact "about do-register - passwords don't match"
           (do-register uname pwd shpwd email) => truthy
-            (provided
+            (provided
               (flash-error "/register" "Passwords don't match") => 1))
       (fact "about do-register - bad emal"
           (do-register uname pwd pwd bemail) => truthy
-            (provided
+            (provided
               (flash-error "/register" "Please enter a valid email address") => 1))
       (fact "about do-register - email exists"
           (do-register uname pwd pwd email) => truthy
-            (provided
+            (provided
               (fetch-one :users :where {:user uname}) => nil
               (fetch-one :users :where {:email email}) => {:user "username"}
               (flash-error "/register" "User with this email address already exists") => 1)))))
-


Compose tests inside `testing` forms I just discovered that when multiple tasks are in the same `testing` form, only the last one gets composed into the main task. This resulted in some checks being skipped.

--- test/io/perun_test.clj
+++ test/io/perun_test.clj
@@ -144,12 +144,13 @@
                                        :description "Test Desc"}))
         (p/markdown)
         (testing "markdown"
-          (value-test :path "2017-01-01-test.md"
-                      :value-fn #(meta= % :parsed parsed-md-basic)
-                      :msg "`markdown` should set `:parsed` metadata on markdown file")
-          (content-test :path "2017-01-01-test.html"
-                        :content parsed-md-basic
-                        :msg "`markdown` should populate HTML file with parsed content"))
+          (comp
+           (value-test :path "2017-01-01-test.md"
+                       :value-fn #(meta= % :parsed parsed-md-basic)
+                       :msg "`markdown` should set `:parsed` metadata on markdown file")
+           (content-test :path "2017-01-01-test.html"
+                         :content parsed-md-basic
+                         :msg "`markdown` should populate HTML file with parsed content")))

         (p/ttr)
         (testing "ttr"
@@ -232,12 +233,13 @@
                                        :description "Test Desc"}))
         (p/markdown :meta {:markdown-set :metadata} :options {:extensions {:smarts true}})
         (testing "markdown"
-          (value-test :path "test.md"
-                      :value-fn #(meta= % :parsed parsed-md-smarts)
-                      :msg "`markdown` should set `:parsed` metadata on markdown file")
-          (content-test :path "test.html"
-                        :content parsed-md-smarts
-                        :msg "`markdown` should populate HTML file with parsed content"))
+          (comp
+           (value-test :path "test.md"
+                       :value-fn #(meta= % :parsed parsed-md-smarts)
+                       :msg "`markdown` should set `:parsed` metadata on markdown file")
+           (content-test :path "test.html"
+                         :content parsed-md-smarts
+                         :msg "`markdown` should populate HTML file with parsed content")))

         (p/ttr :filterer :markdown-set)
         (testing "ttr"
@@ -322,13 +324,14 @@
         (p/inject-scripts :scripts #{"test.js"} :filter #{#"foo"})
         (p/inject-scripts :scripts #{"test.js"} :remove #{#"baz"})
         (testing "inject-scripts"
-          (content-test :path "bar/foo.html"
-                        :content (str "<script>" js-content "</script>")
-                        :msg "`inject-scripts` should alter the contents of a file")
-          (content-test :path "baz.html"
-                        :content (str "<script>" js-content "</script>")
-                        :negate? true
-                        :msg "`inject-scripts` should not alter the contents of a removed file"))))
+          (comp
+           (content-test :path "bar/foo.html"
+                         :content (str "<script>" js-content "</script>")
+                         :msg "`inject-scripts` should alter the contents of a file")
+           (content-test :path "baz.html"
+                         :content (str "<script>" js-content "</script>")
+                         :negate? true
+                         :msg "`inject-scripts` should not alter the contents of a removed file")))))

 (deftesttask content-tests []
   (comp (testing "Collection works without input files" ;; #77
@@ -360,5 +363,6 @@
         (add-txt-file :path "test2.md" :content md-content)
         (p/markdown)
         (testing "detecting new files"
-          (content-test :path "test2.html" :content parsed-md-basic)
-          (value-test :path "test2.md" :value-fn #(meta= % :parsed parsed-md-basic)))))
+          (comp
+           (content-test :path "test2.html" :content parsed-md-basic)
+           (value-test :path "test2.md" :value-fn #(meta= % :parsed parsed-md-basic))))))


Fix assortment tests

Fix assortment tests

--- test/io/perun_test.clj
+++ test/io/perun_test.clj
@@ -260,10 +260,10 @@
           (file-exists? :path "public/atom.xml"
                         :msg "`atom-feed` should write atom.xml"))

-        (add-txt-file :path "test2.md" :content (nth yamls 3))
-        (add-txt-file :path "test3.md" :content (nth yamls 4))
-        (add-txt-file :path "test4.md" :content (nth yamls 5))
-        (add-txt-file :path "test5.md" :content (nth yamls 6))
+        (add-txt-file :path "test2.md" :content (nth input-strings 3))
+        (add-txt-file :path "test3.md" :content (nth input-strings 4))
+        (add-txt-file :path "test4.md" :content (nth input-strings 5))
+        (add-txt-file :path "test5.md" :content (nth input-strings 6))
         (p/markdown)

         (p/assortment :renderer 'io.perun-test/render-assortment)


Change it so there is no buffered out of moves, just a cancel

--- src/tile_game/grid.cljs
+++ src/tile_game/grid.cljs
@@ -79,18 +79,17 @@
       "© 2017 Charles L.G. Comstock "
       [:a {:href "https://github.com/dgtized/tile-game"} "(github)"]]]))

-(defn playback-solution [cancel delay]
-  (let [out (async/chan 256)] ;; max solution length to process
-    (go-loop [[move & remaining] (b/solve-next (:board @app-state))]
-      (if move
-        (do
-          (async/<! (async/timeout delay))
-          (let [[_ c] (async/alts! [cancel [out move]])]
-            (when (not= c cancel)
-              (slide! move)
-              (recur remaining))))
-        (async/close! out)))
-    out))
+(defn playback-solution
+  [cancel delay]
+  (go-loop [[move & remaining] (b/solve-next (:board @app-state))]
+    (if move
+      (do
+        (let [[_ c] (async/alts! [cancel (async/timeout delay)])]
+          (when (not= c cancel)
+            (slide! move)
+            (recur remaining))))
+      (async/close! cancel)))
+  cancel)

 (defn ui-event-loop [command]
   (go-loop [cancel (async/chan 1)]


Test multi-line commands

Test multi-line commands

--- test/yetibot/core/test/handler.clj
+++ test/yetibot/core/test/handler.clj
@@ -3,6 +3,7 @@
     [yetibot.core.parser :refer [parser]]
     [yetibot.core.handler :refer :all]
     [yetibot.core.commands.history]
+    [clojure.string :as s]
     [yetibot.core.repl :refer [load-minimal]]
     [instaparse.core :as insta]
     [clojure.test :refer :all]))
@@ -29,4 +30,7 @@
      [[:expr [:cmd [:words "echo" [:space " "] "your" [:space " "] "temp:"]]]])
     "embedded-cmds should extract a collection of embedded commands from a string"))

-
+(deftest test-newline-cmd
+  (let [multi-str (s/join \newline [1 2 3])]
+    (is (= multi-str
+        (handle-unparsed-expr (str "echo " multi-str)))))


Refactored in populate-in-clause to make smarter use of clojure.string/join. Prettified validation functions.

--- src/alfresco_technical_validation/validation.clj
+++ src/alfresco_technical_validation/validation.clj
@@ -49,9 +49,8 @@
 ; To workaround the limitation described in the comments of this page: http://docs.neo4j.org/chunked/stable/cypher-parameters.html
 (defn- populate-in-clause
   [query in-values]
-  (let [values-1 (s/join (map #(str "'" % "',") in-values))
-        values-2 (.substring values-1 0 (- (.length values-1) 1))]
-    (s/replace query "{in-clause-values}" values-2)))
+  (let [comma-delimited-string-quoted-in-values (s/join "," (map #(str "'" % "'") in-values))]
+    (s/replace query "{in-clause-values}" comma-delimited-string-quoted-in-values)))

 (defn- api01-public-alfresco-java-api
   []
@@ -71,7 +70,13 @@
                                                        ORDER BY n.name
                                                      ", alfresco-public-java-api)
         res                      (cy/tquery cypher-query)
-        message                  (if (empty? res) "" (s/join "\n" (map #(str (get % "UsedBy") " uses " (s/join ", " (get % "BlacklistedAlfrescoAPIs"))) res)))]
+        message                  (if (empty? res)
+                                   ""
+                                   (s/join "\n"
+                                           (map #(str (get % "UsedBy")
+                                                      " uses "
+                                                      (s/join ", " (get % "BlacklistedAlfrescoAPIs")))
+                                                res)))]
     { "API01" message }))

 (defn- api06-service-locator
@@ -89,7 +94,13 @@
                                              RETURN n.name as UsedBy, COLLECT(DISTINCT m.name) AS BlacklistedSpringAPIs
                                               ORDER BY n.name
                                             ")
-        message                  (if (empty? res) "" (s/join "\n" (map #(str (get % "UsedBy") " uses " (s/join ", " (get % "BlacklistedSpringAPIs"))) res)))]
+        message                  (if (empty? res)
+                                   ""
+                                   (s/join "\n"
+                                           (map #(str (get % "UsedBy")
+                                                      " uses "
+                                                      (s/join ", " (get % "BlacklistedSpringAPIs")))
+                                                res)))]
     { "API06" message }))

 (defn- com06-compiled-jvm-version
@@ -102,7 +113,13 @@
                         RETURN n.name AS ClassName, n.`class-version-str` AS ClassVersion
                          ORDER BY n.name
                        ")
-        message        (if (empty? res) "" (s/join "\n" (map #(str (get % "ClassName") " is compiled for JVM version " (get % "ClassVersion"))) res))]
+        message        (if (empty? res)
+                         ""
+                         (s/join "\n"
+                                 (map #(str (get % "ClassName")
+                                            " is compiled for JVM version "
+                                            (get % "ClassVersion")))
+                                      res))]
     { "COM06" message }))

 (defn- sec04-stb03-stb04-stb05-stb06-stb10-stb12-java-apis
@@ -141,7 +158,13 @@
                         RETURN n.name as UsedBy, COLLECT(DISTINCT m.name) AS BlacklistedJavaAPIs
                          ORDER BY n.name
                        ")
-        message        (if (empty? res) "" (s/join "\n" (map #(str (get % "UsedBy") " uses " (s/join ", " (get % "BlacklistedJavaAPIs"))) res)))]
+        message        (if (empty? res)
+                         ""
+                         (s/join "\n"
+                                 (map #(str (get % "UsedBy")
+                                            " uses "
+                                            (s/join ", " (get % "BlacklistedJavaAPIs")))
+                                      res)))]
     {
       "SEC04" message
       "STB03" message
@@ -166,7 +189,13 @@
                         RETURN n.name as UsedBy, COLLECT(DISTINCT m.name) AS SearchAPIs
                          ORDER BY n.name
                        ")
-        message        (if (empty? res) "" (s/join "\n" (map #(str (get % "UsedBy") " uses " (s/join ", " (get % "SearchAPIs"))) res)))]
+        message        (if (empty? res)
+                         ""
+                         (s/join "\n"
+                                 (map #(str (get % "UsedBy")
+                                            " uses "
+                                            (s/join ", " (get % "SearchAPIs")))
+                                      res)))]
     {
       "STB07" message
       "STB14" message
@@ -183,7 +212,13 @@
                         RETURN n.name AS UsedBy, m.name AS AuthenticationUtilAPI
                          ORDER BY n.name
                        ")
-        message        (if (empty? res) "" (s/join "\n" (map #(str (get % "UsedBy") " uses " (get % "AuthenticationUtilAPI")) res)))]
+        message        (if (empty? res)
+                         ""
+                         (s/join "\n"
+                                   (map #(str (get % "UsedBy")
+                                              " uses "
+                                              (get % "AuthenticationUtilAPI"))
+                                        res)))]
     { "SEC02" message }))

 (defn- stb06-stb18-manual-transactions
@@ -200,7 +235,13 @@
                         RETURN n.name as UsedBy, COLLECT(DISTINCT m.name) AS TransactionAPIs
                          ORDER BY n.name
                        ")
-        message        (if (empty? res) "" (s/join "\n" (map #(str (get % "UsedBy") " uses " (s/join ", " (get % "TransactionAPIs"))) res)))]
+        message        (if (empty? res)
+                         ""
+                         (s/join "\n"
+                                 (map #(str (get % "UsedBy")
+                                            " uses "
+                                            (s/join ", " (get % "TransactionAPIs")))
+                                      res)))]
     {
       "STB06" message
       "STB18" message


remove dependency

remove dependency

--- src_cljs/rrms/corecljs.cljs
+++ src_cljs/rrms/corecljs.cljs
@@ -87,7 +87,7 @@

     (cond (and (not (nil? date1)) (nil? date2) srcstrv) (filter #(tt/= date1 (c/from-string (.-date %))) data)
           (and (not (nil? date1)) (not (nil? date2)) srcstrv) (get-range-data data date1 date2)
-          (and (nil? date1) (nil? date2) (not srcstrv)) (filter-by-str (get-value! :documents) lstr)
+          (and (nil? date1) (nil? date2) (not srcstrv)) (filter-by-str data lstr)
           (and (not (nil? date1)) (nil? date2) (not srcstrv)) (filter-by-str-dates data lstr date1)
           :else (filter-by-str-dates data lstr date1 date2))))