quickfix, list? -> seq?

quickfix, list? -> seq?

--- src/untangled_spec/reporters/terminal.clj
+++ src/untangled_spec/reporters/terminal.clj
@@ -64,7 +64,7 @@
                      (color-str :diff/impl)
                      (#(if (empty? path) %
                          (assoc-in out path %))))))
-            (walk/prewalk #(cond-> % (list? %) (-> vec (conj ::list))) actual) d)
+            (walk/prewalk #(cond-> % (seq? %) (-> vec (conj ::list))) actual) d)
     (walk/prewalk #(cond-> %
                      (and (vector? %) (= ::list (last %)))
                      drop-last) d)


We can see the queries are correct now

We can see the queries are correct now

We can see the queries are correct now

--- src/webapp/framework/server/systemfns.clj
+++ src/webapp/framework/server/systemfns.clj
@@ -632,10 +632,10 @@
    (println (str "**** Processing: " realtime-log-entry))
    (println (str @cached-queries))
    (println (str "Count: " (-> @cached-queries keys count str)))
-   ;(let [queries (keys @cached-queries)]
-;   (for [query queries]
-     ;(println (str "   " queries)))
-   ))
+   (let [queries (keys @cached-queries)]
+   (doall (for [query queries]
+     (println (str "   " queries)))
+   ))))

@@ -644,7 +644,7 @@
   (loop []
     (do
         (let [realtime-log-entry   (<! server-side-record-changes)]
-            (process-log-entry realtime-log-entry )
+            (process-log-entry  realtime-log-entry )
         )
         (recur)
       )
@@ -674,7 +674,9 @@
                                                 "realtime_jvm_id = ?")
                     ]
                      (let [get-new-entry-count    (korma.core/exec-raw [sql [next-id]] []) ]
+                       (do
                        (println "processing: " get-new-entry-count )
+                       ;(println (str @cached-queries))
                         (if (pos? (first get-new-entry-count))
                           (do
                         (let [realtime-log-entry-list
@@ -684,7 +686,7 @@
                           (go
                             (if realtime-log-entry
                                (>! server-side-record-changes  realtime-log-entry)))
-                          )))
+                          ))))
                  ))) my-pool )


Test for function get-command

Test for function get-command

--- test/clj_jenkins_api/jenkins_api_test.clj
+++ test/clj_jenkins_api/jenkins_api_test.clj
@@ -12,7 +12,8 @@

 (ns clj-jenkins-api.jenkins-api-test
   (:require [clojure.test :refer :all]
-            [clj-jenkins-api.jenkins-api :refer :all]))
+            [clj-jenkins-api.jenkins-api :refer :all]
+            [clj-http.client :as http-client]))

 ;
 ; Common functions used by tests.
@@ -296,3 +297,11 @@
         (update-jenkins-url nil "")
         (is true "Exception not thrown")))

+(deftest test-get-command
+    "Check the clj-jenkins-api.jenkins-api/get-command"
+    (testing "the clj-jenkins-api.jenkins-api/get-command"
+        (with-redefs [http-client/get (fn [url mapa] {:body url})]
+            (are [x y] (= x y)
+                {:body ""} (http-client/get "" nil)
+                {:body "url"} (http-client/get "url" nil)))))
+


Use a unique name for created documents, to help concurrent build and test.

