Fix api.

Fix api.

--- src/onyx/api.clj
+++ src/onyx/api.clj
@@ -37,7 +37,7 @@
               workflow)))

 (defn unpack-map-workflow
-  ([workflow] (vec (unpack-workflow workflow [])))
+  ([workflow] (vec (unpack-map-workflow workflow [])))
   ([workflow result]
      (let [roots (keys workflow)]
        (if roots


Add instance tags to sample-jobdef.clj

Add instance tags to sample-jobdef.clj

--- examples/sample-jobdef.clj
+++ examples/sample-jobdef.clj
@@ -159,6 +159,12 @@
   ;Instance type for master
   ;:master-instance-type "m1.large"

+  ;EMR Cluster tags
+  ;Provide comma-separated list of key=value pairs, which will be used to
+  ;create tags for instances in your EMR cluster
+  ;read more at
+  ;http://docs.aws.amazon.com/ElasticMapReduce/latest/DeveloperGuide/emr-plan-tags.html
+  ;:tags "fake:project=fightingcrime,fake:group=ateam"
   ; Uncomment to attempt to get additional nodes via the spot market
   ; This example requests up to 30 additional m1.xlarge nodes, and we are willing to
   ; pay up to 80% of the difference between the reserve price and the demand price.


fix(deps): update dependency compojure:compojure to v1.6.1 (#73)

--- technologies/clojure/project.clj
+++ technologies/clojure/project.clj
@@ -7,7 +7,7 @@
                  [javax.servlet/servlet-api "2.5"]
                  [ring/ring-core "1.6.0-RC2"]
                  [http-kit "2.2.0"]
-                 [compojure "1.5.2"]
+                 [compojure "1.6.1"]
                  [org.clojure/data.json "0.2.6"]
                  [alaisi/postgres.async "0.8.0"]]
   :main ^:skip-aot benchmark.core


Share the existing env rather than update-ns-map!

--- src/oxcart/passes/lambda_lift.clj
+++ src/oxcart/passes/lambda_lift.clj
@@ -16,7 +16,6 @@
             [oxcart.pattern :as pattern]
             [clojure.tools.analyzer.ast :as ast]
             [clojure.tools.analyzer.passes.jvm.emit-form :refer [emit-form]]
-            [clojure.tools.analyzer.jvm :refer [update-ns-map!]]
             [clojure.tools.analyzer.passes.collect
              :refer [collect-closed-overs]]
             [clojure.set :refer [union]]))
@@ -69,7 +68,7 @@
                                  fn*->cannonical-fn*
                                  (rewrite-fn* used-locals)))
               partial-form `(partial ~(symbol sym) ~@used-locals)
-              def-ast      (util/ast def-form     (update-ns-map! (:env ast)))
+              def-ast      (util/ast def-form     (:env ast))
               partial-ast  (util/ast partial-form (:env ast))]

           ;; create the new def
@@ -101,7 +100,8 @@
         ;;    all the locals of the body expression.

         (let [bindings     (:bindings ast)
-              locals->vars (atom {})]
+              locals->vars (atom {})
+              env          (:env ast)]

           ;; create the forward defs
           (doseq [b bindings]
@@ -110,7 +110,8 @@
                           pattern/fn->name
                           symbol)
                   {:keys [statements ret]} (util/ast `(do (def ~sym)
-                                                    ~sym))
+                                                          ~sym)
+                                                     env)
                   def-ast (first statements)]

               ;; save the def ast


