shorten the TTL on the sql driver connection pools from 3 hours down to 1 hour.

--- src/metabase/driver/generic_sql.clj
+++ src/metabase/driver/generic_sql.clj
@@ -92,7 +92,7 @@
    (fn [spec]
      (log/debug (u/format-color 'magenta "Creating new connection pool..."))
      (kdb/connection-pool (assoc spec :minimum-pool-size 1)))
-   :ttl/threshold (* 3 60 60 1000)))
+   :ttl/threshold (* 60 60 1000)))

 (defn db->jdbc-connection-spec
   "Return a JDBC connection spec for DATABASE. Normally this will have a C3P0 pool as its datasource, unless the database is `short-lived`."


Basic text-display system

Basic text-display system

--- src/game/main_game.cljs
+++ src/game/main_game.cljs
@@ -3,7 +3,7 @@
 (defn MainGame [game]
   (let [still-frame 0
         anim-frame-rate 2
-        speed 10
+        speed 5

         dialogue-style (clj->js {:font "20px Arial"
                                  :fill "white"})
@@ -36,6 +36,8 @@
         ;; Set up input
         (set! (.. this -cursors)
               (.. game -input -keyboard (createCursorKeys)))
+        (set! (.. this -spacebar) (.. game -input -keyboard (addKey js/Phaser.Keyboard.SPACEBAR)))
+

         ;; Set up camera
         (.. this -player -anchor (setTo 0.5 0.5))
@@ -44,39 +46,57 @@

         (set! (.. this -dialogue-box -fixedToCamera) true)
         (set! (.. this -dialogue-text -fixedToCamera) true)
+        (set! (.-dialogue this) ["First" "Second" "Third" "Fourth"])
+        (set! (.. this -lastDUpdate) (.. game -time -now))
+
         )

       (update [this]
-        (cond
-          (.. this -cursors -up -isDown)
+
+        (if-let [d (seq (.-dialogue this))]
           (do
-            (let [y  (.. this -player -y)]
-              (set! (.. this -player -y)
-                    (- y speed)))
-            (.. this -player -animations (play "up")))
+            (.. this -dialogue-text (setText (first d)))
+            (when (and (.. this -spacebar -isDown)
+                       (> (- (.. game -time -now)
+                             (.. this -lastDUpdate))
+                          1000))
+              (do
+                (set! (.. this -lastDUpdate) (.. game -time -now))
+                (.. this -dialogue-text (setText ""))
+                (set! (.-dialogue this) (rest d)))))

-          (.. this -cursors -down -isDown)
-          (do
-            (let [y  (.. this -player -y)]
-              (set! (.. this -player -y)
-                    (+ y speed)))
-            (.. this -player -animations (play "down")))

-          (.. this -cursors -left -isDown)
-          (do
-            (let [x  (.. this -player -x)]
-              (set! (.. this -player -x)
-                    (- x speed)))
-            (.. this -player -animations (play "left")))
+          ;; Basic Movement
+          (cond
+            (.. this -cursors -up -isDown)
+            (do
+              (let [y  (.. this -player -y)]
+                (set! (.. this -player -y)
+                      (- y speed)))
+              (.. this -player -animations (play "up")))

-          (.. this -cursors -right -isDown)
-          (do
-            (let [x  (.. this -player -x)]
-              (set! (.. this -player -x)
-                    (+ x speed)))
-            (.. this -player -animations (play "right")))
+            (.. this -cursors -down -isDown)
+            (do
+              (let [y  (.. this -player -y)]
+                (set! (.. this -player -y)
+                      (+ y speed)))
+              (.. this -player -animations (play "down")))

-          :else (set! (.. this -player -frame) still-frame))
+            (.. this -cursors -left -isDown)
+            (do
+              (let [x  (.. this -player -x)]
+                (set! (.. this -player -x)
+                      (- x speed)))
+              (.. this -player -animations (play "left")))
+
+            (.. this -cursors -right -isDown)
+            (do
+              (let [x  (.. this -player -x)]
+                (set! (.. this -player -x)
+                      (+ x speed)))
+              (.. this -player -animations (play "right")))
+
+            :else (set! (.. this -player -frame) still-frame)))

         (.collideWorld this))


Inject alembic.still/load-project in profiles.clj

--- profiles.clj
+++ profiles.clj
@@ -67,7 +67,7 @@
                         (when (resolve 'vinyasa.inject/in)
                           (eval
                             `(~(symbol "vinyasa.inject/in")
-                              ~'[alembic.still distill lein])))]}
+                              ~'[alembic.still distill lein load-project])))]}

  :pull {:dependencies [;; Pull dependencies from Clojars in the REPL
                        [im.chit/vinyasa.maven "0.4.7"]]


+logging

+logging

--- test/babel/test/en.cljc
+++ test/babel/test/en.cljc
@@ -280,6 +280,7 @@
                                               :spec {:def :def
                                                      :pred :definite}}
                                        :tense :present}}})]
+    (log/info (str "reflexive furniture expression:" (display-expression expr)))
     (is (= (fo expr)
            "the chair is in front of itself"))))


add first english parsing test

add first english parsing test

--- test/babel/test/en.cljc
+++ test/babel/test/en.cljc
@@ -179,3 +179,5 @@
     (is (= (fo form)
            "you all were going downstairs"))))

+(deftest simple-parse
+  (is (not (empty? (parse "she sleeps")))))


add new test: 'the man's dog'

add new test: 'the man's dog'

--- test/babel/test/en.cljc
+++ test/babel/test/en.cljc
@@ -199,6 +199,10 @@
          (fo (generate {:synsem {:cat :verb :sem {:pred :be-called
                                                   :subj {:pred :lei}
                                                   :obj {:pred :luisa}}}})))))
-
-
-
+(deftest the-mans-dog
+  (is (= "the man's dog"
+         (fo (generate {:synsem {:cat :verb :sem {:pred :be-called
+                                                  :subj {:pred :lei}
+                                                  :obj {:pred :luisa}}}})))))
+
+


use model functions for login

use model functions for login

--- src/greybear/server.clj
+++ src/greybear/server.clj
@@ -6,8 +6,7 @@
         [hiccup core element page form]
         [hiccup.middleware :only [wrap-base-url]]
         [compojure.core :only [defroutes GET POST]]
-        [cemerick.friend.credentials :only [hash-bcrypt bcrypt-verify]]
-        [greybear.model :only [read-game]]))
+        [greybear.model :only [read-game verify-user-password]]))

 (defn stones-to-js
   "Transforms a string of chars into a JSON array
@@ -42,19 +41,17 @@
               [:div#password (password-field "password")]
               (submit-button "login"))]]))

-(def users
-  {"foo" (hash-bcrypt "bar")})
-
 (defn login
   [request]
   (let [creds (get request :params)]
     (if creds
       (let [{:keys [username password]} creds]
-        (if (bcrypt-verify password (users username))
+        (if (verify-user-password username password)
           ;; TODO redirect to where the user came from
           (-> (redirect-after-post "/")
               (assoc :session {:user username}))
-          {:body (html5 "Failed authentication.")}))
+          {:status 401
+           :body (html5 "Failed authentication.")}))
       {:body (html5 "no-params")})))

 (defroutes main-routes
@@ -69,4 +66,4 @@
 (def app
   (-> (handler/site main-routes)
       (wrap-session)
-      (wrap-base-url)))+      (wrap-base-url)))


Fix BigDecimal equality check, clean up reporting

--- test/transit/verify.clj
+++ test/transit/verify.clj
@@ -13,14 +13,16 @@
   directories which have a `bin/roundtrip` script. Options can be used
   to control which project is tested, which encoding to test, turn on
   generative testing and collect timing information."
-  (:require [transit.read :as r]
+  (:require [clojure.java.io :as io]
+            [clojure.walk :as walk]
+            [transit.read :as r]
             [transit.write :as w]
-            [clojure.java.io :as io]
             [transit.generators :as gen]
             [transit.corner-cases :as cc])
   (:import [java.io PrintStream ByteArrayOutputStream ByteArrayInputStream
             BufferedInputStream BufferedOutputStream FileInputStream]
-           [org.apache.commons.codec.binary Hex]))
+           [org.apache.commons.codec.binary Hex]
+           [java.math MathContext]))

 (def TIMEOUT
   "Timeout for roundtrip requests to native implementation"
@@ -114,6 +116,13 @@
   (let [f (future (r/read @(:reader proc)))]
     (deref f timeout-ms ::timeout)))

+(defn equalize [data]
+  (walk/prewalk (fn [node]
+                  (if (instance? java.math.BigDecimal node)
+                    (.stripTrailingZeros node)
+                    node))
+                data))
+
 (defn roundtrip-transit
   "Given a process, a byte array of transit data and an encoding,
   roundtrip the transit data and return a map of test results. Throws
@@ -121,19 +130,22 @@
   map contains the expected and actual Clojure data and the test
   status: one of `:error` or `:success`."
   [proc transit-out encoding]
-  (write-to-stream proc transit-out)
-  (let [data-in (read-response proc TIMEOUT)
-        data-out (read-transit transit-out encoding)]
-    (if (= data-in ::timeout)
-      (throw (ex-info "Response timeout" {:status :timeout :p proc :transit transit-out}))
-      {:transit-expected (String. transit-out)
-       :data-expected data-out
-       :data-actual data-in
-       ;; only checks the top level type
-       :status (if (and (= (type data-out) (type data-in))
-                        (= data-out data-in))
-                 :success
-                 :error)})))
+  (let [start (System/nanoTime)]
+    (write-to-stream proc transit-out)
+    (let [data-in (read-response proc TIMEOUT)
+          end (System/nanoTime)
+          data-out (read-transit transit-out encoding)]
+      (if (= data-in ::timeout)
+        (throw (ex-info "Response timeout" {:status :timeout :p proc :transit transit-out}))
+        {:transit-expected (String. transit-out)
+         :data-expected data-out
+         :data-actual data-in
+         :nano-time (- end start)
+         ;; only checks the top level type
+         :status (if (and (= (type data-out) (type data-in))
+                          (= (equalize data-out) (equalize data-in)))
+                   :success
+                   :error)}))))

 (defn roundtrip-edn
   "Given a process, an EDN form and an encoding, roundtrip the EDN
@@ -167,9 +179,9 @@
   [transits proc encoding]
   (dotimes [x 200]
     (mapv #(roundtrip-transit proc % encoding) transits))
-  (let [start (System/nanoTime)]
-    (mapv #(roundtrip-transit proc % encoding) transits)
-    (quot (- (System/nanoTime) start) 1000000)))
+  (quot (reduce + (map :nano-time
+                       (mapv #(roundtrip-transit proc % encoding) transits)))
+        1000000))

 (def extension {:json ".json"
                 :msgpack ".mp"})
@@ -194,24 +206,29 @@
     (filter #((:pred %) proc encoding opts)
             [{:pred (constantly true)
               :desc "exemplar file"
+              :input transit-exemplars
               :path [:tests :exemplar-file]
-              :test #(test-transit transit-exemplars proc encoding)}
+              :test #(test-transit % proc encoding)}
              {:pred (constantly true)
               :desc "EDN corner case"
+              :input cc/forms
               :path [:tests :corner-case-edn]
-              :test #(test-edn cc/forms proc encoding)}
+              :test #(test-edn % proc encoding)}
              {:pred (fn [_ e _] (= e :json))
               :desc "JSON transit corner case"
+              :input (map (fn [s] (.getBytes s)) cc/transit-json)
               :path [:tests :corner-case-transit-json]
-              :test #(test-transit (map (fn [s] (.getBytes s)) cc/transit-json) proc encoding)}
+              :test #(test-transit % proc encoding)}
              {:pred (fn [_ _ o] (:gen o))
               :desc "generated EDN"
+              :input (:generated-forms opts)
               :path [:tests :generated-edn]
-              :test #(test-edn (:generated-forms opts) proc encoding)}
+              :test #(test-edn % proc encoding)}
              {:pred (fn [_ _ o] (:time o))
               :desc "timing"
+              :input transit-exemplars
               :path [:time]
-              :test #(let [ms (test-timing transit-exemplars proc encoding)]
+              :test #(let [ms (test-timing % proc encoding)]
                        {:ms ms
                         :count (count transit-exemplars)
                         :encoding encoding})}])))
@@ -233,11 +250,11 @@
                  :encoding encoding}]
     (try
       (let [tests (filter-tests proc encoding opts)
-            results (reduce (fn [r {:keys [path test desc]}]
+            results (reduce (fn [r {:keys [path test desc input]}]
                               (println (format "running \"%s\" test for %s encoding..."
                                                desc
                                                (name encoding)))
-                              (assoc-in r path (test)))
+                              (assoc-in r path (test input)))
                             results
                             tests)]
         (stop-process proc)
@@ -255,12 +272,14 @@
   (println (format "testing %s's %s encoding"
                    project
                    (name encoding)))
-  (let [command (str "../" project "/bin/roundtrip")]
-    (report (-> (verify-impl-encoding command encoding opts)
-                (assoc :project project))
-            opts)))
-
-(defn verify-impl
+  (if (= encoding :msgpack)
+    (println "msgpack tests are disabled until we have a working implementation.")
+    (let [command (str "../" project "/bin/roundtrip")]
+      (report (-> (verify-impl-encoding command encoding opts)
+                  (assoc :project project))
+              opts))))
+
+  (defn verify-impl
   "Given a project name like 'transit-java', 'transit-clj' or
   'transit-ruby', and user provided options, run tests for each
   encoding specified in the options. Encoding can be either `:json` or
@@ -320,20 +339,61 @@
       (str \u001b (style styles) s \u001b (:reset styles))
       s)))

-(defn timeout-result? [results]
-  (when-let [e (:exception results)]
-    (= (:status (ex-data e)) :timeout)))
-
-(defn exception-result? [results]
-  (:exception results))
-
-(defn not-implemented? [results]
-  (every? #(= (:data-actual %) ::read-error) (apply concat (vals (:tests results)))))
-
-;; TODO: when there is an exception, print out the form that was being
-;; transmitted
-;; TODO: would be nice if we could do the same thing we do with
-;; timeouts and show the previous thing as well
+(defn result-type [results]
+  (cond (= (:status (ex-data (:exception results))) :timeout)
+        :timeout
+        (= (:status (ex-data (:exception results))) :disconnected)
+        :disconnected
+        (:exception results)
+        :exception
+        (every? #(= (:data-actual %) ::read-error) (apply concat (vals (:tests results))))
+        :not-implemented))
+
+(defmulti print-report (fn [results opts] (result-type results)))
+
+(defmethod print-report :timeout [results opts]
+  (let [timeout-form (-> results :exception ex-data :edn)
+        [prev curr] (first (filter #(= (last %) timeout-form)
+                                   ;; TODO: timeout could occur
+                                   ;; in other kinds of tests
+                                   (partition 2 1 (:generated-forms opts))))]
+    (println (with-style :red "Response Timeout"))
+    (println (with-style :red "Timeout while processing:"))
+    (println (pr-str timeout-form))
+    (println (with-style :red "Previous form was:"))
+    (println (pr-str prev))))
+
+(defmethod print-report :disconnected [results opts]
+  (let [error-form (-> results :exception ex-data :transit)]
+    (println (with-style :red "Implementation Disconnected"))
+    (println (with-style :red "Disconnect when sending:"))
+    (println (pr-str (String. error-form)))))
+
+(defmethod print-report :exception [results opts]
+  (do (println results)
+      (.printStackTrace (:exception results))))
+
+(defmethod print-report :not-implemented [results opts]
+  (println (with-style :red "Not Implemented")))
+
+(defmethod print-report :default [results opts]
+  ;; TODO: need to do something better for printing transit data
+  ;; (when bytes)
+  (doseq [[k v] (:tests results)]
+    (let [errors (filter #(= (:status %) :error) v)
+          ecnt (count errors)
+          pcnt (- (count v) ecnt)
+          style (if (pos? ecnt) :red :green)]
+      (println (with-style style (format "Testing with %s %s inputs"
+                                         (count v) k)))
+      (println (with-style style (format "Summary: passed: %s, errors: %s"
+                                         pcnt ecnt)))
+      (when (pos? ecnt)
+        (do (doseq [error errors]
+              (println "Sent Transit:" (pr-str (:transit-expected error)))
+              (println "Expected:    " (pr-str (:data-expected error)))
+              (println "Actual:      " (pr-str (:data-actual error)))))))))
+
 (defn report [{:keys [project command encoding tests time] :as results} opts]
   (println (with-style :bright "Project: " project))
   (println "Command: " command)
@@ -344,34 +404,41 @@
                        (:ms time)
                        (:count time)
                        (name (:encoding time))))))
-  (cond (timeout-result? results)
-        (let [timeout-form (-> results :exception ex-data :edn)
-              [prev curr] (first (filter #(= (last %) timeout-form)
-                                         (partition 2 1 (:generated-forms opts))))]
-          (println (with-style :red "Response Timeout"))
-          (println (with-style :red "Timeout while processing:"))
-          (println (pr-str timeout-form))
-          (println (with-style :red "Previous form was:"))
-          (println (pr-str prev)))
-        (exception-result? results)
-        (do (println results)
-            (.printStackTrace (:exception results)))
-        (not-implemented? results)
-        (println (with-style :red "Not Implemented"))
-        :else
-        ;; TODO: need to do something better for printing transit data
-        ;; (when bytes)
-        (doseq [[k v] tests]
-          (let [errors (filter #(= (:status %) :error) v)
-                ecnt (count errors)
-                pcnt (- (count v) ecnt)
-                style (if (pos? ecnt) :red :green)]
-            (println (with-style style (format "Testing with %s %s inputs"
-                                               (count v) k)))
-            (println (with-style style (format "Summary: passed: %s, errors: %s"
-                                               pcnt ecnt)))
-            (when (pos? ecnt)
-              (do (doseq [error errors]
-                    (println "Sent Transit:" (pr-str (:transit-expected error)))
-                    (println "Expected:    " (pr-str (:data-expected error)))
-                    (println "Actual:      " (pr-str (:data-actual error))))))))))
+  (print-report results opts))
+
+(comment ;; example of problem with msgpack
+
+  (defn start-process  [command encoding]
+    (let [p (.start (ProcessBuilder. [command (name encoding)]))
+          out (BufferedOutputStream. (.getOutputStream p))
+          in (BufferedInputStream. (.getInputStream p))]
+      {:out out :p p :in in}))
+
+  (defn stop-process [proc]
+    (.write (:out proc) 3) ;; send Ctrl+C
+    (.flush (:out proc))
+    (.destroy (:p proc)))
+
+  (defn write-to-stream [proc transit-data]
+    (println "Send bytes:")
+    (println (count transit-data))
+    (println (Hex/encodeHexString transit-data))
+    (.write (:out proc) transit-data 0 (count transit-data))
+    (.flush (:out proc)))
+
+  (defn read-response [proc]
+    (println (.read (:in proc))))
+
+  ;; works
+  (def p (start-process "../transit-ruby/bin/roundtrip" :json))
+  (write-to-stream p (.getBytes "{\"~#'\":42}"))
+  (read-response p)
+  (stop-process p)
+
+  ;; doesn't work
+  (def p (start-process "../transit-ruby/bin/roundtrip" :msgpack))
+  (write-to-stream p (.getBytes "{\"~#'\":42}"))
+  (read-response p)
+  (stop-process p)
+
+)


Removed suplicate key: :javac-options

Removed suplicate key: :javac-options

Building storm causes errors due to a duplicate `:javac-options`
entries in the `storm-core/project.clj`.
```
Caused by: java.lang.IllegalArgumentException: Duplicate key:
:javac-options
```
I have merged the `:javac-options` into a single entry.

--- storm-core/project.clj
+++ storm-core/project.clj
@@ -49,7 +49,7 @@
   :test-paths ["test/clj"]
   :resource-paths ["../conf"]
   :target-path "target"
-  :javac-options ["-target" "1.6" "-source" "1.6"]
+  :javac-options ["-target" "1.6" "-source" "1.6" "-g"]
   :profiles {:dev {:resource-paths ["src/dev"]
                    :dependencies [[org.mockito/mockito-all "1.9.5"]]}
              :release {}
@@ -61,7 +61,6 @@
   :repositories {"sonatype"
                  "http://oss.sonatype.org/content/groups/public/"}

-  :javac-options ["-g"]
   :jvm-opts ["-Djava.library.path=/usr/local/lib:/opt/local/lib:/usr/lib"]

   :aot :all)


Improve data query by applying "where" sooner.

--- src/cavm/h2.clj
+++ src/cavm/h2.clj
@@ -900,14 +900,24 @@
 (defn- col-arrays [columns n]
   (zipmap columns (repeatedly (partial float-array n))))

-(def probe-query
+; Replaced this with the query below, which applies the bin id filter
+; earlier.
+(comment (def probe-query
   "SELECT  gene, i, expscores from
      (SELECT  `probes`.`name` as `gene`, `probes`.`id`  FROM `probes`
        INNER JOIN TABLE(name varchar=?) T ON T.`name`=`probes`.`name`
        WHERE (`probes`.`eid` = ?)) P
    LEFT JOIN `joins` on P.id = `joins`.`pid`
    LEFT JOIN `scores` ON `sid` = `scores`.`id`
-   WHERE `joins`.`i` in (%s)")
+   WHERE `joins`.`i` in (%s)"))
+
+(def probe-query
+  "SELECT  gene, i, expscores from
+     (SELECT * FROM (SELECT  `probes`.`name` as `gene`, `probes`.`id`  FROM `probes`
+       INNER JOIN TABLE(name varchar=?) T ON T.`name`=`probes`.`name`
+       WHERE (`probes`.`eid` = ?)) P
+   LEFT JOIN `joins` on P.id = `joins`.`pid` WHERE `joins`.`i` in (%s))
+   LEFT JOIN `scores` ON `sid` = `scores`.`id`")

 (defn select-scores-full [eid columns bins]
   (let [q (format probe-query


Require rhizome.viz only if needed.

Require rhizome.viz only if needed.

--- src/leiningen/dolly.clj
+++ src/leiningen/dolly.clj
@@ -4,7 +4,6 @@
             [clojure.set :as set]
             [clojure.java.io :as io]
             [rhizome.dot :as dot]
-            [rhizome.viz :as viz]
             [dolly.namespace :as ns]))

@@ -164,17 +163,33 @@
             ns-info (ns/namespaces-in-dirs ns-opts)
             _ (handle-errwarn ns-info)
             graph-args (ns/ns-info->graph-args ns-info)]
-        (case (:format ns-info)
-          (nil :text) (do
-                        (println "Dependencies:")
-                        (ns/print-ns-deps-text ns-info))
-          :dot (spit "nsdeps.dot" (apply dot/graph->dot graph-args))
-          :svg (spit "nsdeps.svg" (apply viz/graph->svg graph-args))
-          :png (viz/save-image (apply viz/graph->image graph-args)
-                                "nsdeps.png")
-          :window (do
-                    (apply viz/view-graph graph-args)
-                    (read-line))))
+        (if (contains? #{:nil :text :dot} (:format ns-info))
+          ;; Then don't require rhizome.viz, since by default it pops
+          ;; up another JVM GUI-related icon in the doc on Mac OS X.
+          (case (:format ns-info)
+            (nil :text) (do
+                          (println "Dependencies:")
+                          (ns/print-ns-deps-text ns-info))
+            :dot (spit "nsdeps.dot" (apply dot/graph->dot graph-args)))
+          (do
+            (require 'rhizome.viz)
+            (let [graph->svg (ns-resolve 'rhizome.viz 'graph->svg)
+                  graph->image (ns-resolve 'rhizome.viz 'graph->image)
+                  save-image (ns-resolve 'rhizome.viz 'save-image)
+                  view-graph (ns-resolve 'rhizome.viz 'view-graph)]
+              (case (:format ns-info)
+                :svg (spit "nsdeps.svg" (apply graph->svg graph-args))
+                :png (save-image (apply graph->image graph-args)
+                                 "nsdeps.png")
+                :window (do
+                          (apply view-graph graph-args)
+                          ;; TBD: If I don't do something to delay the
+                          ;; program exiting here, the window is shown
+                          ;; but then is closed immediately.  Is there a
+                          ;; way to make this program end only when
+                          ;; someone closes the new window?
+                          (println "Delaying quitting until you press return, otherwise the new window will close:")
+                          (read-line)))))))

       ("ls" "list-clones")
       (println "list-clones not implemented yet")


using only needed parameters

using only needed parameters

otherwise, division by zero error conditions would have to be caught

--- Clojure-Websockets/MainApp/src/cljs/birdwatch/stats/regression.cljs
+++ Clojure-Websockets/MainApp/src/cljs/birdwatch/stats/regression.cljs
@@ -20,7 +20,5 @@
             slope (/ Lxy Lxx)
             intercept (- y-bar (* slope x-bar))
             reg-ss (* slope Lxy)
-            res-ms (/ (- Lyy reg-ss) (- n 2))
-            r (/ Lxy (Math/sqrt (* Lxx Lyy)))
-            r2 (/ reg-ss Lyy)]
-        [intercept slope r r2]))))
+            res-ms (/ (- Lyy reg-ss) (- n 2))]
+        [intercept slope]))))


fix issue with ICE install cost

fix issue with ICE install cost

--- src/node/game/core.cljs
+++ src/node/game/core.cljs
@@ -252,13 +252,12 @@
               [:servers :remote (-> (split server " ") last js/parseInt)])
         card-type (:type card)
         slot (case card-type
-               "ICE" :ices
-               "Upgrade" :upgrades
-               ("Agenda" "Asset") :content)
-        cost (if (= card-type "ICE") [:credit (count (get-in @state (cons :corp dest)))])]
+               "ICE" (conj dest :ices)
+               ("Agenda" "Asset" "Upgrade") (conj dest :content))
+        cost (if (= card-type "ICE") [:credit (count (get-in @state (cons :corp slot)))])]
     (when (apply pay (concat [state side :click 1] cost))
       (system-msg state side (str "installs a" (if (= card-type "ICE") "n ICE" " card") " in " server))
-      (move state side card (conj dest slot)))))
+      (move state side card slot))))

 (defn play [state side {:keys [card server]}]
   (case (:type card)


Change to new API.

Change to new API.

--- src/onyx/plugin/sql.clj
+++ src/onyx/plugin/sql.clj
@@ -24,7 +24,7 @@

 (defmethod p-ext/inject-pipeline-resources
   :sql/load-rows
-  [{:keys [task-map] :as pipeline}]
+  [_ {:keys [task-map] :as pipeline}]
   {:params [(task->pool task-map)]})

 (defmethod p-ext/apply-fn [:input :sql]


back to a smoothed poisson distribution

back to a smoothed poisson distribution

--- src/paulkrake/goals.clj
+++ src/paulkrake/goals.clj
@@ -11,7 +11,8 @@
   "Maps number-of-goals to a score value from [0 1]. The mean of goals per game is 1.36"
   [goals]
   (let [goals-as-number (if (number? goals) goals (Integer/valueOf goals))]
-    (d/cdf (d/normal-distribution 1.36 (Math/sqrt 0.5)) goals-as-number)))
+    (d/cdf (d/poisson-distribution (* 2  1.36) ) (* 2 goals-as-number)) ;; * 2 to smooth the poisson distribution
+    ))

 (defn score-to-goals-fn [score]
   (as-> (range -1 100) x
@@ -59,6 +60,6 @@
              (map (fn [[ h g]]
                     (let [[_ _ [shots-hmin shots-hmax] [shots-gmin shots-gmax]] (p/predict-single-game shots-data h g faktor-sigma shots/score-to-shots-fn)
                           [_ _ [gps-hmin gps-hmax] [gps-gmin gps-gmax]] (p/predict-single-game gps-data h g faktor-sigma gps/score-to-gps-fn)]
-                      [h g [(* shots-hmin gps-hmin 1/100) (* shots-hmax gps-hmax 1/100)] [(* shots-gmin gps-gmin 1/100) (* shots-gmax gps-gmax 1/100)] ])) x)
+                      [h g [(* shots-hmin gps-hmin 1) (* shots-hmax gps-hmax 1)] [(* shots-gmin gps-gmin 1) (* shots-gmax gps-gmax 1)] ])) x)
              (map (fn [[h g [hmin hmax] [gmin gmax]]] (format "%24s - %24s   [%.2f - %.2f] : [%.2f - %.2f]" h g hmin hmax gmin gmax)) x))
        )))


Split args in ProcessBuilder invocation

Split args in ProcessBuilder invocation

Fixes #63

--- src/postal/sendmail.clj
+++ src/postal/sendmail.clj
@@ -69,7 +69,7 @@
   ([msg sendmail]
       (let [mail (sanitize (message->str msg))
             cmd (concat
-                 [sendmail (format "-f %s" (sender msg))]
+                 [sendmail "-f" (sender msg)]
                  (recipients msg))
             pb (ProcessBuilder. cmd)
             p (.start pb)


Fix invokeinterface when no iface argument is provided.

--- src/insn/op.clj
+++ src/insn/op.clj
@@ -184,7 +184,7 @@
   The last argument `iface` can be used to specify the method's owner
   class is an interface (e.g., a default implementation)."
   ([v cls mname] (&fn v cls mname -1))
-  ([v cls mname desc-or-arity] (&fn v cls mname desc-or-arity false))
+  ([v cls mname desc-or-arity] (&fn v cls mname desc-or-arity (= &op Opcodes/INVOKEINTERFACE)))
   ([v cls mname desc-or-arity iface]
    (let [mname (util/method-name mname)
          desc (if (number? desc-or-arity)


Semantic semver sorting

Semantic semver sorting

--- src/sinon_docs/core.clj
+++ src/sinon_docs/core.clj
@@ -23,6 +23,9 @@
 (defn to-html [s]
   (md/to-html s pegdown-options))

+(defn api-version [file]
+  (mapv read-string (str/split (:version file) #"\.")))
+
 (defn releases []
   (->> "resources/public/releases"
        clojure.java.io/file
@@ -30,7 +33,7 @@
        (filter #(re-find #"sinon-\d\.\d+\.\d+" (.getPath %)))
        (map #(let [matches (re-find #"(\d\.\d+\.\d+), (\d\d\d\d.\d\d.\d\d)" (slurp %))]
                {:version (nth matches 1) :date (nth matches 2) :file (.getPath %)}))
-       (sort-by :version)
+       (sort-by api-version)
        reverse))

 (def get-releases (memoize releases))


db/notify!: Use shared lock.

db/notify!: Use shared lock.

--- src/pepa/db.clj
+++ src/pepa/db.clj
@@ -72,7 +72,7 @@
   (make-advisory-lock-query-fn "pg_advisory_xact_lock_shared"))

 (defn notify! [db topic]
-  (advisory-xact-lock! db topic)
+  (advisory-xact-lock-shared! db topic)
   (bus/notify! (:bus db) topic))

 ;;; Extend namespaced keywords to map to PostgreSQL enums


Quick TODO note.

Quick TODO note.

--- src/dragon/util.clj
+++ src/dragon/util.clj
@@ -176,6 +176,7 @@
 (defn component->system
   ""
   [system-or-component]
+  ;; XXX we need to change this to support any component
   (if (contains? system-or-component :event)
     system-or-component
     {:event system-or-component}))


CMR-5322: Fixed granule validate end point not returning path errors when collection is invalid.

--- ingest-app/src/cmr/ingest/services/messages.clj
+++ ingest-app/src/cmr/ingest/services/messages.clj
@@ -1,7 +1,8 @@
 (ns cmr.ingest.services.messages
-  (:require [cmr.common.util :as util]
-            [cmr.common.validations.core :as vc]
-            [clojure.string :as str]))
+  (:require
+   [clojure.string :as string]
+   [cmr.common.util :as util]
+   [cmr.common.validations.core :as vc]))

 (defn parent-collection-does-not-exist
   [provider-id granule-ur collection-ref]
@@ -9,14 +10,14 @@
         coll-ref-humanized-fields (for [[field value] collection-ref-fields]
                                     (format "%s [%s]" (vc/humanize-field field) value))]
     (format "Collection with %s referenced in granule [%s] provider [%s] does not exist."
-            (str/join ", " coll-ref-humanized-fields)
+            (string/join ", " coll-ref-humanized-fields)
             granule-ur provider-id)))

 (defn invalid-multipart-params
   [expected-params actual-params]
   (format "Unexpected multipart parameters: [%s]. Expected the multipart parameters [%s]."
-          (str/join ", " actual-params)
-          (str/join ", " expected-params)))
+          (string/join ", " actual-params)
+          (string/join ", " expected-params)))

 (defn invalid-revision-id
   [revision-id]
@@ -24,7 +25,8 @@

 (defn invalid-parent-collection-for-validation
   [collection-validation-error]
-  (str "The collection given for validating the granule was invalid: " collection-validation-error))
+  (str "The collection given for validating the granule was invalid: "
+       (pr-str collection-validation-error)))

 (defn platform-not-matches-kms-keywords
   [platform]
@@ -76,9 +78,9 @@
                               attribute-order)]
     (case (count human-id-values)
       1 (first human-id-values)
-      2 (str/join " and " human-id-values)
+      2 (string/join " and " human-id-values)
       ;; else
-      (str (str/join ", " (drop-last human-id-values)) ", and " (last human-id-values)))))
+      (str (string/join ", " (drop-last human-id-values)) ", and " (last human-id-values)))))

 (defn science-keyword-not-matches-kms-keywords
   "Create the invalid science keyword message"


use Date/Time from Exif when no GPS date and time

--- iwaswhere-web/src/clj/iwaswhere_web/imports.clj
+++ iwaswhere-web/src/clj/iwaswhere_web/imports.clj
@@ -4,7 +4,8 @@
             [iwaswhere-web.files :as f]
             [clj-time.coerce :as c]
             [me.raynes.fs :as fs]
-            [clj-time.format :as tf])
+            [clj-time.format :as tf]
+            [clojure.tools.logging :as log])
   (:import [com.drew.imaging ImageMetadataReader]))

 (defn dms-to-dd
@@ -24,14 +25,13 @@
           dd)))))

 (defn extract-ts
-  "Converts GPS timestamp strings into milliseconds since epoch.
+  "Converts concatenated GPS timestamp strings into milliseconds since epoch.
   Example from iPhone 6s camera app:
     'GPS Date Stamp' '2016:03:30'
     'GPS Time-Stamp' '20:07:57.00 UTC'"
-  [d t]
-  (let [f (tf/formatter "yyyy:MM:dd HH:mm:ss.SS z")
-        dt (tf/parse f (str d " " t))]
-    (c/to-long dt)))
+  [ts]
+  (let [f (tf/formatter "yyyy:MM:dd HH:mm:ss.SS z")]
+    (c/to-long (tf/parse f ts))))

 (defn extract-from-tag
   "Creates map for a single Exif directory.
@@ -53,25 +53,29 @@
         lon-ref (get raw-exif "GPS Longitude Ref")
         gps-date (get raw-exif "GPS Date Stamp")
         gps-time (get raw-exif "GPS Time-Stamp")]
-        {:raw-exif raw-exif
-         :timestamp (extract-ts gps-date gps-time)
-         :latitude (dms-to-dd lat-dms lat-ref)
-         :longitude (dms-to-dd lon-dms lon-ref)}))
+    {:raw-exif  raw-exif
+     :timestamp (if gps-date
+                  (extract-ts (str gps-date " " gps-time))
+                  ;; workaround since EXIF editor doesn't add timezone
+                  (extract-ts (str (get raw-exif "Date/Time") ".00 UTC")))
+     :latitude  (dms-to-dd lat-dms lat-ref)
+     :longitude (dms-to-dd lon-dms lon-ref)}))

 (defn import-photos
   "Imports photos from respective directory."
   [{:keys [put-fn]}]
-    (let [files (file-seq (clojure.java.io/file "data/image-import"))]
-      (doseq [img (f/filter-by-name files #"[A-Za-z0-9_]+.jpg")]
-        (let [filename (.getName img)
-              rel-path (.getPath img)
-              file-info (exif-for-file img)
-              target-filename (str (:timestamp file-info) "-" filename)
-              new-entry (merge file-info
-                               {:img-file target-filename
-                                :tags ["#photo"]})]
-          (fs/rename rel-path (str "data/images/" target-filename))
-          (put-fn [:geo-entry/persist new-entry])))))
+  (let [files (file-seq (clojure.java.io/file "data/image-import"))]
+    (doseq [img (f/filter-by-name files #"[A-Za-z0-9_]+.jpg")]
+      (let [filename (.getName img)]
+        (try (let [rel-path (.getPath img)
+                   file-info (exif-for-file img)
+                   target-filename (str (:timestamp file-info) "-" filename)
+                   new-entry (merge file-info
+                                    {:img-file target-filename
+                                     :tags     ["#photo"]})]
+               (fs/rename rel-path (str "data/images/" target-filename))
+               (put-fn [:geo-entry/persist new-entry]))
+             (catch Exception ex (log/error (str "Error while importing " filename) ex)))))))

 (defn cmp-map
   [cmp-id]


* clojure/arrays: missed a reflection (doesn't matter)

--- clojure/arrays.clj
+++ clojure/arrays.clj
@@ -56,7 +56,7 @@
                   (do
                     (vswap! arrays assoc! ai a)
                     (vswap! free pop)
-                    (B ai))
+                    (B (int ai)))
                   (do
                     (B (count @arrays))
                     (vswap! arrays conj! a)))))


Add nrepl-port option to cli.

Add nrepl-port option to cli.

--- src/incise/core.clj
+++ src/incise/core.clj
@@ -21,13 +21,18 @@
    ["-c" "--config CONFIG_FILE"
     "The path to an edn file acting as configuration for incise"]
    ["-p" "--port PORT" "The port number to run the development server on."
-    :default (getenv "INCISE_PORT" 5000)
+    :default (getenv "INCISE_PORT" (conf/get :port))
+    :parse-fn #(Integer. %)
+    :validate [#(< 0 % 0x10000)
+               "Must be a number between 0 and 65536"]]
+   [nil "--nrepl-port PORT" "The port number to run the nrepl server on."
+    :default (getenv "INCISE_NREPL_PORT" (conf/get :nrepl-port))
     :parse-fn #(Integer. %)
     :validate [#(< 0 % 0x10000)
                "Must be a number between 0 and 65536"]]
    ["-t" "--thread-count THREAD_COUNT"
     "The number of threads for the development server to use."
-    :default (getenv "INCISE_THREAD_COUNT" 4)
+    :default (getenv "INCISE_THREAD_COUNT" (conf/get :thread-count))
     :parse-fn #(Integer. %)]
    ["-g" "--ignore-publish"
     "Ignore the publish config for content (i.e. parse regardless)."]


add client side play joins

add client side play joins

--- src/luffer/core.clj
+++ src/luffer/core.clj
@@ -27,7 +27,7 @@
 ;t.datetime "updated_at"

 (defentity plays
-  (entity-fields :id :user_id :track_id :source :created_at)
+  (entity-fields :id :user_id :track_id :api_client_id :source :created_at)
   (belongs-to users {:fk :user_id})
   (belongs-to tracks {:fk :track_id})
   (belongs-to api_clients {:fk :api_client_id}))
@@ -135,8 +135,10 @@
 (def venues-by-id (id-doc-map (select venues)))
 (def shows-by-id  (id-doc-map (select shows)))
 (def tracks-by-id (id-doc-map (select tracks)))
-(def api_clients-by-id (id-doc-map (select api_clients)))
+(def api-clients-by-id (id-doc-map (select api_clients)))
 (def users-by-id (id-doc-map (select users)))
+
+;; idea: use transform to make column names unique

 (defn join-by-id
   "Join in-memory models. Iterate the primary collection and set a key for each matching lookup-collection model."
@@ -145,7 +147,36 @@
                   [pid (assoc pm pkey (get lcoll (get pm lkey)))])
                 pcoll)))

-(pprint (select-keys (-> (join-by-id shows-by-id venues-by-id :venue :venue_id) (join-by-id tours-by-id :tour :tour_id)) [891]))
+(defn show-fully-stocked [id]
+  (get (-> (join-by-id shows-by-id venues-by-id :venue :venue_id)
+           (join-by-id tours-by-id :tour :tour_id))
+       id))
+
+(defn assoc-user
+  "associate the user with the play"
+  [play]
+  (let [uid (get play :user_id)
+        usr (last (get (vec users-by-id) uid))]
+    (assoc play :user usr)))
+
+(defn assoc-track
+  "associate the track with the play"
+  [play]
+  (let [tid (get play :track_id)
+        t (last (get (vec tracks-by-id) tid))]
+    (assoc play :track t)))
+
+
+(defn assoc-api-client
+  "associate the api-client with the play"
+  [play]
+  (let [acid (get play :api_client_id)
+        ac (last (get (vec api-clients-by-id) acid))]
+    (assoc play :api_client ac)))
+
+(defmacro select-plays-stocked [& clauses]
+  `(map #(-> (assoc-user %) (assoc-api-client) (assoc-track))
+       (select plays ~@clauses)))

 (defn -main
   "I don't do a whole lot ... yet."


Fix table nesting to be under tbody/thead

--- src/tile_game/grid.cljs
+++ src/tile_game/grid.cljs
@@ -43,14 +43,16 @@

 (defn help-screen []
   [:table {:style {:width "25%"}}
-   [:tr [:th "Key"] [:th "Action"]]
-   [:tr [:td "Left"] [:td "Move blank tile left"]]
-   [:tr [:td "Right"] [:td "Move blank tile right"]]
-   [:tr [:td "Up"] [:td "Move blank tile up"]]
-   [:tr [:td "Down"] [:td "Move blank tile down"]]
-   [:tr [:td "N"] [:td "Shuffle Board"]]
-   [:tr [:td "R"] [:td "Reset Board"]]
-   [:tr [:td "S"] [:td "Solve next piece"]]])
+   [:thead
+    [:tr [:th "Key"] [:th "Action"]]]
+   [:tbody
+    [:tr [:td "Left"] [:td "Move blank tile left"]]
+    [:tr [:td "Right"] [:td "Move blank tile right"]]
+    [:tr [:td "Up"] [:td "Move blank tile up"]]
+    [:tr [:td "Down"] [:td "Move blank tile down"]]
+    [:tr [:td "N"] [:td "Shuffle Board"]]
+    [:tr [:td "R"] [:td "Reset Board"]]
+    [:tr [:td "S"] [:td "Solve next piece"]]]])

 (defn tile-grid [command]
   (let [{:keys [board size analysis-mode]} @app-state


dead code eliminating & doc sprucing

dead code eliminating & doc sprucing

--- src/timsg/scene_var.clj
+++ src/timsg/scene_var.clj
@@ -5,14 +5,6 @@
             [clojure.core :as c]
             [arcadia.internal.spec :as as])
   (:import [UnityEngine GameObject Component]))
-
-(defn- run-init [init-fn name]
-  (when-let [ent (init-fn)]
-    (when-not (instance? GameObject ent)
-      (throw
-        (Exception.
-          (str "Zero-argument arity of def, if present, must return a GameObject; instead getting a " (type ent)))))
-    ent))

 (s/def ::tail-impl
   (s/cat
@@ -65,7 +57,7 @@
   "def form for binding vars to GameObjects. Syntax is close to that of a defn, with
 zero or one arguments supported:

-(sv/def car
+(def car
   ([] (or (object-named \"the car\")
           (let [car (create-primitive :cube)]
             (set! (.name car) \"the car\")
@@ -97,9 +89,9 @@

 Another example:

-(def truck [x] ;; just the 1-ary body supplied
-  (when x (destroy x)) ;; whatever it is, get rid of it
-  (let [truck (create-primitive :cube)] ;; make a new one
+(def truck [x]                          ;; Just the 1-ary body supplied
+  (when x (destroy x))                  ;; Whatever it is, get rid of it
+  (let [truck (create-primitive :cube)] ;; Make a new one
     (set! (.name truck) \"truck\")
     (with-cmpt truck [tr Transform]
       (set! (.position tr) (arcadia.linear/v3 0 5 10))


Display the currently logged in user properly

--- src/mdr2/layout.clj
+++ src/mdr2/layout.clj
@@ -39,7 +39,7 @@
   [:ul.nav.navbar-nav.navbar-right
    (if user
      (list
-      [:li [:a [:b (:username user)]]]
+      [:li [:a [:b (format "%s %s" (:first_name user) (:last_name user))]]]
       [:li [:a {:href "/logout"} (glyphicon "log-out")]])
      [:li [:a {:href "/login"} (glyphicon "log-in")]])])


"Once you're database is updated" :smiling_imp:

--- src/metabase/db.clj
+++ src/metabase/db.clj
@@ -122,7 +122,7 @@
                     "Please execute the following sql commands on your database before proceeding.\n\n"
                     sql
                     "\n\n"
-                    "Once you're database is updated try running the application again.\n"))
+                    "Once your database is updated try running the application again.\n"))
         (throw (java.lang.Exception. "Database requires manual upgrade."))))
     (log/info "Database Migrations Current ... CHECK")


Test specs independently

Test specs independently

--- test/plumula/delta/slow/operation_test.cljc
+++ test/plumula/delta/slow/operation_test.cljc
@@ -4,16 +4,14 @@
               [plumula.delta.operation :as operation]
               [plumula.mimolette.alpha :refer [defspec-test]]))

-(defspec-test test-op-specs
-  `[operation/length
-    operation/type
-    operation/take'
-    operation/take
-    operation/drop'
-    operation/drop
-    operation/delete
-    operation/with-attributes
-    operation/insert
-    operation/retain
-    operation/attribute-diff]
-  {:opts {:num-tests 10}})
+(defspec-test test-lenght `operation/length {:opts {:num-tests 10}})
+(defspec-test test-type `operation/type {:opts {:num-tests 10}})
+(defspec-test test-take' `operation/take' {:opts {:num-tests 10}})
+(defspec-test test-take `operation/take {:opts {:num-tests 10}})
+(defspec-test test-drop' `operation/drop' {:opts {:num-tests 10}})
+(defspec-test test-drop `operation/drop {:opts {:num-tests 10}})
+(defspec-test test-delete `operation/delete {:opts {:num-tests 10}})
+(defspec-test test-with-attributes `operation/with-attributes {:opts {:num-tests 10}})
+(defspec-test test-insert `operation/insert {:opts {:num-tests 10}})
+(defspec-test test-retain `operation/retain {:opts {:num-tests 10}})
+(defspec-test test-attribute-diff `operation/attribute-diff {:opts {:num-tests 10}})


avoid closing datomic connection too early

--- src/wb_es/bulk/core.clj
+++ src/wb_es/bulk/core.clj
@@ -112,7 +112,7 @@

 (defn- scheduler-retry! [& args] (apply dq/retry! args))

-(defn- scheduler-stats [] (dq/stats q))
+(defn- scheduler-stats [] (get (dq/stats q) "indexing_jobs"))

 (defn schedule-jobs-sample [db]
@@ -311,22 +311,30 @@
       (go
        (loop []
          (debug "Stats" (scheduler-stats))
-         (if-let [job-ref (scheduler-take! 600000 nil)]
+         (if-let [job-ref (scheduler-take! 60000 nil)]
            ;; normal batches won't be nil
            ;; only get nil when no more jobs are added to the queue for a period of time
-           (let [job (deref job-ref)]
+           (do
+             (try
+               (let [job (deref job-ref)]
+                 (try
+                   (run-index-batch db release-id job)
+                   (scheduler-complete! job-ref)
+                   (debug "Indexed" (or (meta job) :no_metadata))
+                   (catch Exception e
+                     (warn "Failed to index and scheduled to retry" (or (meta job) :no_metadata))
+                     (scheduler-retry! job-ref) ; retried items are added at the end of the queue
+                     )))
+               (catch java.io.IOException e
+                 (error "Corrupted reference" job-ref)
+                 (scheduler-complete! job-ref)))
+             (recur))
+
+           (if (= (:in-progress (scheduler-stats))
+                  0)
              (do
-               (try
-                 (run-index-batch db release-id job)
-                 (scheduler-complete! job-ref)
-                 (debug "Indexed" (or (meta job) :no_metadata))
-                 (catch Exception e
-                   (do
-                     (scheduler-retry! job-ref) ; retried items are added at the end of the queue
-                     (warn "Failed to index and scheduled to retry" (or (meta job) :no_metadata)))
-                   ))
-               (recur)))
-           (info "Done!")
+               (info "Done!" (scheduler-stats))
+               (mount/stop)))
            ))))

     )
@@ -353,5 +361,5 @@
       (connect-snapshot-repository repository-name)
       (let [snapshot-id (get-next-snapshot-id repository-name release-id)]
         (save-snapshot index-id repository-name snapshot-id))
-      (mount/stop)))
+      ))
   )


Add testing util task

Add testing util task

--- test/io/perun_test.clj
+++ test/io/perun_test.clj
@@ -17,6 +17,12 @@
   [file key val]
   (or (some #{val} (-> file pm/+meta-key+ key))
       (contains? (-> file pm/+meta-key+ key) val)))
+
+(deftask prn-meta-key
+  [p path PATH str "path of the file to test"
+   k key  KEY  kw  "the key to prn"]
+  (boot/with-pass-thru fileset
+    (->> path (boot/tmp-get fileset) pm/+meta-key+ key prn)))

 (deftask key-test
   [p path PATH str "path of the file to test"


Remove csrf token from template

Remove csrf token from template

--- src/server/clojure_template/templates/layouts.clj
+++ src/server/clojure_template/templates/layouts.clj
@@ -1,14 +1,12 @@
 (ns clojure-template.templates.layouts
   (:require [environ.core :refer [env]]
-            [hiccup.page :refer [html5 include-css include-js]]
-            [ring.middleware.anti-forgery :refer [*anti-forgery-token*]]))
+            [hiccup.page :refer [html5 include-css include-js]]))

 (defn application [& content]
   (html5 [:head
           [:meta {:charset "utf-8"}]
           [:meta {:http-equiv "X-UA-Compatible" :content "IE=edge"}]
           [:meta {:name "viewport" :content "width=device-width, initial-scale=1"}]
-          [:meta {:csrf *anti-forgery-token*}]
           [:title "Application"]
           (include-css "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css")
           (include-css "https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css")


Fix defn ordering problem.

Fix defn ordering problem.

--- src/kolmogorov_music/song.clj
+++ src/kolmogorov_music/song.clj
@@ -36,6 +36,9 @@
 (defn increment [v i n]
   (update-in v [i] (partial + n)))

+(defn digit-shift [x n]
+  (apply * x (repeat n (bigint 10))))
+
 (defn decode-note [time a b c d]
   (if (zero? (* a b))
     {:time time :duration (/ c (max d 1))}
@@ -51,9 +54,6 @@
            (decode* (-> state (increment index (:duration note))))
            lazy-seq
            (cons note)))))
-
-(defn digit-shift [x n]
-  (apply * x (repeat n (bigint 10))))

 (defn flatten-ratio [duration]
   (let [d (if (ratio? duration) (denominator duration) 1)
@@ -81,7 +81,7 @@
          (phrase [2/3 1/3 2/3 1/3 6/3]
                  [4 3 2 1 0]))
        (with (->> (phrase [8] [9]) (times 2)))
-       (with (->> (phrase [1 1 2] [0 4 0]) (times 4)))
+       (with (->> (phrase [1 1 2] [-7 -3 -7]) (times 4)))
        (with (->> (phrase (cycle [2/3 1/3]) [8 8 nil 8 nil 8 nil 7]) (times 4)))
        (wherever :pitch, :pitch (comp scale/A scale/major scale/lower))
        code))


Renames event handler

Renames event handler

--- src/wordsmith/core.cljs
+++ src/wordsmith/core.cljs
@@ -6,7 +6,7 @@

 (def app-state (atom {:text "Hello world!"}))

-(defn handle-keydown [event app owner]
+(defn handle-input [event app owner]
   (let [input-area (om/get-node owner "input-area")
         output-area (om/get-node owner "output-area")
         text (.-value input-area)
@@ -19,7 +19,7 @@
     (render [_]
       (dom/div #js {:className "container"}
         (dom/textarea #js {:ref "input-area"
-                           :onInput #(handle-keydown % app owner)})
+                           :onInput #(handle-input % app owner)})
         (dom/div #js {:ref "output-area"})))))

 (om/root


inline function

inline function

--- src/zombie_run/core.clj
+++ src/zombie_run/core.clj
@@ -173,9 +173,6 @@
 (defn player-health [{terrain :terrain :as game}]
   (get-in terrain [(player-position game) :health]))

-(defn player-direction [{terrain :terrain :as game}]
-  (get-in terrain [(player-position game) :direction]))
-
 (defn configure-player-weapon [game overrides]
   (update-in game [:terrain (player-position game) :weapon] merge overrides))

@@ -191,7 +188,9 @@

 (defn- player-attack [{terrain :terrain :as game} player-pos]
   (reduce (fn [game counter]
-            (let [target-pos (get-position player-pos (player-direction game) counter)]
+            (let [target-pos (get-position player-pos
+                                           (get-in terrain [player-pos :direction])
+                                           counter)]
               (update game :terrain attack-target player-pos target-pos :zombie)))
           game
           (range 1 (inc (weapon-range (get-in terrain [player-pos :weapon]))))))


Add missing file from last commit

Add missing file from last commit

--- src/refactor_nrepl/find_unbound.clj
+++ src/refactor_nrepl/find_unbound.clj
@@ -12,14 +12,14 @@
   (throw-unless-clj-file file)
   (let [content (slurp file)
         ast (ns-ast content)
-        sexp (sexp-at-point content line column)
+        sexp (get-enclosing-sexp content line column)
         selected-sexp-node (->> ast
-                                 (top-level-form-index line column)
-                                 (nth ast)
-                                 nodes
-                                 (filter (partial node-at-loc? line column))
-                                 (filter (partial node-for-sexp? sexp))
-                                 last)]
+                                (top-level-form-index line column)
+                                (nth ast)
+                                nodes
+                                (filter (partial node-at-loc? line column))
+                                (filter (partial node-for-sexp? sexp))
+                                last)]
     (into '() (set/intersection (->> selected-sexp-node :env :locals keys set)
                                 (->> selected-sexp-node
                                      nodes


Disable opengl context sharing between windows.

--- src/quil/applet.clj
+++ src/quil/applet.clj
@@ -205,6 +205,18 @@
 (defn -meta [this]
   (.state this))

+(defn- reset-shared-opengl-context
+  "Processing 2.1.1 shares opengl context between windows. It means that when
+  one sketch is closed and new one is starting it will use context from closed
+  one. But the context was already 'cleared' and nothing is drawn on in new sketch.
+  Currently (23.02.2014) processing guys removed context sharing but it is not
+  released yet. That's why we do it manually by setting shared context to null
+  on each sketch 'setup' phase."
+  []
+  (let [field (.getDeclaredField processing.opengl.PJOGL "sharedCanvasAWT")]
+    (.setAccessible field true)
+    (.set field nil nil)))
+
 (defn -setup [this]
   ; If renderer is :pdf - we need to set it via size method,
   ; as there is no other way to set file path for renderer.
@@ -216,6 +228,7 @@
     (let [[width height] (:size (meta this))
           renderer (resolve-renderer (:renderer (meta this)))]
     (.size this (int width) (int height) renderer (:output-file (meta this)))))
+  (reset-shared-opengl-context)
   (with-applet this
     ((:setup-fn (meta this)))))


Return max-threads to Jetty default

Return max-threads to Jetty default

--- src/radix/setup.clj
+++ src/radix/setup.clj
@@ -39,7 +39,7 @@
   (Boolean/valueOf (env :production "false")))

 (def threads
-  (Integer/valueOf (env :threads "100")))
+  (Integer/valueOf (env :threads "254")))

 (def graphite-defaults
   {:graphite-enabled? graphite-enabled?


[#5885] fix Password pop-up 'Sign message' wallet screen overlaps Cancel+Sign buttons on iPhoneX

Signed-off-by: Igor Mandrigin <042dc4512fa3d391c5170cf3aa61e6a638f84342@mandrigin.ru>

--- src/status_im/ui/screens/views.cljs
+++ src/status_im/ui/screens/views.cljs
@@ -193,7 +193,7 @@
           :initialRouteName "wallet-onboarding-setup-modal"}}

         :wallet-sign-message-modal
-        (wrap-modal :wallet-sign-message-modal sign-message-modal)})
+        [:modal sign-message-modal]})
       {:mode             "modal"
        :headerMode       "none"
        :initialRouteName "main-stack"})}


more log/debug statements; variable renaming

--- src/babel/francais/morphology.cljc
+++ src/babel/francais/morphology.cljc
@@ -80,6 +80,7 @@
   "Conjugate an infinitive into a surface form by taking the first
    element of regular-patterns where the element's :u unifies successfully with
    conjugate-with."
+  (log/debug (str "conjugate(" (string/join "," [infinitive (strip-refs conjugate-with)]) ")"))
   (let [underspecified?
         (or
          (= :top (get-in conjugate-with [:synsem :cat] :top))
@@ -104,17 +105,17 @@
                 (log/debug (str "conjugate: infinitive=" infinitive "; conjugate-with: "
                                 (strip-refs conjugate-with)))

-                lookup-spec (strip-refs
+                spec (strip-refs
                              (unify
                               (dissoc-paths
                                conjugate-with [[:français :exception]])
                               {:français {:infinitive infinitive
                                           :exception true}}))
                 diag
-                (log/debug (str "conjugate: lookup-spec: " lookup-spec))
+                (log/debug (str "conjugate: spec: " spec))

                 diag
-                (if (= :fail lookup-spec)
+                (if (= :fail spec)
                   (log/debug (str "fail-path for conjugate-with:"
                                   (strip-refs conjugate-with) "; "
                                   {:français {:infinitive infinitive
@@ -124,7 +125,7 @@
                                    {:français {:infinitive infinitive
                                                :exception true}}))))

-                error (if (= :fail lookup-spec)
+                error (if (= :fail spec)
                         (throw (Exception. (str "conjugate was given conjugate-with=:fail; "
                                               "arg1="
                                               (strip-refs (dissoc-paths
@@ -139,13 +140,13 @@
                                      prefix :prefix
                                      suffix :suffix
                                      unify-with :unify-with} %]
-                                (if (not (= :fail (unify unify-with lookup-spec)))
+                                (if (not (= :fail (unify unify-with spec)))
                                   (cond (and (not (nil? prefix))
                                              (not (nil? suffix)))
-                                        (str (get-in lookup-spec [:français prefix]) suffix)
+                                        (str (get-in spec [:français prefix]) suffix)

                                         (not (nil? path))
-                                        (get-in lookup-spec path)
+                                        (get-in spec path)

                                         true (throw (Exception. (str "problem with irregular pattern:" %))))))
                              verbs/irregular-conjugations))
@@ -156,6 +157,14 @@
                          (fn [replace-pattern]
                            (let [from (nth (:g replace-pattern) 0)
                                  to (nth (:g replace-pattern) 1)]
+                             (when (and from to infinitive)
+                               (log/debug (str "from: " from "; infinitive: " infinitive " => "
+                                               (re-matches from infinitive)))
+                               (log/debug (if (re-matches from infinitive)
+                                            (str "matched: from: " from "; infinitive: "
+                                                 infinitive " with "
+                                                 "unify-against: " (strip-refs (:u replace-pattern)) ";"
+                                                 "conjugate-with:" (strip-refs conjugate-with)))))
                              (if (and from to infinitive
                                       (re-matches from infinitive)
                                       (not (= :fail
@@ -168,6 +177,10 @@
                                (string/replace infinitive from to))))
                          regular-patterns))]
             (let [results (concat exceptional-surface-forms regulars [infinitive])]
+              (log/debug (if (not (empty? exceptional-surface-forms))
+                           (str "conjugate: exceptional conjugation: " (first exceptional-surface-forms))
+                           (if (not (empty? regulars))
+                             (str "conjugate: regular conjugation: " (first regulars)))))
               (first results))))))

 (defn pre-conjugate [spec]


whitespace

whitespace

--- src/babel/italiano/morphology.cljc
+++ src/babel/italiano/morphology.cljc
@@ -1375,7 +1375,6 @@
                 ;; if a noun has no number, it's :sing(gular)
                 (unifyc lexeme
                         {:synsem {:agr {:number :sing}}})
-
                 true
                 lexeme))
         (get lexicon surface-form))))


fix list repo data structure

fix list repo data structure

--- cloc-web/src/cloc_web/users.clj
+++ cloc-web/src/cloc_web/users.clj
@@ -72,17 +72,28 @@
   (let [repos (into {} (list-github-repos user)) ;; {"url":object}
         registered (into {} (list-registered-repos params))
         add-registered (fn [repo registered]
-                          (merge repo {:registered registered}))]
-    (merge-with add-registered repos registered)))
+                          (merge repo {:registered registered}))
+        into-vec (fn [[url values]]
+                    (assoc values :url url))]
+    (map into-vec (merge-with add-registered repos registered))))

 (defn me
   [{:keys [user] :as params}]
   {:status 200
    :body {:user user
           :login "github"
-          :repos [{:name "rep"
+          :repos [{:url (get-repo-location "0of/rep")
+                   :name "rep"
                    :full_name "0of/rep"
-                   :description "description"}]}})
+                   :description "description"}
+                  {:url (get-repo-location "0of/rep2")
+                   :name "rep2"
+                   :full_name "0of/rep2"
+                   :description "description"
+                   :registered {:id "0of/rep2"
+                                :user "0of"
+                                :filter "*"
+                                :lang "SUM"}}]}})

 (defn is_login
   [{:keys [user] :as params}]


More obfuscation

More obfuscation

--- clojure/src/yatzy_clj/yatzy.clj
+++ clojure/src/yatzy_clj/yatzy.clj
@@ -2,7 +2,17 @@
   (:gen-class))

 (defn chance [d1 d2 d3 d4 d5]
-  (+ d1 d2 d3 d4 d5))
+  (let [total
+        (+
+          d1
+          d2
+          d3
+          d4
+          d5)
+        ]
+    total
+    )
+  )

 (defn tally-die [dice]
   (for [i (range 1 7)]


Support Sieppari-style error handlers with pedestal

The reitit-pedestal Executor checks if the mounted interceptors have
1-arity error handler. If so, they are wrapped into a 2 arrity function.

--- modules/reitit-pedestal/src/reitit/pedestal.clj
+++ modules/reitit-pedestal/src/reitit/pedestal.clj
@@ -6,6 +6,29 @@
             [reitit.http])
   (:import (reitit.interceptor Executor)))

+(defn- arity [f]
+  (->> (class f)
+       .getDeclaredMethods
+       (filter #(= "invoke" (.getName %)))
+       first
+       .getParameterTypes
+       alength))
+
+(defn- error-with-arity-1? [{error-fn :error}]
+  (and error-fn (= 1 (arity error-fn))))
+
+(defn- error-arity-2->1 [error]
+  (fn [context ex]
+    (let [{ex :error :as context} (error (assoc context :error ex))]
+      (if ex
+        (-> context
+            (assoc ::chain/error ex)
+            (dissoc :error))
+        context))))
+
+(defn wrap-error-arity-2->1 [interceptor]
+  (update interceptor :error error-arity-2->1))
+
 (def pedestal-executor
   (reify
     Executor
@@ -13,7 +36,13 @@
       (->> interceptors
            (map (fn [{:keys [::interceptor/handler] :as interceptor}]
                   (or handler interceptor)))
-           (map interceptor/interceptor)))
+           (map (fn [interceptor]
+                  (if (interceptor/interceptor? interceptor)
+                    interceptor
+                    (interceptor/interceptor
+                     (if (error-with-arity-1? interceptor)
+                       (wrap-error-arity-2->1 interceptor)
+                       interceptor)))))))
     (enqueue [_ context interceptors]
       (chain/enqueue context interceptors))))