--- test/clj_ravendb/client_watching_test.clj
+++ test/clj_ravendb/client_watching_test.clj
@@ -11,7 +11,7 @@
       index-name (str "WatchedDocuments" (System/currentTimeMillis))]
   (deftest test-watching-document-puts-to-channel-on-document-change
     (testing "Watching a document puts to a channel on document change"
-      (let [document {:test 2 :name "WatchedDocument"}
+      (let [document {:test 2 :name id}
             ch (chan)
             watcher (watch-documents client [id] ch {:wait 0})
             _ (Thread/sleep 2000)
@@ -25,7 +25,7 @@

   (deftest test-watching-index-puts-to-channel-on-index-change
     (testing "Watching an index puts to a channel on index change"
-      (let [document {:test 2 :name "WatchedDocument"}
+      (let [document {:test 2 :name id}
             ch (chan)
             watcher (watch-index client {:index index-name} ch {:wait 0})
             _ (Thread/sleep 2000)
@@ -37,11 +37,11 @@

   (use-fixtures :each (fn [f]
                         (put-index! client {:index index-name
-                                            :where [[:== :name "WatchedDocument"]]
+                                            :where [[:== :name id]]
                                             :select [:name]})
                         (bulk-operations! client [{:method "PUT"
                                                    :id id
-                                                   :document {:test 1 :name "WatchedDocument"}
+                                                   :document {:test 1 :name id}
                                                    :metadata {}}])
                         (f)
                         (delete-index! client index-name)


Improve description of  disable?

Improve description of  disable?

--- src/re_com/buttons.cljs
+++ src/re_com/buttons.cljs
@@ -15,7 +15,7 @@
    {:name :on-click         :required false                          :type "() -> nil"       :description "function to call when the button is clicked."}
    {:name :tooltip          :required false :default "no tooltop"    :type "string"          :description "show a popover-tooltip using this text."}
    {:name :tooltip-position :required false :default :below-center   :type "keyword"         :description "position of the popover-tooltip. e.g. :right-below."}
-   {:name :disabled?        :required false :default false           :type "boolean | atom"  :description "Set to true to disable the button."}
+   {:name :disabled?        :required false :default false           :type "boolean | atom"  :description "if true, the user can't click the button."}
    {:name :class            :required false                          :type "string"          :description "Class string. e.g. \"btn-info\" (see: http://getbootstrap.com/css/#buttons)."}
    {:name :style            :required false                          :type "map"             :description "CSS class names, space seperated."}
    {:name :attr             :required false                          :type "map"             :description "html attributes to add or override (:class/:style not allowed)."}])
@@ -66,9 +66,9 @@
 ;;--------------------------------------------------------------------------------------------------

 (def md-circle-icon-button-args-desc
-  [{:name :md-icon-name     :required true   :default "md-add"       :type "string"     :description "the name of the icon. See http://zavoloklom.github.io/material-design-iconic-font/icons.html"}
+  [{:name :md-icon-name     :required true  :default "md-add"        :type "string"     :description "the name of the icon. "}
    {:name :on-click         :required false                          :type "() -> nil"  :description "function to call when the button is clicked"}
-   {:name :size             :required false  :default "nil"          :type "keyword"    :description "set size of button (nil = regular, or :smaller or :larger."}
+   {:name :size             :required false :default ":regular"      :type "keyword"    :description "the size of button. One of :regular, :smaller or :larger."}
    {:name :tooltip          :required false                          :type "string"     :description "show a popover-tooltip using this text."}
    {:name :tooltip-position :required false :default ":below-center" :type "keyword"    :description "position of the popover-tooltip. e.g. :right-below."}
    {:name :emphasise?       :required false :default false           :type "boolean"    :description "if true, use emphasised styling so the button really stands out."}
@@ -79,6 +79,8 @@

 (def md-circle-icon-button-args
   (set (map :name md-circle-icon-button-args-desc)))
+
+; XXX It should be possible for disabled? to be an atom?

 (defn md-circle-icon-button
   "a circular button containing a material design icon"
@@ -125,9 +127,9 @@
 ;;--------------------------------------------------------------------------------------------------

 (def md-icon-button-args-desc
-  [{:name :md-icon-name     :required true   :default "md-add"       :type "string"     :description "the name of the icon. See http://zavoloklom.github.io/material-design-iconic-font/icons.html"}
+  [{:name :md-icon-name     :required true  :default "md-add"        :type "string"     :description [:span "the name of the icon." ]}
    {:name :on-click         :required false                          :type "() -> nil"  :description "function to call when the button is clicked"}
-   {:name :size             :required false  :default "nil"          :type "keyword"    :description "set size of button (nil = regular, or :smaller or :larger."}
+   {:name :size             :required false :default "nil"           :type "keyword"    :description "set size of button (nil = regular, or :smaller or :larger."}
    {:name :tooltip          :required false                          :type "string"     :description "show a popover-tooltip using this text."}
    {:name :tooltip-position :required false :default ":below-center" :type "keyword"    :description "position of the popover-tooltip. e.g. :right-below."}
    {:name :emphasise?       :required false :default false           :type "boolean"    :description "if true, use emphasised styling so the button really stands out."}
@@ -138,6 +140,8 @@

 (def md-icon-button-args
   (set (map :name md-icon-button-args-desc)))
+
+; XXX It should be possible for disabled? to be an atom?

 (defn md-icon-button
   "a square button containing a material design icon"
@@ -284,7 +288,7 @@
    {:name :on-click         :required false                          :type "() -> nil"  :description "function to call when the hyperlink is clicked."}
    {:name :tooltip          :required false                          :type "string"     :description "show a popover-tooltip using this text."}
    {:name :tooltip-position :required false :default ":below-center" :type "keyword"    :description "position of the popover-tooltip. e.g. :right-below."}
-   {:name :disabled?        :required false :default false           :type "string"     :description "Set to true to disable the hyperlink."}
+   {:name :disabled?        :required false :default false           :type "string"     :description "if true, the user can't click the button."}
    {:name :class            :required false                          :type "string"     :description "CSS class names, space seperated."}
    {:name :style            :required false                          :type "map"        :description "CSS styles to add or override."}
    {:name :attr             :required false                          :type "map"        :description "html attributes to add or override (:class/:style not allowed)."}])


Updated it to also colour the entire popover border and updated the docs

--- src/re_com/popover.cljs
+++ src/re_com/popover.cljs
@@ -229,6 +229,7 @@
    {:name :width                :required false                       :type "string"           :validate-fn string?           :description "a CSS style describing the popover width"}
    {:name :height               :required false :default "auto"       :type "string"           :validate-fn string?           :description "a CSS style describing the popover height"}
    {:name :popover-color        :required false :default "white"      :type "string"           :validate-fn string?           :description "fill color of the popover"}
+   {:name :popover-border-color :required false                       :type "string"           :validate-fn string?           :description "color of the popover border, including the arrow"}
    {:name :arrow-length         :required false :default 11           :type "integer | string" :validate-fn number-or-string? :description "the length in pixels of the arrow (from pointy part to middle of arrow base)"}
    {:name :arrow-width          :required false :default 22           :type "integer | string" :validate-fn number-or-string? :description "the width in pixels of arrow base"}
    {:name :arrow-gap            :required false :default -1           :type "integer"          :validate-fn number?           :description "px gap between the anchor and the arrow tip. Positive numbers push the popover away from the anchor"}
@@ -236,8 +237,7 @@
    {:name :margin-left          :required false                       :type "string"           :validate-fn string?           :description "a CSS style describing the horiztonal offset from anchor after position"}
    {:name :margin-top           :required false                       :type "string"           :validate-fn string?           :description "a CSS style describing the vertical offset from anchor after position"}
    {:name :tooltip-style?       :required false :default false        :type "boolean"                                         :description "setup popover styles for a tooltip"}
-   {:name :title                :required false                       :type "string | markup"                                 :description "describes a title"}
-   {:name :popover-border-color :required false                       :type "string"           :validate-fn string?           :description "color of the popover arrow stroke"}])
+   {:name :title                :required false                       :type "string | markup"                                 :description "describes a title"}])

 (defn popover-border
   "Renders an element or control along with a Bootstrap popover"
@@ -292,6 +292,7 @@
                            (when width  {:width  width})
                            (when height {:height height})
                            (when popover-color {:background-color popover-color})
+                           (when popover-border-color {:border-color popover-border-color})
                            (when tooltip-style?
                              {:border-radius "4px"
                               :box-shadow    "none"
@@ -337,7 +338,7 @@
    {:name :body                 :required false                        :type "string | hiccup"  :validate-fn string-or-hiccup? :description "describes the popover body. Must be a single component"}
    {:name :tooltip-style?       :required false  :default false        :type "boolean"                                         :description "setup popover styles for a tooltip"}
    {:name :popover-color        :required false  :default "white"      :type "string"           :validate-fn string?           :description "fill color of the popover"}
-   {:name :popover-border-color :required false                        :type "string"           :validate-fn string?           :description "color of the popover arrow stroke"}
+   {:name :popover-border-color :required false                        :type "string"           :validate-fn string?           :description "color of the popover border, including the arrow"}
    {:name :arrow-length         :required false  :default 11           :type "integer | string" :validate-fn number-or-string? :description "the length in pixels of the arrow (from pointy part to middle of arrow base)"}
    {:name :arrow-width          :required false  :default 22           :type "integer | string" :validate-fn number-or-string? :description "the width in pixels of arrow base"}
    {:name :arrow-gap            :required false  :default -1           :type "integer"          :validate-fn number?           :description "px gap between the anchor and the arrow tip. Positive numbers push the popover away from the anchor"}


[clojure] remove time+ macro

[clojure] remove time+ macro

--- etc/scratch.clj
+++ etc/scratch.clj
@@ -62,20 +62,6 @@
    (refresh)
    (apply kaocha.repl/run ns-list)))

-(defmacro time+
-  "Like time but:
-  - accepts a `tag` argument
-  - prints out start + end time
-  - rounds up ms - less precise"
-  [tag & body]
-  (printf "start |%s| %s\n"  tag (java.time.LocalDateTime/now))
-  `(let [start-time# ^Long (System/currentTimeMillis)
-         return# (do
-                   ~@body)
-         time# ^Long (- (System/currentTimeMillis) start-time#)]
-     (printf "end |%s| %s - %sms\n" ~tag   (str (java.time.LocalDateTime/now)) time#)
-     return#))
-
 (def system-status (atom {}))

 (defn start-system!


fix warnings by defining render-board late & using command

--- src/tile_game/grid.cljs
+++ src/tile_game/grid.cljs
@@ -34,12 +34,6 @@
             :on-change (fn [e] (swap! app-state assoc :size (.-target.value e)))
             :style {:width "25%"}}]])

-(defn render-board [board dim commmand]
-  [:svg {:view-box (str "0 0 " dim " " dim) :width 800 :height 800}
-   (for [x (range dim) y (range dim)]
-     (let [tile (nth board (+ (* y dim) x))]
-       (render-tile [x y] tile command)))])
-
 (defn render-tile [[x y] tile command]
   (if-not (zero? tile)
     (let [fill-color (nth colors tile)]
@@ -48,6 +42,12 @@
        [:text {:x (+ 0.5 x) :y (+ 0.65 y)
                :font-family "Verdana" :font-size 0.4 :text-anchor "middle"}
         (str tile)]])))
+
+(defn render-board [board dim command]
+  [:svg {:view-box (str "0 0 " dim " " dim) :width 800 :height 800}
+   (for [x (range dim) y (range dim)]
+     (let [tile (nth board (+ (* y dim) x))]
+       (render-tile [x y] tile command)))])

 (defn help-screen []
   [:table {:style {:width "25%"}}


MAIN-4423 disable version string

MAIN-4423 disable version string

--- src/vignette/system.clj
+++ src/vignette/system.clj
@@ -20,19 +20,20 @@
            (fn [_]
              (jet/run-jetty
                {
-                :ring-handler (if (boolean (Boolean/valueOf (env :reload-on-request)))
-                                (do
-                                  (println "Code will be reloaded on each request")
-                                  (wrap-reload (create-routes (image-routes (stores this)))))
-                                (create-routes (image-routes (stores this))))
-                :port         port
-                :configurator configure-jetty
-                :join?        false
+                :ring-handler         (if (boolean (Boolean/valueOf (env :reload-on-request)))
+                                        (do
+                                          (println "Code will be reloaded on each request")
+                                          (wrap-reload (create-routes (image-routes (stores this)))))
+                                        (create-routes (image-routes (stores this))))
+                :port                 port
+                :configurator         configure-jetty
+                :join?                false
+                :send-server-version? false
                 ; FIXME: update the readme
-                :max-threads  (Integer. (env :vignette-server-max-threads default-max-threads))
+                :max-threads          (Integer. (env :vignette-server-max-threads default-max-threads))
                 ; see https://wiki.eclipse.org/Jetty/Howto/High_Load#Thread_Pool
-                :job-queue    (ArrayBlockingQueue.
-                                (Integer. (env :vignette-server-queue-size default-queue-size)))}))))
+                :job-queue            (ArrayBlockingQueue.
+                                        (Integer. (env :vignette-server-queue-size default-queue-size)))}))))
   (stop [this]
     (when-let [server @(:running (:state this))]
       (.stop server))))


Limit change sets to 10 to avoid performance issues

--- src/warehouse/core.cljs
+++ src/warehouse/core.cljs
@@ -37,8 +37,8 @@
                       (on-state-load response)
                       (add-watch app-state :change-set (fn [k r os ns]
                                                          (let [cs (util/get-change-set (:components os) (:components ns))]
-                                                           (if-not (empty? cs)
-                                                             (swap! change-sets conj cs))))))
+                                                           (when-not (empty? cs)
+                                                             (swap! change-sets #(take 10 (conj % cs))))))))
                     nil)

@@ -261,7 +261,7 @@
                                 (reset! adding false))} "Save"]
           [:button {:type "button" :on-click (m/handler-fn (reset! adding false))} "Cancel"]])
        (when (true? @showing-changeset)
-         (let [cs (reverse @change-sets)
+         (let [cs @change-sets
                k1 (range (count cs) 0 -1)]

            (map (fn [change-set-col k2]


run bulk index

run bulk index

--- src/wb_es/bulk/core.clj
+++ src/wb_es/bulk/core.clj
@@ -2,9 +2,12 @@
   (:gen-class)
   (:require [clj-http.client :as http]
             [cheshire.core :as json]
+            [datomic.api :as d]
             [mount.core :as mount]
+            [wb-es.datomic.data.core :refer [create-document]]
             [wb-es.datomic.db :refer [datomic-conn]]
-            [wb-es.env :refer [es-base-url]]))
+            [wb-es.env :refer [es-base-url release-id]]
+            [wb-es.mappings.core :refer [index-settings]]))

 (defn format-bulk
   "returns a new line delimited JSON based on
@@ -23,11 +26,38 @@
   "submit formatted new line delimited JSON to elasticsearch"
   [formatted-docs]
   (http/post (format "%s/_bulk" es-base-url)
-             {:debug true
-              :headers {:content-type "application/x-ndjson"}
+             {:headers {:content-type "application/x-ndjson"}
               :body formatted-docs}))
+
+(defn get-eids-by-type [db ident-attr]
+  (d/q '[:find [?eid ...]
+         :in $ ?ident-attr
+         :where [?eid ?ident-attr]]
+       db ident-attr))
+
+(defn run-index-batch [db batch]
+  (->> batch
+       (map #(create-document (d/entity db %)))
+       (format-bulk "index")
+       (submit)))
+
+(defn run []
+  (let [db (d/db datomic-conn)
+        index-url (format "%s/%s " es-base-url release-id)]
+    (do
+      (http/put index-url {:headers {:content-type "application/json"}
+                           :body (json/generate-string index-settings)})
+      (let [eids (get-eids-by-type db :go-term/id)
+            step 100
+            batches (partition step step [] eids)]
+        (doseq [batch batches]
+          (run-index-batch db batch))))))

 (defn -main
   "I don't do a whole lot ... yet."
   [& args]
-  (println "Hello, Bulky World!"))
+  (do
+    (println "Hello, Bulky World!")
+    (mount/start)
+    (run)
+    (mount/stop)))


Cleanup code. (#1037)

Cleanup code. (#1037)

--- scheduler/src/cook/mesos/scheduler.clj
+++ scheduler/src/cook/mesos/scheduler.clj
@@ -52,7 +52,7 @@
             [plumbing.core :as pc])
   (import [com.netflix.fenzo ConstraintEvaluator ConstraintEvaluator$Result
                              TaskAssignmentResult TaskRequest TaskScheduler TaskScheduler$Builder
-                             VMTaskFitnessCalculator VirtualMachineLease VirtualMachineLease$Range
+                             VirtualMachineLease VirtualMachineLease$Range
                              VirtualMachineCurrentState]
           [com.netflix.fenzo.functions Action1 Func1]))

@@ -436,46 +436,6 @@
                           (VirtualMachineLease$Range. begin end))
                         (offer-resource-ranges offer "ports"))))

-(defn novel-host-constraint
-  "This returns a Fenzo hard constraint that ensures the given job won't run on the same host again"
-  [job]
-  (reify ConstraintEvaluator
-    (getName [_] "novel_host_constraint")
-    (evaluate [_ task-request target-vm task-tracker-state]
-      (let [previous-hosts (->> (:job/instance job)
-                                (remove #(true? (:instance/preempted? %)))
-                                (mapv :instance/hostname))]
-        (ConstraintEvaluator$Result.
-          (not-any? #(= % (.getHostname target-vm))
-                    previous-hosts)
-          (str "Can't run on " (.getHostname target-vm)
-               " since we already ran on that: " previous-hosts))))))
-
-(defn gpu-host-constraint
-  "This returns a Fenzo hard constraint that ensure that if the givn job requires gpus, it will be assigned
-   to a GPU host, and if it doesn't require gpus, it will be assigned to a non-GPU host."
-  [job]
-  (let [job-needs-gpus? (fn [job]
-                          (delay (->> (:job/resource job)
-                                      (filter (fn gpu-resource? [res]
-                                                (and (= (:resource/type res) :resource.type/gpus)
-                                                     (pos? (:resource/amount res)))))
-                                      (seq)
-                                      (boolean))))
-        needs-gpus? (job-needs-gpus? job)]
-    (reify ConstraintEvaluator
-      (getName [_] (str (if @needs-gpus? "" "non_") "gpu_host_constraint"))
-      (evaluate [_ task-request target-vm task-tracker-state]
-        (let [has-gpus? (boolean (or (pos? (or (.getScalarValue (.getCurrAvailableResources target-vm) "gpus") 0.0))
-                                     (some (fn gpu-task? [req]
-                                             @(job-needs-gpus? (:job req)))
-                                           (into (vec (.getRunningTasks target-vm))
-                                                 (mapv #(.getRequest %) (.getTasksCurrentlyAssigned target-vm))))))]
-          (ConstraintEvaluator$Result.
-            (if @needs-gpus?
-              has-gpus?
-              (not has-gpus?))
-            (str "The machine " (.getHostname target-vm) (if @needs-gpus? " doesn't have" " has") " gpus")))))))

 (defrecord TaskRequestAdapter [job resources task-id assigned-resources guuid->considerable-cotask-ids constraints needs-gpus? scalar-requests]
   TaskRequest


fix test

fix test

--- test/babel/test/en.cljc
+++ test/babel/test/en.cljc
@@ -287,7 +287,8 @@
                                               :mod '()
                                               :number :sing
                                               :spec {:def :def
-                                                     :pred :definite}}}}})]
+                                                     :pred :definite}}}
+                                 :subcat '()}})]
     (log/info (str "furniture-sentence: "
                    (display-expression expr)))


cleanup: remove access to non-public, unused function

--- test/babel/test/en.cljc
+++ test/babel/test/en.cljc
@@ -5,8 +5,7 @@
             [babel.english :as english :refer [morph morph-ps]]
             [babel.english.grammar :as grammar :refer [head-first head-last]]
             [babel.english.morphology :refer [get-string]]
-
-            [babel.generate :as generate :refer [get-lexemes]]
+            [babel.generate :as generate]
             [babel.lexiconfn :refer [write-lexicon]]
             [babel.over :refer [over overc overh]]
             [babel.parse :as parse]


Show flash notification when user deletes SSH key

--- src-cljs/frontend/controllers/api.cljs
+++ src-cljs/frontend/controllers/api.cljs
@@ -575,11 +575,13 @@
   (if-not (= (:project-id context) (project-model/id (get-in state state/project-path)))
     state
     (let [{:keys [hostname fingerprint]} context]
-      (update-in state (conj state/project-path :ssh_keys)
-                 (fn [keys]
-                   (remove #(and (= (:hostname %) hostname)
-                                 (= (:fingerprint %) fingerprint))
-                           keys))))))
+      (-> state
+          (update-in (conj state/project-path :ssh_keys)
+                     (fn [keys]
+                       (remove #(and (= (:hostname %) hostname)
+                                     (= (:fingerprint %) fingerprint))
+                               keys)))
+          (state/add-flash-notification "Your key has been successfully deleted.")))))

 (defmethod api-event [:save-project-api-token :success]


is this test identical for all java versions?

--- test/java_time_test.clj
+++ test/java_time_test.clj
@@ -1006,12 +1006,12 @@
         test-langs ["en" "tr" "cn"]]
     (testing "locale specific rules for lower-case can cause formatters to not be found"
       (doseq [lang test-langs]
-       (testing lang
-         (try
-           (Locale/setDefault (Locale/forLanguageTag lang))
-           (is (some? (j/formatter :rfc-1123-date-time)))
-           (finally
-             (Locale/setDefault current-locale))))))))
+        (testing lang
+          (try
+            (Locale/setDefault (Locale/forLanguageTag lang))
+            (is (some? (j/formatter :rfc-1123-date-time)))
+            (finally
+              (Locale/setDefault current-locale))))))))

 (deftest formatter-test
   (testing "case-insensitive formatter"
@@ -1021,26 +1021,7 @@
              (j/local-time fmt "00:34AM")))))

   (testing "case-sensitive formatter"
-    ;; Java version detection:
-    ;; java.lang.Runtime.Version class exists from Java 9 onwards, hence
-    ;; the need to detect the Java version from the java.version string returned
-    ;; by System/getProperty. In versions before 9, java.version has the format
-    ;; 1.x.y, e.g., 1.8.0_255, but from version 9 onwards, the initial 1 element
-    ;; is dropped.
-    ;; Refer to JEP 223 for information on the change.
-    ;; https://openjdk.java.net/jeps/223
-    (let [java-version (->> (System/getProperty "java.version")
-                            (re-find #"^\d+")
-                            Integer/parseInt)]
-      (if (> java-version 11)
-        (testing "Java 12 and above treats AM as invalid"
-          (let [fmt (java-time/formatter "hh:mma" {:case :sensitive})]
-            (is (= (j/local-time 0 34 0 0)
-                   (j/local-time fmt "12:34AM")))
-            (is (thrown? Exception (j/local-time fmt "12:34am")))))
-
-        (testing "Java 8 and 11 treats am as invalid"
-          (let [fmt (java-time/formatter "hh:mma" {:case :sensitive})]
-            (is (= (j/local-time 0 34 0 0)
-                   (j/local-time fmt "12:34AM")))
-            (is (thrown? Exception (j/local-time fmt "12:34am")))))))))
+    (let [fmt (java-time/formatter "hh:mma" {:case :sensitive})]
+      (is (= (j/local-time 0 34 0 0)
+             (j/local-time fmt "12:34AM")))
+      (is (thrown? Exception (j/local-time fmt "12:34am"))))))


Making sub-component failure messages better

--- web-client/test/test_burgerboard/huh.cljs
+++ web-client/test/test_burgerboard/huh.cljs
@@ -102,12 +102,27 @@
     )
   )

+(defn component-name [component]
+  (.-name component)                    ; This isn't standard JS, but
+                                        ; works enough places, for now
+  )
+
 (defn sub-component [sub-component cursor]
   (fn [component]
-    (= {:sub-component sub-component
-        :cursor cursor}
-       component
+    (let [expected-name (component-name sub-component)
+          actual-name (component-name (:sub-component component))]
+      (cond
+       (not= sub-component (:sub-component component))
+       {:msg "sub-component does not match"
+        :expected expected-name :actual actual-name}
+
+       (not= cursor (:cursor component))
+       {:msg (str "sub-component cursor does not match for " expected-name)
+        :expected cursor :actual (:cursor component)}
+
+       :else true
        )
+      )
     )
   )


Improve Logger test

Improve Logger test

--- test/uruk/core_test.clj
+++ test/uruk/core_test.clj
@@ -169,7 +169,9 @@
   (and (is (= (:timeout-millis (:default-request-options expected-config))
               (.getTimeoutMillis (:default-request-options session))
               (.getTimeoutMillis (:effective-request-options session))))
-       (is (instance? Logger (:logger session))) ;; TODO test Logger better--name?
+       (is (and (instance? Logger (:logger session))
+                (= (.getName (:logger expected-config))
+                   (.getName (:logger session)))))
        (is (empty? (:user-object session))) ;; XXX is this all we can test user-object?
        (is (= (:transaction-timeout session)
               (:transaction-timeout expected-config)))
@@ -179,6 +181,7 @@
 (deftest set-session-config
   (testing "A session with explicitly-set configuration must reflect that configuration"
     (let [opts {:default-request-options {:timeout-millis 75}
+                :logger (Logger/getLogger "test")
                 ;; TODO test default Req Opts more?
                 ;; TODO test effective Req Opts more?
                 :transaction-timeout 56


make it route to the url you're on

make it route to the url you're on

--- frontend/core.cljs
+++ frontend/core.cljs
@@ -124,7 +124,8 @@

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

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


make deref and other componds selectable

--- cljs/src/worker/plastic/worker/editor/layout/utils.cljs
+++ cljs/src/worker/plastic/worker/editor/layout/utils.cljs
@@ -48,7 +48,7 @@
     replace-unescape-double-quotes))

 (defn is-selectable? [tag]
-  (#{:token :fn :list :map :vector :set :meta} tag))
+  (#{:token :fn :list :map :vector :set :meta :deref :quote :syntax-quote :unquote :unquote-splicing} tag))

 (defn string-node? [node]
   (instance? StringNode node))


swallow errors on analytics.google/push also

--- frontend/analytics/google.cljs
+++ frontend/analytics/google.cljs
@@ -2,9 +2,10 @@
   (:require [frontend.utils :as utils :include-macros true]))

 (defn push [args]
-  (let [gaq (aget js/window "_gaq")
-        push (aget gaq "push")]
-     (.call push gaq (clj->js args))))
+  (utils/swallow-errors
+   (let [gaq (aget js/window "_gaq")
+         push (aget gaq "push")]
+     (.call push gaq (clj->js args)))))

 (defn track-event [& args]
   (utils/swallow-errors (push (cons "_trackEvent" args))))


[#2287] Adapt auth responses to json type

--- backend/src/akvo/lumen/auth.clj
+++ backend/src/akvo/lumen/auth.clj
@@ -36,21 +36,33 @@
 (defn api-path? [{:keys [path-info]}]
   (string/starts-with? path-info "/api/"))

+(defn- application-json-type
+  "code taken from ring.middleware.json/wrap-json-response"
+  [response & [options]]
+  (let [json-response (update-in response [:body] json/generate-string options)]
+    (if (contains? (:headers response) "Content-Type")
+      json-response
+      (response/content-type json-response "application/json; charset=utf-8"))))
+
 (def not-authenticated
   (-> (response/response "Not authenticated")
-      (response/status 401)))
+      (response/status 401)
+      application-json-type))

 (def not-authorized
   (-> (response/response "Not authorized")
-      (response/status 403)))
+      (response/status 403)
+      application-json-type))

 (def service-unavailable
   (-> (response/response "Service Unavailable")
-      (response/status 503)))
+      (response/status 503)
+      application-json-type))

 (def internal-server-error
   (-> (response/response "Internal server errror")
-      (response/status 500)))
+      (response/status 500)
+      application-json-type))

 (defn api-authz?
   "Feature flag predicate function. Add trailing $auth to given_name to enable


Lazy autocomplete scrolling.

Lazy autocomplete scrolling.

--- metlog-vault/src-client/metlog_client/autocomplete.cljs
+++ metlog-vault/src-client/metlog_client/autocomplete.cljs
@@ -29,17 +29,31 @@
                       :selected-index -1
                       :update-filter-text true}))

+(defn- ensure-entry-visible [ container-elem entry-elem ]
+  (cond
+    (< (.-offsetTop entry-elem)
+       (.-scrollTop container-elem))
+    (aset container-elem "scrollTop" (.-offsetTop entry-elem))
+
+    (> (+ (.-offsetTop entry-elem) (.-clientHeight entry-elem))
+       (+ (.-scrollTop container-elem) (.-clientHeight container-elem)))
+    ;; Place the bottom edge of the entry against the bottom edge
+    ;; of the container.
+    (aset container-elem "scrollTop" (- (.-offsetTop entry-elem)
+                                        (- (.-clientHeight container-elem)
+                                           (.-clientHeight entry-elem))))))
+
 (defn autocomplete-entry [ ]
   (reagent/create-class
    {:component-did-update
     (fn [ this old-argv ]
       (let [[ _ _ _ was-selected? ] old-argv
-            [ _ container-node _ is-selected? ] (reagent/argv this) ]
+            [ _ container-elem _ is-selected? ] (reagent/argv this) ]
         (when (and is-selected? (not was-selected?))
-          (aset container-node "scrollTop" (.-offsetTop (reagent/dom-node this))))))
+          (ensure-entry-visible container-elem (reagent/dom-node this)))))

     :reagent-render
-    (fn [ container-node content selected? ]
+    (fn [ container-elem content selected? ]
       [:div {:class (str "autocomplete-completion-entry "
                          (if selected? "selected"))}
        content])}))


fix the approve/deny buttons

fix the approve/deny buttons

--- src-cljs/frontend/components/overlay.cljs
+++ src-cljs/frontend/components/overlay.cljs
@@ -202,14 +202,14 @@
        (str "Requested access " (format-access-date (:access-request/create-date entity))))]]
    [:div.access-options
     (when-not (= :access-request.status/denied (:access-request/status entity))
-      [:a.access-option
+      [:button.access-option
        {:role "button"
         :class "negative"
         :title "Decline"
         :on-click #(cast! :access-request-denied {:request-id (:db/id entity)
                                                   :doc-id (:access-request/document entity)})}
        (common/icon :times)])
-    [:a.access-option
+    [:button.access-option
      {:role "button"
       :class "positive"
       :title "Approve"


Generate initial config works again

Generate initial config works again

--- src/all/cider_ci/executor/main_config.clj
+++ src/all/cider_ci/executor/main_config.clj
@@ -13,6 +13,7 @@
     [cider-ci.utils.fs :as fs]
     [cider-ci.utils.self :as self]
     [cider-ci.constants :refer [WORKING-DIR]]
+    [cider-ci.utils.pki :as pki]

     [yaml.core :as yaml]
     [clojure.pprint :refer [pprint]]
@@ -29,6 +30,7 @@
     [java.io File]
     ))

+(def default-key-pair (memoize pki/generate-key-pair))

 (def default-traits-files
   (case (System/getProperty "os.name")
@@ -44,15 +46,17 @@
   ;  :service :executor,
     :accepted_repositories ["^.*$"]
 ;    :windows {:fsi_path "C:\\Program Files (x86)\\Microsoft SDKs\\F#\\4.0\\Framework\\v4.0\\Fsi.exe"},
-    :tmp_dir "tmp",
+    :tmp_dir (-> "/tmp" clj-fs/absolute clj-fs/normalized str),
 ;    :server_secret "secret",
     :trial_retention_duration "30 Minutes",
-    :name "DemoExecutor",
+    :name (hostname),
     :hostname (hostname),
 ;    :secret "secret",
     :repositories_dir nil;(-> "./tmp/executor_repositories" clj-fs/absolute clj-fs/normalized str),
     :working_dir (->  "./tmp/working_dir" clj-fs/absolute clj-fs/normalized str),
     :default_script_timeout "3 Minutes",
+    :public_key (-> (default-key-pair) pki/key-pair->pem-public)
+    :private_key (-> (default-key-pair) pki/key-pair->pem-private)
 ;    :http {:port 8883
 ;           :host "localhost"
 ;           :enabled (if (= env/env :dev) true false)}
@@ -96,8 +100,7 @@
 (defn generate-config-file-usage [options-summary & more]
   (->> ["Cider-CI Executor generate-config-file"
         ""
-        "Write the default configuration to a file. "
-        "Commonly used to retrieve an initial configuration for the executor."
+        "Write a initial configuration file. "
         ""
         "Options:"
         options-summary
@@ -110,14 +113,13 @@
        flatten (clojure.string/join \newline)))

 (def generate-config-file-file-header
-  [(str "# Cider-CI " (cider-ci.utils.self/version) " Default Executor Configuration")
+  [(str "# Cider-CI " (cider-ci.utils.self/version) " Initial Executor Configuration")
    "#"
-   "# Some of these defaults depend on the environment."
-   "# We recommend to create a configuration file based on this file"
-   "# but only including those keys/values which are intended to be "
-   "# overridden."
-   "# The default configuration will be merged with the configuration"
-   "# given in the config-file. See also 'deep-merge' in the documentation."
+   "# The derived internal configuration will be merged with the configuration"
+   "# values given this file. Key value pairs given here have will override "
+   "# automatically derieved values. See also 'deep-merge' in the documentation."
+   "# "
+   "# Remove all key/value pairs which should rather be derived automatically."
    "#"])

 (def config-file-option
@@ -127,8 +129,9 @@

 (def cli-options
   [["-f" "--force" "Overwrite an existing config file"]
-   ["-h" "--help"
-    :default false]])
+   ["-h" "--help" :default false]
+   config-file-option
+   ])

 (defn generate-config-file [options]
   (when (nil? (:config-file options))
@@ -166,6 +169,7 @@

-;(-main "-c" "default-executor-config.yml" "-f")
+;(-main {} "-c" "./tmp/initial-executor-config.yml" "-f")
+;(-main {} "-h")


More experimenting with event listeners.

--- ClojureScript/hello.cljs
+++ ClojureScript/hello.cljs
@@ -9,14 +9,14 @@

 (def pos (atom 0))

-(defn foobar [canvas]
+(defn foobar [canvas y]
     (let [ctx (.getContext canvas "2d")
         x (swap! pos inc)]
         (do
             (. ctx (save))
             (.clearRect ctx 0 0 (.width canvas) (.height canvas))
             (set! (.fillStyle ctx) "red")
-            (.fillRect ctx x 100 100 50)
+            (.fillRect ctx x y 100 50)
             (. ctx (restore))
             )))

@@ -29,7 +29,9 @@
             }) "")
         button (goog.dom/createDom "button" {} "Click!")]
         (do
-            (goog.events/listen button goog.events.EventType/CLICK (partial foobar canvas))
+            (goog.events/listen button goog.events.EventType/CLICK (partial foobar canvas 100))
+            (goog.events/listen document.body goog.events.EventType/KEYDOWN (partial foobar canvas 50) true)
+            (goog.events/listen document.body goog.events.EventType/KEYUP (partial foobar canvas 150) true)
             (dorun (map (partial goog.dom/appendChild document.body)
                 [(goog.dom/createDom "h1" {} "Hello!") canvas button])))))


Wrapped failures in execution of action and composing of the specification to a proper HTTP response.

--- src/clj_formal_specifications_app/api.clj
+++ src/clj_formal_specifications_app/api.clj
@@ -11,16 +11,22 @@
   [filename]
   {:body {:contents (slurp (examples/example-file filename))}})

+(defn bad-request
+  [e]
+  {:body (.getMessage e) :status 400})
+
 (defn compose
   [spec]
   (let [ns (spec/get-ns-name spec)]
-    {:body (do (remove-ns (symbol ns)) (load-string spec) ns)}))
+    (try
+      {:body (do (remove-ns (symbol ns)) (load-string spec) ns)}
+      (catch Exception e (bad-request e)))))

 (defn execute-with-ns
   [ns command]
   (try
     {:body (str (binding [*ns* (find-ns (symbol ns))] (load-string command)))}
-    (catch Exception e {:body (.getMessage e) :status 400})))
+    (catch Exception e (bad-request e))))

 (defn ns-data
   [ns]


Fixed bug with printing empty list using print_exec and print_code

--- src/clojush/instructions/input_output.clj
+++ src/clojush/instructions/input_output.clj
@@ -11,10 +11,14 @@
   (fn [state]
     (if (empty? (type state))
       state
-      (let [top-thing (top-item type state)]
-        (if (< max-string-length (count (str (stack-ref :output 0 state) top-thing)))
+      (let [top-thing (top-item type state)
+            top-thing-string (if (or (string? top-thing)
+                                     (char? top-thing))
+                               top-thing
+                               (pr-str top-thing))]
+        (if (< max-string-length (count (str (stack-ref :output 0 state) top-thing-string)))
           state
-          (stack-assoc (str (stack-ref :output 0 state) top-thing)
+          (stack-assoc (str (stack-ref :output 0 state) top-thing-string)
                        :output
                        0
                        (pop-item type state)))))))


Tidy up and documentation for c.c.a.bitwise

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

--- src/conexp/contrib/algorithms/bitwise.clj
+++ src/conexp/contrib/algorithms/bitwise.clj
@@ -12,8 +12,7 @@
   (:use [clojure.contrib.seq-utils :only (indexed)])
   (:use [conexp.fca.contexts :only (objects attributes incidence)]))

-
-;(set! *warn-on-reflection* true)
+(set! *warn-on-reflection* true)

 ;;; Helpers to convert to and from BitSets

@@ -30,24 +29,22 @@
   [[var bitset] & body]
   `(loop [~var (int (.nextSetBit ~bitset 0))]
      (cond
-       (== -1 ~var)
-       true,
-       (not ~@body)
-       false,
-       :else
-       (recur (.nextSetBit ~bitset (inc ~var))))))
+       (== -1 ~var) true,
+       (not ~@body) false,
+       :else (recur (.nextSetBit ~bitset (inc ~var))))))

 (defmacro dobits
-  ""
+  "Executes body for every bit set in bitset. Var gets bound to the
+  current location of the bit. Before every iteration, end-test (if
+  given) is tested and the loop is stopped if it returns true."
   [[var bitset & end-test] & body]
-  `(let [#^BitSet bitset# ~bitset]
+  `(let [^BitSet bitset# ~bitset]
      (loop [~var (int (.nextSetBit bitset# 0))]
-       (if (or (== -1 ~var)
-	       ~@end-test)
-	 nil
-	 (do
-	   ~@body
-	   (recur (int (.nextSetBit bitset# (inc ~var)))))))))
+       (if (or (== -1 ~var) ~@end-test)
+         nil
+         (do
+           ~@body
+           (recur (int (.nextSetBit bitset# (inc ~var)))))))))

 (defn filter-bitset
   "Returns a new bitset of all bits in bitset for which predicate returns true."
@@ -55,40 +52,45 @@
   (let [result (BitSet.)]
     (dobits [i bitset]
       (when (predicate i)
-	(.set result i)))
+        (.set result i)))
     result))

 (defn to-bitset
-  ""
+  "Converts hashset to a BitSet. Elements are associated with indices
+  as given by element-vector (i.e. the order in this vector is the
+  order of the elements in the resulting BitSet."
   [element-vector hashset]
-  (let [#^BitSet bs (BitSet. (count element-vector))]
+  (let [^BitSet bs (BitSet. (count element-vector))]
     (doseq [pair (indexed element-vector)
-	    :when (contains? hashset (second pair))]
+            :when (contains? hashset (second pair))]
       (.set bs (first pair)))
     bs))

 (defn to-hashset
-  ""
-  [element-vector #^BitSet bitset]
-  (loop [pos (int (.nextSetBit bitset 0))
-	 result #{}]
+  "Converts given bitset to a set, where element-vector gives the
+  actual objects to be collected, i.e. element v at position p in
+  element-vector is included in the result iff p is set in bitset."
+  [element-vector, ^BitSet bitset]
+  (loop [pos (int (.nextSetBit bitset 0)),
+         result #{}]
     (if (== -1 pos)
       result
       (recur (.nextSetBit bitset (inc pos))
-	     (conj result (nth element-vector pos))))))
+             (conj result (nth element-vector pos))))))

 (defn to-binary-matrix
-  ""
+  "Converts the incidence-relation to a binary matrix (in the sense of
+  Java) filled with 1 and 0."
   [object-vector attribute-vector incidence-relation]
   (let [incidence-matrix (make-array Integer/TYPE (count object-vector) (count attribute-vector))]
     (dotimes [obj-idx (count object-vector)]
-      (let [#^ints row (aget #^objects incidence-matrix obj-idx)]
-	(dotimes [att-idx (count attribute-vector)]
-	  (aset row att-idx
-		(if (contains? incidence-relation [(nth object-vector obj-idx)
-						   (nth attribute-vector att-idx)])
-		  (int 1)
-		  (int 0))))))
+      (let [^ints row (aget ^objects incidence-matrix obj-idx)]
+        (dotimes [att-idx (count attribute-vector)]
+          (aset row att-idx
+                (if (contains? incidence-relation [(nth object-vector obj-idx)
+                                                   (nth attribute-vector att-idx)])
+                  (int 1)
+                  (int 0))))))
     incidence-matrix))

 (defn to-binary-context
@@ -96,16 +98,12 @@
   attribute-count, incidence-matrix] of context with the obvious
   definitions."
   [context]
-  (let [object-vector (vec (objects context))
-	attribute-vector (vec (attributes context))
-
-	object-count (count object-vector)
-	attribute-count (count attribute-vector)
-
-	incidence-matrix (to-binary-matrix object-vector attribute-vector (incidence context))]
-    [object-vector attribute-vector,
-     object-count  attribute-count,
-     incidence-matrix]))
+  (let [object-vector    (vec (objects context)),
+        attribute-vector (vec (attributes context)),
+        object-count     (count object-vector),
+        attribute-count  (count attribute-vector),
+        incidence-matrix (to-binary-matrix object-vector attribute-vector (incidence context))]
+    [object-vector attribute-vector object-count attribute-count incidence-matrix]))

 (defmacro with-binary-context
   "For a given context defines object-vector, attribute-vector,
@@ -117,23 +115,29 @@
      ~@body))

 (defn bitwise-object-derivation
-  ""
-  [incidence-matrix object-count attribute-count #^BitSet bitset]
-  (let [#^BitSet derived-attributes (BitSet. attribute-count)]
+  "Implements object derivation for BitSets."
+  [incidence-matrix, object-count, attribute-count, ^BitSet bitset]
+  (let [^BitSet derived-attributes (BitSet. attribute-count)]
     (dotimes [att (int attribute-count)]
-      (if (forall-in-bitset [obj bitset]
-	    (== 1 (deep-aget ints incidence-matrix obj att)))
-	(.set derived-attributes att)))
+      (when (forall-in-bitset [obj bitset]
+              (== 1 (deep-aget ints incidence-matrix obj att)))
+        (.set derived-attributes att)))
     derived-attributes))

 (defn bitwise-attribute-derivation
-  ""
-  [incidence-matrix object-count attribute-count #^BitSet bitset]
-  (let [#^BitSet derived-objects (BitSet. object-count)]
+  "Implements attribute derivation for BitSets."
+  [incidence-matrix, object-count, attribute-count, ^BitSet bitset]
+  (let [^BitSet derived-objects (BitSet. object-count)]
     (dotimes [obj (int object-count)]
-      (if (forall-in-bitset [att bitset]
-	    (== 1 (deep-aget ints incidence-matrix obj att)))
-	(.set derived-objects obj)))
+      (when (forall-in-bitset [att bitset]
+              (== 1 (deep-aget ints incidence-matrix obj att)))
+        (.set derived-objects obj)))
     derived-objects))

+;;;
+
+(set! *warn-on-reflection* false)
+
+;;;
+
 nil


small changes to the scanning notification text

--- src/mafia_votecount/views/create_game.clj
+++ src/mafia_votecount/views/create_game.clj
@@ -45,6 +45,6 @@
                      (log/info "Succesfully added game"))
                     (catch Exception e
                       (log/error e "Failed to scan game"))))
-                "Game is being added. Scanning may take long time")
-              "Game is already in database"))
-      "Invalid url")))
+                "Game is being added. Scanning may take a long time - please return to the homepage and reload the page.")
+              "Game is already in the database"))
+      "Invalid URL")))


fix import

fix import

--- src/ruuvi_server/heroku/heroku_config.clj
+++ src/ruuvi_server/heroku/heroku_config.clj
@@ -1,4 +1,5 @@
 (ns ruuvi-server.heroku.heroku-config
+  (:import java.net.URI)
   )

 (def database-config


comment routing related vizs

comment routing related vizs

--- dev/user.clj
+++ dev/user.clj
@@ -8,14 +8,19 @@
             [polismath.math.named-matrix :as nm]
             [polismath.math.corr :as corr]
             [polismath.tasks :as tasks]
+            [plumbing.core :as plmb]
             [honeysql.core :as honey]
             [clojure.core.matrix :as matrix]
             [clojure.core.async :as async :refer [>! <! >!! <!! go go-loop thread]]
+            [clojure.set :as set]
+            [clojure.string :as string]
+            [clojure.pprint :as pp]
             [environ.core :as env]
             [taoensso.timbre :as log]
             [taoensso.timbre.profiling :as prof]
             [vizard.core :as viz]
-            [clojure.data.json :as json]))
+            [cheshire.core :as chesh]
+            [tentacles.gists :as gists]))

 ;; Conv loading utilities
@@ -44,20 +49,60 @@
       (:group-votes conv))))

+(defn importance-metric
+  [A P S E]
+  (let [p (/ (+ P 1) (+ S 2))
+        a (/ (+ A 1) (+ S 2))]
+    (* (- 1 p) (+ E 1) a)))
+
+
+(defn cmnt-stats
+  [conv tid extremity]
+  (let [group-votes (:group-votes conv)
+        {:as total-votes :keys [A D S P]}
+        ;; reduce over votes per group, already aggregated
+        (reduce
+          (fn [votes [gid data]]
+            (let [{:as data :keys [A S D]} (get-in data [:votes tid])
+                  data (assoc data :P (+ (- S (+ A D))))]
+              ;; Add in each of the data's kv count pairs
+              (reduce
+                (fn [votes' [k v]]
+                  (update votes' k + v))
+                votes
+                data)))
+          {:A 0 :D 0 :S 0 :P 0}
+          group-votes)
+        importance
+        (importance-metric A P S extremity)
+        priority
+        (get-in conv [:comment-priorities tid])]
+    (log/spy
+      {:total-votes (str total-votes)
+       :priority priority
+       :importance importance
+       :fontSize (* priority 40)})))
+
+
 (defn comments-data
   [conv]
-  (map
-    (fn [tid extremity [x y]]
-      (merge
-        {:label tid
-         :x x
-         :y y
-         :extremity extremity
-         :type "comment"}
-        (cmnt-group-votes conv tid)))
-    (:tids conv)
-    (-> conv :pca :comment-extremity)
-    (-> conv :pca :comment-projection matrix/transpose)))
+  (->>
+    (map
+      (fn [tid extremity [x y]]
+        (merge
+          {:tid tid
+           :label tid
+           :x x
+           :y y
+           :extremity extremity
+           :type "comment"}
+          (cmnt-group-votes conv tid)
+          (cmnt-stats conv tid extremity)))
+      (:tids conv)
+      (-> conv :pca :comment-extremity)
+      (-> conv :pca :comment-projection matrix/transpose))
+    (remove (comp (:mod-out conv) :tid))))
+

 (defn groups-data
   [conv]
@@ -112,13 +157,14 @@
         subgroups))
     (:subgroup-clusters conv)))

+
 (defn conv-data
   [conv]
   (concat
     (comments-data conv)
     (groups-data conv)
-    (subgroup-clusters-data conv)))
-    ;(base-clusters-data conv)))
+    (subgroup-clusters-data conv)
+    (base-clusters-data conv)))

 (def size-scale
@@ -148,17 +194,163 @@
            {:mark "text"
             :encoding {:x {:field "x"}
                        :y {:field "y"}
+                       :size {:field "fontSize"}
                        :text {:field "label"}}}]})

-(defn p! [conv]
-  (viz/p! (assoc conv-plot :data {:values (conv-data conv)})))
+(def conv-plot
+  {:width 2000
+   :height 1300
+   :layer [
+           {:mark "rule"
+            :encoding {:x {:value 0 :scale {:zero false}}}}
+           ;{:mark "rule"
+           ; :encoding {:x {:value 0.0}}}
+           {:mark {:type "point" :filled true}
+            :encoding {:x {:field "x"}
+                       :y {:field "y"}
+                       :size {:field "size" :scale size-scale}
+                       :color {:field "type"}}}
+           {:mark "point"
+            :encoding {:x {:field "x"}
+                       :y {:field "y"}
+                       :size {:field "size"
+                              :scale size-scale}
+                       :opacity {:value 0.5}
+                       :color {:value "#000"}}}
+           {:mark "text"
+            :encoding {:x {:field "x"}
+                       :y {:field "y"}
+                       :size {:field "fontSize"}
+                       :text {:field "label"}}}]})
+
+
+
+(defn p!
+  ([conv]
+   (viz/p! (assoc conv-plot :data {:values (conv-data conv)}))))

 ;; Test calls here
 ;(def plot-data
 ;  (conv-data conv))
 ;(def the-plot
-;  (p! conv))
-
+  ;(p! conv))
+
+
+(defn integrate
+  [coll]
+  (:result
+    (reduce
+      (fn [result x]
+        (-> result
+          (update :total + x)
+          (update :result conj (+ (:total result) x))))
+      {:total 0 :result []}
+      coll)))
+
+(defn plot-priorities!
+  [conv & {:keys [strict-mod exclude-meta]}]
+  (let [values
+        (->> (:comment-priorities conv)
+             (remove (comp
+                       (set/union
+                         (if exclude-meta (:meta-tids conv) #{})
+                         (if strict-mod
+                           (set/difference (set (:tids conv)) (:mod-in conv))
+                           (set/difference (:mod-out conv) (:meta-tids conv))))
+                       first))
+             (sort-by second))
+        max-integral
+        (apply max (integrate (vals values)))
+        comments
+        (into {} (map (fn [c] [(:tid c) c])
+                      (comments-data conv)))
+        entities
+        (map
+          (fn [i [tid x] X]
+            (merge
+              (get comments tid)
+              {:rank i
+               :rank-perc (/ i (count values))
+               :tid tid
+               :priority x
+               :integral X
+               :prob (/ X max-integral)
+               :is-meta (boolean (get (:meta-tids conv) tid))
+               :mod-out (boolean (get (:mod-out conv) tid))}))
+          (range)
+          values
+          (integrate (vals values)))]
+    (viz/p!
+      {:data {:values entities}
+       :title "Priority CDF"
+       :width 1400
+       :height 900
+       :mark "bar"
+       :encoding {:x {:field "rank-perc"}
+                  :y {:field "prob"}}})))
+                  ;:y {:field "priority"}}})))
+
+
+
+(defn gist-plot!
+  [name plot]
+  (let [plot-json (chesh/generate-string plot)
+        gist (gists/create-gist {name plot-json} {:description "Vega plot; see " :public false})]
+    ;(pp/pprint (update gist :files dissoc :content))))
+    gist))
+
+(defn vega-editor-url
+  [gist-url]
+  (str
+    "https://vega.github.io/editor/#/gist/vega-lite/"
+    (-> gist-url (string/split #"\/") reverse (->> (take 2) reverse (string/join "/")))))
+
+(defn publish-plot!
+  [name plot]
+  (let [gist (gist-plot! name plot)
+        gist-url (:url gist)]
+    (log/info "Gist url:" gist-url)
+    (log/info "Vega editor url:" (vega-editor-url gist-url))))
+
+;(publish-plot! "linear" priority-plot)
+
+
+
+;(:profile-data conv)
+;(:mod-out conv)
+;(->> (:comment-priorities conv)
+     ;(remove (comp (:mod-out conv) first))
+     ;vals
+     ;;(map #(matrix/pow % 2))
+     ;sort
+     ;integrate)
+     ;(apply +))
+
+;;135 -> 199
+
+
+(defn prob-dist
+  "Messy function for investigating statistical distributions. Given a sample of comments selected
+  from the server's get comments fn, or from a page reload, this function returns the subset of those
+  comments which fall in the uppermost percentile of comments. By tracing back y values on a cdf plot to
+  the x values at which they intersect the cft, you can get a sense of what portion of sample should fall
+  within the specified percentile and then compare that to what you get here."
+  [conv sample percentile & {:keys [in-conv]}]
+  (let [comment-priorities
+        (->> (:comment-priorities conv)
+             (sort-by second)
+             (remove (comp (set/difference (:mod-out conv) (:meta-tids conv))
+                           first))
+             (filter (comp
+                       (set (or in-conv (:tids conv)))
+                       first)))]
+    (log/info (count (vec comment-priorities)))
+    (set/intersection
+      (into #{}
+        (map first
+          (take-last (log/spy :info (int (* (count comment-priorities) percentile)))
+                     comment-priorities)))
+      (set sample))))

@@ -168,7 +360,7 @@
   (viz/start-plot-server!)
   ;; Run one of these to interactively test out a particular system or subsystem
   (runner/run! system/base-system {:math-env :preprod})
-  ;(runner/run! system/poller-system {:math-env :dev :poll-from-days-ago 0.1})
+  (runner/run! system/poller-system {:math-env :dev :poll-from-days-ago 0.1})
   ;(runner/run! system/task-system {:math-env :preprod :poll-from-days-ago 3})
   ;(runner/run! system/full-system {:math-env :preprod :poll-from-days-ago 0.1})
   ;(runner/run! system/darwin-system)
@@ -186,22 +378,40 @@
   ;(def zid 17175)
   ;(def zid 16703)
   ;(def zid 16906)
-  (def zid 17890)
+  ;(def zid 17890)
+  (def zid 18115)
   (def args {:zid zid})
-

   (def conv
     (-> (load-conv args)
         (conv/conv-update [])))

-  (println (:tids conv))
+  (def priority-plot (plot-priorities! conv :strict-mod true :exclude-meta true))
+  (pp/pprint priority-plot)
+  (publish-plot! "comments-buble-up.json" priority-plot)
+
+
+  (->> (nm/get-matrix (:raw-rating-mat conv))
+       matrix/shape)
+  (sort (keys conv))
+  ;(let [matrix (nm/get-matrix (:raw-rating-mat conv))]
+    ;(->> matrix
+         ;matrix/columns
+         ;(map
+           ;(fn [col]
+             ;(let [seen (remove nil? col)
+                   ;agree ()]
+               ;#(/ % (-> matrix matrix/shape first))
+               ;count
+               ;double)))
+         ;sort))

   ;; Look at profile output
   (sort-by (comp - second) @(:profile-data conv))
   (reduce + (map second @(:profile-data conv)))

   ;; Plot the conversation
-  (do (p! conv) nil)
+  (p! conv)

   ;; Run correlation matrix
   ;(corr/default-tids conv)


Enable figwheel

Enable figwheel

--- dev/user.clj
+++ dev/user.clj
@@ -6,6 +6,7 @@
   []
   (f/start-figwheel! {:builds [{:id :dev
                                 :source-paths ["src"]
+                                :figwheel true
                                 :compiler {:main 'xom.ui
                                            :asset-path "js/compiled/out"
                                            :output-to "resources/public/js/compiled/xom.js"
@@ -14,3 +15,6 @@
                                            }
                                 }]}))

+(defn stop
+  []
+  (f/stop-figwheel!))


pull aspire namespaces into the 'user ns with their conventional abbreviations

--- dev/user.clj
+++ dev/user.clj
@@ -6,8 +6,8 @@
             [clojure.test :as test]
             [clojure.tools.namespace.repl :refer (refresh refresh-all)]
             [hickory.core :as hickory]
-            [aspire.core :as aspire.core]
-            [aspire.conf :as aspire.conf]
+            [aspire.core :as a-core]
+            [aspire.conf :as a-conf]
             [aspire.templates :as a-tpl]
             [net.cgrand.enlive-html :as en]
             ))
@@ -21,20 +21,20 @@
         mydir (format "%s/.aspire" home)
         args ["--verbose"
               "--config-path" mydir]
-        [opts conf] (aspire.core/opts-and-conf-from-args args)]
-    (alter-var-root #'system (constantly (aspire.core/system conf)))
+        [opts conf] (a-core/opts-and-conf-from-args args)]
+    (alter-var-root #'system (constantly (a-core/system conf)))
     system))

 (defn start!
   "Starts the current development system."
   []
-  (alter-var-root #'system aspire.core/start!))
+  (alter-var-root #'system a-core/start!))

 (defn stop!
   "Shuts down and destroys the current development system."
   []
   (alter-var-root #'system
-                  (fn [s] (when s (aspire.core/stop! s)))))
+                  (fn [s] (when s (a-core/stop! s)))))

 (defn go
   "Initializes the current development system and starts it running."


Save the ID column type for realtime rows

This is important so that we can have any type of ID column available
for realtime SQL

--- src/webapp/framework/server/systemfns.clj
+++ src/webapp/framework/server/systemfns.clj
@@ -504,7 +504,7 @@
         sql-to-create-admin-table "
         CREATE TABLE coils_users
         (
-        id serial NOT NULL,
+        id character varying NOT NULL,
         user_name character varying,
         CONSTRAINT users_pkey PRIMARY KEY (id)
         );
@@ -546,6 +546,7 @@
         record_timestamp    timestamp without time zone,
         record_table_name   character varying,
         record_id           character varying,
+        record_id_type      character varying,
         record_operation    character varying,
         record_status       character varying
         );
@@ -588,9 +589,11 @@
         $BODY$
         BEGIN
         INSERT INTO coils_realtime_log
-        (record_timestamp,  record_table_name,  record_id,  record_operation,  record_status)
+        (record_timestamp,  record_table_name,  record_id, record_id_type, record_operation,  record_status)
         VALUES
-        ( now(),   TG_TABLE_NAME ,  NEW.id,  'INSERT',  'WAITING');
+        ( now(),   TG_TABLE_NAME ,  NEW.id,
+        (select data_type from information_schema.columns where column_name='id' and table_name = TG_TABLE_NAME),
+        'INSERT',  'WAITING');
         RETURN NULL;
         END;
         $BODY$
@@ -634,9 +637,11 @@
         $BODY$
         BEGIN
         INSERT INTO coils_realtime_log
-        (record_timestamp,  record_table_name,  record_id,  record_operation,  record_status)
+        (record_timestamp,  record_table_name,  record_id, record_id_type,  record_operation,  record_status)
         VALUES
-        ( now(),   TG_TABLE_NAME ,  NEW.id,  'UPDATE',  'WAITING');
+        ( now(),   TG_TABLE_NAME ,  NEW.id,
+        (select data_type from information_schema.columns where column_name='id' and table_name = TG_TABLE_NAME),
+        'UPDATE',  'WAITING');
         RETURN NULL;
         END;
         $BODY$
@@ -676,9 +681,11 @@
         $BODY$
         BEGIN
         INSERT INTO coils_realtime_log
-        (record_timestamp,  record_table_name,  record_id,  record_operation,  record_status)
+        (record_timestamp,  record_table_name,  record_id, record_id_type,  record_operation,  record_status)
         VALUES
-        ( now(),   TG_TABLE_NAME ,  OLD.id,  'DELETE',  'WAITING');
+        ( now(),   TG_TABLE_NAME ,  OLD.id,
+        (select data_type from information_schema.columns where column_name='id' and table_name = TG_TABLE_NAME),
+        'DELETE',  'WAITING');
         RETURN NULL;
         END;
         $BODY$


-> reflects the intent better here

-> reflects the intent better here

--- test/clojurewerkz/cassaforte/cql_test.clj
+++ test/clojurewerkz/cassaforte/cql_test.clj
@@ -159,9 +159,9 @@
                        (where :city "city_5")
                        (allow-filtering true))]
        (is (= 5
-              (->> res
-                   first
-                   :age))))
+              (-> res
+                  first
+                  :age))))
      (truncate s :users)))

   (deftest test-list-operations


Add a test that came in later in PuppetDB PR 748

--- test/puppetlabs/kitchensink/core_test.clj
+++ test/puppetlabs/kitchensink/core_test.clj
@@ -49,6 +49,17 @@
     (is (datetime? 20)))
   (testing "should return false for an invalid integer")
   (is (not (datetime? -9999999999999999999999999999999))))
