PCA code switched over to core.matrix; tests passing

--- src/pca.clj
+++ src/pca.clj
@@ -1,30 +1,20 @@
-(ns pca)
+(ns pca
+  (:refer-clojure :exclude [* - + == /])
+  (:use utils)
+  (:use clojure.core.matrix)
+  (:use clojure.core.matrix.stats)
+  (:use clojure.core.matrix.operators)
+  (:use utils matrix-utils))
+
+(set-current-implementation :vectorz)
+

 (set! *unchecked-math* true)
-
-(use 'utils 'matrix-utils 'criterium.core)
-(require '(incanter
-            [core :as ic.core]
-            [stats :as ic.stats]
-            [datasets :as ic.data]
-            [io :as ic.io])
-         ;['hiphip.double :as 'dbl]
-         ['clojure.tools.trace :as 'tr])
-
-
-(defn dot [^doubles xs ^doubles ys]
-  "Returns the dot (or Euclidean inner) product of vectors xs and ys"
-  (ic.core/sum (ic.core/mult xs ys)))
-
-
-(defn norm [xs]
-  "Returns the norm (length) of vector xs"
-  (Math/sqrt (apply + (map #(Math/pow % 2) xs))))

 (defn repeatv [n x]
   "Utility function for making a vector of length n composed entirely of x"
-  (into [] (repeat n x)))
+  (matrix (into [] (repeat n x))))

 ; Should maybe hide this inside power-iteration and have that function wrap it's current
@@ -32,13 +22,12 @@
 (defn xtxr [data start-vec]
   "Will need to rename this and some of the inner variables to be easier to read...
   Computes an inner step of the power-iteration process"
-  (let [n-rows (count (first data))
-        curr-vec (ic.core/trans (repeatv n-rows 0))]
-    (loop [data data curr-vec curr-vec]
+  (let [n-cols (dimension-count data 1)
+        curr-vec (transpose (repeatv n-cols 0))]
+    (loop [data (rows data) curr-vec curr-vec]
       (if-let [row (first data)]
         (recur (rest data)
-               (ic.core/plus (tr/trace curr-vec)
-                             (tr/trace (ic.core/mult (dot row start-vec) row))))
+               (+ curr-vec (* (inner-product start-vec row) row)))
         curr-vec))))

@@ -50,11 +39,13 @@
         n-cols (count (first data))
         start-vector (or start-vector (repeatv n-cols 1))
         ; XXX - this add extra cols to the start vector if we have new comments... should test
-        start-vector (into [] (concat start-vector (repeatv (- n-cols (count start-vector)) 1)))]
+        start-vector (matrix
+                       (concat start-vector
+                               (repeatv (- n-cols (dimension-count start-vector 0)) 1)))]
     (loop [iters iters start-vector start-vector last-eigval 0]
       (let [product-vector (xtxr data start-vector)
-            eigval (norm product-vector)
-            normed (ic.core/div product-vector eigval)]
+            eigval (length product-vector)
+            normed (normalise product-vector)]
         (if (or (= iters 0) (= eigval last-eigval))
           normed
           (recur (dec iters) normed eigval))))))
@@ -63,24 +54,17 @@
 (defn proj-vec [xs ys]
   "This computes the projection of ys orthogonally onto the vector spanned by xs"
   (let [coeff (/ (dot xs ys) (dot xs xs))]
-    (ic.core/mult coeff xs)))
+    (* coeff xs)))

 (defn factor-matrix [data xs]
   "As in the Gram-Shmidt process; we can 'factor out' the vector xs from all the vectors in data,
   such that there is no remaining variance in the xs direction within the data."
-  (ic.core/matrix (mapv #(ic.core/minus % (proj-vec xs %)) data)))
-
-
-(defn mean-vector [data]
-  (if (= (first (ic.core/dim data)) 1)
-    (ic.core/matrix data)
-    (ic.core/matrix (mapv ic.stats/mean (zip (tr/trace data))))))
+  (matrix (mapv #(- % (proj-vec xs %)) data)))

 (defn centered-data [data]
-  (let [data-cntr (ic.core/trans (mean-vector data))]
-    (mapv #(ic.core/minus % data-cntr) data)))
+  (- data (mean data)))

 ; Will eventually also want to add last-pcs
@@ -89,7 +73,7 @@
   power-iteration"
   (let [cntrd-data (centered-data data)
         start-vectors (or start-vectors [])
-        data-dim (apply min (ic.core/dim cntrd-data))]
+        data-dim (min (row-count cntrd-data) (column-count cntrd-data))]
     (loop [data' cntrd-data n-comps' (min n-comps data-dim) pcs [] start-vectors start-vectors]
       (let [pc (power-iteration data' iters (first start-vectors)) ; may eventually want to return eigenvals...
             pcs (conj pcs pc)]
@@ -109,9 +93,6 @@
 (defn pca-project [data pcs]
   "Apply the principal component projection specified by pcs to the data"
   ; Here we map each row of data to it's projection
-  (mapv
-    ; each projection is the map of the pcs to the dot of a pc and the data-row
-    (fn [data-row] (mapv #(dot data-row %) pcs))
-    data))
+  (mmul data (transpose pcs)))


rename satisfied? -> deps-satisfied? and add wait-until-deps-satisfied

--- src/overtone/libs/deps.clj
+++ src/overtone/libs/deps.clj
@@ -91,8 +91,8 @@
     (send-off dep-state* on-deps* key deps handler)))

 (defn satisfy-deps
-  "Specifies that a given dependency has been satisfied. Uses an agent so it's
-  safe to call this from within a transaction."
+  "Specifies that a list of dependencies have been satisfied. Uses an agent so
+  it's safe to call this from within a transaction."
   [& deps]
   (send-off dep-state* satisfy* (set deps)))

@@ -114,15 +114,33 @@
                       :todo (deps :done)
                       :done []})))

-(defn satisfied?
-  "Returns true if all the deps (specified either as a single dep or a
-  collection of deps) have been satisfied."
-  [deps]
-  (let [deps (deps->set deps)
-        satisfied (:satisfied @dep-state*)]
-    (set/superset? satisfied deps)))
-
 (defn satisfied-deps
   "Returns a set of all satisfied deps"
   []
   (:satisfied @dep-state*))
+
+(defn deps-satisfied?
+  "Returns true if all the deps (specified either as a single dep or a
+  collection of deps) have been satisfied."
+  [deps]
+  (let [deps (deps->set deps)]
+    (set/superset? (satisfied-deps) deps)))
+
+(defn wait-until-deps-satisfied
+  "Makes the current thread sleep until specified deps have been satisfied.
+  Thread enters a sleep cycle sleeping for wait-time ms before each dep check.
+  If timeout is a positive value throws timeout exception if deps haven't been
+  satisfied by timeout ms. Default wait-time is 100ms and default timeout is
+  10000 ms"
+  ([deps] (wait-until-deps-satisfied deps 10000 100))
+  ([deps timeout] (wait-until-deps-satisfied deps timeout 100))
+  ([deps timeout wait-time]
+     (if (<= timeout 0)
+       (while (not (deps-satisfied? deps))
+         (Thread/sleep wait-time))
+       (loop [sleep-time 0]
+         (when (> sleep-time timeout)
+           (throw (Exception. (str "The following deps took too long to be satisfied: " deps))))
+         (when-not (deps-satisfied? deps)
+           (Thread/sleep wait-time)
+           (recur (+ sleep-time wait-time)))))))


Update samples to make use of defrecord.

* use defrecord for Sample
* use defrecord-ifn for PlayableSample.
* pull #'sample-player out of #'sample.
* make #'sample-player work with defrecord-ifn.
* add Sample and PlayableSample to our isa heirarchy.
* reorder source to make heirarchy code work as expected.

--- src/overtone/sc/sample.clj
+++ src/overtone/sc/sample.clj
@@ -47,6 +47,8 @@

 (defonce loaded-samples* (ref {}))

+(defrecord Sample [id size n-channels rate allocated-on-server path args name])
+
 (defn- load-sample*
   [path & args]
   (let [path (canonical-path path)
@@ -58,12 +60,11 @@
           start    (get arg-map :start 0)
           n-frames (get arg-map :size 0)
           buf      (buffer-alloc-read path start n-frames)]
-      (let [sample (with-meta
-                     (merge buf
-                            {:path path
-                             :args args
-                             :name f-name})
-                     {:type ::sample})]
+      (let [sample (map->Sample
+                    (assoc buf
+                      :path path
+                      :args args
+                      :name f-name))]
         (dosync (alter loaded-samples* assoc [path args] sample))
         sample))))

@@ -114,11 +115,6 @@
   [s]
   (isa? (type s) ::sample))

-;; Samples are just audio files loaded into a buffer, so buffer
-;; functions work on samples too.
-(derive ::sample :overtone.sc.buffer/file-buffer)
-(derive ::playable-sample ::sample)
-
 (defn- free-loaded-sample
   [[[path args] buf]]
   (if (server-connected?)
@@ -146,6 +142,19 @@
     (free-loaded-sample [[path args] buf])
     :done))

+(defn sample-player
+  [smpl & pargs]
+  {:pre [(sample? smpl)]}
+  (let [{:keys [path args]}     smpl
+        {:keys [id n-channels]} (get @loaded-samples* [path args])]
+    (cond
+     (= n-channels 1) (apply mono-player id pargs)
+     (= n-channels 2) (apply stereo-player id pargs))))
+
+(defrecord-ifn PlayableSample
+  [id size n-channels rate allocated-on-server path args name]
+  sample-player)
+
 (defn sample
   "Loads a .wav or .aiff file into a memory buffer. Returns a function capable
    of playing that sample.
@@ -155,15 +164,16 @@

   "
   [path & args]
-  (let [{:keys [path args] :as s} (apply load-sample path args)
-        player (fn [& pargs]
-                 (let [{:keys [id n-channels]} (get @loaded-samples* [path args])]
-                   (cond
-                    (= n-channels 1) (apply mono-player id pargs)
-                    (= n-channels 2) (apply stereo-player id pargs))))]
-    (with-meta
-      (callable-map s player)
-      {:type ::playable-sample})))
+  (let [smpl (apply load-sample path args)]
+    (map->PlayableSample smpl)))
+
+;; Samples are just audio files loaded into a buffer, so buffer
+;; functions work on samples too.
+(derive Sample         ::sample)
+(derive PlayableSample ::playable-sample)
+
+(derive ::sample :overtone.sc.buffer/file-buffer)
+(derive ::playable-sample ::sample)

 (defmethod buffer-id ::sample [sample] (:id sample))


handle telegram polling errors #9

handle telegram polling errors #9

--- src/consolelifebot/telegram.clj
+++ src/consolelifebot/telegram.clj
@@ -14,7 +14,13 @@
                             :timeout 60}
              :keep-alive 60000}
             (fn [{:keys [status headers body error]}]
-              (:result (json/read-str body :key-fn keyword)))))
+              (println status)
+              (if (not= status 200)
+                (do
+                  (log/error body)
+                  (Thread/sleep 500)
+                  [])
+                (:result (json/read-str body :key-fn keyword))))))

 (defn- post [method body]
   (log/info "[telegram] post " method " " body)


add ability to explicitly name a dynamically created record type

--- dada-core/src/main/clojure/org/dada/core.clj
+++ dada-core/src/main/clojure/org/dada/core.clj
@@ -261,6 +261,12 @@
 	keys (map (fn [[key type]] (symbol (attribute-key key))) attributes)]
     (eval `(do (defrecord ~sym ~keys) ~sym)))) ; TODO: put type hints on fields

+(defn #^Class named-record-class [class-name attributes]
+  "make an anonymous record Class"
+  (let [sym (symbol class-name)
+	keys (map (fn [[key type]] (symbol (attribute-key key))) attributes)]
+    (eval `(do (defrecord ~sym ~keys) ~sym))))
+
 (defn #^Creator record-creator [#^Class class]
   "make a Creator for the given Class"
   (proxy [Creator] []
@@ -285,6 +291,15 @@
 	 version-comparator
 	 (map (fn [[key type mutable]] (Attribute. key type mutable (record-getter class type key))) attributes))))

