fix example pipeline

fix example pipeline

--- example-pipeline/src/lambdaui/example/simple_pipeline.clj
+++ example-pipeline/src/lambdaui/example/simple_pipeline.clj
@@ -9,7 +9,8 @@
             [lambdacd.util :as file-util]
             [lambdaui.core :as ui]
             [lambdacd.steps.manualtrigger :refer [wait-for-manual-trigger parameterized-trigger]]
-            [lambdacd.runners :as pipeline-runners]))
+            [lambdacd.runners :as pipeline-runners]
+            [lambdacd.steps.support :as support]))

 (defonce lastStatus (atom nil))

@@ -33,9 +34,24 @@
 (defn different-status [_ _]
   {:status (swap! lastStatus swapStatus)})

+(defn output-parameters [args ctx]
+  (let [p (support/new-printer)
+        out #(support/print-to-output ctx p %)
+        revision (get args :revision)
+
+        ]
+    (out (str "result from previous step \n" (clojure.pprint/write args :stream nil)))
+
+    (if revision (out (str "Revision entered: " revision))
+                 (out "You did not use the parameterized trigger."))
+    {:status :success}
+    ))
+
 (defn wait-for-git-revision [_ ctx]
+  (let [result
+        (parameterized-trigger {:revision {:desc "Input git revision"}} ctx)]

-  (parameterized-trigger {:revision {:desc "Input git revision"}} ctx))
+    (update result :global #(assoc % :revision (:revision result)))))

@@ -45,6 +61,8 @@
                   wait-for-manual-trigger
                   wait-for-git-revision
                   ))
+     output-parameters
+     output-parameters
      a-lot-output
      (step/alias "i have substeps"
                  (run successfullStep
@@ -89,8 +107,7 @@
     (reset! server
             (server/run-server (routes

-                                 (context "/pipeline" []
-                                   (ui/pipeline-routes pipeline :contextPath "/pipeline")))
+                                 (ui/pipeline-routes pipeline))
                                {:open-browser? false
                                 :port          port}))))


Intgration of role elements for rating list | cb

--- src/cljs/conference_rating/conference_detail_page/conference_detail_page.cljs
+++ src/cljs/conference_rating/conference_detail_page/conference_detail_page.cljs
@@ -35,15 +35,15 @@
                         :venue {:avg 3 :count 6}
                         :community {:avg 2.5 :count 5}
                         :roles {
-                                :dev 11
+                                :dev 1
                                 :devops 2
-                                :ux 1
-                                :qa 0
-                                :ba 0
-                                :pm 0
-                                :sales 0
-                                :recruting 1
-                                :other 1}
+                                :ux 3
+                                :qa 4
+                                :ba 5
+                                :pm 6
+                                :sales 7
+                                :recruting 8
+                                :other 9}
                         :experience {
                                      :rookie 1
                                      :beginner 3
@@ -98,13 +98,25 @@
    [:p "I want to watch out for potential hires"]])

 ;;TODO show badges for experience level (in navy lue), too
+(defn- aggregated-ratings-for-role [conference role]
+  (get-in conference [:aggregated-ratings :roles role]))
+
+(defn- selection-of-role-elements [conference role label]
+  (let [count (aggregated-ratings-for-role conference role)]
+    (if (> count 0) [badge (str label " " count) "badge-light-blue"])))

 (defn conference-badges [simple-conference]
-  (let [dev-count (get-in simple-conference [:aggregated-ratings :roles :dev])]
+  (let [dev-count (aggregated-ratings-for-role simple-conference :dev)]
   [:div
-   (conference-badges-row (if (> dev-count 0) [badge (str "DEV " dev-count) "badge-light-blue"])
-                          (badge "QA" "badge-light-blue")
-                          (badge "BA" "badge-light-blue"))
+   (conference-badges-row (selection-of-role-elements simple-conference :dev "DEV")
+                          (selection-of-role-elements simple-conference :devops "DEVOPS")
+                          (selection-of-role-elements simple-conference :ux "UX")
+                          (selection-of-role-elements simple-conference :qa "QA")
+                          (selection-of-role-elements simple-conference :ba "BA")
+                          (selection-of-role-elements simple-conference :pm "PM")
+                          (selection-of-role-elements simple-conference :sales "Sales")
+                          (selection-of-role-elements simple-conference :recruting "Recruting")
+                          (selection-of-role-elements simple-conference :other "Others"))
    (conference-badges-row (badge "Inspiring" "badge-light-primary")
                           (badge "learnings" "badge-light-primary")
                           (badge "Network" "badge-light-primary")


Return component on stop

Return component on stop

--- modules/aleph/src/modular/aleph.clj
+++ modules/aleph/src/modular/aleph.clj
@@ -29,8 +29,8 @@
       (assoc component :server server)))
   (stop [component]
     (when-let [server (:server component)]
-      (.close server)
-      (dissoc component :server))))
+      (.close server))
+    (dissoc component :server)))

 (def new-webserver-schema
   {:port s/Int


Rename has-class? to has-method?

Rename has-class? to has-method?

--- src/main/clojure/powderkeg/core.clj
+++ src/main/clojure/powderkeg/core.clj
@@ -35,7 +35,7 @@
     (vector? msig) (= msig (sig x))
     (fn? msig)     (msig x)))

-(defn- has-class? [^Class class msig]
+(defn- has-method? [^Class class msig]
   (some (partial sig-matches? msig) (concat (.getMethods class) (.getConstructors class))))

 (defmacro ^:private compile-cond [& choices]
@@ -296,9 +296,9 @@
               (reify org.apache.spark.api.java.function.FlatMapFunction ; todo: skip api.java.* go to spark
                 (call [_ it]
                   (compile-cond
-                    (has-class? org.apache.spark.api.java.function.FlatMapFunction [java.util.Iterator "call" [Object]])
+                    (has-method? org.apache.spark.api.java.function.FlatMapFunction [java.util.Iterator "call" [Object]])
                     (.iterator ((df) it))
-                    (has-class? org.apache.spark.api.java.function.FlatMapFunction [Iterable "call" [Object]])
+                    (has-method? org.apache.spark.api.java.function.FlatMapFunction [Iterable "call" [Object]])
                     ((df) it))))
               preserve-partitioning)]
     rdd))
@@ -407,10 +407,10 @@
         ([] (rf))
         ([acc] (rf acc))
         ([acc left right] (rf acc (compile-cond
-                                   (has-class? org.apache.spark.api.java.JavaPairRDD
+                                   (has-method? org.apache.spark.api.java.JavaPairRDD
                                                (partial left-outer-join-optional "org.apache.spark.api.java.Optional"))
                                    (.or ^org.apache.spark.api.java.Optional left not-found)
-                                   (has-class? org.apache.spark.api.java.JavaPairRDD
+                                   (has-method? org.apache.spark.api.java.JavaPairRDD
                                                (partial left-outer-join-optional "com.google.common.base.Optional"))
                                    (.or ^com.google.common.base.Optional left not-found)) right))))))

@@ -423,10 +423,10 @@
        ([] (rf))
        ([acc] (rf acc))
        ([acc left right] (rf acc left (compile-cond
-                                       (has-class? org.apache.spark.api.java.JavaPairRDD
+                                       (has-method? org.apache.spark.api.java.JavaPairRDD
                                                    (partial left-outer-join-optional "org.apache.spark.api.java.Optional"))
                                        (.or ^org.apache.spark.api.java.Optional right not-found)
-                                       (has-class? org.apache.spark.api.java.JavaPairRDD
+                                       (has-method? org.apache.spark.api.java.JavaPairRDD
                                                    (partial left-outer-join-optional "com.google.common.base.Optional"))
                                        (.or ^com.google.common.base.Optional right not-found))))))))

@@ -473,12 +473,12 @@
         partitioner (org.apache.spark.Partitioner/defaultPartitioner
                      rdd (scala-seq rdds))]
     (by-key (compile-cond
-              (has-class? org.apache.spark.rdd.CoGroupedRDD [nil "<init>" [scala.collection.Seq org.apache.spark.Partitioner scala.reflect.ClassTag]] )
+              (has-method? org.apache.spark.rdd.CoGroupedRDD [nil "<init>" [scala.collection.Seq org.apache.spark.Partitioner scala.reflect.ClassTag]] )
               (org.apache.spark.rdd.CoGroupedRDD.
               (scala-seq (cons rdd rdds))
               partitioner
               (.AnyRef scala.reflect.ClassTag$/MODULE$))
-              (has-class? org.apache.spark.rdd.CoGroupedRDD [nil "<init>" [scala.collection.Seq org.apache.spark.Partitioner]] )
+              (has-method? org.apache.spark.rdd.CoGroupedRDD [nil "<init>" [scala.collection.Seq org.apache.spark.Partitioner]] )
               (org.apache.spark.rdd.CoGroupedRDD.
               (scala-seq (cons rdd rdds))
               partitioner))


Update elements to dissoc all arguments

Update elements to dissoc all arguments

--- src/main/untangled/ui/elements.cljc
+++ src/main/untangled/ui/elements.cljc
@@ -137,7 +137,7 @@
         attrs        (cond-> attrs
                        (contains? state :required) (assoc :required "true")
                        :always (assoc :type "text")
-                       :always (dissoc :size)
+                       :always (dissoc :size :state)
                        :always (assoc :className classes)
                        :always (assoc :placeholder (name placeholder)))]
     (dom/input (clj->js attrs))))


Added some more code to clojure speed test

--- src/net/slreynolds/ds/speedtest.clj
+++ src/net/slreynolds/ds/speedtest.clj
@@ -1,4 +1,15 @@
 (ns net.slreynolds.ds.speedtest)
+
+; Warmup the jit compiler etc in the JVM
+; before doing any measurements
+(defn warmup[setup dowork]
+  (let [computation 7]
+       (dotimes [_ N]
+         (let [o (setup)
+               res (dowork o)
+               newComp (+ computation (. res getIntParam))]
+           newComp))))
+

 ; Measure space (bytes) consumed by side effects
 ; of dowork


Fix some typos.

Fix some typos.

--- src/oc/storage/resources/update.clj
+++ src/oc/storage/resources/update.clj
@@ -140,7 +140,7 @@
   Note: if additional-keys are supplied, they will be included in the map, and only boards
   containing those keys will be returned.
   "
-  ([conn org-uuid] (get-updates-by-org conn org-uuid []))
+  ([conn org-uuid] (list-updates-by-org conn org-uuid []))

   ([conn org-uuid :- lib-schema/UniqueID additional-keys]
   {:pre [(db-common/conn? conn)
@@ -158,7 +158,7 @@
   Note: if additional-keys are supplied, they will be included in the map, and only boards
   containing those keys will be returned.
   "
-  ([conn org-uuid user-id] (get-updates-by-org conn org-uuid []))
+  ([conn org-uuid user-id] (list-updates-by-author conn org-uuid user-id []))

   ([conn org-uuid :- lib-schema/UniqueID user-id :- lib-schema/UniqueID additional-keys]
   {:pre [(db-common/conn? conn)


Use 'nested-select-keys'.

Use 'nested-select-keys'.

--- src/org/spootnik/cyanite/config.clj
+++ src/org/spootnik/cyanite/config.clj
@@ -2,7 +2,8 @@
   "Yaml config parser, with a poor man's dependency injector"
   (:import (java.net InetAddress))
   (:require [org.spootnik.cyanite.util :refer [set-aggregator-patterns!
-                                               set-blacklist-patterns!]]
+                                               set-blacklist-patterns!
+                                               nested-select-keys]]
             [org.spootnik.cyanite.store_mware]
             [clj-yaml.core :refer [parse-string]]
             [clojure.string :refer [split]]
@@ -154,18 +155,10 @@

 (defn config-instance
   [config entity default & [deps]]
-  (let [settings (merge default (select-keys config deps))]
+  (let [settings (merge default (nested-select-keys config deps))]
     (-> config
         (update-in [entity] (partial merge settings))
         (update-in [entity] get-instance entity))))
-
-(defn config-rollup-finder
-  [config]
-  (let [settings (merge default-rollup-finder
-                        (select-keys (:carbon config) [:rollups]))]
-    (-> config
-        (update-in [:rollup-finder] (partial merge settings))
-        (update-in [:rollup-finder] get-instance :rollup-finder))))

 (defn init
   "Parse yaml then enhance config"
@@ -187,4 +180,4 @@
         (update-in [:http] (partial merge default-http))
         (update-in [:aggregator] (partial merge default-aggregator))
         (update-in [:blacklist] (partial merge default-blacklist))
-        (config-rollup-finder))))
+        (config-instance :rollup-finder default-rollup-finder [:rollups]))))


Disabling optimizations for avoid problems with minimization

--- scripts/build.clj
+++ scripts/build.clj
@@ -9,7 +9,7 @@
     :output-to "out/tests.js"
     :output-dir "out"
     :target :nodejs
-    :optimizations :advanced
+    :optimizations :none
     :pretty-print true
     :language-in  :ecmascript5
     :language-out :ecmascript5


Neither produce nor consume were justified by their existence

--- modules/messaging/src/main/clojure/immutant/messaging.clj
+++ modules/messaging/src/main/clojure/immutant/messaging.clj
@@ -20,15 +20,23 @@
   (:require [immutant.messaging.codecs :as codecs])
   (:require [immutant.messaging.hornetq-direct :as hornetq]))