+
+(deftest test-true-str?
+  (are [t-or-f? str-val] (t-or-f? (true-str? str-val))
+
+                         true? "true"
+                         true? "TRUE"
+                         true? "TrUe"
+
+                         false? "false"
+                         false? nil
+                         false? "FALSE"))

 (deftest quotient-test
   (testing "quotient"


fixed shutdown hook removal

fixed shutdown hook removal

--- storm-multicore/src/clj/backtype/storm/LocalCluster.clj
+++ storm-multicore/src/clj/backtype/storm/LocalCluster.clj
@@ -55,7 +55,7 @@

 (defn -shutdown
   [this]
-  (.removeShutdownHook (:shutdown-hook (. this state)))
+  (.removeShutdownHook (Runtime/getRuntime) (:shutdown-hook (. this state)))
   (.shutdown (:nimbus (. this state))))


Adding support for asserting attribute values; adding support for the input elements wrapped manually by Om, since they aren't straight React DOM elements

--- web-client/test/test_burgerboard/huh.cljs
+++ web-client/test/test_burgerboard/huh.cljs
@@ -4,7 +4,7 @@
    [cemerick.cljs.test :as t]
    [om.core :as om :include-macros true]
    [om.dom :as dom :include-macros true]
-   [clojure.string :refer [upper-case]]
+   [clojure.string :refer [lower-case]]
    )
   )

