fix paths to :note so that :notes can be removed prior to printing surface form

--- src/babel/english/morphology.cljc
+++ src/babel/english/morphology.cljc
@@ -18,12 +18,8 @@
                                  (= :perfect (get-in input [:synsem :sem :aspect]))))
                        (not (= :lui (get-in input [:synsem :sem :subj :pred])))
                        (not (= :lei (get-in input [:synsem :sem :subj :pred]))))
-                ;; TODO: we are (dissoc)ing two paths, but probably only need
-                ;; to do the second [:english :a :note]. It's harmless to do both
-                ;; but confusing to try to understand since the first is
-                ;; probably not significant.
-                (dissoc-paths input [[:comp :english :note]
-                                     [:english :a :note]])
+                (dissoc-paths input [[:english :a :note] ;; this handles "you" in "you wash yourself"
+                                     [:english :b :b :note]]) ;; this handles "yourself" in the same sentence.
                 input)]
     (cond
       (= input :fail)


Remove error message when messages get through

--- src/braid/client/core/events.cljs
+++ src/braid/client/core/events.cljs
@@ -586,11 +586,17 @@
 (reg-event-db
   :add-open-thread
   (fn [state [_ thread]]
-    (-> state
-        (update-in [:threads (thread :id)] merge thread)
-        (update-in [:group-threads (thread :group-id)]
-                   #(conj (set %) (thread :id)))
-        (update-in [:user :open-thread-ids] conj (thread :id)))))
+    (let [msg-ids (into #{} (map (comp (partial str :failed-to-send) :id))
+                        (:messages thread))
+          remove-msg-errors (fn [state]
+                              (update state :errors
+                                      (partial remove (fn [[k _]] (msg-ids k)))))]
+      (-> state
+          remove-msg-errors
+          (update-in [:threads (thread :id)] merge thread)
+          (update-in [:group-threads (thread :group-id)]
+                     #(conj (set %) (thread :id)))
+          (update-in [:user :open-thread-ids] conj (thread :id))))))

 (reg-event-fx
   :maybe-increment-unread


Implement Nasir via JoelCFC25.

Implement Nasir via JoelCFC25.

--- src/clj/game/cards-identities.clj
+++ src/clj/game/cards-identities.clj
@@ -161,7 +161,17 @@
                                   :effect (effect (mill 2) (draw))}}}

    "Nasir Meidan: Cyber Explorer"
-   {:effect (effect (gain :link 1))}
+   {:effect (effect (gain :link 1))
+    :abilities [{:req (req (and (:run @state)
+                                (:rezzed (get-card state current-ice))))
+                 :effect (req (let [current-ice (get-card state current-ice)]
+                           (trigger-event state side :pre-rez-cost current-ice)
+                           (let [cost (rez-cost state side current-ice)]
+                             (lose state side :credit (:credit runner))
+                             (gain state side :credit cost)
+                             (system-msg state side (str "loses all credits and gains " cost
+                                                         " [Credits] from the rez of " (:title current-ice)))
+                             (swap! state update-in [:bonus] dissoc :cost))))}]}

    "NBN: Making News"
    {:recurring 2}


Add 24/7 News Cycle

Add 24/7 News Cycle