DB-readeriin lisättiin tulosten haku

DB-readeriin lisättiin tulosten haku

--- mtg-pairings-wer/src/mtg_pairings/db_reader.clj
+++ mtg-pairings-wer/src/mtg_pairings/db_reader.clj
@@ -1,65 +1,84 @@
-(ns mtg-pairings.db-reader
-  (:require [clojess.core :as db]))
+(ns mtg-pairings.db-reader
+  (:require [clojess.core :as db]))
+
+(defn open [filename]
+  (db/open-db filename))
+
+(defn tournaments
+  "Returns a list of tournaments in the database"
+  [db]
+  (->> (db/table db "Tournament")
+    db/rows
+    (map #(select-keys % [:TournamentId :Title :StartDate]))))
+
+(def bye
+  {:id 0
+   :name "***BYE***"
+   :dci-numbers []})
+
+(defn dcinumbers-for-players
+  "Returns a list of DCI numbers for a list of players"
+  [db players]
+  (let [person-table (db/table db "Person")]
+    (for [player players
+          :let [person (db/row person-table (:PersonId player))]]
+      (:PrimaryDciNumber person))))
+
+(defn teams
+  "Returns a list of teams in the tournament with the given id number."
+  [db tournament-id]
+  (let [team-table (db/table db "Team")
+        teamplayer-table (db/table db "TeamPlayers")]
+    (into {} (for [team (db/rows team-table {:TournamentId tournament-id})
+                   :let [teamplayers (db/rows teamplayer-table {:TeamId (:TeamId team)})]]
+               {(:TeamId team) {:id (:TeamId team)
+                                :name (:Name team)
+                                :dci-numbers (dcinumbers-for-players db teamplayers)}}))))
+
+(defn teams-from-ids
+  [team-ids all-teams]
+  (if (= 2 (count team-ids))
+    (let [pair (map all-teams team-ids)]
+      [pair (reverse pair)])
+    [[(all-teams (first team-ids)) bye]]))

-(defn open [filename]
-  (db/open-db filename))

-(defn tournaments
-  "Returns a list of tournaments in the database"
-  [db]
-  (->> (db/table db "Tournament")
-    db/rows
-    (map #(select-keys % [:TournamentId :Title :StartDate]))))
+(defn results-for-round
+  [db round-id all-teams]
+  (let [match-table (db/table db "Match")
+        result-table (db/table db "TeamMatchResult")
+        matches (db/rows match-table {:RoundId round-id})]
+   (for [match matches
+     :let [[first-row second-row] (db/rows result-table {:MatchId (:MatchId match)})]]
+        (if (>= (:GameWins first-row) (:GameWins second-row))
+
+        {:GameWins (:GameWins first-row), :GameLosses (:GameLosses first-row),
+         :GameDraws (:GameDraws first-row), :WinnerTeamId (:TeamId first-row),
+         :LoserTeamId (:TeamId second-row)}

-(def bye
-  {:id 0
-   :name "***BYE***"
-   :dci-numbers []})
+        {:GameWins (:GameWins second-row), :GameLosses (:GameLosses second-row),
+          :GameDraws (:GameDraws second-row), :WinnerTeamId (:TeamId second-row),
+          :LoserTeamId (:TeamId first-row)}))))

-(defn dcinumbers-for-players
-  "Returns a list of DCI numbers for a list of players"
-  [db players]
-  (let [person-table (db/table db "Person")]
-    (for [player players
-          :let [person (db/row person-table (:PersonId player))]]
-      (:PrimaryDciNumber person))))
-
-(defn teams
-  "Returns a list of teams in the tournament with the given id number."
-  [db tournament-id]
-  (let [team-table (db/table db "Team")
-        teamplayer-table (db/table db "TeamPlayers")]
-    (into {} (for [team (db/rows team-table {:TournamentId tournament-id})
-                   :let [teamplayers (db/rows teamplayer-table {:TeamId (:TeamId team)})]]
-               {(:TeamId team) {:id (:TeamId team)
-                                :name (:Name team)
-                                :dci-numbers (dcinumbers-for-players db teamplayers)}}))))
-
-(defn teams-from-ids
-  [team-ids all-teams]
-  (if (= 2 (count team-ids))
-    (let [pair (map all-teams team-ids)]
-      [pair (reverse pair)])
-    [[(all-teams (first team-ids)) bye]]))
-
-(defn pairings-for-round
-  [db round-id all-teams]
-  (let [match-table (db/table db "Match")
-        result-table (db/table db "TeamMatchResult")
-        matches (db/rows match-table {:RoundId round-id})
-        results (for [match matches]
-                  (map :TeamId (db/rows result-table {:MatchId (:MatchId match)})))]
-    (mapcat #(teams-from-ids % all-teams) results)))
-
-(defn pairings
-  [db tournament-id]
-  (let [round-table (db/table db "Round")
-        rounds (db/rows round-table {:TournamentId tournament-id})
-        teams (teams db tournament-id)]
-    (for [round rounds]
-      (pairings-for-round db (:RoundId round) teams))))
-
-(defn print-pairings [pairings]
-  (doseq [pairing pairings]
-    (println (:name (first pairing)) "-" (:name (second pairing)))))
+
+(defn pairings-for-round
+  [db round-id all-teams]
+  (let [match-table (db/table db "Match")
+        result-table (db/table db "TeamMatchResult")
+        matches (db/rows match-table {:RoundId round-id})
+        results (for [match matches]
+                  (map :TeamId (db/rows result-table {:MatchId (:MatchId match)})))]
+    (mapcat #(teams-from-ids % all-teams) results)))
+
+(defn pairings
+  [db tournament-id]
+  (let [round-table (db/table db "Round")
+        rounds (db/rows round-table {:TournamentId tournament-id})
+        teams (teams db tournament-id)]
+    (for [round rounds]
+      (pairings-for-round db (:RoundId round) teams))))
+
+(defn print-pairings [pairings]
+  (doseq [pairing pairings]
+    (println (:name (first pairing)) "-" (:name (second pairing)))))


Deref atom

Deref atom

--- src/runbld/main.clj
+++ src/runbld/main.clj
@@ -64,7 +64,7 @@
                 :errors errors
                 :msg (with-out-str
                        (println "execution had errors")
-                       (doseq [err errors]
+                       (doseq [err @errors]
                          (println "==========")
                          (println err)))}))
      (if runbld.opts/*dev*


add aws code to exceptions

add aws code to exceptions

--- src/shuppet/aws.clj
+++ src/shuppet/aws.clj
@@ -18,19 +18,22 @@
 (def ^:const sts-url (env :service-aws-sts-url))
 (def ^:const sts-version (env :service-aws-sts-api-version))

+(defn- get-message
+  [body]
+  (str (or (xml1-> body :Error :Message text) (xml1-> body :Errors :Error :Message text))))
+
+(defn- get-code
+  [body]
+  (str (or (xml1-> body :Error :Code text) (xml1-> body :Errors :Error :Code text))))
+
 (defn throw-aws-exception
-  [title action url status message]
+  [title action url status body]
   (throw+ {:type ::aws
            :title (str title " request failed while performing the action '" action "'")
            :url url
            :status status
-           :message message}))
-
-(defn- get-message
-  [body]
-  (str (xml1-> body :Errors :Error :Code text)
-       "\n"
-       (xml1-> body :Errors :Error :Message text)))
+           :message (get-message body)
+           :code (get-code body)}))

 (defn ec2-request
   [params]
@@ -43,7 +46,7 @@
                  (zip/xml-zip))]
     (if (= 200 status)
       body
-      (throw-aws-exception "EC2" (get params "Action") url status (get-message body)))))
+      (throw-aws-exception "EC2" (get params "Action") url status body))))

 (defn iam-request
   [params]
@@ -57,7 +60,7 @@
     (condp = status
       200 body
       404 nil
-      (throw-aws-exception "IAM" (get params "Action") url status (get-message body)))))
+      (throw-aws-exception "IAM" (get params "Action") url status body))))

 (defn elb-request
   [params]
@@ -73,7 +76,7 @@
                  (zip/xml-zip))]
     (if (= 200 status)
       body
-      (throw-aws-exception "ELB" (get params "Action") url status (get-message body))))
+      (throw-aws-exception "ELB" (get params "Action") url status body)))

   (defn decode-message
     [encoded-message]


improve error reporting for defkey arg vectors

--- src/keypin/core.clj
+++ src/keypin/core.clj
@@ -171,17 +171,17 @@
                      (cons the-sym (cons arg-vec more)))
                 (partition 2)
                 (map (fn [[each-sym each-vec]]
-                       (i/expect-arg each-sym symbol? ["Expected a symbol to define var, found" (pr-str each-sym)])
-                       (i/expect-arg each-vec vector? ["Expected a vector to create key, found" (pr-str each-vec)])
+                       (i/expect-arg each-sym symbol? ["Expected a symbol to define var, but found" (pr-str each-sym)])
+                       (i/expect-arg each-vec vector? ["Expected a vector to create key, but found" (pr-str each-vec)])
                        [each-sym (case (count each-vec)
                                    1 (conj each-vec any? "No description" options)
                                    2 (let [{:keys [pred desc]
                                             :or {pred any?
                                                  desc "No description"}
-                                            :as spec-opts} (let [each-opts (get each-vec 1)]
+                                            :as spec-opts} (let [[each-key each-opts] each-vec]
                                                              (i/expect-arg each-opts map?
-                                                               ["Expected an option map for defkey, but found"
-                                                                (pr-str each-opts)])
+                                                               (format "Expected an option map for key %s, but found %s"
+                                                                 (pr-str each-key) (pr-str each-opts)))
                                                              (merge options each-opts))]
                                        (-> (pop each-vec) ; remove options first
                                          (conj pred desc spec-opts)))


Doseq?

Doseq?

--- src/korhal/core.clj
+++ src/korhal/core.clj
@@ -53,7 +53,7 @@
   (println "updating")

   ;; spawn a drone
-  (for [unit (.getMyUnits (:api @this))]
+  (doseq [unit (.getMyUnits (:api @this))]
     (do (println "bacon")
         #_(when (= (.getTypeID unit) (.getID jnibwapi.types.UnitType$UnitTypes/Zerg_Larva))
           (when (and (>= (.. (:api @this) getSelf getMinerals) 50) (not (:morphed-drone this)))


Update "get-task-object" function in task.clj

Update "get-task-object" function, change the type of first param "topology" from ^TopologyContext to ^StormTopology. the "get-task-object" function in task.clj,the type of first param "topology" should be ^StormTopology not ^TopologyContext.

the "get-task-object" is called by "mk-task-data" function in task.clj, "mk-task-data" is defined as following:

(defn mk-task-data [executor-data task-id]
  (recursive-map
    :executor-data executor-data
    :task-id task-id
    :system-context (system-topology-context (:worker executor-data) executor-data task-id)
    :user-context (user-topology-context (:worker executor-data) executor-data task-id)
    :builtin-metrics (builtin-metrics/make-data (:type executor-data))
    :tasks-fn (mk-tasks-fn <>)
    :object (get-task-object (.getRawTopology ^TopologyContext (:system-context <>)) (:component-id executor-data))))

(:system-context <>) return TopologyContext instance, TopologyContext extends GeneralTopologyContext, the TopologyContext instance has StormTopology _topology. “getRawTopology” method of TopologyContext must return StormTopology _topology. (.getRawTopology ^TopologyContext (:system-context <>) return StormTopology instance not TopologyContext instance. so the type of param topology is StormTopology not TopologyContext.

at the same time, "get-task-object" call "get_spouts" and "get_bolts" of the param topology. you can find the "get_spouts" and "get_bolts" function are only defined in StormTopology, and StormTopology is not a subclass of TopologyContext. so i think the type of param topology is StormTopology not TopologyContext.

--- storm-core/src/clj/backtype/storm/daemon/task.clj
+++ storm-core/src/clj/backtype/storm/daemon/task.clj
@@ -61,7 +61,7 @@
     (:topology worker))
    tid))

-(defn- get-task-object [^TopologyContext topology component-id]
+(defn- get-task-object [^StormTopology topology component-id]
   (let [spouts (.get_spouts topology)
         bolts (.get_bolts topology)
         state-spouts (.get_state_spouts topology)


Refactored some stored tests to use the new with-wrapped-fn-args

--- test/com/puppetlabs/puppetdb/test/scf/storage.clj
+++ test/com/puppetlabs/puppetdb/test/scf/storage.clj
@@ -61,47 +61,37 @@
         (is (= (query-to-vec "SELECT name FROM certnames")
                [{:name certname}])))
       (testing "replacing facts"
-        (let [deletes (atom {})
-              updates (atom #{})
-              adds (atom {})
-              sql-insert sql/insert-records
-              sql-update sql/update-values
-              sql-delete sql/delete-rows]
-          ;;Ensuring here that new records are inserted, updated
-          ;;facts are updated (not deleted and inserted) and that
-          ;;the necessary deletes happen
-          (with-redefs [sql/insert-records (fn [table & rows]
-                                             (swap! adds assoc table rows)
-                                             (apply sql-insert table rows))
-                        sql/update-values (fn [table clause values]
-                                            (swap! updates conj values)
-                                            (sql-update table clause values))
-                        sql/delete-rows (fn [table clause]
-                                          (swap! deletes assoc table clause)
-                                          (sql-delete table clause))]
-            (let [new-facts {"domain" "mynewdomain.com"
-                             "fqdn" "myhost.mynewdomain.com"
-                             "hostname" "myhost"
-                             "kernel" "Linux"
-                             "uptime_seconds" "3600"}]
-              (replace-facts! {"name"  certname "values" new-facts} (now))
-              (testing "should have only the new facts"
-                (is (= (query-to-vec "SELECT name, value FROM certname_facts ORDER BY name")
-                       [{:name "domain" :value "mynewdomain.com"}
-                        {:name "fqdn" :value "myhost.mynewdomain.com"}
-                        {:name "hostname" :value "myhost"}
-                        {:name "kernel" :value "Linux"}
-                        {:name "uptime_seconds" :value "3600"}])))
-              (testing "should only delete operatingsystem key"
-                (is (= {:certname_facts ["certname=? and name in (?)" "some_certname" "operatingsystem"]}
-                       @deletes)))
-              (testing "should update existing keys"
-                (is (true? (contains? @updates {:value "mynewdomain.com"})))
-                (is (true? (contains? @updates  {:value "myhost.mynewdomain.com"})))
-                (is (some :timestamp @updates)))
-              (testing "should only insert uptime_seconds"
-                (is (= {:certname_facts [{:value "3600", :name "uptime_seconds", :certname "some_certname"}]}
-                       @adds)))))))
+        ;;Ensuring here that new records are inserted, updated
+        ;;facts are updated (not deleted and inserted) and that
+        ;;the necessary deletes happen
+        (tu/with-wrapped-fn-args [adds sql/insert-records
+                                  updates sql/update-values
+                                  deletes sql/delete-rows]
+          (let [new-facts {"domain" "mynewdomain.com"
+                           "fqdn" "myhost.mynewdomain.com"
+                           "hostname" "myhost"
+                           "kernel" "Linux"
+                           "uptime_seconds" "3600"}]
+            (replace-facts! {"name"  certname "values" new-facts} (now))
+            (testing "should have only the new facts"
+              (is (= (query-to-vec "SELECT name, value FROM certname_facts ORDER BY name")
+                     [{:name "domain" :value "mynewdomain.com"}
+                      {:name "fqdn" :value "myhost.mynewdomain.com"}
+                      {:name "hostname" :value "myhost"}
+                      {:name "kernel" :value "Linux"}
+                      {:name "uptime_seconds" :value "3600"}])))
+            (testing "should only delete operatingsystem key"
+              (is (= [[:certname_facts ["certname=? and name in (?)" "some_certname" "operatingsystem"]]]
+                     @deletes)))
+            (testing "should update existing keys"
+              (is (some #{[:certname_facts ["certname=? and name=?" "some_certname" "domain"] {:value "mynewdomain.com"}]} @updates))
+              (is (some #{[:certname_facts ["certname=? and name=?" "some_certname" "fqdn"] {:value "myhost.mynewdomain.com"}]} @updates))
+              (is (some (fn [update-call]
+                          (and (= :certname_facts_metadata (first update-call))
+                               (:timestamp (last update-call)))) @updates)))
+            (testing "should only insert uptime_seconds"
+              (is (= [[:certname_facts {:value "3600", :name "uptime_seconds", :certname "some_certname"}]]
+                     @adds))))))

       (testing "replacing all new facts"
         (delete-facts! certname)
@@ -223,56 +213,48 @@
                     "contains"] nil})))

         ;; Lets intercept the insert/update/delete level so we can test it later
-        (let [deletes (atom {})
-              adds (atom {})
-              sql-insert sql/insert-rows
-              sql-delete sql/delete-rows]
-          (with-redefs [sql/insert-rows    (fn [table & rows]
-                                             (swap! adds assoc table rows)
-                                             (apply sql-insert table rows))
-                        sql/delete-rows    (fn [table clause]
-                                             (swap! deletes assoc table clause)
-                                             (sql-delete table clause))]
-            ;; Here we only replace edges, so we can capture those specific SQL
-            ;; operations
-            (let [resources    (:resources modified-catalog)
-                  refs-to-hash (reduce-kv (fn [i k v]
-                                            (assoc i k (shash/resource-identity-hash v)))
-                                          {} resources)]
-              (replace-edges! certname modified-edges refs-to-hash)
-              (testing "ensure catalog-edges-map returns a predictable value"
-                (is (= (catalog-edges-map certname)
-                       {["d9b87fb0aaafa5f56cc49e9dbfa83b1c573c6e8a"
-                         "e247f822a0f0bbbfff4fe066ce4a077f9c03cdb1"
-                         "contains"] nil,
-                         ["57495b553981551c5194a21b9a26554cd93db3d9"
-                          "e247f822a0f0bbbfff4fe066ce4a077f9c03cdb1"
-                          "required-by"] nil
-                         ["57495b553981551c5194a21b9a26554cd93db3d9"
-                          "e247f822a0f0bbbfff4fe066ce4a077f9c03cdb1"
-                          "before"] nil})))
-
-              (testing "should only delete the 1 edge"
-                (is (= {:edges ["certname=? and source=? and target=? and type=?"
+        ;; Here we only replace edges, so we can capture those specific SQL
+        ;; operations
+        (tu/with-wrapped-fn-args [adds sql/insert-rows
+                                  deletes sql/delete-rows]
+          (let [resources    (:resources modified-catalog)
+                refs-to-hash (reduce-kv (fn [i k v]
+                                          (assoc i k (shash/resource-identity-hash v)))
+                                        {} resources)]
+            (replace-edges! certname modified-edges refs-to-hash)
+            (testing "ensure catalog-edges-map returns a predictable value"
+              (is (= (catalog-edges-map certname)
+                     {["d9b87fb0aaafa5f56cc49e9dbfa83b1c573c6e8a"
+                       "e247f822a0f0bbbfff4fe066ce4a077f9c03cdb1"
+                       "contains"] nil,
+                       ["57495b553981551c5194a21b9a26554cd93db3d9"
+                        "e247f822a0f0bbbfff4fe066ce4a077f9c03cdb1"
+                        "required-by"] nil
+                       ["57495b553981551c5194a21b9a26554cd93db3d9"
+                        "e247f822a0f0bbbfff4fe066ce4a077f9c03cdb1"
+                        "before"] nil})))
+
+            (testing "should only delete the 1 edge"
+              (is (= [[:edges ["certname=? and source=? and target=? and type=?"
                                 "basic.catalogs.com"
                                 "d9b87fb0aaafa5f56cc49e9dbfa83b1c573c6e8a"
                                 "57495b553981551c5194a21b9a26554cd93db3d9"
-                                "contains"]}
-                       @deletes)))
-              (testing "should only insert the 1 edge"
-                (is (= {:edges [["basic.catalogs.com"
-                                 "57495b553981551c5194a21b9a26554cd93db3d9"
-                                 "e247f822a0f0bbbfff4fe066ce4a077f9c03cdb1"
-                                 "before"]]}
-                       @adds)))
-              (testing "when reran to check for idempotency"
-                (swap! adds {})
-                (swap! deletes {})
-                (replace-edges! certname modified-edges refs-to-hash)
-                (testing "should delete no edges"
-                  (is (= nil @deletes)))
-                (testing "should insert no edges"
-                  (is (= nil @adds))))))))))
+                                "contains"]]]
+                     @deletes)))
+            (testing "should only insert the 1 edge"
+              (is (= [[:edges ["basic.catalogs.com"
+                               "57495b553981551c5194a21b9a26554cd93db3d9"
+                               "e247f822a0f0bbbfff4fe066ce4a077f9c03cdb1"
+                               "before"]]]
+                     @adds)))
+            (testing "when reran to check for idempotency"
+              (reset! adds [])
+              (reset! deletes [])
+              (replace-edges! certname modified-edges refs-to-hash)
+              (testing "should delete no edges"
+                (is (empty? @deletes)))
+              (testing "should insert no edges"
+                (is (empty?@adds)))))))))

   (deftest catalog-duplicates
     (testing "should share structure when duplicate catalogs are detected for the same host"


fix npm browser overrides not being used on windows

--- src/main/shadow/build/npm.clj
+++ src/main/shadow/build/npm.clj
@@ -656,7 +656,10 @@
                     (.toPath package-dir)

                     rel-name
-                    (str "./" (.relativize package-path (.toPath file)))]
+                    (str "./" (-> (.toPath file)
+                                  (.relativize package-path)
+                                  (str)
+                                  (rc/normalize-name)))]

                 ;; FIXME: I'm almost certain that browser allows overriding without extension
                 ;; "./lib/some-file":"./lib/some-other-file"


js property

js property

--- src/nodecljs/server/core.cljs
+++ src/nodecljs/server/core.cljs
@@ -19,8 +19,8 @@
                             "<script src='/js/app.js'></script>"])) ))

 (defn handler [req res]
-  (if (= "https" (aget (.headers req) "x-forwarded-proto"))
-    (.redirect res (str "'http://" (.get req "Host") (.url req)))
+  (if (= "https" (aget (.-headers req) "x-forwarded-proto"))
+    (.redirect res (str "http://" (.get req "Host") (.-url req)))
     (let [jokes-chan (async/into [] (fetch-some-jokes 5))]
       (go
         (.set res "Content-Type" "text/html")


Use json-verbose exemplar files

Use json-verbose exemplar files

--- test/transit/verify.clj
+++ test/transit/verify.clj
@@ -224,7 +224,7 @@
    :encoding encoding})

 (def extension {:json         ".json"
-                :json-verbose ".json-verbose"
+                :json-verbose ".verbose.json"
                 :msgpack      ".mp"})

 (defn exemplar-transit


Make generative tests optional

Make generative tests optional

bin/verify -gen 100

will run a test with 100 generated inputs

--- test/transit/verify.clj
+++ test/transit/verify.clj
@@ -187,9 +187,11 @@
                         (assoc-in [:tests :exemplar-file] (test-exemplar-files proc encoding))
                         (assoc-in [:tests :corner-case-edn] (test-corners-of-edn proc encoding))
                         (assoc-in [:tests :corner-case-transit-json]
-                                  (test-corners-of-transit-json proc encoding))
-                        (assoc-in [:tests :generated-edn]
-                                  (test-generated-edn (:generated-forms opts) proc encoding)))]
+                                  (test-corners-of-transit-json proc encoding)))
+            results (if (:gen opts)
+                      (assoc-in results [:tests :generated-edn]
+                                (test-generated-edn (:generated-forms opts) proc encoding))
+                      results)]
         (stop-process proc)
         results)
       (catch Throwable e
@@ -267,7 +269,8 @@
         testable-impls (keep #(let [script (io/file root (str % "/bin/roundtrip"))]
                                 (when (.exists script) %))
                              (.list root))
-        forms (take 100 (repeatedly gen/ednable))]
+        forms (when-let [n (:gen opts)]
+                (take n (repeatedly gen/ednable)))]
     (doseq [impl testable-impls]
       (when (or (not impls)
                 (contains? impls impl))
@@ -278,6 +281,7 @@
             (case k
               "-impls" (assoc a :impls (set (mapv #(str "transit-" %) v)))
               "-enc" (assoc a :enc (keyword (first v)))
+              "-gen" (assoc a :gen (Integer/valueOf (first v)))
               a))
           {}
           (partition 2 (partition-by #(.startsWith % "-") args))))


Use —rm instead of calling “docker rm” after test

--- test/powderkeg/integration_test.clj
+++ test/powderkeg/integration_test.clj
@@ -11,7 +11,9 @@
     (.trim out)))

 (defn start-master [pwd]
-  (sh! "docker" "run" "-d"
+  (sh! "docker" "run"
+       "-d"
+       "--rm"
        "--name" "master"
        "-h" "master"
        "-p" "8080:8080"
@@ -31,7 +33,9 @@
        "-h" "master"))

 (defn start-worker [pwd]
-  (sh! "docker" "run" "-d"
+  (sh! "docker" "run"
+       "-d"
+       "--rm"
        "--name" "worker"
        "--link" "master"
        "-h" "worker"
@@ -50,8 +54,7 @@
        "org.apache.spark.deploy.worker.Worker" "spark://master:7077"))

 (defn stop-spark [instance]
-  (sh! "docker" "stop" instance)
-  (sh! "docker" "rm" instance))
+  (sh! "docker" "stop" instance))

 (defn with-cluster [f]
   (let [pwd (.getAbsolutePath (java.io.File. ""))]


(maint) Increase TTL of integration test msgs to 5 s

--- test/integration/puppetlabs/pcp/broker/service_test.clj
+++ test/integration/puppetlabs/pcp/broker/service_test.clj
@@ -252,7 +252,7 @@
                             (assoc :message_type "http://puppetlabs.com/inventory_request"
                                    :targets ["pcp:///server"]
                                    :sender "pcp://client01.example.com/test")
-                            (message/set-expiry 3 :seconds)
+                            (message/set-expiry 5 :seconds)
                             (message/set-json-data {:query ["pcp://client01.example.com/test"]}))]
             (client/send! client request)
             (let [response (client/recv! client 1000)]
@@ -262,7 +262,7 @@
                             (assoc :sender "pcp://client01.example.com/test"
                                    :targets ["pcp://client01.example.com/test"]
                                    :message_type "greeting")
-                            (message/set-expiry 3 :seconds)
+                            (message/set-expiry 5 :seconds)
                             (message/set-json-data "Hello"))]
             (client/send! client message)
             (let [message (client/recv! client 1000)]
@@ -278,7 +278,7 @@
                           (assoc :message_type "http://puppetlabs.com/inventory_request"
                                  :targets ["pcp:///server"]
                                  :sender "pcp://client01.example.com/test")
-                          (message/set-expiry 3 :seconds)
+                          (message/set-expiry 5 :seconds)
                           (message/set-json-data {:query ["pcp://client01.example.com/test"]}))]
           (client/send! client request)
           (let [response (client/recv! client)]
@@ -295,7 +295,7 @@
                           (assoc :message_type "http://puppetlabs.com/inventory_request"
                                  :targets ["pcp:///server"]
                                  :sender "pcp://client01.example.com/test")
-                          (message/set-expiry 3 :seconds)
+                          (message/set-expiry 5 :seconds)
                           (message/set-json-data {:query ["pcp://*/test"]}))]
           (client/send! client request)
           (let [response (client/recv! client)]
@@ -313,7 +313,7 @@
                           (assoc :message_type "http://puppetlabs.com/inventory_request"
                                  :targets ["pcp:///server"]
                                  :sender "pcp://client01.example.com/test")
-                          (message/set-expiry 3 :seconds)
+                          (message/set-expiry 5 :seconds)
                           (message/set-json-data {:query ["pcp://client02.example.com/test"]}))]
           (client/send! client request))
         (let [response (client/recv! client)]
@@ -346,7 +346,7 @@
                             (assoc :message_type "http://puppetlabs.com/inventory_request"
                                    :targets ["pcp:///server"]
                                    :sender "pcp://client01.example.com/test")
-                            (message/set-expiry 3 :seconds)
+                            (message/set-expiry 5 :seconds)
                             (message/set-json-data {:query ["pcp://client01.example.com/test"]}))]
             (client/send! client request)
             (let [response (client/recv! client 1000)]
@@ -362,7 +362,7 @@
                           (assoc :sender "pcp://client01.example.com/test"
                                  :targets ["pcp://client01.example.com/test"]
                                  :message_type "greeting")
-                          (message/set-expiry 3 :seconds)
+                          (message/set-expiry 5 :seconds)
                           (message/set-json-data "Hello"))]
           (client/send! client message)
           (let [message (client/recv! client)]
@@ -378,7 +378,7 @@
                           (assoc :sender "pcp://client01.example.com/test"
                                  :targets ["pcp://*/test"]
                                  :message_type "greeting")
-                          (message/set-expiry 3 :seconds)
+                          (message/set-expiry 5 :seconds)
                           (message/set-json-data "Hello"))]
           (client/send! client message)
           (let [message (client/recv! client)]
@@ -397,7 +397,7 @@
                                  :targets ["pcp://client02.example.com/test"]
                                  :destination_report true
                                  :message_type "greeting")
-                          (message/set-expiry 3 :seconds)
+                          (message/set-expiry 5 :seconds)
                           (message/set-json-data "Hello"))]
           (client/send! sender message)
           (let [report  (client/recv! sender)
@@ -422,7 +422,7 @@
                           (assoc :sender "pcp://client01.example.com/test"
                                  :targets ["pcp://client02.example.com/*"]
                                  :message_type "greeting")
-                          (message/set-expiry 3 :seconds)
+                          (message/set-expiry 5 :seconds)
                           (message/set-json-data "Hello"))]
           (client/send! client message)
           (let [response (client/recv! client 1000)]
@@ -451,7 +451,7 @@
                           (assoc :sender "pcp://client01.example.com/test"
                                  :targets ["pcp://client02.example.com/test"]
                                  :message_type "greeting")
-                          (message/set-expiry 3 :seconds)
+                          (message/set-expiry 5 :seconds)
                           (message/set-json-data "Hello"))]
           (client/send! client message)
           (let [response (client/recv! client)]
@@ -474,7 +474,7 @@
                           (assoc :sender "pcp://client01.example.com/test"
                                  :targets ["pcp://client02.example.com/test"]
                                  :message_type "greeting")
-                          (message/set-expiry 3 :seconds)
+                          (message/set-expiry 5 :seconds)
                           (message/set-json-data "Hello"))]
           (client/send! client message)))
       (with-open [client (client/connect :certname "client02.example.com")]
@@ -507,7 +507,7 @@
           (let [message (-> (message/make-message :sender "pcp://client01.example.com/test"
                                                   :message_type "test/sensitive"
                                                   :targets ["pcp://client02.example.com/test"])
-                            (message/set-expiry 3 :seconds))]
+                            (message/set-expiry 5 :seconds))]
             (client/send! client01 message)
             (let [received (client/recv! client02)]
               (is (= (:id message) (:id received))))))