@@ -40,14 +40,22 @@
     )
   )

-(defn tag [tag-name & tests]
+(defn tag-name [component]
+  (cond
+   (fn? (.-getDisplayName component)) (.getDisplayName component)
+   (not (nil? (.-tagName component))) (lower-case (.-tagName component))
+   :else (.-type (.-props component))
+    )
+  )
+
+(defn tag [expected-tag & tests]
   (fn [component]
-    (let [actual (.-tagName component)]
-      (if-not (= (upper-case tag-name) actual)
-        {:msg "Tag does not match" :expected tag-name :actual actual}
+    (let [actual (tag-name component)]
+      (if-not (= expected-tag actual)
+        {:msg "Tag does not match" :expected expected-tag :actual actual}
         (if (empty? tests)
           true
-          (test-predicates tests component {:in (str "tag " tag-name)})
+          (test-predicates tests component {:in (str "tag " expected-tag)})
           )
         )
       )
@@ -135,3 +143,15 @@
       )
     )
   )
+
+(defn with-attr [attr-name attr-value]
+  (fn [component]
+    (let [actual-value (aget (.. component -props) attr-name)]
+      (if (= attr-value actual-value)
+        true
+        {:msg "Attribute value does not match"
+         :expected attr-value :actual actual-value}
+        )
+      )
+    )
+  )


Unit test for function read-building-jobs-from-jenkins

--- test/emender_jenkins/rest_api_test.clj
+++ test/emender_jenkins/rest_api_test.clj
@@ -640,3 +640,43 @@
         ""         {"task" {"name" ""}}
         "job-name" {"task" {"name" "job-name"}}))

