Switch changed to rely on an atom instead of a ref

This should be marginally faster and avoid transaction retries
should they happen. I'm not familiar with criterium or other
libraries to validate the hypothesis that it is faster, so this
is just conjecture.

--- src/riemann/streams.clj
+++ src/riemann/streams.clj
@@ -960,7 +960,7 @@
   This implementation of top is lazy, in the sense that it won't proactively
   expire events which are bumped from the top-k set--you have to wait for
   another event with the same host and service to arrive before child streams
-  will know it's expired."
+  will know it's expired."
   ([k f top-stream]
      (top k f top-stream bit-bucket nil))
   ([k f top-stream bottom-stream]
@@ -1237,7 +1237,7 @@
 (defn scale
   "Passes on a changed version of each event by multiplying each
    metric with the given scale factor.
-
+
   ; Convert bytes to kilobytes
   (scale 1/1024 index)"
   [factor & children]
@@ -1319,22 +1319,18 @@

   (changed (fn [e] (> (:metric e) 2)) ...)"
   [pred & children]
-  (let [options (first children)
-        previous (ref
-                   (when (map? options)
-                     (:init options)))
+  (let [options  (first children)
+        previous (atom (list (when (map? options)
+                               (:init options))))
         children (if (map? options)
                    (rest children)
                    children)]
     (fn stream [event]
-      (when
-        (dosync
-          (let [cur (pred event)
-                old (deref previous)]
-            (when-not (= cur old)
-              (ref-set previous cur)
-              true)))
-        (call-rescue event children)))))
+      (let [cur  (pred event)
+            kept (swap! previous (comp (partial take 2)
+                                       #(conj % cur)))]
+        (when-not (every? (partial = cur) kept)
+          (call-rescue event children))))))

 (defmacro changed-state
   "Passes on changes in state for each distinct host and service."
@@ -1629,10 +1625,10 @@
   as -. = events are passed to children, and - events are ignored.

        A spike           Flapping           Stable changes
-  |                 |                    |
-  |       -         |    -- -   ======   |      =====
+  |                 |                    |
+  |       -         |    -- -   ======   |      =====
   |                 |        -           |           ========
-  |======= ======   |====  -  --         |======
+  |======= ======   |====  -  --         |======
   +------------->   +---------------->   +------------------>
         time              time                  time


remove task 'local' (replaced by 'locally')

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

--- build.boot
+++ build.boot
@@ -103,13 +103,6 @@
        :description "Example code, boot, miraj, GAE"
        :license     {"EPL" "http://www.eclipse.org/legal/epl-v10.html"}})

-(deftask local
-  "install to local repo"
-  []
-  (comp (boot/pom)
-        (boot/jar)
-        (boot/install)))
-
 (deftask dev
   "make a dev build - including reloader"
   [k keep bool "keep intermediate .clj and .edn files"


Add support for pushing releases/snapshots to Clojars

--- build.boot
+++ build.boot
@@ -33,7 +33,7 @@
  test-cljs {:js-env :phantom
             :update-fs? true
             :optimizations :none}
- push      {:repo "deploy"
+ push      {:repo "deploy-clojars"
             :ensure-branch "master"
             :ensure-clean true
             :ensure-tag (last-commit)
@@ -94,3 +94,21 @@
     (pom)
     (jar)
     (install)))
+
+(deftask deploy-snapshot
+  []
+  (comp
+    (pom)
+    (jar)
+    (build-jar)
+    (target)
+    (push-snapshot)))
+
+(deftask deploy-release
+  []
+  (comp
+    (pom)
+    (jar)
+    (build-jar)
+    (target)
+    (push-release)))


Update paren-soup

Update paren-soup

--- build.boot
+++ build.boot
@@ -43,7 +43,7 @@
   (set-env! :dependencies
     (conj (get-env :dependencies)
       '[org.clojure/clojurescript "1.9.225"]
-      '[paren-soup "2.6.1"]
+      '[paren-soup "2.6.2"]
       '[cljsjs/codemirror "5.19.0-0"]))
   (comp (cljs :optimizations :advanced) (target)))


simple embedded cassandra tests

simple embedded cassandra tests

--- build.boot
+++ build.boot
@@ -6,12 +6,29 @@
                (update-in (get-env) [:dependencies]
                           conj '[leiningen "2.7.1"])))

-(def lein-proj (pod/with-eval-in lein-pod
-                 (require '[leiningen.core.project :as p])
-                 (p/read)))
+(defn cassandra-unit-proj
+  []
+  (pod/with-eval-in lein-pod
+    (require '[leiningen.core.project :as p])
+    (p/read "project.clj" [:cassandra-unit])))

-(def deps (:dependencies lein-proj))
+(def cass-deps (:dependencies (cassandra-unit-proj)))

+(def cass-pod (pod/make-pod
+               (update-in (get-env) [:dependencies]
+                          concat cass-deps)))
+
+(pod/with-eval-in cass-pod
+  (import '[org.cassandraunit.utils EmbeddedCassandraServerHelper])
+  (EmbeddedCassandraServerHelper/startEmbeddedCassandra))
+
+(defn test-proj
+  []
+  (pod/with-eval-in lein-pod
+    (require '[leiningen.core.project :as p])
+    (p/read "project.clj" [:test])))
+
+(def test-deps (:dependencies (test-proj)))
 (set-env!
  :wagons       '[[s3-wagon-private "1.2.0"]]

@@ -22,9 +39,16 @@
                                          :username [:env/aws_access_key :gpg]
                                          :passphrase [:env/aws_secret_key :gpg]}]])

- :dependencies deps
+ :dependencies test-deps

  :source-paths #{"src" "test"})

 (require
- '[adzerk.boot-test :refer :all])
+ '[adzerk.boot-test :refer [test]]
+ )
+
+;; (def test adzerk.boot-test/test)
+
+
+;; set system-property for embedded test
+(System/setProperty "cassandra_port" "9142")


Update to latest version of Perun

Update to latest version of Perun

--- build.boot
+++ build.boot
@@ -17,7 +17,7 @@
    [org.martinklepsch/boot-gzip "0.1.3" :scope "test"]
    [org.slf4j/slf4j-nop "1.7.21" :scope "test"]
    [pandeiro/boot-http "0.7.6" :scope "test"]
-   [perun "0.3.0" :scope "test"]
+   [perun "0.4.1-SNAPSHOT" :scope "test"]
    [weasel "0.7.0" :scope "test"]

    ;; App


cleanup

cleanup

--- build.boot
+++ build.boot
@@ -6,8 +6,8 @@
   :dependencies  [['tailrecursion/boot.core   "2.0.0"]
                   ['tailrecursion/boot.task   "2.0.0"]
                   ['tailrecursion/hoplon      "5.0.0"]
-                  ['org.clojure/clojurescript "0.0-2156"]
-                  ['markdown-clj              "0.9.38"]]
+                  ['markdown-clj              "0.9.38"]
+                  ['org.clojure/clojurescript "0.0-2156"]]
   :src-paths     #{"src"}
   :out-path      "resources/public")


Update deps

Update deps

--- build.boot
+++ build.boot
@@ -3,12 +3,12 @@
 #tailrecursion.boot.core/version "2.3.1"

 (set-env!
-  :dependencies  '[[tailrecursion/boot.task   "2.1.2"]
-                   [tailrecursion/hoplon      "5.7.1"]
+  :dependencies  '[[tailrecursion/boot.task   "2.1.3"]
+                   [tailrecursion/hoplon      "5.7.2"]
                    [markdown-clj              "0.9.41"]
                    [tailrecursion/boot.ring   "0.1.0-SNAPSHOT"]
                    [tailrecursion/boot.notify "2.0.0-SNAPSHOT"]
-                   [org.clojure/clojurescript "0.0-2156"]]
+                   [org.clojure/clojurescript "0.0-2202"]]
   :src-paths     #{"src"}
   :out-path      "resources/public")


codeina API doc generator added

codeina API doc generator added

--- build.boot
+++ build.boot
@@ -12,6 +12,7 @@
                  [com.h2database/h2 "1.4.196" :scope "test"]
                  [mysql/mysql-connector-java "6.0.6" :scope "test"]
                  [org.postgresql/postgresql "42.1.4" :scope "test"]
+                 [funcool/boot-codeina "0.1.0-SNAPSHOT" :scope "test"]
                  [ring/ring-defaults "0.3.1"]
                  [midje "1.8.3" :scope "test"]
                  [peridot "0.5.0" :scope "test"]
@@ -35,6 +36,7 @@
 (require
  '[cerber.oauth2.standalone.system]
  '[cerber.migration]
+ '[funcool.boot-codeina :refer :all]
  '[adzerk.bootlaces :refer [bootlaces! build-jar push-release]]
  '[zilti.boot-midje :refer [midje]])

@@ -73,4 +75,16 @@
                       :version +version+
                       :description "OAuth2 provider"
                       :url "https://github.com/mbuczko/cerber-oauth2-provider"
-                      :scm {:url "https://github.com/mbuczko/cerber-oauth2-provider"}})
+                      :scm {:url "https://github.com/mbuczko/cerber-oauth2-provider"}}
+               apidoc {:version +version+
+                       :title "Cerber"
+                       :sources #{"src"}
+                       :description "OAuth2 provider for Clojure"
+                       :exclude ['cerber.config
+                                'cerber.db
+                                'cerber.error
+                                'cerber.form
+                                'cerber.handlers
+                                'cerber.helpers
+                                'cerber.middleware
+                                'cerber.migration]})


added js-load fn to boot-reload

added js-load fn to boot-reload

--- build.boot
+++ build.boot
@@ -36,7 +36,7 @@
             :source-map true
             :optimizations :none
             :output-to "public/js/main.js")
-      (reload)))
+      (reload :on-jsload (symbol "lokate.navigation/render"))))

 (deftask dev-serve
   "Start server for development."


Refactor.

Refactor.

--- src/datascript/core.cljs
+++ src/datascript/core.cljs
@@ -25,14 +25,10 @@
 ;;;;;;;;;; Searching

-(defn- slice-it [index search callback]
-  (callback (let [search-start search
-        search-stop  (mapv #(if (nil? %) "\uffff" %) search)]
-    (vec (vals (subseq index >= search-start <= search-stop))))))
-
 (defprotocol ISearch
   (-search [data pattern callback])
-  (add-record [data e a v]))
+  (add-record [data e a v])
+  (slice-it [data index search callback]))

 (defrecord DB [eav aev ave]
   Object
@@ -40,22 +36,27 @@
     (pr-str* this))

   ISearch
-  (-search [_ [e a v] callback]
+  (-search [db [e a v] callback]
     (case-tree [e a (some? v)] [
-      (slice-it eav [e a v] callback)                ;; e a v
-      (slice-it eav [e a nil] callback)              ;; e a _
-      (slice-it eav [e nil nil] (fn [data]
+      (slice-it db "eav" [e a v] callback)                ;; e a v
+      (slice-it db "eav" [e a nil] callback)              ;; e a _
+      (slice-it db "eav" [e nil nil] (fn [data]
         (callback (filter #(= v (.-v %)) data))))    ;; e _ v
-      (slice-it eav [e nil nil] callback)            ;; e _ _
-      (slice-it ave [a v nil] callback)              ;; _ a v
-      (slice-it ave [a nil nil] callback)            ;; _ a _
+      (slice-it db "eav" [e nil nil] callback)            ;; e _ _
+      (slice-it db "ave" [a v nil] callback)              ;; _ a v
+      (slice-it db "ave" [a nil nil] callback)            ;; _ a _
       (callback (filter #(= v (.-v %)) eav))         ;; _ _ v
-      (callback eav)]))                              ;; _ _ _
+      (callback "eav")]))                              ;; _ _ _
   (add-record [_ e a v]
     (DB.
       (assoc eav [e a v] [e a v])
       (assoc aev [a e v] [e a v])
-      (assoc ave [a v e] [e a v]))))
+      (assoc ave [a v e] [e a v])))
+  (slice-it [db index search callback]
+    (callback (let [search-start search
+                    search-stop  (mapv #(if (nil? %) "\uffff" %) search)
+                    index        ((keyword index) db)]
+      (vec (vals (subseq index >= search-start <= search-stop)))))))

 (defn init-db []
   (DB. (sorted-map) (sorted-map) (sorted-map)))


Use record of col-row color as input to drawing func.

--- src/videotest/falling/fall_core.clj
+++ src/videotest/falling/fall_core.clj
@@ -78,38 +78,40 @@
 (defn update-rgba [{:keys [rgba-mat frame-mat] :as state}]
   (assoc-in state [:rgba-mat] (cv/BGR->RGBA! frame-mat rgba-mat)))

-(defn update-color-record [{:keys [rgba-mat color-record] :as state}]
-  #_(dorun
-     (map ))
-  state)
-
-(defn draw-mosaic
-  [tri-points tri-glyphs drawn-mat rgba-mat [col row :as coords]]
-  (let [color-fn (fn [display-x display-y]
-                   (let [cam-x (int (display->cam display-x))
-                         cam-y (int (display->cam display-y))
+(defn update-color-record
+  [{:keys [triangle-points rgba-mat color-record] :as state}]
+  (let [color-fn (fn [col row]
+                   (let [cam-x (* col CAM-BIN-SIZE)
+                         cam-y (* row CAM-BIN-SIZE)
                          cam-x (+ cam-x CAM-BIN-SIZE-2)
                          cam-y (+ cam-y CAM-BIN-SIZE)
                          c (.get rgba-mat
-                                 (min (- CAM-HEIGHT 1) cam-y)
-                                 (min (- CAM-WIDTH  1) cam-x))]
+                                 cam-y
+                                 cam-x)]
                      (if (< 0 (count c))
                        (vec c)
                        [0 0 0 255])))
-        [display-x display-y] (tri-points coords)
-        c (color-fn display-x display-y)]
+        colors (reduce (fn [memo [col row :as coords]]
+                         (assoc-in memo [coords] (color-fn col row)))
+                       {}
+                       (keys triangle-points))]
+   (assoc-in state [:color-record] colors)))
+
+(defn draw-mosaic
+  [tri-points tri-glyphs drawn-mat color-record [col row :as coords]]
+  (let [[display-x display-y] (tri-points coords)
+        c (color-record coords)]
     (cv-draw/draw-poly-with-pts drawn-mat c (tri-glyphs coords))))

 (defn overlay-triangles
-  [{:keys [drawn-mat rgba-mat triangle-points triangle-glyphs] :as state}]
+  [{:keys [drawn-mat rgba-mat triangle-points triangle-glyphs color-record] :as state}]
   (dorun
    (map (partial draw-mosaic
                  triangle-points
                  triangle-glyphs
                  drawn-mat
-                 rgba-mat)
+                 color-record)
         (keys triangle-points)))
-  ;(cv-draw/draw-poly-with-pts drawn-mat [255 0 0 255] (triangle-glyphs [63 0]))
   state)

 (defn update-drawn-p-image [state]
@@ -120,9 +122,9 @@
   (-> state
       (cv/update-frame)
       (update-rgba)
+      (update-color-record)
       (overlay-triangles)
-      (update-drawn-p-image)
-      (update-color-record)))
+      (update-drawn-p-image)))

 (defn draw [state]
   (let [{:keys [p-image frame-mat]} state]


Minor fix: correct handling of web resources

--- src/photon/handler.clj
+++ src/photon/handler.clj
@@ -230,6 +230,6 @@
     (GET "/" []
          :no-doc true
          (response/resource-response "index.html" {:root "public/ui"}))
-    #_(route/resources "/")
+    (route/resources "/")
     (route/not-found (http/not-found "Not found")))
   (wrap-session (reload/wrap-reload #'app-no-reload)))


CMR-4239 - Ordered dependencies.

CMR-4239 - Ordered dependencies.

--- ingest-app/project.clj
+++ ingest-app/project.clj
@@ -3,46 +3,46 @@

   :url "https://github.com/nasa/Common-Metadata-Repository/tree/master/ingest-app"

-  :dependencies [[org.clojure/clojure "1.8.0"]
-                 [nasa-cmr/cmr-umm-lib "0.1.0-SNAPSHOT"]
-                 [nasa-cmr/cmr-umm-spec-lib "0.1.0-SNAPSHOT"]
-                 [nasa-cmr/cmr-transmit-lib "0.1.0-SNAPSHOT"]
-                 [nasa-cmr/cmr-acl-lib "0.1.0-SNAPSHOT"]
-                 [nasa-cmr/cmr-message-queue-lib "0.1.0-SNAPSHOT"]
-                 [nasa-cmr/cmr-common-app-lib "0.1.0-SNAPSHOT"]
-                 [compojure "1.5.1"]
-                 [potemkin "0.4.3"]
-                 [ring/ring-core "1.5.0"]
-                 [ring/ring-json "0.4.0"]
-                 [clj-http "2.0.0"]
-                 [drift "1.5.3"]
-
-                 [org.clojure/tools.nrepl "0.2.12"]
-
-                 ;; Database related
-                 [org.quartz-scheduler/quartz "2.2.2"]
-                 [nasa-cmr/cmr-oracle-lib "0.1.0-SNAPSHOT"]]
-
-  :plugins [[drift "1.5.3"]
-            [lein-exec "0.3.4"]
-            [test2junit "1.2.1"]]
+  :dependencies [
+    [clj-http "2.0.0"]
+    [compojure "1.5.1"]
+    [drift "1.5.3"]
+    [nasa-cmr/cmr-acl-lib "0.1.0-SNAPSHOT"]
+    [nasa-cmr/cmr-common-app-lib "0.1.0-SNAPSHOT"]
+    [nasa-cmr/cmr-message-queue-lib "0.1.0-SNAPSHOT"]
+    [nasa-cmr/cmr-oracle-lib "0.1.0-SNAPSHOT"]
+    [nasa-cmr/cmr-transmit-lib "0.1.0-SNAPSHOT"]
+    [nasa-cmr/cmr-umm-lib "0.1.0-SNAPSHOT"]
+    [nasa-cmr/cmr-umm-spec-lib "0.1.0-SNAPSHOT"]
+    [org.clojure/clojure "1.8.0"]
+    [org.clojure/tools.nrepl "0.2.12"]
+    [org.quartz-scheduler/quartz "2.2.2"]
+    [potemkin "0.4.3"]
+    [ring/ring-core "1.5.0"]
+    [ring/ring-json "0.4.0"]]
+  :plugins [
+    [drift "1.5.3"]
+    [lein-exec "0.3.4"]
+    [test2junit "1.2.1"]]
   :repl-options {:init-ns user}
   :jvm-opts ^:replace ["-server"
                        "-Dclojure.compiler.direct-linking=true"]
   :profiles {
-    :dev {:dependencies [[org.clojure/tools.namespace "0.2.11"]
-                         [org.clojars.gjahad/debug-repl "0.3.3"]
-                         [ring-mock "0.1.5"]]
-          :jvm-opts ^:replace ["-server"]
-          :source-paths ["src" "dev" "test"]}
-
+    :dev {
+      :dependencies [
+        [org.clojars.gjahad/debug-repl "0.3.3"]
+        [org.clojure/tools.namespace "0.2.11"]
+        [ring-mock "0.1.5"]]
+      :jvm-opts ^:replace ["-server"]
+      :source-paths ["src" "dev" "test"]}
     ;; This profile specifically here for generating documentation. It's faster than using the regular
     ;; profile. An agent pool is being started when using the default profile which causes the wait of
     ;; 60 seconds before allowing the JVM to shutdown since no call to shutdown-agents is made.
     ;; Generate docs with: lein generate-static
     :static {}
-    :uberjar {:main cmr.ingest.runner
-              :aot :all}
+    :uberjar {
+      :main cmr.ingest.runner
+      :aot :all}
     ;; This profile is used for linting and static analysis. To run for this
     ;; project, use `lein lint` from inside the project directory. To run for
     ;; all projects at the same time, use the same command but from the top-
@@ -50,13 +50,13 @@
     :lint {
       :source-paths ^:replace ["src"]
       :test-paths ^:replace []
-      :plugins [[jonase/eastwood "0.2.3"]
-                [lein-ancient "0.6.10"]
-                [lein-bikeshed "0.4.1"]
-                [lein-kibit "0.1.2"]
-                [lein-shell "0.4.0"]
-                [venantius/yagni "0.1.4"]]}}
-
+      :plugins [
+        [jonase/eastwood "0.2.3"]
+        [lein-ancient "0.6.10"]
+        [lein-bikeshed "0.4.1"]
+        [lein-kibit "0.1.2"]
+        [lein-shell "0.4.0"]
+        [venantius/yagni "0.1.4"]]}}
   :aliases {"generate-static" ["with-profile" "static"
                                "run" "-m" "cmr.ingest.site.static" "all"]
             ;; Database migrations run by executing "lein migrate"


render line for repeat geofield

render line for repeat geofield

--- src/hatti/map/utils.cljs
+++ src/hatti/map/utils.cljs
@@ -530,7 +530,9 @@
   (cond
     (f/geoshape? field) {:layer-type "fill" :style :fill}
     (f/osm? field) {:layer-type "fill" :style :fill}
-    (f/geotrace? field) {:layer-type "line" :style :line
+    (or
+     (f/geotrace? field)
+     (f/repeat? field)) {:layer-type "line" :style :line
                          :layout {:line-join "round"
                                   :line-cap "round"}}
     :else {:layer-type "circle" :style :point}))


guard again soe

guard again soe

--- src/java_time/graph.cljc
+++ src/java_time/graph.cljc
@@ -115,7 +115,7 @@
   (run! (fn [[t r]]
           (when (assignable-type? k t)
             (if-not more-arity-steps
-              (vswap! vresult concat (mapv #(as-source types-so-far t %) r))
+              (vswap! vresult into (map #(as-source types-so-far t %)) r)
               (search-for-possible-sources vresult r
                                            (conj types-so-far t)
                                            (first more-arity-steps)


lib.ktoa.components - Add list-view-ds helper for ListView dataSource creation

--- src/ktoa/components.cljc
+++ src/ktoa/components.cljc
@@ -48,7 +48,11 @@
          "touchable-without-feedback" "TouchableWithoutFeedback"
          "view" "View"
          "view-pager-android" "ViewPagerAndroid"
-         "web-view" "WebView"}))))
+         "web-view" "WebView"}))
+
+     (defn list-view-ds []
+       (let [ds (aget core/react-native "ListView" "DataSource")]
+         (ds. #js {:rowHasChanged not=})))))

 #?(:clj
    (defmacro gen-wrappers [comps]


remove empty settings button from settings drawer

--- src-cljs/frontend/components/aside.cljs
+++ src-cljs/frontend/components/aside.cljs
@@ -63,7 +63,4 @@
             [:span "Night Mode"]
             (if night-mode?
               (common/icon :check)
-              (common/icon :times))]
-           [:button
-            [:span "Settings"]
-            (common/icon :times)]]]])))))
+              (common/icon :times))]]]])))))