-(declare produce consume)
+(declare with-session destination)

-(defn publish [destination message & opts]
+(defn publish [dest-name message & opts]
   "Send a message to a destination"
-  (produce destination message opts))
+  (with-session (fn [session]
+                  (let [destination (destination session dest-name)
+                        producer (.createProducer session destination)
+                        encoded (codecs/encode session message opts)]
+                  (.send producer encoded)))))

-(defn receive [destination & opts]
+(defn receive [dest-name & {timeout :timeout}]
   "Receive a message from a destination"
-  (consume destination opts))
+  (with-session (fn [session]
+                  (let [destination (destination session dest-name)
+                        consumer (.createConsumer session destination)
+                        encoded (.receive consumer (or timeout 10000))]
+                    (codecs/decode encoded)))))

 (defn wait-for-destination [f & count]
   (let [attempts (or count 30)
@@ -55,18 +63,3 @@
     (.createQueue session name)
     (.createTopic session name)))

-(defn- produce [dest-name message opts]
-  (with-session (fn [session]
-                  (let [destination (destination session dest-name)
-                        producer (.createProducer session destination)
-                        encoded (codecs/encode session message opts)]
-                  (.send producer encoded)))))
-
-(defn- consume [dest-name {timeout :timeout}]
-  (with-session (fn [session]
-                  (let [destination (destination session dest-name)
-                        consumer (.createConsumer session destination)
-                        encoded (.receive consumer (or timeout 10000))]
-                    (codecs/decode encoded)))))
-
-


panc-annotations: - implement -v - display usage text when an unknown option has been specified

--- panc/src/main/clojure/org/quattor/pan/pan_annotations.clj
+++ panc/src/main/clojure/org/quattor/pan/pan_annotations.clj
@@ -27,9 +27,9 @@
     (current-directory)
     (create-absolute-file dir)))

-(defn get-compiler-options
-  [{base-dir :base-dir output-dir :output-dir}]
-  (CompilerOptions/createAnnotationOptions output-dir base-dir))
+(defn get-compiler-options [options]
+  (println (str "base-dir=" (:base-dir options) "\toutput-dir=" (:output-dir options)))
+  (CompilerOptions/createAnnotationOptions (clojure.java.io/file (:output-dir options)) (clojure.java.io/file (:base-dir options))))

 (defn generate-annotations [options files]
   (let [compiler-options (get-compiler-options options)
@@ -63,19 +63,21 @@

 (defn error-msg [errors]
   (str "The following errors occurred while parsing your command:\n\n"
-       (string/join \newline errors)))
+       (string/join \n errors)))

 (defn exit [status msg]
   (println msg)
   (System/exit status))

 (defn -main [& args]
-  (let [{:keys [options files errors summary]} (parse-opts args cli-options)]
+  (let [{:keys [options arguments errors summary]} (parse-opts args cli-options)]
     (cond
       (:help options) (exit 0 (usage summary))
       (< (count args) 1) (exit 1 (usage summary))
-      errors (exit 1 (error-msg errors)))
-    (let [^CompilerResults results (generate-annotations options files)]
+      errors (exit 1 (str (error-msg errors) "\n\n" (usage summary))))
+    (when (:verbose options)
+      (println (str "Templates to process: " arguments)))
+    (let [^CompilerResults results (generate-annotations options arguments)]
       (if-let [errors (.formatErrors results)]
         (println errors)
         "")


Issue #483 Slack edit events

Issue #483 Slack edit events

--- src/yetibot/core/adapters/slack.clj
+++ src/yetibot/core/adapters/slack.clj
@@ -128,6 +128,18 @@
         user-model (users/get-user cs (:user e))]
     (handle-raw cs user-model :leave nil)))

+(defn on-message-changed [{:keys [channel] {:keys [user text]} :message} config]
+  (log/info "message changed")
+  (let [[chan-name entity] (entity-with-name-by-id config {:channel channel
+                                                           :user user})
+        cs (chat-source chan-name)
+        user-model (users/get-user cs user)]
+    (binding [*target* channel]
+      (handle-raw cs
+                  user-model
+                  :message
+                  (unencode-message text)))))
+
 (defn on-message [conn config event]
   (log/info "message" event)
   (log/info "platform-name" (a/platform-name *adapter*))
@@ -136,6 +148,7 @@
     (condp = subtype
       "channel_join" (on-channel-join event)
       "channel_leave" (on-channel-leave event)
+      "message_changed" (on-message-changed event config)
       ; do nothing if we don't understand
       nil)
     ; don't listen to yetibot's own messages


fix previous build

fix previous build

--- frontend/components/build_head.cljs
+++ frontend/components/build_head.cljs
@@ -9,6 +9,7 @@
             [frontend.components.forms :as forms]
             [frontend.routes :as routes]
             [frontend.utils :as utils :include-macros true]
+            [frontend.utils.vcs-url :as vcs-url]
             [goog.string :as gstring]
             [goog.string.format]
             [om.core :as om :include-macros true]
@@ -217,12 +218,11 @@
                       (build-model/duration build))]]
               [:tr
                [:th "Previous"]
-               (if-not (:previous_build build)
+               (if-not (:previous build)
                  [:td "none"]
                  [:td
-                  [:a {:href (build-model/path-for (select-keys build [:vcs_url])
-                                                   (assoc build :build_num (:previous_build build)))}
-                   (:previous_build build)]])
+                  [:a {:href (routes/v1-build-path (vcs-url/org-name vcs-url) (vcs-url/repo-name vcs-url) (:build_num (:previous build)))}
+                   (:build_num (:previous build))]])
                [:th "Status"]
                [:td
                 [:span.build-status {:class (:status build)}


remove unneeded requires

remove unneeded requires

--- examples/mario/src/mario/core.cljs
+++ examples/mario/src/mario/core.cljs
@@ -1,13 +1,10 @@
 (ns ^:figwheel-always mario.core
   (:require [om.core :as om :include-macros true]
             [om.dom :as dom :include-macros true]
-            [cljs.core.async :as async :refer [>! <!]]
             [jamesmacaulay.zelkova.signal :as z]
             [jamesmacaulay.zelkova.time :as time]
             [jamesmacaulay.zelkova.keyboard :as keyboard]
-            [jamesmacaulay.zelkova.window :as window]
-            [jamesmacaulay.async-tools.core :as tools])
-  (:require-macros [cljs.core.async.macros :refer [go go-loop]]))
+            [jamesmacaulay.zelkova.window :as window]))

 (enable-console-print!)


removed logging prefix from todomvc example

--- examples/todomvc/src/app/core.cljs
+++ examples/todomvc/src/app/core.cljs
@@ -25,7 +25,7 @@
         ; define spec
         app-spec (-> (spec/new-spec history storage ["Finish this project" "Take a bath"])
                      (devtools/add-debugger storage :debugger-model)
-                     (logging/add "[debugger] "))
+                     logging/add)

         ; create app from spec
         app (mvsa/app app-spec)


whitespace tweak

whitespace tweak

--- etc/synthdefs/synth-designs.clj
+++ etc/synthdefs/synth-designs.clj
@@ -2214,6 +2214,7 @@
           fin-r         (x-fade2 in-r new-r (- (* mix 2) 1) amp)]
       (out out_bus [fin-l fin-r])))

+
   (defsynth sonic-pi-fx_replace_pan
     [amp 1
      amp_slide 0


Unbreak ClojureScript match tests

Unbreak ClojureScript match tests

--- test/active/clojure/match_test.cljc
+++ test/active/clojure/match_test.cljc
@@ -75,12 +75,13 @@
      (is (= false
             (example-matcher three-data)))))

+#?(:clj
 (defpattern one-or
   [(:kind #"one")
    (:x (:or "a" "b" "c" "x") :as x)
    (:y (:or "x" "y" "z"))
    (:z :as z)
-   :w])
+   :w]))

 #?(:clj
    (def example-or-matcher


fix broken unit test (#1704)

fix broken unit test (#1704)

--- cimi-resources/test/com/sixsq/slipstream/ssclj/resources/spec/deployment_test.cljc
+++ cimi-resources/test/com/sixsq/slipstream/ssclj/resources/spec/deployment_test.cljc
@@ -43,15 +43,18 @@

                        :state              "STARTED"

+                       :clientAPIKey       {:href   "credential/uuid"
+                                            :secret "api secret"}
+
                        :deploymentTemplate {:href "deployment-template/uuid-1"}

                        :sshPublicKeys      ["ssh-rsa key1..." "ssh-rsa key2..."]

-                       :outputParameters [{:parameter "param-1"}]
-                       :module           (merge {:href "my-module-uuid"} valid-module)
+                       :outputParameters   [{:parameter "param-1"}]
+                       :module             (merge {:href "my-module-uuid"} valid-module)

-                       :externalObjects  ["external-object/uuid1" "external-object/uuid2"]
-                       :serviceOffers    ["service-offer/uuid1" "service-offer/uuid2"]})
+                       :externalObjects    ["external-object/uuid1" "external-object/uuid2"]
+                       :serviceOffers      ["service-offer/uuid1" "service-offer/uuid2"]})

 (deftest test-schema-check


Bumps version to 1.53.4-SNAPSHOT

Bumps version to 1.53.4-SNAPSHOT

--- scheduler/project.clj
+++ scheduler/project.clj
@@ -13,7 +13,7 @@
 ;; See the License for the specific language governing permissions and
 ;; limitations under the License.
 ;;
-(defproject cook "1.53.3"
+(defproject cook "1.53.4-SNAPSHOT"
   :description "This launches jobs on a Mesos cluster with fair sharing and preemption"
   :license {:name "Apache License, Version 2.0"}
   :dependencies [[org.clojure/clojure "1.8.0"]


Snapshot version

Snapshot version

--- scheduler/project.clj
+++ scheduler/project.clj
@@ -13,7 +13,7 @@
 ;; See the License for the specific language governing permissions and
 ;; limitations under the License.
 ;;
-(defproject cook "1.13.0"
+(defproject cook "1.13.1-SNAPSHOT"
   :description "This launches jobs on a Mesos cluster with fair sharing and preemption"
   :license {:name "Apache License, Version 2.0"}
   :dependencies [[org.clojure/clojure "1.8.0"]


Fix test capture. Order applied seems to be random, so enforce exact match of URL pattern

--- test/buildviz/go/sync_jobs_test.clj
+++ test/buildviz/go/sync_jobs_test.clj
@@ -79,15 +79,15 @@
     (successful-response content)]])

 (defn- provide-buildviz-and-capture-puts [map-ref]
-  [[#"http://buildviz:8010/builds/(.+)/(.+)/testresults"
+  [[#"http://buildviz:8010/builds/([^/]+)/([^/]+)"
+    (fn [req]
+      (swap! map-ref #(conj % [(:uri req)
+                               (j/parse-string (slurp (:body req)) true)]))
+      {:status 200 :body ""})]
+   [#"http://buildviz:8010/builds/([^/]+)/([^/]+)/testresults"
     (fn [req]
       (swap! map-ref #(conj % [(:uri req)
                                (slurp (:body req))]))
-      {:status 200 :body ""})]
-   [#"http://buildviz:8010/builds/(.+)/(.+)"
-    (fn [req]
-      (swap! map-ref #(conj % [(:uri req)
-                               (j/parse-string (slurp (:body req)) true)]))
       {:status 200 :body ""})]])

 (defn- serve-up [& routes]


New test: test-calculate-first-day-of-week-1

--- test/clj_calendar/calendar_test.clj
+++ test/clj_calendar/calendar_test.clj
@@ -295,3 +295,11 @@
                 1    (get-month calendar)
                 2    (get-week calendar)))))