+
+(def building-jobs-jenkins-response
+    (str
+    "{\"_class\":\"hudson.model.ListView\","
+    "\"jobs\":["
+        "{\"_class\":\"hudson.model.FreeStyleProject\",\"name\":\"test-Example_Documentation-1.0-Guide-en-US (preview)\",\"url\":\"http://10.20.30.40:8080/job/test-Example_Documentation-1.0-Guide-en-US%20(preview)/\",\"buildable\":true,\"color\":\"yellow_anime\",\"lastSuccessfulBuild\":{\"_class\":\"hudson.model.FreeStyleBuild\",\"description\":\"Total: 4  Passed: 1  Failed: 3\"},\"scm\":{\"_class\":\"hudson.plugins.git.GitSCM\",\"userRemoteConfigs\":[{\"url\":\"git@git.domain.name:example-documentation/guide.git\"}]}},"
+        "{\"_class\":\"hudson.model.FreeStyleProject\",\"name\":\"test-Example_Documentation-1.0-Guide-en-US (stage)\",\"url\":\"http://10.20.30.40:8080/job/test-Example_Documentation-1.0-Guide-en-US%20(stage)/\",\"buildable\":true,\"color\":\"yellow_anime\",\"lastSuccessfulBuild\":{\"_class\":\"hudson.model.FreeStyleBuild\",\"description\":\"Total: 4  Passed: 1  Failed: 3\"},\"scm\":{\"_class\":\"hudson.plugins.git.GitSCM\",\"userRemoteConfigs\":[{\"url\":\"git@git.domain.name:example-documentation/guide.git\"}]}}"
+        "]}"))
+
+(deftest test-read-building-jobs-from-jenkins
+    "Check the function emender-jenkins.rest-api/read-building-jobs-from-jenkins."
+    (with-redefs [jenkins-api/get-command (fn [all-jobs-url] building-jobs-jenkins-response)]
+        (is (= (read-building-jobs-from-jenkins "url" "job-list-part")
+               [{"_class" "hudson.model.FreeStyleProject",
+                 "name" "test-Example_Documentation-1.0-Guide-en-US (preview)",
+                 "url"
+                 "http://10.20.30.40:8080/job/test-Example_Documentation-1.0-Guide-en-US%20(preview)/",
+                 "buildable" true,
+                 "color" "yellow_anime",
+                 "lastSuccessfulBuild"
+                 {"_class" "hudson.model.FreeStyleBuild",
+                  "description" "Total: 4  Passed: 1  Failed: 3"},
+                  "scm"
+                 {"_class" "hudson.plugins.git.GitSCM",
+                  "userRemoteConfigs"
+                  [{"url" "git@git.domain.name:example-documentation/guide.git"}]}}
+                {"_class" "hudson.model.FreeStyleProject",
+                 "name" "test-Example_Documentation-1.0-Guide-en-US (stage)",
+                 "url"
+                 "http://10.20.30.40:8080/job/test-Example_Documentation-1.0-Guide-en-US%20(stage)/",
+                 "buildable" true,
+                 "color" "yellow_anime",
+                 "lastSuccessfulBuild"
+                 {"_class" "hudson.model.FreeStyleBuild",
+                  "description" "Total: 4  Passed: 1  Failed: 3"},
+                 "scm"
+                 {"_class" "hudson.plugins.git.GitSCM",
+                  "userRemoteConfigs"
+                  [{"url" "git@git.domain.name:example-documentation/guide.git"}]}}]))))
+