+(defn #^Metadata named-record-metadata2 [class-name primary-keys version-keys version-comparator attributes]
+  "make a record-based Metadata instance"
+  (let [class (named-record-class class-name attributes)]
+    (new MetadataImpl
+	 (record-creator class)
+	 primary-keys
+	 version-keys
+	 version-comparator
+	 (map (fn [[key type mutable]] (Attribute. key type mutable (record-getter class type key))) attributes))))

 (let [record-metadata-cache (atom {})]

@@ -296,6 +311,17 @@
 	record-metadata-cache
 	(fn [cache key]
 	    (if (contains? cache key) cache (assoc cache key (record-metadata2 primary-keys version-keys version-comparator attributes))))
+	cache-key)
+       cache-key)))
+
+  (defn #^Metadata named-record-metadata
+    "return memoized record-metadata"
+    [class-name primary-keys version-keys version-comparator attributes]
+    (let [cache-key [primary-keys version-keys version-comparator attributes]]
+      ((swap!
+	record-metadata-cache
+	(fn [cache key]
+	    (if (contains? cache key) cache (assoc cache key (named-record-metadata2 class-name primary-keys version-keys version-comparator attributes))))
 	cache-key)
        cache-key)))


(TK-400) Add test for debug logging

(TK-400) Add test for debug logging

Also adds a new macro to start the status service with a given config

--- test/puppetlabs/trapperkeeper/services/status/status_service_test.clj
+++ test/puppetlabs/trapperkeeper/services/status/status_service_test.clj
@@ -6,7 +6,7 @@
             [puppetlabs.trapperkeeper.services :refer [defservice service service-context]]
             [puppetlabs.trapperkeeper.app :refer [get-service] :as tka]
             [puppetlabs.trapperkeeper.testutils.bootstrap :refer :all]
-            [puppetlabs.trapperkeeper.testutils.logging :refer [with-test-logging]]
+            [puppetlabs.trapperkeeper.testutils.logging :refer [with-test-logging with-logger-event-maps]]
             [puppetlabs.trapperkeeper.services.status.status-service :refer [status-service get-status]]
             [puppetlabs.trapperkeeper.services.status.status-core :as status-core]
             [puppetlabs.trapperkeeper.services.webrouting.webrouting-service :as webrouting-service]
@@ -31,18 +31,27 @@
   [resp]
   (:status (parse-response resp true)))

-(defmacro with-status-service
+(defmacro with-status-service-with-config
   "Macro to start the status service and its dependencies (jetty9 and
-  webrouting service), along with any other services desired."
-  [app services & body]
+  webrouting service), along with any other services desired, with the given
+  config"
+  [app services config & body]
   `(with-app-with-config
      ~app
      (concat [jetty9-service/jetty9-service
               webrouting-service/webrouting-service
               scheduler-service/scheduler-service
               status-service] ~services)
-     status-service-config
+     ~config
      (do ~@body)))
+
+(defmacro with-status-service
+  "Macro to start the status service and its dependencies (jetty9 and
+  webrouting service), along with any other services desired. Provides
+  a default tk config"
+  [app services & body]
+  `(with-status-service-with-config
+    ~app ~services status-service-config ~@body))

 (def alerts [{:severity :error
               :message "Alert! Alert"}])
@@ -469,3 +478,35 @@
                  :state "running"}
                 (dissoc body :status)))
          (is (map? (get-in body [:status :experimental :jvm-metrics]))))))))
+
+(deftest status-debug-logging-test
+  (testing "status service logs debug data when setting is enabled"
+    (with-test-logging
+     (with-logger-event-maps
+      "puppetlabs.trapperkeeper.services.status.status-debug-logging"
+      event-maps
+      (with-status-service-with-config
+       app
+       []
+       (merge status-service-config
+              {:status {:debug-logging {:interval-milliseconds 10}}})
+       (Thread/sleep 100)
+       ; The only thing that's logged from that namespace should be the status data
+       ; so any of the events will work
+       (let [log-event (first @event-maps)
+             status-json-string (:message log-event)
+             status-data (json/parse-string status-json-string)]
+         (is (= "running" (get status-data "state"))))))))
+  (testing "status service does not log debug data when setting is not present"
+    (with-test-logging
+     (with-logger-event-maps
+      "puppetlabs.trapperkeeper.services.status.status-debug-logging"
+      event-maps
+      (with-status-service
+       app
+       []
+       ; Can't prove that with a longer sleep something wouldn't have been logged,
+       ; so this sleep time is a bit arbitrary
+       (Thread/sleep 100)
+       (testing "no events have been logged"
+         (is (empty? @event-maps))))))))


Remove webserver from system

Remove webserver from system

--- src/edge/system.clj
+++ src/edge/system.clj
@@ -10,11 +10,10 @@
    [edge.webserver :refer [new-webserver]]))

 (defn new-system-map []
-  (system-map
-   ::webserver (new-webserver)))
+  (system-map))

 (defn new-dependency-map []
-  {::webserver {}})
+  {})

 (defn new-production-system
   "Create the production system"


Fixed mongo-insert-results for sending perf metrics

--- src/polismath/conv_man.clj
+++ src/polismath/conv_man.clj
@@ -132,11 +132,13 @@

 (defn mongo-insert-results
-  "Perform insert to mongo collection"
+  "Perform insert to mongo collection by zid"
   [collection-name object]
   (mc/update
     (db/mongo-db (env/env :mongolab-uri))
     collection-name
+    {:zid (or (:zid object)
+              (get object "zid"))}
     object))


Get ALL users from intercom, recursively

--- src/polismath/intercom.clj
+++ src/polismath/intercom.clj
@@ -12,21 +12,46 @@
 (defn get-intercom-users
   "Get the list of users from intercom (don't want to create intercom users for users that haven't
   actually signed up"
-  []
-  (->
-    (client/get "https://api.intercom.io/users"
-                {:accept :json
-                 :basic-auth ["nb5hla8s" (env/env :intercom-api-key)]})
-    :body
-    (ch/parse-string)
-    (->>
-      (into {}))))
+  [& [page]]
+  (let [return-data
+          (->
+            (or page "https://api.intercom.io/users")
+            (client/get
+              {:accept :json
+               :basic-auth ["nb5hla8s" (env/env :intercom-api-key)]})
+            :body
+            (ch/parse-string)
+            (->>
+              (into {})))
+        next-page (get-in return-data ["pages" "next"])
+        users (get return-data "users")]
+    (if next-page
+      (into users (get-intercom-users next-page))
+      users)))
+
+
+(defn user-id
+  [user]
+  (try
+    (-> user
+        (get "user_id")
+        (Integer/parseInt))
+    (catch Exception e
+      nil)))
+
+
+(defn user-id-str
+  [user]
+  (get user "user_id"))

 (defn -main
   []
-  (->>
+  (->
     (get-intercom-users)
-    (get "users")
+    (->>
+      (sort-by #(get % "created_at"))
+      (map #(vector (get % "created_at") (user-id-str %))))
     (pp/wide-pp)))

+


fail on nil *ns*

fail on nil *ns*

--- src/main/cljs/cljs/tools/reader.cljs
+++ src/main/cljs/cljs/tools/reader.cljs
@@ -394,11 +394,12 @@
                 name (-nth s 1)]
             (if (identical? \: (.charAt token 0))
               (if-not (nil? ns)
-                (let [ns (resolve-ns (symbol (subs ns 1)))]
-                  (if-not (nil? ns)
-                    (keyword (str ns) name)
-                    (reader-error reader "Invalid token: :" token)))
-                (keyword (str *ns*) (subs name 1)))
+                (if-let [ns (resolve-ns (symbol (subs ns 1)))]
+                  (keyword (str ns) name)
+                  (reader-error reader "Invalid token: :" token))
+                (if-let [ns *ns*]
+                  (keyword (str ns) (subs name 1))
+                  (reader-error reader "Invalid token: :" token)))
               (keyword ns name)))
           (reader-error reader "Invalid token: :" token)))
       (reader-error reader "Invalid token: :"))))


Break that big test up into subtests

Break that big test up into subtests

--- test/grimoire/things_test.clj
+++ test/grimoire/things_test.clj
@@ -20,8 +20,9 @@
   (is (t/version?   (t/thing->version t)))
   (is (t/platform?  (t/thing->platform t)))
   (is (t/namespace? (t/thing->namespace t)))
-  (is (t/def?       (t/thing->def t)))
+  (is (t/def?       (t/thing->def t))))

+(deftest thing->def-tests
   ;; Testing stuff that should fail
   (testing "Testing thing->def"
     (is-assert-error?
@@ -42,8 +43,9 @@

     (is-assert-error?
      (t/thing->def
-      (t/thing->group t))))
+      (t/thing->group t)))))

+(deftest thing->namespace-tests
   (testing "Testing thing->namespace"
     (is-assert-error?
      (t/thing->namespace
@@ -59,8 +61,9 @@

     (is-assert-error?
      (t/thing->namespace
-      (t/thing->group t))))
+      (t/thing->group t)))))

+(deftest thing->platform-tests
   (testing "Testing thing->platform"
     (is-assert-error?
      (t/thing->platform
@@ -72,8 +75,9 @@

     (is-assert-error?
      (t/thing->platform
-      (t/thing->group t))))
+      (t/thing->group t)))))

+(deftest thing->version-tests
   (testing "Testing thing->version"
     (is-assert-error?
      (t/thing->version
@@ -81,8 +85,9 @@

     (is-assert-error?
      (t/thing->version
-      (t/thing->group t))))
+      (t/thing->group t)))))

+(deftest thing->artifact-tests
   (testing "Testing thing->artifact"
     (is-assert-error?
      (t/thing->artifact


Make sure `lein run` works

Make sure `lein run` works

--- test/jcf/integration_test.clj
+++ test/jcf/integration_test.clj
@@ -28,3 +28,10 @@
     (is (zero? exit)
         (format "lein test failed with status %d.\nOut:\n%s\n\nErr:\n%s\n\n"
                 exit out err))))
+
+(deftest test-lein-run
+  (let [_ (println "Running lein run. This'll take a couple of seconds...")
+        {:keys [exit out err]} (sh "lein" "run" :dir *dir*)]
+    (is (zero? exit)
+        (format "lein run failed with status %d.\nOut:\n%s\n\nErr:\n%s\n\n"
+                exit out err))))


Tests for discover-tasks.

Tests for discover-tasks.

--- test/onyx/validation_test.clj
+++ test/onyx/validation_test.clj
@@ -99,3 +99,44 @@
            [:e :f]
            [:g :h]})

+(let [catalog
+      [{:onyx/name :in
+        :onyx/ident :hornetq/read-segments
+        :onyx/type :input
+        :onyx/medium :hornetq
+        :onyx/consumption :concurrent}
+
+       {:onyx/name :inc
+        :onyx/fn :onyx.peer.single-peer-test/my-inc
+        :onyx/type :transformer
+        :onyx/consumption :concurrent}
+
+       {:onyx/name :out
+        :onyx/ident :hornetq/write-segments
+        :onyx/type :output
+        :onyx/medium :hornetq
+        :onyx/consumption :concurrent}]
+      workflow {:in {:inc :out}}
+      tasks (onyx.coordinator.planning/discover-tasks catalog workflow)
+      in (first (filter (fn [t] (= (:name t) :in)) tasks))
+      inc (first (filter (fn [t] (= (:name t) :inc)) tasks))
+      out (first (filter (fn [t] (= (:name t) :out)) tasks))]
+
+  (fact "There are 3 tasks"
+        (count tasks) => 3)
+
+  (facts ":in comes first, then :inc, then :out"
+         (fact (:phase in) => 1)
+         (fact (:phase inc) => 2)
+         (fact (:phase out) => 3))
+
+  (fact ":in's egress queue to :inc is :inc's ingress queue"
+        (:inc (:egress-queues in)) => (:ingress-queues inc))
+
+  (fact ":inc's egress queue to :out is :out's ingress queue"
+        (:out (:egress-queues inc)) => (:ingress-queues out))
+
+  (fact ":in has an ingress queue" (:ingress-queues in) =not=> nil?)
+
+  (fact ":out has an egress queue" (:egress-queues out) =not=> empty?))
+


Makes k8s API client read timeout configurable

--- scheduler/src/cook/kubernetes/compute_cluster.clj
+++ scheduler/src/cook/kubernetes/compute_cluster.clj
@@ -609,7 +609,15 @@
       a bearer token for authenticating with kubernetes
     - bearer-token-refresh-seconds: interval to refresh the bearer token
     - If we have a configuration file set, then we can select the context out of that kubeconfig file with kubeconfig-context"
-  [^String config-file base-path ^String use-google-service-account? bearer-token-refresh-seconds verifying-ssl ^String ca-cert ^String ca-cert-path kubeconfig-context]
+  [^String config-file
+   base-path
+   ^String use-google-service-account?
+   bearer-token-refresh-seconds
+   verifying-ssl
+   ^String ca-cert
+   ^String ca-cert-path
+   kubeconfig-context
+   read-timeout-seconds]
   {:pre [(not (and ca-cert ca-cert-path))]}
   (log/info "API Client config file" config-file)
   (let [^ApiClient api-client (if (some? config-file)
@@ -628,8 +636,13 @@
                                       ^ClientBuilder clientbuilder (ClientBuilder/kubeconfig kubeconfig)]
                                   (.build clientbuilder))
                                 (ApiClient.))
