refactor make-filesystem

refactor make-filesystem

we now create a filesystem from the inisection and merge that with a
"filesystem agnostic" additional filesystem map, which contains things
like the fsid, the new sleep-between-sync, and remove-filters.

--- src/brainbot/nozzle/vfs.clj
+++ src/brainbot/nozzle/vfs.clj
@@ -22,16 +22,30 @@
    (partial inihelper/ensure-protocol Filesystem)
    inihelper/dynaload-section))

+(defn- match-entry?-seq-from-value
+  [system s]
+  (->> s
+       misc/trimmed-lines-from-string
+       (map (partial fsfilter/make-filter system))
+       (map fsfilter/make-match-entry?)))
+
+(defn- duration-from-string
+  [s]
+  (Integer. s))
+
+(defn make-additional-fs-map [system section-name]
+  {:remove-filters (match-entry?-seq-from-value
+                    system
+                    (get-in system [:iniconfig section-name "remove"]))
+   :sleep-between-sync (duration-from-string
+                        (get-in system [:iniconfig section-name "sleep-between-sync"] "3600"))
+   :fsid section-name})
+
 (defn make-filesystem
   [system section-name]
-  (let [fs (dynaload-filesystem system section-name)
-        remove (misc/trimmed-lines-from-string
-                (get-in system [:iniconfig section-name "remove"]))]
-    (assoc fs
-      :remove-filters (->> remove
-                           (map (partial fsfilter/make-filter system))
-                           (map fsfilter/make-match-entry?))
-      :fsid section-name)))
+  (merge
+   (dynaload-filesystem system section-name)
+   (make-additional-fs-map system section-name)))

 (defn- listdir-catch-access-denied


set a default thread exception handler

set a default thread exception handler

--- src/chat/server/handler.clj
+++ src/chat/server/handler.clj
@@ -140,6 +140,18 @@
   :start (nrepl/start-server :port (:nrepl-port (mount/args)))
   :stop (nrepl/stop-server nrepl))

