[PDOK-1592] fix: change-update after delete in geoserver

--- src/main/clojure/pdok/featured/geoserver.clj
+++ src/main/clojure/pdok/featured/geoserver.clj
@@ -125,10 +125,11 @@
        " WHERE NOT EXISTS (SELECT 1 FROM " (pg/quoted schema) "." (pg/quoted table) " WHERE _id = ?)" ))

 (defn- gs-add-feature
-  ([db proj-fn all-attributes-fn features]
+  ([db proj-fn all-attributes-fn no-insert features]
    (try
-     (let [selector (juxt :dataset :collection)
-           per-dataset-collection (group-by selector features)]
+     (let [filtered-features (filter #(not (@no-insert (:version %))) features)
+           selector (juxt :dataset :collection)
+           per-dataset-collection (group-by selector filtered-features)]
         (doseq [[[dataset collection] grouped-features] per-dataset-collection]
          (let [all-attributes (all-attributes-fn dataset collection)
                records (filter (comp not nil?)
@@ -157,7 +158,7 @@

 (defn- gs-update-feature [db proj-fn features]
     (let [selector (juxt :dataset :collection)
-         per-dataset-collection
+          per-dataset-collection
            (group-by selector features)]
      (doseq [[[dataset collection] collection-features] per-dataset-collection]
         ;; group per key collection so we can batch every group
@@ -185,17 +186,31 @@
     (catch java.sql.SQLException e
       (log/with-logs ['pdok.featured.projectors :error :error] (j/print-sql-exception-chain e)))))

-(defn- flush-all [db proj-fn cache insert-batch update-batch delete-batch]
+(defn- flush-all [db proj-fn cache insert-batch update-batch delete-batch no-insert]
   "Used for flushing all batches, so entry order is alway new change close"
   (let [cached-collection-attributes (cached cache gs-collection-attributes db)]
+
+    (process-batch update-batch (partial gs-update-feature db proj-fn))
     (process-batch delete-batch (partial gs-delete-feature db))
-    (flush-batch insert-batch (partial gs-add-feature db proj-fn cached-collection-attributes))
+
+    (flush-batch insert-batch (partial gs-add-feature db proj-fn cached-collection-attributes no-insert))
     (flush-batch update-batch (partial gs-update-feature db proj-fn))
-    (flush-batch delete-batch (partial gs-delete-feature db))))
+    (flush-batch delete-batch (partial gs-delete-feature db))
+
+    (dosync (ref-set no-insert #{}))
+    ))
+
+(defn- versions-in-batch [{:keys [dataset collection id]} batch]
+   (map :version
+        (filter (fn [f] (and
+                     (= (:dataset f) dataset)
+                     (= (:collection f) collection)
+                     (= (:id f) id)))
+                batch)))

 (deftype GeoserverProjector [db cache insert-batch insert-batch-size
                              update-batch update-batch-size
-                             delete-batch delete-batch-size
+                             delete-batch delete-batch-size no-insert
                              flush-fn proj-fn no-visualization ndims srid]
   proj/Projector
   (proj/init [this] this)
@@ -206,7 +221,7 @@
             cached-collection-exists? (cached cache gs-collection-exists? db)
             cached-collection-attributes (cached cache gs-collection-attributes db)
             batched-add-feature
-            (with-batch insert-batch insert-batch-size (partial gs-add-feature db proj-fn cached-collection-attributes) flush-fn)]
+            (with-batch insert-batch insert-batch-size (partial gs-add-feature db proj-fn cached-collection-attributes no-insert) flush-fn)]
         (do (when (not (cached-dataset-exists? dataset))
               (gs-create-dataset db dataset)
               (cached-dataset-exists? :reload dataset))
@@ -238,8 +253,11 @@
         (batched-delete-feature feature))))
   (proj/delete-feature [p feature]
     (if (proj/accept? p feature)
-      (let [batched-delete-feature (with-batch delete-batch delete-batch-size
+      (let [versions-in-insert (versions-in-batch feature @insert-batch)
+            batched-delete-feature (with-batch delete-batch delete-batch-size
                                      (partial gs-delete-feature db) flush-fn)]
+        (dosync
+          (alter no-insert #(clojure.set/union % (into #{} versions-in-insert))))
         (batched-delete-feature feature))))
   (proj/accept? [_ feature]
          (not (some #{(:collection feature)} no-visualization)))
@@ -257,12 +275,13 @@
         update-batch (ref (clojure.lang.PersistentQueue/EMPTY))
         delete-batch-size (or (:delete-batch-size config) (:batch-size config) 10000)
         delete-batch (ref (clojure.lang.PersistentQueue/EMPTY))
+        no-insert (ref #{})
         ndims (or (:ndims config) 2)
         srid (or (:srid config) 28992)
         proj-fn (or (:proj-fn config) identity)
         no-visualization (:no-visualization config)
-        flush-fn #(flush-all db proj-fn cache insert-batch update-batch delete-batch)]
+        flush-fn #(flush-all db proj-fn cache insert-batch update-batch delete-batch no-insert)]
     (->GeoserverProjector db cache insert-batch insert-batch-size
                           update-batch update-batch-size
-                          delete-batch delete-batch-size
+                          delete-batch delete-batch-size no-insert
                           flush-fn proj-fn no-visualization ndims srid)))


add default to demand ugen

add default to demand ugen

--- src/overtone/sc/ugen/metadata/demand.clj
+++ src/overtone/sc/ugen/metadata/demand.clj
@@ -5,7 +5,7 @@
      [
       {:name "Demand",
        :args [{:name "trig" :doc "Can be any signal. A trigger happens when the signal changes from non-positive to positive."}
-              {:name "reset" :doc "Resets the list of ugens when triggered."}
+              {:name "reset" :default 0 :doc "Resets the list of ugens when triggered."}
               {:name "demandUGens", :mode :append-sequence-set-num-outs :doc "list of demand rate ugens"}],
        :check (same-rate-as-first-input)
        :auto-rate true


Stackdriver: fix shadowing warning for string/replace.

--- src/riemann/stackdriver.clj
+++ src/riemann/stackdriver.clj
@@ -2,8 +2,8 @@
   "Forwards events to Stackdriver."
   (:require riemann.time
             [clj-http.client :as client]
-            [cheshire.core :refer [generate-string]])
-  (:use [clojure.string :only [replace]]))
+            [cheshire.core :refer [generate-string]]
+            [clojure.string :as str]))

 (def gateway-url "https://custom-gateway.stackdriver.com/v1/custom")

@@ -11,7 +11,7 @@
   "Constructs a metric name from an event."
   [opts event]
   (let [service ((:name opts) event)]
-     (replace service #"\s+" ".")))
+     (str/replace service #"\s+" ".")))

 (defn generate-datapoint
   "Accepts riemann event/events and converts it into equivalent stackdriver datapoint."


Add conversions: bbl <-> m^3

Add conversions: bbl <-> m^3


Cleaning up some macro code

Cleaning up some macro code

--- src/midje/checkers/defining.clj
+++ src/midje/checkers/defining.clj
@@ -11,9 +11,9 @@
         core-metavars {:midje/checker true :arglists `'~arglists}
         metavars-to-add (if docstring
                           (assoc core-metavars :doc docstring)
-                          core-metavars)]
-    `(def ~(vary-meta checker-name merge metavars-to-add)
-          (.withMeta ~core-function
+                          core-metavars)
+        name (vary-meta checker-name merge metavars-to-add)]
+    `(def ~name (.withMeta ~core-function
                      (assoc (.meta (var ~checker-name)) :midje/checker true)))))


Reduce unnecessarily long backoff times

Reduce unnecessarily long backoff times

--- src/onyx/information_model.cljc
+++ src/onyx/information_model.cljc
@@ -759,7 +759,7 @@
             {:doc "Mean number of ms to wait before trying to rejoin the cluster after a previous join attempt has aborted."
              :type :integer
              :unit :milliseconds
-             :default 500
+             :default 200
              :optional? true
              :added "0.8.0"}

@@ -767,7 +767,7 @@
             {:doc "Number of ms to wait before trying to complete the job if all input tasks have been exhausted."
              :type :integer
              :unit :milliseconds
-             :default 400
+             :default 100
              :optional? true
              :added "0.8.0"}

@@ -775,7 +775,7 @@
             {:doc "Number of ms to back off and wait before retrying the call to `start-task?` lifecycle hook if it returns false."
              :type :integer
              :unit :milliseconds
-             :default 500
+             :default 100
              :optional? true
              :added "0.8.0"}

@@ -784,7 +784,7 @@
              :type :integer
              :unit :milliseconds
              :optional? true
-             :default 500
+             :default 100
              :added "0.8.0"}

             :onyx.peer/fn-params


More netty type hinting. Length check no longer required

--- src/onyx/messaging/protocol.clj
+++ src/onyx/messaging/protocol.clj
@@ -44,7 +44,7 @@

 (def completion-payload-length (int (+ completion-msg-length type-header-length)))

-(defn build-completion-msg-buf [allocator id]
+(defn build-completion-msg-buf [^ByteBufAllocator allocator id]
   (let [buf ^ByteBuf (.ioBuffer allocator completion-payload-length) #_(byte-buffer completion-payload-length)]
     (.writeByte buf completion-type-id)
     (write-uuid buf id)
@@ -56,7 +56,7 @@

 (def ack-payload-length ^int (+ ack-msg-length type-header-length))

-(defn build-ack-msg-buf [allocator id completion-id ack-val]
+(defn build-ack-msg-buf [^ByteBufAllocator allocator id completion-id ack-val]
   (let [^ByteBuf buf (.ioBuffer allocator ack-payload-length) #_(byte-buffer ack-payload-length)]
     (.writeByte buf ack-type-id)
     (write-uuid buf id)
@@ -97,7 +97,7 @@
      :ack-val ack-val
      :message message}))

-(defn build-messages-msg-buf [allocator messages]
+(defn build-messages-msg-buf [^ByteBufAllocator allocator messages]
   (let [compressed-messages (map (fn [msg]
                                    (update-in msg [:message] compress))
                                  messages)
@@ -132,9 +132,9 @@
     (cond (= msg-type messages-type-id)
           (read-messages-buf buf)
           (= msg-type ack-type-id)
-          (if (<= ack-msg-length (.readableBytes buf))
-            (read-ack-buf buf))
+          (read-ack-buf buf)
           (= msg-type completion-type-id)
-          (if (<= completion-msg-length (.readableBytes buf))
-            (read-completion-buf buf))
+          (read-completion-buf buf)
           :else (throw (Exception. (str "Invalid message type: " msg-type))))))
+
+


Thread a map through.

Thread a map through.

--- src/onyx/peer/task_pipeline.clj
+++ src/onyx/peer/task_pipeline.clj
@@ -7,9 +7,8 @@
 (defn create-tx-session [queue]
   (extensions/create-tx-session queue))

-(defn read-batch [queue session queue-name batch-size]
-  (let [consumer (extensions/create-consumer queue session queue-name)]
-    (map (partial extensions/consume-message consumer) (range batch-size))))
+(defn read-batch [queue consumer batch-size]
+  (map (partial extensions/consume-message queue consumer) (range batch-size)))

 (defn decompress-message [message]
   (read-string message))
@@ -24,35 +23,37 @@

 (defn open-session-loop [queue read-ch]
   (loop []
-    (>!! read-ch (create-tx-session queue))
-    (recur)))
+    (when-let [session (create-tx-session queue)]
+      (>!! read-ch {:session session})
+      (recur))))

 (defn read-batch-loop [queue queue-name read-ch decompress-ch batch-size]
   (loop []
-    (when-let [session (<!! read-ch)]
-      (let [batch (read-batch queue session queue-name batch-size)]
-        (>!! decompress-ch batch))
+    (when-let [{:keys [session] :as event} (<!! read-ch)]
+      (let [consumer (extensions/create-consumer queue session queue-name)
+            batch (read-batch queue consumer batch-size)]
+        (>!! decompress-ch (assoc event :batch batch :consumer consumer)))
       (recur))))

 (defn decompress-tx-loop [decompress-ch apply-fn-ch]
   (loop []
-    (when-let [batch (<!! decompress-ch)]
+    (when-let [{:keys [batch] :as event} (<!! decompress-ch)]
       (let [decompressed-msgs (map decompress-message batch)]
-        (>!! apply-fn-ch decompressed-msgs))
+        (>!! apply-fn-ch (assoc event :decompressed decompressed-msgs)))
       (recur))))

 (defn apply-fn-loop [apply-fn-ch compress-ch task]
   (loop []
-    (when-let [msgs (<!! apply-fn-ch)]
-      (let [rets (map (partial apply-fn task) msgs)]
-        (>!! compress-ch rets))
+    (when-let [{:keys [decompressed] :as event} (<!! apply-fn-ch)]
+      (let [results (map (partial apply-fn task) decompressed)]
+        (>!! compress-ch (assoc event :results results)))
       (recur))))

 (defn compress-tx-loop [compress-ch write-batch-ch]
   (loop []
-    (when-let [batch (<!! compress-ch)]
-      (let [compressed-msgs (map compress-msg batch)]
-        (>!! compress-ch batch))
+    (when-let [{:keys [results] :as event} (<!! compress-ch)]
+      (let [compressed-msgs (map compress-msg results)]
+        (>!! compress-ch (assoc event :compressed compressed-msgs)))
       (recur))))

 (defn write-batch-loop [write-ch status-check-ch]


Fix if order.

Fix if order.

--- src/onyx/flow_conditions/fc_routing.cljc
+++ src/onyx/flow_conditions/fc_routing.cljc
@@ -49,10 +49,10 @@
         (if (seq compiled-ex-fcs)
           (choose-output-paths event compiled-ex-fcs result (:exception (ex-data message)) egress-tasks)
           (let [{:keys [exception segment]} (ex-data message)]
-            (throw (maybe-attach-segment exception task-id segment)))))
-      (if (seq compiled-norm-fcs)
-        (choose-output-paths event compiled-norm-fcs result message egress-tasks)
-        (->Route egress-tasks nil nil nil))))))
+            (throw (maybe-attach-segment exception task-id segment))))
+        (if (seq compiled-norm-fcs)
+          (choose-output-paths event compiled-norm-fcs result message egress-tasks)
+          (->Route egress-tasks nil nil nil)))))))

 (defn apply-post-transformation [message routes event]
   (let [post-transformation (:post-transformation routes)


Deallocate task-slot-ids on deallocated job

--- src/onyx/scheduling/common_job_scheduler.clj
+++ src/onyx/scheduling/common_job_scheduler.clj
@@ -208,6 +208,7 @@
   (let [peers (sort (replica->job-peers replica job))]
     (-> replica
         (update-in [:allocations] dissoc job)
+        (update-in [:task-slot-ids] dissoc job)
         (update-in [:peer-state] (fn [peer-state]
                                    (reduce (fn [ps peer]
                                              (assoc ps peer :idle))


Add test.

Add test.

--- src/onyx/scheduling/common_job_scheduler.clj
+++ src/onyx/scheduling/common_job_scheduler.clj
@@ -174,6 +174,8 @@

 (def max-utilization-p (claim-spare-peers replica-p job-claims-p spare-peers-p))

+(def task-distribution-p (cts/task-distribute-peer-count replica-b :j2 (:j2 max-utilization-p)))
+


removed loop in authentication; still not working though. cannot find token?

--- src/amindblowingworld/routes.clj
+++ src/amindblowingworld/routes.clj
@@ -39,7 +39,7 @@
 (def client-config
   {:client-id "60b87c4b4a6e4428e50d"
    :client-secret "096e27ebcf5c127f857b655bc136b050b6244edc"
-   :callback {:domain "http://amindblowingworld.clojurecup.com" :path "/"}
+   :callback {:domain "http://amindblowingworld.clojurecup.com" :path "/authenticated"}
    })

 (def uri-config
@@ -94,9 +94,7 @@

 (defroutes main-routes
   (GET "/" [request]
-       (if auth
-         (friend/authorize #{::user} (render-main-page request))
-         (render-main-page request)))
+         (render-main-page request))

          ;; [:ul [:li (e/link-to (misc/context-uri request "role-user") "Requires the `user` role")]
         ;;  ;[:li (e/link-to (misc/context-uri request "role-admin") "Requires the `admin` role")]
@@ -104,10 +102,9 @@
         ;;         "Requires any authentication, no specific role requirement")]]
         ;; [:h3 "Logging out"]
         ;; [:p (e/link-to (misc/context-uri request "logout") "Click here to log out") "."])))
-  (GET "/logout" request
-    (friend/logout* (resp/redirect (str (:context request) "/"))))
-  ;; (GET "/requires-authentication" request
-  ;;   (friend/authenticated "Thanks for authenticating!"))
+  (friend/logout (ANY "/logout" request (ring.util.response/redirect "/")))
+  (GET "/authenticated" [request]
+    (friend/authorize #{::user} (render-main-page request)))
   ;; (GET "/role-user" request
   ;;   (friend/authorize #{::users/user} "You're a user!"))
   ;; #_(GET "/role-admin" request
@@ -128,8 +125,8 @@
     (-> main-routes
         (friend/authenticate
          {:allow-anon? true
-          ;;:default-landing-uri "/"
-          ;;:login-uri "/"
+          :default-landing-uri "/"
+          :login-uri "/github.callback"
           :unauthorized-handler #(-> (h/html5 [:h2 "You do not have sufficient privileges to access " (:uri %)])
                                      resp/response
                                      (resp/status 401))
@@ -137,8 +134,8 @@
                        {:client-config client-config
                         :uri-config uri-config
                         :config-auth config-auth
-                        :access-token-parsefn oauth2u/get-access-token-from-params
-                        ;;:access-token-parsefn #(-> % :body codec/form-decode (get "access_token"))
+                        ;;:access-token-parsefn oauth2u/get-access-token-from-params
+                        :access-token-parsefn #(-> % :body codec/form-decode (get "access_token"))
                         })]})
         handler/site
         wrap-base-url)


capitalize apps

capitalize apps

--- src/pc/views/blog/optimizing_om_apps.clj
+++ src/pc/views/blog/optimizing_om_apps.clj
@@ -38,7 +38,7 @@
       (.call f this))))")

 (defn optimizing-om-apps []
-  {:title "Optimizing Om apps"
+  {:title "Optimizing Om Apps"
    :blurb "We've released a new library for Om that we use to optimize Precursor."
    :author "Daniel"
    :body


(PDB-5484) requires-paging?: unused, remove

Thanks to Stel Abrego for pointing it out.

--- src/puppetlabs/puppetdb/query/paging.clj
+++ src/puppetlabs/puppetdb/query/paging.clj
@@ -233,16 +233,6 @@
                     (string/join "', '" (map name columns)))))))
   paging-options)

-(defn requires-paging?
-  "Given a paging-options map, return true if the query requires paging and
-  false if it does not."
-  [{:keys [limit offset order_by include_total] :as paging-options}]
-  (not
-   (and
-    (every? nil? [limit offset])
-    ((some-fn nil? (every-pred coll? empty?)) order_by)
-    (not include_total))))
-
 (defn dealias-order-by
   [{:keys [projections] :as _query-rec} paging-options]
   (let [alias-map (->> projections


adding http client

adding http client

--- src/update_repo_clj/lib.clj
+++ src/update_repo_clj/lib.clj
@@ -3,7 +3,8 @@
             [clojure.java.shell :as shell]
             [taoensso.timbre :as timbre
               :refer (log  trace  debug  info  warn  error  fatal get-env log-env)]
-            [taoensso.timbre.appenders.core :as appenders])
+            [taoensso.timbre.appenders.core :as appenders]
+            [org.httpkit.client :as http])
   (:use [selmer.parser]))

 (defn with-abs-path [filename]
@@ -17,14 +18,12 @@

 (def index (render-file "index.html" {}))

-
 (defn handle-errors [error]
   (timbre/error (str error))
   {:status 400,
    :headers {"Content-Type" "text/html"},
    :body (render-file "error.html" {})
   })
-

 (defn handle-success [res]
   (info (str res))
@@ -33,12 +32,10 @@
    :body (render-file "success.html" {:result (str res)})
   })

-
 (def script
   (let [r (with-abs-path script-file-name)]
     (info (str "Using script: " r))
     r))
-

 (defn call-script []
   (try
@@ -49,6 +46,5 @@
   (catch java.io.IOException e
     (handle-errors e))))

-
 (defn loginfo [text]
   (info text))


fixes failures in test-find-invokes

fixes failures in test-find-invokes

- works around weird #' problem

--- src/refactor_nrepl/refactor.clj
+++ src/refactor_nrepl/refactor.clj
@@ -18,7 +18,7 @@

 (defn- field-or-class [alias-info ast]
   (let [fn-node (:fn ast)
-        class (or (:class fn-node) (-> fn-node :var str (str/replace "#'clojure.core/" "")))
+        class (or (:class fn-node) (-> fn-node :var str (str/replace "#'" "") (str/replace "clojure.core/" "")))
         full-class (get alias-info class class)]
     (join "/" (remove nil? [full-class (:field fn-node)]))))


fix exercise compilation error

fix exercise compilation error

--- src/regarde/models/exercise.clj
+++ src/regarde/models/exercise.clj
@@ -1,5 +1,6 @@
 (ns regarde.models.exercise
-  (:require [korma.core :as sql]))
+  (:require [korma.core :as sql]
+            [regarde.models.rating]))

 (sql/defentity exercises)


Fixed audio copy

Fixed audio copy

--- src/video_server/ffmpeg.clj
+++ src/video_server/ffmpeg.clj
@@ -116,9 +116,10 @@

 (defn audio-to-encode
   "Returns the best audio stream to use for the target codec."
-  [audio-streams]
+  [audio-streams codec]
   (let [audio (reverse (sort-by #(parse-long (:bit_rate %)) audio-streams))]
-    (or (first (filter #(= (-> % :disposition :default) 1) audio))
+    (or (first (filter #(= (-> % :codec_name) codec) audio))
+        (first (filter #(= (-> % :disposition :default) 1) audio))
         (first audio))))

 (defn audio-codec-options
@@ -138,7 +139,7 @@
   "Returns the ffmpeg options for encoding / copying the aac audio
   stream."
   [audio-streams index codec]
-  (let [audio (audio-to-encode audio-streams)
+  (let [audio (audio-to-encode audio-streams codec)
         exists (= (:codec_name audio) codec)]
     (conj ["-map" (str "0:" (:index audio))
            (str "-c:a:" index) (if exists "copy" codec)]
@@ -150,7 +151,7 @@
   streams."
   [{:keys [audio-streams]}]
   (into (audio-encoder-options audio-streams 0 "aac")
-        (when-let [audio (audio-to-encode audio-streams)]
+        (when-let [audio (audio-to-encode audio-streams "ac3")]
           (when (> (:channels audio) 2)
             (audio-encoder-options audio-streams 1 "ac3")))))


Swagger2 now updates methods in components as well. Extremly slow due to amount of api calls and searches

--- src/ardoq/swagger/swagger_v2.clj
+++ src/ardoq/swagger/swagger_v2.clj
@@ -6,6 +6,9 @@
             [clojure.string :as s]
             [clostache.parser :as tpl]
             [medley.core :refer [map-vals]]))
+
+(defn set-id-and-version [{id :_id version :_version} resource]
+  (assoc resource :_id id :_version version))

 (defn create-workspace [client model wsname {:keys [info] :as data}]
   ;; Creates a new workspace in the client.
@@ -73,17 +76,27 @@
        (let [type (doall (map (fn [[_ v]]
                                 (get-in v [:schema]))
                               response))
-             op (-> (api/map->Component {:name (str (:name parent) "/" (name method))
-                                         :description (common/generate-operation-description data models)
-                                         :rootWorkspace (str wid)
-                                         :model _id
-                                         :parent (:_id parent)
-                                         :method method
-                                         :typeId (api/type-id-by-name model "Operation")})
-                    (api/create client)
-                    (assoc :return-model type
-                           :input-models parameters
-                           :security security))]
+             op (or (some-> (common/find-existing-resource client (str (:name parent) "/" (name method)) #(api/map->Component {}) wid)
+                            (set-id-and-version (api/map->Component
+                                                 {:name (str (:name parent) "/" (name method))
+                                                  :description (common/generate-operation-description data models)
+                                                  :rootWorkspace (str wid)
+                                                  :model _id
+                                                  :parent (:_id parent)
+                                                  :method method
+                                                  :typeId (api/type-id-by-name model "Operation")}))
+                            (api/update client))
+                 (-> (api/map->Component {:name (str (:name parent) "/" (name method))
+                                          :description (common/generate-operation-description data models)
+                                          :rootWorkspace (str wid)
+                                          :model _id
+                                          :parent (:_id parent)
+                                          :method method
+                                          :typeId (api/type-id-by-name model "Operation")})
+                     (api/create client)
+                     (assoc :return-model type
+                            :input-models parameters
+                            :security security)))]
          (find-or-create-tag client tag wid op tags)
          op)))
    methods))
@@ -241,9 +254,6 @@
     (-> (create-param-model wid _id parameters description model)
         (common/save-models client))))

-(defn set-id-and-version [{id :_id version :_version} resource]
-  (assoc resource :_id id :_version version))
-
 (defn create-resource [client model {:keys [paths definitions] :as spec} defs params secur tags workspace]
   ;;Create a resource. Does so by setting first path resource then adding the operations to it. Requires a full swagger file as input and the workspace it is being created in
   (let [{:keys [_id description]} model
@@ -251,7 +261,7 @@
     (doseq [[path {:keys [parameters] :as methods}] paths]
       (let [parent (doall {:resource path
                            :parameters parameters
-                           :component (or (some-> (common/find-existing-resource client (name path) #(api/map->Component {}) (:_id workspace))
+                           :component (or (some-> (common/find-existing-resource client (name path) #(api/map->Component {}) wid)
                                                   (set-id-and-version (api/->Component path description (str wid) _id (api/type-id-by-name model "Resource") nil))
                                                   (api/update client))
                                        (-> (api/->Component path description (str wid) _id (api/type-id-by-name model "Resource") nil)


Clean up Item handler responses.

Clean up Item handler responses.

Use Ring utility methods for responses instead of hand-coded maps.

--- src/webdev/item/handler.clj
+++ src/webdev/item/handler.clj
@@ -1,34 +1,30 @@
 (ns webdev.item.handler
-  (:require [webdev.item.model :refer [create-item read-items update-item delete-item]]
+  (:require [ring.util.response :refer [response not-found redirect]]
+            [webdev.item.model :refer [create-item
+                                       read-items
+                                       update-item
+                                       delete-item]]
             [webdev.item.view :refer [items-page]]))

 (defn handle-index-items [req]
   (let [db (:webdev/db req)
         items (read-items db)]
-    {:status 200
-     :headers {}
-     :body (items-page items)}))
+    (response (items-page items))))

 (defn handle-create-item [req]
   (let [name (get-in req [:params "name"])
         description (get-in req [:params "description"])
-        db (:webdev/db req)
-        item-ide (create-item db name description)]
-    {:status 302
-     :headers {"Location" "/items"}
-     :body ""}))
+        db (:webdev/db req)]
+    (create-item db name description)
+    (redirect "/items")))

 (defn handle-delete-item [req]
   (let [db (:webdev/db req)
         item-id (java.util.UUID/fromString (:item-id (:route-params req)))
         exists? (delete-item db item-id)]
     (if exists?
-      {:status 302
-       :headers {"Location" "/items"}
-       :body ""}
-      {:status 404
-       :headers {}
-       :body "Item not found."})))
+      (redirect "/items")
+      (not-found "Item not found."))))

 (defn handle-update-item [req]
   (let [db (:webdev/db req)
@@ -36,9 +32,5 @@
         checked (get-in req [:params "checked"])
         exists? (update-item db item-id (= "true" checked))]
     (if exists?
-      {:status 302
-       :headers {"Location" "/items"}
-       :body ""}
-      {:status 404
-       :headers {}
-       :body "Item not found."})))
+      (redirect "/items")
+      (not-found "Item not found."))))


OAUTH temporary disabled - using view_index for demo

--- src/amindblowingworld/routes.clj
+++ src/amindblowingworld/routes.clj
@@ -134,13 +134,13 @@
     ]))

 (defroutes main-routes
-  (GET "/" request
-       (render-login-page request))
-  (GET "/authenticated" request
-       ;;(friend/authorize #{::user} (render-authenticated-page request))
-       (render-authenticated-page request)
-       )
-  (GET "/world" [] (index-page))
+;auth;  (GET "/" request
+;auth;       (render-login-page request))
+;auth;  (GET "/authenticated" request
+;auth;       ;;(friend/authorize #{::user} (render-authenticated-page request))
+;auth;      (render-authenticated-page request)
+;auth;       )
+  (GET "/" [] (index-page))
   (GET "/map.png" [] (response-biome-map))
   (GET ["/history/since/:event-id", :event-id #"[0-9]+"] [event-id] (history-since (read-string event-id)))
   (GET "/rest/add-user/:name"  [name] (add-user-request name))
@@ -150,7 +150,7 @@
   (GET "/rest/tribes"      [] (tribes-request))
   (GET ["/rest/tribe/:id/settlements", :id #"[0-9]+"]   [id] (tribe-settlements-request (read-string id)))
   (GET ["/useractions/disaster/:x/:y/:name", :x #"[0-9]+", :y #"[0-9]+"] [x y name] (disaster-request (read-string x) (read-string y) name))
-  (friend/logout (ANY "/logout" request (ring.util.response/redirect "/")))
+;auth;  (friend/logout (ANY "/logout" request (ring.util.response/redirect "/")))
   (route/resources "/")
   (route/not-found "Page not found"))


Use kube annotations over labels for node tags

--- src/clj/shale/node_providers.clj
+++ src/clj/shale/node_providers.clj
@@ -102,14 +102,14 @@
     (str "http://" (-> pod :status :podIP) ":" port-num "/wd/hub")))

 (defn provided-node-from-pod
-  "Get a `ProvidedNode` from pod info returned from the kube API. A label with
-  the key `shale/node-tags` can optionally provide node tags in a
+  "Get a `ProvidedNode` from pod info returned from the kube API. An annotation
+  with the key `shale/node-tags` can optionally provide node tags in a
   semicolon-delimited list."
   [pod port-name]
   (let [url (selenium-url-from-pod pod port-name)
         tags (-> pod
                  :metadata
-                 :labels
+                 :annotations
                  (:shale/node-tags "")
                  (clojure.string/split #";")
                  (->> (into #{})))]


refresh the namespace context

refresh the namespace context

--- src/clj_money/import/gnucash.clj
+++ src/clj_money/import/gnucash.clj
@@ -242,10 +242,11 @@

 (defn- node->transaction
   [node]
-  (-> node
-      (node->model transaction-attributes)
-      (assoc :items (->> ($x "trn:splits/trn:split" node)
-                         (map node->transaction-item)))))
+  (with-namespace-context namespace-map
+    (-> node
+        (node->model transaction-attributes)
+        (assoc :items (->> ($x "trn:splits/trn:split" node)
+                           (map node->transaction-item))))))

 (defn- append-trading-attributes
   [transaction node]


Refresh movement works through ajax.

Refresh movement works through ajax.

--- src/cljs/movement/generator.cljs
+++ src/cljs/movement/generator.cljs
@@ -29,43 +29,44 @@
         idx))
     coll))

-(defn async-add-movement [part-title]
-  (go
-    (let [movements (atom [])
-          parts (session/get-in [:movement-session :parts])
-          position-in-parts (first (positions #{part-title} (map :title parts)))
-          categories (:categories (first (filter #(= part-title (:title %)) parts)))
-          categories-prepped (mapv #(str/replace % " " "-") categories)]
-      (doseq [c categories-prepped]
-        (swap! movements conj (first (read-string (<! (GET (str "singlemovement/" c)))))))
-      (session/update-in! [:movement-session :parts position-in-parts :movements]
-                          conj (first (shuffle @movements))))))
-
-(def p (atom []))
+(def p (atom nil))

 (defn add-movement-handler [movement]
-  (print (first movement))
   (session/update-in! [:movement-session :parts @p :movements]
                       conj (first movement)))
-
-(defn x [m]
-  (print m))
-
-(defn t [m]
-  (print m))

 (defn add-movement [part-title]
   (let [parts (session/get-in [:movement-session :parts])
         position-in-parts (first (positions #{part-title} (map :title parts)))
         categories (:categories (first (filter #(= part-title (:title %)) parts)))]
     (reset! p position-in-parts)
-    (print categories)
     (GET1 "singlemovement"
           {:params        {:categories categories}
            :format        :edn
            :handler       add-movement-handler
-           :error-handler #(print "error getting single movement.")})
+           :error-handler #(print "error getting single movement through add.")})
     ))
+
+(def ml (atom []))
+(def p-ml (atom nil))
+
+(defn refresh-movement-handler [movement]
+  (session/assoc-in! [:movement-session :parts @p :movements]
+                     (assoc @ml @p-ml (first movement))))
+
+(defn refresh-movement [m part-title]
+  (let [parts (session/get-in [:movement-session :parts])
+        position-in-parts (first (positions #{part-title} (map :title parts)))
+        ;todo: get categories from the movement, not the part.
+        categories (:categories (first (filter #(= part-title (:title %)) parts)))]
+    (reset! p position-in-parts)
+    (reset! ml (vec (session/get-in [:movement-session :parts @p :movements])))
+    (reset! p-ml (first (positions #{m} @ml)))
+    (GET1 "singlemovement"
+          {:params        {:categories categories}
+           :format        :edn
+           :handler       refresh-movement-handler
+           :error-handler #(print "error getting single movement through refresh.")})))

 (defn async-refresh-movement [m part-title]
   (go
@@ -88,29 +89,7 @@
         (session/assoc-in! [:movement-session :parts position-in-parts :movements]
                             movement-list)))))

-(def temp-movements (atom []))
-
-(defn refresh-movement [m part-title]
-  (let [parts (session/get-in [:movement-session :parts])
-        position-in-parts (first (positions #{part-title} (map :title parts)))
-
-        movement-list (vec (session/get-in [:movement-session :parts position-in-parts :movements]))
-
-        ;todo: get categories from the movement, not the part.
-        categories (:categories (first (filter #(= part-title (:title %)) parts)))
-        categories-prepped (mapv #(str/replace % " " "-") categories)]
-
-    (reset! temp-movements [])
-    (doseq [c categories-prepped]
-      (GET1 (str "singlemovement/" c)
-               {:handler       add-movement-handler
-                :error-handler (fn [] (print "error getting single movement."))}))
-
-    (let [position-in-movement-list (first (positions #{m} movement-list))
-          movement-list (assoc movement-list position-in-movement-list (first (shuffle @temp-movements)))]
-
-      (session/assoc-in! [:movement-session :parts position-in-parts :movements]
-                         movement-list))))
+

 (defn remove-movement [m part-title]
   (let [parts (session/get-in [:movement-session :parts])


Read data readers file from assets (see lein-droid 37da7bf)

--- src/clojure/neko/compilation.clj
+++ src/clojure/neko/compilation.clj
@@ -25,7 +25,7 @@
   {:author "Daniel Solano Gómez"}
   (:use [neko.resource :only [get-resource]])
   (:import android.content.Context
-           java.io.File))
+           [java.io File FileNotFoundException]))

 (def #^{:doc "Whether or not compilation has been initialized."
         :private true}
@@ -55,12 +55,13 @@
           (dorun))))))

 (defn get-data-readers [^Context context]
-  (->> (.. context (getResources)
-           (openRawResource (get-resource :raw :data-readers)))
-       slurp
-       read-string
-       (map (fn [[k v]] [k (resolve v)]))
-       (into {})))
+  (when-let [readers-file (try (.open (.getAssets context) "data_readers.clj")
+                               (catch FileNotFoundException e nil))]
+    (->> readers-file
+         slurp
+         read-string
+         (map (fn [[k v]] [k (resolve v)]))
+         (into {}))))

 (defn init
   "Initializes the compilation path, creating or cleaning cache directory as


Updated/added code comments.

Updated/added code comments.

--- src/cmr/opendap/ous/variable.clj
+++ src/cmr/opendap/ous/variable.clj
@@ -79,6 +79,10 @@
   (- y-dim
      (int (Math/floor (+ (/ y-dim 2) in)))))

+;; The following longitudinal phase shift functions are translated from the
+;; OUS Node.js prototype. It would be nice to use the more general functions
+;; above, if those work out.
+
 (defn lon-lo-phase-shift
   [x-dim lon-lo]
   (-> (/ (* (- x-dim 1)
@@ -127,6 +131,9 @@
           (- default-lat-hi default-lat-lo))
        Math/ceil
        int))
+
+;; The following latitudinal phase shift functions are what is currently being
+;; used.

 (defn lat-lo-phase-shift
   [y-dim lat-lo]


Better docs on union path

Better docs on union path

--- src/com/wsscode/pathom/core.cljc
+++ src/com/wsscode/pathom/core.cljc
@@ -81,7 +81,7 @@
      :as env}]
    (let [entity (entity env)
          query (if (union-children? ast)
-                 (let [_ (assert union-path "You need to set pathom/union-path to handle union queries.")
+                 (let [_ (assert union-path "You need to set :com.wsscode.pathom.core/union-path to handle union queries.")
                        path (union-path entity)]
                    (or (get query path) (throw (ex-info "No query for union path" {:union-path path
                                                                                :path (::path env)}))))


handle error from infura

handle error from infura

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

--- src/status_im/ethereum/ens.cljs
+++ src/status_im/ethereum/ens.cljs
@@ -42,6 +42,7 @@
     :method "resolver(bytes32)"
     :params [(namehash ens-name)]
     :outputs ["address"]
+    :on-error #(cb "0x")
     :on-success
     (fn [[address]]
       (cb (when-not (= address default-address) address)))}))
@@ -53,6 +54,7 @@
     :method "owner(bytes32)"
     :params [(namehash ens-name)]
     :outputs ["address"]
+    :on-error #(cb "0x")
     :on-success
     (fn [[address]]
       (cb address))}))
@@ -80,6 +82,7 @@
     :method "addr(bytes32)"
     :params [(namehash ens-name)]
     :outputs ["address"]
+    :on-error #(cb "0x")
     :on-success
     (fn [[address]]
       (cb address))}))
@@ -95,6 +98,7 @@
     :method "name(bytes32)"
     :params [(namehash ens-name)]
     :outputs ["string"]
+    :on-error #(cb "0x")
     :on-success
     (fn [[name]]
       (cb name))}))
@@ -123,6 +127,7 @@
    {:contract resolver
     :method "contenthash(bytes32)"
     :params [(namehash ens-name)]
+    :on-error #(cb "0x")
     :on-success
     (fn [raw-hash]
       ;; NOTE: it would be better if our abi-spec/decode was able to do that
@@ -172,7 +177,10 @@
     :on-success
     (fn [[x y]]
       (let [public-key (uncompressed-public-key x y)]
-        (cb public-key)))}))
+        (cb public-key)))
+    ;;at some point infura started to return execution reverted error instead of "0x" result
+    ;;our code expects "0x" result
+    :on-error #(cb "0x")}))

 (defn get-addr
   [registry ens-name cb]


Relax constraint on filters

Relax constraint on filters

Before we checked filters are exactly the same as the chats.
If there's any state mismatch, this will result in not fetching messages
from the mailserver.
This might not be necessarily what we want, we probably want to be
resilient to this case.

Signed-off-by: Andrea Maria Piana <39e16ece3c2d27e1889178b15ddb376e524032f8@gmail.com>

--- src/status_im/transport/db.cljs
+++ src/status_im/transport/db.cljs
@@ -2,6 +2,7 @@
  status-im.transport.db
   (:require [cljs.spec.alpha :as spec]
             [clojure.string :as s]
+            [clojure.set :as sets]
             status-im.contact.db
             [status-im.utils.config :as config]
             [status-im.utils.clocks :as utils.clocks]
@@ -132,4 +133,4 @@
                                              chat-id)
                                         topic))
                                     (get db :transport/chats))))]
-    (= chats filters)))
+    (empty? (sets/difference chats filters))))


perform all logging IO through a single agent to ensure the correct behavior in cases of transaction retries and multithreaded writes

--- src/subrosa/plugins/logging.clj
+++ src/subrosa/plugins/logging.clj
@@ -5,6 +5,8 @@
   (:import [java.util Date]
            [java.text SimpleDateFormat]
            [java.io File FileWriter]))
+
+(def io-agent (agent nil))

 (def time-formatter (SimpleDateFormat. "HH:mm:ss"))
 (def date-formatter (SimpleDateFormat. "yyyy-MM-dd"))
@@ -22,9 +24,12 @@
     (str log-dir "/" room-name "_" (format-date) ".log")))

 (defn append [room-name msg]
-  (with-open [out (FileWriter. (get-log-name room-name) true)]
-    (.write out (.toCharArray
-                 (str (format-time) " " msg "\n")))))
+  (send io-agent
+        (fn [_]
+          (io!
+           (with-open [out (FileWriter. (get-log-name room-name) true)]
+             (.write out (.toCharArray
+                          (str (format-time) " " msg "\n"))))))))

 (defmulti log-dispatch (fn [& args] (first args)))


fix small bug with o and au matras

fix small bug with o and au matras


Add click handler when choosing an attitude

--- src/discuss/references/main.cljs
+++ src/discuss/references/main.cljs
@@ -14,7 +14,7 @@
 (defn reference-usage-handler
   "Handler to process information about the reference. Store results and change view."
   [response]
-  (let [res (com/success-handler response)]
+  (let [res (com/process-response response)]
     (lib/update-state-item! :common :reference-usages (fn [_] res))
     (lib/change-view! :reference-usages)))

@@ -62,8 +62,7 @@
   [data _owner]
   (reify om/IRender
     (render [_]
-      (let [reference (:reference data)
-            issue (:issue data)
+      (let [issue (:issue data)
             statement (:statement data)
             author (:author data)]
         (dom/div #js {:className "bs-callout bs-callout-info"}
@@ -88,6 +87,21 @@
                           (apply dom/div nil
                                  (map #(om/build usage-view (lib/merge-react-key %)) usages))))))))

+(defn get-statement-handler
+  ""
+  [response]
+  (let [res (com/process-response response)]
+    (com/ajax-get-and-change-view (:url res) :default)))
+
+(defn get-statement-url
+  "Given an issue-id, statement-id and attitude, query statement url inside the discussion."
+  [statement agree]
+  (let [issue-id (get-in statement [:issue :uid])
+        statement-id (get-in statement [:statement :uid])
+        pre-url (get-in config/api [:get :statement-url])
+        url (clojure.string/join "/" [pre-url issue-id statement-id agree])]
+    (com/ajax-get url {} get-statement-handler)))
+
 (defn agree-disagree-view
   "Agree or disagree with the selected reference."
   []
@@ -99,10 +113,10 @@
                           "Do you agree or disagree with this statement?")
                  (om/build usage-view statement)
                  (dom/div #js {:className "text-center"}
-                          (bs/button-primary #(rlib/supportive? true)
+                          (bs/button-primary #(get-statement-url statement true)
                                              (vlib/fa-icon "fa-thumbs-up")
                                              " Agree")
                           " "
-                          (bs/button-primary #(rlib/supportive? false)
+                          (bs/button-primary #(get-statement-url statement false)
                                              (vlib/fa-icon "fa-thumbs-down")
                                              " Disagree")))))))


Use formatstring instead of str

Use formatstring instead of str

--- src/discuss/references/main.cljs
+++ src/discuss/references/main.cljs
@@ -36,8 +36,8 @@
 (defn query-reference-details
   "Show usages of the provided reference."
   [reference]
-  (let [url (str (get-in config/api [:get :reference-usages]) "/" (:id reference))]
-    (log/info "Requesting information for reference with id" (:id reference))
+  (let [url (format "%s/%d" (get-in config/api [:get :reference-usages]) (:id reference))]
+    (log/info "Requesting information for reference with id %d" (:id reference))
     (comlib/ajax-get url nil reference-usage-handler)))

 (s/fdef query-reference-details


Extend IInspect onto cljs.core.UUID

Extend IInspect onto cljs.core.UUID

--- src/ankha/core.cljs
+++ src/ankha/core.cljs
@@ -297,6 +297,9 @@
   Range
   (-inspect [this] (coll-view this "(" ")" "seq range"))

+  UUID
+  (-inspect [this] (literal "uuid" this))
+
   om/IndexedCursor
   (-inspect [this]
     (coll-view this "[" "]" "vector indexed-cursor"))


Revert ":onyx/id -> onyx/tenancy-id"

Revert ":onyx/id -> onyx/tenancy-id"

This reverts commit 9bbb648b662752e24a0d1b921a829d9191f74a2b.

--- src/workshop/workshop_utils.clj
+++ src/workshop/workshop_utils.clj
@@ -45,12 +45,12 @@

 (defn load-peer-config [onyx-id]
   (assoc (-> "dev-peer-config.edn" resource slurp read-string)
-    :onyx/tenancy-id onyx-id
+    :onyx/id onyx-id
     :zookeeper/address zk-str))

 (defn load-env-config [onyx-id]
   (assoc (-> "env-config.edn" resource slurp read-string)
-    :onyx/tenancy-id onyx-id
+    :onyx/id onyx-id
     :zookeeper/address zk-str
     :zookeeper.server/port zk-port))


Prefix test handlers with prefix.

Prefix test handlers with prefix.

--- src/cbfg/fence.cljs
+++ src/cbfg/fence.cljs
@@ -73,12 +73,12 @@

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

-(defn add-two [actx x delay]
+(defn test-add-two [actx x delay]
   (ago test-add-two actx
        (<! (timeout delay))
        (+ x 2)))

-(defn range-to [actx s e delay]
+(defn test-range-to [actx s e delay]
   (let [c (achan actx)]
     (ago test-range-to actx
          (doseq [n (range s e)]
@@ -106,15 +106,15 @@
     gch))

 (defn test [actx]
-  (let [reqs [{:rq #(add-two % 1 200)}
-              {:rq #(add-two % 4 100)}
-              {:rq #(add-two % 10 50) :fence true}
-              {:rq #(range-to % 40 45 10) :fence true}
-              {:rq #(add-two % 9 400)}
-              {:rq #(add-two % 9 400)}
-              {:rq #(range-to % 0 2 100)}
-              {:rq #(range-to % 6 10 5) :fence true}
-              {:rq #(add-two % 30 100)}]]
+  (let [reqs [{:rq #(test-add-two % 1 200)}
+              {:rq #(test-add-two % 4 100)}
+              {:rq #(test-add-two % 10 50) :fence true}
+              {:rq #(test-range-to % 40 45 10) :fence true}
+              {:rq #(test-add-two % 9 400)}
+              {:rq #(test-add-two % 9 400)}
+              {:rq #(test-range-to % 0 2 100)}
+              {:rq #(test-range-to % 6 10 5) :fence true}
+              {:rq #(test-add-two % 30 100)}]]
     (ago test actx ; TODO - revisit timing wobbles.
          (map (fn [test] (cons (if (= (sort (nth test 1))
                                       (sort (nth test 2)))


paint-canvas! returns channel

paint-canvas! returns channel

--- src/cellf/core.cljs
+++ src/cellf/core.cljs
@@ -157,15 +157,16 @@
 (declare playback-ctx)

 (defn paint-canvas! [{:keys [moves grid-size]} tick]
-  (take! (@img-cache tick) (fn [img]
-    (let [s (/ capture-size grid-size)]
+  (go
+    (let [img (<! (@img-cache tick))
+          s   (/ capture-size grid-size)]
       (.clearRect playback-ctx 0 0 capture-size capture-size)
       (doseq [[idx pos] (:cells (moves tick))]
         (if-not (= idx :empty)
           (let [[x1 y1] (get-cell-xy idx grid-size)
                 [x2 y2] (get-cell-xy pos grid-size)]
             (.drawImage playback-ctx img (* x1 s) (* y1 s) s s (* x2 s) (* y2 s) s s))))
-      (.drawImage playback-ctx img 0 capture-size)))))
+      (.drawImage playback-ctx img 0 capture-size))))

 (defonce app-state (atom {}))

@@ -188,7 +189,7 @@
             move-count (count moves)
             tick       (if (>= tick move-count) 0 tick)]
         (swap! app-state assoc :tick tick)
-        (paint-canvas! app tick)
+        (<! (paint-canvas! app tick))
         (if (or (zero? move-count) (= tick (dec move-count)))
           (recur 0)
           (recur (inc tick)))))))


Extend completion and hint functionality.

--- src/cli4clj/cli.clj
+++ src/cli4clj/cli.clj
@@ -70,8 +70,13 @@
                  (.setPrompt prompt-string))
         arg-completers (reduce
                          (fn [v k]
-                           (conj v (ArgumentCompleter. [(StringsCompleter. (conj (vec (map name (cmd-aliases k))) (name k)))
-                                                        (StringsCompleter. [(str (get-in cmds [k :fn-args]))])])))
+                           (if (or (not (nil? (get-in cmds [k :fn-args])))
+                                   (not (nil? (get-in cmds [k :completion-hint]))))
+                             (conj v
+                                   (ArgumentCompleter.
+                                     [(StringsCompleter. (conj (vec (map name (cmd-aliases k))) (name k)))
+                                      (StringsCompleter. [(str "Arguments: " (get-in cmds [k :fn-args]) "\n")
+                                                          (str "Hint: " (get-in cmds [k :completion-hint]))])]))))
                          []
                          (keys cmd-aliases))
         _ (doseq [arg-compl arg-completers]


records obtained incorrectly

records obtained incorrectly

--- src/crawler/dom.clj
+++ src/crawler/dom.clj
@@ -234,25 +234,14 @@
        (xpath->records xpath
                        (html->xml-doc page-src))))

-(defn date-indexed-xpath?
-  "Checks if the xpath returns objects
-that are indexed by dates. This requires us to
-get to the LCA of the xpath's nodes and "
+(defn xpath-recods-dates
+  "An xpath returns nodes. We check how many of these
+result in nodes that are indexed by a clear date"
   [xpath page-src]
   (let [num-records      (count
                           (xpath->records
                            xpath
                            (html->xml-doc page-src)))
-
-        records          (first
-                          (map
-                           #(list
-                             (.getNodeName %)
-                             (.getNamedItem (.getAttributes %) "id")
-                             (.getNamedItem (.getAttributes %) "class"))
-                           (xpath->records
-                            xpath
-                            (html->xml-doc page-src))))

         dategroups-found (count
                           (filter
@@ -262,17 +251,22 @@
                             page-src)))]
     (when-not (= num-records 0)
       {:ratio (/ dategroups-found num-records)
-       :num-records num-records
-       :records records})))
+       :num-records num-records})))

 (defn xpaths-ranked
   [page-src]
   (let [xpaths (:xpaths (minimum-maximal-xpath-set page-src))]
     (filter
-     #(> (:ratio (second %)) 0)
+     #(= (:ratio (second %)) 1)
      (filter
       #(identity (second %))
-      (map (fn [xpath] (list
-                        xpath
-                        (date-indexed-xpath? xpath page-src)))
+      (map (fn [xpath]
+             (list
+              xpath
+              (xpath-recods-dates xpath page-src)))
            xpaths)))))
+
+(defn equal-xpaths?
+  "Xpaths are equal either if the strings are the same
+or the returned records/nodes in the page are the same"
+  [xpath1 xpath2])


fn to scheduler digest jobs

fn to scheduler digest jobs

--- src/chat/server/email_digest.clj
+++ src/chat/server/email_digest.clj
@@ -1,7 +1,8 @@
 (ns chat.server.email-digest
   (:require [clojurewerkz.quartzite
              [triggers :as t]
-             [jobs :as j :refer [defjob]]]
+             [jobs :as j :refer [defjob]]
+             [scheduler :as qs]]
             [clojurewerkz.quartzite.schedule.cron :as cron]
             [clj-time
              [core :as time]
@@ -28,6 +29,10 @@

 (defn daily-update-users
   "Find all users that want daily digest updates"
+  [])
+
+(defn weekly-update-users
+  "Find all users that want weekly digest updates"
   [])

 ; sending
@@ -83,3 +88,9 @@
     (t/with-schedule
       (cron/schedule
         (cron/weekly-on-day-and-hour-and-minute 0 2 30)))))
+
+(defn add-jobs
+  [scheduler]
+  (-> scheduler
+      (qs/schedule (daily-digest-job) (daily-digest-trigger))
+      (qs/schedule (weekly-digest-job) (weekly-digest-trigger))))


Log more details

Log more details

--- src/clj/hyphen_keeper/export.clj
+++ src/clj/hyphen_keeper/export.clj
@@ -63,13 +63,13 @@
   ;; i.e. the first one is very small compared to the second one, we
   ;; end up waiting the same time.
   (doseq [[spelling [white-list dictionary original]] dictionaries]
-    (log/info "Writing the white-list")
     (->
      spelling
      get-hyphenations
      (write-file white-list original))
-    (log/info "Running substrings.pl")
-    (sh substrings-program white-list dictionary)))
+    (log/infof "Wrote the white-list %s" white-list)
+    (sh substrings-program white-list dictionary)
+    (log/infof "Ran substrings.pl on %s producing %s" white-list dictionary)))

 (defn- exporter
   "Create a channel and attach a listener to it so that events can be


updated

updated

--- src/cljs/dbquery/data_table.cljs
+++ src/cljs/dbquery/data_table.cljs
@@ -47,7 +47,7 @@
   (sql-distinct [this col]
     (sql/sql-select [(str "distinct " col)] @tables @conditions [] []))
   (sql-count [_]
-    (sql/sql-select ["count(*)"] @tables @conditions)))
+    (sql/sql-select ["count(*)"] @tables @conditions [] [])))

 (defn query-from-sql [raw-sql]
   (SqlQuery. (atom ["*"]) (atom [(str "(" raw-sql ")")]) (atom {}) (atom []) (atom [])))
@@ -83,7 +83,9 @@

   (filter [this col condition]
     (.condition! query col condition)
-    (.refresh this)))
+    (.refresh this))
+  (column-values [this col data-fn error-fn]
+    (.execute this (.sql-distinct query col data-fn error-fn))))

 (defn filter-box [col controller]
   (let[condition (atom (-> controller .-query (.condition col) (or {})))]
@@ -105,19 +107,21 @@
          "OK"]]])))

 (defn column-toolbar [show? i col sort-control controller]
-  (let[filter-on? (atom false)]
+  (let[active-box (atom nil)]
     (fn[show? i col sort-control controller]
       (if @show?
         [:div.my-popover
          [c/button-group {:bsSize "xsmall"}
-          [c/button {:on-click #(swap! filter-on? not)} [:i.fa.fa-filter]]
+          [c/button {:on-click #(swap! active-box case :filter nil :filter)} [:i.fa.fa-filter]]
+          [c/button {:on-click #(swap! active-box case :distinct nil :distinct) :title "Distinct Values"} [:i.fa.fa-list-alt]]
           [c/button [:i.fa.fa-minus]]
           [c/button [:i.fa.fa-plus]]
-          [c/button {:on-click #(.set-sort sort-control i "up") :ttile "Sort Asc"} [:i.fa.fa-sort-up]]
+          [c/button {:on-click #(.set-sort sort-control i "up") :title "Sort Asc"} [:i.fa.fa-sort-up]]
           [c/button {:on-click #(.set-sort sort-control i "down") :title "Sort Desc"} [:i.fa.fa-sort-down]]
           [c/button {:on-click #(.set-sort sort-control i nil) :title "No Sort"} [:i.fa.fa-sort]]]
-         (if @filter-on?
-           [filter-box col controller])]))))
+         (case @active-box
+           :filter [filter-box col controller]
+           :distinct [dist-values col controller])]))))

 (defn scroll-bottom? [e]
   (let [elem (.-target e)


refactor tags

refactor tags

--- src/cljs/salava/core/ui/tag.cljs
+++ src/cljs/salava/core/ui/tag.cljs
@@ -1,8 +1,27 @@
 (ns salava.core.ui.tag
   (:require [clojure.string :refer [trim lower-case]]
             [salava.core.i18n :refer [t]]
-            [salava.core.ui.helper :refer [plugin-fun]]
-            [reagent.session :as session]))
+            [salava.core.ui.helper :refer [plugin-fun path-for]]
+            [reagent.session :as session]
+            [reagent.core :refer [cursor atom]]
+            [salava.core.ui.ajax-utils :as ajax]
+            ))
+
+(defn update-settings [badge-id state]
+  (ajax/GET
+    (path-for (str "/obpv1/badge/settings/" badge-id) true)
+    {:handler (fn [data]
+                (swap! state assoc :badge-settings data (assoc data :new-tag "")))}))
+
+(defn save-settings [state]
+  (let [{:keys [id visibility tags rating]} @(cursor state [:badge-settings])]
+    (ajax/POST
+      (path-for (str "/obpv1/badge/save_settings/" id))
+      {:params  {:visibility   visibility
+                 :tags         tags
+                 :rating       (if (pos? rating) rating nil)}
+       :handler (fn []
+                  (update-settings id state))})))

 (defn add-tag
   ([tags-atom new-tag-atom]
@@ -13,12 +32,11 @@
                 (not tag-exists?))
        (reset! tags-atom (conj (vec @tags-atom) new-tag))
        (reset! new-tag-atom ""))))
-  ([tags-atom new-tag-atom state reload-fn]
-   (let [save-settings (first (plugin-fun (session/get :plugins) "settings" "save_settings"))]
-     (do
-       (add-tag tags-atom new-tag-atom)
-       (save-settings state reload-fn "share")
-       ))))
+  ([tags-atom new-tag-atom state]
+   (do
+     (add-tag tags-atom new-tag-atom)
+     (save-settings state)
+     )))

 (defn remove-tag [tags-atom tag-value]
   (reset! tags-atom (remove #(= % tag-value) @tags-atom)))
@@ -42,7 +60,7 @@
             :value       @new-tag-atom
             :on-change   #(reset! new-tag-atom (-> % .-target .-value))
             :on-key-down #(if (= (.-which %) 13)
-                            (add-tag tags-atom new-tag-atom state reload-fn))}]))
+                            (add-tag tags-atom new-tag-atom state))}]))

 (defn tags
   ([tags-atom] (tags tags-atom true))
@@ -56,14 +74,13 @@
                    :dangerouslySetInnerHTML {:__html "×"}
                    :on-click #(remove-tag tags-atom tag)}])])))
   ([tags-atom state reload-fn]
-   (let [save-settings (first (plugin-fun (session/get :plugins) "settings" "save_settings"))]
-     (into [:div.tag-labels]
-           (for [tag @tags-atom]
-             [:span {:class "label label-default"}
-              tag
-              [:a {:class "remove-tag"
-                   :dangerouslySetInnerHTML {:__html "×"}
-                   :on-click #(do
-                                (.preventDefault %)
-                                (remove-tag tags-atom tag)
-                                (save-settings state reload-fn "share"))}]])))))
+   (into [:div.tag-labels]
+         (for [tag @tags-atom]
+           [:span {:class "label label-default"}
+            tag
+            [:a {:class "remove-tag"
+                 :dangerouslySetInnerHTML {:__html "×"}
+                 :on-click #(do
+                              (.preventDefault %)
+                              (remove-tag tags-atom tag)
+                              (save-settings state))}]]))))


Skip suffix check in completions for degenerate cases

This patch handles the case when a line starts with (, ends with / or is
straight up empty.

--- src/cljs/snapshot/lumo/repl.cljs
+++ src/cljs/snapshot/lumo/repl.cljs
@@ -1442,15 +1442,16 @@
   (if-some [js-matches (re-find #"js/(\S*)$" line)]
     (js/$$LUMO_GLOBALS.getJSCompletions line (second js-matches) cb)
     (let [top-level? (boolean (re-find #"^\s*\(\s*[^()\s]*$" line))
+          skip-suffix-check? (or (= "(" line) (string/ends-with? line "/") (empty? line))
           ns-alias (second (re-find #"\(*(\b[a-zA-Z-.<>*=&?]+)/[a-zA-Z-]*$" line))
           line-match-suffix (first (re-find #":?([a-zA-Z-.<>*=&?]*|^\(/)$" line))
           line-prefix (subs line 0 (- (count line) (count line-match-suffix)))
-          completions (if (empty? line-match-suffix)
-                        #js []
-                       (reduce (fn [ret item]
-                                  (doto ret
-                                    (.push (str line-prefix item))))
-                                #js []
+          completions (reduce (fn [ret item]
+                                (doto ret
+                                  (.push (str line-prefix item))))
+                              #js []
+                              (if skip-suffix-check?
+                                (completion-candidates top-level? ns-alias)
                                 (filter #(is-completion? line-match-suffix %)
                                         (completion-candidates top-level? ns-alias))))]
       (cb (doto completions


Add email confirm

Add email confirm

--- src/cljs/whatishistory/core.cljs
+++ src/cljs/whatishistory/core.cljs
@@ -118,6 +118,9 @@
 ;; -------------------------
 ;; Components

+(defn email-confirmed [v1 v2]
+  (and (not (nil? v1)) (= v1 v2)))
+
 (defn defn-form-content [app-atom]
   [:form {:class "defnForm"}
    [:div {:class "fieldsWrap"}
@@ -135,8 +138,13 @@
                           (swap! app-atom assoc :email evt.target.value))}]
     [:input {:type "email"
              :class "emailConfirm"
-             :placeholder "Enter Your Email"}]
-    [:span {:class "emailIsConfirmed no"}]
+             :placeholder "Enter Your Email"
+             :on-change (fn [evt]
+                          (swap! app-atom assoc :email-confirm evt.target.value))}]
+    [:span {:class "emailConfirm"}
+     (if (email-confirmed (get @app-atom :email) (get @app-atom :email-confirm))
+       [:span {:class "check"} "\u2714"]
+       [:span {:class "x-mark"} "\u2718"])]
     [:textarea {:class "defnInput twelve columns"
                 :placeholder "Please compose your definition here..."
                 :on-change (fn [evt]


wrap-mutate-handle-exception is losing mutation responses

--- src/com/wsscode/pathom/core.cljc
+++ src/com/wsscode/pathom/core.cljc
@@ -539,7 +539,8 @@
                       (<? res)
                       (catch #?(:clj Throwable :cljs :default) e
                         (if process-error (process-error env e)
-                                          {::reader-error (error-str e)}))))))
+                                          {::reader-error (error-str e)}))))
+                  res))
               (catch #?(:clj Throwable :cljs :default) e
                 (if process-error (process-error env e)
                                   {::reader-error (error-str e)})))))))))


Prototype alternate conversions; generate-pair

--- src/test_utils/fracture_diagnostics.cljc
+++ src/test_utils/fracture_diagnostics.cljc
@@ -42,6 +42,12 @@
 (def rand-slurry-rate-unit (rand-unit :slurry-rate))
 (def rand-temperature-unit (rand-unit :temperature))
 (def rand-volume-unit (rand-unit :volume))
+
+(defn force-as [[magnitude from] to]
+  (let [factor 4.44822]
+    (condp = [from to]
+      [:lbf :N] [(* magnitude factor) to]
+      [:N :lbf] [(/ magnitude factor) to])))

 (defn convert-units-f [from to]
   (let [factors   {[:lb-per-cu-ft :kg-per-m3] 16.0185
@@ -631,3 +637,8 @@
                                     :F temperature-f-surface
                                     :C ((convert-units-f :F :C) temperature-f-surface)))]
      [temperature-value temperature-unit measured-at])))
+
+(defn generate-pair [units generate-units-f generate-measurement-f measurement-as-f]
+  (let [unit        (generate-units-f)
+        measurement (generate-measurement-f unit)]
+    [measurement (measurement-as-f measurement (first (remove (partial = unit) units)))]))


disable filtering by timestamp

disable filtering by timestamp

--- src/deltalog/mr.clj
+++ src/deltalog/mr.clj
@@ -31,8 +31,8 @@

         splitter-pipe (Each. "json_split" (make-splitter json-paths))
         tail-pipe (-> splitter-pipe
-                      (Each. (make-fields ["timestamp"])
-                             (ExpressionFilter. "timestamp >= 1393542318" Long/TYPE))
+                      ;(Each. (make-fields ["timestamp"])
+                      ;       (ExpressionFilter. "timestamp >= 1393542318" Long/TYPE))
                       (GroupBy. (make-fields ["id"])
                                 (make-fields ["timestamp"]))
                       (Every. Fields/ALL (Last.) Fields/RESULTS))


level-up wip

level-up wip

--- src/goodbot/plugins/level_up.clj
+++ src/goodbot/plugins/level_up.clj
@@ -12,14 +12,14 @@
               :where [_ :level-up/skills ?s]]))
   (println prev-skills)
   (println "::::::::::::: retracting skills")
-  (comment db/transact irc '[":db/retract" [":level-up/skills"]])
+  (db/transact irc '[":db/retract" [":level-up/skills"]])

   (def skills (concat (bot/get-plugin-commands irc) (:tasks @irc)))
   (println "::::::::::::: adding skills")
   (println "::::: " skills)

   (println ":::::: building query")
-  (def add-query (map #((println "map " %){:db/id #db/id[:db.part/level-up] :level-up/skills %}) skills))
+  (def add-query (mapv (fn [skill] {:db/id #db/id[:db.part/level-up] :level-up/skills skill}) skills))

   (println ":::::: query " add-query)
   (println "========================")


Remove commented out section that should've been removed ages ago

--- src/grafter_2/rdf/protocols.cljc
+++ src/grafter_2/rdf/protocols.cljc
@@ -576,32 +576,3 @@

      ([target graph triples batch-size]
       (apply-batched target (fn [repo batch] (delete repo graph batch)) triples batch-size))))
-
-
-;; TODO TOOD TODO
-
-#_(defn ^:no-doc statements
-    "Attempts to coerce an arbitrary source of RDF statements into a
-    sequence of grafter Statements.
-
-    If the source is a quad store quads from all the named graphs will
-    be returned.  Any triples in an unnamed graph will be ignored.
-
-    Takes optional parameters which may be used depending on the
-    context e.g. specifiying the format of the source triples.
-
-    The `:format` option is supplied by the wrapping function and may be
-    nil, or act as an indicator about the format of the triples to read.
-    Implementers can choose whether or not to ignore or require the
-    format parameter.
-
-    The `:buffer-size` option can be used to configure the buffer size
-    at which statements are parsed from an RDF stream.  Its default
-    value of 32 was found to work well in practice, and also aligns with
-    chunk size of Clojure's lazy sequences.
-
-    The `:base-uri` option can be supplied to automatically re`@base`
-    URI's on a new prefix when reading."
-    [this & {:keys [format buffer-size base-uri] :as options}]
-    (throw (ex-info "Moved function definition.  Please use grafter-2.rdf4j/statements instead" {}))
-    #_(to-statements this options))


Refactor parser

Refactor parser

- Changed the parser to use zippers for cleaner parsing and whitespace
  preservation
- Updated the interface for zipper changes too

--- src/greenyouse/chenex/parser.clj
+++ src/greenyouse/chenex/parser.clj
@@ -1,9 +1,11 @@
 (ns greenyouse.chenex.parser
   (:require [clojure.java.io :as io]
-            [clojure.string :as s]))
+            [rewrite-clj.zip :as z]))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Transforms
+
+;; TODO: do a general cleanup here later

 ;; TODO: could optimize transforms a little bit
 (defn- do-transforms
@@ -72,60 +74,40 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Parser

-(declare parse-nodes)
+(def ^:private chenex-macros
+  #{'chenex/in! 'chenex/ex! 'chenex/in-case!})

-;; NOTE: must keep datatype intact, e.g. [] -> [], not to seq
-(defn node-filter [t coll]
-  (cond
-    (and (list? coll)
-      (re-find #"chenex" (str (first coll)))) (t coll)
-      (sequential? coll) (cond
-                           (empty? coll) coll
-                           (vector? coll) (into [] (parse-nodes t coll))
-                           :else
-                           (parse-nodes t coll))
-      (set? coll) (into #{} (map #(node-filter t %) coll))
-      (map? coll)  (into {} (map #(into [] (parse-nodes t %)) coll))
-      :else
-      coll))
+(defn- chenex-macro?
+  "Returns true if the node is a chenex macro"
+  [loc]
+  (when (z/list? loc)
+    (let [op (-> loc z/down z/value)]
+      (boolean (chenex-macros op)))))

-(defn- parse-nodes
-  "Recursively searches the entire tree for matches using a depth-first
-  search. When a match is found, process fe, otherwise do nothing."
-  ([transform exprs] (trampoline (parse-nodes transform exprs nil)))
-  ([transform exprs acc]
-   (if (empty? exprs) (reverse acc)
-       #(parse-nodes transform (rest exprs)
-          (conj acc (node-filter transform (first exprs)))))))
+(defn- parse-nodes [xform forms]
+  (z/prewalk
+    (z/up forms) ; ensure all forms are walked
+    chenex-macro?
+    (fn [loc]
+      (let [parsed (-> loc z/sexpr xform)]
+        (if (nil? parsed)
+          (z/remove loc) ; filter nodes not in the feature expression set
+          (z/replace loc parsed))))))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Interface

-;; FIXME: `ns` will kill the parser if it's not in the first sexpr. Why?
-;; FIXME: handle errors without killing the process
 (defn- prep
-  "Helper fn that wraps code in a vector before passing it to parse-nodes."
-  [feature-set inner-transforms expr]
-  (let [t (fe-transform feature-set inner-transforms)
-        ;; must wrap expr in a sequence to return all the nodes
-        wrapped (->> expr str (str "[") s/reverse (str "]") s/reverse)
-        fe (binding [*default-data-reader-fn*
-                     (fn [tag arg]
-                       (symbol (str "#" tag " " arg)))]
-             (read-string wrapped))]
-    (parse-nodes t fe)))
+  "Helper fn that registers the transforms and calls the parser."
+  [feature-set inner-transforms forms]
+  (let [xform (fe-transform feature-set inner-transforms)]
+    (parse-nodes xform forms)))

-(defn- exit
-  "Helper fn to convert back to string and unwrap the code."
-  [fe]
-  (-> fe str (subs 1) s/reverse (subs 1) s/reverse))
-
-;; TODO: would be nice to filter out the nils and pretty print the output
 (defn start-parse [file-in file-out features inner-transforms]
   (let [in-p (->> file-in
-               slurp
-               (prep features inner-transforms)
-               exit)]
+                  z/of-file
+                  (prep features inner-transforms)
+                  z/root-string)]
     (do (io/make-parents file-out)
         (spit file-out in-p))))


Add db methods to fetch file by sea

Add db methods to fetch file by sea

--- src/extremo/db.cljs
+++ src/extremo/db.cljs
@@ -11,6 +11,17 @@
   (-> (.resolve path repo-path)
       (nodegit.Repository.open)
       (.catch #(js/console.error "Something went wrong opening repo: " %))))
+
+(defn get-entry-by-sha
+  "Returns a promised value for the entry specified by the sha."
+  [repo sha]
+  (-> repo
+      (.then #(.getMasterCommit %))
+      (.then #(.getTree %))
+      (.then #(.entries %))
+      (.then (fn [entries]
+               (filterv #(= (.sha %) sha) entries)))
+      (.then #(if (empty? %) nil (first %)))))

 (defn get-entry-by-path
   "Returns a promise for the entry specified by filepath in repo."
@@ -54,6 +65,11 @@
                                          :created_at (:date (last file-history))
                                          :history file-history)))))))

+(defn get-file-by-sha [sha]
+  (-> (open-repo)
+      (get-entry-by-sha sha)
+      (.then #(build-entry-data %))))
+
 (defn get-file-by-path [filepath]
   (let [rv (transient {})]
     (-> (open-repo)
@@ -76,5 +92,14 @@
 ;; (-> (get-all-files)
 ;;     (.then #(js/console.log %)))

-;; (-> (get-file-by-path "test2.md")
+;; (-> (get-file-by-path "test.md")
 ;;     (.then #(js/console.log (clj->js %))))
+
+;; (-> (get-file-by-sha "96a357d8e67de8d4f3992cf4255019bbcae6da08")
+;;     (.then #(js/console.log (clj->js %))))
+
+;; (-> (open-repo)
+;;     (get-entry-by-sha "96a357d8e67de8d4f3992cf4255019bbcae6da08")
+;;     (.then #(build-entry-data %))
+;;     (.then #(js/console.log (clj->js %)))
+;;     (.catch #(js/console.error %)))


name should contain underscore

name should contain underscore

--- src/crawler/structure-driven.clj
+++ src/crawler/structure-driven.clj
@@ -1,12 +0,0 @@
-(ns crawler.structure-driven
-  (:require [crawler.rich-char-extractor :as rc-extractor]
-            [crawler.similarity :as similarity]))
-
-(defn leaf?
-  [body example-leaf]
-  (let [sim (similarity/tree-edit-distance-html
-             body
-             example-leaf)]
-    (<= 0.8 sim)))
-
-(def extractor rc-extractor/state-action)


Change rook.async alias in dispatcher

Change rook.async alias in dispatcher

--- src/io/aviso/rook/dispatcher.clj
+++ src/io/aviso/rook/dispatcher.clj
@@ -3,7 +3,7 @@
             [clojure.string :as string]
             [clojure.pprint :as pp]
             [io.aviso.rook :as rook]
-            [io.aviso.rook.async :as async]
+            [io.aviso.rook.async :as rook-async]
             [io.aviso.rook.internals :as internals]
             [io.aviso.rook.schema-validation :as sv]))

@@ -125,7 +125,7 @@
 (defn apply-middleware-async [middleware sync? handler]
   (middleware
     (if sync?
-      (async/ring-handler->async-handler handler)
+      (rook-async/ring-handler->async-handler handler)
       handler)))

 (defn compile-dispatch-table


Make type-of-completion work with unbound Vars

--- src/de/kotka/vimclojure/util.clj
+++ src/de/kotka/vimclojure/util.clj
@@ -232,11 +232,14 @@
     (instance? clojure.lang.Namespace thing) "n"
     (class? thing)        "c"
     (:macro (meta thing)) "m"
-    :else                 (let [value (var-get thing)]
-                            (cond
-                              (instance? clojure.lang.MultiFn value) "f"
-                              (fn? value) "f"
-                              :else       "v"))))
+    :else                 (try
+                            (let [value (var-get thing)]
+                              (cond
+                                (instance? clojure.lang.MultiFn value) "f"
+                                (fn? value) "f"
+                                :else       "v"))
+                            (catch IllegalStateException _
+                              "v"))))

 (defn make-completion-item
   "Create a completion item for Vim's popup-menu."


Implement make-completion-item for static fields of classes

--HG--
branch : bleeding-edge

--- src/de/kotka/vimclojure/util.clj
+++ src/de/kotka/vimclojure/util.clj
@@ -235,8 +235,11 @@
 (defn- type-of-completion
   [thing]
   (cond
-    (instance? clojure.lang.Namespace thing) "n"
+    (instance? clojure.lang.Namespace thing)   "n"
+    (instance? java.lang.reflect.Field thing)  "S"
+    (instance? java.lang.reflect.Method thing) "M"
     (class? thing)        "c"
+    (coll? thing)         (recur (first thing))
     (:macro (meta thing)) "m"
     :else                 (try
                             (let [value (var-get thing)]
@@ -269,13 +272,31 @@
             "info" ""))

 (defmethod make-completion-item "M"
-  [the-name the-method]
-  (let [rtype    (-> the-method .getReturnType .getSimpleName str)
-        arglist  (.getParameterTypes the-method)
-        menu     (str-cat (concat arglist [rtype]) " -> ")
-        info     (str the-name " :: " menu)]
+  [the-name the-methods]
+  (let [nam      (name (read-string the-name))
+        rtypes   (map #(-> % .getReturnType .getSimpleName) the-methods)
+        arglists (map (fn [m]
+                        (let [types (.getParameterTypes m)]
+                          (vec (map #(.getSimpleName %) types))))
+                      the-methods)
+        info     (apply str "  " the-name \newline \newline
+                        (map #(str "  " %1 " " nam
+                                   (str-wrap (str-cat %2 ", ") \( \))
+                                   \; \newline)
+                             rtypes arglists))]
     (hash-map "word" the-name
               "kind" "M"
+              "menu" (print-str arglists)
+              "info" info)))
+
+(defmethod make-completion-item "S"
+  [the-name [the-field]]
+  (let [nam  (name (read-string the-name))
+        menu (-> the-field .getType .getSimpleName)
+        info (str "  " the-name \newline \newline
+                  "  " menu " " the-name \newline)]
+    (hash-map "word" the-name
+              "kind" "S"
               "menu" menu
               "info" info)))


Queue items are returned in the wrong order

--- src/emender_jenkins/rest_api.clj
+++ src/emender_jenkins/rest_api.clj
@@ -509,7 +509,7 @@
 (defn create-jobs-in-queue-response
     [items]
     (let [job-names       (map get-job-name-from-queue-info items) ; items are sorted properly!
-          queue-positions (range 1 (inc (count items)))]                 ; we need to have index assigned to each item in queue
+          queue-positions (range (count items) 0 -1)]              ; we need to have index assigned to each item in queue
           (for [[queue-position job-name] (zipmap queue-positions job-names)]
              {"queuePos" queue-position
               "jobName"  job-name})))


Remove unnecessary require

Remove unnecessary require

--- test/circle/backend/build/test_run_build.clj
+++ test/circle/backend/build/test_run_build.clj
@@ -3,7 +3,6 @@
   (:use [circle.backend.build.test-utils])
   (:use [circle.backend.action :only (defaction action)])
   (:require [circle.backend.action.nodes :as nodes])
-  (:require [circle.backend.build.config :as config])
   (:use [circle.model.build :only (build successful?)])
   (:use [circle.backend.build.run :only (run-build)])
   (:require [circle.model.project :as project])


add one more test

add one more test

--- test/clj/backtype/storm/integration_test.clj
+++ test/clj/backtype/storm/integration_test.clj
@@ -115,6 +115,11 @@
                     {"1" (thrift/mk-spout-spec (TestWordSpout. true) :parallelism-hint 3)}
                     {"2" (thrift/mk-bolt-spec {"1" ["non-exists-field"]} (TestWordCounter.) :parallelism-hint 4)}))

+(defn mk-invalidate-topology-3 []
+  (thrift/mk-topology
+                    {"1" (thrift/mk-spout-spec (TestWordSpout. true) :parallelism-hint 3)}
+                    {"2" (thrift/mk-bolt-spec {["1" "non-exists-stream"] ["word"]} (TestWordCounter.) :parallelism-hint 4)}))
+
 (defn try-complete-wc-topology [cluster topology]
   (try (do
          (complete-topology cluster
@@ -128,10 +133,12 @@
   (with-simulated-time-local-cluster [cluster :supervisors 4]
     (let [any-error1? (try-complete-wc-topology cluster (mk-validate-topology-1))
           any-error2? (try-complete-wc-topology cluster (mk-invalidate-topology-1))
-          any-error3? (try-complete-wc-topology cluster (mk-invalidate-topology-2))]
+          any-error3? (try-complete-wc-topology cluster (mk-invalidate-topology-2))
+          any-error4? (try-complete-wc-topology cluster (mk-invalidate-topology-3))]
       (is (= any-error1? false))
       (is (= any-error2? true))
-      (is (= any-error3? true)))))
+      (is (= any-error3? true))
+      (is (= any-error4? true)))))

 (defbolt identity-bolt ["num"]
   [tuple collector]


Add existence statements

Add existence statements

--- test/clojurewerkz/cassaforte/test_helper.clj
+++ test/clojurewerkz/cassaforte/test_helper.clj
@@ -6,9 +6,7 @@

 (defn with-temporary-keyspace
   [session f]
-  (try
-    (drop-keyspace session :new_cql_keyspace)
-    (catch Exception _ nil))
+  (drop-keyspace session :new_cql_keyspace (if-exists))

   (create-keyspace session "new_cql_keyspace"
                    (with {:replication
@@ -42,9 +40,7 @@
                                      :primary-key [[:device_id :date] :created_at]}))

   (f)
-  (try
-    (drop-keyspace session :new_cql_keyspace)
-    (catch Exception _ nil)))
+  (drop-keyspace session :new_cql_keyspace))

 (defmacro test-combinations
   "Run given queries in both plain and prepared modes."


Integrate self-adaptivity-controller into main.

--- src/dsbdp/main.clj
+++ src/dsbdp/main.clj
@@ -195,6 +195,15 @@
                                   (.inc in-cntr)))
                       :default (fn [] (.inc out-cntr))))
           self-adaptivity-cfg (options :self-adaptivity-cfg)
+          self-adaptivity-controller (if (not (nil? self-adaptivity-cfg))
+                                       (create-self-adaptivity-controller
+                                         self-adaptivity-cfg
+                                         pipeline
+                                         (condp = scenario
+                                           "self-adaptive-low-throughput" synthetic-low-throughput-self-adaptivity-processing-fns
+                                           "self-adaptive-average-throughput" synthetic-average-throughput-self-adaptivity-processing-fns
+                                           "self-adaptive-high-throughput" synthetic-high-throughput-self-adaptivity-processing-fns)
+                                         fn-mapping))
           thread-info-fn (create-thread-info-fn)
           stats-fn (fn []
                      (let [in (double (/ (.value in-cntr) 1000.0))
@@ -206,7 +215,11 @@
                          "in-delta:" (delta-cntr :in in) "k/s;"
                          "out-delta:" (delta-cntr :out out) "k/s;")
                        (if (not (nil? pipeline))
-                         (println (get-counts pipeline)))))]
+                         (let [counts (get-counts pipeline)]
+                           (println @fn-mapping)
+                           (println counts)
+                           (if (not (nil? self-adaptivity-controller))
+                             (update-stats self-adaptivity-controller counts))))))]
       (println "Starting experiment...")
       (.setName (Thread/currentThread) "Main")
       (.start in-loop)


Be more explicit about what "paths" are in UI

--- src/kevin/views.clj
+++ src/kevin/views.clj
@@ -76,19 +76,26 @@
   [path]
   [:ul] (content (map result-node path)))

+(defn paths-count [paths bacon-number]
+  (let [total (str paths " path" (when-not (= 1 paths) "s"))
+        degrees (str bacon-number " degree" (when-not (= 1 bacon-number) "s"))]
+    (str total " with " degrees " of separation")))
+
 (defsnippet results "templates/results.html" [:#results]
   [{:keys [paths total start end bacon-number]}]
   [:.result_list :> [:ul (html/but first-of-type)]] nil
   [:.result_list :> [:ul first-of-type]] (clone-for [path paths]
                                                     (content (result path)))
-  [:.result_list :> :h3] (content (str total " paths"))
+  [:.result_list :> :h3] (content (paths-count total bacon-number))
   [:.bacon_number :mark] (content (str bacon-number))
   [:.bacon_number [:p first-of-type]] (content (format-name start))
   [:.bacon_number [:p last-of-type]] (content (format-name end)))

 (defn disambiguate [pairs {:keys [hard-mode person1 person2]}]
   (main-template :title "Did you mean one of these?"
-                 :body [(possibilities pairs)
+                 :body [(if (seq pairs)
+                          (possibilities pairs)
+                          (html/html [:h2 "Oops. We couldn't find one of those actors"]))
                         (html/html [:h2 "Try a new search"])
                         (form person1 person2 hard-mode)]))


Try to fix deref error

Try to fix deref error

--- src/korhal/core.clj
+++ src/korhal/core.clj
@@ -12,10 +12,13 @@
  :constructors {[] []}
  :prefix "korhal-")

+(defn swap-key [curr-val k v]
+  (merge curr-val {k v}))
+
 (defn korhal-main [& args]
   (let [ai (korhal.core.)
         api (jnibwapi.JNIBWAPI. ai)]
-    (compare-and-set! (.state ai) @(.state ai) (merge @(.state ai) {:api api}))
+    (swap! (.state ai) swap-key :api api)
     (.start api)))

 (defn korhal-init [this]


GAWB-23: use when-not instead of if-not

GAWB-23: use when-not instead of if-not

--- src/cljs/org/broadinstitute/firecloud_ui/page/workspace/summary/attribute_editor.cljs
+++ src/cljs/org/broadinstitute/firecloud_ui/page/workspace/summary/attribute_editor.cljs
@@ -110,7 +110,7 @@
         (style/create-section-header
           [:div {}
            "Workspace Attributes"
-           (if-not editing?
+           (when-not editing?
              [:span {:style {:fontSize "initial" :fontWeight "initial"}}
               [:a {:style {:textDecoration "none" :marginLeft "1em"}
                    :href (str (config/api-url-root) "/cookie-authed/workspaces/"


adding tests

adding tests

--- test/desdemona/ui/nav_test.cljs
+++ test/desdemona/ui/nav_test.cljs
@@ -1,13 +1,45 @@
 (ns desdemona.ui.nav-test
   (:require
    [desdemona.ui.nav :as n]
+   [desdemona.ui.dom :as d]
+   [reagent.session :as session]
    [cljs.test :as t :refer-macros [deftest testing is are]]))
+
+(deftest search-form-component-test
+  (is (= (n/search-form-component)
+         [:form.navbar-form.navbar-left
+          [:div.input-group
+           [:input.main-input.form-control
+            {:placeholder "Search..."}]
+           [:div.input-group-btn
+            [d/dropdown-button {:id "timeframe-dropdown"
+                                :bsStyle "default"
+                                :pullRight true
+                                :title "last 24h"}
+             [d/menu-item {} "Last 4h"]
+             [d/menu-item {} "Last 8h"]
+             [d/menu-item {} "Last 12h"]
+             [d/menu-item {} "Last week"]
+             [d/menu-item {} "Last month"]
+             [d/menu-item {:divider true}]
+             [d/menu-item {} "Custom"]]
+            [:button.btn.btn-primary {:aria-label "Search"}
+             [:i.fa.fa-search {:aria-hidden true}]]]]])))

 (deftest nav-test
   (is (= (n/nav)
-         [:nav
-          [:ul
-           [:li
-            [:a {:href "/"} "Dashboard"]]
-           [:li
-            [:a {:href "/table"} "Table"]]]])))
+         [:div.navbar.navbar-default.navbar-double-row
+          [:div.container-fluid.pt-30.pb-30
+           [:div.navbar-header
+            [:a.navbar-brand.brand-logo {:href "#"}
+             "Desdemona"]]
+           (n/search-form-component)]
+          [:div.container-fluid
+           [:nav
+            (let [current-page (session/get :current-page)
+                  active? #(= % current-page)]
+              [:ul.nav.nav-tabs
+               [:li {:class nil}
+                [:a {:href "/"} "Dashboard"]]
+               [:li {:class nil}
+                [:a {:href "/table"} "Table"]]])]]])))


Resolve reflection warnings in tests

Resolve reflection warnings in tests

--- test/http/async/client/test.clj
+++ test/http/async/client/test.clj
@@ -292,7 +292,7 @@
     (await resp)
     (is (done? resp))
     (is (failed? resp))
-    (is (= "boom!" (.getMessage (error resp))))))
+    (is (= "boom!" (.getMessage ^Exception (error resp))))))

 (deftest test-send-headers
   (let [resp (GET *client* "http://localhost:8123/" :headers {:a 1 :b 2})
@@ -665,7 +665,7 @@

 (deftest content-type-fn
   (let [resp (GET *client* "http://localhost:8123/body")]
-    (is (.startsWith (content-type resp) "text/plain"))))
+    (is (.startsWith ^String (content-type resp) "text/plain"))))

 (deftest single-set-cookie
   (let [resp (GET *client* "http://localhost:8123/cookie")


improve test names for xframe setting

improve test names for xframe setting

--- test/nevergreen/config_test.clj
+++ test/nevergreen/config_test.clj
@@ -14,13 +14,13 @@
              (provided
                (env :port) => nil)))

-(fact "allow-iframe-from"
-      (fact "defaults to 5000"
+(fact "allow iframe from"
+      (fact "from env"
             (subject/allow-iframe-from) => "host:port"
             (provided
               (env :allow-iframe-from) => "host:port"))

-      (fact "use default if not set in env"
+      (fact "defaults to 'self'"
             (subject/allow-iframe-from) => "'self'"))

 (facts "aes encryption key"


Reduce rows-per-segment so multiple batches are required

--- test/onyx/plugin/input_test.clj
+++ test/onyx/plugin/input_test.clj
@@ -113,7 +113,7 @@
     :sql/password db-pass
     :sql/table :people
     :sql/id :id
-    :sql/rows-per-segment 1000
+    :sql/rows-per-segment 2
     :onyx/batch-size 1000
     :onyx/max-peers 1
     :onyx/doc "Partitions a range of primary keys into subranges"}


clipping stack; proper image coordinates handling

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

--- plugins/SlideExplorer2/src/slide_explorer/canvas.clj
+++ plugins/SlideExplorer2/src/slide_explorer/canvas.clj
@@ -2,7 +2,7 @@
   (:import (java.awt AlphaComposite BasicStroke Color Font Graphics Graphics2D Image
                      Polygon RenderingHints Shape)
            (java.awt.font TextAttribute)
-           (java.awt.geom Arc2D Arc2D$Double Ellipse2D$Double
+           (java.awt.geom Arc2D Arc2D$Double Area Ellipse2D$Double
                           Line2D$Double Path2D$Double
                           Rectangle2D$Double
                           RoundRectangle2D$Double)
@@ -19,6 +19,9 @@
 ;
 ; gradients
 ; affine transforms
+
+(defn read-image [file]
+  (javax.imageio.ImageIO/read (clojure.java.io/file file)))

 (defn enable-anti-aliasing
   "Turn on (off) anti-aliasing for a graphics context."
@@ -70,6 +73,9 @@
     (keyword? color) (colors color)
     (string? color)  (colors (keyword color))
     :else            color))
+
+(defn set-color [g2d color]
+  (.setColor g2d (color-object color)))

 (def degrees-to-radians (/ Math/PI 180))

@@ -94,10 +100,19 @@
                     (BasicStroke. width cap-code join-code miter-limit)))))
     (when (and x y (or rotate scale scale-x scale-y))
       (doto g2d
-        (.translate x y)
+        (.translate (double x) (double y))
         (.rotate (* degrees-to-radians (or rotate 0.0)))
         (.scale (or scale-x scale 1.0) (or scale-y scale 1.0))
-        (.translate (- x) (- y)))))
+        (.translate (double (- x)) (double (- y))))))
+
+(defn intersect-shapes [shape1 shape2]
+  (doto (Area. shape1) (.intersect (Area. shape2))))
+
+(defn- with-g2d-clip-fn [g2d clip body-fn]
+  (let [original-clip (.getClip g2d)]
+    (.setClip g2d (intersect-shapes clip original-clip))
+    (body-fn)
+    (.setClip g2d original-clip)))

 (defn- with-g2d-state-fn [g2d params body-fn]
   (let [color (.getColor g2d)
@@ -127,7 +142,7 @@

 (defn- half? [a]
   (when a
-    (/ a 2)))
+    (/ a 2.)))

 (defn- twice? [a]
   (when a
@@ -139,15 +154,17 @@
            w width h height]
     :as the-map}]
   (let [l (or l left) t (or t top) r (or r right) b (or b bottom)
-        w (or w width (-? r l) (twice? (-? x l)) (twice? (-? r x)))
-        h (or h height (-? b t) (twice? (-? y t)) (twice? (-? b y)))
+        w (or (-? r l) (twice? (-? x l)) (twice? (-? r x)) w width)
+        h (or (-? b t) (twice? (-? y t)) (twice? (-? b y)) h height)
         l (or l (-? r w) (-? x (half? w)))
         t (or t (-? b h) (-? y (half? h)))
         r (or r (+? l w) (+? x (half? w)))
         b (or b (+? t h) (+? y (half? h)))
         x (or x (+? l (half? w)))
         y (or y (+? t (half? h)))]
-    (merge the-map {:w w :h h :l l :t t :r r :b b :x x :y y})))
+    (->> (merge the-map {:w w :h h :l l :t t :r r :b b :x x :y y})
+         (filter second)
+         (into {}))))

 (defmulti make-obj (fn [obj-keyword params] obj-keyword))

@@ -204,23 +221,32 @@
   data)

 (defn stroke? [stroke]
-  (and stroke (pos? (:width stroke))))
+  (let [width (:width stroke)]
+    (or (nil? width) (pos? width))))

 (defmulti draw-primitive (fn [g2d obj params] (type obj)))

 (defmethod draw-primitive Shape
-  [g2d shape {:keys [fill stroke]}]
-  (when fill
-    (.fill g2d shape))
-  (when (stroke? stroke)
-    (.draw g2d shape)))
+  [g2d shape {:keys [color fill stroke] :as params}]
+  (with-g2d-state [g2d params]
+                  (when fill
+                    (when-let [fill-color (:color fill)]
+                      (doto g2d
+                        (set-color fill-color)
+                        (.fill shape))))
+                  (when (stroke? stroke)
+                    (doto g2d
+                      (set-color (or (:color stroke) color :black))
+                      (.draw shape)))))

 (defmethod draw-primitive Image
-  [g2d image {:keys [l t w h]}]
-  (.drawImage g2d image
-              l t
-              (or w (.getWidth image))
-              (or h (.getHeight image)) nil))
+  [g2d image params]
+  (let [w (or (:w params) (.getWidth image))
+        h (or (:h params) (.getHeight image))
+        params+ (complete-coordinates (assoc params :w w :h h))
+        {:keys [l t]} params+]
+    (with-g2d-state [g2d params+]
+                    (.drawImage g2d image l t w h nil))))

 (defn draw-string-center
   "Draw a string centered at position x,y."
@@ -239,7 +265,7 @@
                  (float (+ y (/ height 2))))))

 (defmethod draw-primitive String
-  [g2d text {:keys [x y font fill stroke]}]
+  [g2d text {:keys [x y font fill stroke] :as params}]
   (let [{:keys [name bold italic underline strikethrough size]} font
         style (bit-or (if bold Font/BOLD 0) (if italic Font/ITALIC 0))
         font1 (Font. name style size)
@@ -257,7 +283,8 @@
       ;(draw-shape g2d obj fill stroke)
       ;(.translate g2d (- x) (- y))
       (.setFont g2d font2)
-      (draw-string-center g2d text x y)
+      (with-g2d-state [g2d params]
+                       (draw-string-center g2d text x y))
       )))

 (defn draw-primitives [g2d items]
@@ -265,8 +292,8 @@
   (doseq [[type params inner] items]
     (when type
     (let [params+ (complete-coordinates params)]
-      (with-g2d-state [g2d params+]
-                      (draw-primitive g2d (make-obj type params+) params+))))))
+      (draw-primitive g2d (make-obj type params+) params+)))))
+

 (defn paint-canvas-graphics [^Graphics graphics data]
   (draw-primitives graphics data))
@@ -297,12 +324,12 @@

 (defn demo-animation [reference]
   (dotimes [i 200]
-  (Thread/sleep 30)
-  (swap! reference (fn [data]
-                     (-> data
-                         (assoc-in [0 :params :w] (+ i 100))
-                         (assoc-in [0 :params :h] (+ i 100)))
-                     ))))
+    (Thread/sleep 30)
+    (swap! reference (fn [data]
+                       (-> data
+                           (assoc-in [6 1 :rotate] (+ i 5))
+                           ))
+           )))

 (defn handle-data-changed [text-area changed-fn]
   (let [doc (.getDocument text-area)]
@@ -325,24 +352,25 @@
       (.. getContentPane (add scroll-pane))
       .show)))

+(def img (read-image "/Users/arthur/Desktop/flea.png"))
+
+(count
 (reset!
   grafix
   [
    [:round-rect
     {:l 20 :t 10 :w 300 :h 300
      :arc-radius 100
-     :fill true :color :pink
+     :fill {:color :pink}
+     :scale 1.3
+     :stroke {:color 0xE06060
+              :cap :round
+              :width 5
+              :dashes [10 10] :dash-phase 0}
      :rotate 50}]
-   [:round-rect
-    {:l 20 :t 10 :w 300 :h 300
-     :arc-radius 100 :rotate 50
-     :fill false :color 0xE06060
-     :stroke {:width 5
-              :cap :round
-              :dashes [10 10] :dash-phase 0}}]
    [:ellipse
     {:l 25 :t 15 :w 110 :h 90
-     :fill true :color :yellow :alpha 0.5 :stroke nil}]
+     :fill true :color :yellow :alpha 0.5 :stroke {:width 10 :cap :round :dashes [20 20]}}]
    [:polyline
     {:vertices [{:x 100 :y 100}
                 {:x 50 :y 150}
@@ -360,8 +388,8 @@
     {:x 180 :y 120 :text "Testing!!!"
      :color :white
      :alpha 0.7
-     :rotate 0.2
-     :scale 1.1
+     :rotate 20
+     :scale-x 1.1
      :fill true
      :stroke {:width 10 :cap :butt}
      :font {:name "Arial"
@@ -369,20 +397,18 @@
             :italic false
             :underline false
             :strikethrough false
-            :size 60}}]
-   (comment
+            :size 50}}]
    [:ellipse
-    {:x 350 :y 350 :w 40 :h 40 :fill true :color :pink
-     :stroke nil}]
-   [:ellipse
-    {:x 350 :y 350 :w 40 :h 40 :fill false :color :red
-     :stroke {:width 4}}]
+    {:x 350 :y 350 :w 40 :h 40 :fill {:color :pink}
+     :stroke {:width 4 :color 0xE06060}}]
    [:line
-    {:x 350 :y 350 :w 18 :h 18 :fill false :color :white :alpha 0.8
+    {:x 350 :y 350 :w 18 :h 18 :color :white :alpha 0.8
      :stroke {:width 7 :cap :butt}}]
+   [:image
+    {:x 200 :t 150 :data img :rotate 171}]
    [:line
     {:x 350 :y 350 :w -18 :h 18 :fill false :color :white :alpha 0.8
-     :stroke {:width 7 :cap :butt}}])
+     :stroke {:width 7 :cap :butt}}]
    [:line
     {:x 180 :y 220 :w 0 :h 50 :color :red
      :stroke {:width 10 :cap :round}
@@ -397,6 +423,6 @@
      :fill false
      :stroke {:width 10}
      :alpha 0.7}]
-   ])
-
-
+   ]))
+
+


wrong arity (fixed)

wrong arity (fixed)

--- src/latte/core.clj
+++ src/latte/core.clj
@@ -231,7 +231,7 @@
               ;;{
               ;; If Step 1-3 went well, the definition is created and returned
               ;;}
-              [:ok (defenv/->Definition def-name params (count params) body-term ty {})])))))))
+              [:ok (defenv/->Definition def-name params (count params) body-term #{} ty {})])))))))

 ;;{
 ;; The following function generates the clojure documentation of