allow either order of noun+adj

allow either order of noun+adj

--- test/babel/test/it.cljc
+++ test/babel/test/it.cljc
@@ -77,7 +77,8 @@
                                        :number :sing
                                        :pred :donna}}}
                        np-grammar)]
-    (is (= (fo expr) "la donna difficile"))
+    (is (or (= (fo expr) "la donna difficile")
+            (= (fo expr) "la difficile donna")))
     (is (not (empty? (reduce concat (map
                                      :parses (parse (fo expr) np-grammar))))))))


Fixes some whitespace in api.clj (#679)

Fixes some whitespace in api.clj (#679)

--- scheduler/src/cook/mesos/api.clj
+++ scheduler/src/cook/mesos/api.clj
@@ -844,7 +844,7 @@
                                      (map str)))))
         instances (map #(fetch-instance-map db %1 retrieve-sandbox-directory-from-agent) (:job/instance job))
         submit-time (when (:job/submit-time job) ; due to a bug, submit time may not exist for some jobs
-                (.getTime (:job/submit-time job)))
+                     (.getTime (:job/submit-time job)))
         job-map {:command (:job/command job)
                  :constraints constraints
                  :cpus (:cpus resources)
@@ -2043,12 +2043,12 @@
                 (timers/time!
                   list-endpoint
                   (let [{states ::states
-                        user ::user
-                        start-ms ::start-ms
-                        end-ms ::end-ms
-                        since-hours-ago ::since-hours-ago
-                        limit ::limit
-                        name-filter-fn ::name-filter-fn} ctx
+                         user ::user
+                         start-ms ::start-ms
+                         end-ms ::end-ms
+                         since-hours-ago ::since-hours-ago
+                         limit ::limit
+                         name-filter-fn ::name-filter-fn} ctx
                         start-ms' (or start-ms (- end-ms (-> since-hours-ago t/hours t/in-millis)))
                         start (Date. start-ms')
                         end (Date. end-ms)
@@ -2400,4 +2400,3 @@
     (format-params/wrap-restful-params {:formats [:json-kw]
                                         :handle-error c-mw/handle-req-error})
     (streaming-json-middleware)))
-


Since we decreased batch timeout, the count for repeated batch calls needs more tolerance.

--- test/onyx/peer/lifecycles_test.clj
+++ test/onyx/peer/lifecycles_test.clj
@@ -141,5 +141,5 @@
                   (partition 3 repeated-calls)))
       ;; Allow lifecycles to run more times in case the CI box is lagging
       ;; and we experience replays.
-      (is (<= (count repeated-calls) 40))
+      (is (<= (count repeated-calls) 200))
       (is (= 3 @started-task-counter)))))


Use some numbers in auto quoting tests

Use some numbers in auto quoting tests


I'm not sure what this is, it's left over.

--- comment-breaker/src/comment_breaker/core.clj
+++ comment-breaker/src/comment_breaker/core.clj
@@ -5,6 +5,7 @@
 (def line-length (atom nil))
 (def sep-char (atom "\r\n"))