+(deftest test-calculate-first-day-of-week-1
+    "Check the function clj-calendar.calendar/calculate-first-day-of-week"
+    (testing "the function clj-calendar.calendar/calculate-first-day-of-week"
+        (doseq [year (range 2000 2010)]
+            (doseq [week (range 1 52)]
+                ; must be zero, because we get 1st day of each week
+                (is (zero? (calculate-first-day-of-week (get-calendar-for-week year week))))))))
+


Doubled max points

Doubled max points

--- test/clojush/test/clojush_tests.clj
+++ test/clojush/test/clojush_tests.clj
@@ -333,7 +333,7 @@
 ;; ;                                                  (registered-for-type :boolean)
 ;; ;                                                  (list (fn [] (rand-int 100))
 ;; ;                                                        'in))
-;; ;                         :max-points 100
+;; ;                         :max-points 200
 ;; ;                         :population-size 10000
 ;; ;                         :reproduction-simplifications 2})
 ;; ;


State.

State.

--- test/com/nomistech/clojure_the_language/c_400_state_and_concurrency/s_020_atoms.clj
+++ test/com/nomistech/clojure_the_language/c_400_state_and_concurrency/s_020_atoms.clj
@@ -149,7 +149,8 @@
             (report-on-what-is-happening []
               (loop []
                 (println (get-info))
-                (when (< @competing-updates-atom n-competitors)
+                (when (< @competing-updates-atom
+                         n-competitors)
                   (Thread/sleep 1000)
                   (recur))))]
       (create-competing-threads)


CMR-2652: Modified the search sequence of the AncillaryKeyword.

--- system-int-test/test/cmr/system_int_test/search/collection_keyword_search_test.clj
+++ system-int-test/test/cmr/system_int_test/search/collection_keyword_search_test.clj
@@ -549,7 +549,7 @@
         [c10-umm-json-1]

         "testing parameter search by existing ancillary keywords"
-        "CMR2652AKW3"
+        "CMR2652AKW4"
         [c10-umm-json-2]

         "testing parmaeter search by non-existing ancillary keywords"
@@ -566,7 +566,7 @@
         [c10-umm-json-1]

         "testing json query search by existing ancillary keywords"
-        "CMR2652AKW4"
+        "CMR2652AKW3"
         [c10-umm-json-2]

         "testing json query search by non-existing ancillary keywords"


