Add clojure function for perform sync action

--- src/clojure/fault/core.clj
+++ src/clojure/fault/core.clj
@@ -1,7 +1,7 @@
 (ns fault.core
   (:require [fault.future :as f]
             [fault.service :as s])
-  (:import (fault ServiceExecutor ResilientAction ResilientFuture)))
+  (:import (fault ServiceExecutor ResilientAction ResilientFuture ResilientPromise)))

 (set! *warn-on-reflection* true)

@@ -13,4 +13,10 @@
     (.promise ^ResilientFuture (.submitAction service
                                               (reify ResilientAction
                                                 (run [_] (f)))
-                                              time-out-ms))))+                                              time-out-ms))))
+
+(defn perform-action [^ServiceExecutor service f]
+  (f/->CLJResilientFuture
+    ^ResilientPromise (.performAction service
+                                      (reify ResilientAction
+                                        (run [_] (f))))))


add arimethic ops protocols' interfaces

add arimethic ops protocols' interfaces

--- src/clojure/gpu/matrix.clj
+++ src/clojure/gpu/matrix.clj
@@ -271,3 +271,17 @@
       (count indexes) [m m] indexes
       (.set m (long-array indexes) v))))

+(extend-protocol PMatrixAdd
+  (matrix-add [m a]
+    (.add m m))
+  (matrix-sub [m b]
+    (.add m a)))
+
+(extend-protocol PMatrixMultiply
+  (element-multiply [m a]
+    (.mul m a)))
+
+(extend-protocol PMatrixDivide
+  (element-divide [m a]
+    (.div m a)))
+


harvest signature

harvest signature

--- src/co/nclk/linen/core.clj
+++ src/co/nclk/linen/core.clj
@@ -251,20 +251,20 @@

 (defn harvest
-  [m config hkey & [reports]]
+  [m hkey & [reports]]
   (cond
     (map? m)
     (if-let [report ((keyword hkey) m)]
       (conj reports report)
       (reduce
         (fn [reports [k v]]
-          (harvest v config hkey reports))
+          (harvest v hkey reports))
         reports m))

     (coll? m)
     (reduce
       (fn [reports x]
-        (harvest x config hkey reports))
+        (harvest x hkey reports))
       reports m)

     :else reports))


fcalib conversions for implication sets

fcalib conversions for implication sets

enabling the usage of fcalib's next-closure implementation

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

--- src/conexp/util/fcalib.clj
+++ src/conexp/util/fcalib.clj
@@ -71,8 +71,15 @@
   (make-implication (.getPremise fcalib-implication)
                     (.getConclusion fcalib-implication)))

-(defn ^ImplicationSet to-fcalib-implication-set [conexp-clj-context conexp-clj-set-of-implications]
-  (not-yet-implemented))
+(defn ^ImplicationSet to-fcalib-implication-set
+  "Given a formal context and a sequence of implications of this contexts, returns an
+  ImplicationSet as used in fcalib containing the implications, and having the given
+  context as base context."
+  [conexp-clj-context conexp-clj-implications]
+  (let [^ImplicationSet fcalib-implication-set (ImplicationSet. (to-fcalib-context conexp-clj-context))]
+    (doseq [impl (map to-fcalib-implication conexp-clj-set-of-implications)]
+      (.add fcalib-implication-set impl))
+    fcalib-implication-set))

 ;;


bug #3463 - disabled update of group chat participants

Signed-off-by: Julien Eluard <c768e13f1ba4c3ebed2909a1fc1e4b50bb021a2f@gmail.com>

--- src/status_im/ui/screens/profile/group_chat/views.cljs
+++ src/status_im/ui/screens/profile/group_chat/views.cljs
@@ -34,7 +34,9 @@

 (defn actions [admin? chat-id]
   (concat
-    (when admin?
+    ;; NOTE(goranjovic) - group chat participant removal has been temporarily disabled
+    ;; due to this bug - https://github.com/status-im/status-react/issues/3463
+    #_(when admin?
       [{:label  (i18n/label :add-members)
         :icon   :icons/add
         :action #(re-frame/dispatch [:navigate-to :add-participants-toggle-list])}])
@@ -62,7 +64,9 @@
 (defn contact-actions [contact]
   [{:action #(re-frame/dispatch [:show-profile (:whisper-identity contact)])
     :label  (i18n/label :t/view-profile)}
-   {:action #(re-frame/dispatch [:remove-group-chat-participants #{(:whisper-identity contact)}])
+   ;; NOTE(goranjovic) - group chat participant removal has been temporarily disabled
+   ;; due to this bug - https://github.com/status-im/status-react/issues/3463
+   #_{:action #(re-frame/dispatch [:remove-group-chat-participants #{(:whisper-identity contact)}])
     :label  (i18n/label :t/remove-from-chat)}])

 (defn render-contact [contact admin?]


Adapt DistrictType validation to new arity

...of util/validate-enum-elements. It now wants the error severity
passed in too.

--- src/vip/data_processor/validation/v5/district_type.clj
+++ src/vip/data_processor/validation/v5/district_type.clj
@@ -3,4 +3,4 @@

 (def validate
   "Validates all DistrictType elements' formats."
-  (util/validate-enum-elements :district-type))
+  (util/validate-enum-elements :district-type :errors))


Add standard ring middleware

Add standard ring middleware

--- src/core/clj/virt/core.clj
+++ src/core/clj/virt/core.clj
@@ -3,7 +3,12 @@
             [compojure.route :as route]
             [compojure.core :refer [GET POST defroutes]]
             [ring.util.response :as resp]
-            [ring.middleware.params :as params]
+            (ring.middleware [params :refer [wrap-params]]
+                             [nested-params :refer [wrap-nested-params]]
+                             [keyword-params :refer [wrap-keyword-params]]
+                             [session :refer [wrap-session]]
+                             [resource :refer [wrap-resource]]
+                             [content-type :refer [wrap-content-type]])
             [aleph.http :refer :all]
             [aleph.formats :refer :all]
             [lamina.core :refer :all]
@@ -35,8 +40,8 @@
 (defn channels-handler [request]
   (edn-response
     (let [params (:params request)
-          lon (read-string (get params "lon"))
-          lat (read-string (get params "lat"))]
+          lon (read-string (:lon params))
+          lat (read-string (:lat params))]
       (get-channels lon lat))))

 (defn new-channel [channel-name lon lat]
@@ -96,8 +101,11 @@
     (siphon chat ch)
     (siphon ch chat)))

+(defn serve-page [page]
+  (-> (resp/resource-response (str page ".html") {:root "public"})
+      (resp/content-type "text/html")))
+
 (defroutes app-routes
-  (route/resources "/")
   (GET "/api/apps" [] apps-handler)
   (GET "/api/channels" [] channels-handler)
   (POST "/api/channels" [] new-channel-handler)
@@ -106,7 +114,7 @@
   (GET "/api/chat/messages/:thread-id" [] chat-messages-handler)
   (GET ["/api/chat/ws/:thread-id", :thread-id #"[0-9A-Za-z]+"] {}
        (wrap-aleph-handler chat-thread-ws-handler))
-  (GET "/*" {:keys [uri]} (resp/resource-response "index.html" {:root "public"}))
+  (GET "/*" [] (serve-page "index"))
   (route/not-found "Page not found"))

 (defn -main [& args]
@@ -129,5 +137,13 @@
     (korma/transform
       (fn [m] (:message m))))

-  (start-http-server (wrap-ring-handler (params/wrap-params app-routes))
-                     {:port 3000 :websocket true}))
+  (start-http-server
+    (wrap-ring-handler
+      (-> app-routes
+          (wrap-session)
+          (wrap-keyword-params)
+          (wrap-nested-params)
+          (wrap-params)
+          (wrap-resource "public")
+          (wrap-content-type)))
+    {:port 3000 :websocket true}))


whitespace fixes

whitespace fixes

--- src/corpus_utils/bccwj.clj
+++ src/corpus_utils/bccwj.clj
@@ -36,22 +36,22 @@
 ;; Refer to BCCWJ 1.0 Manual V1 Table 5.2 (pp. 78) for all tags and their meanings.
 (def paragraph-level-tags
   #{:article
-     :blockEnd
-     :cluster
-     :titleBlock
-     :title
-     :orphanedTitle
-     :list
-     :paragraph
-     :verse
-     :br ; Inline tag. TODO: find example where this is right or wrong.
-     :speech
-     :speaker ; For OM.
-     :caption
-     :citation
-     :quotation
-     :OCAnswer
-     :OCQuestion})
+    :blockEnd
+    :cluster
+    :titleBlock
+    :title
+    :orphanedTitle
+    :list
+    :paragraph
+    :verse
+    :br ; Inline tag. TODO: find example where this is right or wrong.
+    :speech
+    :speaker ; For OM.
+    :caption
+    :citation
+    :quotation
+    :OCAnswer
+    :OCQuestion})

 (comment ; Not used at present. The text attr should not be used as a string in the sentence.
   (def in-sentence-tags


Added the beginnings of a forward pass for a conv net

--- src/cortex/impl/layers.clj
+++ src/cortex/impl/layers.clj
@@ -100,23 +100,6 @@
     (m/exp! output)
     (m/div! output (m/esum output))))

-
-
-
-;; for (t = 0; t < stride*nframe; t++)
-;; {
-;;         real *gradInput_ptr = gradInput_data + (t/stride)*dim*stride + t % stride;
-;;         real *output_ptr = output_data + (t/stride)*dim*stride + t % stride;
-;;         real *gradOutput_ptr = gradOutput_data + (t/stride)*dim*stride + t % stride;
-
-;;         long d;
-;;         accreal sum = 0;
-;;         for (d = 0; d < dim; d++)
-;;              sum += (accreal)gradOutput_ptr [d*stride] * output_ptr [d*stride];
-
-;;         for (d = 0; d < dim; d++)
-;;              gradInput_ptr [d*stride] = output_ptr [d*stride] * (gradOutput_ptr [d*stride] - sum);
-;; }

 (defn softmax-backward!
   ""
@@ -331,3 +314,82 @@
                                (cp/clone down)
                                (m/clone input-tmp)
                                (m/clone output-tmp))))