Expose :decode? as a step option.

Expose :decode? as a step option.

--- messaging/src/immutant/pipeline.clj
+++ messaging/src/immutant/pipeline.clj
@@ -251,14 +251,41 @@
         (vary-meta f assoc :step step :next-step next-step))
       fns (partition 2 1 step-names))))

+(defn ^{:valid-options
+        #{:name :concurrency :decode? :error-handler :fanout? :step-deref-timeout}}
+  step
+  "Wraps the given function with the given options, returning a function.
+
+   The following options can be passed as kwargs or as a map [default]:
+
+   * :name                a name to use for the step [the current index of the fn]
+   * :concurrency         the number of threads to use, overriding the pipeline
+                          setting [1]
+   * :decode?             if false, the raw message object will be passed to
+                          this step [true]
+   * :error-handler       an error handler function that can override the
+                          pipeline setting [nil]
+   * :fanout?             applies the fanout fn to the result of the step.
+                          See {{fanout}} for more details [false]
+   * :step-deref-timeout  the amount of time to wait when dereferencing
+                          the result of the step if it returns a delay,
+                          in ms. Overrides the pipeline setting [10 seconds]"
+  [f & opts]
+  (let [opts (u/kwargs-or-map->map opts)]
+    (o/validate-options  opts step)
+    (vary-meta f merge opts)))
+
 (defn- sync-result-step-fn
   "Returns a function that publishes the result of the pipeline so it can be deref'ed"
   [pl ttl]
-  (fn [m]
-    (msg/publish pl (if m (codecs/decode m))
-      :encoding :edn
-      :ttl ttl
-      :properties {"result" true, correlation-property (get-correlation-property m)})))
+  (step
+    (fn [m]
+      (msg/publish pl (if m (codecs/decode m))
+        :encoding :edn
+        :ttl ttl
+        :properties {"result" true, correlation-property (get-correlation-property m)}))
+    :decode? false))
+

 (defn ^{:valid-options
         #{:concurrency :error-handler :result-ttl :step-deref-timeout :durable}}
@@ -312,8 +339,7 @@
         steps (-> (take-while fn? args)
                 vec
                 (#(if keep-result?
-                    (conj % (vary-meta (sync-result-step-fn pl result-ttl) assoc
-                              :decode? false))
+                    (conj % (sync-result-step-fn pl result-ttl))
                     %))
                 named-steps)
         pl-fn (pipeline-fn pl (map (comp :step meta) steps) keep-result?)]
@@ -329,28 +355,6 @@
         (swap! pipelines assoc pl-name final)
         final))))