[#105] Update line-seq implementation

[#105] Update line-seq implementation

--- priv/clojure/core.clj
+++ priv/clojure/core.clj
@@ -2914,18 +2914,18 @@
   rdr must implement java.io.BufferedReader."
   {:added "1.0"
    :static true}
-  [^java.io.BufferedReader rdr]
-  (throw "unimplemented io")
-  #_(when-let [line (.readLine rdr)]
-    (cons line (lazy-seq (line-seq rdr)))))
+  [rdr]
+  (let [line (clojerl.IReader/read_line.e rdr)]
+    (when (not= line :eof)
+      (cons line (lazy-seq (line-seq rdr))))))

 (defn comparator
   "Returns an implementation of java.util.Comparator based upon pred."
   {:added "1.0"
    :static true}
   [pred]
-    (fn [x y]
-      (cond (pred x y) -1 (pred y x) 1 :else 0)))
+  (fn [x y]
+    (cond (pred x y) -1 (pred y x) 1 :else 0)))

 (defn sort
   "Returns a sorted sequence of the items in coll. If no comparator is
@@ -4510,8 +4510,7 @@
   StringReader initialized with the string s."
   {:added "1.0"}
   [s & body]
-  (throw "unimplemented io")
-  #_`(with-open [s# (-> (java.io.StringReader. ~s) clojure.lang.LineNumberingPushbackReader.)]
+  `(with-open [s# (clojerl.StringReader/new ~s)]
      (binding [*in* s#]
        ~@body)))


Adding back reset

Adding back reset

--- resources/leiningen/new/closp/clj/user.clj
+++ resources/leiningen/new/closp/clj/user.clj
@@ -1,5 +1,5 @@
 (ns {{ns}}.user
-  (:require [reloaded.repl :refer [go]]
+  (:require [reloaded.repl :refer [go reset]]
             [{{ns}}.components.components :refer [dev-system]]))

 (defn start-dev-system []


CMR-1419: Temporarily removed granule iso-smap tests that are broken

--- system-int-test/test/cmr/system_int_test/search/concept_metadata_search_test.clj
+++ system-int-test/test/cmr/system_int_test/search/concept_metadata_search_test.clj
@@ -153,13 +153,7 @@
               umm-gran1-1 :echo10 "application/echo10+xml" "G1200000003-PROV1" 1

               " echo10 granule revision 2"
-              umm-gran1-2 :echo10 "application/echo10+xml" "G1200000003-PROV1" 2
-
-               "iso-smap granule revision 1"
-              umm-gran1-1 :iso-smap "application/iso:smap+xml" "G1200000003-PROV1" 1
-
-              "iso-smap granule revision 2"
-              umm-gran1-2 :iso-smap "application/iso:smap+xml" "G1200000003-PROV1" 2))
+              umm-gran1-2 :echo10 "application/echo10+xml" "G1200000003-PROV1" 2))

       (testing "Requests for tombstone revision returns a 400 error"
         (let [{:keys [status errors] :as response} (search/get-search-failure-xml-data


Add stub about entry

Add stub about entry


mlog more useful info on show-trial? call

--- frontend/components/dashboard.cljs
+++ frontend/components/dashboard.cljs
@@ -13,6 +13,7 @@
   (:require-macros [frontend.utils :refer [html]]))

 (defn show-trial-notice? [projects plan]
+  (println "show-trial-notice? for [" (map :reponame projects) "] and plan-model/trial? " (plan-model/trial? plan) " oss statuses are [" (map project-model/oss? projects) "]")
   (let [some-private-repos (some #(not (project-model/oss? %)) projects)]
     (and some-private-repos
          (plan-model/trial? plan)


more accurate tools used by customers

more accurate tools used by customers

--- frontend/components/landing_b.cljs
+++ frontend/components/landing_b.cljs
@@ -140,7 +140,7 @@
               :cite "John Duff"
               :cite-title "Director of Engineering"
               :cite-avatar "/img/outer/home/john-duff.png"
-              :tools #{:rails :ruby}
+              :tools #{:rails :ruby :javascript :redis}
               ;; TODO get position from index rather than specifying manually
               :position 0}
     :intercom {:name "Intercom"
@@ -149,7 +149,7 @@
                :cite "Ciaran Lee"
                :cite-title "CTO"
                :cite-avatar "/img/outer/home/ciaran-lee.png"
-               :tools #{:node :javascript}
+               :tools #{:ruby :rails :javascript}
                :position 1}
     :sincerely {:name "Sincerely"
                 :logo ""
@@ -157,7 +157,7 @@
                 :cite "Justin Watt"
                 :cite-title "Director of Engineering"
                 :cite-avatar "/img/outer/home/justin-watt.png"
-                :tools #{:php :amazon :mysql}
+                :tools #{:php :amazon :mysql :javascript}
                 :position 2}
     :kickstarter {:name "Kickstarter"
                   :logo ""
@@ -165,7 +165,7 @@
                   :cite "Aaron Suggs"
                   :cite-title "Operations Engineer"
                   :cite-avatar "/img/outer/home/aaron-suggs.png"
-                  :tools #{:django :python}
+                  :tools #{:ruby :rails :javascript :amazon}
                   :position 3}
     :gocardless {:name "GoCardless"
                  :logo ""


Remove useless coersion to vector.

Remove useless coersion to vector.

--- frontend/uxbox/data/workspace.cljs
+++ frontend/uxbox/data/workspace.cljs
@@ -164,7 +164,7 @@
     (-apply-watch [_ state]
       (let [selected (get-in state [:workspace :selected])]
         (rx/from-coll
-         (into [(deselect-all)] (mapv #(delete-shape %) selected)))))))
+         (into [(deselect-all)] (map #(delete-shape %) selected)))))))

 (defn initialize
   "Initialize the workspace state."


CMR-2051: Add test with nested conditionals

--- system-int-test/test/cmr/system_int_test/search/tagging/collection_tag_search_test.clj
+++ system-int-test/test/cmr/system_int_test/search/tagging/collection_tag_search_test.clj
@@ -239,8 +239,14 @@
             "By and'ing tags"
             [tag1-colls] {:and [{:tag {:value "value1"}} {:tag {:namespace "namespace1"}}]}

-            "By negating (NOT) tags"
+            "By negating ('not') tags"
             [tag3-colls tag4-colls tag5-colls] {:not {:tag {:namespace "Namespace1"}}}
+
+            "By nested 'and', 'or', and 'not' tags"
+            [tag4-colls tag5-colls] {:and [{:not {:tag {:namespace "Namespace1"}}}
+                                           {:or [{:not {:tag {:namespace "Namespace2"}}}
+                                                 {:tag {:value "Value2"}}]}]}
+

             ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
             ;; Combinations


wip on rendering and adding gol bling

wip on rendering and adding gol bling


More on type hints

More on type hints

--- lambdalf-lib/src/main/clojure/alfresco/core.clj
+++ lambdalf-lib/src/main/clojure/alfresco/core.clj
@@ -14,16 +14,19 @@
 ; limitations under the License.

 (ns alfresco.core
-    (:import (it.sk.alfresco.clojure ContextHelper)
-             (org.alfresco.service ServiceRegistry)))
+  (:import (it.sk.alfresco.clojure ContextHelper)
+           (org.springframework.context ApplicationContext)
+           (org.alfresco.service ServiceRegistry)))

 (set! *warn-on-reflection* true)

 (defn get-bean
   "Yields the instance of a spring managed bean"
   [bean]
-  (. (ContextHelper/getApplicationContext) getBean bean))
+  (let [^ApplicationContext ctx (ContextHelper/getApplicationContext)]
+    (. ctx getBean bean)))

 (defn ^ServiceRegistry alfresco-services
+  "Exposes the Alfresco ServiceRegistry to get access to the Foundation API"
   []
   (get-bean ServiceRegistry/SERVICE_REGISTRY))


Refactoring kill workers method

Refactoring kill workers method

--- storm-core/src/clj/org/apache/storm/daemon/supervisor.clj
+++ storm-core/src/clj/org/apache/storm/daemon/supervisor.clj
@@ -553,6 +553,16 @@
           (rm-topo-files conf storm-id localizer false)
           storm-id)))))

+(defn kill-existing-workers-with-change-in-components [supervisor existing-assignment new-assignment]
+  (let [assigned-executors (or (ls-local-assignments (:local-state supervisor)) {})
+        allocated (read-allocated-workers supervisor assigned-executors (Time/currentTimeSecs))
+        valid-allocated (filter-val (fn [[state _]] (= state :valid)) allocated)
+        port->worker-id (clojure.set/map-invert (map-val #((nth % 1) :port) valid-allocated))]
+    (doseq [p (set/intersection (set (keys existing-assignment))
+                                (set (keys new-assignment)))]
+      (if (not= (:executors (existing-assignment p)) (:executors (new-assignment p)))
+        (shutdown-worker supervisor (port->worker-id p))))))
+
 (defn mk-synchronize-supervisor [supervisor sync-processes event-manager processes-event-manager]
   (fn this []
     (let [conf (:conf supervisor)
@@ -578,11 +588,7 @@
           assigned-storm-ids (assigned-storm-ids-from-port-assignments new-assignment)
           localizer (:localizer supervisor)
           checked-downloaded-storm-ids (set (verify-downloaded-files conf localizer assigned-storm-ids all-downloaded-storm-ids))
-          downloaded-storm-ids (set/difference all-downloaded-storm-ids checked-downloaded-storm-ids)
-          assigned-executors (or (ls-local-assignments local-state) {})
-          allocated (read-allocated-workers supervisor assigned-executors (Time/currentTimeSecs))
-          valid-allocated (filter-val (fn [[state _]] (= state :valid)) allocated)
-          port->worker-id (clojure.set/map-invert (map-val #((nth % 1) :port) valid-allocated))]
+          downloaded-storm-ids (set/difference all-downloaded-storm-ids checked-downloaded-storm-ids)]

       (log-debug "Synchronizing supervisor")
       (log-debug "Storm code map: " storm-code-map)
@@ -615,10 +621,7 @@
       (doseq [p (set/difference (set (keys existing-assignment))
                                 (set (keys new-assignment)))]
         (.killedWorker isupervisor (int p)))
-      (doseq [p (set/intersection (set (keys existing-assignment))
-                                  (set (keys new-assignment)))]
-        (if (not= (:executors (existing-assignment p)) (:executors (new-assignment p)))
-          (shutdown-worker supervisor (port->worker-id p))))
+      (kill-existing-workers-with-change-in-components supervisor existing-assignment new-assignment)
       (.assigned isupervisor (keys new-assignment))
       (ls-local-assignments! local-state
             new-assignment)


Change names

Change names

--- src/airhead_cljs/core.cljs
+++ src/airhead_cljs/core.cljs
@@ -15,12 +15,12 @@
 ;; -------------------------
 ;;

-(defn info-get []
+(defn get-info! []
   (GET "/api/info"
        {:handler #(swap! state assoc :info %)
         :response-format :json}))

-(defn playlist-get []
+(defn get-playlist! []
   (GET "/api/playlist"
        {:handler #(swap! state assoc :playlist %)
         :response-format :json}))
@@ -31,29 +31,32 @@
 (defn playlist-remove [id]
   (DELETE (str "/api/playlist/" id)))

-(defn library-get []
+(defn get-library! []
   (GET "/api/library"
        {:handler #(swap! state assoc :library (% "tracks"))
         :response-format :json}))

-(defn library-upload []
+(defn on-form-success [form]
+  (swap! state assoc :upload-status "Done!")
+  (.reset form))
+
+(defn on-form-error [form]
+  (swap! state assoc :upload-status "Something went wrong"))
+
+(defn upload! []
   ;; TODO: do not use element id
   (let [form (.getElementById js/document
-                              "upload-form")
-        on-success (fn []
-                     (swap! state assoc :upload-status "Done!")
-                     (.reset form))
-        on-error #(swap! state assoc :upload-status "Something went wrong")]
+                              "upload-form")]
     (swap! state assoc :upload-status "Uploading...")
     (POST "/api/library" {:enc-type "multipart/form-data"
                           :body (js/FormData. form)
-                          :handler on-success
-                          :error-handler on-error})))
+                          :handler #(on-form-success form)
+                          :error-handler #(on-form-error form)})))

 (defn polling-callback []
-  (info-get)
-  (playlist-get)
-  (library-get))
+  (get-info!)
+  (get-playlist!)
+  (get-library!))

 (js/setInterval polling-callback 1000)

@@ -76,7 +79,7 @@
    [:h2 "Upload"]
    [:form {:id "upload-form"}
     [:input {:type "file" :name "track"}]
-    [:input {:type "button" :value "Upload" :on-click library-upload}]]
+    [:input {:type "button" :value "Upload" :on-click upload!}]]
    [:div.upload-status (@state :upload-status)]])

 (defn playlist-add-component [uuid]


Only search for three or more characters

--- src/app/core.cljs
+++ src/app/core.cljs
@@ -14,6 +14,7 @@
   (atom {:selected [:details]
          :rsvp-search {:name ""
                        :results nil
+                       :error nil
                        :party {}}
          :party {}
          :selection {:party nil
@@ -169,7 +170,7 @@
             :name "New York Loft Hostel"
             :notes "249 Varet St., Brooklyn ($)"}])]]))

-(defn rsvp-search-view [{:keys [name results] :as data} owner]
+(defn rsvp-search-view [{:keys [name results error] :as data} owner]
   (reify om/IRender
     (render [_]
       (html
@@ -177,10 +178,13 @@
         [:h2 "RSVP"]
         [:form {:id "rsvpsearch"
                 :onSubmit #(do (.. % (preventDefault))
-                               (go (let [guests (<! (search-guests name))]
-                                     (om/update! data :results guests)
-                                     (when (= 1 (count guests))
-                                       (select-party! owner (get-in guests [0 :party]))))))}
+                               (go (if (>= (count name) 3)
+                                     (do (om/update! data :error nil)
+                                         (let [guests (<! (search-guests name))]
+                                           (om/update! data :results guests)
+                                           (when (= 1 (count guests))
+                                             (select-party! owner (get-in guests [0 :party])))))
+                                     (om/update! data :error "Please enter three or more characters."))))}
          [:label {:for "guestsearch"} "Enter the name on your invitation:"]
          [:input {:type "text"
                   :name "guestseearch"
@@ -189,6 +193,7 @@
                   :value name
                   :ref "name"
                   :onChange #(om/update! data :name (.-value (om/get-node owner "name")))}]
+         (when (some? error) [:div error])
          [:button {:type "submit"}
           "Find RSVP"]]]))))


Split net-clean-up into separate func.

Split net-clean-up into separate func.

--- src/cbfg/net.cljs
+++ src/cbfg/net.cljs
@@ -1,104 +1,109 @@
 (ns cbfg.net
   (:require-macros [cbfg.ago :refer [achan-buf ago ago-loop aclose aalts aput aput-close]]))

+(defn net-clean-up [actx listens streams results]
+  (ago cleanup actx
+       (doseq [[[addr port] accept-ch] listens]
+         (aclose cleanup accept-ch))
+       (doseq [stream (vals streams)]
+         (aclose cleanup (:recv-ch stream)))
+       (doseq [[result-ch msg] results]
+         (aclose cleanup result-ch)))
+  :done)
+
 (defn make-net [actx request-listen-ch request-connect-ch & opts]
-  (let [clean-up (fn [listens streams results]
-                   (ago cleanup actx
-                        (doseq [[[addr port] accept-ch] listens]
-                          (aclose cleanup accept-ch)))
-                   :done)]
-    (ago-loop net actx
-              [ts 0
-               listens {}  ; Keyed by [addr port], value is accept-ch.
-               streams {}  ; A conn is represented by dual streams, where streams
-                           ; is keyed by send-ch and a value of...
-                           ; {:send-addr :send-port :send-ch
-                           ;  :recv-addr :recv-port :recv-ch
-                           ;  :side (:client|:server)
-                           ;  :server-addr :server-port
-                           ;  :msgs [[deliver-at msg] ...]}.
-               results []] ; A result is [ch msg].
-              (let [deliverables (mapcat (fn [send-ch stream]
+  (ago-loop net actx
+            [ts 0
+             listens {}  ; Keyed by [addr port], value is accept-ch.
+             streams {}  ; A conn is represented by dual streams, where streams
+                         ; is keyed by send-ch and a value of...
+                         ; {:send-addr :send-port :send-ch
+                         ;  :recv-addr :recv-port :recv-ch
+                         ;  :side (:client|:server)
+                         ;  :server-addr :server-port
+                         ;  :msgs [[deliver-at msg] ...]}.
+             results []] ; A result entry is [result-ch msg].
+            (let [deliverables (mapcat (fn [send-ch stream]
                                          (when-let [[deliver-at msg] (first (:msgs stream))]
                                            (when (>= ts deliver-at)
                                              [[(:recv-ch stream) (first (:msgs stream))]])))
                                        streams)
-                    sendables (mapcat (fn [send-ch stream]
-                                       (when (< (count (:msgs stream))
-                                                (get opts :max-msgs-per-stream 10))
-                                         [(:send-ch stream)]))
-                                      streams)
-                    [v ch] (aalts net (-> [request-listen-ch request-connect-ch]
-                                          (into deliverables)
-                                          (into sendables)
-                                          (into results)))]
-                (cond
-                 (= ch request-listen-ch)
-                 (if-let [[addr port accept-ch] v]
-                   (if (get listens [addr port])
-                     (recur (inc ts)
-                            (assoc listens [addr port] accept-ch)
-                            streams
-                            results)
-                     (do (aclose net accept-ch)
-                         (recur (inc ts) listens streams results)))
-                   (clean-up listens streams results))
-                 (= ch request-connect-ch)
-                 (if-let [[to-addr to-port from-addr result-ch] v]
-                   ; TODO: Need to model connection delay, perhaps with a generic "later".
-                   (if-let [accept-ch (get listens [to-addr to-port])]
-                     (let [end-point-buf-size (get opts :end-point-buf-size 0)
-                           client-send-ch (achan-buf net end-point-buf-size)
-                           client-recv-ch (achan-buf net end-point-buf-size)
-                           server-send-ch (achan-buf net end-point-buf-size)
-                           server-recv-ch (achan-buf net end-point-buf-size)]
-                       ; TODO: Need to model running out of ports.
-                       ; TODO: Need to model stop accepting connections / stop listening.
-                       (recur (inc ts)
-                              listens
-                              (-> streams
-                                  (assoc client-send-ch {:send-ch client-send-ch :recv-ch server-recv-ch
-                                                         :server-addr to-addr :server-port to-port
-                                                         :side :client :msgs []})
-                                  (assoc server-send-ch {:send-ch server-send-ch :recv-ch client-recv-ch
-                                                         :server-addr to-addr :server-port to-port
-                                                         :side :server :msgs []}))
-                              (-> results
-                                  (conj [result-ch [client-send-ch client-recv-ch]])
-                                  (conj [accept-ch [server-send-ch server-recv-ch]]))))
-                     (do (aclose net result-ch)
-                         (recur (inc ts) listens streams results)))
-                   (clean-up listens streams results))
-                 (contains? sendables ch)
-                 (let [send-ch ch]
-                   (if-let [stream (get streams send-ch)]
-                     (let [[msg result-ch] v]
-                       (recur (inc ts)
-                              listens
-                              (update-in streams [send-ch :msgs]
-                                         conj [(+ ts (get :opts :delivery-delay 0)) msg])
-                              (if result-ch
-                                (conj results [result-ch :ok])
-                                result-ch)))
+                  sendables (mapcat (fn [send-ch stream]
+                                      (when (< (count (:msgs stream))
+                                               (get opts :max-msgs-per-stream 10))
+                                        [(:send-ch stream)]))
+                                    streams)
+                  [v ch] (aalts net (-> [request-listen-ch request-connect-ch]
+                                        (into deliverables)
+                                        (into sendables)
+                                        (into results)))]
+              (cond
+               (= ch request-listen-ch)
+               (if-let [[addr port accept-ch] v]
+                 (if (get listens [addr port])
+                   (recur (inc ts)
+                          (assoc listens [addr port] accept-ch)
+                          streams
+                          results)
+                   (do (aclose net accept-ch)
+                       (recur (inc ts) listens streams results)))
+                 (net-clean-up net listens streams results))
+               (= ch request-connect-ch)
+               (if-let [[to-addr to-port from-addr result-ch] v]
+                 ; TODO: Need to model connection delay, perhaps with a generic "later".
+                 (if-let [accept-ch (get listens [to-addr to-port])]
+                   (let [end-point-buf-size (get opts :end-point-buf-size 0)
+                         client-send-ch (achan-buf net end-point-buf-size)
+                         client-recv-ch (achan-buf net end-point-buf-size)
+                         server-send-ch (achan-buf net end-point-buf-size)
+                         server-recv-ch (achan-buf net end-point-buf-size)]
+                     ; TODO: Need to model running out of ports.
+                     ; TODO: Need to model stop accepting connections / stop listening.
                      (recur (inc ts)
                             listens
-                            (update-in streams [send-ch :send-closed] true)
-                            results)))
-                 :else ; Must be a completed deliverable (recv-ch aput'ed) or completed results aput.
-                 (if-let [stream (first (filter #(= (:recv-ch %) ch) (vals streams)))]
-                   (let [stream2 (update-in stream [:msgs] rest)]
-                     (if (and (:send-closed stream2)
-                              (empty? (:msgs stream2)))
-                       (do (aclose net (:recv-ch stream2))
-                           (recur (inc ts)
-                                  listens
-                                  (dissoc streams (:send-ch stream2))
-                                  results))
-                       (recur (inc ts)
-                              listens
-                              (assoc streams (:send-ch stream2) stream2)
-                              results)))
+                            (-> streams
+                                (assoc client-send-ch {:send-ch client-send-ch :recv-ch server-recv-ch
+                                                       :server-addr to-addr :server-port to-port
+                                                       :side :client :msgs []})
+                                (assoc server-send-ch {:send-ch server-send-ch :recv-ch client-recv-ch
+                                                       :server-addr to-addr :server-port to-port
+                                                       :side :server :msgs []}))
+                            (-> results
+                                (conj [result-ch [client-send-ch client-recv-ch]])
+                                (conj [accept-ch [server-send-ch server-recv-ch]]))))
+                   (do (aclose net result-ch)
+                       (recur (inc ts) listens streams results)))
+                 (net-clean-up net listens streams results))
+               (contains? sendables ch)
+               (let [send-ch ch]
+                 (if-let [stream (get streams send-ch)]
+                   (let [[msg result-ch] v]
+                     (recur (inc ts)
+                            listens
+                            (update-in streams [send-ch :msgs]
+                                       conj [(+ ts (get :opts :delivery-delay 0)) msg])
+                            (if result-ch
+                              (conj results [result-ch :ok])
+                              result-ch)))
                    (recur (inc ts)
                           listens
-                          streams
-                          (remove #(= (first %) ch) results))))))))
+                          (update-in streams [send-ch :send-closed] true)
+                          results)))
+               :else ; Must be a completed deliverable (recv-ch aput'ed) or completed results aput.
+               (if-let [stream (first (filter #(= (:recv-ch %) ch) (vals streams)))]
+                 (let [stream2 (update-in stream [:msgs] rest)]
+                   (if (and (:send-closed stream2)
+                            (empty? (:msgs stream2)))
+                     (do (aclose net (:recv-ch stream2))
+                         (recur (inc ts)
+                                listens
+                                (dissoc streams (:send-ch stream2))
+                                results))
+                     (recur (inc ts)
+                            listens
+                            (assoc streams (:send-ch stream2) stream2)
+                            results)))
+                 (recur (inc ts) ; Handle a completed results aput.
+                        listens
+                        streams
+                        (remove #(= (first %) ch) results)))))))


Bumps version to 1.58.1-SNAPSHOT

Bumps version to 1.58.1-SNAPSHOT

--- scheduler/project.clj
+++ scheduler/project.clj
@@ -13,7 +13,7 @@
 ;; See the License for the specific language governing permissions and
 ;; limitations under the License.
 ;;
-(defproject cook "1.58.0"
+(defproject cook "1.58.1-SNAPSHOT"
   :description "This launches jobs on a Mesos cluster with fair sharing and preemption"
   :license {:name "Apache License, Version 2.0"}
   :dependencies [[org.clojure/clojure "1.10.3"]


Bumps version to 1.58.5-SNAPSHOT

Bumps version to 1.58.5-SNAPSHOT

--- scheduler/project.clj
+++ scheduler/project.clj
@@ -13,7 +13,7 @@
 ;; See the License for the specific language governing permissions and
 ;; limitations under the License.
 ;;
-(defproject cook "1.58.4"
+(defproject cook "1.58.5-SNAPSHOT"
   :description "This launches jobs on a Mesos cluster with fair sharing and preemption"
   :license {:name "Apache License, Version 2.0"}
   :dependencies [[org.clojure/clojure "1.10.3"]


Fixing refactoring of spatial viz change.

--- dev/user.clj
+++ dev/user.clj
@@ -7,6 +7,7 @@
             [cmr.system-int-test.data2.core :as data]
             [cmr.common.config :as config]
             [earth.driver :as earth-viz]
+            [common-viz.util :as common-viz]
             [vdd-core.core :as vdd])
   (:use [clojure.test :only [run-all-tests]]
         [clojure.repl]
@@ -44,7 +45,7 @@
 (defn reload-coffeescript []
   (do
     (println "Compiling coffeescript")
-    (println (earth-viz/compile-coffeescript (get-in system [:components :vdd-server :config])))
+    (println (common-viz/compile-coffeescript (get-in system [:components :vdd-server :config])))
     (vdd/data->viz {:cmd :reload})))

 (info "Custom dev-system user.clj loaded.")


Remove commented-out stuff from `user` ns form

--- dev/user.clj
+++ dev/user.clj
@@ -2,8 +2,7 @@
   "Namespace to support hacking at the REPL."
   (:require [clojure.java.javadoc :refer [javadoc]]
             [clojure.pprint :refer [pp pprint]]
-            [clojure.repl :refer :all ; [apropos dir doc find-doc pst source]
-             ]
+            [clojure.repl :refer :all]
             [clojure.string :as str]
             [clojure.tools.namespace.move :refer :all]
             [clojure.tools.namespace.repl :refer :all]


Decreased default delay to 70ms

Decreased default delay to 70ms

--- src/eddy/mail.clj
+++ src/eddy/mail.clj
@@ -5,7 +5,7 @@
 (def email-user (env :email-user))
 (def email-pass (env :email-pass))
 (def email-host (env :email-host))
-(def email-delay (env :email-delay 5000))
+(def email-delay (env :email-delay 70))

 (defn send-message [address, body]
   (postal/send-message {:user email-user


Additional diffs for parallelizing cgdata transforms.

--- src/cavm/core.clj
+++ src/cavm/core.clj
@@ -19,9 +19,6 @@
   (:require [clojure.tools.cli :refer [cli]])
   (:require [cavm.cgdata :as cgdata])
   (:gen-class))
-
-(defn- tabbed [line]
-  (s/split line #"\t"))

 (defn- file-time [file]
   (from-long (.lastModified (java.io.File. file))))
@@ -60,7 +57,7 @@
                   [rfile])
           stats (mapv #(file-stats root %) files)
           data-fn (fn []
-                    (cgdata/matrix-data meta features (map tabbed (line-seq in))))]
+                    (cgdata/matrix-data meta features (line-seq in)))]
       (load-exp stats meta data-fn features))))

 (defn- loadtest [name ^Integer m ^Integer n]


Sketch network connect model.

Sketch network connect model.

--- src/cbfg/net.cljs
+++ src/cbfg/net.cljs
@@ -1,6 +1,5 @@
 (ns cbfg.net
-  (:require-macros [cbfg.ago :refer [achan-buf ago ago-loop aalts
-                                     aput aput-close atake]]))
+  (:require-macros [cbfg.ago :refer [achan ago-loop aclose aalts aput]]))

 (defn make-net [actx request-listen-ch request-connect-ch max-msgs-per-stream]
   (let [clean-up #()]
@@ -13,7 +12,7 @@
                            ; is keyed by send-ch and a value of...
                            ; {:send-addr :send-port :send-ch
                            ;  :recv-addr :recv-port :recv-ch
-                           ;  :accept-addr :accept-port
+                           ;  :to-side :to-addr :to-port
                            ;  :msgs :tot-msgs}.
               (let [deliveries (mapcat (fn [send-ch stream]
                                          (when-let [[deliver-at msg] (first (:msgs stream))]
@@ -31,11 +30,29 @@
                  (= ch request-listen-ch)
                  (when-let [[addr port accept-ch] v]
                    (if (get listens [addr port])
-                     (recur (inc ts) request-listen-ch request-connect-ch listens streams)
-                     (recur (inc ts) request-listen-ch request-connect-ch listens streams)))
+                     (recur (inc ts) request-listen-ch request-connect-ch
+                            (assoc listens [addr port] accept-ch)
+                            streams)
+                     (do (aclose net accept-ch)
+                         (recur (inc ts) request-listen-ch request-connect-ch listens streams))))
                  (= ch request-connect-ch)
-                 (when v
-                   (recur (inc ts) request-listen-ch request-connect-ch listens streams))
+                 (when-let [[to-addr to-port from-addr result-ch] v]
+                   (if-let [accept-ch (get listens [to-addr to-port])]
+                     (let [client-send-ch (achan net)
+                           client-recv-ch (achan net)
+                           server-send-ch (achan net)
+                           server-recv-ch (achan net)]
+                       ; TODO: Need to model connection delay and running out of ports.
+                       (aput net result-ch [client-send-ch client-recv-ch])
+                       (aput net accept-ch [server-send-ch server-recv-ch])
+                       (recur (inc ts) request-listen-ch request-connect-ch listens
+                              (-> streams
+                                  (assoc client-send-ch {:send-ch client-send-ch :recv-ch server-recv-ch
+                                                         :to-side :recv :to-addr to-addr :to-port to-port})
+                                  (assoc server-send-ch {:send-ch server-send-ch :recv-ch client-recv-ch
+                                                         :to-side :send :to-addr to-addr :to-port to-port}))))
+                     (do (aclose net result-ch)
+                         (recur (inc ts) request-listen-ch request-connect-ch listens streams))))
                  (contains? listenables ch)
                  (if v
                    (recur (inc ts) request-listen-ch request-connect-ch listens streams)


doc: minor clarity improvement

doc: minor clarity improvement

--- src/insn/core.clj
+++ src/insn/core.clj
@@ -269,7 +269,7 @@

   If the given argument count matches a constructor with a distinct
   arity, that one is invoked. In this case, constructors that take
-  primitives are supported via reflection unboxing.
+  primitives are supported via reflective unboxing.

   Otherwise, the argument types must exactly match (as per
   `clojure.core/class`) a defined constructor, or a constructor that


Clean up contract of get-pager-links.

Clean up contract of get-pager-links.

--- project/scrape-summitpost-data/src/scrape_summitpost_data/get_item_texts.clj
+++ project/scrape-summitpost-data/src/scrape_summitpost_data/get_item_texts.clj
@@ -10,21 +10,18 @@

 (defn- get-pager-links
   "Given a link to a paginated search results page from summitpost, GET the
-  page and return a sequence of links to all search results pages. If there
-  is no pagination, return nil."
+  page and return a sequence of links to all search results pages."
   [link]
-  (->> link
-       (str base-url)
-       (slurp)
-       (reaver/parse)
-       (extract-all-pager-links)))
+  (let [page (slurp (str base-url link))
+        jsoup (reaver/parse page)]
+    (or (extract-all-pager-links jsoup) [link])))

 (defn- get-pages
   "Given a link to a search results page from summitpost, GET every search
   results page in the pagination (or just the page if no pagination) and
   return them as a lazy sequence."
   [link]
-  (->> (or (get-pager-links link) [link])
+  (->> (get-pager-links link)
        (map (partial str base-url))
        (map slurp)))


added up print

added up print

--- src/c4_arena/core.clj
+++ src/c4_arena/core.clj
@@ -189,4 +189,5 @@
    :port 4222
    :handler cider-nrepl-handler)
   (matcher-init)
-  (http/start-server #'app {:port 8001}))
+  (http/start-server #'app {:port 8001})
+  (tb/info "Server is up!"))


add :anonymous metadata to reify anonymous type symbol

--- src/clj/cljs/core.clj
+++ src/clj/cljs/core.clj
@@ -625,12 +625,12 @@
       'js/Function "function"})

 (defmacro reify [& impls]
-  (let [t      (gensym "t")
+  (let [t        (with-meta (gensym "t") {:anonymous true})
         meta-sym (gensym "meta")
         this-sym (gensym "_")
-        locals (keys (:locals &env))
-        ns     (-> &env :ns :name)
-        munge  cljs.compiler/munge]
+        locals   (keys (:locals &env))
+        ns       (-> &env :ns :name)
+        munge    cljs.compiler/munge]
     `(do
        (when-not (exists? ~(symbol (core/str ns) (core/str t)))
          (deftype ~t [~@locals ~meta-sym]


don't read an empty body

don't read an empty body

--- src/clj_http/core.clj
+++ src/clj_http/core.clj
@@ -42,6 +42,6 @@
               http-entity (.getEntity http-resp)
               resp {:status (.getStatusCode (.getStatusLine http-resp))
                     :headers (parse-headers http-resp)
-                    :body (EntityUtils/toByteArray (.getEntity http-resp))}]
+                    :body (if http-entity (EntityUtils/toByteArray http-entity))}]
           (.shutdown (.getConnectionManager http-client))
           resp)))))