+
+
+(defn get-padded-strided-dimension
+  "http://caffe.berkeleyvision.org/tutorial/layers.html"
+  ^long [^long input-dim ^long pad ^long kernel-size ^long stride]
+  (long (+ (long (/ (- (+ input-dim (* 2 pad))  kernel-size)
+                    stride))
+           1)))
+
+
+
+
+(defn create-padded-input-matrix
+  [input-vector-matrixes width height padx pady num-channels]
+  (let [width (long width)
+        height (long height)
+        padx (long padx)
+        pady (long pady)
+        num-channels (long num-channels)
+        padded-input-matrix (m/zero-array :vectorz [(+ height (* 2 pady))
+                                                    (* (+ width (* 2 padx)) num-channels)])
+        input-mat-view (m/submatrix padded-input-matrix
+                                    [[pady height]
+                                     [(* padx num-channels) (* width num-channels)]])
+        input-vec-seq (map m/eseq input-vector-matrixes)
+        interleaved-data (apply interleave input-vec-seq)
+        data-rows (map-indexed vector (partition (* width num-channels) interleaved-data))]
+    (doseq [[idx data-row] data-rows]
+      (m/set-row! input-mat-view idx data-row))
+    padded-input-matrix))
+
+(defn create-convolution-rows
+  "Given an image flattened into a matrix for each channel
+create a matrix where each row is the input to the convolution filter row
+meaning the convolution is just a dotproduct across the rows.
+Should be width*height rows.  Padding is applied as zeros across channels"
+  [input-vector-matrixes width height k-width k-height padx pady stride-w stride-h]
+  (let [width (long width)
+        height (long height)
+        k-width (long k-width)
+        k-height (long k-height)
+        padx (long padx)
+        pady (long pady)
+        stride-w (long stride-w)
+        stride-h (long stride-h)
+        num-channels (long (count input-vector-matrixes))
+        input-matrix (create-padded-input-matrix input-vector-matrixes
+                                                 width height
+                                                 padx pady
+                                                 num-channels)
+        output-width (get-padded-strided-dimension width padx k-width stride-w)
+        output-height (get-padded-strided-dimension height pady k-height stride-h)
+        input-mat-stride (* (+ width (* 2 padx)) num-channels)
+        kernel-stride (* k-width num-channels)]
+    (for [^long output-y (range output-height)
+          ^long output-x (range output-width)]
+      (m/array :vectorz (m/eseq (m/submatrix input-matrix [[(* output-y stride-h) k-height]
+                                                           [(* output-x stride-w num-channels) kernel-stride]]))))))
+(defn calc-conv
+  "input: channels*w.h
+   weights: channels*kw*ky.n-kernels
+   bias: w.h.n-kernels
+  weight-gradient: (m/shape weights)
+  bias-gradient: (m/shape bias)
+  output: (m/shape bias)
+  returns output."
+  [input weights bias padx pady output]
+  (m/assign! output bias))
+
+
+;; (defrecord Convolutional [weights bias padx pady output weight-gradient bias-gradient]
+;;     cp/PModule
+;;     (cp/calc [m input]
+;;       (let [up (cp/calc up input)]
+;;         (DenoisingAutoencoder. up down input-tmp output-tmp)))
+
+;;     (cp/output [m]
+;;       (cp/output up))
+;;)


switch ports with $PORT

switch ports with $PORT

--- src/semtag_web/service.clj
+++ src/semtag_web/service.clj
@@ -69,4 +69,4 @@
               ;; Either :jetty or :tomcat (see comments in project.clj
               ;; to enable Tomcat)
               ::bootstrap/type :jetty
-              ::bootstrap/port 8000})
+              ::bootstrap/port (Integer. (or (System/getenv "PORT") 8000))})


Runtime envrionment loader added to core

--- src/clj/hellhound/core.clj
+++ src/clj/hellhound/core.clj
@@ -1,7 +1,13 @@
 (ns hellhound.core
   "This namespace contains core functions which are required
-  by the whole framework in order to operate.")
+  by the whole framework in order to operate."
+  (:require [hellhound.config :refer [read-config]]))

+;; Definitions ---------------------------------------------
+(def environment-configuration (atom {}))
+
+;; Functions -----------------------------------------------
+;;;; Runtime Environment helpers ---------------------------
 (defn env
   "Return the current runtime profile. Possible values
   `development`, `test`, `production` or any custom
@@ -24,3 +30,18 @@
   "Returns `true` if current runtime profile is `:production`."
   []
   (= :production (env)))
+
+
+;;;; Runtime Environment Configuration Loaders -------------
+(defn runtime-configuration
+  "Read and parse the configuration file related to the current runtime
+  environment."
+  []
+  (let [config (read-config (format "environments/%s.edn" (env)))]
+    (reset! environment-configuration config)
+    config))
+
+(defn application-config
+  "Return the current runtime environment configuration."
+  []
+  @environment-configuration)


Add rudimentary mobile support

Add rudimentary mobile support

--- src/cljs/pizarra/core.cljs
+++ src/cljs/pizarra/core.cljs
@@ -6,6 +6,7 @@
             [pizarra.timemachine :as undo]))

 (enable-console-print!)
