convert map of apis into vector

convert map of apis into vector

--- src/mirthsync/core.clj
+++ src/mirthsync/core.clj
@@ -104,32 +104,37 @@
           (upload-node server path find-id (to-zip (slurp f))))))))

 (def apis
-  {:configurationMap {:find-elements [:map]
-                      :find-id [(fn [_] nil)]
-                      :find-name [(fn [_] "configurationMap")]
-                      :path "server/configurationMap"}
+  [{:api 'configurationMap'
+    :find-elements [:map]
+    :find-id [(fn [_] nil)]
+    :find-name [(fn [_] "configurationMap")]
+    :path "server/configurationMap"}

-   :codeTemplate {:find-elements [:list :codeTemplate]
-                  :find-id [:id zip/down zip/node]
-                  :find-name [:name zip/down zip/node]
-                  :path "codeTemplates"}
+   {:api 'codeTemplate'
+    :find-elements [:list :codeTemplate]
+    :find-id [:id zip/down zip/node]
+    :find-name [:name zip/down zip/node]
+    :path "codeTemplates"}

-   :globalScripts {:find-elements [:map]
-                   :find-id [(fn [_] nil)]
-                   :find-name [(fn [_] "globalScripts")]
-                   :path "server/globalScripts"}
+   {:api 'globalScripts'
+    :find-elements [:map]
+    :find-id [(fn [_] nil)]
+    :find-name [(fn [_] "globalScripts")]
+    :path "server/globalScripts"}

-   :channelGroup {:find-elements [:list :channelGroup]
-                  :find-id [:id zip/down zip/node]
-                  :find-name [:name zip/down zip/node]
-                  :path "channelgroups"
-                  :prevent-push true}
+   {:api 'channelGroup'
+    :find-elements [:list :channelGroup]
+    :find-id [:id zip/down zip/node]
+    :find-name [:name zip/down zip/node]
+    :path "channelgroups"
+    :prevent-push true}

-   :channel {:find-elements [:list :channel]
-             :find-id [:id zip/down zip/node]
-             :find-name [:name zip/down zip/node]
-             :path "channels"}
-   })
+   {:api 'channel'
+    :find-elements [:list :channel]
+    :find-id [:id zip/down zip/node]
+    :find-name [:name zip/down zip/node]
+    :path "channels"}
+   ])

 (defn run
   "Start of app logic. Links the action specified in the application
@@ -142,8 +147,8 @@
     (cli/output 0 (str "Authenticating to server at " server " as " username))
     (with-authentication server username password
       (fn [] (doseq [api apis]
-              (cli/output 1 (key api))
-              (action app-conf (val api)))))
+              (cli/output 1 (:api api))
+              (action app-conf api))))
     (cli/output 0 "Finished!")
     app-conf))


add and add-statement wrappers for use in preference to grafter.rdf.protocols.

--- src/grafter/rdf.clj
+++ src/grafter/rdf.clj
@@ -177,3 +177,20 @@
 (defn context [statement]
   "Return the RDF context from a statement."
   (pr/context statement))
+
+(defn add-statement
+  "Add an RDF statement to the target datasink.  Datasinks must
+  implement grafter.rdf.protocols/ITripleWriteable.
+
+  Datasinks include sesame RDF repositories, connections and anything
+  built by rdf-serializer."
+  ([target statement]
+     (pr/add-statement target statement))
+  ([target graph statement]
+     (pr/add-statement target graph statement)))
+
+(defn add
+  "Adds a sequence of statements to the specified datasink.  Supports
+  all the same targets as add-statement."
+  [target triples]
+  (pr/add target triples))