-(defn ^{:valid-options
-        #{:name :concurrency :error-handler :step-deref-timeout :fanout?}}
-  step
-  "Wraps the given function with the given options, returning a function.
-
-   The following options can be passed as kwargs or as a map [default]:
-
-   * :name                a name to use for the step [the current index of the fn]
-   * :concurrency         the number of threads to use, overriding the pipeline
-                          setting [1]
-   * :error-handler       an error handler function that can override the
-                          pipeline setting [nil]
-   * :step-deref-timeout  the amount of time to wait when dereferencing
-                          the result of the step if it returns a delay,
-                          in ms. Overrides the pipeline setting [10 seconds]
-   * :fanout?             applies the fanout fn to the result of the step.
-                          See {{fanout}} for more details [false]"
-  [f & opts]
-  (let [opts (u/kwargs-or-map->map opts)]
-    (o/validate-options  opts step)
-    (vary-meta f merge opts)))
-
 (defn stop
   "Destroys a pipeline.


- remove usage of historian & dependency - update dependency to [re-frame "0.1.8"] - use new register-pure-handler in all steps NOTE: functional but daypart unit tests failing + history not yet working

--- src/re_frame/undo.cljs
+++ src/re_frame/undo.cljs
@@ -23,7 +23,7 @@
 (defn clear-history!
   []
   (reset! undo-list [])
-  (reset! undo-list []))
+  (reset! redo-list []))

 (defn store-now!
@@ -34,22 +34,30 @@
                            @max-undos
                            (conj @undo-list @app-db)))))

+(defn- undos?
+  [v]
+  (> (count v) 1))
+
+(defn- redos?
+  [v]
+  (> (count v) 0))
+

 ;; -- subscriptions  -----------------------------------------------------------------------------

 (subs/register
   :undos?
   (fn handler
-    ; "return true is anything is stored in the undo list, otherwise false"
+    ; "return true if anything is stored in the undo list, otherwise false"
     [_ _]
-    (reaction (> (count @undo-list) 1))))
+    (reaction (undos? @undo-list))))

 (subs/register
   :redos?
   (fn handler
-    ; "return true is anything is stored in the redo list, otherwise false"
+    ; "return true if anything is stored in the redo list, otherwise false"
     [_ _]
-    (reaction (> (count @redo-list) 0))))
+    (reaction (redos? @redo-list))))

 ;; -- event handlers  ----------------------------------------------------------------------------


include path in assert error

include path in assert error

Including path helps track down which particular cursor is misbehaving.

--- src/reagent/ratom.cljs
+++ src/reagent/ratom.cljs
@@ -321,7 +321,9 @@
               (and (ifn? src)
                    (not (vector? src))))
           (str "src must be a reactive atom or a function, not "
-               (pr-str src)))
+               (pr-str src)
+               " while attempting to get path: "
+               (pr-str path))
   (->RCursor src path nil nil nil))


added cascalog tests for telescoping long trend

--- test/forma/trends/analysis_test.clj
+++ test/forma/trends/analysis_test.clj
@@ -159,34 +159,48 @@
 ;;         (dorun (telescoping-short-trend 140 271 23 30 10 ndvi reli))))
 ;; "Elapsed time: 5650.48 msecs"

-(defn extract-ndvi
-  [{:keys [ndvi]}]
-  [ndvi])
-
-(defn extract-reli
-  [{:keys [reli]}]
-  [reli])
-
-(defn extract-rain
-  [{:keys [rain]}]
-  [rain])
-
-(defn create-tap
-  [n ts]
-  (vec (repeat n (schema/timeseries-value 0 ts))))
-
-(defn myfunc [m]
-  (let [coll (vector (:series m))]
-    (hansen-stat (first coll))))
+
+(def total-tap
+  (vec (repeat 2 {:start 0 :end 271 :ndvi ndvi :reli reli :rain rain})))
+
+(defn long-trend-results
+  "returns three vectors, the first with the hansen statistic for time
+  series ranging from 0 through 135 (end of training period) and 136;
+  the second with the long-term drop value; and the third with the
+  long-term t-statisic.  Input a map, generated by total-tap.  The
+  start and end index don't matter for this application, but are left
+  in there anyway to ensure forward compatibility"
+  [m]
+  (let [ndvi (vector (:ndvi m))
+        reli (vector (:reli m))
+        rain (vector (:rain m))])
+  (transpose (telescoping-long-trend 23 135 136 ndvi reli rain)))
+
+(def long-trend-query
+  (<- [?han-stat ?long-drop ?long-tstat]
+      (total-tap ?ts-map)
+      (tele-wrap ?ts-map :> ?han-stat ?long-drop ?long-tstat)
+      (:distinct false)))
+
+(fact
+ "duplicate time series will produce two sets of identical results, given that :distinct is set to false; otherwise, results would "
+ long-trend-query => (produces '([[1.2393550741169639 1.2133709085855648]
+                                  [2.4915869043482424 1.3049908881259853]
+                                  [1.1504228201940752 0.5951173333726173]]
+                                 [[1.2393550741169639 1.2133709085855648]
+                                  [2.4915869043482424 1.3049908881259853]
+                                  [1.1504228201940752 0.5951173333726173]])))
+
+;; informative tests (leave in for now)
+
+;; (defn create-tap
+;;   [n ts]
+;;   (vec (repeat n (schema/timeseries-value 0 ts))))
+
+;; (defn myfunc [m]
+;;   (let [coll (vector (:series m))]
+;;     (hansen-stat (first coll))))

 ;; (defn test-myfunc []
 ;;   (?<- (stdout) [?han] (time-src ?series) (myfunc ?series :> ?han)))

-(defn total-tap
-  [n]
-  (repeat n {:start 0 :end 271 :ndvi ndvi :reli reli :rain rain}))
-
-(defmapcatop tele-wrap
-  [ndvi reli rain]
-  (telescoping-long-trend 23 100 110 ndvi reli rain))
-


fixed import

fixed import

--- src/syncserver/core.clj
+++ src/syncserver/core.clj
@@ -1,6 +1,6 @@
 (ns syncserver.core
   (:require [clojure.data :as d])
-  (:import syncserver.ISyncFunction))
+  (:import syncserver.IFunction1))

 (defn dissoc-in [m [k & ks :as keys]]
   (if ks


+(deftest furniture-sentence)

+(deftest furniture-sentence)

--- test/babel/test/en.cljc
+++ test/babel/test/en.cljc
@@ -214,3 +214,23 @@
     (is (= (fo expr)
            "in front of the table"))))

+(deftest furniture-sentence
+  (let [expr (generate {:modified false
+                        :comp {:synsem {:agr {:person :3rd}}}
+                        :synsem {:cat :verb
+                                 :sem {:aspect :progressive
+                                       :pred :in-front-of
+                                       :subj {:pred :chair
+                                              :mod '()
+                                              :number :sing
+                                              :spec {:def :def
+                                                     :pred :definite}}
+                                       :obj {:pred :table
+                                             :mod '()
+                                             :number :sing
+                                             :spec {:def :def
+                                                    :pred :definite}}
+                                       :tense :present}}}
+                       :model medium)]
+    (is (= (fo expr)
+           "the chair is in front of the table"))))


+(defn tiny-model)

+(defn tiny-model)

--- test/babel/test/it.cljc
+++ test/babel/test/it.cljc
@@ -38,6 +38,16 @@
                 arguments
                 `[(log/info (str "done with test: " ~test-name))])]
     `(realtest/deftest ~test-name ~@wrapped-arguments)))
+
+(defn tiny-model []
+  (let [lexicon (babel.lexiconfn/read-lexicon "it")]
+    (babel.italiano.grammar/model-plus-lexicon
+     lexicon (fn [rule]
+               (do
+                 (log/info (str "THE RULE IS: " (:rule rule)))
+                 (or
+                  (= (:rule rule)
+                     "s-present-nonphrasal")))))))

 ;; (repeatedly #(println (morph (time (generate reflexive-passato-is-slow)))))
 (defn generate


+(defn cross-product)

+(defn cross-product)

--- test/babel/test/en.cljc
+++ test/babel/test/en.cljc
@@ -620,12 +620,20 @@
                                    (reduce merge [a b])))))))
         a-s))))

-
-
-
-
-
-
+;; how to use:
+;;(map flatten (cross-product [1 2 3][4 5 6 7][8 9 10]))
+
+(defn cross-product [a b & more]
+  (if (not (empty? more))
+    (reduce
+     (fn [x y] (cross-product x y))
+     (concat (list a b) more))
+    (if (not (empty? a))
+      (concat
+       (map (fn [each-b]
+              [(first a) each-b])
+            b)
+       (f (rest a) b)))))


add more namespaces for debugging

add more namespaces for debugging

--- test/babel/test/it.cljc
+++ test/babel/test/it.cljc
@@ -2,13 +2,16 @@
   (:refer-clojure :exclude [get-in])
   (:require [babel.italiano.grammar :refer [small medium np-grammar]]
             [babel.italiano.lexicon :refer [lexicon]]
-            [babel.italiano.morphology :as morph :refer [fo new-style replace-patterns]]
+            [babel.italiano.morphology :as morph :refer [analyze-regular fo replace-patterns]]
+            [babel.italiano.morphology.nouns :as nouns]
+            [babel.italiano.morphology.verbs :as verbs]
             [babel.italiano.workbook :refer [analyze generate generate-all parse]]
             [babel.parse :as parse]
             #?(:clj [clojure.test :refer [deftest is]])
             #?(:cljs [cljs.test :refer-macros [deftest is]])
             #?(:clj [clojure.tools.logging :as log])
-            #?(:cljs [babel.logjs :as log])
+            #?(:cljs [babel.logjs :as log])
+            [clojure.string :as string]
             [dag_unify.core :refer [get-in strip-refs]]))

 (deftest analyze-1


tests and comments

tests and comments

--- test/babel/test/it.cljc
+++ test/babel/test/it.cljc
@@ -325,16 +325,50 @@
                 (map :surface
                      result)))))