+;; exceptions in background thread handler
+
+(defn set-default-exception-handler
+  []
+  (Thread/setDefaultUncaughtExceptionHandler
+    (reify Thread$UncaughtExceptionHandler
+      (uncaughtException [_ thread ex]
+        (timbre/errorf "Uncaught exception %s on %s" ex (.getName thread))))))
+
+(defstate thread-handler
+  :start (set-default-exception-handler))
+
 ;; main
 (defn -main  [& args]
   (let [port (Integer/parseInt (first args))


Docstring util commit seemed to get clobbered by popping a previous stash :-(

--- src/overtone/doc_util.clj
+++ src/overtone/doc_util.clj
@@ -20,7 +20,8 @@
   "Generates a padding string starting concatting s with len times pad:
    (gen-padding \"\" 5 \"b\") ;=> \"bbbbb\"
    May be called without starting string s in which case it defaults to the
-   empty string."
+   empty string and also without pad in which case it defaults to a single space"
+  ([len] (gen-padding "" len " "))
   ([len pad] (gen-padding "" len pad))
   ([s len pad]
      (if (> len 0)
@@ -30,17 +31,26 @@
 (defn indented-str-block
   "Appends a list ls of strings to string s in a formatted block with a specific
    width max-len and indentation indent. May be called with a basic text string
-   and max-len and indent in which case text will be split on whitespace."
+   and max-len and indent in which case text will be split on whitespace.
+
+  Will clobber all single \n found but will honour two in a row. This allows
+  docstrings to contain \n for formatting purposes in source form rather than
+  require them to exist on one large line."
   ([txt max-len indent] (let [id (str (java.util.UUID/randomUUID))
                               split-text (replace-re #"[\n]{2}" id txt)
                               split-text (replace-str "\n" " " split-text)
-                              split-text (replace-str id "\n" split-text)
+                              split-text (replace-str id "\n\n " split-text)
                               split-text (split #" +" split-text)]
                           (indented-str-block "" split-text 0 max-len indent)))
   ([s ls cur-len max-len indent]
      (if (empty? ls)
        s
        (let [f-len (.length (first ls))]
-         (if (> (+ cur-len f-len) max-len)
-           (indented-str-block (str s "\n" (gen-padding "" indent " ")) ls 0 max-len indent)
-           (indented-str-block (str s (first ls) " ") (rest ls) (+ cur-len f-len) max-len indent))))))
+         (if (.endsWith (first ls) "\n\n")
+           (if (> (+ cur-len f-len) max-len)
+             (indented-str-block (str s "\n" (gen-padding indent) (first ls) (gen-padding indent)) (rest ls) 0 max-len indent)
+             (indented-str-block (str s (first ls) (gen-padding indent)) (rest ls) 0 max-len indent))
+           (if (> (+ cur-len f-len) max-len)
+             (indented-str-block (str s "\n" (gen-padding indent)) ls 0 max-len indent)
+             (indented-str-block (str s (first ls) " ") (rest ls) (+ cur-len f-len) max-len indent))
+           )))))


Percentage task scheduler can remove peers from grouped tasks with flux-policy continue

--- src/onyx/scheduling/percentage_task_scheduler.clj
+++ src/onyx/scheduling/percentage_task_scheduler.clj
@@ -24,7 +24,7 @@
 (defn remove-grouping-tasks [replica job-id allocations]
   (remove
    (fn [[planned-task allocation]]
-     (not (nil? (get-in replica [:flux-policies job-id (:task planned-task)]))))
+     (cts/preallocated-grouped-task? replace job-id planned-task))
    allocations))

 (defn reduce-overallocated-peers


dont trigger draw event if deck is empty

--- src/clj/game/core-rules.clj
+++ src/clj/game/core-rules.clj
@@ -56,21 +56,23 @@
   "Draw n cards from :deck to :hand."
   ([state side] (draw state side 1))
   ([state side n]
-   (let [active-player (get-in @state [:active-player])]
-     (let [n (if (get-in @state [active-player :register :max-draw])
-               (min n (remaining-draws state side))
-               n)]
-       (when (and (= side :corp) (> n (count (get-in @state [:corp :deck]))))
-         (system-msg state side "is decked")
-         (win state :runner "Decked"))
-       (when-not (get-in @state [active-player :register :cannot-draw])
-         (let [drawn (zone :hand (take n (get-in @state [side :deck])))]
-           (swap! state update-in [side :hand] #(concat % drawn))
-           (swap! state update-in [side :deck] (partial drop n))
-           (swap! state update-in [active-player :register :drawn-this-turn] (fnil #(+ % n) 0))
-           (trigger-event state side (if (= side :corp) :corp-draw :runner-draw) n)
-           (when (= 0 (remaining-draws state side))
-             (prevent-draw state side))))))))
+   (let [active-player (get-in @state [:active-player])
+         n (if (get-in @state [active-player :register :max-draw])
+             (min n (remaining-draws state side))
+             n)
+         deck-count (count (get-in @state [side :deck]))]
+     (when (and (= side :corp) (> n deck-count))
+       (system-msg state side "is decked")
+       (win state :runner "Decked"))
+     (when-not (get-in @state [active-player :register :cannot-draw])
+       (let [drawn (zone :hand (take n (get-in @state [side :deck])))]
+         (swap! state update-in [side :hand] #(concat % drawn))
+         (swap! state update-in [side :deck] (partial drop n))
+         (swap! state update-in [active-player :register :drawn-this-turn] (fnil #(+ % n) 0))
+         (when-not (zero? deck-count)
+           (trigger-event state side (if (= side :corp) :corp-draw :runner-draw) n))
+         (when (= 0 (remaining-draws state side))
+           (prevent-draw state side)))))))

 ;;; Damage
 (defn flatline [state]


Regression fix

Regression fix

--- src/clj/salava/badge/db.clj
+++ src/clj/salava/badge/db.clj
@@ -21,23 +21,6 @@
                         )))
         reduced-events (vals (reduce helper {} (reverse events)))]
     (filter #(false? (:hidden %)) reduced-events)))
-
-
-
-
-
-(defn admin-events-reduce [events]
-  (let [helper (fn [current item]
-                  (let [key [(:verb item)]]
-                    (-> current
-                        (assoc  key item)
-                        (assoc-in  [key :count] (inc (get-in current [key :count ] 0)))
-                        )))
-        reduced-events (vals (reduce helper {} (reverse events)))]
-    (filter #(false? (:hidden %)) reduced-events)))
-
-
-

 (defn badge-message-map


Add D3 line graph example that correctly redraws when the app state is updated.

--- src/cljs/om_sente/core.cljs
+++ src/cljs/om_sente/core.cljs
@@ -193,46 +193,91 @@
                           [:div
                            [:input {:type "submit" :value "Login"}]]]]))))

+(defn line-graph
+  "Example from http://www.janwillemtulp.com/2011/04/01/tutorial-line-chart-in-d3/"
+  [raw-data]
+  (let [h 200 w 960 m 30
+        d (clj->js raw-data)
+        y-scale (.. js/d3 -scale linear
+                    (domain #js [(apply max raw-data) 0])
+                    (range #js [(+ 0 m) (- h m)]))
+        x-scale (.. js/d3 -scale linear
+                    (domain #js [0 (count raw-data)])
+                    (range #js [(+ 0 m) (- w m)]))
+        svg (.. js/d3 (select "#d3-node") (append "svg")
+                (attr #js {:width w :height h}))
+        g (.. svg (append "g"))
+        l (.. js/d3 -svg line (x (fn [d i] (x-scale i)))
+              (y (fn [d] (y-scale d))))]
+    ;; actual line
+    (.. g (append "path") (attr "d" (l d)))
+    ;; x-axis
+    (.. g (append "line") (attr "x1" (x-scale 0))
+        (attr "y1" (y-scale 0))
+        (attr "x2" (x-scale (count raw-data)))
+        (attr "y2" (y-scale 0)))
+    ;; y-axis
+    (.. g (append "line") (attr "x1" (x-scale 0))
+        (attr "y1" (y-scale 0))
+        (attr "x2" (x-scale 0))
+        (attr "y2" (y-scale (apply max raw-data))))
+    ;; x-label
+    (.. g (selectAll ".xLabel") (data (.ticks x-scale 5))
+        enter (append "text")
+        (attr "class" "xLabel")
+        (text js/String)
+        (attr "x" (fn [d] (x-scale d)))
+        (attr "y" (- h 5))
+        (attr "text-anchor" "middle"))
+    ;; y-label
+    (.. g (selectAll ".yLabel") (data (.ticks y-scale 4))
+        enter (append "text")
+        (attr "class" "yLabel")
+        (text js/String)
+        (attr "x" (/ m 1.5))
+        (attr "y" (fn [d] (y-scale d)))
+        (attr "text-anchor" "end"))
+    ;; x-ticks
+    (.. g (selectAll "xTicks") (data (.ticks x-scale 5))
+        enter (append "line")
+        (attr "class" "xTicks")
+        (attr "x1" (fn [d] (x-scale d)))
+        (attr "y1" (y-scale 0))
+        (attr "x2" (fn [d] (x-scale d)))
+        (attr "y2" (+ (y-scale 0) 5)))
+    ;; y-ticks
+    (.. g (selectAll "yTicks") (data (.ticks y-scale 4))
+        enter (append "line")
+        (attr "class" "yTicks")
+        (attr "x1" (- (x-scale 0) 5))
+        (attr "y1" (fn [d] (y-scale d)))
+        (attr "x2" (x-scale 0))
+        (attr "y2" (fn [d] (y-scale d))))))
+
+(defn graph-data-changing
+  [old new]
+  (not= (:data/text old) (:data/text new)))
+
 (defn d3-test
   "Component that tests D3 / Om / React integration."
   [app owner]
   (reify
-    om/IInitState
-    (init-state [this]
-                {:data (vec (repeatedly 100 #(rand-int 100)))})
     om/IDidMount
     (did-mount [this]
-               (let [h 500 w 960 m 20
-                     d-raw (om/get-state owner :data)
-                     d (clj->js d-raw)
-                     y (.. js/d3 -scale linear
-                           (domain #js [0 (apply max d-raw)])
-                           (range #js [(+ 0 m) (- h m)]))
-                     x (.. js/d3 -scale linear
-                           (domain #js [0 (count d-raw)])
-                           (range #js [(+ 0 m) (- w m)]))
-                     svg (.. js/d3 (select "#d3-node") (append "svg")
-                             (attr #js {:width w :height h}))
-                     g (.. svg (append "g")
-                           (attr "transform" (str "transform(0, " h ")")))
-                     l (.. js/d3 -svg line (x (fn [d i] (x i)))
-                           (y (fn [d] (- (y d)))))]
-                 (println l)
-                 (.. g (append "path") (attr "d" (l d)))
-                 (.. g (append "line") (attr "x1" (x 0))
-                     (attr "y1" (- (y 0)))
-                     (attr "x2" (x w))
-                     (attr "y2" (- (y 0))))
-                 (.. g (append "line") (attr "x1" (x 0))
-                     (attr "y1" (- (y 0)))
-                     (attr "x2" (x 0))
-                     (attr "y2" (- (y (apply max d-raw)))))
-
-                 ))
+               (println "d3 did-mount - draw line when first mounted")
+               (line-graph (vec (make-target (:data/text app)))))
+    om/IDidUpdate
+    (did-update [this prev-props prev-state]
+                (when (graph-data-changing prev-props app)
+                  (println "d3 did-update app state change - redraw line")
+                  (.remove (.-firstChild (om/get-node owner "d3-node")))
+                  (line-graph (vec (make-target (:data/text app))))))
     om/IRender
     (render [this]
             (println "d3 render state")
-            (dom/div #js {:react-key "d3-test-graph" :id "d3-node"}))))
+            (dom/div #js {:react-key "d3-node" ;; ensure React knows this is non-reusable
+                          :ref "d3-node"       ;; label it so we can retrieve it via get-node
+                          :id "d3-node"}))))   ;; set id so D3 can find it!

 (defn secured-application
   "Component that represents the secured portion of our application."


Remove console.log.apply(..) calls for now since IE8 can't support those (can re-enable for debugging on other browsers)

--- src/cljs/om_sente/core.cljs
+++ src/cljs/om_sente/core.cljs
@@ -12,7 +12,7 @@
             [taoensso.sente :as s]
             [cljs.core.async :as async :refer [<! >! chan]]))

-(enable-console-print!)
+#_(enable-console-print!)

 ;; create the Sente web socket connection stuff when we are loaded:

@@ -121,7 +121,7 @@

 (defmethod handle-event :default
   [event app owner]
-  (println "UNKNOWN EVENT" event))
+  #_(println "UNKNOWN EVENT" event))

 ;; Remember the session state in the application component's local state:

@@ -150,7 +150,7 @@
   "Handle inbound events."
   [app owner]
   (go (loop [[op arg] (<! ch-chsk)]
-        (println "-" op)
+        #_(println "-" op)
         (case op
           :chsk/recv (handle-event arg app owner)
           ;; we ignore other Sente events


Functions for recursively changing keys.

--- src/cmr_edsc_stubs/util.clj
+++ src/cmr_edsc_stubs/util.clj
@@ -1,7 +1,9 @@
 (ns cmr-edsc-stubs.util
   (:require
    [cheshire.core :as json]
-   [clojure.java.io :as io]))
+   [clojure.java.io :as io]
+   [clojure.string :as string]
+   [clojure.walk :refer [postwalk-replace]]))

 (def local-token "mock-echo-system-token")
 (def local-token-header {"echo-token" local-token})
@@ -35,3 +37,51 @@
       (get-dir)
       (file-seq)
       files?))
+
+(defn camel->
+  [regex string-format string-data]
+  (-> string-data
+      (string/replace regex string-format)
+      (string/lower-case)))
+
+(defn camels->
+  [regex string-format seq-strings]
+  (map (comp keyword
+             (partial camel-> regex string-format)
+             name)
+       seq-strings))
+
+(defn camel->kebab
+  [string-or-seq-data]
+  (let [regex #"([^-A-Z])([A-Z])"
+        string-format "$1-$2"]
+    (if (seq? string-or-seq-data)
+      (camels-> regex string-format string-or-seq-data)
+      (camel-> regex string-format string-or-seq-data))))
+
+(defn camel->snake
+  [string-or-seq-data]
+  (let [regex #"([^_A-Z])([A-Z])"
+        string-format "$1_$2"]
+    (if (seq? string-or-seq-data)
+      (camels-> regex string-format string-or-seq-data)
+      (camel-> regex string-format string-or-seq-data))))
+
+(defn lookup-converter
+  [mode]
+  (println "Mode:" mode)
+  (case mode
+    [:camel :kebab] camel->kebab
+    [:camel :snake] camel->snake
+    identity))
+
+(defn get-all-keys
+  [data]
+  (concat (keys data)
+          (mapcat (fn [[k v]] (if (map? v) (get-all-keys v))) data)))
+
+(defn convert-keys
+  [mode data]
+  (let [orig-keys (get-all-keys data)
+        converter-fn (lookup-converter mode)]
+    (postwalk-replace (zipmap orig-keys (converter-fn orig-keys)) data)))


New tests: test-job-name->url-1 and test-job-name->url-2

--- test/clj_jenkins_api/jenkins_api_test.clj
+++ test/clj_jenkins_api/jenkins_api_test.clj
@@ -70,3 +70,21 @@
     (testing "if the clj-jenkins-api.jenkins-api/encode-spaces definition exists."
         (is (thrown? NullPointerException (encode-spaces nil)))))

+(deftest test-job-name->url-1
+    "Check that the clj-jenkins-api.jenkins-api/job-name->url definition exists."
+    (testing "if the clj-jenkins-api.jenkins-api/job-name->url definition exists."
+        (are [x y] (= x y)
+            "job/"                  (job-name->url "" "")
+            " job/"                 (job-name->url " " "")
+            "jenkins-url/job/"      (job-name->url "jenkins-url/" "")
+            "jenkins-url:8080/job/" (job-name->url "jenkins-url:8080/" ""))))
+
+(deftest test-job-name->url-2
+    "Check that the clj-jenkins-api.jenkins-api/job-name->url definition exists."
+    (testing "if the clj-jenkins-api.jenkins-api/job-name->url definition exists."
+        (are [x y] (= x y)
+            "jenkins-url:8080/job/"                  (job-name->url "jenkins-url:8080/" "")
+            "jenkins-url:8080/job/job-name"          (job-name->url "jenkins-url:8080/" "job-name")
+            "jenkins-url:8080/job/job%20name"        (job-name->url "jenkins-url:8080/" "job name")
+            "jenkins-url:8080/job/long%20job%20name" (job-name->url "jenkins-url:8080/" "long job name"))))
+


Update swank dependency to fix build.

Update swank dependency to fix build.

--- backend/project.clj
+++ backend/project.clj
@@ -36,6 +36,7 @@
                  [vmfest "0.2.3"]

                  ;; Misc
+                 [swank-clojure "1.3.3"]
                  [commons-codec "1.4"]
                  [org.apache.commons/commons-compress "1.0"]
                  [org.xeustechnologies/jtar "1.0.4"]


prepare release plugin

prepare release plugin

--- backend/project.clj
+++ backend/project.clj
@@ -18,6 +18,7 @@
                  ["releases" { :url "https://clojars.org/repo"
                                                :username "sroidl"
                                                :password [:gpg :env]}]]
+  :lein-release {:scm :git}
   :profiles {:dev {:dependencies [[lambdacd-git "0.1.2"]
                                   [com.gearswithingears/shrubbery "0.4.1"]
                                   [ring-cors "0.1.8"]]


Fixing admin debugger

Fixing admin debugger

So that it can display the table names and data as well.

--- src/webapp/framework/client/components/admin.cljs
+++ src/webapp/framework/client/components/admin.cljs
@@ -1,13 +1,14 @@
 (ns webapp.framework.client.components.admin
   (:require
-   [webapp.framework.client.coreclient   :as c :include-macros true])
-
-
-	(:use
-		[webapp.framework.client.system-globals  :only  [
-																										 client-data-windows
-																										 client-query-cache
-																										 ]]))
+    [webapp.framework.client.coreclient   :as c :include-macros true])
+
+
+  (:use
+    [webapp.framework.client.system-globals  :only  [
+                                                      client-data-windows
+                                                      client-query-cache
+                                                      client-record-cache
+                                                      ]]))
 (c/ns-coils 'webapp.framework.client.components.admin)

@@ -64,14 +65,22 @@

-(c/defn-ui-component     admin-view-show-data-source-data   [table-data]
-  (c/container
-   nil
-
-   (c/div {:style {:color  "blue"}}
-		  (c/container
-		   (c/inline "50%" (c/text (str "count" )))
-		   (c/inline "50%" (c/text (count (c/read-ui table-data [:values]))))))))
+(c/defn-ui-component
+  admin-view-show-data-source-data   [table-name]
+  (let [table             table-name
+        table-data       (keys @(get @(get @client-record-cache table) :values) )
+                            ]
+    (c/container
+      nil
+
+
+      (c/div {:style {:color  "blue"}}
+             (c/container
+               (c/inline "50%" (c/text (str "count" )))
+               (c/inline "50%" (c/text (count aaa)))
+               )
+      (c/div nil (str "table-data: " table-data))
+             ))))

@@ -86,69 +95,73 @@
 (c/defn-ui-component     admin-view-list-data-sources   [data-sources]

   (let [
-        use-source    (c/read-ui data-sources [:data-source])
-	    	view          (c/read-ui data-sources [:data-view])
+        use-source       (c/read-ui data-sources [:data-source])
+	    	view             (c/read-ui data-sources [:data-view])
+        table-list       (keys @client-record-cache)
 	    	]

-	(c/div nil
-		   (c/map-many
-			#(c/container
-
-			  (let [table-name   (str (name  (-> (second %) :def :table)))
-					data-source  (first %)]
-
-				(if (or (nil? use-source)
-						(= use-source  data-source))
-
-				  (c/div {:style {:color  "black"}}
-						 (c/inline "300px" (c/div nil table-name))
-						 (c/inline "100px" (c/div {:style {:fontSize "12px" :padding "7px"}
-												   :onClick
-												   (fn [e] (do
-															 (c/write-ui
-															  data-sources
-															  [:data-source]
-															  data-source)
-
-															 (c/write-ui
-															  data-sources
-															  [:data-view]
-															  "defn")
-															 ))} "Defn"))
-						 (c/inline "100px" (c/div {:style {:fontSize "12px" :padding "7px"}
-												   :onClick
-												   (fn [e] (do
-															 (c/write-ui
-															  data-sources
-															  [:data-source]
-															  data-source)
-
-															 (c/write-ui
-															  data-sources
-															  [:data-view]
-															  "data")
-															 ))
-												   } "Data"))
-
-						 ))))
-			(c/read-ui data-sources [:values])
-			)
-            (cond
-			 (and use-source (= view "defn"))
-
-			  (c/component admin-view-show-data-source-def
-						   (c/read-ui data-sources
-									 [:values (keyword use-source) :def]) [])
-
-			 (and use-source (= view "data"))
-
-			  (c/component admin-view-show-data-source-data
-						   (c/read-ui data-sources
-									 [:values (keyword use-source) :data]) []))
-
-         (c/div nil "List of data sources")
-
-         )))
+    (c/div nil
+           ;(c/div {:style {:fontWeight "bold" :color "blue"}} (str "Data source: " use-source))
+           ;(c/div {:style {:fontWeight "bold" :color "blue"}} (str "View: " view))
+           ;(c/div {:style {:fontWeight "bold" :color "green"}} (str "table-list: " table-list))
+
+           (c/div {:style {:fontWeight "bold" :color "black"}} "List of data sources")
+
+           (c/map-many
+             #(c/container
+
+                (let [table-name   (str (name  %))
+                      data-source  %]
+
+                  (if (or (nil? use-source)
+                          (= use-source  data-source))
+
+                    (c/div {:style {:color  "black"}}
+                           (c/inline "300px" (c/div nil table-name))
+                           (c/inline "100px" (c/div {:style {:fontSize "12px" :padding "7px"}
+                                                     :onClick
+                                                     (fn [e] (do
+                                                               (c/write-ui
+                                                                 data-sources
+                                                                 [:data-source]
+                                                                 data-source)
+
+                                                               (c/write-ui
+                                                                 data-sources
+                                                                 [:data-view]
+                                                                 "defn")
+                                                               ))} "Defn"))
+                           (c/inline "100px" (c/div {:style {:fontSize "12px" :padding "7px"}
+                                                     :onClick
+                                                     (fn [e] (do
+                                                               (c/write-ui
+                                                                 data-sources
+                                                                 [:data-source]
+                                                                 data-source)
+
+                                                               (c/write-ui
+                                                                 data-sources
+                                                                 [:data-view]
+                                                                 "data")
+                                                               ))
+                                                     } "Data"))
+
+                           ))))
+            table-list
+             )
+           (cond
+             (and use-source (= view "defn"))
+
+             (c/component admin-view-show-data-source-def
+                          (c/read-ui data-sources
+                                     [:values (keyword use-source) :def]) [])
+
+             (and use-source (= view "data"))
+
+               (c/div nil  (c/component admin-view-show-data-source-data data-sources [:data-source]))
+
+
+             ))))


VHDL keywords for using components

VHDL keywords for using components

--- src/computer_build/vhdl.clj
+++ src/computer_build/vhdl.clj
@@ -108,6 +108,13 @@
         (to-vhdl (second %)))) (partition 2 clauses)))
     "END IF;")

+(def-vhdl-multiline :component [name & ports]
+  (str "COMPONENT " (keyword-to-str name))
+  "PORT("
+  (commaify (map to-vhdl (map (partial cons :port) ports)))
+  ");"
+  (str "END COMPONENT;"))
+
 ; inline / single-line statements

 (defmethod to-vhdl :<= [[type & args]]
@@ -119,6 +126,9 @@

 (def-vhdl-inline :port [id direction kind]
   (keyword-to-str id) ": " (keyword-to-str direction) " " kind)
+
+(def-vhdl-inline :instance [component name & mappings]
+  name ": " (keyword-to-str component) " PORT MAP(" (str-join ", " (map keyword-to-str mappings)) ");")

 (def-vhdl-inline :low [target]
   (to-vhdl `(<= ~target "0")))


Removed context-for-clop

Removed context-for-clop

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

--- src/conexp/fca/contexts.clj
+++ src/conexp/fca/contexts.clj
@@ -542,7 +542,7 @@
   \\]
   where
   \\[
-    (g_1,g_2)\\nabla(j,m) \\iff g_jI_jm \\qquad\\text{for $j\\in\\set{1,2}}.
+    (g_1,g_2)\\nabla(j,m) \\iff g_jI_jm \\qquad\\text{for $j\\in\\set{1,2}$}.
   \\]"
   [ctx-1 ctx-2]
   (let [new-objs (cross-product (objects ctx-1) (objects ctx-2))
@@ -644,15 +644,4 @@

 ;;;

-(defn context-for-clop
-  "Returns a minimal context describing the closure operator clop on
-  base-set."
-  [base-set clop]
-  (let [objects    (all-closed-sets base-set clop),
-	attributes base-set,
-	incidence  contains?]
-    (reduce-context-objects (make-context objects attributes incidence))))
-
-;;;
-
 nil


(PDB-4637) testutils.db/create-temp-db: double-quote database name

--- test/puppetlabs/puppetdb/testutils/db.clj
+++ test/puppetlabs/puppetdb/testutils/db.clj
@@ -141,12 +141,12 @@
   (let [n (swap! test-db-counter inc)
         db-name (if-not pdb-test-id
                   (str "pdb_test_" n)
-                  (str "pdb_test_" pdb-test-id "_" n))]
-    (assert (valid-sql-id? db-name))
+                  (str "pdb_test_" pdb-test-id "_" n))
+        db-qname (jdbc/double-quote db-name)]
     (jdbc/with-db-connection (db-admin-config)
       (jdbc/do-commands-outside-txn
-       (format "drop database if exists %s" db-name)
-       (format "create database %s template %s" db-name template-name)))
+       (format "drop database if exists %s" db-qname)
+       (format "create database %s template %s" db-qname template-name)))
     (db-user-config db-name)))

 (def ^:dynamic *db* nil)


Added more logic for specifying base-url.

--- src/cadence/server.clj
+++ src/cadence/server.clj
@@ -18,13 +18,14 @@
       (ring.util.response/redirect (https-url request))
       (handler request))))

-
 (defn -main [& m]
   (let [mode (keyword (or (first m) :dev))
         port (Integer. (get (System/getenv) "PORT" "5000"))
         url "cadence.herokuapp.com"]
     (if (not= mode :dev) (server/add-middleware require-https))
     (server/add-middleware wrap-gzip)
-    (server/start port {:mode mode
-                        ;:base-url (if (= mode :dev) (str "test" url))
-                        :ns 'cadence})))
+    (server/start port (let [opts {:mode mode
+                                   :ns 'cadence}]
+                         (if (not= mode :dev)
+                           (assoc opts :base-url url)
+                           opts)))))


Update fake.class.path when adding dependencies

--- boot/core/src/boot/core.clj
+++ boot/core/src/boot/core.clj
@@ -163,6 +163,7 @@
   "Add Maven dependencies to the classpath, fetching them if necessary."
   [old new env]
   (->> new rm-clojure-dep (assoc env :dependencies) pod/add-dependencies)
+  (set-fake-class-path!)
   new)

 (defn- add-directories!


respect transaction/timestamp when building entities from facts

--- sample/src/sample/core.clj
+++ sample/src/sample/core.clj
@@ -42,15 +42,19 @@
 (defn cltest2 []
   (cldb/db-rel fact e a v t)

-  (letfn [(to-entities [db]
+  (letfn [(entities [db]
             (let [lres (cldb/with-db db
                          (cl/run* [q]
-                           (cl/fresh [e a v]
-                             (fact e a v (cl/lvar))
-                             (cl/== q [e a v]))))]
+                           (cl/fresh [e a v t]
+                             (fact e a v t)
+                             (cl/== q [e a v t]))))]
               (when (not-empty lres)
-                (reduce (fn [s [e a v]]
-                          (assoc-in s [e a] v))
+                (reduce (fn [s [e a v t]]
+                          (update-in s [e a]
+                                     (fn [tmap]
+                                       (if tmap
+                                         (assoc tmap t v)
+                                         (sorted-map-by #(* -1 (compare %1 %2)) t v)))))
                         {}
                         lres))))]

@@ -65,11 +69,13 @@
                   [fact 100 :address  200           2]

                   [fact 101 :type     :person       2]
-                  [fact 101 :name     "bar"         2]
+                  [fact 101 :name     "bar1"        2]
                   [fact 101 :email    "bar@foo.com" 2]
-                  [fact 101 :address  200           2])]
+                  [fact 101 :address  200           2]
+                  [fact 101 :name     "bar2"        4]
+                  [fact 101 :name     "bar3"        3])]

-      (cldb/with-db facts1
+      #_(cldb/with-db facts1
         (cl/run* [q]
           (cl/fresh [pid a v]
             (fact pid :type :person (cl/lvar))
@@ -77,7 +83,7 @@
             (fact pid a v (cl/lvar))
             (cl/== q [pid a v]))))

-      (to-entities facts1))))
+      (entities facts1))))

 ;;; (cltest2)


Test for res-ch close can be less lines.

--- src/cbfg/test/kvs.cljs
+++ src/cbfg/test/kvs.cljs
@@ -20,11 +20,7 @@
                        (atake tkvs res-ch)
                        (merge m {:status :invalid
                                  :status-info :missing-kvs-ident-arg})
-                       nil)
-                    (e n
-                       (atake tkvs res-ch)
-                       nil
-                       nil))
+                       (atake tkvs res-ch)))
                   (let [res-ch (achan tkvs)
                         m {:res-ch res-ch :op :kvs-remove :kvs-ident [:bogus :ident]}]
                     (aput tkvs cmd-ch m)
@@ -32,7 +28,7 @@
                        (atake tkvs res-ch)
                        (merge m {:status :not-found
                                  :status-info [:no-kvs (:kvs-ident m)]})
-                       nil)))
+                       (atake tkvs res-ch))))
            "pass"
            (str "FAIL: on test-lane #" @n)))))


Hooked up item-set and item del to multi-change.

--- src/cbfg/world/t2.cljs
+++ src/cbfg/world/t2.cljs
@@ -26,8 +26,8 @@
              (aput item-get (:kvs-mgr-ch coll-state)
                    (assoc m :op :multi-get
                           :kvs-ident (:kvs-ident coll-state)
-                          :key-reqs [{:key (:key m)
-                                      :res-ch (:res-ch m)
+                          :key-reqs [{:res-ch (:res-ch m)
+                                      :key (:key m)
                                       :sq (parse-sq (:sq m))}])))
         [coll-state nil])

@@ -36,14 +36,28 @@
              (aput item-set (:kvs-mgr-ch coll-state)
                    (assoc m :op :multi-change
                           :kvs-ident (:kvs-ident coll-state)
-                          :changes [(cbfg.kvs/mutate-entry
-                                     {:key (:key m)
-                                      :val (:val m)
-                                      :sq (parse-sq (:sq m))})])))
+                          :change-reqs
+                          [{:res-ch (:res-ch m)
+                            :change-fn
+                            (cbfg.kvs/mutate-entry
+                             {:key (:key m)
+                              :val (:val m)
+                              :sq (parse-sq (:sq m))})}])))
         [coll-state nil])

     "item-del"
-    [coll-state (assoc m :status :not-implemented-yet)]
+    (do (act item-del actx
+             (aput item-del (:kvs-mgr-ch coll-state)
+                   (assoc m :op :multi-change
+                          :kvs-ident (:kvs-ident coll-state)
+                          :change-reqs
+                          [{:res-ch (:res-ch m)
+                            :change-fn
+                            (cbfg.kvs/mutate-entry
+                             {:deleted true
+                              :key (:key m)
+                              :sq (parse-sq (:sq m))})}])))
+        [coll-state nil])

     [coll-state (assoc m :status :invalid :status-info :invalid-op)]))


Added key-compression-map into metadata

Added key-compression-map into metadata

--- src/cfpb/qu/loader.clj
+++ src/cfpb/qu/loader.clj
@@ -19,7 +19,8 @@
     [core :as mongo :refer [with-db get-db]]
     [query :as q]
     [collection :as coll]
-    [joda-time]]
+    [joda-time]
+    [key-compression :refer [compression-map]]]
    [cfpb.qu.util :refer :all]
    [cfpb.qu.query.where :as where]
    [cfpb.qu.data :refer :all])
@@ -85,10 +86,20 @@
 (defn save-dataset-definition
   "Save the definition of a dataset into the 'metadata' database."
   [name definition]
-  (with-db (get-db "metadata")
-    (coll/update "datasets" {:name name}
-                 (assoc definition :name name :last-modified (now))
-                 :upsert true)))
+  (let [definition (assoc definition
+                     :name name
+                     :last-modified (now))
+        definition (reduce (fn [def [slice sdef]]
+                             (assoc-in def
+                                       [:compression-map slice]
+                                       (compression-map (slice-columns sdef))))
+                           definition
+                           (:slices definition))
+        definition (dissoc definition :tables)]
+    (with-db (get-db "metadata")
+      (coll/update "datasets" {:name name}
+                   definition
+                   :upsert true))))

 (defmulti cast-value (fn [_ valuedef] (:type valuedef)))


Builder fix, Valley cards, correct typos

Removes 1 credit cost on Builder subroutine. Adds Decoy from Core, and a couple easy cards from The Valley pack. Fixes a few message typos.

--- src/clj/game/cards.clj
+++ src/clj/game/cards.clj
@@ -137,7 +137,7 @@

    "Bioroid Efficiency Research"
    {:choices {:req #(and (= (:type %) "ICE") (has? % :subtype "Bioroid") (not (:rezzed %)))}
-    :msg (msg "rez " (:title target) " at not cost")
+    :msg (msg "rez " (:title target) " at no cost")
     :effect (effect (rez target {:no-cost true}))}

    "Blue Level Clearance"
@@ -200,6 +200,9 @@
    "Calling in Favors"
    {:effect (effect (gain :credit (count (filter (fn [c] (has? c :subtype "Connection"))
                                                  (get-in runner [:rig :resource])))))}
+
+   "Capital Investors"
+   {:abilities [{:cost [:click 1] :effect (effect (gain :credit 2)) :msg "gain 2 [Credits]"}]}

    "Caprice Nisei"
    {:abilities [{:msg "start a Psi game"
@@ -283,6 +286,9 @@
    "Closed Accounts"
    {:req (req tagged) :effect (effect (lose :runner :credit :all))}

+   "Clot"
+   {:events {:purge {:effect (effect (trash card))}}}
+
    "Code Siphon"
    {:effect (effect (run :rd
                       {:replace-access
@@ -387,6 +393,9 @@

    "Day Job"
    {:additional-cost [:click 3] :effect (effect (gain :credit 10))}
+
+   "Decoy"
+   {:abilities [{:msg "avoid 1 tag" :effect (effect (trash card))}]}

    "Dedicated Response Team"
    {:events {:successful-run-ends {:req (req tagged) :msg "do 2 meat damage"
@@ -516,7 +525,7 @@

    "Elizas Toybox"
    {:abilities [{:cost [:click 3] :choices {:req #(not (:rezzed %))}
-                 :label "Rez a card at no cost" :msg (msg "rez " (:title target) " at not cost")
+                 :label "Rez a card at no cost" :msg (msg "rez " (:title target) " at no cost")
                  :effect (effect (rez target {:no-cost true}))}]}

    "Emergency Shutdown"
@@ -1129,7 +1138,7 @@

    "Oversight AI"
    {:choices {:req #(and (= (:type %) "ICE") (not (:rezzed %)))}
-    :msg (msg "rez " (:title target) " at not cost")
+    :msg (msg "rez " (:title target) " at no cost")
     :effect (effect (rez target {:no-cost true}))}

    "PAD Campaign"
@@ -1651,6 +1660,9 @@
                     (move target :hand) (shuffle! :deck))
     :choices (req (filter #(has? % :subtype "Icebreaker") (:deck runner)))}

+   "Spike"
+   {:abilities [{:msg "break up to 3 barrier subroutines" :effect (effect (trash card))}]}
+
    "Spinal Modem"
    {:effect (effect (gain :memory 1)) :leave-play (effect (lose :memory 1)) :recurring 2
     :events {:successful-trace {:req (req run) :effect (effect (damage :brain 1))}}}
@@ -2135,24 +2147,27 @@
    "Asteroid Belt"
    {:advanceable :always :abilities [{:msg "end the run" :effect (effect (end-run))}]}

+   "Bandwidth"
+   {:abilities [{:msg "give the Runner 1 tag" :effect (effect (gain :runner :tag 1))}}
+
    "Bastion"
    {:abilities [{:msg "end the run" :effect (effect (end-run))}]}

    "Builder"
    {:abilities [{:label "Move Builder to the outermost position of any server"
                  :cost [:click 1] :prompt "Choose a server" :choices (req servers)
-                 :msg (msg "move it to the outmost position of " target)
+                 :msg (msg "move it to the outermost position of " target)
                  :effect (effect (move card (conj (server->zone state target) :ices)))}
-                {:label "Place 1 advancement token on an ICE that can be advance on this server"
+                {:label "Place 1 advancement token on an ICE that can be advanced on this server"
                  :msg (msg "place 1 advancement token on " (if (:rezzed target) (:title target) "a card"))
                  :choices {:req #(or (= (:type %) "Agenda") (:advanceable %))}
-                 :cost [:credit 1] :effect (effect (add-prop target :advance-counter 1))}]}
+                 ::effect (effect (add-prop target :advance-counter 1))}]}

    "Bullfrog"
    {:abilities [{:msg "start a Psi game"
                  :psi {:not-equal
                        {:player :corp :prompt "Choose a server" :choices (req servers)
-                        :msg (msg "move it to the outmost position of " target)
+                        :msg (msg "move it to the outermost position of " target)
                         :effect (req (let [dest (server->zone state target)]
                                        (swap! state update-in [:run]
                                               #(assoc % :position (count (get-in corp (conj dest :ices)))
@@ -2193,6 +2208,9 @@

    "Chum"
    {:abilities [{:msg "do 3 net damage" :effect (effect (damage :net 3))}]}
+
+   "Cortex Lock"
+   {:abilities [{:msg "do 1 net damage" :effect (effect (damage :net 1))}]}

    "Curtain Wall"
    {:abilities [{:msg "end the run" :effect (effect (end-run))}]}
@@ -2408,6 +2426,12 @@
                  :label "Trash a program"
                  :choices (req (get-in runner [:rig :program])) :effect (effect (trash target))}]}

+   "Negotiator"
+   {:abilities [{:msg "gain 2 [Credits]" :effect (effect (gain :credit 2))}
+                {:prompt "Choose a program to trash" :label "Trash a program"
+                 :msg (msg "trash " (:title target))
+                 :choices (req (get-in runner [:rig :program])) :effect (effect (trash target))}}
+
    "Neural Katana"
    {:abilities [{:msg "do 3 net damage" :effect (effect (damage :net 3))}]}

@@ -2596,7 +2620,7 @@

    "Wendigo"
    {:advanceable :always
-    :abilities [{:msg "prevent the Runner from using a chosen program for the remaining of this run"}]}
+    :abilities [{:msg "prevent the Runner from using a chosen program for the remainder of this run"}]}

    "Whirlpool"
    {:abilities [{:msg "prevent the Runner from jacking out"


Rewrite things

Rewrite things

--- src/clj_blog/views.clj
+++ src/clj_blog/views.clj
@@ -15,13 +15,12 @@
     [:input {:type "checkbox", :class "sidebar-checkbox", :id "sidebar-checkbox"}]
     [:div {:class "sidebar", :id "sidebar"}
       [:div {:class "sidebar-item"}
-        [:p {} "{{ site.description }}"]]
+        [:p {} "My personal blog, mostly about technical staff."]]
       [:nav {:class "sidebar-nav"}
         [:a {:class "sidebar-nav-item active", :href "/"} "Home"]
         [:a {:class "sidebar-nav-item", :href "http://iempire.ru"} "About"]
         [:div {:class "sidebar-item sidebar-item-separator"}
           [:p {} "Social"]
-
           [:nav {:class "sidebar-nav"}
             [:a {:class "sidebar-nav-item", :href "https://twitter.com/kirshatrov"} "@kirshatrov"]
             [:a {:class "sidebar-nav-item", :href "https://github.com/kirs"} "Github"]]]
@@ -54,15 +53,15 @@
     [:meta {:http-equiv "content-type", :content "text/html; charset=utf-8"}]
     [:meta {:name "viewport", :content "width=device-width, initial-scale=1.0, maximum-scale=1"}]
     [:title (wrap-page-title title)]
-    [:link {:rel "stylesheet", :href (str (basepath) "public/css/poole.css")}]
-    [:link {:rel "stylesheet", :href (str (basepath) "public/css/syntax.css")}]
-    [:link {:rel "stylesheet", :href (str (basepath) "public/css/lanyon.css")}]
-    [:link {:rel "stylesheet", :href "https://fonts.googleapis.com/css?family=PT+Serif:400,400italic,700%7CPT+Sans:400"}]
-    [:link {:rel "stylesheet", :href (str (basepath) "public/rrssb/rrssb.css")}]
+    [:link {:rel "stylesheet", :href (str (basepath) "static/css/poole.css")}]
+    [:link {:rel "stylesheet", :href (str (basepath) "static/css/syntax.css")}]
+    [:link {:rel "stylesheet", :href (str (basepath) "static/css/lanyon.css")}]
+    [:link {:rel "stylesheet", :href "//fonts.googleapis.com/css?family=PT+Serif:400,400italic,700%7CPT+Sans:400"}]
+    [:link {:rel "stylesheet", :href (str (basepath) "static/rrssb/rrssb.css")}]
     [:script {:src "http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"}]
-    [:script {:src (str (basepath) "public/rrssb/rrssb.min.js")}]
-    [:link {:rel "apple-touch-icon-precomposed", :sizes "144x144", :href (str (basepath) "public/apple-touch-icon-precomposed.png")}]
-    [:link {:rel "shortcut icon", :href (str (basepath) "public/favicon.ico")}]
+    [:script {:src (str (basepath) "static/rrssb/rrssb.min.js")}]
+    [:link {:rel "apple-touch-icon-precomposed", :sizes "144x144", :href (str (basepath) "static/apple-touch-icon-precomposed.png")}]
+    [:link {:rel "shortcut icon", :href (str (basepath) "static/favicon.ico")}]
     [:link {:rel "alternate", :type "application/rss+xml", :title "RSS", :href "/atom.xml"}]]))

 (defn single-post-page
@@ -117,4 +116,5 @@
             [:h1 { :class "post-title" }
               [:a { :href (:permalink post) } (:title post)]]
             [:span {:class "post-date"} (format-post-date (:date post))]])]]]
-    [:label {:for "sidebar-checkbox", :class "sidebar-toggle"}]))
+    [:label {:for "sidebar-checkbox", :class "sidebar-toggle"}]
+    [:script { :src (str (basepath) "static/js/site.js") }]))


Fix null entity when using a HEAD request

--- src/clj_http/core2.clj
+++ src/clj_http/core2.clj
@@ -166,8 +166,8 @@
        :headers (parse-headers
                  (.headerIterator response)
                  (opt req :use-header-maps-in-response))
-       :length (.getContentLength entity)
-       :chunked? (.isChunked entity)
-       :repeatable? (.isRepeatable entity)
-       :streaming? (.isStreaming entity)
+       :length (if (nil? entity) 0 (.getContentLength entity))
+       :chunked? (if (nil? entity) false (.isChunked entity))
+       :repeatable? (if (nil? entity) false (.isRepeatable entity))
+       :streaming? (if (nil? entity) false (.isStreaming entity))
        :status (.getStatusCode status)})))


fix link in sample pipeline

fix link in sample pipeline

--- example/clj/todopipeline/steps.clj
+++ example/clj/todopipeline/steps.clj
@@ -46,7 +46,7 @@
   {:status :success
    :details [{:label "Some Links"
               :details [{:label "Builds API"
-                         :href "/api/builds"}
+                         :href "/api/builds/"}
                         {:label "Github"
                          :href "https://github.com/flosell/lambdacd"}]}
              {:label "Mock test results"


fixes broken tests

fixes broken tests

--- test/nevergreen/api/projects_test.clj
+++ test/nevergreen/api/projects_test.clj
@@ -13,8 +13,7 @@
 (facts "it fetches projects"
        (fact "with authentication"
              (subject/fetch-tray {:url valid-url :username "a-user" :password "encrypted-password"}) => (contains (list (contains {:name       "project-1"
-                                                                                :prognosis  :sick
-                                                                                :project-id anything})))
+                                                                                :prognosis  :sick})))
              (provided
                (parser/get-projects ..stream.. anything) => [{:name "project-1" :prognosis :sick}]
                (crypt/decrypt "encrypted-password") => password
@@ -23,8 +22,7 @@

        (fact "without authentication"
              (subject/fetch-tray {:url valid-url}) => (contains (list (contains {:name       "project-1"
-                                                                                :prognosis  :sick
-                                                                                :project-id anything})))
+                                                                                :prognosis  :sick})))
              (provided
                (parser/get-projects ..stream.. anything) => [{:name "project-1" :prognosis :sick}]
                (http/http-get valid-url nil) => ..stream..
@@ -33,8 +31,7 @@

        (fact "without authentication if blank username and password"
              (subject/fetch-tray {:url valid-url :username "" :password ""}) => (contains (list (contains {:name       "project-1"
-                                                                                :prognosis  :sick
-                                                                                :project-id anything})))
+                                                                                :prognosis  :sick})))
              (provided
                (parser/get-projects ..stream.. anything) => [{:name "project-1" :prognosis :sick}]
                (http/http-get valid-url nil) => ..stream..
@@ -83,7 +80,7 @@
                       (subject/fetch-interesting anything) => irrelevant)))

        (fact "handles no tray id being given"
-             (subject/get-interesting [{:included ["project"] :url valid-url}]) => (list {:tray-id nil :project-id "project" :prognosis :sick})
+             (subject/get-interesting [{:included ["project"] :url valid-url}]) => (list {:tray-id nil :prognosis :sick :web-url "project"})
              (provided
                (subject/fetch-tray anything) => [{:web-url "project" :prognosis :sick}])))


More concise.

More concise.

--- src-cljs/frontend/components/build_head.cljs
+++ src-cljs/frontend/components/build_head.cljs
@@ -725,7 +725,7 @@
                   (list user-link " on CircleCI.com")
                   (list "CircleCI.com"))
       "api" "API"
-      (if (:job_name build)
+      (or
         (:job_name build)
         "unknown"))))


Flagged discovery port as a constant

Flagged discovery port as a constant

--- src/video_server/main.clj
+++ src/video_server/main.clj
@@ -26,7 +26,7 @@
            (org.slf4j LoggerFactory))
   (:gen-class))

-(def discovery-port 8394)
+(def ^:const discovery-port 8394)

 (defn exists?
   "Returns the canonical path if the directory exists."


finish supervisor integration

finish supervisor integration

--- src/clj/backtype/storm/daemon/supervisor.clj
+++ src/clj/backtype/storm/daemon/supervisor.clj
@@ -245,10 +245,13 @@
                                        storm-code-map (read-storm-code-locations storm-cluster-state sync-callback)
                                        assigned-storm-ids (set (keys storm-code-map))
                                        downloaded-storm-ids (set (read-downloaded-storm-ids conf))
-                                       new-assignment (read-assignments
+                                       new-assignment (->>
+                                                       (read-assignments
                                                         storm-cluster-state
                                                         supervisor-id
-                                                        sync-callback)]
+                                                        sync-callback)
+                                                       (filter-key #(.confirmAssigned isupervisor %)))
+                                       existing-assignment (.get local-state LS-LOCAL-ASSIGNMENTS)]
                                    (log-debug "Synchronizing supervisor")
                                    (log-debug "Storm code map: " storm-code-map)
                                    (log-debug "Downloaded storm ids: " downloaded-storm-ids)
@@ -278,10 +281,12 @@
                                        ))
                                    (log-debug "Writing new assignment "
                                               (pr-str new-assignment))
+                                   (doseq [p (set/difference (set (keys existing-assigned))
+                                                             (set (keys new-assignment)))]
+                                     (.killedWorker isupervisor (int p)))
                                    (.put local-state
                                          LS-LOCAL-ASSIGNMENTS
-                                         new-assignment
-                                         )
+                                         new-assignment)
                                    (.add processes-event-manager sync-processes)
                                    ))
         heartbeat-fn (fn [] (.supervisor-heartbeat!


Correct response header/body display

Correct response header/body display

--- src/cljs/gc_api_browser/tabbed_response.cljs
+++ src/cljs/gc_api_browser/tabbed_response.cljs
@@ -40,5 +40,5 @@
                                                     :onClick   #(om/update! app-cursor :showing-response-body? false)}
                                                "Headers"))
                           (if showing-response-body?
-                            (render-headers headers)
-                            (render-body body))))))))
+                            (render-body body)
+                            (render-headers headers))))))))


refactor async-future* to use one atom

refactor async-future* to use one atom

--- src/cljx/jamesmacaulay/async_tools/core.cljx
+++ src/cljx/jamesmacaulay/async_tools/core.cljx
@@ -29,21 +29,23 @@

 (defn async-future*
   [f]
-  (let [handlers (atom [])
-        container (atom nil)
-        resolve (fn [value]
-                  (reset! container
-                          (channels/box value))
-                  (doseq [handler @handlers]
-                    ((impl/commit handler) value)))]
-    (f resolve)
+  (let [state-atom (atom {:boxed-value nil
+                          :handlers []})
+        resolve-fn (fn [value]
+                     (let [state (swap! state-atom assoc :boxed-value (channels/box value))]
+                       (doseq [handler (:handlers state)]
+                         ((impl/commit handler) value))
+                       (swap! state-atom assoc :handlers nil)))]
+    (f resolve-fn)
     (reify
       impl/ReadPort
       (take! [_ handler]
-        (let [boxed @container]
-          (when (nil? boxed)
-            (swap! handlers conj handler))
-          boxed)))))
+        (-> state-atom
+            (swap! (fn [state]
+                     (if (nil? (:boxed-value state))
+                       (update-in state [:handlers] conj handler)
+                       state)))
+            :boxed-value)))))

 (defn async-future<
   [ch]


fix missing #+cljs

fix missing #+cljs

--- src/cljx/jamesmacaulay/zelkova/keyboard.cljx
+++ src/cljx/jamesmacaulay/zelkova/keyboard.cljx
@@ -110,5 +110,6 @@

 (def enter (down? 13))

+#+cljs
 (def last-pressed
   (z/map #(.-keyCode %) down-events))


Commented out test for now

Commented out test for now

--- test/bfg/betfair/betting_test.clj
+++ test/bfg/betfair/betting_test.clj
@@ -3,7 +3,7 @@
             [org.httpkit.fake :refer :all]
             [clojure.test :refer :all]))

-(deftest betting-api
+#_(deftest betting-api
   (testing "list-event-types!"
     (let [response "pong"]
       (is


good now

good now

--- test/epicea/utils/access_test.clj
+++ test/epicea/utils/access_test.clj
@@ -51,7 +51,6 @@
   (is (= {:x 3 :y 4} (make-xy 3 4))))

-(comment
   (def empty-xy2 [nil nil])
 (def x2 (vector-accessor 0 {:default-parent empty-xy2}))
 (def y2 (vector-accessor 1 {:default-parent empty-xy2}))
@@ -59,6 +58,7 @@

 (deftest constructor-test2
   (is (= [9 20] (make-xy2 9 20))))
+

 (def even-access
   {:id :even-number
@@ -68,17 +68,19 @@
    :set (fn [a b] b)})

 (deftest even-access-test
-  (is (= 2 (getx even-access 2)))
-  (is (= (optional 2) (getx-optional even-access 2)))
-  (is (= (optional) (getx-optional even-access 3))))
+  (is (= 2 (getx 2 even-access)))
+  (is (= (optional 2) (getx-optional 2 even-access)))
+  (is (= (optional) (getx-optional 3 even-access))))

 (def whiskers2 (map-accessor :whiskers {:default-parent {:type :cat :whiskers []}}))
 (def whiskers3 (map-accessor :whiskers {:make-default (fn [_] [1 2 3])}))

+
 (deftest cat-test
-  (is (= [] (getx-or-default whiskers2 {})))
-  (is (= [1 2 3] (getx-or-default whiskers3 {}))))
+  (is (= [] (getx-or-default {} whiskers2)))
+  (is (= [1 2 3] (getx-or-default {} whiskers3))))

+(comment
 (deftest vec1-accessor-test
   (is (= 4 (updatex vec1-accessor 3 (fn [k] (map inc k))))))
 )


Begin generative testing on lexer/parser props.

--- test/smallex/test/parser/smlx.clj
+++ test/smallex/test/parser/smlx.clj
@@ -1,9 +1,14 @@
 (ns smallex.test.parser.smlx
   (:require [clojure.test :refer :all]
             [clojure.java.io :as io]
-            [smallex.parser.smlx :as smlx])
+            [simple-check.clojure-test :as ct :refer [defspec]]
+            [simple-check.generators :as gen]
+            [simple-check.properties :as prop]
+            [smallex.parser.smlx :as smlx]
+            [smallex.test.generators :as s-gen])
   (:import (com.hypirion.smallex SMLXLexer)
-           (clojure.lang ExceptionInfo)))
+           (clojure.lang ExceptionInfo)
+           (java.io StringReader)))

 (defn- filter-afterv
   "Like filterv, but picks the item after the matched element, if existing."
@@ -18,13 +23,31 @@
           :else
           matched)))

+(defmacro ^:private change-max-size
+  [name max-size]
+  `(alter-meta! (var ~name) assoc
+                :test (fn [] (#'ct/assert-check
+                             (assoc (~name ct/*default-test-count*
+                                           :max-size ~max-size)
+                               :test-var (str '~name))))))
+
+(defspec def-count-equal-to-rule-count
+  (prop/for-all [grammar (gen/fmap str s-gen/grammar)]
+    (let [item-seq (-> grammar StringReader. SMLXLexer. iterator-seq)
+          parsed (smlx/parse item-seq)]
+      (testing "'def' count in legal grammar should be equal to rule count"
+        (is (= (count (:rules parsed))
+               (count (filter #(= :def (:type %)) item-seq))))))))
+
+(change-max-size def-count-equal-to-rule-count 40)
+
 (deftest test-clj-spec
   (with-open [rdr (io/reader (io/resource "clojure.smlx"))]
     (let [item-seq (iterator-seq (SMLXLexer. rdr))
           grammar (smlx/parse item-seq)]
       (testing "'def' count in legal grammar should be equal to rule count"
-          (is (= (count (:rules grammar))
-                 (count (filter #(= :def (:type %)) item-seq)))))
+        (is (= (count (:rules grammar))
+               (count (filter #(= :def (:type %)) item-seq)))))
       (testing "'alias' count in legal grammar should be equal to alias count"
         (is (= (count (:aliases grammar))
                (count (filter #(= :alias (:type %)) item-seq)))))


Missed an s

Missed an s

--- test/stl_collector/utils_test.clj
+++ test/stl_collector/utils_test.clj
@@ -1,4 +1,4 @@
-(ns stl-collector.util-test
+(ns stl-collector.utils-test
   (:require [stl-collector.utils :as u]
             [clojure.test :refer :all]))


Fix typo in SQL.

Fix typo in SQL.

--- src/webdev/item/model.clj
+++ src/webdev/item/model.clj
@@ -42,6 +42,6 @@
 (defn read-items [db]
   (db/query
     db
-    ["SELECT id, name, description. checked, date_created
+    ["SELECT id, name, description, checked, date_created
       FROM items
       ORDER BY date_created"]))


Typehint some more in incise.parsers.html.

--- src/incise/parsers/html.clj
+++ src/incise/parsers/html.clj
@@ -14,13 +14,14 @@
             [clj-time.coerce :refer [to-date]]
             [clojure.string :as s]
             [clojure.java.io :refer [file reader]])
-  (:import [java.io File]))
+  (:import [java.io File]
+           [incise.parsers.parse Parse]))

 (defn- remove-trailing-index-html
   [path]
   (s/replace path #"/index\.html$" "/"))

-(defn Parse->path [parse]
+(defn Parse->path [^Parse parse]
   (->> parse
        (:path)
        (remove-trailing-index-html)
@@ -50,7 +51,7 @@
     (try
       (edn/read-string s)
       (catch RuntimeException e
-        (throw (ex-info (str "The given string seemed to start with a map, but"
+        (throw (ex-info (str "The given string seemed to start with a map, but "
                              "failed to be interpretted as edn.")
                         {:string s}
                         e))))))
@@ -72,7 +73,7 @@
 (defn write-Parse
   "Write the result of Parse->string to a file in the out-dir at the path
   specified in the given parse. Return the written File."
-  [^incise.parsers.parse.Parse parse-data]
+  [^Parse parse-data]
   (let [out-file (file (conf/get :out-dir) (:path parse-data))]
     (-> out-file
         (.getParentFile)
@@ -88,8 +89,8 @@
   the root, if it is a post it will be placed under a directory strucutre based
   on its date."
   [parser-fn]
-  (fn [file]
-    (let [parse (File->Parse parser-fn file)]
+  (fn html-parser-parser [file]
+    (let [^Parse parse (File->Parse parser-fn file)]
       (when (publish-parse? parse)
         (record-parse! (.getCanonicalPath file) parse)
         (delay [(write-Parse parse)])))))


Add note about resolver vs. pipeline

Add note about resolver vs. pipeline

--- src/io/aviso/twixt/jade.clj
+++ src/io/aviso/twixt/jade.clj
@@ -25,6 +25,8 @@
         (let [full-name (add-missing-extension name ".jade")]
           (t/track
             #(format "Including Jade source from asset `%s'." full-name)
+            ;; Use the asset-resolver, not the asset pipeline, because we need
+            ;; the un-compiled version of the asset.
             (let [included (asset-resolver full-name nil)]
               (utils/nil-check included "Included asset does not exist.")
               (swap! dependencies utils/add-asset-as-dependency included)


tweaks

tweaks

--- src/konserve/indexeddb.cljs
+++ src/konserve/indexeddb.cljs
@@ -3,7 +3,7 @@
             [konserve.compressor]
             [konserve.encryptor]
             [konserve.impl.defaults :as defaults]
-            [konserve.impl.storage-layout :as storage-layout :refer [PBackingStore]]
+            [konserve.impl.storage-layout :as storage-layout]
             [konserve.serializers]
             [konserve.utils :refer [with-promise]]))

@@ -39,7 +39,7 @@
   (with-promise out
     (let [p (js/window.indexedDB.databases)]
       (.then p #(put! out %))
-      (.catch p #(put! out (ex-info (str "error listing databases")
+      (.catch p #(put! out (ex-info "error listing databases"
                                     {:cause %
                                      :caller 'konserve.indexeddb/list-dbs}))))))

@@ -268,7 +268,7 @@

 (defn connect-idb-store
   "Connect to a IndexedDB backed KV store with the given db name.
-   Optional serializer, read-handlers, write-handlers, buffer-size and config.
+   Optional serializer, read-handlers, write-handlers.

    This implementation stores all values as js/Blobs in an IndexedDB
    object store instance. The object store itself is nameless, and there
@@ -296,16 +296,15 @@
    value offset in the same way that the filestore implementations are. Consumers
    must discard the amount of bytes found in the :offset key of the locked-cb
    arg map. See: https://developer.mozilla.org/en-US/docs/Web/API/Blob/stream"
-  [db-name & {:keys [config] :as params}]
+  [db-name & {:as params}]
   (let [store-config (merge {:default-serializer :FressianSerializer
                              :compressor         konserve.compressor/null-compressor
                              :encryptor          konserve.encryptor/null-encryptor
                              :read-handlers      (atom {})
                              :write-handlers     (atom {})
-                             :config             (merge {:sync-blob? true
-                                                         :in-place? true
-                                                         :lock-blob? true}
-                                                        config)}
+                             :config             {:sync-blob? true
+                                                  :in-place? true
+                                                  :lock-blob? true}}
                             (dissoc params :config))
         backing            (IndexedDBackingStore. db-name nil)]
     (defaults/connect-default-store backing store-config)))


think i finished up core..

think i finished up core..

--- src/frontend/core.cljs
+++ src/frontend/core.cljs
@@ -38,6 +38,7 @@
     false))

 (defn send-chat-message [message]
+  (println "Sending chat message: " message)
   (.emit socket "chat-message" room-id message))

 (defn keydown-message-input [event]
@@ -121,6 +122,7 @@
       (swap! app-state assoc :music-files (merge (:music-files @app-state)
                                                  {track-id (new js/Blob)}))
       (swap! app-state assoc :num-of-downloads (inc (:num-of-downloads @app-state)))
+      (println "Sending file-download-request for:" track-id)
       (.emit socket "file-download-request" track-id)
       (println (str "Num of file downloads: " (:num-of-downloads @app-state))))
     (println "WARNING: Attempted to request download that has already been requested")))


removed download request on upload completion

--- src/frontend/core.cljs
+++ src/frontend/core.cljs
@@ -73,9 +73,7 @@
 (.on socket "upload-complete"
   (fn [music-info]
     (swap! app-state assoc :music-info
-      (merge (:music-info @app-state) music-info))
-    (println (.-id music-info))
-    (.emit socket "file-download-request" (.-id music-info))))
+      (merge (:music-info @app-state) music-info))))

 (.on (new js/ss socket) "file-download"
   (fn [stream track-id file-size]


prints done to console when file is done DLing

--- src/frontend/core.cljs
+++ src/frontend/core.cljs
@@ -84,7 +84,8 @@
 (.on (new js/ss socket) "file-to-client"
   (fn [stream]
     (println "WOO")
-    (.on stream "data" (fn [] (println "H")))))
+    (.on stream "data" #(println "H"))
+    (.on stream "end" #(println "DONE!"))))

 (.change (js/$ "#file_upload_input")
   (fn [e]


move valid-msg? to validation namespace and rename to valid-json?, fix formatting

--- src/gangway/worker.clj
+++ src/gangway/worker.clj
@@ -21,24 +21,11 @@

 (defn dispatch [db-conn message]
   (let [wf (get-worker-fn message)]
-  ((get-worker-fn message) db-conn message)))
+    ((get-worker-fn message) db-conn (construct-data message))))

 (defn do-work [db-conn messages]
   (let [parsed-messages (json/read-str messages :key-fn keyword)]
     (doall (map (partial dispatch db-conn) parsed-messages))))
-
-(defn valid-msg?
-  "Evaluates given message string to determine if it's a valid Gangway message.
-   Initial validation confirms that message is a valid JSON string. Further validation
-   of data 'shape' is likely required."
-  [msg]
-  (let [valid-msg
-    (try
-      (let [parsed-msg (json/read-str msg :key-fn keyword)]
-        true)
-      (catch Exception e
-        (not true)))]
-    valid-msg))

 (comment

@@ -53,4 +40,3 @@
                            :competency-parents [1 2 3]}}}])
      :key-fn keyword))
   )
-


CMR-3693: Changed some variable names.

CMR-3693: Changed some variable names.

--- transmit-lib/src/cmr/transmit/kms.clj
+++ transmit-lib/src/cmr/transmit/kms.clj
@@ -136,9 +136,9 @@
    Returns a sequence of full hierarchy maps."
   [keyword-scheme xml-content]
   (let [parsed-xml (xml/parse (java.io.StringReader. xml-content))
-        conceptBriefs (select parsed-xml "conceptBrief")
-        idnnodeAttrs (filter (fn [x] (= "idnnode" (:conceptScheme x))) (map :attrs conceptBriefs))
-        short-names (map vals (map #(select-keys % [:prefLabel]) idnnodeAttrs))
+        concept-brief-tags (select parsed-xml "conceptBrief")
+        idnnode-attrs (filter (fn [x] (= "idnnode" (:conceptScheme x))) (map :attrs concept-brief-tags))
+        short-names (map vals (map #(select-keys % [:prefLabel]) idnnode-attrs))
         keyword-entries (->> short-names
                              ;; Create a map for each short-name value using the subfield-names as keys
                              (map #(zipmap (keyword-scheme keyword-scheme->field-names) %))


remove :public from the list of the private properties

--- src/open_company/representations/company.clj
+++ src/open_company/representations/company.clj
@@ -14,7 +14,7 @@

 (def recognized-links #{:self :update :partial-update :delete :section-list})

-(def ^:private clean-properties [:id :org-id :public])
+(def ^:private clean-properties [:id :org-id])

 (defun url
   ([slug :guard string?] (str "/companies/" (name slug)))


svg letters

svg letters

--- src/gobanbot/image.clj
+++ src/gobanbot/image.clj
@@ -15,7 +15,7 @@
   (let [style (if (= color :black)
                 {:fill :black}
                 {:stroke :black :fill :white :width 1})]
-    [:circle style (vec (map #(-> % (* 10) (+ 10)) xy)) 6]))
+    [:circle style (vec (map #(-> % (* 100) (+ 100)) xy)) 45]))

 (defn get-stones [moves]
   (map (fn [{:keys [mv bid]}]
@@ -25,17 +25,23 @@

 (defn get-hlines []
   (map
-    (fn [i] [:line {:stroke :black :width 1} [i 10] [i 190]])
-    (range 10 200 10)))
+    (fn [i] [:line {:stroke :black :stroke-width 5} [i 100] [i 1900]])
+    (range 100 2000 100)))

 (defn get-vlines []
   (map
-    (fn [i] [:line {:stroke :black :width 1} [10 i] [190 i]])
-    (range 10 200 10)))
+    (fn [i] [:line {:stroke :black :stroke-width 5} [100 i] [1900 i]])
+    (range 100 2000 100)))

 (defn get-htext []
   (map
-    (fn [i] [:text {:font-family "sans-serif" :font-size 10 :x (+ 10 (* i 10)) :y 10}
+    (fn [i] [:text {:font-family "sans-serif" :font-size 72 :x (+ 72 (* i 100)) :y 72}
+             (-> i (+ 97) char str)])
+    (range 19)))
+
+(defn get-vtext []
+  (map
+    (fn [i] [:text {:font-family "sans-serif" :font-size 72 :x 10 :y (+ 122 (* i 100))}
              (-> i (+ 97) char str)])
     (range 19)))

@@ -45,6 +51,7 @@
                                  (get-hlines)
                                  (get-vlines)
                                  (get-htext)
+                                 (get-vtext)
                                  (get-stones moves)))
                     (str "resources/" f-n))
     f-n))


Don't lose comments changed immediately before submit button pressed

--- client/src/cljs/receipts_client/views.cljs
+++ client/src/cljs/receipts_client/views.cljs
@@ -248,6 +248,7 @@
         :width field-width
         :model (or (:purchase/comment receipt) "")
         :on-change #(>evt [:edit-current-receipt :purchase/comment %])
+        :change-on-blur? false ;; For touch screen; otherwise misses change immediately before submit
         :attr {:type "text"}]]
       [labelled "Consumer"
        (:purchase/consumer validation-errors)


Indent -main and change inputs to main

Indent -main and change inputs to main

--- src/hydrofoil/core.clj
+++ src/hydrofoil/core.clj
@@ -2,7 +2,8 @@
   (:require [clojure.data.json :as json]
             [hydrofoil.evolution :refer :all]
             [hydrofoil.utils :refer :all]
-            [hydrofoil.Model.Thin_Aerofoil_Theory :as TAT]))
+            [hydrofoil.Model.Thin_Aerofoil_Theory :as TAT]
+            [hydrofoil.Model.Lifting_Line_Theory :as LLT]))

 (defn run-constants
   [dencity velocity angle-of-attack span root-chord]
@@ -67,5 +68,16 @@

         )))))

-(defn -main [angle-of-attack span root-chord scoring-arg]
-  (hill-climber 10000 (run-constants 1 50 (Integer/parseInt angle-of-attack) (Integer/parseInt span) (Integer/parseInt root-chord)) drag-priority-scoring (Integer/parseInt scoring-arg)))
+
+(defn -main [dencity v-infinity angle-of-attack]
+      (hill-climber 3000000
+                    (run-constants (Double/parseDouble dencity)
+                                   (Double/parseDouble v-infinity)
+                                   (Double/parseDouble angle-of-attack)
+                                   11.24
+                                   2.67)
+                    lift-priority-scoring
+                    27585))
+
+(LLT/Lifting-Line-Theory (NACA-design 0 0 0) (run-constants 0.7708 163.17 2.1 11.24 2.67))
+(LLT/S (run-constants 0.7708 163.17 2.1 11.24 2.67))


Does the image reading error handling in handler instead of hdfsreader

--- src/images/handler.clj
+++ src/images/handler.clj
@@ -19,8 +19,13 @@
         :headers {"Content-Type" (str "image/" (content-subtype filename))
                   "Access-Control-Allow-Headers" "x-splunk-form-key, accept, origin"
                   "Access-Control-Allow-Methods" "GET"}
-        :body (-> (reader/get-image path filename)
-                  image/image-stream->byte-array
+        :body (-> (try
+                    (-> (reader/get-image path filename)
+                        image/image-stream->byte-array)
+                    (catch Exception e
+                      (-> (clojure.java.io/resource "public/imsorry.jpg")
+                          .openStream
+                          IOUtils/toByteArray)))
                   Base64/encodeBase64
                   String.)})
   (route/resources "/")


(PDB-5138) validate-dotted-field: anchor regexp

Presumably this should only match facts.something not
foo.facts.something.

--- src/puppetlabs/puppetdb/query_eng/engine.clj
+++ src/puppetlabs/puppetdb/query_eng/engine.clj
@@ -55,7 +55,8 @@

 (defn validate-dotted-field
   [dotted-field]
-  (and (string? dotted-field) (re-find #"(facts|trusted)\..+" dotted-field)))
+  ;; Q: why isn't parameters in here (cf. :dotted-fields below)
+  (and (string? dotted-field) (re-find #"^(facts|trusted)\..+" dotted-field)))

 (def field-schema (s/cond-pre s/Keyword
                               SqlCall SqlRaw


Define and use future-with-default-out.

Define and use future-with-default-out.

--- src/incise/watcher.clj
+++ src/incise/watcher.clj
@@ -33,19 +33,26 @@
       (delete-recursively file)))
   (.delete root))

+(defmacro future-with-default-out
+  "Just like future, but ensures that *out* and *err* inside the future are the
+   same as the calling context."
+  [& body]
+  `(let [orig-out# *out*
+         orig-err# *err*]
+    (future
+      (binding [*out* orig-out#
+                *err* orig-err#]
+        ~@body))))
+
 (defn watch
   [change-fn]
   (delete-recursively (File. "resources/public/"))
-  (let [orig-out *out*
-        orig-err *err*]
-    (future
-      (binding [*out* orig-out
-                *err* orig-err]
-        @(watcher ["resources/content/"]
-                  (rate 300)
-                  (on-change (-> change-fn
-                                 per-change
-                                 log-exceptions)))))))
+  (future-with-default-out
+    @(watcher ["resources/content/"]
+              (rate 300)
+              (on-change (-> change-fn
+                             per-change
+                             log-exceptions)))))

 (def watching nil)


More cleanup

More cleanup

--- src/metabase/util/stats.clj
+++ src/metabase/util/stats.clj
@@ -2,6 +2,7 @@
   "Functions which summarize the usage of an instance"
   (:require [clojure.tools.logging :as log]
             [clj-http.client :as client]
+            [medley.core :as m]
             [toucan.db :as db]
             [metabase.api.session :as session-api]
             [metabase.config :as config]
@@ -30,15 +31,18 @@
             [metabase.util :as u])
   (:import java.util.Date))

-(defn- one-if
-  "Return `1` if CONDITION is truthy, otherwise return `0`."
-  ([k m]
-   (one-if (get m k)))
-  ([condition]
-   (if condition 1 0)))
-
-(defn- merge-count-maps [ms]
-  (reduce (partial merge-with +) ms))
+(defn- merge-count-maps
+  "Merge sequence of maps MS by summing counts inside them.
+   Non-integer values are allowed; truthy values are considered to add a count of `1`, while non-truthy
+   values do not affect the result count."
+  [ms]
+  (reduce (partial merge-with +)
+          (for [m ms]
+            (m/map-vals #(cond
+                           (number? %) %
+                           %           1
+                           :else       0)
+                        m))))

 (def ^:private ^:const ^String metabase-usage-url "https://xuq0fbkk0j.execute-api.us-east-1.amazonaws.com/prod")

@@ -146,10 +150,10 @@
   []
   {:users (merge-count-maps (for [user (db/select [User :is_active :is_superuser :last_login :google_auth])]
                               {:total     1
-                               :active    (one-if :is_active    user)
-                               :admin     (one-if :is_superuser user)
-                               :logged_in (one-if :last_login   user)
-                               :sso       (one-if :google_auth  user)}))})
+                               :active    (:is_active    user)
+                               :admin     (:is_superuser user)
+                               :logged_in (:last_login   user)
+                               :sso       (:google_auth  user)}))})

 (defn- group-metrics
   "Get metrics based on groups:
@@ -164,8 +168,8 @@
   {:questions (merge-count-maps (for [{query-type :query_type} (db/select [Card :query_type])]
                                   (let [native? (= (keyword query-type) :native)]
                                     {:total  1
-                                     :native (one-if native?)
-                                     :gui    (one-if (not native?))})))})
+                                     :native native?
+                                     :gui    (not native?)})))})

 (defn- dashboard-metrics
   "Get metrics based on dashboards
@@ -218,7 +222,7 @@
   []
   {:databases (merge-count-maps (for [{is-full-sync? :is_full_sync} (db/select [Database :is_full_sync])]
                                   {:total    1
-                                   :analyzed (one-if is-full-sync?)}))})
+                                   :analyzed is-full-sync?}))})

 (defn- table-metrics


Bump next

Bump next

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject com.wsscode/pathom "2.0.19"
+(defproject com.wsscode/pathom "2.0.20-SNAPSHOT"
   :description "A Clojure library designed to provide a collection of helper functions to support Clojure(script) graph parsers using\nom.next graph syntax."
   :url "https://github.com/wilkerlucio/pathom"
   :license {:name "Eclipse Public License"


Update cljs -> 0.0-3123

Update cljs -> 0.0-3123


Update ring to 1.4.0-RC1

Update ring to 1.4.0-RC1


Version 1.1.4

Version 1.1.4


bump dev version

bump dev version


add exclutions

add exclutions


avoids name conflicts with clojure.core error-handler (#784)

--- waiter/src/waiter/process_request.clj
+++ waiter/src/waiter/process_request.clj
@@ -236,10 +236,10 @@
                                        correlation-id
                                        (stream-http-request executor service-id metric-group error-handler-fn
                                                             input-stream body-ch @bytes-streamed-atom)))
-          error-handler (fn [throwable]
-                          (log/info "request failed after streaming" @bytes-streamed-atom "bytes")
-                          (histograms/update! (metrics/service-histogram service-id "request-size") @bytes-streamed-atom)
-                          (error-handler-fn throwable))]
+          stream-error-handler (fn [throwable]
+                                 (log/info "request failed after streaming" @bytes-streamed-atom "bytes")
+                                 (histograms/update! (metrics/service-histogram service-id "request-size") @bytes-streamed-atom)
+                                 (error-handler-fn throwable))]
       (try
         (loop [unreported-bytes-to-statsd 0]
           (let [available-bytes (.available input-stream)
@@ -290,13 +290,13 @@
                           (if (>= sleep-duration-ms max-back-pressure-delay-ms)
                             (let [description-map {:bytes-pending bytes-read :bytes-streamed bytes-streamed}]
                               (log/error "unable to stream request bytes" description-map)
-                              (error-handler (ex-info "unable to stream request bytes" description-map)))
+                              (stream-error-handler (ex-info "unable to stream request bytes" description-map)))
                             (recur (* 2 sleep-duration-ms)))))))))

               :else
               (submit-request-streaming-task executor stream-http-request-task))))
         (catch Throwable th
-          (error-handler th))))))
+          (stream-error-handler th))))))

 (defn input-stream->channel
   "Returns a channel that will contain the ByteBuffers read from the input stream.
@@ -325,14 +325,14 @@
                               (try
                                 (submit-request-streaming-task executor stream-http-request-fn)
                                 (catch Throwable throwable
-                                  (error-handler throwable))))
+                                  (error-handler-fn throwable))))
                             (onAllDataRead [_]
                               (async/close! body-ch))
                             (onError [_ throwable]
                               (error-handler-fn throwable))))
         (submit-request-streaming-task executor stream-http-request-fn))
       (catch Throwable throwable
-        (error-handler throwable)))
+        (error-handler-fn throwable)))
     body-ch))

 (defn- make-http-request


Typo.

Typo.

--- clojure_pi_dir/pi.clj
+++ clojure_pi_dir/pi.clj
@@ -1,7 +1,7 @@
 ; We have to define name-space etc. because we want to compile to to Java byte-code.
 (ns pi
   (:gen-class
-  :methods [#^{t:static true} [calcpi [int] double]]))
+  :methods [#^{:static true} [calcpi [int] double]]))

 ; The function that does the bulk of our work as usual.
 (defn -calcpi [n] ((fn [x] (/ (apply + (map (fn [x] (/ 4 (+ 1 (* x x)))) (range (/ 0.5 x) 1 (/ 1 x)))) x)) n))


add comment for monad law

add comment for monad law

--- src/monad/clojure/monad.clj
+++ src/monad/clojure/monad.clj
@@ -220,6 +220,7 @@

 ;;Associativity 结合律
 ;;Binding m to f and then applying >>= to the result and g should be the same as applying >>= to m and a function of argument x that first applies f to x and then binds it to g.
+;;详细的证明可以使用LC进行推导证明

 (let [m (return (->List nil) 3)
       f (fn [x] (->List (list x (- x))))


double asset downloading timeout time

double asset downloading timeout time

--- src/overtone/libs/asset.clj
+++ src/overtone/libs/asset.clj
@@ -17,7 +17,7 @@
   "Download file at url to local filesystem at tmp-file verbosely."
   [url tmp-file]
   (binding [*verbose-overtone-file-helpers* true]
-    (download-file url tmp-file 10000 100 5000)))
+    (download-file url tmp-file 20000 100 5000)))

 (defn- safe-url
   "Replace all non a-z A-Z 0-9 - chars in stringified version of url with _"


add 'when-assert' as a separate macro

add 'when-assert' as a separate macro

--- src/pjstadig/assertions.clj
+++ src/pjstadig/assertions.clj
@@ -9,11 +9,20 @@
 (ns pjstadig.assertions
   (:refer-clojure :exclude [assert]))

+
+(defmacro when-assert
+  "Execute body of code only if assertions are enabled."
+  [& body]
+  `(when pjstadig.Assertions/assertionsEnabled
+     ~@body))
+
+
 (defmacro assert
+  "Evaluate form. Return nil on truthy result, throw AssertionError otherwise."
   ([form]
      `(assert ~form ~(pr-str form)))
   ([form msg]
-     `(if pjstadig.Assertions/assertionsEnabled
+     `(when-assert
         (if ~form
           nil
           (throw (AssertionError. ~msg))))))


fix to work with new :gae map, javac 1.7

* restructure :gae map
* module version string independent of project version string
* javac defaults to 1.7

Signed-off-by: Gregg Reynolds <d0f77bc71a9867acdcb4f62f012b858edad79160@norc.org>

--- src/migae/boot_gae.clj
+++ src/migae/boot_gae.clj
@@ -278,9 +278,13 @@
    k keep bool str "keep intermediate .clj files"
    m module MODULE str "module dirpath"
    v verbose bool "Print trace messages."]
+  ;; boolean hasUppercase = !password.equals(password.toLowerCase());
   (let [tmp-dir (boot/tmp-dir!)
         prev-pre (atom nil)
-        dir (if dir dir web-inf-dir)]
+        dir (if dir dir web-inf-dir)
+        version (str/replace (-> (boot/get-env) :gae :module :version) "." "-")]
+    (if (not= version  (.toLowerCase version))
+      (throw (Exception. (str "Upper-case not allowed in GAE version string: " version))))
     (boot/with-pre-wrap fileset
       (let [webapp-edn-files (->> (boot/fileset-diff @prev-pre fileset)
                                   boot/input-files
@@ -304,9 +308,9 @@
                                    {}
                                    {:module (str (-> webapp-edn-c :module :name))})
                                  {}))
-              app-id (name (-> (boot/get-env) :gae :app-id))
-              version (str/replace (-> (boot/get-env) :gae :version) "." "-")
-              version (str "r-" (subs version 0 (.lastIndexOf version "-SNAPSHOT")))
+              app-id (name (-> (boot/get-env) :gae :app :id))
+              ;; version (str/replace (-> (boot/get-env) :gae :module :version) "." "-")
+              ;; version (str "r-" (subs version 0 (.lastIndexOf version "-SNAPSHOT")))
               module (-> (boot/get-env) :gae :module :name)
               ;; module (if (:module gae-forms)
               ;;          (str (:module gae-forms) "-" version)
@@ -445,7 +449,7 @@
     (comp (install-sdk)
           (libs :verbose verbose)
           (appstats :verbose verbose)
-          (builtin/javac)
+          (builtin/javac :options ["-target" "1.7"])
           (if prod identity (reloader :keep keep :service service :verbose verbose))
           (filters :keep keep :verbose verbose)
           (servlets :keep keep :verbose verbose)
@@ -475,14 +479,14 @@
    s service bool "building as service"
    v verbose bool "verbose"]
   (let [mod      (-> (boot/get-env) :gae :module :name)
-        app-dir  (-> (boot/get-env) :gae :module :app-dir)
+        app-dir  (-> (boot/get-env) :gae :app :dir)
         dir      (if monitor
                    (str app-dir "/target/" mod)
                    (if service (str "target/" mod)
                        "target"))]
     (if service
       (if (not (and mod app-dir))
-        (throw (Exception. "For service targets, both :name and :app-dir must be specified in :gae map of build.boot"))))
+        (throw (Exception. "For service targets, both :name and :app :dir must be specified in :gae map of build.boot"))))
     (println "TARGET DIR: " dir)
     (builtin/target :dir #{dir}
                     :no-clean (or no-clean false))))
@@ -611,9 +615,12 @@
   (if verbose (println "TASK: boot-gae/deploy"))
   (validate-tools-api-jar)
   (println "PARAMS: " *opts*)
-  (let [opts (merge {:sdk-root (:sdk-root config-map)
+  (let [mod      (-> (boot/get-env) :gae :module :name)
+        app-dir  (-> (boot/get-env) :gae :app :dir)
+        ;; dir      (if service (str "target/" mod) "target")
+        opts (merge {:sdk-root (:sdk-root config-map)
                      ;; :use-java7 true
-                     :build-dir (gae-app-dir)} ;; (:build-dir config-map)}
+                     :build-dir (if build-dir build-dir (gae-app-dir))} ;; (:build-dir config-map)}
                     *opts*)
         _ (println "OPTS: " opts)
         params (into [] (for [[k v] (remove (comp nil? second)
@@ -1129,7 +1136,7 @@
           ;; _ (println "ARGS: " args)
           ;; jargs (into-array String (conj jargs "build/exploded-app"))

-          target-dir (if service (str (-> (boot/get-env) :gae :module :app-dir)
+          target-dir (if service (str (-> (boot/get-env) :gae :app :dir)
                                       "/target/"
                                       (-> (boot/get-env) :gae :module :name))
                          "target")


Spacing

Spacing

--- src/proxmox/validations.clj
+++ src/proxmox/validations.clj
@@ -21,7 +21,7 @@
     :type [v/required
            (v/member prox-types  :message (<< "Proxmox VM type must be either ~{prox-types}" ))]
     :vmid [(v/custom (partial greater-then 100) :message "vmid must be greater then 100"
-                     :pre #(-> % :proxmox :vmid nil? not) )]
+                     :pre #(-> % :proxmox :vmid nil? not))]
     :password [v/required cv/str?]
     :nameserver [cv/str?])


minimally working 2 pages before major refactor

--- src-cljs/tranjlator/core.cljs
+++ src-cljs/tranjlator/core.cljs
@@ -20,7 +20,10 @@

 (def app-state (atom {:original [sample-source]
                       :translated [sample-translation]
-                      :users sample-users}))
+                      :users sample-users
+                      :user-name nil
+                      :listener-ch (chan)
+                      :sender-ch (chan)}))

 (defn handle-incoming [listener-ch server-ch]
   (go
@@ -52,12 +55,20 @@
   #_(put! target text)
   false)

-(defn check-for-enter [e owner {:keys [text sender-ch]}]
+(defn send-message-click [sender-ch text owner app]
+  (do
+    (post-message sender-ch text)
+    (clear-text owner)))
+
+(defn login-click [sender-ch text owner app]
+  (post-message sender-ch text)
+  (om/update! app :user-name text)
+  (clear-text owner))
+
+(defn check-for-enter [e owner {:keys [text sender-ch]} app click-fn]
   (when (or (= 13 (.-keyCode e))
             (= 13 (.-which e)))
-    (do
-      (post-message sender-ch text)
-      clear-text owner)))
+    (click-fn sender-ch text owner app)))

 (defn text-entry [e owner {:keys [text]}]
   (om/set-state! owner :text (.. e -target -value)))
@@ -80,46 +91,67 @@
   (reify
     om/IInitState
     (init-state [_]
-      (let [listener-ch (chan)
-            sender-ch (chan)]
-        (make-socket listener-ch sender-ch)
-        {:listener-ch listener-ch
-         :sender-ch sender-ch
-         :text ""}))
+      {:text ""})
+    om/IRenderState
+    (render-state [this {:keys [text] :as state}]
+      (let [sender-ch (:sender-ch app)]
+        (dom/div #js {:className "container"}
+                 (dom/h3 nil "Enter Chat stuff")
+                 (dom/div #js {:className "form-horizontal"}
+                          (dom/div nil
+                                   (dom/div nil
+                                            (om/build users-view (:users app)))
+                                   (dom/div nil
+                                            (om/build chat-view (:original app)))
+                                   (dom/div nil
+                                            (om/build chat-view (:translated app))))
+                          (dom/div #js {:className "form-group"}
+                                   (dom/input #js {:className "form-control" :type "text"
+                                                   :value text
+                                                   :onKeyPress (fn [e] (check-for-enter e owner state app send-message-click))
+                                                   :onChange #(text-entry % owner state)}))
+                          (dom/div #js {:className "col-xs-offset-2 col-xs-10"}
+                                   (dom/button #js {:type "button" :className "button"
+                                                    :onClick (fn [e] (send-message-click sender-ch text owner app))}
+                                               "click me"))))))))
+
+(defn signin-view [app owner]
+  (reify
+    om/IInitState
+    (init-state [_]
+      {:text ""})
+    om/IRenderState
+    (render-state [this {:keys [text] :as state}]
+      (let [sender-ch (:sender-ch app)]
+        (dom/h3 #js {:className "container"}
+                (dom/div #js {:className "form-horizontal"}
+                         (dom/div #js {:className "form-group"}
+                                  (dom/input #js {:className "form-control" :type "text"
+                                                  :value text
+                                                  :onKeyPress (fn [e] (check-for-enter e owner state app login-click))
+                                                  :onChange (fn [e] (text-entry e owner state))}))
+                         (dom/div #js {:className "col-xs-offset-2 col-xs-10"}
+                                  (dom/button #js {:type "button" :className "button"
+                                                   :onClick (fn [e] (login-click sender-ch text owner app))}))))))))
+
+(defn view-picker [app owner]
+  (reify
     om/IWillMount
     (will-mount [_]
-      (let [listener-ch (om/get-state owner :listener-ch)
-            sender-ch (om/get-state owner :sender-ch)]
+      (let [listener-ch (:listener-ch app)
+            sender-ch (:sender-ch app)]
+        (make-socket listener-ch sender-ch)
         (go (loop []
               (let [msg (<! listener-ch)]
                 ;; do something cool with the message
                 (recur))))))
-    om/IRenderState
-    (render-state [this {:keys [sender-ch text] :as state}]
-      (dom/div #js {:className "container"}
-               (dom/h3 nil "Enter Chat stuff")
-               (dom/div #js {:className "form-horizontal"}
-                         (dom/div nil
-                                  (dom/div nil
-                                           (om/build users-view (:users app)))
-                                  (dom/div nil
-                                           (om/build chat-view (:original app)))
-                                  (dom/div nil
-                                           (om/build chat-view (:translated app))))
-                         (dom/div #js {:className "form-group"}
-                                  (dom/input #js {:className "form-control" :type "text"
-                                                  :value text
-                                                  :onKeyPress (fn [e] (check-for-enter e owner state))
-                                                  :onChange #(text-entry % owner state)}))
-                         (dom/div #js {:className "col-xs-offset-2 col-xs-10"}
-                                  (dom/button #js {:type "button" :className "button"
-                                                   :onClick (fn [e] (do
-                                                                     (post-message sender-ch text)
-                                                                     (clear-text owner))
-                                                              )}
-                                              "click me")))))))
+    om/IRender
+    (render [_]
+      (if (empty? (:user-name app))
+        (om/build signin-view app)
+        (om/build master-view app)))))

 (om/root
- master-view
+ view-picker
  app-state
  {:target (. js/document (getElementById "app"))})


fix case count

fix case count

--- src/neuseg/prepare.clj
+++ src/neuseg/prepare.clj
@@ -20,9 +20,6 @@

 (defn- clean [text]
   (clojure.string/replace text #"(\s|\u00a0)+" " "))
-
-(defn- trim [text]
-   (clojure.string/replace text #"(\s|\u00a0)+" ""))

 (defn tagging [text]
   (let [seged (seg text)]
@@ -51,8 +48,9 @@
     (with-open [wrtr (writer baos :encoding "utf-8")]
       (with-open [rdr (reader file-corpus :encoding "utf-8")]
         (doseq [line (line-seq rdr)]
-          (swap! counter + (count (trim line)))
-          (.write wrtr (gen-cases (clean line))))))
+          (let [cline (clean line)]
+            (swap! counter + (count cline))
+            (.write wrtr (gen-cases cline))))))
     (with-open [wrtr (writer file-output  :encoding "utf-8")]
         (.write wrtr (str @counter " 32 2\n"))
           (.write wrtr (.toString baos "utf-8")))))


freemem instead of used heap

freemem instead of used heap

--- src/ontrail/system.clj
+++ src/ontrail/system.clj
@@ -7,7 +7,7 @@
   (format "%.0f min" (/ (.getUptime (ManagementFactory/getRuntimeMXBean)) 60000.0)))

 (defn get-used-heap[]
-  (format "%.0fM" (/ (.totalMemory (Runtime/getRuntime)) (* 1024 1024.0))))
+  (format "%.0fM" (/ (.freeMemory (Runtime/getRuntime)) (* 1024 1024.0))))

 (defn get-max-heap[]
   (format "%.0fM" (/ (.maxMemory (Runtime/getRuntime)) (* 1024 1024.0))))