+(.initializeTouchEvents js/React true)

 (def app-state
   (atom {:canvas {:drawing? false
@@ -184,6 +185,11 @@
       (update-in [:actions] (partial -end tool))
       (assoc :drawing? false))))

+(defn get-coords [dom e]
+  (let [x (- (.-pageX e) (.-offsetLeft dom))
+        y (- (.-pageY e) (.-offsetTop dom))]
+    [x y]))
+
 (defn canvas [data owner {:keys [interact?]}]
   (reify
     om/IDidMount
@@ -201,17 +207,27 @@
           (merge (:dimensions data)
              (when interact?
                {:onSelectStart (fn [_])
+                :onTouchStart (fn [e]
+                               (.preventDefault e)
+                               (om/transact! data [] start-drawing))
                 :onMouseDown (fn [e]
                                (.preventDefault e)
                                (om/transact! data [] start-drawing))
                 :onMouseUp (fn [_]
                              (om/transact! data [] stop-drawing :add-to-undo))
+                :onTouchEnd (fn [_]
+                             (om/transact! data [] stop-drawing :add-to-undo))
+                :onTouchMove (fn [e]
+                               (when (:drawing? @data)
+                                 (let [dom (om/get-node owner)
+                                       idx (dec (count (:actions @data)))
+                                       [x y] (get-coords dom (aget (.-touches e) 0))]
+                                   (om/transact! data [:actions idx] #(-move (current-tool) % x y)))))
                 :onMouseMove (fn [e]
                                (when (:drawing? @data)
                                  (let [dom (om/get-node owner)
                                        idx (dec (count (:actions @data)))
-                                       x (- (.-pageX e) (.-offsetLeft dom))
-                                       y (- (.-pageY e) (.-offsetTop dom))]
+                                       [x y] (get-coords dom e)]
                                    (om/transact! data [:actions idx] #(-move (current-tool) % x y)))))})))
         nil))))


fix crash bug

fix crash bug

--- src/clojure/cljam/core.clj
+++ src/clojure/cljam/core.clj
@@ -25,7 +25,7 @@

 (defmethod read-header "class cljam.bam.BamReader"
   [rdr]
-  (bam/read-header rdr))
+  (bam/header rdr))

 (defmulti read-alignments (comp str class))

@@ -130,7 +130,7 @@
       (println "Invalid arguments")
       (System/exit 1))
     (with-open [r (bam/reader (first files))]
-      (let [sam {:header (bam/read-header r)
+      (let [sam {:header (bam/header r)
                  :alignments (bam/read-alignments r)}]
         (when-not (sorter/sorted? sam)
           (println "Not sorted")


Added sql/load function to mirror SparkSQL recommendation.

--- src/clojure/flambo/sql.clj
+++ src/clojure/flambo/sql.clj
@@ -31,12 +31,12 @@
   (.jsonFile sql-context path))

 ;; Since 1.3 the SparkSQL data sources API is recommended for load & save operations.
-;; (defn load
-;;   "Returns the dataset stored at path as a DataFrame."
-;;   ([sql-context path]                   ; data source type configured by spark.sql.sources.default
-;;    (.load sql-context path))
-;;   ([sql-context path source-type]       ; specify data source type
-;;    (.load sql-context path source-type)))
+(defn load
+  "Returns the dataset stored at path as a DataFrame."
+  ([sql-context path]                   ; data source type configured by spark.sql.sources.default
+   (.load sql-context path))
+  ([sql-context path source-type]       ; specify data source type
+   (.load sql-context path source-type)))

 (defn read-csv
   "Reads a file in table format and creates a data frame from it, with cases corresponding to


(PDB-3723) update command test for new queries

[rlb@puppet.com: squash; adjust message; wrap lines]

--- test/puppetlabs/puppetdb/command_test.clj
+++ test/puppetlabs/puppetdb/command_test.clj
@@ -684,9 +684,33 @@
   [:v4])

 (defn query-factsets [& cols]
-  (->> (query-to-vec "select certname, (stable||volatile) as facts, environment, producer_timestamp from factsets")
+  (->> (str "select certname,"
+            "       (stable||volatile) as facts,"
+            "       environment,"
+            "       producer_timestamp"
+            "  from factsets
+                 inner join environments on factsets.environment_id=environments.id")
+       query-to-vec
        (map #(update % :facts (comp json/parse-string str)))
        (map #(select-keys % cols))))
+
+(defn query-facts
+        [& cols]
+        (->> (str "select certname,"
+                  "       environment,"
+                  "       value #>> '{}' as value,"
+                  "       key as name,"
+                  "       producer_timestamp"
+                  "  from (select certname,"
+                  "               producer_timestamp,"
+                  "               environment_id,"
+                  "               (jsonb_each((stable||volatile))).*"
+                  "          from factsets) fs"
+                  ;; Q: is this wrong?  fs.key outside subselect?
+                  "    left join environments env on fs.environment_id = env.id"
+                  "    order by fs.key")
+             query-to-vec
+             (map #(select-keys % cols))))

 (let [certname  "foo.example.com"
       facts     {:certname certname
@@ -708,20 +732,7 @@
       (testing "should ignore the blacklisted fact"
         (with-message-handler {:keys [handle-message dlo delay-pool q]}
           (handle-message (queue/store-command q (facts->command-req (version-kwd->num version) command)))
-          (is (= (query-to-vec
-                  "SELECT fp.path as name,
-                          COALESCE(fv.value_string,
-                                   cast(fv.value_integer as text),
-                                   cast(fv.value_boolean as text),
-                                   cast(fv.value_float as text),
-                                   '') as value,
-                          fs.certname
-                   FROM factsets fs
-                     INNER JOIN facts as f on fs.id = f.factset_id
-                     INNER JOIN fact_values as fv on f.fact_value_id = fv.id
-                     INNER JOIN fact_paths as fp on f.fact_path_id = fp.id
-                   WHERE fp.depth = 0
-                   ORDER BY name ASC")
+          (is (= (query-facts :certname :name :value)
                  [{:certname certname :name "a" :value "1"}
                   {:certname certname :name "b" :value "2"}
                   {:certname certname :name "c" :value "3"}]))))))
@@ -791,20 +802,7 @@
           (is (= [{:certname certname
                    :facts {"x" "24", "y" "25", "z" "26"}}]
                  (query-factsets :certname :facts)))
-          #_(is (= (query-to-vec
-                  "SELECT fp.path as name,
-                          COALESCE(fv.value_string,
-                                   cast(fv.value_integer as text),
-                                   cast(fv.value_boolean as text),
-                                   cast(fv.value_float as text),
-                                   '') as value,
-                          fs.certname
-                   FROM factsets fs
-                     INNER JOIN facts as f on fs.id = f.factset_id
-                     INNER JOIN fact_values as fv on f.fact_value_id = fv.id
-                     INNER JOIN fact_paths as fp on f.fact_path_id = fp.id
-                   WHERE fp.depth = 0
-                   ORDER BY name ASC")
+          (is (= (query-facts :certname :name :value)
                  [{:certname certname :name "x" :value "24"}
                   {:certname certname :name "y" :value "25"}
                   {:certname certname :name "z" :value "26"}]))
@@ -824,21 +822,8 @@
                  [{:certname certname :deactivated nil}]))
           (is (= [{:certname certname
                    :facts {"a" "1", "b" "2", "c" "3"}}]
-                 (query-factsets)))
-         #_ (is (= (query-to-vec
-                  "SELECT fp.path as name,
-                          COALESCE(fv.value_string,
-                                   cast(fv.value_integer as text),
-                                   cast(fv.value_boolean as text),
-                                   cast(fv.value_float as text),
-                                   '') as value,
-                          fs.certname
-                   FROM factsets fs
-                     INNER JOIN facts as f on fs.id = f.factset_id
-                     INNER JOIN fact_values as fv on f.fact_value_id = fv.id
-                     INNER JOIN fact_paths as fp on f.fact_path_id = fp.id
-                   WHERE fp.depth = 0
-                   ORDER BY name ASC")
+                 (query-factsets :certname :facts)))
+          (is (= (query-facts :certname :name :value)
                  [{:certname certname :name "a" :value "1"}
                   {:certname certname :name "b" :value "2"}
                   {:certname certname :name "c" :value "3"}]))
@@ -858,20 +843,7 @@
           (is (= [{:certname certname
                    :facts {"a" "1", "b" "2", "c" "3"}}]
                  (query-factsets :certname :facts)))
-          #_ (is (= (query-to-vec
-                  "SELECT fp.path as name,
-                          COALESCE(fv.value_string,
-                                   cast(fv.value_integer as text),
-                                   cast(fv.value_boolean as text),
-                                   cast(fv.value_float as text),
-                                   '') as value,
-                          fs.certname
-                   FROM factsets fs
-                     INNER JOIN facts as f on fs.id = f.factset_id
-                     INNER JOIN fact_values as fv on f.fact_value_id = fv.id
-                     INNER JOIN fact_paths as fp on f.fact_path_id = fp.id
-                   WHERE fp.depth = 0
-                   ORDER BY name ASC")
+          (is (= (query-facts :certname :name :value)
                  [{:certname certname :name "a" :value "1"}
                   {:certname certname :name "b" :value "2"}
                   {:certname certname :name "c" :value "3"}]))
@@ -898,26 +870,21 @@

       (is (= [{:certname certname
                :facts {"a" "1", "b" "2", "c" "3"}
-               :producer-timestamp producer-time
+               :producer_timestamp producer-time
                :environment "DEV"}]
-             (query-factsets :certnames :facts :producer-timestamp :environment)))
-      #_(is (= (query-to-vec
-              "SELECT fp.path as name,
-                          COALESCE(fv.value_string,
-                                   cast(fv.value_integer as text),
-                                   cast(fv.value_boolean as text),
-                                   cast(fv.value_float as text),
-                                   '') as value,
-                          fs.certname,
-                          e.environment,
-                          fs.producer_timestamp
-                   FROM factsets fs
-                     INNER JOIN facts as f on fs.id = f.factset_id
-                     INNER JOIN fact_values as fv on f.fact_value_id = fv.id
-                     INNER JOIN fact_paths as fp on f.fact_path_id = fp.id
-                     INNER JOIN environments as e on fs.environment_id = e.id
-                   WHERE fp.depth = 0
-                   ORDER BY name ASC")
+             (query-factsets :certname :facts :producer_timestamp :environment)))
+      #_(is (= (query-to-vec (str "select certname,"
+                                  "       environment,"
+                                  "       value,"
+                                  "       key as name,"
+                                  "       producer_timestamp"
+                                  "  from (select certname,"
+                                  "               producer_timestamp,"
+                                  "               environment_id,"
+                                  "               (jsonb_each((stable||volatile))).*"
+                                  "          from factsets) fs"
+                                  "            left join environments env on fs.environment_id = env.id"
+                                  "          order by fs.key"))
              [{:certname certname :name "a" :value "1" :producer_timestamp producer-time :environment "DEV"}
               {:certname certname :name "b" :value "2" :producer_timestamp producer-time :environment "DEV"}
               {:certname certname :name "c" :value "3" :producer_timestamp producer-time :environment "DEV"}]))
@@ -940,23 +907,8 @@

       (is (= [{:certname certname
                :facts {"a" "1", "b" "2", "c" "3"}}]
-             (query-factsets)))
-     #_ (is (= (query-to-vec
-              "SELECT fp.path as name,
-                          COALESCE(fv.value_string,
-                                   cast(fv.value_integer as text),
-                                   cast(fv.value_boolean as text),
-                                   cast(fv.value_float as text),
-                                   '') as value,
-                          fs.certname,
-                          e.environment
-                   FROM factsets fs
-                     INNER JOIN facts as f on fs.id = f.factset_id
-                     INNER JOIN fact_values as fv on f.fact_value_id = fv.id
-                     INNER JOIN fact_paths as fp on f.fact_path_id = fp.id
-                     INNER JOIN environments as e on fs.environment_id = e.id
-                   WHERE fp.depth = 0
-                   ORDER BY name ASC")
+             (query-factsets :certname :facts)))
+      (is (= (query-facts :certname :name :value :environment)
              [{:certname certname :name "a" :value "1" :environment "DEV"}
               {:certname certname :name "b" :value "2" :environment "DEV"}
               {:certname certname :name "c" :value "3" :environment "DEV"}]))


Trivial keyword fix

Trivial keyword fix

--- src/eulalie/util/query.clj
+++ src/eulalie/util/query.clj
@@ -35,7 +35,7 @@
 (defn policy-key-in [k]
   (let [k (cond-> k (keyword? k) name)]
     (cond
-      (= "AWS" k) k
+      (= "AWS" k) (name k) ;; eh
       (string? k)
       (let [segments (str/split (name k) #":" 2)]
         (apply keyword (map csk/->kebab-case-string segments)))


State: Change maps in atoms example to films.

--- test/com/nomistech/clojure_the_language/c_400_state_and_concurrency/s_020_atoms.clj
+++ test/com/nomistech/clojure_the_language/c_400_state_and_concurrency/s_020_atoms.clj
@@ -52,25 +52,42 @@
 ;;;; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 ;;;; Storing maps in atoms

-(def my-map-atom (atom {}))
+;;;; Something about films

-(do (swap! my-map-atom assoc :first-name "Alice")
-    ;; does this: (assoc {} :first-name "Alice"}
-    (fact @my-map-atom => {:first-name "Alice"}))
+(def jaws-atom (atom {}))

-(do (swap! my-map-atom assoc :first-name "Bob")
-    ;; does this: (assoc {:first-name "Alice"} :first-name "Bob")
-    (fact @my-map-atom => {:first-name "Bob"}))
+;; Set the title:

-(do (swap! my-map-atom assoc-in [:address :line-1] "78 Green Lane")
+(do (swap! jaws-atom assoc :title "Paws")
+    ;; does this: (assoc {} :title "Paws"}
+    (fact @jaws-atom => {:title "Paws"}))
+
+;; Whoops; we got the title wrong. Fix it:
+
+(do (swap! jaws-atom assoc :title "Jaws")
+    ;; does this: (assoc {:title "Paws"} :title "Jaws")
+    (fact @jaws-atom => {:title "Jaws"}))
+
+;; Set the director:
+
+(do (swap! jaws-atom assoc-in [:director :name] "Karl Zwicky")
     ;; does this:
-    ;;   (assoc-in {:first-name "Bob"} [:address :line-1] "78 Green Lane")
-    (fact @my-map-atom => {:first-name "Bob"
-                           :address {:line-1 "78 Green Lane"}}))
+    ;;   (assoc-in {:title "Jaws"} [:director :name] "Karl Zwicky")
+    (fact @jaws-atom => {:title "Jaws"
+                         :director {:name "Karl Zwicky"}}))

-(do (swap! my-map-atom assoc-in [:address :line-1] "37 High Street")
-    (fact @my-map-atom => {:first-name "Bob"
-                           :address {:line-1 "37 High Street"}}))
+;; Whoops; we got the director wrong. Fix it:
+
+(do (swap! jaws-atom assoc-in [:director :name] "Steven Spielberg")
+    (fact @jaws-atom => {:title "Jaws"
+                         :director {:name "Steven Spielberg"}}))
+
+;; Add more detail to the director:
+
+(do (swap! jaws-atom assoc-in [:director :date-of-birth] 1946)
+    (fact @jaws-atom => {:title "Jaws"
+                         :director {:name "Steven Spielberg"
+                                    :date-of-birth 1946}}))

 ;;;; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 ;;;; `compare-and-set!`


State.

State.

--- test/com/nomistech/clojure_the_language/c_400_state_and_concurrency/s_020_atoms.clj
+++ test/com/nomistech/clojure_the_language/c_400_state_and_concurrency/s_020_atoms.clj
@@ -118,11 +118,11 @@
               (swap! n-attempts-atom inc)
               (Thread/sleep (rand-int 100))
               (inc n))
-            (long-running-inc-on-atom []
+            (long-running-inc-on-atom! []
               (swap! competing-updates-atom long-running-inc))
             (create-competing-threads []
               (dotimes [_ n-competitors]
-                (.start (Thread. long-running-inc-on-atom))))
+                (.start (Thread. long-running-inc-on-atom!))))
             (report-on-what-is-happening []
               (loop []
                 (println (get-info))


Version bump for cider-nrepl and update namespace/var names

--- src/dj/init/cidernrepl.clj
+++ src/dj/init/cidernrepl.clj
@@ -15,15 +15,16 @@
     :can-add? (constantly false)))

 (cp/add-dependencies
- :coordinates '[[refactor-nrepl "2.3.1"]
-                [cider/cider-nrepl "0.16.0-SNAPSHOT"]]
+ :coordinates '[[refactor-nrepl "2.4.0"]
+                [cider/cider-nrepl "0.20.0"]]
  :repositories (merge a/maven-central
                       {"clojars" "https://clojars.org/repo"}))

-(require '[clojure.tools.nrepl.server]
+(require '[nrepl.server]
          '[cider.nrepl])

 (let [port 9001]
   (println "starting cider nrepl server on port" port)
-  (clojure.tools.nrepl.server/start-server :port port :handler cider.nrepl/cider-nrepl-handler)
+  (nrepl.server/start-server
+   :port port :handler cider.nrepl/cider-nrepl-handler)
   (println "running cider nrepl server on port" port))


Fix broken token authentication

Fix broken token authentication

This was accidentally broken in commit 83b1201.
Also improve a function behaviour when there is no data.

--- src/env_logger/handler.clj
+++ src/env_logger/handler.clj
@@ -54,14 +54,16 @@
                                                       (t/minutes 45))
                                              (t/local-date-time)
                                              (:ruuvitag-locations env)))))]
-        {:status 200
-         :body {:data (assoc data :recorded
-                             (convert-epoch-ms-to-string (:recorded data)))
-                :rt-data (for [item rt-data]
-                           (assoc item :recorded
-                                  (convert-epoch-ms-to-string
-                                   (:recorded item))))
-                :weather-data (get-fmi-weather-data)}}))))
+        (if-not data
+          {:status 500}
+          {:status 200
+           :body {:data (assoc data :recorded
+                               (convert-epoch-ms-to-string (:recorded data)))
+                  :rt-data (for [item rt-data]
+                             (assoc item :recorded
+                                    (convert-epoch-ms-to-string
+                                     (:recorded item))))
+                  :weather-data (get-fmi-weather-data)}})))))

 (defn get-plot-page-data
   "Returns data needed for rendering the plot page."
@@ -228,7 +230,9 @@
         defaults-config (assoc-in defaults [:security :anti-forgery] false)
         handler (as-> routes $
                   (wrap-authorization $ auth/auth-backend)
-                  (wrap-authentication $ auth/auth-backend)
+                  (wrap-authentication $
+                                       auth/jwe-auth-backend
+                                       auth/auth-backend)
                   (wrap-json-response $ {:pretty false})
                   (wrap-json-params $ {:keywords? true})
                   (wrap-defaults $ (if dev-mode


ME|AR: code refactor

ME|AR: code refactor

--- src/hatti/views/table.cljs
+++ src/hatti/views/table.cljs
@@ -21,11 +21,10 @@
 (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"}]
-        extra-fields (if is-filtered-dataview?
-                        extra-field
-                      (conj extra-field forms/submission-time-field))]
-        extra-fields))
+  (let [extra-field  [{:full-name "_rank" :label "#" :name "_rank" :type "integer"}]]
+    (if is-filtered-dataview?
+      extra-field
+      (conj extra-field forms/submission-time-field))))

 (defn all-fields [form is-filtered-dataview?]
   "Given a (flat-)form, returns fields for table display.


maybe fix the subscribing to NaN problem

--- src-cljs/frontend/core.cljs
+++ src-cljs/frontend/core.cljs
@@ -100,7 +100,7 @@

 (defn app-state []
   (let [initial-state (state/initial-state)
-        document-id (js/parseInt (last (re-find #"document/(.+)$" (.getPath utils/parsed-uri))))
+        document-id (long (last (re-find #"document/(.+)$" (.getPath utils/parsed-uri))))
         cust (js->clj (aget js/window "Precursor" "cust") :keywordize-keys true)]
     (atom (assoc initial-state
             :document/id document-id


wip: parser - List field type

wip: parser - List field type

--- src/graphql_clj/parser.clj
+++ src/graphql_clj/parser.clj
@@ -184,6 +184,11 @@
    :TypeFieldVariable (fn type-field-variable [& args]
                         (log/debug "TypeFieldVariable: args: " args)
                         [:type-field-variable (into {} args)])
+
+   :ListTypeName (fn list-type-name [& args]
+                   (log/debug "ListTypeName: args" args)
+                   {:kind :LIST
+                    :innerType (into {} args)})
    })

 (defn transform


RR: set pageSize from app-state

RR: set pageSize from app-state

--- src/hatti/views/table.cljs
+++ src/hatti/views/table.cljs
@@ -140,7 +140,10 @@
                     (put! shared/event-chan {:submission-to-rank rank}))))
     ;; page, filter, and data set-up on the dataview
     (init-sg-pager grid dataview)
-    (.setPagingOptions dataview #js {:pageSize 25})
+    (.setPagingOptions dataview #js
+        {:pageSize (or (get-in @shared/app-state
+                               [:table-page :num-displayed-records])
+                       25)})
     (.setFilter dataview (partial filterfn form))
     (.setItems dataview (clj->js data) _id)
     [grid dataview]))


Remove extraneous space in nREPL message.

- CIDER was expecting a message of form 'nREPL server started on port <port>'
  (https://github.com/clojure-emacs/cider/blob/master/nrepl-client.el#L1072)
  but we were outputting 'nREPL server started on port  <port>'

--- modules/gradle-clojure-tools/src/main/clojure/gradle_clojure/tools/clojure_nrepl.clj
+++ modules/gradle-clojure-tools/src/main/clojure/gradle_clojure/tools/clojure_nrepl.clj
@@ -24,7 +24,7 @@
                         :port control-port
                         :accept 'gradle-clojure.tools.clojure-nrepl/stop!})
   (let [server (nrepl/start-server :bind "localhost" :port repl-port :handler handler)]
-    (println "nREPL server started on port " repl-port)
+    (println "nREPL server started on port" repl-port)
     (println "Enter Ctrl-D to stop the REPL.")
     (deref (deref stopper))
     (server/stop-server "control")


implemented "cond", "and", "or"

implemented "cond", "and", "or"

--- src/kondolisp/compiler.clj
+++ src/kondolisp/compiler.clj
@@ -323,7 +323,58 @@
 	       ~else-label
 	       ~@(compile-pass1 else-body)
 	       ~end-label))
-	  ;;
+          ;;
+          ('cond)
+          `((:VM_IVAL ~(make-nil)))
+          ;;
+          ('cond clause & clauses)
+          (let [end-label (gensym),
+                clauses-insts
+                (apply concat
+                       (map (fn [clause]
+                              (let [pred (first clause)
+                                    body (rest clause)
+                                    next-clause-label (gensym)]
+                                `(~@(compile-pass1 pred)
+                                  (:VM_BIFN ~next-clause-label)
+                                  ~@(apply concat
+                                           (map compile-pass1 body))
+                                  (:VM_JMP ~end-label)
+                                  ~next-clause-label)))
+                            (cons clause clauses)))]
+            `(~@clauses-insts
+              ~end-label))
+	  ;;
+          ('and)
+          `((:VM_IVAL ~(make-t)))
+          ;;
+          ('and exp & rest)
+          (let [end-label (gensym)
+                insts
+                (drop-last
+                 (apply concat
+                        (map (fn [exp]
+                               `(~@(compile-pass1 exp)
+                                 (:VM_BIN ~end-label)))
+                             (cons exp rest))))]
+            `(~@insts
+              ~end-label))
+          ;;
+          ('or)
+          `((:VM_IVAL ~(make-nil)))
+          ;;
+          ('or exp & rest)
+          (let [end-label (gensym)
+                insts
+                (drop-last
+                 (apply concat
+                        (map (fn [exp]
+                               `(~@(compile-pass1 exp)
+                                 (:VM_BIF ~end-label)))
+                             (cons exp rest))))]
+            `(~@insts
+              ~end-label))
+          ;;
 	  ('while pred & body)	(let [retry-label (gensym),
 				      end-label (gensym)]
 				  `((:VM_IVAL ~(make-nil))


Don't fetch and install. Install does that.

--- src/leiningen/protobuf.clj
+++ src/leiningen/protobuf.clj
@@ -153,7 +153,6 @@
   ([project] (compile project (proto-files (io/file "proto"))))
   ([project files]
      (install project)
-     (fetch project)
      (when (= "protobuf" (:name project))
        (compile-google-protobuf project))
      (protoc project files)))


Ensure :path-info key in war file is not url-encoded (fixes #83)

--- src/leiningen/ring/war.clj
+++ src/leiningen/ring/war.clj
@@ -115,10 +115,11 @@
 (defn generate-handler [project handler-sym]
   (if (get-in project [:ring :servlet-path-info?] true)
     `(fn [request#]
-       (~handler-sym
-         (assoc request#
-           :path-info (.getPathInfo (:servlet-request request#))
-           :context   (.getContextPath (:servlet-request request#)))))
+       (let [context# ^String (.getContextPath (:servlet-request request#))]
+         (~handler-sym
+          (assoc request#
+            :context context#
+            :path-info (subs (:uri request#) (.length context#))))))
     handler-sym))

 (defn compile-servlet [project]


Fix failing jobs test, ffs.

Fix failing jobs test, ffs.

--- integration-tests/apps/jobs/test/jobs/cron.clj
+++ integration-tests/apps/jobs/test/jobs/cron.clj
@@ -44,4 +44,4 @@

 (deftest it-should-raise-when-spec-is-given-with-at-opts
   (doseq [o [:at :in :every :repeat :until]]
-    (is (thrown? IllegalArgumentException (schedule "name" #() "spec" o 0)))))
+    (is (thrown? IllegalArgumentException (job/schedule "name" #() "spec" o 0)))))


Move LightTable-Clojure to plugins

Move LightTable-Clojure to plugins

--- src/lt/objs/langs/clj.cljs
+++ src/lt/objs/langs/clj.cljs
@@ -29,8 +29,7 @@
 (def shell (load/node-module "shelljs"))
 (def cur-path (.pwd shell))
 (def home-path deploy/home-path)
-(def jar-dir (files/join home-path "plugins" "clojure"))
-(def jar-path (files/join jar-dir "lein-light-standalone.jar"))
+(def jar-path (files/join home-path "plugins/clojure/runner/target/lein-light-standalone.jar"))

 ;;****************************************************
 ;; Parser


Add help command

Add help command

--- src/antlion_clojure/bot.clj
+++ src/antlion_clojure/bot.clj
@@ -172,6 +172,22 @@
                    :channel channel
                    :text (format-result parse-result)})))

+(defn- help
+  [{:keys [user channel] :as res} me]
+  (map->Payload {:type :message
+                 :user user
+                 :channel channel
+                 :text
+                 (str
+                     "ﾂｶｲｶﾀ\n"
+                     "```"
+                      me " help                   : この文章を表示\n"
+                      me " fyi                    : メモ一覧を表示\n"
+                      me " set-fyi <title> <body> : <title> <body>をメモ\n"
+                      me " del-fyi <title>        : <title>を削除\n"
+                      me " <S-Expression>         : <S-Expression>を評価\n"
+                      "```")}))
+
 (defn- channel-leave-handler
   [{:keys [user channel]
     :as res}]
@@ -191,10 +207,12 @@
 (defn- command-message-handler
   [{:keys [user channel]
     :as res}]
-  (let [txt (split (:text res) #" ")
+  (let [txt (split (:text res) #"\s+")
+        me (first txt)
         command (second txt)
         args (drop 2 txt)]
     (case command
+      "help" (help res me)
       "set-problem" (set-problem res (first args) (second args))
       "del-problem" (del-problem res (first args))
       "set-fyi" (set-fyi res (first args) (second args))


fix source map debugging in eval-str

fix source map debugging in eval-str

--- src/main/cljs/cljs/js.cljs
+++ src/main/cljs/cljs/js.cljs
@@ -625,17 +625,18 @@
                         (do
                           (.append sb (with-out-str (comp/emit ast)))
                           (recur ns'))))))
-                 (let [js-source (.toString sb)
-                       evalm {:lang :clj
-                              :name name
-                              :path (ns->relpath name)
-                              :source js-source}]
-                   (when (:verbose opts)
-                     (debug-prn js-source))
+                 (do
                    (when (:source-map opts)
                      (append-source-map env/*compiler*
                        name source sb @comp/*source-map-data* opts))
-                   (cb {:ns ns :value (*eval-fn* evalm)}))))))))
+                   (let [js-source (.toString sb)
+                         evalm     {:lang   :clj
+                                    :name   name
+                                    :path   (ns->relpath name)
+                                    :source js-source}]
+                    (when (:verbose opts)
+                      (debug-prn js-source))
+                    (cb {:ns ns :value (*eval-fn* evalm)})))))))))
       (:*cljs-ns* bound-vars))))

 (defn eval-str


[#123] ring depends on a newer version of file-uploads than akvo-flow

--- api/project.clj
+++ api/project.clj
@@ -12,6 +12,7 @@
                  [ring/ring-defaults "0.2.1"]
                  [ring/ring-json "0.4.0"]
                  [ring-jetty-component "0.3.1"]
+                 [commons-fileupload "1.3.1"]
                  [org.akvo.flow/akvo-flow "v1.9.29-52-g4bc8f24" :classifier "classes"]
                  [org.akvo/commons "0.4.5"]
                  [raven-clj "1.5.0"]


sighs are not artifacts

sighs are not artifacts

--- src/babel/encyclopedia.cljc
+++ src/babel/encyclopedia.cljc
@@ -219,7 +219,8 @@
    {:pred :salad}    {:artifact true
                       :edible true}

-   {:pred :sigh}     {:physical-object false
+   {:pred :sigh}     {:artifact false
+                      :physical-object false
                       :event true}

    {:pred :shoe}     {:clothing true}


CMR-5065 Updates test generators to test default enum values.

--- umm-spec-lib/test/cmr/umm_spec/test/umm_g/generators.clj
+++ umm-spec-lib/test/cmr/umm_spec/test/umm_g/generators.clj
@@ -38,15 +38,15 @@
                    :qa-percent-cloud-cover (ext-gen/optional (ext-gen/choose-double 0 100)))))))

 (def qa-auto-flag
-  (gen/elements ["Passed" "Failed" "Suspect"]))
+  (gen/elements ["Passed" "Failed" "Suspect" "Undetermined"]))

 (def qa-op-flag
   (gen/elements ["Passed" "Failed" "Being Investigated" "Not Investigated"
-                 "Inferred Passed" "Inferred Failed" "Suspect"]))
+                 "Inferred Passed" "Inferred Failed" "Suspect" "Undetermined"]))

 (def qa-science-flag
   (gen/elements ["Passed" "Failed" "Being Investigated" "Not Investigated"
-                 "Inferred Passed" "Inferred Failed" "Suspect" "Hold"]))
+                 "Inferred Passed" "Inferred Failed" "Suspect" "Hold" "Undetermined"]))

 (def qa-flags
   (ext-gen/non-empty-obj-gen
@@ -57,9 +57,15 @@
        (when (not-empty (util/remove-nil-keys flag-map))
          (merge flag-map explanation-map)))
      (gen/tuple
-       (gen/hash-map :automatic-quality-flag (ext-gen/optional qa-auto-flag)
-                     :operational-quality-flag (ext-gen/optional qa-op-flag)
-                     :science-quality-flag (ext-gen/optional qa-science-flag))
+       (gen/hash-map :automatic-quality-flag (ext-gen/optional (gen/one-of
+                                                                [(ext-gen/string-ascii 1 10)
+                                                                 qa-auto-flag]))
+                     :operational-quality-flag (ext-gen/optional (gen/one-of
+                                                                  [(ext-gen/string-ascii 1 10)
+                                                                   qa-op-flag]))
+                     :science-quality-flag (ext-gen/optional (gen/one-of
+                                                              [(ext-gen/string-ascii 1 10)
+                                                               qa-science-flag])))
        (gen/hash-map :automatic-quality-flag-explanation (ext-gen/optional (ext-gen/string-ascii 1 10))
                      :operational-quality-flag-explanation (ext-gen/optional (ext-gen/string-ascii 1 10))
                      :science-quality-flag-explanation (ext-gen/optional (ext-gen/string-ascii 1 10))))))))


Fix typo

Fix typo

--- src/braid/server/db/bot.clj
+++ src/braid/server/db/bot.clj
@@ -68,7 +68,7 @@
   (->> (d/q '[:find [(pull ?b pull-pattern) ...]
               :in $ pull-pattern ?group-id
               :where
-              [?b :bot/notify-all-messages true]
+              [?b :bot/notify-all-messages? true]
               [?g :group/id ?group-id]
               [?b :bot/group ?g]]
             (db/db) bot-pull-pattern group-id)


validate filesystem names, add docstrings

--- src/brainbot/nozzle/sys.clj
+++ src/brainbot/nozzle/sys.clj
@@ -1,4 +1,5 @@
 (ns brainbot.nozzle.sys
+  "system map creation and a bit of iniconfig utils"
   (:require [brainbot.nozzle.worker :as worker]
             [brainbot.nozzle.misc :as misc]
             [brainbot.nozzle.inihelper :as inihelper]
@@ -6,7 +7,8 @@
   (:import [java.util.concurrent Executors]))

 (defn valid-name?
-  "check if s is a valid-name"
+  "check if s is a valid-name, i.e. a non-empty sequence of the
+  characters a-zA-Z0-9 - and _"
   [s]
   (boolean (re-matches #"^[-a-zA-Z0-9_]+$" s)))

@@ -15,26 +17,57 @@
    :filesystems (misc/trimmed-lines-from-string
                  (get-in iniconfig [inihelper/main-section-name "filesystems"]))
    :rmq-prefix (get-in iniconfig [inihelper/main-section-name "rmq-prefix"] inihelper/main-section-name)
-   :es-url (or (get-in iniconfig [inihelper/main-section-name "es-url"]) "http://localhost:9200")})
+   :es-url (or (get-in iniconfig [inihelper/main-section-name "es-url"])
+               "http://localhost:9200")})
+
+(defn- inidie
+  "call misc/die, put the section name and iniconfig source in front
+  of the error message"
+  [iniconfig section msg]
+  (misc/die (format "while parsing section %s in %s: %s"
+                    section
+                    (-> iniconfig meta :source)
+                    msg)))
+
+(defn- make-die-fn
+  "return fn wrapping misc/die, put the section name and iniconfig
+  source in front of the error message"
+  [iniconfig section]
+  (partial inidie iniconfig section))
+
+(defn- validate-filesystems
+  "validate filesystem names. call die with an error message, if validation fails"
+  [filesystems die]
+  (doseq [fs filesystems]
+    (when-not (valid-name? fs)
+      (die (format "the filesystem name %s is not valid" (pr-str fs))))))
+
+(defn- validate-main-section
+  "validate main section"
+  [{:keys [rmq-prefix filesystems]} die]
+  (when-not (valid-name? rmq-prefix)
+    (die (format "rmq-prefix value %s is not valid" (pr-str rmq-prefix))))
+  (validate-filesystems filesystems die))

 (defn- parse-main-section
+  "parse nozzle's main section. the result will be stored as :config inside the system map"
   [iniconfig]
   (let [res (parse-main-section* iniconfig)
-        die (fn [msg]
-              (misc/die
-               (format "while parsing section %s in %s: %s"
-                       inihelper/main-section-name
-                       (-> iniconfig meta :source)
-                       msg)))]
-    (when-not (valid-name? (:rmq-prefix res))
-      (die (format "rmq-prefix value %s is not valid" (pr-str (:rmq-prefix res)))))
-    (doseq [fs (:filesystems res)]
-      (when-not (valid-name? fs)
-        (die (format "the filesystem name %s is not valid" (pr-str fs)))))
+        die (make-die-fn iniconfig inihelper/main-section-name)]
+    (validate-main-section res die)
     res))

 (defn make-system [iniconfig command-sections]
+  "create a system map. the system map is where we store our
+  configuration data and some state. the system map contains the followings keys:
+
+  :iniconfig the ini configuration
+  :command-sections command sections as passed on the command line
+  :config parsed values from the main section
+  :thread-pool the thread pool which should be used by workers
+  :name->obj an atom, mapping section names as specified in the ini
+             config to the objects which we created."
   {:iniconfig iniconfig
    :command-sections command-sections
    :config (parse-main-section iniconfig)
@@ -45,12 +78,25 @@
   current-system nil)

 (defn run-system
+  "start running the system by starting a meta-runner with the
+  command-sections"
   [{:keys [iniconfig command-sections] :as system}]
   (alter-var-root #'current-system (constantly system))
   (worker/start (meta-runner/make-meta-runner system command-sections)))

+(defn- get-filesystems-for-section*
+  "get filesystems specified in section and validate them. no fallback"
+  [system section-name]
+  (let [filesystems (misc/trimmed-lines-from-string
+                     (get-in system [:iniconfig section-name "filesystems"]))
+        die (make-die-fn (:iniconfig system) section-name)]
+    (validate-filesystems filesystems die)
+    filesystems))
+
 (defn get-filesystems-for-section
+  "get the list of filesystem names specified in the given section or
+  as a fallback in the main section"
   [system section-name]
-  (or (misc/trimmed-lines-from-string (get-in system [:iniconfig section-name "filesystems"]))
+  (or (get-filesystems-for-section* system section-name)
       (get-in system [:config :filesystems])
-      (misc/die (str "no filesystems defined in section " section-name))))
+      (inidie (:iniconfig system) section-name "no filesystems defined")))


[#130] Upgrade flow dependencies

[#130] Upgrade flow dependencies

--- api/project.clj
+++ api/project.clj
@@ -15,7 +15,7 @@
                  [ring/ring-json "0.4.0"]
                  [ring-jetty-component "0.3.1"]
                  [commons-fileupload "1.3.1"]
-                 [org.akvo.flow/akvo-flow "20200901-121115.9ce5653f" :classifier "classes"]
+                 [org.akvo.flow/akvo-flow "20220120-233458.89643d80" :classifier "classes"]
                  [org.akvo/commons "0.4.5" :exclusions [org.clojure/tools.nrepl]]
                  [raven-clj "1.5.0"]
                  [javax.jdo/jdo2-api "2.3-eb"]


Fix go host message

Fix go host message

--- app/dev/dev.clj
+++ app/dev/dev.clj
@@ -24,7 +24,7 @@
   (let [res (integrant.repl/go)]
     (println (io.aviso.ansi/yellow
                (format "[Edge] Website can be browsed at http://%s/"
-                       (-> system :edge.web-server :config :host))))
+                       (-> system :edge/web-server :config :host))))
     (println (io.aviso.ansi/bold-yellow "[Edge] Now make code changes, then enter (reset) here"))
     res))


replaced absolute value kludge with math version.

--- src/clj/forma/reproject.clj
+++ src/clj/forma/reproject.clj
@@ -49,7 +49,7 @@
   0 longitude. Columns move east, wrapping around the globe, and rows
   move north.)"
   [ll-res max-width lat lon]
-  (let [abs-lon (if (neg? lon) (- lon) lon)
+  (let [abs-lon (Math/abs lon)
         lon-idx (bucket ll-res abs-lon)
         lat-idx (bucket ll-res (+ lat 90))]
     [lat-idx (if (neg? lon)


Add on-shutdown value formatters

Add on-shutdown value formatters

--- src/clj/introspect/core.clj
+++ src/clj/introspect/core.clj
@@ -25,7 +25,7 @@
 (let [method-calls (atom {})]
   (defn introspect-function
     [caller method args return-value]
-    (let [descriptor          [(.getClass caller) (.getName method)]
+    (let [descriptor          [(-> caller .getClass .getName) (.getName method)]
           current-call-types  (conj (mapv type args) (type return-value))
           previous-call-types (get @method-calls descriptor)]

@@ -36,15 +36,30 @@
                [descriptor]
                #(conj (or % #{}) current-call-types)))))

+
   (defn get-method-calls
     []
     @method-calls)
+
+  (defn format-report
+    "Formats multivariate function call report"
+    []
+    (->> @method-calls
+         (filter #(> (count (second %)) 1))
+         (map (fn [[[klass method-name] argument-calls]]
+                (format "Multivariate Function Calls: `%s` \n\t\t%s\n"
+                        (if (= "invoke" method-name)
+                          klass
+                          (format "%s$%s" klass method-name))
+                        (clojure.string/join "\n\t\t"
+                                             (map format-signature argument-calls)))))
+         (clojure.string/join "\n")))

   (defn t
     ([f-name]
        (t (.getClass f-name) "invoke"))
     ([klass method]
-       (let [calls (get @method-calls [klass method])]
+       (let [calls (get @method-calls [(.getName klass)  method])]
          (if (not (empty? calls))
            (doseq [call calls]
              (println (format-signature call)))
@@ -56,15 +71,16 @@

 (defonce introspected-namespaces (atom #{}))
 (defn introspect-namespace
-  [namespace-sym]
-  (when (not (get introspected-namespaces namespace-sym))
-    (println (str "Introspecting " (name namespace-sym)))
-    (swap! introspected-namespaces conj namespace-sym)
+  [namespace]
+  (when (not (get introspected-namespaces namespace))
+    (println (str "Introspecting " namespace))
+    (swap! introspected-namespaces conj namespace)

-    (IntrospectProfilingAgent/initializeAgent (-> namespace-sym
+    (IntrospectProfilingAgent/initializeAgent (-> namespace
                                                   name
                                                   (.replace "-" "_")))
-    (compile namespace-sym))
+    (let [namespace-sym (symbol namespace)]
+      (compile namespace-sym)))
   ;; v.ns.name.name.replace('.', '/').replace('-','_') + "$" + munge(v.sym.name);
   )

@@ -82,6 +98,10 @@
   (println "|_|_| |_|\\__|_|  \\___/|___/ .__/ \\___|\\___|\\__|")
   (println "                          |_|                  ")

+
   (binding [*compile-path* (str (System/getProperty "user.dir") "/target/classes")]
     (doseq [n (clojure.string/split agent-args #";")]
-      (introspect-namespace (symbol n)))))
+      (introspect-namespace n)))
+
+  (.addShutdownHook (Runtime/getRuntime)
+                    (Thread. #(println (format-report)))))


Make stacktraces optional

Make stacktraces optional

--- src/clj/introspect/core.clj
+++ src/clj/introspect/core.clj
@@ -1,8 +1,16 @@
 (ns introspect.core
-  (:import [introspect IntrospectProfilingAgent Interceptor])
+  (:import [introspect IntrospectProfilingAgent Interceptor]
+           [java.lang.instrument Instrumentation])
   (:require [introspect.stacktrace :as stacktrace]))

-(def format-signature #(str "(" (clojure.string/join " -> " %) ")"))
+
+
+(defn format-signature
+  [types]
+  (str "(" (->> types
+                (map #(.getName %))
+                (clojure.string/join " -> ")) ")"))
+
 (def join-with-newline #(clojure.string/join "\n\t" %))

 (defn get-type
@@ -13,6 +21,8 @@

 ;; (def method-calls (atom {}))
+
+(def ^:dynamic *print-stacktraces* false)

 (let [method-calls (atom {})]

@@ -28,13 +38,14 @@
         (println
          (str
           "\nDetected unusual method call: "
-          (class class-name)
+          (.getName (class class-name))
           " was called with arguments \n\t"
           (format-signature current-call-types)
           "\nprevious calls were with\n\t"
-          (join-with-newline (map format-signature previous-call-types))
-          "\nStacktrace:\n")
-         (stacktrace/format-stack-trace (.getStackTrace (Thread/currentThread)))))
+          (join-with-newline (map format-signature previous-call-types))))
+        (when *print-stacktraces*
+          (println "\nStacktrace:\n"
+                   (stacktrace/format-stack-trace (.getStackTrace (Thread/currentThread))))))

       (swap! method-calls
              update-in


Still not getting sent messages back in the browser :(

--- src/clj/om_sente/server.clj
+++ src/clj/om_sente/server.clj
@@ -35,9 +35,10 @@
   "Main event processor."
   [{:keys [client-uuid ring-req event] :as data}]
   ;; right now we just echo back anything we receive
-  (println "handle-data" event)
+  (println "handle-data" data)
   (let [[ev-id & payload] event]
-    (chsk-send! "test" [:test/reply (first payload)])))
+    (chsk-send! client-uuid [:test/reply (first payload)]))
+  (println "sent reply"))

 (defn -main [& args]
   (println "starting -main")


fix retracted facts handling

fix retracted facts handling

--- src/clj/ow/factum/facts.clj
+++ src/clj/ow/factum/facts.clj
@@ -21,7 +21,8 @@
                                            result)
                            nil (do (vswap! facts* #(assoc-in % [e a] true))
                                    (xf result (take 4 input))))
-                    :retract (do (vswap! facts* #(assoc-in % [e a] ::retracted))
+                    :retract (do (when (nil? (get-in @facts* [e a]))
+                                   (vswap! facts* #(assoc-in % [e a] ::retracted)))
                                  result))))))]
     (into [] xf rawfacts)))


Fixed badge save

Fixed badge save

--- src/clj/salava/badge/db.clj
+++ src/clj/salava/badge/db.clj
@@ -167,14 +167,20 @@
         (insert-badge! {:connection tx}))
     badge-id))

-
 (defn save-user-badge! [ctx user-badge]
   (jdbc/with-db-transaction  [tx (:connection (u/get-db ctx))]
-    (let [badge-id (->> (:badge user-badge) (save-images ctx) (save-badge! tx))
+    (let [now (u/now)
+          badge-id (->> (:badge user-badge) (save-images ctx) (save-badge! tx))
           user-badge-id (-> user-badge
                             (dissoc :badge)
                             (assoc :badge_id badge-id)
                             (insert-user-badge<! {:connection tx})
                             :generated_key)]
-      (doseq [evidence (:evidence user-badge)]
-        (jdbc/insert! tx "user_badge_evidence" (-> evidence (dissoc :id) (assoc :user_badge_id user-badge-id)))))))
+      (when (seq (:evidence user-badge))
+        (doseq [evidence (:evidence user-badge)]
+          (when (map? evidence)
+            (jdbc/insert! tx "user_badge_evidence" (-> evidence
+                                                       (dissoc :id)
+                                                       (assoc :user_badge_id user-badge-id
+                                                              :ctime now
+                                                              :mtime now)))))))))


Remove unnecessary bimap fn

Remove unnecessary bimap fn

--- src/clj/seria/util/coll.clj
+++ src/clj/seria/util/coll.clj
@@ -6,13 +6,6 @@
   (->> coll
        (map-indexed #(vector %2 %1))
        (into {})))
-
-(defn bimap [coll]
-  (->> coll
-       (distinct)
-       (map-indexed vector)
-       (into {})
-       ((juxt set/map-invert identity))))

 (defn find-by [f form]
   (cond-> []


Add Code List Items

Add Code List Items

--- src/cljs/lens/workbook.cljs
+++ src/cljs/lens/workbook.cljs
@@ -3,6 +3,7 @@
                    [plumbing.core :refer [fnk]]
                    [lens.macros :refer [h]])
   (:require [cljs.core.async :as async]
+            [cljs.reader :as reader]
             [om.core :as om :include-macros true]
             [om-tools.core :refer-macros [defcomponent]]
             [om-tools.dom :as d :include-macros true]
@@ -191,6 +192,12 @@
         (or (:question item) "loading..."))
       (when (s/is-numeric? item)
         (d/div {:id (cell-id opts id) :style {:height "200px"}})))))
+
+(defcomponent code-list-item [cl-item]
+  (render [_]
+    (d/div
+      (d/div
+        (str (-> cl-item :id :item-id) ": " (-> cl-item :id :code))))))

 (defn query-grid-cell-mouse-leave [state]
   (assoc state :hover false :dropdown-hover false :dropdown-active false))
@@ -250,7 +257,8 @@
         (condp = (:type term)
           :form (om/build form term {:opts opts})
           :item-group (om/build item-group term {:opts opts})
-          :item (om/build item term {:opts opts})))
+          :item (om/build item term {:opts opts})
+          :code-list-item (om/build code-list-item term {:opts opts})))
       (d/div {:class "query-col-or-badge text-muted"} "OR"))))

 (defn show-item-dialog! [owner query-idx col-idx]
@@ -436,11 +444,30 @@
   (-> (update-in query [:query-grid :cols] #(vec (map-indexed assoc-idx %)))
       (assoc :idx idx)))

+(defn resolve-code-list-item-ids [query]
+  (update-in
+    query [:query-grid :cols]
+    (fn [cols]
+      (mapv
+        (fn [col]
+          (update-in
+            col [:cells]
+            (fn [cells]
+              (mapv
+                (fn [{:keys [type] :as cell}]
+                  (println :resolve :id :in cell)
+                  (if (= :code-list-item type)
+                    (update-in cell [:id] (fn [id] (println id) (reader/read-string id)))
+                    cell))
+                cells))))
+        cols))))
+
 (defn assoc-default-results [query]
   (assoc query :vc-by-se-result {} :vc-by-ad-result {}))

 (defn prepare-queries [queries]
   (->> (map-indexed index-query queries)
+       (map resolve-code-list-item-ids)
        (mapv assoc-default-results)))

 (defn prepare-version


Plug the cell strength based heuristic

Plug the cell strength based heuristic

--- src/cljs/triboard/core.cljs
+++ src/cljs/triboard/core.cljs
@@ -202,18 +202,14 @@
       #(assoc %1 %2 (compute-cell-strength board %2))
       {} all-positions)))

-#_(defn sum-strength
-   "Compute total strength of taking the provided cells"
-   [cells-strength taken-cells]
-   (transduce (map cells-strength) + taken-cells))
-
 (defn move-strength
   "Compute the strength of a move, based on the converted cells"
   [cells-strength converted-filter [move converted]]
   (transduce
     (comp
       (filter converted-filter)
-      (map (comp count :taken))) ;; Enhance this heuristic to consider map connections
+      (mapcat :taken)
+      (map cells-strength))
     + converted))

 (defn worst-immediate-loss


Format project.clj

Format project.clj

Mostly to trigger a new build

--- backend/project.clj
+++ backend/project.clj
@@ -2,7 +2,7 @@
   :description "Akvo Lumen backend"
   :url "https://github.com/akvo/akvo-lumen"
   :license {:name "GNU Affero General Public License 3.0"
-            :url  "https://www.gnu.org/licenses/agpl-3.0.html"}
+            :url "https://www.gnu.org/licenses/agpl-3.0.html"}
   :min-lein-version "2.0.0"
   :dependencies [[clojurewerkz/scrypt "1.2.0"]
                  [ch.qos.logback/logback-classic "1.2.3"]
@@ -46,7 +46,6 @@
                  [ring/ring-json "0.4.0"]
                  [selmer "1.11.8"]
                  [net.postgis/postgis-jdbc "2.2.1" :exclusions [org.postgresql/postgresql]]
-
                  [iapetos "0.1.8" :exclusions [io.prometheus/simpleclient]]
                  [io.prometheus/simpleclient_hotspot "0.5.0"]
                  [io.prometheus/simpleclient_dropwizard "0.5.0"]]
@@ -58,17 +57,17 @@
             [lein-environ "1.0.3"]
             [lein-cljfmt "0.5.7"]
             [jonase/eastwood "0.3.3"]]
-  :codox {:doc-paths   ["resources/akvo/lumen/doc"]
+  :codox {:doc-paths ["resources/akvo/lumen/doc"]
           :output-path "../docs"}
   :main ^:skip-aot akvo.lumen.main
   :target-path "target/%s/"
-  :aliases {"setup"   ["run" "-m" "duct.util.repl/setup"]
+  :aliases {"setup" ["run" "-m" "duct.util.repl/setup"]
             "migrate" ["run" "-m" "dev/migrate"]
-            "seed"    ["run" "-m" "dev/seed"]}
+            "seed" ["run" "-m" "dev/seed"]}
   :test-selectors {:default (and (constantly true)
                                  (complement :functional))
                    :functional :functional
-                   :all     (constantly true)}
+                   :all (constantly true)}
   :eastwood {:config-files ["eastwood_cfg.clj"]}
   :profiles
   {:dev           [:project/dev :profiles/dev]


further annotate hash usage in encoding

further annotate hash usage in encoding

--- src/cljs_api_gen/encode.clj
+++ src/cljs_api_gen/encode.clj
@@ -18,7 +18,7 @@

    ";"  "_SEMICOLON_" ;; syntax - comment
    "\\" "_BSLASH_"    ;; syntax - character
-   "#"  "_HASH_"      ;; syntax - tagged literal
+   "#"  "_HASH_"      ;; syntax - tagged literal, regex, set, fn, cond
    "["  "_LSQUARE_"   ;; syntax - vector
    "]"  "_RSQUARE_"
    "{"  "_LCURLY_"    ;; syntax - map


fix server url

fix server url

--- src/name_bazaar/ui/db.cljs
+++ src/name_bazaar/ui/db.cljs
@@ -19,7 +19,7 @@
 (def production-config
   {:node-url "https://kovan.infura.io/"
    :load-node-addresses? false
-   :server-url "http://localhost:6200"})
+   :server-url "https://api.namebazaar.io"})

 (def default-db
   (merge


Get remote nrepl working with newer lein/nrepl.el

Signed-off-by: Deepak Giridharagopal <d11186354d1ef01ca06ae37d7e23e827da13e85f@puppetlabs.com>

--- src/com/puppetlabs/repl.clj
+++ src/com/puppetlabs/repl.clj
@@ -2,8 +2,7 @@
   (:import [vimclojure.nailgun NGServer])
   (:require [clojure.string :as string]
             [clojure.tools.nrepl.server :as nrepl]
-            [swank.swank :as swank])
-  (:use [clojure.tools.nrepl.transport :only (tty tty-greeting)]))
+            [swank.swank :as swank]))

 (defmulti start-repl
   "Starts and instance of the specified `kind` of REPL, listening on `host` and
@@ -13,7 +12,7 @@

 (defmethod start-repl "nrepl"
   [kind host port]
-  (nrepl/start-server :bind host :port port :transport-fn tty :greeting-fn tty-greeting))
+  (nrepl/start-server :bind host :port port))

 (defmethod start-repl "swank"
   [kind host port]


typos

typos

--- src/examples/clojure/rx/lang/clojure/examples/video_example.clj
+++ src/examples/clojure/rx/lang/clojure/examples/video_example.clj
@@ -11,7 +11,7 @@
 (declare video->bookmark)
 (declare video->rating)

-; just use a simple lock to keep multi-threaded output fr beiom ng a interlea llved
+; just use a simple lock to keep multi-threaded output from being interleaved
 (def print-lock (Object.))

 (defn example1


Update to ClojureScript 0.0-3255

Update to ClojureScript 0.0-3255

--- ClojureScript/project.clj
+++ ClojureScript/project.clj
@@ -1,7 +1,7 @@
 (defproject shrimp "0.1.0-SNAPSHOT"
   :description "Demo project for Goby."
   :dependencies [[org.clojure/clojure "1.7.0-beta2"]
-                 [org.clojure/clojurescript "0.0-3246"]
+                 [org.clojure/clojurescript "0.0-3255"]
                  [org.clojure/core.async "0.1.346.0-17112a-alpha"]
                  [goby "0.3.1"]
                  [org.omcljs/ambly "0.1.0-SNAPSHOT"]]


AB+CM #27 - error handling for create-objective

--- src/objective8/actions.clj
+++ src/objective8/actions.clj
@@ -24,10 +24,11 @@
     (writers/create-candidate candidate)))

 (defn create-objective! [{:keys [created-by-id] :as objective}]
-  (let [stored-objective (objectives/store-objective! objective)]
-    (create-writer-for-objective! stored-objective)
-    {:result stored-objective
-     :status ::success}))
+  (if-let [stored-objective (objectives/store-objective! objective)]
+    (do (create-writer-for-objective! stored-objective)
+        {:result stored-objective
+         :status ::success})
+    {:status ::failure}))

 (defn start-drafting! [objective-id]
   (let [objective (storage/pg-retrieve-entity-by-uri (str "/objectives/" objective-id) :with-global-id)]


do not force all refs to nil

do not force all refs to nil

this merges in an unconventional manner (from right to left) since
user supplied attrs are fed first to merge-props.

--- src/om_bootstrap/util.cljs
+++ src/om_bootstrap/util.cljs
@@ -71,13 +71,14 @@
   handles :on-select :on-click, :on-blur, kebab-cased as om-tools
   prefers."
   (let [merge-class (fn [l r] (str l " " r))
+        orig-fn  (fn [l r] (or l r))
         empty-fn (fn [_ _] nil)]
     {:className merge-class
      :class merge-class
      :style merge
      :children empty-fn
      :key empty-fn
-     :ref empty-fn
+     :ref orig-fn
      :on-select chain-fns
      :on-click chain-fns
      :on-blur chain-fns}))


Small perf improvement in fast concat

Small perf improvement in fast concat

--- src/onyx/peer/function.clj
+++ src/onyx/peer/function.clj
@@ -26,16 +26,18 @@
        (map #(dissoc % :routes :hash-group))))

 (defn into-transient [coll vs]
-  (loop [rs vs updated-coll coll]
-    (if (empty? rs)
-      updated-coll
-      (recur (rest rs) (conj! updated-coll (first rs))))))
+  (loop [rs (seq vs) updated-coll coll]
+    (if rs
+      (recur (next rs)
+             (conj! updated-coll (first rs)))
+      updated-coll)))

 (defn fast-concat [vvs]
-  (loop [vs vvs coll (transient [])]
-    (if (empty? vs)
-      (persistent! coll)
-      (recur (rest vs) (into-transient coll (first vs))))))
+  (loop [vs (seq vvs) coll (transient [])]
+    (if vs
+      (recur (next vs)
+             (into-transient coll (first vs)))
+      (persistent! coll))))

 (defn build-segments-to-send [leaves]
   (->> leaves


Invite modal: Use keys consistent with identity schema

--- src-cljs/frontend/components/pages/team.cljs
+++ src-cljs/frontend/components/pages/team.cljs
@@ -77,16 +77,16 @@
                       (:email user))))))

 (defn invite-teammates-modal [{:keys [selected-org close-fn show-modal?]} owner]
-  (letfn [(select-user! [{:keys [login] :as user}]
-            (om/set-state! owner [:org-members-by-login login :selected] true))
-          (deselect-user! [{:keys [login] :as user}]
-            (om/set-state! owner [:org-members-by-login login :selected] false))
-          (selected? [{:keys [login] :as user}]
-            (om/get-state owner [:org-members-by-login login :selected]))
-          (set-email! [{:keys [login] :as user} value]
-            (om/set-state! owner [:org-members-by-login login :email] value))
-          (get-email [{:keys [login] :as user}]
-            (om/get-state owner [:org-members-by-login login :email]))]
+  (letfn [(select-user! [{:keys [handle] :as user}]
+            (om/set-state! owner [:org-members-by-handle handle :selected] true))
+          (deselect-user! [{:keys [handle] :as user}]
+            (om/set-state! owner [:org-members-by-handle handle :selected] false))
+          (selected? [{:keys [handle] :as user}]
+            (om/get-state owner [:org-members-by-handle handle :selected]))
+          (set-email! [{:keys [handle] :as user} value]
+            (om/set-state! owner [:org-members-by-handle handle :email] value))
+          (get-email [{:keys [handle] :as user}]
+            (om/get-state owner [:org-members-by-handle handle :email]))]
     (reify
       om/IWillReceiveProps
       (will-receive-props [_ new-props]
@@ -99,103 +99,108 @@
             (api/get-org-members (:name new-selected-org) (:vcs_type new-selected-org) (om/get-shared owner [:comms :api])))
           (when (not= new-vcs-users old-vcs-users)
             (om/set-state! owner
-                           :org-members-by-login
+                           :org-members-by-handle
                            (into {}
-                                 (for [{:keys [login circle_member email id]
-                                        :as user} new-vcs-users
-                                       :when (not circle_member)
+                                 (for [[handle {:keys [is_user email provider_id]
+                                                :as user}] new-vcs-users
+                                       :when (not is_user)
                                        :let [trimmed-email (some-> email gstr/trim)]]
-                                   [login {:email trimmed-email
-                                           :login login
-                                           :id id
-                                           :selected (valid-email? trimmed-email)}]))))))
+                                   [handle {:email trimmed-email
+                                            :login handle
+                                            :id provider_id
+                                            :selected (valid-email? trimmed-email)}]))))))

       om/IRenderState
-      (render-state [_ {:keys [org-members-by-login]}]
+      (render-state [_ {:keys [org-members-by-handle]}]
         (component
          (if show-modal?
-           (let [users (remove :circle_member (:vcs-users selected-org))
+           (let [users (when show-modal?
+                         (->> selected-org
+                              :vcs-users
+                              vals
+                              (remove :is_user)
+                              (sort-by :handle)))
                  count-users (count users)
                  count-with-email (count (filter (fn [[_ user]]
                                                    (-> user :email valid-email?))
-                                                 org-members-by-login))
+                                                 org-members-by-handle))
                  count-selected (count (filter (fn [[_ user]]
                                                  (:selected user))
-                                               org-members-by-login))]
+                                               org-members-by-handle))]
              (modal/modal-dialog {:title "Invite Teammates"
                                   :body
                                   (element :body
-                                    (html
-                                     [:div
-                                      (if-not (contains? selected-org :vcs-users)
-                                        [:div.loading-spinner common/spinner]
-                                        (list
-                                         [:.header
-                                          "These are the people who are not using CircleCI yet ("
-                                          [:span
-                                           [:b count-with-email]
-                                           " of "
-                                           [:b count-users]
-                                           " users have emails, "
-                                           [:b count-selected]
-                                           " are selected):"]]
-                                         [:.table
-                                          (om/build table/table
-                                                    {:rows users
-                                                     :key-fn :login
-                                                     :columns [{:header "Username"
-                                                                :cell-fn (fn [{:keys [login] :as user}]
-                                                                           (element :avatars
-                                                                                (html
-                                                                                [:div
-                                                                                [:img.invite-gravatar {:src (gh-utils/make-avatar-url user
-                                                                                :size 50)}]
-                                                                                (str "  " login)])))}
-                                                               {:header "Email"
-                                                                :cell-fn (fn [user]
-                                                                           (let [is-selected (selected? user)
-                                                                                email (get-email user)]
-                                                                             (om/build form/text-field
-                                                                                {:on-change (fn [event]
-                                                                                (let [trimmed-input (gstr/trim (.. event -currentTarget -value))
-                                                                                is-valid (valid-email? trimmed-input)]
-                                                                                (set-email! user trimmed-input)
-                                                                                (cond
-                                                                                (and (not is-selected)
-                                                                                is-valid)
-                                                                                (select-user! user)
-                                                                                (and is-selected
-                                                                                (not is-valid))
-                                                                                (deselect-user! user))))
-                                                                                :value email
-                                                                                :size :medium
-                                                                                :validation-error (when (and (or is-selected
-                                                                                (not (empty? email)))
-                                                                                (not (valid-email? email)))
-                                                                                (str email " is not a valid email"))})))}
-                                                               {:type :shrink
-                                                                :cell-fn (fn [user]
-                                                                           (let [email (get-email user)
-                                                                                is-valid (valid-email? email)]
-                                                                             [:input {:type "checkbox"
-                                                                                :disabled (and (not is-valid)
-                                                                                (not (empty? email)))
-                                                                                :checked (selected? user)
-                                                                                :on-click #(if-let [is-checked (.. % -currentTarget -checked)]
-                                                                                (when is-valid
-                                                                                (select-user! user))
-                                                                                (deselect-user! user))}]))}]
-                                                     :striped? true})]))]))
+                                           (html
+                                            [:div
+                                             (if-not (contains? selected-org :vcs-users)
+                                               [:div.loading-spinner common/spinner]
+                                               (list
+                                                [:.header
+                                                 "These are the people who are not using CircleCI yet ("
+                                                 [:span
+                                                  [:b count-with-email]
+                                                  " of "
+                                                  [:b count-users]
+                                                  " users have emails, "
+                                                  [:b count-selected]
+                                                  " are selected):"]]
+                                                [:.table
+                                                 (om/build table/table
+                                                           {:rows users
+                                                            :key-fn :handle
+                                                            :columns [{:header "Username"
+                                                                       :cell-fn (fn [{:keys [handle] :as user}]
+                                                                                (element :avatars
+                                                                                (html
+                                                                                [:div
+                                                                                [:img.invite-gravatar {:src (gh-utils/make-avatar-url user
+                                                                                :size 50)}]
+                                                                                (str "  " handle)])))}
+                                                                      {:header "Email"
+                                                                       :cell-fn (fn [user]
+                                                                                (let [is-selected (selected? user)
+                                                                                email (get-email user)]
+                                                                                (om/build form/text-field
+                                                                                {:on-change (fn [event]
+                                                                                (let [trimmed-input (gstr/trim (.. event -currentTarget -value))
+                                                                                is-valid (valid-email? trimmed-input)]
+                                                                                (set-email! user trimmed-input)
+                                                                                (cond
+                                                                                (and (not is-selected)
+                                                                                is-valid)
+                                                                                (select-user! user)
+                                                                                (and is-selected
+                                                                                (not is-valid))
+                                                                                (deselect-user! user))))
+                                                                                :value email
+                                                                                :size :medium
+                                                                                :validation-error (when (and (or is-selected
+                                                                                (not (empty? email)))
+                                                                                (not (valid-email? email)))
+                                                                                (str email " is not a valid email"))})))}
+                                                                      {:type :shrink
+                                                                       :cell-fn (fn [user]
+                                                                                (let [email (get-email user)
+                                                                                is-valid (valid-email? email)]
+                                                                                [:input {:type "checkbox"
+                                                                                :disabled (and (not is-valid)
+                                                                                (not (empty? email)))
+                                                                                :checked (selected? user)
+                                                                                :on-click #(if-let [is-checked (.. % -currentTarget -checked)]
+                                                                                (when is-valid
+                                                                                (select-user! user))
+                                                                                (deselect-user! user))}]))}]
+                                                            :striped? true})]))]))
                                   :actions [(button/button {:on-click close-fn} "Cancel")
                                             (forms/managed-button
                                              [:button.btn.btn-success {:data-success-text "Sent"
                                                                        :on-click #(do
-                                                                                (raise! owner [:invited-github-users {:invitees (invitees org-members-by-login)
+                                                                                (raise! owner [:invited-github-users {:invitees (invitees org-members-by-handle)
                                                                                :vcs_type (:vcs_type selected-org)
                                                                                :org-name (:name selected-org)}])
                                                                                (close-fn))
-                                                                       :disabled (or (empty? (invitees org-members-by-login))
-                                                                                (not (every? (comp valid-email? :email) (invitees org-members-by-login))))}
+                                                                       :disabled (or (empty? (invitees org-members-by-handle))
+                                                                                (not (every? (comp valid-email? :email) (invitees org-members-by-handle))))}
                                               "Send Invites "
                                               [:i.fa.fa-envelope-o]])]
                                   :close-fn close-fn}))


comment

comment

--- src/otp_api_proxy/util.clj
+++ src/otp_api_proxy/util.clj
@@ -35,6 +35,9 @@
                  (http-client/get route-lines-url))))))

 (defn anaheim-route-lines []
+  ;; Note that results include the SSV header. I've kept it in there to make
+  ;; debugging easier.  It won't create a problem unless some bus route is
+  ;; named "route line id" for instance.
   (let [lines (split (route-lines-request) #"\n")]
     (for [l lines]
       (let [fields (split l #"\\")]


Added ring-swagger-ui dependency to the project.

--- app/project.clj
+++ app/project.clj
@@ -9,7 +9,8 @@
                  [com.stuartsierra/component "0.2.3"]
                  [metosin/potpuri "0.2.2"]
                  [http-kit "2.1.19"]
-                 [metosin/compojure-api "0.21.0"]]
+                 [metosin/compojure-api "0.21.0"]
+                 [metosin/ring-swagger-ui "2.1.5-M2"]]
   :main ^:skip-aot clj-web-example.main
   :target-path "target/%s"
   :profiles {:uberjar {:aot :all}})


lookback to estimate n? in (predict-result s t n?)

--- src/paulkrake/crossval.clj
+++ src/paulkrake/crossval.clj
@@ -2,14 +2,31 @@
   (:require [paulkrake.datacenter :as dc]
             [paulkrake.goals :as g]))

+(defn metric-distance
+  "euklidische Norm"
+  [result prediction]
+  (->> (map (fn [[rh rg][ph pg]]
+              (Math/sqrt (+ (* (- rg pg)
+                               (- rg pg))
+                            (* (- rh ph)
+                               (- rh ph))))) result prediction)
+       (map (fn [x] (* x x)))
+       (apply +)
+       (Math/sqrt)))

-(defn points-single-game [[[rh rg][ph pg]]]
-  (let []
-    (cond (and (=  rh ph) (= rg pg)) 4
-          (and (not= rh ph) (= (- rh ph) (- rg pg)))    3
-          (= (Math/signum (double (- rh rg))) (Math/signum (double (- ph pg)))) 2
-          true                                                0
-          )))
+(defn kickerpoints [[rh rg][ph pg]]
+  (cond (and (=  rh ph) (= rg pg)) 4
+        (and (not= rh ph) (= (- rh ph) (- rg pg)))    3
+        (= (Math/signum (double (- rh rg))) (Math/signum (double (- ph pg)))) 2
+        true                                                0))
+
+(defn metric-kickerpoints
+  "kickerpoints metric"
+  [result prediction]
+  (->> (map kickerpoints result prediction)
+       (map (fn [x] (* -1 x)))
+       (apply +)))
+
 (defn look-back [min-n max-n  t]
   (max min-n (min t max-n)))

@@ -21,17 +38,35 @@
                      (reduce (fn [a [h g hg gg]] (assoc a [h g] [(int hg) (int gg)])) nil x))]
     (as-> (merge-with vector result prediction) x
       (vals x)
-      (map (fn [rp] (points-single-game rp)) x)
+      (map (fn [rp] (metric-kickerpoints rp)) x)
       (apply + x))))

-(defn cross-validate [saison threshold]
+#_(defn cross-validate [saison threshold]
   (as-> (for [max-n (range 1 35)  min-n (range 1 35) :while (<= min-n max-n)]
           (as-> (dc/range-spieltage saison 35 34) y
             (map (fn [s] (points s min-n max-n)) y)
             [min-n max-n (apply + y)])) x
     (filter (fn [[_ _ p]] (< threshold p)) x )
     (sort-by (fn [[a b _]] (+ b  (* a  100)) ) x)))
+#_(cross-validate 1415 386)
+
+(defn to-map [list-of-results]
+  (reduce (fn [a [h g hg gg]] (assoc a [h g] [hg gg])) {} list-of-results))
+
+(defn measure [result prediction metric-fn]
+  (as-> (merge-with vector (to-map result) (to-map prediction)) x
+    (vals x)
+    (metric-fn (map first x) (map second x))))
+
+(defn lookback [s t metric-fn]
+  (let [result (dc/spieltag s t)]
+    (as-> (range 5 34) x1
+      (map (fn [n] [n (as-> (g/predict-result s t n) y
+                        (measure result y metric-fn))]) x1)
+      (sort-by second x1))))

-#_(cross-validate 1415 386)
+
+
+


[#2399] Make authz middleware allow collection requests

--- backend/src/akvo/lumen/lib/auth.clj
+++ backend/src/akvo/lumen/lib/auth.clj
@@ -97,7 +97,8 @@
                  "/api/visualisations/maps" {:methods #{:post}}
                  "/api/dashboards" {:methods #{:get :post}}
                  "/api/dashboards/:id" {:methods #{:get :put :delete}}
-                 "/api/collections" {:methods #{:get}}})
+                 "/api/collections" {:methods #{:get :post}}
+                 "/api/collections/:id" {:methods #{:get :put :delete}}})

 (defn- auth-datasets [all-datasets permissions]
   (->> all-datasets


[#1449] Refactor: prefer s/explain-data vs s/explain

so we don't print out result of s/valid? indirectly when calling l.auth/ids

--- backend/src/akvo/lumen/lib/auth.clj
+++ backend/src/akvo/lumen/lib/auth.clj
@@ -212,5 +212,5 @@
               dataset.s/*id?*       ds-fun
               dashboard.s/*id?*     dash-fun
               collection.s/*id?*    col-fun]
-      (s/explain spec data)
+      (s/explain-data spec data)
       (deref ids))))


Removed pprint for basic debug so query returns are in their individual lines

--- src/conceptnet_clj/core.clj
+++ src/conceptnet_clj/core.clj
@@ -88,4 +88,4 @@
        (d/db conn)
        concept-name))

-(pp/pprint (find-concepts-for-concept "Clojure"))+(find-concepts-for-concept "Clojure")


Extendes some documentation

Extendes some documentation

for context-sum, context-product, context-semiproduct and
context-xia-product. Did not test whether TeX accepts this documentation
though.

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

--- src/conexp/fca/contexts.clj
+++ src/conexp/fca/contexts.clj
@@ -431,7 +431,13 @@
   (make-context base-set base-set not=))

 (defn context-sum
-  "Computes the context sum of ctx-1 and ctx-2."
+  "Computes the context sum of ctx-1 and ctx-2, that is
+  \\begin{multline}
+    (G_1,M_1,I_1) + (G_2,M_2,I_2) := \\\\
+      (G_1\\cup G_2, M_1\\cup M_2, I_1\\cup I_2
+      \\cup (G_1\\times M_2) \\cup (G_2\\times M_1)
+  \\end{multline}
+  where all set unions are disjoint set unions."
   [ctx-1 ctx-2]
   (let [new-objs (union (set-of [g_1 1] [g_1 (objects ctx-1)])
 			(set-of [g_2 2] [g_2 (objects ctx-2)]))
@@ -450,7 +456,15 @@
     (make-context new-objs new-atts new-inz)))

 (defn context-product
-  "Computes the context product of ctx-1 and ctx-2."
+  "Computes the context product of ctx-1 and ctx-2, that is
+  \\[
+    (G_1,M_1,I_1) \\times (G_2,M_2,I_2) :=
+      (G_1\\times G_2, M_1\\times M_2, \\nabla)
+  \\]
+  where
+  \\[
+    (g_1,g_2)\\nabla(m_1,m_2) \\iff g_1I_1m_1 \\text{ or } g_2I_2m_2.
+  \\]"
   [ctx-1 ctx-2]
   (let [new-objs (cross-product (objects ctx-1) (objects ctx-2))
 	new-atts (cross-product (attributes ctx-1) (attributes ctx-2))
@@ -464,7 +478,16 @@
     (make-context new-objs new-atts new-inz)))

 (defn context-semiproduct
-  "Computes the context semiproduct of ctx-1 and ctx-2."
+  "Computes the context semiproduct of ctx-1 and ctx-2, where for
+  contexts $(G_1,M_1,I_1)$ and $(G_2,M_2,I_2)$ their semidirect
+  product is defined as
+  \\[
+    (G_1\\times G_2, M_1\\cup M_2, \\nabla)
+  \\]
+  where
+  \\[
+    (g_1,g_2)\\nabla(j,m) \\iff g_jI_jm \\qquad\\text{for $j\\in\\set{1,2}}.
+  \\]"
   [ctx-1 ctx-2]
   (let [new-objs (cross-product (objects ctx-1) (objects ctx-2))
 	new-atts (disjoint-union (attributes ctx-1) (attributes ctx-2))
@@ -476,7 +499,15 @@
     (make-context new-objs new-atts new-inz)))

 (defn context-xia-product
-  "Computes Xia's product of ctx-1 and ctx-2."
+  "Computes Xia's product of ctx-1 and ctx-2, where for two contexts
+  $(G_1,M_1,I_1)$ and $(G_2,M_2,I_2)$ their Xia product is defined as
+  \\[
+    (G_1\\times G_2, M_1\\times M_2, \\tilde)
+  \\]
+  where
+  \\[
+    (g_1,g_2) \\tilde (m_1,m_2) \\iff (g_1I_1m_1\\iff g_2I_2m_2).
+  \\]."
   [ctx-1 ctx-2]
   (let [G_1 (objects ctx-1)
 	G_2 (objects ctx-2)