@@ -515,7 +515,7 @@
           (let [message (-> (message/make-message :sender "pcp://client02.example.com/test"
                                                   :message_type "test/sensitive"
                                                   :targets ["pcp://client01.example.com/test"])
-                            (message/set-expiry 3 :seconds))]
+                            (message/set-expiry 5 :seconds))]
             (client/send! client02 message)
             (let [received (client/recv! client01 1000)]
               (is (= nil received)))))))))
@@ -533,16 +533,16 @@
                                  :targets ["pcp://client02.example.com/test"]
                                  :in-reply-to (ks/uuid)
                                  :message_type "greeting")
-                          (message/set-expiry 3 :seconds)
+                          (message/set-expiry 5 :seconds)
                           (message/set-json-data "Hello"))]
           (client/send! sender message)
-          (let [recieved (client/recv! receiver)]
+          (let [received-msg (client/recv! receiver)]
             (is (= (case receiver-version
                      "v1.0" nil
                      (:in-reply-to message))
-                   (:in-reply-to recieved)))
-            (is (= "greeting" (:message_type recieved)))
-            (is (= "Hello" (message/get-json-data recieved)))))))))
+                   (:in-reply-to received-msg)))
+            (is (= "greeting" (:message_type received-msg)))
+            (is (= "Hello" (message/get-json-data received-msg)))))))))

 (def no-vnext-config
   "A broker with vNext unconfigured"