-        ; Reset to a more sane timeout from the default 10 seconds.
-        http-client-with-readtimeout (-> api-client .getHttpClient .newBuilder (.readTimeout 120 TimeUnit/SECONDS) .build)
+        http-client-with-readtimeout (-> api-client
+                                         .getHttpClient
+                                         .newBuilder
+                                         (.readTimeout
+                                           read-timeout-seconds
+                                           TimeUnit/SECONDS)
+                                         .build)
         _ (.setHttpClient api-client http-client-with-readtimeout)]
     (when base-path
       (.setBasePath api-client base-path))
@@ -674,6 +687,7 @@
            name
            namespace
            node-blocklist-labels
+           read-timeout-seconds
            scan-frequency-seconds
            state
            state-locked?
@@ -687,6 +701,7 @@
          namespace {:kind :static
                     :namespace "cook"}
          node-blocklist-labels (list)
+         read-timeout-seconds 120
          scan-frequency-seconds 120
          state :running
          state-locked? false
@@ -704,7 +719,15 @@
         compute-cluster-config)))
   (let [conn cook.datomic/conn
         cluster-entity-id (get-or-create-cluster-entity-id conn name)
-        api-client (make-api-client config-file base-path use-google-service-account? bearer-token-refresh-seconds verifying-ssl ca-cert ca-cert-path kubeconfig-context)
+        api-client (make-api-client config-file
+                                    base-path
+                                    use-google-service-account?
+                                    bearer-token-refresh-seconds
+                                    verifying-ssl
+                                    ca-cert
+                                    ca-cert-path
+                                    kubeconfig-context
+                                    read-timeout-seconds)
         launch-task-executor-service (Executors/newFixedThreadPool launch-task-num-threads)
         compute-cluster-launch-rate-limiter (cook.rate-limit/create-compute-cluster-launch-rate-limiter name compute-cluster-launch-rate-limits)
         compute-cluster (->KubernetesComputeCluster api-client


Fixed issue #16

Fixed issue #16

--- src/alfresco_technical_validation/source_validation.clj
+++ src/alfresco_technical_validation/source_validation.clj
@@ -82,6 +82,7 @@
         :perf02         #"<index\s+enabled\s*=\s*\"true"
         :perf03         #"<stored>\s*true\s*</stored>"
         :com08          #"<namespace\s+uri\s*=\s*\".*\"\s+prefix\s*=\s*\"(.*)\"\s*/>"
+        :stb15          #"parent=\"dictionaryModelBootstrap\""
       }
     :ant {
         :ivy            #"antlib:org\.apache\.ivy\.ant"
@@ -206,6 +207,19 @@
                          "Uses of synchronized"
                          false
                          "The technology does not synchronize.")))
+
+(defn- stb15-load-content-models-via-bootstrap
+  [source content-index]
+  (let [matches (filter #(= :stb15 (:regex-id %)) content-index)
+        message (str "Dictionary bootstrap(s):\n"
+                     (s/join "\n"
+                             (map #(str (subs (str (:file %)) (.length ^String source)) " line " (:line-number %) ": " (:line %))
+                                  matches)))]
+      (declare-result "STB15"
+                      (not (empty? matches))
+                      (if (empty? matches)
+                        "#### Manual followup required - content models (if any) are not loaded via bootstrap."
+                        message))))

 (defn- stb19-avoid-none-transactions
   [source content-index]
@@ -318,6 +332,7 @@
          (api05-inject-serviceregistry-not-services  source content-index)
          (com03-unique-module-identifier             source content-index)
          (com08-unique-namespace-prefixes            source content-index)
+         (stb15-load-content-models-via-bootstrap    source content-index)
          (stb19-avoid-none-transactions              source content-index)
          (stb20-avoid-transaction-setting            source content-index)
          (perf02-judicious-use-of-indexed-properties source content-index)


added template caching

added template caching

--- src/selmer/test_parser.clj
+++ src/selmer/test_parser.clj
@@ -6,6 +6,8 @@
 (def ^Character filter-close \})
 (def ^Character tag-second \%)

+(def templates (atom {}))
+
 (declare parse expr-tag tag-content)

 (defn render [template args]
@@ -13,6 +15,16 @@
     (doseq [element template]
       (.append buf (if (string? element) element (element args))))
     (.toString buf)))
+
+(defn render-file [filename args]
+  (let [{:keys [template last-modified]} (get @templates filename)
+        last-modified-file (.lastModified (java.io.File. filename))]
+    (if (and last-modified (= last-modified last-modified-file))
+      template
+      (let [template (parse filename)]
+        (swap! templates assoc filename {:template template
+                                         :last-modified last-modified-file})
+        template))))

 (defn read-char [rdr]
   (let [ch (.read rdr)]


Added missing unit tests.

Added missing unit tests.

--- test/simulacrum/util_test.clj
+++ test/simulacrum/util_test.clj
@@ -2,13 +2,6 @@
   (:require [clojure.test :refer :all]
             [simulacrum.util :as util]))

-
-(deftest test-get-last-line
-  (let [test-data "This is some
-                  multi-line
-                  text.
-                  Enjoy!"]
-    (is (= "Enjoy!" (util/get-last-line test-data)))))

 (deftest test-mult-str
   (is (= "ab-ab-ab-ab-" (util/mult-str "ab-" 4))))
@@ -32,3 +25,24 @@
         clojure.lang.ExceptionInfo
         #"Input must be between 1 and 5"
         (util/check-input 6))))
+
+(deftest test-get-last-line
+  (let [test-data "This is some
+                  multi-line
+                  text.
+                  Enjoy!"]
+    (is (= "Enjoy!" (util/get-last-line test-data)))))
+
+(deftest test-user-agent
+  (is (= "clj-simulacrum v0.2-dev (https://github.com/oubiwann/clj-simulacrum)"
+         util/user-agent)))
+
+(deftest test-ua-headers
+  (is (= {:headers
+          {"User-Agent"
+           "clj-simulacrum v0.2-dev (https://github.com/oubiwann/clj-simulacrum)"}}
+         util/ua-headers)))
+
+(deftest test-remove-spaces-and-newlines
+  (let [test-data "This is some \n Enjoy!"]
+    (is (= "This is some Enjoy!" (util/remove-spaces-and-newlines test-data)))))


cleanup

cleanup

--- src/metabase/api/common/throttle.clj
+++ src/metabase/api/common/throttle.clj
@@ -49,21 +49,23 @@
 (declare calculate-delay
          remove-old-attempts)

-(defrecord Throttler [;; Name of the API field/value being checked. Used to generate appropriate API error messages, so they'll be displayed in the
-                      ;; right part of the screen
+(defrecord Throttler [;; Name of the API field/value being checked. Used to generate appropriate API error messages, so
+                      ;; they'll be displayed on the right part of the screen
                       ^Keyword exception-field-key
-                      ;; [Internal] List of attempt entries. These are pairs of [key timestamp (ms)], e.g. ["cam@metabase.com" 1438045261132]
+                      ;; [Internal] List of attempt entries. These are pairs of [key timestamp (ms)],
+                      ;; e.g. ["cam@metabase.com" 1438045261132]
                       ^Atom    attempts
                       ;; Amount of time to keep an entry in ATTEMPTS before dropping it.
                       ^Integer attempt-ttl-ms
                       ;; Number of attempts allowed with a given key before throttling is applied.
                       ^Integer attempts-threshold
-                      ;; Once throttling is in effect, initial delay before allowing another attempt. This grows according to DELAY-EXPONENT.
+                      ;; Once throttling is in effect, initial delay before allowing another attempt. This grows
+                      ;; according to DELAY-EXPONENT.
                       ^Integer initial-delay-ms
                       ;; For each subsequent failure past ATTEMPTS-THRESHOLD, increase the delay by
                       ;; (num-attempts-over-theshold ^ DELAY-EXPONENT). e.g. if `initial-delay-ms` is 15 and
-                      ;; `delay-exponent` is 2, the first attempt past attempts-threshold will require the user to wait 15 seconds (15 * 1^2),
-                      ;; the next attempt after that 60 seconds (15 * 2^2), then 135, and so on.
+                      ;; `delay-exponent` is 2, the first attempt past attempts-threshold will require the user to wait
+                      ;; 15 seconds (15 * 1^2), the next attempt after that 60 seconds (15 * 2^2), then 135, and so on.
                       ^Integer delay-exponent])

 ;; These are made private because you should use `make-throttler` instead.
@@ -109,7 +111,8 @@
   (println "RECENT ATTEMPTS:\n" (metabase.util/pprint-to-str 'cyan @(:attempts throttler))) ;; TODO - remove debug logging
   (remove-old-attempts throttler)
   (when-let [delay-ms (calculate-delay throttler keyy)]
-    (let [message (format "Too many attempts! You must wait %d seconds before trying again." (int (math/round (/ delay-ms 1000))))]
+    (let [message (format "Too many attempts! You must wait %d seconds before trying again."
+                          (int (math/round (/ delay-ms 1000))))]
       (throw (ex-info message {:status-code 400
                                :errors      {exception-field-key message}}))))
   (swap! attempts conj [keyy (System/currentTimeMillis)]))


Describe tests

Describe tests

--- test/warehouse/util_test.cljs
+++ test/warehouse/util_test.cljs
@@ -4,25 +4,27 @@
   (:require [warehouse.util :as util]))

 (deftest map-diff-test
-  (is (empty? (util/map-diff {} {})))
-  (is (empty? (util/map-diff {:a "a"
-                              :b "b"}
-                             {:a "a"
-                              :b "b"})))
-  (is (= {:a ["a" "new-a"]
-          :c ["c" nil]}
-         (util/map-diff {:a "a"
-                         :b "b"
-                         :c "c"}
-                        {:a "new-a"
-                         :b "b"})))
-  (is (= {:a ["old-a" "a"]
-          :c [nil "c"]}
-         (util/map-diff {:a "old-a"
-                         :b "b"}
-                        {:a "a"
-                         :b "b"
-                         :c "c"}))))
+  (testing "same maps"
+    (is (empty? (util/map-diff {} {})))
+    (is (empty? (util/map-diff {:a "a"
+                                :b "b"}
+                               {:a "a"
+                                :b "b"}))))
+  (testing "different maps"
+    (is (= {:a ["a" "new-a"]
+            :c ["c" nil]}
+           (util/map-diff {:a "a"
+                           :b "b"
+                           :c "c"}
+                          {:a "new-a"
+                           :b "b"})))
+    (is (= {:a ["old-a" "a"]
+            :c [nil "c"]}
+           (util/map-diff {:a "old-a"
+                           :b "b"}
+                          {:a "a"
+                           :b "b"
+                           :c "c"})))))

 (deftest revert-changes-test
   (is (= {:a "a" :b "b" :c "c"}
@@ -45,20 +47,21 @@
                                :amount-min [1 10]}))))

 (deftest get-change-set-test
-  (is (empty? (util/get-change-set {} {})))
-  (is (empty? (util/get-change-set {0 {:id 0
-                                       :name "first"
-                                       :k "v"}
-                                    1 {:id 1
-                                       :name "second"
-                                       :k "c"}}
-
-                                   {0 {:id 0
-                                       :name "first"
-                                       :k "v"}
-                                    1 {:id 1
-                                       :name "second"
-                                       :k "c"}})))
+  (testing "sampe maps"
+    (is (empty? (util/get-change-set {} {})))
+    (is (empty? (util/get-change-set {0 {:id 0
+                                         :name "first"
+                                         :k "v"}
+                                      1 {:id 1
+                                         :name "second"
+                                         :k "c"}}
+
+                                     {0 {:id 0
+                                         :name "first"
+                                         :k "v"}
+                                      1 {:id 1
+                                         :name "second"
+                                         :k "c"}}))))
   (is (= [{:type :update
            :data [{:metadata {:id 0
                              :name "first"}
@@ -75,7 +78,8 @@
                                   :k "v-updated"}
                                1 {:id 1
                                   :name "second"
-                                  :k "c"}})))
+                                  :k "c"}}))
+      "single update")
   (is (= [{:type :update
            :data [{:metadata {:id 0
                               :name "first"}
@@ -95,7 +99,8 @@
                                   :k "v-updated"}
                                1 {:id 1
                                   :name "second"
-                                  :k "c-updated"}})))
+                                  :k "c-updated"}}))
+      "double update")
   (is (= [{:type :create
            :data [{:metadata {:id 1
                               :name "second"}
@@ -111,7 +116,8 @@
                                   :k "v"}
                                1 {:id 1
                                   :name "second"
-                                  :k "k-created"}})))
+                                  :k "k-created"}}))
+      "single create")
   (is (= [{:type :create
            :data [{:metadata {:id 1
                               :name "second"}
@@ -135,7 +141,8 @@
                                   :k "k-created1"}
                                2 {:id 2
                                   :name "third"
-                                  :k "k-created2"}})))
+                                  :k "k-created2"}}))
+      "double create")
   (is (= [{:type :create
            :data [{:metadata {:id 2
                               :name "third"}
@@ -161,7 +168,8 @@
                                   :k "k-updated"}
                                2 {:id 2
                                   :name "third"
-                                  :k "k-created"}}))))
+                                  :k "k-created"}}))
+      "create and update"))

 (deftest string->array-test
   (is (= (util/string->array "a, b ,c, a")
@@ -175,26 +183,27 @@
   (is (= {:components {}
           :notifications []}
          (util/document->state {:components []}
-                          {:components []
-                           :notifications []})))
+                               {:components []
+                                :notifications []}))
+         "empty components")
   (is (= {:components {2 {:id 2
-                       :name "second-component"
-                       :tags #{"component"}
-                       :amount 3}}
+                          :name "second-component"
+                          :tags #{"component"}
+                          :amount 3}}
           :notifications []}
          (util/document->state {:components [{:id 2
-                                        :name "second-component"
-                                        :tags #{"component"}
-                                        :amount 3}]}
-                          {:components {1 {:id 1
-                                           :name "EPR212A408000Z"
-                                           :tags #{"optocoupler"}
-                                           :amount 7}
-                                        2 {:id 2
-                                           :name "2N3904"
-                                           :tags #{"transistor"}
-                                           :amount 8}}
-                           :notifications []})))
+                                              :name "second-component"
+                                              :tags #{"component"}
+                                              :amount 3}]}
+                               {:components {1 {:id 1
+                                                :name "EPR212A408000Z"
+                                                :tags #{"optocoupler"}
+                                                :amount 7}
+                                             2 {:id 2
+                                                :name "2N3904"
+                                                :tags #{"transistor"}
+                                                :amount 8}}
+                                :notifications []})))
   (testing "vector transforms into set to maintain BC"
     (is (= {:components {2 {:id 2
                             :name "second-component"
@@ -231,7 +240,8 @@
 (deftest merge-documents-test
   (is (= {:components []}
          (util/merge-documents {:components []}
-                               {:components []})))
+                               {:components []}))
+      "empty components")
   (is (= {:components [{:id 1
                         :name "component1"
                         :tags ["tag"]
@@ -241,14 +251,16 @@
                                               :tags ["tag"]
                                               :amount 1}]}
                                {:components [{:name "component1"
-                                              :amount 2}]})))
+                                              :amount 2}]}))
+      "components with the same name")
   (is (= {:components [{:id 1
                        :name "component"
                        :tags []
                        :amount 2}]}
          (util/merge-documents {:components []}
                                {:components [{:name "component"
-                                              :amount 2}]})))
+                                              :amount 2}]}))
+      "new component without tags")
   (is (= {:components [{:id 1
                        :name "component"
                        :tags ["tag"]
@@ -256,7 +268,8 @@
          (util/merge-documents {:components []}
                                {:components [{:name "component"
                                               :tags ["tag"]
-                                              :amount 2}]})))
+                                              :amount 2}]}))
+      "new component with tags")
   (is (= {:components [{:id 1
                        :name "component"
                        :tags []
@@ -270,5 +283,6 @@
                                               :tags []
                                               :amount 2}]}
                                {:components [{:name "imported-component"
-                                             :amount 1}]}))))
-
+                                              :amount 1}]}))
+      "existing and imported components"))
+