Force Object arrays in btset (closes #212)

--- src/datascript/btset.cljc
+++ src/datascript/btset.cljc
@@ -229,7 +229,7 @@
              i   1
              p   (da/aget arr 0)]
         (if (>= i al)
-          (into-array (persistent! acc)) ;; TODO avoid persistent?
+          (into-array #?(:clj Object) (persistent! acc)) ;; TODO avoid persistent?
           (let [e (da/aget arr i)]
             (if (== 0 (cmp e p))
               (recur acc (inc i) e)
@@ -1006,7 +1006,7 @@
                (+ shift level-shift))))))

 (defn -btset-from-seq [seq cmp] ;; TODO avoid array?
-  (let [arr (-> seq into-array (da/asort cmp) (sorted-arr-distinct cmp))]
+  (let [arr (-> (into-array #?(:clj Object) seq) (da/asort cmp) (sorted-arr-distinct cmp))]
     (-btset-from-sorted-arr arr cmp)))

 (defn btset-by


adding assert-sh and stringfying uuid

adding assert-sh and stringfying uuid

--- test/com/narkisr/common_test.clj
+++ test/com/narkisr/common_test.clj
@@ -2,9 +2,11 @@
   (:require [com.narkisr.couchfs.couch-access :as couch])
   (:import java.io.File)
   (:use
+    [clojure.test :only [is]]
     (com.narkisr.couchfs (mounter :only [mount-with-group]))
     (clojure.java (shell :only [sh]))
-    (com.narkisr fs-logic )
+    (com.narkisr fs-logic)
+    [clojure.tools.trace :only [trace-ns trace-vars]]
     ))

@@ -14,12 +16,21 @@
 (def rename-path)
 (def file-path)

+(defn assert-sh [& v]
+  {:pre [(some #{:out :err} v)]}
+  "assrts a shell cmd output against expected output key"
+  (let [[exec [k] [asrt]] (partition-by keyword? v)]
+    (is (= (k (apply sh exec)) asrt))))
+
+;(trace-ns 'com.narkisr.couchfs.couch-access)
+;(trace-ns 'com.narkisr.couchfs.couch-fs)
+;(trace-vars com.narkisr.couchfs.couch-fs/fs-mkdir)
+
 (defn mount-and-sleep [f]
-  (def uuid (java.util.UUID/randomUUID))
+  (def uuid (str (java.util.UUID/randomUUID)))
   (def meta-file (-> (str "fake/." uuid "/" uuid ".json")))
   (def rename-path (str "fake/" uuid "/" uuid "renamed.html"))
   (def file-path (str "fake/" uuid "/" uuid ".html"))
-  (couch/delete-db "playground")
   (couch/create-non-existing-db "playground")
   (sh "mkdir" "fake")
   (mount-with-group "http://127.0.0.1:5983/" "playground" "fake" "fuse-threads")
@@ -28,6 +39,7 @@
   (f)
   (sh "rm" "-r" (str "fake/" uuid))
   (sh "rm" "-r" (str "fake/." uuid))
-  (sh "fusermount" "-u" "fake"))
+  (sh "fusermount" "-u" "fake")
+  (couch/delete-db "playground"))


Add a comment on generating the parsed tree for inspection

--- test/graphql_clj/parser_test.clj
+++ test/graphql_clj/parser_test.clj
@@ -89,3 +89,9 @@
 (defn render-all-parsed! []
   (render-parsed! "statements.edn" (mapv parser/parse test-statements))
   (render-parsed! "schemas.edn" (mapv parser/parse test-schemas)))
+
+;; To generate a large parsed tree for inspection from the repl
+(comment
+  (require '[graphql-clj.parser-test :as pt])
+  (pt/render-all-parsed!))
+;; Go look in test/scenarios/parsed/schemas.edn and statements.edn


Remove stale comments

Remove stale comments

--- src/expound/problems.cljc
+++ src/expound/problems.cljc
@@ -91,7 +91,7 @@
     ;; 2. If value is unique, just find that, ignoring the 'in' path
     ;; 3. Find the unformed value (if there is an unformer)
     (let [in1 (paths/in-with-kps form (:val problem) (:in problem) [])
-          in' (if (not= :expound.paths/not-found-path (first in1))
+          in' (if (not= ::paths/not-found-path (first in1))
                 in1
                 ;; TODO - rename
                 (let [paths (paths/paths-to-value form (:val problem) [] [])]
@@ -101,12 +101,10 @@
                       (paths/in-with-kps form
                                          (s/unform (last (:via problem)) (:val problem))
                                          (:in problem) [])
-                    ;; TODO - test CLJS
                     ;; The unform fails if there is no unformer
                       (catch #?(:cljs :default
                                 :clj java.lang.IllegalStateException) e
                         in1)))))]
-      ;; TODO - remember to update this when I remove special 'not-found' paths
       (assoc problem :expound/in in'))
     (catch #?(:cljs :default
               :clj Exception) e


Expose completion actions to the user

Expose completion actions to the user

--- src/flense_nw/keymap.cljs
+++ src/flense_nw/keymap.cljs
@@ -1,6 +1,7 @@
 (ns flense-nw.keymap
   (:require [flense.actions.clipboard :as clipboard]
             [flense.actions.clojure :as clojure]
+            [flense.actions.completions :as completions]
             [flense.actions.history :as history]
             [flense.actions.paredit :as paredit]
             [flense.actions.text :as text]
@@ -20,7 +21,6 @@
    #{:backspace} #(or (text/delete-char %) (paredit/delete %))
    #{:shift :backspace} paredit/delete
    #{:shift :space} paredit/insert-left
-   #{:enter} paredit/insert-outside
    #{:space} paredit/insert-right

    #{:ctrl :shift :open-square-bracket} paredit/make-map
@@ -49,6 +49,7 @@
    #{:meta :x} clipboard/cut
    #{:meta :v} clipboard/paste

+   #{:enter} completions/complete
    #{:tab} clojure/expand-template
    #{:meta :shift :d} clojure/jump-to-definition
    #{:shift :three} clojure/toggle-dispatch


Document choice to _not_ throw on non-cluster cmds in cluster mode

--- src/taoensso/carmine/commands.clj
+++ src/taoensso/carmine/commands.clj
@@ -92,6 +92,12 @@
              {:parser parser# ; Parser metadata will be used as req-opts
               :expected-keyslot cluster-keyslot#}))]

+     ;; We could also choose to throw here for non-Cluster commands being used
+     ;; in Cluster mode. For the moment choosing to let Redis server reply with
+     ;; relevant errors since: 1. There's no command spec info on non/cluster
+     ;; keys yet, and 2. The list of supported commands will probably be
+     ;; evolving rapidly for the foreseeable future.
+
      ;; (println "Enqueue request: " request#)
      (swap! req-queue# (fn [[_# q#]] [nil (conj q# request#)]))))


Making slightly more idiomatic

Making slightly more idiomatic

--- jvm-runner/test/codewars/test/utils.clj
+++ jvm-runner/test/codewars/test/utils.clj
@@ -5,7 +5,7 @@
 (defmacro with-java-out-str
   "A version of clojure.core/with-out-str suitable for wrapping java's System.out"
   [& body]
-  `(let [original-out# (PrintStream. (. System out))
+  `(let [original-out# (PrintStream. System/out)
          byte-out# (ByteArrayOutputStream.)]
      (-> byte-out# (PrintStream.) System/setOut)
      ~@body


r is configurable, w is computed

r is configurable, w is computed

--- src/icecap/store/riak.clj
+++ src/icecap/store/riak.clj
@@ -26,7 +26,7 @@
   Additionally, we know that we're never going to see key collisions,
   because the keys are long random strings.
   "
-  [& {n :n r :r :or {:n 3 :w 2}}]
+  [& {n :n r :r :or {:n 3 :r 1}}]
   (let [w (- n r)]
     {:n-val n
      :r r


[#104] Change the way to convert a string to number

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number#Convert_numeric_strings_to_numbers

--- backend/src/org/akvo/dash/transformation/engine.clj
+++ backend/src/org/akvo/dash/transformation/engine.clj
@@ -20,7 +20,7 @@

 (defn to-number
   [engine value]
-  (js-eval engine (str "+" value)))
+  (js-eval engine (str "Number(" value ")")))

 (defn to-string
   [engine value]


Use chat-data-structure from send-to-all

--- src/yetibot/core/adapters/irc.clj
+++ src/yetibot/core/adapters/irc.clj
@@ -10,7 +10,7 @@
     [clojure.string :refer [split-lines join]]
     [yetibot.core.config :refer [update-config get-config config-for-ns
                                  reload-config conf-valid?]]
-    [yetibot.core.chat :refer [send-msg-for-each register-chat-adapter]]
+    [yetibot.core.chat :refer [chat-data-structure send-msg-for-each register-chat-adapter] :as chat]
     [yetibot.core.util.format :as fmt]
     [yetibot.core.handler :refer [handle-raw]]))

@@ -52,11 +52,6 @@
           (start))))
     3 900))

-(defn send-to-all
-  "Send message to all targets. TODO: use chat-data-structure"
-  [msg]
-  (doall (map #(binding [*target* %] (send-msg msg)) (channels))))
-
 (defn- create-user [info]
   (let [username (:nick info)
         id (:user info)]
@@ -74,12 +69,21 @@
    split it and send one for each"
   [p] (send-msg-for-each (prepare-paste p)))

-(defn fetch-users []
-  (doall (map #(irc-conn/write-irc-line @conn "WHO" %) (channels))))
-
 (def messaging-fns
   {:msg send-msg
    :paste send-paste})
+
+(defn send-to-all
+  "Send message to all targets. TODO: use chat-data-structure"
+  [msg]
+  (doall (map #(binding [*target* %
+                         chat/*messaging-fns* messaging-fns]
+                 (chat-data-structure msg))
+              (channels))))
+
+
+(defn fetch-users []
+  (doall (map #(irc-conn/write-irc-line @conn "WHO" %) (channels))))

 (defn recognized-chan? [c] ((set (channels)) c))


improved so far

improved so far

--- src/bluebell/utils/core.clj
+++ src/bluebell/utils/core.clj
@@ -208,6 +208,15 @@
     [new-state
      (denormalize-coll coll new-coll)]))

+(defn normalized-coll-accessor
+  ([] {:desc "Normalized coll accessor"})
+  ([x] (if (coll? x)
+         (normalize-coll x)
+         []))
+  ([x y] (if (coll? x)
+           (denormalize-coll x y)
+           x)))
+
 ;;;;;;;;;;;;;;;;;;; Helpers
 (defn only-visit [x? v]
   (fn [x]
@@ -259,7 +268,9 @@
                [m c] (traverse-postorder-cached-coll m c cfg)]
            [m ((:visit cfg) ((:access-coll cfg) expr c))]))))

-(def default-traverse-cfg {:access-coll coll-accessor})
+(def normalized-coll-accessor)
+
+(def default-traverse-cfg {:access-coll normalized-coll-accessor})

 (defn traverse-postorder-cached
   ([m expr cfg]
@@ -286,6 +297,8 @@
                             (traverse-postorder-with-state-sub
                              state x visit access))
                           state (access expr))
+        _ (do (println "expr=" expr)
+              (println "children=" children))
         expr (access expr children)]
     (visit state expr)))


clearing print

clearing print

--- test/celestial/fixtures.clj
+++ test/celestial/fixtures.clj
@@ -44,7 +44,6 @@
 (defmacro with-conf
   "Using fixture/celestial.edn conf file"
   [f & body]
-  (println (symbol? f))
   (if (symbol? f)
     `(with-redefs [celestial.config/config ~f]
        ~@body


Add an integration test for multipart form uploads

--- test/clj_http/core_test.clj
+++ test/clj_http/core_test.clj
@@ -1,13 +1,15 @@
 (ns clj-http.core-test
-  (:use [clojure.test])
+  (:use [clojure.test]
+        [clojure.java.io :only [file]])
   (:require [clojure.pprint :as pp]
             [clj-http.core :as core]
             [clj-http.util :as util]
-            [ring.adapter.jetty :as ring]))
+            [ring.adapter.jetty :as ring])
+  (:import (java.io ByteArrayInputStream)))

 (defn handler [req]
-  (pp/pprint req)
-  (println) (println)
+  ;;(pp/pprint req)
+  ;;(println) (println)
   (condp = [(:request-method req) (:uri req)]
     [:get "/get"]
     {:status 200 :body "get"}
@@ -26,7 +28,9 @@
       (Thread/sleep 10)
       {:status 200 :body "timeout"})
     [:delete "/delete-with-body"]
-    {:status 200 :body "delete-with-body"}))
+    {:status 200 :body "delete-with-body"}
+    [:post "/multipart"]
+    {:status 200 :body (:body req)}))

 (defn run-server
   []
@@ -120,3 +124,16 @@
         (is (= "get" (slurp-body resp))))
       (finally
        (.stop t)))))
+
+(deftest ^{:integration true} multipart-form-uploads
+  (run-server)
+  (let [bytes (util/utf8-bytes "byte-test")
+        stream (ByteArrayInputStream. bytes)
+        resp (request {:request-method :post :uri "/multipart"
+                       :multipart [["a" "testFINDMEtest"
+                                    "b" bytes
+                                    "c" (file "test-resources/keystore")
+                                    "d" stream]]})
+        resp-body (apply str (map char (:body resp)))]
+    (is (= 200 (:status resp)))
+    (is (re-find #"testFINDMEtest" resp-body))))


constraining implicit dependencies resolving

--- src/leiningen/compile.clj
+++ src/leiningen/compile.clj
@@ -132,7 +132,10 @@
   "Ahead-of-time compile the project. Looks for all namespaces under src/
 unless a list of :namespaces is provided in project.clj."
   [project]
-  (deps project :skip-dev)
+  ;; dependencies should be resolved by explicit "lein deps",
+  ;; otherwise it will be done only if :library-path is empty
+  (when (empty? (find-lib-jars project))
+    (deps project :skip-dev))
   (.mkdir (file (:compile-path project)))
   (let [namespaces (namespaces-to-compile project)]
     (if (seq namespaces)
@@ -141,3 +144,4 @@
                           (println "Compiling" namespace#)
                           (clojure.core/compile namespace#)))
       (println "No :namespaces listed for compilation in project.clj."))))
+


More helpful message when no namespaces are configured for compilation.

--- src/leiningen/compile.clj
+++ src/leiningen/compile.clj
@@ -26,7 +26,7 @@
       nses)))

 (defn stale-namespaces
-  "Given a seq of namespaces that are both compilable and that hav missing or
+  "Given a seq of namespaces that are both compilable and that have missing or
   out-of-date class files."
   [project]
   (filter
@@ -130,7 +130,7 @@
   (when (empty? (find-lib-jars project))
     (deps project :skip-dev))
   (.mkdir (file (:compile-path project)))
-  (if (compilable-namespaces project)
+  (if (seq (compilable-namespaces project))
     (if-let [namespaces (seq (stale-namespaces project))]
       (eval-in-project project
                        `(doseq [namespace# '~namespaces]


bumped up devtools, piggieback

bumped up devtools, piggieback

--- resources/leiningen/new/reagent_frontend/project.clj
+++ resources/leiningen/new/reagent_frontend/project.clj
@@ -49,7 +49,7 @@
   :aliases {"package" ["do" "clean" ["cljsbuild" "once" "release"]]}

   :profiles {:dev {:source-paths ["src" "env/dev/clj"]
-                   :dependencies [[binaryage/devtools "0.9.10"]
+                   :dependencies [[binaryage/devtools "0.9.11"]
                                   [figwheel-sidecar "0.5.19"]
                                   [nrepl "0.6.0"]
-                                  [cider/piggieback "0.4.1"]]}})
+                                  [cider/piggieback "0.4.2"]]}})


Forbid the board to grow out of control

Forbid the board to grow out of control

--- src/cljs/triboard/core.cljs
+++ src/cljs/triboard/core.cljs
@@ -2,6 +2,7 @@
   (:require
     [clojure.string :as str]
     [cljs.core.async :as async :refer [put! chan <! >!]]
+    [goog.dom :as dom]
     [reagent.core :as reagent :refer [atom]])
   (:require-macros
     [cljs.core.async.macros :refer [go go-loop alt!]]
@@ -390,12 +391,16 @@
    (show-scores scores player)
    [top-panel-button #(swap! app-state update :help not) "?"]])

+(defn max-board-height []
+  (* 0.8 (-> (dom/getWindow) dom/getViewportSize .-height)))
+
 (defn run-game []
-  [:div
+  [:div.game-panel
    [show-top-panel @scores @current-player]
    (into
-     [:svg#board
-      {:view-box (str "0 0 " board-width " " board-height)}]
+     [:svg.board
+      {:view-box (str "0 0 " board-width " " board-height)
+       :style {:max-height (str (max-board-height) "px")}}]
      (for [[x y] all-positions]
        ^{:key [x y]}
        (case (get-in @app-state [:board x y])


Create status-area section of UI -Currently only contains tile coordinates

--- src/cljs/zetawar/views.cljs
+++ src/cljs/zetawar/views.cljs
@@ -268,6 +268,14 @@
                 :aria-hidden true
                 :on-click #(dispatch [::events.ui/configure-faction faction])
                 :title (translate :configure-faction-tip)}]]]))))
+
+(defn status-info [{:as view-ctx :keys [conn translate]}]
+  (let [[hover-q hover-r] @(subs/hover-hex conn)]
+    [:p
+     (translate :hover-tile-location)
+     (if hover-q
+       (str hover-q ", " hover-r)
+       "none")]))

 (def armor-type-abbrevs
   {:unit-type.armor-type/personnel "P"
@@ -462,7 +470,8 @@
     [faction-actions view-ctx]]
    [:div.col-md-10
     [faction-status view-ctx]
-    [board view-ctx]]])
+    [board view-ctx]
+    [status-info view-ctx]]])

 (defn app-root [{:as view-ctx :keys [conn dispatch translate]}]
   [:div


Use 'dev' instead of 'handle' as device fd name'

--- src/clopack_native/core.clj
+++ src/clopack_native/core.clj
@@ -6,14 +6,14 @@
 (defn- dev-open [interface]
   (jna/invoke Integer clopack_native/dev_open interface))

-(defn- dev-read [handle buf buf-len]
-  (jna/invoke Integer clopack_native/dev_read handle buf buf-len))
+(defn- dev-read [dev buf buf-len]
+  (jna/invoke Integer clopack_native/dev_read dev buf buf-len))

-(defn- dev-write [handle buf buf-len]
-  (jna/invoke Integer clopack_native/dev_write handle buf buf-len))
+(defn- dev-write [dev buf buf-len]
+  (jna/invoke Integer clopack_native/dev_write dev buf buf-len))

-(defn- dev-close [handle]
-  (jna/invoke Integer clopack_native/dev_close handle))
+(defn- dev-close [dev]
+  (jna/invoke Integer clopack_native/dev_close dev))

 (defn- dev-buf-len []
   (jna/invoke Integer clopack_native/dev_buf_len))
@@ -21,32 +21,32 @@
 (defn create-context [interface]
   "Creates a new packet context with the given interface.
    Returns a packet context on success, nil on errors."
-  (let [handle  (dev-open interface)
+  (let [dev     (dev-open interface)
         buf-len (dev-buf-len)]
-    (when-not (= handle -1)
-      {:handle  handle
+    (when-not (= dev -1)
+      {:dev     dev
        :buf-len buf-len})))

 (defn read-frame [ctx]
   "Reads a data frame as from a packet context.
    Returns a byte-array on success, nil otherwise"
-  (let [handle    (:handle ctx)
+  (let [dev       (:dev ctx)
         buf-len   (:buf-len ctx)
         buf       (byte-array buf-len)
-        num-read  (dev-read handle buf buf-len)]
+        num-read  (dev-read dev buf buf-len)]
     (when-not (= num-read -1)
       (take num-read buf))))

 (defn write-frame [ctx buf]
   "Writes the given byte-array as a data frame through a packet context.
    Returns the number of bytes written on success, nil otherwise."
-  (let [handle      (:handle ctx)
+  (let [dev         (:dev ctx)
         buf-len     (count buf)
-        num-written (dev-write handle buf buf-len)]
+        num-written (dev-write dev buf buf-len)]
     (when-not (= num-written -1)
       num-written)))

 (defn destroy-context [ctx]
   "Destroys a packet context."
-  (dev-close (:handle ctx))
+  (dev-close (:dev ctx))
   nil)


Remove one invalid file test (because throw OutOfMemoryError in travis-ci)

--- test/cljam/t_bam.clj
+++ test/cljam/t_bam.clj
@@ -12,8 +12,7 @@
 (def temp-file-sorted (str temp-dir "/test.sorted.bam"))
 (def not-found-file (str temp-dir "/not-found.bam"))
 (def invalid-file-1 test-fa-file)
-(def invalid-file-2 test-fq-gz-file)
-(def invalid-file-3 test-tabix-file)
+(def invalid-file-2 test-tabix-file)

 (deftest slurp-bam
   (is (= (slurp-bam-for-test test-bam-file) test-sam)))
@@ -115,8 +114,7 @@
   (with-before-after {:before (prepare-cache!)
                       :after (clean-cache!)}
     (is (thrown? Exception (bam/reader invalid-file-1 :ignore-index true)))
-    (is (thrown? Exception (bam/reader invalid-file-2 :ignore-index true)))
-    (is (thrown? IOException (bam/reader invalid-file-3 :ignore-index true)))
+    (is (thrown? IOException (bam/reader invalid-file-2 :ignore-index true)))
     (is (thrown? IOException (bam/reader not-found-file :ignore-index true)))))

 (deftest bamreader-medium-file


Fix comment, remove debug log.

Fix comment, remove debug log.

--- src/oc/storage/representations/activity.clj
+++ src/oc/storage/representations/activity.clj
@@ -68,7 +68,7 @@
           resources-list (:activity data)
           last-resource (last resources-list)
           last-resource-date (:sort-value last-resource)
-          ;; In case the response doesn't contains all the possible posts or
+          ;; In case the response contains all the possible posts or
           ;; the number of returned posts is smaller than the requested number
           ;; we don't add a next url for pagination
           next? (and (not= (:next-count data) (:total-count data))
@@ -99,7 +99,6 @@
   activity for the API.
   "
   [params org collection-type activity boards-by-uuid user]
-  (println "DBG render-activity-list refresh" (:refresh params) "direction" (:direction params))
   (let [following? (:following params)
         unfollowing? (:unfollowing params)
         bookmarks? (is-bookmarks? collection-type)


Fix and note about property case test

Fix and note about property case test

--- test/reagenttest/testreagent.cljs
+++ test/reagenttest/testreagent.cljs
@@ -288,10 +288,12 @@
   ;; (is (not (re-find #"enctype"
   ;;                   (as-string [:div {"enc-type" "x"}])))
   ;;     "Strings are passed through to React.")
-  (is (re-find #"encType"
+  ;; FIXME: For some reason UMD module returns everything in
+  ;; lowercase, and CommonJS with upper T
+  (is (re-find #"enc[tT]ype"
                (as-string [:div {"encType" "x"}]))
       "Strings are passed through to React, and have to be camelcase.")
-  (is (re-find #"encType"
+  (is (re-find #"enc[tT]ype"
                (as-string [:div {:enc-type "x"}]))
       "Strings are passed through to React, and have to be camelcase."))


use babel.enrich

use babel.enrich

--- babel/francais.clj
+++ babel/francais.clj
@@ -6,6 +6,7 @@

 (require '[dag-unify.core :refer (fail? get-in strip-refs)])
 (require '[babel.cache :refer [create-index]])
+(require '[babel.enrich :refer [enrich]])
 (require '[babel.forest :as forest])
 (require '[babel.francais.grammar :refer [grammar]])
 (require '[babel.francais.lexicon :refer [lexicon-source]])
@@ -87,8 +88,6 @@
       (forest/generate-all spec use-grammar
                            (flatten (vals @use-lexicon))
                            use-index))))
-(declare enrich)
-
 (def small
   (future
     (let [grammar
@@ -133,72 +132,3 @@
        :index (create-index grammar (flatten (vals lexicon)) head-principle)
        })))

-(declare against-comp)
-(declare against-pred)
-(declare matching-comp-lexemes)
-(declare matching-head-lexemes)
-
-(defn enrich [spec]
-  (let [against-pred (against-pred spec)]
-    (if true against-pred
-        (let [against-comp (map (fn [spec]
-                            (against-comp spec))
-                          (if (seq? against-pred)
-                            (seq (set against-pred))
-                            against-pred))]
-          (if (seq? against-comp)
-            (seq (set against-comp))
-            against-comp)))))
-
-(defn against-pred [spec]
-  (let [pred (get-in spec [:synsem :sem :pred] :top)]
-    (if (= :top pred)
-      spec
-      (mapcat (fn [lexeme]
-                (let [result (unify spec
-                                    {:synsem {:sem (strip-refs (get-in lexeme [:synsem :sem] :top))}}
-                                    {:synsem {:essere (strip-refs (get-in lexeme [:synsem :essere] :top))}}
-                                    )]
-                  (if (not (fail? result))
-                    (list result))))
-              (matching-head-lexemes spec)))))
-
-;; TODO: not currently used: needs to be called from within (enrich).
-(defn against-comp [spec]
-  (let [pred-of-comp (get-in spec [:synsem :sem :subj :pred] :top)]
-    (if (= :top pred-of-comp)
-      spec
-      (mapcat (fn [lexeme]
-                (let [result (unify spec
-                                    {:comp {:synsem {:agr (strip-refs (get-in lexeme [:synsem :agr] :top))
-                                                     :sem (strip-refs (get-in lexeme [:synsem :sem] :top))}}})]
-                  (if (not (fail? result))
-                    (list result))))
-              (matching-comp-lexemes spec)))))
-
-(defn matching-head-lexemes [spec]
-  (let [pred-of-head (get-in spec [:synsem :sem :pred] :top)]
-    (if (= pred-of-head :top)
-      spec
-      (mapcat (fn [lexemes]
-                (mapcat (fn [lexeme]
-                          (if (= pred-of-head
-                                 (get-in lexeme [:synsem :sem :pred] :top))
-                            (list lexeme)))
-                        lexemes))
-              (vals @lexicon)))))
-
-(defn matching-comp-lexemes [spec]
-  (let [pred-of-comp (get-in spec [:synsem :sem :subj :pred] :top)]
-    (if (= pred-of-comp :top)
-      spec
-      (mapcat (fn [lexemes]
-                (mapcat (fn [lexeme]
-                          (if (= pred-of-comp
-                                 (get-in lexeme [:synsem :sem :pred] :top))
-                            (list lexeme)))
-                        lexemes))
-              (vals @lexicon)))))
-
-(defn + [& args]
-  (parse (string/join " " args)))


Add the '--help' option

Add the '--help' option

--- src/cyanite_remover/cli.clj
+++ src/cyanite_remover/cli.clj
@@ -179,7 +179,8 @@
                     (not= (get logconfig/levels % :not-found) :not-found))
                "Invalid log level"]]
    ["-S" "--stop-on-error" "Stop on first non-fatal error"]
-   ["-P" "--disable-progress" "Disable progress bar"]])
+   ["-P" "--disable-progress" "Disable progress bar"]
+   ["-h" "--help" "Show this help"]])

 (defn- run-command
   "Run command."
@@ -197,7 +198,7 @@
         (cli/parse-opts args cli-options)]
     ;; Handle help and error conditions
     (cond
-     (< (count args) 1) (exit 0 (usage summary))
+     (or (< (count args) 1) (contains? options :help)) (exit 0 (usage summary))
      errors (exit 1 (error-msg errors)))
     ;; Run command
     (run-command arguments options summary)


cljfmt

cljfmt

--- src/desdemona/ui/table.cljs
+++ src/desdemona/ui/table.cljs
@@ -48,7 +48,7 @@
               [:li {:class (when (active? k) "active")}
                [:a {:href "#"
                     :on-click #(when (> (count toggled-cols) 1)
-                                (session/update! session-entry toggle-key k))}
+                                 (session/update! session-entry toggle-key k))}
                 (wd/describe-key k)]]))]]))

 (def columns-toggler-component


Three tests for the function start-server

--- test/hurvinek/core_test.clj
+++ test/hurvinek/core_test.clj
@@ -11,8 +11,10 @@
 ;

 (ns hurvinek.core-test
-  (:require [clojure.test :refer :all]
-            [hurvinek.core :refer :all]))
+  (:require [clojure.test       :refer :all]
+            [hurvinek.core      :refer :all]
+            [ring.adapter.jetty :as    jetty]
+            [clojure.tools.cli  :as    cli]))

 ;
 ; Common functions used by tests.
@@ -100,3 +102,33 @@
         (is (thrown? AssertionError (get-and-check-port "65537")))
         (is (thrown? AssertionError (get-and-check-port "1000000")))))

+(deftest test-start-server-positive-1
+    (testing "hurvinek.core/start-server"
+        ; use mock instead of jetty/run-jetty
+        (with-redefs [jetty/run-jetty (fn [app port] port)]
+            (is (= {:port 1}     (start-server "1")))
+            (is (= {:port 2}     (start-server "2")))
+            (is (= {:port 1000}  (start-server "1000")))
+            (is (= {:port 65534} (start-server "65534")))
+            (is (= {:port 65535} (start-server "65535"))))))
+
+(deftest test-start-server-positive-2
+    (testing "hurvinek.core/start-server"
+        ; use mock instead of jetty/run-jetty
+        (with-redefs [jetty/run-jetty (fn [app port] app)]
+            (is (= app (start-server "1")))
+            (is (= app (start-server "2")))
+            (is (= app (start-server "1000")))
+            (is (= app (start-server "65534")))
+            (is (= app (start-server "65535"))))))
+
+(deftest test-start-server-wrong-port-number
+    (testing "hurvinek.core/start-server"
+        ; use mock instead of jetty/run-jetty
+        (with-redefs [jetty/run-jetty (fn [app port] port)]
+            (is (= {:port -1}      (start-server "-1")))
+            (is (= {:port 0}       (start-server "0")))
+            (is (= {:port 65536}   (start-server "65536")))
+            (is (= {:port 65537}   (start-server "65537")))
+            (is (= {:port 1000000} (start-server "1000000"))))))
+


Test for function show-help

Test for function show-help

--- test/hurvinek/core_test.clj
+++ test/hurvinek/core_test.clj
@@ -132,3 +132,12 @@
             (is (= {:port 65537}   (start-server "65537")))
             (is (= {:port 1000000} (start-server "1000000"))))))

+(deftest test-show-help
+    (testing "hurvinek.core/show-help"
+        (let [options (cli/parse-opts nil cli-options)]
+            (is (= (with-out-str (show-help options))
+                   (str
+                   "Usage:\n"
+                   "  -p, --port   PORT  port number\n"
+                   "  -h, --help         show this help\n"))))))
+


get-random-name should be a lot faster now

--- src/hphelper/shared/sql.clj
+++ src/hphelper/shared/sql.clj
@@ -94,7 +94,9 @@
 (defn get-random-name
   "Gets a random name from the database. at a specified clearance level"
   ([clearance]
-   (let [nameMap (get-random-item (query "SELECT * FROM `first_name`;"))]
+   (let [nameMap (first (query "SELECT * FROM `first_name` LIMIT 1 OFFSET ?;"
+                                         ((comp rand-int :cnt first)
+                                          (query "SELECT COUNT(`fn_id`) AS `cnt` FROM `first_name`"))))]
      (str (nameMap :fn_name) "-"
           clearance "-"
           (create-random-zone-name))))


Simplify kmg.datomic-helpers/prepare-entity

Let's burn one more pair of brackets.

--- src/kmg/datomic_helpers.clj
+++ src/kmg/datomic_helpers.clj
@@ -27,7 +27,7 @@
 (defn prepare-entity [data]
   (if (contains? data :db/id)
     data
-    (merge data {:db/id (d/tempid :db.part/user)})))
+    (assoc data :db/id (d/tempid :db.part/user))))

 (defn prepare-entities [data]
   (map prepare-entity data))


Whitespace

Whitespace

--- src/onyx/plugin/datomic.clj
+++ src/onyx/plugin/datomic.clj
@@ -9,7 +9,7 @@
             [taoensso.timbre :refer [info debug fatal]]))

 (defn safe-connect [task-map]
-  (if-let [uri (:datomic/uri task-map)]
+  (if-let [uri (:datomic/uri task-map)]
     (d/connect uri)
     (throw (ex-info ":datomic/uri missing from write-datoms task-map." task-map))))

@@ -24,7 +24,7 @@

 (defn start-commit-loop! [commit-ch log k]
   (go-loop []
-           (when-let [content (<!! commit-ch)]
+           (when-let [content (<!! commit-ch)]
              (extensions/force-write-chunk log :chunk content k)
              (recur))))

@@ -53,7 +53,7 @@
           range-end (:datomic/index-range-end task-map)]
       (d/index-range db attribute range-start range-end))))

-(defn close-read-datoms-resources
+(defn close-read-datoms-resources
   [{:keys [datomic/producer-ch datomic/commit-ch datomic/read-ch] :as event} lifecycle]
   (close! read-ch)
   (close! commit-ch)
@@ -80,12 +80,12 @@
                             (loop [chunk-index (inc start-index)
                                    datoms (seq (drop num-ignored
                                                      (datoms-sequence db task-map)))]
-                              (when datoms
+                              (when datoms
                                 (let [success? (>!! ch (assoc (t/input (java.util.UUID/randomUUID)
                                                                        {:datoms (map unroll (take datoms-per-segment datoms))})
-                                                              :chunk-index chunk-index))]
+                                                              :chunk-index chunk-index))]
                                   (if success?
-                                    (recur (inc chunk-index)
+                                    (recur (inc chunk-index)
                                            (seq (drop datoms-per-segment datoms)))))))
                             (>!! ch (t/input (java.util.UUID/randomUUID) :done))
                             (catch Exception e
@@ -97,7 +97,7 @@
          :datomic/drained? (:drained pipeline)
          :datomic/top-chunk-index (:top-chunk-index pipeline)
          :datomic/top-acked-chunk-index (:top-acked-chunk-index pipeline)
-         :datomic/pending-chunk-indices (:pending-chunk-indices pipeline)
+         :datomic/pending-chunk-indices (:pending-chunk-indices pipeline)
          :datomic/pending-messages (:pending-messages pipeline)}))))

 (defn highest-acked-chunk [starting-index max-index pending-chunk-indices]
@@ -107,16 +107,16 @@
       max-pending
       (recur (inc max-pending)))))

-(defrecord DatomicInput [log task-id max-pending batch-size batch-timeout
+(defrecord DatomicInput [log task-id max-pending batch-size batch-timeout
                          pending-messages drained?
-                         top-chunk-index top-acked-chunk-index pending-chunk-indices
+                         top-chunk-index top-acked-chunk-index pending-chunk-indices
                          read-ch commit-ch]
   p-ext/Pipeline
-  (write-batch
+  (write-batch
     [this event]
     (function/write-batch event))

-  (read-batch
+  (read-batch
     [_ event]
     (let [pending (count (keys @pending-messages))
           max-segments (min (- max-pending pending) batch-size)
@@ -124,14 +124,14 @@
           batch (->> (range max-segments)
                      (keep (fn [_] (first (alts!! [read-ch timeout-ch] :priority true)))))]
       (doseq [m batch]
-        (when-let [chunk-index (:chunk-index m)]
+        (when-let [chunk-index (:chunk-index m)]
           (swap! top-chunk-index max chunk-index)
           (swap! pending-chunk-indices conj chunk-index))
         (swap! pending-messages assoc (:id m) m))
     (when (and (= 1 (count @pending-messages))
                (= (count batch) 1)
                (= (:message (first batch)) :done))
-      (>!! commit-ch {:status :complete})
+      (>!! commit-ch {:status :complete})
       (reset! drained? true))
     {:onyx.core/batch batch}))

@@ -145,7 +145,7 @@
         (reset! top-acked-chunk-index new-top-acked))
       (swap! pending-messages dissoc segment-id)))

-  (retry-segment
+  (retry-segment
     [_ event segment-id]
     (when-let [msg (get @pending-messages segment-id)]
       (>!! read-ch (assoc msg :id (java.util.UUID/randomUUID))))
@@ -155,7 +155,7 @@
     [_ _ segment-id]
     (get @pending-messages segment-id))

-  (drained?
+  (drained?
     [_ _]
     @drained?))

@@ -165,12 +165,12 @@
         batch-size (:onyx/batch-size catalog-entry)
         batch-timeout (or (:onyx/batch-timeout catalog-entry) (:onyx/batch-timeout defaults))
         read-ch (chan (or (:datomic/read-buffer catalog-entry) 1000))
-        commit-ch (chan (sliding-buffer 1))]
+        commit-ch (chan (sliding-buffer 1))]
     (->DatomicInput (:onyx.core/log pipeline-data)
                     (:onyx.core/task-id pipeline-data)
-                    max-pending batch-size batch-timeout
-                    (atom {})
-                    (atom false)
+                    max-pending batch-size batch-timeout
+                    (atom {})
+                    (atom false)
                     (atom -1)
                     (atom -1)
                     (atom #{})
@@ -196,7 +196,7 @@
    (:tx datom)
    (:added datom)])

-(defn close-read-log-resources
+(defn close-read-log-resources
   [{:keys [datomic/producer-ch datomic/commit-ch datomic/read-ch] :as event} lifecycle]
   (close! read-ch)
   (close! commit-ch)
@@ -288,16 +288,16 @@
       max-pending
       (recur (inc max-pending)))))

-(defrecord DatomicLogInput
+(defrecord DatomicLogInput
   [log task-id max-pending batch-size batch-timeout pending-messages drained?
    top-tx top-acked-tx pending-txes
    read-ch commit-ch]
   p-ext/Pipeline
-  (write-batch
+  (write-batch
     [this event]
     (function/write-batch event))

-  (read-batch
+  (read-batch
     [_ event]
     (let [pending (count (keys @pending-messages))
           max-segments (min (- max-pending pending) batch-size)
@@ -329,7 +329,7 @@
         (reset! top-acked-tx new-top-acked))
       (swap! pending-messages dissoc segment-id)))

-  (retry-segment
+  (retry-segment
     [_ event segment-id]
     (when-let [msg (get @pending-messages segment-id)]
       (>!! read-ch (assoc msg :id (java.util.UUID/randomUUID))))
@@ -339,7 +339,7 @@
     [_ _ segment-id]
     (get @pending-messages segment-id))

-  (drained?
+  (drained?
     [_ _]
     @drained?))

@@ -382,50 +382,50 @@

 (defrecord DatomicWriteDatoms [conn partition]
   p-ext/Pipeline
-  (read-batch
+  (read-batch
     [_ event]
     (function/read-batch event))

-  (write-batch
+  (write-batch
     [_ event]
     (let [messages (mapcat :leaves (:tree (:onyx.core/results event)))]
       @(d/transact conn
-                   (map (fn [msg] (if (and partition (not (sequential? msg)))
+                   (map (fn [msg] (if (and partition (not (sequential? msg)))
                                     (assoc msg :db/id (d/tempid partition))
                                     msg))
                         (map :message messages)))
       {:onyx.core/written? true}))

-  (seal-resource
+  (seal-resource
     [_ _]
     {}))

 (defn write-datoms [pipeline-data]
   (let [task-map (:onyx.core/task-map pipeline-data)
-        conn (safe-connect task-map)
-        partition (:datomic/partition task-map)]
+        conn (safe-connect task-map)
+        partition (:datomic/partition task-map)]
     (->DatomicWriteDatoms conn partition)))

 (defrecord DatomicWriteBulkDatoms [conn]
   p-ext/Pipeline
-  (read-batch
+  (read-batch
     [_ event]
     (function/read-batch event))

-  (write-batch
+  (write-batch
     [_ event]
     ;; Transact each tx individually to avoid tempid conflicts.
     (doseq [tx (mapcat :leaves (:tree (:onyx.core/results event)))]
       @(d/transact conn (:tx (:message tx))))
     {:onyx.core/written? true})

-  (seal-resource
+  (seal-resource
     [_ _]
     {}))

 (defn write-bulk-datoms [pipeline-data]
   (let [task-map (:onyx.core/task-map pipeline-data)
-        conn (safe-connect task-map)]
+        conn (safe-connect task-map)]
     (->DatomicWriteBulkDatoms conn)))

 (def read-datoms-calls
@@ -455,7 +455,7 @@
              basis-t (d/as-of basis-t))]
     {:datomic/conn conn
      :datomic/db db
-     :onyx.core/params (if param?
+     :onyx.core/params (if param?
                          (conj params db)
                          params)}))

@@ -466,9 +466,9 @@
   (when-not uri
     (throw (ex-info "Missing :datomic/uri in inject-conn-calls lifecycle."
                     lifecycle)))
-  (let [conn (d/connect uri)]
+  (let [conn (d/connect uri)]
     {:datomic/conn conn
-     :onyx.core/params (if param?
+     :onyx.core/params (if param?
                          (conj params conn)
                          params)}))


Filter by region and stack name.

Filter by region and stack name.

--- src/onyx_benchmark/util.clj
+++ src/onyx_benchmark/util.clj
@@ -1,5 +1,11 @@
 (ns onyx-benchmark.util
   (:require [cheshire.core :refer [parse-string]]))
+
+(defn in-stack? [stack-name tags]
+  (seq (filter (fn [t] (and (= (:Key t) "stack-name") (= (:Value t) stack-name))) tags)))
+
+(defn in-region? [stack-region tags]
+  (seq (filter (fn [t] (and (= (:Key t) "stack-region") (= (:Value t) stack-region))) tags)))

 (defn peer? [tags]
   (seq (filter (fn [t] (and (= (:Key t) "stack-role") (= (:Value t) "peer"))) tags)))
@@ -10,9 +16,15 @@
 (defn metrics? [tags]
   (seq (filter (fn [t] (and (= (:Key t) "stack-role") (= (:Value t) "metrics"))) tags)))

-(defn -main [file & args]
+(defn -main [stack-name stack-region file & args]
   (let [contents (parse-string (slurp file) true)
         instances (mapcat :Instances (:Reservations contents))]
-    (spit "/home/ubuntu/zookeeper.txt" (:PublicDnsName (first (filter (fn [i] (zk? (:Tags i))) instances))))
-    (spit "/home/ubuntu/metrics.txt" (:PublicDnsName (first (filter (fn [i] (metrics? (:Tags i))) instances))))))
+    (spit "/home/ubuntu/zookeeper.txt" (:PublicDnsName (first (filter (fn [i] (and (zk? (:Tags i))
+                                                                                (in-stack? stack-name (:Tags i))
+                                                                                (in-region? stack-region (:Tags i))))
+                                                                      instances))))
+    (spit "/home/ubuntu/metrics.txt" (:PublicDnsName (first (filter (fn [i] (and (metrics? (:Tags i))
+                                                                                (in-stack? stack-name (:Tags i))
+                                                                                (in-region? stack-region (:Tags i))))
+                                                                    instances))))))


make cljs.js core dumping configurable, it doubles output size and slows down compile time.

--- src/main/cljs/cljs/js.clj
+++ src/main/cljs/cljs/js.clj
@@ -18,4 +18,7 @@
      ~@body))

 (defmacro dump-core []
-  `(quote ~(get-in @env/*compiler* [::ana/namespaces 'cljs.core])))
+  (let [state @env/*compiler*]
+    (if-not (false? (get-in state [:options :dump-core]))
+      `(quote ~(get-in state [::ana/namespaces 'cljs.core]))
+      `(hash-map))))


Fixed bug in tf-idf where it wasn't returning all-terms.

--- project/analyze-data/src/analyze_data/tf_idf/core.clj
+++ project/analyze-data/src/analyze_data/tf_idf/core.clj
@@ -44,5 +44,7 @@
   [term-corpus]
   (let [all-terms (sort (distinct (apply concat term-corpus)))
         tf-corpus (map double-normalized-term-frequency term-corpus)
-        idf (inverse-document-frequency tf-corpus)]
-    (map (partial tf-idf-document idf all-terms) tf-corpus)))
+        idf (inverse-document-frequency tf-corpus)
+        tf-idf-values (map (partial tf-idf-document idf all-terms) tf-corpus)]
+    (cons all-terms tf-idf-values)))
+


Fix channel variable name

Fix channel variable name

--- worker/src/worker/main.clj
+++ worker/src/worker/main.clj
@@ -51,7 +51,7 @@
           "geocommit.job.fast" "{\"repository-url\": \"https://github.com/peritus/geocommit\", \"identifier\": \"github.com/peritus/geocommit\", \"commits\": [\"8b66817de64bea338726a1d479f42e28957bd337\", \"6b3fb2040331889642eb35f708c3c2e56dbc1ea5\"]}"
           :content-type "application/json"
           :type "geocommit.job.update")
-        (rmq/close channel-fast)
+        (rmq/close channel-default)
         (rmq/close channel-slow)
         (rmq/close connection))
       (do


Reactive the 'state' for one and use the state 'state-fnx' from the model for the fnx part.

--- src/app/cljs/one/sample/controller.cljs
+++ src/app/cljs/one/sample/controller.cljs
@@ -2,7 +2,7 @@
   application state."}
   one.sample.controller
   (:use [one.browser.remote :only (request)]
-        [one.sample.model :only (state)])
+        [one.sample.model :only (state state-fnx)])
   (:require [cljs.reader :as reader]
             [clojure.browser.event :as event]
             [one.dispatch :as dispatch]
@@ -26,7 +26,7 @@
   :type)

 (defmethod action :init [_]
-  #_(reset! state {:state :init}))
+  (reset! state {:state :init}))

 (defmethod action :form [_]
   (when-not (#{:form :init} (:state @state))
@@ -93,7 +93,7 @@
    "bar.file"     ["bar"     []                           ["ls"]]})

 (defmethod action-fnx :init [_]
-  (reset! state {:state :init, :all-ns all-ns}))
+  (reset! state-fnx {:state :init, :all-ns all-ns}))

 (dispatch/react-to #{:init}
                    (fn [t d] (action-fnx (assoc d :type t))))


Complete the test of derivative

Complete the test of derivative

--- test/clj/algorithms_clj/derivative_test.clj
+++ test/clj/algorithms_clj/derivative_test.clj
@@ -46,13 +46,14 @@
     (derivative [* :x :y] :x) => :y
     (derivative [* :x :y :z] :x) => [* :y :z]
     (derivative [* :x :x :x] :x) => [+ [* :x :x] [* :x :x] [* :x :x]] ;; TODO: Perfect
-    )
-  )
+    ))

 (deftest test-product-sum-composites
   (fact "Sum of product"
-    ;;(derivative [+ [* :x :y] [:x :x]] :x) => [+ :y [+ :x :x]] ;; FIX
+    (derivative [+ [* :x :y] [* :x :x]] :x) => [+ :y [+ :x :x]] ;; TODO: Perfect
     )
-  )
+  (fact "Product of sum"
+    (derivative [* [+ :x :y] [+ :x :x]] :x) => [+ [+ :x :x] [* 2 [+ :x :y]]] ;; TODO: Perfect
+    ))

 (run-tests)


for être=false verbs, no gender or number agreement

--- src/babel/francais/morphology/verbs.clj
+++ src/babel/francais/morphology/verbs.clj
@@ -326,7 +326,8 @@
       irregular

       ;; else, no :past-participle irregular form found, so use regular.
-      (let [er-type (re-find #"[ée]r$" infinitive) ;; c.f. italiano -are
+      (let [essere (get-in word [:essere])
+            er-type (re-find #"[ée]r$" infinitive) ;; c.f. italiano -are
             re-type (re-find #"re$" infinitive) ;; c.f. italian -ere
             ir-type (re-find #"ir$" infinitive) ;; c.f. italian -ire
             stem (string/replace infinitive #"[iaeé]r$" "")
@@ -357,7 +358,11 @@
                   true
                   "i")]
         ;; regular
-        (str stem verb-type-suffix gender-suffix number-suffix)))))
+        (str stem verb-type-suffix
+             (if essere
+               gender-suffix "")
+             (if essere
+               number-suffix ""))))))

 (defn number-and-person [number person]
   (cond (and (= person :1st) (= number :sing))


remove case that's never relevant

remove case that's never relevant

--- src/clj/lambdacd/internal/execution.clj
+++ src/clj/lambdacd/internal/execution.clj
@@ -31,9 +31,7 @@
           cur-result
           (do
             (pipeline-state/update ctx new-result)
-             (if (is-finished key value)
-               new-result
-               (recur new-result))))))))
+            (recur new-result)))))))

 (defn- process-final-result [step-result ctx]
   (let [new-step-result (assoc step-result :status (get step-result :status :undefined))]


update window

update window

--- src/cljs/cljs_morphic/morph/window.cljs
+++ src/cljs/cljs_morphic/morph/window.cljs
@@ -1,6 +1,7 @@
 (ns cljs-morphic.morph.window
-  (:require [cljs-morphic.morph :refer [rectangle image ellipse find-morph
-                                        set-prop position-in-world redefine]]
+  (:require [cljs-morphic.morph :refer [rectangle image ellipse text
+                                        set-prop position-in-world redefine $morph]]
+            [fresnel.lenses :refer [fetch]]
             [cljs-morphic.helper :refer-macros [morph-fn] :refer [add-points]]))

 (declare window)
@@ -8,24 +9,68 @@
 (morph-fn layout-morph [self props submorphs]
      ((props :layout) self props submorphs))

-(defn layout [submorphs]
-  "traverse the morph hierarchy and enforce the defined layout properties"
-  submorphs)
+(def control-height 12)
+
+(defn close-box [target-id]
+  (ellipse
+   {:position {:x 10 :y 10}
+    :fill "#ff6052"
+    :mouse-enter '(fn [world]
+                    (let [x-box (-> self :>> :submorphs first)]
+                      (om/update! x-box [:morph :Visible] true)))
+    :mouse-leave '(fn [world]
+                    (let [x-box (-> self :>> :submorphs first)]
+                      (om/update! x-box [:morph :Visible] false)))
+    :mouse-click '(fn [world]
+                    (let [target (-> self :>> :morph :target-id)]
+                      (morphic/remove-morph! ($morph "World") target)))
+    :extent {:x control-height :y control-height}
+    :target-id target-id}
+   (text {:position {:x -2 :y -6}
+          :id "close-label"
+          :text-string "×"
+          :font-size 10
+          :allow-input false
+          :visible true})))
+
+(defn min-box [target-id]
+  (ellipse
+   {:position {:x 30 :y 10}
+    :extent {:x control-height :y control-height}
+    :fill "#ffbe06"
+    :mouse-enter '(fn [world id]
+                     (let [x-box (-> self :>> :submorphs first)]
+                       (om/update! x-box [:morph :Visible] true)))
+    :mose-leave '(fn [world id]
+                     (let [x-box (-> self :>> :submorphs first)]
+                       (om/update! x-box [:morph :Visible] false)))
+    :mouse-click '(fn [world id]
+                    (let [target (fetch world [self :properties :target-id])
+                          width (fetch world [($morph target) :properties :extent :x])]
+                  (morphic/set-prop world target {:x width :y 30})))
+    :target-id target-id}
+   (text {:position {:x -2 :y -6}
+          :id "min-label"
+          :text-string "−"
+          :font-size 10
+          :allow-input false
+          :visible true})))

 (morph-fn window-resizer [window props submorphs]
           (window props submorphs
-                  (-> (rectangle {:fill "red"
-                                  :id "resizer"
-                                  :draggable? true
-                                  :position (add-points (props :extent) {:x -25 :y -25})
-                                  :extent {:x 25 :y 25}
-                                  :css {"cursor" "nwse-resize"}
-                                  :on-drag (fn [world id]
-                                             (let [[_ {pos :position} _] (find-morph world id)]
-                                               (redefine world (props :id)
-                                                         (fn [window props submorphs]
-                                                           (window (assoc props :extent (add-points pos {:x 25 :y 25}))
-                                                                   (layout submorphs))))))}))))
+                  (-> (image {:url "http://localhost:8084/resize.png"
+                              :id (str "resizer-on-" (props :id))
+                              :opacity 0.3
+                              :draggable? true
+                              :position (add-points (props :extent) {:x -25 :y -25})
+                              :extent {:x 25 :y 25}
+                              :css {"cursor" "nwse-resize"}
+                              :on-drag (fn [world id]
+                                         (let [[_ {pos :position} _] (fetch world ($morph id))
+                                               new-extent (add-points pos {:x 25 :y 25})]
+                                           (-> world
+                                             (set-prop (:id props) :extent new-extent)
+                                             (set-prop  (:target-id props) :extent (add-points {:x 0 :y -30} new-extent)))))}))))

 (morph-fn window [self props submorphs]
           (let [window-ext (add-points {:x 0 :y 30} (props :extent))
@@ -39,7 +84,7 @@
                           :border-radius 10
                           :border-width 1
                           :drop-shadow true
-                          :draggable? true}
+                          :draggable? true
+                          :target-id (:id props)}
                          (self (assoc props :position {:x 0 :y 30} :draggable? false) submorphs))
-              ; window-resizer
-              )))+              window-resizer)))


import other async symbols

import other async symbols

--- src/cljs/infinitelives/pixi/events.cljs
+++ src/cljs/infinitelives/pixi/events.cljs
@@ -1,4 +1,7 @@
-(ns infinitelives.pixi.events)
+(ns infinitelives.pixi.events
+  (:require [cljs.core.async :refer [put! chan close!]])
+  (:require-macros [cljs.core.async.macros :refer [go]]))
+

 ;;
 ;; Resize Channel


only position is on by default

only position is on by default

--- src/cljs/infinitelives/pixi/sprite.cljs
+++ src/cljs/infinitelives/pixi/sprite.cljs
@@ -188,7 +188,7 @@
             alpha 1
             visible true
             rotation 0
-            particle-opts #{:position :alpha}}}]
+            particle-opts #{:position}}}]
   (let [container
         (if particle
           (js/PIXI.ParticleContainer. nil (opts->js particle-opts))


refactor directive for CLI

refactor directive for CLI

--- src/clojure/zensols/cisql/directive.clj
+++ src/clojure/zensols/cisql/directive.clj
@@ -10,26 +10,79 @@
             [zensols.cisql.db-access :as db]
             [zensols.cisql.table-export :as te]))

-(declare print-help)
-(declare init-grammer)
-(declare connect-help)
-(declare connect)
-(declare export)
+(declare directives)

-(def ^:private directives
+(defn- command-line-directive [name desc ns-sym func-sym]
+  {:name name
+   :arg-count "*"
+   :usage "<help|[options]>"
+   :desc desc
+   :fn (fn [_ args]
+         (log/debugf "%s: args: <%s>" name args)
+         (binding [parse/*rethrow-error* false
+                   parse/*include-program-in-errors* false]
+           (let [ctx (-> (list ns-sym func-sym)
+                         parse/single-action-context)]
+             (if (or (empty? args) (= "help" (first args)))
+               (parse/print-action-help ctx)
+               (->> (parse/process-arguments ctx args)
+                    (#(println "configured" %)))))))})
+
+(defn- export [query last-query csv-name]
+  (log/debugf "last query: %s" last-query)
+  (let [to-export (or query last-query)]
+    (if-not to-export
+      (binding [*out* *err*]
+        (-> "no queued query (skip the query delimiter (%s) after SQL)"
+            (format (conf/config :linesep))
+            (ex-info {:query query
+                      :last-query last-query
+                      :csv-name csv-name})
+            throw)))
+    (if-not query
+      (println "no queued query so using the last executed"))
+    (te/export-table-csv to-export csv-name)))
+
+(defn- print-command-help []
+  (let [decls (->> (directives)
+                   (map (fn [{:keys [name usage desc]}]
+                          (when desc
+                            {:decl (str name " " usage)
+                             :desc desc})))
+                   (remove nil?))
+        space (->> decls (map #(-> % :decl count)) (reduce max) (max 0) (+ 2))]
+    (->> decls
+         (map (fn [{:keys [decl desc]}]
+                (let [fmt (str "%-" space "s %s")]
+                  (println (format fmt decl desc)))))
+         doall)))
+
+(defn- print-help []
+  (println "commands:")
+  (print-command-help)
+  (println)
+  (println "variables:")
+  (conf/print-key-desc))
+
+(defn- grammer []
+  (->> (directives)
+       (map #(select-keys % [:name :arg-count]))))
+
+(defn init-grammer []
+  (r/set-grammer (conf/config :linesep) (grammer)))
+
+(defn directives-by-name []
+  (let [dirs (directives)]
+   (zipmap (map :name (directives))
+           (map #(dissoc % :name) dirs))))
+
+(defn- directives []
   [{:name "help"
     :arg-count 0
     :fn (fn [& _]
           (print-help))}
-   {:name "connect"
-    :arg-count "*"
-    :usage "<help|[options]>"
-    :desc "connect to a database (try 'help')"
-    :fn (fn [_ args]
-          (log/debugf "connect: args: <%s>" args)
-          (if (or (empty? args) (= "help" (first args)))
-            (connect-help)
-            (connect args)))}
+   (command-line-directive "connect" "connect to a database (try 'help')"
+                           'zensols.cisql.interactive 'interactive-directive)
    {:name "sh"
     :arg-count ".."
     :usage "[variable]"
@@ -103,65 +156,3 @@
     :desc "export the queued query to a CSV file"
     :fn (fn [{:keys [query last-query]} [csv-name]]
           (export query last-query csv-name))}])
-
-(defn- print-command-help []
-  (let [decls (->> directives
-                   (map (fn [{:keys [name usage desc]}]
-                          (when desc
-                            {:decl (str name " " usage)
-                             :desc desc})))
-                   (remove nil?))
-        space (->> decls (map #(-> % :decl count)) (reduce max) (max 0) (+ 2))]
-    (->> decls
-         (map (fn [{:keys [decl desc]}]
-                (let [fmt (str "%-" space "s %s")]
-                  (println (format fmt decl desc)))))
-         doall)))
-
-(defn- print-help []
-  (println "commands:")
-  (print-command-help)
-  (println)
-  (println "variables:")
-  (conf/print-key-desc))
-
-(defn- connect-help []
-  (binding [parse/*rethrow-error* false
-            parse/*include-program-in-errors* false]
-    (-> '(zensols.cisql.interactive interactive-directive)
-        parse/single-action-context
-        parse/print-action-help)))
-
-(defn- connect [args]
-  (binding [parse/*rethrow-error* false
-            parse/*include-program-in-errors* false]
-    (-> '(zensols.cisql.interactive interactive-directive)
-        parse/single-action-context
-        (parse/process-arguments args)
-        (#(println "configured" %)))))
-
-(defn- export [query last-query csv-name]
-  (log/debugf "last query: %s" last-query)
-  (let [to-export (or query last-query)]
-    (if-not to-export
-      (binding [*out* *err*]
-        (-> "no queued query (skip the query delimiter (%s) after SQL)"
-            (format (conf/config :linesep))
-            (ex-info {:query query
-                      :last-query last-query
-                      :csv-name csv-name})
-            throw)))
-    (if-not query
-      (println "no queued query so using the last executed"))
-    (te/export-table-csv to-export csv-name)))
-
-(defn- grammer []
-  (->> directives
-       (map #(select-keys % [:name :arg-count]))))
-
-(defn init-grammer []
-  (r/set-grammer (conf/config :linesep) (grammer)))
-
-(defn directives-by-name []
-  (zipmap (map :name directives)
-          (map #(dissoc % :name) directives)))


Renamed elasticsearch namespace to connect.

--- src/cmr/elastic_utils/elasticsearch.clj
+++ src/cmr/elastic_utils/elasticsearch.clj
@@ -1,4 +1,4 @@
-(ns cmr.elastic-utils.elasticsearch
+(ns cmr.elastic-utils.connect
   "Provide functions to invoke elasticsearch"
   (:require [clojurewerkz.elastisch.rest :as esr]
             [cmr.common.log :as log :refer (debug info warn error)]


cleanup

cleanup

--- src/com/billpiel/sayid/inner_trace3.clj
+++ src/com/billpiel/sayid/inner_trace3.clj
@@ -159,8 +159,8 @@
     tree-atom))

 (defn record-trace-tree!
-  [tree-atom root-path]
-  (let [children (some-> (@tree-atom [] #_root-path)
+  [tree-atom]
+  (let [children (some-> (@tree-atom [])
                          deref-children
                          :children
                          deref)]
@@ -201,7 +201,6 @@

 (defn find-closest-parent
   [path path-parents]
-  (clojure.pprint/pprint path)
   (if-let [parent (path-parents path)]
     parent
     (when-not (or (nil? path) (empty? path))
@@ -606,7 +605,7 @@
                 `(~(:args m)
                   (let [~'$$ (atom {})
                         ~'$$return (do ~@(apply list (:form m)))]
-                    (record-trace-tree! ~'$$ [~(:body-idx m)])
+                    (record-trace-tree! ~'$$)
                     ~(mk-recur-handler (:recur m)))))
               traced-bods)})


Fix assertion

Fix assertion

--- tests/test_lazy.cljx
+++ tests/test_lazy.cljx
@@ -42,7 +42,7 @@
           fv1   (delay (fn [x] (inc x)))
           fv2   (delay (swap! state inc) 1)
           fv3   (m/fapply fv1 fv2)]
-      (is (delay fv3))
+      (is (delay? fv3))
       (is (= @state 0))
       (is (= @fv3 2))
       (is (= @state 1))))


add assert to fail when unknown option is passed

--- src/node_cljfmt/main.cljs
+++ src/node_cljfmt/main.cljs
@@ -9,9 +9,13 @@

 (def fs (nodejs/require "fs"))

+(def known-option? #{:edn})
+
 (defn parse-arg [parsed arg]
   (if (.startsWith arg "--")
-    (let [[opt v] (string/split (subs arg 2) #"=" 2)]
+    (let [[opt-str v] (string/split (subs arg 2) #"=" 2)
+          opt         (keyword opt-str)]
+      (assert (known-option? opt) (str "Unknown option " opt))
       (assoc-in parsed [:opts opt] v))
     (assoc parsed :filename arg)))

@@ -32,9 +36,9 @@
   (let [parsed (parse-args (aget js/process "argv"))]
     (if-let [filename (:filename parsed)]
       (let [file ((aget fs "readFileSync") filename "utf8")
-            opts (edn-opts (get-in parsed [:opts "edn"]))
+            opts (edn-opts (get-in parsed [:opts :edn]))
             formatted (cljfmt/reformat-string file opts)]
         ((aget fs "writeFileSync") filename formatted "utf8"))
       (js/console.error "Provide a filename"))))

-(set! *main-cli-fn* -main)
+(set! *main-cli-fn* -main)


add option for colored printing

add option for colored printing

--- src/bolth.clj
+++ src/bolth.clj
@@ -8,18 +8,27 @@
   (:import java.util.concurrent.LinkedBlockingQueue
            java.util.AbstractQueue))

-;; helpers
+;; colour helpers
+(def ^{:dynamic true
+       :doc "turns on/off colored printing. You shouldn't touch this directly,
+            just pass :colored true or :colored false to run-all-tests"}
+  *colored-printing* true)
+
 (defn redify [s]
-  (str
-    "\u001B[31m"
-    s
-    "\u001B[m"))
+  (if *colored-printing*
+    (str
+      "\u001B[31m"
+      s
+      "\u001B[m")
+    s))

 (defn greenify [s]
-  (str "\u001B[32m"
-       s
-       "\u001B[m"))
+  (if *colored-printing*
+    (str "\u001B[32m"
+         s
+         "\u001B[m")
+    s))

 (def ^{:dynamic true
        :doc
@@ -395,6 +404,10 @@

   options for io.aviso.exception/write-exception. Defaults to just showing 10 lines from exception stacktraces. See (doc io.aviso.exception/write-exception) for full documentation.

+  :colored-printing : an boolean (defaults to true)
+
+  sets if bolth will print results with color or not. Defaults to true.
+
   ## Returned value

   After running (assuming :exit-with-error-code wasn't set),
@@ -433,7 +446,8 @@
      (binding [*out* writer
                *frame-options* (:frame-options options *frame-options*)
                clojure.test/*test-out* writer
-               *test-runner-state* (atom {})]
+               *test-runner-state* (atom {})
+               *colored-printing* (:colored-printing options true)]
        (clear-screen options)
        (let [f (start-flusher (:flush-interval options 10))
              t0 (System/nanoTime)


CMR-3048: Fixed issue with queue/exchange binding

--- message-queue-lib/src/cmr/message_queue/queue/sqs.clj
+++ message-queue-lib/src/cmr/message_queue/queue/sqs.clj
@@ -174,18 +174,23 @@
         policy (.withStatements (Policy.) (into-array Statement [statement]))]
     (.toJson policy)))

+(defn bind-queue-to-exchange
+  "Bind a queue to a single exchange. Extend should be true
+  if the queue is already bound to other exchanges."
+  [sns-client sqs-client exchange-name queue-name extend?]
+  (let [q-name (normalize-queue-name queue-name)
+        q-url (.getQueueUrl (.getQueueUrl sqs-client q-name))
+        ex-name (normalize-queue-name exchange-name)
+        topic (get-topic sns-client ex-name)
+        topic-arn (.getTopicArn topic)]
+    (Topics/subscribeQueue sns-client sqs-client topic-arn q-url extend?)))
+
 (defn- bind-queue-to-exchanges
  "Bind a queue to SNS Topics representing exchanges."
  [sns-client sqs-client exchange-names queue-name]
- (let [q-name (normalize-queue-name queue-name)
-       q-arn (get-queue-arn sqs-client q-name)
-       q-url (.getQueueUrl (.getQueueUrl sqs-client q-name))]
-    (doseq [exchange-name exchange-names
-            :let [ex-name (normalize-queue-name exchange-name)
-                  topic (get-topic sns-client ex-name)
-                  topic-arn (.getTopicArn topic)]]
-      ;; subscribe the queue to the topic
-      (Topics/subscribeQueue sns-client sqs-client topic-arn q-url))))
+ (bind-queue-to-exchange sns-client sqs-client (first exchange-names) queue-name false)
+ (doseq [exchange-name (rest exchange-names)]
+   (bind-queue-to-exchange sns-client sqs-client exchange-name queue-name true)))

 (defn- normalized-queue-name->original-queue-name
   "Convert a normalized queue name to the original queue name used to create it."
@@ -320,23 +325,33 @@
 (comment
   ; (.subscribe (:sns-client broker) "arn:aws:sns:us-east-1:688991608580:gsfc-eosdis-cmr-ingest_exchange" "sqs" "arn:aws:sqs:us-east-1:688991608580:gsfc-eosdis-cmr-ngap-cmr-test_queue")
   ;; create a broker
-  (def broker (lifecycle/start (create-queue-broker {}) nil))
+  ;; (def broker (lifecycle/start (create-queue-broker {}) nil))
+  (def broker (lifecycle/start (create-queue-broker {:queues ["jn_test_queueX5" "jn_test_queueY5" "jn_test_queueZ5"]
+                                                     :exchanges ["jn_test_exchangeA5" "jn_test_exchangeB5"]
+                                                     :queues-to-exchanges {"jn_test_queueX5" ["jn_test_exchangeA5"]
+                                                                           "jn_test_queueY5" ["jn_test_exchangeA5" "jn_test_exchangeB5"]
+                                                                           "jn_test_queueZ5" ["jn_test_exchangeB5"]}})
+                               nil))
+
+  (def msg-cnt-atom (atom 0))
   ;; list the topics for the cmr-ingest_exchange exchange/topic
   (get-topic (:sns-client broker) "cmr_ingest_exchange")
   ;; list the queues for the cmr_ingest_exchange
-  (queue/get-queues-bound-to-exchange broker "gsfc-eosdis-cmr-wl-ingest_exchange")
+  (queue/get-queues-bound-to-exchange broker "jn_test_exchangeA5")
   ;; create a test queue
-  (create-queue (:sqs-client broker) "gsfc-eosdis-cmr-wl-index_all_revisions_queue")
+  (create-queue (:sqs-client broker) "jn_test_queue3")
   ;; create a test exchange
-  (create-exchange (:sns-client broker) "cmr_test_exchange")
+  (create-exchange (:sns-client broker) "jn_test_exchange3")
+  (create-exchange (:sns-client broker) "jn_test_exchange3b")
   ;; list the queues for the cmr_test_exchange
-  (queue/get-queues-bound-to-exchange broker "cmr_test_exchange")
+  (queue/get-queues-bound-to-exchange broker "jn_test_exchangeA5")
   ;; Bind the queue to the new exchange
-  (queue/publish-to-queue broker "gsfc-eosdis-cmr-wl-index_queue" {:action "concept-update"})
-  (bind-queue-to-exchanges (:sns-client broker) (:sqs-client broker) ["gsfc-eosdis-cmr-wl-ingest_exchange"] "gsfc-eosdis-cmr-wl-index_all_revisions_queue")
+  (bind-queue-to-exchanges (:sns-client broker) (:sqs-client broker) ["jn_test_exchangeA5"] "jn_test_queueY5")
   ;; subscribe to test queue with a simple handler that prints received messages
-  (queue/subscribe broker "gsfc-eosdis-cmr-wl-index_queue" (fn [msg] (println "Got Message: " msg)))
+  (queue/subscribe broker "jn_test_queueY5" (fn [msg] (do (println "MESSAGE!") (swap! msg-cnt-atom inc))))
   ;; publish a message to the queue to verify our subscribe worked
-  (queue/publish-to-queue broker "gsfc-eosdis-cmr-wl-index_all_revisions_queue" {:action "concept-update"})
+  (queue/publish-to-queue broker "jn_test_queueY5" {:action "concept-update" :dummy "John"})
   ;; publish a message to the exchange to verify the message is sent to the queue
-  (queue/publish-to-exchange broker "gsfc-eosdis-cmr-wl-ingest_exchange" {:action "concept-update" :dummy "dummy"}))
+  (queue/publish-to-exchange broker "jn_test_exchangeA5" {:action "concept-update" :dummy "Dan"})
+  (println "OK")
+  @msg-cnt-atom)


vigilant runner prints load error stacktraces

--- src/speclj/run/vigilant.clj
+++ src/speclj/run/vigilant.clj
@@ -52,7 +52,8 @@
           (reset! (.previous-failed runner) (:fail (categorize (seq @(.results runner)))))
           (run-and-report runner reporters))
         (catch java.lang.Throwable e
-          (process-compile-error runner e)))
+          (process-compile-error runner e)
+          (report-runs* reporters @(.results runner))))
       (reset! (.results runner) []))))

 (deftype VigilantRunner [file-listing results previous-failed directories]


Generate domain test data

Generate domain test data

--- src/test_utils/sandbox.cljs
+++ src/test_utils/sandbox.cljs
@@ -62,3 +62,46 @@
 (defn rand-northing []
   (let [maximum-northing 1e7]
     (tuc/rand-range maximum-northing)))
+
+(defn rand-minimal-xy-monitor-treatment-distance []
+  (let [minimum-euclidean-distance 946.9745
+        x-component (* minimum-euclidean-distance (rand))
+        y-component (Math/sqrt (- (* minimum-euclidean-distance minimum-euclidean-distance) (* x-component x-component)))]
+    [x-component y-component]))
+
+(defn rand-well-number []
+  (inc (tuc/rand-digit)))
+
+(defn rand-stage-number []
+  (inc (tuc/rand-2)))
+
+(defn flat-trajectory [md x y z stage-length plot-angle]
+  (let [next-fn (fn [[md0 x0 y0 z0]]
+                  (let [step (tuc/draw-normal stage-length (/ stage-length 10))
+                        step-angle (tuc/draw-normal plot-angle (/ plot-angle 10))]
+                    [(+ md0 (tuc/draw-normal stage-length (/ stage-length 10)))
+                     (+ x0 (* step (Math/cos (* (/ step-angle 180) Math.PI))))
+                     (+ y0 (* step (Math/sin (* (/ step-angle 180) Math.PI))))
+                     (tuc/draw-normal z (/ z 10))
+                     ]))]
+    (iterate next-fn [md x y z])))
+
+(defn typical-treatment-times []
+  (let [[year-0 month-0 day-0 hour-0 minute-0 second-0 :as start] (tuc/rand-timestamp 2016 2026)
+        duration-hours (tuc/draw-normal 2.5 0.25)
+        duration-hour (int duration-hours)
+        duration-minute (int (* 60 (- duration-hours duration-hour)))
+        duration-seconds (rand-nth (range 60))]
+    [start
+     [year-0 month-0 day-0
+      (rem (+ hour-0 duration-hour) 24)
+      (rem (+ minute-0 duration-minute) 60)
+      duration-seconds]]))
+
+(defn stage-extents []
+  (let [extent-0 (typical-stage-extent)
+        next-fn (fn [[top-0 bottom-0] extent-0]
+                  [(+ top-0 (typical-stage-length))
+                   (+ bottom-0 (typical-stage-length))])]
+    (iterate next-fn extent-0)))
+


add :signal-fn & :collect-fn opts for sync-execution-context, add parallel sig/coll sync handlers using core.reducers/fold

--- src/thi/ng/fabric/core.cljc
+++ src/thi/ng/fabric/core.cljc
@@ -2,12 +2,14 @@
   #?@(:clj
       [(:require
         [taoensso.timbre :refer [debug info warn]]
+        [clojure.core.reducers :as r]
         [clojure.core.async :refer [go go-loop chan close! <! >! alts! timeout]])]
       :cljs
       [(:require-macros
         [cljs.core.async.macros :refer [go go-loop]]
         [cljs-log.core :refer [debug info warn]])
        (:require
+        [clojure.core.reducers :as r]
         [cljs.core.async :as a :refer [chan close! <! >! alts! timeout]])]))

 ;; #?(:clj (taoensso.timbre/set-level! :warn))
@@ -377,16 +379,38 @@
           (recur colls (next verts))))
       colls)))

+(defn parallel-sync-signal-vertices
+  [vertices thresh]
+  (r/fold
+   +
+   (fn
+     ([] 0)
+     ([acc v] (if (should-signal? v thresh) (do (signal! v sync-vertex-signal) (inc acc)) acc)))
+   vertices))
+
+(defn parallel-sync-collect-vertices
+  [vertices thresh]
+  (r/fold
+   +
+   (fn
+     ([] 0)
+     ([acc v] (if (should-collect? v thresh) (do (collect! v) (inc acc)) acc)))
+   vertices))
+
 (def default-sync-context-opts
   {:collect-thresh 0
    :signal-thresh  0
-   :max-ops        1e6})
+   :max-ops        1e6
+   :signal-fn      sync-signal-vertices
+   :collect-fn     sync-collect-vertices})

 (defn sync-execution-context
   [opts]
   (let [ctx       (merge default-sync-context-opts opts)
         c-thresh  (:collect-thresh ctx)
         s-thresh  (:signal-thresh ctx)
+        coll-fn   (:collect-fn ctx)
+        sig-fn    (:signal-fn ctx)
         max-ops   (:max-ops ctx)]
     (reify
       #?@(:clj
@@ -405,8 +429,8 @@
               verts (vertices (:graph ctx))]
           (loop [colls 0, sigs 0]
             (if (<= (+ colls sigs) max-ops)
-              (let [sigs' (sync-signal-vertices verts s-thresh)
-                    colls' (sync-collect-vertices verts c-thresh)]
+              (let [sigs' (sig-fn verts s-thresh)
+                    colls' (coll-fn verts c-thresh)]
                 (if (and (pos? sigs') (pos? colls'))
                   (recur (long (+ colls colls')) (long (+ sigs sigs')))
                   (execution-result :converged colls sigs t0)))


bugfix sync-signal-vertices & parallel-sync-signal-vertices, bugfix execution-result args for sync context

--- src/thi/ng/fabric/core.cljc
+++ src/thi/ng/fabric/core.cljc
@@ -251,7 +251,7 @@
       (let [v (first verts)]
         (if (should-signal? v thresh)
           (do (debug (:id v) "signaling")
-              (recur (long (+ sigs (signal! v sync-vertex-signal))) (next verts)))
+              (recur (long (+ sigs (count (signal! v sync-vertex-signal)))) (next verts)))
           (recur sigs (next verts))))
       sigs)))

@@ -270,13 +270,19 @@
 (defn parallel-sync-signal-vertices
   [vertices thresh]
   (r/fold
-   + (fn [sigs v] (if (should-signal? v thresh) (do (signal! v sync-vertex-signal) (inc sigs)) sigs))
+   + (fn [sigs v]
+       (if (should-signal? v thresh)
+         (+ sigs (count (signal! v sync-vertex-signal)))
+         sigs))
    vertices))

 (defn parallel-sync-collect-vertices
   [vertices thresh]
   (r/fold
-   + (fn [colls v] (if (should-collect? v thresh) (do (collect! v) (inc colls)) colls))
+   + (fn [colls v]
+       (if (should-collect? v thresh)
+         (do (collect! v) (inc colls))
+         colls))
    vertices))

 (defn default-sync-context-opts
@@ -323,8 +329,8 @@
                     colls' (coll-fn verts c-thresh)]
                 (if (or (pos? sigs') (pos? colls'))
                   (recur (inc i) (long (+ colls colls')) (long (+ sigs sigs')))
-                  (->result :converged sigs colls t0 i)))
-              (->result :max-iter-reached sigs colls t0 i))))))))
+                  (->result :converged i sigs colls t0)))
+              (->result :max-iter-reached i sigs colls t0))))))))

 (defn default-async-vertex-processor
   [s-thresh c-thresh]


add :warnings to build options schema

add :warnings to build options schema

fix #495

--- sidecar/src/figwheel_sidecar/schemas/cljs_options.clj
+++ sidecar/src/figwheel_sidecar/schemas/cljs_options.clj
@@ -542,30 +542,33 @@
 ;; ** ClojureScript Compiler Warnings

 (def-key ::warnings
-  (strict-keys
-   :opt-un
-   [::undeclared-ns-form
-    ::protocol-deprecated
-    ::undeclared-protocol-symbol
-    ::fn-var
-    ::invalid-arithmetic
-    ::preamble-missing
-    ::undeclared-var
-    ::protocol-invalid-method
-    ::variadic-max-arity
-    ::multiple-variadic-overloads
-    ::fn-deprecated
-    ::redef
-    ::fn-arity
-    ::invalid-protocol-symbol
-    ::dynamic
-    ::undeclared-ns
-    ::overload-arity
-    ::extending-base-js-type
-    ::single-segment-namespace
-    ::protocol-duped-method
-    ::protocol-multiple-impls
-    ::invoke-ctor])
+  (s/or
+   :bool boolean?
+   :warnings-map-options
+   (strict-keys
+    :opt-un
+      [::undeclared-ns-form
+       ::protocol-deprecated
+       ::undeclared-protocol-symbol
+       ::fn-var
+       ::invalid-arithmetic
+       ::preamble-missing
+       ::undeclared-var
+       ::protocol-invalid-method
+       ::variadic-max-arity
+       ::multiple-variadic-overloads
+       ::fn-deprecated
+       ::redef
+       ::fn-arity
+       ::invalid-protocol-symbol
+       ::dynamic
+       ::undeclared-ns
+       ::overload-arity
+       ::extending-base-js-type
+       ::single-segment-namespace
+       ::protocol-duped-method
+       ::protocol-multiple-impls
+       ::invoke-ctor]))

   "This flag will turn on/off compiler warnings for references to
 undeclared vars, wrong function call arities, etc. Can be a boolean
@@ -833,7 +836,8 @@
      ::ups-foreign-libs
      ::closure-output-charset
      ::external-config
-     ::watch-fn])
+     ::watch-fn
+     ::warnings])

    ))


Microcosmetics

Microcosmetics

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

--- src/main/clojure/conexp/io/contexts.clj
+++ src/main/clojure/conexp/io/contexts.clj
@@ -212,11 +212,11 @@

 (define-context-output-format :conexp
   [ctx file]
-  (with-open [outfile (clojure.java.io/writer file)]
+  (with-out-writer file
     (xml/emit (xml/sexp-as-element [:ConceptualSystem
                                     [:Version {:MajorNumber "1", :MinorNumber "0"}]
                                     [:Contexts (ctx->xml-vector ctx 0)]])
-              outfile)))
+              *out*)))

 ;; Galicia (.bin.xml)


CMR-2815 updates acl search tests

CMR-2815 updates acl search tests

--- access-control-app/int_test/cmr/access_control/int_test/acl_search_test.clj
+++ access-control-app/int_test/cmr/access_control/int_test/acl_search_test.clj
@@ -55,6 +55,15 @@
    :catalog_item_identity {:name "REPLACEME"
                            :provider_id "PROV1"
                            :collection_applicable true}})
+(def provider-acl-for-catalog-item
+  "A provider ACL that grants create to guest to facilitate catalog-item creation"
+  {:legacy_guid "ABCD-EFG-HIJK-LMNOP"
+   :group_permissions [{:group_id "REPLACEME"
+                        :permissions ["read" "update" "create" "delete"],}
+                       {:user_type "guest"
+                        :permissions ["read" "update" "create" "delete"]}]
+   :provider_identity {:provider_id "PROV1"
+                       :target "CATALOG_ITEM_ACL"}})

 (defn system-acl
   "Creates a system acl for testing with the given target."
@@ -176,6 +185,10 @@
                                ["user1"])
         group1-concept-id (:concept_id group1)
         group2-concept-id (:concept_id group2)
+        acl-provider-for-catalog-item-acl (ingest-acl token (assoc-in provider-acl-for-catalog-item
+                                                                      [:group_permissions 0 :group_id] group1-concept-id))
+        ;; required to create catalog item acls
+        _ (u/wait-until-indexed)
         acl1 (ingest-acl token (assoc (system-acl "SYSTEM_AUDIT_REPORT")
                                       :group_permissions
                                       [{:user_type "guest" :permissions ["read"]}]))
@@ -190,7 +203,6 @@
         acl5 (ingest-acl token (assoc (provider-acl "AUDIT_REPORT")
                                       :group_permissions
                                       [{:user_type "guest" :permissions ["read"]}]))
-        acl6 (ingest-acl token (provider-acl "OPTION_ASSIGNMENT"))

         acl7 (ingest-acl token (single-instance-acl group1-concept-id))
         acl8 (ingest-acl token (single-instance-acl group2-concept-id))
@@ -199,14 +211,14 @@
         acl10 (ingest-acl token (catalog-item-acl "All Granules"))

         system-acls [acl1 acl2 acl3 acl4]
-        provider-acls [acl5 acl6]
+        provider-acls [acl-provider-for-catalog-item-acl acl5]
         single-instance-acls [acl7 acl8]
         catalog-item-acls [acl9 acl10]
         all-acls (concat system-acls provider-acls single-instance-acls catalog-item-acls)]
     (u/wait-until-indexed)

     (testing "Find all ACLs"
-      (let [response (ac/search-for-acls (u/conn-context) {})]
+      (let [response (ac/search-for-acls (u/conn-context) {:page_size 20})]
         (is (= (acls->search-response (count all-acls) all-acls)
                (dissoc response :took)))
         (testing "Expected Names"
@@ -216,7 +228,7 @@
                   (str "Group - " group1-concept-id)
                   (str "Group - " group2-concept-id)
                   "Provider - PROV1 - AUDIT_REPORT"
-                  "Provider - PROV1 - OPTION_ASSIGNMENT"
+                  "Provider - PROV1 - CATALOG_ITEM_ACL"
                   "System - ARCHIVE_RECORD"
                   "System - METRIC_DATA_POINT_SAMPLE"
                   "System - SYSTEM_AUDIT_REPORT"
@@ -236,6 +248,11 @@

 (deftest acl-search-permitted-group-test
   (let [token (e/login (u/conn-context) "user1")
+        group1 (u/ingest-group token {:name "group1"} ["user1"])
+        acl-provider-for-catalog-item-acl (ingest-acl token (assoc-in provider-acl-for-catalog-item
+                                                                      [:group_permissions 0 :group_id] (:concept_id group1)))
+        ;; required to create catalog item acls
+        _ (u/wait-until-indexed)
         acl1 (ingest-acl token (assoc (system-acl "SYSTEM_AUDIT_REPORT")
                                       :group_permissions
                                       [{:user_type "guest" :permissions ["read"]}]))
@@ -262,13 +279,13 @@
                                       [{:user_type "registered" :permissions ["read" "order"]}
                                        {:group_id "AG10000-PROV" :permissions ["create"]}]))

-        guest-acls [acl1 acl3 acl4 acl7]
+        guest-acls [acl-provider-for-catalog-item-acl acl1 acl3 acl4 acl7]
         registered-acls [acl2 acl5 acl8]
         AG12345-acls [acl3 acl6]
         AG10000-acls [acl8]
-        read-acls [acl1 acl2 acl3 acl4 acl8]
-        create-acls [acl3 acl5 acl7 acl8]
-        all-acls [acl1 acl2 acl3 acl4 acl5 acl6 acl7 acl8]]
+        read-acls [acl-provider-for-catalog-item-acl acl1 acl2 acl3 acl4 acl8]
+        create-acls [acl-provider-for-catalog-item-acl acl3 acl5 acl7 acl8]
+        all-acls [acl-provider-for-catalog-item-acl acl1 acl2 acl3 acl4 acl5 acl6 acl7 acl8]]
     (u/wait-until-indexed)

     (testing "Search ACLs by permitted group"
@@ -316,10 +333,10 @@
                     (dissoc response :took))))
            ;; CMR-3154 acceptance criterium 1
            "Guests create"
-           ["guest" "create"] [acl7]
+           ["guest" "create"] [acl-provider-for-catalog-item-acl acl7]

            "Guest read"
-           ["guest" "read"] [acl1 acl3 acl4]
+           ["guest" "read"] [acl-provider-for-catalog-item-acl acl1 acl3 acl4]

            "Registered read"
            ["registered" "read"] [acl2 acl8]
@@ -409,9 +426,10 @@
         acl-system (ingest-acl token (assoc (system-acl "SYSTEM_AUDIT_REPORT")
                                             :group_permissions
                                             [{:user_type "guest" :permissions ["read"]}]))
-        acl-provider (ingest-acl token (assoc (provider-acl "AUDIT_REPORT")
-                                              :group_permissions
-                                              [{:user_type "guest" :permissions ["read"]}]))
+
+        acl-provider (ingest-acl token (assoc-in provider-acl-for-catalog-item [:group_permissions 0 :group_id] group1-concept-id))
+        ;; required to create catalog item acls
+        _ (u/wait-until-indexed)
         acl-single-instance (ingest-acl token (single-instance-acl group1-concept-id))
         acl-catalog-item (ingest-acl token (catalog-item-acl "All Collections"))
         all-acls [acl-system acl-provider acl-single-instance acl-catalog-item]]
@@ -456,6 +474,10 @@
         group1 (u/ingest-group token {:name "group1"} ["user1"])
         group2 (u/ingest-group token {:name "group2"} ["USER1" "user2"])
         group3 (u/ingest-group token {:name "group3"} nil)
+        acl-provider-for-catalog-item-acl (ingest-acl token (assoc-in provider-acl-for-catalog-item
+                                                                      [:group_permissions 0 :group_id] (:concept_id group1)))
+        ;; required to create catalog item acls
+        _ (u/wait-until-indexed)
         ;; No user should match this since all users are registered
         acl-guest (ingest-acl token (assoc (system-acl "ANY_ACL")
                                            :group_permissions
@@ -507,31 +529,30 @@
         ["user3"] (concat registered-acls)

         "user1 gets acls for registered, group1, and group2"
-        ["user1"] [acl-registered-1 acl-registered-2 acl-group1 acl-group2]
+        ["user1"] [acl-provider-for-catalog-item-acl acl-registered-1 acl-registered-2 acl-group1 acl-group2]

         "user2 gets acls for guest, registred, and group2"
         ["user2"] [acl-registered-1 acl-registered-2 acl-group2]

         "User names are case-insensitive"
-        ["USER1"] [acl-registered-1 acl-registered-2 acl-group1 acl-group2]))))
+        ["USER1"] [acl-provider-for-catalog-item-acl acl-registered-1 acl-registered-2 acl-group1 acl-group2]))))

 (deftest acl-search-provider-test
   (let [token (e/login (u/conn-context) "user1")
-        acl1 (ingest-acl token (assoc (provider-acl "INGEST_MANAGEMENT_ACL")
-                                      :group_permissions
-                                      [{:user_type "guest" :permissions ["read"]}]))
-        acl2 (ingest-acl token (assoc (assoc-in (provider-acl "INGEST_MANAGEMENT_ACL")
-                                                [:provider_identity :provider_id] "PROV2")
-                                      :group_permissions
-                                      [{:user_type "guest" :permissions ["read"]}]))
-        acl3 (ingest-acl token (assoc (assoc-in (provider-acl "INGEST_MANAGEMENT_ACL")
-                                                [:provider_identity :provider_id] "PROV3")
-                                      :group_permissions
-                                      [{:user_type "guest" :permissions ["read"]}]))
-        acl4 (ingest-acl token (assoc (assoc-in (provider-acl "INGEST_MANAGEMENT_ACL")
-                                                [:provider_identity :provider_id] "PROV4")
-                                      :group_permissions
-                                      [{:user_type "guest" :permissions ["read"]}]))
+        group1 (u/ingest-group token {:name "group1"} ["user1"])
+        acl1 (ingest-acl token (assoc-in provider-acl-for-catalog-item
+                                         [:group_permissions 0 :group_id] (:concept_id group1)))
+        acl2 (ingest-acl token (assoc-in (assoc-in provider-acl-for-catalog-item
+                                                   [:group_permissions 0 :group_id] (:concept_id group1))
+                                         [:provider_identity :provider_id] "PROV2"))
+        acl3 (ingest-acl token (assoc-in (assoc-in provider-acl-for-catalog-item
+                                                   [:group_permissions 0 :group_id] (:concept_id group1))
+                                         [:provider_identity :provider_id] "PROV3"))
+        acl4 (ingest-acl token (assoc-in (assoc-in provider-acl-for-catalog-item
+                                                   [:group_permissions 0 :group_id] (:concept_id group1))
+                                         [:provider_identity :provider_id] "PROV4"))
+        ;; required to create catalog item acls
+        _ (u/wait-until-indexed)
         acl5 (ingest-acl token (catalog-item-acl "Catalog_Item1_PROV1"))
         acl6 (ingest-acl token (catalog-item-acl "Catalog_Item2_PROV1"))
         acl7 (ingest-acl token (assoc-in (catalog-item-acl "Catalog_Item3_PROV2")
@@ -608,13 +629,13 @@
         acl4 (ingest-acl token (assoc (provider-acl "OPTION_DEFINITION")
                                       :group_permissions
                                       [{:user_type "registered" :permissions ["create"]}]))
-        acl5 (ingest-acl token (assoc (provider-acl "OPTION_ASSIGNMENT")
-                                      :group_permissions
-                                      [{:group_id (:concept_id group2) :permissions ["create"]}]))
-        acl6 (ingest-acl token (assoc-in (assoc (provider-acl "OPTION_ASSIGNMENT")
-                                                :group_permissions
-                                                [{:group_id (:concept_id group2) :permissions ["create"]}])
+        acl5 (ingest-acl token (assoc-in provider-acl-for-catalog-item
+                                         [:group_permissions 0 :group_id] (:concept_id group1)))
+        acl6 (ingest-acl token (assoc-in (assoc-in provider-acl-for-catalog-item
+                                                   [:group_permissions 0 :group_id] (:concept_id group1))
                                          [:provider_identity :provider_id] "PROV2"))
+        ;; required to create catalog item acls
+        _ (u/wait-until-indexed)
         acl7 (ingest-acl token (assoc (catalog-item-acl "All Collection")
                                       :group_permissions
                                       [{:group_id (:concept_id group1) :permissions ["create"]}
@@ -639,7 +660,7 @@
          :permitted-user "user1"}
         [acl7]

-        "One criteria changed to get empy result"
+        "One criteria changed to get empty result"
         {:provider "PROV1"
          :permitted-group "guest"
          :identity-type "catalog_item"
@@ -652,7 +673,7 @@
          :permitted-group ["guest" "registered"]
          :identity-type ["catalog_item" "provider"]
          :permitted-user "user1"}
-        [acl4 acl7]
+        [acl4 acl5 acl6 acl7]

         ;;Shows when permitted groups are not specified, then all user groups are returned for that user
         "Multiple search criteria with no permitted group specified and permitted users set to user2"
@@ -660,4 +681,4 @@
          :permitted-group ""
          :identity-type ["catalog_item" "provider"]
          :permitted-user "user2"}
-        [acl4 acl5 acl6 acl7 acl9]))))
+        [acl4 acl7 acl9]))))


minor rename and cleanup

minor rename and cleanup

--- src/clj/marceline/storm/testing/trident_wordcount.clj
+++ src/clj/marceline/storm/testing/trident_wordcount.clj
@@ -10,7 +10,7 @@
             [clojure.string :as string :only [join split]])
   (:use [backtype.storm clojure config]))

-(defn mk-fixed-spout [max-batch-size]
+(defn mk-fixed-batch-spout [max-batch-size]
   (FixedBatchSpout.
    (t/fields "sentence")
    max-batch-size
@@ -34,8 +34,8 @@
         (t/emit-fn coll word)))))

 (defn build-topology [drpc]
-  (let [spout (mk-fixed-spout 3)
-        _ (.setCycle spout true)
+  (let [spout (doto (mk-fixed-batch-spout 3)
+                (.setCycle true))
         word-state-factory (MemoryMapState$Factory.)
         trident-topology (TridentTopology.)
         word-counts (-> (t/new-stream* trident-topology "word-counts" spout)


users can hide featured badges

users can hide featured badges

--- src/cljs/salava/extra/application/ui/application.cljs
+++ src/cljs/salava/extra/application/ui/application.cljs
@@ -346,13 +346,20 @@

 (defn pro-badges-grid [state]
   (let [show-issuer-info-atom (cursor state [:show-issuer-info])
+        show-featured (cursor state [:show-featured])
         badges (shuffle-pro-badges 4 state)
         badge-count (count badges)]

-    (when (and (not (empty? badges)) (not @show-issuer-info-atom))
+    (when (and (not (empty? badges)) (not @show-issuer-info-atom) @show-featured)
       (into [:div.panel {:class "row wrap-grid"
                          :id    "grid"
                          :style {:padding "10px"}}
+             [:button.close {:aria-label "OK"
+                             :on-click #(do
+                                          (.preventDefault %)
+                                          (swap! state assoc :show-featured false))}
+              [:span {:aria-hidden "true"
+                      :dangerouslySetInnerHTML {:__html "×"}}]]
              [:h3 [:i.fa.fa-star ] (str " " (if (> badge-count 1) (t :extra-application/Featuredbadges) (t :extra-application/Featuredbadge) ))]
              [:hr]]
             (for [element-data badges]
@@ -425,7 +432,8 @@
                                 :ajax-message       nil
                                 :issuer-content {:name (t :extra-application/Allissuers)}
                                 :issuer-search false
-                                :search-result []})]
+                                :search-result []
+                                :show-featured true})]
     (init-data state init-values)
     (autocomplete-search state (:country init-values))
     (fn []


Upgrade karma-junit-reporter to 2.0.1

Upgrade karma-junit-reporter to 2.0.1

--- src/deps.cljs
+++ src/deps.cljs
@@ -2,4 +2,4 @@
                 "karma"                 "4.3.0"
                 "karma-chrome-launcher" "3.1.0"
                 "karma-cljs-test"       "0.1.0"
-                "karma-junit-reporter"  "1.2.0"}}
+                "karma-junit-reporter"  "2.0.1"}}


sweep sweep

sweep sweep