Fixed typo

Fixed typo

--- test/machine_learning/network_test.clj
+++ test/machine_learning/network_test.clj
@@ -33,7 +33,7 @@
        (fact "Biases should be present and have the correct structure"
              (m/shape (:biases (create-network [2 3 4]))) => [2 3 1]
              (m/shape (:biases (create-network [2 3 4 5]))) => [3 3 1])
-       (fact "Weights shold be a matrix-array with weights between layers"
+       (fact "Weights should be a matrix-array with weights between layers"
              (m/matrix? (first (:weights (create-network [2 3 2])))) => truthy
              (m/row-count (first (:weights (create-network [2 3 2])))) => 3
              (m/column-count (first (:weights (create-network [2 3 2])))) => 2


Fix multi peer test.

Fix multi peer test.

--- test/onyx/peer/multi_peer_mem_test.clj
+++ test/onyx/peer/multi_peer_mem_test.clj
@@ -3,13 +3,13 @@
             [onyx.peer.hornetq-util :as hq-util]
             [onyx.api]))

-(def n-messages 150)
+(def n-messages 15000)

-(def batch-size 50)
+(def batch-size 1320)

 (def timeout 500)

-(def echo 1)
+(def echo 1000)

 (def in-queue (str (java.util.UUID/randomUUID)))

@@ -95,6 +95,3 @@
   (fact (set (butlast results)) => expected)
   (fact (last results) => :done))

-
-(fact results => (conj (vec (map (fn [x] {:n (inc x)}) (range n-messages))) :done))
-


Remove useless import.

Remove useless import.

--- src/uxbox/frontend.clj
+++ src/uxbox/frontend.clj
@@ -13,7 +13,6 @@
             [catacumba.handlers.parse :as cparse]
             [catacumba.handlers.misc :as cmisc]
             [uxbox.config :as cfg]
-            [uxbox.services.auth :as sauth]
             [uxbox.frontend.auth :as auth]
             [uxbox.frontend.users :as users]
             [uxbox.frontend.errors :as errors]


Adding proper merge commit handling.

Adding proper merge commit handling.

We now track merges according to paths and files that mere changed by
more than one parent of the merge.

This is important if there are non-colliding changes happening within
a project. The resulting project is a *new* thing but this is not
directly detected by conventional merge logic. Merges either ignore
all changes or show all changes. Showing all changes makes it look
like a merge delivers a new project, even if the change within a
project was done via a single ancestor (meaning that the ancestor is
actually the point where the change should be noted).

--- src/leiningen/voom.clj
+++ src/leiningen/voom.clj
@@ -967,6 +967,32 @@
       (->> (reductions #(str %1 "/" %2)))
       (conj "")))

+(defn file-path-merges
+  [parents]
+  (->> parents
+       (mapcat #(into #{} (mapcat sub-paths %)))
+       (reduce #(update-in % [%2] (fnil inc 0)) {})
+       (filter #(< 1 (val %)))
+       (map first)))
+
+(defn merged-paths
+  [gitdir sha]
+  ;; TODO How to properly handle project file deletions?
+  (->> (git {:gitdir gitdir} "log" "-1" "-m"
+            "--name-status" "--pretty=format:--" sha)
+       :lines
+       (remove #{""})
+       (map #(s/replace % #"^[ADM]\t" ""))
+       (partition-by #{"--"})
+       (remove #{'("--")})
+       file-path-merges
+       (map #(-> (git {:gitdir gitdir}
+                      "rev-parse" (str sha ":" %))
+                 :out
+                 s/trim
+                 (->> (vector %))))
+       (into {})))
+
 (defn exported-commits
   [gitdir tip-shas seen-shas]
   (let [marks-file (File/createTempFile "marks" ".txt")]
@@ -979,7 +1005,13 @@
             marks (into {}
                         (map #(let [[mark sha] (s/split % #" ")]
                                 [mark (sha/mk sha)])
-                             (re-seq #"(?m)^.*$" (slurp marks-file))))]
+                             (re-seq #"(?m)^.*$" (slurp marks-file))))
+            merge-commit-fn (fn [cmd commit]
+                              (if (= cmd "merge")
+                                (-> commit
+                                    (assoc :merge true)
+                                    (assoc :paths (merged-paths gitdir (-> commit :sha str))))
+                                commit))]
         (with-open [rdr (-> out
                             java.io.ByteArrayInputStream.
                             (java.io.InputStreamReader. "ISO-8859-1")
@@ -999,12 +1031,15 @@
                                             (assoc commit :ctime))
                            "data" (do (.skip rdr (Long/parseLong more-line))
                                       commit)
-                           ("from" "merge") (update-in commit [:parents]
-                                                       (fnil conj [])
-                                                       (marks more-line))
-                           "M" (let [[_ sha path] (s/split more-line #" " 3)]
-                                 (update-in commit [:paths]
-                                            assoc path (sha/mk sha)))
+                           ("from" "merge") (let [commit (merge-commit-fn cmd commit)]
+                                              (update-in commit [:parents]
+                                                         (fnil conj [])
+                                                         (marks more-line)))
+                           "M" (if (:merge commit)
+                                 commit
+                                 (let [[_ sha path] (s/split more-line #" " 3)]
+                                   (update-in commit [:paths]
+                                              assoc path (sha/mk sha))))
                            "D" (update-in commit [:paths] assoc more-line nil)
                            (do (println "Unparsed:" line)
                                commit)))))


Extend 'box-cmd to handle stringification and breakout 'proj-id->name fn.

--- src/leiningen/voom.clj
+++ src/leiningen/voom.clj
@@ -46,8 +46,8 @@
                        cmdline)))

 (defn box-cmd
-  [cmd]
-  (swap! *box-cmds* conj cmd))
+  [& cmd]
+  (swap! *box-cmds* conj (apply str cmd)))

 (defn git
   [{:keys [^File gitdir ok-statuses sh-opts]
@@ -619,13 +619,17 @@
           (do (sh "rm" "-f" pdir)
               (sh "rm" "-rf" checkout))))

+(defn proj-id->name
+  [proj]
+  (-> (str proj)
+      (s/replace #"/" "--")))
+
 (defn box-repo-add
   [{:keys [repo gitdir branch sha proj path verify]}]
   (assert (contains? #{nil :ok} verify))
   (if-let [bdir (find-box)]
     (let [sha (str sha)
-          pname (-> (str proj)
-                    (s/replace #"/" "--"))
+          pname (proj-id->name proj)
           pdir (adj-path bdir pname)
           checkout (adj-path bdir task-dir pname)
           g {:gitdir checkout}]
@@ -685,7 +689,7 @@
   [proj target & args]
   (let [p (adj-path *pwd* target)]
     (sh "mkdir" "-p" p)
-    (box-cmd (str "target_dir='" (.getAbsolutePath p) "'"))
+    (box-cmd "target_dir='" (.getAbsolutePath p) "'")
     (apply box-init proj target args)))

 (defn box-remove


Add informative text instead of missing picture

--- src/wlmmap/handler.clj
+++ src/wlmmap/handler.clj
@@ -58,10 +58,10 @@
                  arl (format wp-link-format-url lng (codec/url-encode art) art)
                  src (format src-format-url reg id)
                  all (str "
" nam "
"
-                          (when (not (= "" imc)) (str ilk "
"))
-                          (when (not (= "" art)) (str arl "
"))
-                          (when (not (= "" reg)) src))]
-             (list cnt (list (:lat m) (:lon m)) (= "" imc) all))))
+                          (if (empty? imc) "[No image]

" (str ilk "
"))
+                          (when (seq art) (str arl "
"))
+                          (when (seq reg) src))]
+             (list cnt (list (:lat m) (:lon m)) (empty? imc) all))))
        monuments
        (range (if (empty? start) 0 (Integer/parseInt start)) 100000)))


add read all and create routes for access keys

--- src/wombats/routes.clj
+++ src/wombats/routes.clj
@@ -15,6 +15,7 @@
             [wombats.handlers.echo :as echo]
             [wombats.handlers.game :as game]
             [wombats.handlers.user :as user]
+            [wombats.handlers.access-keys :as access-keys]
             [wombats.handlers.auth :as auth]
             [wombats.handlers.arena :as arena]
             [wombats.handlers.simulator :as simulator]
@@ -99,6 +100,11 @@
           ["/start"
            {:put game/start-game}]]]

+        ["/access_keys"
+         ^:interceptors [(authorize #{:user.roles/event-coordinator})]
+         {:get access-keys/get-access-keys
+          :post access-keys/add-access-key}]
+
         ["/auth"
          ["/github"
           ^:interceptors [(add-api-settings api-settings)


matcher sends entire message, with content of :payload replaced by pretty-printed string

--- src/clj/com/matthiasnehlsen/inspect/matcher.clj
+++ src/clj/com/matthiasnehlsen/inspect/matcher.clj
@@ -40,7 +40,7 @@
                 (when-not (= msg :stop-loop)
                   (doseq [uid (:any @uids)]
                     (when (pos? (get (:clients @app) uid 0))
-                      (chsk-send! uid [:info/msg {:pp (with-out-str (pp/pprint msg))}])
+                      (chsk-send! uid [:info/msg (assoc msg :payload (with-out-str (pp/pprint (:payload msg))))])
                       (swap! app update-in [:clients uid] dec)))
                   (recur)))))


Tidied up redundant code and broken CSS

Tidied up redundant code and broken CSS

--- src/cljs/kixi/hecuba/tabs/hierarchy/xyplot.cljs
+++ src/cljs/kixi/hecuba/tabs/hierarchy/xyplot.cljs
@@ -101,53 +101,30 @@
         (data-loop cursor @chart-data-chan))
       om/IRender
       (render [_]
-        (dom/div #js {:style #js {:position "relative"
-                                  :overflow "hidden"
-                                  :whiteSpace "nowrap"
-                                  :font-family "sans-serif"
-                                  :font-size "11px"
-                                  :text-align "center"
-                                  :width (str (+ 50 @chart-width) "px")}}
-                 (dom/span #js {:style #js {:float "left"
-                                            :margin (str (/ @chart-height 2) "px -40px 0px -10px")
-                                            :WebkitTransform "rotate(-90deg)"
-                                            :MozTransform "rotate(-90deg)"
-                                            :msTransform "rotate(-90deg)"
-                                            :OTransform "rotate(-90deg)"
-                                            :filter "progid:DXImageTransform.Microsoft.BasicImage(rotation=3)"}} (str "Unit: " y-label))
-                 (dom/div #js {:dangerouslySetInnerHTML #js
-                               {:__html (->> @cursor
-                                             :element
-                                             viz/svg-plot2d-cartesian
-                                             (svg/svg {:width @chart-width :height @chart-height})
-                                             hiccups/html)}})
-                 (dom/div #js {:style #js {:height "20px" :margin-top "5px"}} (dom/span nil (str "Unit: " x-label))))))))
+        (if (-> cursor :element)
+          (dom/div #js {:style #js {:position "relative"
+                                    :overflow "hidden"
+                                    :whiteSpace "nowrap"
+                                    :fontFamily "sans-serif"
+                                    :fontSize "11px"
+                                    :textAlign "center"
+                                    :width (str (+ 50 @chart-width) "px")}}
+                   (dom/span #js {:style #js {:float "left"
+                                              :margin (str (/ @chart-height 2) "px -40px 0px -10px")
+                                              :WebkitTransform "rotate(-90deg)"
+                                              :MozTransform "rotate(-90deg)"
+                                              :msTransform "rotate(-90deg)"
+                                              :OTransform "rotate(-90deg)"
+                                              :filter "progid:DXImageTransform.Microsoft.BasicImage(rotation=3)"}} (str "Unit: " y-label))
+                   (dom/div #js {:dangerouslySetInnerHTML #js
+                                 {:__html (->> @cursor
+                                               :element
+                                               viz/svg-plot2d-cartesian
+                                               (svg/svg {:width @chart-width :height @chart-height})
+                                               hiccups/html)}})
+                   (dom/div #js {:style #js {:height "20px" :marginTop "5px"}} (dom/span nil (str "Unit: " x-label)))))))))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-(defn update-sensor [click sensors history selected?]
-  (let [{:keys [id unit lower_ts upper_ts]} click
-        new-selected-sensors ((if selected? disj conj) (:selected @sensors) id)
-        [type device_id] (string/split id #"~")]
-    ;; update history
-    (history/update-token-ids! history :sensors (if (seq new-selected-sensors)
-                                                  (string/join ";" new-selected-sensors)
-                                                  nil))
-    ;; update chart default range
-    (comment (when (and lower_ts upper_ts (not selected?))
-               (om/update! chart :range {:start-date (common/unparse-date lower_ts "yyyy-MM-dd")
-                                         :end-date (common/unparse-date upper_ts "yyyy-MM-dd")})))
-    ;; update units in chart
-    (comment (om/transact! chart :units (fn [units]
-                                          (if selected?
-                                            (dissoc units id)
-                                            (assoc units id unit)))))))
-
-(defn process-click [click cursor owner history]
-  (let [{:keys [id unit]} click
-        {:keys [sensors property-details]} cursor
-        already-selected? (contains? (:selected @sensors) id)]
-    (update-sensor click sensors history already-selected?)))

 (defn sensor-row [{:keys [xyplot-data sensor]} owner {:keys [table-id event-chan]}]
   (reify


Fix select-keys lense in cljs impl.

Fix select-keys lense in cljs impl.

--- src/lentes/core.cljc
+++ src/lentes/core.cljc
@@ -129,18 +129,22 @@
    (fn [s f]
      (update s k f))))

+(def ^:private core-select-keys
+  #?(:clj clojure.core/select-keys
+     :cljs cljs.core/select-keys))
+
 (defn select-keys
   "Return a lens focused on the given keys in an associative data
   structure."
   [ks]
   (lens
    (fn [s]
-     (clojure.core/select-keys s ks))
+     (core-select-keys s ks))
    (fn [s f]
      (merge (apply dissoc s ks)
-            (-> (clojure.core/select-keys s ks)
+            (-> (core-select-keys s ks)
                 f
-                (clojure.core/select-keys ks))))))
+                (core-select-keys ks))))))

 (defn in
   "Given a path and optionally a default value, return a lens that


Convert create event request to internal format

--- src/liber/resource.clj
+++ src/liber/resource.clj
@@ -6,10 +6,10 @@
             [liberator.core :as liberator]
             [liberator.representation :as liberator-rep]
             [liber.lifecycle :refer [Lifecycle]]
-
             [liber.api-schema :as schema]
             [cheshire.core :as json]
-            [clj-schema.validation :refer [validation-errors]])
+            [clj-schema.validation :refer [validation-errors]]
+            [liber.util :as util])
 )

 (def resource-defaults
@@ -109,30 +109,32 @@
   (events [this]
           (resource
            :allowed-methods [:post]
+           ;; check tracker exists
+           ;; check valid checksum/password
+           :authorized?
+           :allowed? true
            :malformed? (fn [ctx]
                         (let [data (-> ctx :request :body)
-                              result (validation-errors? data schema/new-single-event-schema)]
-                          result
-                          ;; TODO convert and put stuff to ctx
-                        ))
+                              errors (validation-errors schema/new-single-event-schema data)
+                              converted-data (util/convert data schema/new-event-conversion)]
+                          (debug errors (not (empty? errors)))
+                          [(not (empty? errors)) {::validation-errors errors
+                                                  ::data converted-data}]))
            :handle-malformed (fn [ctx]
-                               (let [errors (ctx :validation-errors)
+                               (let [errors (ctx ::validation-errors)
                                      resp (json-response 400 {:error :malformed-data
                                                               :validation-errors errors} )]
                                  (debug "Malformed request" errors)
                                  resp))
-           ;; check tracker exists
-           ;; check valid checksum
            :post! (fn [ctx]
-                    (let [data (-> ctx :request :body)]
+                    (let [data (-> ctx ::data)]
                       (info "new-event" data)
                       (let [{:keys [tracker_id]} data
                             new-event (events/create-event! event-service tracker_id data)]
-                        {:created event}
-                        )))
+                        {::created event} )))
            :handle-created (fn [ctx]
-                             {:success "ok"
-                              :created-event (ctx :created)}
+                             {:success "OK"
+                              :created-event (ctx ::created)})
            ))

   (event [this event-id]


minimize mail project.clj

minimize mail project.clj

--- migae-mail/project.clj
+++ migae-mail/project.clj
@@ -1,10 +1,6 @@
-(defproject migae/service/migae-mail "0.1.0-SNAPSHOT"
+(defproject migae/migae-mail "0.1.0-SNAPSHOT"
   :description "migae - Mobile Ink Google App Engine sdk for Clojure."
   :url "https://github.com/greynolds/migae"
   :min-lein-version "2.0.0"
-  :exclusions [org.clojure/clojure]
-  :jar-name "migae-mail.jar"
-  :plugins [[lein-sub "0.2.1"]
-            [codox "0.6.4"]]
-  :dependencies [[org.clojure/clojure "1.5.1"]
-                 [migae/migae-kernel "0.1.0-SNAPSHOT"]])
+  :dependencies [
+                 [migae/migae-core "0.1.0-SNAPSHOT"]])


#26 - Reformatted book list and made separate 'modes' for books and chapters.

--- src/biblecli/commands/staticpages.cljs
+++ src/biblecli/commands/staticpages.cljs
@@ -79,30 +79,29 @@
   text-align: center;
 }