Select component should have 'fill' state passed to it.

--- src/cljs/svg/app.cljs
+++ src/cljs/svg/app.cljs
@@ -184,10 +184,9 @@
             :on-change (fn [e] (fire :dimension-changed [v (-> e .-target .-value)]))}]])

 (defn select-component
-  []
-  (fn []
-    (let [fill (r/cursor app-db [:fill])
-          colors ["gray" "red" "orange" "yellow" "green" "blue"
+  [fill]
+  (fn [fill]
+    (let [colors ["gray" "red" "orange" "yellow" "green" "blue"
                   "aqua" "indigo" "purple" "brown" "black"]]
       (do
         [:div {:class "form-group"}
@@ -223,7 +222,7 @@
         [range-component x 0 720 "CX"]
         [range-component y 0 720 "CY"]
         [range-component radius 1 100 "Size"]
-        [select-component]]
+        [select-component fill]]
        [:div {:class "col-md-9"}
         [svg-component circle]]])))


Code review: Destructure to remove manual lookups

--- src/cower/handler.clj
+++ src/cower/handler.clj
@@ -8,9 +8,8 @@
 (def server1-conn { :pool {} :spec {} })
 (defmacro wcar* [& body] `(car/wcar server1-conn ~@body))

-(defn- key-value-to-map [key-value]
-  {:name (nth key-value 0)
-   :url (nth key-value 1)})
+(defn- key-value-to-map [[k v]]
+  {:name k :url v})

 (defn- key-values-to-json [keys values]
   (map key-value-to-map (zipmap keys values)))


generate final model

generate final model

--- src/crawler/model.clj
+++ src/crawler/model.clj
@@ -27,9 +27,18 @@

    Focus on just avoids right now and trust
    the onlies"
-  [a-model-file a-corpus-file]
+  [a-model-file a-corpus-file a-leaves-file]
   (let [model (read-model a-model-file)
         downloaded-corpus (corpus/read-corpus-file a-corpus-file)
+        leaf-cluster (last
+                      (sort-by
+                       count
+                       (read-model a-leaves-file)))
+        leaf-examples (map
+                       (fn [l]
+                         (-> l downloaded-corpus :body))
+                       leaf-cluster)
+
         corpus-urls (set
                      (map
                       (fn [[u x]]
@@ -98,7 +107,14 @@
                                    (fn [{x :xpath}]
                                      (if action-to-take-at-target
                                        (= x action-to-take-at-target)
-                                       true))
+                                       (let [num-matched (count
+                                                          (filter
+                                                           (fn [e]
+                                                             (similarity/similar? e bd))
+                                                           leaf-examples))]
+                                         (>= num-matched
+                                               (/ (count leaf-examples)
+                                                  2)))))
                                    xpaths-hrefs)))))
                             u)))
                        docs-at-src-xpath)]


Fix building-prop for gen-assoc

Fix building-prop for gen-assoc

--- src/aurora/btree.cljs
+++ src/aurora/btree.cljs
@@ -44,6 +44,9 @@
 (defn key= [as bs]
   (== 0 (key-compare as bs)))

+(defn key-not= [as bs]
+  (not (== 0 (key-compare as bs))))
+
 (defn key-lt [as bs]
   (== -1 (key-compare as bs)))

@@ -66,10 +69,8 @@
   (toString [this]
             (pr-str (into {} (map vec (seq this)))))
   (assoc! [this key val]
-          (assert (or (number? key) (string? key)))
           (.assoc! root key val max-keys))
   (dissoc! [this key]
-           (assert (or (number? key) (string? key)))
            (.dissoc! root key max-keys))
   (push! [this ix key&val&child which-child]
            (let [left-child (if (== which-child left-child) (aget key&val&child 2) root)
@@ -116,12 +117,12 @@
                   mid-key (aget keys mid)]
               (if (key-lt mid-key key)
                 (recur (+ mid 1) hi)
-                (if (== mid-key key)
+                (if (key= mid-key key)
                   mid
                   (recur lo (- mid 1))))))))
   (assoc! [this key val max-keys]
           (let [ix (.seek this key 0)]
-            (if (== key (aget keys ix))
+            (if (and (< ix (alength keys)) (key= key (aget keys ix)))
               (do
                 (aset vals ix val)
                 true)
@@ -133,7 +134,7 @@
                 (.assoc! (aget children ix) key val max-keys)))))
   (dissoc! [this key max-keys]
            (let [ix (.seek this key 0)]
-             (if (== key (aget keys ix))
+             (if (and (< ix (alength keys)) (key= key (aget keys ix)))
                (if (nil? children)
                  (do
                    (.pop! this ix)
@@ -188,12 +189,12 @@
                        (.update-lower! this (if (nil? children) (aget keys 0) (.-lower (aget children 0))))
                        (.update-upper! this (if (nil? children) (aget keys (- (alength keys) 1)) (.-upper (aget children (- (alength children) 1)))))))))))
   (update-lower! [this new-lower]
-                 (when-not (== lower new-lower)
+                 (when (or (nil? lower) (key-not= lower new-lower))
                    (set! lower new-lower)
                    (when (and (instance? Node parent) (== parent-ix 0))
                      (.update-lower! parent new-lower))))
   (update-upper! [this new-upper]
-                 (when-not (== upper new-upper)
+                 (when (or (nil? upper) (key-not= upper new-upper))
                    (set! upper new-upper)
                    (when (and (instance? Node parent) (== parent-ix (- (alength (.-children parent)) 1)))
                      (.update-upper! parent new-upper))))
@@ -262,7 +263,7 @@
               (assert (>= (count keys) min-keys) (pr-str keys min-keys)))
             (assert (<= (count keys) max-keys) (pr-str keys max-keys))
             (assert (= (count keys) (count (set keys))))
-            (assert (= (seq keys) (seq (sort-by identity compare-keys keys))))
+            (assert (= (seq keys) (seq (sort-by identity key-compare keys))))
             (assert (every? #(key-lte lower %) keys) (pr-str lower keys))
             (assert (every? #(key-gte upper %) keys) (pr-str upper keys))
             (if (nil? children)
@@ -342,7 +343,7 @@
                         (set! ix 0)
                         (recur))
                       (if (or (and (identical? node start-node) (== ix start-ix))
-                              (== key (aget (.-keys node) ix))
+                              (key= key (aget (.-keys node) ix))
                               (nil? (.-children node))
                               (let [lower (.-upper (aget (.-children node) ix))]
                                 (key-lt lower key)))
@@ -370,7 +371,7 @@
             (loop [current current]
               (let [max-key (.key (aget iterators (mod (- current 1) (alength iterators))))
                     min-key (.key (aget iterators current))]
-                (when-not (== min-key max-key)
+                (when-not (key= min-key max-key)
                   (.seek (aget iterators current))
                   (if (.-end? (aget iterators current))
                     (set! end? true)
@@ -392,7 +393,7 @@
   (if (> (alength iterators) 1)
     (if (some #(.-end? %) iterators)
       (Intersection. iterators true)
-      (let [intersection (Intersection. (into-array (sort-by #(.key %) compare-keys iterators)) false)]
+      (let [intersection (Intersection. (into-array (sort-by #(.key %) key-compare iterators)) false)]
         (.search intersection 0)
         intersection))
     (aget iterators 0)))
@@ -513,7 +514,7 @@

 (defn run-building-prop [min-keys key-len actions]
   (let [tree (apply-to-tree (tree min-keys key-len) actions)
-        sorted-map (apply-to-sorted-map (sorted-map-by compare-keys) actions)]
+        sorted-map (apply-to-sorted-map (sorted-map-by key-compare) actions)]
     (and (= (seq (map vec tree)) (seq sorted-map))
          (.valid! tree))))

@@ -524,7 +525,7 @@

 (defn run-lookup-prop [min-keys key-len actions action]
   (let [tree (apply-to-tree (tree min-keys key-len) actions)
-        sorted-map (apply-to-sorted-map (sorted-map-by compare-keys) actions)
+        sorted-map (apply-to-sorted-map (sorted-map-by key-compare) actions)
         tree-result (case (nth action 0)
                       :assoc! (.assoc! tree (nth action 1) (nth action 2))
                       :dissoc! (.dissoc! tree (nth action 1)))
@@ -580,7 +581,7 @@

 (defn run-iterator-prop [min-keys key-len actions movements]
   (let [tree (apply-to-tree (tree min-keys key-len) actions)
-        sorted-map (apply-to-sorted-map (sorted-map-by compare-keys) actions)
+        sorted-map (apply-to-sorted-map (sorted-map-by key-compare) actions)
         iterator-results (apply-to-iterator (iterator tree) movements)
         elems-results (apply-to-elems (seq sorted-map) movements)]
     #_(.pretty-print tree)
@@ -595,7 +596,7 @@
 (defn run-intersection-prop [min-keys key-len actionss movements]
   (let [trees (map #(apply-to-tree (tree min-keys key-len) %) actionss)
         elems (apply clojure.set/intersection (map #(set (map vec %)) trees))
-        sorted-map (into (sorted-map-by compare-keys) elems)
+        sorted-map (into (sorted-map-by key-compare) elems)
         iterator-results (apply-to-iterator (intersection (into-array (map iterator trees))) movements)
         elems-results (apply-to-elems (seq sorted-map) movements)]
     (= iterator-results elems-results)))
@@ -605,6 +606,7 @@
                  actionss (gen/not-empty (gen/vector (gen/vector (gen-action key-len))))
                  movements (gen/vector (gen-movement key-len))]
                 false))
+
 (comment
   (dc/quick-check 1000 (least-prop 1))
   (dc/quick-check 1000 (least-prop 2))
@@ -620,7 +622,7 @@
   (dc/quick-check 1000 (anti-symmetric-prop 2))
   (dc/quick-check 1000 (total-prop 1))
   (dc/quick-check 1000 (total-prop 2))
-  (dc/quick-check 1000 (building-prop gen-assoc))
+  (dc/quick-check 1000 (building-prop gen-assoc 1))
   (dc/quick-check 10000 (building-prop gen-action))
   ;; cljs.core.pr_str(cemerick.double_check.quick_check(1000, aurora.btree.building_prop(aurora.btree.gen_action)))
   (dc/quick-check 10000 (lookup-prop gen-action))


adding default put port

adding default put port

--- src/celestial/ssh.clj
+++ src/celestial/ssh.clj
@@ -26,7 +26,7 @@
 (defn put
   "Copies a file into host under dest"
   [host file dest]
-  (with-session host
+  (with-session host 22
     (fn [session]
       (let [channel (ssh-sftp session)]
         (with-channel-connection channel
@@ -35,7 +35,9 @@
 (defn log-output
   "Output log stream"
   [out]
-  (doseq [line (line-seq (clojure.java.io/reader out))] (debug line) ))
+  (doseq [line (line-seq (clojure.java.io/reader out))] (debug line))
+  (debug "done")
+  )

 (defn execute [{:keys [host port] :or {port 22}} & batches]
   {:pre [(every? sequential? batches)]}
@@ -66,7 +68,7 @@
   (execute {:host host} [(<< "git clone ~{uri} ~{dest}/~(no-ext (fname uri))")]))
 (defmethod copy :http [host uri dest]
   (execute {:host host} [(<< "wget -O ~{dest}/~(fname uri) ~{uri}")]))
-(defmethod copy :file [host uri dest] (put host (fname uri)  dest))
+(defmethod copy :file [host uri dest] (put host (subs uri 6)  dest))
 (defmethod copy :default [host uri dest] (copy host (<< "file:/~{uri}") dest))

 (test #'no-ext)


* src/clj/cljs/core.clj: switch to mapcat

--- src/clj/cljs/core.clj
+++ src/clj/cljs/core.clj
@@ -241,22 +241,22 @@
                                         `(set! ~(symbol (str prototype-prefix f)) (fn ~@(map adapt-params meths))))
                                       sigs))
                                (cons `(set! ~(symbol (str prototype-prefix pprefix)) true)
-                                     (map (fn [[f & meths]]
-                                            (let [ifn? (= psym 'cljs.core.IFn)
-                                                  pf (if ifn?
-                                                       (str prototype-prefix 'call)
-                                                       (str prototype-prefix pprefix f))
-                                                  adapt-params (fn [[[targ & args :as sig] & body]]
-                                                                 (let [tsym (gensym "tsym")]
-                                                                   `(~(with-meta (vec (cons tsym args)) (meta sig))
-                                                                     (this-as ~tsym
-                                                                              (let [~targ ~tsym]
-                                                                                ~@body)))))
-                                                  meths (if ifn?
-                                                          (map adapt-params meths)
-                                                          meths)]
-                                              `(set! ~(symbol pf) (fn ~@meths))))
-                                          sigs)))))]
+                                     (mapcat (fn [[f & meths]]
+                                               (let [ifn? (= psym 'cljs.core.IFn)
+                                                     pf (if ifn?
+                                                          (str prototype-prefix 'call)
+                                                          (str prototype-prefix pprefix f))
+                                                     adapt-params (fn [[[targ & args :as sig] & body]]
+                                                                    (let [tsym (gensym "tsym")]
+                                                                      `(~(with-meta (vec (cons tsym args)) (meta sig))
+                                                                        (this-as ~tsym
+                                                                                (let [~targ ~tsym]
+                                                                                ~@body)))))
+                                                     meths (if ifn?
+                                                             (map adapt-params meths)
+                                                             meths)]
+                                                 [`(set! ~(symbol pf) (fn ~@meths))]))
+                                             sigs)))))]
         `(do ~@(mapcat assign-impls impl-map))))))

 (defmacro deftype [t fields & impls]


Added subqueries to pull FORMA datasets out of the subdataset array.

--- src/clj/forma/hdf.clj
+++ src/clj/forma/hdf.clj
@@ -5,29 +5,26 @@
   (:require [cascalog [ops :as c] [workflow :as w] [io :as io]]
             [clojure.contrib [math :as m] [io :as i] [string :as s]]))