+;;;; Functions to process the file and break it into comments
 (defn suffix-file [fstr suffix]
   (let [splits (clojure.string/split fstr #"\.")]
     (str (apply str (butlast splits)) suffix "." (last splits))))
@@ -25,16 +26,16 @@

 (defn process-file [contents]
   (clojure.string/join @sep-char
-    (map eat-line (clojure.string/split contents (re-pattern @sep-char)))))
+		(map eat-line (clojure.string/split contents (re-pattern @sep-char)))))

 (defn get-args [args]
   (let [parsed
           (cli args
-		    ["-i" "--in-file" "File to run comment processing on."]
-			["-o" "--out-file" "Output file."]
-			["-l" "--line-length" "The desired line length."
-			  :default 80 :parse-fn #(Integer. %)])
-	    p-map (first parsed)]
+						["-i" "--in-file" "File to run comment processing on."]
+						["-o" "--out-file" "Output file."]
+						["-l" "--line-length" "The desired line length."
+							:default 80 :parse-fn #(Integer. %)])
+				p-map (first parsed)]
 	(do
 	  (reset! line-length (:line-length p-map))
 	  (cond
@@ -49,7 +50,7 @@
   (let [cli-map (get-args args)]
     (try
 	  (->> (slurp (:in-file cli-map))
-		   (process-file)
-		   (spit (:out-file cli-map)))
+				 (process-file)
+				 (spit (:out-file cli-map)))
 	  (catch java.io.IOException e
 	    (prn (.toString e))))))


Release DiffFormatter and ObjectReader after achievement scanning

--- src-clj/acha/git_parser.clj
+++ src-clj/acha/git_parser.clj
@@ -52,6 +52,9 @@
   (doto (DiffFormatter. DisabledOutputStream/INSTANCE)
     (.setRepository (.getRepository repo))
     (.setDiffComparator RawTextComparator/DEFAULT)))
+
+(defn object-reader [^Git repo]
+  (.. repo getRepository newObjectReader))

 (defn- normalize-path [path]
   (cond


stop fetching so many entity ids

stop fetching so many entity ids

--- src-cljs/frontend/core.cljs
+++ src-cljs/frontend/core.cljs
@@ -294,13 +294,37 @@
 (defn fetch-entity-ids [api-ch eid-count]
   (ajax/ajax :post "/api/entity-ids" :entity-ids api-ch :params {:count eid-count}))

+(defn notify-error [state]
+  (d/transact! (:db @state) [{:layer/type :layer.type/text
+                              :layer/name "Error"
+                              :layer/text "There was an error connecting to the server."
+                              :layer/start-x 200
+                              :layer/start-y 200
+                              :db/id -1
+                              :layer/end-x 600
+                              :layer/end-y 175}
+                             {:layer/type :layer.type/text
+                              :layer/name "Error"
+                              :layer/text "Please refresh to try again."
+                              :layer/start-x 200
+                              :layer/start-y 225
+                              :db/id -2
+                              :layer/end-x 400
+                              :layer/end-y 200}]))
+
 (defn setup-entity-id-fetcher [state]
   (let [api-ch (-> state deref :comms :api)]
-    (fetch-entity-ids api-ch 60)
-    (add-watch state :entity-id-fetcher (fn [key ref old new]
-                                          (when (> 20 (-> new :entity-ids count))
-                                            (println "fetching more entity ids")
-                                            (fetch-entity-ids api-ch 40))))))
+    (go (let [resp (<! (ajax/managed-ajax :post "/api/entity-ids" :params {:count 40}))]
+          (if (= :success (:status resp))
+            (do
+              (put! api-ch [:entity-ids :success {:resp resp :status :success}])
+              (add-watch state :entity-id-fetcher (fn [key ref old new]
+                                                    (when (> 35 (-> new :entity-ids count))
+                                                      (println "fetching more entity ids")
+                                                      (fetch-entity-ids api-ch (- 40
+                                                                                (-> new :entity-ids count)))))))
+            (do (notify-error state)
+                (js/Rollbar.error "entity ids request failed :(")))))))

 (defn ^:export setup! []
   (js/React.initializeTouchEvents true)


Commented out "tea edit" block, as feature has been replaced.

--- src-cljs/tea_time/core.cljs
+++ src-cljs/tea_time/core.cljs
@@ -168,6 +168,7 @@
   ;(ajax/GET "/api/teas" :handler (fn [response] (reset! app-db (assoc-in @app-db [:teas-list] response)))))

  ;;(reset! app-db (assoc-in app-db [:teas-list] response))
+
 (defn delete-tea
   "Sends a get request that deletes the tea argument"
   [name]
@@ -268,23 +269,23 @@

 ;;(post-to-teas-db @tmp-new-tea)

-(defn tea-edit
-  "The edit/delete form component"
-  []
-  (fn []
-    [:div.form-group
-     [:div.row [:div.col-md-12]
-       [:button.btn.btn-info {:on-click (fn [_] (swap! show-edit not))} "Show/Hide edit form"]
-       [:div.p (str "Preview: " (or @edit-tea-snap "*no tea selected*") " -> " (or @edit-tea "*no tea selected*"))]
-       [:div.p]
-       [:form {:style {:visibility (if @show-edit
-                                     "visible"
-                                     "hidden")}}
-        [:input.form-control {:field :text :id :change-tea :value @edit-tea :on-change sync-edit-tea
-        ; [:input.btn.btn-info {:type "submit" :value "Update Tea Name" :on-click #((update-tea @edit-tea-id @edit-tea)
-                                                                                (reset! edit-tea nil)
-                                                                                (reset! edit-tea-snap nil)}]]
-       [:input.btn.btn-danger {:type "button" :value (str "Delete " @edit-tea-snap) :on-click #(delete-tea @edit-tea)}]]]))
+;(defn tea-edit
+  ;"The edit/delete form component"
+  ;[]
+  ;(fn []
+    ;[:div.form-group
+     ;[:div.row [:div.col-md-12]
+       ;[:button.btn.btn-info {:on-click (fn [_] (swap! show-edit not))} "Show/Hide edit form"]
+       ;[:div.p (str "Preview: " (or @edit-tea-snap "*no tea selected*") " -> " (or @edit-tea "*no tea selected*"))]
+       ;[:div.p]
+       ;[:form {:style {:visibility (if @show-edit
+                                     ;"visible"
+                                     ;"hidden")}}
+        ;[:input.form-control {:field :text :id :change-tea :value @edit-tea :on-change sync-edit-tea
+         ;[:input.btn.btn-info {:type "submit" :value "Update Tea Name" :on-click #((update-tea @edit-tea-id @edit-tea))}]
+                                                                                ;(reset! edit-tea nil)
+                                                                                ;(reset! edit-tea-snap nil)}]]
+       ;[:input.btn.btn-danger {:type "button" :value (str "Delete " @edit-tea-snap) :on-click #(delete-tea @edit-tea)}]]]))

 ;; tea-edit can be re-written so that it will look like the tea is being
 ;; modified in place on the DOM -- as a sort of preview -- then once the
@@ -298,11 +299,10 @@
     [:div.col-md-12
      "Here is a list of teas"]]
    [:div.row
-    [:div.col-md-8
-     [tealister]]
-    [:div.col-md-4
-     [tea-edit]
-     [tea-adder]]]])
+    [:div.col-xs-6
+     [tealister]
+     [tea-adder]]
+    [:div.col-xs-6]]])

 (def pages


(PE-13552) Add comments to clarify tests

--- test/integration/puppetlabs/services/jruby/jruby_puppet_pool_int_test.clj
+++ test/integration/puppetlabs/services/jruby/jruby_puppet_pool_int_test.clj
@@ -211,7 +211,7 @@
          (is (= "success response from restart test" (:body get-results))))))))

 (deftest ^:integration test-503-when-app-shuts-down
-  (testing "During a shutdown the agent requests result in a 503 response"
+  (testing "After the app is shutdown the agent requests result in a 503 response"
     (ks-testutils/with-no-jvm-shutdown-hooks
      (let [config (-> (jruby-testutils/jruby-puppet-tk-config
                        (jruby-testutils/jruby-puppet-config {:max-active-instances 2
@@ -267,7 +267,11 @@
            (tk-app/stop app)))))))

 (deftest ^:integration test-503-when-jruby-is-first-to-shutdown
-  (testing "After a shutdown, requests result in 503 http responses"
+  (testing "After the jruby service is shutdown, requests result in 503 http responses"
+    ;; The difference between this test and the test-503-when-app-shuts-down test is that
+    ;; This test only shuts down the jruby service as opposed to the entire app. This way
+    ;; we can test that the behavior is the same even if the app is in a partial shutdown
+    ;; state when a request comes in
     (bootstrap/with-puppetserver-running-with-mock-jruby-puppet-fn
      "JRuby mocking is safe here, because we're just looking to see that the
       HTTP response for an environment request transitions from success to


time helper for repl

time helper for repl

--- src/pc/repl.clj
+++ src/pc/repl.clj
@@ -3,6 +3,7 @@
    Also serves as a guide for how nses should be aliased"
   (:require [cheshire.core :as json]
             [clj-http.client :as http]
+            [clj-time.core :as time]
             [clojure.java.javadoc :refer (javadoc)]
             [clojure.repl :refer :all]
             [datomic.api :as d]


Use 'map' instead of 'for' in problem61.clj

--- euler_clojure/src/euler/problem61.clj
+++ euler_clojure/src/euler/problem61.clj
@@ -57,7 +57,7 @@
   members of that type."
   [func]
   (let [dw (drop-while (complement fourdigit?)
-                       (for [i (iterate inc 0)] (func i)))]
+                       (map func (iterate inc 0)))]
     (take-while fourdigit? dw)))

 (defn problem61 []


fix example pipeline config

fix example pipeline config

--- example/example_pipeline/pipeline.clj
+++ example/example_pipeline/pipeline.clj
@@ -27,7 +27,15 @@
 (defn -main [& args]
   (let [home-dir (util/create-temp-dir)
         artifacts-path-context "/artifacts"
-        lineup-cfg (io/load-config-file "lineup.json")
+        lineup-cfg {"urls"        {
+                                   "https://#env#.otto.de" {
+                                                            "paths"       ["/" "multimedia"]
+                                                            "max-diff"    2
+                                                            "env-mapping" {"live" "www"}}
+                                   }
+                    "browser"     :firefox
+                    "resolutions" [600 800]
+                    }
         config {:lineup-cfg               lineup-cfg
                 :home-dir                 home-dir
                 :dont-wait-for-completion false


fix comment

fix comment

--- contrib/devtools/src/carry_devtools/core.cljs
+++ contrib/devtools/src/carry_devtools/core.cljs
@@ -169,7 +169,7 @@
                  ; load debugger model from storage and replay if it's in replay mode
                  (let [loaded-model (get storage storage-key)]
                    (when (-> loaded-model ::debugger :replay-mode?)
-                     ; updating :initial-model so that on hot reload we don't see changes after modifying app init code
+                     ; update :initial-model to the fresh one
                      (let [new-model (assoc-in loaded-model [::debugger :initial-model] (-> @model ::debugger :initial-model))]
                        (dispatch-action [::load new-model]))


improve demo

improve demo

--- src/babel/english/demo.cljc
+++ src/babel/english/demo.cljc
@@ -14,71 +14,45 @@
 ;; should also be possible to override per-language.
 (def ^:const max-total-depth 25)

+;; run each (generate) as (time (generate)):
+(def ^:const timings? false)
+
 (def default-language-model (medium))

 (defn demo [ & [n spec]]
   (let [demo-specs
         [{:demo-name "Dog noun phrases"
           :synsem {:cat :noun
-                   :sem {:pred :cane}}}
+                   :sem {:pred :dog}}}

-         {:demo-name "Very specific noun phrases: few-rules"
-          :lm (few-rules)
-          :synsem {:cat :noun
-                   :sem {:pred :cane
-                         :number :plur
-                         :mod {:pred :first}
-                         :spec {:def :genitive
-                                :of {:pred :luisa}}}}}
-
-         {:demo-name "Very specific noun phrases: small-lexicon"
-          :lm (small-lexicon)
-          :synsem {:cat :noun
-                   :sem {:pred :cane
-                         :number :plur
-                         :mod {:pred :second}
-                         :spec {:def :genitive
-                                :of {:pred :luisa}}}}}
-
-         {:demo-name "Very specific noun phrases"
-          :synsem {:cat :noun
-                   :sem {:pred :cane
-                         :number :plur
-                         :mod {:pred :first}
-                         :spec {:def :genitive
-                                :of {:pred :luisa}}}}}
-
-         {:demo-name "Noun Phrases"
-          :synsem {:cat :noun}}
-
          {:demo-name "Sentences about dogs eating"
           :synsem {:cat :verb
-                   :sem {:subj {:pred :cane}
+                   :sem {:subj {:pred :dog}
                          :pred :eat}}}

-         {:demo-name "Sentences about thinking"
+         {:demo-name "The adventures of Luisa's yellow cat"
+          :synsem {:cat :verb
+                   :sem {:subj {:pred :cat
+                                :mod {:pred :yellow}
+                                :spec {:def :genitive
+                                       :of {:pred :luisa}}}}}}
+
+         {:demo-name "Women who read books"
+          :synsem {:cat :verb
+                   :sem {:subj {:pred :woman}
+                         :pred :read
+                         :obj {:pred :book}}}}
+
+         {:demo-name "Thinking"
           :synsem {:cat :verb
                    :sem {:pred :think}}}

-         {:demo-name "Sentences about believing"
-          :synsem {:cat :verb
-                   :sem {:pred :believe}}}
-
-         {:demo-name "Sentences about assuming"
-          :synsem {:cat :verb
-                   :sem {:pred :assume}}}
-
-         {:synsem {:cat :verb}
-          :demo-name "Sentences"}
-
-         {:synsem :top
-          :demo-name "Totally random expressions"}
          ]]

     (doall (map (fn [spec]
                   (let [log-message
-                        (str "running demo: " (:demo-name spec) "; " n " attempts.")]
-                    (do (log/info log-message)
+                        (str "running demo: " (:demo-name spec) "..")]
+                    (do (if timings? (log/info log-message))
                         (println)
                         (println log-message)
                         (println)
@@ -101,16 +75,20 @@
 (defn run-demo-with [n spec model]
   "print out _n_ generated sentences to stdout."
   (let [n (if n (Integer. n)
-              100)
+              10)
         spec (if spec (unifyc spec
                               {:modified false})
                  {:modified false})]
-    (filter #(not (nil? %))
-            (take n (repeatedly
-                     #(let [result
-                            (time
-                             (generate spec
-                                       :model model
-                                       :max-total-depth max-total-depth))]
-                        result))))))
+    (filter #(not (nil? %))
+            (if timings?
+              (take n (repeatedly
+                       #(time
+                         (generate spec
+                                   :model model
+                                   :max-total-depth max-total-depth))))
+              (take n (repeatedly
+                       #(generate spec
+                                  :model model
+                                  :max-total-depth max-total-depth)))))))

+


flag for ability to score an agenda

flag for ability to score an agenda

--- src/clj/game/core-flags.clj
+++ src/clj/game/core-flags.clj
@@ -206,6 +206,11 @@
           (rez-req state side card nil)
           true))))

+(defn can-score?
+  ([state side card] (can-score? state side card nil))
+  ([state side card {:as args}]
+   (turn-flag? state side card :can-score)))
+
 (defn can-be-advanced?
   "Returns true if the card can be advanced"
   [card]


simplified

simplified

--- src/cljs/markov/markov.cljs
+++ src/cljs/markov/markov.cljs
@@ -11,18 +11,20 @@

 ;; Markov chain generation

-(defn markov-data [line]
-  (let [l (if (= \. (last line)) line (str line "."))
-        words (cons "*START*" (clojure.string/split l #"\s"))
-        maps (for [p (partition 2 1 words)] {(first p) [(second p)]})]
+(defn markov-data [text]
+  (let [maps
+        (for [line (clojure.string/split text #"\.")
+              m (let [l (str line ".")
+                      words
+                      (cons "*START*" (clojure.string/split l #"\s+"))]
+                  (for [p (partition 2 1 (remove empty? words))]
+                    {(first p) [(second p)]}))]
+          m)]
     (apply merge-with concat maps)))

-(defn text-to-markov [text]
-  (let [sentences (clojure.string/split text #"\n")]
-    (apply merge-with concat (map markov-data sentences))))

 (defn generate []
-  (let [data (text-to-markov (input))]
+  (let [data (markov-data (input))]
     (loop [ws (data "*START*")
            acc []]
       (let [w (rand-nth ws)


Adds input field and button to add a todo

--- src/cljs/todo_clj/core.cljs
+++ src/cljs/todo_clj/core.cljs
@@ -1,17 +1,31 @@
 (ns todo-clj.core
   (:require [om.core :as om :include-macros true]
             [om.dom :as dom :include-macros true]
-            [ajax.core :refer [GET]]))
+            [ajax.core :refer [GET POST ajax-request json-request-format json-response-format]]))

 (enable-console-print!)

 (defonce app-state (atom {:todos []}))
+
+(defn trace [content]
+  (println content))

 (defn handler [response cursor]
   (om/update! cursor :todos response))

 (defn todo [todo]
   (dom/li #js {:key (:id todo)} (:title todo)))
+
+(defn add-todo [app owner]
+  (let [title (.-value (om/get-node owner "new-todo"))]
+    (POST "/todos" {:handler #(om/transact! app :todos (fn [todos]
+                                                         (println (conj todos %))
+                                                         (conj todos %)))
+                    :error-handler trace
+                    :params {:title title}
+                    :format :json
+                    :response-format :json
+                    :keywords? true})))

 (defn root-component [app owner]
   (reify
@@ -22,8 +36,12 @@
                      :response-format :json}))
     om/IRender
     (render [_]
+      (println (:todos app))
       (dom/div nil
         (dom/h1 nil "Todo")
+        (dom/div nil
+          (dom/input #js {:ref "new-todo" :type "text"} nil)
+          (dom/button #js {:onClick #(add-todo app owner)} "Submit"))
         (dom/ul nil (map todo (get app :todos)))))))

 (om/root


Compute all available moves at each turn

--- src/cljs/triboard/core.cljs
+++ src/cljs/triboard/core.cljs
@@ -50,21 +50,9 @@
     (fn [r [color [x y]]] (assoc-in r [x y] color))
     empty-board (init-positions)))

-(defn new-game []
-  {:board (new-board)
-   :turn 0
-   ;; From the turn you can deduce the number of turn left
-   ;; There is an invariant holding: total score = 12 * 3 + turn
-   ;; TODO - Enhance the display to show the available moves (compute them once)
-   :player (rand-nth players)
-   :scores
-   {:blue 12
-    :red 12
-    :green 12}})
-
-
-;; -----------------------------------------
-;; TAKING CELLS
+
+;; -----------------------------------------
+;; IDENTIFY CONVERTIBLE CELLS
 ;; -----------------------------------------

 (defn range-single-coord
@@ -131,6 +119,16 @@
    :looser :empty
    :taken [pos]})

+(defn with-available-moves
+  "Compute all available moves on the board"
+  [{:keys [board] :as game}]
+  (merge game
+    {:moves
+     (into {}
+       (map (juxt identity #(available-moves-at board %)))
+       all-positions)}
+    ))
+

 ;; -----------------------------------------
 ;; ON PLAYER MOVE
@@ -158,9 +156,10 @@
 (defn play-move
   "On player playing the move [x y]"
   [{:keys [player board] :as game} [x y]]
-  (if-let [moves (get (available-moves-at board [x y]) player)]
+  (if-let [moves (get-in game [:moves [x y] player])]
     (-> game
       (apply-moves (conj moves (take-empty-cell-move player [x y])))
+      (with-available-moves)
       (update-in [:player] next-player)) ;; TODO - We must compute the available moves to switch player
     game))

@@ -168,6 +167,15 @@
 ;; -----------------------------------------
 ;; GAME STATE
 ;; -----------------------------------------
+
+(defn new-game []
+  (with-available-moves
+    {:board (new-board)
+     :player (rand-nth players)
+     :scores
+     {:blue 12
+      :red 12
+      :green 12}}))

 (defonce app-state (atom (new-game)))
 (def board (reagent/cursor app-state [:board]))


Add card for nil in collections

Add card for nil in collections

--- devcards/datafrisk/ui_card.cljs
+++ devcards/datafrisk/ui_card.cljs
@@ -52,4 +52,11 @@
          :vec []
          :list '()}
    "root"
-   (r/atom {:data-frisk {"root" {:expanded-paths #{[]}}}})])+   (r/atom {:data-frisk {"root" {:expanded-paths #{[]}}}})])
+
+(defcard-rg nil-in-collections
+  [Root {:set #{nil}
+         :vec [nil]
+         :list '(nil nil)}
+   "root"
+   (r/atom {:data-frisk {"root" {:expanded-paths #{[] [:set] [:vec] [:list]}}}})])


Update deps and add clean-targets

Update deps and add clean-targets

--- ClojureScript/replete/project.clj
+++ ClojureScript/replete/project.clj
@@ -1,6 +1,7 @@
 (defproject replete "0.1.0"
   :dependencies [[org.clojure/clojure "1.7.0"]
-                 [org.clojure/clojurescript "0.0-3422"]
+                 [org.clojure/clojurescript "0.0-3426"]
                  [org.clojure/tools.reader "0.10.0-SNAPSHOT" :exclusions [org.clojure/clojure]]
                  [com.cognitect/transit-cljs "0.8.220"]
-                 [com.cognitect/transit-clj "0.8.275"]])
+                 [com.cognitect/transit-clj "0.8.275"]]
+  :clean-targets ["out" "target"])


Add tests for edge cases

Add tests for edge cases

--- boot/pod/test/boot/tmpdir_test.clj
+++ boot/pod/test/boot/tmpdir_test.clj
@@ -59,3 +59,19 @@
       (is (has-path? (:changed diff) "path"))
       (is (not (has-path? (:added diff) "path")))
       (is (not (has-path? (:removed diff) "path"))))))
+
+(deftest diff*-edge-test
+  (let [before {}
+        after {}
+        diff (#'tmpd/diff* before after)]
+    (testing "Empty dicts"
+      (is (empty? (:added diff)))
+      (is (empty? (:removed diff)))
+      (is (empty? (:changed diff)))))
+  (let [before nil
+        after nil
+        diff (#'tmpd/diff* before after)]
+    (testing "Nil"
+      (is (empty? (:added diff)))
+      (is (empty? (:removed diff)))
+      (is (empty? (:changed diff))))))


Fix user not showing up on ns page

Fix user not showing up on ns page

--- src/clj/clojuredocs/site/nss.clj
+++ src/clj/clojuredocs/site/nss.clj
@@ -37,13 +37,14 @@
        [:td [:div.doc doc]]])))

 (defn index [ns-str]
-  (fn [r]
+  (fn [{:keys [user] :as r}]
     (let [lib (library-for ns-str)
           ns (namespace-for ns-str)
           vars (sort-by #(-> % :name str/lower-case) (vars-for ns-str))]
       (when ns
         (common/$main
           {:body-class "ns-page"
+           :user user
            :content [:div
                      [:div.row
                       [:div.col-sm-2


Tallie Perrault should be optional

Tallie Perrault should be optional

--- src/clj/game/cards-resources.clj
+++ src/clj/game/cards-resources.clj
@@ -740,10 +740,21 @@
    {:abilities [{:label "Draw 1 card for each Corp bad publicity"
                  :effect (effect (trash card {:cause :ability-cost}) (draw (:bad-publicity corp)))
                  :msg (msg "draw " (:bad-publicity corp) " cards")}]
-    :events {:play-operation {:msg "give the Corp 1 bad publicity and take 1 tag"
-                              :effect (effect (gain :bad-publicity 1) (tag-runner :runner 1))
-                              :req (req (or (has-subtype? target "Black Ops")
-                                            (has-subtype? target "Gray Ops")))}}}
+    :events {:play-operation
+             {:req (req (or (has-subtype? target "Black Ops")
+                            (has-subtype? target "Gray Ops")))
+              :effect (req (show-wait-prompt state :corp "Runner to use Tallie Perrault")
+                           (resolve-ability
+                             state :runner
+                             {:optional
+                              {:prompt "Use Tallie Perrault to give the Corp 1 bad publicity and take 1 tag?"
+                               :player :runner
+                               :yes-ability {:msg "give the Corp 1 bad publicity and take 1 tag"
+                                             :effect (effect (gain :corp :bad-publicity 1)
+                                                             (tag-runner :runner 1)
+                                                             (clear-wait-prompt :corp))}
+                               :no-ability {:effect (effect (clear-wait-prompt :corp))}}}
+                            card nil))}}}

    "Technical Writer"
    {:data {:counter-type "Credit"}


Slider component changes

Slider component changes

--- src/cljs/hacker_agent/debug.cljs
+++ src/cljs/hacker_agent/debug.cljs
@@ -29,9 +29,8 @@

 (defn slider [value min max]
   [:input {:type "range" :value @value :min min :max max
-           :style {:width "100%"}
            :on-change #(let [new-val (-> % .-target .-value)]
-                         (reset! value new-val))}])
+                         (reset! value (int new-val)))}])

 (defn edit-value [value]
   (if (< 50 (count (str @value)))


Missed copyright notice

Missed copyright notice

--- src/clojure/neko/ui/listview.clj
+++ src/clojure/neko/ui/listview.clj
@@ -1,3 +1,14 @@
+; Copyright © 2012 Alexander Yakushev.
+; All rights reserved.
+;
+; This program and the accompanying materials are made available under the
+; terms of the Eclipse Public License v1.0 which accompanies this distribution,
+; and is available at <http://www.eclipse.org/legal/epl-v10.html>.
+;
+; By using this software in any fashion, you are agreeing to be bound by the
+; terms of this license.  You must not remove this notice, or any other, from
+; this software.
+
 (ns neko.ui.listview
   "Contains utilities to work with ListView."
   (:import android.util.SparseBooleanArray


added to close

added to close

--- src/babel/english/lexicon.clj
+++ src/babel/english/lexicon.clj
@@ -202,6 +202,9 @@

    "check" {:synsem {:cat :verb
                      :sem {:pred :check}}}
+
+   "close" {:synsem {:cat :verb
+                     :sem {:pred :close}}}

    "come" {:synsem {:cat :verb
                     :sem {:pred :come}}


added convertir

added convertir

--- src/babel/espanol/lexicon.clj
+++ src/babel/espanol/lexicon.clj
@@ -110,6 +110,10 @@

    "contestar" {:synsem {:cat :verb
                          :sem {:pred :answer}}}
+
+   "convertir" {:espanol {:boot-stem "conviert"}
+                :synsem {:cat :verb
+                         :sem {:pred :convent}}}

    "correr" {:synsem {:cat :verb
                       :sem {:pred :run}}}


Add a zero with space after every sequence of space

This seems to help with screen readers as then words are not concated
across line and page breaks.

--- src/catalog/layout/common.clj
+++ src/catalog/layout/common.clj
@@ -112,6 +112,12 @@
     (string/blank? s) s
     :else (str s ".")))

+(defn- insert-zero-width-space
+  "Add a zero with space after each sequence of white space in `s`.
+  This seems to improve the FOP output for screen readers"
+  [s]
+  (string/replace s #"(\S)\s+(\S)" "$1 $2"))
+
 (defn wrap
   "Adds a period to `s` and wrap it in `prefix` and `postfix`. If `s`
   is a sequence the contained strings are joined with \", \" as a
@@ -124,8 +130,11 @@
    (wrap s prefix postfix true))
   ([s prefix postfix period?]
    (if s
-     (let [s (if (seq? s) (string/join ", " s) s)]
-       (str prefix (if period? (periodify s) s) postfix))
+     (let [s (cond->> s
+               (seq? s) (string/join ", ")
+               true insert-zero-width-space
+               period? periodify)]
+       (str prefix s postfix))
      "")))

 (defn empty-or-blank? [s]


Put glaube-und-philosophie in the right sort order

--- src/catalog/layout/common.clj
+++ src/catalog/layout/common.clj
@@ -12,9 +12,10 @@
 (def genres [:belletristik :sachbücher :kinder-und-jugendbücher])
 (def braille-genres (conj genres :musiknoten :taktilesbuch))
 (def subgenres [:action-und-thriller :beziehungsromane :fantasy-science-fiction
-                :gesellschaftsromane :historische-romane :hörspiele :krimis
+                :gesellschaftsromane :glaube-und-philosophie
+                :historische-romane :hörspiele :krimis
                 :lebensgeschichten-und-schicksale :literarische-gattungen
-                :literatur-in-fremdsprachen :mundart-heimat-natur :glaube-und-philosophie
+                :literatur-in-fremdsprachen :mundart-heimat-natur
                 :biografien :freizeit-haus-garten :geschichte-und-gegenwart
                 :kunst-kultur-medien :lebensgestaltung-gesundheit-erziehung
                 :philosophie-religion-esoterik :reisen-natur-tiere :sprache


Periodify all subtitles correctly

Periodify all subtitles correctly

--- src/catalog/layout/common.clj
+++ src/catalog/layout/common.clj
@@ -125,4 +125,4 @@
 (def formats [:hörbuch :braille :grossdruck :e-book :hörfilm :ludo])

 (defn render-subtitles [subtitles]
-  (periodify (string/join ". " subtitles)))
+  (string/join " " (map periodify subtitles)))


clean code

clean code

Signed-off-by: Yen-Chin Lee <082d453d72dce940e12089a4ad48b97cfe1f3ec4@gmail.com>

--- src/clj/brains_brain/core.clj
+++ src/clj/brains_brain/core.clj
@@ -29,8 +29,7 @@
   (let [board (make-array Integer/TYPE board-size board-size)]
     (doseq [x (range 0 board-size)
             y (range 0 board-size)]
-      (aset-int board x y (if (< (rand-int 100) 50) 0 1))
-      )
+      (aset-int board x y (if (< (rand-int 100) 50) 0 1)))
     board))

 (def a (make-board))
@@ -40,16 +39,14 @@
           y (range 0 board-size)
           :let [cell (aget a x y)
                 xb (* x cell-size)
-                yb (* y cell-size)
-                ]]
+                yb (* y cell-size)]]
     (draw g
           (rect xb yb cell-size)
           (style :background (case cell
-                               1 :red
-                               :white)
+                               :on :red
+                               :white) ; default (:off)
                  :foreground :black ; broader
                  ))))
-

 (defn make-ui
   []


Updated license text

Updated license text

--- src/clj_mrazik/dictionary.clj
+++ src/clj_mrazik/dictionary.clj
@@ -1,3 +1,15 @@
+;
+;  (C) Copyright 2016, 2017  Pavel Tisnovsky
+;
+;  All rights reserved. This program and the accompanying materials
+;  are made available under the terms of the Eclipse Public License v1.0
+;  which accompanies this distribution, and is available at
+;  http://www.eclipse.org/legal/epl-v10.html
+;
+;  Contributors:
+;      Pavel Tisnovsky
+;
+
 (ns clj-mrazik.dictionary)

 (require '[clj-mrazik.db-interface :as db-interface])


Fix winning madlib

Fix winning madlib

--- src/cljc/robinson/render.cljc
+++ src/cljc/robinson/render.cljc
@@ -1047,7 +1047,7 @@
         (map
           (fn [line] {:s line :fg :black :bg :white :style #{:center}})
           ["Rescue!"
-           (format "A passing %s spots you.")
+           (format "A passing %s spots you." rescue-mode)
            "Press <color fg=\"highlight\">space</color> to continue."])))
     (render-rect-double-border screen 16 4 53 6 :black :white)))


Add ID to sensor

Add ID to sensor

--- src/cljs/robot_kata/core.cljs
+++ src/cljs/robot_kata/core.cljs
@@ -42,8 +42,8 @@

     (append! (sel1 :#robot-svg)
              [:g#robot {:transform "translate(400, 400)"}
-              [:circle {:cx 0 :cy   0 :r  35 :stroke "black" :stroke-width 2 :fill "silver"}]
-              [:circle {:cx 0 :cy -30 :r 2.5 :stroke "none"                  :fill  "black"}] ] )
+              [:circle        {:cx 0 :cy   0 :r  35 :stroke "black" :stroke-width 2 :fill "silver"}]
+              [:circle#sensor {:cx 0 :cy -30 :r 2.5 :stroke "none"                  :fill  "black"}] ] )

     (go
      (while true


similarity was printed to stdout. fixed

similarity was printed to stdout. fixed

--- src/crawler/structure_driven.clj
+++ src/crawler/structure_driven.clj
@@ -4,7 +4,8 @@
    The structure driven crawler fetches a navigation
    pattern = XPath seq"
   (:require [crawler.rich-char-extractor :as rc-extractor]
-            [crawler.similarity :as similarity]))
+            [crawler.similarity :as similarity]
+            [crawler.utils :as utils]))

 (defn stop?
   [{visited :visited}]
@@ -19,7 +20,7 @@
                 body
                 example-leaf)]
        (do
-         (println :similarity sim)
+         (utils/sayln :similarity sim)
          (<= thresh sim)))))

 (def extractor rc-extractor/state-action)


Commenting out the viz server to try and fix the build.

--- src/cmr/dev_system/system.clj
+++ src/cmr/dev_system/system.clj
@@ -67,7 +67,8 @@
                                   in-memory-elastic-port
                                   (+ in-memory-elastic-port 10)
                                   "es_data/dev_system")
-                :vdd-server (viz-helper/create-viz-server)}})
+                ; :vdd-server (viz-helper/create-viz-server)
+                }})

 (defmethod create-system :external-dbs
   [type]
@@ -76,7 +77,9 @@
           :index-set (index-set-system/create-system)
           :ingest (ingest-system/create-system)
           :search (search-system/create-system)}
-   :components {:vdd-server (viz-helper/create-viz-server)}})
+   :components {
+                ;:vdd-server (viz-helper/create-viz-server)
+                }})

 (defn- stop-components
   [system]


Improve scroll feedback

Improve scroll feedback

--- src/ecregister/posts_ui.clj
+++ src/ecregister/posts_ui.clj
@@ -60,13 +60,20 @@
     (async/go
      (r/push! event-stream {:id :fa-post, :value (async/<! c)}))))

+(defn my-scrollable [& args]
+  (let [s (apply scrollable args)]
+    (-> s
+        (.getVerticalScrollBar)
+        (.setUnitIncrement 18))
+    s))
+
 (defn build-posts-tab []
   (let [form
         (mig-panel
          :items [[(label "Последний опубликованный пост") "top,center,wrap"]
                  [(progress-bar :id :faprog :indeterminate? false :value 10) "center,wrap"]
                  [(make-post-widget {:id :latest-fa-post :author "" :title "" :visible? false}) "center,wrap"]
-                 [(scrollable (grid-panel :border 8 :id :aw-posts :vgap 10 :columns 1)) "grow,pushy"]
+                 [(my-scrollable (grid-panel :border 8 :id :aw-posts :vgap 10 :columns 1)) "grow,pushy"]
                  ]
          :constraints ["fill,gap 18px,hidemode 3"])
         evs (r/events)]


Change html2hiccup -> html to hiccup

Change html2hiccup -> html to hiccup

--- src/htmltohiccup/views/index.clj
+++ src/htmltohiccup/views/index.clj
@@ -14,7 +14,7 @@
     [:head
      [:meta {:charset "utf-8"}]
      [:meta {:content "IE=edge,chrome=1", :http-equiv "X-UA-Compatible"}]
-     [:title]
+     [:title "HTML To Hiccup"]
      [:meta {:content "", :name "description"}]
      [:meta {:content "width=device-width", :name "viewport"}]
      [:link {:href "css/bootstrap.min.css", :rel "stylesheet"}]
@@ -28,7 +28,7 @@
      ""
      ""
      [:div.container
-      [:div.row [:div.span12 [:h2 "htmltohiccup"]]]
+      [:div.row [:div.span12 [:h2 "HTML To Hiccup"]]]
       [:div.row
        [:div.span6 [:h3 "HTML"] [:div#in_html.span6 {}]]
        [:div.span6


Document the new :arg-resolvers option

Document the new :arg-resolvers option

--- src/io/aviso/rook/dispatcher.clj
+++ src/io/aviso/rook/dispatcher.clj
@@ -220,7 +220,18 @@
   The structure of handler-maps is as required by handler-form;
   middleware-spec is the literal form specifying the middleware in the
   dispatch table; a route-spec* is a route-spec with keywords replaced
-  by symbols in the pathvec."
+  by symbols in the pathvec.
+
+  `options` should be a map of options or `nil`. Currently only one
+  option is supported:
+
+  :arg-resolvers
+
+  : _Default: nil_
+
+  : Can be used to specify default resolvers (which will be overridden
+    by argument resolvers specified in namespace or function
+    metadata)."
   [dispatch-table options]
   (let [extra-arg-resolvers (:arg-resolvers options)]
     (loop [routes     {}
@@ -477,7 +488,8 @@
   [analysed-dispatch-table opts]
   (let [dispatch-map (build-dispatch-map analysed-dispatch-table opts)]
     (if (:async? opts)
-      (map-traversal-dispatcher dispatch-map (doto (async/chan) (async/close!)))
+      (map-traversal-dispatcher dispatch-map
+        (doto (async/chan) (async/close!)))
       (map-traversal-dispatcher dispatch-map))))

 (def ^:private dispatch-table-compilation-defaults
@@ -503,7 +515,16 @@

   : _Default: [[build-map-traversal-handler]]_

-  : Will be called with routes, handlers, middleware and should produce a Ring handler."
+  : Will be called with routes, handlers, middleware and should
+    produce a Ring handler.
+
+  :arg-resolvers
+
+  : _Default: nil_
+
+  : Can be used to specify default resolvers (which will be overridden
+    by argument resolvers specified in namespace or function
+    metadata)."
   ([dispatch-table]
      (compile-dispatch-table
        dispatch-table-compilation-defaults


Remove unnecessary docstring formatting

Remove unnecessary docstring formatting

--- src/io/aviso/rook/dispatcher.clj
+++ src/io/aviso/rook/dispatcher.clj
@@ -263,7 +263,7 @@
   dispatch table; a route-spec* is a route-spec with keywords replaced
   by symbols in the pathvec.

-  `options` should be a map of options or `nil`. Currently only one
+  options should be a map of options or nil. Currently only one
   option is supported:

   :arg-resolvers


1.3-ifying examples.tagged-tg8

1.3-ifying examples.tagged-tg8

--- src/examples/tagged_tg8.clj
+++ src/examples/tagged_tg8.clj
@@ -3,8 +3,8 @@
 ;; Lee Spector, lspector@hampshire.edu, 2010

 (ns examples.tagged-tg8
-  (:require [clojush] [clojure.contrib.math])
-  (:use [clojush] [clojure.contrib.math]))
+  (:use [clojush]
+	[clojure.math.numeric-tower]))

 ;;;;;;;;;;;;
 ;; Integer symbolic regression of the y=5x^6-2x^5-5x^3+3x^2+5. This uses


Minor change in move-interaction

Minor change in move-interaction

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

--- src/conexp/graphics/nodes_and_connections.clj
+++ src/conexp/graphics/nodes_and_connections.clj
@@ -376,8 +376,8 @@
 				   (let [[a b] (position @interaction-obj),
 					 [x y] (device-to-world scn x y)]
 				     (move-node-by @interaction-obj (- x a) (- y b))
-				     (.refresh scn)
-				     (call-hook-with scn :move-drag @interaction-obj (- x a) (- y b)))),
+				     (call-hook-with scn :move-drag @interaction-obj (- x a) (- y b))
+				     (.refresh scn))),
 	   GWindow/BUTTON1_UP    (do
 				   (call-hook-with scn :move-stop @interaction-obj)
 				   (reset! interaction-obj nil))


Let's not have this silly business. I don't know why I did it this way to begin with.

--- src/hphelper/shared/sql.clj
+++ src/hphelper/shared/sql.clj
@@ -17,15 +17,9 @@
 ;; continue to return the same names for ##REF-TAGS##
 ;; It is done this way so names aren't overwritten during frequent updating
 ;; (resaving source files will re-load them into memory)
-(defn init-named-items
-  "Checks if namedItems is initialised. If not, initialise it"
-  []
-  (if (not (ns-resolve 'hphelper.shared.sql 'namedItems))
-    (def namedItems
-      "A map atom with references as keys and named items as values"
-      (atom {}))))
-
-(init-named-items)
+(def namedItems
+  "A map atom with references as keys and named items as values"
+  (atom {}))

 (defn reset-named-items!
   "Resets the namedItems atom"
@@ -35,13 +29,11 @@
 (defn get-name
   "Returns the referenced name from namedItems, or nil if not existing"
   [keyName]
-  (init-named-items)
   (get @namedItems keyName))

 (defn named-exists?
   "Returns true if the named item already exists in namedItems, else false"
   [refName]
-  (init-named-items)
   (if (some #{refName} (vals @namedItems))
     true
     false))
@@ -50,7 +42,6 @@
   "Adds the reference name pair to namedItems, overwriting any previous allocation.
   Returns the added name"
   ([keyRef valName]
-   (init-named-items)
    (swap! namedItems assoc keyRef valName)
    valName)
   ([[keyRef valName]]


Remove duplicate sample bins in query.

Remove duplicate sample bins in query.

--- src/cavm/h2.clj
+++ src/cavm/h2.clj
@@ -662,7 +662,7 @@
       (join scores)))

 (defn with-bins [q bins]
-  (where q (in :i bins)))
+  (where q (in :i (distinct bins))))

 (defn for-experiment [q exp]
   (where q {:probes.eid exp}))


Only generate keyfn/ident if they are not defined by the user

--- src/main/workflo/macros/view.clj
+++ src/main/workflo/macros/view.clj
@@ -70,7 +70,8 @@
    function is automatically generated based on this ID."
   [props fns]
   (cond-> fns
-    (some #{'db/id} (map :name props))
+    (and (some #{'db/id} (map :name props))
+         (not (some #{'ident} (map first fns))))
     (conj (generate-ident-fn props))))

 (defn maybe-generate-key-fn
@@ -78,7 +79,8 @@
    function is automatically generated based on this ID."
   [props fns]
   (cond-> fns
-    (some #{'db/id} (map :name props))
+    (and (some #{'db/id} (map :name props))
+         (not (some #{'keyfn 'key} (map first fns))))
     (conj (generate-key-fn props))))

 (defn maybe-generate-query-fn


checkpoint - pivot broken - but getting there

--- src/main/clojure/org/dada/core/PivotModel.clj
+++ src/main/clojure/org/dada/core/PivotModel.clj
@@ -66,10 +66,10 @@

 	 pivot-fn (fn [old-pivotted key src-value] ;e.g. [["Sei Whale" Mon ... 20 ...] Mon [Mon 21]]
 		      (let [src-value-value (.get src-value-getter src-value) ;; e.g. 20
-			    ;;dummy (println "PIVOT-FN:" key src-value-value)
+			    dummy (println "PIVOT-FN:" key src-value-value old-pivotted)
 			    pivot-fns (pivot-map key)
 			    pivot-values (map #(% src-value-value old-pivotted) pivot-fns)
-			    ;;dummy (println "PIVOT-VALUES:" pivot-values)
+			    dummy (println "PIVOT-VALUES:" pivot-values)
 			    new-pivotted (.create pivot-creator (into-array Object pivot-values))]
 			;;(println "PIVOT-FN:" key)
 			new-pivotted))


Add yada webjars helpers

Add yada webjars helpers

--- lib/edge.ig.yada/src/edge/yada/ig.clj
+++ lib/edge.ig.yada/src/edge/yada/ig.clj
@@ -30,6 +30,17 @@
   [_ {:keys [name]}]
   (yada/as-resource (io/resource name)))

+(defmethod ig/init-key ::webjar
+  [_ {:keys [webjar] :as options}]
+  (@(requiring-resolve 'yada.resources.webjar-resource/new-webjar-resource)
+   webjar
+   options))
+
+(defmethod ig/init-key ::webjars-route-pair
+  [_ options]
+  (@(requiring-resolve 'yada.resources.webjar-resource/webjars-route-pair)
+   options))
+
 ;; Use getName to avoid requiring a direct dependency on bidi, etc.
 (defmulti ^:private hosts
   (fn [config state]


Remove empty function.

Remove empty function.

--- src/onyx/log/commands/common.clj
+++ src/onyx/log/commands/common.clj
@@ -79,8 +79,6 @@
       (let [n (mod message-id (count peers))]
         (= (nth peers n) id)))))

-(defn allocated-to-job [replica args id])
-
 (defn should-seal? [replica job-id state message-id]
   (let [allocated-to-job? (= job-id (:job (peer->allocated-job (:allocations replica) (:id state))))]
     (and allocated-to-job?


Remove unnecessary thread

Remove unnecessary thread

--- src/onyx/messaging/netty_tcp.clj
+++ src/onyx/messaging/netty_tcp.clj
@@ -134,19 +134,38 @@
           (.addLast "int32-frame-encoder" (int32-frame-encoder))
           (.addLast shared-event-executor "handler" handler))))))

-(defn handle [buf-recvd-ch msg]
-  (.retain ^ByteBuf msg)
-  (>!! buf-recvd-ch msg))
-
 (defn create-server-handler
   "Given a core, a channel, and a message, applies the message to
   core and writes a response back on this channel."
-  [buf-recvd-ch]
-  (fn [^ChannelHandlerContext ctx ^Object message]
-    (handle buf-recvd-ch message)))
+  [messenger inbound-ch release-ch retry-ch]
+  (fn [^ChannelHandlerContext ctx ^ByteBuf buf]
+    (try
+      (let [msg (protocol/read-buf (:decompress-f messenger) buf)]
+        (let [t ^byte (:type msg)]
+          (cond (= t protocol/messages-type-id)
+                (doseq [message (:messages msg)]
+                  (>!! inbound-ch message))
+
+                (= t protocol/ack-type-id)
+                (acker/ack-message (:acking-daemon messenger)
+                                   (:id msg)
+                                   (:completion-id msg)
+                                   (:ack-val msg))
+
+                (= t protocol/completion-type-id)
+                (>!! release-ch (:id msg))
+
+                (= t protocol/retry-type-id)
+                (>!! retry-ch (:id msg))
+
+                :else
+                (throw (ex-info "Unexpected message received from Netty" {:message msg})))))
+      (catch Throwable e
+        (taoensso.timbre/error e)
+        (throw e)))))

 (defn start-netty-server
-  [boss-group worker-group host port buf-recvd-ch]
+  [boss-group worker-group host port messenger inbound-ch release-ch retry-ch]
   (let [bootstrap (ServerBootstrap.)
         channel (if (epoll?)
                   EpollServerSocketChannel
@@ -155,8 +174,10 @@
                         (ImmediateEventExecutor/INSTANCE))
         initializer (channel-initializer-done
                      (gen-tcp-handler channel-group
-                                      (create-server-handler buf-recvd-ch)))]
-                                        ; Configure bootstrap
+                                      (create-server-handler messenger
+                                                             inbound-ch
+                                                             release-ch
+                                                             retry-ch)))]
     (doto bootstrap
       (.group boss-group worker-group)
       (.channel channel)
@@ -208,40 +229,6 @@
               (.channel channel)
               (.handler (client-channel-initializer (new-client-handler))))]
       (.channel ^ChannelFuture (.awaitUninterruptibly (.connect b host port))))))
-
-(defn app [daemon messenger buf-recv-ch inbound-ch release-ch retry-ch shutdown-ch]
-  (thread
-    (loop []
-          (let [[buf ch] (alts!! [buf-recv-ch shutdown-ch])]
-            (when buf
-              (try
-                (let [msg (protocol/read-buf (:decompress-f messenger) buf)]
-                  ;(taoensso.timbre/info "Message buf: " buf msg)
-                  ;; undo retain added in server handler
-                  (.release ^ByteBuf buf)
-                  (let [t ^byte (:type msg)]
-                    (cond (= t protocol/messages-type-id)
-                          (doseq [message (:messages msg)]
-                            (>!! inbound-ch message))
-
-                          (= t protocol/ack-type-id)
-                          (acker/ack-message daemon
-                                             (:id msg)
-                                             (:completion-id msg)
-                                             (:ack-val msg))
-
-                          (= t protocol/completion-type-id)
-                          (>!! release-ch (:id msg))
-
-                          (= t protocol/retry-type-id)
-                          (>!! retry-ch (:id msg))
-
-                          :else
-                          (throw (ex-info "Unexpected message received from Netty" {:message msg})))))
-                (catch Throwable e
-                  (taoensso.timbre/error e)
-                  (throw e)))
-              (recur))))))

 (defrecord NettyTcpSockets [peer-group]
   component/Lifecycle
@@ -272,10 +259,8 @@
     (taoensso.timbre/info "Stopping Netty TCP Sockets")
     (try
       (when-let [rs @resources]
-        (let [{:keys [shutdown-fn shutdown-ch app-loop]} rs]
-          (shutdown-fn)
-          (close! shutdown-ch)
-          (<!! app-loop))
+        (let [{:keys [shutdown-fn]} rs]
+          (shutdown-fn))
         (reset! resources nil))
       (catch Throwable e (timbre/fatal e)))
     (assoc component :bind-addr nil :external-addr nil
@@ -292,25 +277,19 @@

 (defmethod extensions/open-peer-site NettyTcpSockets
   [messenger assigned]
-  ;; TODO: get rid of buf-recv-ch and do the handling inside
-  ;; the netty handler
-  (let [buf-recv-ch (chan 10000)
-        inbound-ch (:inbound-ch (:messenger-buffer messenger))
+  (let [inbound-ch (:inbound-ch (:messenger-buffer messenger))
         release-ch (:release-ch messenger)
         retry-ch (:retry-ch messenger)
-        daemon (:acking-daemon messenger)
         shutdown-fn (start-netty-server (:boss-group messenger)
                                         (:worker-group messenger)
                                         (:bind-addr messenger)
                                         (:netty/port assigned)
-                                        buf-recv-ch)
-        shutdown-ch (chan 1)
-        app-loop (app daemon messenger buf-recv-ch inbound-ch release-ch retry-ch shutdown-ch)]
+                                        messenger
+                                        inbound-ch
+                                        release-ch
+                                        retry-ch)]
     (reset! (:resources messenger)
-            {:shutdown-fn shutdown-fn
-             :shutdown-ch shutdown-ch
-             :buf-recv-ch buf-recv-ch
-             :app-loop app-loop})))
+            {:shutdown-fn shutdown-fn})))

 (defmethod extensions/connect-to-peer NettyTcpSockets
   [messenger event {:keys [netty/external-addr netty/port]}]


Avoid task iteration when peer is reallocated.

--- src/onyx/peer/task_lifecycle.clj
+++ src/onyx/peer/task_lifecycle.clj
@@ -165,10 +165,10 @@
       (>!! outbox-ch entry)))
   state)

-(defn time-out-peers! [state peers]
+(defn time-out-peers! [state type peers]
   (if-not (empty? peers)
     (let [{:keys [onyx.core/log-prefix onyx.core/id onyx.core/task] :as event} (get-event state)
-          timeout-msg (format "%s Peers timed out %s" log-prefix (vec peers) id task)
+          timeout-msg (format "%s Peers timed out %s, peers: %s" log-prefix type (vec peers) id task)
           next-state (reduce evict-dead-peer! state peers)]
       (-> timeout-msg (doto println) (doto info))
       ;; backoff for a while so we don't repeatedly write leave messages
@@ -184,7 +184,7 @@
   (->> (get-messenger state)
        (m/subscriber)
        (sub/timed-out-publishers)
-       (time-out-peers! state)
+       (time-out-peers! state :upstream)
        (advance)))

 (defn offer-heartbeats [state]
@@ -431,17 +431,20 @@

 (def DEBUG false)

-(defn iteration [state replica-val n-iters]
+(defn iteration [state n-iters]
   ;(when DEBUG (viz/update-monitoring! state-machine))
-  (loop [state (exec (next-replica! state replica-val)) n n-iters]
+  (loop [state (exec state) n n-iters]
     ;(print-state state)
     ; (when (zero? (rand-int 10000))
     ;   (print-state state))
-    (if (and (advanced? state)
-             (or (not (new-iteration? state))
-                 (pos? n)))
-      (recur (exec state) (dec n))
+    (if (and (advanced? state) (pos? n))
+      (recur (exec state) ;; we could unroll exec loop a bit
+             (if (new-iteration? state)
+               (dec n)
+               n))
       state)))
+
+(def task-iterations 1)

 (defn run-task-lifecycle!
   "The main task run loop, read batch, ack messages, etc."
@@ -449,13 +452,18 @@
   (try
     (let [{:keys [onyx.core/replica-atom] :as event} (get-event state)]
       (loop [state state
+             prev-replica-val (get-replica state)
              replica-val @replica-atom]
         (debug (:onyx.core/log-prefix event) ", new task iteration")
-        (let [next-state (iteration state replica-val 10)]
-          (if (killed? state)
-            (do (info (:onyx.core/log-prefix event) ", Fell out of task lifecycle loop")
-                next-state)
-            (recur next-state @replica-atom)))))
+        (if (and (= replica-val prev-replica-val)
+                 (not (killed? state)))
+          (recur (iteration state task-iterations) replica-val @replica-atom)
+          (let [next-state (next-replica! state replica-val)]
+            (if (killed? next-state)
+              (do
+               (info (:onyx.core/log-prefix event) ", Fell out of task lifecycle loop")
+               next-state)
+              (recur next-state replica-val replica-val))))))
     (catch Throwable e
       (let [lifecycle (get-lifecycle state)
             action (if (:kill-job? (ex-data e))
@@ -702,7 +710,7 @@
           ;; check if downstream peers are still up
           (->> pubs
                (mapcat pub/timed-out-subscribers)
-               (time-out-peers! this)))
+               (time-out-peers! this :downstream)))
         this)))
   (print-state [this]
     (let [task-map (:onyx.core/task-map event)]
@@ -743,30 +751,36 @@
   (next-replica! [this new-replica]
     (if (= replica new-replica)
       this
-      (let [job-id (:onyx.core/job-id event)
+      (let [{:keys [onyx.core/job-id onyx.core/task-id onyx.core/job-id onyx.core/id onyx.core/task-kill-flag]} event
             old-version (get-in replica [:allocation-version job-id])
-            new-version (get-in new-replica [:allocation-version job-id])
-            next-coordinator (coordinator/next-state coordinator replica new-replica)]
-        (if (or (= old-version new-version)
-                ;; wait for re-allocation
-                (killed? this)
-                (not= job-id
-                      (:job (common/peer->allocated-job (:allocations new-replica)
-                                                        (:onyx.core/id event)))))
-          (-> this
-              (set-coordinator! next-coordinator)
-              (set-replica! new-replica))
-          (let [next-messenger (ms/next-messenger-state! messenger event replica new-replica)]
-            (assert (m/subscriber next-messenger) [:old-replica replica
-                                                  :new-replica new-replica])
-            (checkpoint/cancel! (:onyx.core/storage event))
-            (-> this
-                (set-sealed! false)
-                (set-messenger! next-messenger)
-                (set-coordinator! next-coordinator)
-                (set-replica! new-replica)
-                (reset-event!)
-                (goto-recover!)))))))
+            new-version (get-in new-replica [:allocation-version job-id])]
+        (cond (= old-version new-version)
+              (-> this
+                  (set-coordinator! (coordinator/next-state coordinator replica new-replica))
+                  (set-replica! new-replica))
+
+              (let [allocated (common/peer->allocated-job (:allocations new-replica) id)]
+                (or (killed? this)
+                    (not= task-id (:task allocated))
+                    (not= job-id (:job allocated))))
+              ;; Manually hit the kill switch early since we've been reallocated
+              ;; and we want to escape ASAP
+              (do
+               (reset! task-kill-flag true)
+               this)
+
+              :else
+              (let [next-messenger (ms/next-messenger-state! messenger event replica new-replica)]
+                (assert (m/subscriber next-messenger) [:old-replica replica
+                                                       :new-replica new-replica])
+                (checkpoint/cancel! (:onyx.core/storage event))
+                (-> this
+                    (set-sealed! false)
+                    (set-messenger! next-messenger)
+                    (set-coordinator! (coordinator/next-state coordinator replica new-replica))
+                    (set-replica! new-replica)
+                    (reset-event!)
+                    (goto-recover!)))))))
   (set-windows-state! [this new-windows-state]
     (set! windows-state new-windows-state)
     this)


No longer evict ourselves when evicting others. Made unnecessary by improved liveness checks.

--- src/onyx/peer/task_lifecycle.clj
+++ src/onyx/peer/task_lifecycle.clj
@@ -766,25 +766,17 @@
     (set! event new-event)
     this)
   (evict-peer! [this peer-id]
-    (let [{:keys [onyx.core/log-prefix onyx.core/id onyx.core/log
-                  onyx.core/id onyx.core/outbox-ch]} event]
+    (let [{:keys [onyx.core/log-prefix onyx.core/log onyx.core/id onyx.core/outbox-ch]} event]
       ;; If we're not up, don't emit a log message. We're probably dead too.
       (when (and (extensions/connected? log)
                  (not (get evicted peer-id)))
         (set! evicted (conj evicted peer-id))
         (let [peer-id (coordinator-peer-id->peer-id peer-id)
-              ;; Evict ourselves, as we're not sure whether it's the other peer at fault, or ourselves
-              ;; and we may be evicting the peer that would have evicted us.
-              evict-self-entry {:fn :leave-cluster
-                                :peer-parent id
-                                :args {:id id
-                                       :group-id (get-in replica [:groups-reverse-index id])}}
               entry {:fn :leave-cluster
                      :peer-parent id
                      :args {:id peer-id
                             :group-id (get-in replica [:groups-reverse-index peer-id])}}]
           (info log-prefix "Peer timed out with no heartbeats. Emitting leave cluster." entry)
-          (>!! outbox-ch evict-self-entry)
           (>!! outbox-ch entry))))
     this)
   (reset-event! [this]


Add sample image handler tracker

Add sample image handler tracker

--- src/onyx/peer/task_lifecycle.clj
+++ src/onyx/peer/task_lifecycle.clj
@@ -31,7 +31,7 @@
             [onyx.static.default-vals :refer [defaults arg-or-default]]
             [onyx.messaging.protocol-aeron :as protocol]
             [onyx.messaging.common :as mc])
-  (:import [uk.co.real_logic.aeron Aeron Aeron$Context FragmentAssembler Publication Subscription]
+  (:import [uk.co.real_logic.aeron Aeron Aeron$Context FragmentAssembler Publication Subscription AvailableImageHandler]
            [uk.co.real_logic.aeron.driver MediaDriver MediaDriver$Context ThreadingMode]
            [uk.co.real_logic.aeron.logbuffer FragmentHandler]
            [uk.co.real_logic.agrona ErrorHandler]
@@ -60,6 +60,14 @@
                                                 100
                                                 (.toNanos TimeUnit/MICROSECONDS 10)
                                                 (.toNanos TimeUnit/MICROSECONDS 1000))))
+
+;; Available image handler could be used to setup a lookup for which streamId matches which sourceIdentity i.e. host
+;; Once we know what host it corresponds to, then we should be able to lookup the full peer id via the short peer id + the source identity
+(def log-available-image-handler
+  (reify AvailableImageHandler
+    (onAvailableImage [this image]
+      (let [subscription (.subscription image)]
+        (info "Available image on:" (.channel subscription) (.streamId subscription) (.sessionId image) (.sourceIdentity image))))))

 (defn start-subscribers!
   [ingress-task-ids conn bind-addr port stream-id idle-strategy task-type]
@@ -390,7 +398,8 @@
     (try
       (let [{:keys [workflow catalog task flow-conditions windows filtered-windows
                     triggers filtered-triggers lifecycles task-map metadata]} task-information
-            ctx (.errorHandler (Aeron$Context.) no-op-error-handler)
+            ctx (.availableImageHandler (.errorHandler (Aeron$Context.) no-op-error-handler)
+                                        log-available-image-handler)
             aeron-conn (Aeron/connect ctx)

             log-prefix (logger/log-prefix task-information)


Channel not required for benchmark plugin

--- src/onyx/plugin/bench_plugin.clj
+++ src/onyx/plugin/bench_plugin.clj
@@ -9,7 +9,6 @@

 (defn inject-reader
   [event lifecycle]
-  (assert (:core.async/chan event) ":core.async/chan not found - add it via inject-lifecycle-resources.")
   {:generator/pending-messages (atom {})
    :generator/retry (atom [])})


Fix clean-ns duplicating the docstring in ns meta

Fixes clojure-emacs/clj-refactor.el#185

--- src/refactor_nrepl/ns/pprint.clj
+++ src/refactor_nrepl/ns/pprint.clj
@@ -87,7 +87,10 @@
                     :else (rest more))
         ns-meta (-> (find-ns name)
                     meta
-                    (dissoc :file :line :end-line :column :end-column))]
+                    (dissoc :file :line :end-line :column :end-column))
+        ;; if there's a docstring it is copied into to the metadata
+        ;; for the ns and will get duplicated if we don't remove it
+        ns-meta (if docstring? (dissoc ns-meta :doc) ns-meta)]
     (-> (with-out-str
           (printf "(ns ")
           (when (seq ns-meta) (pprint-meta ns-meta))


center title on screen

center title on screen

--- src/solar_system_of_js/core.cljs
+++ src/solar_system_of_js/core.cljs
@@ -22,7 +22,7 @@
   "Initial state of the application."
   {:slide 0
    :title {:x 0
-           :y 0
+           :y -100
            :alpha 1}
    :cam {:x 0
          :y 0


renamed attribute

renamed attribute

--- configuration/xml-input-extent.clj
+++ configuration/xml-input-extent.clj
@@ -17,7 +17,7 @@
                 (mapping [:Owner :Owner-text-node] :Owner)
                 (mapping [:WWW :WWW-text-node] :WWW)
                 (mapping [:Description :Description-text-node] :Description)
-                (mapping [:ID :ID-text-node :ID] :ID)
+                (mapping [:LocalID :LocalID-text-node :ID] :ID)
                 (mapping [:Name :Name-text-node] :Name)
                 (mapping [:OtherInfo :OtherInfo-text-node] :OtherInfo)
                 (mapping [:Latitude-attribute] :Latitude)


[#248] Disable projections

[#248] Disable projections

--- api/src/clojure/org/akvo/flow_api/datastore/stats.clj
+++ api/src/clojure/org/akvo/flow_api/datastore/stats.clj
@@ -46,7 +46,7 @@
                                     ;; TODO:
                                     ;; Recover projections when index is up
                                     ;; https://github.com/akvo/akvo-flow/issues/3932
-                                    :projections {"value" String
+                                    #_#_:projections {"value" String
                                                   "surveyInstanceId" Long}}
                                    {})))))


exclude infinite? in cljs

exclude infinite? in cljs

--- src/test/clojure/clojure/test/check/test.cljc
+++ src/test/clojure/clojure/test/check/test.cljc
@@ -8,6 +8,8 @@
 ;   You must not remove this notice, or any other, from this software.

 (ns clojure.test.check.test
+  #?(:cljs
+     (:refer-clojure :exclude [infinite?]))
   (:require #?(:cljs
                [cljs.test :as test :refer-macros [deftest testing is]])
             #?(:clj


insert methods should return single value

--- src/wishlistd/models/queries.clj
+++ src/wishlistd/models/queries.clj
@@ -33,12 +33,14 @@
       (first (into [] results)))))

 (defn insert-wishlist [wishlist]
-  (sql/with-connection db
-    (sql/insert-records :wishlist wishlist)))
+  (first
+    (sql/with-connection db
+      (sql/insert-records :wishlist wishlist))))

 (defn delete-wishlist [{:keys [code]}] ; code is unique not null
-  (sql/with-connection db
-    (sql/delete-rows :wishlist ["code=?" code])))
+  (first
+    (sql/with-connection db
+      (sql/delete-rows :wishlist ["code=?" code]))))

 (defn update-wishlist [wishlist]
   (let [{:keys [id]} wishlist]


Update sequential->dom thanks @maxweber

Update sequential->dom thanks @maxweber

--- src/ankha/core.cljs
+++ src/ankha/core.cljs
@@ -89,12 +89,13 @@
                                      :verticalAlign "top"}}
             (inspect v)))))))

-(defn sequential->dom [data owner {:keys [page-item-count]
-                                   :or {page-item-count 10}}]
+(defn sequential->dom
+  [data owner {:keys [page-item-count] :or {page-item-count 10}}]
   (reify
     om/IInitState
     (init-state [_]
-      {:page 0})
+      {:page 1})
+
     om/IRenderState
     (render-state [_ {:keys [page]}]
       (let [button-style {:display "inline-block"
@@ -104,50 +105,42 @@
                           :cursor "pointer"
                           :outline "none"
                           :fontWeight "bold"
-                          :padding "0"}]
-        (dom/div
-         nil
+                          :padding "0 1em"}
+            total (count data)
+            total-pages (js/Math.ceil (/ total page-item-count))
+            first-page? (= page 1)
+            last-page? (= page total-pages)]
+
+        (dom/div nil
          (dom/button
           #js {:onClick
                (fn [_]
-                 (om/update-state!
-                  owner :page
-                  (fn [page-number]
-                    (if-not (zero? page-number)
-                      (dec page-number)
-                      page-number))))
+                 (when-not first-page?
+                   (om/update-state! owner :page dec)))
                :style (clj->js
-                       (assoc button-style
-                         :opacity (if (zero? page) "0.3" "1.0")))}
-          "<<")
-         (dom/span nil page)
-         (let [last-page? (fn [p cnt] (> (inc (* (inc p) page-item-count))
-                                         cnt))]
-           (dom/button
-            #js {:onClick
-                 (fn [_]
-                   (om/update-state!
-                    owner :page
-                    (fn [page-number]
-                      (if-not (last-page? page-number (count @data))
-                        (inc page-number)
-                        page-number))))
-                 :style (clj->js
-                         (assoc button-style
-                           :opacity (if (last-page? page (count data))
-                                      "0.3"
-                                      "1.0")))}
-            ">>"))
-         (dom/span nil (str "(" (count data) ")"))
+                       (assoc button-style :opacity (if first-page? "0.3" "1.0")))}
+          "Prev")
+
+         (dom/span nil (str "Page " page " of " total-pages " (" total " items)"))
+
+         (dom/button
+           #js {:onClick
+                (fn [_]
+                  (when-not last-page?
+                    (om/update-state! owner :page inc)))
+                :style (clj->js
+                        (assoc button-style :opacity (if last-page? "0.3" "1.0")))}
+           "Next")

          (let [page-data (->> data
-                              (drop (* page page-item-count))
+                              (drop (* (dec page) page-item-count))
                               (take page-item-count))]
            (into-array
             (for [[i x :as pair] (map-indexed vector page-data)]
               (dom/li #js {:className "entry"
                            :key (hash-key pair)}
                       (inspect x))))))))))
+

 (defn coll->dom [data]
   (cond


Clear textarea after import

Clear textarea after import

--- src/app/importer.cljs
+++ src/app/importer.cljs
@@ -17,6 +17,7 @@
                                    (map #(clojure.string/trim %)
                                         ws))))]
     (data/add-multiple! (@data/wordlists @ctl/active-list-idx) ws2)
+    (aset (.getElementById js/document "textareaimport") "value" "")
     (put! eventbus-in :data-updated)))

 ;; single word input field


add (comp-pre-checks) function definition and use within (defn moreover-comp)

--- src/babel/over.cljc
+++ src/babel/over.cljc
@@ -113,10 +113,10 @@
 (defn comp-pre-checks [parent child]
   (or
    (fail? (unifyc (get-in parent [:comp :synsem :cat])
-                  (get-in child [:synsem :cat])))
-   ))
-
-;; (fo (first (take 1 (parse "il gatto rosso si è alzato"))))
+                  (get-in child [:synsem :cat])))))
+
+;; good benchmark: run the following in babel.test.it:
+;; (take 5 (repeatedly #(time (fo (first (parse "il gatto rosso si è alzato"))))))

 (defn moreover-head [parent child lexfn-sem-impl morph]
   (let [morph (if morph morph (fn [x] x))]
@@ -199,9 +199,7 @@
   (log/trace (str "moreover-comp type comp:" (type child)))

   (let [result
-        (if (and *check-parent-and-head-child-cat-equal*
-                 (not (= (get-in parent [:comp :synsem :cat])
-                         (get-in child [:synsem :cat]))))
+        (if (comp-pre-checks parent child)
           :fail
           (unify
            (merge
@@ -218,7 +216,6 @@
       (let [debug (log/debug (str "moreover-comp: pass:     "
                                   "[" (get-in parent [:surface]) "];" " child ["
                                   (get-in child [:surface]) "]"))]
-
         (let [result
               (merge {:comp-filled true}
                      result)]
@@ -235,11 +232,11 @@
              *throw-exception-if-failed-to-add-complement*
              (get-in child '(:head)))
           (throw (exception (str "failed to add complement: " child "  to: phrase: " parent
-                                  ". Failed path was: " (fail-path result)
-                                  ". Value of parent at path is: "
-                                  (get-in parent (fail-path result))
-                                  "; Synsem of child is: "
-                                  (get-in child '(:synsem) :top)))))
+                                 ". Failed path was: " (fail-path result)
+                                 ". Value of parent at path is: "
+                                 (get-in parent (fail-path result))
+                                 "; Synsem of child is: "
+                                 (get-in child '(:synsem) :top)))))
         (log/trace (str "moreover-comp: complement synsem: " (strip-refs (get-in child '(:synsem) :top))))
         (log/trace (str "moreover-comp:  parent value: " (strip-refs (get-in parent (fail-path result)))))
         :fail))))


changed client log statements so they look better in LT

--- support/src/figwheel/client.cljs
+++ support/src/figwheel/client.cljs
@@ -8,8 +8,6 @@
    [cljs.core.async.macros :refer [go go-loop]]
    [figwheel.client :refer [defonce]]))

-(def log-style "color:rgb(0,128,0);")
-
 (defn log [{:keys [debug]} & args]
   (when debug
     (.log js/console (to-array args))))
@@ -57,7 +55,7 @@
    (let [files'  (add-request-urls opts files)
          res     (<! (load-all-js-files files'))]
      (when (not-empty res)
-       (.log js/console "%cFigwheel: loaded these files" log-style )
+       (.debug js/console "Figwheel: loaded these files")
        (.log js/console (prn-str (map :file res)))
        (<! (timeout 10)) ;; wait a beat before callback
        (apply on-jsload [res])))))
@@ -142,7 +140,7 @@
 (defn watch-and-reload* [{:keys [retry-count websocket-url
                                  jsload-callback
                                  on-compile-fail] :as opts}]
-    (.log js/console "%cFigwheel: trying to open cljs reload socket" log-style)
+    (.debug js/console "Figwheel: trying to open cljs reload socket")
     (let [socket (js/WebSocket. websocket-url)]
       (set! (.-onmessage socket) (fn [msg-str]
                                    (let [msg (read-string (.-data msg-str))]
@@ -154,7 +152,7 @@
                                        nil))))
       (set! (.-onopen socket)  (fn [x]
                                  (patch-goog-base)
-                                 (.log js/console "%cFigwheel: socket connection established" log-style)))
+                                 (.debug js/console "Figwheel: socket connection established")))
       (set! (.-onclose socket) (fn [x]
                                  (log opts "Figwheel: socket closed or failed to open")
                                  (when (> retry-count 0)
@@ -180,18 +178,18 @@
 (def format-messages (comp (partial map error-msg-format) get-essential-messages))

 (defn default-on-compile-fail [{:keys [formatted-exception exception-data] :as ed}]
-  (.log js/console "%cFigwheel: Compile Exception" log-style)
+  (.debug js/console "Figwheel: Compile Exception")
   (doseq [msg (format-messages exception-data)]
     (.log js/console msg))
   ed)

 (defn default-before-load [files]
-  (.log js/console "%cFigwheel: loading files" log-style)
+  (.debug js/console "Figwheel: loading files")
   #_(.log js/console (prn-str (mapv :file files)))
   files)

 (defn default-on-cssload [files]
-  (.log js/console "%cFigwheel: loaded CSS files" log-style)
+  (.debug js/console "Figwheel: loaded CSS files")
   (.log js/console (prn-str (map :file files)))
   files)


file tactile books and musiknoten under braille

So they are shown under braille in the catalog

--- src/catalog/vubis.clj
+++ src/catalog/vubis.clj
@@ -312,6 +312,9 @@
             (cond
               (= format :hörbuch) [format genre sub-genre]
               (#{:hörfilm :ludo} format) [format]
+              ;; file tactile books and musiknoten under braille with
+              ;; the original format as genre
+              (#{:taktilesbuch :musiknoten} format) [:braille format]
               (= genre :kinder-und-jugendbücher) [format genre sub-genre]
               :else [format genre])]
         (update-in m update-keys (fnil conj []) item))) {})))


adding static resources and using type and system routes

--- src/celestial/api.clj
+++ src/celestial/api.clj
@@ -10,10 +10,10 @@
    limitations under the License.)

 (ns celestial.api
-  (:refer-clojure :exclude [hash])
+  (:refer-clojure :exclude [hash type])
   (:use
         [celestial.routes.ui :only (ui-routes)]
-        [celestial.hosts-api :only (hosts types)]
+        [celestial.hosts-api :only (system type)]
         [celestial.users-api :only (users quotas)]
         [gelfino.timbre :only (get-tid)]
         [compojure.core :only (defroutes routes)]
@@ -131,8 +131,12 @@
            (p/delete-action id)
            (success {:msg "Deleted action" :id id})))

+(defroutes static-routes
+  (route/files "/" {:root (str (System/getProperty "user.dir") "/public/")})
+  (route/files "/bower_componenets" {:root (str (System/getProperty "user.dir") "/public/bower_conponents/")}))
+
 (defroutes app-routes
-  ui-routes hosts types actions jobs (friend/wrap-authorize users admin)
+  static-routes system type actions jobs (friend/wrap-authorize users admin)
   (friend/wrap-authorize quotas admin) (route/not-found "Not Found"))

 (defn error-wrap


client instance shutdown

client instance shutdown

--- src/chazel/chazel.clj
+++ src/chazel/chazel.clj
@@ -117,6 +117,9 @@
     HazelcastClientProxy (field HazelcastClientProxy :client p)
     p))

+(defn shutdown-client [instance]
+  (HazelcastClient/shutdown instance))
+
 (defn shutdown []
   (let [instance (hz-instance)]
     (when instance


Clarify laziness in parse-string and parse-stream docstrings

Fixes #81

--- src/cheshire/core.clj
+++ src/cheshire/core.clj
@@ -145,7 +145,10 @@
   false to leave them as strings, or a function to provide custom coercion.

   The array-coerce-fn is an optional function taking the name of an array field,
-  and returning the collection to be used for array values."
+  and returning the collection to be used for array values.
+
+  If the top-level object is an array, it will be parsed lazily (use
+  `parse-strict' if strict parsing is required for top-level arrays."
   ([string] (parse-string string nil nil))
   ([string key-fn] (parse-string string key-fn nil))
   ([^String string key-fn array-coerce-fn]
@@ -184,7 +187,12 @@

   The array-coerce-fn is an optional function taking the name of an array field,
   and returning the collection to be used for array values.
-  If laziness is needed, see parsed-seq."
+
+  If the top-level object is an array, it will be parsed lazily (use
+  `parse-strict' if strict parsing is required for top-level arrays.
+
+  If multiple objects (enclosed in a top-level `{}' need to be parsed lazily,
+  see parsed-seq."
   ([rdr] (parse-stream rdr nil nil))
   ([rdr key-fn] (parse-stream rdr key-fn nil))
   ([^BufferedReader rdr key-fn array-coerce-fn]


added satisfies?, note, now a macro, protocol must be name, not value

--- src/clj/cljs/core.clj
+++ src/clj/cljs/core.clj
@@ -14,7 +14,8 @@
                             if-let if-not import io! lazy-cat lazy-seq let letfn locking loop
                             memfn ns or proxy proxy-super pvalues refer-clojure reify sync time
                             when when-first when-let when-not while with-bindings with-in-str
-                            with-loading-context with-local-vars with-open with-out-str with-precision with-redefs]))
+                            with-loading-context with-local-vars with-open with-out-str with-precision with-redefs
+                            satisfies?]))

 (alias 'core 'clojure.core)

@@ -52,9 +53,10 @@
                      ret))
         assign-impls (fn [[psym sigs]]
                        (let [pprefix (protocol-prefix psym)]
-                         (map (fn [[f & meths]]
-                                `(set! ~(symbol (str prototype-prefix pprefix f)) (fn* ~@meths)))
-                              sigs)))]
+                         (cons `(set! ~(symbol (str prototype-prefix pprefix)) true)
+                               (map (fn [[f & meths]]
+                                      `(set! ~(symbol (str prototype-prefix pprefix f)) (fn* ~@meths)))
+                                    sigs))))]
     `(do ~@(mapcat assign-impls impl-map))))

 (defmacro deftype [t fields & impls]
@@ -92,9 +94,15 @@
                        slot (symbol (str prefix (name fname)))]
                    `(defn ~fname ~@(map #(expand-sig slot %) sigs))))]
     `(do
-       (def ~p ~prefix)
+       (def ~psym ~prefix)
        ~@(map method methods))))

+(defmacro satisfies?
+  [psym x]
+  (let [p (:name (cljs.compiler/resolve-var (dissoc &env :locals) psym))
+        prefix (protocol-prefix p)]
+    `(if (. ~x ~(symbol prefix)) true false)))
+
 (defmacro lazy-seq [& body]
-  `(new cljs.user.LazySeq nil false (fn [] ~@body)))
+  `(new cljs.core.LazySeq nil false (fn [] ~@body)))


* src/clj/cljs/core.clj: not-nil? not general enough for a fast PHM implementation. Removing. Adding internal coercive-not=.

--- src/clj/cljs/core.clj
+++ src/clj/cljs/core.clj
@@ -48,8 +48,9 @@
 (defmacro nil? [x]
   `(identical? ~x nil))

-(defmacro not-nil? [x]
-  (bool-expr (list 'js* "(~{} != null)" x)))
+;; internal - do not use.
+(defmacro coercive-not= [x y]
+  (bool-expr (list 'js* "(~{} != ~{})" x y)))

 (defmacro true? [x]
   (bool-expr (list 'js* "~{} === true" x)))


Add assert macro

Add assert macro

--- src/clj/cljs/core.clj
+++ src/clj/cljs/core.clj
@@ -114,3 +114,16 @@
 (defmacro aget [a i]
   (list 'js* "(~{}[~{}])" a i))

+(defmacro assert
+  "Evaluates expr and throws an exception if it does not evaluate to
+  logical true."
+  ([x]
+     (when *assert*
+       `(when-not ~x
+          (throw (cljs.core/str
+                   "Assert failed: " (cljs.core/pr-str '~x))))))
+  ([x message]
+     (when *assert*
+       `(when-not ~x
+          (throw (cljs.core/str
+                   "Assert failed: " ~message "\n" (cljs.core/pr-str '~x)))))))


import side-key to core.clj namespace

import side-key to core.clj namespace

--- src/clj/game/core.clj
+++ src/clj/game/core.clj
@@ -1,7 +1,8 @@
 (ns game.core
   (:require [game.utils :refer [remove-once has? merge-costs zone make-cid to-keyword capitalize
                                 costs-to-symbol vdissoc distinct-by abs String->Num safe-split
-                                dissoc-in cancellable side-str]]
+                                dissoc-in cancellable side-key side-str]]
+            [game.cards :refer ice?]
             [game.macros :refer [effect req msg]]
             [clojure.string :refer [split-lines split join]]
             [clojure.core.match :refer [match]]))


split pay function into pay and can-pay?

--- src/clj/game/core.clj
+++ src/clj/game/core.clj
@@ -23,10 +23,17 @@
 (declare prompt! forfeit trigger-event handle-end-run trash update-advancement-cost update-all-advancement-costs
          update-all-ice update-ice-strength update-breaker-strength all-installed)

-(defn pay [state side card & args]
+(defn can-pay? [state side & args]
   (let [costs (merge-costs (remove #(or (nil? %) (= % [:forfeit])) args))
         forfeit-cost (some #{[:forfeit] :forfeit} args)
         scored (get-in @state [side :scored])]
+    (if (and (every? #(>= (- (get-in @state [side (first %)]) (last %)) 0) costs)
+             (or (not forfeit-cost) (not (empty? scored))))
+      {:costs costs, :forfeit-cost forfeit-cost, :scored scored}
+    )))
+
+(defn pay [state side card & args]
+  (when-let [{:keys [costs forfeit-cost scored]} (apply can-pay? state side args)]
     (when (and (every? #(>= (- (get-in @state [side (first %)]) (last %)) 0) costs)
                (or (not forfeit-cost) (not (empty? scored))))
       (when forfeit-cost


Fix select with less than max cards selected

--- src/clj/game/core.clj
+++ src/clj/game/core.clj
@@ -289,7 +289,7 @@
                     (if-let [m (get-in ability [:choices :max])]
                       (str "Select up to " m " targets for " (:title card))
                       (str "Select a target for " (:title card))))
-                  ["Done"] (fn [choice] (resolve-select state side))
+                  ["Done"] (req (resolve-select state side))
                   (assoc args :prompt-type :select)))))

 (defn resolve-ability [state side {:keys [counter-cost advance-counter-cost cost effect msg req once


Don't run where.exe on an absolute path.

Fixes #33

--- src/clj/runbld/io.clj
+++ src/clj/runbld/io.clj
@@ -43,6 +43,9 @@

 (defn abspath [f]
   (.getCanonicalPath (jio/as-file f)))
+
+(defn abspath? [f]
+  (.isAbsolute (jio/as-file f)))

 (defn abspath-file [f]
   (jio/file (abspath f)))
@@ -94,11 +97,13 @@

 (def windows-which
   (fn [name]
-    (-> (run-which "where.exe" name)
-        java.io.StringReader.
-        jio/reader
-        line-seq
-        first)))
+    (if (abspath? name)
+      name
+      (-> (run-which "where.exe" name)
+          java.io.StringReader.
+          jio/reader
+          line-seq
+          first))))

 (defn which-fn [os]
   (condp #(.startsWith %2 %1) os


Whitespace cleanup

Whitespace cleanup

Signed-off-by: Gregory Haskins <640d9fe47775e6723f0355b7315e38f7d98d3539@gmail.com>

--- src/cljparse/core.clj
+++ src/cljparse/core.clj
@@ -34,4 +34,3 @@
                             (do
                               (println "Starting cljparse on:" (.getAbsolutePath file) "and errors:" errors)
                               (config/parser file))))))))
-


Properly throttle failed logins [fixes #401]

This builds on
https://github.com/ato/clojars-web/commit/43b1bd7087926d2875ebf47e5dbb4c2fbb9ce4d3,
but fixes it to catch bad password attempts as well.

--- src/clojars/web.clj
+++ src/clojars/web.clj
@@ -23,6 +23,7 @@
              [safe-hiccup :refer [raw]]
              [search :refer [search]]]
             [clojure.java.io :as io]
+            [clojure.set :refer [rename-keys]]
             [compojure
              [core :refer [ANY context GET PUT routes]]
              [route :refer [not-found]]]
@@ -82,14 +83,17 @@

 (defn credential-fn [db]
   (let [attempts (atom {})]
-    (partial creds/bcrypt-credential-fn
-             (fn [id]
-               (if-let [{:keys [user password]}
-                        (db/find-user-by-user-or-email db id)]
-                 (when-not (empty? password)
-                   (swap! attempts dissoc user)
-                   {:username user :password password})
-                 (do (swap! attempts bad-attempt id) nil))))))
+    (fn [{:keys [username] :as auth-map}]
+      (if-let [auth-result (creds/bcrypt-credential-fn
+                             #(rename-keys (db/find-user-by-user-or-email db %)
+                               {:user :username})
+                             auth-map)]
+        (do
+          (swap! attempts dissoc username)
+          auth-result)
+        (do
+          (swap! attempts bad-attempt username)
+          nil)))))

 (defn wrap-x-frame-options [f]
   (fn [req] (update-in (f req) [:headers] assoc "X-Frame-Options" "DENY")))


routine for finer-grained pruning added

routine for finer-grained pruning added

--- src/crawler/dom.clj
+++ src/crawler/dom.clj
@@ -383,3 +383,7 @@
         (fn [acc [an-xpath node]]
           (merge-with
            concat acc {an-xpath [node]})) {} nodes-xpaths))))
+
+(defn split-items
+  [xpaths-hrefs-tokens]
+  xpaths-hrefs-tokens)


add non-trimmed stuff to model as well

add non-trimmed stuff to model as well

--- src/crawler/model.clj
+++ src/crawler/model.clj
@@ -67,78 +67,89 @@
           refined :refined}]

 ;       (println :old-refined refined)
-;       (println :new-refined )
-       (let [probed-refinement
-             (reduce
-              (fn [acc [[src-xpath xpath-to-take] refinement]]
-                (let [docs-at-src-xpath (filter
-                                         (fn [[u x]]
-                                           (and (= (:path x)
-                                                   src-xpath)
-                                                (some #{u} corpus-urls)))
-                                         downloaded-corpus)
+                                        ;       (println :new-refined )
+       (if (empty?
+            (filter
+             (fn [[axn-pair x]]
+               (and (not
+                     (nil? x))
+                    (not
+                     (empty? (:avoid x)))))
+             refined))
+         {:actions axns
+          :refined refined}
+         (let [probed-refinement
+               (reduce
+                (fn [acc [[src-xpath xpath-to-take] refinement]]
+                  (let [docs-at-src-xpath (filter
+                                           (fn [[u x]]
+                                             (and (= (:path x)
+                                                     src-xpath)
+                                                 (some #{u} corpus-urls)))
+                                          downloaded-corpus)

-                      action-to-take-at-target (if (= (inc (count src-xpath))
-                                                      (count axns))
-                                                 nil
-                                                 (nth (reverse axns)
-                                                      (inc
-                                                       (count src-xpath))))
+                       action-to-take-at-target (if (= (inc (count src-xpath))
+                                                       (count axns))
+                                                  nil
+                                                  (nth (reverse axns)
+                                                       (inc
+                                                        (count src-xpath))))

-                      new-refinements
+                       new-refinements

-                      (map
-                       (fn [[u x]]
-                         (let [processed-doc (dom/html->xml-doc (:body x))]
-                           (dom/probe-refinements
-                            xpath-to-take
-                            refinement
-                            processed-doc
-                            (fn [l bd]
-                              (let [xpaths-hrefs (:xpath-nav-info
-                                                  (extractor/state-action
-                                                   bd
-                                                   {:url l}
-                                                   {}
-                                                   []))]
-                                (not
-                                 (empty?
-                                  (filter
-                                   (fn [{x :xpath}]
-                                     (if action-to-take-at-target
-                                       (= x action-to-take-at-target)
-                                       (let [num-matched (count
-                                                          (filter
-                                                           (fn [e]
-                                                             (similarity/similar? e bd))
-                                                           leaf-examples))]
-                                         (>= num-matched
-                                               (/ (count leaf-examples)
-                                                  2)))))
-                                   xpaths-hrefs)))))
-                            u)))
-                       docs-at-src-xpath)]
-                  ;; this is the new refinement
-                  (merge
-                   acc
-                   {[src-xpath xpath-to-take]
-                    (merge refinement
-                           {:avoid
-                            (first
-                             (last
-                              (sort-by
-                               second
-                               (frequencies new-refinements))))})})))
-              {}
-              (filter
-               (fn [[axn-pair refinement]]
-                 (not
-                  (or (nil? (:avoid refinement))
-                      (empty? (:avoid refinement)))))
-               refined))]
+                       (map
+                        (fn [[u x]]
+                          (let [processed-doc (dom/html->xml-doc (:body x))]
+                            (dom/probe-refinements
+                             xpath-to-take
+                             refinement
+                             processed-doc
+                             (fn [l bd]
+                               (let [xpaths-hrefs (:xpath-nav-info
+                                                   (extractor/state-action
+                                                    bd
+                                                    {:url l}
+                                                    {}
+                                                    []))]
+                                 (not
+                                  (empty?
+                                   (filter
+                                    (fn [{x :xpath}]
+                                      (if action-to-take-at-target
+                                        (= x action-to-take-at-target)
+                                        (let [num-matched (count
+                                                           (filter
+                                                            (fn [e]
+                                                              (similarity/similar? e bd))
+                                                            leaf-examples))]
+                                          (>= num-matched
+                                              (/ (count leaf-examples)
+                                                 2)))))
+                                    xpaths-hrefs)))))
+                             u)))
+                        docs-at-src-xpath)]
+                   ;; this is the new refinement
+                   (merge
+                    acc
+                    {[src-xpath xpath-to-take]
+                     (merge refinement
+                            {:avoid
+                             (first
+                              (last
+                               (sort-by
+                                second
+                                (frequencies new-refinements))))})})))
+               {}
+               (filter
+                (fn [[axn-pair refinement]]
+                  (not
+                   (or (nil? (:avoid refinement))
+                       (empty? (:avoid refinement)))))
+                refined))]

-         ;; now merge with the existing refinements
-         (let [updated-refinements {:refined (merge refined
-                                                    probed-refinement)}]
-           updated-refinements)))
+          ;; now merge with the existing refinements
+          (let [updated-refinements {:actions axns
+                                     :refined (merge refined
+                                                     probed-refinement)}]
+            updated-refinements))))
      actions-with-refinements)))


Clean up

Clean up

--- src/extremo/db.cljs
+++ src/extremo/db.cljs
@@ -60,16 +60,5 @@
         (get-entry-by-path filepath)
         (.then #(build-entry-data %)))))

-;; (-> (open-repo)
-;;     (.then #(.getMasterCommit %))
-;;     (.then #(.getTree %))
-;;     (.then (fn [tree]
-;;              (-> (.walk tree)
-;;                  (.on "entry" #(js/console.log (.path %)))
-;;                  (.start)))))
-
-;; (-> (get-file-history "test.md")
-;;     (.then #(js/console.log (clj->js %))))
-
 (-> (get-file-by-path "test.md")
     (.then #(js/console.log (clj->js %))))


Refactored achievement handling

Refactored achievement handling

--- src/demogorgon/nh.clj
+++ src/demogorgon/nh.clj
@@ -295,6 +295,25 @@
                        (:player data)
                        (:turns data))))

+(defn bitfield-to-int [bitfield]
+  (if (string? bitfield)
+    (if (or (.startsWith bitfield "0x")
+            (.startsWith bitfield "0X"))
+      (Integer/parseInt (.substring bitfield 2) 16)
+      (Integer/parseInt bitfield))
+    bitfield))
+
+(defn parse-bitfield [values bitfield]
+  (let [bitfield (if (integer? bitfield)
+                   bitfield
+                   (bitfield-to-int bitfield))]
+    (first (filter string?
+                   (map (fn [idx]
+                          (if (bit-test bitfield idx)
+                            (nth values idx)
+                            nil))
+                        (range (count values)))))))
+
 (defn make-livelog-out [data]
   (condp #(contains? %2 %1) data
     :wish (if (= (.toLowerCase (:wish data)) "nothing")
@@ -345,19 +364,12 @@

     :game_action (make-game-action-out data)

-    :achieve_diff (let [achieve-diff (Integer/parseInt (.substring (:achieve_diff data) 2) 16)]
+    :achieve_diff (let [achieve-diff (bitfield-to-int (:achieve_diff data))]
                     (if (not (or (= achieve-diff 0)
                                  (= achieve-diff 0x200)
                                  (= achieve-diff 0x400)))
-                      (first (filter #(not (= nil %1))
-                                     (map (fn [idx]
-                                            (if (bit-test achieve-diff idx)
-                                              (format "%s %s after %s turns."
-                                                      (:player data)
-                                                      (nth achievements idx)
-                                                      (:turns data))
-                                              nil))
-                                          (range (count achievements)))))))
+                      (parse-bitfield achievements achieve-diff)))
+
     (str "unhandled line: " data)))

 (defn handle-livelog-line [irc line]