-.book h3 {
-  margin: 0;
-  min-height: 32px;
-}
-.book .chapters {
+.book, .main {
   display: none;
-  margin-bottom: 8px;
-}
-.book .chapters a {
+}
+.books a, .chapters a {
   display: inline-block;
   display: inline-flex;
   justify-content: center;
   align-items: center;
   text-align: center;
-  min-width: 4ex;
-  min-height: 4ex;
-  padding: 0;
+  min-height: 3.7ex;
+  padding: 2px;
   margin: 2px;
-  background-color: rgba(0,0,0,0.03);
-}
-.book.active .chapters {
+  background-color: rgba(0,0,0,0.05);
+}
+.books a {
+  min-width: 17.5ex;
+}
+.chapters a {
+  min-width: 3.7ex;
+}
+.toc .active {
   display: block;
 }
-
 .verses .active {
   background-color: #FFFF99;
 }
@@ -194,8 +193,7 @@
 ")

 (defn js []
-"// NOTE: Experimental
-(function (document, window) {
+"(function (document, window) {

 var lastElem = null;

@@ -220,9 +218,16 @@
     var el;
     el = FindElem(lastElem);
     SetActiveElem(el, false);
-
-    var id = '_' + window.location.hash.substr(1);
+    el = FindElem('_main');
+    SetActiveElem(el, false);
+
+    var raw = window.location.hash.substr(1);
+    var id = '_' + raw;
     el = FindElem(id);
+    if(!el) {
+      id = '_main';
+      el = FindElem(id);
+    }
     if(el) {
         lastElem = id;
         SetActiveElem(el, true);
@@ -371,13 +376,20 @@
         chapcount (count chapters)
         id (:id b)
         bookid (book-elem-id id)]
-     [:div.book {:id (str "_" bookid)}
-     [:h3.chapter [:a {:href (if (> chapcount 1) (str "#" bookid) bookid)} (book-name-nbsp id)]]
-     [:div.chapters
-      (->> chapters
-           (map (fn [ch]
+     [:a {:href (if (> chapcount 1) (str "#" bookid) bookid)} (book-name-nbsp id)]))
+
+(defn toc-book-details [b]
+  (let [chapters (:chapters b)
+        chapcount (count chapters)
+        id (:id b)
+        bookid (book-elem-id id)]
+    [:div.book {:id (str "_" bookid)}
+      [:h2.chapter (book-name-nbsp id)]
+      [:div.back [:a {:href "."} "Back to Book Lists"]]
+      [:div.chapters
+        (->> chapters
+             (map (fn [ch]
                   (list [:a {:href (rel-url (:id b) (:num ch) chapcount)} (:num ch)]))))]]))
-

 (defn toc [m baseurl canonical]
   (str "<!DOCTYPE html>"
@@ -393,18 +405,25 @@
           [:div.content.toc
             [:h1 "The King James Bible"]

-            [:div#votd.votd]
-            [:script "(function(w,d,t,u,v,i,n,l){w['VotdObject']=v;w[v]=w[v]||{};w[v].i=i;n=d.createElement(t),l=d.getElementsByTagName(t)[0];n.async=1;n.src=u;l.parentNode.insertBefore(n,l)})(window,document,'script','votd/votd.js','votd','votd');"]
-
-            [:h2 "The Old Testament"]
-            (->> m
-              (take 39)
-              (map toc-book))
-
-            [:h2 "The New Testament"]
-            (->> m
-              (drop 39)
-              (map toc-book))
+            [:div#_main.main.active
+
+              [:div#votd.votd]
+              [:script "(function(w,d,t,u,v,i,n,l){w['VotdObject']=v;w[v]=w[v]||{};w[v].i=i;n=d.createElement(t),l=d.getElementsByTagName(t)[0];n.async=1;n.src=u;l.parentNode.insertBefore(n,l)})(window,document,'script','votd/votd.js','votd','votd');"]
+
+              [:h2 "The Old Testament"]
+              [:div.books
+                (->> m
+                  (take 39)
+                  (map toc-book))]
+
+              [:h2 "The New Testament"]
+              [:div.books
+                (->> m
+                  (drop 39)
+                  (map toc-book))]]
+
+           (->> m
+                (map toc-book-details))

             [:div.about [:a {:href "https://github.com/pstephens/kingjames.bible/blob/master/README.md"} "About " baseurl ]]]
           [:script {:type "text/javascript" :src "hiliter.js"}]]])))


make file loading fix backward compatible

--- support/src/figwheel/client/file_reloading.cljs
+++ support/src/figwheel/client/file_reloading.cljs
@@ -203,15 +203,19 @@
 (defn patch-goog-base []
   (defonce bootstrapped-cljs (do (bootstrap-goog-base) true)))

+(def gloader
+  (cond
+    (exists? loader/safeLoad)
+    #(loader/safeLoad (conv/trustedResourceUrlFromString (str %1)) %2)
+    (exists? loader/load) #(loader/load (str %1) %2)
+    :else (throw (ex-info "No remote script loading function found." {}))))
+
 (defn reload-file-in-html-env
   [request-url callback]
   (dev-assert (string? request-url) (not (nil? callback)))
-  (let [deferred (loader/safeLoad
-                  (conv/trustedResourceUrlFromString
-                   (str (add-cache-buster request-url)))
-                  #js {:cleanupWhenDone true})]
-    (.addCallback deferred #(apply callback [true]))
-    (.addErrback deferred #(apply callback [false]))))
+  (doto (gloader (add-cache-buster request-url) #js {:cleanupWhenDone true})
+    (.addCallback #(apply callback [true]))
+    (.addErrback  #(apply callback [false]))))

 (def reload-file*
   (condp = (utils/host-env?)


style permalink "done" button

style permalink "done" button

--- src/braid/client/ui/styles/thread.cljs
+++ src/braid/client/ui/styles/thread.cljs
@@ -112,6 +112,10 @@
      [:.user :.tag :.add
       {:margin-bottom (em 0.5)
        :margin-right (em 0.5)} ] ]
+
+    [:.permalink
+     [:button
+      mixins/pill-button]]

     [:.controls
      {:position "absolute"


show autocompletes immediately (except emoji still reqs 1 character)

--- src/chat/client/views/new_message.cljs
+++ src/chat/client/views/new_message.cljs
@@ -51,7 +51,7 @@
   [
    ; ... :emoji  -> autocomplete emoji
    (fn [text thread-id]
-     (let [pattern #"\B:(\S{3,})$"]
+     (let [pattern #"\B:(\S{1,})$"]
        (when-let [query (second (re-find pattern text))]
          (->> emoji/unicode
               (filter (fn [[k v]]
@@ -73,7 +73,7 @@

    ; ... @<user>  -> autocompletes user name
    (fn [text thread-id]
-     (let [pattern #"\B@(\S{1,})$"]
+     (let [pattern #"\B@(\S{0,})$"]
        (when-let [query (second (re-find pattern text))]
          (->> (store/all-users)
               (filter (fn [u]
@@ -96,7 +96,7 @@

    ; ... #<tag>   -> autocompletes tag
    (fn [text thread-id]
-     (let [pattern #"\B#(\S{1,})$"]
+     (let [pattern #"\B#(\S{0,})$"]
        (when-let [query (second (re-find pattern text))]
          (->> (store/all-tags)
               (filter (fn [t]


notes

notes

--- src/clj/backtype/storm/daemon/task.clj
+++ src/clj/backtype/storm/daemon/task.clj
@@ -61,6 +61,7 @@
   (.emitDirect collector task stream values)
   )

+;; TODO: this should be defined somewhere else and be serializable. it should be added to topology by nimbus
 (defn mk-acker-bolt []
   (let [output-collector (atom nil)
         pending (atom nil)]
@@ -105,7 +106,9 @@
              )
       )))

+
 (defn- get-task-object [topology component-id]
+  ;; TODO: this will be no longer necessary when constructing system topology in nimbus
   (if (= ACKER-COMPONENT-ID component-id)
     (mk-acker-bolt)
     (let [spouts (.get_spouts topology)
@@ -127,6 +130,7 @@
       )))

+;; TODO: this logic needs to be moved to nimbus for constructing system topology
 (defn outbound-components
   "Returns map of stream id to component id to grouper"
   [topology-context]
@@ -167,12 +171,7 @@
 (defmulti mk-task-stats class-selector)

 (defn- get-readable-name [topology-context]
-  (let [component-id (.getThisComponentId topology-context)]
-    (if (system-component? component-id)
-      ({ACKER-COMPONENT-ID "Acker"} component-id)
-      ;; TODO: change this so that can get better name for nested bolts
-      (str (class (get-task-object (.getRawTopology topology-context) component-id)))
-      )))
+  (.getThisComponentId topology-context))

 (defn- send-ack [^TopologyContext topology-context ^Tuple input-tuple
                  ^List generated-ids send-fn]


removed duplicate variable assignment, removed empy emails check

--- src/clj/org/openforis/ceo/db/users.clj
+++ src/clj/org/openforis/ceo/db/users.clj
@@ -222,8 +222,7 @@
   (let [user-id        (:userId params -1)
         institution-id (tc/val->int (:institutionId params))]
     (call-sql "add_institution_user" institution-id user-id 3)
-    (let [institution-id   (tc/val->int (:institutionId params))
-          institution-name (:name (first (call-sql "select_institution_by_id" institution-id -1)))
+    (let [institution-name (:name (first (call-sql "select_institution_by_id" institution-id -1)))
           email            (:email (first (call-sql "get_user_by_id" user-id)))
           emails           (mapv :email
                                  (filter
@@ -231,15 +230,13 @@
                                   (call-sql "get_all_users_by_institution_id" institution-id)))
           email-msg (format (str "User %s has requested the acces to institution %s.")
                             email institution-name)]
-      (if (not-empty emails)
-        (try
-          (send-mail emails nil nil "Membership Request" email-msg "text/plain")
-          (data-response "")
-          (catch Exception _ (data-response (str email
-                                                 " has requested the membership to "
-                                                 institution-name
-                                                 ", but the email notification has failed."))))
-        (data-response "There are no administrator users.")))))
+      (try
+        (send-mail emails nil nil "Membership Request" email-msg "text/plain")
+        (data-response "")
+        (catch Exception _ (data-response (str email
+                                               " has requested the membership to "
+                                               institution-name
+                                               ", but the email notification has failed.")))))))

 (defn- get-mailing-list-errors [subject body remaining-time]
   (cond (or (str/blank? subject) (str/blank? body))


passing around state correctly

passing around state correctly

--- src/cljs/swarmpit/component/mixin.cljs
+++ src/cljs/swarmpit/component/mixin.cljs
@@ -20,6 +20,8 @@
            state)})

 (def focus-filter
-  {:did-mount #(-> js/document
-                   (.getElementById "filter")
-                   (.focus))})+  {:did-mount (fn [state]
+                (-> js/document
+                    (.getElementById "filter")
+                    (.focus))
+                state)})


get-form-meta-somehow

get-form-meta-somehow

--- src/com/billpiel/sayid/deep_trace2.clj
+++ src/com/billpiel/sayid/deep_trace2.clj
@@ -459,6 +459,11 @@
                                 false
                                 ~else))))))

+(defn get-form-meta-somehow
+  [form]
+  (or (meta form)
+      (-> form first meta)))
+
 (defn xpand-fn
   [head form src-map fn-meta path parent-path]
   (xpand-fn-form head
@@ -469,8 +474,7 @@
                             path)
                  path
                  (mk-tree-template src-map
-                                   (or (meta form)
-                                       (-> form first meta))
+                                   (get-form-meta-somehow form)
                                    fn-meta
                                    path
                                    parent-path)))
@@ -486,8 +490,7 @@
                                   path)
                       path
                       (mk-tree-template src-map
-                                        (or (meta form)
-                                            (-> form first meta))
+                                        (get-form-meta-somehow form)
                                         fn-meta
                                         path
                                         parent-path
@@ -502,8 +505,7 @@
                             path)
                  path
                  (mk-tree-template src-map
-                                   (or (meta form)
-                                       (-> form first meta))
+                                   (get-form-meta-somehow form)
                                    fn-meta
                                    path
                                    parent-path)))
@@ -517,8 +519,7 @@
                              path)
                   path
                   (mk-tree-template src-map
-                                    (or (meta form)
-                                        (-> form first meta))
+                                    (get-form-meta-somehow form)
                                     fn-meta
                                     path
                                     parent-path)))


More crash handling

More crash handling


fix repo uri

fix repo uri

--- src/devops_101_pipeline/meta/steps.clj
+++ src/devops_101_pipeline/meta/steps.clj
@@ -4,7 +4,7 @@
             [lambdacd.steps.manualtrigger :as manualtrigger]
             [lambdacd.steps.git :as git]))

-(def devops-101-repo "https://github.com/flosell/lambdacd.git") ;; change this if you want to make your own changes
+(def devops-101-repo "https://github.com/flosell/devops-101-lambdacd.git") ;; change this if you want to make your own changes
 (def devops-101-branch "digitalocean")
 (defn wait-for-repo [_ ctx]
   (git/wait-for-git ctx devops-101-repo devops-101-branch))


(SERVER-1761) Test profiler svc for default enabled

--- test/unit/puppetlabs/services/puppet_profiler/puppet_profiler_service_test.clj
+++ test/unit/puppetlabs/services/puppet_profiler/puppet_profiler_service_test.clj
@@ -32,10 +32,10 @@

 (deftest test-profiler-service
   (testing "get-profiler returns nil if profiling is not enabled"
-    (call-get-profiler {} nil?)
-    (call-get-profiler {:profiler {}} nil?)
     (call-get-profiler {:profiler {:enabled "false"}} nil?)
     (call-get-profiler {:profiler {:enabled false}} nil?))
   (testing "get-profiler returns a profiler if profiling is enabled"
+    (call-get-profiler {} #(instance? PuppetProfiler %))
+    (call-get-profiler {:profiler {}} #(instance? PuppetProfiler %))
     (call-get-profiler {:profiler {:enabled "true"}} #(instance? PuppetProfiler %))
     (call-get-profiler {:profiler {:enabled true}} #(instance? PuppetProfiler %))))


identity was wrong

identity was wrong

--- src/friend_oauth2_google_demo/core.clj
+++ src/friend_oauth2_google_demo/core.clj
@@ -53,7 +53,7 @@
         resp (client/get (str "https://www.googleapis.com/plus/v1/people/me?access_token=" (:access-token token)))
         data (-> resp :body (json/read-str :key-fn keyword))]

-    {:identity data :roles #{::user}}))
+    {:identity (:id data) :roles #{::user}}))

 (def uri-config
   {:authentication-uri {:url   "https://accounts.google.com/o/oauth2/auth"


Updated cli test

Updated cli test

Signed-off-by: Tom Marble <b248307e886b80bf9cb4014595572a835b049bf4@info9.net>

--- test/clj/testing/pamela/cli.clj
+++ test/clj/testing/pamela/cli.clj
@@ -19,6 +19,6 @@
   (testing "testing-pamela-cli"
     (is (= log-levels #{"trace" "debug" "info" "warn" "error" "fatal" "report"}))
     (is (= output-formats #{"edn" "json"}))
-    (is (= (sort (keys actions)) '("build" "htn" "tpn")))
+    (is (= (sort (keys actions)) '("build" "check" "htn" "tpn")))
     (is (= (base-64-decode "KGNvaW4uZmxpcC0zKQ==") "(coin.flip-3)"))
     ))


change the way the password reset unit test is done to avoid issues with the way mysql handles datetimes.

--- test/metabase/api/user_test.clj
+++ test/metabase/api/user_test.clj
@@ -214,27 +214,20 @@

 ;; ## PUT /api/user/:id/password
 ;; Test that a User can change their password
-(let [user-last-name (random-name)]
-  (expect-eval-actual-first
-      (let [{user-id :id} (sel :one User :last_name user-last-name)]
-        (sel :one :fields [Session :id] :user_id user-id (k/order :created_at :desc))) ; get the latest Session for this User
-    (let [password {:old "password"
-                    :new "whateverUP12!!"}
-          {:keys [email id] :as user} (create-user :password (:old password) :last_name user-last-name)
-          creds {:old {:password (:old password)
-                       :email email}
-                 :new {:password (:new password)
-                       :email email}}]
-      ;; Check that creds work
-      (metabase.http-client/client :post 200 "session" (:old creds))
-      ;; Change the PW
-      (metabase.http-client/client (:old creds) :put 200 (format "user/%d/password" id) {:password (:new password)
-                                                                                :old_password (:old password)})
-      ;; Old creds should no longer work
-      (assert (= (metabase.http-client/client :post 400 "session" (:old creds))
-                {:errors {:password "did not match stored password"}}))
-      ;; New creds *should* work
-      (metabase.http-client/client :post 200 "session" (:new creds)))))
+(expect-let [creds                 {:email    "abc@metabase.com"
+                                    :password "def"}
+             {:keys [id password]} (ins User
+                                     :first_name "test"
+                                     :last_name  "user"
+                                     :email      "abc@metabase.com"
+                                     :password   "def")]
+  true
+  (do
+    ;; use API to reset the users password
+    (metabase.http-client/client creds :put 200 (format "user/%d/password" id) {:password     "abc123!!DEF"
+                                                                                :old_password (:password creds)})
+    ;; now simply grab the lastest pass from the db and compare to the one we have from before reset
+    (not= password (sel :one :field [User :password] :email (:email creds)))))

 ;; Check that a non-superuser CANNOT update someone else's password
 (expect "You don't have permissions to do that."


content type

content type

--- src/ontrail/core.clj
+++ src/ontrail/core.clj
@@ -31,7 +31,7 @@
        (.error logger (str exception#))
        (stacktrace/print-stack-trace exception# 100)
        {:status 500
-        :headers {"Content-Type" "application/tex"}
+        :headers {"Content-Type" "application/text"}
         :body (str exception#)})))

 (defmacro is-authenticated? [cookies action]
@@ -43,7 +43,7 @@
        (.error logger (str exception#))
        (stacktrace/print-stack-trace exception# 100)
        {:status 500
-        :headers {"Content-Type" "application/tex"}
+        :headers {"Content-Type" "application/text"}
         :body (str exception#)})))

 (defn log-and-wrap-dir-index [handler]
@@ -85,7 +85,7 @@
         (is-authenticated? cookies (json-response (create-ex (:username (user-from-token (:value (cookies "authToken")))) params))))

   (route/resources "/")
-  (route/not-found "Page not found"))
+  (route/not-found {:status 404}))

 (defn -main [& args]
   (.info logger "Starting to build index")


switch to official parsley 0.9.1

switch to official parsley 0.9.1

--- src/paredit/parser.clj
+++ src/paredit/parser.clj
@@ -15,15 +15,9 @@
 (def ^:dynamic *tag-opening-brackets* {:list "(", :map "{", :vector "[", :string "\"", :regex "#\"", :set "#{", :fn "#("})
 (def ^:dynamic *atom* #{:symbol :keyword :int :float :ratio :anon-arg})

-(defn eof [s eof?]
-  (when (and (= 0 (.length ^String s)) eof?) [0 eof]))
-
-#_(reify MatcherFactory
-  (matcher-fn [this id]
-    (fn [s eof?] (when (and (= 0 (.length ^String s)) eof?) [0 id]))))
-
-;(defn bracket-end [s eof?]
-;  (lr+/match #{")" "]" "}" eof} s eof?))
+(def eof (reify net.cgrand.parsley.lrplus/MatcherFactory
+           (matcher-fn [this id]
+             (fn [s eof?] (when (and (= 0 (.length ^String s)) eof?) [0 id])))))

 (def gspaces #{:whitespace :comment :discard})
 (def only-code (partial remove (comp (conj gspaces


fixed edeposit/edeposit#555 doplnil jsem testy a kod k odeslani do Krameria.

--- src/edeposit/amqp/kramerius/handlers.clj
+++ src/edeposit/amqp/kramerius/handlers.clj
@@ -1,19 +1,20 @@
 (ns edeposit.amqp.kramerius.handlers
-  (:require [me.raynes.fs :as fs]
-            [langohr.basic     :as lb]
-            [clojure.data.json :as json]
-            [clojure.java.io :as io]
-            [clojure.tools.logging :as log]
-            [clojure.pprint :as pp]
+  (:require [clj-time.core :as t]
+            [clj-time.local :as lt]
             [clojure.data.json :as json]
             [clojure.data.xml :as xml]
-            [clj-time.core :as t]
+            [clojure.java.io :as io]
+            [clojure.java.shell :as shell]
+            [clojure.pprint :as pp]
+            [clojure.string :as cs]
+            [clojure.tools.logging :as log]
+            [clojurewerkz.serialism.core :as s]
+            [clojure.xml :as x]
+            [edeposit.amqp.kramerius.xml.foxml :as f]
             [edeposit.amqp.kramerius.xml.mods :as m]
-            [edeposit.amqp.kramerius.xml.foxml :as f]
             [edeposit.amqp.kramerius.xml.utils :as u]
-            [clojure.java.shell :as shell]
-            [clojurewerkz.serialism.core :as s]
-            )
+            [langohr.basic     :as lb]
+            [me.raynes.fs :as fs])
   (:import [org.apache.commons.codec.binary Base64])
   )

@@ -31,24 +32,24 @@
 (defn save-request
   "it returns name of a directory where payload is saved"
   [[[metadata payload] workdir]]
-  (spit (io/file workdir "payload.bin") payload)
-  (.mkdir (io/file workdir "payload"))
-  (spit (io/file workdir "metadata.clj") metadata)
+  (fs/mkdirs (io/file workdir "request" "payload"))
+  (spit (io/file workdir "request" "payload.bin") payload)
+  (spit (io/file workdir "request" "metadata.clj") metadata)
   (let [msg (json/read-str (String. payload) :key-fn keyword)
-        marcxml-file (io/file  workdir "payload" "oai_marc.xml")]
+        marcxml-file (io/file  workdir "request" "payload" "oai_marc.xml")]
     (log/info "save export request to" workdir)
     (spit (-> marcxml-file .toString (.concat ".b64")) (:b64_marcxml msg))
-    (spit (io/file workdir "payload" "uuid") (:uuid msg))
-    (spit (io/file workdir "payload" "urnnbn") (:urnnbn msg))
-    (spit (io/file workdir "payload" "aleph_id") (:aleph_id msg))
-    (spit (io/file workdir "payload" "isbn") (:isbn msg))
-    (spit (io/file workdir "payload" "location-at-kramerius") (:location_at_kramerius msg))
-    (spit (io/file workdir "payload" "is-private") (:is_private msg))
-    (spit (io/file workdir "payload" "edeposit-url.txt") (:edeposit_url msg))
+    (spit (io/file workdir "request" "payload" "uuid") (:uuid msg))
+    (spit (io/file workdir "request" "payload" "urnnbn") (:urnnbn msg))
+    (spit (io/file workdir "request" "payload" "aleph_id") (:aleph_id msg))
+    (spit (io/file workdir "request" "payload" "isbn") (:isbn msg))
+    (spit (io/file workdir "request" "payload" "location-at-kramerius") (:location_at_kramerius msg))
+    (spit (io/file workdir "request" "payload" "is-private") (:is_private msg))
+    (spit (io/file workdir "request" "payload" "edeposit-url.txt") (:edeposit_url msg))
     (with-open [out (io/output-stream marcxml-file)]
       (.write out (Base64/decodeBase64 (:b64_marcxml msg))))

-    (let [out-dir (io/file workdir "payload" "first-page")
+    (let [out-dir (io/file workdir "request" "payload" "first-page")
           first-page (-> msg :first_page)
           ]
       (.mkdir out-dir)
@@ -57,7 +58,7 @@
       (with-open [out (io/output-stream (io/file out-dir (-> first-page :filename)))]
         (.write out (Base64/decodeBase64 (-> first-page :b64_data)))))

-    (let [out-dir (io/file workdir "payload" "original")
+    (let [out-dir (io/file workdir "request" "payload" "original")
           original (-> msg :original)
           ]
       (.mkdir out-dir)
@@ -77,8 +78,8 @@
   (.mkdir (io/file workdir "marcxml2mods" "request"))

   [{:uuid (.toString workdir)}
-   {:marc_xml (slurp (io/file workdir "payload" "oai_marc.xml"))
-    :uuid (slurp (io/file workdir "payload" "uuid"))
+   {:marc_xml (slurp (io/file workdir "request" "payload" "oai_marc.xml"))
+    :uuid (slurp (io/file workdir "request" "payload" "uuid"))
     }])

 (defn save-marcxml2mods-response
@@ -116,40 +117,17 @@

 (defn add-urnnbn-to-mods
   [[mods workdir]]
-  (let [urnnbn (slurp (io/file workdir "payload" "urnnbn"))]
+  (let [urnnbn (slurp (io/file workdir "request" "payload" "urnnbn"))]
     [(map (fn [one-mods] (m/with-urnnbn-identifier one-mods urnnbn)) mods) workdir]))

 (defn mods->oai_dcs
   [[mods workdir]]
   [(map m/mods->oai_dc mods) workdir])

-;; (defn save-img-files
-;;   [[mods_files workdir]]
-;;   (let [uuid (slurp (io/file workdir "uuid"))
-;;         slurp-img-full (comp slurp (partial io/file workdir "img_full"))
-;;         slurp-img-preview (comp slurp (partial io/file workdir "img_preview"))
-;;         ]
-;;     (.mkdir (io/file workdir uuid))
-;;     (.mkdir (io/file workdir uuid "img"))
-;;     (fs/copy (io/file workdir "img_full" (slurp-img-full "filename"))
-;;              (io/file workdir uuid "img" (slurp-img-full "filename")))
-;;     (fs/copy (io/file workdir "img_preview" (slurp-img-preview "filename"))
-;;              (io/file workdir uuid "img" (slurp-img-preview "filename")))
-;;     [{:type :img_full
-;;       :mimetype (slurp-img-full "mimetype")
-;;       :filename (slurp-img-full "filename")
-;;       }
-;;      {:type :img_preview
-;;       :mimetype (slurp-img-preview "mimetype")
-;;       :filename (slurp-img-preview "filename")
-;;       }
-;;      workdir]))
-
-
 (defn make-package-with-foxml
   [[mods mods-workdir] [oai_dcs oai-workdir] workdir]
   {:pre [(= workdir mods-workdir oai-workdir)]}
-  (let [payload-dir (io/file workdir "payload")
+  (let [payload-dir (io/file workdir "request" "payload")
         uuid (slurp (io/file payload-dir "uuid"))
         result-dir (io/file workdir uuid)
         full-file {:mimetype (slurp (io/file payload-dir "original" "mimetype"))
@@ -164,14 +142,15 @@
     (let [foxml (f/foxml mods oai_dcs full-file preview-file
                          {:uuid uuid
                           :label "ahoj"
-                          :created (t/now)
-                          :last-modified (t/now)
+                          :created (lt/local-now)
+                          :last-modified (lt/local-now)
                           })
           out-file (io/file result-dir (str uuid ".xml"))
           ]
       (spit out-file (u/emit foxml))
-      (fs/copy-dir (io/file workdir "payload" "first-page") result-dir)
-      (fs/copy (io/file workdir "payload" "edeposit-url.txt") (io/file result-dir "edeposit-url.txt"))
+      (fs/copy-dir (io/file workdir "request" "payload" "first-page") result-dir)
+      (fs/copy (io/file workdir "request" "payload" "edeposit-url.txt")
+               (io/file result-dir "edeposit-url.txt"))
       [uuid workdir])))

 (defn make-zip-package
@@ -185,9 +164,7 @@
 (defn prepare-request-for-export-to-storage
   [[zip-file uuid workdir]]

-  (.mkdir (io/file workdir "export-to-storage"))
-  (.mkdir (io/file workdir "export-to-storage" "request"))
-
+  (fs/mkdirs (io/file workdir "export-to-storage" "request"))
   (let [zip-file-b64 (io/file (str (.toString zip-file) ".b64"))]
     (with-open [out (io/output-stream zip-file-b64 )]
       (.write out (Base64/encodeBase64 (.getBytes (slurp zip-file)))))
@@ -196,9 +173,9 @@
                     :content-type "edeposit/export-to-storage-request"
                     :content-encoding "application/json"
                     :persistent true}
-          payload {:isbn (slurp (io/file workdir "payload" "isbn"))
+          payload {:isbn (slurp (io/file workdir "request" "payload" "isbn"))
                    :uuid uuid
-                   :aleph_id (slurp (io/file workdir "payload" "aleph_id"))
+                   :aleph_id (slurp (io/file workdir "request" "payload" "aleph_id"))
                    :b64_data (slurp zip-file-b64)
                    :dir_pointer ""}
           ]
@@ -207,6 +184,72 @@
       [metadata payload workdir]
       )
     )
+  )
+
+(defn save-response-from-export-to-storage
+  [metadata ^bytes payload]
+  (let [msg (json/read-str (String. payload) :key-fn keyword)
+        workdir (io/file (-> metadata :headers (get "UUID")))]
+    (if (.exists workdir)
+      (let [response-dir (io/file workdir "export-to-storage" "response")]
+        (fs/mkdirs (io/file response-dir "payload"))
+        (spit (io/file response-dir "metadata.clj") (s/serialize metadata s/clojure-content-type))
+        (io/copy payload (io/file response-dir "payload.bin"))
+        [msg workdir])
+      (do
+        (log/error "workdir:" (.toString workdir) "doesnot exists!")
+        [msg nil])
+      )
+    )
+  )
+
+(defn prepare-scp-to-kramerius
+  [[{:keys [dir_pointer] :as msg} workdir] & {:keys [import-mount archive-mount originals-mount]}]
+  {:pre [(some? import-mount)
+         (some? archive-mount)
+         (some? originals-mount)
+         ]}
+  (let [uuid (slurp (io/file workdir "request" "payload" "uuid"))]
+    (let [request-dir (io/file workdir "scp-to-kramerius" "request")
+          foxml-fname (str uuid ".xml")]
+      (fs/mkdirs request-dir)
+      (spit (io/file workdir "scp-to-kramerius" "dir_pointer") dir_pointer)
+      (spit (io/file request-dir "from") (.toString (io/file request-dir foxml-fname)))
+      (spit (io/file request-dir "to")
+            (str "/"
+                 (cs/join "/"
+                          (map (fn [path] (-> path
+                                             (cs/replace #"^file:" "")
+                                             (cs/replace #"^[/]+"  "")))
+                               [import-mount foxml-fname]))))
+      (let [root (-> (io/file workdir uuid foxml-fname)
+                     io/input-stream
+                     x/parse)]
+        (-> root
+            (f/update-rels archive-mount dir_pointer originals-mount)
+            u/emit
+            (io/copy (io/file request-dir foxml-fname)))
+        )
+      )
+    [workdir]
+    )
+  )
+
+(defn scp-to-kramerius
+  [[workdir] {:keys [scp]}]
+  "scp is a function: (fn [from-path to-path])"
+  (let [out-dir (io/file workdir "scp-to-kramerius" "response")
+        request-dir (io/file workdir "scp-to-kramerius" "request")
+        to-path (slurp (io/file request-dir "to"))
+        from-path (slurp (io/file request-dir "from"))
+        ]
+    (fs/mkdirs out-dir)
+    (let [result (scp from-path to-path)]
+      (spit (io/file out-dir "result") result)
+      (spit (io/file out-dir "sent") (.toString (lt/local-now)))
+      )
+    )
+  [workdir]
   )

 (defn parse-and-export [metadata ^bytes payload]


Client certificate option for Jetty adapter

--- ring-jetty-adapter/src/ring/adapter/jetty.clj
+++ ring-jetty-adapter/src/ring/adapter/jetty.clj
@@ -32,6 +32,9 @@
       (.setTruststore ssl-connector (options :truststore)))
     (when (options :trust-password)
       (.setTrustPassword ssl-connector (options :trust-password)))
+    (case (options :client-auth)
+      :need (.setNeedClientAuth ssl-connector true)
+      :want (.setWantClientAuth ssl-connector true))
     (.addConnector server ssl-connector)))

 (defn- create-server
@@ -61,7 +64,9 @@
   :key-password - the password to the keystore
   :truststore   - a truststore to use for SSL connections
   :trust-password - the password to the truststore
-  :max-threads  - the maximum number of threads to use (default 250)"
+  :max-threads  - the maximum number of threads to use (default 250)
+  :client-auth  - SSL client certificate authenticate, may be set to :need,
+                  :want or :none (defaults to :none)"
   [handler options]
   (let [^Server s (create-server (dissoc options :configurator))]
     (when-let [configurator (:configurator options)]


Remove destructuring

Remove destructuring

--- resources/platformer/utils.clj
+++ resources/platformer/utils.clj
@@ -47,12 +47,12 @@
     (:y-velocity entity)))

 (defn get-direction
-  [{:keys [x-velocity direction]}]
+  [entity]
   (cond
-    (> x-velocity 0) :right
-    (< x-velocity 0) :left
+    (> (:x-velocity entity) 0) :right
+    (< (:x-velocity entity) 0) :left
     :else
-    direction))
+    (:direction entity)))

 (defn get-touching-tile
   [screen entity & layer-names]


obfuscate code!

obfuscate code!

--- clojure/src/yatzy_clj/yatzy.clj
+++ clojure/src/yatzy_clj/yatzy.clj
@@ -95,14 +95,46 @@
                  )]
     (if (= nil result) 0 result)))

+;int score = 0;
+;for (int i = 0; i < 6; i += 1)
+;         if (counts[6-i-1] >= 2) {
+;                n++;
+;                score += (6-i);
+;         }
+;if (n == 2)
+;  return score * 2;
+;else
+;  return 0;
+
 (defn two-pair [dice]
-  (let [tallies (tally-die dice)
-        result (->> (range 0 6)
-                    (filter #(>= (nth tallies (- 6 % 1)) 2))
-                    (map #(- 6 %))
-                    (reduce +)
-                    (* 2))]
-    (if (= nil result) 0 result)))
+  (let [counts (tally-die dice)
+        values (remove nil?
+                       (for [i (range 0 6)]
+                         (if (>= (nth counts (- 6 i 1)) 2)
+                           (- 6 i)
+                           nil
+                           )
+                         )
+                       )
+        score (reduce + values)
+        n (count values)]
+    (if (= n 2)
+      (* score 2)
+      0
+      )
+    )
+  )
+
+
+
+;(defn two-pair [dice]
+;  (let [tallies (tally-die dice)
+;        result (->> (range 0 6)
+;                    (filter #(>= (nth tallies (- 6 % 1)) 2))
+;                    (map #(- 6 %))
+;                    (reduce +)
+;                    (* 2))]
+;    (if (= nil result) 0 result)))

 (defn four-of-a-kind [dice]
   (let [tallies (tally-die dice)
@@ -122,7 +154,8 @@
   )

 (defn three-of-a-kind [dice]
-  (let [t (tally-die dice)
+  (let [t (for [i (range 1 7)]
+            (apply + (for [die dice] (if (= die i) 1 0))))
         result (first
                  (remove nil?
                          (for [i (range 0 6)]


Correct requirement to detect same speed or not

--- src/re_natal_esp32control_app/views/ble_control/common.cljs
+++ src/re_natal_esp32control_app/views/ble_control/common.cljs
@@ -16,7 +16,7 @@
   (and (= (:lf speed1) (:lf speed2))
        (= (:lb speed1) (:lb speed2))
        (= (:rf speed1) (:rf speed2))
-       (= (:lb speed1) (:lb speed2))))
+       (= (:rb speed1) (:rb speed2))))

 (defn send-speed []
   (let [speed (subscribe [:speed])


Adapt tests for last ns name change.

Adapt tests for last ns name change.

--- test/nanomsg_tests.clj
+++ test/nanomsg_tests.clj
@@ -1,5 +1,5 @@
 (ns nanomsg-tests
-  (:require [nanomsg :as nn]
+  (:require [nanomsg.core :as nn]
             [nanomsg.async :as nna]
             [clojure.core.async :refer [<! >! go put! take!]]
             [clojure.test :refer :all]))


Add source file and line to deprecation notices

--- src/riemann/common.clj
+++ src/riemann/common.clj
@@ -29,7 +29,9 @@
   "Wraps body in an implicit (do), and logs a deprecation notice when invoked."
   [comment & body]
   `(do
-     (info ~(str "Deprecated: " comment))
+     (info ~(str "Deprecated: "
+                 (format "<%s:%s> " *file* (:line (meta &form)))
+                 comment))
      ~@body))

 (def hostname-refresh-interval


Revert "match wbid without get to case"

Revert "match wbid without get to case"

This reverts commit 8315a2f9e7cf229f9f47f1e338b9a20921f7a18b.

--- src/wb_es/web/core.clj
+++ src/wb_es/web/core.clj
@@ -4,13 +4,7 @@

 (defn wrap-query-lower-case [handler]
   (fn [request]
-    (let [q-raw (get-in request [:params :q])
-          new-request (-> request
-                          (update-in [:params :q] #(some-> % clojure.string/lower-case))
-                          (assoc-in [:params :q_raw] q-raw)
-                          )]
-      (handler new-request))
-    ))
+    (handler (update-in request [:params :q] #(some-> % clojure.string/lower-case)))))

 (defn get-filter [options]
@@ -35,7 +29,7 @@
                  {:bool
                   {:must [{:bool {:filter (get-filter options)}}
                           {:dis_max
-                           {:queries [{:term {:wbid (:q_raw options)}}
+                           {:queries [{:term {:wbid q}}
                                       {:match_phrase {:label {:query q
                                                               :minimum_should_match "70%"}}}
                                       {:match_phrase {:other_names {:query q
@@ -125,7 +119,7 @@
                  {:bool
                   {:must [{:bool {:filter (get-filter options)}}
                           {:dis_max
-                           {:queries [{:term {:wbid (:q_raw options)}}
+                           {:queries [{:term {:wbid q}}
                                       {:match_phrase {:label {:query q
                                                               :minimum_should_match "70%"}}}
                                       {:match_phrase {:other_names {:query q


Fixed constant-pair counting problems.

Fixed constant-pair counting problems.

--- src/zprint/zprint.cljc
+++ src/zprint/zprint.cljc
@@ -546,6 +546,15 @@
   [style-vec]
   (let [[s color what] (first style-vec)]
     (or (= what :newline) (= what :indent))))
+
+(defn prepend-nl
+  "Given an indent ind and a style-vec coll, place a newline (actually an
+  indent) at the front of coll.  If the first thing in coll is a newline,
+  then don't add any spaces after the newline that we prepend."
+  [options ind coll]
+  (concat-no-nil [[(str "\n" (blanks (if (first-nl? coll) 0 ind))) :none :indent
+                   1]]
+                 coll))

 ; Debugging help to find differences between line-lengths and
 ; line-lengths-iter.  Surprisingly helpful!
@@ -1844,51 +1853,77 @@
   of the ones we skip so the count is right in the end.  We don't
   expect any whitespace in this, because this seq should have been
   produced by zmap-right or its equivalent, which already skips the
-  whitespace."
-  [seq-right]
-  (loop [seq-right-rev (reverse seq-right)
+  whitespace.  Returns two things: [paired-item-count actual-paired-items],
+  where paired-item-count is the number of things from the end of
+  the seq you have to trim off to get the constant pairs included,
+  and the actual-paired-items is the count of the items to be checked
+  against the constant-pair-min (which is exclusive of comments and
+  newlines).  "
+  [zloc-seq]
+  (loop [zloc-seq-rev (reverse zloc-seq)
          element-count 0
-         ; since it is reversed, we need a constant second
+         paired-element-count 0
+         ; since it is reversed, we need a constant every second element
          constant-required? nil
-         pair-size 0]
-    (let [element (first seq-right-rev)]
-      (if (empty? seq-right-rev)
+         pair-size 0
+         actual-pair-size 0]
+    (let [element (first zloc-seq-rev)]
+      #_(prn "count-constant-pairs: element-count:" element-count
+           "paired-element-count:" paired-element-count
+	   "constant-required:" constant-required?
+	   "pair-size:" pair-size
+	   "actual-pair-size:" actual-pair-size
+	   "element:" (zstring element))
+      (if (empty? zloc-seq-rev)
         ; remove potential elements of this pair, since we haven't
         ; seen the end of it, and return
-        (- element-count pair-size)
+        [(- element-count pair-size) (- paired-element-count actual-pair-size)]
         (let [comment-or-newline? (zcomment-or-newline? element)]
           (if (and (not comment-or-newline?)
                    constant-required?
                    (not (zconstant? element)))
             ; we counted the right-hand and any comments of this pair, but it
             ; isn't a pair so exit now with whatever we have so far
-            (- element-count pair-size)
-            (recur (next seq-right-rev)
+            [(- element-count pair-size)
+             (- paired-element-count actual-pair-size)]
+            (recur (next zloc-seq-rev)
                    (inc element-count)
+                   (if comment-or-newline?
+                     paired-element-count
+                     (inc paired-element-count))
                    (if comment-or-newline?
                      constant-required?
                      (not constant-required?))
                    (if (and constant-required? (not comment-or-newline?))
                      ; must be a constant, so start count over
                      0
-                     (inc pair-size)))))))))
+                     (inc pair-size))
+                   (if (and constant-required? (not comment-or-newline?))
+                     ; start count of actual pairs over as well
+                     0
+                     (if comment-or-newline?
+                       ; we are only counting actual pairs here
+                       actual-pair-size
+                       (inc actual-pair-size))))))))))

 (defn constant-pair
   "Argument is a zloc-seq.  Output is a [pair-seq non-paired-item-count],
   if any.  If there are no pair-seqs, pair-seq must be nil, not an
-  empty seq.  This will largely ignore newlines."
+  empty seq.  This will largely ignore newlines and comments."
   [caller {{:keys [constant-pair? constant-pair-min]} caller, :as options}
-   seq-right]
+   zloc-seq]
   (if constant-pair?
-    (let [paired-item-count (count-constant-pairs seq-right)
-          non-paired-item-count (- (count seq-right) paired-item-count)
+    (let [[paired-item-count actual-paired-items] (count-constant-pairs zloc-seq)
+          non-paired-item-count (- (count zloc-seq) paired-item-count)
           _ (dbg options
                  "constant-pair: non-paired-items:"
-                 non-paired-item-count)
-          pair-seq (when (>= paired-item-count constant-pair-min)
-                     (drop non-paired-item-count seq-right))]
+                 non-paired-item-count
+		 "paired-item-count:" paired-item-count
+		 "actual-paired-items:" actual-paired-items)
+          pair-seq (when (>= actual-paired-items constant-pair-min)
+                     (drop non-paired-item-count zloc-seq))]
       [pair-seq non-paired-item-count])
-    [nil (count seq-right)]))
+    [nil (count zloc-seq)]))

 ;;
 ;; # Take into account constant pairs


Remove empty link and create link from draft board in org response.

--- src/oc/storage/representations/board.clj
+++ src/oc/storage/representations/board.clj
@@ -70,11 +70,12 @@
   (let [board-slug (:slug board)
         options (if (zero? draft-count) {} {:count draft-count})
         is-draft-board? (= board-slug "drafts")
-        links [(self-link org-slug board-slug :recently-posted options)
-               (when-not is-draft-board?
-                 (self-link org-slug board-slug :recent-activity options))]
-        full-links (if (or (= :author (:access-level board))
-                           is-draft-board?)
+        links (remove nil?
+               [(self-link org-slug board-slug :recently-posted options)
+                (when-not is-draft-board?
+                  (self-link org-slug board-slug :recent-activity options))])
+        full-links (if (and (= :author (:access-level board))
+                            (not is-draft-board?))
           ;; Author gets create link
           (conj links (create-entry-link org-slug board-slug))
           ;; No create link


Removes surplus require

Removes surplus require

--- src/pasmo_gigi/geo/ui/map/map_views.cljs
+++ src/pasmo_gigi/geo/ui/map/map_views.cljs
@@ -1,21 +1,9 @@
 (ns pasmo-gigi.geo.ui.map.map-views
   (:require [re-frame.core :refer [subscribe dispatch]]
             [reagent.core :as r]
-            [goog.object :as gob]
             [pasmo-gigi.geo.ui.db :refer [settings]]))

 (def FEATURE-LAYER (r/atom nil))
-
-#_(defn render-map
-  []
-  (let [mapbox-api        (:mapbox-api @settings)
-        mapbox-prop       (gob/get mapbox-api "mapbox")
-        map-el            (.map mapbox-prop  "map" "uris77.nd0o07dd")
-        feature-layer-obj ((gob/get mapbox-prop "featureLayer"))
-        add-to-fn         (gob/get feature-layer-obj "addTo")
-        feature-layer     (.apply add-to-fn feature-layer-obj (array map-el))]
-    (reset! FEATURE-LAYER feature-layer)
-    (.log js/console "FEATURE_LAYER: " @FEATURE-LAYER)))

 (defn render-map
   []
@@ -23,8 +11,7 @@
         feature-layer (.addTo (-> js/L
                                   .-mapbox
                                   .featureLayer) map-el)]
-    (reset! FEATURE-LAYER feature-layer)
-    (.log js/console "FEATURE_LAYER: " @FEATURE-LAYER)))
+    (reset! FEATURE-LAYER feature-layer)))

 (defn map-coords
   [coords]


(PDB-3374) Don't use fs in exported resources test

--- test/puppetlabs/puppetdb/integration/exported_resources.clj
+++ test/puppetlabs/puppetdb/integration/exported_resources.clj
@@ -1,17 +1,16 @@
 (ns puppetlabs.puppetdb.integration.exported-resources
   (:require [clojure.test :refer :all]
             [puppetlabs.puppetdb.integration.fixtures :as int]
-            [me.raynes.fs :as fs]))
-
-(defn manifest-for [certname]
-  (str "@@notify { 'Hello from " certname "': }\n"
-       "Notify <<| |>>"))
+            [slingshot.test]))

 (deftest ^:integration basic-collection
   (with-open [pg (int/setup-postgres)
               pdb (int/run-puppetdb pg {})
               ps (int/run-puppet-server [pdb] {})]
-    (let [agents ["agent-1" "agent-2"]]
+    (let [agents ["agent-1" "agent-2"]
+          manifest-for (fn manifest-for [certname]
+                         (str "@@notify { 'Hello from " certname "': }\n"
+                              "Notify <<| |>>"))]
       (testing "Run with an exported resource first"
         (doseq [agent agents]
           (int/run-puppet-as agent ps pdb (manifest-for agent))))
@@ -37,8 +36,6 @@
                            (re-find #"duplicate resource was found while collecting exported resources"
                                     (get-in % [:result :err])))
                       (int/run-puppet-as "collector" ps pdb "Notify <<| title == 'DUPE NOTIFY' |>>")))))))
-
-

 (deftest ^:integration deactivated-nodes
   (with-open [pg (int/setup-postgres)
@@ -72,109 +69,60 @@
   (with-open [pg (int/setup-postgres)
               pdb (int/run-puppetdb pg {})
               ps (int/run-puppet-server [pdb] {})]
-    (let [temp-dir (fs/temp-dir "collections-with-queries")
-          test-collection (fn test-collection [manifest files-to-check]
-                            (fs/delete-dir temp-dir)
-                            (fs/mkdir temp-dir)
-                            (int/run-puppet-as "collector" ps pdb manifest)
-                            (doseq [f files-to-check]
-                              (is (fs/exists? (str temp-dir "/" f)))))]
+    (let [test-collection (fn test-collection [manifest regexes-to-check]
+                            (let [{:keys [out]} (int/run-puppet-as "collector" ps pdb manifest)]
+                              (doseq [r regexes-to-check]
+                                (is (re-find r out)))))]

       (testing "Run puppet to create resources for collection"
         (int/run-puppet-as "exporter" ps pdb
-                           (str "@@file { '" temp-dir "/file-a':"
-                                "  ensure  => present,"
-                                "  mode    => '0777',"
-                                "  content => 'foo'"
-                                "}"
-                                "@@file { '" temp-dir "/file-b':"
-                                "  ensure  => present,"
-                                "  mode    => '0755',"
-                                "  content => 'bar'"
-                                "}"
-                                "@@file { '" temp-dir "/file-c':"
-                                "  ensure  => present,"
-                                "  mode    => '0744',"
-                                "  content => 'foo',"
-                                "}"
-                                "@@file { '" temp-dir "/file-d':"
-                                "  ensure  => present,"
-                                "  mode    => '0744',"
-                                "  content => 'bar'"
-                                "}")))
+                           (str "@@notify { 'message-a': name => 'a', tag => 'here' }"
+                                "@@notify { 'message-b': name => 'b', tag => 'there' }"
+                                "@@notify { 'message-c': name => 'c', tag => ['here', 'there'] }"
+                                "@@notify { 'message-d': name => 'd' }")))

       (testing "= query"
-        (test-collection "File <<| mode == '0744' |>>"
-                         ["file-c" "file-d"]))
+        (test-collection "Notify <<| name == 'a' |>>"
+                         [#"message-a"]))

       (testing "!= query"
-        (test-collection "File <<| mode != '0755' |>>"
-                         ["file-a" "file-c" "file-d"]))
+        (test-collection "Notify <<| name != 'a' |>>"
+                         [#"message-b" #"message-c" #"message-d"]))

       (testing "'or' query"
-        (test-collection "File <<| mode == '0755' or content == 'bar' |>>"
-                         ["file-b" "file-d"]))
+        (test-collection "Notify <<| name == 'a' or name == 'b' |>>"
+                         [#"message-a" #"message-b"]))

       (testing "'and' query"
-        (test-collection "File <<| mode == '0744' and content == 'foo' |>> "
-                         ["file-c"]))
+        (test-collection "Notify <<| title == 'message-a' and name == 'a' |>> "
+                         [#"message-a"]))

       (testing "nested query"
-        (test-collection "File <<| (mode == '0777' or mode == '0755') and content == 'bar' |>>"
-                         ["file-b"])))))
-
-(deftest ^:integration non-parameter-queries
-  (with-open [pg (int/setup-postgres)
-              pdb (int/run-puppetdb pg {})
-              ps (int/run-puppet-server [pdb] {})]
-    (let [temp-dir (fs/temp-dir "non-parameter-queries")
-          test-collection (fn test-collection [manifest files-to-check]
-                            (fs/delete-dir temp-dir)
-                            (fs/mkdir temp-dir)
-                            (int/run-puppet-as "collector" ps pdb manifest)
-                            (doseq [f files-to-check]
-                              (is (fs/exists? (str temp-dir "/" f)))))]
-
-      (testing "Run puppet to create resources for collection"
-        (int/run-puppet-as "exporter" ps pdb
-                           (str "@@file { 'file-a':"
-                                "  path   => '" temp-dir "/file-a',"
-                                "  ensure => present,"
-                                "  tag    => 'here',"
-                                "}"
-
-                                "@@file { 'file-b':"
-                                "  path   => '" temp-dir "/file-b',"
-                                "  ensure => present,"
-                                "  tag    => ['here', 'there'],"
-                                "}"
-
-                                "@@file { 'file-c':"
-                                "  path   => '" temp-dir "/file-c',"
-                                "  ensure => present,"
-                                "  tag    => ['there'],"
-                                "}")))
+        (test-collection (str "Notify <<| (title == 'message-a' or title == 'message-b') and "
+                              "           (name == 'a' or name == 'b') |>>")
+                         [#"message-a" #"message-b"]))

       (testing "title query"
-        (test-collection "File <<| title == 'file-c' |>>"
-                         ["file-c"]))
+        (test-collection "Notify <<| title == 'message-a' |>>"
+                         [#"message-a"]))

       (testing "title query when nothing matches"
-        (test-collection "File <<| title == 'file' |>>"
+        (test-collection "Notify <<| title == 'message-q' |>>"
                          []))

       (testing "title query with uri-invalid characters"
-        (test-collection "File <<| title != 'a string with spaces and & and ? in it' |>>"
-                         ["file-a" "file-b" "file-c"]))
+        (test-collection "Notify <<| title != 'a string with spaces and & and ? in it' |>>"
+                         [#"message-a" #"message-b" #"message-c" #"message-d"]))

       (testing "tag query"
-        (test-collection "File <<| tag == 'here'|>> "
-                         ["file-a" "file-b"]))
+        (test-collection "Notify <<| tag == 'here'|>> "
+                         [#"message-a" #"message-c"]))

       (testing "inverse tag query"
-        (test-collection "File <<| tag != 'here'|>> "
-                         ["file-c"]))
+        (test-collection "Notify <<| tag != 'here'|>> "
+                         [#"message-b" #"message-d"]))

       (testing "tag queries should be case-insensitive"
-        (test-collection "File <<| tag == 'HERE'|>> "
-                         ["file-a" "file-b"])))))
+        (test-collection "Notify <<| tag == 'HERE'|>> "
+                         [#"message-a" #"message-c"])))))
+


wip on setting marks on participants

wip on setting marks on participants

--- src/tango/cljs/adjudicator/mutation.cljs
+++ src/tango/cljs/adjudicator/mutation.cljs
@@ -57,12 +57,13 @@
              (log result)
              (let [q
                    (d/transact! state [{:db/id              -1
-                                        :result/id (:result/id result)
+                                        ;:result/id (:result/id result)
                                         :result/mark-x      mark-x
                                         :result/participant [:participant/id (:result/participant result)]
                                         :result/activity [:activity/id (:result/activity result)]
                                         :result/adjudicator [:adjudicator/id (:result/adjudicator result)]}
                                        {:app/id 1 :app/results -1}
                                        ])]
-               (log q)))})
+               (log q)))
+   :remote true})


Improved impl of ruler.

Improved impl of ruler.

--- src/uxbox/ui/workspace/canvas/ruler.cljs
+++ src/uxbox/ui/workspace/canvas/ruler.cljs
@@ -13,82 +13,91 @@
             [uxbox.ui.mixins :as mx]
             [uxbox.ui.dom :as dom]))

-;; FIXME: clear & refactor (this is a first quick & dirty impl)
-
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Component
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

-(defn- distance
-  [[x1 y1] [x2 y2]]
-  (let [dx (- x1 x2)
-        dy (- y1 y2)]
-    (-> (mth/sqrt (+ (mth/pow dx 2) (mth/pow dy 2)))
-        (mth/precision 2))))
+(defn- resolve-position
+  [own [x y]]
+  (let [overlay (mx/get-ref-dom own "overlay")
+        brect (.getBoundingClientRect overlay)]
+    [(- x (.-left brect))
+     (- y (.-top brect))]))

 (defn- get-position
   [own event]
   (let [x (.-clientX event)
-        y (.-clientY event)
-        overlay (mx/get-ref-dom own "overlay")
-        brect (.getBoundingClientRect overlay)]
-    [(- x (.-left brect))
-     (- y (.-top brect))]))
+        y (.-clientY event)]
+    (resolve-position own [x y])))

 (defn- on-mouse-down
   [own local event]
   (dom/stop-propagation event)
   (let [pos (get-position own event)]
-    (swap! local assoc
-           :active true
-           :pos1 pos
-           :pos2 pos)))
+    (reset! local {:active true :pos1 pos :pos2 pos})))

 (defn- on-mouse-up
   [own local event]
   (dom/stop-propagation event)
-  (swap! local assoc
-         :active false
-         :pos1 nil
-         :pos2 nil))
+  (reset! local {:active false}))

-(defn- on-mouse-move
-  [own local event]
-  (when (:active @local)
-    (let [pos (get-position own event)]
-      (swap! local assoc :pos2 pos))))
-
-(defn overlay-render
-  [own]
-  (let [local (:rum/local own)
-        [x1 y1 :as p1] (:pos1 @local)
+(defn- overlay-render
+  [own local]
+  (let [[x1 y1 :as p1] (:pos1 @local)
         [x2 y2 :as p2] (:pos2 @local)
-        distance (distance p1 p2)]
+        distance (mth/distance p1 p2)]
     (html
      [:svg {:on-mouse-down #(on-mouse-down own local %)
             :on-mouse-up #(on-mouse-up own local %)
-            :on-mouse-move #(on-mouse-move own local %)
             :ref "overlay"}
       [:rect {:style {:fill "transparent" :stroke "transparent" :cursor "cell"}
               :width wb/viewport-width
               :height wb/viewport-height}]
       (if (and (:active @local) x1 x2)
-        [:g
-         [:line {:x1 x1
-                 :y1 y1
-                 :x2 x2
-                 :y2 y2
-                 :style {:cursor "cell"}
-                 :stroke-width "2"
-                 :stroke "red"}]
-         [:text {:x (+ x2 15) :y y2}
-          [:tspan (str distance)]]])])))
+          [:g
+           [:line {:x1 x1 :y1 y1 :x2 x2 :y2 y2
+                   :style {:cursor "cell"}
+                   :stroke-width "2"
+                   :stroke "red"}]
+           [:text {:x (+ x2 15) :y y2}
+            [:tspan (str distance)]]])])))
+
+(defn- overlay-will-mount
+  [own local]
+  (letfn [(on-value [pos]
+            (swap! local assoc :pos2 pos))]
+    (as-> wb/mouse-absolute-s $
+      (rx/dedupe $)
+      (rx/filter #(:active @local) $)
+      (rx/map #(resolve-position own %) $)
+      (rx/on-value $ on-value)
+      (assoc own ::sub $))))
+
+(defn- overlay-will-unmount
+  [own]
+  (let [subscription (::sub own)]
+    (subscription)
+    (dissoc own ::sub)))
+
+(defn- overlay-transfer-state
+  [old-own own]
+  (let [sub (::sub old-own)]
+    (assoc own ::sub sub)))
+
+(def ^:static overlay
+  (mx/component
+   {:render #(overlay-render % (:rum/local %))
+    :will-mount #(overlay-will-mount % (:rum/local %))
+    :will-unmount overlay-will-unmount
+    :transfer-state overlay-transfer-state
+    :name "overlay"
+    :mixins [mx/static (mx/local)]}))

 (defn- ruler-render
   [own]
   (let [flags (rum/react wb/flags-l)]
     (when (contains? flags :workspace/ruler)
-      (overlay-render own))))
+      (overlay))))

 (def ^:static ruler
   (mx/component


Updated JRuby version to 9.3.3.0 for support of Apple M1 chip.

--- orbits-lib/project.clj
+++ orbits-lib/project.clj
@@ -1,7 +1,7 @@
 (def jruby-version
   "The version of JRuby to use. This is the same as used in the collection renderer
    java package to prevent classpath issues"
-  "9.2.6.0")
+  "9.3.3.0")

 (def dev-gem-install-path
   "The directory within this library where Ruby gems are installed for development time dependencies."


Version 0.6.0

Version 0.6.0

--- metlog-vault/project.clj
+++ metlog-vault/project.clj
@@ -1,4 +1,4 @@
-(defproject metlog-vault "0.6.0-SNAPSHOT"
+(defproject metlog-vault "0.6.0"
   :description "Repository for storing and displaying time series data reported by metlog-agent.."

   :license {:name "Eclipse Public License"


more shader cleanup

more shader cleanup

--- src/splash/core.cljs
+++ src/splash/core.cljs
@@ -98,10 +98,7 @@
 uniform sampler2D uSampler;
 uniform float time;

-float hash2(vec2 uv) {
-    return fract(sin(uv.x * 15.78 + uv.y * 35.14) * 43758.23);
-}
-
+// hue,saturation,value -> red,green,blue
 vec3 hsv2rgb(vec3 c)
 {
     vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
@@ -109,6 +106,7 @@
     return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
 }

+// shader mainline
 void main( void ) {
     vec4 col = texture2D(uSampler, vTextureCoord);


Rename worker to cache

Rename worker to cache

--- src/useful/state.clj
+++ src/useful/state.clj
@@ -99,10 +99,10 @@
    than the duration you specified."
     [f duration]
     (let [{:keys [unit num]} duration
-          worker (agent {:ready false})
+          cache (agent {:ready false})
           task (delay (.scheduleAtFixedRate executor
                                             (fn []
-                                              (send worker
+                                              (send cache
                                                     (fn [_]
                                                       {:ready true
                                                        :value (f)})))
@@ -111,10 +111,10 @@
       (fn
         ([]
            (do (get-ready)
-               (:value (wait-until worker :ready))))
+               (:value (wait-until cache :ready))))
         ([not-found]
            (do (get-ready)
-               (let [{:keys [ready value]} @worker]
+               (let [{:keys [ready value]} @cache]
                  (if ready
                    value
                    not-found))))))))


Add refer-clojure to avoid 1.9 compilation warning

--- src/yada/boolean.clj
+++ src/yada/boolean.clj
@@ -1,6 +1,7 @@
 ;; Copyright © 2015, JUXT LTD.

 (ns yada.boolean
+  (:refer-clojure :exclude [boolean?])
   (:require
    [schema.core :as s]))

@@ -29,4 +30,3 @@
    boolean? s/Bool
    vector? CompositeExpression
    :else s/Any))
-


Charsets now comparable

Charsets now comparable

Needed by json-html rendering

--- src/yada/charset.clj
+++ src/yada/charset.clj
@@ -38,7 +38,9 @@
   Charset
   (charset [_] alias)
   (canonical-name [_] (get alias->name (.toUpperCase alias)))
-  (preferred-alias [this] (name->alias (canonical-name this))))
+  (preferred-alias [this] (name->alias (canonical-name this)))
+  Comparable
+  (compareTo [this other] (. (java.text.Collator/getInstance) compare (:alias this) (:alias other))))

 (def charset-pattern
   (re-pattern (str "(" http-token ")"


(TK-339) add test for restarting if stop timeout expires

--- test/clj/puppetlabs/trapperkeeper/services/webserver/jetty9_service_test.clj
+++ test/clj/puppetlabs/trapperkeeper/services/webserver/jetty9_service_test.clj
@@ -712,7 +712,34 @@
           (let [response (http-client-common/get async-client "http://localhost:8080/hello" {:as :text})]
             @in-request-handler
             (tk-app/stop app)
-            (is (not (nil? (:error @response))))))))))
+            (is (not (nil? (:error @response)))))))))
+
+  (testing "tk app can still restart even if stop timeout expires"
+    (let [in-request-handler (promise)
+          sleepy-service (tk-core/service
+                          [[:WebserverService add-ring-handler]]
+                          (init [this context]
+                                (add-ring-handler
+                                 (fn [_]
+                                   (deliver in-request-handler true)
+                                   (Thread/sleep 2000)
+                                   {:status 200 :body hello-body})
+                                 hello-path)
+                                context))]
+      (with-test-logging
+       (with-app-with-config
+         app
+         [jetty9-service
+          sleepy-service]
+         {:webserver {:port 8080 :shutdown-timeout-seconds 1}}
+         (with-open [async-client (async/create-client {})]
+           (let [response (http-client-common/get async-client "http://localhost:8080/hi_world" {:as :text})]
+             @in-request-handler
+             (tk-app/restart app)
+             (is (not (nil? (:error @response)))))
+           (let [response (http-client-common/get async-client "http://localhost:8080/hi_world" {:as :text})]
+             (is (= 200 (:status @response)))
+             (is (= hello-body (:body @response))))))))))

 (deftest warn-if-sslv3-supported-test
   (letfn [(start-server [ssl-protocols]


(SERVER-1741) Update tests for varying --gzip etag suffix

--- test/integration/puppetlabs/services/master/environment_classes_int_test.clj
+++ test/integration/puppetlabs/services/master/environment_classes_int_test.clj
@@ -73,6 +73,16 @@
 (defn response-etag
   [request]
   (get-in request [:headers "etag"]))
+
+(defn etag-with-gzip-suffix
+  [etag]
+  (if (.endsWith etag "--gzip")
+    etag
+    (str etag "--gzip")))
+
+(defn etag-without-gzip-suffix
+  [etag]
+  (str/replace etag #"--gzip$" ""))

 (defn response->class-info-map
   [response]
@@ -160,12 +170,8 @@
                                         "name" "production"}
              initial-response (get-env-classes "production")
              initial-etag (response-etag initial-response)
-             initial-etag-with-gzip-suffix (if (.endsWith initial-etag "--gzip")
-                                             initial-etag
-                                             (str initial-etag "--gzip"))
-             initial-etag-without-gzip-suffix (str/replace initial-etag
-                                                           #"--gzip$"
-                                                           "")]
+             initial-etag-with-gzip-suffix (etag-with-gzip-suffix initial-etag)
+             initial-etag-without-gzip-suffix (etag-without-gzip-suffix initial-etag)]
          (testing "initial fetch of environment_classes info is good"
            (is (= 200 (:status initial-response))
                (str
@@ -319,8 +325,11 @@
                                                     "test")
                  production-response-initial (get-env-classes "production")
                  production-etag-initial (response-etag production-response-initial)
+                 production-etag-initial-without-gzip-suffix (etag-without-gzip-suffix production-etag-initial)
                  test-response-initial (get-env-classes "test")
-                 test-etag-initial (response-etag test-response-initial)]
+                 test-etag-initial (response-etag test-response-initial)
+                 test-etag-initial-without-gzip-suffix (etag-without-gzip-suffix
+                                                         (response-etag test-response-initial))]
              (is (= 200 (:status production-response-initial))
                  (str
                   "unexpected status code for initial production response"
@@ -365,8 +374,8 @@
                    (str
                     "unexpected status code for prod response after code change "
                     "but before flush"))
-               (is (= production-etag-initial (response-etag
-                                               production-response-before-flush))
+               (is (= production-etag-initial-without-gzip-suffix (response-etag
+                                                                    production-response-before-flush))
                    "unexpected etag change when no production environment change")
                (is (empty? (:body production-response-before-flush))
                    "unexpected body for production response")
@@ -374,8 +383,8 @@
                    (str
                     "unexpected status code for test response after code change "
                     "but before flush"))
-               (is (= test-etag-initial (response-etag
-                                         test-response-before-flush))
+               (is (= test-etag-initial-without-gzip-suffix (response-etag
+                                                              test-response-before-flush))
                    "unexpected etag change when no test environment change")
                (is (empty? (:body test-response-before-flush))
                    "unexpected body for test response")
@@ -412,8 +421,8 @@
                      (str
                       "unexpected status code for test response after code change "
                       "but test environment not invalidated"))
-                 (is (= test-etag-initial (response-etag
-                                           test-response-after-prod-flush))
+                 (is (= test-etag-initial-without-gzip-suffix (response-etag
+                                                                test-response-after-prod-flush))
                      "unexpected etag change when test environment not invalidated")
                  (is (empty? (:body test-response-after-prod-flush))
                      "unexpected body for test response")))))


Continue test.

Continue test.

--- test/onyx/coordinator/multi_job_test.clj
+++ test/onyx/coordinator/multi_job_test.clj
@@ -72,14 +72,14 @@
         (extensions/on-change sync payload-node-b-1 #(>!! sync-spy-b %))

         (>!! (:born-peer-ch-head coordinator) peer-node-a)
-        (>!! (:born-peer-ch-head coordinator) peer-node-b)
-
-        (<!! offer-ch-spy)
         (<!! offer-ch-spy)

         (>!! (:planning-ch-head coordinator) {:catalog catalog-a :workflow workflow-a})
+        (<!! offer-ch-spy)
+
+        (>!! (:born-peer-ch-head coordinator) peer-node-b)
+        (<!! offer-ch-spy)

-        (<!! offer-ch-spy)
         (<!! sync-spy-a)
         (<!! sync-spy-b)

@@ -114,7 +114,51 @@
           (<!! ack-ch-spy)

           (<!! status-spy)
-          (<!! status-spy))))
+          (<!! status-spy)
+
+          (>!! (:planning-ch-head coordinator) {:catalog catalog-b :workflow workflow-b})
+          (<!! offer-ch-spy)
+
+          (extensions/write-place sync peer-node-a payload-node-a-2)
+          (extensions/on-change sync payload-node-a-2 #(>!! sync-spy-a %))
+          (extensions/touch-place sync (:completion (:nodes payload-a))))
+
+        (<!! offer-ch-spy)
+        (<!! sync-spy-a)
+
+        (let [payload-a (extensions/read-place sync payload-node-a-2)]
+          (testing "Payload A is for job B"
+            (let [db (d/db (:conn log))
+                  query '[:find ?job :in $ ?task ?catalog :where
+                          [?job :job/task ?task]
+                          [?job :job/catalog ?catalog]]
+                  result (d/q query db (:db/id (:task payload-a)) (pr-str catalog-b))
+                  jobs (map first result)]
+              (is (= (count jobs) 1))))
+
+          (extensions/on-change sync (:status (:nodes payload-a)) #(>!! status-spy %))
+          (extensions/touch-place sync (:ack (:nodes payload-a)))
+
+          (<!! ack-ch-spy)
+          (<!! status-spy))
+
+        (let [payload-b (extensions/read-place sync payload-node-b-1)]
+          (extensions/write-place sync peer-node-b payload-node-b-2)
+          (extensions/on-change sync payload-node-b-2 #(>!! sync-spy-b %))
+          (extensions/touch-place sync (:completion (:nodes payload-b)))
+
+          (<!! offer-ch-spy)
+          (<!! sync-spy-b))
+
+        (let [payload-b (extensions/read-place sync payload-node-b-2)]
+          (testing "Payload B is for job A"
+            (let [db (d/db (:conn log))
+                  query '[:find ?job :in $ ?task ?catalog :where
+                          [?job :job/task ?task]
+                          [?job :job/catalog ?catalog]]
+                  result (d/q query db (:db/id (:task payload-b)) (pr-str catalog-a))
+                  jobs (map first result)]
+              (is (= (count jobs) 1)))))))

     {:eviction-delay 50000}))


Add -A/--add-asset, -R/--add-resource, -S/--add-source options to sift task (fixes #212)

--- boot/core/src/boot/task/built_in.clj
+++ boot/core/src/boot/task/built_in.clj
@@ -314,6 +314,10 @@
   files into resource files, for example, etc. If --invert is also specified
   the transformation is done to paths that DO NOT match.

+  The --add-asset, --add-resource, and --add-source options add the contents
+  of a directory to the fileset as assets, resources, or sources, respectively.
+  The --invert option has no effect on these options.
+
   The --add-jar option extracts the contents of a jar file on the classpath
   and adds them to the fileset. The PROJECT part of the argument specifies the
   group-id/artifact-id symbol associated with the jar, and the MATCH portion
@@ -344,6 +348,9 @@
   [a to-asset MATCH        #{regex}    "The set of regexes of paths to move to assets."
    r to-resource MATCH     #{regex}    "The set of regexes of paths to move to resources."
    s to-source MATCH       #{regex}    "The set of regexes of paths to move to sources."
+   A add-asset PATH        #{str}      "The set of directory paths to add to assets."
+   R add-resource PATH     #{str}      "The set of directory paths to add to resources."
+   S add-source PATH       #{str}      "The set of directory paths to add to sources."
    j add-jar PROJECT:MATCH {sym regex} "The map of jar to path regex of entries in jar to unpack."
    w with-meta KEY         #{kw}       "The set of metadata keys files must have."
    M add-meta MATCH:KEY    {regex kw}  "The map of path regex to meta key to add."
@@ -388,6 +395,9 @@
           (util/info "Adding jar entries from %s...\n" (.getName (io/file jar)))
           (pod/unpack-jar jar tmp :include inc :exclude exc)))
       (-> fileset
+          ((partial reduce core/add-asset)    (map io/file add-asset))
+          ((partial reduce core/add-resource) (map io/file add-resource))
+          ((partial reduce core/add-source)   (map io/file add-source))
           (core/fileset-reduce core/ls remover to-src to-rsc to-ast mover withmeta)
           (#(core/add-meta % (addmeta %)))
           (core/add-resource tmp)


Fix race condition in test

Fix race condition in test

--- test/src/clojure/neko/threading_test.clj
+++ test/src/clojure/neko/threading_test.clj
@@ -256,13 +256,14 @@
   ; not allowed in on-cancelled
   (let [task (new-task (fn [] (Thread/sleep 100)))
         fail-count (atom 0)
+        latch (CountDownLatch. 1)
         task (with-on-cancelled task (fn []
                                        (try
                                          (publish-progress \x \y \z)
                                          (catch IllegalStateException d
-                                           (swap! fail-count inc)))))
+                                           (swap! fail-count inc)
+                                           (.countDown latch)))))
         task (execute! task)]
     (cancel task)
-    (try (result-of task)
-      (catch java.util.concurrent.CancellationException _))
+    (.await latch)
     (is-eq 1 @fail-count)))


fix test

fix test

--- test/babel/test/fr.clj
+++ test/babel/test/fr.clj
@@ -71,12 +71,18 @@
         grammar (:grammar @small)
         result
         (over grammar
-              (get lexicon "je")
+              (get lexicon "nous")
               (over grammar
                     (get lexicon "sommes") (get lexicon "aller")))]
-    (is (not (nil? result)))
-    (is (not (empty? result)))
-    (is (= 1 (.size result)))))
+    (is (= 2 (.size result)))
+    (is (or (= (fo (nth result 0))
+               "nous sommes allées")
+            (= (fo (nth result 1))
+               "nous sommes allées")))
+    (is (or (= (fo (nth result 0))
+               "nous sommes allés")
+            (= (fo (nth result 1))
+               "nous sommes allés")))))

 (deftest passe-compose-morphology
   (let [result


format

format

--- bot/dl.clj
+++ bot/dl.clj
@@ -5,8 +5,7 @@
             [cheshire.core :as json]
             [org.httpkit.client :as http]
             [clojure.java.io :as io])
-  (:import (java.net URLEncoder)
-           (com.google.auth.oauth2 GoogleCredentials)
+  (:import (com.google.auth.oauth2 GoogleCredentials)
            (java.util Base64)))

 (def dl-server (System/getenv "DL_SERVER"))
@@ -20,20 +19,18 @@
               :subprotocol "sqlite"
               :subname     ":resource:butterfly.db"})

-(defn- url-encode [url] (some-> url (URLEncoder/encode "UTF-8") (.replace "+" "%20")))
-
 (defn- parse-result [{label :displayName, {:keys [score]} :classification}]
   (let [[genus species] (str/split label #"_")
-        latin-name (str genus " " (str/lower-case species))
+        latin-name (str genus " " species)
         {:keys [vn_name common_name url]} (or (first (jdbc/query
                                                        db-spec
                                                        ["SELECT vn_name, common_name, url
                                                         FROM butterfly
                                                         WHERE genus = ? AND species = ?"
-                                                        genus (str/lower-case species)]))
+                                                        genus species]))
                                               {:vn_name latin-name
                                                :url     "http://www.vncreatures.net/hinhanh.php?nhom=1&loai=3"})]
-    [(or vn_name common_name) (str latin-name " ~ " (* 100 score) "%") url]))
+    [(or vn_name common_name) (format "%s ~ %.2f%%" latin-name (* 100 score)) url]))

 (defn- label-image [image-url]
   (.refreshIfExpired credential)


allow for future alpha versions of clojure to have column info

--- src/main/clojure/clojure/tools/reader/impl/utils.clj
+++ src/main/clojure/clojure/tools/reader/impl/utils.clj
@@ -9,10 +9,11 @@
 ;; getColumnNumber and *default-data-reader-fn* are available only since clojure-1.5.0-beta1
 (def >=clojure-1-5-alpha*?
   (let [{:keys [minor qualifier]} *clojure-version*]
-    (and (>= minor 5)
-         (not= "alpha"
-               (when qualifier
-                 (subs qualifier 0 (dec (count qualifier))))))))
+    (or (and (= minor 5)
+             (not= "alpha"
+                   (when qualifier
+                     (subs qualifier 0 (dec (count qualifier))))))
+        (> minor 5))))

 (defmacro ^:private compile-if [cond then else]
   (if (eval cond)


experimenting with heroku autodeployment

--- build.boot
+++ build.boot
@@ -22,7 +22,7 @@
     :bucket "blog.hashobject.com"
     :access-key (System/getenv "AWS_ACCESS_KEY")
     :secret-key (System/getenv "AWS_SECRET_KEY")
-    :source "target/public/"
+    :source "/app/target/public"
     :options {"Cache-Control" "max-age=315360000, no-transform, public"}})

 (deftask build-dev


Update to latest boot-junit

Update to latest boot-junit

--- build.boot
+++ build.boot
@@ -1,6 +1,6 @@
 (set-env!
  :source-paths #{"src"}
- :dependencies '[[radicalzephyr/boot-junit "0.1.0" :scope "test"]
+ :dependencies '[[radicalzephyr/boot-junit "0.1.1" :scope "test"]
                  [jeluard/boot-notify "0.1.2"      :scope "test"]])

 (def +version+ "0.1.0-SNAPSHOT")


Updated dependencies

Updated dependencies

Signed-off-by: Tom Marble <b248307e886b80bf9cb4014595572a835b049bf4@info9.net>

--- build.boot
+++ build.boot
@@ -20,7 +20,7 @@
                     [com.cemerick/piggieback "0.2.1"     :scope "test"]
                     [weasel                 "0.7.0"      :scope "test"]
                     [org.clojure/tools.nrepl "0.2.12"    :scope "test"]
-                    [adzerk/boot-reload     "0.4.7"      :scope "test"]
+                    [adzerk/boot-reload     "0.4.8"      :scope "test"]
                     [pandeiro/boot-http "0.7.3" :scope "test"]
                     [adzerk/boot-cljs       "1.7.228-1"  :scope "test"]
                     [adzerk/boot-cljs-repl  "0.3.0"      :scope "test"]


Don't restrict test runner to one package

--- build.boot
+++ build.boot
@@ -16,8 +16,7 @@
       :scm {:url "https://github.com/RadicalZephyr/http-server.git"}
       :licens {"MIT" "http://opensource.org/licenses/MIT"}}
  jar {:file "server.jar"
-      :manifest {"Main-Class" "net.zephyrizing.http_server.HttpServer"}}
- junit {:packages '#{net.zephyrizing.http_server_test}})
+      :manifest {"Main-Class" "net.zephyrizing.http_server.HttpServer"}})

 ;;; This prevents a name collision WARNING between the test task and
 ;;; clojure.core/test, a function that nobody really uses or cares


Update dependencies

Update dependencies

--- build.boot
+++ build.boot
@@ -36,15 +36,15 @@
  :resource-paths #{"resources"}
  :asset-paths #{"assets"}
  :dependencies
- '[[adzerk/boot-cljs "1.7.228-1" :scope "test"]
+ '[[adzerk/boot-cljs "2.0.0" :scope "test"]
    [adzerk/boot-cljs-repl "0.3.3" :scope "test"]
    [adzerk/boot-reload "0.5.1" :scope "test"]
    [weasel "0.7.0" :scope "test"] ;; Websocket Server
-   [deraen/boot-sass "0.3.0" :scope "test"]
+   [deraen/boot-sass "0.3.1" :scope "test"]
    [reloaded.repl "0.2.3" :scope "test"]

    [org.clojure/clojure "1.9.0-alpha14"]
-   [org.clojure/clojurescript "1.9.229"]
+   [org.clojure/clojurescript "1.9.494"]

    [org.clojure/tools.nrepl "0.2.12"]

@@ -57,17 +57,17 @@
    [com.stuartsierra/component "0.3.2"]
    [hiccup "1.0.5"]
    [org.clojure/tools.namespace "0.2.11"]
-   [prismatic/schema "1.1.3"]
-   [selmer "1.10.6"]
+   [prismatic/schema "1.1.4"]
+   [selmer "1.10.7"]
    [yada "1.2.1" :exclusions [aleph manifold ring-swagger prismatic/schema]]

    [aleph "0.4.3"]
    [manifold "0.1.6"]
-   [metosin/ring-swagger "0.22.10"]
+   [metosin/ring-swagger "0.23.0"]

    ;; App deps
-   [reagent "0.6.0"]
-   [com.cognitect/transit-clj "0.8.297"]
+   [reagent "0.6.1"]
+   [com.cognitect/transit-clj "0.8.300"]

    ;; Logging
    [org.clojure/tools.logging "0.3.1"]