Removed capacity from block.

Removed capacity from block.

--- src/clojure/uncomplicate/neanderthal/block.clj
+++ src/clojure/uncomplicate/neanderthal/block.clj
@@ -8,7 +8,8 @@

 (ns uncomplicate.neanderthal.block
   (:require [uncomplicate.neanderthal.internal.api :as api])
-  (:import [uncomplicate.neanderthal.internal.api Block DataAccessor LayoutNavigator DenseStorage]))
+  (:import [uncomplicate.neanderthal.internal.api Block DataAccessor LayoutNavigator DenseStorage
+            FullStorage]))

 (defn buffer [^Block x]
   (.buffer x))
@@ -27,9 +28,6 @@

 (defn gapless? [a]
   (.isGapless (api/storage a)))
-
-(defn capacity [a]
-  (.capacity (api/storage a)))

 (defn wrap-prim [^DataAccessor accessor ^double v]
   (.wrapPrim accessor v))


For sse can't connect is a problem, disconnecting is not

--- cljs/src/gin/remote/services.cljs
+++ cljs/src/gin/remote/services.cljs
@@ -140,10 +140,16 @@
                                                              [?e :args ?args]]}
                                                    db-after (:max-tx db-after)))]
                       (handle-client event args report conn))))
-  (let [source (js/EventSource. (str (game-url) "/events"))]
+  (let [source (js/EventSource. (str (game-url) "/events"))
+        open (atom false)]
+    (set! (.-onopen source)
+          (reset! open true))
     (set! (.-onerror source)
           (fn [e]
-            (error-handler conn)))
+            ;; can't connect is a problem, disconnecting is not
+            (when-not @open
+              (error-handler conn))
+            (reset! open false)))
     (set! (.-onmessage source)
           (fn [e]
             (let [data (.-data e)


fix macroexpand-1

fix macroexpand-1

--- src/main/clojure/clojure/tools/analyzer/js.clj
+++ src/main/clojure/clojure/tools/analyzer/js.clj
@@ -142,7 +142,8 @@
   (env/ensure (global-env)
     (if (seq? form)
       (let [op (first form)]
-        (if (specials op)
+        (if (or (not (symbol? op))
+                (specials op))
           form
           (let [clj-macro (maybe-macro op env)]
             (if (and clj-macro


Rationalise and cleanup onyx specs.

Rationalise and cleanup onyx specs.

--- src/onyx/spec.cljc
+++ src/onyx/spec.cljc
@@ -41,8 +41,6 @@

 (s/def :onyx/group-by-fn namespaced-keyword?)

-(s/def :onyx/input-retry-timeout pos-int?)
-
 (s/def :onyx/language #{:clojure :java})

 (s/def :onyx/max-peers pos-int?)
@@ -57,8 +55,6 @@

 (s/def :onyx/params
   (s/coll-of keyword? :kind vector?))
-
-(s/def :onyx/pending-timeout pos-int?)

 (s/def :onyx/plugin keyword?)

@@ -201,15 +197,19 @@
     :millisecond :milliseconds
     :element :elements})

+(s/def :window/doc string?)
+
+(s/def :window/session-key any?)
+
+(s/def :window/task keyword?)
+
 (s/def :window/id (s/or :keyword keyword? :uuid uuid?))

 (s/def :window/task keyword?)

 (s/def :window/init any?)

-(s/def :window/min-value integer?)
-
-(s/def :window/doc string?)
+(s/def :window/min-value number?)

 (s/def :window/type
   #{:fixed :sliding :global :session})
@@ -228,6 +228,8 @@
         :vec (s/cat :keyword keyword?)
         :vec-params (s/cat :keyword keyword? :any any?)))

+(s/def :window/window-key any?)
+
 (defmulti window-type :window/type)

 (defmethod window-type :fixed
@@ -257,19 +259,25 @@
   (s/coll-of (s/multi-spec window-type :window/type)
              :kind vector?))

-(s/def :trigger/window-id keyword?)
+(s/def :trigger/doc string?)
+
+(s/def :trigger/fire-all-extents? boolean?)

 (s/def :trigger/on keyword?)

+(s/def :trigger/pred keyword?)
+
 (s/def :trigger/sync keyword?)

-(s/def :trigger/pred keyword?)
+(s/def :trigger/emit keyword?)
+
+(s/def :trigger/window-id :window/id)
+
+(s/def :trigger/on keyword?)

 (s/def :trigger/fire-all-extents? boolean?)

 (s/def :trigger/watermark-percentage number?)
-
-(s/def :trigger/doc string?)

 (s/def :trigger/refinement
   #{:onyx.refinements/accumulating


Improving printing to table

Improving printing to table

--- src/app/operations.clj
+++ src/app/operations.clj
@@ -14,29 +14,35 @@
   (getQName x))

 (defn resultToStrings [resultRow]
-  (map toString resultRow))
+  (into [] (map toString resultRow)))

 (defn resultsToStrings [results]
   (map resultToStrings results))

-(defn columnLength [headerStr resultStrs]
+(defn getN [l ind]
+  (if (= ind 0)
+    (first l)
+    (getN (rest l) (- ind 1))))
+
+(defn columnLength [headerStr resultStrs ind]
   (max
     (.length headerStr)
     (apply max
-      (map (fn [s] (.length s)) resultStrs))))
+      (into [] (map (fn [row] (.length (nth row ind))) resultStrs)))))

-(defn columnLengthsHelper [headersStrings resultsStrings acc]
+(defn columnLengthsHelper [headersStrings resultsStrings acc ind]
   (if (empty? headersStrings)
     acc
     (columnLengthsHelper
       (rest headersStrings)
-      (rest resultsStrings)
+      resultsStrings
       (conj
         acc
-        (columnLength (first headersStrings) (first resultsStrings))))))
+        (columnLength (first headersStrings) resultsStrings ind))
+      (+ 1 ind))))

 (defn columnLengths [headersStrings, resultsStrings]
-  (columnLengthsHelper headersStrings resultsStrings '()))
+  (into [] (columnLengthsHelper headersStrings resultsStrings [] 0)))

 (defn padStr [s len]
   (if (>= (.length s) len)
@@ -62,7 +68,6 @@
         headersStrings (resultToStrings headers),
         colLengths (columnLengths headersStrings resultsStrings)]
     (do
-      (println "COLLENGTH " colLengths)
       (println (rowStr colLengths headersStrings))
       (println (separatorStr colLengths))
       (doall (for [r resultsStrings]


s/fo/morph/

s/fo/morph/

--- src/babel/english.cljc
+++ src/babel/english.cljc
@@ -110,7 +110,7 @@
             (fn [num]
               (let [expr (generate spec
                                    :model model)
-                    fo (fo expr :show-notes false)]
+                    fo (morph expr :show-notes false)]
                 (let [to-print
                       (cond
                         (empty? fo) (str "(failed)")


Clear Seq arguments before navigating back to chat. Fixes #1355

--- src/status_im/profile/handlers.cljs
+++ src/status_im/profile/handlers.cljs
@@ -37,6 +37,7 @@
 (register-handler :open-chat-with-the-send-transaction
   (u/side-effect!
     (fn [db [_ chat-id]]
+      (dispatch [:clear-seq-arguments])
       (dispatch [:navigate-to :chat chat-id])
       (js/setTimeout #(dispatch [:select-chat-input-command {:name "send"}]) 500))))


bug #4826 - fixed the issue when navigating back from sign message with android button

Signed-off-by: Goran Jovic <fc686822162e6f379ea05b6f92d78d206147085c@gmail.com>

--- src/status_im/ui/screens/views.cljs
+++ src/status_im/ui/screens/views.cljs
@@ -120,6 +120,7 @@
                :on-request-close (fn []
                                    (cond
                                      (#{:wallet-send-transaction-modal
+                                        :wallet-sign-message-modal
                                         :wallet-transaction-fee}
                                       modal-view)
                                      (dispatch [:wallet/discard-transaction-navigate-back])


bit more docs

bit more docs

--- src/celestial/core.clj
+++ src/celestial/core.clj
@@ -13,10 +13,10 @@

 (defprotocol Vm
   "A VM/Machine base API, implement this in order to add a new provider into celestial"
-  (create [this] "Creates a VM, the VM should be upand and ready to accept ssh sessions post this step")
+  (create [this] "Creates a VM, the VM should be up and and ready to accept ssh sessions post this step")
   (delete [this] "Deletes a VM")
-  (start [this] "Starts an existing VM, ssh should be up")
-  (stop [this]  "Stops a VM")
+  (start [this] "Starts an existing VM only if its not running, ssh should be up")
+  (stop [this]  "Stops a VM only if it exists and running")
   (status [this]
     "Returns vm status (values defere between providers) false if it does not exists"))


adding sample transformation to api

adding sample transformation to api

--- src/clj/flambo/api.clj
+++ src/clj/flambo/api.clj
@@ -108,6 +108,12 @@
       (.join (.map other (pair-function identity)))
       (.map (function double-untuple))))

+(defn sample [rdd with-replacement? fraction seed]
+    (-> rdd
+        (.map (pair-function identity))
+        (.sample with-replacement? fraction seed)
+        (.map (function untuple))))
+
 ;;; Actions

 (def first (memfn first))


clarify seed usages

clarify seed usages

--- src/clj_money/seed.clj
+++ src/clj_money/seed.clj
@@ -46,16 +46,20 @@
                        [])))))

 (defn seed
-  [user entity identifier]
+  "Seeds an entity with a predefined set of accounts
+
+  USAGE:
+  lein seed john@doe.com Personal personal-accounts"
+  [email entity-name seed-identifier]
   (with-transacted-storage [s (env :db)]
     (pprint
-      (->> identifier
+      (->> seed-identifier
            (format "resources/seeds/%s.edn")
            slurp
            read-string
-           (append-user s user)
-           (append-entity s entity)
-           (append-accounts s entity)
+           (append-user s email)
+           (append-entity s entity-name)
+           (append-accounts s entity-name)
            (realize s)))))

 (defn- generate-salary-transaction
@@ -85,6 +89,10 @@
                                  :amount 1447M}]}))

 (defn generate-transactions
+  "Seeds an account with transactions
+
+  USAGE
+  lein generate-transactions john@doe.com Personal 2017-01-01"
   [email entity-name start-date]
   (with-transacted-storage [s (env :db)]
     (let [user (users/find-by-email s email)


remove default core.

remove default core.

--- src/cljbukkit/core.clj
+++ src/cljbukkit/core.clj
@@ -1,6 +0,0 @@
-(ns cljbukkit.core)
-
-(defn foo
-  "I don't do a whole lot."
-  [x]
-  (println x "Hello, World!"))


adding snapshot concept (capturing entities & t)

--- sample/src/sample/core.clj
+++ sample/src/sample/core.clj
@@ -43,39 +43,49 @@
 (defn cltest2 []
   #_(cldb/db-rel fact e a v t)

-  (defn facts->entities [facts & {:keys [at-t]}]
+  (defrecord Snapshot [entities t])
+
+  (defn facts->snapshot [facts & {:keys [at-t]}]
     (let [;;;ldb (apply cldb/db facts)
           #_lres #_(cldb/with-db ldb
                  (cl/run* [q]
                    (cl/fresh [e a v t]
                      (fact e a v t)
-                     (cl/== q [e a v t]))))]
+                     (cl/== q [e a v t]))))
+          maxt (volatile! 0)]
       (when (not-empty facts #_lres)
-        (->> facts #_lres
-             (reduce (fn [s [e a v t]]
-                       (if (or (not at-t) (<= t at-t))
-                         (update-in s [e a]
-                                    (fn [[t2 v2 :as oldval]]
-                                      (if (and t2 (> t2 t))
-                                        oldval
-                                        [t v])))
-                         s))
-                     {})
+        (->Snapshot (->> facts #_lres
+                         (reduce (fn [s [e a v t]]
+                                   (if (or (not at-t) (<= t at-t))
+                                     (do (when (> t @maxt)
+                                           (vreset! maxt t))
+                                         (update-in s [e a]
+                                                    (fn [[t2 v2 :as oldval]]
+                                                      (if (and t2 (> t2 t))
+                                                        oldval
+                                                        [t v]))))
+                                     s))
+                                 {})
              ;;; TODO: this can probably be optimized in terms of memory usage & performance.
              ;;;   instead of building a new map, can we somehow operate on the existing one in
              ;;;   the appropriate nested places?
-             (map (fn [[e am]]
-                    [e (reduce (fn [am [k [t v]]]
-                                 (assoc am k v))
-                               {}
-                               am)]))
-             (into {})))))
+                         (map (fn [[e am]]
+                                [e (reduce (fn [am [k [t v]]]
+                                             (assoc am k v))
+                                           {}
+                                           am)]))
+                         (into {}))
+                    (do (println "MAXT2" @maxt)@maxt)))))

-  (defn entities+facts->entities [entities facts & {:keys [at-t]}]
+  (defn snapshot+facts->snapshot [snapshot facts & {:keys [at-t]}]
+    {:pre [(or (nil? at-t) (> at-t (:t snapshot)))]}
     (letfn [(merge-entities [es1 es2]
               (merge-with #(merge %1 %2)
-                          es1 es2))]
-      (merge-entities entities (facts->entities facts :at-t at-t))))
+                          es1 es2))
+            (merge-snapshots [s1 s2]
+              (->Snapshot (merge-entities (:entities s1) (:entities s2))
+                          (:t s2)))]
+      (merge-snapshots snapshot (facts->snapshot facts :at-t at-t))))

   (let [facts1 [[#_fact 200 :type     :address      1]
                 [#_fact 200 :street   "street 111"  1]
@@ -100,7 +110,7 @@
                 [#_fact 101 :name     "bar9"        10]
                 [#_fact 101 :name     "bar8"        9]]]

-    (entities+facts->entities (facts->entities facts1) facts2)))
+    (snapshot+facts->snapshot (facts->snapshot facts1) facts2)))

 ;;; (cltest2)


Introduce ability to parse producers.

Introduce ability to parse producers.

--- src/uk/co/anthonycampbell/imdb/cast_parser.clj
+++ src/uk/co/anthonycampbell/imdb/cast_parser.clj
@@ -17,8 +17,6 @@
     "Searches through all of the provided cast tables until we find the
      director sub section."
     [cast-tables]
-    ;(println cast-tables)
-
     (if (not-empty cast-tables)
         (let [table-links (html/select (first cast-tables) [:a])]
             (if (not-empty table-links)
@@ -30,6 +28,22 @@

                     ; Move onto next article
                     (search-for-directors (rest cast-tables)))))))
+
+(defn search-for-producers
+    "Searches through all of the provided cast tables until we find the
+     producer sub section."
+    [cast-tables]
+    (if (not-empty cast-tables)
+        (let [table-links (html/select (first cast-tables) [:a])]
+            (if (not-empty table-links)
+
+                ; Check whether this is the right article
+                (if (= (first (:content (first table-links))) "Produced by")
+                    ; Return producers
+                    (rest (html/select (first cast-tables) [:tr]))
+
+                    ; Move onto next article
+                    (search-for-producers (rest cast-tables)))))))

 (defn search-for-screen-writers
     "Searches through all of the provided cast tables until we find the
@@ -73,14 +87,41 @@
 (defn construct-producers
     "Construct a producers string based on the provided parsed page content"
     [page-content]
+    (println (search-for-producers (parse-cast-page page-content)))
+
     (if (not-empty page-content)
-        nil))
+        ; Parse list of producers
+        (loop [producer-string ""
+               producer-list (search-for-producers (parse-cast-page page-content))]
+            (if (not-empty producer-list)
+
+                ; Recurrsively compile producer string
+                (recur (str producer-string
+                    (let [producers (html/select (first producer-list) [:a])]
+                        (if (not-empty producers)
+
+                            ; If we have a type to work with lets validate
+                            (if (> (count producers) 1)
+                                (let [producer (first (:content (first producers)))
+                                      producer-type (first (:content (second producers)))]
+
+                                    ; Only grab if type is executive or producer
+                                    (if (= (ccstring/lower-case producer-type) "producer")
+                                        (str ", " producer)
+
+                                        (if (= (ccstring/lower-case producer-type) "executive producer")
+                                            (str ", " producer)
+                                            "")))
+
+                                (first (:content (first producers)))))))
+                    (rest producer-list))
+
+                ; Final clean up
+                (ccstring/trim (subs producer-string 2))))))

 (defn construct-screen-writers
     "Construct a screen-writers string based on the provided parsed page content"
     [page-content]
-    (println (search-for-screen-writers (parse-cast-page page-content)))
-
     (if (not-empty page-content)
         ; Parse list of screen writers
         (loop [screen-writer-set (sorted-set)


Allow more compact node notation

Allow more compact node notation

Instead of

    foo:
      kind: requirement
      title: Foo
      tags:
        - t/bar
        - t/baz

it is now possible to write

    foo:
      text: |
        # requirement: Foo

        +t/bar +t/baz

Of course short forms for "requirement", "component" etc. are
still possible:

    foo:
      text: |
        # r: Foo

        +t/bar +t/baz

The resulting node will be rendered with the title "Foo" and the
line will be stripped from the markdown text. Also, the fields
`text` and `description` are now synonymous. Combinations of the
old and new syntax are also supported:

    foo:
      description: |
        # r: Foo

        +t/bar
      tags:
        - t/baz

--- src/custard/parser.clj
+++ src/custard/parser.clj
@@ -27,11 +27,58 @@

 ;;;; Parsing

+(def kind-aliases
+  {"project" ["project" "p"]
+   "requirement" ["requirement" "req" "r"]
+   "component" ["component" "comp" "c"]
+   "work-item" ["work-item" "work" "w"]
+   "tag" ["tag" "t"]})
+
+(defn parse-kind [kind]
+  (when-let [kind (cond-> kind (map? kind) (get "kind"))]
+    (ffirst (filter #(some #{kind} (second %)) kind-aliases))))
+
+(defn parse-markdown-data [data]
+  (let [text (or (data "description") (data "text") "")
+        lines (str/split-lines text)
+        title-pattern #"#\s+(([a-z]+):\s*)?(.*)"
+        tag-pattern #"\+([a-zA-Z0-9-_\/:]+)"]
+    (letfn [(parse-md-kind-and-title [res line]
+              (if-not (and (:kind res) (:title res))
+                (if-let [match (re-matches title-pattern line)]
+                  (let [[_ _ kind title] match]
+                    (let [res (-> res
+                                  (assoc :kind (parse-kind kind))
+                                  (assoc :title title))]
+                      res))
+                  (update res :lines conj line))
+                (update res :lines conj line)))
+            (parse-md-tags [res line]
+              (let [tags (map second (re-seq tag-pattern line))]
+                (-> res
+                    (dissoc :lines)
+                    (update :tags (comp distinct concat) tags))))
+            (parse-md-step [res line]
+              (merge (parse-md-kind-and-title res line)
+                     (parse-md-tags res line)))]
+      (let [res (reduce parse-md-step {} lines)
+            text (str/join "\n" (reverse (:lines res)))]
+        (-> res
+            (dissoc :lines)
+            (assoc :text text))))))
+
 (defn parse-common [data]
-  {:title (data "title")
-   :description (data "description")
-   :mapped-here (mapv #(hash-map :name %) (data "mapped-here"))
-   :tags (mapv #(hash-map :name %) (data "tags"))})
+  (let [markdown-data (parse-markdown-data data)]
+    {:title (or (data "title") (:title markdown-data))
+     :kind (or (parse-kind data) (:kind markdown-data))
+     :description (if (:title markdown-data)
+                    (:text markdown-data)
+                    (or (data "description")
+                        (data "text")))
+     :mapped-here (mapv #(hash-map :name %) (data "mapped-here"))
+     :tags (into []
+             (concat (mapv #(hash-map :name %) (data "tags"))
+                     (mapv #(hash-map :name %) (:tags markdown-data))))}))

 (defn parse-project [data]
   {:copyright (data "copyright")})
@@ -54,18 +101,6 @@
    "component" parse-component
    "work-item" parse-work-item
    "tag" parse-tag})
-
-(def kind-aliases
-  {"project" ["project"]
-   "requirement" ["requirement" "req" "r"]
-   "component" ["component" "comp" "c"]
-   "work-item" ["work-item" "work" "w"]
-   "tag" ["tag" "t"]})
-
-(defn parse-kind [data]
-  (when (contains? data "kind")
-    (when-let [kind (get data "kind")]
-      (ffirst (filter #(some #{kind} (second %)) kind-aliases)))))

 (defn custard-node? [node]
   (contains? node :kind))
@@ -91,17 +126,16 @@

 (defn parse-nodes [name-segments parent-name data]
   {:pre [(map? data)]}
-  (let [kind (parse-kind data)
-        parser (kind-parsers kind)]
-    (if (and kind parser)
+  (let [common (parse-common data)
+        parser (kind-parsers (:kind common))]
+    (if (and (:kind common) parser)
       (let [name (str/join "/" name-segments)
             basic {:name name
                    :parent parent-name
                    :children (parse-children name-segments name data)}]
         [(merge basic
-                 {:kind kind}
-                 (parse-common data)
-                 (parser data))])
+                (parse-common data)
+                (parser data))])
       (parse-children name-segments parent-name data))))

 (defn parse-tree [data]


Simplify kmg.datomic-helpers/every-first

--- src/kmg/datomic_helpers.clj
+++ src/kmg/datomic_helpers.clj
@@ -19,7 +19,7 @@
 (defn db [] (d/db (conn)))

 (defn every-first [v]
-  (for [elem v] (first elem)))
+  (map first v))

 (defn entity [db id]
   (d/touch (d/entity db id)))


formatting (again)

formatting (again)

--- src/leiningen/fore_prob.clj
+++ src/leiningen/fore_prob.clj
@@ -1,16 +1,15 @@
 (ns leiningen.fore-prob
   "Populate the current project with a 4clojure problem."
   (:require [clj-http.client :as http]
-            [clojure.java.io :as io])
-  (:use [clojure.string :as cs :exclude [replace reverse]]))
+            [clojure.java.io :as io]
+            [clojure.string  :as cs]))

-;; Purloined from leiningen/src/leiningen/util/paths.clj
+;; Adapted from leiningen/src/leiningen/util/paths.clj
 (defn- ns->path
   "Convert a namespace into a path"
   [n]
-  (str (.. (str n)
-           (replace \- \_)
-           (replace \. \/))))
+  (apply str (replace {\- \_
+                       \. \/} n)))

 (defn- title->fn
   "Convert a problem title into a valid function name"
@@ -25,11 +24,19 @@
     (if (re-find r t)
       (spit fn (cs/replace t r "")))))

+(defn- indent
+  "Return a string representing the given level of indentation"
+  ([] (indent 1))
+  ([lvl]
+    (apply str (repeat lvl "  "))))
+
 (defn- desc->comments
   "format a problem description as Clojure comments with one level of
    indentation"
-  [desc]
-  (str "  ;; " (cs/replace desc #"\r?\n" "\n  ;; ")))
+  ([desc] (desc->comments desc 1))
+  ([desc i]
+    (str
+      (indent i) ";; " (cs/replace desc #"\r?\n" (str "\n" (indent i) ";; ")))))

 (defn- add-stub [project prob]
   (let [src (io/file "src" (ns->path (project :group)) "core.clj")]
@@ -37,7 +44,7 @@
       (spit src
             (str "\n(defn " prob "-solution [] ; Update args as needed!\n"
                  (-> project :description desc->comments) "\n"
-                 "  nil)\n")
+                 (indent) "nil)\n")
             :append true))))

 (defn- no-test-yet
@@ -57,7 +64,7 @@
   (->>
    (map #(cs/replace % #"\b__\b" (str prob "-solution")) tests)
    (map #(cs/replace % #"\r?\n" "\n"))
-   (map #(cs/join " " ["(is" % "\"" (enquote %) "\")"]))
+   (map #(cs/join " " [(str (indent) "(is") % "\"" (enquote %) "\")"]))
    (cs/join "\n")))

 (defn- write-tests
@@ -83,7 +90,7 @@
   (let [req (http/get (str fore-url n) {:as :json
                                         :throw-exceptions false})]
     (if (= (req :status) 200)
-      ;; we don't need scores here and it's polluting debugging logs
+      ;; we don't need scores here and it's polluting debug logs
       (dissoc (req :body) :scores))))

 (defn fore-prob
@@ -97,6 +104,5 @@
           (println (str "Problem \"" title "\" added!"))
           (println (str "Problem \"" title "\" has already been added!"))))
       (catch Exception e
-        (println (str "Failed setting problem " prob-num ": " (.getMessage e)))
-        (shutdown-agents)))
+        (println (str "Failed setting problem " prob-num ": " (.getMessage e)))))
     (println "Cannot get problem" prob-num "(HTTP status != 200).")))


Fix reference usage list

Fix reference usage list

--- src/discuss/views.cljs
+++ src/discuss/views.cljs
@@ -238,7 +238,7 @@
                           (cond
                             (= view :login) (om/build login-form {})
                             (= view :options) (om/build options/view data)
-                            (= view :reference-usages) (om/build ref/usages-view {})
+                            (= view :reference-usages) (om/build ref/usages-view data)
                             (= view :reference-create-with-ref) (om/build ref/create-with-reference-view data)
                             (= view :find) (om/build find/view data)
                             :else (discussion-elements data))


Extracts a new multimethod

Extracts a new multimethod

--- src/expound/alpha.cljc
+++ src/expound/alpha.cljc
@@ -227,6 +227,7 @@
      (pr-str (if retag (retag (problems/value-in val path)) nil)))))

 (defmulti problem-group-str (fn [type spec-name _val _path _problems _opts] type))
+(defmulti expected-str (fn [type  spec-name _val _path _problems _opts] type))

 (defn explain-missing-keys [problems]
   (let [missing-keys (map #(printer/missing-key (:pred %)) problems)]
@@ -241,6 +242,9 @@
            (str "\n\n" table)
            nil))))

+(defmethod expected-str :problem/missing-key [_type spec-name val path problems opts]
+  (explain-missing-keys problems))
+
 (defmethod problem-group-str :problem/missing-key [_type spec-name val path problems opts]
   (assert (apply = (map :val problems)) (str "All values should be the same, but they are " problems))
   (printer/format
@@ -251,21 +255,32 @@
 %s"
    (header-label "Spec failed")
    (show-spec-name spec-name (printer/indent (*value-str-fn* spec-name val path (problems/value-in val path))))
-   (explain-missing-keys problems)))
+   (expected-str _type spec-name val path problems opts)))
+
+(defmethod expected-str :problem/not-in-set [_type spec-name val path problems opts]
+  (let [combined-set (apply set/union (map :pred problems))]
+    (printer/format
+     "should be%s: %s"
+     (if (= 1 (count combined-set)) "" " one of")
+     (string/join "," (map #(str "`" % "`") combined-set)))))

 (defmethod problem-group-str :problem/not-in-set [_type spec-name val path problems opts]
   (assert (apply = (map :val problems)) (str "All values should be the same, but they are " problems))
-  (let [combined-set (apply set/union (map :pred problems))]
-    (printer/format
-     "%s
-
-%s
-
-should be%s: %s"
-     (header-label "Spec failed")
-     (show-spec-name spec-name (printer/indent (*value-str-fn* spec-name val path (problems/value-in val path))))
-     (if (= 1 (count combined-set)) "" " one of")
-     (string/join "," (map #(str "`" % "`") combined-set)))))
+  (printer/format
+   "%s
+
+%s
+
+%s"
+   (header-label "Spec failed")
+   (show-spec-name spec-name (printer/indent (*value-str-fn* spec-name val path (problems/value-in val path))))
+   (expected-str _type spec-name val path problems opts)))
+
+(defmethod expected-str :problem/missing-spec [_type spec-name val path problems opts]
+  (->> problems
+        (map #(no-method spec-name val path %))
+        (string/join "\n"))
+  )

 (defmethod problem-group-str :problem/missing-spec [_type spec-name val path problems opts]
   (printer/format
@@ -273,9 +288,7 @@

 %s"
    (header-label "Missing spec")
-   (->> problems
-        (map #(no-method spec-name val path %))
-        (string/join "\n"))))
+   (expected-str _type spec-name val path problems opts)))

 (defmethod problem-group-str :problem/regex-failure [_type spec-name val path problems opts]
   (s/assert ::singleton problems)


Revert "Proxy works even for new paths"

Revert "Proxy works even for new paths"

This reverts commit e291a56f34e8966acf73922d0626ef644baec0f5.

--- src/frontend/proxy.clj
+++ src/frontend/proxy.clj
@@ -66,23 +66,8 @@
           (let [local-response (handler req)]
             (when (not= 404 (:status local-response))
               local-response)))
-        (letfn [(do-proxy-request [req channel]
-                  (request (proxy-request req options)
-                           (fn [response]
-                             (let [rewrite (if (:error response) rewrite-error rewrite-success)]
-                               (if (and (#{404 301} (:status response))
-                                        (not= "/dashboard" (:uri req)))
-
-                                 ;; If the backend returns a 404, try returning /dashboard instead,
-                                 ;; which is known to render the app page. This makes it easier to
-                                 ;; add new URLs in development, because we add see the new page on
-                                 ;; prod.circlehost without deploying the new route to the
-                                 ;; production backend. Just remember to deploy that route when
-                                 ;; shipping the feature, or the page will be unavailable in the
-                                 ;; production app.
-                                 (do-proxy-request (assoc req :uri "/dashboard") channel)
-
-                                 ;; Otherwise, proxy as normal.
-                                 (send! channel (rewrite response)))))))]
-          (with-channel req channel
-            (do-proxy-request req channel))))))
+        (with-channel req channel
+          (request (proxy-request req options)
+                   (fn [response]
+                     (let [rewrite (if (:error response) rewrite-error rewrite-success)]
+                       (send! channel (rewrite response)))))))))


Drop core.async/component dependency These will force older versions than Onyx use internally, which is probably a bad idea

--- resources/leiningen/new/onyx_app/project.clj
+++ resources/leiningen/new/onyx_app/project.clj
@@ -4,8 +4,6 @@
   :license {:name "Eclipse Public License"
             :url "http://www.eclipse.org/legal/epl-v10.html"}
   :dependencies [[org.clojure/clojure "1.7.0"]
-                 [org.clojure/core.async "0.1.346.0-17112a-alpha"]
-                 [org.onyxplatform/onyx "0.8.0-alpha1"]
-                 [com.stuartsierra/component "0.2.3"]]
+                 [org.onyxplatform/onyx "0.8.0-alpha1"]]
   :profiles {:dev {:dependencies [[org.clojure/tools.namespace "0.2.11"]]
                    :source-paths ["env/dev" "src"]}})


Add überjar alias.

Add überjar alias.

--- src/leiningen/core.clj
+++ src/leiningen/core.clj
@@ -48,8 +48,8 @@
         (abort "No project.clj found in this directory."))))
   ([] (read-project "project.clj")))

-(def aliases {"--help" "help" "-h" "help" "-?" "help"
-              "-v" "version" "--version" "version"})
+(def aliases {"--help" "help" "-h" "help" "-?" "help" "-v" "version"
+              "--version" "version" "überjar" "uberjar"})

 (def no-project-needed #{"new" "help" "version"})


Move :version default value up to 'newest-voom-ver-by-spec destructure.

--- src/leiningen/voom.clj
+++ src/leiningen/voom.clj
@@ -422,13 +422,13 @@
    (update-in [:proj] (fnil #(s/replace % #"%" "/") :NOT_FOUND))))

 (defn newest-voom-ver-by-spec
-  [proj-name {:keys [version repo branch path]}]
-
+  [proj-name {:keys [version repo branch path]
+              :or {version ""}}]
   (for [gitdir (all-repos-dirs)
         :when (or (nil? repo) (= repo (-> (remotes gitdir) :origin :fetch)))
         :let [ptn (s/join "--" ["voom"
                                 (str (namespace proj-name) "%" (name proj-name))
-                                (str (or version "") "*")])
+                                (str version "*")])
               tags (set (:lines (git {:gitdir gitdir} "tag" "--list" ptn)))
               tspecs (if (= tags [""])
                        []


Suppress output from project.clj's while reading them.

--- src/leiningen/voom.clj
+++ src/leiningen/voom.clj
@@ -393,7 +393,8 @@
       (try
         (spit tmp-file
               (:out (git {:gitdir gitdir} "cat-file" "-p" (str blob-sha))))
-        (project/read (str tmp-file))
+        (binding [*out* null-writer, *err* null-writer]
+          (project/read (str tmp-file)))
         (catch Exception e
           ;; It was really just a best effort anyway. Silently ignore.
           nil)


Capture example logic code for posterity before removing it.

--- src/leiningen/voom.clj
+++ src/leiningen/voom.clj
@@ -922,6 +922,7 @@
   [_]
   (time (p-repos (fn [p] (clear-voom-tags p) (tag-repo-projects p)))))

+;; ===== Git import =====

 (defn git-commits
   [gitdir & args]
@@ -1156,12 +1157,85 @@
                (ancestoro c p)
                (l/== q true))))))

+  (time
+   (let [_ l/lvar]
+     (doall
+      (pldb/with-db db2
+        (l/run* [q]
+                (r-proj (_) q (_) (_) (_) (_) (_)))))))
+  (time
+   (count
+    (into #{}
+          (let [_ l/lvar]
+            (doall
+             (pldb/with-db db2
+               (l/run* [p M m i s]
+                       (r-proj (_) p M m i (_) s)
+                       (l/pred p #(.startsWith (str %) "lono")))))))))
+
+  (time
+   (doseq [f
+           (into #{}
+                 (let [_ l/lvar
+                       sha (sha/mk "36bb052caf1d560448dfd9e3c81e19d8e210f1a1")
+                       pname 'b2b/b2b-server]
+                   (doall
+                    (pldb/with-db db2
+                      (l/run 20 [A]
+                             (l/fresh [p M m i q s p2 M2 m2 i2 q2 s2 tpath tsha osha otsha bsha obsha oosha ootsha oobsha]
+                                      ;; For commit SHA, find the location and version of PNAME
+                                      (r-commit sha (_) tsha)
+                                      (r-proj bsha pname M m i q s)
+                                      (obj-patho tsha () "project.clj" :blob bsha tpath)
+                                      ;; Find an ancestor of SHA with a project at the same location
+                                      (ancestoro sha osha)
+                                      (r-commit osha (_) otsha)
+                                      (obj-patho otsha () "project.clj" :blob obsha tpath)
+                                      ;; Where the very previous commit at this location has a different project.clj blob
+                                      (r-commit-parent osha oosha)
+                                      (r-commit oosha (_) ootsha)
+                                      (l/!= obsha oobsha)
+                                      (obj-patho ootsha () "project.clj" :blob oobsha tpath)
+                                      ;; And found project.clj is also different from the current
+                                      (r-proj obsha pname M2 m2 i2 q2 s2)
+                                      (l/!= bsha obsha)
+                                      ;; Share the details
+                                      (l/== A [tpath osha [p M m i q s] [p2 M2 m2 i2 q2 s2]])
+                                      ))))))]
+     (prn f)))
+
+  (time
+   (doseq [f
+           (into #{}
+                 (let [_ l/lvar
+                       sha (sha/mk "36bb052caf1d560448dfd9e3c81e19d8e210f1a1")
+                       pname 'b2b/b2b-server]
+                   (doall
+                    (pldb/with-db db2
+                      (l/run 20 [a]
+                             (l/fresh [p M m i q s p2 M2 m2 i2 q2 s2 tpath tsha osha otsha bsha stsha ostsha ootsha oobsha ptpath thing]
+                                      ;; For commit SHA, find the location and version of PNAME
+                                      (r-commit sha (_) tsha)
+                                      (r-proj bsha pname M m i q s)
+                                      (obj-patho tsha () "project.clj" :blob bsha tpath)
+                                      ;; Locate the project directory
+                                      (l/conso thing ptpath tpath)
+                                      (obj-patho tsha () thing :tree stsha ptpath)
+                                      ;; Find an ancestor of SHA with a project directory at the same location
+                                      (ancestoro sha osha)
+                                      (r-commit osha (_) otsha)
+                                      (obj-patho otsha () thing :tree ostsha ptpath)
+                                      (l/!= stsha ostsha)
+                                      (l/== a [tpath sha osha [p M m i q s] [p2 M2 m2 i2 q2 s2]])
+                                      ))))))]
+     (prn f)))
+
 (time ; full
    (doseq [f
            (into #{}
                  (let [_ l/lvar
                        sha (sha/mk "36bb052caf1d560448dfd9e3c81e19d8e210f1a1")
-                       pname 'name/of-project]
+                       pname 'b2b/b2b-server]
                    (doall
                     (pldb/with-db db2
                       (l/run 20 [a]
@@ -1190,6 +1264,84 @@
                                       ))))))]
      (prn f)))

+;; - where does this project live (path/repo)-wise?
+(r-proj _ ?path PNAME ?M ?m ?i ?q ?S)
+;; - what are all the versions "available" for this project?
+(r-proj _ ?path PNAME ?M ?m ?i ?q ?S)
+;; - what commits, after <this> version was introduced, change the path at the same
+(r-proj ?sha PATH PNAME M m i q S)
+
+
+(time ; next
+ (doseq [f
+         (into #{}
+               (let [_ l/lvar
+                     ;; We're starting at some ref or sha
+                     sha (sha/mk "36bb052caf1d560448dfd9e3c81e19d8e210f1a1")
+                     ;; We know what project
+                     pname 'b2b/b2b-server
+                     ;; We have some version constraint
+                     M 0
+                     m 0
+                     p]
+                 (doall
+                  (pldb/with-db db2
+                    (l/run 20 [a]
+                           (l/fresh [p M m i q s p2 M2 m2 i2 q2 s2 tpath tsha osha oosha otsha bsha stsha ostsha ootsha oostsha oobsha ptpath thing]
+                                    ;; For commit SHA, find the location and version of PNAME
+                                    (r-commit sha (_) tsha)
+                                    (r-proj bsha pname M m i q s)
+                                    (obj-patho tsha () "project.clj" :blob bsha tpath)
+                                    ;; Locate the project directory
+                                    (l/conso thing ptpath tpath)
+                                    (obj-patho tsha () thing :tree stsha ptpath)
+                                    ;; Find an ancestor of SHA with a project directory at the same location
+                                    (ancestoro sha osha)
+                                    (r-commit osha (_) otsha)
+                                    (obj-patho otsha () thing :tree ostsha ptpath)
+                                    (l/!= stsha ostsha)
+                                    ;; Where the very previous commit at this location has a different project.clj blob
+                                    (r-commit-parent osha oosha)
+                                    (r-commit oosha (_) ootsha)
+                                    (obj-patho ootsha () thing :tree oostsha ptpath)
+                                    (l/!= ostsha oostsha)
+                                    ;; Find the project details
+                                    (obj-patho ootsha () "project.clj" :blob oobsha tpath)
+                                    (r-proj oobsha (_) M2 m2 i2 q2 s2)
+                                    (l/== a [tpath sha osha oobsha [p M m i q s] [p2 M2 m2 i2 q2 s2]])
+                                    ))))))]
+   (prn f)))
+
+(time
+ (doseq [f (let [_ l/lvar
+                 pname 'b2b/b2b-server
+                 ppath '("b2b" "modules")
+                 csha (sha/mk "36bb052")]
+           (pldb/with-db db2
+             (l/run 1 [q]
+                    (l/fresh [bsha tpath tsha psha ptsha pbsha]
+                             (r-commit csha (_) tsha)
+                             (obj-patho tsha () "server" :tree bsha ppath)
+                             (ancestoro csha psha)
+                             (r-commit psha (_) ptsha)
+                             (obj-patho ptsha () "server" :tree pbsha ppath)
+                             (l/!= bsha pbsha)
+                             (l/== q [pname ppath csha ptsha])))))]
+   (prn f)))
+
+  (time
+   (identity
+    (into #{}
+          (let [_ l/lvar
+                sha (sha/mk "612e0705de7ff991aa65b910ed0820adabd1d921")]
+            (doall
+             (pldb/with-db db2
+               (l/run* [p M m i q s tpath]
+                       (l/fresh [ctime tsha bsha]
+                                (r-commit sha ctime tsha)
+                                (obj-patho tsha nil "project.clj" :blob bsha tpath)
+                                (r-proj bsha p M m i q s)))))))))
+
   (pldb/with-db db3
     (l/run 10 [obj-sha]
      (l/fresh [sha]


Bump version

Bump version

--- modules/http-kit/project.clj
+++ modules/http-kit/project.clj
@@ -1,12 +1,12 @@
 ;; Copyright © 2014 JUXT LTD.

-(defproject juxt.modular/http-kit "0.3.0"
+(defproject juxt.modular/http-kit "0.3.1-SNAPSHOT"
   :description "A modular extension that provides support for http-kit channels"
   :url "https://github.com/juxt/modular/tree/master/modules/http-kit"
   :license {:name "The MIT License"
             :url "http://opensource.org/licenses/MIT"}
   :dependencies [[http-kit "2.1.13"]
                  [prismatic/schema "0.2.1"]
-                 [juxt/modular "0.2.0"]
-                 [juxt.modular/ring "0.2.0"]
+                 [juxt/modular "0.3.0"]
+                 [juxt.modular/ring "0.3.0"]
                  ])


clicking works\!

clicking works\!

--- src/mermaid_ldjam/core.cljs
+++ src/mermaid_ldjam/core.cljs
@@ -16,18 +16,17 @@
 (defmacro dbg[x] `(let [x# ~x] (println "dbg:" '~x "=" x#) x#))

 (defn point-in-rect? [entity mx my]
-  ;(and
-  ;(> mx (:x entity))
-   ;(< mx (+ (:x entity) (:width entity)))
-   ;(> my (:y entity))
-   ;(< my (+ (:y entity) (:height entity)))
-                                        ;)
-  (println "Hello")
-  true)
+  (and
+   (> mx (:x entity))
+   (< mx (+ (:x entity) (:width entity)))
+   (> my (:y entity))
+   (< my (+ (:y entity) (:height entity)))))

 (defn clicked-on-entity? [mx my state]
   (let [new-state (for [[k v] (:entities state) :when (point-in-rect? v mx my)] (assoc state :last-clicked k))]
-    new-state))
+    (if-not (empty? new-state)
+      (first new-state)
+      state)))

 (defn update-last-clicked [state]
   (if true
@@ -36,8 +35,7 @@

 (defn update-state [state]
   (-> state
-      (update-last-clicked))
-  state)
+      (update-last-clicked)))

 (def load-image  (memoize q/load-image))


beginning to remove redundant arguments.

--- src/midje/util/checkers.clj
+++ src/midje/util/checkers.clj
@@ -95,6 +95,11 @@
 (defn chatty-checker-falsehood? [value]
   (:midje/chatty-checker-falsehood (meta value)))

+(defn- add-actual [actual result]
+  (if (chatty-checker-falsehood? result)
+    (merge result {:actual actual})
+    result))
+
 (defn chatty-checker? [fn]
   (:midje/chatty-checker (meta fn)))

@@ -518,23 +523,14 @@
 ;;

-(defn match? [midje-classification actual expected looseness]
-  (let [comparison (compare-results midje-classification actual expected looseness)]
+(defn match? [actual expected looseness]
+  (let [comparison (compare-results (midje-classification actual) actual expected looseness)]
     (or (total-match? comparison)
         (apply noted-falsehood
-               (cons (best-actual-match midje-classification comparison)
-                     (best-expected-match midje-classification comparison expected))))))
-
-
-(defn- actual-x-contains? [actual expected looseness]
-  (match? (midje-classification actual) actual expected looseness))
-
-(defn- add-actual [actual result]
-  (if (chatty-checker-falsehood? result)
-    (merge result {:actual actual})
-    result))
-
-
+               (cons (best-actual-match (midje-classification actual) comparison)
+                     (best-expected-match (midje-classification actual) comparison expected))))))
+
+ ;; The interface

 (defn- container-checker-maker [name checker-fn]
@@ -555,7 +551,7 @@
               (try-re expected actual re-find)

               :else
-              (apply actual-x-contains? [actual expected looseness]))))))
+              (match? actual expected looseness))))))

 (def just (container-checker-maker 'just
     (fn [actual expected looseness]
@@ -564,7 +560,7 @@
               (try-re expected actual re-matches)

               (same-lengths? actual expected)
-              (apply actual-x-contains? [actual expected looseness])
+              (match? actual expected looseness)

               :else
               (tag-as-chatty-falsehood
@@ -590,8 +586,7 @@
                   (try-re (pattern-fn expected) actual re-find)

                   (expected-fits? actual expected)
-                  (apply actual-x-contains?
-                         [(take-fn (count expected) actual) expected looseness])
+                  (match?(take-fn (count expected) actual) expected looseness)

                   :else
                   (tag-as-chatty-falsehood


fixes #2037 so that the dot for the most recent data point is always placed over the most recent value in the sparkline.

--- src/metabase/pulse.clj
+++ src/metabase/pulse.clj
@@ -316,11 +316,16 @@

 (defn- render:sparkline
   [_ {:keys [rows cols]}]
-  (let [xs     (for [row  rows
+  (let [ft-row (if (datetime-field? (first cols))
+                 #(.getTime ^Date (u/->Timestamp %))
+                 identity)
+        rows   (if (> (ft-row (first (first rows)))
+                      (ft-row (first (last rows))))
+                 (reverse rows)
+                 rows)
+        xs     (for [row  rows
                      :let [x (first row)]]
-                 (if (datetime-field? (first cols))
-                   (.getTime ^Date (u/->Timestamp x))
-                   x))
+                 (ft-row x))
         xmin   (apply min xs)
         xmax   (apply max xs)
         xrange (- xmax xmin)


Allow nil values in hex conversions.

Allow nil values in hex conversions.

--- src/multihash/core.clj
+++ src/multihash/core.clj
@@ -65,11 +65,12 @@
 (defn- bytes->hex
   "Converts a byte array into a lowercase hexadecimal string."
   [^bytes value]
-  (let [width (* 2 (count value))
-        hex (-> (BigInteger. 1 value)
-                (.toString 16)
-                str/lower-case)]
-    (zero-pad width hex)))
+  (when (and value (pos? (alength value)))
+    (let [width (* 2 (alength value))
+          hex (-> (BigInteger. 1 value)
+                  (.toString 16)
+                  str/lower-case)]
+      (zero-pad width hex))))

 (defn- hex->bytes
@@ -77,17 +78,18 @@
   array is zero-padded to match the hex string length."
   ^bytes
   [^String value]
-  (when (odd? (count value))
-    (throw (IllegalArgumentException.
-             (str "Input string '" value "' is not valid hex: number of "
-                  "characters (" (count value) ") is odd"))))
-  (let [width (/ (count value) 2)
-        data (.toByteArray (BigInteger. value 16))]
-    (if (= width (count data))
-      data
-      (let [data' (byte-array width)]
-        (System/arraycopy data 0 data' 0 (count data))
-        data'))))
+  (when (and value (not (empty? value)))
+    (when (odd? (count value))
+      (throw (IllegalArgumentException.
+               (str "Input string '" value "' is not valid hex: number of "
+                    "characters (" (count value) ") is odd"))))
+    (let [width (/ (count value) 2)
+          data (.toByteArray (BigInteger. value 16))]
+      (if (= width (alength data))
+        data
+        (let [data' (byte-array width)]
+          (System/arraycopy data 0 data' (- width (alength data)) (alength data))
+          data')))))


Make util/set-canvas-size! take map with w and h

--- src/musicbox/util.cljs
+++ src/musicbox/util.cljs
@@ -19,10 +19,10 @@
   { :w (or (.-innerWidth js/window) (.-clientWidth (.-body js/document)))
     :h (or (.-innerHeight js/window) (.-clientHeight (.-body js/document)))})

-(defn set-canvas-size! [canvas-id width height]
+(defn set-canvas-size! [canvas-id {w :w h :h}]
   (let [canvas (dom/getElement canvas-id)]
-    (set! (. canvas -width) width)
-    (set! (. canvas -height) height)))
+    (set! (. canvas -width) w)
+    (set! (. canvas -height) h)))

 (defn get-ctx [canvas-id]
   (.getContext (dom/getElement canvas-id) "2d"))


Adds more logging.

Adds more logging.

--- src/onyx/peer/transform.clj
+++ src/onyx/peer/transform.clj
@@ -1,7 +1,9 @@
 (ns onyx.peer.transform
   (:require [clojure.core.async :refer [chan go alts!! close! >!] :as async]
             [onyx.peer.pipeline-extensions :as p-ext]
-            [onyx.extensions :as extensions]))
+            [onyx.extensions :as extensions]
+            [taoensso.timbre :refer [info]]
+            [dire.core :refer [with-post-hook!]]))

 (defn read-batch [queue consumers batch-size timeout]
   (let [consumer-chs (take (count consumers) (repeatedly #(chan 1)))]
@@ -32,31 +34,54 @@
   (for [p producers msg msgs]
     (extensions/produce-message queue p session msg)))

-(defmethod p-ext/read-batch :default
+(defn read-batch-shim
   [{:keys [queue session ingress-queues batch-size timeout]}]
   (let [consumers (map (partial extensions/create-consumer queue session) ingress-queues)
         batch (read-batch queue consumers batch-size timeout)]
     {:batch batch :consumers consumers}))

-(defmethod p-ext/decompress-batch :default
-  [{:keys [queue batch]}]
+(defn decompress-batch-shim [{:keys [queue batch]}]
   (let [decompressed-msgs (map (partial decompress-segment queue) batch)]
     {:decompressed decompressed-msgs}))

-(defmethod p-ext/apply-fn :default
-  [{:keys [decompressed task catalog]}]
+(defn apply-fn-shim [{:keys [decompressed task catalog]}]
   (let [task (first (filter (fn [entry] (= (:onyx/name entry) task)) catalog))
         results (map (partial apply-fn task) decompressed)]
     {:results results}))

-(defmethod p-ext/compress-batch :default
-  [{:keys [results]}]
+(defn compress-batch-shim [{:keys [results]}]
   (let [compressed-msgs (map compress-segment results)]
     {:compressed compressed-msgs}))

-(defmethod p-ext/write-batch :default
-  [{:keys [queue egress-queues session compressed]}]
+(defn write-batch-shim [{:keys [queue egress-queues session compressed]}]
   (let [producers (map (partial extensions/create-producer queue session) egress-queues)
         batch (write-batch queue session producers compressed)]
     {:producers producers}))

+(defmethod p-ext/read-batch :default
+  [event] (read-batch-shim event))
+
+(defmethod p-ext/decompress-batch :default
+  [event] (decompress-batch-shim event))
+
+(defmethod p-ext/apply-fn :default
+  [event] (apply-fn-shim event))
+
+(defmethod p-ext/compress-batch :default
+  [event] (compress-batch-shim event))
+
+(defmethod p-ext/write-batch :default
+  [event] (write-batch-shim event))
+
+(with-post-hook! #'read-batch-shim
+  (fn [{:keys [batch consumers]}]
+    (info "Transformer: Read batch of" (count batch) "segments from" (count consumers) "inputs")))
+
+(with-post-hook! #'decompress-batch-shim
+  (fn [{:keys [decompressed]}]
+    (info "Transformer: Decompressed" (count decompressed) "segments")))
+
+(with-post-hook! #'apply-fn-shim
+  (fn [{:keys [results]}]
+    (info "Transformer: Applied fn to" (count results) "segments")))
+


Fix logged stacktrace

Fix logged stacktrace

--- src/onyx/static/logging.clj
+++ src/onyx/static/logging.clj
@@ -26,7 +26,7 @@
                      ;; (str (type ...)) prefixes "class" in the string.
                      (.getName ^java.lang.Class (.getClass ^clojure.lang.ExceptionInfo e))
                      (.getMessage ^clojure.lang.ExceptionInfo e))]
-     (ex-info msg error-keys (.getCause ^clojure.lang.ExceptionInfo e)))))
+     (ex-info msg error-keys e))))

 (defn exception-msg [task-information msg]
   (str (log-prefix task-information) msg))


Fix documentation error.

Fix documentation error.

--- src/afterglow/show.clj
+++ src/afterglow/show.clj
@@ -552,7 +552,7 @@
   orientation. Coordinates and rotations are with respect to the [show
   frame of
   reference](https://github.com/brunchboy/afterglow/wiki/Show-Space),
-  and are in meters and degrees. You can use [[transform/inches]]
+  and are in meters and radians. You can use [[transform/inches]]
   and [[transform/degrees]] to convert for you if desired."
   {:doc/format :markdown}
   [key fixture universe start-address & {:keys [x y z x-rotation y-rotation z-rotation]


if-let

if-let

--- src/overcode/introvert.cljs
+++ src/overcode/introvert.cljs
@@ -46,14 +46,13 @@
 (defn seq->js
   "Converts a seq-like value into a JS Array."
   ([obj flat visited]
-   (let [was-visited (visited? visited obj)]
-     (if was-visited
-       (if flat
-         "Circular Seq"
-         was-visited)
-       (let [out (array)]
-         (visit! visited obj out)
-         (array-append out (map #(->js % flat visited) obj))))))
+   (if-let [was-visited (visited? visited obj)]
+     (if flat
+       "Circular Seq"
+       was-visited)
+     (let [out (array)]
+       (visit! visited obj out)
+       (array-append out (map #(->js % flat visited) obj)))))

   ([obj flat] (seq->js obj flat (atom {})))
   ([obj] (seq->js obj false (atom {}))))
@@ -61,20 +60,19 @@
 (defn map->js
   "Converts a map-like value into a JS Object."
   ([obj flat visited]
-   (let [was-visited (visited? visited obj)]
-     (if was-visited
-       (if flat
-         "Circular Map"
-         was-visited)
-       (let [out (js-obj)]
-         (visit! visited obj out)
-         (dorun
-          (map
-           #(let [key (->js (first %)  flat visited)
-                  val (->js (second %) flat visited)]
-              (aset out key val))
-           obj))
-         out))))
+   (if-let [was-visited (visited? visited obj)]
+     (if flat
+       "Circular Map"
+       was-visited)
+     (let [out (js-obj)]
+       (visit! visited obj out)
+       (dorun
+        (map
+         #(let [key (->js (first %)  flat visited)
+                val (->js (second %) flat visited)]
+            (aset out key val))
+         obj))
+       out)))

   ([obj flat] (map->js obj flat (atom {})))
   ([obj] (map->js obj false (atom {}))))


adding param metadata to the mooger

adding param metadata to the mooger

--- src/overtone/inst/synth.clj
+++ src/overtone/inst/synth.clj
@@ -40,18 +40,28 @@
     (* 0.5 filt)))

 (definst mooger
-  [note 60 amp 0.8
-   osc1 0 osc2 1     ; Choose 0 1 2 for saw, sin, or pulse
-   osc1-level 0.5 osc2-level 0.5
-   cutoff 500
-   attack 0.1 decay 0.1 sustain 0.7 release 0.2
-   fattack 0.1 fdecay 0.1 fsustain 0.9 frelease 0.2
+  "Choose 0, 1, or 2 for saw, sin, or pulse"
+  [note {:default 60 :min 0 :max 127 :step 1}
+   amp  {:default 0.3 :min 0 :max 1 :step 0.01}
+   osc1 {:default 0 :min 0 :max 2 :step 1}
+   osc2 {:default 1 :min 0 :max 2 :step 1}
+   osc1-level {:default 0.5 :min 0 :max 1 :step 0.01}
+   osc2-level {:default 0 :min 0 :max 1 :step 0.01}
+   cutoff {:default 500 :min 0 :max 20000 :step 1}
+   attack {:default 0.0001 :min 0.0001 :max 5 :step 0.001}
+   decay {:default 0.3 :min 0.0001 :max 5 :step 0.001}
+   sustain {:default 0.99 :min 0.0001 :max 1 :step 0.001}
+   release {:default 0.0001 :min 0.0001 :max 6 :step 0.001}
+   fattack {:default 0.0001 :min 0.0001 :max 6 :step 0.001}
+   fdecay {:default 0.3 :min 0.0001 :max 6 :step 0.001}
+   fsustain {:default 0.999 :min 0.0001 :max 1 :step 0.001}
+   frelease {:default 0.0001 :min 0.0001 :max 6 :step 0.001}
    gate 1]
   (let [freq (midicps note)
         osc-bank-1 [(saw freq) (sin-osc freq) (pulse freq)]
         osc-bank-2 [(saw freq) (sin-osc freq) (pulse freq)]
         amp-env (env-gen (adsr attack decay sustain release) gate :action FREE)
-        f-env (env-gen (adsr fattack fdecay fsustain frelease) gate :action FREE)
+        f-env (env-gen (adsr fattack fdecay fsustain frelease) gate)
         s1 (* osc1-level (select osc1 osc-bank-1))
         s2 (* osc2-level (select osc2 osc-bank-2))
         filt (moog-ff (+ s1 s2) (* cutoff f-env) 3)]


string conversion of byte-array

string conversion of byte-array

--- src/ontrail/crypto.clj
+++ src/ontrail/crypto.clj
@@ -23,8 +23,8 @@
 (defn get-bytes [in] (if (string? in) (.getBytes in) in))

 (defn byte-array-to-string [arr]
-  (.debug logger (str arr))
-  (apply str (map #(char %) arr))) ; aebaerae -castaus char:ksi, mutta tässä toimii?
+  (.debug logger (str "Array: " (apply str (map #(char (bit-and 255 (int %))) arr))))
+  (String. arr)) ; aebaerae -castaus char:ksi, mutta tässä toimii?

 (defn base64-encode [bytes-or-string] (byte-array-to-string (Base64/encodeBase64URLSafeString (get-bytes bytes-or-string))))
 (defn base64-decode [bytes-or-string] (Base64/decodeBase64 (get-bytes bytes-or-string)))


correct handling of spaces atoms

correct handling of spaces atoms

--- src/paredit/parser.clj
+++ src/paredit/parser.clj
@@ -1,6 +1,7 @@
 ; note : hiredman's reader http://github.com/hiredman/clojure/blob/readerII/src/clj/clojure/reader.clj#L516
 ; still TODO :
-; 1. make parser and function behaviour similar for terminals atom and spaces (and move the special handling of zipping terminals up on :eof from default-handler to default-maker ?)
+; 1. done - make parser and function behaviour similar for terminals atom and spaces
+; 1.a  (and move the special handling of zipping terminals up on :eof from default-handler to default-maker ?)
 ; 2. correctly handle clojure specificities : #{} #^ #"" ' ` @ #^ ^ #' #_ #() ~ ~@ foo#
 ; 3. correctly handle the premature :eof on non closed structures (a cause of error)
 ; 4. correctly handle parsetree errors (wrong closing of bracket, ... TODO finish the exhaustive list)
@@ -62,7 +63,7 @@
 (def *opening-brackets* (set (keys *brackets*)))
 (def *closing-brackets* (set (vals *brackets*)))
 (def *spaces* #{\space \tab \newline \return})
-
+(def *atoms* #{ \a \space})

 (defn zip-one [#^String text offset line col parents parser-state accumulated-state]
   (let [level (-> accumulated-state peek (assoc :end-offset offset))
@@ -78,14 +79,14 @@
     (cond
       (> (count parents) (count accumulated-state))
         ; enter a sublevel
-        (if (and (= :eof parser-state) (= \a (-> parents peek :tag))) ; todo move in default-make-result ?
+        (if (and (= :eof parser-state) (*atoms* (-> parents peek :tag))) ; todo move in default-make-result ?
           (zip-one
             text offset line col parents parser-state
             (-> accumulated-state (conj (peek parents))))
           (-> accumulated-state (conj (peek parents))))
       (or
         (< (count parents) (count accumulated-state))
-        (and (= :eof parser-state) (= \a (-> accumulated-state peek :tag))))
+        (and (= :eof parser-state) (*atoms* (-> accumulated-state peek :tag))))
         ; exit a sublevel
           ; on stocke l'offset de fin du niveau, on l'enregistre en tant
           ; que fils du parent, on depope le niveau


Remove IndexOutOfBoundsException in paredit.parser/called

--- src/paredit/parser.clj
+++ src/paredit/parser.clj
@@ -55,6 +55,7 @@
   (let [e (remove-meta e)
         e-code-children (code-children e)]
     (and
+      (<= 2 (count e-code-children))
       (#{"("} (nth e-code-children 0))
       (sym-name (nth e-code-children 1)))))


Use db.backend conf option in default-db

--- src/photon/handler.clj
+++ src/photon/handler.clj
@@ -118,23 +118,7 @@
 (def cold-latency 5000)

 #_(def test-ds (filedb/->DBFile (clojure.java.io/resource "events.json")))
-
-(defmulti default-db (fn []
-                       (log/info "Configuring DB...")
-                       (:db.backend conf/config)))
-(defmethod default-db "cassandra" []
-  (cassandra/->DBCassandra (get conf/config :cassandra.ip "127.0.0.1")
-                           (get conf/config :kspace "photon")
-                           (get conf/config :table "events")))
-(defmethod default-db "mongodb" [] (mongo/mongo))
-#_(defmethod default-db "riak" [] (riak/riak riak/s-bucket))
-#_(defmethod default-db "file" []
-    (filedb/->DBFile (clojure.java.io/file (:file.path conf/config))))
-
-(defn figwheel-main []
-  (let [ms (m/start-server! (:microservice.name conf/config)
-                            (default-db))]
-    (dosync (alter own-stream (fn [_] ms)))))
+(declare figwheel-main)

 (defroutes* app-routes
   (GET* "/startup" []
@@ -236,25 +220,57 @@
         nns (clojure.string/replace nn #"_" "-")]
     nns))

-((defn load-db-plugins!
-   ([jf]
-    (let [files (filenames-in-jar jf)
-          matches (filter #(and (.startsWith % "photon/db/")
-                                (.endsWith % ".clj"))
-                          files)
-          codes (map #(.getInputStream jf (.getEntry jf %)) matches)]
-      (dorun (map #(log/info "Loading" % "in" (.getName jf) "...") matches))
-      #_(dorun (map read-string (map slurp codes)))
-      (dorun (map #(require (symbol (file->ns %))) matches))))
-   ([]
-    (log/info "Finding backend plugin implementations...")
-    (let [jarfiles (classpath-jarfiles)]
-      (dorun (map load-db-plugins! jarfiles))))))
+(defn load-db-plugins!
+  ([jf]
+   (let [files (filenames-in-jar jf)
+         matches (filter #(and (.startsWith % "photon/db/")
+                               (.endsWith % ".clj"))
+                         files)
+         codes (map #(.getInputStream jf (.getEntry jf %)) matches)]
+     (dorun (map #(log/info "Loading" % "in" (.getName jf) "...") matches))
+     #_(dorun (map read-string (map slurp codes)))
+     (dorun (map #(require (symbol (file->ns %))) matches))))
+  ([]
+   (log/info "Finding backend plugin implementations...")
+   (let [jarfiles (classpath-jarfiles)]
+     (dorun (map load-db-plugins! jarfiles)))))
+
+#_(defmulti default-db (fn []
+                       (log/info "Configuring DB...")
+                       (:db.backend conf/config)))
+#_(defmethod default-db "cassandra" []
+  (cassandra/->DBCassandra (get conf/config :cassandra.ip "127.0.0.1")
+                           (get conf/config :kspace "photon")
+                           (get conf/config :table "events")))
+#_(defmethod default-db "mongodb" [] (mongo/mongo))
+#_(defmethod default-db "riak" [] (riak/riak riak/s-bucket))
+#_(defmethod default-db "file" []
+    (filedb/->DBFile (clojure.java.io/file (:file.path conf/config))))
+
+(defn find-implementation [impls n]
+  (first (filter #(= n (db/driver-name (%))) impls)))
+
+(defn default-db []
+  (let [target (:db.backend conf/config)
+        impls (db/implementations)
+        chosen (find-implementation impls target)]
+    (if (nil? chosen)
+      (do
+        (log/error "Backend plugin for" target
+                   "not found, falling back to dummy")
+        ((find-implementation impls "dummy")))
+      (chosen))))
+
+(defn figwheel-main []
+  (let [ms (m/start-server! (:microservice.name conf/config)
+                            (default-db))]
+    (dosync (alter own-stream (fn [_] ms)))))

 ;; Workaround to have http-kit as the provider for Ring
 ;; In order to use http-kit, run `lein run` instead of `lein ring server`
 (defn -main [& args]
   (log/info "Starting photon...")
+  (load-db-plugins!)
   (let [db (default-db)
         _ (log/info "DB Configured...")
         ms (m/start-server! (:microservice.name conf/config) db)]


remove :use criterium

remove :use criterium

--- src/polismath/play.clj
+++ src/polismath/play.clj
@@ -7,7 +7,6 @@
   (:use clojure.data.csv
         clojure.java.io
         clojure.pprint
-        criterium.core
         polismath.conversation
         polismath.clusters
         polismath.pca


unit test fix.

unit test fix.

--- test/metabase/api/database_test.clj
+++ test/metabase/api/database_test.clj
@@ -170,21 +170,21 @@
   (expect-eval-actual-first
     (set (filter identity (conj (for [engine datasets/all-valid-engines]
                                   (datasets/when-testing-engine engine
-                                                                (match-$ (get-or-create-test-data-db! (driver/engine->driver engine))
-                                                                  {:created_at      $
-                                                                   :engine          (name $engine)
-                                                                   :id              $
-                                                                   :updated_at      $
-                                                                   :name            "test-data"
-                                                                   :is_sample       false
-                                                                   :is_full_sync    true
-                                                                   :organization_id nil
-                                                                   :description     nil
-                                                                   :tables          [(table-details (Table (id :categories)))
-                                                                                (table-details (Table (id :checkins)))
-                                                                                (table-details (Table (id :users)))
-                                                                                (table-details (Table (id :venues)))]
-                                                                   :features        (mapv name (driver/features (driver/engine->driver engine)))})))
+                                                                (let [database (get-or-create-test-data-db! (driver/engine->driver engine))]
+                                                                  (match-$ database
+                                                                    {:created_at      $
+                                                                     :engine          (name $engine)
+                                                                     :id              $
+                                                                     :updated_at      $
+                                                                     :name            "test-data"
+                                                                     :is_sample       false
+                                                                     :is_full_sync    true
+                                                                     :organization_id nil
+                                                                     :description     nil
+                                                                     :tables          (->> (sel :many Table :db_id (:id database))
+                                                                                (mapv table-details)
+                                                                                (sort-by :name))
+                                                                     :features        (mapv name (driver/features (driver/engine->driver engine)))}))))
                                 ;; (?) I don't remember why we have to do this for postgres but not any other of the bonus drivers
                                 (match-$ (sel :one Database :name db-name)
                                   {:created_at      $


Added handling of SignatureException for JWS

Wrap SignatureException in ExceptionInfo so it can be correctly
handled by JWS token backend

--- src/buddy/sign/jws.clj
+++ src/buddy/sign/jws.clj
@@ -140,11 +140,17 @@
   ([input pkey] (unsign input pkey nil))
   ([input pkey {:keys [alg] :or {alg :hs256}}]
    (let [[header payload signature] (split-jws-message input)]
-     (when-not (verify-signature {:key pkey
-                                  :signature signature
-                                  :alg alg
-                                  :header header
-                                  :payload payload})
+     (when-not
+       (try
+         (verify-signature {:key       pkey
+                            :signature signature
+                            :alg       alg
+                            :header    header
+                            :payload   payload})
+         (catch java.security.SignatureException se
+           (throw (ex-info "Message seems corrupt or manipulated."
+                           {:type :validation :cause :signature}
+                           se))))
        (throw (ex-info "Message seems corrupt or manipulated."
                        {:type :validation :cause :signature})))
      (decode-payload payload))))


fix typo

fix typo

--- frontend/core.cljs
+++ frontend/core.cljs
@@ -127,7 +127,7 @@
 (defn setup! []
   (main app-state (sel1 :body))
   ;; XXX direct dispatching is probably the wrong approach
-  (sec/dispatch! (.getPath (goog.Uri. js/document.location.href)) "/"))
+  (sec/dispatch! (.getPath (goog.Uri. js/document.location.href))))

 ;; Wait for the page to finish loading before we kick off the setup
 ;; process


Start less hardcoding of t1.

Start less hardcoding of t1.

--- src/cbfg/world/t1.cljs
+++ src/cbfg/world/t1.cljs
@@ -184,7 +184,7 @@

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

-(defn world-vis-init [el-prefix init-event-delay]
+(defn world-vis-init-t [js-ns el-prefix init-event-delay]
   (init-roots)
   (let [req-handlers cbfg.world.lane/cmd-handlers
         req-ch (map< (fn [ev] {:op (.-id (.-target ev))
@@ -243,7 +243,7 @@
                 (first (wait-until #(seq (cbfg.world.net/net-actx-info @vis "net-1")))))
         (let [expand-ch (listen-el (gdom/getElement (str el-prefix "-html")) "click")
               prog-in (get-el-value "prog-in")
-              prog-js (str "with (cbfg.world.t1) {" prog-in "}")
+              prog-js (str "with (" js-ns ") {" prog-in "}")
               prog-res (try (js/eval prog-js) (catch js/Object ex ex))]
           (go-loop [num-requests 0 num-responses 0]
             (let [[v ch] (alts! [req-ch (:res-ch @prog-base)])
@@ -277,6 +277,9 @@
           (close! (:res-ch @prog-base))
           (recur (inc num-worlds)))))))

+(defn world-vis-init [el-prefix init-event-delay]
+  (world-vis-init-t "cbfg.world.t1" el-prefix init-event-delay))
+
 ; --------------------------------------------

 (defn kv-server [server-addr & ports]


TODO comment on audit log.

TODO comment on audit log.

--- src/cbfg/world/t2.cljs
+++ src/cbfg/world/t2.cljs
@@ -127,6 +127,7 @@
           (if (not (get (:key m) colls))
             (let [nrev (inc (:rev server-state))
                   coll (make-coll actx nrev (:key m))]
+              ; TODO: audit log on success and failure.
               [(-> server-state
                    (assoc-in [:realms (:cur-realm m)
                               :collsets (:cur-realm-collset m)


Remove testing text boxes

Remove testing text boxes

--- src/re_demo/input_text.cljs
+++ src/re_demo/input_text.cljs
@@ -70,62 +70,7 @@
                                                                    :on-change        #(reset! text-val %)
                                                                    :validation-regex @regex
                                                                    :change-on-blur?  change-on-blur?
-                                                                   :disabled?        disabled?]
-
-                                                                  ;;;
-
-                                                                  [input-text
-                                                                   :model text-val
-                                                                   :status :validating
-                                                                   :status-icon? @status-icon?
-                                                                   :status-tooltip @status-tooltip
-                                                                   :width "300px"
-                                                                   :placeholder (if @regex "enter number (99.9)" "placeholder message")
-                                                                   :on-change #(reset! text-val %)
-                                                                   :validation-regex @regex
-                                                                   :change-on-blur? change-on-blur?
-                                                                   :disabled? disabled?]
-
-                                                                  [input-text
-                                                                   :model text-val
-                                                                   :status :success
-                                                                   :status-icon? @status-icon?
-                                                                   :status-tooltip @status-tooltip
-                                                                   :width "300px"
-                                                                   :placeholder (if @regex "enter number (99.9)" "placeholder message")
-                                                                   :on-change #(reset! text-val %)
-                                                                   :validation-regex @regex
-                                                                   :change-on-blur? change-on-blur?
-                                                                   :disabled? disabled?]
-
-                                                                  [input-text
-                                                                   :model text-val
-                                                                   :status :warning
-                                                                   :status-icon? @status-icon?
-                                                                   :status-tooltip @status-tooltip
-                                                                   :width "300px"
-                                                                   :placeholder (if @regex "enter number (99.9)" "placeholder message")
-                                                                   :on-change #(reset! text-val %)
-                                                                   :validation-regex @regex
-                                                                   :change-on-blur? change-on-blur?
-                                                                   :disabled? disabled?]
-                                                                  [input-text
-                                                                   :model text-val
-                                                                   :status :error
-                                                                   :status-icon? @status-icon?
-                                                                   :status-tooltip @status-tooltip
-                                                                   :width "300px"
-                                                                   :placeholder (if @regex "enter number (99.9)" "placeholder message")
-                                                                   :on-change #(reset! text-val %)
-                                                                   :validation-regex @regex
-                                                                   :change-on-blur? change-on-blur?
-                                                                   :disabled? disabled?]
-                                                                  ]
-
-
-
-
-                                                       ]
+                                                                   :disabled?        disabled?]]]
                                                       [v-box
                                                        :gap      "15px"
                                                        :children [[title :level :level3 :label "Callbacks"]


Clarify comment

Clarify comment

--- src/re_frame/registrar.cljc
+++ src/re_frame/registrar.cljc
@@ -26,9 +26,9 @@

   ([kind id required?]
    (let [handler (get-handler kind id)]
-     (when debug-enabled?                                   ;; This is in a separate when so Closure DCE can run
-       (when (and required? (nil? handler))                 ;; Otherwise you'd need to type hint the and with a ^boolean for DCE.
-         (console :error "re-frame: no " (str kind) " handler registered for:" id)))
+     (when debug-enabled?                          ;; This is in a separate when so Closure DCE can run ...
+       (when (and required? (nil? handler))        ;; ...otherwise you'd need to type hint the `and` with a ^boolean for DCE.
+         (console :error "re-frame: no " (str kind) " handler registered for: " id)))
      handler)))


Added a simple metric of similarity of results from the two engines

--- src/cloogling/core.clj
+++ src/cloogling/core.clj
@@ -136,6 +136,15 @@

+(defn simple-similarity-metric [x y]
+  (try (str (format "%3f" (* 100 (float (/ (count x) (count y))))) "%")
+    (catch ArithmeticException e "0.0%" )
+    )
+  )
+
+
+(str (format "%3f" (* 100 (float (/ 1 2)))) "%")
+(.decimalValue (/ 1 2))

 (defn uber-query
   [x]
@@ -144,12 +153,18 @@
                                      x)
         bing-result (search-bing (read-property "config.json" "bing" "username")
                                  (read-property "config.json" "bing" "password")
-                                 x)]
-
-    [(get-aggregated-result google-result bing-result) (get-common-urls google-result bing-result)]
-
-    )
-  )
+                                 x)
+        duplicated-in-bing (get-common-urls google-result bing-result)
+
+        similarity-metric (simple-similarity-metric duplicated-in-bing google-result)
+        ]
+
+    [(get-aggregated-result google-result bing-result) duplicated-in-bing similarity-metric ]
+
+    )
+  )
+
+

 ;;(uber-query "Miles Davis")

@@ -207,6 +222,9 @@
                 "\n-------------------------\n\n"
                 "The following results were duplicated in Bing:\n\n"
                 (get-printable-result (second uber-query-result))
+                "\n-------------------------\n\n"
+                "A simple similarity metric (does not consider results order): "
+                (nth uber-query-result 2)


Typo.

Typo.

--- src/rivulet/bridge.clj
+++ src/rivulet/bridge.clj
@@ -9,7 +9,7 @@

 (defonce vertx (atom nil))

-(defmacro with-vertx [&body]
+(defmacro with-vertx [& body]
   `(vembed/with-vertx @vertx ~@body))

 (defn dest->eventbus [dest address]


beats-user-data-ubuntu

beats-user-data-ubuntu

--- src/terraboot/user_data.clj
+++ src/terraboot/user_data.clj
@@ -12,6 +12,24 @@
                  {:path    "/etc/beats/metricbeat.yml"
                   :content (snippet "system-files/metricbeat.yml")}]})

+(def beats-user-data-ubuntu
+  {:write_files [{:path    "/etc/beats/filebeat.yml"
+                  :content (snippet "system-files/filebeat.yml")}
+                 {:path    "/etc/beats/metricbeat.yml"
+                  :content (snippet "system-files/metricbeat.yml")}
+                 {:path    "/etc/systemd/system/copy-bins.service"
+                  :content (snippet "systemd/copy-bins.service")}
+                 {:path    "/etc/systemd/system/filebeat.service"
+                  :content (snippet "systemd/filebeat.service")}
+                 {:path    "/etc/systemd/system/metricbeat.service"
+                  :content (snippet "systemd/metricbeat.service")}]
+   :runcmd      ["systemctl daemon-reload"
+                 "systemctl start copy-bins.service"
+                 "systemctl enable metricbeat.service"
+                 "systemctl enable filebeat.service"
+                 "systemctl start metricbeat.service"
+                 "systemctl start filebeat.service"]})
+
 (def dockerd-logging
   {:write_files [{:path        "/etc/systemd/system/docker.service.d/journald-logging.conf"
                   :content     (snippet "system-files/dockerd-journald-logging.conf")


Fixed problem that the old classpath entries were lost.

--- ccw.support.examples/src/ccw/support/labrepl/wizards/LabreplCreationOperation.clj
+++ ccw.support.examples/src/ccw/support/labrepl/wizards/LabreplCreationOperation.clj
@@ -97,12 +97,13 @@
   [project]
   (let
     [java-project (.getJavaProject (ClojureCore/getClojureProject project))
+     old-lib-entries (vec (.getRawClasspath java-project))
      lib-members (.members (.getFolder project "lib"))
-     lib-entries
+     new-lib-entries
        (into-array
-         (map #(JavaCore/newLibraryEntry (.getFullPath %) nil nil) lib-members))]
+         (concat old-lib-entries (map #(JavaCore/newLibraryEntry (.getFullPath %) nil nil) lib-members)))]
     (doto java-project
-      (.setRawClasspath lib-entries nil)
+      (.setRawClasspath new-lib-entries nil)
       (.save nil true))))

 (defn create-project


Prefer if to when for single expressions.

--- src/shale/sessions.clj
+++ src/shale/sessions.clj
@@ -171,7 +171,7 @@
   "Asynchronously point a session to a url. Destroy the session if the
   webdriver is dead. Return true if everything seems okay."
   (let [okay (not (session-go-to-url session-id current-url))]
-    (when (not okay) (destroy-session session-id))
+    (if-not okay (destroy-session session-id))
     okay))

 (def ModifyArg
@@ -191,7 +191,7 @@
       (session-key session-id)
       (select-keys session
         [:reserved :current-url :browser-name :node]))
-    (when (contains? session :tags)
+    (if (contains? session :tags)
       (save-session-tags-to-redis session-id (session :tags)))))

 (defn modify-session
@@ -208,7 +208,7 @@
                :as modifications}]
   (info (format "Modifing session %s, %s" session-id (str modifications)))
   (when (some #{session-id} (session-ids))
-    (when (or (not current-url)
+    (if (or (not current-url)
             (session-go-to-url-or-destroy-session session-id current-url))
       (save-session-diff-to-redis
         session-id


Add some missing methods to the jooq transaction context implementation.

--- src/suricatta/core.clj
+++ src/suricatta/core.clj
@@ -118,10 +118,9 @@
         cause       (atom nil)]
     (reify org.jooq.TransactionContext
       (configuration [_] conf)
-      ;; jOOQ 3.5.x
-      ;; (settings [_] (.settings conf))
-      ;; (dialect [_] (.dialect conf))
-      ;; (family [_] (.family (.dialect conf)))
+      (settings [_] (.settings conf))
+      (dialect [_] (.dialect conf))
+      (family [_] (.family (.dialect conf)))
       (transaction [_] @transaction)
       (transaction [self t] (reset! transaction t) self)
       (cause [_] @cause)


Store link to parent in all nodes (not used yet)

--- src/custard/parser.clj
+++ src/custard/parser.clj
@@ -107,8 +107,11 @@
           (build-node [graph node]
             (let [ident (node->ident node)
                   children (:children node)
+                  parent (if (nil? (:parent node))
+                           nil
+                           {:name (:parent node)})
                   linked-data (-> node
-                                  (dissc :parent)
+                                  (assoc :parent parent)
                                   (update :children #(mapv node->link %))
                                   keywordize-keys)]
               (-> graph


CMR-3279 fixes validation

CMR-3279 fixes validation

--- access-control-app/src/cmr/access_control/services/acl_search_service.clj
+++ access-control-app/src/cmr/access_control/services/acl_search_service.clj
@@ -227,7 +227,7 @@
  (let [[safe-params type-errors] (cpv/apply-type-validations
                                    params
                                    [(partial cpv/validate-map [:options])
-                                    (partial cpv/validate-map [:options :collection-concept-id])
+                                    (partial cpv/validate-map [:collection-concept-id])
                                     (partial cpv/validate-map [:options :permitted-group])
                                     (partial cpv/validate-map [:options :identity-type])
                                     (partial cpv/validate-map [:options :provider])


update language-in and language-out

update language-in and language-out

--- sidecar/src/figwheel_sidecar/schemas/cljs_options.clj
+++ sidecar/src/figwheel_sidecar/schemas/cljs_options.clj
@@ -465,27 +465,53 @@
   :compiler-stats true")

 (s/def ::closure-language-in-out-opts
-  #{:ecmascript3 :ecmascript5 :ecmascript5-strict
-    :ecmascript6 :ecmascript6-typed :ecmascript6-strict
+  #{:ecmascript-next    :es-next
+    :ecmascript-2017    :es-2017
+    :ecmascript-2016    :es-2016
+    :ecmascript-2015    :es-2015
+    :ecmascript6        :es6
+    :ecmascript6-strict :es6-strict
+    :ecmascript6-typed  :es6-typed
+    :ecmascript5        :es5
+    :ecmascript5-strict :es5-strict
+    :ecmascript3        :es3
     :no-transpile})

 (def-key ::language-in         ::closure-language-in-out-opts
-
-  "Configure the input and output languages for the closure library. May
-be :ecmascript3, ecmascript5, ecmascript5-strict, :ecmascript6-typed,
-:ecmascript6-strict, :ecmascript6 or :no-transpile.
-
-Defaults to :ecmascript3
+  "Configure the input and output languages for the closure library. May be:
+
+* :ecmascript-next identical to :es-next
+* :ecmascript-2017 identical to :es-2017
+* :ecmascript-2016 identical to :es-2016
+* :ecmascript-2015 identical to :es-2015
+* :ecmascript6 :es6
+* :ecmascript6-strict :es6-strict
+* :ecmascript6-typed identical to :es6-typed
+* :ecmascript5 identical to :es5
+* :ecmascript5-strict identical to :es5-strict
+* :ecmascript3 identical to :es3
+* :no-transpile
+
+Defaults to :ecmascript5

   :language-in  :ecmascript3")

 (def-key ::language-out        ::closure-language-in-out-opts
-
-  "Configure the input and output languages for the closure library. May
-be :ecmascript3, ecmascript5, ecmascript5-strict, :ecmascript6-typed,
-:ecmascript6-strict, :ecmascript6 or :no-transpile.
-
-Defaults to :ecmascript3
+  "Configure the input and output languages for the closure library. May be:
+
+* :ecmascript-next identical to :es-next
+* :ecmascript-2017 identical to :es-2017
+* :ecmascript-2016 identical to :es-2016
+* :ecmascript-2015 identical to :es-2015
+* :ecmascript6 :es6
+* :ecmascript6-strict :es6-strict
+* :ecmascript6-typed identical to :es6-typed
+* :ecmascript5 identical to :es5
+* :ecmascript5-strict identical to :es5-strict
+* :ecmascript3 identical to :es3
+* :no-transpile
+
+Defaults to :no-transpile

   :language-out  :ecmascript3")


Whitespace

Whitespace

--- src/angelic/search/implicit/dash_astar_opt_simple.clj
+++ src/angelic/search/implicit/dash_astar_opt_simple.clj
@@ -196,7 +196,6 @@

 ;; Multimethod to get a subproblem by name, or nil for dead.
 (defmulti get-subproblem (fn get-subproblem-dispatch [nm inp] (first nm)))
-

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


(SERVER-547) Make 404 upgrade handler optional

If the legacy routing service is enabled then the friendly upgrade
message needs to be disabled since the both use the same mount point.
This commit checks to see if the `invalid-in-puppet-4` route id is
configured before mounting the friendly 404 handler.

--- src/clj/puppetlabs/services/master/master_service.clj
+++ src/clj/puppetlabs/services/master/master_service.clj
@@ -10,7 +10,7 @@

 (defservice master-service
   master/MasterService
-  [[:WebroutingService add-ring-handler get-route]
+  [[:WebroutingService add-ring-handler get-route get-registered-endpoints]
    [:PuppetServerConfigService get-config]
    [:RequestHandlerService handle-request]
    [:CaService initialize-master-ssl! retrieve-ca-cert! retrieve-ca-crl!]
@@ -20,6 +20,10 @@
    (core/validate-memory-requirements!)
    (let [path              (get-route this :master-routes)
          config            (get-config)
+         upgrade-error-path (get-in config
+                              [:web-router-service
+                               ::master-service
+                               :invalid-in-puppet-4])
          certname          (get-in config [:puppet-server :certname])
          localcacert       (get-in config [:puppet-server :localcacert])
          hostcrl           (get-in config [:puppet-server :hostcrl])
@@ -30,7 +34,6 @@
                                 :artifact-id "puppetserver"})
          upgrade-error     (core/construct-404-error-message jruby-service product-name)
          update-server-url (get-in config [:product :update-server-url])]
-
      (version-check/check-for-updates! {:product-name product-name} update-server-url)

      (retrieve-ca-cert! localcacert)
@@ -42,7 +45,12 @@
        this
       (compojure/context path [] (core/build-ring-handler handle-request))
       {:route-id :master-routes})
-     (add-ring-handler this (core/construct-invalid-request-handler upgrade-error) {:route-id :invalid-in-puppet-4}))
+
+     (when upgrade-error-path
+       (add-ring-handler
+         this
+         (core/construct-invalid-request-handler upgrade-error)
+         {:route-id :invalid-in-puppet-4})))
    context)
   (start
     [this context]


Fix TTL

Fix TTL

--- src/clojure/clojurewerkz/cassaforte/new_query_api.clj
+++ src/clojure/clojurewerkz/cassaforte/new_query_api.clj
@@ -536,7 +536,7 @@
   [:alter-column [column-name column-type]])

 (def ^:private alter-options
-  {:default-ttl                 (fn [opts val] (.defaultTimeToLive opts val))
+  {:default-ttl                 (fn [opts val] (.defaultTimeToLive opts (int val)))
    :bloom-filter-fp-chance      (fn [opts val] (.bloomFilterFPChance opts val))
    :caching                     (fn [opts val] (.caching opts val))
    :gc-grace-seconds            (fn [opts val] (.gcGraceSeconds opts val))


Add if-not-exists

Add if-not-exists

--- src/clojure/clojurewerkz/cassaforte/new_query_api.clj
+++ src/clojure/clojurewerkz/cassaforte/new_query_api.clj
@@ -264,6 +264,11 @@
    (fn value-query [query-builder]
      (.value query-builder (name key) value))])

+(defn if-not-exists
+  []
+  [:if-not-exists
+   (fn if-not-exists [query-builder]
+     (.ifNotExists query-builder))])

 (defn values
   ([m]


Revert "Test speed up using filter"

Revert "Test speed up using filter"

This reverts commit 36dd241a17fb663f2d27a5a127948073e646a063.

--- src/wlmmap/handler.clj
+++ src/wlmmap/handler.clj
@@ -41,29 +41,30 @@
   "return a string with the javascript code to generate addressPoints."
   [params]
   (let [mons (take 5000 (wcar* (car/smembers "frfrim")))
-        all (for [m (filter #(:lat %) mons)]
-              (let [res (read-string (wcar* (car/get m)))
-                    lat (:lat res)
-                    lon (:lon res)
-                    reg (:registrant_url res)
-                    id (:id res)
-                    nam (cleanup-name (:name res))
-                    imc (:image res)
-                    img (codec/url-encode imc)
-                    lng (:lang res)
-                    emb (str "")
-                    ilk (if (not (= imc ""))
-                          (str "" emb "") "")
-                    art (:monument_article res)
-                    arl (format "%s" lng art art)
-                    src (format "Source: %s" reg id)]
-                (when (and lat lon nam)
-                  (format "[%s,%s,\"%s\",\"%s\"]" lat lon nam
-                          (str "
" nam "
"
-                               ilk "
" (if art (str arl "
") "")
-                               src "
")))))]
+        all (remove #(nil? %)
+                    (for [m mons]
+                      (let [res (read-string (wcar* (car/get m)))
+                            lat (:lat res)
+                            lon (:lon res)
+                            reg (:registrant_url res)
+                            id (:id res)
+                            nam (cleanup-name (:name res))
+                            imc (:image res)
+                            img (codec/url-encode imc)
+                            lng (:lang res)
+                            emb (str "")
+                            ilk (if (not (= imc ""))
+                                  (str "" emb "") "")
+                            art (:monument_article res)
+                            arl (format "%s" lng art art)
+                            src (format "Source: %s" reg id)]
+                        (when (and lat lon nam)
+                          (format "[%s,%s,\"%s\",\"%s\"]" lat lon nam
+                                  (str "
" nam "
"
+                                       ilk "
" (if art (str arl "
") "")
+                                       src "
"))))))]
     (str "var addressPoints = [" (str/join "," all) "];")))

 (defn- index [params]


add support for type-translations to sql-model - allows us to provide more specific types than those defaulted from sql-metadata

--- dada-core/src/main/clojure/org/dada/core.clj
+++ dada-core/src/main/clojure/org/dada/core.clj
@@ -305,19 +305,27 @@
 ;;--------------------------------------------------------------------------------

 (defn sql-attributes
-  "Derive a sequence of MetaData attributes from a SQL ResultSet"
-  [#^ResultSetMetaData sql-metadata]
+  "Derive a sequence of MetaData attributes from an SQL ResultSet"
+  [#^ResultSetMetaData sql-metadata type-translations]
   (map
    (fn [column]
-       [(keyword (.getColumnName sql-metadata column))
-	(Class/forName (.getColumnClassName sql-metadata column))
-	true])			 ;we don't know - so assume mutability
+       (let [key (keyword (.getColumnName sql-metadata column))]
+	 [key
+	  (or (let [[type] (type-translations key)] type)
+	      (Class/forName (.getColumnClassName sql-metadata column)))
+	  true]))		 ;we don't know - so assume mutability
    (range 1 (+ 1 (.getColumnCount sql-metadata)))))

 (defn sql-data
   "Create a sequence from some MetaData and a SQL ResultSet"
-  [#^Metadata metadata #^ResultSet result-set]
-  (let [creator (.getCreator metadata)]
+  [#^Metadata metadata #^ResultSet result-set type-translations]
+  (let [creator (.getCreator metadata)
+	readers (map
+		 (fn [#^Attribute attribute]
+		     (let [[_ translator] (type-translations (.getKey attribute))]
+		       (or translator
+			   (fn [#^ResultSet result-set #^Integer column-index] (.getObject result-set column-index)))))
+		 (.getAttributes metadata))]
     (loop [output nil]
       (if (.next result-set)
 	(recur
@@ -327,8 +335,9 @@
 	   (into-array
 	    Object
 	    (map
-	     (fn [#^Integer column] (.getObject result-set column))
-	     (range 1 (+ 1 (count (.getAttributes metadata)))))))
+	     (fn [reader #^Integer column-index] (reader result-set column-index))
+	     readers
+	     (iterate inc 1))))
 	  output))
 	output))))

@@ -343,17 +352,16 @@

 (defn sql-model
   "make a SQL query and return the ResultSet as a Model"
-  [model-name #^Connection connection #^String sql primary-keys version-keys version-comparator]
+  [model-name #^Connection connection #^String sql primary-keys version-keys version-comparator & [type-translations]]
   (let [result-set (.executeQuery (.prepareStatement connection sql))
-	;;metadata (record-metadata [:id] [] nil (sql-attributes (.getMetaData result-set))) ;lets use records...
 	metadata (custom-metadata
 		  (name (gensym "org.dada.core.SQLModel"))
 		  Object
 		  primary-keys
 		  version-keys
 		  version-comparator
-		  (sql-attributes (.getMetaData result-set)))
-	data (sql-data metadata result-set)
+		  (sql-attributes (.getMetaData result-set) type-translations))
+	data (sql-data metadata result-set type-translations)
 	sql-model (model model-name metadata)]
     (.close result-set)
     (insert-n sql-model data)


Catch all exceptions in sanitizer

Catch all exceptions in sanitizer

--- src/devtools/core.cljs
+++ src/devtools/core.cljs
@@ -35,7 +35,7 @@
       (api-call value)                                      ; raw API call
       (try
         (api-call value)                                    ; wrapped API call
-        (catch js/Object e
+        (catch :default e
           (debug/log-exception e)
           nil)))))


Improved macro

Improved macro

--- src/fake_http/core.clj
+++ src/fake_http/core.clj
@@ -177,23 +177,18 @@
   "Applies routes and creates and stops a fake server implicitly"
   {:arglists '([bindings? routes & body])}
   [bindings-or-routes & more-args]
-  ;{:pre [(vector? bindings) (even? (count bindings))]}
   (let [[bindings routes body] (if (vector? bindings-or-routes)
                                  [bindings-or-routes (first more-args) (rest more-args)]
                                  [[] bindings-or-routes more-args])]
-    (cond
-      (= (count bindings) 0) `(let [server# (start! ~routes)
-                                    ~'uri (:uri server#)]
-                                (try
-                                  ~@body
-                                  (finally
-                                    (.close server#))))
-      (symbol? (bindings 0)) `(let ~bindings
-                                (let [server# (start! ~routes)
-                                      ~'uri (:uri server#)]
-                                  (try
-                                    ~@body
-                                    (finally
-                                      (.close server#)))))
-      :else (throw (IllegalArgumentException.
-                     "with-routes! only allows Symbols in bindings")))))+
+    (assert (and (vector? bindings)
+                 (even? (count bindings))
+                 (every? symbol? (take-nth 2 bindings))) "Bindings need to be a vector with an even number of forms")
+
+    `(let ~bindings
+       (let [server# (start! ~routes)
+             ~'uri (:uri server#)]
+         (try
+           ~@body
+           (finally
+             (.close server#)))))))


Fix logic for when to request new access token

...also fix `or` indentation.

Thanks for the library!  Just the right abstraction I was looking for.

--- src/gmail_clj/core.clj
+++ src/gmail_clj/core.clj
@@ -124,7 +124,7 @@
   "Returns the current active auth token."
   []
   (when (or (nil? *access-token*)
-          (> (:expires *access-token*) (now)))
+            (< (:expires *access-token*) (now)))
     (request-auth))
   (:token *access-token*))