Fix test

Fix test

--- test/onyx/plugin/bench_plugin_test.clj
+++ test/onyx/plugin/bench_plugin_test.clj
@@ -9,11 +9,9 @@

 (def id (java.util.UUID/randomUUID))

-(def scheduler :onyx.job-scheduler/greedy)
+(def scheduler :onyx.job-scheduler/balanced)

 (def messaging :netty)
-;(def messaging :aleph-tcp)
-;(def messaging :netty-tcp)

 (def env-config
   {:zookeeper/address "127.0.0.1:2189"
@@ -36,20 +34,24 @@
    :onyx/id id
    :onyx.messaging/bind-addr "127.0.0.1"
    :onyx.messaging/peer-ports (vec (range 40000 40200))
-   ;:onyx.peer/join-failure-back-off 500
    :onyx.peer/job-scheduler scheduler
    :onyx.messaging/impl messaging})
+
+
+(println "Starting env")
+(def env (onyx.api/start-env env-config))

 (def peer-group
   (onyx.api/start-peer-group peer-config))

-(def batch-size 1)
+(def batch-size 20)
 (def batch-timeout 100)

 (def counter (atom 0))
+(def retry-counter (atom 0))
+

 (defn my-inc [{:keys [n] :as segment}]
-  (swap! counter inc)
   (assoc segment :n (inc n)))

 (def catalog
@@ -60,7 +62,25 @@
     :onyx/batch-timeout batch-timeout
     :onyx/batch-size batch-size}