+(deftest casa-generate
+  (let [result (generate {:synsem {:cat :noun
+                                   :agr {:number :sing}
+                                   :sem {:pred :house
+                                         :mod '()
+                                         :spec {:def :def}}}})]
+    (is (= (fo result) "la casa"))
+    (is (= (get-in result [:synsem :sem :mod]) '()))))
+
+(deftest case-generate
+  (let [result (generate {:synsem {:cat :noun
+                                   :agr {:number :plur}
+                                   :sem {:pred :house
+                                         :mod '()
+                                         :spec {:def :def}}}})]
+    (is (= (fo result) "le case"))
+    (is (= (get-in result [:synsem :sem :mod]) '()))))
+
+(deftest alla-casa-generate
+  (let [result (generate
+                {:synsem {:cat :prep
+                          :sem {:pred :a
+                                :obj {:pred :house
+                                      :spec {:def :def}
+                                      :mod '()}}}})]
+    (is (= (fo result) "alla casa"))))
+
 (deftest a-casa-generate
   (let [result (generate
                 {:comp {:synsem {:reflexive false}}
+                 ;; TODO: the above is needed to prevent "a" + reflexive pronoun:
+                 ;; eliminate this need.
                  :synsem {:cat :prep
                           :sem {:pred :a
                                 :obj {:pred :house
+                                      ;; :mod '() ;; this is commented out:
+                                      ;; if *not* commented out, test will run faster since there will
+                                      ;; be less futile bolts checked (less bolts where no complement can
+                                      ;; be found.
                                       :spec {:def :none}}}}})] ;; "a casa", not "a tua casa", "a della casa", etc
     (is (= (fo result) "a casa"))))

-(deftest casa-generate
+;; TODO: what is this test doing that the preceding test is not doing?
+(deftest a-casa-generate-2
   (let [result (generate
                 {:modified false
                  :synsem {:cat :verb


Modify the state when clicking on a namespace or on '..'. Did not need before displaying the function because the state was always the same. But, for displaying a function, the state is changed to fn-form-displaying, thus preventing the .. to work!

--- src/app/cljs/one/sample/controller.cljs
+++ src/app/cljs/one/sample/controller.cljs
@@ -103,6 +103,7 @@
   ;; update the model with the new namespace
   (swap! state-fnx (fn [old]
                      (assoc old
+                       :state :ns-navigating
                        :ns-nav ns))))

 (def fn-to-display


Display "Error" in status bar if query fails

--- src/sqls/worksheet.clj
+++ src/sqls/worksheet.clj
@@ -107,7 +107,6 @@
   [worksheet-agent-state
    ^clojure.lang.Atom worksheet
    ^String sql]
-  (println "execute!")
   (let [^javax.swing.JFrame frame (:frame @worksheet)
         ^java.sql.Connection conn (@worksheet :conn)]
     (assert (not= frame nil))
@@ -122,7 +121,9 @@
         (ui-worksheet/log frame "Done\n")
         (ui-worksheet/status-text frame "Done"))
       (catch java.sql.SQLException e
-        (ui-worksheet/log frame (format "Failed to execute SQL: %s\n" (str e)))))
+        (do
+          (ui-worksheet/log frame (format "Failed to execute SQL: %s\n" (str e)))
+          (ui-worksheet/status-text frame "Error"))))
     (swap! worksheet (partial swap-worksheet-state :busy :idle)))
   worksheet-agent-state)


Clarify comment in dijkstra.cljc.

Clarify comment in dijkstra.cljc.

--- src/cljc/mazes/algorithms/dijkstra.cljc
+++ src/cljc/mazes/algorithms/dijkstra.cljc
@@ -74,8 +74,8 @@
   ([grid origin]
    (solve grid origin nil))
   ([grid origin destination]
-   ;; NOTE: If no cells have less than infinite distance, they must not have
-   ;; been linked to any visited cell.
+   ;; NOTE: If all remaining cells have infinite distance, they must have been
+   ;; unreachable.
    (let [complete? (if (nil? destination)
                      ; true when all reachable cells have been visited
                      (fn [distances unvisited]


fix: [bug] #a6f6bef had broken net-worth

--- src/cljs/expense_tracker/net_worth.cljs
+++ src/cljs/expense_tracker/net_worth.cljs
@@ -1,19 +1,23 @@
 (ns expense-tracker.net-worth
-  (:require [expense-tracker.globals :as g]))
+  (:require [expense-tracker.globals :as g]
+            [expense-tracker.utils :as u]))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; helpers

-(defn nw-helper [typeof]
+(defn nw-helper [children]
   [:table.table.table-bordered.table-striped
-   (map (fn [s]
-          ^{:key (str typeof "-" (:name s))}
-          [:tr [:td [:a.text-capitalize {:href (str "/trans/" (:name s))} (:name s)]]
-           [:td (or (:balance s) 0)]])
-        (filter #(= typeof (:type %)) @g/accounts))
+   (map (fn [n]
+          ^{:key (u/random)}
+          [:tr [:td [:a.text-capitalize {:href (str "/trans/" (:name n))} (:name n)]]
+           [:td (or (:balance n) 0)]])
+        children)
    [:tr [:td [:strong "Total"]]
     [:td (reduce + (map #(or (:balance %) 0)
-                        (filter #(= typeof (:type %)) @g/accounts)))]]])
+                        children))]]])
+
+(defn get-children [parent]
+  (:children (first (filter #(= parent (:name %)) @g/accounts))))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; components and views
@@ -21,8 +25,8 @@
 (defn c-net-worth []
   [:div.row
    [:div.col-sm-6
-    [:h3 "Assets"] (nw-helper :asset)
-    [:h3 "Income"] (nw-helper :income)]
+    [:h3 "Assets"] (nw-helper (get-children "asset"))
+    [:h3 "Income"] (nw-helper (get-children "income"))]
    [:div.col-sm-6
-    [:h3 "Liabilities"] (nw-helper :liability)
-    [:h3 "Expenses"] (nw-helper :expense)]])
+    [:h3 "Liabilities"] (nw-helper (get-children "liability"))
+    [:h3 "Expenses"] (nw-helper (get-children "expense"))]])


Remove stub

Remove stub

--- src/cljs/koeeoadi/components/theme.cljs
+++ src/cljs/koeeoadi/components/theme.cljs
@@ -95,9 +95,6 @@
   (let [input (gdom/getElement "file-input")]
     (.click input)))

-(defn export-theme []
-  (println "stub"))
-
 (defn theme-actions [comp]
   (dom/div #js {:className "row control-row"}
     (dom/div #js {:className "one-third column"}


fix mixpanel properties (#1568)

fix mixpanel properties (#1568)

--- src/cljs/main/broadfcui/utils/ajax.cljs
+++ src/cljs/main/broadfcui/utils/ajax.cljs
@@ -148,10 +148,10 @@
              :headers (merge (@get-bearer-token-header) content-type=json)
              :data (utils/->json-string
                     {:event event
-                     :data (assoc details
-                             :appId js/window.location.hostname
-                             :appPath "method-repo"
-                             :timestamp (js/Date.now))})
+                     :properties (assoc details
+                                   :appId js/window.location.hostname
+                                   :appPath "method-repo"
+                                   :timestamp (js/Date.now))})
              :on-done (constantly nil)})
       (catch :default _ nil))))


newline sep bug fix

newline sep bug fix

--- src/clojure/zensols/actioncli/parse.clj
+++ src/clojure/zensols/actioncli/parse.clj
@@ -165,7 +165,8 @@
   ([{:keys [name description options] :as action} skip-action-name? max-len]
    (str (if-not skip-action-name?
           (format (str "%-" (+ 4 max-len) "s") name))
-        description \newline
+        description
+        (if-not (empty? options) \newline)
         (:summary (cli/parse-opts nil options)))))

 (defn- action-keys [action-context]
@@ -186,7 +187,7 @@
             (action-help action)
             (->> (map #(get actions %) action-keys)
                  (map #(action-help % (= 'single action-mode) name-len))
-                 (s/join \newline)))
+                 (s/join (str \newline\newline))))
           ((or print-help-fn identity))))))

 (defn- parse-single [action-context action arguments single-action-mode?


Cell permutation now working

Cell permutation now working

--- src/conexp/contrib/gui/editors/util.clj
+++ src/conexp/contrib/gui/editors/util.clj
@@ -20,7 +20,7 @@
                         InputEvent]
            [java.awt.datatransfer DataFlavor StringSelection]
            [javax.swing.event TreeSelectionListener TableModelListener
-             MouseInputListener ]
+             MouseInputListener MouseInputAdapter ]
            [javax.swing.table DefaultTableModel])
   (:use clojure.contrib.swing-utils
         [clojure.contrib.string :only (join split-lines split)])
@@ -131,7 +131,7 @@
                            :modifiers (translate-modifier (.getModifiersEx event))
                            :position [(.getX event) (.getY event)]
                            :buttons-down (translate-pressed-btns (.getModifiersEx event))})]
-    (proxy [MouseInputListener] []
+    (proxy [MouseInputAdapter] []
       (mousePressed [event]
         (with-swing-threads* (pressed (translate-event event))))
       (mouseReleased [event]
@@ -143,8 +143,7 @@
       (mouseClicked [event]
         (with-swing-threads* (clicked (translate-event event))))
       (mouseMoved [event]
-        (with-swing-threads* (message-box "MOVED")
-          (moved (translate-event event))))
+        (with-swing-threads* (moved (translate-event event))))
       (mouseDragged [event]
         (with-swing-threads* (dragged (translate-event event)))))))

@@ -209,7 +208,8 @@
 (defn add-control-mouse-listener
   "Adds a mouse-listener proxy to the given control."
   [control proxy]
-  (.addMouseListener (get-control control) proxy))
+  (.addMouseListener (get-control control) proxy)
+  (.addMouseMotionListener (get-control control) proxy))

 ;;; Button
@@ -674,20 +674,23 @@
                                 (if (not= start-col end-col)
                                   (move-column widget start-col end-col))
                                 (if (not= start-row end-row)
-                                  (move-row widget start-row end-row)))
-                              (dosync (ref-set drag-start nil)))),
+                                  (move-row widget start-row end-row))))),
          drag-motion-event (fn [x]
-                             (message-box "X")
-                             (if (and (= (:button x) 1)
-                                   (= (:modifiers x) #{:alt})
-                                   (not= (deref drag-start) nil))
-                               (let [ cell (get-view-coordinates-at-point
-                                             widget (:position x))
-                                      row (first cell)
-                                      column (second cell) ]
-                                 (select-single-cell widget row column))
-                               (message-box "DRAG")
-                               )),
+                             (if (not= (deref drag-start) nil)
+                               (let [ start (deref drag-start)
+                                     end (get-view-coordinates-at-point
+                                           widget (:position x))
+                                     start-row (first start)
+                                     start-col (second start)
+                                     end-row (first end)
+                                     end-col (second end)]
+                                 (select-single-cell widget end-row end-col)
+                                 (dosync
+                                   (ref-set drag-start end))
+                                 (if (not= start-col end-col)
+                                   (move-column widget start-col end-col))
+                                 (if (not= start-row end-row)
+                                   (move-row widget start-row end-row))))),

         cell-permutor (proxy-mouse-listener button-down-event
@@ -695,7 +698,7 @@
                                             ignore-event
                                             ignore-event
                                             ignore-event
-                                            drag-motion-event
+                                            ignore-event
                                             drag-motion-event)]
     (add-hook widget "table-changed"
       (fn [c f l t] (table-change-hook widget c f l t))


Add support for `nil` and keywords as url parameters.

--- src/uxbox/main/ui.cljs
+++ src/uxbox/main/ui.cljs
@@ -124,6 +124,13 @@
    ["/dashboard/colors" :dashboard/colors]
    ["/workspace/:project/:page" :workspace/page]])

+(extend-protocol bc/IPathRepr
+  nil
+  (-repr [it] "")
+
+  cljs.core.Keyword
+  (-repr [it] (name it)))
+
 ;; --- Main Entry Point

 (defn init-routes


using find-vm and asserting power off on destroy

--- src/vsphere/vijava.clj
+++ src/vsphere/vijava.clj
@@ -32,7 +32,7 @@
   (memoize
     (fn []
       (into []
-        (repeatedly (get! :hypervisor :vsphere :session-count) #(agent (connect (get! :hypervisor :vsphere))))))))
+            (repeatedly (get! :hypervisor :vsphere :session-count) #(agent (connect (get! :hypervisor :vsphere))))))))

 (defn session-expired? [instance]
   (nil? (:currentSession (bean (.getSessionManager (deref (first (services))))))))
@@ -60,7 +60,7 @@
      (let [res# @p#]
        (when (instance? Throwable res#)
          (throw res#))
-       res# )
+       res#)
      ))

 (defn navigator
@@ -74,8 +74,16 @@

 (defn find*
   "Find entity by type and name"
-  ([type name] (find* type name (navigator)))
-  ([type name within] (.searchManagedEntity within type name)))
+  ([type name*] (find* type name* (navigator)))
+  ([type name* within]
+   (if-let [entity (.searchManagedEntity within type name*)]
+     entity
+     (throw+ {:type ::missing-entity :message (str "No matching entity found " name*)}))))
+
+(defn find-vm
+  "locates a vm or a template"
+  [name*]
+  (find* "VirtualMachine" name*))

 (defn resource-pools [dcname]
   (find-all "ResourcePool" (navigator (find* "Datacenter" dcname))))
@@ -109,47 +117,46 @@

 (defn clone [{:keys [datacenter] :as allocation} {:keys [template hostname] :as machine}]
   (with-service
-    (if-let [vm (find* "VirtualMachine" template)]
-      (wait-for (.cloneVM_Task vm (.getParent vm) hostname (clone-spec allocation machine)))
-      (throw+ {:type ::missing-template :message (str "No matching template found " template)})
-      )))
+    (let [vm (find-vm template)]
+      (wait-for (.cloneVM_Task vm (.getParent vm) hostname (clone-spec allocation machine))))))

 (def power-to-s
   {VirtualMachinePowerState/poweredOn :running
    VirtualMachinePowerState/poweredOff :stopped
    VirtualMachinePowerState/suspended :suspended})

-(defn status [hostname]
+(defn status
+  "Get VM status"
+  [hostname]
   (with-service
-    (let [vm (find* "VirtualMachine" hostname)]
-      (-> (bean vm) :summary bean :runtime bean :powerState power-to-s ))))
+    (-> hostname find-vm bean :summary bean :runtime bean :powerState power-to-s )))

-(defn power-on [hostname]
+(defn power-on
+  "Power on VM"
+  [hostname]
   (with-service
-    (let [vm (find* "VirtualMachine" hostname)]
-      (wait-for (.powerOnVM_Task vm nil)))))
+    (wait-for (.powerOnVM_Task (find-vm hostname) nil))))

-(defn power-off [hostname]
+(defn power-off
+  "Power off VM"
+  [hostname]
   (with-service
-    (let [vm (find* "VirtualMachine" hostname)]
-      (wait-for (.powerOffVM_Task vm)))))
+    (wait-for (.powerOffVM_Task (find-vm hostname)))))

-(defn destroy [hostname]
-  (with-service
-    (let [vm (find* "VirtualMachine" hostname)]
-      (wait-for (.destroy_Task vm)))))
+(defn destroy
+  "Destroy a vm, requires vm to be stopped"
+  [hostname]
+  {:pre [(= (status hostname) :stopped)]}
+  (with-service (wait-for (.destroy_Task (find-vm hostname)))))

 (comment
-  (try
-    (clone {:datacenter "playground"}
-           {:template "ubuntu-13.04_puppet-3.1" :hostname "bar" :disk-format :sparse :cpus 1 :memory 512})
-    (catch Throwable e (error e))
-    )
-  (map deref (repeatedly 40 (fn []  (future (status "foo") ))))
-  (status "foo")
-  (power-on "foo")
-  (power-off "foo")
-  (destroy "foo")
+  (clone {:datacenter "playground"} {:template "ubuntu-13.04_puppet-3.1-with-tools" :hostname "bar" :disk-format :sparse :cpus 2 :memory 512})
+  (with-service
+    (:guestState (bean (.getGuest (find-vm "bar")))))
+  (status "bar")
+  (power-on "bar")
+  (power-off "bar")
+  (destroy "bar")
   (clojure.pprint/pprint  (bean (.getServerConnection (deref (first (services))))))
   (clojure.pprint/pprint (.getKey (:currentSession (bean (.getSessionManager (deref (first (services))))))))
   (clojure.pprint/pprint (.getKey (:currentSession (bean (.getSessionManager (deref (second (services))))))))


multilingual achievement

multilingual achievement

--- src-clj/acha/achievement.clj
+++ src-clj/acha/achievement.clj
@@ -216,7 +216,8 @@
 (def multilingual
   [:multilingual
    (fn [commit-info]
-     nil)])
+     (>= (+ (map #(if (% commit-info) 1 0)
+      (vals (map make-language-scanner language-table)))) 5))])
 (def commenter
   [:commenter
    (fn [commit-info]


add a debug function until we hook up sente to app-state

--- src-cljs/frontend/sente.cljs
+++ src-cljs/frontend/sente.cljs
@@ -1,6 +1,7 @@
 (ns frontend.sente
   (:require-macros [cljs.core.async.macros :as asyncm :refer (go go-loop)])
   (:require [cljs.core.async :as async :refer (<! >! put! chan)]
+            [frontend.utils :as utils :include-macros true]
             [taoensso.sente  :as sente :refer (cb-success?)]))

 (defn subscribe-to-document [sente-state document-id]
@@ -15,7 +16,17 @@
                      ((:send-fn sente-state) [:frontend/subscribe {:document-id document-id}])
                      (async/close! tap))))))

+(defn do-something [sente-state]
+  (let [tap (async/chan (async/sliding-buffer 1))
+         mult (async/mult (:ch-recv sente-state))]
+    (async/tap mult tap)
+    (go-loop []
+             (when-let [val (<! tap)]
+               (utils/inspect val)
+               (recur)))))
+
 (defn init [app-state]
   (let [{:keys [chsk ch-recv send-fn state] :as sente-state} (sente/make-channel-socket! "/chsk" {:type :auto})]
     (swap! app-state assoc :sente sente-state)
-    (subscribe-to-document sente-state 123456789)))
+    (subscribe-to-document sente-state 123456789)
+    (do-something sente-state)))


SearchResource.clj: added extra fields for ATOM results

--- src/org/altlaw/www/SearchResource.clj
+++ src/org/altlaw/www/SearchResource.clj
@@ -32,30 +32,35 @@
   (when-let [h (get highlights (str docid))]
     (get h "text")))