--- src/clj/game/cards-operations.clj
+++ src/clj/game/cards-operations.clj
@@ -1,7 +1,15 @@
 (in-ns 'game.core)

 (def cards-operations
-  {"Aggressive Negotiation"
+  {
+   "24/7 News Cycle"
+   {:req (req (> (count (filter #(not= (:title %) "Bifrost Array") (:scored corp))) 2))
+    :additional-cost [:forfeit]
+    :prompt "Choose an agenda to trigger"
+    :msg (msg "trigger the score ability on " (:title target))
+    :effect (effect (card-init target))}
+
+   "Aggressive Negotiation"
    {:req (req (:scored-agenda corp-reg)) :prompt "Choose a card" :choices (req (:deck corp))
     :effect (effect (move target :hand) (shuffle! :deck))}


Removed time part in the lobby deck selector

--- src/cljs/netrunner/gamelobby.cljs
+++ src/cljs/netrunner/gamelobby.cljs
@@ -141,7 +141,7 @@
              [:img {:src (image-url (:identity deck))}]
              [:div.float-right (deck-status-span deck)]
              [:h4 (:name deck)]
-             [:div.float-right (-> (:date deck) js/Date. js/moment (.format "MMM Do YYYY - HH:mm"))]
+             [:div.float-right (-> (:date deck) js/Date. js/moment (.format "MMM Do YYYY"))]
              [:p (get-in deck [:identity :title])]])])]]])))

 (defn faction-icon


simplify undo-move

simplify undo-move

--- src/cljs/triboard/logic/game.cljs
+++ src/cljs/triboard/logic/game.cljs
@@ -34,7 +34,7 @@
 (defn undo-player-move
   "Cancel the last player move, getting back to the previous player move"
   [game]
-  (let [new-game (drop-while #(player/is-ai? (:player %)) (drop 1 game))]
+  (let [new-game (drop-while (comp player/is-ai? :player) (drop 1 game))]
     (if (empty? new-game)
       (take-last 1 game)
       new-game)))


Don't make completions with nil

Don't make completions with nil

--- src/clojure/nightcode/editors.clj
+++ src/clojure/nightcode/editors.clj
@@ -360,7 +360,8 @@
       (getCompletions [comp]
         (let [prefix (.getAlreadyEnteredText this comp)
               context (get-completion-context text-area prefix)]
-          (for [symbol-str (compliment/completions prefix context)]
+          (for [symbol-str (compliment/completions prefix context)
+                :when (some? symbol-str)]
             (->> (str "
"
                       (compliment/documentation symbol-str)
                       "
")


rewriting/fixing some query logic

rewriting/fixing some query logic

--- src/com/billpiel/sayid/query2.clj
+++ src/com/billpiel/sayid/query2.clj
@@ -34,256 +34,6 @@
   (->> z
        (iter-while-identity z/up)
        rest))
-
-(defn children-zips [z]
-  (->> z
-       z/down
-       (iter-while-identity z/right)))
-
-(defn descendant-depth-firstish-zips [z]
-  (let [kids (children-zips z)]
-    (lazy-cat kids
-              (mapcat descendant-depth-firstish-zips
-                      kids))))
-
-;; === helpers
-
-(defn some-zippers
-  [zipr-seq node tags-fn pred-fn]
-  (->> zipr-seq
-       (map z/node)
-       (map tags-fn)
-       (some pred-fn)))
-
-(defmacro defn-zipper->>
-  [name & body]
-  `(defn ~name
-     [node#]
-     (->> node#
-          :zipper
-          ~@body)))
-
-(defmacro defn-tags-functor
-  [name & body]
-  `(defn ~name
-     [node# tags-fn#]
-     (->> node#
-          ~@body
-          (map z/node)
-          (map tags-fn#))))
-
-(defn-zipper->> lazy-ancestor-zipr-seq ancestor-zips)
-(defn-tags-functor lazy-ancestor-tag-seq lazy-ancestor-zipr-seq)
-
-(defn-zipper->> lazy-descendant-zipr-seq descendant-depth-firstish-zips)
-(defn-tags-functor lazy-descendant-tag-seq lazy-descendant-zipr-seq)
-
-(defn-zipper->> lazy-sibling-zipr-seq all-sib-zips)
-(defn-tags-functor lazy-sibling-tag-seq lazy-sibling-zipr-seq)
-
-(defn some-tags
-  [tag-set tag-seq]
-  (some (partial some
-                 tag-set)
-        tag-seq))
-
-(defmacro defn-tag-seq-fnr->>
-  [name args & body]
-  `(defn ~name
-     ~(conj args 'tag-seq-functor)
-     (fn [~'node ~'tag-fn]
-       (->> (~'tag-seq-functor ~'node ~'tag-fn)
-            ~@body))))
-
-(defn-tag-seq-fnr->> mk-some-tags-in-seq-fn [tag-set] (some-tags tag-set))
-(defn-tag-seq-fnr->> take-lazy-tag-seq-functor [n] (take n))
-(defn-tag-seq-fnr->> prepend-node-to-lazy-tag-seq-functor [] (lazy-cat [(tag-fn node)]))
-
-;; === tags
-
-(defn get-tags
-  [node pred-map]
-  (vec (for [[kw pred] pred-map
-             :when (pred node)]
-         kw)))
-
-(defn get-tag-map
-  [tree pred-map]
-  (reduce (fn [tag-map node]
-            (assoc tag-map
-                   (:id node)
-                   (get-tags node pred-map)))
-          {}
-          (tree-seq map? :children tree)))
-
-(defn mk-get-tag-fn
-  [tag-map]
-  (fn [tree]
-    (-> tree
-        :id
-        tag-map)))
-
-;; === zippers
-
-(defn tree->zipper
-  [tree]
-  (z/zipper map?
-            #(-> % :children not-empty)
-            #(assoc % :children %2)
-            tree))
-
-(defn traverse-assoc-zipper
-  [zipr]
-  (if (z/end? zipr)
-    (-> zipr z/root)
-    (recur (-> zipr
-               (z/edit assoc :zipper zipr)
-               z/next))))
-
-(defn traverse-tree-assoc-zipper
-  [tree]
-  (-> tree
-      tree->zipper
-      traverse-assoc-zipper))
-
-;; move this to trace or utils?
-(defn traverse-tree
-  [tree f]
-  (assoc (f tree)
-         :children (mapv #(traverse-tree % f)
-                         (:children tree))))
-
-(defn traverse-tree-dissoc-zipper
-  [tree]
-  (traverse-tree tree #(dissoc % :zipper)))
-
-;; === query
-
-(defn query-tree
-  [qry-fn tree]
-  (if-not (nil? tree)
-    (let [e' (update-in tree [:children]
-                        (partial mapcat
-                                 (partial query-tree
-                                          qry-fn)))]
-      (if (qry-fn tree)
-        [e']
-        (:children e')))
-    []))
-
-(defn query-dos
-  [tree pred-map pred-final-fn] ;; pred-final-fn takes a node (w/ :zipper) and fn to retrieve tags from a node
-  (let [tag-map (get-tag-map tree pred-map)
-        get-tag-fn (mk-get-tag-fn tag-map)
-        pred-final-fn' #(pred-final-fn % get-tag-fn)]
-    (->> tree
-         tree->zipper
-         traverse-assoc-zipper
-         (query-tree pred-final-fn'))))
-
-(defn query-uno
-  [tree pred-fn]
-  (query-tree pred-fn tree))
-
-(defn query
-  ([tree pred-fn] (query-uno tree pred-fn))
-  ([tree pred-map pred-final-fn] (query-dos tree pred-map pred-final-fn)))
-
-;; === macro interface
-
-
-(defn get-some*
-  [f v]
-  (cond
-    (fn? f)
-    (f v)
-
-    (set? f)
-    (f v)
-
-    :default
-    (get v f)))
-
-(defn get-some
-  [coll v]
-  (loop [coll coll
-         v v]
-    (if ((some-fn empty? nil?) coll)
-      v
-      (let [[f & r] coll]
-        (when-let [v' (get-some* f v)]
-          (recur r v'))))))
-
-(defn eq* [pred v]
-  (cond (fn? pred)
-        (pred v)
-
-        (set? pred)
-        (pred v)
-
-        (instance? java.util.regex.Pattern pred)
-        (->> v
-             str
-             (re-matches pred))
-
-        :default (= pred v)))
-
-(defn mk-query-fn
-  [query-coll]
-  (let [path (drop-last query-coll)
-        pred (last query-coll)]
-    (fn [v]
-      (try
-        (->> v
-             (get-some path)
-             (eq* pred))
-        (catch Exception ex
-          nil)))))
-
-(defn some-mk-query-fn
-  [queries]
-  (->> queries
-       (map mk-query-fn)
-       (apply some-fn)))
-
-(defn some-fn-2
-  [& preds]
-  (fn [node tag-fn]
-    (loop [[f & r] preds]
-      (or (f node tag-fn)
-          (when (not-empty r)
-            (recur r))))))
-
-(defn every-pred-2
-  [& preds]
-  (fn [node tag-fn]
-    (loop [[f & r] preds]
-      (and (f node tag-fn)
-           (if (not-empty r)
-             (recur r)
-             true)))))
-
-#_ (defn mk-relative-final-qry-fn
-     [opts tag-set & [dist]]
-     (let [opts' (util/obj-pred-action-else opts
-                                            (partial some #{:w})
-                                            :t [:a :s :d])
-           f' (fn [tag-seq-fnr]
-                (let [taker (if dist
-                              (partial take-lazy-tag-seq-functor dist)
-                              identity)
-                      stis (->> tag-seq-fnr
-                                taker
-                                prepend-node-to-lazy-tag-seq-functor
-                                (mk-some-tags-in-seq-fn tag-set))]
-                  stis))
-           rel-seq-map {:a lazy-descendant-tag-seq
-                        :s lazy-sibling-tag-seq
-                        :d lazy-ancestor-tag-seq}]
-       (->> opts'
-            (keep rel-seq-map)
-            (map f')
-            (apply some-fn-2))))

 (defn children-zips [zipr]
   (some->> zipr
@@ -304,11 +54,166 @@
               (children-zips-by-generation kids)))
     nil))

+
+;; === tags
+
+(defn get-tags
+  [node pred-map]
+  (vec (for [[kw pred] pred-map
+             :when (pred node)]
+         kw)))
+
+(defn get-tag-map
+  [tree pred-map]
+  (reduce (fn [tag-map node]
+            (assoc tag-map
+                   (:id node)
+                   (get-tags node pred-map)))
+          {}
+          (tree-seq map? :children tree)))
+
+(defn mk-get-tag-fn
+  [tag-map]
+  (fn [tree]
+    (-> tree
+        :id
+        tag-map)))
+
+;; === zippers
+
+(defn tree->zipper
+  [tree]
+  (z/zipper map?
+            #(-> % :children not-empty)
+            #(assoc % :children %2)
+            tree))
+
+(defn traverse-assoc-zipper
+  [zipr]
+  (if (z/end? zipr)
+    (-> zipr z/root)
+    (recur (-> zipr
+               (z/edit assoc :zipper zipr)
+               z/next))))
+
+(defn traverse-tree-assoc-zipper
+  [tree]
+  (-> tree
+      tree->zipper
+      traverse-assoc-zipper))
+
+;; move this to trace or utils?
+(defn traverse-tree
+  [tree f]
+  (assoc (f tree)
+         :children (mapv #(traverse-tree % f)
+                         (:children tree))))
+
+(defn traverse-tree-dissoc-zipper
+  [tree]
+  (traverse-tree tree #(dissoc % :zipper)))
+
+;; === query
+
+(defn query-tree
+  [qry-fn tree]
+  (if-not (nil? tree)
+    (let [e' (update-in tree [:children]
+                        (partial mapcat
+                                 (partial query-tree
+                                          qry-fn)))]
+      (if (qry-fn tree)
+        [e']
+        (:children e')))
+    []))
+
+(defn query-dos
+  [tree pred-map pred-final-fn] ;; pred-final-fn takes a node (w/ :zipper) and fn to retrieve tags from a node
+  (let [tag-map (get-tag-map tree pred-map)
+        get-tag-fn (mk-get-tag-fn tag-map)
+        pred-final-fn' #(pred-final-fn % get-tag-fn)]
+    (->> tree
+         tree->zipper
+         traverse-assoc-zipper
+         (query-tree pred-final-fn'))))
+
+(defn query-uno
+  [tree pred-fn]
+  (query-tree pred-fn tree))
+
+(defn query
+  ([tree pred-fn] (query-uno tree pred-fn))
+  ([tree pred-map pred-final-fn] (query-dos tree pred-map pred-final-fn)))
+
+;; === macro interface
+
+
+(defn get-some*
+  [f v]
+  (cond
+    (fn? f)
+    (f v)
+
+    (set? f)
+    (f v)
+
+    :default
+    (get v f)))
+
+(defn get-some
+  [coll v]
+  (loop [coll coll
+         v v]
+    (if ((some-fn empty? nil?) coll)
+      v
+      (let [[f & r] coll]
+        (when-let [v' (get-some* f v)]
+          (recur r v'))))))
+
+(defn eq* [pred v]
+  (cond (fn? pred)
+        (pred v)
+
+        (set? pred)
+        (pred v)
+
+        (instance? java.util.regex.Pattern pred)
+        (->> v
+             str
+             (re-matches pred))
+
+        :default (= pred v)))
+
+(defn mk-query-fn
+  [query-coll]
+  (let [path (drop-last query-coll)
+        pred (last query-coll)]
+    (fn [v]
+      (try
+        (->> v
+             (get-some path)
+             (eq* pred))
+        (catch Exception ex
+          nil)))))
+
+(defn some-mk-query-fn
+  [queries]
+  (->> queries
+       (map mk-query-fn)
+       (apply some-fn)))
+
+(defn every-pred-2
+  [& preds]
+  (fn [node tag-fn]
+    (loop [[f & r] preds]
+      (and (f node tag-fn)
+           (if (not-empty r)
+             (recur r)
+             true)))))
+
+
 (defn mk-lazy-descendant-tag-seq
   [node tag-fn dist]
-  (def n' node)
-  (def tag-fn' tag-fn)
-  (def d' dist)
   (let [generations-seq (->> node
                              :zipper
                              children-zips-by-generation)
@@ -321,8 +226,29 @@
          (mapcat tag-fn))))

-(defn mk-lazy-sibling-tag-seq [])
-(defn mk-lazy-ancestor-tag-seq [])
+(defn mk-lazy-sibling-tag-seq
+  [node tag-fn dist]
+  (let [generations-seq (->> node
+                             :zipper
+                             all-sib-zips)
+        g-seq (if dist
+                (take dist generations-seq)
+                generations-seq)]
+    (->> g-seq
+         (map z/node)
+         (mapcat tag-fn))))
+
+(defn mk-lazy-ancestor-tag-seq
+  [node tag-fn dist]
+  (let [generations-seq (->> node
+                             :zipper
+                             ancestor-zips)
+        g-seq (if dist
+                (take dist generations-seq)
+                generations-seq)]
+    (->> g-seq
+         (map z/node)
+         (mapcat tag-fn))))

 (defn mk-relative-final-qry-fn
   [opts tag-set & [dist]]


[#0] Reformat code and trim logs

[#0] Reformat code and trim logs

--- backend/src/akvo/lumen/component/flow.clj
+++ backend/src/akvo/lumen/component/flow.clj
@@ -2,7 +2,7 @@
   "wrap flow and flow api logic and data related"
   (:require [akvo.lumen.http.client :as http.client]
             [integrant.core :as ig]
-            [akvo.lumen.component.keycloak :as c.keycloak]
+            [akvo.lumen.component.keycloak :as c.keycloak]
             [clojure.tools.logging :as log]
             [clojure.spec.alpha :as s]))

@@ -45,11 +45,15 @@
                       {:as :json
                        :headers headers
                        :throw-entire-message? true
-                       :unexceptional-status #(<= 200 % 299)
+                       :unexceptional-status #(<= 200 % 299)
                        :form-params body
                        :content-type :json}))
-              (catch Exception e (log/error e :fail :url flow-api-url :token token :body body :response (ex-data e))))]
-    (log/debug ::check-permissions :body body :res res :elapsed-time (str "Elapsed time: " (/ (double (- (. System (nanoTime)) start)) 1000000.0) " msecs"))
+              (catch Exception e
+                (log/error e :fail :url flow-api-url :body body
+                           :response (ex-data e))))]
+    (let [elapsed (/ (double (- (. System (nanoTime)) start)) 1000000.0)]
+      (log/debug ::check-permissions :body body :res res
+                 :elapsed-time (str "Elapsed time: " elapsed " msecs")))
     res))

 (defmethod ig/init-key ::api  [_ {:keys [url] :as opts}]
@@ -60,7 +64,8 @@
 (s/def ::internal-url string?)
 (s/def ::api-headers fn?)
 (s/def ::internal-api-headers fn?)
-(s/def ::config (s/keys :req-un [::url ::auth0-url ::internal-url ::api-headers ::internal-api-headers]))
+(s/def ::config (s/keys :req-un [::url ::auth0-url ::internal-url ::api-headers
+                                 ::internal-api-headers]))

 (defmethod ig/pre-init-spec ::api [_]
   ::config)


add reitit perf-test options

add reitit perf-test options

--- perf/calfpath/perf_test.clj
+++ perf/calfpath/perf_test.clj
@@ -130,7 +130,11 @@
         "/user/:id/permissions/"   (h2x)
         "/company/:cid/dept/:did/" (h3x)
         "/this/is/a/static/route"  (h4x)
-        (hxx)))))
+        (hxx)))
+    ;; as per https://github.com/kumarshantanu/calfpath/pull/12
+    {;; :inject-match? false
+     :inject-router? false
+     :reitit.trie/parameters reitit.trie/record-parameters}))

 (defmacro cond-let


Adds union

Adds union

--- src/the_little_clojurian/chapter7.clj
+++ src/the_little_clojurian/chapter7.clj
@@ -90,3 +90,16 @@
   (is (= (intersect '(1 2) '(2 3)) '(2)))
   (is (= (intersect '(1 2 3 4) '(4 3 2 1)) '(1 2 3 4)))
   (is (= (intersect '(stewed tomatoes and macaroni) '(macaroni and cheese)) '(and macaroni))))
+
+(with-test
+  (def union
+    (fn [set1 set2]
+      (cond (null? set1) set2
+            (member? (car set1) set2) (union (cdr set1) set2)
+            :else (cons (car set1) (union (cdr set1) set2)))))
+
+  (is (= (union '() '()) '()))
+  (is (= (union '(1) '(1)) '(1)))
+  (is (= (union '(1) '(1 2)) '(1 2)))
+  (is (= (union '(1 2 3) '(4 5 6)) '(1 2 3 4 5 6)))
+  (is (= (union '(stewed tomatoes and macaroni casserole) '(macaroni and cheese)) '(stewed tomatoes casserole macaroni and cheese))))


Refactoring the server module

Refactoring the server module

--- src/hurvinek/server.clj
+++ src/hurvinek/server.clj
@@ -14,11 +14,9 @@
     "Server module with functions to accept requests and send response back to users via HTTP.")

 (require '[ring.util.response     :as http-response])
-(require '[clojure.data.json      :as json])
-(require '[clojure.xml            :as xml])
-(require '[clojure.data.csv       :as csv])

 (require '[hurvinek.html-renderer :as html-renderer])
+(require '[hurvinek.exporter      :as exporter])
 (require '[hurvinek.db-interface  :as db-interface])

 (defn println-and-flush
@@ -249,67 +247,68 @@
               (finish-processing html-renderer/render-component-list request title product-id chapter-id group-id product-name chapter-name group-name component-list "danger" (.getMessage delete-result))
               (finish-processing html-renderer/render-component-list request title product-id chapter-id group-id product-name chapter-name group-name component-list "info" (str "Component " component-name " has been deleted")))))

-(defn data->json
-    [products]
-    (json/write-str products))
-
-(defn data->edn
-    [products]
-    (with-out-str
-        (clojure.pprint/pprint products)))
-
-(defn data->csv
-    [products]
-    (with-out-str
-        (csv/write-csv *out* products)))
-
-(defn product-output-data
-    [output-format product-list]
-    (condp = output-format
-        "json" (data->json product-list)
-               (data->json product-list))) ; default value
+(defn get-output-format
+    [request]
+    (let [output-format (-> (:params request) (get "format"))]
+        (condp = output-format
+            "json" :json
+            "xml"  :xml
+            "csv"  :csv
+            "edn"  :edn
+            "text" :txt
+            "txt"  :txt
+                   :json)))

 (defn mime-type
     [output-format]
-    (condp = output-format
-        "json" "application/json"
-               "application/json")) ; default value
+    (case output-format
+        :json  "application/json"
+        :edn   "application/edn"
+        :csv   "text/csv"
+        :txt   "text/plain"
+        :xml   "text/xml"))

 (defn process-list-of-products
     [request]
-    (let [product-list (db-interface/read-products)
-          output-format (get request "format")
-          output-data   (product-output-data output-format product-list)
+    (let [product-list  (db-interface/read-products)
+          output-format (get-output-format request)
+          output-data   (exporter/product-output-data output-format product-list)
           mime-type     (mime-type output-format)]
         (-> (http-response/response output-data)
             (http-response/content-type mime-type))))

 (defn process-list-of-chapters
     [request]
-    (let [params       (:params request)
-          product-id   (get params "product-id")
-          chapters     (db-interface/read-chapters product-id)
-          json-output  (data->json chapters)]
-        (-> (http-response/response json-output)
-            (http-response/content-type "application/json"))))
+    (let [params        (:params request)
+          product-id    (get params "product-id")
+          chapters      (db-interface/read-chapters product-id)
+          output-format (get-output-format request)
+          output-data   (exporter/chapters-output-data output-format chapters)
+          mime-type     (mime-type output-format)]
+        (-> (http-response/response output-data)
+            (http-response/content-type mime-type))))

 (defn process-list-of-groups
     [request]
-    (let [params       (:params request)
-          chapter-id   (get params "chapter-id")
-          groups       (db-interface/read-groups chapter-id)
-          json-output  (data->json groups)]
-        (-> (http-response/response json-output)
-            (http-response/content-type "application/json"))))
+    (let [params        (:params request)
+          chapter-id    (get params "chapter-id")
+          groups        (db-interface/read-groups chapter-id)
+          output-format (get-output-format request)
+          output-data   (exporter/groups-output-data output-format groups)
+          mime-type     (mime-type output-format)]
+        (-> (http-response/response output-data)
+            (http-response/content-type mime-type))))

 (defn process-list-of-components
     [request]
-    (let [params       (:params request)
-          chapter-id   (get params "chapter-id")
-          chapters     (db-interface/read-components-for-chapter chapter-id)
-          json-output  (data->json chapters)]
-        (-> (http-response/response json-output)
-            (http-response/content-type "application/json"))))
+    (let [params        (:params request)
+          chapter-id    (get params "chapter-id")
+          components    (db-interface/read-components-for-chapter chapter-id)
+          output-format (get-output-format request)
+          output-data   (exporter/components-output-data output-format components)
+          mime-type     (mime-type output-format)]
+        (-> (http-response/response output-data)
+            (http-response/content-type mime-type))))

 (defn return-file
     "Creates HTTP response containing content of specified file.


Formatting

Formatting

--- src/kixi/hecuba/dev.clj
+++ src/kixi/hecuba/dev.clj
@@ -41,8 +41,7 @@
                          (get-port system)
                          (path-for (get-routes system) (typ (get-handlers system))))))
    ;; wait for all promises to be delivered (all responses to arrive)
-   (map deref) doall
-   ))
+   (map deref) doall))

 (defn get-id-from-path [system path]
   (get-in (match-route (get-routes system) path) [:params :hecuba/id]))
@@ -51,46 +50,45 @@
   Lifecycle
   (init [_ system] system)
   (start [_ system]
-    (println
-     (let [[p1 p2 p3]
-           (for [response
-                 (put-items system
-                            :projects
-                            [{:hecuba/name "Eco-retrofit Ealing"
-                              :project-code "IRR"
-                              :leaders ["/users/1" "/users/2"]}
+    (let [[p1 p2 p3]
+          (for [response
+                (put-items
+                 system
+                 :projects
+                 [{:hecuba/name "Eco-retrofit Ealing"
+                   :project-code "IRR"
+                   :leaders ["/users/1" "/users/2"]}

-                             {:hecuba/name "Eco-retrofit Bolton"
-                              :project-code "IRR"
-                              :leaders ["/users/1" "/users/2"]}
+                  {:hecuba/name "Eco-retrofit Bolton"
+                   :project-code "IRR"
+                   :leaders ["/users/1" "/users/2"]}

-                             {:hecuba/name "The Glasgow House"
-                              :project-code "IRR"
-                              :leaders ["/users/3"]}])]
-             (get-id-from-path system (get-in response [:headers :location]))
-             )]
-       (put-items system
-                  :properties
-                  [{:hecuba/name "Falling Water"
-                    :address "1491 Mill Run Rd, Mill Run, PA"
-                    :rooms 4
-                    :date-of-construction 1937
-                    :hecuba/parent p1}
-                   {:hecuba/name "The Empire State Building"
-                    :address "New York"
-                    :rooms 100
-                    :date-of-construction 1930
-                    :hecuba/parent p1}
-                   {:hecuba/name "Buckingham Palace"
-                    :address "London SW1A 1AA, United Kingdom"
-                    :rooms 775
-                    :hecuba/parent p2}
-                   {:hecuba/name "The ODI"
-                    :address "3rd Floor, 65 Clifton Street, London EC2A 4JE"
-                    :rooms 13
-                    :hecuba/parent p3}])
-       ))
+                  {:hecuba/name "The Glasgow House"
+                   :project-code "IRR"
+                   :leaders ["/users/3"]}])]
+            (get-id-from-path system (get-in response [:headers :location])))]

+      (put-items
+       system
+       :properties
+       [{:hecuba/name "Falling Water"
+         :address "1491 Mill Run Rd, Mill Run, PA"
+         :rooms 4
+         :date-of-construction 1937
+         :hecuba/parent p1}
+        {:hecuba/name "The Empire State Building"
+         :address "New York"
+         :rooms 100
+         :date-of-construction 1930
+         :hecuba/parent p1}
+        {:hecuba/name "Buckingham Palace"
+         :address "London SW1A 1AA, United Kingdom"
+         :rooms 775
+         :hecuba/parent p2}
+        {:hecuba/name "The ODI"
+         :address "3rd Floor, 65 Clifton Street, London EC2A 4JE"
+         :rooms 13
+         :hecuba/parent p3}]))

     system)
   (stop [_ system] system))


changed linked document command to

changed linked document command to

Signed-off-by: Chris Granger <5654cde260ae99bc4d30054171b8bcd902efd19a@gmail.com>

--- src/lt/objs/opener.cljs
+++ src/lt/objs/opener.cljs
@@ -261,7 +261,7 @@
                       (object/raise opener :open-info! info))})

 (cmd/command {:command :opener.open-linked-doc
-              :desc "Opener: Open linked document of current file"
+              :desc "File: Open another view of current file"
               :exec (fn []
                       (let [ed (pool/last-active)]
                         (open-linked-path ed opener (get-in @ed [:info :path]) {})))})


Use plainto_tsquery

Use plainto_tsquery

--- src/yetibot/core/webapp/resolvers.clj
+++ src/yetibot/core/webapp/resolvers.clj
@@ -39,7 +39,7 @@
                          )
         where-clause (when search_query
                        {:where/clause
-                        "to_tsvector(body) @@ to_tsquery(?)"
+                        "to_tsvector(body) @@ plainto_tsquery(?)"
                         :where/args [search_query]})
         ]
     (history/query (merge {:query/identifiers identity


[fix #9] Add money to user, when he create new event.

--- src/ombs/view/pages.clj
+++ src/ombs/view/pages.clj
@@ -66,11 +66,14 @@
 (h/defsnippet user-select-option "../resources/public/moneyout.html" [:.users :> :option] [user]
   [:option] (comp (h/set-attr :value (:name user)) (h/set-attr :data-balance (:balance user)) (h/content (:name user))))

+(h/defsnippet form "../resources/public/moneyout.html" [:.userform] [users]
+ [:.users] (h/content (map #(user-select-option %) users)))
+
 (defn fill-users[users]
   "Return func, that fills users. If no any user given return func that produce
   'We do not owe' message"
-  (if (> 0 (count users))
-    (h/content (map #(user-select-option %) users))
+  (if (< 0 (count users))
+    (h/substitute (form users))
     (h/content "We do not owe! Hooray!")
     ))


note about pull api

note about pull api

--- src/pc/models/layer.clj
+++ src/pc/models/layer.clj
@@ -24,6 +24,7 @@
                       [?t :layer/name]]}
             db (:db/id document))))

+;; TODO: can use pull API here
 (defn read-api [layer]
   (select-keys layer [:layer/name
                       :layer/uuid


Disable remote timeout test.

Disable remote timeout test.

--- messaging/test/immutant/messaging_test.clj
+++ messaging/test/immutant/messaging_test.clj
@@ -181,23 +181,22 @@
         (publish q :hi)
         (= :hi (receive q :timeout 100 :timeout-val :failure))))))

-(deftest remote-receive-should-properly-timeout
+;; This works sometimes, but sometimes a remote receive takes 30s to
+;; timeout, no matter the :timeout setting. I think we're doing it
+;; right, and it's an HQ issue, so I'm disabling this test.
+
+#_(deftest remote-receive-should-properly-timeout
   (let [q-name (.name (:destination (random-queue)))
         extra-connect-opts
         (when (u/in-container?)
           [:username "testuser" :password "testuser" :remote-type :hornetq-wildfly])]
-    (immutant.internal.util/warn "TC: pre-connect")
     (with-open [c (apply context :host "localhost" :port (u/messaging-remoting-port)
                     extra-connect-opts)]
-      (immutant.internal.util/warn "TC: pre queue")
       (let [q (queue q-name :context c)
             start (System/currentTimeMillis)]
         ;; warm up the context
-        (immutant.internal.util/warn "TC: pre warmup")
         (receive q :timeout 1)
-        (immutant.internal.util/warn "TC: post warmup")
         (is (= :success (receive q :timeout 100 :timeout-val :success)))
-        (immutant.internal.util/warn "TC: post rcv")
         (is (< (- (System/currentTimeMillis) start) 200))))))

 (deftest publish-from-a-listener-should-work


[#3157] Fix bar count with data-groups

[#3157] Fix bar count with data-groups

--- backend/src/akvo/lumen/lib/aggregation/bar.clj
+++ backend/src/akvo/lumen/lib/aggregation/bar.clj
@@ -61,13 +61,13 @@
           sort-sql
           truncate-size))

-(defn- aggregation* [aggregation-method metric-column bucket-column]
+(defn- aggregation* [aggregation-method metric-column bucket-column flow?]
   (let [aggregation-method (if-not metric-column "count" (or aggregation-method "count"))]
     (format
      (case aggregation-method
        nil                         "NULL"
        ("min" "max" "sum")         (str aggregation-method  "(%s)")
-       "count"                     (str aggregation-method  "(*)")
+       "count"                     (format "count(%s)" (if flow? "distinct instance_id" "*"))
        "mean"                      "avg(%s)"
        "median"                    "percentile_cont(0.5) WITHIN GROUP (ORDER BY %s)"
        "distinct"                  "COUNT(DISTINCT %s)"
@@ -144,7 +144,8 @@
     (let [subbucket-column (find-column columns (:subBucketColumn query))
           metric-y-column  (or (find-column columns (:metricColumnY query)) subbucket-column)
           metric-aggregation (:metricAggregation query)
-          aggregation      (aggregation* metric-aggregation metric-y-column bucket-column)
+          flow? (some #(= "instance_id" (:columnName %)) columns)
+          aggregation      (aggregation* metric-aggregation metric-y-column bucket-column flow?)
           metric-columns-y (when (not (empty? (:metricColumnsY query)))
                              (let [metric-columns-y (map #(find-column columns %) (:metricColumnsY query) )]
                                (conj metric-columns-y metric-y-column)))
@@ -156,7 +157,7 @@
                               bucket-column
                               (if metric-columns-y
                                 (->> metric-columns-y
-                                     (map #(aggregation* metric-aggregation %  bucket-column))
+                                     (map #(aggregation* metric-aggregation %  bucket-column flow?))
                                      (map-indexed
                                       (fn [index x]
                                         (if (= index 0) (str x " as y") x)) )


Whoops.

Whoops.

--- test/clojure_the_language/clojure_numerics_test.clj
+++ test/clojure_the_language/clojure_numerics_test.clj
@@ -294,10 +294,3 @@
   (let [v (+' Long/MAX_VALUE 2)]
     (type v)        => clojure.lang.BigInt
     (type (/ v 2))) => clojure.lang.Ratio)
-
-;; (defmacro my-=>
-;;   ([form expected-value]
-;;      `(let [] (fact ~form ~'=> ~expected-value))))
-
-;; (fact (my-=> 3 3))
-;; (fact (my-=> 3 4))


CMR-4691: Updated sample UMM-S data for integration tests.

--- system-int-test/src/cmr/system_int_test/data2/umm_spec_service.clj
+++ system-int-test/src/cmr/system_int_test/data2/umm_spec_service.clj
@@ -11,12 +11,21 @@

 (def ^:private sample-umm-service
   {:Name "AIRX3STD"
-   :Type "OPeNDAP"
+   :LongName "OPeNDAP Service for AIRS Level-3 retrieval products"
+   :Type "WEB SERVICES"
    :Version "1.9"
-   :Description "AIRS Level-3 retrieval product created using AIRS IR, AMSU without HSB.",
-   :OnlineResource {:Linkage "https://acdisc.gesdisc.eosdis.nasa.gov/opendap/Aqua_AIRS_Level3/AIRX3STD.006/",
-                    :Name "OPeNDAP Service for AIRS Level-3 retrieval products",
-                    :Description "OPeNDAP Service"}})
+   :Description "AIRS Level-3 retrieval product created using AIRS IR, AMSU without HSB."
+   :RelatedURL {
+     :URL "https://acdisc.gesdisc.eosdis.nasa.gov/opendap/Aqua_AIRS_Level3/AIRX3STD.006/"
+     :Description "OPeNDAP Service"
+     :Type "GET SERVICE"
+     :URLContentType "CollectionURL"}
+   :ServiceKeywords [
+      {:ServiceCategory "DATA ANALYSIS AND VISUALIZATION"
+       :ServiceTopic "VISUALIZATION/IMAGE PROCESSING"}]
+   :ServiceOrganizations [
+      {:Roles ["SERVICE PROVIDER"]
+       :ShortName "LDPAAC"}]})

 (defn- service
   "Returns a UMM-S record from the given attribute map."


Also terminate context when receiving term from updates

--- server/src/patavi/server/service.clj
+++ server/src/patavi/server/service.clj
@@ -31,7 +31,8 @@
             (if (= update {id "terminate"})
               (do
                 (close! updates)
-                (.close socket))
+                (.close socket)
+                (.term context))
               (do
                 (>! updates update)
                 (recur (zmq/receive-all socket)))))))


Fix local UDF memorization

Fix local UDF memorization

--- src/main/clojure/pigpen/local.clj
+++ src/main/clojure/pigpen/local.clj
@@ -48,15 +48,17 @@
       (.get ^Tuple value index)
       value)))

+(def ^:dynamic udf-scope nil)
+
 (def create-udf
   (memoize
-    (fn ^EvalFunc [return init func]
+    (fn ^EvalFunc [scope return init func]
       (eval `(new ~(symbol (str "pigpen.PigPenFn" return)) ~(str init) ~(str func))))))

 ;; TODO add option to skip this for faster execution
 (defn ^:private eval-code [{:keys [return expr args]} values]
   (let [{:keys [init func]} expr
-        ^EvalFunc instance (create-udf return init func)
+        ^EvalFunc instance (create-udf udf-scope return init func)
         ^Tuple tuple (->> args
                        (map #(if ((some-fn symbol? vector?) %) (dereference (values %)) %))
                        (apply pig/tuple))]
@@ -102,11 +104,12 @@
 (defn graph->observable
   ([commands]
     {:pre [(sequential? commands)]}
-    (let [observable (graph->observable (->> commands
-                                          (map (juxt :id identity))
-                                          (into {}))
-                                        [])]
-      (observable)))
+    (binding [udf-scope (gensym)]
+      (let [observable (graph->observable (->> commands
+                                            (map (juxt :id identity))
+                                            (into {}))
+                                          [])]
+        (observable))))
   ([command-lookup observables]
     (if (empty? command-lookup) (second (last observables))
       (let [[id _ :as o] (some (find-next-o (into {} observables)) (vals command-lookup))]
@@ -237,12 +240,15 @@
                      (str "Don't know how to flatten a " (type result)))))))

 (defmethod graph->local :generate [{:keys [projections] :as command} data]
-  (let [^Observable data (first data)]
+  (let [udf-scope' udf-scope ; yes this is ugly, but passing this as an explicit parameter breaks a lot of other code
+        ^Observable data (first data)]
     (.mapMany data
       (fn [values]
         (let [^Iterable result (->> projections
-                             (map (fn [p] (graph->local p values)))
-                             (cross-product))]
+                                 (map (fn [p]
+                                        (binding [udf-scope udf-scope']
+                                          (graph->local p values))))
+                                 (cross-product))]
           (Observable/from result))))))

 (defn ^:private pig-compare [[key order & sort-keys] x y]


Refactor reserve code

Refactor reserve code

--- src/clj_simple_chart/ncs/reserve.clj
+++ src/clj_simple_chart/ncs/reserve.clj
@@ -1,11 +1,14 @@
 (ns clj-simple-chart.ncs.reserve
   (:require [clj-http.client :as client]
-            [clj-simple-chart.csv.csvmap :as csvmap]
+            [clj-simple-chart.csv.csvmap :as csv]
             [clojure.pprint :as pprint]
             [clojure.test :as test]))

 (def field-reserves-url "http://factpages.npd.no/ReportServer?/FactPages/TableView/field_reserves&rs:Command=Render&rc:Toolbar=false&rc:Parameters=f&rs:Format=CSV&Top100=false&IpAddress=80.213.237.130&CultureCode=en")
-(defonce field-reserves-raw (-> field-reserves-url client/get :body csvmap/csv-map))
+(defonce field-reserves-raw (-> field-reserves-url
+                                (client/get)
+                                (:body)
+                                (csv/csv-map)))

 (def columns (:columns field-reserves-raw))
 (def data (:data field-reserves-raw))
@@ -25,34 +28,26 @@
                      :fldNpdidField
                      :DatesyncNPD]))

-(def numeric-fields [:fldRecoverableOil
-                     :fldRecoverableGas
-                     :fldRecoverableNGL
-                     :fldRecoverableCondensate
-                     :fldRecoverableOE
-                     :fldRemainingOil
-                     :fldRemainingGas
-                     :fldRemainingNGL
-                     :fldRemainingCondensate
-                     :fldRemainingOE])
+(def numeric-columns [:fldRecoverableOil
+                      :fldRecoverableGas
+                      :fldRecoverableNGL
+                      :fldRecoverableCondensate
+                      :fldRecoverableOE
+                      :fldRemainingOil
+                      :fldRemainingGas
+                      :fldRemainingNGL
+                      :fldRemainingCondensate
+                      :fldRemainingOE])

-(defn parse-row [row]
-  (reduce (fn [r field] (update r field
-                                (fn [x]
-                                  (if (number? (read-string x))
-                                    (read-string x)
-                                    (throw (Exception. (str "Expected number, got " x)))))))
-          row
-          numeric-fields))
-
-(def data-parsed (map parse-row data))
+(def data-parsed (->> data
+                      (csv/read-string-columns numeric-columns)
+                      (csv/number-or-throw-columns numeric-columns)))

 (def field-names (map :fldName data))

 (defn get-reserve [field-name kind]
   {:pre [(some #{field-name} field-names)
          (some #{kind} [:fldRecoverableOE :fldRecoverableOil :fldRecoverableGas])]}
-  (-> (filter #(= (:fldName %) field-name) data)
+  (-> (filter #(= (:fldName %) field-name) data-parsed)
       first
-      (get kind)
-      read-string))+      (get kind)))


fix phone-detail ajax calls

fix phone-detail ajax calls

Conflicts:
	src/cljs/phonecat_re_frame/core.cljs

--- src/cljs/phonecat_re_frame/core.cljs
+++ src/cljs/phonecat_re_frame/core.cljs
@@ -93,13 +93,14 @@
 (re-frame/register-handler
  :process-phone-detail-response
  (fn
-   [app-state [_ [phone-id response]]]
+   ;; store info for the specific phone-id in the db
+   [app-state [_ phone-id response]]
    (assoc-in app-state [:phone-details (keyword phone-id)] response)))

 (re-frame/register-handler
  :process-phone-detail-bad-response
  (fn
-   [app-state [_ [phone-id response]]]
+   [app-state [_ phone-id response]]
    (println "Error getting phone detail for id: " phone-id)
    app-state))

@@ -108,10 +109,11 @@
  (fn
    [app-state [_ phone-id]]
    (ajax/GET (str "phones/" phone-id ".json")
-             {:handler #(re-frame/dispatch [:process-phone-detail-response [phone-id %1]])
-              :error-handler #(re-frame/dispatch [:process-phone-detail-bad-response [phone-id %1]])
+             {:handler #(re-frame/dispatch [:process-phone-detail-response phone-id %1])
+              :error-handler #(re-frame/dispatch [:process-phone-detail-bad-response phone-id %1])
               :response-format :json
-              :keywords? true})))
+              :keywords? true})
+   app-state))

 (re-frame/register-handler
  :process-phone-detail-response


A validator function has been added for the system's atom store

--- core/src/cljc/hellhound/system/store.cljc
+++ core/src/cljc/hellhound/system/store.cljc
@@ -2,10 +2,16 @@
   (:import
    (clojure.lang IPersistentMap)))

+(defn valid-system?
+  [value]
+  (cond
+    (nil? value) false
+    :else true))

 ;; Main storage for system data.
-(def system (atom {}))
-
+(def system
+  (atom {}
+        :validator valid-system?))

 (defn get-system
   "A shortcut function for derefing `system`."


Refactors and expands tests

Refactors and expands tests

--- src/the_little_clojurian/todo.clj
+++ src/the_little_clojurian/todo.clj
@@ -25,7 +25,7 @@
   (is (= (leftmost-node {:id 1 :nodes '({:id 2} {:id 3})})
          {:id 2}))

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

 (with-test
@@ -56,8 +56,13 @@
 (with-test
   (def complete-nodes*
     (fn [id nodes]
-      (cond (empty? nodes) '()
-            :else (cons (complete-node* id (first nodes)) (complete-nodes* id (rest nodes))))))
+      (cond (nil? nodes) nil
+            (empty? nodes) '()
+            :else (cons (complete-node* id (first nodes))
+                        (complete-nodes* id (rest nodes))))))
+
+  (is (= (complete-nodes* 1 nil)
+         nil))

   (is (= (complete-nodes* 1 '())
          '()))
@@ -121,7 +126,10 @@
          {:id 1 :nodes '({:id 2} {:id 3} {:id 4 :complete true})}))

   (is (= (complete-node* 2 {:id 1 :nodes '({:id 2 :nodes ({:id 3})})})
-         {:id 1 :nodes '({:id 2 :complete true :nodes ({:id 3})})})))
+         {:id 1 :nodes '({:id 2 :complete true :nodes ({:id 3})})}))
+
+  (is (= (complete-node* 3 {:id 1 :nodes '({:id 2 :nodes ({:id 3} {:id 4})})})
+         {:id 1 :nodes '({:id 2 :nodes ({:id 3 :complete true} {:id 4})})})))

 (with-test
   (def complete-list*


Add some blurb about how to setup a secondary nameserver.

Reviewed by:	-hackers

--- etc/namedb/named.boot
+++ etc/namedb/named.boot
@@ -1,11 +1,21 @@
-;	$Id$
+;	$Id: named.boot,v 1.5 1997/02/23 09:21:09 peter Exp $
 ;	From: @(#)named.boot	5.1 (Berkeley) 6/30/90

-; boot file for secondary name server
-; Note that there should be one primary entry for each SOA record.
+; Refer to the named(8) man page for details.  If you are ever going
+; to setup a primary server, make sure you've understood the hairy
+; details of how DNS is working.  Even with simple mistakes, you can
+; break connectivity for affected parties, or cause huge amount of
+; useless Internet traffic.
+;
+; Setting up secondaries is way easier and the rough picture for this
+; is explained below.
+;
+; If you enable a local name server, don't forget to enter 127.0.0.1
+; into your /etc/resolv.conf so this server will be queried first.
+; Also, make sure to enable it in /etc/rc.conf.

 ; example sortlist config:
-; sortlist 128.3.0.0
+; sortlist 127.0.0.0

 directory	/etc/namedb

@@ -14,10 +24,39 @@
 cache     .							named.root
 primary   0.0.127.IN-ADDR.ARPA	localhost.rev

-; example secondary server config:
-; secondary Berkeley.EDU	128.32.130.11 128.32.133.1	ucbhosts.bak
-; secondary 32.128.IN-ADDR.ARPA	128.32.130.11 128.32.133.1	ucbhosts.rev.bak
-
-; example primary server config:
-; primary  Berkeley.EDU		ucbhosts
-; primary  32.128.IN-ADDR.ARPA	ucbhosts.rev
+; NB: Do not use the IP addresses below, they are faked, and only
+; serve demonstration/documentation purposes!
+;
+; Example secondary config entries.  It can be convenient to become
+; a secondary at least for the zone where your own domain is in.  Ask
+; your network administrator for the IP address of the responsible
+; primary.
+;
+; Never forget to include the reverse lookup (IN-ADDR.ARPA) zone!
+; (This is the first bytes of the respective IP address, in reverse
+; order, with ".IN-ADDR.ARPA" appended.)
+;
+; Before starting to setup a primary zone, better make sure you fully
+; understand how DNS and BIND works, however.  There are sometimes
+; unobvious pitfalls.  Setting up a secondary is comparably simpler.
+;
+; NB: Don't blindly enable the examples below. :-)  Use actual names
+; and addresses instead.
+;
+;type       zone name               IP of primary  backup file name
+;==================================================================
+;secondary  domain.com              192.168.1.1    domain.com.bak
+;secondary  0.168.192.in-addr.arpa  192.168.1.1    0.168.192.in-addr.arpa.bak
+;
+;
+; If you've got a DNS server around at your upstream provider, enter
+; its IP address here, and enable the line below.  This will make you
+; benefit from its cache, thus reduce overall DNS traffic in the Internet.
+;
+;forwarders 127.0.0.1
+;
+; In addition to the "forwarders" clause, you can force your name
+; server to never initiate queries of its own, but always ask its
+; forwarders only, by enabling the following line:
+;
+;options forward-only


Thread colorspace from experiment to think.image.patch (#162)

--- experiment/src/cortex/experiment/util.clj
+++ experiment/src/cortex/experiment/util.clj
@@ -24,19 +24,19 @@

 (defn- image->observation-data
   "Create an observation from input."
-  [image datatype image-aug-fn]
+  [image datatype colorspace image-aug-fn]
   (patch/image->patch (if image-aug-fn
                         (image-aug-fn image)
                         image)
                       :datatype datatype
-                      :colorspace :gray))
+                      :colorspace colorspace))

 (defn- file->observation
   "Given a file, returns an observation map (an element of a dataset)."
-  [{:keys [class-name->index]} image-aug-fn datatype ^File file]
+  [{:keys [class-name->index]} image-aug-fn datatype colorspace ^File file]
   (try
-    {:data (image->observation-data (i/load-image file) datatype image-aug-fn)
+    {:data (image->observation-data (i/load-image file) datatype colorspace image-aug-fn)
      :labels (util/idx->one-hot (class-name->index (.. file getParentFile getName))
                                 (count (keys class-name->index)))}
     (catch Throwable _
@@ -45,8 +45,9 @@

 (defn create-dataset-from-folder
   "Turns a folder of folders of png images into a dataset (a sequence of maps)."
-  [folder-name class-mapping & {:keys [image-aug-fn datatype]
-                                :or {datatype :float}}]
+  [folder-name class-mapping & {:keys [image-aug-fn datatype colorspace]
+                                :or {datatype :float
+                                     colorspace :gray}}]
   (println "Building dataset from folder:" folder-name)
   (->> folder-name
        (io/as-file)
@@ -55,5 +56,6 @@
        (map (partial file->observation
                      class-mapping
                      image-aug-fn
-                     datatype))
+                     datatype
+                     colorspace))
        (remove nil?)))


document build fork prs flag

document build fork prs flag

--- frontend/components/project_settings.cljs
+++ frontend/components/project_settings.cljs
@@ -368,7 +368,17 @@
                                    "Be part of our F/OSS beta! Organizations now have a free container "
                                    "reserved for F/OSS projects; enabling this will allow this project's "
                                    "builds to use it and let others see your builds, both through the "
-                                   "web UI and the API."]})]])))))
+                                   "web UI and the API."]})
+           (describe-flag {:flag :build-fork-prs
+                           :title "Project Fork Pull Requests"
+                           :blurb [:p
+                                   "CircleCI will automatically update the commit status shown on GitHub's "
+                                   "pull request page. Builds will count against the parent repository's plan "
+                                   "and will be able to access the parent's project and environment settings."
+                                   :p
+                                   "If you have SSH keys or AWS credentials stored in your project settings and "
+                                   "untrusted forks can make pull requests against your repo, then this option "
+                                   "isn't for you!"]})]])))))

 (defn dependencies [project-data owner]
   (reify


Prepare for the addition of async-pipeline experiments.

--- src/dsbdp/main.clj
+++ src/dsbdp/main.clj
@@ -178,6 +178,10 @@
                          (.inc out-cntr))))
           batch-delay (:batch-delay options)
           batch-size (:batch-size options)
+          in-chan (if (.contains scenario "async-pipeline")
+                    (async/chan queue-size))
+          out-chan (if (.contains scenario "async-pipeline")
+                     (async/chan queue-size))
           in-loop (ProcessingLoop.
                     "DataGenerationLoop"
                     (cond


formatting

formatting

--- test/cellophane/om_tutorials_test.clj
+++ test/cellophane/om_tutorials_test.clj
@@ -77,6 +77,7 @@
         (is (= (class (cellophane/app-root animals-reconciler)) AnimalsList))
         (is (= markup-str result-markup))))))

+;; =============================================================================
 ;; Om Links tutorial

 (def links-init-data
@@ -127,22 +128,23 @@
 (deftest test-render-links-tutorial
   (let [c (cellophane/add-root! links-reconciler LinksSomeList nil)]
     (is (= (dom/render-to-str c)
-          (remove-whitespace
-            "

-
A List!

-

-

-
Foo

-
bob.smith@gmail.com

-

-

-
Bar

-
bob.smith@gmail.com

-

-

-
Baz

-
bob.smith@gmail.com

-

-

-
")))))
+           (remove-whitespace
+             "

+
A List!

+

+

+
Foo

+
bob.smith@gmail.com

+

+

+
Bar

+
bob.smith@gmail.com

+

+

+
Baz

+
bob.smith@gmail.com

+

+

+
")))))

+


comments for next time

comments for next time

--- test/cljs/triboard/core_test.cljs
+++ test/cljs/triboard/core_test.cljs
@@ -112,4 +112,7 @@
 ;; Running the tests
 ;; ----------------------------------------------------------------------------

+;; (require '[cljs.spec.test])
+;; (cljs.spec.test/instrument)
+;; (cljs.spec.test/unstrument)
 (test/run-tests)


nrepl -- fix double inner trace bug

nrepl -- fix double inner trace bug

--- src/com/billpiel/sayid/nrepl_middleware.clj
+++ src/com/billpiel/sayid/nrepl_middleware.clj
@@ -164,11 +164,12 @@
   [{:keys [transport source file line] :as msg}]
   (try (let [{start-line :line} (get-meta-at-pos-in-source file line source)
              matches (query-ws-by-file-line-range file start-line line)
-             [{:keys [name]}] matches
+             [{:keys [name inner-path]}] matches
              kids (:children (sd/ws-deref!))
              _ (do (sd/ws-cycle-all-traces!)
                    (sd/ws-clear-log!)
-                   (sd/ws-add-deep-trace-fn!* name)
+                   (when (nil? inner-path) ;; don't inner-trace an inner trace
+                     (sd/ws-add-deep-trace-fn!* name))
                    (replay! kids))
              matches' (query-ws-by-file-line-range file start-line line)
              out (if-not (nil? matches')


Update of todo-list

Update of todo-list

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

--- src/conexp/contrib/todo.clj
+++ src/conexp/contrib/todo.clj
@@ -12,7 +12,8 @@
 	       "fca"    { "rules"    [ "Think about and write some code." ],
 			  "retracts" [ "Implement first thoughts of F. Kästner." ],
 			  "association-rules" [ "More?" ],
-			  "exploration" [ "Add background knowledge (implications or clauses)." ] },
+			  "exploration" [ "Add background knowledge (implications or clauses)." ],
+			  "contexts" [ "Better implementation for context-for-clop." ] },

 	       "graphics" { "draw"   [ "Implement full lattice editor" ],
 			    "base"   [ "Get current lattice layout from a GScene." ] },
@@ -24,7 +25,8 @@

 	       "contrib" { "fuzzy"   [ "Design and implement something for FuzzyFCA (Cynthia)." ],
 			   "rough"   [ "Design and implement something for RoughSets (Christian)." ],
-			   "algorithms" { "bitwise" [ "Add In-Close and fast Calculations for Luxenburger Bases." ],
+			   "algorithms" { "bitwise" [ "Add In-Close and fast Calculations for Luxenburger Bases.",
+						      "Add preconditioned NextClosure." ],
 					  "parallel" [ "Implement ParallelNextClosure and Krajca-Outrata-Vychodil." ] } },

 	       "tests"  ["Add tests for everything.",


Replace missing arg to get

Replace missing arg to get

--- src/poky/protocol/http/jdbc/text.clj
+++ src/poky/protocol/http/jdbc/text.clj
@@ -20,7 +20,7 @@

 (defn- wrap-get
   [kvstore k params headers body]
-  (if-let [v (get (kv/get* kvstore k))]
+  (if-let [v (get (kv/get* kvstore k) k)]
     (response v)
     (not-found "")))


(PE-2281) Add comments reminding us to upgrade prismatic

--- src/puppetlabs/trapperkeeper/app.clj
+++ src/puppetlabs/trapperkeeper/app.clj
@@ -43,6 +43,8 @@
   (try
     (eager-compile graph-map)
     (catch IllegalArgumentException e
+      ;; TODO: when prismatic releases version 0.2.0 of plumbing, we should clean this
+      ;; up.  See: https://tickets.puppetlabs.com/browse/PE-2281
       (let [match (re-matches #"(?s)^Failed on keyseq: \[:(.*)\]\. Value is missing\. .*$" (.getMessage e))]
         (if match
           (throw (RuntimeException. (format "Service function '%s' not found" (second match))))
@@ -57,6 +59,8 @@
   (try
     (graph-fn {})
     (catch RuntimeException e
+      ;; TODO: when prismatic releases version 0.2.0 of plumbing, we should clean this
+      ;; up.  See: https://tickets.puppetlabs.com/browse/PE-2281
       (if-let [match (re-matches #"^Key (:.*) not found in null$" (.getMessage e))]
         (throw (RuntimeException. (format "Service '%s' not found" (second match))))
         (if-let [match (re-matches #"^Key :(.*) not found in .*$" (.getMessage e))]


Fix var names

Fix var names

--- src/rdf_path_examples/evaluation.clj
+++ src/rdf_path_examples/evaluation.clj
@@ -84,11 +84,11 @@
     (if (seq errors)
       (do (println errors) (System/exit 1))
       (let [{:keys [number-of-runs]
-             :as config} (edn/read-string (slurp config))
+             :as params} (edn/read-string (slurp config))
             config-name (.getName (io/as-file config))
-            avg-ilds (compute-avg-ilds config paths :number-of-runs number-of-runs)
+            avg-ilds (compute-avg-ilds params paths :number-of-runs number-of-runs)
             output-name (str (string/replace config-name #"\.[a-z]+$" "")
                              "_"
                              (java.util.UUID/randomUUID)
                              ".edn")]
-        (spit output-name (with-out-str (pprint {:config config :results avg-ilds})))))))
+        (spit output-name (with-out-str (pprint {:config params :results avg-ilds})))))))


Pull out reusable checker functions, support both job types

--- src/onyx_jepsen/checker.clj
+++ src/onyx_jepsen/checker.clj
@@ -32,6 +32,95 @@
 (defn pulses [conn peer-config]
   (onyx.log.curator/children conn (onyx.log.zookeeper/pulse-path (:onyx/id peer-config))))

+(defn history->read-ledgers [history task-name]
+  (filter (fn [action]
+            (and (= (:f action) :read-ledgers)
+                 (= (:task action) task-name)
+                 (= (:type action) :ok)))
+          history))
+
+(defn ledger-reads->job+reads [ledger-reads]
+  (->> ledger-reads
+       :value
+       (mapcat (fn [[job-num reads]]
+                 (map (fn [r]
+                        {:job-num job-num
+                         :read-results (:results r)})
+                      reads)))))
+
+(defn reads-correct-jobs? [job+reads]
+  (empty?
+    (remove (fn [{:keys [read-results job-num]}]
+              (or (empty? read-results)
+                  (= #{job-num} (set (map :job-num read-results)))))
+            job+reads)))
+
+(defn job-exception [log-conn final-replica]
+  (if-let [killed-job (first (:killed-jobs final-replica))]
+    (onyx.extensions/read-chunk log-conn :exception killed-job)))
+
+(defn history->successful-writes [history]
+  (filter (fn [action]
+            (and (= (:f action) :add)
+                 (= (:type action) :ok)))
+          history))
+
+(defn simple-job-invariants [log-conn history final-replica n-jobs]
+  (let [exception (job-exception log-conn final-replica)
+        ledger-reads (first (history->read-ledgers history :persist))
+        ledger-read-results (ledger-reads->job+reads ledger-reads)
+        ;; Add a check here that there are no overlaps in the ledgers read by the jobs
+        correct-jobs? (reads-correct-jobs? ledger-read-results)
+        successfully-added (history->successful-writes history)
+        added-values (set (map :value successfully-added))
+        read-values (->> ledger-read-results
+                         (mapcat :read-results)
+                         (map :value)
+                         set)
+        diff-written-read (clojure.set/difference added-values read-values)
+        all-written-read? (empty? diff-written-read)
+        unacked-writes-read (clojure.set/difference read-values added-values)]
+    {:information {:read-values read-values
+                   :diff-written-read diff-written-read
+                   :unacknowledged-writes-read unacked-writes-read
+                   :job-exception-message (some-> exception (.getMessage))
+                   :job-exception-trace (if exception (with-out-str (clojure.stacktrace/print-stack-trace exception)))}
+     :invariants {:job-completed? (nil? exception)
+                  :reads-correct-jobs? correct-jobs?
+                  :all-written-read? all-written-read?}}))
+
+(defn window-state-job-invariants [log-conn history final-replica n-jobs]
+  (let [exception (job-exception log-conn final-replica)
+        ledger-reads (first (history->read-ledgers history :persist))
+        trigger-ledger-reads (first (history->read-ledgers history :identity-log))
+        _ (println "Trigger ledger reads " trigger-ledger-reads)
+        ledger-read-results (ledger-reads->job+reads ledger-reads)
+        ;; Add a check here that there are no overlaps in the ledgers read by the jobs
+        correct-jobs? (reads-correct-jobs? ledger-read-results)
+        successfully-added (history->successful-writes history)
+        added-values (set (map :value successfully-added))
+        read-values (->> ledger-read-results
+                         (mapcat :read-results)
+                         (map #(dissoc % :job-num))
+                         set)
+        diff-written-read (clojure.set/difference added-values read-values)
+        all-written-read? (empty? diff-written-read)
+        unacked-writes-read (clojure.set/difference read-values added-values)]
+    {:information {:read-values read-values
+                   :diff-written-read diff-written-read
+                   :unacknowledged-writes-read unacked-writes-read
+                   :job-exception-message (some-> exception (.getMessage))
+                   :job-exception-trace (if exception (with-out-str (clojure.stacktrace/print-stack-trace exception)))}
+     :invariants {:job-completed? (nil? exception)
+                  :reads-correct-jobs? correct-jobs?
+                  :all-written-read? all-written-read?}}))
+
+(defn history->job-name [history]
+  (:job-type (first (filter (fn [action]
+                              (and (= (:f action) :submit-job)
+                                   (= (:type action) :ok)))
+                            history))))
+
 ;; TODO, check whether the jobs were even submitted, if not, nothing should be read back
 ;; important for short running tests
 (defrecord Checker [peer-config n-peers n-jobs]
@@ -42,7 +131,7 @@
           peer-log-reads (:value (first (filter (fn [action]
                                                   (and (= (:f action) :read-peer-log)
                                                        (= (:type action) :ok)))
-                                                          history)))
+                                                history)))
           final-replica (playback-log peer-config peer-log-reads)
           log-conn (:log (component/start (system/onyx-client peer-config)))
           all-peers-up? (= (count (:peers final-replica))
@@ -55,73 +144,20 @@
           accepting-empty? (empty? (:accepted final-replica))
           prepared-empty? (empty? (:prepared final-replica))

-          cluster-invariants {:all-peers-up? all-peers-up?
-                              :peers-match-pulses? peers-match-pulses?
-                              :accepting-empty? accepting-empty?
-                              :prepared-empty? prepared-empty?}
+          invariants-cluster {:invariants {:all-peers-up? all-peers-up?
+                                           :peers-match-pulses? peers-match-pulses?
+                                           :accepting-empty? accepting-empty?
+                                           :prepared-empty? prepared-empty?}
+                              :information {:pulse-peers pulse-peers
+                                            :peer-log peer-log-reads
+                                            :final-replica final-replica}}

-          ;;;;;;;;;
-          ;; Job invariants
-
-          exception (if-let [killed-job (first (:killed-jobs final-replica))]
-                      (onyx.extensions/read-chunk log-conn :exception killed-job))
-
-          ledger-reads (first (filter (fn [action]
-                                        (and (= (:f action) :read-ledgers)
-                                             (= (:type action) :ok)))
-                                      history))
-
-
-          ledger-read-results (->> ledger-reads
-                                   :value
-                                   (mapcat (fn [[job-num reads]]
-                                             (map (fn [r]
-                                                    {:job-num job-num
-                                                     :read-results (:results r)})
-                                                  reads))))
-
-          ;; Add a check here that there are no overlaps in the ledgers read by the jobs
-          reads-correct-jobs? (empty?
-                                (remove (fn [{:keys [read-results job-num]}]
-                                          (or (empty? read-results)
-                                              (= #{job-num} (set (map :job-num read-results)))))
-                                        ledger-read-results))
-
-          successfully-added (filter (fn [action]
-                                       (and (= (:f action) :add)
-                                            (= (:type action) :ok)))
-                                     history)
-
-          added-values (set (map :value successfully-added))
-
-          read-values (->> ledger-read-results
-                           (mapcat :read-results)
-                           (map :value)
-                           set)
-
-          diff-written-read (clojure.set/difference added-values read-values)
-          all-written-read? (empty? diff-written-read)
-
-          ;; Check that all values at the output went through the second task first
-          all-job-set (set (mapcat (fn [lr]
-                                     (map :job-num (:results lr)))
-                                   (:value ledger-reads)))
-          all-through-intermediate? (= all-job-set (set (range 0 n-jobs)))
-          unacked-writes-read (clojure.set/difference read-values added-values)
-          job-invariants {:job-completed? (nil? exception)
-                          :reads-correct-jobs? reads-correct-jobs?
-                          :all-written-read? all-written-read?}
-          invariants [job-invariants cluster-invariants]]
-      (doto {:valid? (empty? (filter false? (mapcat vals invariants)))
-             :job-invariants job-invariants
-             :cluster-invariants cluster-invariants
-             :run-information {:added added-values
-                               :read-values read-values
-                               :diff-written-read diff-written-read
-                               :unacknowledged-writes-read unacked-writes-read
-                               :job-exception-message (some-> exception (.getMessage))
-                               :job-exception-trace (if exception (with-out-str (clojure.stacktrace/print-stack-trace exception)))
-                               :pulse-peers pulse-peers
-                               :peer-log peer-log-reads
-                               :final-replica final-replica}}
+          job-invariants-fn (case (history->job-name history)
+                              :simple-job simple-job-invariants
+                              :window-state-job window-state-job-invariants)
+          invariants-job (job-invariants-fn log-conn history final-replica n-jobs)
+          invariants [invariants-job invariants-cluster]]
+      (doto {:valid? (empty? (filter false? (mapcat (comp vals :invariants) invariants)))
+             :job-invariants invariants-job
+             :cluster-invariants invariants-cluster}
         info))))


Simplify layout code

Simplify layout code

--- frontend/src/faceboard/views/boards/people.cljs
+++ frontend/src/faceboard/views/boards/people.cljs
@@ -18,6 +18,8 @@
             [faceboard.state :refer [app-state]]
             [faceboard.logging :refer [log log-err log-warn log-info]])
   (:require-macros [faceboard.macros.utils :refer [profile, measure]]))
+
+(def person-card-z-level 100)

 (defcomponent social-section-item-component [data _ _]
   (render [_]
@@ -101,6 +103,7 @@
           (when extended?
             (dom/div {:class "right-part"}
               (dom/div {:class    "person-edit-button"
+                        :title    "edit the card"
                         :on-click (fn [e]
                                     (.stopPropagation e)
                                     (perform! :open-editor (om/path person) (.-shiftKey e)))}
@@ -124,7 +127,7 @@
                         "translateZ(" (:z layout) "px)"))
           zoom-transform (when layout
                            (str
-                             "translateZ(" (if extended? 100 0) "px)"))]
+                             "translateZ(" (if extended? person-card-z-level 0) "px)"))]
       (dom/div {:class     (str "person-card"
                              (when layout " has-layout")
                              (anim-class expansion-anim " expanding")
@@ -368,27 +371,19 @@
   ISeqable
   (-seq [nl] (array-seq nl 0)))

-(defn lookup-person [people id]
-  (first (filter #(= id (:id %)) people)))
-
-(defn retrieve-card-layout [people filter-predicates card]
+(defn retrieve-card-layout [card]
   (if-let [person-id (.getAttribute card "data-fbid")]
-    (let [person (lookup-person people person-id)]
-      [person-id
-       {:left (.-offsetLeft card)
-        :top  (.-offsetTop card)
-        :z    (if (is-person-filtered? filter-predicates person) -100 -100)}])))
-
-(defn retrieve-cards-layout [people filter-predicates cards]
-  (apply hash-map (mapcat #(retrieve-card-layout people filter-predicates %) cards)))
+    [person-id {:left (.-offsetLeft card)
+                :top  (.-offsetTop card)
+                :z    (- person-card-z-level)}]))
+
+(defn retrieve-cards-layout [cards]
+  (apply hash-map (mapcat retrieve-card-layout cards)))

 (defn recompute-layout [node data]
   (let [cards (.-childNodes node)
-        active-filters (get-in data [:ui :filters :active])
-        filter-predicates (build-filter-predicates active-filters data)
-        people (get-in data [:content :people])
         current-layout (get-in @app-state [:transient (:id data) :layout])
-        layout (retrieve-cards-layout people filter-predicates cards)]
+        layout (retrieve-cards-layout cards)]
     (when-not (= (pr-str current-layout) (pr-str layout))
       (perform! :update-people-layout (:id data) layout))))


Do not fail when unable to read from zookeeper.

--- src/repmgr_to_zk/zk.clj
+++ src/repmgr_to_zk/zk.clj
@@ -11,7 +11,7 @@
   (zk/connect (config/lookup :zookeeper :connect)))

 (defn get-master [client path]
-  (zk-data/to-string (:data (zk/data client path))))
+  (some->> (zk/data client path) :data zk-data/to-string))

 (defn create [client path]
   (let [paths (->> (s/split path #"/")


Add syntax highlighting to datadog example in docs (#955)

--- src/riemann/datadog.clj
+++ src/riemann/datadog.clj
@@ -48,6 +48,7 @@

   Example:

+  ```clojure
   (def datadog-forwarder
     (batch 100 1/10
       (async-queue!
@@ -55,7 +56,8 @@
         {:queue-size     1e4  ; 10,000 events max
          :core-pool-size 5    ; Minimum 5 threads
          :max-pools-size 100} ; Maxium 100 threads
-        (datadog {:api-key \"bn14a6ac2e3b5h795085217d49cde7eb\"}))))"
+        (datadog {:api-key \"bn14a6ac2e3b5h795085217d49cde7eb\"}))))
+  ```"
   [opts]
   (let [opts (merge {:api-key "datadog-api-key"} opts)]
     (fn [event]


Note that (top) won't expire displaced events.

--- src/riemann/streams.clj
+++ src/riemann/streams.clj
@@ -716,7 +716,13 @@
   (top 10 :metric
     (adjust [:tags conj \"top\"]
       index)
-    index)"
+    index)
+
+  This implementation of top is lazy, in a sense. It won't proactively expire
+  events which are bumped from the top-k set--you have to wait for another
+  event with the same host and service to arrive before child streams will know
+  it's expired. At some point I (or an enterprising committer) should fix
+  that."
   ([k f top-stream]
    (top k f top-stream bit-bucket))
   ([k f top-stream bottom-stream]


Split out field as separate component

Split out field as separate component

--- src/cljs/iframe_app/condition_selector.cljs
+++ src/cljs/iframe_app/condition_selector.cljs
@@ -69,39 +69,45 @@
                name]])))])))

-(defcomponent field-list [{:keys [master-field]} owner {:keys [fields label list-class]}]
+(defcomponent field [selections owner {:keys [field]}]
+  (render-state [_ _]
+    (html
+      [:li {:class (if (= field (:master-field selections))
+                     "selected")}
+       [:a.field.master-field
+        {:value (:id field)
+         :data-id  (:id field)
+         :on-click (fn [_]
+                     (let [{:keys [pick-channel]} (om/get-shared owner)]
+                       (put! pick-channel
+                             {:selection-to-update :master-field
+                              :new-value           field})))}
+        (:name field)]])))
+
+(defcomponent field-list [selections _ {:keys [fields label list-class]}]
   (render-state [_ _]
     (html
       [:div.field-list
-       [:div.separator (str label " (" (count fields) ")")]
+       [:div.separator  (str label " (" (count fields) ")")]
        [:ul {:class list-class}
-        (for [{:keys [name id] :as ticket-field} fields]
-          [:li {:class (if (= ticket-field master-field)
-                         "selected")}
-           [:a.field.master-field
-            {:value    id
-             :data-id  id
-             :on-click (fn [e]
-                         (let [{:keys [pick-channel]} (om/get-shared owner)]
-                           (put! pick-channel
-                                 {:selection-to-update :master-field
-                                  :new-value           ticket-field})))}
-            name]])]])))
+        (for [ticket-field fields]
+          (om/build field
+                    selections
+                    {:opts {:field ticket-field}}))]])))

 (defcomponent master-field-picker [app-state owner]
   (render-state [_ _]
     (html
-
       (let [fields-in-conditions (->> app-state :conditions (map :master-field) set)
             fields-not-in-conditions (difference (set (om/get-shared owner :ticket-fields))
                                                  fields-in-conditions)
             selections (:selections app-state)]
         [:td.fields
-         (om/build field-list selections {:opts {:fields                 fields-not-in-conditions
-                                                 :list-class              "available-fields"
-                                                 :label                  "Available"}})
+         (om/build field-list selections {:opts {:fields     fields-not-in-conditions
+                                                 :list-class "available-fields"
+                                                 :label      "Available"}})
          (if (not (empty? fields-in-conditions))
-           (om/build field-list selections {:opts {:fields                 fields-in-conditions
-                                                   :list-class              "fields-in-existing-conditions"
-                                                   :label                  "Existing conditions"}}))]))))
+           (om/build field-list selections {:opts {:fields     fields-in-conditions
+                                                   :list-class "fields-in-existing-conditions"
+                                                   :label      "Existing conditions"}}))]))))


show package dimensions

show package dimensions

--- src/cljs/ikea_clojure_cup/select_items.cljs
+++ src/cljs/ikea_clojure_cup/select_items.cljs
@@ -3,6 +3,7 @@
             [cljs.core.async :as async]
             [reagent.core :as reagent :refer [atom]]
             [reagent-forms.core :refer [bind-fields]]
+            [clojure.string :as cs]
             [ikea-clojure-cup.autocomplete]
             [ikea-clojure-cup.regions :refer [region-state]]
             [ikea-clojure-cup.bootstrap :as bootstrap])
@@ -66,7 +67,9 @@
   [packages]
   [bootstrap/pop-over {:id "package-popover" :title (str (count packages) " flatpacks")
                        :placement :bottom}
-   "This product is packaged in " (count packages) " flatpacks or boxes."])
+   "This product is packaged in " (count packages) " flatpacks or boxes:"
+   [:ul
+    (map (fn [{:keys [width height length]}] [:li (str width "cm x " height "cm x " length "cm")]) packages)]])

 (defn package-total-view
   [item-container packages]


paging hidden when there is only one page

--- src/cljs/material/component/list/basic.cljs
+++ src/cljs/material/component/list/basic.cljs
@@ -175,21 +175,22 @@

 (rum/defc footer < rum/reactive [items]
   (let [{:keys [rowsPerPage page]} (rum/react footer-state)]
-    (cmp/table-footer
-      {:className "Swarmpit-table-footer"}
-      (cmp/table-row
-        {}
-        (cmp/table-pagination
-          {:rowsPerPageOptions  []
-           :component           "div"
-           :count               (count items)
-           :rowsPerPage         rowsPerPage
-           :page                page
-           :onChangePage        (fn [e new-page]
-                                  (swap! footer-state assoc :page new-page))
-           :onChangeRowsPerPage (fn [e]
-                                  (swap! footer-state assoc :rowsPerPage (-> e .-target .-value))
-                                  (swap! footer-state assoc :page 0))})))))
+    (when (> (count items) rowsPerPage)
+      (cmp/table-footer
+        {:className "Swarmpit-table-footer"}
+        (cmp/table-row
+          {}
+          (cmp/table-pagination
+            {:rowsPerPageOptions  []
+             :component           "div"
+             :count               (count items)
+             :rowsPerPage         rowsPerPage
+             :page                page
+             :onChangePage        (fn [e new-page]
+                                    (swap! footer-state assoc :page new-page))
+             :onChangeRowsPerPage (fn [e]
+                                    (swap! footer-state assoc :rowsPerPage (-> e .-target .-value))
+                                    (swap! footer-state assoc :page 0))}))))))

 (rum/defc responsive-footer < rum/reactive
                               {:init (fn [state _]


Name change

Name change

--- examples/phonebook/src/phonebook/resources.clj
+++ examples/phonebook/src/phonebook/resources.clj
@@ -13,7 +13,7 @@
    [yada.protocols :as p]
    [yada.yada :as yada]))

-(def phonebook-representations
+(def representations
   [{:media-type #{"text/html"
                   "application/edn;q=0.9"
                   "application/json;q=0.8"}
@@ -27,7 +27,7 @@
     {:parameters {:post {:form {:surname String
                                 :firstname String
                                 :phone [String]}}}
-     :representations phonebook-representations})
+     :representations representations})

   m/Get
   (GET [_ ctx]
@@ -53,7 +53,7 @@
       :post {:path {:entry Long}
              :form {(s/required-key "method") String}}
       :delete {:path {:entry Long}}}
-     :representations phonebook-representations})
+     :representations representations})

   m/Get
   (GET [_ ctx]


[#44] Start porting clojure.core namespace

--- priv/clojure/core.clj
+++ priv/clojure/core.clj
@@ -1260,6 +1260,154 @@
   [num]
   (throw "unimplemented")
   #_(. clojure.lang.Numbers (rationalize num)))
+
+;;Bit ops
+
+(defn bit-not
+  "Bitwise complement"
+  {:inline (fn [x] `(. clojure.lang.Numbers (not ~x)))
+   :added "1.0"}
+  [x] (erlang/bnot.e x))
+
+
+(defn bit-and
+  "Bitwise and"
+   {:inline (nary-inline 'and)
+    :inline-arities >1?
+    :added "1.0"}
+   ([x y] (erlang/band.e x y))
+   ([x y & more]
+      (reduce1 bit-and (bit-and x y) more)))
+
+(defn bit-or
+  "Bitwise or"
+  {:inline (nary-inline 'or)
+   :inline-arities >1?
+   :added "1.0"}
+  ([x y] (erlang/bor.e x y))
+  ([x y & more]
+    (reduce1 bit-or (bit-or x y) more)))
+
+(defn bit-xor
+  "Bitwise exclusive or"
+  {:inline (nary-inline 'xor)
+   :inline-arities >1?
+   :added "1.0"}
+  ([x y] (erlang/bxor.e x y))
+  ([x y & more]
+    (reduce1 bit-xor (bit-xor x y) more)))
+
+(defn bit-and-not
+  "Bitwise and with complement"
+  {:inline (nary-inline 'andNot)
+   :inline-arities >1?
+   :added "1.0"
+   :static true}
+  ([x y] (bit-not (bit-and x y)))
+  ([x y & more]
+    (reduce1 bit-and-not (bit-and-not x y) more)))
+
+
+(defn bit-clear
+  "Clear bit at index n"
+  {:added "1.0"
+   :static true}
+  [x n]
+  (throw "unimplemented")
+  #_(. clojure.lang.Numbers clearBit x n))
+
+(defn bit-set
+  "Set bit at index n"
+  {:added "1.0"
+   :static true}
+  [x n]
+  (throw "unimplemented")
+  #_(. clojure.lang.Numbers setBit x n))
+
+(defn bit-flip
+  "Flip bit at index n"
+  {:added "1.0"
+   :static true}
+  [x n]
+  (throw "unimplemented")
+  #_(. clojure.lang.Numbers flipBit x n))
+
+(defn bit-test
+  "Test bit at index n"
+  {:added "1.0"
+   :static true}
+  [x n]
+  (throw "unimplemented")
+  #_(. clojure.lang.Numbers testBit x n))
+
+
+(defn bit-shift-left
+  "Bitwise shift left"
+  {:inline (fn [x n] `(. clojure.lang.Numbers (shiftLeft ~x ~n)))
+   :added "1.0"}
+  [x n] (erlang/bsl.e x n))
+
+(defn bit-shift-right
+  "Bitwise shift right"
+  {:inline (fn [x n] `(. clojure.lang.Numbers (shiftRight ~x ~n)))
+   :added "1.0"}
+  [x n] (erlang/bsr.e x n))
+
+(defn unsigned-bit-shift-right
+  "Bitwise shift right, without sign-extension."
+  {:inline (fn [x n] `(. clojure.lang.Numbers (unsignedShiftRight ~x ~n)))
+   :added "1.6"}
+  [x n]
+  (throw "unimplemented")
+  #_(. clojure.lang.Numbers unsignedShiftRight x n))
+
+(defn integer?
+  "Returns true if n is an integer"
+  {:added "1.0"
+   :static true}
+  [n]
+  (erlang/is_integer.e n))
+
+(defn even?
+  "Returns true if n is even, throws an exception if n is not an integer"
+  {:added "1.0"
+   :static true}
+   [n] (if (integer? n)
+        (zero? (bit-and n 1))
+        (throw (str "Argument must be an integer: " n))))
+
+(defn odd?
+  "Returns true if n is odd, throws an exception if n is not an integer"
+  {:added "1.0"
+   :static true}
+  [n] (not (even? n)))
+
+
+;;
+
+(defn complement
+  "Takes a fn f and returns a fn that takes the same arguments as f,
+  has the same effects, if any, and returns the opposite truth value."
+  {:added "1.0"
+   :static true}
+  [f]
+  (fn
+    ([] (not (f)))
+    ([x] (not (f x)))
+    ([x y] (not (f x y)))
+    ([x y & zs] (not (apply f x y zs)))))
+
+(defn constantly
+  "Returns a function that takes any number of arguments and returns x."
+  {:added "1.0"
+   :static true}
+  [x] (fn [& args] x))
+
+(defn identity
+  "Returns its argument."
+  {:added "1.0"
+   :static true}
+  [x] x)

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


[#89] Return form from ns macro

[#89] Return form from ns macro

--- priv/clojure/core.clj
+++ priv/clojure/core.clj
@@ -5803,20 +5803,18 @@
         references (remove #(= :gen-class (first %)) references)
         ;ns-effect (clojure.core/in-ns name)
         name-metadata (meta name)]
-    (do
-      (in-ns name)
-      #_(when name-metadata
-          `((.resetMeta (clojure.lang.Namespace/find '~name) ~name-metadata)))
-      (with-loading-context
-        (when (and (not= name 'clojure.core)
-                   (not-any? #(= :refer-clojure (first %)) references))
-          (refer 'clojure.core))
-        (clj_core/seq_to_list.e (map process-reference references)))
-      nil
-      #_(if (= '~name 'clojure.core)
-          nil
-          (do (dosync (commute @#'*loaded-libs* conj '~name)) nil))
-      )))
+
+    `(do
+       (clojure.core/in-ns '~name)
+       (with-loading-context
+         ;; ~@(when gen-class-call (list gen-class-call))
+         ~@(when (and (not= name 'clojure.core)
+                      (not-any? #(= :refer-clojure (first %)) references))
+             `((clojure.core/refer '~'clojure.core)))
+         ~@(map process-reference references))
+       #_(if (= '~name 'clojure.core)
+         nil
+         (do (dosync (commute @#'*loaded-libs* conj '~name)) nil)))))

 (defmacro refer-clojure
   "Same as (refer 'clojure.core <filters>)"


[#158] Fix: use a namespaced qualified symbol as :test

--- priv/clojure/test.clj
+++ priv/clojure/test.clj
@@ -631,7 +631,7 @@
   {:added "1.1"}
   [name & body]
   (when *load-tests*
-    (let [test-var-name (symbol (str  name "__:test"))]
+    (let [test-var-name (symbol (str (ns-name *ns*)) (str name "__test"))]
       `(do
          (def ~(vary-meta name assoc :test test-var-name)
            (fn [] (test-var (var ~name))))
@@ -642,11 +642,11 @@
   {:added "1.1"}
   [name & body]
   (when *load-tests*
-    (let [test-var-name (symbol (str name "__:private-test"))]
+    (let [test-var-name (symbol (str name "__private-test"))]
       `(do
          (def ~(vary-meta name assoc :test test-var-name :private true)
            (fn [] (test-var (var ~name))))
-         (defn ~test-var-name [] ~@body)))))
+         (defn- ~test-var-name [] ~@body)))))

 (defmacro set-test
@@ -721,7 +721,7 @@
       (try (t)
            (catch _ e
              (do-report {:type :error, :message "Uncaught exception, not in assertion."
-                      :expected nil, :actual e})))
+                         :expected nil, :actual e})))
       (do-report {:type :end-test-var, :var v}))))

 (defn test-vars
@@ -733,10 +733,10 @@
     (let [once-fixture-fn (join-fixtures (::once-fixtures (meta ns)))
           each-fixture-fn (join-fixtures (::each-fixtures (meta ns)))]
       (once-fixture-fn
-       (fn bbla []
+       (fn []
          (doseq [v vars]
            (when (:test (meta v))
-             (each-fixture-fn (fn call-test-var [] (test-var v))))))))))
+             (each-fixture-fn (fn [] (test-var v))))))))))

 (defn test-all-vars
   "Calls test-vars on every var interned in the namespace, with fixtures."


add more constraints to testing chiamarsi


Add stop to frontend dev tools

Add stop to frontend dev tools

--- dev-src/clj/comic_reader/frontend_dev.clj
+++ dev-src/clj/comic_reader/frontend_dev.clj
@@ -1,7 +1,7 @@
 (ns comic-reader.frontend-dev
   (:require [clojure.java.browse :refer [browse-url]]
             [clojure.repl :refer :all]
-            [comic-reader.system :refer [go]]
+            [comic-reader.system :refer [go stop]]
             [figwheel-sidecar.repl-api :refer :all]))

 (defn- cwd []
@@ -26,4 +26,10 @@
 (defn start-dev! [& args]
   (apply go args)
   (start-figwheel! figwheel-config)
+  (start-autobuild)
   (browse-url "http://localhost:10555/devcards"))
+
+(defn stop-dev! []
+  (stop-autobuild)
+  (stop-figwheel!)
+  (stop))


Add `dbg` macro, like `trace`, but better

Credit:
  http://www.learningclojure.com/2010/09/clojure-macro-tutorial-part-i-getting.html

--- src/sinusoides/util.clj
+++ src/sinusoides/util.clj
@@ -19,6 +19,11 @@
 (ns sinusoides.util
   (:require [pl.danieljanus.tagsoup :as tagsoup]))

+(defmacro dbg [x]
+  `(let [x# ~x]
+     (println '~x "=" x#)
+     x#))
+
 (defmacro embed-svg [svg-file]
   (let [hiccup (tagsoup/parse-string (slurp svg-file))]
     `~hiccup))


Stop calculating offer attribute map unnecessarily then throw it away. (#1802)

Co-authored-by: Scott Crosby <23e8f75489aff47cf2cd5a529e9a769a24e9501c@twosigma.com>

--- scheduler/src/cook/scheduler/scheduler.clj
+++ scheduler/src/cook/scheduler/scheduler.clj
@@ -1360,13 +1360,12 @@
                                                         (list))))
                                                   compute-clusters))
                         _ (doseq [offer offers
-                                  :let [slave-id (-> offer :slave-id :value)
-                                        attrs (get-offer-attr-map offer)]]
+                                  :let [slave-id (-> offer :slave-id :value)]]
                             ; Cache all used offers (offer-cache is a map of hostnames to most recent offer)
                             (swap! agent-attributes-cache (fn [c]
                                                             (if (cache/has? c slave-id)
                                                               (cache/hit c slave-id)
-                                                              (cache/miss c slave-id attrs)))))
+                                                              (cache/miss c slave-id (get-offer-attr-map offer))))))
                         using-pools? (not (nil? (config/default-pool)))
                         user->quota (quota/create-user->quota-fn (d/db conn) (if using-pools? pool-name nil))
                         matched-head? (handle-resource-offers! conn fenzo pool-name->pending-jobs-atom


add user validation tests

add user validation tests

--- test/clj_money/models/users_test.clj
+++ test/clj_money/models/users_test.clj
@@ -41,4 +41,16 @@
       (users/create data-store (dissoc attributes :email))
       (catch clojure.lang.ExceptionInfo e
         (is (= {:email 'missing-required-key}
+               (:error (ex-data e)))))))
+  (testing "First name is required"
+    (try
+      (users/create data-store (dissoc attributes :first_name))
+      (catch clojure.lang.ExceptionInfo e
+        (is (= {:first_name 'missing-required-key}
+               (:error (ex-data e)))))))
+  (testing "Last name is required"
+    (try
+      (users/create data-store (dissoc attributes :last_name))
+      (catch clojure.lang.ExceptionInfo e
+        (is (= {:last_name 'missing-required-key}
                (:error (ex-data e))))))))


Use proper hostname in the api-call-handler test

--- test/emender_jenkins/server_test.clj
+++ test/emender_jenkins/server_test.clj
@@ -220,12 +220,13 @@
     (testing "the function emender-jenkins.server/api-call-handler."
         (let [request {:configuration {
                           :api  {:prefix "/api"}
-                          :info {:version "1.0"}}}]
+                          :info {:version "1.0"}}}
+              hostname (get-hostname)]
             (are [uri result] (= (api-call-handler request uri :get) result)
                 "/api/"
                 {:status 200
                  :headers {"Content-Type" "application/json"}
-                 :body "{\"name\":\"Emender Jenkins Service\",\"version\":\"1.0\",\"api_prefix\":\"\\/api\",\"hostname\":\"dhcp-lab-190.englab.brq.redhat.com\",\"test\":\"\\/api\"}"}
+                 :body (str "{\"name\":\"Emender Jenkins Service\",\"version\":\"1.0\",\"api_prefix\":\"\\/api\",\"hostname\":\"" hostname "\",\"test\":\"\\/api\"}")}
                 "/api/configuration"
                 {:status 200
                  :headers {"Content-Type" "application/json"}


yet more testing

yet more testing

--- src/mafia_votecount/scraper/team_liquid.clj
+++ src/mafia_votecount/scraper/team_liquid.clj
@@ -54,7 +54,7 @@
         last-page  (->> (reverse page-number-bar)
                         (filter #(Character/isDigit (first %))) ;; Filter is lazy
                         (first))
-        last-page-number (if (integer? (Integer/parseInt last-page)) (Integer/parseInt) 1)]
+        last-page-number (if (integer? (Integer/parseInt last-page)) (Integer/parseInt last-page) 1)]
     (vec (range 1 (inc last-page-number)))))

 (defn- has-quote? [part]


[PDOK-2011] publication-date added for extract

--- src/main/clojure/pdok/featured/extracts.clj
+++ src/main/clojure/pdok/featured/extracts.clj
@@ -27,14 +27,15 @@
   "Returns the rendered representation of the collection of features for a given feature-type inclusive tiles-set"
   (if (empty? features)
     [nil nil]
-    (let [template-key (template-key dataset extract-type feature-type)]
+    (let [template-key (template-key dataset extract-type feature-type)
+          _ (println (first features))]
       [nil (map #(vector feature-type (:_tiles %) (m/render template-key %)
-                           (:_valid_from %) (:_valid_to %)) features)])))
+                           (:_valid_from %) (:_valid_to %) (:lv-publicatiedatum %)) features)])))

 (defn- jdbc-insert-extract [db table entries]
    (try (j/with-db-connection [c db]
           (apply (partial j/insert! c (str extract-schema "." table) :transaction? false
-                    [:feature_type :valid_from :valid_to :tiles :xml])
+                    [:feature_type :valid_from :valid_to :publication :tiles :xml])
                     entries))
         (catch java.sql.SQLException e (j/print-sql-exception-chain e))))

@@ -64,8 +65,8 @@
    (let [tiles (reduce clojure.set/union (map tiles-from-feature rendered-features))]
      (add-extractset-area db extractset-id tiles)))

-(defn- tranform-feature-for-db [[feature-type tiles xml-feature valid-from valid-to]]
-  [feature-type valid-from valid-to (vec tiles) xml-feature])
+(defn- tranform-feature-for-db [[feature-type tiles xml-feature valid-from valid-to publication-date]]
+  [feature-type valid-from valid-to publication-date (vec tiles) xml-feature])

 (defn add-extract-records [db dataset feature-type extract-type version rendered-features]
   "Inserts the xml-features and tile-set in an extract schema based on dataset, extract-type, version and feature-type,


Have test output go through go routine.

Have test output go through go routine.

This is to test ability for outside non-ago routine
to see rollbacks correctly.

--- test/ago/test.cljs
+++ test/ago/test.cljs
@@ -39,7 +39,8 @@
       last-snapshot (atom nil)
       agw (make-ago-world nil)
       ch1 (ago-chan agw 1)
-      ch2 (ago-chan agw 2)]
+      ch2 (ago-chan agw 2)
+      out-ch (ago-chan agw 1)]
   (go-loop []
     (<! stw-ch)
     (reset! last-snapshot (ago-snapshot agw))
@@ -48,9 +49,12 @@
     (<! rtw-ch)
     (ago-restore agw @last-snapshot)
     (recur))
+  (go-loop []
+    (println (<! out-ch))
+    (recur))
   (ago agw
        (loop [num-hi 0 num-bye 0]
-         (println "num-hi" num-hi "num-bye" num-bye)
+         (>! out-ch ["num-hi" num-hi "num-bye" num-bye])
          (let [[x ch] (alts! [hi-ch bye-ch])]
            (cond
             (= ch hi-ch)
@@ -83,7 +87,7 @@
                     (recur num-hi (inc num-bye)))))))))
   (ago agw
        (loop [num-fie 0]
-         (println "num-fie" num-fie)
+         (>! out-ch ["num-fie" num-fie])
          (>! ch2 [:fie num-fie])
          (>! ch2 [:foe num-fie])
          (let [x (<! fie-ch)]


Add test for html string output of inline style

--- test/re_view_hiccup/hiccup_test.cljs
+++ test/re_view_hiccup/hiccup_test.cljs
@@ -82,16 +82,25 @@
   "Client-side HTML strings from React elements"

   (is (= "
abc
"
-         (html/string (hiccup/element [:div {:class "red"} "abc"]))))
+         (html/string (hiccup/element [:div {:class "red"} "abc"])))
+      "div with class")
+
+  (is (= "
abc
"
+         (html/string (hiccup/element [:div {:style {:font-size 10}} "abc"])))
+      "div with inline style")

   (is (= "<amazon>abc</amazon>"
-         (html/string (hiccup/element [:amazon "abc"]))))
+         (html/string (hiccup/element [:amazon "abc"])))
+      "custom element")

   (is (= "<amazon:effect name=\"whispered\">abc</amazon:effect>"
-         (html/string (hiccup/element [:amazon/effect {:name "whispered"} "abc"]))))
+         (html/string (hiccup/element [:amazon/effect {:name "whispered"} "abc"])))
+      "custom element with namespace")

   (is (= ""
-         (html/string (hiccup/element [:span {:onClick #()}]))))
+         (html/string (hiccup/element [:span {:onClick #()}])))
+      "element with event handler (handler is elided)")

   (is (= "<speak><say-as interpret-as=\"cardinal\">abc</say-as></speak>"
-         (html/string (hiccup/element [:speak [:say-as {:interpret-as "cardinal"} "abc"]])))))+         (html/string (hiccup/element [:speak [:say-as {:interpret-as "cardinal"} "abc"]])))
+      "nested custom elements with custom attributes"))


todomvc: routing is now applied after persistence so that on start token is taken from the url bar instead of local storage

--- examples/todomvc/src/app/spec.cljs
+++ examples/todomvc/src/app/spec.cljs
@@ -15,6 +15,9 @@
        :on-start      (fn [_model _dispatch-signal] (println "[todos] start"))
        :on-stop       (fn [_model _dispatch-signal] (println "[todos] stop"))}
       (schema/add model/Schema)
-      (routing/add history)
+
       ; debugger deals with persistence itself, so we have to blacklist it here to get rid of loading conflicts
-      (persistence/add storage :model {:blacklist #{::devtools/debugger}})))+      (persistence/add storage :model {:blacklist #{::devtools/debugger}})
+
+      ; routing goes after persistence layer so that on start token is taken from the url bar instead of local storage
+      (routing/add history)))


fix interop

fix interop

Former-commit-id: e2b8bcc42436f584060a874b67e06adf6dc7957c

--- src/status_im/i18n.cljs
+++ src/status_im/i18n.cljs
@@ -8,7 +8,7 @@
 (set! (.-translations js.I18n) (clj->js {:en en/translations}))

 (defn t [path & options]
-  (.t js/I18n (name path) options))
+  (.t js/I18n (name path) (clj->js options)))

 (comment
   (defn deep-merge [& maps]