-   {:onyx/name :inc
+   {:onyx/name :inc1
+    :onyx/fn :onyx.plugin.bench-plugin-test/my-inc
+    :onyx/type :function
+    :onyx/batch-timeout batch-timeout
+    :onyx/batch-size batch-size}
+
+   {:onyx/name :inc2
+    :onyx/fn :onyx.plugin.bench-plugin-test/my-inc
+    :onyx/type :function
+    :onyx/batch-timeout batch-timeout
+    :onyx/batch-size batch-size}
+
+   {:onyx/name :inc3
+    :onyx/fn :onyx.plugin.bench-plugin-test/my-inc
+    :onyx/type :function
+    :onyx/batch-timeout batch-timeout
+    :onyx/batch-size batch-size}
+
+   {:onyx/name :inc4
     :onyx/fn :onyx.plugin.bench-plugin-test/my-inc
     :onyx/type :function
     :onyx/batch-timeout batch-timeout
@@ -76,19 +96,18 @@

 ;; TO TEST

-(defn inject-no-op-ch [event lifecycle]
-  {:core.async/chan (chan (dropping-buffer 1))})
+(def workflow [[:in :inc1]
+               [:inc1 :inc2]
+               [:inc2 :inc3]
+               [:inc3 :inc4]
+               [:inc4 :no-op]])

-(def workflow [[:in :inc] [:inc :no-op]])

-(println "Starting env")
-(def env (onyx.api/start-env env-config))
 (println "starting Vpeers")
+(def v-peers (onyx.api/start-peers 6 peer-group))

-(def v-peers (onyx.api/start-peers 6 peer-group))
 (println "Started vpeers")
-
-(def bench-length 100000)
+(def bench-length 300000)

 (Thread/sleep 10000)

@@ -96,13 +115,36 @@

 (def start-time-millis (System/currentTimeMillis))

-(def in-calls {:lifecycle/before-task :onyx.plugin.bench-plugin-test/inject-no-op-ch})
+(def bench-calls
+  {:lifecycle/before-task (fn inject-counter-before-task [event lifecycle]
+                            {:counter counter
+                             :retry-counter retry-counter})
+   :lifecycle/after-batch (fn after-batch [event lifecycle]
+                            (swap! (:counter event) + (count (:onyx.core/batch event)))
+                            {})})
+
+(def in-calls {:lifecycle/before-task (fn inject-no-op-ch [event lifecycle]
+                                        {:core.async/chan (chan (dropping-buffer 1))})})

 (def lifecycles
   [{:lifecycle/task :no-op
     :lifecycle/calls :onyx.plugin.bench-plugin-test/in-calls}
    {:lifecycle/task :no-op
-    :lifecycle/calls :onyx.plugin.core-async/writer-calls}])
+    :lifecycle/calls :onyx.plugin.core-async/writer-calls}
+   {:lifecycle/task :in
+    :lifecycle/calls :onyx.plugin.bench-plugin-test/bench-calls}
+   {:lifecycle/task :in
+    :lifecycle/calls :onyx.plugin.bench-plugin/reader-calls}
+   {:lifecycle/task :inc1
+    :lifecycle/calls :onyx.plugin.bench-plugin-test/bench-calls}
+   {:lifecycle/task :inc2
+    :lifecycle/calls :onyx.plugin.bench-plugin-test/bench-calls}
+   {:lifecycle/task :inc3
+    :lifecycle/calls :onyx.plugin.bench-plugin-test/bench-calls}
+   {:lifecycle/task :inc4
+    :lifecycle/calls :onyx.plugin.bench-plugin-test/bench-calls}
+   {:lifecycle/task :no-op
+    :lifecycle/calls :onyx.plugin.bench-plugin-test/bench-calls}])

 (println "Starting job at " (java.util.Date.))
 (onyx.api/submit-job
@@ -116,6 +158,7 @@

 (future
   (while true
+    (println "Retry counter " @retry-counter)
     (println "Update " @counter (float (/ @counter
                                           (/ (- (System/currentTimeMillis) start-time-millis)
                                              1000))) "/sec")


[#38] Removed some unimplemented thrown errors

--- priv/clojure/core.clj
+++ priv/clojure/core.clj
@@ -4508,7 +4508,7 @@
           (let ~lets
             ~@body))))))

-   ;;redefine fn with destructuring and pre/post conditions
+;;redefine fn with destructuring and pre/post conditions

 (defmacro fn
@@ -4927,14 +4927,16 @@
      (walk root)))

 (defn file-seq
-  "A tree seq on java.io.Files"
+  "A tree seq on all files in a directory structure"
   {:added "1.0"
    :static true}
   [dir]
-  (throw "unimplemented")
-  #_(tree-seq
-   (fn [^java.io.File f] (. f (isDirectory)))
-   (fn [^java.io.File d] (seq (. d (listFiles))))
+  (tree-seq
+   (fn [^java.io.File f] (filelib/is_dir.e f))
+   (fn [^java.io.File d] (->> (file/list_dir.e d)
+                             second
+                             (map erlang/list_to_binary.1)
+                             seq))
    dir))

 (defn xml-seq
@@ -5003,8 +5005,7 @@
             (do (vswap! seen conj input)
                 (rf result input))))))))
   ([coll]
-   (throw "unimplemented destructuring")
-   #_(let [step (fn step [xs seen]
+   (let [step (fn step [xs seen]
                 (lazy-seq
                   ((fn [[f :as xs] seen]
                      (when-let [s (seq xs)]


only reload page when html file changed

only reload page when html file changed

--- src/adzerk/boot_reload/reload.cljs
+++ src/adzerk/boot_reload/reload.cljs
@@ -7,8 +7,8 @@

 (def ^:private page-uri (goog.Uri. (.. js/window -location -href)))

-(defn- substring? [s subs]
-  (pos? (.lastIndexOf s subs)))
+(defn- ends-with? [s pat]
+  (= pat (subs s (- (count s) (count pat)))))

 (defn- reload-page! []
   (.reload (.-location js/window)))
@@ -17,11 +17,8 @@
   (when href-or-uri
     (let [uri  (goog.Uri. href-or-uri)
           path (.getPath (.resolve page-uri uri))]
-      (when (not-empty (filter #(substring? % path) changed))
+      (when (not-empty (filter #(ends-with? % path) changed))
         uri))))
-
-(defn- ends-with? [s pat]
-  (= pat (subs s (- (count s) (count pat)))))

 (defn- reload-css [changed]
   (let [sheets (.. js/document -styleSheets)]
@@ -50,7 +47,11 @@
           (fn [e] (.error js/console "Load failed:" (.-message e))))))))

 (defn- reload-html [changed]
-  (when (changed-href? page-uri changed) (reload-page!)))
+  (let [page-path (.getPath page-uri)
+        html-path (if (ends-with? page-path "/")
+                    (str page-path "index.html")
+                    page-path)]
+    (when (changed-href? html-path changed) (reload-page!))))

 (defn- group-log [title things-to-log]
   (.groupCollapsed js/console title)


+log/debugs; comments

+log/debugs; comments

--- src/babel/francais/morphology.cljc
+++ src/babel/francais/morphology.cljc
@@ -57,9 +57,18 @@
     (filter (fn [lexeme]
               (and
                (= infinitive (get-in lexeme [:français :infinitive] ::none))
+               (or (log/debug (str " found an infinitive match:" (strip-refs lexeme))) true)
+
+               ;; add other (get-in) constraints here, if necessary:
+               ;; ..
+
+               ;; (unify) with spec should be last since it is expensive:
                (not (fail? (unify spec lexeme)))
-               (or (log/debug (str "lookup-in: matched: " (strip-refs lexeme)))
-                   true)))
+
+               (or (log/debug (str " found a unify match:" (strip-refs lexeme))) true)
+
+
+               (or (log/debug (str "lookup-in: matched: " (strip-refs lexeme))) true)))
             lexemes)))

 (defn conjugate [infinitive unify-with & [lexicon]]


refactor morphological analysis a bit

refactor morphological analysis a bit

--- src/babel/francais/morphology.cljc
+++ src/babel/francais/morphology.cljc
@@ -548,20 +548,20 @@
                                        :subcat {:1 {:agr {:number :plur
                                                           :gender :masc}}}}}}]
    ;; -er and -ir type verbs
-   #"^(\S+)e$" [;; reflexive verbs beginning with a vowel: (e.g. "s'amuser") : 1st singular
-                {:replace-with "er"
-                 :replace-pattern "s'$1"
-                 :structure {:synsem {:subcat {:1 {:agr {:number :sing
-                                                         :person :1st}}}
-                                      :infl :present}}}
-                ;; reflexive verbs beginning with a vowel: (e.g. "s'amuser") : 3rd singular
-                {:replace-with "er"
-                 :replace-pattern "s'$1"
-                 :structure {:synsem {:subcat {:1 {:agr {:number :sing
-                                                         :person :3rd}}}
-                                      :infl :present}}}
-
-                ;; reflexive verbs beginning with a non-vowel: (e.g. "se lever") : 1st singular
+   #"^([aeéiou]\S+)e$" [;; reflexive verbs beginning with a vowel: (e.g. "s'amuser") : 1st singular
+                       {:replace-with "er"
+                        :replace-pattern "s'$1"
+                        :structure {:synsem {:subcat {:1 {:agr {:number :sing
+                                                                :person :1st}}}
+                                             :infl :present}}}
+                       ;; reflexive verbs beginning with a vowel: (e.g. "s'amuser") : 3rd singular
+                       {:replace-with "er"
+                        :replace-pattern "s'$1"
+                        :structure {:synsem {:subcat {:1 {:agr {:number :sing
+                                                                :person :3rd}}}
+                                             :infl :present}}}]
+
+   #"^(\S+)e$" [;; reflexive verbs beginning with a non-vowel: (e.g. "se lever") : 1st singular
                 {:replace-with "er"
                  :replace-pattern "se $1"
                  :structure {:synsem {:subcat {:1 {:agr {:number :sing
@@ -597,22 +597,36 @@
                                       :infl :present}}}
                 ]

-
+   ;; -er and -ir type verbs
+   #"^(aeéiou\S+)es$" [;; reflexive verbs beginning with a vowel: (e.g. "s'amuser") : 2nd singular
+                       {:replace-with "er"
+                        :replace-pattern "s'$1"
+                        :structure {:synsem {:subcat {:1 {:agr {:number :sing
+                                                                :person :2nd}}}
+                                             :infl :present}}}
+                       {:replace-with "er" ;; parle -> parler
+                        :structure {:synsem {:subcat {:1 {:agr {:number :sing
+                                                                :person :2nd}}}
+                                             :infl :present}}}
+                       {:replace-with "ir" ;; dorme -> dormir
+                        :structure {:synsem {:subcat {:1 {:agr {:number :sing
+                                                                :person :2nd}}}
+                                             :infl :present}}}]
+
    ;; -er and -ir type verbs
    #"^(\S+)es$" [;; reflexive verbs beginning with a vowel: (e.g. "s'amuser") : 2nd singular
-                {:replace-with "er"
-                 :replace-pattern "s'$1"
-                 :structure {:synsem {:subcat {:1 {:agr {:number :sing
-                                                         :person :2nd}}}
-                                      :infl :present}}}
+                 {:replace-with "er"
+                  :replace-pattern "s'$1"
+                  :structure {:synsem {:subcat {:1 {:agr {:number :sing
+                                                          :person :2nd}}}
+                                       :infl :present}}}

                  ;; reflexive verbs beginning with a non-vowel: (e.g. "se lever") : 2nd singular
-                {:replace-with "er"
-                 :replace-pattern "se $1"
-                 :structure {:synsem {:subcat {:1 {:agr {:number :sing
-                                                         :person :2nd}}}
-                                      :infl :present}}}
-
+                 {:replace-with "er"
+                  :replace-pattern "se $1"
+                  :structure {:synsem {:subcat {:1 {:agr {:number :sing
+                                                          :person :2nd}}}
+                                       :infl :present}}}
                  {:replace-with "er" ;; parle -> parler
                   :structure {:synsem {:subcat {:1 {:agr {:number :sing
                                                           :person :2nd}}}
@@ -621,7 +635,7 @@
                   :structure {:synsem {:subcat {:1 {:agr {:number :sing
                                                           :person :2nd}}}
                                        :infl :present}}}]
-
+
    }
   )


added exploit target field descriptions

added exploit target field descriptions

--- src/cia/schemas/exploit_target.clj
+++ src/cia/schemas/exploit_target.clj
@@ -38,14 +38,17 @@
 (s/defschema Weakness
   "See http://stixproject.github.io/data-model/1.2/et/WeaknessType/"
   {:description (describe s/Str "text description of this Weakness")
-   (s/optional-key :cwe_id) s/Str ;; CWE identifier for a particular weakness
+   (s/optional-key :cwe_id)
+   (describe s/Str "CWE identifier") ;; CWE identifier for a particular weakness
    })

 (s/defschema Configuration
   "See http://stixproject.github.io/data-model/1.2/et/ConfigurationType/"
-  {:description s/Str
-   (s/optional-key :short_description) s/Str
-   (s/optional-key :cce_id) s/Str ;; The CCE identifier for a configuration item
+  {:description (describe s/Str "text description of this Configuration")
+   (s/optional-key :short_description)
+   (describe s/Str "short text description of this Configuration")
+   (s/optional-key :cce_id)
+   (describe s/Str "CCE identifier") ;; The CCE identifier for a configuration item
    })

 (s/defschema ExploitTarget
@@ -53,13 +56,20 @@
   (st/merge
    c/GenericStixIdentifiers
    {:timestamp c/Time
-    (s/optional-key :version) s/Str
-    (s/optional-key :vulnerability) [Vulnerability]
-    (s/optional-key :weakness) [Weakness]
-    (s/optional-key :configuration) [Configuration]
-    (s/optional-key :potential_COAs) rel/RelatedCOAs
-    (s/optional-key :source) c/Source
-    (s/optional-key :related_exploit_targets) rel/RelatedExploitTargets
+    (s/optional-key :version)
+    (describe s/Str "schema version for this content")
+    (s/optional-key :vulnerability)
+    (describe [Vulnerability] "identifies and characterizes a Vulnerability as a potential ExploitTarget")
+    (s/optional-key :weakness)
+    (describe [Weakness] "identifies and characterizes a Weakness as a potential ExploitTarget")
+    (s/optional-key :configuration)
+    (describe [Configuration] "identifies and characterizes a Configuration as a potential ExploitTarget")
+    (s/optional-key :potential_COAs)
+    (describe rel/RelatedCOAs "identifies and characterizes a Configuration as a potential ExploitTarget")
+    (s/optional-key :source)
+    (describe c/Source "ExploitTarget source")
+    (s/optional-key :related_exploit_targets)
+    (describe rel/RelatedExploitTargets "identifies and characterizes a Configuration as a potential ExploitTarget")

     ;; Not provided: related_packages (deprecated)
     ;; Not provided: handling


bfs complete

bfs complete

--- src/clj/morpheus/traversal/bfs.clj
+++ src/clj/morpheus/traversal/bfs.clj
@@ -17,8 +17,8 @@
 ; I also took some idea from Charles E. Leiserson and Tao B. Schardl, for the underlying BSP data processing mechanism.
 ; Morpueus will use the task founder server as the only machine for join operations in each level.

+(def tasks-vertices (atom {}))
 (def superstep-tasks (atom {}))
-(def searched-stacks (atom {}))

 (defn fetch-local-edges [task-id vertex-ids]
   )
@@ -44,7 +44,7 @@
                           vertex-res (if with-vertices? vertex (select-keys vertex [:*id*]))
                           edges-res (map (fn [edge]
                                            (assoc (if with-edges? edge {})
-                                             :opp (eb/get-oppisite edge vertex-id)))
+                                             :*opp* (eb/get-oppisite edge vertex-id)))
                                          neighbours)]
                       [vertex-res edges-res]))))
               vertices-stack)