+
+;; ## Attempts to Get Metadata
+
+;; Requires an unpacked MODIS file and a seq of meta-data keys.
+(defmapop [meta-values [meta-keys]] [modis]
+  (let [metadata (.GetMetadata_Dict modis "")]
+    (map #(.get metadata %) meta-keys)))
+
 (defn get-metadata
   "Takes in a decompressed HDF file and a key, and returns the associated
    metadata."
   [hdf keys]
   (let [metadata (.GetMetadata_Dict hdf "")]
-    (vec (map #(.get metadata %) keys))))
+    (map #(.get metadata %) keys)))

 (defn get-tileid
   "Returns the TileID of a decompressed MODIS file."
   [hdf]
   (get-metadata hdf ["TileID"]))

-(defn get-bytes
-  "Extracts a byte array from a Hadoop BytesWritable object."
-  [^BytesWritable bytes]
-  (byte-array (.getLength bytes)
-              (.getBytes bytes)))
-
-;; Requires an unpacked MODIS file and a seq of meta-data keys.
-
-(defmapop [meta-values [meta-keys]] [modis]
-  (let [metadata (.GetMetadata_Dict modis "")]
-    (map #(.get metadata %) meta-keys)))

 ;; ## Mapping operations

@@ -36,9 +33,13 @@
 ;; array is processed with gdal, and then the temp directory is destroyed.
 ;; Function returns the decompressed MODIS file as a 1-tuple.

-;; dataset_index2name = {11:'ndvi', 2:'evi', 5:'reli', 9:'qual'}   # indices are within the MODIS HDF4 files
+(defn get-bytes
+  "Extracts a byte array from a Hadoop BytesWritable object."
+  [^BytesWritable bytes]
+  (byte-array (.getLength bytes)
+              (.getBytes bytes)))

-(defmapcatop unpack {:stateful true}
+(defmapop unpack {:stateful true}
   ([]
      (do
        (gdal/AllRegister)
@@ -49,32 +50,50 @@
            bytes (get-bytes stream)]
        (do
          (i/copy (get-bytes stream) tfile)
-         (gdal/Open (.toString tfile) 0))))
+         (gdal/Open (.toString tfile) 0)))) ;; this value should return a seq instea
   ([tdir]
      (i/delete-file-recursively tdir)))

-(def subdata-map {:evi "monthly EVI"
-                  :qual "VI Quality"
-                  :red "red reflectance"
-                  :nir "NIR reflectance"
-                  :azi "azimuth"
-                  :blue "blue reflectance"
-                  :reli "monthly pixel"
-                  :viewz "view zenith"
-                  :ndvi "NDVI"
-                  :sunz "sun zenith"})
+(def *modis-subsets*
+  {:evi "monthly EVI"
+   :qual "VI Quality"
+   :red "red reflectance"
+   :nir "NIR reflectance"
+   :azi "azimuth"
+   :blue "blue reflectance"
+   :reli "monthly pixel"
+   :viewz "view zenith"
+   :ndvi "NDVI"
+   :sunz "sun zenith"})

-(def forma-sets #{:ndvi :evi :qual :reli})
+(def forma-subsets
+  #{:ndvi :evi :qual :reli})

-(defn keep-dataset? [entry]
+(defn subdata-key [entry]
   (let [val (.getValue entry)
+        key (.getKey entry)]
+    (some #(if (s/substring? (% *modis-subsets*) val)
+             %)
+          forma-sets)))
+
+(defn subdataset-filter
+  "Generates a predicate function that compares Hashtable entries to a supplied
+   list of acceptable keys. These keys should exist in *modis-subsets*."
+  [to-keep]
+  (fn [entry]
+    (let [val (.getValue entry)
         key (.getKey entry)]
     (and (s/substring? "_NAME" key)
          (some #(s/substring? % val)
-               (map subdata-map forma-sets)))))
+               (map *modis-subsets* to-keep))))))

-;; the QUERY to use. TODO: make sure this associates the key with the
-;; subdataset.
-(let [metadata (.GetMetadata_Dict opened-file "SUBDATASETS")]
-  (map #(gdal/Open (.getValue %))
-       (filter keep-dataset? metadata)))+(def forma-dataset? (subdataset-filter forma-subsets))
+
+(defn make-subdataset
+  "Accepts an entry in the SUBDATASETS Hashtable of a MODIS Dataset, and returns
+   a 2-tuple with the forma dataset key and the Dataset object."
+  [entry]
+  (vector (subdata-key entry) (gdal/Open (.getValue entry))))
+
+;; (let [metadata (.GetMetadata_Dict opened-file "SUBDATASETS")]
+;;   (map make-subdataset (filter forma-dataset? metadata)))


Improve function naming in app.cljs

Improve function naming in app.cljs

--- src/cljs/app/app.cljs
+++ src/cljs/app/app.cljs
@@ -42,7 +42,7 @@
   (group-by :os (map analyze-download-url asset-info-list)))

 ; Download JSON data
-(defn load-download-json [json-url]
+(defn download-json [json-url]
   (go
     (let [{{asset-info-list :assets} :body} (<! (http/get json-url {:with-credentials? false}))]
       (reset! data (build-download-list asset-info-list)))))
@@ -89,5 +89,5 @@

 (defn init []
   (let [json-url "http://api.github.com/repos/adolby/Kryvos/releases/latest"]
-    (load-download-json json-url)
+    (download-json json-url)
     (reagent/render-component [page] (.-body js/document))))


C2 wrapper to Singult's unify should only call mapping on first datum when data is non-empty.

--- src/cljs/c2/core.cljs
+++ src/cljs/c2/core.cljs
@@ -13,5 +13,6 @@
 (defn unify [data mapping & args]
   ;;Execute the mapping on the first datum so that atoms within the mapping fn will be derefed.
   ;;This should eliminate confusion wherin c2.util#bind! doesn't pick up on dependencies within the unify mapping fn (because the mapping fn isn't executed until rendering, which happens after computed-observable dependencies are calculated).
-  (mapping (first data))
+  (when (seq data)
+    (mapping (first data)))
   (apply singult/unify data mapping args))


uncamelizing

uncamelizing

--- src/docker/remote.clj
+++ src/docker/remote.clj
@@ -26,9 +26,20 @@
 (defn root [node]
   (<< "https://~(hypervisor :docker :nodes node :host):~(hypervisor :docker :nodes node :port)/"))

+(defn uncamel [m]
+ (map-keys m k/->kebab-case))
+
+(defn uncamelize
+   "uncammel responses"
+   [m]
+ (if (sequential? m)
+   (map uncamel m)
+   (uncamel m)))
+
+
 (defn call [verb api args node]
   (-> (verb (<< "~(root node)~{api}") (merge args {:insecure? true}))
-    :body (parse-string true)))
+    :body (parse-string true) uncamelize))

 (defn docker-post
   "A post against a docker instance with provided params"
@@ -41,7 +52,8 @@

 (defn docker-delete [node api] (call client/delete api {} node))

-(defn docker-get [node api] (call client/get api {} node))
+(defn docker-get [node api]
+  (call client/get api {} node))

 (comment
   (celestial.model/set-env :dev (docker-get :local "/images/json?all=0")))


minor changes to hierarchy

minor changes to hierarchy

--- src/exp/hierarchy.clj
+++ src/exp/hierarchy.clj
@@ -135,6 +135,6 @@
 (defn wrap-action-nsa [a full-context]
   (if (env/primitive? a)
     (NSAPrimitive a full-context)
-    (NSAHLA. a full-context)))
+    (NSAHLA a full-context)))

 ;; Can take more progressions than flat because


Focus management #38 - :focus-traversal-order performance

--- src/flatgui/focus.clj
+++ src/flatgui/focus.clj
@@ -96,7 +96,7 @@
 ;;;  NOTE:
 ;;; This implementation is slow. For containers that have frequenlty moving children, it's better
 ;;; to wrap it into another function that would call this one in rare cases (e.g. only when :children
-;;; change)
+;;; change, see below)
 (fg/defevolverfn :focus-traversal-order
   (let [accepting-children (get-accepting-children component)]
     (if (pos? (count accepting-children))
@@ -104,6 +104,12 @@
             result (mapcat (fn [i] (map :id (nth lines i))) (range 0 (count lines)))]
         result)
       [])))
