started work on classifier -- need to move out of trend analysis

--- src/clj/forma/trends/analysis.clj
+++ src/clj/forma/trends/analysis.clj
@@ -1,7 +1,8 @@
 (ns forma.trends.analysis
-  (:use [forma.matrix.utils :only (variance-matrix coll-avg)]
+  (:use [forma.matrix.utils :only (variance-matrix coll-avg ones-column)]
         [clojure.math.numeric-tower :only (sqrt floor abs expt)]
-        [forma.trends.filter :only (deseasonalize make-reliable hp-filter)])
+        [forma.trends.filter :only (deseasonalize make-reliable hp-filter)]
+        [clojure-csv.core])
   (:require [forma.utils :as utils]
             [incanter.core :as i]
             [incanter.stats :as s]))
@@ -140,13 +141,12 @@
   to do."
   [y long-block short-block & x]
   (let [characteristics (create-struct :short :long :long-tstat :break)
-        deseas (harmonic-seasonal-decomposition 23 3 y)
-        [long-val long-tstat] (apply long-stats deseas x)]
+        [long-val long-tstat] (apply long-stats y x)]
     (struct characteristics
-            (min-short-trend long-block short-block deseas)
+            (min-short-trend long-block short-block y)
             long-val
             long-tstat
-            (apply hansen-stat deseas x))))
+            (apply hansen-stat y x))))

 (defn scaled-vector
   [scalar coll]
@@ -187,6 +187,73 @@
          (apply (partial map -) [coll S]))))

+(def mys-data (let [file "/Users/danhammer/Desktop/testmys/allmys.txt"]
+                (map
+                 (partial map #(Float/parseFloat %))
+                 (parse-csv
+                  (slurp file)))))
+
+(def mys-labels (take 100000 (map last mys-data)))
+(def mys-features (take 100000 (map butlast mys-data)))
+
+(def X (i/bind-columns
+        (ones-column (count mys-features))
+        (i/matrix (vec (map vec mys-features)))))
+(def Xt (i/trans X))
+
+
+(def beta (i/trans (i/matrix (repeat 23 0))))
+
+(defn make-binary
+  [coll]
+  (map #(if (> % 0) 1 0) coll))
+
+(def y (make-binary mys-labels))
+
+(defn one-minus
+  [coll]
+  (map #(- 1 %) coll))
+
+(defn prob
+  [beta X]
+  (let [exp-bx (map #(Math/exp %) (i/mmult beta (i/trans X)))]
+    (map / exp-bx (map inc exp-bx))))
+
+(defn log-likelihood
+  [prob labels]
+  (let [inv-log-p (map * (map #(- 1 %) labels)
+                       (map #(Math/log %) (map #(- 1 %) prob)))
+        log-p (map * labels (map #(Math/log %)  prob))]
+    (reduce + (map + inv-log-p log-p))))
+
+(defn info-matrix
+  [X Xt y p]
+  (let [p-vec (map * p (one-minus p))]
+    (i/mmult
+     (map (partial map * p-vec) Xt)
+     X)))
+
+(defn increment-beta
+  [X Xt y p rdg-cons]
+  (let [score (i/mmult Xt (map - y p))
+        [obs chars] (i/dim X)
+        info-mat (info-matrix X Xt y p)
+        info-adj (i/plus info-mat (i/diag (repeat chars rdg-cons)))]
+    (i/mmult
+     (i/solve info-adj) score)))
+
+(defn logistic-ridge-classifier
+  [y X rdg-cons]
+  (let [b (repeat (second (i/dim X)) 0)
+        Xt (i/trans X)]
+    (loop [beta b diff 4]
+      (if (zero? diff)
+        beta
+        (recur (let [p (prob (i/trans beta) X)
+                     inc-beta (increment-beta X Xt y p rdg-cons)]
+                 (println beta)
+                 map + beta inc-beta)
+               (dec diff))))))

 ;; ## WHOOPBANG :: Collect the short-term drop associated with a
 ;; ## time-series
@@ -219,17 +286,17 @@
 ;;           (windowed-apply coll-avg window)
 ;;           (make-monotonic min))))

-(defn collect-short-trend
-  "preps the short-term drop for the merge into the other data by separating
-  out the reference period and the rest of the observations for estimation,
-  that is, `for-est`!"
-  ([start-pd end-pd long-block window ts]
-     (collect-short-trend start-pd end-pd long-block window ts []))
-  ([start-pd end-pd long-block window ts reli-ts]
-     (let [offset (+ long-block window)
-           [y z] (map #(-> % (- offset) (+ 2)) [start-pd end-pd])
-           full-ts (short-trend long-block window ts reli-ts)]
-       (subvec full-ts (dec y) z))))
+;; (defn collect-short-trend
+;;   "preps the short-term drop for the merge into the other data by separating
+;;   out the reference period and the rest of the observations for estimation,
+;;   that is, `for-est`!"
+;;   ([start-pd end-pd long-block window ts]
+;;      (collect-short-trend start-pd end-pd long-block window ts []))
+;;   ([start-pd end-pd long-block window ts reli-ts]
+;;      (let [offset (+ long-block window)
+;;            [y z] (map #(-> % (- offset) (+ 2)) [start-pd end-pd])
+;;            full-ts (short-trend long-block window ts reli-ts)]
+;;        (subvec full-ts (dec y) z))))

 ;; WHIZBANG :: Collect the long-term drop of a time-series


Implement Casting Call.

Implement Casting Call.

--- src/clj/game/cards-operations.clj
+++ src/clj/game/cards-operations.clj
@@ -39,6 +39,26 @@

    "Blue Level Clearance"
    {:effect (effect (gain :credit 5) (draw 2))}
+
+   "Casting Call"
+   {:choices {:req #(and (:type % "Agenda") (= (:zone %) [:hand]))}
+    :effect (req (let [agenda target]
+                   (resolve-ability
+                     state side {:prompt (str "Choose a server to install " (:title agenda))
+                                 :choices (server-list state agenda)
+                                 :effect (req (corp-install state side agenda target {:install-state :face-up})
+                                              ; find where the agenda ended up and host on it
+                                              (let [agenda (some #(when (= (:cid %) (:cid agenda)) %)
+                                                                 (all-installed state :corp))]
+                                                ; the operation ends up in :discard when it is played; to host it,
+                                                ; we need (host) to look for it in discard.
+                                                (host state side agenda (assoc card :zone [:discard]
+                                                                                :seen true :installed true))
+                                                (system-msg state side
+                                                            (str "hosts Casting Call on " (:title agenda)))))}
+                     card nil)))
+    :events {:access {:req (req (= (:cid target) (:cid (:host card))))
+                      :effect (effect (gain :runner :tag 2)) :msg "give the Runner 2 tags"}}}

    "Celebrity Gift"
    {:choices {:max 5 :req #(and (:side % "Corp") (= (:zone %) [:hand]))}


dummy changes in pages

dummy changes in pages

--- src/cljs/work_sessions/pages.cljs
+++ src/cljs/work_sessions/pages.cljs
@@ -9,7 +9,7 @@
    ;;
    ;; pages
    ;;
-   ;; [childrensfutures-trade.components.home-page :refer [home-page]]
+   ;; [work-sessions.components.home-page :refer [home-page]]
    ;; [childrensfutures-trade.components.my-goals-page :refer [my-goals-page]]
    ;; [childrensfutures-trade.components.pulse-page :refer [pulse-page]]
    ;; [childrensfutures-trade.components.how-to-play-page :refer [how-to-play-page]]
@@ -19,6 +19,7 @@
    ;; [childrensfutures-trade.components.latest-events-page :refer [latest-events-page]]

    ))
+

 (def page-defs


Fix typo

Fix typo

--- src/clojure/clj_chess/analyse.clj
+++ src/clojure/clj_chess/analyse.clj
@@ -21,7 +21,7 @@
                                      finish-iteration? :finish-iteration?
                                      search-moves :search-moves}]
   (if-not (= 1 (count (keep identity [depth time nodes])))
-    (throw (Exception. "Exactly one if :depth, :time and :nodes must be supplied"))
+    (throw (Exception. "Exactly one of :depth, :time and :nodes must be supplied"))
     (let [command (go-command depth time nodes finish-iteration? search-moves)
           engine-output (do
                           (uci/send-command engine (chess/board-to-uci board))
@@ -135,4 +135,4 @@
                   {:move (chess/move-to-uci m)}
                   (analyse-move engine b m :depth depth :time time :nodes nodes)))
               (reverse (chess/boards-with-moves game))))
-       (build-game-from-analysis (:tags game))))+       (build-game-from-analysis (:tags game))))


Parse PORT as Integer

Parse PORT as Integer

--- dev/system.clj
+++ dev/system.clj
@@ -1,7 +1,8 @@
 (ns system
   (:require [clojure.string :as str]
+            [org.httpkit.server :refer [run-server]]
             [lens.app :refer [app]]
-            [org.httpkit.server :refer [run-server]]))
+            [lens.util :refer [parse-int]]))

 (defn env []
   (->> (str/split-lines (slurp ".env"))
@@ -13,7 +14,7 @@
   {:app app
    :db-uri (or (env "DB_URI") "datomic:mem://lens")
    :version (System/getProperty "lens.version")
-   :port (or (env "PORT") 5001)
+   :port (or (some-> (env "PORT") (parse-int)) 5001)
    :mdb-uri (env "MDB_URI")})

 (defn start [{:keys [app db-uri version port] :as system}]


Make it Possible to Start REPL without .env File

I use a in-memory DB with populated base schema in this case.

--- dev/system.clj
+++ dev/system.clj
@@ -2,20 +2,30 @@
   (:require [clojure.string :as str]
             [org.httpkit.server :refer [run-server]]
             [lens.app :refer [app]]
-            [lens.util :refer [parse-int]]))
+            [lens.util :refer [parse-int]]
+            [datomic.api :as d]
+            [lens.schema :as schema])
+  (:import [java.io File]))

 (defn env []
-  (->> (str/split-lines (slurp ".env"))
-       (reduce (fn [ret line]
-                 (let [vs (str/split line #"=")]
-                   (assoc ret (first vs) (str/join "=" (rest vs))))) {})))
+  (if (.canRead (File. ".env"))
+    (->> (str/split-lines (slurp ".env"))
+         (reduce (fn [ret line]
+                   (let [vs (str/split line #"=")]
+                     (assoc ret (first vs) (str/join "=" (rest vs))))) {}))
+    {}))
+
+(defn create-mem-db []
+  (let [uri "datomic:mem://lens"]
+    (d/create-database uri)
+    (schema/load-base-schema (d/connect uri))
+    uri))

 (defn system [env]
   {:app app
-   :db-uri (or (env "DB_URI") "datomic:mem://lens")
+   :db-uri (or (env "DB_URI") (create-mem-db))
    :version (System/getProperty "lens.version")
-   :port (or (some-> (env "PORT") (parse-int)) 5001)
-   :mdb-uri (env "MDB_URI")})
+   :port (or (some-> (env "PORT") (parse-int)) 5001)})

 (defn start [{:keys [app db-uri version port] :as system}]
   (let [stop-fn (run-server (app db-uri version) {:port port})]


[#13181] Cannot delete images or audio messages

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

--- src/status_im/ui/screens/chat/message/message.cljs
+++ src/status_im/ui/screens/chat/message/message.cljs
@@ -572,31 +572,45 @@
                          :source {:uri (contenthash/url (-> content :sticker :hash))}}]]
      reaction-picker]))

-(defmethod ->message constants/content-type-image [{:keys [content in-popover?] :as message} {:keys [on-long-press modal]
-                                                                                :as   reaction-picker}]
+(defmethod ->message constants/content-type-image
+  [{:keys [content in-popover? outgoing] :as message}
+   {:keys [on-long-press modal]
+    :as   reaction-picker}]
   [message-content-wrapper message
-   [message-content-image message {:modal         modal
-                                   :disabled      in-popover?
-                                   :delay-long-press 100
-                                   :on-long-press (fn []
-                                                    (on-long-press
-                                                     [{:on-press #(re-frame/dispatch [:chat.ui/reply-to-message message])
-                                                       :id       :reply
-                                                       :label    (i18n/label :t/message-reply)}
-                                                      {:on-press #(re-frame/dispatch [:chat.ui/save-image-to-gallery (:image content)])
-                                                       :id       :save
-                                                       :label    (i18n/label :t/save)}]))}]
+   [message-content-image message
+    {:modal         modal
+     :disabled      in-popover?
+     :delay-long-press 100
+     :on-long-press (fn []
+                      (on-long-press
+                       (concat [{:on-press #(re-frame/dispatch [:chat.ui/reply-to-message message])
+                                 :id       :reply
+                                 :label    (i18n/label :t/message-reply)}
+                                {:on-press #(re-frame/dispatch [:chat.ui/save-image-to-gallery (:image content)])
+                                 :id       :save
+                                 :label    (i18n/label :t/save)}]
+                               (when (and outgoing config/delete-message-enabled?)
+                                 [{:on-press #(re-frame/dispatch [:chat.ui/soft-delete-message message])
+                                   :label    (i18n/label :t/delete)
+                                   :id       :delete}]))))}]
    reaction-picker])

-(defmethod ->message constants/content-type-audio [message {:keys [on-long-press modal]
-                                                            :as   reaction-picker}]
+(defmethod ->message constants/content-type-audio
+  [{:keys [outgoing] :as message}
+   {:keys [on-long-press modal]
+    :as   reaction-picker}]
   (let [show-timestamp? (reagent/atom false)]
     (fn [] [message-content-wrapper message
-            [react/touchable-highlight (when-not modal
-                                         {:on-long-press
-                                          (fn [] (on-long-press []))
-                                          :on-press (fn []
-                                                      (reset! show-timestamp? true))})
+            [react/touchable-highlight
+             (when-not modal
+               {:on-long-press
+                (fn [] (on-long-press (if (and outgoing config/delete-message-enabled?)
+                                        [{:on-press #(re-frame/dispatch [:chat.ui/soft-delete-message message])
+                                          :label    (i18n/label :t/delete)
+                                          :id       :delete}]
+                                        [])))
+                :on-press (fn []
+                            (reset! show-timestamp? true))})
              [react/view (style/message-view-wrapper (:outgoing message))
               [message-timestamp message show-timestamp?]
               [react/view {:style (style/message-view message) :accessibility-label :audio-message}


remove some logging

remove some logging

--- src/webcv/synthdef.cljs
+++ src/webcv/synthdef.cljs
@@ -63,7 +63,6 @@
 (defmethod add-param ::synthdef
   [graph node param-key param-val]
   (let [new-edges (map #(vector % node) (outputs param-val))]
-    (print (str "new edges - " param-key " :: " new-edges))
     (-> (apply add-edges (merge-graphs graph param-val) new-edges)
         (add-attr-to-edges ::param-name param-key new-edges))))

@@ -92,9 +91,7 @@

 (defn- node-builder [ctx synthdef]
   (fn [id]
-    (print (str "building node " id))
-    (doto (make-node ctx (attrs synthdef id))
-      (pprint))))
+    (make-node ctx (attrs synthdef id))))

 (defn- mapped-to [f coll]
   (into {} (map (juxt identity f)) coll))
@@ -109,6 +106,5 @@
             :let [edge-type (map #(attr synthdef % ::node-type) edge)
                   [src dest] (map nodes-by-id edge)
                   edge-attrs (attrs synthdef edge)]]
-      (print (str "building edge " edge edge-attrs))
       (make-edge edge-type src dest edge-attrs))))


Add many fixes to matrix operations.

Add many fixes to matrix operations.

--- frontend/src/uxbox/util/geom/matrix.cljs
+++ frontend/src/uxbox/util/geom/matrix.cljs
@@ -59,12 +59,12 @@
          tx2 (:tx om)
          ty2 (:ty om)]
      (Matrix.
-      (+ (* a2 a1) (* c2 b1))
-      (+ (* b2 a1) (* d2 b1))
-      (+ (* a2 c1) (* c2 d1))
-      (+ (* b2 c1) (* d2 d1))
-      (+ tx1 (* tx2 a1) (* ty2 b1))
-      (+ ty1 (* tx2 c1) (* ty2 d1)))))
+      (+ (* a2 a1) (* c2 c1))
+      (+ (* a2 b1) (* c2 d1))
+      (+ (* b2 a1) (* d2 c1))
+      (+ (* b2 b1) (* d2 d1))
+      (+ tx1 (* tx2 a1) (* ty2 c1))
+      (+ ty1 (* tx2 b1) (* ty2 d1)))))
   ([m om & others]
    (reduce multiply (multiply m om) others)))

@@ -114,25 +114,26 @@
            (rotate-matrix angle)
            (translate-matrix (gpt/negate center)))))