-(defn prepare-hit [highlights doc]
+(defn prepare-hit [this highlights doc]
   (let [docid (.getFieldValue doc "docid")
         name (.getFieldValue doc "name")
         the-name (if (or (nil? name) (empty? name))
                    (str "Untitled #" (.getFieldValue doc "docid"))
-                   name)]
+                   name)
+        date (.getFieldValue doc "date")]
   {:docid docid
-   :url (format "/v1/cases/%s" docid)
+   :url (str (.getTargetRef (Reference. (.. this getRequest getOriginalRef)
+                                        (str "/v1/cases/" docid))))
+   :timestamp (if (seq date) (str date "T10:00:00-05:00")
+                  (DateUtils/timestamp))
    :size (when-let [size (.getFieldValue doc "size")]
            (int (Math/ceil (/ size 1024.0))))
-   :date (date/format-long-date (.getFieldValue doc "date"))
+   :date (date/format-long-date date)
    :court (courts/*court-names* (.getFieldValue doc "court"))
    :name (tmpl/h the-name)
    :citations (map tmpl/h (.getFieldValues doc "citations"))
    :snippets (get-snippets highlights docid)}))

-(defn prepare-solr-results [solr-response]
-  (let [docs (.getResults solr-response)]
-    {:query (.. solr-response getHeader (get "params") (get "q"))
+(defn prepare-solr-results [this solr-response]
+  (let [docs (.getResults solr-response)
+        query (.. solr-response getHeader (get "params") (get "q"))]
+    {:query (tmpl/h query)
      :sort (.. solr-response getHeader (get "params") (get "sort"))
      :total_hits (.getNumFound docs)
      :start_hit (if (zero? (.getNumFound docs)) 0 (inc (.getStart docs)))
      :end_hit (+ (.getStart docs) (count docs))
-     :hits (map (partial prepare-hit (.getHighlighting solr-response))
+     :hits (map (partial prepare-hit this (.getHighlighting solr-response))
                 docs)}))

 (defn get-current-page [ref]
@@ -423,7 +428,7 @@
    (if-let [search-type (get-search-type this)]
      (if-let [solr-query (get-solr-query this search-type)]
        (let [solr-results (execute-search this solr-query)
-             prepared (prepare-solr-results solr-results)]
+             prepared (prepare-solr-results this solr-results)]
          (if (and (= :citation search-type)
                   (= 1 (:total_hits prepared)))
            ;; Citation search, go straight to document:


More forgiving parsing for markov options

--- src/engulf/formulas/markov_requests.clj
+++ src/engulf/formulas/markov_requests.clj
@@ -1,6 +1,7 @@
 (ns engulf.formulas.markov-requests
   "Support for generating markov chains of requests"
   (:use clojure.pprint
+        [clojure.string :only [lower-case]]
         [clojure.walk :only [keywordize-keys]])
   (:require [clojure.string :as string]
             [clojure.tools.logging :as log]
@@ -99,7 +100,9 @@
   (->> corpus
        (map #(if (map? %) % {:url %}))
        (map keywordize-keys)
-       (map #(assoc % :method (keyword (or  (:method %) :get))))))
+       (map #(assoc % :method (if-let [m (:method %)]
+                                (keyword (lower-case m))
+                                :get)))))

 (defn preprocess-corpus
   "Compiles the corpus into something that's a processed as possible but can still


parse clojure exceptions when the exception has a resource path

--- figwheel-core/src/figwheel/tools/exceptions.clj
+++ figwheel-core/src/figwheel/tools/exceptions.clj
@@ -101,8 +101,17 @@
 (defmethod source-file :tools.reader/reader-exception [tm]
   (first-file-source tm))

+(defn correct-file-path [file]
+  (cond
+    (nil? file) file
+    (not (.exists (io/file file)))
+    (if-let [f (io/resource file)]
+      (relativize-local (.getPath f))
+      file)
+    :else (relativize-local file)))
+
 (defmethod source-file :clj/compiler-exception [tm]
-  (some->> tm :via first :message (re-matches #"(?s).*\(([^:]*)\:.*") second relativize-local))
+  (some->> tm :via first :message (re-matches #"(?s).*\(([^:]*)\:.*") second correct-file-path))

 (defn data [tm]
   (or (:data tm) (->> tm :via reverse (keep :data) first)))


working pipes

working pipes

--- src/hackerrank/fp/perimeter-polygon.clj
+++ src/hackerrank/fp/perimeter-polygon.clj
@@ -78,9 +78,16 @@
                          (take-nth 2 (vec (read-line))))]
         (println numbers)))))

+(defn parseInt [n]
+  (Integer/parseInt (str n)))
+
+(defn parseInt-at [f coll]
+  (parseInt (f coll)))
+
 ;; https://clojuredocs.org/clojure.core/line-seq
 (import '(java.io BufferedReader StringReader))
 (line-seq (BufferedReader. (StringReader. input)))
+
 (->> input
      StringReader.
      BufferedReader.
@@ -89,7 +96,12 @@
      (filter #(pos? (count %)))
      (map #(vec %))
      (map #(take-nth 2 %))
-     (map #(Integer/parseInt (str %))))
+     (map #(vector (parseInt-at first %) (parseInt-at second %)))
+     solution)
+
+
+
+

 (count "1")


replace = with EQ in cljsdoc filenames

replace = with EQ in cljsdoc filenames

--- src/core.clj
+++ src/core.clj
@@ -589,6 +589,7 @@
       (replace "?" "QMARK")
       (replace "*" "STAR")
       (replace "+" "PLUS")
+      (replace "=" "EQ")
       (replace "/" "SLASH")))

 (defn item-filename


Inline function

Inline function

--- src/main/cljc/mikron/compiler/core.cljc
+++ src/main/cljc/mikron/compiler/core.cljc
@@ -17,7 +17,10 @@
   (defn compile-schema
     "Returns a compiled schema for the given args."
     [schema global-options]
-    #?(:clj (macrowbar/try-loading-compiling-ns))
+    #?(:clj
+       (try
+         (require (ns-name *ns*))
+         (catch Exception e)))
     (let [schema
           (->> schema
                (util/eval-if-not-literal)


Minor code and doc cleanup.

Minor code and doc cleanup.

--- src/main/clojure/clara/rules/engine.clj
+++ src/main/clojure/clara/rules/engine.clj
@@ -11,7 +11,8 @@
 (defprotocol IRuleSource
   (load-rules [source]))

-
+;; Protocol representing a single condition in
+;; a rule or a query.
 (defprotocol ICondition
   ;; Returns a key uniquely identifying the condition.
   (condition-key [condition])
@@ -122,7 +123,10 @@
   (right-activate [node join-bindings elements memory transport])
   (right-retract [node join-bindings elements memory transport]))

-;; Right
+;; Specialized right activation interface for accumulator nodes,
+;; where the caller has the option of pre-reducing items
+;; to reduce the data sent to the node. This would be useful
+;; if the caller is not in the same memory space as the accumulator node itself.
 (defprotocol IAccumRightActivate
   ;; Pre-reduces elements, returning a map of bindings to reduced elements.
   (pre-reduce [node elements])
@@ -217,6 +221,8 @@

   (description [node] "ProductionNode"))

+;; The QueryNode is a terminal node that stores the
+;; state that can be queried by a rule user.
 (defrecord QueryNode [id query param-keys]
   ILeftActivate
   (left-activate [node join-bindings tokens memory transport]
@@ -229,6 +235,9 @@

   (description [node] (str "QueryNode -- " param-keys)))

+;; Record representing alpha nodes in the Rete network,
+;; each of which evaluates a single condition and
+;; propagates matches to its children.
 (defrecord AlphaNode [condition children activation]
   IAlphaActivate
   (alpha-activate [node facts memory transport]
@@ -543,7 +552,9 @@
              ~'?__bindings__ (atom ~initial-bindings)]
          (do ~@(compile-constraints constraints (set binding-keys)))))))

-(defn compile-action [binding-keys rhs]
+(defn compile-action
+  "Compile the right-hand-side action of a rule, returning a function to execute it."
+  [binding-keys rhs]
   (let [assignments (mapcat #(list (symbol (name %)) (list 'get-in '?__token__ [:bindings %])) binding-keys)]
     `(fn [~'?__token__]
        (let [~@assignments]
@@ -557,6 +568,7 @@
                              (= \? (first (name item))))]
               (keyword  item))))

+;; Record representing a compiled accumulator definition.
 (defrecord AccumulatorDef [initial-value reduce-fn combine-fn convert-return-fn])

 (defn- construct-condition [condition result-binding]


Updated order of default effect vs event handlers

--- libs/datreactor/src/dat/reactor.cljc
+++ libs/datreactor/src/dat/reactor.cljc
@@ -225,12 +225,12 @@

 ;; Defaults

-(register-handler :default
+(register-effect :default
   (fn [app db event]
     (log/error "No definition for event:" event "You should probably go add one in your events ns")
     db))

-(register-effect :default
+(register-handler :default
   (fn [app db event]
     (log/error "No definition for event:" event "You should probably go add one in your events ns")
     db))


Make sure it warns when running production-mode code.

--- env/prod/cljs/vinculum/main.cljs
+++ env/prod/cljs/vinculum/main.cljs
@@ -1,4 +1,5 @@
 (ns vinculum.main
   (:require [vinculum.core :as core]))

+(js/console.log "Starting production mode CLJS!")
 (core/main)


Remove `:subtitle` from `atom-feed` test options

--- test/io/perun_test.clj
+++ test/io/perun_test.clj
@@ -465,7 +465,6 @@
                      :out-dir "foo"
                      :base-url "http://bar.com/"
                      :site-title "Test Site"
-                     :subtitle "Sub-test"
                      :description "Here we go a-testing")
         (testing "atom-feed"
           (file-exists? :path "foo/test-atom.xml"


Ensure experiments available in xcompare run

--- src/aerobio/htseq/rnaseq.clj
+++ src/aerobio/htseq/rnaseq.clj
@@ -84,6 +84,9 @@
   (apply get-comparison-files- args))

+(defn ensure-exp-set [eid]
+  (when (not (cmn/get-exp eid)) (cmn/set-exp eid)))
+
 (defn get-xcomparison-files-
   "Compute the set of Cross Experiment comparison bams and the
   corresponding output csv for the count table matrix. Cross
@@ -102,9 +105,11 @@
                       slurp csv/read-csv rest
                       (map (fn[[c1 c2]]
                              (let [[eid1 strain cond1] (str/split #"-" c1)
+                                   _ (ensure-exp-set eid1)
                                    gb1 (str strain "-" cond1 "*.bam")
                                    c1bams (apply cmn/get-exp-info eid1 bpath)
                                    [eid2 strain cond2] (str/split #"-" c2)
+                                   _ (ensure-exp-set eid2)
                                    gb2 (str strain "-" cond2 "*.bam")
                                    c2bams (apply cmn/get-exp-info eid2 bpath)]
                                [(fs/join c1bams gb1) (fs/join c2bams gb2)]))))


add missing :subcat spec to translation

add missing :subcat spec to translation

--- src/babel/english/writer.clj
+++ src/babel/english/writer.clj
@@ -63,6 +63,7 @@
                             (get-in source-expression [:structure :synsem :sem])))
             (let [source-cat (get-in source-expression [:structure :synsem :cat] :top)
                   spec {:synsem {:cat source-cat
+                                 :subcat (get-in source-expression [:structure :synsem :subcat])
                                  :sem
                                  (strip-refs (get-in
                                               (:structure source-expression)


cleanup

cleanup

--- src/babel/lexicon_reader.clj
+++ src/babel/lexicon_reader.clj
@@ -1,18 +1,8 @@
 (ns babel.lexicon_reader
   (:require
    [babel.korma :refer [init-db]]
-   [babel.writer :refer [write-lexicon]]
-   [clojure.data.json :as json :refer [read-str]]
-   [clojure.string :as string]
    [clojure.tools.logging :as log]
    [korma.core :refer [exec-raw]]))
-
-(declare json-read-str)
-(declare json-value-converter)
-
-(defn coalesce-into-map
-  "take a list of maps and return a map keyed by the keys."
-  [keys values])

 (defn read-lexicon [language]
   (init-db)
@@ -33,46 +23,3 @@
                  (map read-string)
                  (map dag_unify.core/deserialize)))
           lexemes))))
-
-(defn json-read-str [json]
-  (json/read-str json
-                 :key-fn keyword
-                 :value-fn json-value-converter))
-
-(defn json-value-converter [k v]
-  (println (str "k: " k))
-  (println (str "v: " v))
-  (cond
-    (and (or (= k :english)
-             (= k :espanol)
-             (= k :français)
-             (= k :italiano)
-             (= k "english")
-             (= k "espanol")
-             (= k "français")
-             (= k "italiano")
-             (= k "latin")
-             (= k :participle)
-             (= k :past)
-             (= k :past-participle)
-             (= k :present)
-             (= k :1sing)
-             (= k :2sing)
-             (= k :3sing)
-             (= k :note))
-         (not (map? v)))
-    (str v)
-
-    (and (string? v)
-         (= (nth v 0) \:))
-    (keyword (string/replace-first v ":" ""))
-
-    (string? v)
-    (keyword v)
-
-    (= (type v)
-       org.postgresql.jdbc.PgArray)
-    (vec (.getArray v))
-
-
-    :else v))


Fix apply parameter

Fix apply parameter

--- src/puppeteer/domain/usecase/deploy.clj
+++ src/puppeteer/domain/usecase/deploy.clj
@@ -53,7 +53,7 @@

 (defn apply
   [{:keys [deploy-repository] :as comp}
-   {:keys [] :as job}]
+   job]
   (let [deployment (prepare-deployment comp job)
         service (prepare-service comp job)]
     (println deployment)


(PDB-4338) Re-add migration 67

(PDB-4338) Re-add migration 67

Removing an existing migration causes puppetdb to throw a state
exception when it doesn't recognize the migration version number.

--- src/puppetlabs/puppetdb/scf/migrate.clj
+++ src/puppetlabs/puppetdb/scf/migrate.clj
@@ -1636,6 +1636,7 @@
    ;; 67 exposed an agent bug where we would get duplicate resource events
    ;; from a failed exec call. The updated migration adds additional columns
    ;; to the hash to avoid these sorts of collisions
+   67 (fn [])
    68 support-fact-expiration-configuration
    69 add-resource-events-pk})


Adds Cadence.js to the navbar.

Adds Cadence.js to the navbar.

--- src/cadence/views/common.clj
+++ src/cadence/views/common.clj
@@ -31,13 +31,13 @@
   [:li.dropdown
    (if (friend/anonymous?)
      (html [:a.dropdown-toggle
-            {:data-toggle "dropdown"}
+            {:href "#" :data-toggle "dropdown"}
             [:i.icon-user.icon-white] " User " [:b.caret]]
            [:ul.dropdown-menu
             [:li [:a {:href "/signup"} [:i.icon-check] " Sign Up"]]
             [:li [:a {:href "/login"} [:i.icon-share] " Log In"]]])
      (html [:a.dropdown-toggle
-            {:data-toggle "dropdown"}
+            {:href "#" :data-toggle "dropdown"}
             [:i.icon-user.icon-white] " " (m/identity) " " [:b.caret]]
            [:ul.dropdown-menu
             [:li [:a {:href (str "/user/profile/" (m/identity))}
@@ -73,7 +73,15 @@
             [:a {:href "/user/training"} "Training"]])
          [:li [:a {:href "/about"} "About"]]
          [:li [:a {:href "/docs/index.html"} "Documentation"]]
-         [:li [:a {:href "https://github.com/RyanMcG/Cadence"} "Source"]]]
+         [:li [:a {:href "https://github.com/RyanMcG/Cadence"} "Source"]]
+         [:li.dropdown
+          [:a.dropdown-toggle
+               {:href "#" :data-toggle "dropdown"} "Cadence.js " [:b.caret]]
+          [:ul.dropdown-menu
+           [:li [:a {:href "http://ryanmcg.github.com/Cadence-js"}
+                 [:i.icon-book] " Documentation"]]
+           [:li [:a {:href "https://github.com/RyanMcG/Cadence-js"}
+                 [:i.icon-align-left] " Source"]]]]]
         [:ul.nav.pull-right
          [:li.divider-vertical]
          (user-links)]


rum reactive

rum reactive

--- src/cljs/fractals/board.cljs
+++ src/cljs/fractals/board.cljs
@@ -87,7 +87,7 @@
                       :height "40px"
                       :text-align :center
                       :font-size "2rem"}
-              :value (:rows (rum/react state))}]
+              :value (:rows @state)}]
     [:div {:style {:background-color "#D9C9BA"}
            :on-click #(do (swap! state update-in [:rows] inc)
                           (swap! state assoc :board (init-board state)))}
@@ -103,7 +103,7 @@
                       :height "40px"
                       :text-align :center
                       :font-size "2rem"}
-              :value (:cols (rum/react state))}]
+              :value (:cols @state)}]
     [:div {:style {:background-color "#D9C9BA"}
            :on-click #(do
                         (swap! state update-in [:cols] inc)
@@ -120,15 +120,15 @@
                  :color color
                  :display :grid
                  :grid-template-columns (str/join " "
-                                                  (repeat (:cols (rum/react state)) "1fr"))
+                                                  (repeat (:cols @state) "1fr"))
                  :grid-gap "4px"
                  }}
    (map
     (fn [[e area]]
-      (let [cell (get-in (rum/react state)
+      (let [cell (get-in @state
                          e)
-            col (if cell (:zero-col (rum/react state))
-                    (:one-col (rum/react state)))]
+            col (if cell (:zero-col @state)
+                    (:one-col @state))]
         [:div {:key (str  "board-" (str e))
                :on-click #(swap! state assoc-in e (not cell) )
                :style {:grid-area (str/join " / " area)
@@ -137,8 +137,8 @@
                        :background-color col
                        :align-items :center}}
          ]))
-    (for [x (range 0 (:rows  (rum/react state)))
-          y (range 0 (:cols  (rum/react state)))]
+    (for [x (range 0 (:rows @state))
+          y (range 0 (:cols @state))]
       [[:board x y] [(inc x) (inc y) (+ x 2) (+ y 2) ]]))])

 (rum/defcs r-link < (rum/local "#333333" ::bg ) (rum/local "#F1F3F5" ::cl)


rename game to turn in ai

rename game to turn in ai

--- src/cljs/triboard/ai/ai.cljs
+++ src/cljs/triboard/ai/ai.cljs
@@ -35,11 +35,11 @@
     converted))

 (defn- worst-immediate-loss ;; TODO - It should consider what the other player could win
-  "Return the next worse lost game move for 'looser' if 'player' plays"
+  "Return the next worse lost turn move for 'looser' if 'player' plays"
   {:pre [(player? player) (player? looser)]}
-  [cells-strength game player looser]
+  [cells-strength turn player looser]
   (let [converted-filter #(= looser (:looser %))
-        all-moves (get-in game [:moves player])]
+        all-moves (get-in turn [:moves player])]
     (transduce
       (map #(move-strength cells-strength converted-filter %))
       max all-moves)))
@@ -50,7 +50,7 @@
 ;; -----------------------------------------

 (defn compute-cells-strength
-  "Adds to a given game the strength of each of its cells"
+  "Adds to a given turn the strength of each of its cells"
   [board]
   (reduce
     #(assoc %1 %2 (compute-cell-strength board %2))
@@ -61,15 +61,15 @@
    * The immediate gain
    * The worse immediate lost afterwards"
   {:pre [(player? player)]}
-  [cells-strength game player]
-  (let [moves (get-in game [:moves player])
+  [cells-strength turn player]
+  (let [moves (get-in turn [:moves player])
         others (remove #{player} cst/players)]
     (first
       (utils/fast-max-key
         (fn [[m converted :as move]]
-          (let [new-game (turn/play-move game m)
+          (let [new-turn (turn/play-move turn m)
                 diff-score (move-strength cells-strength identity move)
-                losses (map #(worst-immediate-loss cells-strength new-game % player) others)]
+                losses (map #(worst-immediate-loss cells-strength new-turn % player) others)]
             (- diff-score (apply max losses))))
         moves))
     ))


ignore some reported new options

ignore some reported new options

--- src/cljs_api_gen/options.clj
+++ src/cljs_api_gen/options.clj
@@ -2,6 +2,7 @@
   (:require
     [clansi.core :refer [style]]
     [clojure.string :refer [split-lines]]
+    [clojure.set :refer [difference]]
     [cljs-api-gen.read :refer [read-all-ns-forms]]
     [cljs-api-gen.repo-cljs :refer [with-version! published-cljs-tags]]))

@@ -27,7 +28,7 @@
    :compiler-stats {:added "0.0-2629"}
    :dump-core {:added "1.7.10"}
    :elide-asserts {:added "0.0-2156"}
-   ; :emit-constants {:added "0.0-2014"} ; this is implicitly computed from optimize-constants (user input ignored)
+   ; :emit-constants {:added "0.0-2014"} ; (see ignored below)
    :externs {:added "0.0-971"}
    :fn-invoke-direct {:added "1.9.660"}
    :foreign-libs {:added "0.0-971"}
@@ -54,14 +55,14 @@
    :rewrite-polyfills {:added "1.9.562"}
    :source-map {:added "0.0-1798"}
    :source-map-asset-path {:added "1.9.90"}
-   ; :source-map-inline {:added "0.0-2911"} ; this is listed in known-opts, but only applies to repl
+   ; :source-map-inline {:added "0.0-2911"} ; (see ignored below)
    :source-map-path {:added "0.0-2060"}
    :source-map-timestamp {:added "0.0-2505"}
    :static-fns {:added "0.0-1424"}
    :target {:added "0.0-971"}
-   ; :ups-externs {:added "0.0-993"}      ; this is implicitly computed from upstream deps (user input ignored)
-   ; :ups-foreign-libs {:added "0.0-993"} ; this is implicitly computed from upstream deps (user input ignored)
-   ; :ups-libs {:added "0.0-993"}         ; this is implicitly computed from upstream deps (user input ignored)
+   ; :ups-externs {:added "0.0-993"}      ; (see ignored below)
+   ; :ups-foreign-libs {:added "0.0-993"} ; (see ignored below)
+   ; :ups-libs {:added "0.0-993"}         ; (see ignored below)
    :use-only-custom-externs {:added "0.0-971"}
    :verbose {:added "0.0-971"}
    :warning-handlers {:added "1.7.10"}
@@ -131,6 +132,12 @@
   {:compiler (fetch-site-options* "compiler-options")
    :repl (fetch-site-options* "repl-options")})

+(def ignored-site-options
+  {:compiler
+   #{(keyword "language-in and :language-out")} ; we don't combine these
+   :repl
+   #{:watch-fn}}) ; already in compiler options
+
 (defn parse-known-opts [form]
   (when (and (list? form)
              (= (take 2 form) '(def known-opts)))
@@ -147,17 +154,29 @@
 (defn fetch-repo-repl-options []
   (first (keep parse-known-repl-opts (read-all-ns-forms "cljs.repl" :compiler))))

+(def ignored-repo-options
+  {:compiler
+   #{:ups-externs       ; this is implicitly computed from upstream deps (user input ignored)
+     :ups-foreign-libs  ; this is implicitly computed from upstream deps (user input ignored)
+     :ups-libs          ; this is implicitly computed from upstream deps (user input ignored)
+     :source-map-inline ; only applies to repl
+     :emit-constants}    ; this is implicitly computed from optimize-constants (user input ignored)
+   :repl
+   #{:watch-fn}}) ; already in compiler options
+
 (defn fetch-repo-options []
   (with-version! (last @published-cljs-tags)
     {:compiler (fetch-repo-compiler-options)
      :repl (fetch-repo-repl-options)}))

-;; TODO: track ignored compiler/repl options (for each source?)
-
 (defn notify-new-options-from-site []
   (let [{:keys [compiler repl]} (fetch-site-options)
-        new-compiler (apply disj compiler (keys compiler-options))
-        new-repl (apply disj repl (keys repl-options))]
+        new-compiler (difference compiler
+                       (set (keys compiler-options))
+                       (:compiler ignored-site-options))
+        new-repl (difference repl
+                   (set (keys repl-options))
+                   (:repl ignored-site-options))]
     (when (seq new-compiler)
       (println "\nNew Compiler Options (via site):\n")
       (doseq [opt (sort new-compiler)]
@@ -169,8 +188,12 @@

 (defn notify-new-options-from-repo []
   (let [{:keys [compiler repl]} (fetch-repo-options)
-        new-compiler (apply disj compiler (keys compiler-options))
-        new-repl (apply disj repl (keys repl-options))]
+        new-compiler (difference compiler
+                       (set (keys compiler-options))
+                       (:compiler ignored-repo-options))
+        new-repl (difference repl
+                   (set (keys repl-options))
+                   (:repl ignored-repo-options))]
     (when (seq new-compiler)
       (println "\nNew Compiler Options (via repo var):\n")
       (doseq [opt (sort new-compiler)]


Add all keybinds

Add all keybinds


Support for React 16 component paths We rely on reagent.impl.component/component-path to avoid rendering re-frame-trace events to itself (causing infinite loop). This patch copies in a very recent change to Reagent which supports reading of component paths from React 16 components.

--- src/day8/re_frame/trace.cljs
+++ src/day8/re_frame/trace.cljs
@@ -21,8 +21,27 @@
             [devtools.formatters.core :as devtools]))

+;; from https://github.com/reagent-project/reagent/blob/3fd0f1b1d8f43dbf169d136f0f905030d7e093bd/src/reagent/impl/component.cljs#L274
+(defn fiber-component-path [fiber]
+  (let [name (some-> fiber
+                     ($ :type)
+                     ($ :displayName))
+        parent (some-> fiber
+                       ($ :return))
+        path (some-> parent
+                     fiber-component-path
+                     (str " > "))
+        res (str path name)]
+    (when-not (empty? res) res)))
+
+(defn component-path [c]
+  ;; Alternative branch for React 16
+  (if-let [fiber (some-> c ($ :_reactInternalFiber))]
+    (fiber-component-path fiber)
+    (component/component-path c)))
+
 (defn comp-name [c]
-  (let [n (or (component/component-path c)
+  (let [n (or (component-path c)
               (some-> c .-constructor util/fun-name))]
     (if-not (empty? n)
       n
@@ -33,8 +52,8 @@
    (fn render []
      (this-as c
        (trace/with-trace {:op-type   :render
-                          :tags      {:component-path (reagent.impl.component/component-path c)}
-                          :operation (last (str/split (reagent.impl.component/component-path c) #" > "))}
+                          :tags      {:component-path (component-path c)}
+                          :operation (last (str/split (component-path c) #" > "))}
                          (if util/*non-reactive*
                            (reagent.impl.component/do-render c)
                            (let [rat        ($ c :cljsRatom)
@@ -63,7 +82,7 @@
               (let [name (comp-name c)]
                 (js/console.log c)
                 (trace/with-trace {:op-type   :render
-                                   :tags      {:component-path (reagent.impl.component/component-path c)}
+                                   :tags      {:component-path (component-path c)}
                                    :operation (last (str/split name #" > "))}
                                   (real-renderer c)))))

@@ -78,7 +97,7 @@
               (fn [] (this-as c
                        (trace/with-trace {:op-type   key
                                           :operation (last (str/split (comp-name c) #" > "))
-                                          :tags      {:component-path (reagent.impl.component/component-path c)
+                                          :tags      {:component-path (component-path c)
                                                       :reaction       (interop/reagent-id ($ c :cljsRatom))}})
                        (.call (real-custom-wrapper key f) c c)))


pretty-fy rendering of league select on report

--- src/foosball/views/match.clj
+++ src/foosball/views/match.clj
@@ -6,7 +6,7 @@
          [hiccup.page :only [html5 include-js include-css]]
          [foosball.util]))

-(defn- players-select [id players & [selected]]
+(defn- render-players-select [id players & [selected]]
   [:select.form-control {:id id :name id}
    [:option {:value "nil" :disabled "disabled" :selected "selected"} "Pick a player"]
    (->> players
@@ -15,7 +15,7 @@
                                (when (= id selected) {:selected "selected"}))
                 name])))])

-(defn- team-controls [kw team-num {:keys [player1 player2 score]} players]
+(defn- render-team-controls [kw team-num {:keys [player1 player2 score]} players]
   (let [prefix  (name kw)
         idp1    (str prefix "player" 1)
         idp2    (str prefix "player" 2)
@@ -24,11 +24,11 @@
      [:h2 (str "Team " team-num ":")]
      [:div.form-group
       [:label.control-label.col-lg-4 {:for idp1} (str "Player " 1)]
-      [:div.controls.col-lg-8 (players-select idp1 players player1)]]
+      [:div.controls.col-lg-8 (render-players-select idp1 players player1)]]

      [:div.form-group
       [:label.control-label.col-lg-4 {:for idp2} (str "Player " 2)]
-      [:div.controls.col-lg-8 (players-select idp2 players player2)]]
+      [:div.controls.col-lg-8 (render-players-select idp2 players player2)]]

      [:div.form-group
       [:label.control-label.col-lg-4 {:for idscore} "Score"]
@@ -39,6 +39,29 @@
 (defn- filter-active-players [players]
   (filter :active players))

+(defn render-league-select [leagues selected-league-id]
+  [:form#league-form.form-horizontal {:action "/report/match/league-select" :method "POST"}
+   [:div.form-group.col-lg-6
+    [:label.control-label.col-lg-4 {:for "league-id"} "League"]
+    [:div.controls.col-lg-6
+     [:select.form-control {:id "league-id" :name "league-id"}
+      (map (fn [{:keys [id name]}] [:option (merge {:value id}
+                                                  (when (= id selected-league-id) {:selected "selected"}))
+                                   name])
+           leagues)]]]])
+
+(defn render-match-date [matchdate]
+  (let [formated-date (format-date (->> matchdate
+                                        ((fn [x] (when-not (= :invalid-matchdate x) x)))
+                                        ((fnil identity (java.util.Date.)))))]
+    [:div.form-group.col-lg-12
+     [:div.form-group.pull-right.col-lg-6
+      [:label.control-label.col-lg-6 {:for "matchdate"} "Date played"]
+      [:div.controls.col-lg-5
+       [:input.input-medium.form-control {:id "matchdate" :name "matchdate"
+                                          :type "date"
+                                          :value formated-date}]]]]))
+
 (defn form [players leagues selected-league-id & [{:keys [team1 team2 matchdate]}]]
   (let [active-players (filter-active-players players)]
     (html5
@@ -47,29 +70,18 @@
       "A match winner is the first team to reach ten goals while atleast two goals ahead of the opposing team." [:br]
       "In case of tie-break, report 11-9 or 9-11."]

-     [:form#league-form.form-inline {:action "/report/match/league-select" :method "POST"}
-      [:div.form-group
-       [:select.form-control {:id "league-id" :name "league-id"}
-        (map (fn [{:keys [id name]}] [:option (merge {:value id}
-                                                    (when (= id selected-league-id) {:selected "selected"}))
-                                     name])
-             leagues)]]]
+     (when (< 1 (count leagues))
+       [:div.row
+        (render-league-select leagues selected-league-id)])

      [:form.form-horizontal {:action (str "/report/match/" selected-league-id) :method "POST"}
       [:div.form-group.col-lg-12
-       (team-controls :team1 1 team1 active-players)
+       (render-team-controls :team1 1 team1 active-players)
        [:div.col-lg-2]
-       (team-controls :team2 2 team2 active-players)]
+       (render-team-controls :team2 2 team2 active-players)]

-      [:div.form-group.col-lg-12
-       [:div.form-group.pull-right.col-lg-4
-        [:label.control-label.col-lg-6 {:for "matchdate"} "Date played"]
-        [:div.controls.col-lg-6
-         [:input.input-medium.form-control {:id "matchdate" :name "matchdate"
-                                            :type "date"
-                                            :value (format-date (->> matchdate
-                                                                     ((fn [x] (when-not (= :invalid-matchdate x) x)))
-                                                                     ((fnil identity (java.util.Date.)))))}]]]]
+      (render-match-date matchdate)
+
       [:div.form-group.col-lg-12
        [:div.form-group.col-lg-5.pull-right
         [:button.btn.btn-primary.btn-lg.btn-block


Wrap rest of threading forms

Wrap rest of threading forms

--- src/github_changelog/git.clj
+++ src/github_changelog/git.clj
@@ -30,8 +30,8 @@
 (defn git-dir? [dir]
   (when (and (fs/dir? dir) (fs/dir? (fs/as-file dir ".git")))
     (-> (shell/sh "git" "status" :dir dir)
-        :exit
-        zero?)))
+        (:exit)
+        (zero?))))

 (defn clone-or-load [uri dir]
   (if (git-dir? dir) dir (clone uri dir)))
@@ -75,5 +75,5 @@
                        (or from (initial-commit dir))
                        (or until "HEAD"))]
     (-> (exec "git" "rev-list" commit :dir dir)
-        :out
-        split-lines)))
+        (:out)
+        (split-lines))))


sync names with Standard Algorithm Name Documentation by Oracle

--- src-clj/zlib_tiny/core.clj
+++ src-clj/zlib_tiny/core.clj
@@ -104,17 +104,17 @@

 (defn md5
   ^bytes [^bytes b]
-  (wrap-digest "md5" b))
+  (wrap-digest "MD5" b))

 (defn sha-1
   ^bytes [^bytes b]
-  (wrap-digest "sha1" b))
+  (wrap-digest "SHA-1" b))

 (defn sha-256
   ^bytes [^bytes b]
-  (wrap-digest "sha256" b))
+  (wrap-digest "SHA-256" b))

 (defn sha-512
   ^bytes [^bytes b]
-  (wrap-digest "sha-512" b))
+  (wrap-digest "SHA-512" b))


New test for the function compute-job-status

--- test/emender_jenkins/results_test.clj
+++ test/emender_jenkins/results_test.clj
@@ -287,3 +287,14 @@
             nil (job-name->environment "test-Red_Hat_Enterprise_Linux-6.2-Book_Name_1-en-US (unknown)" "(preview)" "(stage)" "(prod)")
             nil (job-name->environment "test-Red_Hat_Enterprise_Linux-7-Book_Name_1-en-US (unknown)" "(preview)" "(stage)" "(prod)"))))

+(deftest test-compute-job-status
+    "Check the emender-jenkins.results/compute-job-status function."
+    (testing "the emender-jenkins.results/compute-job-status function."
+        (are [x y] (= x y)
+            :disabled        (compute-job-status true nil)
+            :ok              (compute-job-status "blue" true)
+            :unstable        (compute-job-status "yellow" true)
+            :disabled        (compute-job-status "disabled" true)
+            :failure         (compute-job-status "xyzzy" true)
+            :does-not-exists (compute-job-status nil true))))
+


Updated tests to reflect new name of trends query

--- test/forma/hadoop/jobs/forma_test.clj
+++ test/forma/hadoop/jobs/forma_test.clj
@@ -19,14 +19,15 @@
    :long-block 15
    :window 5})

-(defn run-dynamic
+(comment
+  (defn run-dynamic
   "Test function that displays the output of the dynamic tap."
   []
   (?- (stdout)
-      (-> (dynamic-cleaned-tap some-map
+      (-> (analyze-trends some-map
                        (hfs-seqfile "/Users/sritchie/Desktop/ndviseries1000/")
                        (hfs-seqfile "/Users/sritchie/Desktop/ndviseries1000/"))
-          (c/first-n 10))))
+          (c/first-n 10)))))

 ;; FORMA, broken down into pieces. We're going to have sixteen sample
 ;; timeseries, to test the business with the neighbors.
@@ -233,7 +234,7 @@
           outer-src
           (forma-tap est-map :n-src :reli-src :r-src :v-src :f-src)
           (provided
-            (dynamic-cleaned-tap
+            (analyze-trends
              est-map
              (dynamic-filter 25 :n-src :reli-src :r-src :v-src)) => dynamic-tuples
              (fire-tap est-map :f-src) => fire-values))


handle utils/notify-error

handle utils/notify-error

--- frontend/controllers/errors.cljs
+++ frontend/controllers/errors.cljs
@@ -54,3 +54,12 @@
   [container message args previous-state current-state]
   (when (get-in current-state state/error-message-path)
     (set! (.-scrollTop (sel1 "main.app-main")) 0)))
+
+(defmethod error :error-triggered
+  [container message error state]
+  (assoc-in state state/error-message-path error))
+
+(defmethod post-error! :error-triggered
+  [container message args previous-state current-state]
+  (when (get-in current-state state/error-message-path)
+    (set! (.-scrollTop (sel1 "main.app-main")) 0)))


adds support for logging request trailers (#865)

--- waiter/src/waiter/process_request.clj
+++ waiter/src/waiter/process_request.clj
@@ -469,6 +469,20 @@
                     (log/warn "unable to abort as request not found inside response!"))]
       (log/info "aborted backend request:" aborted))))

+(defn- introspect-trailers
+  "Introspects and logs trailers received in the response"
+  [{:keys [trailers] :as response}]
+  (if trailers
+    (let [trailers-ch (async/promise-chan)
+          correlation-id (cid/get-correlation-id)]
+      (async/go
+        (when-let [trailers-data (async/<! trailers)]
+          (async/>! trailers-ch trailers-data)
+          (cid/cinfo correlation-id "response trailers:" trailers-data))
+        (async/close! trailers-ch))
+      (assoc response :trailers trailers-ch))
+    response))
+
 (defn- forward-grpc-status-headers-in-trailers
   "Adds logging for tracking response trailers for requests.
    Since we always send some trailers, we need to repeat the grpc status headers in the trailers
@@ -518,8 +532,9 @@
         (async/close! abort-ch))
       ;; stop writing any content in the body from stream-http-response and trigger request completion
       (async/close! body)
-      ;; do not expect any trailers either in the response
-      (async/close! trailers)
+      (when trailers
+        ;; do not expect any trailers either in the response
+        (async/close! trailers))
       ;; eagerly close channel as request is deemed a success and avoid blocking in stream-http-response
       (async/close! error-chan))
     response))
@@ -557,6 +572,7 @@
             location (post-process-async-request-response-fn
                        service-id metric-group backend-proto instance (handler/make-auth-user-map request)
                        reason-map instance-request-properties location query-string))
+          (introspect-trailers)
           (handle-grpc-error-response request backend-proto reservation-status-promise)
           (forward-grpc-status-headers-in-trailers)
           (assoc :body resp-chan)


- No more aot compilation - Introducing ZMQ

--- jvm-runner/project.clj
+++ jvm-runner/project.clj
@@ -17,20 +17,19 @@
    [org.clojure/core.logic "0.8.8"] ; Logic Programming
    [org.clojure/core.match "0.2.1"] ; Pattern Matching
    [prismatic/plumbing "0.3.3"] ; Random Awesomeness
-   [slingshot "0.11.0"] ; Advanced Exceptions
    [clj-http "1.0.0"] ; HTTP Client
    [enlive "1.1.5"] ; HTML templating
    [hiccup "1.0.5"] ; Clojure HTML DSL
    [junit/junit "4.11"] ; JUnit
    [org.codehaus.groovy/groovy-all "2.3.6"] ; Groovy
    [environ "0.5.0"] ; Environment Variables
-   [com.keminglabs/zmq-async "0.1.0"] ; ZMQ over core-async
+   [org.zeromq/jeromq "0.3.3"] ; ZMQ
+   [org.zeromq/cljzmq "0.1.4" :exclusions [org.zeromq/jzmq]]
    ]
   :ring {:handler codewars.rest.handler/app}
   :plugins [[lein-environ "0.5.0"] [lein-ring "0.8.12"]]
   :source-paths ["src/clojure"]
   :java-source-paths ["src/java"]
-  :env {:timeout "10000"}
-  :profiles {:uberjar {:aot :all}
-             :dev {:plugins [[com.jakemccrary/lein-test-refresh "0.5.4"]]}}
+  :env {:timeout "10000"
+        :zmq-socket "tcp://127.0.0.1:12349"}
   :main codewars.core)


Only send the message body as a task to Rserve (pirate)

--- worker/src/patavi/worker/consumer.clj
+++ worker/src/patavi/worker/consumer.clj
@@ -68,9 +68,9 @@
     (let [{:keys [service socket]} @consumer
           work (chan)
           [address request] (q/retrieve-data msg [String zmq/bytes-type])
-          {:keys [id] :as content} (nippy/thaw request)
+          {:keys [id body] :as content} (nippy/thaw request)
           updater (partial send-update! socket service id)]
-      (go (>! work (wrap-exception handler content updater)))
+      (go (>! work (wrap-exception handler body updater)))
       (go
        (q/send! socket [q/MSG-REP service address (nippy/freeze (<! work))] :prefix-empty)
        (q/send! socket [q/MSG-READY service] :prefix-empty)


Pass morph state reference into onClick callback

--- src-cljs/cljs_workspace/om_morph.cljs
+++ src-cljs/cljs_workspace/om_morph.cljs
@@ -121,7 +121,7 @@
       (let [style (dict->js (extract-style (:morph app)))]
         (dom/div  #js {:style style
                      :className "morphNode"
-                     :onClick #(when-let [cb (get-in @app [:morph :onClick])] (cb %))
+                     :onClick #(when-let [cb (get-in @app [:morph :onClick])] (cb (@app :morph)))
                      :onMouseDown #(draggable/start-dragging % app owner)
                      :onMouseUp #(draggable/stop-dragging % app)
                     }


click outside compile options menu mostly works

--- src-cljs/cljsbuild_ui/pages/main.cljs
+++ src-cljs/cljsbuild_ui/pages/main.cljs
@@ -145,6 +145,13 @@
                     (= output-to (-> v :cljsbuild :compiler :output-to)))
                   blds)]
     (-> matches first first)))
+
+(defn- num-selected-builds [prj]
+  (->> prj
+    :builds
+    (map :active?)
+    (remove false?)
+    count))

 ;;------------------------------------------------------------------------------
 ;; State-effecting
@@ -244,6 +251,15 @@
 ;;------------------------------------------------------------------------------
 ;; Events
 ;;------------------------------------------------------------------------------
+
+;; TODO: not sure this will work long-term if they click in whitespace outside
+;; the app root element
+(defn- click-root []
+  (doall
+    (map
+      (fn [prj-key]
+        (swap! state assoc-in [:projects prj-key :compile-menu-showing?] false))
+      (-> @state :projects keys))))

 ;; NOTE: this could be simplified with a go-loop?
 (defn- handle-compiler-output
@@ -452,7 +468,8 @@
     (zero? num-selected-builds) [:i.fa.fa-square-o]
     :else [:i.fa.fa-minus-square-o]))

-(defn- click-compile-options [prj-key]
+(defn- click-compile-options [js-evt prj-key]
+  (.stopPropagation js-evt)
   (swap! state update-in [:projects prj-key :compile-menu-showing?] not))

 (defn- toggle-auto-compile [prj-key]
@@ -472,6 +489,7 @@

 (sablono/defhtml compile-menu [prj-key prj]
   [:div.menu-b4b27
+    {:on-click #(.stopPropagation %)}
     [:div.auto-option-8a122
       [:label.label-ec878
         {:on-click #(toggle-auto-compile prj-key)}
@@ -482,13 +500,6 @@
     [:div.builds-selections-642a3
       (map-indexed #(build-option %1 %2 prj-key) (:builds prj))]])

-(defn- num-selected-builds [prj]
-  (->> prj
-    :builds
-    (map :active?)
-    (remove false?)
-    count))
-
 (sablono/defhtml idle-buttons [prj-key prj]
   ;(start-auto-btn prj-key num-selected-builds)
   ;(build-once-btn prj-key num-selected-builds)
@@ -498,7 +509,7 @@
       "Compile Once")
     [:span.count-cfa27 (str "[" (num-selected-builds prj) "]")]]
   [:button
-    {:on-click #(click-compile-options prj-key)}
+    {:on-click #(click-compile-options % prj-key)}
     [:i.fa.fa-caret-down]]
   [:button.btn-da85d
     ;{:on-click #(click-clean-btn prj-key)}
@@ -568,6 +579,7 @@
 (quiescent/defcomponent AppRoot [app-state]
   (sablono/html
     [:div.app-ca3cd
+      {:on-click click-root}
       [:div.header-a4c14
         [:div.title-8749a "ClojureScript Compiler"]
         [:div.title-links-42b06
@@ -601,6 +613,17 @@
 ;; Init
 ;;------------------------------------------------------------------------------

+(def events-added? (atom false))
+
+(defn- add-events!
+  "Add events that are outside the react.js event system.
+   NOTE: this is a run-once function"
+  []
+  (when-not @events-added?
+    ;; TODO: we may not even use this
+    (reset! events-added? true)))
+
 (defn init! []
+  (add-events!)
   ;; trigger the initial render
   (swap! state identity))


cleanup

cleanup

--- src-cljs/cljsbuild_ui/pages/main.cljs
+++ src-cljs/cljsbuild_ui/pages/main.cljs
@@ -443,11 +443,13 @@
                      :new-project-name ""
                      :new-project-step 1))

-(defn- close-modal []
+(defn- close-add-project-modal []
   (swap! state assoc :new-project-modal-showing? false))

-(defn- click-new-from-scratch-btn []
-  (swap! state assoc :new-project-step 2))
+(defn- click-new-project-btn []
+  (swap! state assoc :new-project-dir homedir
+                     :new-project-name ""
+                     :new-project-step 2))

 ;; TODO: handle validation here
 (defn- click-create-project-btn []
@@ -464,12 +466,6 @@
   ;; go to the next step
   (swap! state assoc :new-project-step 3)))

-(defn- click-new-project-done-btn []
-  (swap! state assoc :new-project-modal-showing? false
-                     :new-project-name ""
-                     :new-project-dir ""
-                     :new-project-step 1))
-
 ;; TODO: need to handle input validation here
 (defn- on-change-new-project-name-input [js-evt]
   (let [new-name (aget js-evt "currentTarget" "value")]
@@ -482,6 +478,11 @@
   [filename]
   (let [dirname (.dirname path filename)]
     (open dirname)))
+
+(defn- click-modal-overlay []
+  ;; do not let them close the modal while a new project is being created
+  (when-not (= 3 (:new-project-step @state))
+    (close-add-project-modal)))

 ;;------------------------------------------------------------------------------
 ;; Sablono Templates
@@ -639,12 +640,12 @@
     [:div.clr-737fa]])

 (sablono/defhtml modal-overlay []
-  [:div.modal-overlay-120d3 {:on-click close-modal}])
+  [:div.modal-overlay-120d3 {:on-click click-modal-overlay}])

 (sablono/defhtml new-project-step-1 []
   [:div.modal-body-fe4db
     [:div.modal-chunk-2041a
-      [:button.big-btn-a5d18 {:on-click click-new-from-scratch-btn}
+      [:button.big-btn-a5d18 {:on-click click-new-project-btn}
         "New Project"]
       [:p.small-info-b72e9
         "Create a new project from scratch."]]
@@ -654,7 +655,7 @@
       [:p.small-info-b72e9
         "Load an existing project from a Leiningen " [:code "project.clj"] " file."]]
     [:div.modal-bottom-050c3
-      [:span.link-e7e58 {:on-click close-modal}
+      [:span.link-e7e58 {:on-click close-add-project-modal}
         "cancel"]]])

 (sablono/defhtml new-project-step-2 [app-state]
@@ -692,7 +693,7 @@
 ;     [:div.modal-chunk-2041a
 ;       "*TODO: details of the new project*"]
 ;     [:div.modal-bottom-050c3
-;       [:button {:on-click click-new-project-done-btn} "Got it!"]]])
+;       [:button {:on-click close-add-project-modal} "Got it!"]]])

 ;;------------------------------------------------------------------------------
 ;; Quiescent Components