Add docstring for schedule? predicate.

Add docstring for schedule? predicate.


heroku deploy

heroku deploy

--- src/cai/outgoing.clj
+++ src/cai/outgoing.clj
@@ -25,7 +25,6 @@
     [{:action "typing_on"}
      {:message (templates/text-message clever_output)}]))

-
 (defn reply-to-image [sender-id image-url]
   (let [days (mod (reduce + (map #(int %) (seq image-url))) (* 3 365))
         date (time/minus (time/now) (time/days days))
@@ -41,7 +40,6 @@
        {:message (templates/image-message url)}
        {:message (templates/text-message url)})]))

-
 (defn reply-to-audio-or-video [sender-id url]
   (let [text (speech-api/stt url)
         cs-old (get-in @user-map [(keyword sender-id) :cs])


don't sequence all channels if the exposure times are different

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

--- acqEngine/src/org/micromanager/sequence_generator.clj
+++ acqEngine/src/org/micromanager/sequence_generator.clj
@@ -53,7 +53,8 @@
            (for [[[d p] s] property-sequences]
              (or (apply = s)
                  (and (core isPropertySequenceable d p)
-                      (<= (count s) (core getPropertySequenceMaxLength d p)))))))))
+                      (<= (count s) (core getPropertySequenceMaxLength d p)))))))
+    (apply == (map :exposure channels))))

 (defn select-triggerable-sequences [property-sequences]
   (into (sorted-map)


Use `concat` instead of `filter identity` on a vec with nils

--- frontend/utils/state.cljs
+++ frontend/utils/state.cljs
@@ -3,29 +3,24 @@
             [frontend.utils.vcs-url :as vcs-url]))

 (defn set-dashboard-crumbs [state {:keys [org repo branch]}]
-  (let [crumbs [(when org {:type :org
-                           :username org})
-                (when repo {:type :project
-                            :username org
-                            :project repo})
-                (when branch {:type :project-branch
-                              :username org
-                              :project repo
-                              :branch branch})]]
-    (if-let [path-crumbs (->> crumbs
-                              (filter identity)
-                              not-empty)]
-      (let [path-crumbs (assoc-in (vec path-crumbs)
-                                  [(-> path-crumbs count dec) :active]
-                                  true)
-            setting-crumb (cond repo {:type :project-settings
-                                      :username org
-                                      :project repo}
-                                org {:type :org-settings
-                                     :username org})
-            all-crumbs (conj path-crumbs setting-crumb)]
-        (assoc-in state state/crumbs-path all-crumbs))
-      state)))
+  (if-let [path-crumbs (seq (concat
+                              (when org {:type :org
+                                         :username org})
+                              (when repo {:type :project
+                                          :username org :project repo})
+                              (when branch {:type :project-branch
+                                            :username org :project repo :branch branch})))]
+    (let [path-crumbs (assoc-in (vec path-crumbs)
+                                [(-> path-crumbs count dec) :active]
+                                true)
+          setting-crumb (cond repo {:type :project-settings
+                                    :username org
+                                    :project repo}
+                              org {:type :org-settings
+                                   :username org})
+          all-crumbs (conj path-crumbs setting-crumb)]
+      (assoc-in state state/crumbs-path all-crumbs))
+      state))

 (defn reset-current-build [state]
   (assoc state :current-build-data {:build nil


Doc tweak.

Doc tweak.

--- src/algebolic/expression/genetics.clj
+++ src/algebolic/expression/genetics.clj
@@ -89,8 +89,8 @@

 (defn ninety-ten-crossover
   "Randomly selects a crossover point in each of the two given trees, and switches the subtrees
-  at these points. The crossover points are selected from the terminal and function nodes with
-  uniform probability 0.10 and 0.90 respectively."
+  at these points. Following Koza, The crossover points are selected from the terminal and function
+  nodes with probability 0.10 and 0.90 respectively."
   [expr1 expr2]
   (let [terminal1 (> (rand) 0.9)
         target1 (if terminal1


Replace hackish generators/shuffle with a fisher-yates implementation

This:

    (sort (fn [_] (long)) coll)

Does not work on JDK7 since TimSort is clever enough to detect that the
ordering function is behaving inconsistently, resulting in:

    java.lang.IllegalArgumentException:
    Comparison method violates its general contract!

Also, this is just a bad idea:

    A variant of the above method that has seen some use in languages
    that support sorting with user-specified comparison functions is
    to shuffle a list by sorting it with a comparison function that
    returns random values. However, this is an extremely bad method:
    it is very likely to produce highly non-uniform distributions,
    which in addition depends heavily on the sorting algorithm used.

    http://en.wikipedia.org/wiki/Fisher–Yates_shuffle#Comparison_with_other_shuffling_algorithms

We can't use clojure.core/shuffle since we want whatever shuffling we
do to be repeatable given the same input and same initial state of the
random number generator.

This patch provides an implementation of the fisher-yates shuffle and
then replaces the body of shuffle with a call to said function.

Signed-off-by: Stuart Halloway <4dc50fc3bc007be011b5445f3f79298b9eeb51b7@thinkrelevance.com>

--- src/main/clojure/clojure/test/generative/generators.clj
+++ src/main/clojure/clojure/test/generative/generators.clj
@@ -274,12 +274,27 @@
   []
   (one-of scalar collection))

+(defn ^:private fisher-yates
+  "http://en.wikipedia.org/wiki/Fisher–Yates_shuffle#The_modern_algorithm"
+  [coll]
+  (let [as (object-array coll)]
+    (loop [i (dec (count as))]
+      (if (<= 1 i)
+        (let [j (uniform 0 (inc i))
+              t (aget as i)]
+          (aset as i (aget as j))
+          (aset as j t)
+          (recur (dec i)))
+        (into (empty coll) (seq as))))))
+
 (defn shuffle
   "Shuffle coll"
   [coll]
-  (sort-by (fn [_] (long)) coll))
-
-
-
-
-
+  ;; using our own fischer-yates instead of core/shuffle so that
+  ;; we'll get the same shuffle, given the same random *seed*.
+  (fisher-yates coll))
+
+
+
+
+


Fix bug relating to rand-nth on empty collection

--- src/robinson/crafting/weapon_gen.clj
+++ src/robinson/crafting/weapon_gen.clj
@@ -150,11 +150,12 @@
   [recipe ns]
   (let [id (keyword ns "id")]
     (log/info "rand-unused-item" (get recipe :items) (get recipe id))
-    (-> recipe
-      :items
-      (->>
-        (remove (fn [{id :item/id}] (contains? (get recipe id #{}) id))))
-      rand-nth)))
+    (let [unused-items (-> recipe
+                        :items
+                        (->>
+                          (remove (fn [{id :item/id}] (contains? (get recipe id #{}) id)))))]
+      (when (seq unused-items)
+        (rand-nth unused-items)))))

 ;; :requirements is a set of any
 ;;  :event/id
@@ -764,15 +765,17 @@
     (log/info "remedies debuffs" debuffs)
     ; slowdown
     ; push through
-    (if-let [debuff (rand-nth debuffs)]
-      [{:title "Remedy"
-        :description "You think you can fix a problem with this item."
-        :event/choices [
-          {:hotkey \a
-           :name (str "fix " (rcmp/full-name debuff))
-           :choice/one-of [(rce/mod-remove-effect debuff)]}
-          {:name "skip"
-           :hotkey :space}]}]
+    (if (seq debuffs)
+      (if-let [debuff (when (seq debuffs) (rand-nth debuffs))]
+        [{:title "Remedy"
+          :description "You think you can fix a problem with this item."
+          :event/choices [
+            {:hotkey \a
+             :name (str "fix " (rcmp/full-name debuff))
+             :choice/one-of [(rce/mod-remove-effect debuff)]}
+            {:name "skip"
+             :hotkey :space}]}]
+        [])
       [])))

 (defn gen-remedy [state recipe]


[#10439] Fix transaction signing after tapping wrong card

--- src/status_im/hardwallet/common.cljs
+++ src/status_im/hardwallet/common.cljs
@@ -427,11 +427,15 @@
 (fx/defn on-get-application-info-error
   {:events [:hardwallet.callback/on-get-application-info-error]}
   [{:keys [db] :as cofx} error]
-  (log/debug "[hardwallet] application info error " error)
-  (let [on-card-read      (get-in db [:hardwallet :on-card-read])
-        on-card-connected (get-in db [:hardwallet :on-card-connected])
-        login?            (= on-card-read :hardwallet/login-with-keycard)
-        tag-was-lost?     (tag-lost? (:error error))]
+  (let [on-card-read           (get-in db [:hardwallet :on-card-read])
+        on-card-connected      (get-in db [:hardwallet :on-card-connected])
+        last-on-card-connected (get-in db [:hardwallet :last-on-card-connected])
+        login?                 (= on-card-read :hardwallet/login-with-keycard)
+        tag-was-lost?          (tag-lost? (:error error))]
+    (log/debug "[hardwallet] application info error"
+               error
+               on-card-connected
+               last-on-card-connected)
     (when-not tag-was-lost?
       (if login?
         (fx/merge cofx
@@ -440,7 +444,9 @@
         (fx/merge cofx
                   {:db (assoc-in db [:hardwallet :application-info-error] error)}

-                  (when (= on-card-connected :hardwallet/prepare-to-sign)
+                  (when (contains?
+                         #{last-on-card-connected on-card-connected}
+                         :hardwallet/prepare-to-sign)
                     (show-wrong-keycard-alert true))

                   (when on-card-read


back to infura

back to infura

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

--- src/status_im/utils/contenthash.cljs
+++ src/status_im/utils/contenthash.cljs
@@ -58,7 +58,7 @@
 (defn url [hex]
   (let [{:keys [namespace hash]} (decode (ethereum/normalized-hex hex))]
     (case namespace
-      :ipfs (str "https://cloudflare-ipfs.com/ipfs/" hash)
+      :ipfs (str "https://ipfs.infura.io/ipfs/" hash)
       "")))

 (fx/defn cat


cleanup

cleanup

--- src/tailrecursion/boot/gitignore.clj
+++ src/tailrecursion/boot/gitignore.clj
@@ -29,23 +29,24 @@
     (Matcher. negated? (fn [f] (.matches m (.toPath (.getCanonicalFile f)))))))

 (defn parse-gitignore1 [pattern base]
-  (let [base  (if (.endsWith base "/") base (str base "/"))
-        strip #(replace % #"^/*" "")
-        pat   (atom pattern)
-        mat   (atom [])
+  (let [base    (if (.endsWith base "/") base (str base "/"))
+        strip   #(replace % #"^/*" "")
+        pat     (atom pattern)
+        mat     (atom [])
         [negated? end-slash? has-slash? lead-slash? lead-asts? end-ast?]
         (map #(fn [] (re-find % @pat)) [#"^!" #"/$" #"/" #"^/" #"^\*\*/" #"/\*$"])
-        neg?  (negated?)
-        dir?  (end-slash?)]
+        neg?    (negated?)
+        dir?    (end-slash?)
+        matcher #(path-matcher (apply str base %&))]
     (when (negated?) (swap! pat replace #"^!" ""))
     (when (end-slash?) (swap! pat replace #"/*$" ""))
     (if-not (has-slash?)
-      (swap! mat into (map path-matcher [(str base @pat) (str base "**/" @pat)]))
-      (swap! mat conj (path-matcher (str base (strip @pat)))))
+      (swap! mat into (map matcher [@pat (str "**/" @pat)]))
+      (swap! mat conj (matcher (strip @pat))))
     (when (lead-asts?)
-      (swap! mat conj (path-matcher (str base (strip (subs @pat 3))))))
+      (swap! mat conj (matcher (strip (subs @pat 3)))))
     (when (end-ast?)
-      (swap! mat conj (path-matcher (str base (strip @pat) "*"))))
+      (swap! mat conj (matcher (strip @pat) "*")))
     (Matcher. neg?  (fn [f] (and (or (not dir?) (.isDirectory f))
                                  (some #(-matches? % f) @mat))))))


Create initial quests-records when a user is created

--- src/braid/server/db/user.clj
+++ src/braid/server/db/user.clj
@@ -3,7 +3,8 @@
             [clojure.edn :as edn]
             [clojure.string :as string]
             [crypto.password.scrypt :as password]
-            [braid.server.db.common :refer :all]))
+            [braid.server.db.common :refer :all]
+            [braid.server.quests.db :refer [activate-first-quests!]]))

 (defn email-taken?
   [conn email]
@@ -12,13 +13,15 @@
 (defn create-user!
   "creates a user, returns id"
   [conn {:keys [id email avatar nickname password]}]
-  (->> {:user/id id
-        :user/email email
-        :user/avatar avatar
-        :user/nickname (or nickname (-> email (string/split #"@") first))
-        :user/password-token (password/encrypt password)}
-       (create-entity! conn)
-       db->user))
+  (let [user (->> {:user/id id
+                   :user/email email
+                   :user/avatar avatar
+                   :user/nickname (or nickname (-> email (string/split #"@") first))
+                   :user/password-token (password/encrypt password)}
+                  (create-entity! conn)
+                  db->user)
+        _ (activate-first-quests! conn id)]
+    user))

 (defn create-oauth-user!
   "Create a user that logins via oauth (and hence has no password)"


Adds link to source and documentation is navbar.

--- src/cadence/views/common.clj
+++ src/cadence/views/common.clj
@@ -71,7 +71,9 @@
          (when (not (friend/anonymous?))
            [:li
             [:a {:href "/user/training"} "Training"]])
-         [:li [:a {:href "/about"} "About"]]]
+         [:li [:a {:href "/about"} "About"]]
+         [:li [:a {:href "/docs/index.html"} "Documentation"]]
+         [:li [:a {:href "https://github.com/RyanMcG/Cadence"} "Source"]]]
         [:ul.nav.pull-right
          [:li.divider-vertical]
          (user-links)]


Changed to also update parent id

Changed to also update parent id

--- src/clj/bookmarx/handler.clj
+++ src/clj/bookmarx/handler.clj
@@ -133,9 +133,9 @@
     ;; Change the fields in the bookmark.
     (swap! bookmarks update id
            #(merge % (if url
-                       (select-keys bookmark [:bookmark/title :bookmark/url :bookmark/rating
-                                              :bookmark/icon :bookmark/icon-color])
-                       (select-keys bookmark [:bookmark/title]))))
+                       (select-keys bookmark [:bookmark/parent-id :bookmark/title :bookmark/url
+                                              :bookmark/rating :bookmark/icon :bookmark/icon-color])
+                       (select-keys bookmark [:bookmark/parent-id :bookmark/title]))))

     ;; Add the link count to the ancestors.
     (dorun (map #(when (get-in @bookmarks [% :bookmark/link-count])


remove IAM service call from ECR linking process in order to link registry with iam r/o permissions only #236

--- src/clj/swarmpit/handler.clj
+++ src/clj/swarmpit/handler.clj
@@ -482,10 +482,7 @@
                                                   :type "ecr")]
       (try
         (let [url (:proxyEndpoint (api/ecr-token payload))
-              user (:UserName (api/ecr-user payload))
-              response (api/create-ecr (-> payload
-                                           (assoc :user user)
-                                           (assoc :url url)))]
+              response (api/create-ecr (assoc payload :url url))]
           (if (some? response)
             (resp-created (select-keys response [:id]))
             (resp-error 400 "AWS Registry already exist")))
@@ -497,10 +494,7 @@
     (let [payload (keywordize-keys params)]
       (try
         (let [url (:proxyEndpoint (api/ecr-token payload))
-              user (:UserName (api/ecr-user payload))
-              delta-payload (-> payload
-                                (assoc :user user)
-                                (assoc :url url))]
+              delta-payload (assoc payload :url url)]
           (api/update-ecr (:id route-params) delta-payload)
           (resp-ok))
         (catch Exception e


Don't just cache everything

Don't just cache everything

--- src/clj_crud/system/ring.clj
+++ src/clj_crud/system/ring.clj
@@ -87,17 +87,13 @@
                     anti-forgery/wrap-anti-forgery
                     flash/wrap-flash
                     ;; todo put this in db / split flash / account-session store?
-                    (session/wrap-session {:cookie-name "clj-crud-site"
+                    (session/wrap-session {:cookie-name "ccs"
                                            :store (session-cookie/cookie-store)})
                     keyword-params/wrap-keyword-params
                     params/wrap-params
                     (resource/wrap-resource "/")
                     file-info/wrap-file-info
                     content-type/wrap-content-type
-                    ((fn [handler]
-                       (fn [req]
-                         (-> (handler req)
-                             (update-in [:headers] merge {"Cache-Control" "public, max-age=31536000"})))))
                     wrap-accept-uri
                     wrap-redirect-trailing-slash
                     wrap-stacktrace-to-log)]


export data as tsv

export data as tsv

--- src/clojento/views/admin.clj
+++ src/clojento/views/admin.clj
@@ -82,3 +82,13 @@
 		[:tbody (map job-line clojento.models.scheduler/jobs) ]
 		]))

+(defn job-values [job]
+	(clojure.string/join "\t" (map job [:id :code :status :created_at :scheduled_at :executed_at :finished_at])))
+
+(defpage "/data/jobs.tsv" {} (noir.response/content-type "text/tab-separated-values; charset=utf-8"
+	(clojure.string/join "\n"
+		(cons
+			(clojure.string/join "\t" ["id" "code" "status" "created_at" "scheduled_at" "executed_at" "finished_at"])
+			(map job-values clojento.models.scheduler/jobs)))))
+
+


Reverted ordering change.

Reverted ordering change.

--- src/cmr/http/kit/request.clj
+++ src/cmr/http/kit/request.clj
@@ -58,8 +58,10 @@

 (defn request
   [method url req options callback]
-  (httpc/request (-> req
-                     (merge options)
+  ;; WARNING: Don't switch the order ot options/req below, otherwise
+  ;;          CMR OPeNDAP will break!
+  (httpc/request (-> options
+                     (merge req)
                      (assoc :url url :method method)
                      ((fn [x] (log/trace "Options to httpc:" x) x)))
                   callback))


Reverting camel snake kebab verison due to uberjar issue.

--- src/cmr/spatial/messages.clj
+++ src/cmr/spatial/messages.clj
@@ -1,6 +1,6 @@
 (ns cmr.spatial.messages
   "Contains error messages for spatial validation."
-  (:require [camel-snake-kebab.core :as csk]
+  (:require [camel-snake-kebab :as csk]
             [cmr.common.util :as u]
             [pjstadig.assertions :as pj]
             [clojure.string :as str]))


Make rethinkdb start to build, at least.

Get more information on failure.
Use the results of actions properly.
Don't let git write to stderr when nothing is wrong.

--- src/circle/proto.clj
+++ src/circle/proto.clj
@@ -9,6 +9,7 @@
   (:import org.xeustechnologies.jtar.TarInputStream)
   (:require [clojure.string :as string])
   (:require [clojure.contrib.seq-utils :as seq-utils])
+  (:use circle.utils.except)
   (:require [fs]))

 (defn strip-dots
@@ -82,8 +83,9 @@
                             (fs/join path name)))))

 (defn shell-out [& args]
-  (if (not= (:exit (apply shell/sh :return-map true args)) 0)
-    (throw (Exception. (str "Failed thing: " args)))))
+  (let [{:keys [out err exit]} (apply shell/sh :return-map true args)]
+    (throw-if-not (and (= exit 0) (= err ""))
+                  (throwf "Failed (%d): %s\n%s\n%s" exit args out err))))

 ; there is a program called autogen.sh on sourceforge that apparently
 ; does magic here
@@ -162,17 +164,18 @@
         (shell-out "mkdir" "-p" dir)
         (shell-out "git" "init" :dir dir)
         (shell-out "git" "remote" "add" "origin" url :dir dir)
-        (shell-out "git" "fetch" "origin" "HEAD" "--depth" "1" :dir dir)
-        (shell-out "git" "pull" "origin" "HEAD" :dir dir)
+        (shell-out "git" "fetch" "origin" "HEAD" "--depth" "1" "-q" :dir dir)
+        (shell-out "git" "pull" "origin" "HEAD" "-q" :dir dir)
         {:srcdir dir}))))

 (defn repo-handler
-  [{:keys [repo subdir] :or {subdir ""}}]
+  [{:keys [repo subdir] :or {subdir ""} :as config}]
   ; if they dont match, return non-nil and try the next one. If they
   ; do match, return the directory the code was checked out into on
   ; success, and raise an exception on failure.
-  (some #(% repo) [try-github try-hg]))
+  (let [{:keys [srcdir]} (some #(% repo) [try-github try-hg])]
+    (into config {:srcdir (fs/join srcdir subdir)})))

 (def handlers [repo-handler autotools-handler])


It's easier to evaluate code from (comment)

--- src/clojars/main.clj
+++ src/clojars/main.clj
@@ -28,5 +28,6 @@
   (admin/init)
   (start-nailgun))

-;; (def server (run-jetty #'clojars-app {:port 8080 :join? false}))
-;; (.stop server)
+(comment
+  (def server (run-jetty #'clojars-app {:port 8080 :join? false}))
+  (.stop server))


missing []

missing []

--- src/clojure/core.clj
+++ src/clojure/core.clj
@@ -15,6 +15,7 @@

 (defn conversation
+  []
   (DDEClientConversation.))

 (defn setTimeout


Fixed could not binding *enable-logging*

--- src/control/core.clj
+++ src/control/core.clj
@@ -359,7 +359,7 @@
                                  " just needs "
                                  task-arg-count
                                  " arguments")))
-               (binding [*enable-logging* (or log true)
+               (binding [*enable-logging* (or log false)
                          *debug* debug]
                  (when *enable-logging*
                    (println  (str bash-bold


Fix links on docsite.

Fix links on docsite.

--- dev-resources/utils/docsite.clj
+++ dev-resources/utils/docsite.clj
@@ -164,20 +164,20 @@
       (mapcat subcat->html (vals subcategories))])))

 (defn generate-index-page [categories-map]
-  (letfn [(fns->html [fns linkify]
-            (map #(vector :p.function (linkify %)) fns))
-
-          (subcat->html [subcat linkify]
-            (cons [:h4.subcategory (linkify (:name subcat))]
-                  (fns->html (:fns subcat) linkify)))
+  (letfn [(fns->html [fns page]
+            (map #(vector :p.function (link % page %)) fns))
+
+          (subcat->html [subcat page]
+            (cons [:h4.subcategory (link (:name subcat) page
+                                         (str (:name subcat) "-subcategory"))]
+                  (fns->html (:fns subcat) page)))

           (category->html [category]
-            (let [{:keys [name fns subcategories]} category
-                  linkify #(link % name %)]
+            (let [{:keys [name fns subcategories]} category]
               [:div.category-div
                [:h3.category (link name)]
-               (fns->html fns linkify)
-               (map #(subcat->html % linkify) (vals subcategories))]))
+               (fns->html fns name)
+               (map #(subcat->html % name) (vals subcategories))]))

           (find-category [name]
             (->> (vals categories-map)


Handle search navigation for namespaces. Fixes #175

--- src/cljs/clojuredocs/mods/search.cljs
+++ src/cljs/clojuredocs/mods/search.cljs
@@ -342,11 +342,11 @@
                                  (dissoc state :search-loading? :ac-results :ac-text :results-empty?))

                ::ac-select (fn [state res]
-                             (if (and (:ns res) (:name res))
-                               (util/navigate-to
-                                 (util/var-path
-                                   (:ns res)
-                                   (:name res)))))
+                             (util/navigate-to
+                               (or (:href res)
+                                   (util/var-path
+                                     (:ns res)
+                                     (:name res)))))
                ::var-search (fn [state text]
                               (util/navigate-to
                                 (str "/search?q=" (util/url-encode text))))})]


Print emails in console when noop is activated.

--- src/uxbox/tasks/emails.clj
+++ src/uxbox/tasks/emails.clj
@@ -52,11 +52,21 @@
   (let [sqlv (sql/mark-email-as-failed {:id id})]
     (sc/execute conn sqlv)))

+(defn- send-email-to-console
+  [{:keys [id data] :as entry}]
+  (println "******** start email:" id "**********")
+  (println (->> (:body data)
+                (filter #(= (:uxbox.emails.core/type %) :text/plain))
+                (first)
+                (:content)))
+  (println "********** end email:" id "**********")
+  {:error :SUCCESS})
+
 (defn- send-email
   [{:keys [id data] :as entry}]
   (let [config (:smtp cfg/config)
         result (if (:noop config)
-                 {:error :SUCCESS}
+                 (send-email-to-console entry)
                  (postal/send-message config data))]
     (if (= (:error result) :SUCCESS)
       (log/debug "Message" id "sent successfully.")


Consistent Learn more popover style on build page

--- src-cljs/frontend/components/pieces/page_header.cljs
+++ src-cljs/frontend/components/pieces/page_header.cljs
@@ -197,11 +197,11 @@
                (popover/tooltip {:body
                                  (html [:span "This build ran on 2.0. "
                                         (let [href "https://circleci.com/docs/2.0/"]
-                                          [:a {:href href
+                                          [:div [:a {:href href
                                                :target "_blank"
                                                :on-click #((om/get-shared owner :track-event) {:event-type :beta-link-clicked
                                                                                :properties {:href href}})}
-                                           "Learn more"])])
+                                                 "Learn more →"]])])
                                  :placement :bottom}
                                (engine-2)))]
             [:.actions actions]]))))))


More lowercase

More lowercase

--- src-cljs/frontend/components/builds_table.cljs
+++ src-cljs/frontend/components/builds_table.cljs
@@ -63,7 +63,7 @@
                                                                :vcs-url vcs-url
                                                                :build-num build-num}])}
              [:img.cancel-icon {:src (common/icon-path "Status-Canceled")}]
-             [:span.cancel-text "Cancel"]]))])]
+             [:span.cancel-text "cancel"]]))])]

      [:div.build-info
       [:div.build-info-header


Adding ability to actual select an osx plan.

--- src-cljs/frontend/components/org_settings.cljs
+++ src-cljs/frontend/components/org_settings.cljs
@@ -307,7 +307,7 @@
   (reify
     om/IRender
     (render [_]
-      (let [currently-selected? (= plan-id (pm/osx-plan-id plan))
+      (let [currently-selected? (= (name plan-id) (pm/osx-plan-id plan))
             updated-selection? (= plan-id chosen-plan-id)
             trial-start? (and trial-start?
                               (not (pm/osx? plan))
@@ -320,9 +320,10 @@
                    updated-selection? "updated-plan"
                    trial-start? "trial-plan")

-             :on-click (if updated-selection?
-                         #(raise! owner [:osx-plan-deselected])
-                         #(raise! owner [:osx-plan-selected {:plan-id plan-id}]))}
+             :on-click (when (not currently-selected?)
+                         (if updated-selection?
+                           #(raise! owner [:osx-plan-deselected])
+                           #(raise! owner [:osx-plan-selected {:plan-id plan-id}])))}
             [:div.header
              [:div.title title]
              [:div.price "$" [:span.bold price] "/mo"]]
@@ -376,7 +377,8 @@
                 :on-click new-plan-fn}
                plan-img])))))))
 (def osx-plans
-  {:ga [{:plan-id :seed
+  {:ga {:seed
+        {:plan-id :seed
          :title "SEED"
          :price 39
          :container-count "2"
@@ -385,6 +387,7 @@
          :support-level "Community support"
          :team-size "1-2"}

+        :startup
         {:plan-id :startup
          :title "STARTUP"
          :price 129
@@ -395,6 +398,7 @@
          :team-size "unlimited"
          :updated-selection? true}

+        :growth
         {:plan-id :growth
          :title "GROWTH"
          :price 249
@@ -405,6 +409,7 @@
          :team-size "unlimited"
          :trial-start? true}

+        :mobile-focused
         {:plan-id :mobile-focused
          :title "MOBILE FOCUSED"
          :price 449
@@ -412,16 +417,25 @@
          :daily-build-count "more than 10"
          :max-minutes "25,000"
          :support-level "Priority support & Account manager"
-         :team-size "unlimited"}]})
+         :team-size "unlimited"}}})

 (defn osx-plans-list-ga [{:keys [plan org-settings]} owner]
   (reify
     om/IRender
     (render [_]
-      (let [osx-plans (->> osx-plans
+      (let [chosen-plan-id (:chosen-osx-plan-id org-settings)
+            chosen-plan (get-in osx-plans [:ga chosen-plan-id])
+            osx-plans (->> osx-plans
                            :ga
+                           (vals)
                            (map (partial merge {:plan plan
-                                                :chosen-plan-id (:chosen-osx-plan-id org-settings)})))]
+                                                :chosen-plan-id chosen-plan-id})))
+
+            new-plan-fn #(raise! owner [:new-osx-plan-clicked
+                                            {:plan-type {:template  (name chosen-plan-id)}
+                                             :price (:price chosen-plan)
+                                             :description (str "OS X " (clojure.string/capitalize (name chosen-plan-id)) " - $" (:price chosen-plan) "/month.")}])
+            update-plan-fn #(raise! owner [:update-osx-plan-clicked {:plan-type {:template (name chosen-plan-id)}}])]
         (html
           [:div.osx-plans {:data-component `osx-plans-list-ga}
            [:fieldset
@@ -430,8 +444,23 @@
            [:div.plan-selection
             (om/build-all osx-plan-ga osx-plans)]
            [:div.update-action
-            [:a.btn.btn-lg.btn-success.center {:disabled (nil? (:chosen-osx-plan-id org-settings))}
-             "Pay Now"]]])))))
+            (if (and (pm/osx? plan) (not (pm/osx-trial-plan? plan)))
+              (forms/managed-button
+                [:a.btn.btn-lg.btn-success.center
+                 {:data-success-text "Success!"
+                  :data-loading-text "Updating..."
+                  :data-failed-text "Failed"
+                  :on-click update-plan-fn
+                  :disabled (nil? chosen-plan-id)}
+                 "Update"])
+              (forms/managed-button
+                [:a.btn.btn-lg.btn-success.center
+                 {:data-success-text "Success!"
+                  :data-loading-text "Paying..."
+                  :data-failed-text "Failed"
+                  :on-click new-plan-fn
+                  :disabled (nil? chosen-plan-id)}
+                 "Pay Now"]))]])))))

 (defn osx-plans-list [plan owner]
   (reify


Fix mismatched close paren

Fix mismatched close paren

--- src/foreclojure/data_set.clj
+++ src/foreclojure/data_set.clj
@@ -684,8 +684,6 @@
             :restricted (map str '[class type Class vector? sequential?
                                    list? seq? map? set? getClass])})

-      )
-
       (insert! :problems
            {:_id 66
             :title "Power Set"


Removed unnecessary code.

Removed unnecessary code.

--- test/snippets/image/pixels.clj
+++ test/snippets/image/pixels.clj
@@ -118,7 +118,6 @@
 (defsnippet filter-shader-s {:renderer :p2d}
   (background 255)
   (let [orig (create-graphics 100 100)
-        dest (create-graphics 100 100)
         shd (load-shader (str (clojure.java.io/resource "SimpleShader.glsl")))]
     (with-graphics orig
       (color-mode :rgb 1.0)
@@ -131,9 +130,8 @@
         (ellipse (* r 100) (* b 100) 10 10)))
     (image orig 0 0)

-    (copy orig dest [0 0 100 100] [0 0 100 100])
     (filter-shader shd)
-    (image dest 100 100)))
+    (image orig 100 100)))

 (defsnippet get-pixel-s {}
   (background 255)


Tests pass

Tests pass

--- src/atom_finder/classifier/type-conversion.clj
+++ src/atom_finder/classifier/type-conversion.clj
@@ -36,73 +36,108 @@

 (def decl-type (into {} (map #(into [] (vals (select-keys % [1 2]))) type-components)))
 (def basic-type (into {} (map #(into [] (vals (select-keys % [0 2]))) type-components)))
+(def all-type (merge decl-type basic-type))

-(defn bit-range [unsigned? bits]
-  (let [signed-range [(->> bits dec (Math/pow 2) bigint -)
-                      (->> bits dec (Math/pow 2) bigint dec)]]
-    (if unsigned?
-      (map #(- % (first signed-range)) signed-range)
-      signed-range)))

-(def RangeSpec [(s/one s/Int "lower") (s/one s/Int "upper")])
-(defmulti type-range "Which values can safely be stored in a variable with this type" class)
-(s/defmethod type-range IBasicType :- RangeSpec [node]
-    (bit-range (.isUnsigned node) (->> node .getKind basic-type :bits)))
-(s/defmethod type-range IASTSimpleDeclSpecifier :- RangeSpec [node]
-    (bit-range (.isUnsigned node) (->> node .getType decl-type :bits)))
+(defmulti unify-type "Go from an arbitrary java node to it's type in clojure data" class)
+(s/defmethod unify-type IBasicType :- (s/maybe TD) [node] (->> node .getKind basic-type))
+(s/defmethod unify-type IASTSimpleDeclSpecifier :- (s/maybe TD) [node] (->> node .getType decl-type))
+(s/defmethod unify-type IASTSimpleDeclaration :- (s/maybe TD) [node] (->> node .getDeclSpecifier unify-type))
+(s/defmethod unify-type IASTExpression :- (s/maybe TD) [node] (->> node .getExpressionType unify-type))
+(s/defmethod unify-type IProblemType [node] nil)
+
+(defmulti unsigned? class)
+(s/defmethod unsigned? IASTSimpleDeclaration [node] (->> node .getDeclSpecifier unsigned?))
+(s/defmethod unsigned? IASTExpression [node] (->> node .getExpressionType unsigned?))
+(s/defmethod unsigned? IProblemType [node] nil) ; tread as false, but that's probably ok
+(s/defmethod unsigned? :default [node] (->> node .isUnsigned))
+
+(s/defn bit-range :- [(s/one s/Int "lower") (s/one s/Int "upper")]
+  "Which values can safely be stored in a variable with this type"
+  ([node :- IASTNode]
+   (bit-range (unsigned? node) (->> node unify-type :bits)))
+  ([unsigned? :- s/Bool bits :- s/Int]
+   (let [signed-range [(->> bits dec (Math/pow 2) bigint -)
+                       (->> bits dec (Math/pow 2) bigint dec)]]
+     (if unsigned?
+       (map #(- % (first signed-range)) signed-range)
+       signed-range))))

 (s/defn type-conversion-declaration? :- s/Bool
   [node :- IASTSimpleDeclaration]
-  (let [context-spec (.getDeclSpecifier node)
-        context-type (->> context-spec .getType decl-type)
-        [context-lower context-upper] (type-range context-spec)
-        arg-exprs (keep #(some->> % .getInitializer .getInitializerClause) (.getDeclarators node))
-        simple-arg-exprs (filter #(not (instance? IASTInitializerList %)) arg-exprs)
-        arg-types (keep #(->> % .getExpressionType .getKind basic-type) simple-arg-exprs)]
+  (let [context-type (->> node unify-type)]
+    (if (nil? context-type)
+      false
+      (let [[context-lower context-upper] (bit-range node)
+            arg-exprs (keep #(some->> % .getInitializer .getInitializerClause) (.getDeclarators node))
+            simple-arg-exprs (filter #(not (instance? IASTInitializerList %)) arg-exprs)
+            arg-types (keep #(->> % .getExpressionType .getKind basic-type) simple-arg-exprs)]

-    (or
-      ; real -> int
-      (and (#{:int} (:number-type context-type))
-           (any-pred? #(#{:real} (:number-type %)) arg-types))
+        (or
+         ; real -> int
+         (and (#{:int} (:number-type context-type))
+              (any-pred? #(#{:real} (:number-type %)) arg-types))

-      ; large -> small
-      ; signed -> unsigned (and the reverse)
-      (any-pred? (fn [[type expr]]
-                   (and (numeric-literal? expr)
-                        (#{:int} (:number-type type))
-                        (not (<= context-lower (parse-numeric-literal expr) context-upper))))
-                 (map vector arg-types arg-exprs))
-  )))
+         ; large -> small
+         ; signed -> unsigned (and the reverse)
+         (any-pred? (fn [[type expr]]
+                      (and (numeric-literal? expr)
+                           (#{:int} (:number-type type))
+                           (not (<= context-lower (parse-numeric-literal expr) context-upper))))
+                    (map vector arg-types arg-exprs))
+         )))))

 (s/defn type-conversion-assignment? :- s/Bool
   [node :- IASTBinaryExpression]
-  (let [context-exty (->> node .getOperand1 .getExpressionType)
-        context-type (->> context-exty .getKind basic-type)
-        [context-lower context-upper] (type-range context-exty)
-        arg-expr (->> node .getOperand2)
-        arg-exty (->> arg-expr .getExpressionType)
-        arg-type (when-not (instance? IProblemType arg-exty)
-                   (->> arg-exty .getKind basic-type))]
+  (let [context-type (->> node unify-type)]
+    (if (nil? context-type)
+      false
+      (let [[context-lower context-upper] (bit-range node)
+            arg-expr (->> node .getOperand2)
+            arg-type (->> arg-expr unify-type)]

-    (boolean
-     (or
-      ; real -> int
-      (and (#{:int}  (:number-type context-type))
-           (#{:real} (:number-type arg-type)))
+        (boolean
+         (or
+                                        ; real -> int
+          (and (#{:int}  (:number-type context-type))
+               (#{:real} (:number-type arg-type)))

-      ; large -> small
-      ; signed -> unsigned (and the reverse)
-      (and (numeric-literal? arg-expr)
-           (#{:int} (:number-type arg-type))
-           (not (<= context-lower (parse-numeric-literal arg-expr) context-upper)))))
-  ))
+                                        ; large -> small
+                                        ; signed -> unsigned (and the reverse)
+          (and (numeric-literal? arg-expr)
+               (#{:int} (:number-type arg-type))
+               (not (<= context-lower (parse-numeric-literal arg-expr) context-upper)))))
+        ))))

-(->> "int main() { unsigned int V1; V1 = -2; }"
+;(s/defn type-conversion-declaration? :- s/Bool
+;  [node :- IASTSimpleDeclaration]
+;  (let [context-type (->> node unify-type)
+;        arg-exprs (->> node unify-args-types)]
+;    (if (nil? unify-type)
+;      false
+;      (let [[context-lower context-upper] (bit-range node)
+;            simple-arg-exprs (filter #(not (instance? IASTInitializerList %)) arg-exprs)
+;            arg-types (keep #(->> % .getExpressionType .getKind basic-type) simple-arg-exprs)]
+;
+;        (or
+;         ; real -> int
+;         (and (#{:int} (:number-type context-type))
+;              (any-pred? #(#{:real} (:number-type %)) arg-types))
+;
+;         ; large -> small
+;         ; signed -> unsigned (and the reverse)
+;         (any-pred? (fn [[type expr]]
+;                      (and (numeric-literal? expr)
+;                           (#{:int} (:number-type type))
+;                           (not (<= context-lower (parse-numeric-literal expr) context-upper))))
+;                    (map vector arg-types arg-exprs))
+;         )))))
+
+(->> "int main() { unsigned int V1; V2 = -2; }"
     parse-source
     (get-in-tree [0 2 1 0]) ;.getOperand1 .getExpressionType type-range
     type-conversion-assignment?
     )
-

 ; https://www.safaribooksonline.com/library/view/c-in-a/0596006977/ch04.html
 (s/defn type-conversion-atom? :- s/Bool


Simplified app state update

Simplified app state update

But still WIP

--- src/cljs/funnel_front/actions/app_actions.cljs
+++ src/cljs/funnel_front/actions/app_actions.cljs
@@ -5,15 +5,12 @@

 (defn update-app-state [event]
-  (let [data (.parse js/JSON (.-data event))
-        queries (.-queries data)
-        body (.parse js/JSON (.-body data))]
-    (.log js/console data)
-    (.log js/console "first match :" (.-id (first queries)))
-    (swap! app-state
-           update-in
-           [:queries (keyword (.-id (first queries))) :items]
-           conj {:body (js->clj body)})
-    (.log js/console @app-state)
-    ))
-
+  (let [data (->> event (.-data) (js->clj) )]
+    (clog! data)
+    ;; app state update is in work in progress
+    #_(swap! app-state
+             update-in
+             [:queries (keyword (.-id (first queries))) :items]
+             conj {:body (js->clj body)})
+    )
+  )


remove invalid config info

remove invalid config info

--- src/cljs/swarmpit/component/config/create.cljs
+++ src/cljs/swarmpit/component/config/create.cljs
@@ -87,7 +87,6 @@
             :primary    true
             :onTouchTap create-config-handler}))]]
      [:div.form-edit
-      (form/icon-value icon/info "Data must be base64 encoded. If plain text check please encode data.")
       (form/form
         {:onValid   #(reset! isValid true)
          :onInvalid #(reset! isValid false)}


Accept keyword keys as variable name #46

--- src/graphql_clj/executor.clj
+++ src/graphql_clj/executor.clj
@@ -157,7 +157,7 @@
   ([context schema resolver-fn [statement-errors document] variables]
    (if (seq statement-errors)
      {:errors statement-errors}
-     (execute-document document {:variables variables
+     (execute-document document {:variables (clojure.walk/stringify-keys variables)
                                  :context context
                                  :schema schema
                                  :resolver (resolver/create-resolver-fn schema resolver-fn)})))


adding some temp worker values

adding some temp worker values

--- src/hivewing_core/worker.clj
+++ src/hivewing_core/worker.clj
@@ -64,6 +64,7 @@
                             :apiary_uuid (ensure-uuid apiary-uuid)
                             :name  (or worker-name (namer/gen-name)))]
     (let [res (first (jdbc/insert! sql-db :workers clean-params))]
+      (worker-config-set (:uuid res) {".tasks" ["workera" "workerb"]})
       (hin/hive-images-notification-send-worker-update-message (:uuid res))
       res)))


Don't block internally for HTTP

Don't block internally for HTTP

--- src/icecap/handlers/http.clj
+++ src/icecap/handlers/http.clj
@@ -1,7 +1,6 @@
 (ns icecap.handlers.http
   (:require [schema.core :as s]
             [aleph.http :refer [request]]
-            [clojure.core.async :refer [to-chan]]
             [icecap.handlers.core :refer [defstep]]
             [manifold.stream :refer [connect]]
             [schema-contrib.core :as sc]
@@ -35,5 +34,4 @@
          'valid-url?)
    :method (s/enum :GET :POST :DELETE :PUT :PATCH :HEAD)}
   [step]
-  (let [req (spy (request step))]
-    (to-chan [(spy @req)])))
+  (request step))


Fix load generation fns.

Fix load generation fns.

--- src/dsbdp/experiment_helper.clj
+++ src/dsbdp/experiment_helper.clj
@@ -133,53 +133,53 @@
    (fn [_ out] (phrases out))])

 (def synthetic-low-throughput-self-adaptivity-processing-fns
-  [(fn [_ _] (dsbdp.ExperimentHelper/busySleep 200000))
-   (fn [_ _] (dsbdp.ExperimentHelper/busySleep 100000))
-   (fn [_ _] (dsbdp.ExperimentHelper/busySleep 100000))
-   (fn [_ _] (dsbdp.ExperimentHelper/busySleep  50000))
-   (fn [_ _] (dsbdp.ExperimentHelper/busySleep  50000))
-   (fn [_ _] (dsbdp.ExperimentHelper/busySleep  50000))
-   (fn [_ _] (dsbdp.ExperimentHelper/busySleep  50000))
-   (fn [_ _] (dsbdp.ExperimentHelper/busySleep  25000))
-   (fn [_ _] (dsbdp.ExperimentHelper/busySleep  25000))
-   (fn [_ _] (dsbdp.ExperimentHelper/busySleep  25000))
-   (fn [_ _] (dsbdp.ExperimentHelper/busySleep  20500))
-   (fn [_ _] (dsbdp.ExperimentHelper/busySleep  25000))
-   (fn [_ _] (dsbdp.ExperimentHelper/busySleep  25000))
-   (fn [_ _] (dsbdp.ExperimentHelper/busySleep  25000))
-   (fn [_ _] (dsbdp.ExperimentHelper/busySleep  25000))])
+  [(fn [i _] (dsbdp.ExperimentHelper/busySleep 200000) i)
+   (fn [_ o] (dsbdp.ExperimentHelper/busySleep 100000) o)
+   (fn [_ o] (dsbdp.ExperimentHelper/busySleep 100000) o)
+   (fn [_ o] (dsbdp.ExperimentHelper/busySleep  50000) o)
+   (fn [_ o] (dsbdp.ExperimentHelper/busySleep  50000) o)
+   (fn [_ o] (dsbdp.ExperimentHelper/busySleep  50000) o)
+   (fn [_ o] (dsbdp.ExperimentHelper/busySleep  50000) o)
+   (fn [_ o] (dsbdp.ExperimentHelper/busySleep  25000) o)
+   (fn [_ o] (dsbdp.ExperimentHelper/busySleep  25000) o)
+   (fn [_ o] (dsbdp.ExperimentHelper/busySleep  25000) o)
+   (fn [_ o] (dsbdp.ExperimentHelper/busySleep  20500) o)
+   (fn [_ o] (dsbdp.ExperimentHelper/busySleep  25000) o)
+   (fn [_ o] (dsbdp.ExperimentHelper/busySleep  25000) o)
+   (fn [_ o] (dsbdp.ExperimentHelper/busySleep  25000) o)
+   (fn [_ o] (dsbdp.ExperimentHelper/busySleep  25000) o)])

 (def synthetic-average-throughput-self-adaptivity-processing-fns
-  [(fn [_ _] (dsbdp.ExperimentHelper/busySleep 20000))
-   (fn [_ _] (dsbdp.ExperimentHelper/busySleep 10000))
-   (fn [_ _] (dsbdp.ExperimentHelper/busySleep 10000))
-   (fn [_ _] (dsbdp.ExperimentHelper/busySleep  5000))
-   (fn [_ _] (dsbdp.ExperimentHelper/busySleep  5000))
-   (fn [_ _] (dsbdp.ExperimentHelper/busySleep  5000))
-   (fn [_ _] (dsbdp.ExperimentHelper/busySleep  5000))
-   (fn [_ _] (dsbdp.ExperimentHelper/busySleep  2500))
-   (fn [_ _] (dsbdp.ExperimentHelper/busySleep  2500))
-   (fn [_ _] (dsbdp.ExperimentHelper/busySleep  2500))
-   (fn [_ _] (dsbdp.ExperimentHelper/busySleep  2500))
-   (fn [_ _] (dsbdp.ExperimentHelper/busySleep  2500))
-   (fn [_ _] (dsbdp.ExperimentHelper/busySleep  2500))
-   (fn [_ _] (dsbdp.ExperimentHelper/busySleep  2500))
-   (fn [_ _] (dsbdp.ExperimentHelper/busySleep  2500))])
+  [(fn [i _] (dsbdp.ExperimentHelper/busySleep 20000) i)
+   (fn [_ o] (dsbdp.ExperimentHelper/busySleep 10000) o)
+   (fn [_ o] (dsbdp.ExperimentHelper/busySleep 10000) o)
+   (fn [_ o] (dsbdp.ExperimentHelper/busySleep  5000) o)
+   (fn [_ o] (dsbdp.ExperimentHelper/busySleep  5000) o)
+   (fn [_ o] (dsbdp.ExperimentHelper/busySleep  5000) o)
+   (fn [_ o] (dsbdp.ExperimentHelper/busySleep  5000) o)
+   (fn [_ o] (dsbdp.ExperimentHelper/busySleep  2500) o)
+   (fn [_ o] (dsbdp.ExperimentHelper/busySleep  2500) o)
+   (fn [_ o] (dsbdp.ExperimentHelper/busySleep  2500) o)
+   (fn [_ o] (dsbdp.ExperimentHelper/busySleep  2500) o)
+   (fn [_ o] (dsbdp.ExperimentHelper/busySleep  2500) o)
+   (fn [_ o] (dsbdp.ExperimentHelper/busySleep  2500) o)
+   (fn [_ o] (dsbdp.ExperimentHelper/busySleep  2500) o)
+   (fn [_ o] (dsbdp.ExperimentHelper/busySleep  2500) o)])

 (def synthetic-high-throughput-self-adaptivity-processing-fns
-  [(fn [_ _] (dsbdp.ExperimentHelper/busySleep 5000))
-   (fn [_ _] (dsbdp.ExperimentHelper/busySleep 2500))
-   (fn [_ _] (dsbdp.ExperimentHelper/busySleep 2500))
-   (fn [_ _] (dsbdp.ExperimentHelper/busySleep 1250))
-   (fn [_ _] (dsbdp.ExperimentHelper/busySleep 1250))
-   (fn [_ _] (dsbdp.ExperimentHelper/busySleep 1250))
-   (fn [_ _] (dsbdp.ExperimentHelper/busySleep 1250))
-   (fn [_ _] (dsbdp.ExperimentHelper/busySleep  625))
-   (fn [_ _] (dsbdp.ExperimentHelper/busySleep  625))
-   (fn [_ _] (dsbdp.ExperimentHelper/busySleep  625))
-   (fn [_ _] (dsbdp.ExperimentHelper/busySleep  625))
-   (fn [_ _] (dsbdp.ExperimentHelper/busySleep  625))
-   (fn [_ _] (dsbdp.ExperimentHelper/busySleep  625))
-   (fn [_ _] (dsbdp.ExperimentHelper/busySleep  625))
-   (fn [_ _] (dsbdp.ExperimentHelper/busySleep  625))])
+  [(fn [i _] (dsbdp.ExperimentHelper/busySleep 5000) i)
+   (fn [_ o] (dsbdp.ExperimentHelper/busySleep 2500) o)
+   (fn [_ o] (dsbdp.ExperimentHelper/busySleep 2500) o)
+   (fn [_ o] (dsbdp.ExperimentHelper/busySleep 1250) o)
+   (fn [_ o] (dsbdp.ExperimentHelper/busySleep 1250) o)
+   (fn [_ o] (dsbdp.ExperimentHelper/busySleep 1250) o)
+   (fn [_ o] (dsbdp.ExperimentHelper/busySleep 1250) o)
+   (fn [_ o] (dsbdp.ExperimentHelper/busySleep  625) o)
+   (fn [_ o] (dsbdp.ExperimentHelper/busySleep  625) o)
+   (fn [_ o] (dsbdp.ExperimentHelper/busySleep  625) o)
+   (fn [_ o] (dsbdp.ExperimentHelper/busySleep  625) o)
+   (fn [_ o] (dsbdp.ExperimentHelper/busySleep  625) o)
+   (fn [_ o] (dsbdp.ExperimentHelper/busySleep  625) o)
+   (fn [_ o] (dsbdp.ExperimentHelper/busySleep  625) o)
+   (fn [_ o] (dsbdp.ExperimentHelper/busySleep  625) o)])


[#226] s/when/if

[#226] s/when/if

--- api/src/clojure/org/akvo/flow_api/unilog/unilog.clj
+++ api/src/clojure/org/akvo/flow_api/unilog/unilog.clj
@@ -26,7 +26,7 @@

 (defn event-log-spec [config]
   (assert (not (empty? config)) "Config map is empty")
-  (when-let [cloud-sql-instance (config :cloud-sql-instance)]
+  (if-let [cloud-sql-instance (config :cloud-sql-instance)]
     {:subprotocol "postgresql"
      :subname (format "//any:5432/%s" (config :db-name))
      :ssl false


Added DBMS configuration.

Added DBMS configuration.

--- src/forumdb/core.clj
+++ src/forumdb/core.clj
@@ -1,5 +1,5 @@
 (ns forumdb.core
-  (:import [org.hypergraphdb HGEnvironment HGHandle HGPlainLink HGQuery$hg HGQuery HGValueLink]
+  (:import [org.hypergraphdb HGEnvironment HGHandle HGPlainLink HGQuery$hg HGQuery HGValueLink HGConfiguration]
            (java.util Locale TimeZone)
            (java.text SimpleDateFormat)
            (java.io File)
@@ -7,7 +7,9 @@
            (org.joda.time DateTime)
            (org.hypergraphdb.atom HGRel HGRelType)
            (org.hypergraphdb.query HGQueryCondition AtomPartRegExPredicate)
-           (java.util.regex Pattern))
+           (java.util.regex Pattern)
+           (org.hypergraphdb.indexing ByPartIndexer)
+           (org.hypergraphdb.handle SequentialUUIDHandleFactory))
   (:require [clojure.string :as string]
             [clojure.xml :as xml]
             [clj-time.format :as f]
@@ -35,7 +37,13 @@
   Creates a database or opens existing one from the folder specified by argument
   "
   [path]
-  (let [dbinstance (HGEnvironment/get path)]
+  (def config (HGConfiguration.))
+  (def handleFactory (SequentialUUIDHandleFactory. (System/currentTimeMillis) 0))
+  (. config setHandleFactory handleFactory)
+  (. config setTransactional false)
+  (def storeConfig (. (. config getStoreImplementation) getConfiguration))
+  (. (. storeConfig getEnvironmentConfig) setCacheSize (* (* 1024 1024) 500))
+  (let [dbinstance (HGEnvironment/get path config)]
     (reset! database dbinstance)))

 (defn close-database
@@ -83,6 +91,10 @@
     (def topType (. (. @database getTypeSystem) getTop))
     (def userThreadRelType (HGQuery$hg/assertAtom @database (HGRelType. "user-thread" (into-array HGHandle [topType topType]))))
     ;(def userPostRelType (HGQuery$hg/assertAtom @database (HGRelType. "user-post" (into-array HGHandle [topType topType]))))
+
+    ;(def postTypeHandle (. (. @database getTypeSystem) getTypeHandle Post))
+    ;(. (. @database getIndexManager) register (ByPartIndexer. postTypeHandle, "content"))
+    ;(. @database runMaintenance)

     (if (= database-exists 0)
       (do


Refer clojure.string as str

Refer clojure.string as str

--- src/github_changelog/semver.clj
+++ src/github_changelog/semver.clj
@@ -1,6 +1,6 @@
 (ns github-changelog.semver
   (:require [clj-semver.core :as semver]
-            [clojure.string :refer [starts-with?]]))
+            [clojure.string :as str]))

 (def newer? semver/newer?)

@@ -10,7 +10,7 @@

 (defn extract [tag-name prefix]
   (parse
-   (if (starts-with? tag-name prefix)
+   (if (str/starts-with? tag-name prefix)
      (subs tag-name (count prefix))
      tag-name)))


Extract big modifier.

Extract big modifier.

--- src/african_polyphony_and_polyrhythm/talk.clj
+++ src/african_polyphony_and_polyrhythm/talk.clj
@@ -121,15 +121,17 @@
     note))

 (def balendoro
-  (->> [tete ta ha tulule bongo
-        (big tete) (big ta) (big ha) (big tulule) (big bongo)
-        (big (big tete)) (big (big ta)) (big (big ha)) (big (big tulule)) (big (big bongo))
-        (big (big (big tete))) (big (big (big ta))) (big (big (big ha)))]
-       (map rand-variations)
-       (map after (range 0 (* 8 18) 8))
-       ;(map first)
-       (reduce with)
-       (map pan)))
+  (let [horns [tete ta ha tulule bongo]]
+    (->> (concat
+           horns
+           (map big horns)
+           (map (comp big big) horns)
+           (map (comp big big big) (take 3 horns)))
+         (map rand-variations)
+         (map after (range 0 (* 8 18) 8))
+         ;(map first)
+         (reduce with)
+         (map pan))))

 (def inverse-pentatonic (comp pentatonic -))


Algorithm and domain seem working (Although not very fast

--- src/angelic/domains/discrete_manipulation.clj
+++ src/angelic/domains/discrete_manipulation.clj
@@ -286,9 +286,12 @@

 (defn reach-to-context
   ([const dst]
-    (into #{[:base] [:gripper-offset]}
-      (for [go (util/safe-get const [:reachable-go])]
-        [:object-at (add-pos dst go)]))))
+     (let [[w h] (util/safe-get const [:size])]
+      (into #{[:base] [:gripper-offset]}
+            (for [go (util/safe-get const [:reachable-go])
+                  :let [[x y :as pos] (add-pos dst go)]
+                  :when (and (<= 0 x w) (<= 0 y h))]
+              [:object-at pos])))))

 (defn manhattan-distance [[x1 y1] [x2 y2]]
   (+ (util/abs (- x1 x2)) (util/abs (- y1 y2))))
@@ -1097,6 +1100,8 @@
 ;;; (make-discrete-manipulation-env [5 5] [1 1] [ [ [2 2] [3 4] ] ] [ [:a [2 2] [ [3 2] [3 3] ] ] [:b [3 2] [ [2 3] [3 3] ] ] [:c [3 3] [ [2 2] [2 3] ] ] [:d [2 4] [ [3 4] [3 4] ] ] ] 1)
 ; (sahucs-flat )

+; (make-discrete-manipulation-env-regions [15 6] [1 1] [ [ [2 2] [12 4] ] ] [ [:a [2 2] [ [3 2] [6 4] ] ] [:b [7 2] [ [8 2] [12 4] ] ] ] 1 15 15 )
+
 ;; (interactive-search (make-implicit-first-ah-a*-env (make-discrete-manipulation-hierarchy (make-discrete-manipulation-env-regions [7 4] [1 1] [[[2 2] [3 3]] [[5 2] [6 3]] ]  [[:a [2 2] [[5 2] [6 3]]] [:b [5 2] [[2 2] [3 3]]]] 1 2 2 1))))

 ; (let [e (make-discrete-manipulation-env-regions [10 10] [1 1] [ [ [4 4] [7 7] ] ] [ [:a [5 5] [ [4 4] [4 4 ] ] ] ] 1 2 2 1) h (make-discrete-manipulation-hierarchy e)] (println (time (run-counted #(uniform-cost-search e)))) (println (time (run-counted #(sahucs-flat h)))))


Removing code accidentally left in during last commit.

--- src/cmr/search/data/elastic_results_to_query_results.clj
+++ src/cmr/search/data/elastic_results_to_query_results.clj
@@ -46,12 +46,10 @@
   [context result-format name-key elastic-result]
   (let [{concept-id :_id
          revision-id :_version
-         {[name-value] name-key
-          [collection-concept-id] :collection-concept-id} :fields} elastic-result]
+         {[name-value] name-key} :fields} elastic-result]
     (results/map->Reference
       {:concept-id concept-id
        :revision-id revision-id
-       :collection-concept-id collection-concept-id
        :location (format "%s%s" (location-root context) concept-id)
        :name name-value})))


I did a typo

I did a typo

--- src/grimoire/api.clj
+++ src/grimoire/api.clj
@@ -479,8 +479,8 @@
   Examples:
   > [:def :any :any :any :any \"clojure.core\" \"concat\"]

-  Will match all instances of the Def clojure.core/concat in all artifacts on
-  all platforms in all versions in all artifacts in all groups.
+  Will match all instances of the Def clojure.core/concat on all platforms in
+  all versions in all artifacts in all groups.

   > [:ns :any \"clojure\" :any :any \"clojure.set\"]