-  ;; ([m angle]
-  ;;  (let [center (gpt/point 0 0)]
-  ;;    (rotate m angle center)))
-  ;; ([m angle center]
-  ;;  (let [angle (mth/radians angle)
-  ;;        x (:x center)
-  ;;        y (:y center)
-  ;;        cos (mth/cos angle)
-  ;;        sin (mth/sin angle)
-  ;;        nsin (- sin)
-  ;;        tx (- x (+ (* x cos)) (* y sin))
-  ;;        ty (- y (- (* x sin)) (* y cos))
-  ;;        a (+ (* cos (:a m)) (* sin (:b m)))
-  ;;        b (+ (* nsin (:a m)) (* cos (:b m)))
-  ;;        c (+ (* cos (:c m)) (* sin (:d m)))
-  ;;        d (+ (* nsin (:c m)) (* cos (:d m)))
-  ;;        tx' (+ (:tx m) (* tx (:a m)) (* ty (:b m)))
-  ;;        ty' (+ (:ty m) (* tx (:c m)) (* ty (:d m)))]
-  ;;    (Matrix. a b c d tx' ty'))))
+(defn rotate*
+  ([m angle]
+   (let [center (gpt/point 0 0)]
+     (rotate m angle center)))
+  ([m angle center]
+   (let [angle (mth/radians angle)
+         x (:x center)
+         y (:y center)
+         cos (mth/cos angle)
+         sin (mth/sin angle)
+         nsin (- sin)
+         tx (- x (+ (* x cos)) (* y sin))
+         ty (- y (- (* x sin)) (* y cos))
+         a (+ (* cos (:a m)) (* sin (:c m)))
+         b (+ (* cos (:b m)) (* sin (:d m)))
+         c (+ (* nsin (:a m)) (* cos (:c m)))
+         d (+ (* nsin (:b m)) (* cos (:d m)))
+         tx' (+ (:tx m) (* tx (:a m)) (* ty (:c m)))
+         ty' (+ (:ty m) (* tx (:b m)) (* ty (:d m)))]
+     (Matrix. a b c d tx' ty'))))

 (defn scale
   "Apply scale transformation to the matrix."


Working pubsub using core.async and kafka

--- src/zoo_live/events.clj
+++ src/zoo_live/events.clj
@@ -2,7 +2,7 @@
   (:require [clj-kafka.core :refer [with-resource]]
             [cheshire.core :refer [parse-string generate-string]]
             [clojure.core.match :refer [match]]
-            [clojure.core.async :refer [go <! filter< map< dropping-buffer chan close! go-loop >!]]
+            [clojure.core.async :refer [go <! <!! filter< map< pub sub chan close! go-loop >!]]
             [zoo-live.web.resp :refer :all]
             [korma.core :refer :all]
             [clojure.string :as str]
@@ -30,7 +30,8 @@

 (defn query-from-params
   [ent params]
-  (let [where-clause (reduce params-to-where {} params)] (select ent
+  (let [where-clause (reduce params-to-where {} params)]
+    (select ent
             (where where-clause))))

 (defn- kafka-config
@@ -63,8 +64,11 @@
 (defn kafka-stream
   [zk type project]
   (let [conf (kafka-config zk)
-        topic (str "events_" type "_" project)]
-    (messages (consumer conf) [topic])))
+        topic (str "events_" type "_" project)
+        msgs (messages (consumer conf) [topic])
+        channel (chan)]
+    (go (doseq [m msgs] (>! channel m)))
+    (pub channel (fn [_] true))))

 (defn db-response
   [ent params]
@@ -72,22 +76,19 @@

 (defn- streaming-response
   [msgs {:keys [params] :as req}]
-  (let [in-chan (chan (dropping-buffer 100))
-        out-chan (map< generate-string (map< kafka-json-string-to-map in-chan))]
-    (future (doseq [m msgs] (println m) (>! in-chan m)))
+  (let [in-chan (chan)
+        out-chan (->> (sub msgs true in-chan)
+                      (map< kafka-json-string-to-map)
+                      (map< (comp #(str % "\n") generate-string)))]
     (with-channel req channel
-      (send! channel (resp-ok "" stream-mime) false)
-      (on-close channel (fn [status] (close! in-chan) (close! out-chan)))
-      (go-loop []
-               (println "Here")
-               (if-let [m (<! out-chan)]
-
-                 (do (println m)
-                     (send! channel (resp-ok m stream-mime) false)
-                     ))
-
-                     (recur)
-               ))))
+      (send! channel (resp-ok (<!! out-chan) stream-mime) false)
+      (let [writer (go-loop [msg (<! out-chan)]
+                            (send! channel (resp-ok msg stream-mime) false)
+                            (recur (<! out-chan)))]
+        (on-close channel (fn [status]
+                            (close! writer)
+                            (close! in-chan)
+                            (close! out-chan)))))))

 (defn handle-request
   [msgs db-ent type project]
@@ -101,7 +102,6 @@

 (defn event-routes
   [config [type project]]
-  (println type project)
   (let [msgs (kafka-stream (:zookeeper config) type project)
         db-ent (ent config type project)]
     (GET (str "/events/" type "/" project) [:as req] (handle-request msgs db-ent type project))))


Update migration dates

Update migration dates

--- src/braid/server/migrate.clj
+++ src/braid/server/migrate.clj
@@ -9,30 +9,7 @@
     [braid.server.db.user :as user]
     [braid.server.quests.db :as quests]))

-(defn migrate-2017-04-19
-  "Add bot notify-all-messages boolean"
-  []
-  @(d/transact
-     db/conn
-     [{:db/ident :bot/notify-all-messages?
-       :db/doc "Indicates that this bot should recieve all visible messages in its group"
-       :db/valueType :db.type/boolean
-       :db/cardinality :db.cardinality/one
-       :db/id #db/id [:db.part/db]
-       :db.install/_attribute :db.part/db}]))
-
-(defn migrate-2017-04-11
-  "add bot change events"
-  []
-  @(d/transact
-     db/conn
-     [{:db/ident :bot/event-webhook-url
-       :db/valueType :db.type/string
-       :db/cardinality :db.cardinality/one
-       :db/id #db/id [:db.part/db]
-       :db.install/_attribute :db.part/db}]))
-
-(defn migrate-2016-10-28
+(defn migrate-2017-05-25
   "change all db.unique/identity to db.unique/value (to avoid accidental upserts)"
   []
   @(d/transact db/conn
@@ -43,7 +20,7 @@
              [:user/id :message/id :upload/id :thread/id
               :tag/id :group/id :invite/id :bot/id :quest-record/id])))

-(defn migrate-2016-10-26
+(defn migrate-2017-05-24
   "add slug to groups"
   []
   @(d/transact db/conn
@@ -72,6 +49,29 @@
                         [:db/add group
                          :group/slug (slugify group-name)])))]
       @(d/transact db/conn (doall txs))))
+
+(defn migrate-2017-04-19
+  "Add bot notify-all-messages boolean"
+  []
+  @(d/transact
+     db/conn
+     [{:db/ident :bot/notify-all-messages?
+       :db/doc "Indicates that this bot should recieve all visible messages in its group"
+       :db/valueType :db.type/boolean
+       :db/cardinality :db.cardinality/one
+       :db/id #db/id [:db.part/db]
+       :db.install/_attribute :db.part/db}]))
+
+(defn migrate-2017-04-11
+  "add bot change events"
+  []
+  @(d/transact
+     db/conn
+     [{:db/ident :bot/event-webhook-url
+       :db/valueType :db.type/string
+       :db/cardinality :db.cardinality/one
+       :db/id #db/id [:db.part/db]
+       :db.install/_attribute :db.part/db}]))

 (defn migrate-2016-08-18
   "schema change for quests"


ensure we have at least java 7

ensure we have at least java 7

real-fs needs at least java 7 since it relies on the nio
interface. strictly speaking it would be possible to run with java 6,
if real-fs would not be used.

--- src/brainbot/nozzle/main.clj
+++ src/brainbot/nozzle/main.clj
@@ -10,6 +10,21 @@
   (:require [clojure.tools.cli :as cli])
   (:require [com.brainbot.iniconfig :as ini])
   (:gen-class))
+
+
+
+(defn ensure-java-version
+  []
+  (let [java-version (System/getProperty "java.version")
+        [major minor] (map #(Integer. %)
+                           (rest (re-find #"^(\d+)\.(\d+)" java-version)))]
+
+    (when (> 0 (compare [major minor] [1 7]))
+      (binding [*out* *err*]
+        (println
+         (format "Fatal error: You need at least java version 7. The java installation in %s has version %s."
+                 (System/getProperty "java.home") java-version))
+        (System/exit 1)))))

 (defn parse-command-line-options
@@ -61,6 +76,7 @@

 (defn -main [& args]
+  (ensure-java-version)
   (let [{:keys [iniconfig sections]} (parse-command-line-options args)]
     (misc/setup-logging!)
     (let [cfg (ini/read-ini iniconfig)]


Turn identity into record

Turn identity into record

--- src/cats/monad/identity.cljc
+++ src/cats/monad/identity.cljc
@@ -34,7 +34,7 @@

 ;; --- Type constructors

-(deftype Identity [v]
+(defrecord Identity [v]
   p/Contextual
   (-get-context [_] context)

@@ -48,21 +48,7 @@
   #?@(:cljs [cljs.core/IDeref
              (-deref [_] v)]
       :clj  [clojure.lang.IDeref
-             (deref [_] v)])
-
-  #?@(:clj
-      [Object
-       (equals [self other]
-         (if (instance? Identity other)
-           (= v (.-v ^Identity other))
-           false))]
-
-      :cljs
-      [cljs.core/IEquiv
-       (-equiv [_ other]
-         (if (instance? Identity other)
-           (= v (.-v ^Identity other))
-           false))]))
+             (deref [_] v)]))

 (alter-meta! #'->Identity assoc :private true)


simple prn debugging of alia queries

simple prn debugging of alia queries

--- src/er_cassandra/session/alia.clj
+++ src/er_cassandra/session/alia.clj
@@ -8,6 +8,13 @@
   (:import
    [er_cassandra.session Session]))

+(def ^:dynamic debug nil)
+
+(defmacro with-debug
+  [& forms]
+  `(binding [debug true]
+     ~@forms))
+
 (defrecord AliaSession [alia-session]
   Session
   (execute [_ statement]
@@ -15,7 +22,10 @@
      alia-session
      (if (string? statement)
        statement
-       (h/->raw statement))))
+       (do
+         (when debug
+           (prn statement))
+         (h/->raw statement)))))
   (close [_]
     (.close alia-session)))


Allow one-character conventions to make it possible to rename

--- src/clj/herder/web/lobos.clj
+++ src/clj/herder/web/lobos.clj
@@ -33,7 +33,7 @@
          (varchar :name 100)
          (date :from)
          (date :to)
-         (check :name (> (length :name) 1)))))
+         (check :name (> (length :name) 0)))))
   (down
    (drop (table :conventions))))


Better turbo link

Better turbo link

--- src/clj/skidskytte/views.clj
+++ src/clj/skidskytte/views.clj
@@ -29,7 +29,7 @@
     (hp/include-css "/assets/font-awesome/css/font-awesome.min.css")
     (hp/include-css "/css/screen.css")
     (hp/include-css "/css/custom.css")
-    (hp/include-js "https://cdn.skypack.dev/pin/@hotwired/turbo@v7.0.0-beta.4-TQFv5Y2xd4hn2VnTxVul/min/@hotwired/turbo.js")
+    (hp/include-js "https://unpkg.com/@hotwired/turbo@7.0.0-beta.3/dist/turbo.es5-umd.js")
     matomo]
    [:body
     [:div.container


Improve card image display in tooltip

Improve card image display in tooltip

--- src/cljs/decktouch/core.cljs
+++ src/cljs/decktouch/core.cljs
@@ -13,7 +13,8 @@
 ;; Views

 (defn img [url]
-  (str "<img src='" url "'>"))
+  [:img {:src url
+         :style (js-obj "width" "240" "height" "340")}])

 (defn card-in-list [card card-id]
   (let [image-name (clojure.string/replace (get card "imageName") #" " "_")
@@ -24,7 +25,7 @@
          :data-placement "bottom"
          :data-html true
          :data-trigger "hover"
-         :title (img image-link)}
+         :title (reagent/render-component-to-string [img image-link])}
          (str (get card "name"))]]))

 (defn card-in-list-did-mount [card-id]


ideas

ideas

--- src/cljs/triboard/ai/ai.cljs
+++ src/cljs/triboard/ai/ai.cljs
@@ -32,6 +32,8 @@
     ))

 ;; -----------------------------------------
+
+;; TODO - Try to develop a transducer for min-max

 (defn- min-max-step-with
   [min-fn max-fn ai turn on-transition]


slot-coalesce interface change

slot-coalesce interface change

--- rules/alarm.clj
+++ rules/alarm.clj
@@ -285,9 +285,9 @@
     ; 此时会有形如 {:error {:service \"app.req.error\", ...},
     ;               :count {:service \"app.req.count\", ...}} 的事件传递下来

-    ; 用 error 事件做模板，并构造出想要的 event
-    (slot-coalesce :error {:service \"app.req.error_rate\"
-                           :metric (if (> error 100) (/ error count) -1)}
+    ; 构造出想要的 event
+    (slot-coalesce {:service \"app.req.error_rate\"
+                    :metric (if (> error 100) (/ error count) -1)}
       (set-state (> 0.5)
         (runs :state 5
           (should-alarm-every 120
@@ -319,17 +319,18 @@
   "对 slot-window 的结果进行计算，并构造出单一的 event。
   具体用法可以看 slot-window 的帮助

-  template: event 模板，指定一个在 slot-window 中定义的 slot
-  ev': 对 event 模板修改的部分。表达式中可以直接用如下的约定引用 slot 中的值：
+  ev': 构造出的新 event 模板。表达式中可以直接用如下的约定引用 slot 中的值：
     ; 假设: (slot-window :service {:some-counter1 \"app.some_counter\"} ...)
     some-counter1 ; :some-counter1 的 metric 值
     ev:some-counter1 ; :some-counter1 的整个 event
     event ; slot-window 整个传递下来的 {:some-counter1 ...}
   "
-  [template ev' & children]
+  [ev' & children]
   (if (bound? #'*slot-window-slots*)
-    `(smap (fn [~'event]
-      (conj (~template ~'event) ~(ev-rewrite-slot 'event ev' *slot-window-slots*)))
+    `(smap
+      (fn [~'event]
+        (conj (select-keys (first (vals ~'event)) [:host :time])
+              ~(ev-rewrite-slot 'event ev' *slot-window-slots*)))
       ~@children)
     (throw (Exception. "Could not find slot-window stream!"))))

@@ -356,10 +357,10 @@

   (deftest slot-coalesce-test
     (let [s (alarm/slot-window :service {:ev1 "metric.ev1" :ev2 "metric.ev2"}
-              (alarm/slot-coalesce :ev1 {:service "metric.final"
-                                         :metric [ev1 ev2
-                                                  (:metric ev:ev1) (:metric ev:ev2)
-                                                  (:metric (:ev1 event)) (:metric (:ev2 event))]}
+              (alarm/slot-coalesce {:service "metric.final"
+                                    :metric [ev1 ev2
+                                             (:metric ev:ev1) (:metric ev:ev2)
+                                             (:metric (:ev1 event)) (:metric (:ev2 event))]}
                 (tap :slot-coalesce-test)))
           rst (inject! [s] [{:host "meh" :service "metric.ev1" :metric 10},
                             {:host "meh" :service "metric.ev2" :metric 20}])]


sorted接口

sorted接口

--- src/learnclojure/chapt3/core5.clj
+++ src/learnclojure/chapt3/core5.clj
@@ -52,3 +52,28 @@
 (disj #{1 2 4} 1 2)
 ;;clojure.set提供了一些有用的函数，如subset?、superset?、union、intersection、project等

+;;sorted 有序集合
+;;实现sorted抽象的集合北一特定的顺序保存，顺序可以通过一个谓词函数或者一个特定的comparator接口来定义。
+;;这使得我们可以高效，正序(或反序)的获取集合或者获取集合的一部分。这个接口包括以下函数
+;;1.rseq函数可以在常量时间内反序的返回一个集合的函数
+;;2.subseq函数可以返回一个集合的某一个区间的元素的序列
+;;3.rsubseq，和subseq类似，但返回的元素是反序的
+
+;;只有map和set实现了sorted接口，没有字面量来表示sorted集合，要创建sorted集合可以用sorted-map和sorted-set来创建有序的map和set。
+;;如果要用谓词或比较器来定义排序规则的话，要用sorted-map-by和sorted-set-by
+(def sm (sorted-map :z 5 :x 9 :y 0 :b 2 :a 3 :c 4))
+sm
+(rseq sm)
+;;subseq的谓词函数必须是>、<、>=、<=
+(subseq sm <= :c)
+(subseq sm > :b <= :y)
+(rsubseq sm > :b <= :y)
+;;因为sm本身是有序的，对于相同的结果，在sm上调用这些函数比在普通seq上调用要快的多
+
+;;compare函数定义默认排序 正序。它支持clojure所有的标量和顺序集合，它会按照字典排序法对每一层元素排序
+(compare 2 2)
+(compare "ab" "abc")
+(compare ["a" "b" "c"] ["a" "b"])
+(compare ["a" 2 0] ["a" 2])
+
+


tighten up

tighten up

--- boot/core/src/boot/core.clj
+++ boot/core/src/boot/core.clj
@@ -357,6 +357,20 @@
   [fileset ^File dir]
   (tmpd/add fileset (get-add-dir fileset #{:source}) dir))

+(defn mv-source
+  "FIXME: document"
+  [fileset tmpfiles]
+  (tmpd/add-tmp fileset (get-add-dir fileset #{:source}) tmpfiles))
+
+(defn add-resource
+  "Add the contents of the java.io.File dir to the fileset's resources."
+  [fileset ^File dir] (tmpd/add fileset (get-add-dir fileset #{:resource}) dir))
+
+(defn mv-resource
+  "FIXME: document"
+  [fileset tmpfiles]
+  (tmpd/add-tmp fileset (get-add-dir fileset #{:resource}) tmpfiles))
+
 (defn add-meta
   "Adds metadata about the files in the filesystem to their corresponding
   TmpFile objects in the fileset. The meta-map is expected to be a map with
@@ -369,20 +383,6 @@
            %1
            (update-in %1 k merge (apply dissoc %3 x))))
       (reduce-kv fileset meta-map)))
-
-(defn mv-source
-  "FIXME: document"
-  [fileset tmpfiles]
-  (tmpd/add-tmp fileset (get-add-dir fileset #{:source}) tmpfiles))
-
-(defn add-resource
-  "Add the contents of the java.io.File dir to the fileset's resources."
-  [fileset ^File dir] (tmpd/add fileset (get-add-dir fileset #{:resource}) dir))
-
-(defn mv-resource
-  "FIXME: document"
-  [fileset tmpfiles]
-  (tmpd/add-tmp fileset (get-add-dir fileset #{:resource}) tmpfiles))

 (defn fileset-diff
   "Returns a new fileset containing files that were added or modified. Removed


Fix forced slf4j dev-extras dependency

Fix forced slf4j dev-extras dependency

--- lib/edge.app.dev/src/dev_extras.clj
+++ lib/edge.app.dev/src/dev_extras.clj
@@ -7,12 +7,16 @@
    [integrant.repl]
    [integrant.repl.state]
    io.aviso.ansi
-   clojure.tools.deps.alpha.repl)
-  (:import
-    [org.slf4j.bridge SLF4JBridgeHandler]))
+   clojure.tools.deps.alpha.repl))

-(SLF4JBridgeHandler/removeHandlersForRootLogger)
-(SLF4JBridgeHandler/install)
+(when (try
+        (Class/forName "org.slf4j.bridge.SLF4JBridgeHandler")
+        (catch ClassNotFoundException _
+          false))
+  (eval
+    `(do
+       (org.slf4j.bridge.SLF4JBridgeHandler/removeHandlersForRootLogger)
+       (org.slf4j.bridge.SLF4JBridgeHandler/install))))

 (when (try
         (require 'figwheel.main.logging)


Fixed display of property id in table.

Fixed display of property id in table.

--- src-cljs/kixi/hecuba/tabs/programmes.cljs
+++ src-cljs/kixi/hecuba/tabs/programmes.cljs
@@ -349,7 +349,7 @@
      [:table {:className "table table-hover"}
       [:thead
        [:tr [:th "ID"] [:th "Type"] [:th "Address"] [:th "Region"] [:th "Ownership"] [:th "Technologies"] [:th "Monitoring Hierarchy"]]]
-      (for [row (sort-by #(-> % :property_data :property_code) (:data properties))]
+      (for [row (sort-by #(-> % :property_code) (:data properties))]
         (let [property_data (:property_data row)
               id            (:id row)]
           [:tr
@@ -359,7 +359,7 @@
                        (fixed-scroll-to-element "devices-div"))
             :className (if (= id (:selected properties)) "success")
             :id (str table-id "-selected")}
-           [:td (:property_code property_data)]
+           [:td (:property_code row)]
            [:td (:property_type property_data)]
            [:td (:address_street_two property_data)
             (when-let [address_two (:address_street_two property_data)]


Retagged set-theory problems

Retagged set-theory problems

--- src/foreclojure/data_set.clj
+++ src/foreclojure/data_set.clj
@@ -922,7 +922,7 @@
             :restricted ["intersection"]
             :description "Write a function which returns the intersection of two sets.  The intersection is the sub-set of items that each set has in common."
             :approved true
-            :tags ["easy" "set theory"]
+            :tags ["easy" "set-theory"]
             :tests ["(= (__ #{0 1 2 3} #{2 3 4 5}) #{2 3})"
 		    "(= (__ #{0 1 2} #{3 4 5}) #{})"
 		    "(= (__ #{:a :b :c :d} #{:c :e :a :f :d}) #{:a :c :d})"]})
@@ -961,7 +961,7 @@
             :times-solved 0
             :description "Write a function which generates the transitive closure of a binary relation.  The relation will be represented as a set of 2 item vectors."
             :approved true
-            :tags ["hard" "set theory"]
+            :tags ["hard" "set-theory"]
             :tests ["(let [divides #{[8 4] [9 3] [4 2] [27 9]}]\n  (= (__ divides) #{[4 2] [8 4] [8 2] [9 3] [27 9] [27 3]}))"
                     "(let [more-legs\n      #{[\"cat\" \"man\"] [\"man\" \"snake\"] [\"spider\" \"cat\"]}]\n  (= (__ more-legs)\n     #{[\"cat\" \"man\"] [\"cat\" \"snake\"] [\"man\" \"snake\"]\n       [\"spider\" \"cat\"] [\"spider\" \"man\"] [\"spider\" \"snake\"]}))"
                     "(let [progeny\n      #{[\"father\" \"son\"] [\"uncle\" \"cousin\"] [\"son\" \"grandson\"]}]\n  (= (__ progeny)\n     #{[\"father\" \"son\"] [\"father\" \"grandson\"]\n       [\"uncle\" \"cousin\"] [\"son\" \"grandson\"]}))"]})


Fixed typo

Fixed typo

--- src/foreclojure/data_set.clj
+++ src/foreclojure/data_set.clj
@@ -654,7 +654,7 @@
             :title "Group a Sequence"
             :times-solved 0
             :restricted ["group-by"]
-            :description "Given a function f and a sequence s, write a function which return a map.  The keys should be the values of f applied to each item in s.  The value at each key should be a vector of corresponding items in the order they appear in s."
+            :description "Given a function f and a sequence s, write a function which returns a map.  The keys should be the values of f applied to each item in s.  The value at each key should be a vector of corresponding items in the order they appear in s."
             :tags ["medium" "seqs" "core-functions"]
             :tests ["(= (__ #(> % 5) #{1 3 6 8}) {false [1 3], true [6 8]})"
                     "(= (__ #(apply / %) [[1 2] [2 4] [4 6] [3 6]])\n   {1/2 [[1 2] [2 4] [3 6]], 2/3 [[4 6]]})"


fix broken alias check

fix broken alias check

--- src/main/shadow/build/ns_form.clj
+++ src/main/shadow/build/ns_form.clj
@@ -273,7 +273,7 @@
           (seq only)
           (assoc :only only)))))

-(defn check-alias-conflict! [{ns :name :as ns-info} alias]
+(defn check-alias-conflict! [ns-info ns alias]
   (let [conflict
         (or (get-in ns-info [:requires alias])
             (get-in ns-info [:require-macros alias])
@@ -292,7 +292,7 @@
   ns-info)

 (defn merge-require [ns-info merge-key alias ns]
-  (check-alias-conflict! ns-info alias)
+  (check-alias-conflict! ns-info ns alias)
   (update ns-info merge-key assoc alias ns))

 (defn merge-require-fn [merge-key ns]
@@ -355,7 +355,7 @@
     (if-not load?
       ;; only reader-alias, no loading or dependency
       (-> ns-info
-          (check-alias-conflict! as-alias)
+          (check-alias-conflict! lib as-alias)
           (update :reader-aliases assoc as-alias lib))

       ;; regular none :as-alias require


Use ms/drain-into

Use ms/drain-into

--- src/icecap/handlers/core.clj
+++ src/icecap/handlers/core.clj
@@ -45,12 +45,7 @@
 (defmethod execute ::ordered-plans
   [plans]
   (let [out (ms/stream)]
-    (ms/connect-via
-     plans
-     (fn [plan]
-       (-> (execute plan)
-           (drain-to out)))
-     out)
+    (ms/connect-via plans #(ms/drain-into (execute %) out) out)
     out))

 (defmacro defstep


(PDB-4512) engine: add ::which-query annotations

This proved useful when working on the query engine, making it
immediately obvious which query is involved when looking at the query
records during the compilation process (for example, inside
compile-user-query->sql).

--- src/puppetlabs/puppetdb/query_eng/engine.clj
+++ src/puppetlabs/puppetdb/query_eng/engine.clj
@@ -188,7 +188,8 @@
 ;;; Queryable Entities
 (def inventory-query
   "Query for inventory"
-  (map->Query {:projections {"certname" {:type :string
+  (map->Query {::which-query :inventory
+               :projections {"certname" {:type :string
                                          :queryable? true
                                          :field :certnames.certname}
                              "timestamp" {:type :timestamp
@@ -223,7 +224,8 @@

 (def nodes-query
   "Query for nodes entities, mostly used currently for subqueries"
-  (map->Query {:projections {"certname" {:type :string
+  (map->Query {::which-query :nodes
+               :projections {"certname" {:type :string
                                          :queryable? true
                                          :field :certnames.certname}
                              "deactivated" {:type :string
@@ -305,7 +307,8 @@

 (def resource-params-query
   "Query for the resource-params query, mostly used as a subquery"
-  (map->Query {:projections {"res_param_resource" {:type :string
+  (map->Query {::which-query :resource-params
+               :projections {"res_param_resource" {:type :string
                                                    :queryable? true
                                                    :field (hsql-hash-as-str :resource)}
                              "res_param_name" {:type :string
@@ -322,7 +325,8 @@

 (def fact-paths-query
   "Query for the resource-params query, mostly used as a subquery"
-  (map->Query {:projections {"type" {:type :string
+  (map->Query {::which-query :fact-paths
+               :projections {"type" {:type :string
                                      :queryable? true
                                      :field :vt.type}
                              "path" {:type :path
@@ -349,7 +353,8 @@
                :subquery? false}))

 (def fact-names-query
-  (map->Query {:projections {"name" {:type :string
+  (map->Query {::which-query :fact-names
+               :projections {"name" {:type :string
                                      :queryable? true
                                      :field :name}}
                :selection {:from [[:fact_paths :fp]]
@@ -360,7 +365,8 @@

 (def facts-query
   "Query structured facts."
-  (map->Query {:projections {"certname" {:type :string
+  (map->Query {::which-query :facts
+               :projections {"certname" {:type :string
                                          :queryable? true
                                          :field :fs.certname}
                              "environment" {:type :string
@@ -393,7 +399,8 @@

 (def fact-contents-query
   "Query for fact nodes"
-  (map->Query {:projections {"certname" {:type :string
+  (map->Query {::which-query :fact-contents
+               :projections {"certname" {:type :string
                                          :queryable? true
                                          :field :fs.certname}
                              "environment" {:type :string
@@ -443,7 +450,8 @@
 (def report-logs-query
   "Query intended to be used by the `/reports/<hash>/logs` endpoint
   used for digging into the logs for a specific report."
-  (map->Query {:projections {"logs" {:type :json
+  (map->Query {::which-query :report-logs
+               :projections {"logs" {:type :json
                                      :queryable? false
                                      :field (h/coalesce :logs
                                                         (h/scast :logs_json :jsonb))}
@@ -461,7 +469,8 @@
 (def report-metrics-query
   "Query intended to be used by the `/reports/<hash>/metrics` endpoint
   used for digging into the metrics for a specific report."
-  (map->Query {:projections {"metrics" {:type :json
+  (map->Query {::which-query :report-metrics
+               :projections {"metrics" {:type :json
                                         :queryable? false
                                         :field (h/coalesce :reports.metrics
                                                            (h/scast :reports.metrics_json :jsonb))}
@@ -479,7 +488,8 @@
 (def reports-query
   "Query for the reports entity"
   (map->Query
-    {:projections
+    {::which-query :reports
+     :projections
      {"hash" {:type :string
               :queryable? true
               :field (hsql-hash-as-str :reports.hash)}
@@ -606,7 +616,8 @@
 (def catalog-query
   "Query for the top level catalogs entity"
   (map->Query
-    {:projections
+    {::which-query :catalog
+     :projections
      {"version" {:type :string
                  :queryable? true
                  :field :c.catalog_version}
@@ -696,7 +707,8 @@

 (def edges-query
   "Query for catalog edges"
-  (map->Query {:projections {"certname" {:type :string
+  (map->Query {::which-query :edges
+               :projections {"certname" {:type :string
                                          :queryable? true
                                          :field :edges.certname}
                              "relationship" {:type :string
@@ -736,7 +748,8 @@

 (def resources-query
   "Query for the top level resource entity"
-  (map->Query {:projections {"certname" {:type  :string
+  (map->Query {::which-query :resources
+               :projections {"certname" {:type  :string
                                          :queryable? true
                                          :field :c.certname}
                              "environment" {:type :string
@@ -797,7 +810,8 @@

 (def report-events-query
   "Query for the top level reports entity"
-  (map->Query {:projections {"certname" {:type :string
+  (map->Query {::which-query :report-events
+               :projections {"certname" {:type :string
                                          :queryable? true
                                          :field :reports.certname}
                              "configuration_version" {:type :string
@@ -882,7 +896,8 @@
                :source-table "resource_events"}))

 (def inactive-nodes-query
-  (map->Query {:projections {"certname" {:type :string
+  (map->Query {::which-query :inactive-nodes
+               :projections {"certname" {:type :string
                                          :queryable? true
                                          :field :inactive_nodes.certname}}
                :selection {:from [:inactive_nodes]}
@@ -892,7 +907,8 @@

 (def latest-report-query
   "Usually used as a subquery of reports"
-  (map->Query {:projections {"latest_report_hash" {:type :string
+  (map->Query {::which-query :latest-report
+               :projections {"latest_report_hash" {:type :string
                                                    :queryable? true
                                                    :field (hsql-hash-as-str :reports.hash)}}
                :selection {:from [:certnames]
@@ -907,7 +923,8 @@

 (def latest-report-id-query
   "Usually used as a subquery of reports"
-  (map->Query {:projections {"latest_report_id" {:type :numeric
+  (map->Query {::which-query :latest-report-id
+               :projections {"latest_report_id" {:type :numeric
                                                  :queryable? true
                                                  :field :certnames.latest_report_id}}
                :selection {:from [:certnames]}
@@ -917,7 +934,8 @@

 (def environments-query
   "Basic environments query, more useful when used with subqueries"
-  (map->Query {:projections {"name" {:type :string
+  (map->Query {::which-query :environments
+               :projections {"name" {:type :string
                                      :queryable? true
                                      :field :environment}}
                :selection {:from [:environments]}
@@ -948,7 +966,8 @@

 (def producers-query
   "Basic producers query, more useful when used with subqueries"
-  (map->Query {:projections {"name" {:type :string
+  (map->Query {::which-query :producers
+               :projections {"name" {:type :string
                                     :queryable? true
                                     :field :name}}
               :selection {:from [:producers]}
@@ -967,7 +986,8 @@

 (def packages-query
   "Basic packages query"
-  (map->Query {:projections {"package_name" {:type :string
+  (map->Query {::which-query :packages
+               :projections {"package_name" {:type :string
                                              :queryable? true
                                              :field :p.name}
                              "version" {:type :string
@@ -984,7 +1004,8 @@

 (def package-inventory-query
   "Packages and the machines they are installed on"
-  (map->Query {:projections {"certname" {:type :string
+  (map->Query {::which-query :package-inventory
+               :projections {"certname" {:type :string
                                          :queryable? true
                                          :field :certnames.certname}
                              "package_name" {:type :string
@@ -1010,7 +1031,8 @@
                :source-table packages"}))

 (def factsets-query-base
-  {:projections
+  {::which-query :factsets
+   :projections
    {"timestamp" {:type :timestamp
                  :queryable? true
                  :field :timestamp}
@@ -1066,6 +1088,7 @@
   "Query for factsets with the package_inventory reconstructed (used for sync)"
   (map->Query
     (-> factsets-query-base
+        (assoc ::which-query :factsets-with-packages)
         (assoc-in [:projections "package_inventory"]
                   {:type :array
                    :queryable? false


minor documentation improvement

minor documentation improvement

--- src/midje/ideas/metaconstants.clj
+++ src/midje/ideas/metaconstants.clj
@@ -13,7 +13,7 @@
             [midje.util.ecosystem :as ecosystem]))

 (defn- normalized-metaconstant
-  "Turns '..m. to \"...m...\""
+  "Turns '..m. to \"...m...\", or nil if mc-symbol isn't a valid metaconstant symbol"
   [mc-symbol]
   (let [normalize (fn [re metaconstant-format mc-symbol]
                     (-?>> mc-symbol name (re-matches re) second (format metaconstant-format)))
@@ -23,9 +23,9 @@

     (->> mc-symbol ((juxt dot-metaconstant dash-metaconstant)) (find-first identity))))

-(defn metaconstant-symbol? [symbol-or-form]
-  (and (symbol? symbol-or-form)
-    (-> symbol-or-form normalized-metaconstant not not)))
+(defn metaconstant-symbol? [x]
+  (and (symbol? x)
+    (-> x normalized-metaconstant not not)))

 (deftype Metaconstant [name ^clojure.lang.Associative storage]
   Object


#1 First working version, still minor refactorings needed

--- src/leiningen/amp/deploy.clj
+++ src/leiningen/amp/deploy.clj
@@ -33,7 +33,53 @@
                   (assoc m id url)) {} repos)]
     result))

-(defn find-dependency
+(defn- depname
+  "Stringifies the filename of a leiningen dependency"
+  [dep]
+  (-> dep first name))
+
+(defn- version
+  "Stringifies the version of a leiningen dependency"
+  [dep]
+  (str "-" (second dep)))
+
+(defn- classifier
+  "Provides an appendable string for the classifier"
+  [dep]
+  (if-let [classifier (:classifier dep)]
+    (str "-" classifier)
+    ""))
+
+(defn- extension
+  "Provides an appenavle string for the extension"
+  [dep]
+  (if-let [ext (:extension dep)]
+    (str "." extension)
+    ".war"))
+
+(defn- dep-to-filename
+  "Translates a dependency in a filename"
+  [dep]
+  (str (depname dep) (version dep) (classifier dep) (extension dep)))
+
+(defn- dep-filter
+  "Creates a function suitable to `filter` a seq of dependencies to find the requested one"
+  [dep]
+  (fn [^java.io.File file]
+    (let [name (.getName file)
+          dep-name (dep-to-filename dep)]
+      (= dep-name name))))
+
+(defn- find-one
+  "Finds one and only one dependency that matches the given file"
+  [file files]
+  (let [filtered (filter (dep-filter file) files)
+        file (first filtered)]
+    (if file
+      file
+      (main/abort "The target WAR couldn't be found in the configured repository"))))
+
+(defn- find-dependency
   "Finds the WAR from the project then returns its file"
   [{:keys [repositories amp-target-war]}]
   (let [files (aether/dependency-files
@@ -41,7 +87,7 @@
                                                 :coordinates  [amp-target-war]))]
     (if (empty? files)
       (main/abort "No target WAR was found. Did you set :amp-target-war in your project.clj?")
-      (first files))))
+      (find-one amp-target-war files))))

 (defn- copy-war
   "Copies the WAR file where to install the AMP into a working location"
@@ -54,7 +100,7 @@
 (defn- install!
   "Uses the Alfresco MMT to install the AMP into the target WAR"
   [amp war]
-  (ModuleManagementTool/main (into-array ["install" amp war])))
+  (ModuleManagementTool/main (into-array String ["install" (.toString amp) (.toString war)])))

 (defn deploy-amp!
   "Installs the generated AMP into the specified WAR"


add questin before doing push

add questin before doing push

--- src/leiningen/namespaces.clj
+++ src/leiningen/namespaces.clj
@@ -98,12 +98,17 @@
       (m/info "===> Could not commit because" (u/error-of pull-result))
       (m/info (u/output-of pull-result)))))

+(defn yes-or-no [input]
+  (or (= input "yes") (= input "no")))
+
 (defn push! [project]
-  (m/info "\n* Push on" project)
-  (let [push-result (sh/sh "git" "push" "origin")]
-    (if (not (u/is-success? push-result))
-      (m/info "===> Could not push because" (u/error-of push-result))
-      (m/info (u/output-of push-result)))))
+  (let [answer (->> (str "\n*Are you sure to push on" project "?")
+                    (u/ask-user yes-or-no))]
+    (if (= answer "yes")
+      (let [push-result (sh/sh "git" "push" "origin")]
+        (if (not (u/is-success? push-result))
+          (m/info "===> Could not push because" (u/error-of push-result))
+          (m/info (u/output-of push-result)))))))

 (defn test-all [projects]
   (doseq [p projects]


Take advantage of the fact we can return nil from message handler

--- src/braid/rss/core.cljc
+++ src/braid/rss/core.cljc
@@ -20,9 +20,8 @@
        (core/register-server-message-handlers!
          {:braid.server.rss/load-feeds
           (fn [{user-id :user-id group-id :?data}]
-            (if (group-db/user-in-group? user-id group-id)
-              {:reply! {:braid/ok (db/group-feeds group-id)}}
-              {}))
+            (when (group-db/user-in-group? user-id group-id)
+              {:reply! {:braid/ok (db/group-feeds group-id)}}))

           :braid.server.rss/check-feed-url
           (fn [{user-id :user-id feed-url :?data}]
@@ -31,15 +30,14 @@

           :braid.server.rss/add-feed
           (fn [{user-id :user-id {:keys [tag-ids feed-url group-id] :as new-feed} :?data}]
-            (if (and (group-db/user-is-group-admin? user-id group-id)
+            (when (and (group-db/user-is-group-admin? user-id group-id)
                      (let [group-tags (into #{} (map :id) (group-db/group-tags group-id))]
                        (every? group-tags tag-ids)))
               (let [new-feed (assoc new-feed
                                     :id (java.util.UUID/randomUUID)
                                     :user-id user-id)]
                 {:db-run-txns! (db/add-rss-feed-txn new-feed)
-                 :reply! {:braid/ok new-feed}})
-              {}))
+                 :reply! {:braid/ok new-feed}})))

           :braid.server.rss/force-feed-run!
           (fn [{user-id :user-id feed-id :?data}]
@@ -56,10 +54,9 @@
           :braid.server.rss/retract-feed
           (fn [{user-id :user-id feed-id :?data}]
             (let [group-id (db/feed-group-id feed-id)]
-              (if (group-db/user-is-group-admin? user-id group-id)
+              (when (group-db/user-is-group-admin? user-id group-id)
                 {:db-run-txns! (db/remove-feed-txn feed-id)
-                 :reply! :braid/ok}
-                {})))})
+                 :reply! :braid/ok})))})

        (core/register-daily-job!
          (fn []


benchmarks

benchmarks

--- test/babel/test/en.cljc
+++ test/babel/test/en.cljc
@@ -618,21 +618,7 @@
             b)
        (cross-product (rest a) b)))))

-(def lbs (babel.generate/lightning-bolts model spec2 0 6))
-
-(def baz2 (map (fn [lb]
-                (babel.generate/create-mapping
-                 lb (babel.generate/find-comp-paths lb)
-                 model 0 6))
-              lbs))
-
-(defn baz3 [lb]
-  (babel.generate/create-mapping
-   lb (babel.generate/find-comp-paths lb)
-   model 0 6))
-
-
-(defn mapping [spec]
+(defn mapping [spec model]
   (map (fn [lb]
          (babel.generate/create-mapping
           lb (babel.generate/find-comp-paths lb)
@@ -641,9 +627,37 @@

 ;; usage: (show-mapping (mapping spec1))
 (defn show-mapping [mapping]
-  (map (fn [good-one]
-         (map (fn [path]
-                (map fo-ps (get good-one path)))
-              (keys good-one)))
+  (map (fn [path-to-bolts-map]
+         (reduce merge (map (fn [path]
+                              {path (map fo-ps (get path-to-bolts-map path))})
+                            ;; path-to-bolts map is a map from a set of paths to a set of
+                            ;; bolts for each such path in the set of paths.
+                            (keys path-to-bolts-map))))
        mapping))

+(defn do-counts [mapping]
+  (map (fn [bolt-to-comps]
+         {:paths (keys bolt-to-comps)
+                    :counts-per-path
+          (map (fn [path]
+                 (count (get bolt-to-comps path)))
+                         (keys bolt-to-comps))})
+       mapping))
+
+(defn benchmark1 []
+  (do
+    (doall (take 5 (repeatedly #(time (doall (do-counts (mapping spec1 (medium))))))))
+    nil))
+
+(defn benchmark2 []
+  (do
+    (doall (take 5 (repeatedly #(time (doall (do-counts (mapping spec2 (medium))))))))
+    nil))
+
+
+
+
+
+
+
+


change to load only .edn files

change to load only .edn files

--- src/lt/plugins/ltinator.cljs
+++ src/lt/plugins/ltinator.cljs
@@ -78,9 +78,9 @@
 (defn- add-items
   []
   (when (check-project-dir)
-    (map #(hash-map :name (path->project-name %)
-                    :path %)
-         (files/full-path-ls @project-directory))))
+    (for [path (files/full-path-ls @project-directory)
+          :when (= (files/ext path) "edn")]
+      (hash-map :name (path->project-name path) :path path))))

 (defn- selector
   [opts]


Added new test: test-get-calendar.

Added new test: test-get-calendar.

--- test/clouseau/test_calendar.clj
+++ test/clouseau/test_calendar.clj
@@ -69,3 +69,28 @@
     (testing "if the clouseau.calendar/format-date-time definition exists."
         (is (callable? 'clouseau.calendar/format-date-time))))

+;
+; Tests for function behaviours
+;
+
+(deftest test-get-calendar
+    "Check the function clouseau.calendar/get-calendar."
+    (testing "the function clouseau.calendar/get-calendar."
+        (is (not (nil? (get-calendar))))
+        (is (or
+            (=  (class (get-calendar)) java.util.Calendar)
+            (=  (class (get-calendar)) java.util.GregorianCalendar)))
+        (is (or
+            (=  (type  (get-calendar)) java.util.Calendar)
+            (=  (type  (get-calendar)) java.util.GregorianCalendar)))
+        (is (>  (.get (get-calendar) (java.util.Calendar/YEAR)) 2000))
+        (is (>= (.get (get-calendar) (java.util.Calendar/MONTH)) 0))
+        (is (<  (.get (get-calendar) (java.util.Calendar/MONTH)) 12))
+        (is (>= (.get (get-calendar) (java.util.Calendar/DAY_OF_MONTH)) 0))
+        (is (<= (.get (get-calendar) (java.util.Calendar/DAY_OF_MONTH)) 31)) ; let's be on the safe side
+        (is (>= (.get (get-calendar) (java.util.Calendar/DAY_OF_YEAR)) 0))
+        (is (<= (.get (get-calendar) (java.util.Calendar/DAY_OF_YEAR)) 366)) ; let's be on the safe side
+        (is (>= (.get (get-calendar) (java.util.Calendar/WEEK_OF_YEAR)) 0))
+        (is (<= (.get (get-calendar) (java.util.Calendar/WEEK_OF_YEAR)) 54)) ; let's be on the safe side
+))
+


Implemented context-from-clop with explore-attributes

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

--- src/conexp/fca/more.clj
+++ src/conexp/fca/more.clj
@@ -9,7 +9,8 @@
 (ns conexp.fca.more
   (:use conexp.base
         conexp.fca.contexts
-        conexp.fca.implications)
+        conexp.fca.implications
+        conexp.fca.exploration)
   (:require [clojure.contrib.graph :as graph]))

 (ns-doc "More on FCA.")
@@ -166,9 +167,17 @@

   Note: This implementation is slow."
   [base-set clop]
-  (reduce-context-objects (make-context (all-closed-sets base-set clop)
-                                        base-set
-                                        #(contains? %1 %2))))
+  (let [clop-handler (fn [ctx _ impl]
+                       (let [A (premise impl),
+                             B (conclusion impl),
+                             C (clop A)]
+                         (when-not (subset? B C)
+                           [[(gensym) C]])))]
+    (-> (explore-attributes (make-context #{} base-set #{})
+                            :handler clop-handler)
+        :context
+        reduce-context)))
+
 ;;;

 nil


added options to combine

added options to combine

--- src/datasplash/core.clj
+++ src/datasplash/core.clj
@@ -463,17 +463,22 @@

 (defn combine
   ([f
-    {:keys [scope]
+    {:keys [scope fanout view no-defaults]
      :or {scope :global}
      :as options}
     ^PCollection pcoll]
    (let [opts (assoc options :label (keyword (str "combine-" scope)))
-         cf (->combine-fn f)]
+         cfn (->combine-fn f)]
      (-> pcoll
          (.apply (with-opts base-schema opts
                    (cond
-                     (#{:local :per-key} scope) (Combine/perKey (->combine-fn f))
-                     (#{:global :globally} scope) (Combine/globally (->combine-fn f))
+                     (#{:local :per-key} scope) (-> (Combine/perKey cfn)
+                                                    (cond-> fanout (.withHotKeyFanout
+                                                                    (if (fn? fanout) (sfn fanout) fanout))))
+                     (#{:global :globally} scope) (-> (Combine/globally cfn)
+                                                      (cond-> fanout (.withFanout fanout))
+                                                      (cond-> view (.asSingletonView))
+                                                      (cond-> no-defaults (.withoutDefaults)))
                      :else (throw (ex-info (format "Option %s is not recognized" scope)
                                            {:scope-given scope :allowed-scopes #{:global :per-key}})))))
          (.setCoder (make-transit-coder)))))
@@ -498,6 +503,10 @@
                      (combine-by-transform key-fn f options)))))
   ([key-fn f pcoll] (combine-by key-fn f {} pcoll)))

+(defmacro defcombiner
+  [nam method]
+  )
+
 (defn sum
   ([options ^PCollection pcoll]
    (let [opts (assoc options :label :sum)]


more tests

more tests

--- test/etcd_clojure/core_test.clj
+++ test/etcd_clojure/core_test.clj
@@ -80,3 +80,30 @@
     (etcd/set "test-dir/test-val3-on-dir" "3")
     (is (= 3
            (count (etcd/list "test-dir"))))))
+
+(deftest test-stats
+  (testing "should retrive stats"
+    (is (and
+         (contains? (etcd/stats) "leader")
+         (contains? (etcd/stats) "followers")))))
+
+(deftest test-self-stats
+  (testing "should retrive self stats"
+    (is (=
+         ["name" "state" "startTime" "leaderInfo" "recvAppendRequestCnt" "sendAppendRequestCnt"]
+         (keys (etcd/self-stats))))))
+
+(deftest test-store-stats
+  (testing "should retrive store stats"
+    (is (not (nil?
+              (etcd/store-stats))))))
+
+(deftest test-machines
+  (testing "should retrive machines"
+    (is (= 1
+           (count (etcd/machines))))))
+
+(deftest test-config
+  (testing "should retrive config"
+    (is (= 3
+           (count (keys (etcd/config)))))))


discoveries toolbar

discoveries toolbar

Former-commit-id: 5f0862e3b79cd2aa2215c2d185f1eb7f93f8d9de

--- src/syng_im/discovery/screen.cljs
+++ src/syng_im/discovery/screen.cljs
@@ -16,16 +16,17 @@
     (or hashtags [])))

 (defn title-content [show-search]
-  (if show-search
-    [text-input {:style           st/discovery-search-input
-                 :autoFocus       true
-                 :placeholder     "Type your search tags here"
-                 :onSubmitEditing (fn [e]
-                                    (let [search   (aget e "nativeEvent" "text")
-                                          hashtags (get-hashtags search)]
-                                      (dispatch [:broadcast-status search hashtags])))}]
-    [view
-     [text {:style st/discovery-title} "Discover"]]))
+  [view st/discovery-toolbar-content
+   (if show-search
+     [text-input {:style           st/discovery-search-input
+                  :autoFocus       true
+                  :placeholder     "Type your search tags here"
+                  :onSubmitEditing (fn [e]
+                                     (let [search   (aget e "nativeEvent" "text")
+                                           hashtags (get-hashtags search)]
+                                       (dispatch [:broadcast-status search hashtags])))}]
+     [view
+      [text {:style st/discovery-title} "Discover"]])])

 (defn toogle-search [current-value]
   (dispatch [:set ::show-search (not current-value)]))
@@ -34,15 +35,14 @@
   [show-search [:get ::show-search]]
   [view st/discovery-container
    [toolbar
-    {:style      st/discovery-toolbar
-     :nav-action {:image   {:source {:uri :icon_hamburger}
-                            :style  st/hamburger-icon}
-                  :handler #(dispatch [:create-fake-discovery!])}
-     :title      "Add Participants"
-     :content    [title-content show-search]
-     :action     {:image   {:source {:uri :icon_search}
-                            :style  st/search-icon}
-                  :handler #(toogle-search show-search)}}]
+    {:style          st/discovery-toolbar
+     :nav-action     {:image   {:source {:uri :icon_hamburger}
+                                :style  st/hamburger-icon}
+                      :handler #(dispatch [:create-fake-discovery!])}
+     :custom-content [title-content show-search]
+     :action         {:image   {:source {:uri :icon_search}
+                                :style  st/search-icon}
+                      :handler #(toogle-search show-search)}}]
    [scroll-view {:style {}}
     [view st/section-spacing
      [text {:style st/discovery-subtitle} "Popular tags"]]


Refactors tests for leftmost-node

Refactors tests for leftmost-node

--- src/the_little_clojurian/todo.clj
+++ src/the_little_clojurian/todo.clj
@@ -10,11 +10,20 @@
             (empty? (:nodes root)) root
             :else (leftmost-node (first (:nodes root))))))

-  (is (= (leftmost-node nil) nil))
-  (is (= (leftmost-node {:id 1}) {:id 1}))
-  (is (= (leftmost-node {:id 1 :nodes '({:id 2})}) {:id 2}))
-  (is (= (leftmost-node {:id 1 :nodes '({:id 2 :nodes ({:id 3})})}) {:id 3}))
-  (is (= (leftmost-node {:id 1 :nodes '({:id 2} {:id 3})})) {:id 2}))
+  (is (= (leftmost-node nil)
+         nil))
+
+  (is (= (leftmost-node {:id 1})
+         {:id 1}))
+
+  (is (= (leftmost-node {:id 1 :nodes '({:id 2})})
+         {:id 2}))
+
+  (is (= (leftmost-node {:id 1 :nodes '({:id 2} {:id 3})})
+         {:id 2}))
+
+  (is (= (leftmost-node {:id 1 :nodes '({:id 2 :nodes ({:id 3})})})
+         {:id 3})))

 (with-test
   (def complete-nodes*


Story ID: RPC-259 Summary: Fixed diff not showing, because it would namespace the assertions' :assert-type

--- src/untangled_spec/assertions.clj
+++ src/untangled_spec/assertions.clj
@@ -4,7 +4,7 @@
   `(let [arg# ~arg
          result# (~f arg#)]
      {:type (if result# :pass :fail)
-      :message ~msg :assert-type 'call
+      :message ~msg :assert-type '~'call
       :actual arg# :expected '~f}))

 (defn eq-assert-expr [msg [exp act :as form]]
@@ -12,7 +12,7 @@
          exp# ~exp
          result# (= exp# act#)]
      {:type (if result# :pass :fail)
-      :message ~msg :assert-type 'eq
+      :message ~msg :assert-type '~'eq
       :actual act# :expected exp#}))

 (defn exception-matches? [msg e exp-type & [re f f+]]


Add board-access key to the share schema to add it to the board name.

--- src/oc/storage/async/bot.clj
+++ src/oc/storage/async/bot.clj
@@ -29,6 +29,7 @@
     :org-name (schema/maybe schema/Str)
     :org-logo-url (schema/maybe schema/Str)
     :board-name (schema/maybe schema/Str)
+    :board-access (schema/maybe schema/Str)
     :board-slug lib-schema/NonBlankStr
     :entry-uuid lib-schema/UniqueID
     :headline (schema/maybe schema/Str)
@@ -75,6 +76,7 @@
       :org-slug (:slug org)
       :org-name (:name org)
       :board-name (:name board)
+      :board-access (:access board)
       :board-slug (:slug board)
       :org-logo-url (:logo-url org)
       :entry-uuid (:uuid entry)


Reduce raw events logging to trace in IRC

--- src/yetibot/core/adapters/irc.clj
+++ src/yetibot/core/adapters/irc.clj
@@ -170,7 +170,7 @@
   (join-channel a (second (:params info))))

 (defn handle-raw-log [adapter _ b c]
-  (log/info b c))
+  (log/trace b c))

 (defn handle-kick [a _ {:keys [params] :as info}]
   (log/info "kicked" (pr-str info))


Using the "PORT" environment variable to select the web port (Heroku support)

--- src/org/gensym/viddy/run.clj
+++ src/org/gensym/viddy/run.clj
@@ -22,6 +22,8 @@
       (.stop server))))

 (defn -main []
-  (start 8080)
-  (.start (Thread. #())))
+  (let [port (Integer/parseInt
+              (or (System/getenv "PORT") "8080"))]
+    (start port)
+    (.start (Thread. #()))))


+babel.english.lexicon/lexicon

+babel.english.lexicon/lexicon


Silly tweak for the silly fake channel code


Adding elastic search and activemq

Adding elastic search and activemq

--- apoya-app/project.clj
+++ apoya-app/project.clj
@@ -50,6 +50,7 @@
                  [com.google.inject/guice "3.0"]
                  [commons-codec "1.8"]
                  [org.clojure/tools.reader "0.7.10"]
+                 [org.apache.activemq/activemq-broker "5.9.0"]
                  ;;Clojurescript libs
                  [shoreleave/shoreleave-remote "0.3.0"]
                  [clavatar "0.2.1"]]


Update getting_started

Update getting_started

--- src/css-guide/styles/getting_started.cljs
+++ src/css-guide/styles/getting_started.cljs
@@ -156,7 +156,16 @@
     .c-input:not([aria-label]) {
       @apply --assert-selector;
     }
-    ```")
+    ```
+
+    #### Markup Lint
+
+    Enable another layout of outlines to highlight anything out of date or mixed up in your markup.
+
+    ```html
+    <html class='s-markuplint'>
+    ```
+    ")


Don't rename start-*() for advanced compilation

--- src-cljs/game_of_life/draw.cljs
+++ src-cljs/game_of_life/draw.cljs
@@ -48,10 +48,10 @@
   (swap! current-run-id inc)
   (run living-cells (make-context) (deref current-run-id)))

-(defn start-glider []
+(defn ^:export start-glider []
   "Starts simulation with a glider placed in the board"
   (start glider))

-(defn start-random []
+(defn ^:export start-random []
   "Starts simulation with a randomly generated set of live cells"
   (start (random-cells)))


Updated modal actions to be flat

Updated modal actions to be flat

--- src/guide/untangled/ui/element_cards.cljs
+++ src/guide/untangled/ui/element_cards.cljs
@@ -226,5 +226,5 @@
         (e/ui-modal-title {} "Informative")
         (e/ui-modal-body {} "You have been notified.")
         (e/ui-modal-actions {}
-          (e/ui-button {} "Cancel")
-          (e/ui-button {} "Ok"))))))
+          (e/ui-flat-button {:color :primary} "Cancel")
+          (e/ui-flat-button {:color :primary} "Ok"))))))


Certificate is a plain string

Certificate is a plain string

--- test/clojure_fabric/core_test.clj
+++ test/clojure_fabric/core_test.clj
@@ -90,6 +90,12 @@
                        {:name "user1" :type :user :key "9f97934915db15db4c803b6eff5b6f4966bdef05d13f99e4d60c7128a6f22733"}]}])))

+(defn file->bytes [file]
+  (with-open [xin (io/input-stream file)
+              xout (java.io.ByteArrayOutputStream.)]
+    (io/copy xin xout)
+    (.toByteArray xout)))
+
 (defn get-user-crypto-files
   [{:keys [org-type domain-name]} {user-name :name}]
   (let [org-type-name (name org-type)
@@ -105,14 +111,7 @@
                       (crypto-suite/import-key))
      :certificate (-> (format "%ssigncerts/%s-cert.pem" dir user-name+domain-name)
                       (io/resource)
-                      (crypto-suite/import-key)
-                      (Hex/toHexString))}))
-
-(defn file->bytes [file]
-  (with-open [xin (io/input-stream file)
-              xout (java.io.ByteArrayOutputStream.)]
-    (io/copy xin xout)
-    (.toByteArray xout)))
+                      (slurp))}))

 (defn get-node-end-crypto-files
   [{:keys [org-type domain-name]} {node-end-name :name}]


Improve tests.

Improve tests.

--- test/continuo/postgresql_spec.clj
+++ test/continuo/postgresql_spec.clj
@@ -17,24 +17,18 @@
 ;; Fixtures & Initialization
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

-(def +ctx+)
+(def ^:static uri "postgresql://localhost:5432/test")
 (def dbspec {:subprotocol "postgresql"
              :subname "//127.0.0.1/test"})

 (defn transaction-fixture
   [continuation]
-  (with-open [ctx (sc/context dbspec {:isolation-level :serializable})]
-    (sc/atomic ctx
-      (alter-var-root #'+ctx+ (constantly ctx))
-      (alter-var-root #'conn/+test-connection+ (constantly ctx))
-      (continuation)
-      (alter-var-root #'+ctx+ (constantly nil))
-      (alter-var-root #'conn/+test-connection+ (constantly nil))
-      (sc/set-rollback! ctx))))
+  (with-open [conn (sc/context dbspec)]
+    (sc/execute conn "drop schema if exists public cascade;")
+    (sc/execute conn "create schema public;"))
+  (continuation))

 (t/use-fixtures :each transaction-fixture)
-
-(def ^:static uri "postgresql-test://localhost/test")

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Tests
@@ -42,7 +36,7 @@

 (t/deftest facked-connect-tests
   (let [tx @(impl/connect (URI. uri) {})]
-    (t/is (instance? continuo.postgresql.connection.TestTransactor tx))))
+    (t/is (instance? continuo.postgresql.connection.Transactor tx))))

 (t/deftest open-not-created-database
   (try


changes post review by @philandstuff

changes post review by @philandstuff

--- test/digitalocean_expect/test.clj
+++ test/digitalocean_expect/test.clj
@@ -6,14 +6,14 @@
 (def nodes (droplets (env :digitalocean-client-id) (env :digitalocean-api-key)))
 (def creds {:client (env :digitalocean-client-id) :key (env :digitalocean-api-key)})

-(def not-nil? (complement nil?))
-
 (defn nodes-by-status [status]
   (droplets-with-status creds status))

 (def stopped-nodes (nodes-by-status "stopped"))
 (def active-nodes (nodes-by-status "active"))

+; these magic numbers are unfortunate details
+; of the DigitalOcean API
 (defn small? [size] (= 66 size))
 (defn medium? [size] (= 62 size))
 (defn large? [size] (= 60 size))
@@ -31,11 +31,11 @@

 ; check backups are disabled for all nodes
 (expect false? (from-each
-  [node (map :backups_active nodes)] node))
+  [node nodes] (:backups_active node)))

 ; check private networks are disabled for all nodes
 (expect nil? (from-each
-  [node (map :private_ip_address nodes)] node))
+  [node nodes] (:private_ip_address node)))

 ; only use prescribed sizes
 (expect 0


Dictionary type char: 'glossary'

Dictionary type char: 'glossary'


fix handle-response test tests

fix handle-response test tests

--- test/cljs/gc_api_browser/url_bar_test.cljs
+++ test/cljs/gc_api_browser/url_bar_test.cljs
@@ -6,17 +6,15 @@
   (let [old-state {:request {:foo "bar"}
                    :response nil
                    :history []}
-        request {:req "uest"}
         response {:resp "onse"}
-        new-state (url-bar/handle-response request response old-state)]
-
+        new-state (url-bar/handle-response response old-state old-state)]
     (is (instance? UUID (:history-id new-state)))
     (is (= {:foo "bar"} (:request new-state)))
     (is (= {:resp "onse"} (:response new-state)))
     (is (= 1 (count (:history new-state))))

     (let [{:keys [request response id]} (first (:history new-state))]
-      (is (= {:req "uest"} request))
+      (is (= {:foo "bar"} request))
       (is (= {:resp "onse"} response))
       (is (instance? UUID id)))))


Add simple syntax highlighting

Add simple syntax highlighting

--- test/demo.cljs
+++ test/demo.cljs
@@ -33,8 +33,27 @@
     (string/join "\n"
                  (map #(% defs) names))))

+(def builtins ["def" "defn" "ns" "atom" "let" "if" "when"
+               "cond" "merge"])
+
+(defn syntaxify [src]
+  (let [str-p "\"[^\"]*\""
+        keyw-p ":[^\\][(){} \\t\\n]+"
+        res-p (string/join "\\b|" builtins)
+        any-p ".|\\n"
+        patt (re-pattern (str "("
+                              (string/join ")|(" [str-p keyw-p res-p any-p])
+                              ")"))]
+    (apply vector :pre
+           (for [[s str keyw res] (re-seq patt src)]
+             (cond
+              str [:span {:style {:color "green"}} str]
+              keyw [:span {:style {:color "blue"}} keyw]
+              res [:b res]
+              :else s)))))
+
 (defn src-for [{:keys [defs]}]
-  [:pre (src-for-names defs)])
+  [:pre (syntaxify (src-for-names defs))])

 (defn demo-component [props]
   [:div.example


cleanup

cleanup

--- src/babel/italiano/lexicon.cljc
+++ src/babel/italiano/lexicon.cljc
@@ -429,5 +429,3 @@

      ;; end of language-specific grammar rules
 ))
-
-


aiutare: "+{:cat :verb}"

aiutare: "+{:cat :verb}"

--- src/babel/italiano/lexicon.cljc
+++ src/babel/italiano/lexicon.cljc
@@ -127,10 +127,11 @@
    "aggiungere" {:synsem {:cat :verb
                           :sem {:pred :add}}}
    "aiutare"
-    {:synsem {:essere false
-              :sem {:pred :aiutare
-                    :activity true
-                    :obj {:human true}}}}
+   {:synsem {:essere false
+             :cat :verb
+             :sem {:pred :aiutare
+                   :activity true
+                   :obj {:human true}}}}
    "alto"
    [;; non-comparative:
     (let [subject-sem (atom {:human true}) ;; only humans can be tall.


+lezione,libro

+lezione,libro

--- src/babel/italiano/lexicon.cljc
+++ src/babel/italiano/lexicon.cljc
@@ -1499,14 +1499,14 @@
                    :pred :read
                    :subj {:human true}
                    :obj {:legible true}}}}
-   "libro"
-   {:synsem {:agr {:gender :masc}
-             :cat :noun
-             :sem {:artifact true
-                   :pred :libro
-                   :legible true
-                   :speakable false
-                   :consumable false}}}
+
+   "lezione" {:synsem {:agr {:gender :fem}
+                       :cat :noun
+                       :sem {:pred :lesson}}}
+
+   "libro" {:synsem {:agr {:gender :masc}
+                     :cat :noun
+                     :sem {:pred :libro}}}

    ;; as with "la", do we need both of these "lo" entries? try to get by with just one.
    "lo"


set content type for oauth error messages

--- src/braid/server/routes/api.clj
+++ src/braid/server/routes/api.clj
@@ -222,6 +222,7 @@
                   user (db/user-with-email email)]
               (cond
                 (nil? email) {:status 401
+                              :headers {"Content-Type" "text/plain"}
                               :body "Couldn't get email address from github"}

                 user {:status 302
@@ -241,6 +242,7 @@
                 :else
                 {:status 401
                  ; TODO: handle failure better
+                 :headers {"Content-Type" "text/plain"}
                  :body "No such user"
                  :session nil})))
         {:status 400


Fix typo so that OS X 64 will work

Fix typo so that OS X 64 will work

--- src/clj/robinson/glterminal.clj
+++ src/clj/robinson/glterminal.clj
@@ -290,7 +290,7 @@
       (System/setProperty "org.lwjgl.librarypath", (.getAbsolutePath (File. "natives/linux/x86_64")))
     [LWJGLUtil/PLATFORM_MACOSX false]
       (System/setProperty "org.lwjgl.librarypath", (.getAbsolutePath (File. "natives/macosx/x86")))
-    [LWJGLUtil/PLATFORM_MACOSX false]
+    [LWJGLUtil/PLATFORM_MACOSX true]
       (System/setProperty "org.lwjgl.librarypath", (.getAbsolutePath (File. "natives/macosx/x86_64")))
     [LWJGLUtil/PLATFORM_WINDOWS false]
       (System/setProperty "org.lwjgl.librarypath", (.getAbsolutePath (File. "natives/windows/x86")))
@@ -962,4 +962,4 @@
       (async/close! input-chan)
       (Display/makeCurrent)
       (Display/destroy)))
-  (System/exit 0))+  (System/exit 0))


Rename btn generator fn

Rename btn generator fn

--- src/cljs/comic_reader/main.cljs
+++ src/cljs/comic_reader/main.cljs
@@ -33,7 +33,7 @@
    "There's nothing to see here."
    [:a {:href "/#"}]])

-(defn btn-for-id-name [on-click]
+(defn id-btn-for-callback [on-click]
   (fn [data]
     (let [{:keys [id name]} data]
       ^{:key id}
@@ -46,14 +46,15 @@
   (let [site-list (rf/subscribe [:site-list])]
     (fn []
       (when-let [site-list @site-list]
-        [:ul (map (btn-for-id-name
-                   #(go-to (comics-path {:site (:id %)}))) site-list)]))))
+        [:ul (map (id-btn-for-callback
+                   #(go-to (comics-path {:site (:id %)})))
+                  site-list)]))))

 (defn comic-list []
   (let [comics-list (rf/subscribe [:comic-list])]
     (fn []
       (when-let [comic-list @comic-list]
-        [:ul (map (btn-for-id-name
+        [:ul (map (id-btn-for-callback
                    #(.log js/console
                           (str "You clicked the "
                                (:id %)


Mention exact match on client side

Mention exact match on client side

--- src/cljs/subman/components.cljs
+++ src/cljs/subman/components.cljs
@@ -16,7 +16,7 @@
                                    :href "#"}
                                [:i.fa.fa-chevron-left]])]
    [:input.form-control {:type "text"
-                         :placeholder "Type search query. You can specifie language with :lang name, by default used english."
+                         :placeholder "Type search query"
                          :on-change #(reset! value (-> % .-target .-value))
                          :value @value
                          :id "search-input"}]])
@@ -58,6 +58,10 @@
                                [:a {:href "http://subscene.com/"
                                     :target "_blank"} "subscene.com"]
                                "."]
+                              [:p "In query you can specifie language with "
+                               [:code ":lang name"]
+                               ", by default used english."]
+                              [:p "And you can use exact match with " [:code ":exact"] "."]
                               [:p "Total indexed subtitles count: "
                                @total-count
                                "."]


Use relative imports

Use relative imports

--- src/clojure/staircase/tools.clj
+++ src/clojure/staircase/tools.clj
@@ -6,10 +6,10 @@

 (def tool-defaults ;; Lots of duplication here - be less explicit?
   {:headingTemplateURI "./heading.html"
-   :headingControllerURI "./heading-controller.js"
-   :providerURI "./provider.js"
+   :headingControllerURI "./heading-controller"
+   :providerURI "./provider"
    :templateURI "./template.html"
-   :controllerURI "./controller.js"
+   :controllerURI "./controller"
    :width 1})

 (defn- fix-uris


Change default username

Change default username

--- tutorial.vent/src/tutorial/vent/http_api.clj
+++ tutorial.vent/src/tutorial/vent/http_api.clj
@@ -7,7 +7,7 @@

 (defmethod verify ::constant
   [ctx _]
-  "overfl0w")
+  "works_for_pizza")

 (defn- resolve-params
   [m pull]


Update component view to live-update its state

--- src/discuss/references/lib.cljs
+++ src/discuss/references/lib.cljs
@@ -1,6 +1,7 @@
 (ns discuss.references.lib
   (:require [discuss.utils.common :as lib]
-            [om.dom :as dom]))
+            [om.dom :as dom]
+            [om.core :as om]))

 (defn save-selected-reference!
   "Saves the currently clicked reference for further processing."
@@ -39,8 +40,12 @@
 ;;;; View Components
 (defn- current-reference-component
   "Return DOM element showing which reference is currently selected."
-  []
-  (dom/div #js {:className "text-center"
-                :style     #js {:paddingBottom "1em"}}
-           (let [ref-title (:text (get-selected-reference))]
-             (dom/em nil "\"" ref-title "\""))))+  [_ owner]
+  (reify
+    om/IRender
+    (render [_]
+      (om/observe owner (lib/get-cursor :layout))
+      (dom/div #js {:className "text-center"
+                    :style     #js {:paddingBottom "1em"}}
+               (let [ref-title (:text (get-selected-reference))]
+                 (dom/em nil "\"" ref-title "\""))))))


CMR-2362: Reset database to in-memory

CMR-2362: Reset database to in-memory

--- dev-system/dev/user.clj
+++ dev-system/dev/user.clj
@@ -41,8 +41,8 @@
   ;; MAKE SURE YOU DISABLE SYMANTEC ANTIVIRUS BEFORE STARTING THE TESTS WITH EXTERNAL DB
   ;; Renable them when you're done

-  ; (system/set-dev-system-db-type! :in-memory)
-  (system/set-dev-system-db-type! :external)
+  (system/set-dev-system-db-type! :in-memory)
+  ; (system/set-dev-system-db-type! :external)

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


Reduce rotated log size back to 50MB as in 0.9.

--- src/onyx/static/logging_configuration.clj
+++ src/onyx/static/logging_configuration.clj
@@ -4,8 +4,7 @@
             [taoensso.timbre :refer [info] :as timbre]
             [taoensso.timbre.appenders.3rd-party.rotor :as rotor]))

-;; FIXME, remove increase to 1GB from 50MB
-(def MAX-LOG-SIZE (* 512 102400 20))
+(def MAX-LOG-SIZE (* 512 102400))
 (def MAX-LOG-FILES 5)

 ;; temporary workaround to prevent timbre from crashing under some circumstances


Updated photo migration for hecuba changes.

--- dev/photo_migration.clj
+++ dev/photo_migration.clj
@@ -9,24 +9,17 @@
             [clojure.tools.logging            :as log]
             [kixi.hecuba.webutil              :refer (uuid)]))

-
-(defn path-from [p]
-  (try
-    (when (instance? String p) (-> p
-                                   (json/parse-string keyword)
-                                   :path))
-    (catch Throwable t
-      (log/error (str "parsing " p)))))
-
 ;; TODO - need to look at the path things end up at in s3.
-(defn get-item-from-old-embed-bucket [s3-session key]
-  (let [outfile (ioplus/mk-temp-file! "photo-migration" "")]
+(defn get-item-from-old-embed-bucket [s3-session photo]
+  (let [outfile (ioplus/mk-temp-file! "photo-migration" "")
+        key (:path photo)]
+
     (.deleteOnExit outfile)
-    (println key)
+    (log/info "looking for key " key " in " (:file-bucket s3-session))
     (when (s3/item-exists? s3-session key)
       (with-open [in (s3/get-object-by-metadata s3-session {:key key})]
         (io/copy in outfile))
-      {:src-name  "uploads"
+      {:src-name  "media-resources"
        :feed-name "images"
        :uuid      (uuid)
        :dir       (.getParent outfile)
@@ -37,12 +30,11 @@
         get-old (partial get-item-from-old-embed-bucket (assoc s3 :file-bucket "get-embed-data"))
         ]
     (db/with-session [session (:hecuba-session store)]
-      (doseq [{:keys [id photos]} (entities/get-all session)]
-        (log/info "migrating photos for " id)
-        (if-let [paths (not-empty (keep path-from photos))]
-          (doseq [item (keep get-old paths)]
-            (log/info "migrating path for " item)
-            (upload/image-upload store  (assoc item :entity_id id))))))))
+      (doseq [{:keys [entity_id photos]} (entities/get-all session)]
+        (log/info "migrating photos for " entity_id)
+        (doseq [item (keep get-old photos)]
+          (log/info "migrating path for " item)
+          (upload/image-upload store  (assoc item :entity_id entity_id)))))))

 (comment
   ;; from 'user ns after (go)


Add and update ClojureDocs for experiment_helper.clj.

--- src/dsbdp/experiment_helper.clj
+++ src/dsbdp/experiment_helper.clj
@@ -38,6 +38,7 @@
 (def chunker (make-treebank-chunker "resources/opennlp/models/en-chunker.bin"))

 (defn create-no-op-proc-fns
+  "Create a vector of n no-op functions."
   [n]
   (utils/create-proc-fn-vec-from-template
     '(fn [_ _] 0)
@@ -45,6 +46,8 @@
     n))

 (defn create-inc-proc-fns
+  "Create a vector of functions which each perform a single increment operation.
+   The first function will increment the input argument and subsequent functions will increment the output argument."
   [n]
   (utils/create-proc-fn-vec-from-template
     '(fn [i _] (inc i))
@@ -52,6 +55,7 @@
     n))

 (defn create-hashmap-inc-put-proc-fns
+  "The general behaviour is analogous to create-inc-proc-fns, however, the results are stored in a map in which the index of the processing function is used as key to which the result of the operation is associated as value."
   [n]
   (let [o-sym 'o]
     (let [o-meta (vary-meta o-sym assoc :tag 'java.util.Map)]
@@ -61,6 +65,7 @@
        n))))

 (defn factorial
+  "A purposely naive implementation for calculating factorials."
   ([n]
     (factorial 1N 1N n))
   ([result i n]
@@ -69,6 +74,7 @@
       result)))

 (defn create-factorial-proc-fns
+  "Create a vector of processing functions that each calculate the factorial of the input data."
   [n]
   (utils/create-proc-fn-vec-from-template
     '(fn [i _] (dsbdp.experiment-helper/factorial i))
@@ -76,6 +82,8 @@
      n))

 (defn create-busy-sleep-proc-fns
+  "Create a vector of processing functions that perform a busy sleep.
+   The duration of the busy sleep is given as input data in nanoseconds."
   [n]
   (utils/create-proc-fn-vec-from-template
     '(fn [i _] (dsbdp.ExperimentHelper/busySleep ^long (i :_idx_)) 0)


Add ICMP sample data.

Add ICMP sample data.


(PE-3198) Log exceptions in shutdown-on-error

--- src/puppetlabs/trapperkeeper/internal.clj
+++ src/puppetlabs/trapperkeeper/internal.clj
@@ -236,6 +236,7 @@

      (f)
      (catch Throwable t
+       (log/error t "shutdown-on-error triggered because of exception!")
        (deliver shutdown-reason-promise {:cause       :service-error
                                          :error       t
                                          :on-error-fn (when on-error-fn


Fixes #630 - Remove settings menu item from drawer

--- src/status_im/components/drawer/view.cljs
+++ src/status_im/components/drawer/view.cljs
@@ -103,10 +103,6 @@
            [view st/menu-items-container
             [menu-item {:name    (label :t/profile)
                         :handler #(dispatch [:navigate-to :my-profile])}]
-            [menu-item {:name    (label :t/settings)
-                        :handler (fn []
-                                   ;; TODO not implemented
-                                   )}]
             [menu-item {:name    (label :t/discover)
                         :handler #(dispatch [:navigate-to-tab :discover])}]
             [menu-item {:name    (label :t/contacts)


Fixed annotate three-tuple checker.

Fixed annotate three-tuple checker.

--- src/validation_benchmark/lib/annotate.clj
+++ src/validation_benchmark/lib/annotate.clj
@@ -20,7 +20,8 @@

 (defn three-tuple [v]
-  (ann/check [types/Keyword String types/Num] v))
+  (ann/check (types/U [types/Keyword String types/Num]
+                      (list types/Keyword String types/Num)) v))

 (defn vector-of-two-elements [v]


fixed logging in socket.io

fixed logging in socket.io

--- src/engine/server/socket_io.clj
+++ src/engine/server/socket_io.clj
@@ -163,11 +163,12 @@

 (defn deathwatch [channel timeout]
   (future
-    (let [dup (fork channel)]
-      (while (not (drained? channel))
-        (try (wait-for-message channel (* 1000 timeout))
-             (catch TimeoutException _ (log/info "Timeout and closing") (close channel))
-             (catch Exception e (log/error "Caught and closing " e) (close channel)))))))
+    (with-logging-config [:root {:level :trace :out socket-out}]
+      (let [dup (fork channel)]
+        (while (not (drained? channel))
+          (try (wait-for-message channel (* 1000 timeout))
+               (catch TimeoutException _ (log/info "Timeout and closing") (close channel))
+               (catch Exception e (log/error "Caught and closing " e) (close channel))))))))

 (defn handle-ack [socket id data data-ack?]
   (cond (and data-ack? (not id))
@@ -177,7 +178,7 @@

 (defn message-handler [socket dispatcher]
   (fn [message]
-    (with-logging-config [:root {:level :debug :out socket-out}]
+    (with-logging-config [:root {:level :trace :out socket-out}]
       (try
         (when-let [[type id data-ack endpoint data] (translate-message message)]
           (case type


cleanup of :char type

cleanup of :char type

--- src/push/types/base/char.clj
+++ src/push/types/base/char.clj
@@ -1,15 +1,90 @@
 (ns push.types.base.char
+  (:use push.types.extra.generator)
   (:require [push.instructions.core :as core]
             [push.types.core :as t]
             [push.instructions.dsl :as d]
             [push.util.stack-manipulation :as u]
             [push.util.code-wrangling :as fix]
-            [push.instructions.aspects :as aspects])
-  (:use push.types.extra.generator)
-)
+            [push.instructions.aspects :as aspects]
+            ))

-;; character-specific
+(def char-digit? (t/simple-1-in-predicate
+  "`:char-digit? pushes `true` if the top `:char` is a digit (per Java `Character/isDigit`)"
+  :char "digit?" #(Character/isDigit %1)))
+
+
+
+(def char-letter? (t/simple-1-in-predicate
+  "`:char-letter? pushes `true` if the top `:char` is a letter (per Java `Character/isLetter`)"
+  :char "letter?" #(Character/isLetter %1)))
+
+
+
+(def char-lowercase? (t/simple-1-in-predicate
+  "`:char-lowercase? pushes `true` if the top `:char` is lowercase (per Java `Character/isLowerCase`)"
+  :char "lowercase?" #(Character/isLowerCase %1)))
+
+
+
+(def char-uppercase? (t/simple-1-in-predicate
+  "`:char-uppercase? pushes `true` if the top `:char` is uppercase (per Java `Character/isUpperCase`)"
+  :char "uppercase?" #(Character/isUpperCase %1)))
+
+
+
+(def char-whitespace? (t/simple-1-in-predicate
+  "`:char-whitespace? pushes `true` if the top `:char` is a whitespace (per Java `Character/isWhitespace`)"
+  :char "whitespace?" #(Character/isWhitespace %1)))
+
+
+
+;; conversion
+
+
+
+(def float->asciichar
+  (core/build-instruction
+    float->asciichar
+    "`:float->asciichar` pops the top `:float` value, reduces it to an integer modulo 128, and pushes the `:char` that is represented by that ASCII value"
+    :tags #{:string :conversion :base}
+    (d/consume-top-of :float :as :arg)
+    (d/calculate [:arg] #(char (mod (bigint %1) 128)) :as :c)
+    (d/push-onto :char :c)))
+
+
+
+(def float->char
+  (core/build-instruction
+    float->char
+    "`:float->char` pops the top `:float` value, reduces it to an integer modulo 65535, and pushes the `:char` that is represented by that unicode value"
+    :tags #{:string :conversion :base}
+    (d/consume-top-of :float :as :arg)
+    (d/calculate [:arg] #(char (mod (bigint %1) 65535)) :as :c)
+    (d/push-onto :char :c)))
+
+
+
+(def integer->asciichar
+  (core/build-instruction
+    integer->asciichar
+    "`:integer->asciichar` pops the top `:integer` value, reduces it modulo 128, and pushes the `:char` that is represented by that ASCII value"
+    :tags #{:string :conversion :base}
+    (d/consume-top-of :integer :as :arg)
+    (d/calculate [:arg] #(char (mod %1 128)) :as :c)
+    (d/push-onto :char :c)))
+
+
+
+(def integer->char
+  (core/build-instruction
+    integer->char
+    "`:integer-char` pops the top `:integer` value, reduces it modulo 65535, and pushes the `:char` that is represented by that unicode value"
+    :tags #{:string :conversion :base}
+    (d/consume-top-of :integer :as :arg)
+    (d/calculate [:arg] #(char (mod %1 65535)) :as :c)
+    (d/push-onto :char :c)))
+

 (def string->chars
@@ -24,70 +99,6 @@
     (d/calculate [:new-stack] #(into '() (reverse %1)) :as :kludged)
     (d/replace-stack :char :kludged)))

-
-(def char-digit? (t/simple-1-in-predicate
-  "`:char-digit? pushes `true` if the top `:char` is a digit (per Java `Character/isDigit`)"
-  :char "digit?" #(Character/isDigit %1)))
-
-
-(def integer->asciichar
-  (core/build-instruction
-    integer->asciichar
-    "`:integer->asciichar` pops the top `:integer` value, reduces it modulo 128, and pushes the `:char` that is represented by that ASCII value"
-    :tags #{:string :conversion :base}
-    (d/consume-top-of :integer :as :arg)
-    (d/calculate [:arg] #(char (mod %1 128)) :as :c)
-    (d/push-onto :char :c)))
-
-
-(def integer->char
-  (core/build-instruction
-    integer->char
-    "`:integer-char` pops the top `:integer` value, reduces it modulo 65535, and pushes the `:char` that is represented by that unicode value"
-    :tags #{:string :conversion :base}
-    (d/consume-top-of :integer :as :arg)
-    (d/calculate [:arg] #(char (mod %1 65535)) :as :c)
-    (d/push-onto :char :c)))
-
-
-(def float->asciichar
-  (core/build-instruction
-    float->asciichar
-    "`:float->asciichar` pops the top `:float` value, reduces it to an integer modulo 128, and pushes the `:char` that is represented by that ASCII value"
-    :tags #{:string :conversion :base}
-    (d/consume-top-of :float :as :arg)
-    (d/calculate [:arg] #(char (mod (bigint %1) 128)) :as :c)
-    (d/push-onto :char :c)))
-
-
-(def float->char
-  (core/build-instruction
-    float->char
-    "`:float->char` pops the top `:float` value, reduces it to an integer modulo 65535, and pushes the `:char` that is represented by that unicode value"
-    :tags #{:string :conversion :base}
-    (d/consume-top-of :float :as :arg)
-    (d/calculate [:arg] #(char (mod (bigint %1) 65535)) :as :c)
-    (d/push-onto :char :c)))
-
-
-(def char-letter? (t/simple-1-in-predicate
-  "`:char-letter? pushes `true` if the top `:char` is a letter (per Java `Character/isLetter`)"
-  :char "letter?" #(Character/isLetter %1)))
-
-
-(def char-lowercase? (t/simple-1-in-predicate
-  "`:char-lowercase? pushes `true` if the top `:char` is lowercase (per Java `Character/isLowerCase`)"
-  :char "lowercase?" #(Character/isLowerCase %1)))
-
-
-(def char-uppercase? (t/simple-1-in-predicate
-  "`:char-uppercase? pushes `true` if the top `:char` is uppercase (per Java `Character/isUpperCase`)"
-  :char "uppercase?" #(Character/isUpperCase %1)))
-
-
-(def char-whitespace? (t/simple-1-in-predicate
-  "`:char-whitespace? pushes `true` if the top `:char` is a whitespace (per Java `Character/isWhitespace`)"
-  :char "whitespace?" #(Character/isWhitespace %1)))

 (def char-type
@@ -104,15 +115,15 @@
         aspects/make-storable
         aspects/make-taggable
         aspects/make-visible
-        (t/attach-instruction , string->chars)
+        (t/attach-instruction , char-digit?)
         (t/attach-instruction , char-letter?)
-        (t/attach-instruction , char-digit?)
+        (t/attach-instruction , char-lowercase?)
+        (t/attach-instruction , char-uppercase?)
         (t/attach-instruction , char-whitespace?)
+        (t/attach-instruction , float->asciichar)
+        (t/attach-instruction , float->char)
         (t/attach-instruction , integer->asciichar)
         (t/attach-instruction , integer->char)
-        (t/attach-instruction , float->char)
-        (t/attach-instruction , float->asciichar)
-        (t/attach-instruction , char-lowercase?)
-        (t/attach-instruction , char-uppercase?)
+        (t/attach-instruction , string->chars)
         ))


remove redundant str/trim in split-value

--- src/selmer/filter_parser.clj
+++ src/selmer/filter_parser.clj
@@ -134,7 +134,6 @@

 (defn split-value [s]
   (->> s
-       (s/trim)
        ;; Ignore pipes and allow escaped doublequotes inside doublequotes
        (re-seq #"\w*(?:[^|\"]|\"[^\"]*\")+")
        (map str/trim)))