[#1053] Include instance id, display name and surveyal time in flow import

--- backend/src/akvo/lumen/import/flow.clj
+++ backend/src/akvo/lumen/import/flow.clj
@@ -90,11 +90,14 @@
   [form]
   (let [questions (questions form)]
     (into
-     [{:title "Identifier" :type :text :id :identifier}
+     [{:title "Instance id" :type :text :id :instance_id}
+      {:title "Identifier" :type :text :id :identifier}
+      {:title "Display name" :type :text :id :display_name}
       {:title "Latitude" :type :number :id :latitude}
       {:title "Longitude" :type :number :id :longitude}
       {:title "Submitter" :type :text :id :submitter}
-      {:title "Submitted at" :type :date :id :submitted_at}]
+      {:title "Submitted at" :type :date :id :submitted_at}
+      {:title "Surveyal time" :type :number :id :surveyal_time}]
      (map (fn [question]
             {:title (:name question)
              :type (question-type->lumen-type question)
@@ -193,12 +196,15 @@
     (map (fn [form-instance]
            (let [data-point-id (get form-instance "dataPointId")]
              (assoc (response-data form (get form-instance "responses"))
+                    :instance_id (get form-instance "id")
+                    :display_name (get-in data-points [data-point-id "displayName"])
                     :identifier (get-in data-points [data-point-id "identifier"])
                     :latitude (get-in data-points [data-point-id "latitude"])
                     :longitude (get-in data-points [data-point-id "longitude"])
                     :submitter (get form-instance "submitter")
                     :submitted_at (some-> (get form-instance "submissionDate")
-                                          Instant/parse))))
+                                          Instant/parse)
+                    :surveyal_time (get form-instance "surveyalTime"))))
          (form-instances headers-fn form))))

 (defmethod import/dataset-importer "AKVO_FLOW"


New tests: render-user, render-users, and render-admin-interface etc.

--- test/clouseau/test_html_renderer.clj
+++ test/clouseau/test_html_renderer.clj
@@ -78,7 +78,6 @@
     (testing "if the clouseau.html-renderer/render-navigation-bar-section definition exists."
         (is (callable? 'clouseau.html-renderer/render-navigation-bar-section))))

-
 (deftest test-render-description-existence
     "Check that the clouseau.html-renderer/render-description definition exists."
     (testing "if the clouseau.html-renderer/render-description definition exists."
@@ -99,8 +98,18 @@
     (testing "if the clouseau.html-renderer/render-descriptions definition exists."
         (is (callable? 'clouseau.html-renderer/render-descriptions))))

-(deftest test-render-navigation-bar-section-existence
-    "Check that the clouseau.html-renderer/render-navigation-bar-section definition exists."
-    (testing "if the clouseau.html-renderer/render-navigation-bar-section definition exists."
-        (is (callable? 'clouseau.html-renderer/render-navigation-bar-section))))
+(deftest test-render-user-existence
+    "Check that the clouseau.html-renderer/render-user definition exists."
+    (testing "if the clouseau.html-renderer/render-user definition exists."
+        (is (callable? 'clouseau.html-renderer/render-user))))

+(deftest test-render-users-existence
+    "Check that the clouseau.html-renderer/render-users definition exists."
+    (testing "if the clouseau.html-renderer/render-users definition exists."
+        (is (callable? 'clouseau.html-renderer/render-users))))
+
+(deftest test-render-admin-interface-existence
+    "Check that the clouseau.html-renderer/render-admin-interface definition exists."
+    (testing "if the clouseau.html-renderer/render-admin-interface definition exists."
+        (is (callable? 'clouseau.html-renderer/render-admin-interface))))
+


fix missing names for chat with unlogged-in users

--- src/pc/models/chat.clj
+++ src/pc/models/chat.clj
@@ -38,6 +38,7 @@
                   :server/timestamp
                   :client/timestamp
                   ;; TODO: teach frontend to lookup cust/name
+                  :session/uuid
                   :cust/cust-name
                   :chat/body
                   :chat/color


Fix typo.

Fix typo.

--- src/riemann/keenio.clj
+++ src/riemann/keenio.clj
@@ -25,7 +25,7 @@
 (defn keenio
   "Creates a keen adapter. Takes your Keen project id and write key, and
   returns a function that accepts an event and sends it to Keen IO. The full
-  event will sent.
+  event will be sent.

 (streams
   (let [kio (keenio \"COLLECTION_NAME\", \"PROJECT_ID\" \"WRITE_KEY\")]


finish clojure version

finish clojure version

--- Range-Sum-Query/RSQ.clj
+++ Range-Sum-Query/RSQ.clj
@@ -0,0 +1,2 @@
+(defn sumRange [nl i j]
+  (apply + (-> nl (subvec i (inc j)))))


routine name changed

routine name changed

--- src/crawler/records.clj
+++ src/crawler/records.clj
@@ -34,7 +34,9 @@
    {}
    records))

-(defn record-signatures
+(defn page-xpaths-records
+  "Return a list of xpaths and records on a page
+ranked by just the frequency of a record on the page"
   [page-src]
   (let [xpaths          (:xpaths
                          (dom/minimum-maximal-xpath-set page-src))


Winning

Winning

--- src/tictactoe/core.clj
+++ src/tictactoe/core.clj
@@ -47,16 +47,27 @@
   (winning-board? (game-board board move player) player))

 (defn best-case
-  [player move board]
+  [player move board depth minimising winning-player]
+  ; (println depth)
+  ; (println (render board))
   (cond
-    (winning-move? board move player) 1
-    (winning-move? board move (opponent player)) 1
-    :else 0))
+    (winning-board? (game-board board move player) winning-player) (- 10 depth)
+    (winning-board? (game-board board move player) (opponent winning-player)) (- depth 10)
+    (= [] (valid-moves (game-board board move player))) 0
+    :else
+    (apply (cond minimising min :else max)
+      (map
+        #(best-case (opponent player) %1 (game-board board move player) (+ 1 depth) (not minimising) winning-player)
+        (valid-moves (game-board board move player))
+      )
+    )))
+

 (defn cpu-move
   [board player]
+  (println (map #(best-case player %1 board 0 true player) (valid-moves board)))
   (if (empty-board? board) center-cell-index
-    (apply max-key #(best-case player %1 board) (valid-moves board))))
+    (apply max-key #(best-case player %1 board 0 true player) (valid-moves board))))

 (defn player-move [board] (Integer. (read-line)))


Remove unused method

Remove unused method

--- src/tictactoe/core.clj
+++ src/tictactoe/core.clj
@@ -41,8 +41,6 @@

 (defn valid-moves [board] (filter #(= (get board %1) "") (take 9 (range))))

-(defn winning-move? [board move player] (winning-board? (game-board board move player) player))
-
 (defn best-case
   [player move board depth minimising winning-player]
   (cond


Fix indentation in cortex.util-test

Fix indentation in cortex.util-test

--- cortex/test/cljc/cortex/util_test.cljc
+++ cortex/test/cljc/cortex/util_test.cljc
@@ -1,23 +1,23 @@
 (ns cortex.util-test
   (:require
     #?(:cljs [cljs.test :refer-macros [deftest is testing]]
-        :clj [clojure.test :refer [deftest is testing]])
+       :clj [clojure.test :refer [deftest is testing]])
     [clojure.core.matrix :as m]
     [cortex.util :as util]))

 (deftest confusion-test
   (let [cf (util/confusion-matrix ["cat" "dog" "rabbit"])
         cf (-> cf
-            (util/add-prediction "dog" "cat")
-            (util/add-prediction "dog" "cat")
-            (util/add-prediction "cat" "cat")
-            (util/add-prediction "cat" "cat")
-            (util/add-prediction "rabbit" "cat")
-            (util/add-prediction "dog" "dog")
-            (util/add-prediction "cat" "dog")
-            (util/add-prediction "rabbit" "rabbit")
-            (util/add-prediction "cat" "rabbit")
-            )]
+             (util/add-prediction "dog" "cat")
+             (util/add-prediction "dog" "cat")
+             (util/add-prediction "cat" "cat")
+             (util/add-prediction "cat" "cat")
+             (util/add-prediction "rabbit" "cat")
+             (util/add-prediction "dog" "dog")
+             (util/add-prediction "cat" "dog")
+             (util/add-prediction "rabbit" "rabbit")
+             (util/add-prediction "cat" "rabbit")
+             )]
     ;; (util/print-confusion-matrix cf)
     (is (= 2 (get-in cf ["cat" "dog"])))))

@@ -28,22 +28,22 @@
   "Tests if a sequence of array values converges to a target value, with a given tolerance.
    Returns nil if convergence does not happen, the success value from the sequence if it does."
   ([sequence target]
-    (converges? sequence target nil))
+   (converges? sequence target nil))
   ([sequence target {:keys [tolerance max-tests test-fn hits-needed] :as options}]
-    (let [tolerance (or tolerance DEFAULT-TOLERANCE)
-          max-tests (long (or max-tests DEFAULT-MAX-TESTS))
-          test-fn (or test-fn identity)
-          hits-needed (long (or hits-needed 1))]
-      (loop [i 0
-             hits 0
-             sequence (seq sequence)]
-        (when (< i max-tests)
-          (if-let [v (first sequence)]
-             (if (m/equals target (test-fn v) tolerance) ;; equals with tolerance
-               (if (>= (inc hits) hits-needed)
-                 v
-                 (recur (inc i) (inc hits) (next sequence)))
-               (recur (inc i) 0 (next sequence)))))))))
+   (let [tolerance (or tolerance DEFAULT-TOLERANCE)
+         max-tests (long (or max-tests DEFAULT-MAX-TESTS))
+         test-fn (or test-fn identity)
+         hits-needed (long (or hits-needed 1))]
+     (loop [i 0
+            hits 0
+            sequence (seq sequence)]
+       (when (< i max-tests)
+         (if-let [v (first sequence)]
+           (if (m/equals target (test-fn v) tolerance) ;; equals with tolerance
+             (if (>= (inc hits) hits-needed)
+               v
+               (recur (inc i) (inc hits) (next sequence)))
+             (recur (inc i) 0 (next sequence)))))))))

 (deftest test-convergence
   (is (converges? (range 10) 5))


removing log on state discovery

removing log on state discovery

--- src/mount/core.cljc
+++ src/mount/core.cljc
@@ -144,7 +144,7 @@
                               :status #{:stopped}}
                        stop (assoc :stop `(fn [] ~stop)))]
           `(do
-             (log (str "|| mounting... " ~state-name))
+             ;; (log (str "|| mounting... " ~state-name))
              (~'defonce ~state (DerefableState. ~state-name))
              (mount-it (~'var ~state) ~state-name ~s-meta)
              (~'var ~state))))))


into #{} -> set (x2)

into #{} -> set (x2)

--- src/desdemona/utils.clj
+++ src/desdemona/utils.clj
@@ -62,7 +62,7 @@
   "Onyx is a parallel, distributed system - so ordering isn't guaranteed.
    Does an unordered comparison of segments to check for equality."
   [expected actual]
-  (is (= (into #{} expected) (into #{} (remove (partial = :done) actual))))
+  (is (= (set expected) (set (remove (partial = :done) actual))))
   (is (= :done (last actual)))
   (is (= (dec (count actual)) (count expected))))


1.3-ifying examples.krypto

1.3-ifying examples.krypto

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

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

 ;; Chooses and then tries to solve (via pushgp) a game of Krypto.
 ;; See http://en.wikipedia.org/wiki/Krypto_(game)
@@ -50,4 +50,4 @@
                             (abs (- top-int objective))
                             1000)))))
 	 :atom-generators (list 'integer_div 'integer_mult 'integer_add 'integer_sub)
-	 :tournament-size 3)+	 :tournament-size 3)


Fix fixtures.

Fix fixtures.

--- src/uxbox/fixtures.clj
+++ src/uxbox/fixtures.clj
@@ -29,8 +29,6 @@
   (-> (t/encode data)
       (codecs/bytes->str)))

-(def ^:private password (hashers/encrypt "123123"))
-
 (defn- create-user
   [conn i]
   (println "create user" i)
@@ -39,7 +37,7 @@
                        :id (mk-uuid "user" i)
                        :fullname (str "User " i)
                        :metadata (data-encode {})
-                       :password password
+                       :password "123123"
                        :email (str "user" i ".test@uxbox.io")}))

 (defn- create-project
@@ -66,7 +64,7 @@
                      :height 768
                      :layout "tablet"}))

-(def num-users 1000)
+(def num-users 50)
 (def num-projects 5)
 (def num-pages 5)


spacing fix

spacing fix


Handle interruptions on nREPL classloader

When nrepl is run in the same process but in a different classloader,
it will receive the same interruption signals that we're handling on
the client side. We need to capture those, so we only handle them
on the client side, and forward the interruption on the nREPL in the
preferred way, via :interrupt.

This has the unfortunate result that we blow away any signal handling
that the nREPL server wants to do, replacing it with a no-op.
Currently the server has just the default Java signal handling, but
this could change. However, this is only a potential problem when the
nREPL server is running in the same process as the client - that's the
only way it can receive the signal.


more experiment on the board

more experiment on the board


Reverted convoluted compiling

Reverted convoluted compiling

--- src/hummingcat/core.clj
+++ src/hummingcat/core.clj
@@ -8,6 +8,7 @@
     ring.middleware.file-info
     ring.middleware.content-type
     ring.middleware.not-modified
+    ring.middleware.keyword-params
     ring.middleware.params
     ring.util.io
     ring.middleware.session
@@ -188,10 +189,12 @@
   (->
     handler
     (wrap-url-params) ; Custom url-parametrization
-    (wrap-keywords-params)
+    (wrap-keyword-params)
     (wrap-params)
     (wrap-session)
     (wrap-cookies)
+    (wrap-resource "./out") ; Obviously only one of these is correct...
+    (wrap-resource "../out")
     (wrap-resource (or (:static settings) "./"))
     (wrap-file-info)
     (wrap-content-type)
@@ -228,39 +231,22 @@
         ; The rest are passed on as options to the Ring server.
         ; All are optional. Pass in just a number if you want.
         (let [settings {:static (:static options)}
-              new_options (dissoc options
+              new-options (dissoc options
                                   :static
                                   :cljs-input
                                   :cljs-output)
               static (:static options)
-              ; Cannot use an absolute path. Fix later.
-              input_path (or (:cljs-input options) static)
-              output_path (or (:cljs-output options) static)]
-          (do  ; Necessary for run-jetty
-          (if (and input_path output_path)
-            (let [input_directory (clojure.java.io/file input_path)
-                  output_absolute_path (.getAbsolutePath
-                                         (clojure.java.io/file output_path))
-                  input_absolute_path (.getAbsolutePath input_directory)
-                  input_files (for [file (filter #(.isFile %) (file-seq input_directory))] (.getAbsolutePath file))
-                  output_files (vec (map
-                                      #(convert_relative
-                                        %
-                                        input_absolute_path
-                                        output_absolute_path)
-                                      input_files))]
-
-                ; I know this is stupid
-                ; A for loop wasn't working, I have no idea.
-                ; Obviously should refactor.
-                (dotimes [i (count output_files)]
-                  (let [current (nth output_files i)]
-                    ; This fails silently! A very bad thing.
-                    (cljs.closure/build (first current) {:output-to (second current)
-                                                   :optimizations :advanced}))))
-            (when (or input_path output_path)
-              (throw (Exception. "You need both a :cljs-input and a :cljs-output"))))
-          (run-server (wrap-app handler settings) new_options)))))
+              input-path (or (:cljs-input options) static)
+              output-path (or (:cljs-output options) static)]
+          (do
+          (if
+            (and input-path output-path)
+            (cljs.closure/build input-path {:output-to (output-path)
+                                            :optimizations :advanced})
+            (when
+              (or input-path output-path)
+              (throw "You need both a :cljs-input and a :cljs-output")))
+          (run-server (wrap-app handler settings) new-options)))))

 ; (def-handler handle [request]


Remove test.

Remove test.

--- src/wlmmap/handler.clj
+++ src/wlmmap/handler.clj
@@ -29,7 +29,6 @@
    (h/include-js "/js/leaflet.markercluster.js")
    ;; [:h1 "WLM Map (work in progress)"]
    [:div {:id "map"}]
-   (pr-str params)
    (h/include-js "/js/map.js")))

 (defroutes app-routes


Use the PORT env variable

Use the PORT env variable

--- src/wlmmap/handler.clj
+++ src/wlmmap/handler.clj
@@ -368,5 +368,5 @@
 (def ring-handler (middleware/war-handler app))

 (defn -main [& args]
-  (run-server #'ring-handler {:port 80}))
-
+  [port (Integer/parseInt (System/getenv "PORT"))]
+  (run-server #'ring-handler {:port port}))


ensure placeholder key is removed if present

--- src/open_company/resources/section.clj
+++ src/open_company/resources/section.clj
@@ -199,6 +199,7 @@
         author (common/author-for-user user)
         updated-section (-> section
           (clean)
+          (dissoc :placeholder)
           (assoc :company-slug company-slug)
           (assoc :section-name section-name)
           (assoc :author author)
@@ -207,6 +208,7 @@
         updated-sections (company/sections-with (:sections original-company) section-name)
         sectioned-company (assoc original-company :sections updated-sections)
         updated-company (assoc sectioned-company section-name (-> updated-section
+          (dissoc :placeholder)
           (dissoc :company-slug)
           (dissoc :section-name)))]
     (if (and (= (:org-id original-company) (:org-id user)) ; user is valid to do this update
@@ -222,4 +224,4 @@

 (defn delete-all-sections!
   "Use with caution! Failure can result in partial deletes of just some sections. Returns `true` if successful."
-  [] (common/delete-all-resources! table-name))+  [] (common/delete-all-resources! table-name))


tighten up the loop body

tighten up the loop body

--- src/kmp_search/core.clj
+++ src/kmp_search/core.clj
@@ -14,13 +14,13 @@
   (let [length (alength pattern)
         failure (long-array length)
         compute-failure (fn [[i j] b]
-                          (let [j (loop [j j]
-                                    (let [p (aget pattern j)]
-                                      (if (and (pos? j) (not= p b))
-                                        (recur (aget failure (dec j)))
-                                        (if (= p b)
-                                          (inc j)
-                                          j))))]
+                          (let [j (loop [j j p (aget pattern j)]
+                                    (if (and (pos? j) (not= p b))
+                                      (recur (aget failure (dec j))
+                                             (aget pattern j))
+                                      (if (= p b)
+                                        (inc j)
+                                        j)))]
                             (aset-long failure i j)
                             [(inc i) j]))
         _ (reduce compute-failure [1 0] (drop 1 pattern))]


fix cljc form mistake

fix cljc form mistake

--- src/org/martinklepsch/derivatives.cljc
+++ src/org/martinklepsch/derivatives.cljc
@@ -112,7 +112,8 @@
 (let [get-k     "org.martinklepsch.derivatives/get"
       release-k "org.martinklepsch.derivatives/release"
       class-properties #?(:cljs {:childContextTypes {get-k     js/React.PropTypes.func
-                                                     release-k js/React.PropTypes.func}})]
+                                                     release-k js/React.PropTypes.func}}
+                          :clj {})]

   (defn rum-derivatives
     "Given the passed spec add get!/release! derivative functions to


logic fix

logic fix

--- src/metabase/driver.clj
+++ src/metabase/driver.clj
@@ -127,7 +127,7 @@
   (binding [qp/*query* query]
     (let [driver  (database-id->driver (:database query))
           query   (qp/preprocess query)
-          results (i/process-query driver (dissoc query :cum_sum))] ; strip out things that individual impls don't need to know about / deal with
+          results (i/process-query driver (dissoc-in query [:query :cum_sum]))] ; strip out things that individual impls don't need to know about / deal with
       (qp/post-process driver query results))))


Hint type of header-charset.

Hint type of header-charset.

--- src/multicodec/core.clj
+++ src/multicodec/core.clj
@@ -10,7 +10,7 @@
     java.nio.charset.Charset))

-(def header-charset
+(def ^java.nio.charset.Charset header-charset
   "The character set that codec headers are encoded with."
   (Charset/forName "UTF-8"))


making better use of js/ interop

making better use of js/ interop

--- src/nonaga/wrapper.cljs
+++ src/nonaga/wrapper.cljs
@@ -1,14 +1,14 @@
 (ns nonaga.wrapper)

 (defn svg [props child]
-  (.svg (.-DOM js/React) (clj->js props) (clj->js child)))
+  (js/React.DOM.svg (clj->js props) (clj->js child)))

 (defn circle [props]
-  (.circle (.-DOM js/React) (clj->js props)))
+  (js/React.DOM.circle (clj->js props)))

 (defn create-class [& {:as config}]
-  (.createClass js/React (clj->js config)))
+  (js/React.createClass (clj->js config)))

 (defn render-component [component node]
-  (.renderComponent js/React component node))
+  (js/React.renderComponent component node))


Minor :require fix

Minor :require fix

--- src/onyx/plugin/sql.clj
+++ src/onyx/plugin/sql.clj
@@ -1,7 +1,6 @@
 (ns onyx.plugin.sql
   (:require [clojure.java.jdbc :as jdbc]
             [clojure.core.async :refer [chan >! >!! <!! close! go timeout alts!! go-loop]]
-            [taoensso.timbre :refer [fatal]]
             [onyx.peer.pipeline-extensions :as p-ext]
             [onyx.types :as t]
             [onyx.static.default-vals :refer [arg-or-default]]


Remove detritus from onyx.state.core

Remove detritus from onyx.state.core

--- src/onyx/state/core.clj
+++ src/onyx/state/core.clj
@@ -23,67 +23,10 @@
                 (set-bucket id))
               sets))))

-(defn peer-log-id
+(defn peer-slot-id
   [event]
   (let [replica (:onyx.core/replica event)
         job-id (:onyx.core/job-id event)
         peer-id (:onyx.core/id event)
         task-id (:onyx.core/task-id event)]
     (get-in @replica [:task-slot-ids job-id task-id peer-id])))
-
-#_(def state-fn-calls
-  ;; allocate log-id (will be group-id in the future) and initialise state and seen buckets from logs
-  {:lifecycle/before-task-start (fn inject-state [
-                                                  lifecycle]
-                                  )
-   ;; generate new state log entries, apply them to state, and generate new segments
-   ;; only do so if the message has not been seen before
-   :lifecycle/after-batch
-   (fn apply-operations [{:keys [state/fns
-                                 state/log-id
-                                 state/log
-                                 state/seen-log
-                                 state/seen-buckets
-                                 state/state] :as event}
-                         lifecycle]
-     (let [start-time (System/currentTimeMillis)
-           _ (info "BATCH TIME: " start-time)
-           {:keys [produce-log-entries apply-log-entry produce-segments id]} fns
-           segments (map :message (mapcat :leaves (:tree (:onyx.core/results event))))
-           [state'
-            seen-buckets'
-            log-entries
-            seen-ids
-            segments'] (reduce (fn [[state seen-buckets log-entries seen-ids segments] segment]
-                                 (let [seg-id (id segment)]
-                                   (if (seen? seen-buckets seg-id)
-                                     ;; TODO: if we've seen the id again, we should possibly
-                                     ;; add it to a later bucket, as it may mean that retries
-                                     ;; are happening and we shouldn't let it expire
-                                     [state seen-buckets log-entries seen-ids segments]
-                                     (let [new-log-entries (produce-log-entries state segment)
-                                           updated-seen-buckets (apply-seen-id seen-buckets seg-id)
-                                           updated-state (reduce (fn [st entry]
-                                                                   (apply-log-entry st entry))
-                                                                 state
-                                                                 new-log-entries)
-                                           new-segments (mapcat (fn [entry]
-                                                                  (produce-segments updated-state segment entry))
-                                                                new-log-entries)]
-
-                                       (vector updated-state
-                                               updated-seen-buckets
-                                               (into log-entries new-log-entries)
-                                               (conj seen-ids seg-id)
-                                               (into segments new-segments))))))
-                               [@state @seen-buckets [] [] []]
-                               segments)]
-       (reset! state state')
-       (reset! seen-buckets seen-buckets')
-       ;; ensure these are stored in a single transaction to Kafka
-       (state-extensions/store-log-entries log event log-entries)
-       (state-extensions/store-seen-ids (seen-log log-id) event seen-ids)
-       (info "AFTER BATCH FULL: " (- (System/currentTimeMillis) start-time ))
-       ;; segments' should be sent on to next task,
-       ;; but this is too hard to do with proper acking
-       {}))})


select-and-reserve: Remove unnecessary config

--- src/overseer/worker.clj
+++ src/overseer/worker.clj
@@ -28,7 +28,7 @@
 (defn select-and-reserve
   "Attempt to select a ready job to run and reserve it, returning
    nil on failure"
-  [conn config jobs]
+  [conn jobs]
   {:pre [(not (empty? jobs))]}
   (let [job (lottery/run-lottery jobs)]
     (when (reserve-job errors/reserve-exception-handler conn job)
@@ -93,7 +93,7 @@
     (let [jobs (ready-job-entities (d/db conn) job-handlers)]
       (when-not (empty? jobs)
         (timbre/info (count jobs) "handleable job(s) found.")
-        (if-let [job (select-and-reserve conn config jobs)]
+        (if-let [job (select-and-reserve conn jobs)]
           (let [txns (run-job config conn job-handlers job)]
             @(d/transact conn txns)))))))


Updated row-button to not require zmdi for icon setting Fixed small bug in final dropdown demo

--- src/re_com/buttons.cljs
+++ src/re_com/buttons.cljs
@@ -216,15 +216,15 @@
 ;;--------------------------------------------------------------------------------------------------

 (def row-button-args-desc
-  [{:name :md-icon-name     :required true  :default "zmdi zmdi-add" :type "string"          :validate-fn string?           :description [:span "the name of the icon." [:br] "For example, " [:code "\"zmdi zmdi-add\""] " or " [:code "\"zmdi zmdi-undo\""]]}
-   {:name :on-click         :required false                          :type "-> nil"          :validate-fn fn?               :description "a function which takes no params and returns nothing. Called when the button is clicked"}
-   {:name :mouse-over-row?  :required false :default false           :type "boolean"                                        :description "true if the mouse is hovering over the row"}
-   {:name :tooltip          :required false                          :type "string | hiccup" :validate-fn string-or-hiccup? :description "what to show in the tooltip"}
-   {:name :tooltip-position :required false :default :below-center   :type "keyword"         :validate-fn position?         :description [:span "relative to this anchor. One of " position-options-list]}
-   {:name :disabled?        :required false :default false           :type "boolean"                                        :description "if true, the user can't click the button"}
-   {:name :class            :required false                          :type "string"          :validate-fn string?           :description "CSS class names, space separated"}
-   {:name :style            :required false                          :type "CSS style map"   :validate-fn css-style?        :description "CSS styles to add or override"}
-   {:name :attr             :required false                          :type "HTML attr map"   :validate-fn html-attr?        :description [:span "HTML attributes, like " [:code ":on-mouse-move"] [:br] "No " [:code ":class"] " or " [:code ":style"] "allowed"]}])
+  [{:name :md-icon-name     :required true  :default "zmdi-plus"   :type "string"          :validate-fn string?           :description [:span "the name of the icon." [:br] "For example, " [:code "\"zmdi-plus\""] " or " [:code "\"zmdi-undo\""]]}
+   {:name :on-click         :required false                        :type "-> nil"          :validate-fn fn?               :description "a function which takes no params and returns nothing. Called when the button is clicked"}
+   {:name :mouse-over-row?  :required false :default false         :type "boolean"                                        :description "true if the mouse is hovering over the row"}
+   {:name :tooltip          :required false                        :type "string | hiccup" :validate-fn string-or-hiccup? :description "what to show in the tooltip"}
+   {:name :tooltip-position :required false :default :below-center :type "keyword"         :validate-fn position?         :description [:span "relative to this anchor. One of " position-options-list]}
+   {:name :disabled?        :required false :default false         :type "boolean"                                        :description "if true, the user can't click the button"}
+   {:name :class            :required false                        :type "string"          :validate-fn string?           :description "CSS class names, space separated"}
+   {:name :style            :required false                        :type "CSS style map"   :validate-fn css-style?        :description "CSS styles to add or override"}
+   {:name :attr             :required false                        :type "HTML attr map"   :validate-fn html-attr?        :description [:span "HTML attributes, like " [:code ":on-mouse-move"] [:br] "No " [:code ":class"] " or " [:code ":style"] "allowed"]}])

 (defn row-button
   "a circular button containing a material design icon"
@@ -232,7 +232,7 @@
   (let [showing? (reagent/atom false)]
     (fn
       [& {:keys [md-icon-name on-click mouse-over-row? tooltip tooltip-position disabled? class style attr]
-          :or   {md-icon-name "zmdi zmdi-add"}
+          :or   {md-icon-name "zmdi-plus"}
           :as   args}]
       {:pre [(validate-args-macro row-button-args-desc args "row-button")]}
       (let [the-button [:div
@@ -250,7 +250,7 @@
                             {:on-mouse-over (handler-fn (reset! showing? true))
                              :on-mouse-out  (handler-fn (reset! showing? false))}) ;; Need to return true to ALLOW default events to be performed
                           attr)
-                        [:i {:class (str md-icon-name " zmdi-hc-fw-rc")}]]]
+                        [:i {:class (str "zmdi zmdi-hc-fw-rc " md-icon-name)}]]]
         (if tooltip
           [popover-tooltip
            :label    tooltip


Add arrows as firable weapons

Add arrows as firable weapons

--- src/robinson/combat.clj
+++ src/robinson/combat.clj
@@ -229,6 +229,87 @@
     [:human      :punch         :turtle     :leg]       (dg/uniform 1.5 2.5)
     [:human      :punch         :turtle     :shell]     (dg/uniform 1.5 2.1)
     [:human      :punch         :urchin     :body]      (dg/uniform 1.5 2.5)
+;; arrows
+    [:human      :shot-arrow    :bat        :body]      (dg/uniform 1.5 2.5)
+    [:human      :shot-arrow    :bat        #{:face
+                                              :head}]   (dg/uniform 1.8 2.8)
+    [:human      :shot-arrow    :bat        :leg]       (dg/uniform 1.2 1.5)
+    [:human      :shot-arrow    :bat        :wing]      (dg/uniform 1.8 2.8)
+    [:human      :shot-arrow    :bird       :beak]      (dg/uniform 1.5 2.5)
+    [:human      :shot-arrow    :bird       :body]      (dg/uniform 1.5 2.5)
+    [:human      :shot-arrow    :bird       :head]      (dg/uniform 1.5 2.5)
+    [:human      :shot-arrow    :bird       :leg]       (dg/uniform 1.5 2.0)
+    [:human      :shot-arrow    :bird       :tail]      (dg/uniform 1.5 2.5)
+    [:human      :shot-arrow    :bird       :wing]      (dg/uniform 2.5 3.5)
+    [:human      :shot-arrow    :boar       :body]      (dg/uniform 1.5 2.5)
+    [:human      :shot-arrow    :boar       :eye]       (dg/uniform 3.5 4.5)
+    [:human      :shot-arrow    :boar       :face]      (dg/uniform 1.9 2.9)
+    [:human      :shot-arrow    :boar       :head]      (dg/uniform 1.3 2.3)
+    [:human      :shot-arrow    :boar       :leg]       (dg/uniform 1.7 2.7)
+    [:human      :shot-arrow    :boar       :snout]     (dg/uniform 1.7 2.7)
+    [:human      :shot-arrow    :boar       :tail]      (dg/uniform 1.1 2.1)
+    [:human      :shot-arrow    :centipede  #{:body
+                                              :head}]   (dg/uniform 1.9 2.9)
+    [:human      :shot-arrow    :centipede  :leg]       (dg/uniform 1.1 1.5)
+    [:human      :shot-arrow    :clam       :shell]     (dg/uniform 1.5 2.5)
+    [:human      :shot-arrow    :fish       #{:body
+                                              :head}]   (dg/uniform 1.5 2.5)
+    [:human      :shot-arrow    :fish       #{:fin
+                                              :tail}]   (dg/uniform 1.5 2.1)
+    [:human      :shot-arrow    :frog       :*]         (dg/uniform 1.5 2.5)
+    [:human      :shot-arrow    :gecko      :*]         (dg/uniform 1.5 2.5)
+    [:human      :shot-arrow    :monkey     #{:arm
+                                              :leg}]    (dg/uniform 1.5 2.5)
+    [:human      :shot-arrow    :monkey     #{:body
+                                              :face
+                                              :head
+                                              :neck}]   (dg/uniform 1.5 2.5)
+    [:human      :shot-arrow    :monkey     :tail]      (dg/uniform 1.2 2.0)
+    [:human      :shot-arrow    :octopus    #{:body
+                                              :head}]   (dg/uniform 2.5 3.9)
+    [:human      :shot-arrow    :octopus    :tentacle]  (dg/uniform 1.5 2.5)
+    [:human      :shot-arrow    :parrot     #{:body
+                                              :face
+                                              :head}]   (dg/uniform 1.5 2.5)
+    [:human      :shot-arrow    :parrot     #{:leg
+                                              :tail}]   (dg/uniform 1.5 2.3)
+    [:human      :shot-arrow    :parrot     :wing]      (dg/uniform 1.8 2.8)
+    [:human      :shot-arrow    :rat        #{:body
+                                              :face
+                                              :head
+                                              :neck}]   (dg/uniform 1.5 2.5)
+    [:human      :shot-arrow    :rat        #{:leg
+                                              :tail}]   (dg/uniform 1.5 2.2)
+    [:human      :shot-arrow    :scorpion   #{:abdomen
+                                              :head
+                                              :tail}]   (dg/uniform 1.9 2.9)
+    [:human      :shot-arrow    :scorpion   #{:claw
+                                              :leg}]    (dg/uniform 1.5 2.5)
+    [:human      :shot-arrow    :sea-snake  #{:body
+                                              :head}]   (dg/uniform 1.9 2.9)
+    [:human      :shot-arrow    :shark      #{:body
+                                              :head
+                                              :nose}]   (dg/uniform 1.5 2.5)
+    [:human      :shot-arrow    :shark      #{:fin
+                                              :tail}]   (dg/uniform 1.5 2.1)
+    [:human      :shot-arrow    :snake      #{:body
+                                              :head
+                                              :tail}]   (dg/uniform 1.5 2.5)
+    [:human      :shot-arrow    :spider     #{:abdomen
+                                              :face}]   (dg/uniform 1.5 2.5)
+    [:human      :shot-arrow    :spider     #{:leg}]    (dg/uniform 1.5 2.5)
+    [:human      :shot-arrow    :squid      #{:body
+                                              :head
+                                              :tentacle}] (dg/uniform 1.5 2.5)
+    [:human      :shot-arrow    :turtle     #{:body
+                                              :face
+                                              :head
+                                              :neck}]   (dg/uniform 1.5 2.5)
+    [:human      :shot-arrow    :turtle     :leg]       (dg/uniform 1.5 2.5)
+    [:human      :shot-arrow    :turtle     :shell]     (dg/uniform 1.5 2.1)
+    [:human      :shot-arrow    :urchin     :body]      (dg/uniform 1.5 2.5)
+
+;; generic sharp weapon
     [:human      sharp-weapon?  :bat        :body]      (dg/uniform 2.5 3.5)
     [:human      sharp-weapon?  :bat        #{:face
                                               :head}]   (dg/uniform 1.9 3.8)
@@ -432,11 +513,20 @@
   (let [defender           (get-in state defender-path)
         ;;
         attacker           (get-in state attacker-path)
+        bow-wielded        (= :bow
+                              (get-in (filter (fn [item] (contains? item :wielded))
+                                               (get-in state (conj attacker-path :inventory) []))
+                                [0 :id] :non-bow))
         thrown-item        (when-not (keyword? attack)
                              attack)
-        attack             (if (keyword? attack)
+        attack             (cond
+                             (keyword? attack)
                              attack
+                             (and bow-wielded (= :arrow (get thrown-item :id)))
+                             :shot-arrow
+                             :else
                              :thrown-item)
+
         defender-body-part (dg/rand-nth (vec (get defender :body-parts)))
         {x :x y :y}        (get defender :pos)
         hp                 (get defender :hp)


Test test-create-bad-request-response-2

Test test-create-bad-request-response-2

--- test/emender_jenkins/rest_api_test.clj
+++ test/emender_jenkins/rest_api_test.clj
@@ -265,3 +265,13 @@
             {:status "error" :jobName "job-name" :command "command" :message nil}       (create-error-response "job-name" "command" nil)
             {:status "error" :jobName nil        :command nil       :message nil}       (create-error-response nil nil nil))))

+(deftest test-create-bad-request-response-2
+    "Check the function emender-jenkins.rest-api/create-bad-request-response."
+    (testing "the function emender-jenkins.rest-api/create-bad-request-response."
+        (are [x y] (= x y)
+            {:status "error" :command "command" :message "message"} (create-bad-request-response "command" "message")
+            {:status "error" :command "command" :message "message"} (create-bad-request-response "command" "message")
+            {:status "error" :command nil       :message "message"} (create-bad-request-response nil "message")
+            {:status "error" :command "command" :message nil}       (create-bad-request-response "command" nil)
+            {:status "error" :command nil       :message nil}       (create-bad-request-response nil nil))))
+


Remove removed refinement from test.

Remove removed refinement from test.

--- test/onyx/plugin/input_resume_test.clj
+++ test/onyx/plugin/input_resume_test.clj
@@ -29,7 +29,6 @@
                                     :window/type :global
                                     :window/aggregation :onyx.windowing.aggregation/conj}]
                          :triggers [{:trigger/window-id :collect-segments
-                                     :trigger/refinement :onyx.refinements/accumulating
                                      :trigger/fire-all-extents? true
                                      :trigger/id :collect-trigger
                                      :trigger/on :onyx.triggers/segment


(maint) Backport default-timeout-ms (for tests) from stable

--- test/puppetlabs/puppetdb/testutils.clj
+++ test/puppetlabs/puppetdb/testutils.clj
@@ -442,3 +442,6 @@
                              false
                              nil))]
      (f))))
+
+(def default-timeout-ms
+  (* 1000 60 5))


cleaned out some nil values in random code stress test

--- test/push/interpreter/stress_tests.clj
+++ test/push/interpreter/stress_tests.clj
@@ -52,14 +52,15 @@

 (defn bunch-a-junk
   [interpreter how-much-junk]
-  (repeatedly how-much-junk #(condp = (rand-int 10)
+  (remove nil? (repeatedly how-much-junk #(condp = (rand-int 20)
                                      0 (random-integer)
                                      1 (random-float)
                                      2 (random-boolean)
                                      3 (any-input interpreter)
                                      4 (random-char)
                                      5 (random-string)
-                                     (any-instruction interpreter))))
+                                     6 (into '() (bunch-a-junk interpreter 5))
+                                     (any-instruction interpreter)))))

 (defn random-program-interpreter
@@ -79,7 +80,7 @@

 (fact "I can create and run 1000 random programs without an exception"
   :slow :acceptance
-  (dotimes [n 10000]
+  (dotimes [n 1000]
     (let [rando (reset-interpreter (random-program-interpreter 10 200))]
       (try
         (loop [s rando]
@@ -93,4 +94,5 @@
                                  (.getMessage e)
                                  " running "
                                  (pr-str (:program rando))
+                                 "\n" (pr-str (:inputs rando))
                                  )))))))


working passe-composé

working passe-composé

--- test/babel/test/fr.clj
+++ test/babel/test/fr.clj
@@ -1,13 +1,15 @@
 (ns babel.test.fr
   (:refer-clojure :exclude [get-in])
   (:require [babel.engine :as engine]
+            [babel.forest :as forest]
             [babel.francais.writer :as fr :refer [small lexicon]]
             [babel.francais.morphology :refer [fo]]
+            [babel.over :refer [over]]
             [babel.writer :as writer]
             [clojure.string :as string]
             [clojure.test :refer :all]
             [clojure.tools.logging :as log]
-            [dag-unify.core :refer [get-in unifyc]]))
+            [dag-unify.core :refer [fail-path fail? get-in strip-refs unifyc]]))

 (deftest conditional
   (let [result (engine/generate {:synsem {:subcat '()
@@ -44,12 +46,53 @@
          (is (= "av" (get-in result [:head :français :imperfect-stem])))
          (is (= "j'avais" (fo result))))))

+(deftest être-as-aux
+  (let [result
+        (filter #(not (fail? %))
+                (map (fn [rule]
+                       (unifyc rule
+                               {:head (last (get @lexicon "être"))}))
+                     (:grammar @small)))]
+    (and (is (not (empty? result)))
+         (is (= (get-in (first result) [:rule]) "vp-aux")))))
+
+(def vp-aux (first (filter #(= (:rule %) "vp-aux")
+                           (:grammar @small))))
+
+(def etre (first (filter #(= true (get-in % [:synsem :aux]))
+                         (get @lexicon "être"))))
+
+(deftest over-test
+  (let [result
+        (over (get @fr/small :grammar)
+              (get @fr/lexicon "je")
+              (over (get @fr/small :grammar)
+                    (get @fr/lexicon "sommes") (get @fr/lexicon "aller")))]
+    (and (not (nil? result))
+         (not (empty? result))
+         (= 1 (.size result)))))
+
+
+(deftest passe-compose-1
+  (let [result
+        (forest/generate
+         {:synsem {:subcat '()
+                   :sem {:tense :passe-compose
+                         :subj {:pred :noi}
+                         :pred :andare}}}
+         (:grammar @fr/small)
+         (:lexicon @fr/small)
+         (:index @fr/small)
+         (:morph @fr/small))]
+    (and (is (not (nil? result)))
+         (is (= (fo result) "nous sommes allées")))))
+
 (deftest passe-compose
-  (let [result (engine/generate {:synsem {;:subcat '()
-                                          :sem {:pred :andare
+  (let [result (engine/generate {:synsem {:sem {:pred :andare
                                                 :tense :passe-compose
-                                                :subj {:pred :loro
+                                                :subj {:pred :noi
                                                        :gender :fem}}}}
                                 fr/small)]
     (and (is (not (nil? result)))
-         (is (= "nous sommes allées")))))
+         (is (= (fo result) "nous sommes allées")))))
+


Add test for syntax highlighting

Add test for syntax highlighting

--- test/io/perun_test.clj
+++ test/io/perun_test.clj
@@ -193,9 +193,20 @@

 This --- be _asciidoc_.")

-(def input-strings (map #(str "---\n" % "\n---\n" md-content) yamls))
-
-(def adoc-input-strings (map #(str "---\n" % "\n---\n" adoc-content) yamls))
+(defn meta-block
+  [meta]
+  (str "---\n" meta "\n---\n"))
+
+(def input-strings (map #(str (meta-block %) md-content) yamls))
+
+(def adoc-input-strings (map #(str (meta-block %) adoc-content) yamls))
+
+(def highlight-input-string
+  (str
+   (meta-block (yaml/generate-string (assoc base-meta :uuid "f948c938-3cf2-4feb-bf02-f284c2fe9665")))
+   "```scss
+@import 'bootstrap';
+```"))

 (def parsed-md-basic "
Hello there
\n
This --- be markdown.
\n")

@@ -206,6 +217,8 @@
 (def parsed-asciidoctor-adoc "
\n
This --- be asciidoc.
\n
")

 (def parsed-md-smarts "
Hello there
\n
This — be markdown.
\n")
+
+(def highlighted-md "
@import 'bootstrap';\n
")

 (def js-content "(function somejs() { console.log('$foo'); })();")

@@ -278,6 +291,15 @@
           (content-check :path (perun/url-to-path "public/2017-01-01-test.html")
                          :content parsed-md-basic
                          :msg "`markdown` should populate HTML file with parsed content"))
+
+        (add-txt-file :path "highlight-test.md" :content highlight-input-string)
+        (p/markdown)
+        (p/highlight)
+
+        (testing "highlight"
+          (content-check :path (perun/url-to-path "public/highlight-test.html")
+                         :content highlighted-md
+                         :msg "`highlight` should add Pygments syntax highlighting to HTML file"))

         (p/ttr)
         (testing "ttr"
@@ -352,13 +374,13 @@
         (p/assortment :renderer 'io.perun-test/render-assortment)
         (testing "assortment"
           (content-check :path (perun/url-to-path "public/index.html")
-                         :content "assortment 5"
+                         :content "assortment 6"
                          :msg "assortment should modify file contents"))

         (p/collection :renderer 'io.perun-test/render-collection)
         (testing "collection"
           (content-check :path (perun/url-to-path "public/index.html")
-                         :content "collection 6"
+                         :content "collection 7"
                          :msg "collection should modify file contents"))

         (p/tags :renderer 'io.perun-test/render-tags)
@@ -377,7 +399,7 @@
         (p/paginate :renderer 'io.perun-test/render-paginate)
         (testing "paginate"
           (content-check :path (perun/url-to-path "public/page-1.html")
-                         :content "paginate 9"
+                         :content "paginate 10"
                          :msg "`paginate` should write new files"))

         (p/static :renderer 'io.perun-test/render-static)


give navigation-data to all of the pages

--- frontend/controllers/navigation.cljs
+++ frontend/controllers/navigation.cljs
@@ -8,6 +8,9 @@
             [frontend.utils :as utils :refer [mlog merror]]
             [goog.string :as gstring])
   (:require-macros [frontend.utils :refer [inspect]]))
+
+;; XXX we could really use some middleware here, so that we don't forget to
+;;     assoc things in state on every handler

 ;; --- Helper Methods ---

@@ -131,10 +134,10 @@

 (defmethod navigated-to :project-settings
-  [history-imp navigation-point {:keys [project-name subpage org repo]} state]
+  [history-imp navigation-point {:keys [project-name subpage org repo] :as args} state]
   (-> state
       (assoc :navigation-point navigation-point)
-      (assoc :navigation-data {}) ;; XXX: maybe put subpage info here?
+      (assoc :navigation-data args) ;; XXX: maybe put subpage info here?
       (assoc :project-settings-subpage subpage)
       (assoc :project-settings-project-name project-name)
       (assoc-in state/crumbs-path [{:type :org


add tests for all new entity fns

add tests for all new entity fns

--- test/navigator_test.clj
+++ test/navigator_test.clj
@@ -39,6 +39,98 @@
       (is (n-tl/ensure-tx (navigator/tx-entity! (:db-conn nt-config/system) :comp comp-archived)))
       (is (= (sort comp-archived)
              (sort (into {} (navigator/get-competency (:db-conn nt-config/system) "yeep"))))))))
+
+;;queue functions
+
+(deftest task-in-test
+  (let [message {:payload
+                 {:entity
+                  {;;hmm valip won't validate a keyword...
+                   :id-sk-origin "show-evidence"
+                   :name "name"
+                   :version "v1"
+                   :description "description"}}
+                 :header
+                 {:entity-type "task" :operation "assert" :entity-id {:task-id 32}}}]
+    (testing "task-in"
+      (is (not= (navigator/task-in (:db-conn nt-config/system) message) false)))))
+
+(deftest comp-in-test
+  (let [message {:payload
+                 {:entity
+                  {:name "name"
+                   :description "description"
+                   :version "v1"
+                   :status "active"
+                   :tags "tag"}}
+                 :header
+                 {:entity-type "comp" :operation "assert" :entity-id {:comp-id 3280}}}]
+    (testing "comp-in"
+      (is (not= (navigator/comp-in (:db-conn nt-config/system) message) false)))))
+
+(deftest comp-tag-in-test
+  (let [message {:payload
+                 {:entity
+                  {:name "name"
+                   :description "description"
+                   :version "v1"
+                   :type "active"
+                   :isrequestable true
+                   :icon "http://icon-url.com"
+                   :status "active"
+                   :isfinal false
+                   :disp-ctxs "carp"
+                   :child-of "flarp"}}
+                 :header
+                 {:entity-type "comp-tag" :operation "assert"}}]
+    (testing "comp-tag-in"
+      (is (not= (navigator/comp-tag-in (:db-conn nt-config/system) message) false)))))
+
+(deftest perf-asmt-in-test
+  (let [message {:payload
+                 {:entity
+                  {:id-sk-origin "show-evidence"
+                   :name "name"
+                   :version "v1"
+                   :type "project"
+                   :duration-rating-days 35
+                   :comps "comp comp comp"
+                   :credit-value-numerator 10
+                   :credit-value-denominator 11}}
+                 :header
+                 {:entity-type "perf-asmt" :operation "assert" :entity-id {:perf-asmt-id 33}}}]
+    (testing "perf-asmt-in"
+      (is (not= (navigator/perf-asmt-in (:db-conn nt-config/system) message) false)))))
+
+(deftest user2comp-in-test
+  (let [message {:payload
+                 {:entity
+                  {:sis-user-id "234234"
+                   :comp "comp"
+                   :iscomplete true
+                   :isoverridden false
+                   :start-date "12/01/2014"
+                   :proposed-completion-date "12/01/2015"
+                   :current-score "100"
+                   :final-score "100"
+                   :score-denominator 200
+                   :score-type "numeric"
+                   :qualitative-notes "here are some notes for yah"}}
+                 :header
+                 {:entity-type "user2comp" :operation "assert"}}]
+    (testing "user2comp-in"
+      (is (not= (navigator/user2comp-in (:db-conn nt-config/system) message) false)))))
+
+(deftest user2perf-asmt-in-test
+  (let [message {:payload
+                 {:entity
+                  {:user "234234"
+                   :perf-asmt "2834"
+                   :grade true}
+                 :header
+                 {:entity-type "user2perf-asmt" :operation "assert"}}}]
+    (testing "user2perf-asmt-in"
+      (is (not= (navigator/user2perf-asmt-in (:db-conn nt-config/system) message) false)))))

 (comment
   (map #(keys (deref %))


Update CTS math for ML9

Update CTS math for ML9


Warn of potential missed test circumstance

--- test/uruk/core_test.clj
+++ test/uruk/core_test.clj
@@ -74,7 +74,7 @@
                     :quality 20
                     :repair-level :full
                     :resolve-buffer-size 20
-                    :resolve-entities true
+                    :resolve-entities true ;; TODO also test false, since we know boolean keys can be funny
                     :temporal-collection "my-temp"}]
           (= opts
              (describe-content-creation-options (content-creation-options opts)))))))


what's the reason to pass atom arg to fn

--- ext/chrome/src/cljs/owl/web/popup.cljs
+++ ext/chrome/src/cljs/owl/web/popup.cljs
@@ -17,10 +17,11 @@
 (defn save-proxy-uri [uri]
   (.setItem js/localStorage :proxy_uri uri))

-(defn switch-proxy! [s]
-  (swap! s #(bit-xor @s 1))
-  (let [id (by-id "proxy_run")]
-    (if (zero? s)
+(defn switch-proxy! []
+  (let [ps proxy-switch
+        id (by-id "proxy_run")]
+    (reset! ps (bit-xor @ps 1))
+    (if (zero? @ps)
       (set-value! id "Run ")
       (set-value! id "Stop "))))

@@ -56,7 +57,7 @@
   (when-let [uri (value (by-id "proxy_uri"))]
     (.preventDefault e.evt)
     (.stopPropagation e.evt)
-    (switch-proxy! proxy-switch)
+    (switch-proxy!)
     (if (not (zero? @proxy-switch))
       (do (save-proxy-uri uri)
           (.getSelected js/chrome.tabs
@@ -64,14 +65,13 @@
           (apply-proxy-settings! uri))
       (clear-proxy-settings!))))

-(defn on-doc-ready
-  []
+(defn on-doc-ready []
   (when-let [ready-state (.-readyState js/document)]
     (if (and (= "complete" ready-state)
              (by-id "popup"))
       (do
           (.log js/console "#popup:on-doc-ready")
-          (set-link! "options_link" "resources/public/options.html")
+          (set-link! "options_link" "options.html")
           (set-link! "echo_link" "resources/public/echo.html")
           (load-proxy-uri "http://localhost:9001")
           (ev/listen! (by-id "proxy_run") :click on-proxy-run)


slow, creaping progress. damn rl

slow, creaping progress. damn rl


remove redundant code

remove redundant code

--- boot/core/src/boot/task_helpers.clj
+++ boot/core/src/boot/task_helpers.clj
@@ -10,18 +10,6 @@
    [boot.from.me.raynes.conch :as conch]))

 (defn- first-line [s] (when s (first (string/split s #"\n"))))
-(defn- now        [ ] (System/currentTimeMillis))
-(defn- ms->s      [x] (double (/ x 1000)))
-
-(defmacro print-time [ok fail expr]
-  `(let [start# (now)]
-     (try
-       (let [end# (do ~expr (ms->s (- (now) start#)))]
-         (printf ~ok end#))
-       (catch Throwable e#
-         (let [time#  (ms->s (- (now) start#))
-               trace# (with-out-str (trace/print-cause-trace e#))]
-           (println (format ~fail trace# time#)))))))

 (defn tasks-table [tasks]
   (let [get-task  #(-> % :name str)
@@ -60,7 +48,7 @@
   (atom ()))

 ;; cleanup background tasks on shutdown
-(def add-shutdown!
+(def ^:private add-shutdown!
   (delay (pod/add-shutdown-hook! #(doseq [job @bgs] (future-cancel job)))))

 ;; Task helpers ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -81,48 +69,3 @@
   (once
     (core/with-pre-wrap
       (swap! bgs conj (future ((task identity) core/*event*))))))
-
-(defn auto
-  "Run every `msec` (default 200) milliseconds."
-  [& [msec]]
-  (fn [continue]
-    (fn [event]
-      (continue event)
-      (Thread/sleep (or msec 200))
-      (recur (core/make-event event)))))
-
-(defn files-changed?
-  [& [type fancy?]]
-  (let [ignored?  (git/make-gitignore-matcher (core/get-env :src-paths))
-        dirs      (remove core/tmpfile? (core/get-env :src-paths))
-        watchers  (map file/make-watcher dirs)
-        since     (atom 0)]
-    (fn [continue]
-      (fn [event]
-        (let [clean #(assoc %2 %1 (set (remove ignored? (get %2 %1))))
-              info  (->> (map #(%) watchers)
-                      (reduce (partial merge-with set/union))
-                      (clean :time)
-                      (clean :hash))]
-          (if-let [mods (->> (or type :time) (get info) seq)]
-            (do
-              (let [path   (file/path (first mods))
-                    ok-v   "\033[34m↳ Elapsed time: %6.3f sec ›\033[33m 00:00:00 \033[0m"
-                    ok-q   "Elapsed time: %6.3f sec\n"
-                    fail-v "\n\033[31m%s\033[0m\n\033[34m↳ Elapsed time: %6.3f sec ›\033[33m 00:00:00 \033[0m"
-                    fail-q "\n%s\nElapsed time: %6.3f sec\n"
-                    ok     (if-not fancy? ok-q ok-v)
-                    fail   (if-not fancy? fail-q fail-v)]
-                (when (not= 0 @since) (println))
-                (reset! since (:time event))
-                (print-time ok fail (continue (assoc event :watch info)))
-                (flush)))
-            (let [diff  (long (/ (- (:time event) @since) 1000))
-                  pad   (apply str (repeat 9 "\b"))
-                  s     (mod diff 60)
-                  m     (mod (long (/ diff 60)) 60)
-                  h     (mod (long (/ diff 3600)) 24)]
-              (core/sync!)
-              (when fancy?
-                (printf "\033[33m%s%02d:%02d:%02d \033[0m" pad h m s)
-                (flush)))))))))


don't think model fixing should be left for lateR

--- src/crawler/main.clj
+++ src/crawler/main.clj
@@ -193,24 +193,24 @@
           (discussion-forum-crawler (:start options)
                                     (:num-docs options))

-          (:fix-model options)
-          (let [directory (:fix-model options)
-                model-file (.getAbsolutePath
-                            (first
-                             (filter
-                              #(re-find #"\.model$" (.getAbsolutePath %))
-                              (file-seq (io/file directory)))))
-                corpus-file (.getAbsolutePath
-                             (first
-                              (filter
-                               #(re-find #"\.corpus$" (.getAbsolutePath %))
-                               (file-seq (io/file directory)))))
-
-                fixed-model
-                (crawler-model/fix-model model-file
-                                         corpus-file)]
-            (pprint fixed-model (io/writer (str (:fix-model options)
-                                                "pruned-model"))))
+          ;; (:fix-model options)
+          ;; (let [directory (:fix-model options)
+          ;;       model-file (.getAbsolutePath
+          ;;                   (first
+          ;;                    (filter
+          ;;                     #(re-find #"\.model$" (.getAbsolutePath %))
+          ;;                     (file-seq (io/file directory)))))
+          ;;       corpus-file (.getAbsolutePath
+          ;;                    (first
+          ;;                     (filter
+          ;;                      #(re-find #"\.corpus$" (.getAbsolutePath %))
+          ;;                      (file-seq (io/file directory)))))
+
+          ;;       fixed-model
+          ;;       (crawler-model/fix-model model-file
+          ;;                                corpus-file)]
+          ;;   (pprint fixed-model (io/writer (str (:fix-model options)
+          ;;                                       "pruned-model"))))

           :else
           (println "Pick one bruh"))))


Initial end-to-end demo of Derive integrated with Om

Load up Figwheel and at the browser REPL type this:
  (insert! db (assoc (db 1) :text "It's alive!"))

--- src/derive/main.cljs
+++ src/derive/main.cljs
@@ -1,5 +1,5 @@
 (ns derive.main
-  (:require-macros [derive.deps :refer [defn-derived]])
+  (:require-macros [derive.deps :refer [defn-derived with-tracked-dependencies]])
   (:require [clojure.core.reducers :as r]
             [figwheel.client :as fw :include-macros true]
             [om.core :as om :include-macros true]
@@ -77,13 +77,13 @@
        (d/sort (comparator >))
        (reduce + 0)))

-(defn derive-text
+(defn-derived derive-text
   [db id]
 ;  (let [tracker nil #_(default-tracker)]
 ;    (fn [db id]
 ;      (binding [*tracker* nil #_(tracker db [id] *tracker*)]
   (println "Computing Text")
-  (str (:text (db id))  " [" (derive-count db id) "]"))
+  (str (:text (db id))  " [" (derive-count db (inc id)) "]"))

 (defn inc-mod [modulus]
   (fn [old]
@@ -95,11 +95,14 @@
     om/IRender
     (render [_]
       (let [db (om/get-shared owner :db)]
-        (html
-         [:div
-          [:h3 "Om Application"]
-          [:p (derive-text db (inc (:current app)))]
-          [:button {:on-click #(om/transact! app :current (inc-mod 4))} "Next"]])))))
+        (with-tracked-dependencies
+          [parent result deps (deps/empty-deps db)]
+          (html
+           [:div
+            [:h3 "Om Application"]
+            [:p (derive-text db (inc (:current app)))]
+            [:button {:on-click #(om/transact! app :current (inc-mod 4))} "Next"]])
+          (deps/subscribe! db #(om/refresh! owner)))))))

 ;;
 ;; Setup and Lifecycle Management


Change the feature check to list out all old versions, instead of new ones

--- test/expound/alpha_test.cljc
+++ test/expound/alpha_test.cljc
@@ -1286,11 +1286,10 @@

 (defn spec-error-in-ex-msg? []
   #?(:cljs
-     (not (contains? #{"1.10.439"} *clojurescript-version*))
+     (contains? #{"1.10.238" "1.10.339"} *clojurescript-version*)
      :clj
-     (not (contains? #{{:major 1, :minor 10, :incremental 0, :qualifier "RC3"}
-                       {:major 1, :minor 10, :incremental 0}}
-                     *clojure-version*))))
+     (contains? #{{:major 1, :minor 9, :incremental 0, :qualifier nil}}
+                *clojure-version*)))

 (deftest test-instrument
   (st/instrument `test-instrument-adder)


Bump lein-light-nrepl

Bump lein-light-nrepl

--- lein-light-nrepl/project.clj
+++ lein-light-nrepl/project.clj
@@ -1,4 +1,4 @@
-(defproject lein-light-nrepl "0.2.0"
+(defproject lein-light-nrepl "0.3.0"
   :description "nrepl client for Light Table clj and cljs eval."
   :url "https://github.com/LightTable/Clojure/tree/master/lein-light-nrepl"
   :license {:name "Eclipse Public License"


making some utility functions public

making some utility functions public

--- src/octet/util.cljc
+++ src/octet/util.cljc
@@ -50,7 +50,7 @@
 ;;

-(defn- bytes->hex [^bytes bytes]
+(defn bytes->hex [^bytes bytes]
   "converts a byte array to a hex string"
   (let [[f & r] bytes
         fh (fn [_ b]
@@ -58,7 +58,7 @@
                (if (<= 0 b 15) (str "0" h) h)))]
     (join (reductions fh (fh 0 f) r))))

-(defn- byte->ascii [byte]
+(defn byte->ascii [byte]
   "convert a byte to 'printable' ascii where possible, otherwise ."
   (if (<= 32 (bit-and byte 0xFF) 127) (char byte) \.))


use http basic auth for github requests

use http basic auth for github requests

--- src/otto/github.clj
+++ src/otto/github.clj
@@ -13,9 +13,9 @@
   (api-base-url (format "orgs/%s/repos" (:name organization))))

 (defn- make-http-get-fn
-  [_user]
+  [user]
   (fn [url response-fn]
-    (http/get url {} response-fn)))
+    (http/get url {:basic-auth [(:name user) (:token user)]} response-fn)))

 (defn- make-response-fn
   [success-fn]


Better error-handling in case of DB errors

E.g.: Currently concurrent access to the SQLite DB caused "DB locked"
but was hidden.

Change-Id: Ia6ae36e28a2b2f3448bbb67ff68bb448d6651e0b

--- src/qcast/cache.clj
+++ src/qcast/cache.clj
@@ -33,6 +33,7 @@
     [:data          :BLOB     "NOT NULL"]))

 (defn put [item]
+  (debug "Storing" (:id item))
   (try ;; Protect against existing entries
     (->> {:id           (:id item)
           :publish_date (:publish-date item)
@@ -40,6 +41,7 @@
          pre-process
          (db/insert db-spec :presentations))
     (catch SQLException e
+      (error "SQLError:" e)
       (warn "Presentation already exists" item))))

 (defn lookup [id]


resource path

resource path

--- bot/dl.clj
+++ bot/dl.clj
@@ -10,7 +10,7 @@

 (def db-spec {:classname "org.sqlite.JDBC"
               :subprotocol "sqlite"
-              :subname "./butterfly.db"})
+              :subname ":resource:butterfly.db"})

 (defn- url-encode [url] (some-> url (java.net.URLEncoder/encode "UTF-8") (.replace "+" "%20")))


Fix fullscreen.

Fix fullscreen.

--- src/quil/applet.clj
+++ src/quil/applet.clj
@@ -113,7 +113,11 @@
   This string can be passed to native Processing methods."
   [renderer]
   (resolve-constant-key renderer renderer-modes))
-
+(defn- hide-menu-bar-if-macos []
+  (when (= PApplet/platform PApplet/MACOSX)
+    (.. (Class/forName "japplemenubar.JAppleMenuBar")
+        (getDeclaredMethod "hide" (into-array Class []))
+        (invoke nil (into-array Object [])))))

 (defn- display-size
   "Returns size of screen. If there are 2 or more screens it probably return size of
@@ -129,10 +133,7 @@
   "Checks that the size vector is exactly two elements. If not, throws
   an exception, otherwise returns the size vector unmodified."
   [size]
-  (cond (= size :fullscreen)
-        (do
-          ; (japplemenubar.JAppleMenuBar/hide) on os x???
-          (display-size))
+  (cond (= size :fullscreen) (display-size)
         (and (coll? size) (= 2 (count size))) size
         :else (throw (IllegalArgumentException.
                       (str "Invalid size definition:" size ". Was expecting :fullscreen or 2 elements vector: [x-size y-size].")))))
@@ -356,6 +357,8 @@

    :on-close       - Called once, when sketch is closed"
   [& opts]
+  (when (= :fullscreen (:size opts))
+    (hide-menu-bar-if-macos))
   (let [options           (merge {:size [500 300]
                                   :target :frame
                                   :safe-draw-fn true}
@@ -390,7 +393,8 @@
                                   :draw-fn draw-fn
                                   :renderer renderer
                                   :size size
-                                  :target-frame-rate (atom 60)}
+                                  :target-frame-rate (atom 60)
+                                  :decor decor}
                                  listeners)
         prx-obj           (quil.Applet. applet-state)]
     (doto prx-obj


Ошибки

Ошибки

--- radiolamp-6P3S/src/ixinfestor/net.cljs
+++ radiolamp-6P3S/src/ixinfestor/net.cljs
@@ -81,7 +81,7 @@
                            (catch js/Error e
                              (println "ERR -1 " e)))
                          (print-error "ERROR" ee false)
-                         (if error-fn (error-fn e)))))
+                         (when error-fn (error-fn e)))))

       (events/listen req goog.net.EventType.SUCCESS
                      (fn [e]
@@ -91,7 +91,7 @@
                          (try
                            (let [r (t/read r (.getResponseText ee))]
                              (make-reload-if-reload-client r)
-                             (success-fn r))
+                             (when success-fn (success-fn r)))
                            (catch js/Error e
                              (println (str "ERR 1 " e))
                              (print-error "ERRON IN REQUEST SUCCESS" ee false))))))
@@ -108,7 +108,7 @@
                            (set! (-> progress-element .-style .-display) "none"))

                          (println "REQUEST COMPLETE")
-                         (if complete-fn (complete-fn e)))))
+                         (when complete-fn (complete-fn e)))))


debug info

debug info

--- build.boot
+++ build.boot
@@ -43,6 +43,9 @@
         (sitemap :filename "sitemap.xml")
         (rss :title "Hashobject" :description "Hashobject blog" :link "http://blog.hashobject.com")
         (gzip :regex [#".html$" #".css$" #".js$"])
+        (show :fileset true)
+        (show :env true)
+        (show :classpath true)
         (s3-sync)))

 (deftask dev


Update slf4j-nop

Update slf4j-nop

--- build.boot
+++ build.boot
@@ -8,7 +8,7 @@
    [clj-http "3.0.0"]
    [cheshire "5.6.1"]
    [throttler "1.0.0"]
-   [org.slf4j/slf4j-nop "1.7.18"]
+   [org.slf4j/slf4j-nop "1.7.21"]
    [grimradical/clj-semver "0.3.0-20130920.191002-3" :exclusions [org.clojure/clojure]]
    ; testing
    [org.clojure/test.check "0.9.0" :scope "test"]


Squash - boot

Squash - boot

--- build.boot
+++ build.boot
@@ -6,9 +6,7 @@
          '[kr.core.kb :refer [kb]])
 (import java.io.File
         java.io.BufferedReader
-        java.io.FileReader
-        com.bigdata.rdf.sail.webapp.client.RemoteRepositoryManager
-        com.bigdata.rdf.sail.ExportKB)
+        java.io.FileReader)

 (deftask test-connection
          "test connection to a triple store"


Upgrade dependencies

Upgrade dependencies

--- build.boot
+++ build.boot
@@ -21,7 +21,7 @@
    [reloaded.repl "0.2.1" :scope "test"]

    [org.clojure/clojure "1.8.0"]
-   [org.clojure/clojurescript "1.9.14"]
+   [org.clojure/clojurescript "1.9.229"]

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

@@ -31,13 +31,13 @@
    ;; Server deps
    [aero "1.0.0-beta5"]
    [aleph "0.4.1"]
-   [bidi "2.0.9"]
+   [bidi "2.0.10"]
    [com.stuartsierra/component "0.3.1"]
    [hiccup "1.0.5"]
    [org.clojure/tools.namespace "0.2.11"]
    [prismatic/schema "1.0.4"]
    [selmer "1.0.4"]
-   [yada "1.1.28"]
+   [yada "1.1.33"]

    ;; App deps
    [reagent "0.6.0-rc"]
@@ -46,9 +46,9 @@

    ;; Logging
    [org.clojure/tools.logging "0.3.1"]
-   [org.slf4j/jcl-over-slf4j "1.7.18"]
-   [org.slf4j/jul-to-slf4j "1.7.18"]
-   [org.slf4j/log4j-over-slf4j "1.7.18"]
+   [org.slf4j/jcl-over-slf4j "1.7.21"]
+   [org.slf4j/jul-to-slf4j "1.7.21"]
+   [org.slf4j/log4j-over-slf4j "1.7.21"]
    [ch.qos.logback/logback-classic "1.1.5"
     :exclusions [org.slf4j/slf4j-api]]])


[boot]: adding logging and t.namespace

[boot]: adding logging and t.namespace

--- build.boot
+++ build.boot
@@ -17,29 +17,39 @@
                   [com.datomic/datomic-free "0.9.5327"      :scope "provided" :exclusions [joda-time]]

                   ;; boot
-                  [boot/core           "2.5.1"              :scope "provided"]
-                  [adzerk/bootlaces    "0.1.13"             :scope "test"]
-                  [adzerk/boot-test    "1.0.6"              :scope "test"]])
+                  [boot/core              "2.5.1"           :scope "provided"]
+                  [adzerk/bootlaces       "0.1.13"          :scope "test"]
+                  [adzerk/boot-logservice "1.0.1"           :scope "test"]
+                  [adzerk/boot-test       "1.0.6"           :scope "test"]])

 (require '[adzerk.bootlaces :refer :all]
-         '[adzerk.boot-test :as bt])
+         '[adzerk.boot-test :as bt]
+         '[adzerk.boot-logservice :as log-service]
+         '[clojure.tools.logging  :as log]
+         '[clojure.tools.namespace.repl :refer [set-refresh-dirs]])

 (def +version+ "0.1.7-SNAPSHOT")

 (bootlaces! +version+)

+(def log-config
+  [:configuration
+   [:appender {:name "STDOUT" :class "ch.qos.logback.core.ConsoleAppender"}
+    [:encoder [:pattern "%-5level %logger{36} - %msg%n"]]]
+   [:root {:level "TRACE"}
+    [:appender-ref {:ref "STDOUT"}]]])
+
 (deftask dev []

   (set-env! :source-paths #(conj % "dev/clj"))

-  (defn in []
-    (load-data-readers!)
-    (require 'dev)
-    (in-ns 'dev))
+  (alter-var-root #'log/*logger-factory*
+                  (constantly (log-service/make-factory log-config)))
+  (apply set-refresh-dirs (get-env :directories))
+  (load-data-readers!)

-  (comp
-    (watch)
-    (repl)))
+  (require 'dev)
+  (in-ns 'dev))

 (deftask test []
   (set-env! :source-paths #(conj % "test" "test/clj")) ;; (!) :source-paths must not overlap.


Update play-cljs template

Update play-cljs template

--- build.boot
+++ build.boot
@@ -11,7 +11,7 @@
                   [org.clojure/clojure "1.9.0-alpha14"]
                   [leiningen "2.7.0" :exclusions [leiningen.search]]
                   [ring "1.4.0"]
-                  [play-cljs/lein-template "0.10.0"]
+                  [play-cljs/lein-template "0.10.1"]
                   [eval-soup "1.2.0" :exclusions [org.clojure/core.async]]
                   [org.eclipse.jgit/org.eclipse.jgit "4.6.0.201612231935-r"]])


OK BUT FOR REAL THIS TIME

OK BUT FOR REAL THIS TIME

--- src/lazubot/core.clj
+++ src/lazubot/core.clj
@@ -1,6 +1,7 @@
 (ns lazubot.core
   (:require [clojure.java.io :as io]
             [clojure.tools.logging :refer [warn]]
+            [clojure.set :refer [difference]]
             [clojure.core.async :as async]
             [clojure-zulip.core :as zulip]
             [clojail.core :refer [sandbox]]
@@ -11,12 +12,16 @@
               (read (PushbackReader. r))))
 (def conn (zulip/connection config))
 (def bot-streams ["test-stream" "clojure" "ClojureScript Compiler"
-                  "code review" "commits" "Victory"])
+                  "code review" "Victory"])
 (def num-goroutines 10)
 (def sb (sandbox secure-tester))

 (defn ensure-subscriptions []
-  (zulip/sync* (zulip/add-subscriptions conn bot-streams)))
+  (zulip/sync* (zulip/add-subscriptions conn bot-streams))
+  (let [current-subs (set (map :name (:subscriptions (zulip/sync* (zulip/subscriptions conn)))))
+        remove-subs (difference current-subs (set bot-streams))]
+    (when (seq remove-subs)
+      (zulip/sync* (zulip/remove-subscriptions conn remove-subs)))))

 (defn respond [message reply]
   (let [str-reply (if (seq? reply) (str (seq reply)) (str reply))
@@ -68,9 +73,10 @@
              (not= (get-in message [:message :sender_email])
                    (get-in conn [:opts :username])))
     (let [content (get-in message [:message :content])
-          forms (extract-forms content)
-          reply (interpose "\n\n" (map #(str % "\n" "=> " (eval-form %)) forms))]
-      (respond message (apply str reply)))))
+          forms (extract-forms content)]
+      (when (seq forms)
+        (let [reply (interpose "\n\n" (map #(str % "\n" "=> " (eval-form %)) forms))]
+          (respond message (apply str reply)))))))

 (defn -main []
   (ensure-subscriptions)


fix ?!

fix ?!

--- src/useful/debug.clj
+++ src/useful/debug.clj
@@ -22,4 +22,4 @@
     ?!
     ([val] `(?! "/tmp/spit" ~val))
     ([file val]
-       (interrogate-form `(spit ~file :append true) val))))
+       (interrogate-form `(#(spit ~file % :append true)) val))))


Add install-default-uncaught-exception-handler!.

Installs an exception handler of last resort that will print a stack
trace.

--- src/active/clojure/condition_hooks.clj
+++ src/active/clojure/condition_hooks.clj
@@ -35,3 +35,43 @@

 (defn activate-clojure-test! []
   @activation-body)
+
+(defn root-cause
+  "Returns the initial cause of an exception or error by peeling off all of
+  its wrappers"
+  [^Throwable t]
+  (loop [cause t]
+    (if (and (instance? clojure.lang.Compiler$CompilerException cause)
+             (not= (.source ^clojure.lang.Compiler$CompilerException cause) "NO_SOURCE_FILE"))
+      (.getCause cause)) ; one level up ...
+      (if-let [cause (.getCause cause)]
+        (recur cause)
+        cause)))
+
+(defn print-stack-trace-of
+  [^Throwable exc]
+  (let [st (.getStackTrace exc)]
+    (if-let [e (first st)]
+      (clojure.stacktrace/print-trace-element e)
+      (print "[empty stack trace]"))
+    (newline)
+    (doseq [e (rest st)]
+      (print " ")
+      (clojure.stacktrace/print-trace-element e)
+      (newline))))
+
+(defn install-default-uncaught-exception-handler!
+  "Install an exception handler of last resort that will print a stack trace."
+  []
+  (Thread/setDefaultUncaughtExceptionHandler
+   (reify Thread$UncaughtExceptionHandler
+     (uncaughtException [this t e0]
+       (let [e (root-cause e0)]
+         (if (c/condition? e)
+           (do
+             (c/print-condition e *err*)
+             (.flush ^java.io.PrintWriter *err*))
+           (binding [*out* *err*]
+             (println (.getSimpleName (class e)) (.getMessage ^Exception e))
+             (print-stack-trace-of e)
+             (.flush ^java.io.PrintWriter *err*))))))))


Addd some additional whitespaces.

Addd some additional whitespaces.

--- src/clojure/buddy/auth/accessrules.clj
+++ src/clojure/buddy/auth/accessrules.clj
@@ -165,9 +165,11 @@
     (cond
       (keyword? allowed)
       (= actual allowed)
+
       (set? allowed)
       (or (empty? allowed)
           (contains? allowed actual))
+
       :else true)))

 (defn- compile-access-rule


route-params not only from last binding

route-params not only from last binding

--- src/clojure/catacumba/impl/context.clj
+++ src/clojure/catacumba/impl/context.clj
@@ -164,7 +164,7 @@
   "Return a hash-map with parameters extracted from
   routing patterns."
   [^Context ctx]
-  (into {} hp/keywordice-keys-t (.getPathTokens ctx)))
+  (into {} hp/keywordice-keys-t (.getAllPathTokens ctx)))

 (defn get-route-params
   "Return a hash-map with parameters extracted from


Add repurpose fn

Add repurpose fn

--- src/edu/berkeley/ai/domains/nav_2d.clj
+++ src/edu/berkeley/ai/domains/nav_2d.clj
@@ -18,7 +18,7 @@
   (util/assert-is (= :free (map-fn [init-x init-y])))
   (util/assert-is (= :free (map-fn [goal-x goal-y])))
   (strips/make-strips-planning-instance
-   "nav-2d"
+   "nav-2d"
    (make-nav-2d-strips-domain)
    {'xc (map #(util/symbol-cat "x" %) (range width))
     'yc (map #(util/symbol-cat "y" %) (range height))}
@@ -26,8 +26,7 @@
 	   (map (fn [x] ['left-of (util/symbol-cat "x" (dec x)) (util/symbol-cat "x" x)]) (range 1 width))
 	   (map (fn [x] ['above   (util/symbol-cat "y" (dec x)) (util/symbol-cat "y" x)]) (range 1 height))
            (for [y (range height) x (range width) :when (= :border (map-fn [x y]))]
-	     ['border (util/symbol-cat "x" x) (util/symbol-cat "y" y)])
-   	   (map (fn [x] ['above   (util/symbol-cat "y" (dec x)) (util/symbol-cat "y" x)]) (range 1 height)))
+	     ['border (util/symbol-cat "x" x) (util/symbol-cat "y" y)]))
    [['atx (util/symbol-cat "x" goal-x)] ['aty (util/symbol-cat "y" goal-y)]]
    (fn [state]
      (let [pos [(util/desymbolize (first (strips/get-strips-state-pred-val state 'atx)) 1)
@@ -41,7 +40,13 @@
 			(= (map-fn [x y]) :border)   "X"
 			(= (map-fn [x y]) :occupied) "@"
 			:else                     ".")))))))))
-
+
+(defn repurpose-nav-2d-strips-env [env [init-x init-y] [goal-x goal-y]]
+  (envs/sub-environment env
+    #{['atx (util/symbol-cat "x" init-x)] ['aty (util/symbol-cat "y" init-y)]})
+    (envs/make-conjunctive-condition #{['atx (util/symbol-cat "x" goal-x)] ['aty (util/symbol-cat "y" goal-y)]} nil))
+
+
 (comment
 (def *test-map*
   [[0 1 0 0 0 0 0 0 1 0 0]


Fix invalid args on bench / validate-params exception

--- src/engulf/formulas/http_benchmark.clj
+++ src/engulf/formulas/http_benchmark.clj
@@ -41,8 +41,7 @@
 (defn validate-params [params]
   (let [diff (cset/difference #{:url :method :concurrency} params)]
     (when (not (empty? diff))
-      (throw (Exception. "Invalid parameters! Missing keys: " diff))
-      )))
+      (throw (Exception. (str "Invalid parameters! Missing keys: " diff))))))

 (defprotocol IHttpBenchmark
   (run-repeatedly [this]))


System/identityHashCode -> hash when bootstrapping


Fix lein-auto configuraton for SCSS compilation

According to lein-auto documentation:
':paths - list of directories scanned for files. (defaults to concatenation
of
project :source-paths, :java-source-paths and :test-paths).'

None of those contain src/scss in our project.clj.

--- src/leiningen/new/chestnut/project.clj
+++ src/leiningen/new/chestnut/project.clj
@@ -104,7 +104,8 @@
   :sassc [{:src "src/scss/style.scss"
            :output-to "resources/public/css/style.css"}]

-  :auto {"sassc" {:file-pattern  #"\.(scss)$"}}
+  :auto {"sassc" {:file-pattern  #"\.(scss)$"
+                  :paths ["src/scss"]}}
 {{/sass?}}

   :profiles {:dev


Pass args in a vector

Pass args in a vector

--- src/net/sekao/nightcode/controller.clj
+++ src/net/sekao/nightcode/controller.clj
@@ -58,11 +58,12 @@
         (.show dialog)
         (future
           (try
-            (proc/start-java-process! process dir "Boot"
-              "--no-boot-script"
-              "-d" "seancorfield/boot-new:0.4.4" "new"
-              "-t" (name project-type)
-              "-n" project-name)
+            (proc/start-java-process! process dir
+              ["Boot"
+               "--no-boot-script"
+               "-d" "seancorfield/boot-new:0.4.4" "new"
+               "-t" (name project-type)
+               "-n" project-name])
             (catch Exception e (.printStackTrace e)))
           (Platform/runLater
             (fn []


Minor code formatting update.

Minor code formatting update.

--- src/open_company/resources/company.clj
+++ src/open_company/resources/company.clj
@@ -169,10 +169,10 @@

   ([company-props user slug]
   (let [props (-> company-props
-                keywordize-keys
-                (assoc :slug slug)
-                (assoc :uuid (str (java.util.UUID/randomUUID)))
-                (assoc :org-id (:org-id user)))]
+                  keywordize-keys
+                  (assoc :slug slug)
+                  (assoc :uuid (str (java.util.UUID/randomUUID)))
+                  (assoc :org-id (:org-id user)))]
     (-> props
         (update :public #(or % false))
         (update :promoted #(or % false))


Update to ClojureScript 1.9.854

Update to ClojureScript 1.9.854

--- planck-cljs/project.clj
+++ planck-cljs/project.clj
@@ -1,6 +1,6 @@
 (def clojurescript-version (or (System/getenv "CANARY_CLOJURESCRIPT_VERSION")
                                (System/getenv "CLJS_VERSION")
-                               "1.9.660"))
+                               "1.9.854"))
 (defproject planck "0.1.0"
   :profiles {:dev
              {:dependencies [[org.clojure/clojurescript ~clojurescript-version]


Fix #87: don't pass mq connection errors to handler

--- src/taoensso/carmine/message_queue.clj
+++ src/taoensso/carmine/message_queue.clj
@@ -351,11 +351,16 @@
                                         :ndry-runs       (or ndruns 0)
                                         :poll-reply      poll-reply}))

-                            (if (= poll-reply "eoq-backoff")
+                            (cond
+                              (instance? Exception poll-reply)
+                              (throw poll-reply) ; Don't pass conn errs to `handle1`
+
+                              (= poll-reply "eoq-backoff")
                               (Thread/sleep
-                               (max (wcar conn-opts (car/pttl (qk :eoq-backoff?)))
-                                    10))
-                              (handle1 conn-opts qname handler poll-reply))
+                                (max (wcar conn-opts (car/pttl (qk :eoq-backoff?)))
+                                  10))
+
+                              :else (handle1 conn-opts qname handler poll-reply))

                             (when throttle-ms (Thread/sleep throttle-ms)))
                           nil ; Successful worker loop


DM + CM - Minor refactoring for twitter workflow tests

--- test/d_cent/workflows/twitter_test.clj
+++ test/d_cent/workflows/twitter_test.clj
@@ -4,6 +4,9 @@
             [oauth.client :as oauth]))

 (def fake-request {})
+
+(defn with-verifier [request]
+  (assoc-in request [:params :oauth_verifier] "verifier"))

 ;;TODO - inject uri and token providers into workflow?

@@ -19,10 +22,9 @@
         (oauth/request-token consumer callback-url) => nil))

 (fact "Sets session username to twitter screen name"
-      (let [params {:oauth_verifier "verifier"}]
-        (twitter-callback {:params params}) => (contains {:username "screen name"})
-        (provided
-          (oauth/access-token consumer params "verifier") => {:screen_name "screen name"})) )
+      (twitter-callback (-> fake-request with-verifier)) => (contains {:username "screen name"})
+      (provided
+       (oauth/access-token consumer anything "verifier") => {:screen_name "screen name"}) )


Prepare sharing-test for schema share types

--- test/kixi/integration/sharing_test.clj
+++ test/kixi/integration/sharing_test.clj
@@ -30,10 +30,10 @@
   (base/get-metadata file-id ugroups))

 (def shares->authorised-actions
-  {[[:sharing :file-read]] [get-file]
-   [[:sharing :meta-visible]] []
-   [[:sharing :meta-read]] [get-metadata]
-   [[:sharing :meta-update]] []
+  {[[:file :sharing :file-read]] [get-file]
+   [[:file :sharing :meta-visible]] []
+   [[:file :sharing :meta-read]] [get-metadata]
+   [[:file :sharing :meta-update]] []
    ;[[:sharing :read]] []
    ;[[:sharing :use]] []
    })
@@ -50,18 +50,23 @@
    #(get shares->authorised-actions %)
    (subsets shares)))

-(defn shares->file-shares
-  [ugroup shares dload-ugroup]
+(defn shares->sharing-map
+  [type ugroup shares dload-ugroup]
   (->> shares
        (reduce
-        (fn [acc [share-area share-specific]]
-          (merge-with (partial merge-with concat)
-                      acc
-                      {share-area {share-specific [dload-ugroup]}}))
+        (fn [acc [stype share-area share-specific]]
+          (if (= type stype)
+            (merge-with (partial merge-with concat)
+                        acc
+                        {share-area {share-specific [dload-ugroup]}})
+            acc))
         {:sharing {:file-read [ugroup]
                    :meta-read [ugroup]}})
        seq
        flatten))
+
+(def shares->file-sharing-map
+  (partial shares->sharing-map :file))

 (deftest explore-sharing-level->actions
   (let [post-file (partial base/post-file-and-wait
@@ -79,7 +84,7 @@
                            :schema-id schema-id
                            :user-id upload-uid
                            :user-groups upload-ugroup
-                           (shares->file-shares upload-ugroup shares use-ugroup))]
+                           (shares->file-sharing-map upload-ugroup shares use-ugroup))]
             (when-created pfr
               (let [file-id (extract-id pfr)
                     authorised-actions (actions-for shares)


Fix assertion. Sorting could produce false positives.

--- test/onyx/log/generative_peer_join.clj
+++ test/onyx/log/generative_peer_join.clj
@@ -366,8 +366,20 @@
                                {:fn :kill-job :args {:job job-3-id}}])
        :log []
        :peer-choices []}))]
-   (is (= (sort (map count (vals (get (:allocations replica) job-1-id)))) [1 4 3]))
-   (is (= (sort (map count (vals (get (:allocations replica) job-2-id)))) [2 2 4]))
+   (is
+    (=
+     (map
+      (fn [t]
+        (count (get-in replica [:allocations job-1-id t])))
+      (get-in replica [:tasks job-1-id]))
+     [1 4 3]))
+   (is
+    (=
+     (map
+      (fn [t]
+        (count (get-in replica [:allocations job-2-id t])))
+      (get-in replica [:tasks job-2-id]))
+     [2 2 4]))
    (is (= (map count (vals (get (:allocations replica) job-3-id))) []))))

 (deftest peer-leave


fill in a rectangle each frame as validation that rendering works

--- src-cljs/hello.cljs
+++ src-cljs/hello.cljs
@@ -18,7 +18,7 @@

 (defn render [graphics-context]
   (clear-for-frame graphics-context)
-  (.log js/console "frame"))
+  (.fillRect graphics-context 10 20 200 100))

 (defn ^:export main []
   (let [graphics-context (create-canvas)]


Prevent style from leaking

Prevent style from leaking

--- src/braid/client/ui/styles/page.cljs
+++ src/braid/client/ui/styles/page.cljs
@@ -29,7 +29,7 @@
     {:padding vars/pad
      :color vars/grey-text}

-    [:.description
+    ["> .description"
      {:width vars/card-width
       ; we want description to appear above the new thread, but below other threads
       ; TODO: is there a way to make description clickable but not cover


added okta config location, which now comes from snap | fs / sg | #35

--- src/clj/conference_rating/server.clj
+++ src/clj/conference_rating/server.clj
@@ -11,7 +11,7 @@

 (defn do-wrap-okta [handler okta-active]
   (if okta-active
-    (wrap-okta handler {:okta-home "https://dev-133267-admin.oktapreview.com/"})
+    (wrap-okta handler {:okta-home "https://dev-133267-admin.oktapreview.com/" :okta-config-location "okta-ci-config.xml"})
     handler))

  (defn -main [& args]


lesson <div> - add paragraph containing frequency of lessons

for lessons which do not occur weekly

Signed-off-by: Pang Yan Han <22594c345857f664c61cd411f607c4d40a9d4af9@gmail.com>

--- src/cljs/cljs_nusmods/timetable.cljs
+++ src/cljs/cljs_nusmods/timetable.cljs
@@ -952,12 +952,17 @@
   [weekTextIdx]
   (nth WEEK-TEXT-ARRAY weekTextIdx))

+(def ^{:doc     "The string representing weekly frequency for a lesson"
+       :private true}
+  EVERY-WEEK "Every Week")
+
 (defn- create-lesson-div
   "Creates a <div> element for a new lesson using jQuery"
   [& {:keys [day moduleCode moduleName lessonType lessonGroup startTime endTime
              venue weekTextIdx slotsOcc bgColorCssClass isActuallySelected?]}]
   (let [$divElem        ($ "<div />" (js-obj "class" "lesson"))
-        $lessonTypePara (text ($ "<p />") lessonType)]
+        $lessonTypePara (text ($ "<p />") lessonType)
+        weekText        (week-text-index-to-string weekTextIdx)]
     (.addClass $divElem bgColorCssClass)
     ; add background color css class
     (.append $divElem
@@ -971,6 +976,10 @@
                    (str " [" lessonGroup "]")))
     (.append $divElem $lessonTypePara)
     (.append $divElem (text ($ "<p />" (js-obj "class" "venue")) venue))
+    (if (not= weekText EVERY-WEEK)
+        (.append $divElem
+                 (text ($ "<p />" (js-obj "class" "frequency")) weekText)))
+
     ; make the <div> less opaque for a lesson added by jQuery UI draggable
     (if (not isActuallySelected?)
         (.addClass $divElem "lesson-droppable-not-hover"))
@@ -994,8 +1003,7 @@
                      (str (nth time-helper/DAY_INTEGER_TO_STRING day)
                           " " niceStartTime " - " niceEndTime)))
       (.append $qtipContent (text ($ "<p />")
-                                  (str (week-text-index-to-string weekTextIdx)
-                                       " @ " venue)))
+                                  (str weekText " @ " venue)))
       (.qtip $divElem
              (js-obj "content"  (js-obj "text" $qtipContent)
                      "position" (js-obj "my"       "center left"


small fix

small fix

--- src/cljs/salava/badge/ui/routes.cljs
+++ src/cljs/salava/badge/ui/routes.cljs
@@ -36,5 +36,5 @@
    (str (base-path context) "/badge/mybadges") {:weight 20 :title (t :badge/Mybadges) :site-navi true :breadcrumb (t :badge/Badges " / "  :badge/Mybadges)}
    (str (base-path context) "/badge/import") {:weight 22 :title (t :badge/Import) :site-navi false :breadcrumb (t :badge/Badges " / " :badge/Import)}
    (str (base-path context) "/badge/info/\\d+") {:breadcrumb   (t :badge/Badges " / " :badge/Badgeinfo)}
-   (str (base-path context) "/badge/user/endorsements") {:weight 50 :title (t :badge/Endorsements) :breadcrumb (t :badge/Badges " / " :badge/Myendorsements) :site-navi true}})
+   (str (base-path context) "/badge/user/endorsements") {:weight 50 :title (t :badge/Myendorsements) :breadcrumb (t :badge/Badges " / " :badge/Myendorsements) :site-navi true}})


Frontend html5 validation for email field on Sign-in and Sign-up pages

--- src/cljs/todogo_cljs/components.cljs
+++ src/cljs/todogo_cljs/components.cljs
@@ -112,7 +112,7 @@
    [:h2 "Please sign in"]
    [:div {:class "form-group"}
     [:input {:class       "form-control"
-             :type        "text"
+             :type        "email"
              :placeholder "Email address"
              :value (:email user)
              :on-change   #(re-frame/dispatch
@@ -139,7 +139,7 @@
    [:h2 "Please sign in"]
    [:div {:class "form-group"}
     [:input {:class       "form-control"
-             :type        "text"
+             :type        "email"
              :placeholder "Email address"
              :value (:email user)
              :on-change   #(re-frame/dispatch


[#20] Move Datanucleus dependencies to :dev profile

- Datanucleus jars are OSGI enabled, they have a plugin system that
  requires META-INF/MANIFEST.MF and plugin.xml files to be merged
  when repackaging its content in an uberjar
- Instead of going with complex content merging, we exclude those
  jars from the uberjar and will add in the CLASSPATH when running
  the uberjar
- Those jars, when used outside an OSGI container, behave like a
  normal jar file

More info:
  - http://www.datanucleus.org/documentation/extensions/index.html
  - http://stackoverflow.com/a/10106373

--- api/project.clj
+++ api/project.clj
@@ -13,16 +13,13 @@
                  [ring-jetty-component "0.3.1"]
                  [org.akvo.flow/data-access "v1.9.15"]
                  [org.akvo/commons "0.4.2"]
+                 [javax.jdo/jdo2-api "2.3-eb"]
                  [com.google.appengine/appengine-tools-sdk "1.9.50"]
-                 [javax.jdo/jdo2-api "2.3-eb"]
-                 [org.datanucleus/datanucleus-core "1.1.5"]
                  [com.google.appengine/appengine-remote-api "1.9.50"]
                  [com.google.appengine/appengine-api-1.0-sdk "1.9.50"]
                  [com.google.appengine/appengine-jsr107cache "1.9.50"]
                  [net.sf.jsr107cache/jsr107cache "1.1"]
                  [javax.servlet/servlet-api "2.5"]
-                 [com.google.appengine.orm/datanucleus-appengine "1.0.10"]
-                 [org.datanucleus/datanucleus-jpa "1.1.5"]
                  [org.apache.geronimo.specs/geronimo-jpa_3.0_spec "1.1.1"]
                  [clj-http "2.3.0"]
                  [cheshire "5.7.0"]]
@@ -39,7 +36,10 @@
    :uberjar {:aot :all}
    :profiles/dev  {}
    :profiles/test {}
-   :project/dev   {:dependencies [[duct/generate "0.8.2"]
+   :project/dev   {:dependencies [[org.datanucleus/datanucleus-jpa "1.1.5"]
+                                  [org.datanucleus/datanucleus-core "1.1.5"]
+                                  [com.google.appengine.orm/datanucleus-appengine "1.0.10"]
+                                  [duct/generate "0.8.2"]
                                   [reloaded.repl "0.2.3"]
                                   [org.clojure/tools.namespace "0.2.11"]
                                   [org.clojure/tools.nrepl "0.2.12"]