@@ -52,8 +52,21 @@
       :task-id task-id)))

 (defn proc-return-msg [task-id data]
-  (let [[superstep-id vertices-stack] data]
-    (a/>!! (get @superstep-tasks superstep-id) vertices-stack)))
+  (let [[superstep-id vertices-stack] data
+        deepth (get-in @tasks-vertices [task-id :current-level])]
+    (a/go
+      (doseq [[vertex-res edges-res] vertices-stack]
+        (let [vertex-id (:*id* vertex-res)]
+          (swap! tasks-vertices update-in [task-id vertex-id]
+                 #(merge % vertex-res
+                         {:*visited* true
+                          :*edges* edges-res}))
+          (doseq [edge edges-res]
+            (let [opp-id (:*opp* edge)]
+              (swap! tasks-vertices update-in [task-id opp-id]
+                     #(if % % {:*visited* false
+                               :*level* deepth}))))))
+      (a/>! (get @superstep-tasks superstep-id) true))))

 (defn proc-stack [task-id stack]
   (let[server-vertices (partation-vertices stack)
@@ -64,21 +77,34 @@
                                   superstep-chan (a/chan 1)]
                               (swap! superstep-tasks assoc superstep-id superstep-chan)
                               (msg/send-msg server-name :BFS-FORWARD [superstep-id vertex-ids] :task-id task-id)
-                              super-chain)))]
-    (doall (for [step-chain step-chains]
-             (a/<!! step-chain)))))
+                              [superstep-id superstep-chan])))]
+    (doseq [[superstep-id superstep-chan] step-chains]
+      (a/<!! superstep-chan)
+      (swap! superstep-tasks dissoc superstep-id))))

-(defn bfs [vertex {:keys [filters max-deepth stop-cond timeout with-edges? with-vertices?] :as extra-params
+(defn bfs [vertex {:keys [filters max-deepth timeout with-edges? with-vertices?] :as extra-params
                    :or {timeout 60000 max-deepth 8}}]
   "Perform parallel and distributed breadth first search"
   (let [task-id (neb/rand-cell-id)
         vertex-id (:*id* vertex)
         initial-stack [vertex-id]]
     (compute/new-task task-id (assoc extra-params :founder ds/this-server-name))
-    (swap! searched-stacks assoc task-id initial-stack)
+    (swap! tasks-vertices assoc task-id {:current-level 0})
     (proc-stack task-id initial-stack)
-    (doseq [level (range max-deepth)]
-      )))
+    (loop [level 1]
+      (let [vertices (get @tasks-vertices task-id)
+            unvisited (filter
+                        identity
+                        (for [[id vertex] vertices]
+                          (if (get vertex :*visted*)
+                            nil id)))]
+        (when-not (or (empty? unvisited) (> level max-deepth))
+          (proc-stack task-id unvisited)
+          (swap! tasks-vertices update-in [task-id :current-level] inc)
+          (recur (inc level)))))
+    (let [result (get @tasks-vertices task-id)]
+      (swap! tasks-vertices dissoc task-id)
+      result)))

 (msg/register-action :BFS-FORWARD proc-forward-msg)
 (msg/register-action :BFS-RETURN proc-return-msg)


schema

schema

--- src/cljc/salava/badge/schemas.cljc
+++ src/cljc/salava/badge/schemas.cljc
@@ -170,7 +170,7 @@
                             :user_badge_id s/Int
                             :content s/Str
                             :status (s/enum "pending" "accepted" "declined")
-                            :ctime s/Int
+                            :mtime s/Int
                             (s/optional-key :first_name) s/Str
                             (s/optional-key :last_name) s/Str
                             (s/optional-key :profile_picture) (s/maybe s/Str)


renaming

renaming

--- src/cljs/tictactoe/view/panel.cljs
+++ src/cljs/tictactoe/view/panel.cljs
@@ -4,7 +4,7 @@
     ))

-(defn- top-button
+(defn- make-button
   [on-click txt]
   [:button.top-button {:on-click on-click} txt])

@@ -15,7 +15,7 @@
    * The undo button"
   [{:keys [on-restart on-undo]}]
   [:div.scores
-   [top-button on-restart utils/circle-arrow]
+   [make-button on-restart utils/circle-arrow]
    [:h1#title "Tic Tac Toe"]
-   [top-button on-undo utils/back-arrow]
+   [make-button on-undo utils/back-arrow]
    ])


Add missing docstrings and mark some methods private on sse ns.

--- src/clojure/catacumba/impl/sse.clj
+++ src/clojure/catacumba/impl/sse.clj
@@ -19,7 +19,7 @@

 (defprotocol IEvent
-  (event [_] "Create a event"))
+  (^:private event [_] "Create a event"))

 (extend-protocol IEvent
   String
@@ -50,6 +50,8 @@
         (.onSubscribe subscriber subscription)))))

 (defn sse
+  "Start the sse connection with the client
+  and dispatch it in a special hanlder."
   [^DefaultContext context handler]
   (let [out (async/chan 1 (map event))
         pub (channel->publisher out)


Stop using renamed junit task configuration

--- build.boot
+++ build.boot
@@ -20,5 +20,4 @@
        :url         "https://github.com/radicalzephyr/boot-junit"
        :scm         {:url "https://github.com/radicalzephyr/boot-junit"}
        :license     {"Eclipse Public License"
-                     "http://www.eclipse.org/legal/epl-v10.html"}}
- junit {:packages '#{radicalzephyr.boot_junit.test}})
+                     "http://www.eclipse.org/legal/epl-v10.html"}})


Update deps

Update deps

--- build.boot
+++ build.boot
@@ -4,16 +4,16 @@
   :source-paths #{"src/cljs" "src/less" "src/scss" "test/clj" "test/cljs"}
   :resource-paths #{"src/clj" "src/cljc"}
   :dependencies '[[org.clojure/clojure    "1.7.0"]
-                  [org.clojure/clojurescript "1.7.170"]
+                  [org.clojure/clojurescript "1.7.228"]

                   [boot/core              "2.5.2"      :scope "test"]
-                  [adzerk/boot-cljs       "1.7.170-3"  :scope "test"]
+                  [adzerk/boot-cljs       "1.7.228-1"  :scope "test"]
                   [adzerk/boot-cljs-repl  "0.3.0"      :scope "test"]
                   [crisptrutski/boot-cljs-test "0.2.2-SNAPSHOT" :scope "test"]
                   [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.2"      :scope "test"]
+                  [adzerk/boot-reload     "0.4.4"      :scope "test"]
                   [adzerk/boot-test       "1.0.7"      :scope "test"]
                   [deraen/boot-less       "0.5.0"      :scope "test"]
                   ;; For boot-less
@@ -85,7 +85,6 @@
     (cljs-repl :ids #{"js/main"})
     (cljs :ids #{"js/main"})
     (start-app :port port)
-    (test-cljs :namespaces #{"frontend.core-test"})
     (if speak (boot.task.built-in/speak) identity)))

 (deftask run-tests []


Exclude the log4j logger from ring.middleware.logger

--- build.boot
+++ build.boot
@@ -27,8 +27,8 @@
                             [com.stuartsierra/component "0.3.2"]
                             [prismatic/schema "1.1.3"]
                             [environ "1.1.0"]
-                            [org.clojure/tools.logging "0.3.1" :exclusions
-                             [[org.slf4j/slf4j-log4j12 :extension "jar"]]]
+                            [org.clojure/tools.logging "0.3.1"
+                             :exclusions [[org.slf4j/slf4j-log4j12 :extension "jar"]]]
                             [ch.qos.logback/logback-classic "1.1.11"]
                             [org.clojure/core.async "0.3.441"]

@@ -36,7 +36,8 @@
                             [ring "1.5.1"]
                             [http-kit "2.2.0"]
                             [compojure "1.5.2"]
-                            [ring.middleware.logger "0.5.0"]
+                            [ring.middleware.logger "0.5.0"
+                             :exclusions [[org.slf4j/slf4j-log4j12 :extension "jar"]]]
                             [fogus/ring-edn "0.3.0"]
                             [hiccup "1.0.5"]
                             [garden "1.3.2"]


Bump to 0.1.1

Bump to 0.1.1

--- build.boot
+++ build.boot
@@ -1,7 +1,7 @@

 (set-env!
   :project 'irresponsible/unscrew
-  :version "0.1.0"
+  :version "0.1.1"
   :resource-paths #{"src" "resources"}
   :source-paths #{"src"}
   :description "A toolkit for processing jar files"


Update deps

Update deps

--- build.boot
+++ build.boot
@@ -1,19 +1,19 @@
-(def +version+ "0.6.2")
+(def +version+ "0.6.3-SNAPSHOT")

 (set-env!
   :resource-paths #{"src" "boot-less/src" "lein-less4j/src"}
   :source-paths #{"test" "test-resources"}
   :dependencies   '[[org.clojure/clojure "1.8.0" :scope "provided"]
-                    [metosin/boot-alt-test "0.3.0" :scope "test"]
+                    [metosin/boot-alt-test "0.3.2" :scope "test"]
                     ;; Webjars-locator uses logging
-                    [org.slf4j/slf4j-nop "1.7.24" :scope "test"]
+                    [org.slf4j/slf4j-nop "1.7.25" :scope "test"]

                     [com.github.sommeri/less4j "1.17.2"]
                     [com.github.sommeri/less4j-javascript "0.0.1" :exclusions [com.github.sommeri/less4j]]
-                    [org.webjars/webjars-locator "0.32"]
+                    [org.webjars/webjars-locator "0.32-1"]

                     ;; For testing the webjars asset locator implementation
-                    [org.webjars/bootstrap "3.3.6" :scope "test"]])
+                    [org.webjars/bootstrap "3.3.7-1" :scope "test"]])

 (require '[metosin.boot-alt-test :refer [alt-test]])


Fixing problem in atom results with creating atom links.

--- src/cmr/search/results_handlers/atom_results_handler.clj
+++ src/cmr/search/results_handlers/atom_results_handler.clj
@@ -184,7 +184,13 @@
 (defn- add-attribs
   "Returns the attribs with the field-value pair added if there is a value"
   [attribs field value]
-  (if (empty? value) attribs (assoc attribs field value)))
+  (if (or (nil? value)
+          (and (string? value)
+               (empty? value)))
+    attribs
+    (assoc attribs field value)))
+
+

 (defn atom-link->attribute-map
   "Convert an atom link to an XML element"