+
+(fg/defevolverfn simple-focus-traversal-order-evolver :focus-traversal-order
+  (let [reason (fg/get-reason)]
+    (if (or (nil? reason) (= reason [:this]))
+      (focus-traversal-order-evolver component)
+      old-focus-traversal-order)))

 (fg/defaccessorfn get-child-ids-in-traversal-order [component]
   (if-let [focus-traversal-order (get-property component [:this] :focus-traversal-order)]


RR: pass optional external app-state

RR: pass optional external app-state

--- src/hatti/shared.cljs
+++ src/hatti/shared.cljs
@@ -103,25 +103,28 @@

 (defn maybe-merge-languages!
   "Merge languages into the app-state if form is multilingual"
-  [form]
+  [form & [state]]
   (when (f/multilingual? form)
     (let [langs (f/get-languages form)
           default-lang (f/default-lang langs)
           lang-state {:all langs
                       :default default-lang
                       :current default-lang}]
-      (merge-into-app-state! app-state [:languages] lang-state))))
+      (merge-into-app-state!
+       (or state app-state)
+       [:languages] lang-state))))

-(defn language-cursor []
-  (om/ref-cursor (:languages (om/root-cursor app-state))))
+(defn language-cursor [& [state]]
+  (om/ref-cursor (:languages (om/root-cursor (or state app-state)))))

 (defn language-selector
   "A language selector and a following divider."
-  [_ owner]
+  [_ owner {:keys [app-state]}]
   (reify
     om/IRender
     (render [_]
-      (let [{:keys [current all] :as ls} (om/observe owner (language-cursor))
+      (let [{:keys [current all] :as ls}
+            (om/observe owner (language-cursor app-state))
             get-update-handler (fn [language]
                                  (fn [event]
                                    (om/update! ls [:current] language)


Fix small bug introduced in output-collector

--- src/angelic/search/implicit/fah_astar_eval2.clj
+++ src/angelic/search/implicit/fah_astar_eval2.clj
@@ -46,16 +46,12 @@

 ;; TODO: add options to search alg.

-;; TODO: update subproblems the same way as stubs -- call summary-changed-local if
-;;   -- call summary-changed-local if passed on,
-;;   -- or summary-changed! if absorbed.
-
 (set! *warn-on-reflection* true)

-(def *no-identical-nonterminal-outputs* true)
-(def *decompose-cache*     true) ;; nil for none, or bind to hashmap
-(def *state-abstraction*   :eager #_ :deliberate) ;; Or lazy or nil.
+(def *no-identical-nonterminal-outputs* false)
+(def *decompose-cache*     nil #_ true) ;; nil for none, or bind to hashmap
+(def *state-abstraction*   nil #_ :eager #_ :deliberate) ;; Or lazy or nil.

 (assert (contains? #{nil :eager :deliberate} *state-abstraction*))
 (when *state-abstraction* (assert *decompose-cache*))
@@ -266,7 +262,8 @@
   (let [ts  (tree-summarizer inner-sp)
         ret (traits/reify-traits
              [(simple-subproblem stb (output-set inner-sp) ts false
-                                 #(doto (refine-input inner-sp %2) (-> stub-name first #{:SA :OS} assert)))]
+                                 #(doto (if (= (input-set stb) %2) stb (refine-input inner-sp %2)) ;Needed when SA off
+                                    (-> stub-name first #{:SA :OS} assert)))]
              summaries/Summarizable (summarize [s] (summaries/or-summary s (top-down-bound ts))))]
     (connect-and-watch! ret inner-sp
       (fn child-watch [o]


Fix syntax error in core.clj

Fix syntax error in core.clj

--- src/clojure/leiningen/new/quil_clojure/core.clj
+++ src/clojure/leiningen/new/quil_clojure/core.clj
@@ -2,12 +2,12 @@
   (:require [quil.core :refer :all]))

 (defn setup []
-  (smooth)
-  (fill (random 0 255) (random 0 255) (random 0 255)))
+  (smooth))

 (defn draw []
   (background 255)
-   (ellipse 100 100 30 30))
+  (fill 192)
+  (ellipse 100 100 30 30))

 (defsketch example
   :title "Example"


Blockchain now accepts stores other than the account ones

--- src/freecoin/core.clj
+++ src/freecoin/core.clj
@@ -179,7 +179,8 @@
       (let [config-m           (config/create-config)
             stores-m           (merge (db/create-freecoin-stores db {})
                                       (auth-db/create-auth-stores db {:ttl-password-recovery (config/ttl-password-recovery config-m)}))
-            blockchain         (blockchain/new-mongo stores-m)
+            blockchain         (blockchain/new-mongo (select-keys stores-m [:transaction-store :wallet-store
+                                                                            :confirmation-store :tag-store]))
             email-conf         (clojure.edn/read-string (slurp (:email-config config-m)))
             account-activator    (just-auth.messaging/->AccountActivator email-conf (:account-store stores-m))
             password-recoverer (just-auth.messaging/->PasswordRecoverer email-conf (:password-recovery-store stores-m))
@@ -224,7 +225,8 @@
                        stores-m           (db/create-freecoin-stores
                                            db
                                            {:ttl-password-recovery (config/ttl-password-recovery config-m)})
-                       blockchain         (blockchain/new-mongo stores-m)
+                       blockchain         (blockchain/new-mongo (select-keys stores-m [:transaction-store :wallet-store
+                                                                                :confirmation-store :tag-store]))
                        account-activator (just-auth.messaging/->AccountActivator email-conf (:account-store stores-m))
                        password-recoverer (just-auth.messaging/->PasswordRecoverer email-conf (:password-recovery-store stores-m))
                        email-authenticator (just-auth.core/new-email-based-authentication


switch filter parser tests to expectations

--- ssclj/jar/src/test/clojure/com/sixsq/slipstream/ssclj/filter/parser_test.clj
+++ ssclj/jar/src/test/clojure/com/sixsq/slipstream/ssclj/filter/parser_test.clj
@@ -2,97 +2,101 @@
   (:require
     [com.sixsq.slipstream.ssclj.filter.parser :refer :all]
     [instaparse.core :as insta]
-    [clojure.test :refer [deftest is are]]))
+    [expectations :refer :all]))

-(deftest check-valid-double-quote-strings
-  (let [parse (insta/parser filter-grammar-url :start :DoubleQuoteString)]
-    (are [s] (not (insta/failure? (parse s)))
-             "\"\""
-             "\"a\""
-             "\"a1\""
-             "\"\\\"a\""
-             "\"a\\\"\""
-             "\"a\\\"a\"")))
+(defn fails-fn
+  "Provides a function that will parse a string from the given point
+  in the grammar and returns a truthy value if the parsing failed."
+  [start]
+  (let [parser (insta/parser filter-grammar-url :start start)]
+    (fn [s]
+      (insta/failure? (parser s)))))

-(deftest check-valid-single-quote-strings
-  (let [parse (insta/parser filter-grammar-url :start :SingleQuoteString)]
-    (are [s] (not (insta/failure? (parse s)))
-             "''"
-             "'a'"
-             "'a1'"
-             "'\\'a'"
-             "'a\\''"
-             "'a\\'a'")))
+(defn passes-fn
+  [start]
+  (let [fails (fails-fn start)]
+    (fn [s]
+      (not (fails s)))))

-(deftest check-valid-dates
-  (let [parse (insta/parser filter-grammar-url :start :DateValue)]
-    (are [date] (not (insta/failure? (parse date)))
-                "2012-01-02"
-                "2012-01-02T13:14:25Z"
-                "2012-01-02T13:14:25.6Z"
-                "2012-01-02T13:14:25-01:15"
-                "2012-01-02T13:14:25.6-01:15"
-                "2012-01-02T13:14:25+02:30"
-                "2012-01-02T13:14:25.6+02:30")))
+;; valid double quoted strings
+(let [passes (passes-fn :DoubleQuoteString)]
+  (expect passes "\"\"")
+  (expect passes "\"a\"")
+  (expect passes "\"a1\"")
+  (expect passes "\"\\\"a\"")
+  (expect passes "\"a\\\"\"")
+  (expect passes "\"a\\\"a\""))

-(deftest check-invalid-dates
-  (let [parse (insta/parser filter-grammar-url :start :DateValue)]
-    (are [date] (insta/failure? (parse date))
-                "2012"
-                "2012-01-99T13:14:25.6ZZ"
-                "2012-01-02T13:14:25.6Q"
-                "2012-01:02T25:14:25.6-01:15"
-                "2012-01-02T13:14:25.6+02-30")))
+;; valid single quoted strings
+(let [passes (passes-fn :SingleQuoteString)]
+  (expect passes "''")
+  (expect passes "'a'")
+  (expect passes "'a1'")
+  (expect passes "'\\'a'")
+  (expect passes "'a\\''")
+  (expect passes "'a\\'a'"))

-(deftest check-valid-filters
-  (let [parse (insta/parser filter-grammar-url)]
-    (are [filter] (not (insta/failure? (parse filter)))
-                  "alpha=3"
-                  "3=alpha"
-                  "alpha=3 and beta=4"
-                  "3=alpha and 4=beta"
-                  "(alpha=3)"
-                  "(3=alpha)"
-                  "property['beta']='4'"
-                  "property['beta']!='4'"
-                  "property['beta']<'4'" ;; strictly this should be illegal
-                  "alpha=3 and beta=4"
-                  "alpha=3 or beta=4"
-                  "alpha=3 and beta=4 or gamma=5 and delta=6"
-                  "alpha=3 and (beta=4 or gamma=5) and delta=6")))
+;; valid dates
+(let [passes (passes-fn :DateValue)]
+  (expect passes "2012-01-02")
+  (expect passes "2012-01-02T13:14:25Z")
+  (expect passes "2012-01-02T13:14:25.6Z")
+  (expect passes "2012-01-02T13:14:25-01:15")
+  (expect passes "2012-01-02T13:14:25.6-01:15")
+  (expect passes "2012-01-02T13:14:25+02:30")
+  (expect passes "2012-01-02T13:14:25.6+02:30"))

-(deftest check-invalid-filters
-  (let [parse (insta/parser filter-grammar-url)]
-    (are [filter] (insta/failure? (parse filter))
-                  ""
-                  "()"
-                  "alpha=beta"
-                  "alpha=3.2"
-                  "alpha&&4"
-                  "property[beta]='4'"
-                  "property['beta']=4"
-                  "4=property['beta']")))
+;; invalid dates
+(let [fails (fails-fn :DateValue)]
+  (expect fails "2012")
+  (expect fails "2012-01-99T13:14:25.6ZZ")
+  (expect fails "2012-01-02T13:14:25.6Q")
+  (expect fails "2012-01:02T25:14:25.6-01:15")
+  (expect fails "2012-01-02T13:14:25.6+02-30"))

-(deftest check-valid-attributes
-  (let [parse (insta/parser filter-grammar-url :start :Attribute)]
-    (are [filter] (not (insta/failure? (parse filter)))
-                  "a"
-                  "alpha"
-                  "alpha123"
-                  "a1"
-                  "_a"
-                  "_1"
-                  "a1/b2"
-                  "a1/b2/c3")))
+;; valid filters
+(let [passes (passes-fn :Filter)]
+  (expect passes "alpha=3")
+  (expect passes "3=alpha")
+  (expect passes "alpha=3 and beta=4")
+  (expect passes "3=alpha and 4=beta")
+  (expect passes "(alpha=3)")
+  (expect passes "(3=alpha)")
+  (expect passes "property['beta']='4'")
+  (expect passes "property['beta']!='4'")
+  (expect passes "property['beta']<'4'")                    ;; strictly this should be illegal
+  (expect passes "alpha=3 and beta=4")
+  (expect passes "alpha=3 or beta=4")
+  (expect passes "alpha=3 and beta=4 or gamma=5 and delta=6")
+  (expect passes "alpha=3 and (beta=4 or gamma=5) and delta=6"))

-(deftest check-invalid-attributes
-  (let [parse (insta/parser filter-grammar-url :start :Attribute)]
-    (are [filter] (insta/failure? (parse filter))
-                  ""
-                  "1"
-                  "1a"
-                  "a1/"
-                  "/a1"
-                  "a/1")))
+;; invalid filters
+(let [fails (fails-fn :Filter)]
+  (expect fails "")
+  (expect fails "()")
+  (expect fails "alpha=beta")
+  (expect fails "alpha=3.2")
+  (expect fails "alpha&&4")
+  (expect fails "property[beta]='4'")
+  (expect fails "property['beta']=4")
+  (expect fails "4=property['beta']"))

+;; valid attributes
+(let [passes (passes-fn :Attribute)]
+  (expect passes "a")
+  (expect passes "alpha")
+  (expect passes "alpha123")
+  (expect passes "a1")
+  (expect passes "_a")
+  (expect passes "_1")
+  (expect passes "a1/b2")                                   ;; hierarchical attributes are an extension of the spec
+  (expect passes "a1/b2/c3"))

+;; invalid attributes
+(let [fails (fails-fn :Attribute)]
+  (expect fails "")
+  (expect fails "1")
+  (expect fails "1a")
+  (expect fails "a1/")
+  (expect fails "/a1")
+  (expect fails "a/1"))


Define config/get-in.

Define config/get-in.

--- src/incise/config.clj
+++ src/incise/config.clj
@@ -4,7 +4,7 @@
             [pallet.map-merge :refer [merge-keys]]
             [manners.victorian :refer [defmannerisms]])
   (:import [java.io PushbackReader])
-  (:refer-clojure :exclude [reset! load assoc! get]))
+  (:refer-clojure :exclude [reset! load assoc! get get-in]))

 (def ^:private default-config
   {:parse-defaults {:layout :base
@@ -22,6 +22,9 @@
   (if (empty? more)
     @config
     (apply @config more)))
+
+(defn get-in [& more]
+  (apply clojure.core/get-in @config more))

 (defn merge! [& more]
   (apply swap! config