added example form

added example form

--- src/latte/core.clj
+++ src/latte/core.clj
@@ -63,13 +63,16 @@
                                                              :arglists (list (quote ~params)))))
                [:defined :term (quote ~def-name)])))))))

+(defn parse-parameters [def-env params]
+  (reduce (fn [[sts params] [x ty]]
+            (let [[status ty] (stx/parse-term def-env ty)]
+              (if (= status :ko)
+                (reduced [:ko ty])
+                [:ok (conj params [x ty])]))) [:ok []] params))
+
 (defn handle-term-definition [def-name params body]
   ;; parse parameters
-  (let [[status params] (reduce (fn [[sts params] [x ty]]
-                                  (let [[status ty] (stx/parse-term defenv/empty-env ty)]
-                                    (if (= status :ko)
-                                      (reduced [:ko ty])
-                                      [:ok (conj params [x ty])]))) [:ok []] params)]
+  (let [[status params] (parse-parameters defenv/empty-env params)]
     (if (= status :ko)
       [:ko params]
       (let [[status body-term] (stx/parse-term defenv/empty-env body)]
@@ -160,11 +163,7 @@
         [:ok thm-name definition metadata]))))

 (defn handle-thm-declaration [thm-name params ty]
-  (let [[status params] (reduce (fn [[_ params] [x ty]]
-                                  (let [[status ty'] (stx/parse-term defenv/empty-env ty)]
-                                    (if (= status :ko)
-                                      (reduced [:ko ty'])
-                                      [:ok (conj params [x ty'])]))) [:ok []] params)]
+  (let [[status params] (parse-parameters defenv/empty-env params)]
     (if (= status :ko)
       [:ko params]
       (let [[status ty'] (stx/parse-term defenv/empty-env ty)]
@@ -229,11 +228,7 @@
         [:ok ax-name definition metadata]))))

 (defn handle-ax-declaration [ax-name params ty]
-  (let [[status params] (reduce (fn [[_ params] [x ty]]
-                                  (let [[status ty'] (stx/parse-term defenv/empty-env ty)]
-                                    (if (= status :ko)
-                                      (reduced [:ko ty'])
-                                      [:ok (conj params [x ty'])]))) [:ok []] params)]
+  (let [[status params] (parse-parameters defenv/empty-env params)]
     (if (= status :ko)
       [:ko params]
       (let [[status ty'] (stx/parse-term defenv/empty-env ty)]
@@ -242,7 +237,6 @@
           (if (not (ty/proper-type? defenv/empty-env params ty'))
             [:ko {:msg "Axiom body is not a proper type" :axiom ax-name :type ty'}]
             [:ok (defenv/->Axiom ax-name params (count params) ty')]))))))
-

 ;;{
 ;; ## Proofs
@@ -339,6 +333,50 @@

 ;;{
+;; ## Examples
+;;
+;; Examples allow to check propositions at the top-level. They are like unrecorded theorems with proofs.
+;;
+;;}
+
+(s/def ::example (s/cat :params ::def-params
+                        :body ::def-body
+                        :method #{:script :term}
+                        :steps (s/+ any?)))
+
+(declare handle-example-thm)
+
+(defmacro example
+  "An example of the form `(example T <method> <steps>)` is the statement of a proposition, as a type `T`,
+as well as a proof. The proof method is either `:script` (declarative proof script) or `:term` (proof term)."
+  [& args]
+  (let [conf-form (s/conform ::example args)]
+    (if (= conf-form :clojure.spec.alpha/invalid)
+      (throw (ex-info "Syntax error in example."
+                      {:explain (s/explain-str ::example args)}))
+      (let [{params :params body :body method :method steps :steps} conf-form
+            [status thm] (handle-example-thm params body)]
+        (if (= status :ko)
+          (throw (ex-info "Cannot check example." thm))
+          (let [[status infos] (p/check-proof defenv/empty-env (reverse (:params thm)) (:name thm) (:type thm) method steps)]
+            (if (= status :ko)
+              (do ;; (println "infos = " infos)
+                (throw (ex-info (str "Proof failed: " (:msg infos)) (dissoc infos :msg))))
+              `(do
+                 [:checked :example]))))))))
+
+(defn handle-example-thm [params ty]
+  (let [[status params] (parse-parameters defenv/empty-env params)]
+    (if (= status :ko)
+      [:ko params]
+      (let [[status ty'] (stx/parse-term defenv/empty-env ty)]
+        (if (= status :ko)
+          [:ko ty']
+          (if (not (ty/proper-type? defenv/empty-env params ty'))
+            [:ko {:msg "Example body is not a proper type" :type ty'}]
+            [:ok (defenv/->Theorem (gensym "example") params (count params) ty' false)]))))))
+
+;;{
 ;; ## Implicits
 ;;}


better doc

better doc

--- src/latte/core.clj
+++ src/latte/core.clj
@@ -46,7 +46,7 @@
   (str "\n"
        (with-out-str
          (pp/pprint content))
-       "\n(" kind ")"
+       "\n**" kind "**"
        "\n\n"
        explanation))

@@ -75,7 +75,7 @@
         `(do
            (def ~def-name ~quoted-def#)
            (alter-meta! (var ~def-name)  (fn [m#] (assoc m#
-                                                         :doc (mk-doc "definition" (quote ~body) ~doc)
+                                                         :doc (mk-doc "Definition" (quote ~body) ~doc)
                                                          :arglists (list (quote ~params)))))
            [:defined :term (quote ~def-name)])))))

@@ -120,7 +120,7 @@
       `(do
          (def ~def-name ~quoted-def#)
          (alter-meta! (var ~def-name)  (fn [m#] (assoc m#
-                                                       :doc (mk-doc "theorem" (quote ~ty) ~doc)
+                                                       :doc (mk-doc "Theorem" (quote ~ty) ~doc)
                                                        :arglists (list (quote ~params)))))
          [:declared :theorem (quote ~def-name)]))))

@@ -165,7 +165,7 @@
       `(do
          (def ~def-name ~quoted-def#)
          (alter-meta! (var ~def-name)  (fn [m#] (assoc m#
-                                                       :doc (mk-doc "axiom" (quote ~ty) ~doc)
+                                                       :doc (mk-doc "Axiom" (quote ~ty) ~doc)
                                                        :arglists (list (quote ~params)))))
          [:declared :axiom (quote ~def-name)]))))


Add capability for nested gets

Add capability for nested gets

--- src/aerobio/params.clj
+++ src/aerobio/params.clj
@@ -8,7 +8,8 @@
 (defn param-set [] @params)

 (defn get-params [& ks]
-  (if (= 1 (count ks))
-    (@params (first ks))
-    (mapv @params ks)))
+  (cond
+    (and (= 1 (count ks)) (vector? (first ks))) (get-in @params (first ks))
+    (= 1 (count ks)) (@params (first ks))
+    :else (mapv @params ks)))


Add job database support; better error msg for future failures via future+


CMR-3676 Update version migration for consistency

--- umm-spec-lib/src/cmr/umm_spec/migration/version_migration.clj
+++ umm-spec-lib/src/cmr/umm_spec/migration/version_migration.clj
@@ -180,7 +180,7 @@
   [c]
   (if-let [doi-obj (some :DOI (:CollectionCitations c))]
     (-> c
-      (util/update-in-each [:CollectionCitations] dissoc :DOI)
+      (update-in-each [:CollectionCitations] dissoc :DOI)
       (assoc :DOI doi-obj))
     c))

@@ -189,7 +189,7 @@
   [c]
   (if-let [doi-obj (:DOI c)]
     (-> c
-      (util/update-in-each [:CollectionCitations] assoc :DOI doi-obj)
+      (update-in-each [:CollectionCitations] assoc :DOI doi-obj)
       (dissoc :DOI))
     c))


GAWB 1195 sort entity and workflowid column (#561)

* GAWB-1195 sort entity and workflowid

* GAWB-1195 sort entity and workflowid formatting

* improved syntax

--- src/cljs/org/broadinstitute/firecloud_ui/page/workspace/monitor/submission_details.cljs
+++ src/cljs/org/broadinstitute/firecloud_ui/page/workspace/monitor/submission_details.cljs
@@ -40,9 +40,8 @@
       {:empty-message "No Workflows"
        :columns [{:header "Data Entity" :starting-width 200
                   :as-text
-                  (fn [workflow]
-                    (let [entity (workflow "workflowEntity")]
-                      (str (entity "entityName") " (" (entity "entityType") ")")))
+                  (fn [workflow] (get-in workflow ["workflowEntity" "entityName"]))
+                  :sort-by :text
                   :content-renderer
                   (fn [workflow]
                     (let [entity (workflow "workflowEntity")
@@ -65,6 +64,9 @@
                                               [:div {} message])
                                          message-list)])}
                  {:header "Workflow ID" :starting-width 300
+                  :as-text
+                    (fn [workflow] (workflow "workflowId"))
+                  :sort-by :text
                   :content-renderer
                   (fn [workflow]
                    (let [{:keys [submission-id bucketName]} props


clean up (defn generate)

clean up (defn generate)

--- src/babel/espanol.cljc
+++ src/babel/espanol.cljc
@@ -50,17 +50,16 @@

 (defn generate
   [spec & {:keys [max-total-depth model truncate-children]
-           :or {model (medium)
-                max-total-depth generate/max-total-depth
+           :or {max-total-depth generate/max-total-depth
+                model (medium)
                 truncate-children true}}]
   (log/debug (str "generating with spec: " (strip-refs spec) " with max-total-depth: " max-total-depth))
-  (let [model (if model model (medium))]
-    (let [result (generate/generate spec model
-                                    :max-total-depth max-total-depth
-                                    :truncate-children truncate-children)]
-      (if result
-        (conj {:surface (fo result)}
-              result)))))
+  (let [result (generate/generate spec model
+                                  :max-total-depth max-total-depth
+                                  :truncate-children truncate-children)]
+    (if result
+      (conj {:surface (fo result)}
+            result))))

 (defn preprocess [input]
   "arbitrary regexp replacements to convert Spanish orthography into a parsable whitespace-delimited expression"


CMR-2061: Added DIF9 collection entry-id update test.

--- system-int-test/test/cmr/system_int_test/ingest/collection_ingest_test.clj
+++ system-int-test/test/cmr/system_int_test/ingest/collection_ingest_test.clj
@@ -225,13 +225,28 @@
                                     :short-name "EID-1"
                                     :entry-title "ET-1"
                                     :native-id "NID-1"})
-        coll1-2 (assoc-in coll1-1 [:product :short-name] "EID-2")]
-    (d/ingest "PROV1" coll1-1 {:format :dif})
+        coll1-2 (assoc-in coll1-1 [:product :short-name] "EID-2")
+        coll1-3 (dc/collection-dif {:concept-id "C3-PROV1"
+                                    :short-name "EID-3"
+                                    :entry-title "ET-3"
+                                    :native-id "NID-3"})
+        coll1-4 (assoc-in coll1-3 [:product :short-name] "EID-4")
+        ;; ingest the collections/granules for test
+        _ (d/ingest "PROV1" coll1-1 {:format :dif})
+        coll3 (d/ingest "PROV1" coll1-3 {:format :dif})
+        gran1 (d/ingest "PROV1" (dg/granule coll3 {:granule-ur "Granule1"}))
+        gran2 (d/ingest "PROV1" (dg/granule coll3 {:granule-ur "Granule2"}))]
+    (index/wait-until-indexed)

     (testing "update the collection with a different entry-id is OK"
       (let [{:keys [status concept-id revision-id errors]}
             (d/ingest "PROV1" coll1-2 {:format :dif})]
         (is (= ["C1-PROV1" 2 200 nil] [concept-id revision-id status errors]))))
+
+    (testing "update the collection that has granules with a different entry-id is invalid"
+      (let [{:keys [status errors]} (d/ingest "PROV1" coll1-4 {:format :dif :allow-failure? true})]
+        (is (= [422 ["Collection with short-name [EID-3] & version-id [Not provided] is referenced by existing granules, cannot be renamed. Found 2 granules."]]
+               [status errors]))))

     (testing "ingest collection with entry-id used by a different collection latest revision within the same provider is invalid"
       (let [{:keys [status errors]} (d/ingest "PROV1"
@@ -256,10 +271,9 @@
     (testing "entry-id and entry-title constraint violations return multiple errors"
       (let [{:keys [status errors]} (d/ingest "PROV1"
                                               (assoc coll1-2
-                                                     :concept-id "C3-PROV1"
-                                                     :native-id "NID-3")
+                                                     :concept-id "C5-PROV1"
+                                                     :native-id "NID-5")
                                               {:format :dif :allow-failure? true})]
-
         (is (= [409 ["The Entry Title [ET-1] must be unique. The following concepts with the same entry title were found: [C1-PROV1]."
                      "The Entry Id [EID-2] must be unique. The following concepts with the same entry id were found: [C1-PROV1]."]]
                [status errors]))))
@@ -391,7 +405,7 @@
     (is (= 200 (:status coll-del1)))
     (is (= 404 (:status coll-del2)))
     (is (= [(format "Concept with native-id [%s] and concept-id [%s] is already deleted."
-                   native-id concept-id)]
+                    native-id concept-id)]
            (:errors coll-del2)))
     (is (= 5 (:revision-id coll-del1)))
     (index/wait-until-indexed)


CMR-3926 more test formatting changes

CMR-3926 more test formatting changes

--- system-int-test/test/cmr/system_int_test/ingest/collection_update_test.clj
+++ system-int-test/test/cmr/system_int_test/ingest/collection_update_test.clj
@@ -857,32 +857,32 @@
     (index/wait-until-indexed)
     (testing "Update collection successful cases"
       (are3
-       [plat-instruments-1 plat-instruments-2]
-       (let [response (d/ingest-umm-spec-collection "PROV1" (data-umm-c/collection
-                                                             {:EntryTitle "parent-collection"
-                                                              :ShortName "S1"
-                                                              :Version "V1"
-                                                              :Platforms [(apply data-umm-c/platform-with-instruments plat-instruments-1)
-                                                                          (apply data-umm-c/platform-with-instruments plat-instruments-2)]}))
-             {:keys [status errors]} response]
-         (is (= [200 nil] [status errors])))
-
-       "Removing an instrument referenced by granules is invalid once hierarchical search is supported.
-         Currently it's okay if it exists under other platforms."
-       ["p1-1" "i2" "GPS" "i4"]
-       ["p1-2" "i1" "i2" "GPS" "i4"]
-
-       "Adding an additional instrument is OK"
-       ["p1-1" "i1" "i2" "GPS" "i4" "i5"]
-       ["p1-2" "i1" "i2" "GPS" "i4" "i5"]
-
-       "Removing an instrument not referenced by any granule in the collection is OK"
-       ["p1-1" "i1" "i2" "GPS"]
-       ["p1-2" "i1" "i2" "GPS"]
-
-       "Updating an instrument  to humanized alias(case insensitively) referenced by granule on the original value is OK"
-       ["p1-1" "i1" "i2" "Gps Receivers"]
-       ["p1-2" "i1" "i2" "Gps Receivers"]))
+        [plat-instruments-1 plat-instruments-2]
+        (let [response (d/ingest-umm-spec-collection "PROV1" (data-umm-c/collection
+                                                              {:EntryTitle "parent-collection"
+                                                                :ShortName "S1"
+                                                                :Version "V1"
+                                                                :Platforms [(apply data-umm-c/platform-with-instruments plat-instruments-1)
+                                                                            (apply data-umm-c/platform-with-instruments plat-instruments-2)]}))
+              {:keys [status errors]} response]
+          (is (= [200 nil] [status errors])))
+
+        "Removing an instrument referenced by granules is invalid once hierarchical search is supported.
+          Currently it's okay if it exists under other platforms."
+        ["p1-1" "i2" "GPS" "i4"]
+        ["p1-2" "i1" "i2" "GPS" "i4"]
+
+        "Adding an additional instrument is OK"
+        ["p1-1" "i1" "i2" "GPS" "i4" "i5"]
+        ["p1-2" "i1" "i2" "GPS" "i4" "i5"]
+
+        "Removing an instrument not referenced by any granule in the collection is OK"
+        ["p1-1" "i1" "i2" "GPS"]
+        ["p1-2" "i1" "i2" "GPS"]
+
+        "Updating an instrument  to humanized alias(case insensitively) referenced by granule on the original value is OK"
+        ["p1-1" "i1" "i2" "Gps Receivers"]
+        ["p1-2" "i1" "i2" "Gps Receivers"]))

     (testing "Update collection failure cases"
       (are3


Add a function to cancel

Add a function to cancel

--- src/beehive/future.clj
+++ src/beehive/future.clj
@@ -51,7 +51,7 @@
       :timeout? (identical? :timeout (status (.getStatus future)))
       :error? (identical? :error (status (.getStatus future)))
       :pending? (identical? :pending (status (.getStatus future)))
-      :cancelled (identical? :cancelled (status (.getStatus future)))
+      :cancelled? (identical? :cancelled (status (.getStatus future)))
       :result (.result future)
       :error (.error future)
       :rejected? false
@@ -82,4 +82,7 @@
    RejectionReason/ALL_SERVICES_REJECTED :all-services-rejected})

 (defn rejected-action-future [reason]
-  (->CLJRejectedFuture (get reject-enum->keyword reason)))+  (->CLJRejectedFuture (get reject-enum->keyword reason)))
+
+(defn cancel [^CLJResilientFuture f]
+  (.cancel ^PrecipiceFuture (.future f) true))


Refactoring mime type definitions to avoid build failures.

--- common-lib/src/cmr/common/mime_types.clj
+++ common-lib/src/cmr/common/mime_types.clj
@@ -8,52 +8,46 @@
             [cmr.common.services.errors :as svc-errors]
             [ring.middleware.format-response :as fr]))

-;; (note: these maps will be populated as MIME types are declared)
+(def mime-types
+  "Defines a map of mime type format keywords to mime types and other format aliases. Each one of these
+   gas a var defined for it for easy access."
+  {:json {:mime-type "application/json"}
+   :xml {:mime-type "application/xml"}
+   :echo10 {:mime-type "application/echo10+xml"}
+   :iso-smap {:mime-type "application/iso:smap+xml"
+              :aliases [:iso_smap]}
+   :iso19115 {:mime-type "application/iso19115+xml"
+         :aliases [:iso]}
+   :dif {:mime-type "application/dif+xml"}
+   :dif10 {:mime-type "application/dif10+xml"}
+   :csv {:mime-type "text/csv"}
+   :atom {:mime-type  "application/atom+xml"}
+   :kml {:mime-type "application/vnd.google-earth.kml+xml"}
+   :opendata {:mime-type "application/opendata+json"}
+   :native {:mime-type "application/metadata+xml"}})
+
+;; Define vars for each of the mime type formats
+(doseq [[format-kw {:keys [mime-type]}] mime-types]
+  (eval `(def ~(symbol (name format-kw)) ~mime-type)))
+
+(def iso
+  "Defines a shorter alias for iso19115."
+  iso19115)
+
+(def any "*/*")

 (def base-mime-type-to-format
   "A map of MIME type strings to CMR data format keywords."
-  {})
+  (into {} (for [[format-kw {:keys [mime-type]}] mime-types]
+             [mime-type format-kw])))

 (def format->mime-type
   "A map of CMR data format keywords to MIME type strings."
-  {})
-
-;; Supported MIME types
-
-(defmacro defmimetype
-  "An elegant DSL for crafting beautiful mime-type definitions."
-  [name string format-kw & format-aliases]
-  (alter-var-root #'base-mime-type-to-format assoc string format-kw)
-  (doseq [kw (conj format-aliases format-kw)]
-    (alter-var-root #'format->mime-type assoc kw string))
-  `(def ~name ~string))
-
-(defmimetype json "application/json" :json)
-
-(defmimetype xml "application/xml" :xml)
-
-(defmimetype echo10 "application/echo10+xml" :echo10)
-
-(defmimetype iso-smap "application/iso:smap+xml" :iso-smap :iso_smap)
-
-(defmimetype iso "application/iso19115+xml" :iso19115 :iso)
-
-(defmimetype dif "application/dif+xml" :dif)
-
-(defmimetype dif10 "application/dif10+xml" :dif10)
-
-(defmimetype csv "text/csv" :csv)
-
-(defmimetype atom  "application/atom+xml" :atom)
-
-(defmimetype kml "application/vnd.google-earth.kml+xml" :kml)
-
-(defmimetype opendata "application/opendata+json" :opendata)
-
-(defmimetype native "application/metadata+xml" :native)
-
-(def any "*/*")
-
+  (into {} (mapcat (fn [[format-kw {:keys [mime-type aliases]}]]
+                     (cons [format-kw mime-type]
+                            (for [a aliases]
+                              [a mime-type])))
+                   mime-types)))
 ;; extra helpers

 (def all-supported-mime-types
@@ -90,7 +84,7 @@
   audio/*; q=0.2, audio/basic

   \"SHOULD be interpreted as \"I prefer audio/basic, but send me any audio
-   type if it is the best available after an 80% mark-down in quality.\"\"
+  type if it is the best available after an 80% mark-down in quality.\"\"

   This function will return [\"audio/basic\" \"audio/*\"]


Expose tick.core/parse to API

Expose tick.core/parse to API

--- src/tick/alpha/api.clj
+++ src/tick/alpha/api.clj
@@ -119,6 +119,10 @@
 (def UTC (zone "UTC"))
 (def LONDON (zone "Europe/London"))

+;; Parsing
+
+(def parse core/parse)
+
 ;; Arithmetic

 (defn +


Test sending multiple msgs from client to server.

--- src/cbfg/net-test.cljs
+++ src/cbfg/net-test.cljs
@@ -84,7 +84,7 @@
                               (do (aclose tn listen-ch)
                                   (aclose tn connect-ch)
                                   (e n (atake tn net) :done (atake tn net))))))))
-              ; Try sending msgs between client and server.
+              ; Try sending 1 msg between client and server and vice-versa.
               (let [listen-ch (achan tn)
                     connect-ch (achan tn)
                     net (make-net tn listen-ch connect-ch)
@@ -96,19 +96,22 @@
                        (e n (atake tn listen-result-ch) nil nil)
                        (let [connect-result-ch (achan tn)]
                          (aput tn connect-ch [:addr-a 1000 :addr-x connect-result-ch])
-                         (let [[client-send-ch client-recv-ch close-client-recv-ch] (atake tn connect-result-ch)]
+                         (let [[client-send-ch client-recv-ch close-client-recv-ch]
+                               (atake tn connect-result-ch)]
                            (and (e n (not (nil? client-send-ch)) true nil)
                                 (e n (not (nil? client-recv-ch)) true nil)
                                 (e n (not (nil? close-client-recv-ch)) true nil)
                                 (e n (atake tn connect-result-ch) nil nil)
-                                (let [[server-send-ch server-recv-ch close-server-recv-ch] (atake tn accept-ch)]
+                                (let [[server-send-ch server-recv-ch close-server-recv-ch]
+                                      (atake tn accept-ch)]
                                   (and (e n (not (nil? server-send-ch)) true nil)
                                        (e n (not (nil? server-recv-ch)) true nil)
                                        (e n (not (nil? close-server-recv-ch)) true nil)
                                        (do (aput tn client-send-ch [:hi-from-client])
                                            (and (e n (atake tn server-recv-ch) :hi-from-client nil)
                                                 (do (aput tn server-send-ch [:hi-from-server])
-                                                    (and (e n (atake tn client-recv-ch) :hi-from-server nil)
+                                                    (and (e n (atake tn client-recv-ch)
+                                                            :hi-from-server nil)
                                                          (do (aclose tn close-server-recv-ch)
                                                              (aclose tn close-client-recv-ch)
                                                              (aclose tn server-send-ch)
@@ -117,7 +120,52 @@
                                                              (e n (atake tn client-recv-ch) nil nil)
                                                              (aclose tn listen-ch)
                                                              (aclose tn connect-ch)
-                                                             (e n (atake tn net) :done (atake tn net))))))))))))))))
+                                                             (e n (atake tn net)
+                                                                :done
+                                                                (atake tn net)))))))))))))))
+              ; Try sending multiple msgs between client to server.
+              (let [listen-ch (achan tn)
+                    connect-ch (achan tn)
+                    net (make-net tn listen-ch connect-ch)
+                    listen-result-ch (achan tn)]
+                (aput tn listen-ch [:addr-a 1001 listen-result-ch])
+                (let [[close-accept-ch accept-ch] (atake tn listen-result-ch)]
+                  (and (e n (not (nil? close-accept-ch)) true nil)
+                       (e n (not (nil? accept-ch)) true nil)
+                       (e n (atake tn listen-result-ch) nil nil)
+                       (let [connect-result-ch (achan tn)]
+                         (aput tn connect-ch [:addr-a 1001 :addr-x connect-result-ch])
+                         (let [[client-send-ch client-recv-ch close-client-recv-ch]
+                               (atake tn connect-result-ch)]
+                           (and (e n (not (nil? client-send-ch)) true nil)
+                                (e n (not (nil? client-recv-ch)) true nil)
+                                (e n (not (nil? close-client-recv-ch)) true nil)
+                                (e n (atake tn connect-result-ch) nil nil)
+                                (let [[server-send-ch server-recv-ch close-server-recv-ch]
+                                      (atake tn accept-ch)]
+                                  (and (e n (not (nil? server-send-ch)) true nil)
+                                       (e n (not (nil? server-recv-ch)) true nil)
+                                       (e n (not (nil? close-server-recv-ch)) true nil)
+                                       (do (aput tn client-send-ch [:hi-from-client0])
+                                           (aput tn client-send-ch [:hi-from-client1])
+                                           (aput tn client-send-ch [:hi-from-client2])
+                                           (aput tn client-send-ch [:hi-from-client3])
+                                           (aclose tn client-send-ch)
+                                           (and (e n (atake tn server-recv-ch) :hi-from-client0 nil)
+                                                (e n (atake tn server-recv-ch) :hi-from-client1 nil)
+                                                (e n (atake tn server-recv-ch) :hi-from-client2 nil)
+                                                (e n (atake tn server-recv-ch) :hi-from-client3 nil)
+                                                (e n (atake tn server-recv-ch) nil nil)
+                                                (do (aclose tn close-server-recv-ch)
+                                                    (aclose tn close-client-recv-ch)
+                                                    (aclose tn server-send-ch)
+                                                    (e n (atake tn server-recv-ch) nil nil)
+                                                    (e n (atake tn client-recv-ch) nil nil)
+                                                    (aclose tn listen-ch)
+                                                    (aclose tn connect-ch)
+                                                    (e n (atake tn net)
+                                                       :done
+                                                       (atake tn net))))))))))))))
            "pass"
            (str "FAIL: on test-net #" @n)))))


Added wait-done.

Added wait-done.

--- src/cbfg/world/t1.cljs
+++ src/cbfg/world/t1.cljs
@@ -1,6 +1,6 @@
 (ns cbfg.world.t1
   (:require-macros [cljs.core.async.macros :refer [go-loop]]
-                   [cbfg.act :refer [act actx-top achan-buf]])
+                   [cbfg.act :refer [act actx-top achan achan-buf aput atake]])
   (:require [cljs.core.async :refer [<! >! close! chan timeout dropping-buffer]]
             [goog.dom :as gdom]
             [om.core :as om :include-macros true]
@@ -60,13 +60,14 @@
                   [21 :event [:a 21]]
                   [22 :event [:b 22]]]}))

-(def run-world (atom {:a 10}))
+(def run-world       (atom {:a 10}))
 (def run-world-hover (atom nil))

 ; -------------------------------------------------------------------

-(def curr-world (atom nil))
-(def curr-net (atom nil))
+(def curr-world (atom nil)) ; { :world => world-actx
+                            ;   :net-listen-ch => ch
+                            ;   :net-connect-ch => ch }

 ; -------------------------------------------------------------------

@@ -186,13 +187,13 @@
                   :chs {} ; {ch -> {:id (gen-id), :msgs {msg -> true},
                           ;         :first-taker-actx actx-or-nil}}.
                   :gen-id gen-id})]
-        (reset! curr-world {:world world})
-        (reset! curr-net {:net-listen-ch (achan-buf world 10)
-                          :net-connect-ch (achan-buf world 10)})
+        (reset! curr-world {:world world
+                            :net-listen-ch (achan-buf world 10)
+                            :net-connect-ch (achan-buf world 10)})
         (process-events vis event-delay event-ch step-ch render-ch)
         (make-net world
-                  (:net-listen-ch @curr-net)
-                  (:net-connect-ch @curr-net))
+                  (:net-listen-ch @curr-world)
+                  (:net-connect-ch @curr-world))
         (let [prog (get-el-value "prog")
               prog-js (str "with (cbfg.world.t1) {" prog "}")
               prog-res (try (js/eval prog-js) (catch js/Object ex ex))]
@@ -203,9 +204,28 @@

 ; --------------------------------------------

+(defn wait-done [done]
+  (loop []
+    (when (not @done)
+      (cljs.core.async.impl.dispatch/process-messages)
+      (recur))))
+
 (defn kv-server [name & ports]
-  (doseq [port ports]
-    (println :kv-server name port)))
+  (let [world (:world @curr-world)
+        done (atom false)]
+    (act server-init world
+         (doseq [port ports]
+           (println :kv-server name port)
+           (when-let [listen-result-ch (achan server-init)]
+             (aput server-init (:net-listen-ch @curr-world) [name port listen-result-ch])
+             (when-let [[accept-ch close-accept-ch] (atake server-init listen-result-ch)]
+               (cbfg.world.net/server-accept-loop world accept-ch close-accept-ch))))
+         (reset! done true))
+    (wait-done done)))

 (defn kv-client [name & ports]
-  (println :kv-client name ports))
+  (println :kv-client name ports)
+  (let [world (:world @curr-world)
+        done (atom false)]
+    ; TODO.
+    ))


Fix authentication? negogiation caused troubles once in a while with TLS

--- src/gamlor/rochla/guac_tunnel.clj
+++ src/gamlor/rochla/guac_tunnel.clj
@@ -32,7 +32,7 @@
       (.setParameter "port" "3389")
       (.setParameter "username" user)
       (.setParameter "password" password)
-      (.setParameter "security" "any")
+      (.setParameter "security" "nla")
       (.setParameter "ignore-cert" "true"))
     cfg)
   )


Prevent Out of Memory with large streams

This version caps the queue and prevent OOM and obviously uses much less memory.

My app that use some like:

  (doseq [group (partition resolution (kafka/messages consumer topic))

Where resolution is a value of ~60000

Without this patch the memory usage was constantly around ~4gb

After dealing with OOMs and inspecting all vm snapshots I come that the problem was in the pipe, I checked your code then the linked article and was confirmed (in one comment) with the same solution.

--- src/clj_kafka/core.clj
+++ src/clj_kafka/core.clj
@@ -39,15 +39,16 @@
    queue, and a function that inserts items into the queue.

    Source: http://clj-me.cgrand.net/2010/04/02/pipe-dreams-are-not-necessarily-made-of-promises/"
-  []
-  (let [q (LinkedBlockingQueue.)
-        EOQ (Object.)
-        NIL (Object.)
-        s (fn queue-seq []
-            (lazy-seq (let [x (.take q)]
-                        (when-not (= EOQ x)
-                          (cons (when-not (= NIL x) x)
-                                (queue-seq))))))]
-    [(s) (fn queue-put
-           ([] (.put q EOQ))
-           ([x] (.put q (or x NIL))))]))+  ([] (pipe 100))
+  ([size]
+   (let [q (java.util.concurrent.LinkedBlockingQueue. size)
+         EOQ (Object.)
+         NIL (Object.)
+         s (fn queue-seq [] (lazy-seq
+                              (let [x (.take q)]
+                                (when-not (= EOQ x)
+                                  (cons (when-not (= NIL x) x)
+                                        (queue-seq))))))]
+     [(s) (fn queue-put
+            ([] (.put q EOQ))
+            ([x] (.put q (or x NIL))))])))


Rename message to envelope

Rename message to envelope

--- src/tttclj/render.cljs
+++ src/tttclj/render.cljs
@@ -54,9 +54,9 @@
   (let [server-ch (<! (ws-ch "ws://localhost:8080/ws" {:format :edn}))
         container (.getElementById js/document "main")]
     (go-loop []
-      (when-let [msg (<! (:ws-channel server-ch))]
-        (q/render (Game (:message msg)) container)
-        (prn msg)
+      (when-let [envelope (<! (:ws-channel server-ch))]
+        (q/render (Game (:message envelope)) container)
+        (prn envelope)
         (recur)))
     (prn (str "cannot read from server-ch" server-ch "any more"))))


Add element-props and clone-element to manipulate quiescent element props

--- src/quiescent.cljs
+++ src/quiescent.cljs
@@ -124,3 +124,14 @@
   ([] (get-props *component*))
   ([component] [(aget (.-props component) "value")
                 (aget (.-props component) "statics")]))
+
+(defn element-props
+  "Get quescent props of an element."
+  [quiescent-react-element]
+  (aget (.-props quiescent-react-element) "value"))
+
+(defn clone-element
+  "Merge quiescent props into a quescient-react-element's props."
+  [quiescent-react-element quiescent-props]
+  (js/React.cloneElement quiescent-react-element
+    #js{:value (into (element-props quiescent-react-element) quiescent-props)}))


CMR-5848 Adds umm-json to possible virtual granules ingest formats.

--- virtual-product-app/src/cmr/virtual_product/services/virtual_product_service.clj
+++ virtual-product-app/src/cmr/virtual_product/services/virtual_product_service.clj
@@ -5,6 +5,7 @@
    [cmr.common.concepts :as concepts]
    [cmr.common.log :refer (debug info warn error)]
    [cmr.common.mime-types :as mime-types]
+   [cmr.common.mime-types :as mt]
    [cmr.common.services.errors :as errors]
    [cmr.common.util :as u :refer [defn-timed]]
    [cmr.message-queue.config :as queue-config]
@@ -121,9 +122,9 @@
   (let [provider-id (svm/provider-alias->provider-id provider-id)
         orig-concept (mdb/get-concept context concept-id revision-id)
         format (-> (:format orig-concept)
-                   mime-types/base-mime-type-of)
+                   mt/base-mime-type-of)
         ;; If the format is umm-json, we need to use umm-spec to parse the metadata into UMM.
-        orig-umm (if (= format mime-types/umm-json)
+        orig-umm (if (= format mt/umm-json)
                    (umm-spec/parse-metadata context (:concept-type orig-concept) format (:metadata orig-concept))
                    (umm/parse-concept orig-concept))
         vp-config (svm/source-to-virtual-product-mapping [provider-id entry-title])
@@ -134,7 +135,7 @@
       (let [new-umm (svm/generate-virtual-granule-umm provider-id source-short-name
                                                       orig-umm virtual-coll)
             new-granule-ur (:granule-ur new-umm)
-            new-metadata (if (= format mime-types/umm-json)
+            new-metadata (if (= format mt/umm-json)
                            (umm-spec/generate-metadata context new-umm (mime-types/mime-type->format
                                                                          (:format orig-concept)))
                            (umm/umm->xml new-umm (mime-types/mime-type->format


CMR-3279 fixes acl name

CMR-3279 fixes acl name

--- access-control-app/int_test/cmr/access_control/int_test/acl_search_test.clj
+++ access-control-app/int_test/cmr/access_control/int_test/acl_search_test.clj
@@ -706,7 +706,7 @@
                                                               :collection_applicable true
                                                               :collection_identifier {:access_value {:min_value 5 :max_value 10}}
                                                               :provider_id "PROV1"}))
-        acl4 (ingest-acl token (assoc (catalog-item-acl "Access value 2-10")
+        acl4 (ingest-acl token (assoc (catalog-item-acl "Access value undefined")
                                       :catalog_item_identity {:name "include undefined value"
                                                               :collection_applicable true
                                                               :collection_identifier {:access_value {:include_undefined_value true}}


Fix unit tests

Fix unit tests

--- test/cljs/status_im/test/chat/commands/impl/transactions.cljs
+++ test/cljs/status_im/test/chat/commands/impl/transactions.cljs
@@ -1,5 +1,6 @@
 (ns status-im.test.chat.commands.impl.transactions
   (:require [cljs.test :refer-macros [deftest is testing]]
+            [status-im.i18n :as i18n]
             [status-im.chat.commands.impl.transactions :as transactions]
             [status-im.chat.commands.protocol :as protocol]))

@@ -21,17 +22,17 @@
            #{:asset :amount})))
   (testing "Parameters validation"
     (is (= (protocol/validate personal-send-command {:asset "TST"} cofx)
-           {:title       "Invalid Asset"
-            :description "Unknown token - TST"}))
+           {:title       (i18n/label :t/send-request-invalid-asset)
+            :description (i18n/label :t/send-request-unknown-token {:asset "TST"})}))
     (is (= (protocol/validate personal-send-command {:asset "SNT"} cofx)
-           {:title       "Amount"
-            :description "Amount must be specified"}))
+           {:title       (i18n/label :t/send-request-amount)
+            :description (i18n/label :t/send-request-amount-must-be-specified)}))
     (is (= (protocol/validate personal-send-command {:asset "SNT" :amount "a"} cofx)
-           {:title       "Amount"
-            :description "Amount is not valid number"}))
+           {:title       (i18n/label :t/send-request-amount)
+            :description (i18n/label :t/send-request-amount-invalid-number)}))
     (is (= (protocol/validate personal-send-command {:asset "ETH" :amount "0.54354353454353453453454353453445345545"} cofx)
-           {:title       "Amount"
-            :description "Max number of decimals is 18"}))
+           {:title       (i18n/label :t/send-request-amount)
+            :description (i18n/label :t/send-request-amount-max-decimals {:asset-decimals 18})}))
     (is (= (protocol/validate personal-send-command {:asset "ETH" :amount "0.01"} cofx)
            nil)))
   (testing "Yielding control prefills wallet"
@@ -49,31 +50,31 @@
            #{:asset :amount})))
   (testing "Parameters validation"
     (is (= (protocol/validate personal-request-command {:asset "TST"} cofx)
-           {:title       "Invalid Asset"
-            :description "Unknown token - TST"}))
+           {:title       (i18n/label :t/send-request-invalid-asset)
+            :description (i18n/label :t/send-request-unknown-token {:asset "TST"})}))
     (is (= (protocol/validate personal-request-command {:asset "SNT"} cofx)
-           {:title       "Amount"
-            :description "Amount must be specified"}))
+           {:title       (i18n/label :t/send-request-amount)
+            :description (i18n/label :t/send-request-amount-must-be-specified)}))
     (is (= (protocol/validate personal-request-command {:asset "SNT" :amount "a"} cofx)
-           {:title       "Amount"
-            :description "Amount is not valid number"}))
+           {:title       (i18n/label :t/send-request-amount)
+            :description (i18n/label :t/send-request-amount-invalid-number)}))
     (is (= (protocol/validate personal-request-command {:asset "ETH" :amount "0,1Aaa"} cofx)
-           {:title       "Amount"
-            :description "Amount is not valid number"}))
+           {:title       (i18n/label :t/send-request-amount)
+            :description (i18n/label :t/send-request-amount-invalid-number)}))
     (is (= (protocol/validate personal-request-command {:asset "ETH" :amount "1-45"} cofx)
-           {:title       "Amount"
-            :description "Amount is not valid number"}))
+           {:title       (i18n/label :t/send-request-amount)
+            :description (i18n/label :t/send-request-amount-invalid-number)}))
     (is (= (protocol/validate personal-request-command {:asset "SNT" :amount "1$#@8"} cofx)
-           {:title       "Amount"
-            :description "Amount is not valid number"}))
+           {:title       (i18n/label :t/send-request-amount)
+            :description (i18n/label :t/send-request-amount-invalid-number)}))
     (is (= (protocol/validate personal-request-command {:asset "SNT" :amount "20,"} cofx)
-           {:title       "Amount"
-            :description "Amount is not valid number"}))
+           {:title       (i18n/label :t/send-request-amount)
+            :description (i18n/label :t/send-request-amount-invalid-number)}))
     (is (= (protocol/validate personal-request-command {:asset "SNT" :amount "20."} cofx)
-           {:title       "Amount"
-            :description "Amount is not valid number"}))
+           {:title       (i18n/label :t/send-request-amount)
+            :description (i18n/label :t/send-request-amount-invalid-number)}))
     (is (= (protocol/validate personal-request-command {:asset "ETH" :amount "0.54354353454353453453454353453445345545"} cofx)
-           {:title       "Amount"
-            :description "Max number of decimals is 18"}))
+           {:title       (i18n/label :t/send-request-amount)
+            :description (i18n/label :t/send-request-amount-max-decimals {:asset-decimals 18})}))
     (is (= (protocol/validate personal-request-command {:asset "ETH" :amount "0.01"} cofx)
            nil))))


Bump cljs version

Bump cljs version

--- lein-light-nrepl/project.clj
+++ lein-light-nrepl/project.clj
@@ -11,7 +11,7 @@
                  [ibdknox/analyzer "0.0.2"]
                  [clj-stacktrace "0.2.7"]
                  [fs "1.3.3"]
-                 [org.clojure/clojurescript "0.0-2080"
+                 [org.clojure/clojurescript "0.0-2120"
                    :exclusions [org.apache.ant/ant]]
                  [com.cemerick/pomegranate "0.2.0"]
                  ]


[deployment template] add input parameter to publish ports

--- cimi-resources/src/com/sixsq/slipstream/ssclj/resources/deployment/utils.clj
+++ cimi-resources/src/com/sixsq/slipstream/ssclj/resources/deployment/utils.clj
@@ -21,7 +21,10 @@
                           :description "Hostname or IP address of the image"}])

 (def node-input-params [{:parameter   "credential.id"
-                         :description "Cloud credential ID for managing node deployment"}])
+                         :description "Cloud credential ID for managing node deployment"}
+                        {:parameter   "cloud.node.publish.ports"
+                         :description (str "Publish ports [<PROTOCOL>:<PUBLISHED_PORT>:<TARGET_PORT> ...] "
+                                           "(e.g. 'tcp:20000:22 udp::69')")}])

 (def global-parameters [{:parameter   "ss:complete"
                          :description "Global complete flag, set when run completed"},


Updated dev requires.

Updated dev requires.

--- dev-resources/src/cmr_edsc_stubs/dev.clj
+++ dev-resources/src/cmr_edsc_stubs/dev.clj
@@ -4,7 +4,9 @@
    [clojure.string :as string]
    [clojure.tools.namespace.repl :as repl]
    [cmr-edsc-stubs.core :as stubs]
-   [cmr-edsc-stubs.data.core :as data]
+   [cmr-edsc-stubs.data.cmrapis :as cmrapis]
+   [cmr-edsc-stubs.data.jdbc :as jdbc]
+   [cmr-edsc-stubs.data.metadatadb :as metadatadb]
    [cmr-edsc-stubs.data.service :as service]
    [cmr-edsc-stubs.util :as util]
    [cmr.client.ingest :as ingest]


adding querying to the saved repl forms

adding querying to the saved repl forms

--- env/dev/clj/ladders/repl.clj
+++ env/dev/clj/ladders/repl.clj
@@ -51,7 +51,16 @@
                :player/email "dennis@example.com"
                :player/firstName "Dennis"
                :player/lastName "Lipovsky"})
-  (d/transact conn player)
+  (d/transact conn [player])
   (def db (d/db conn))
   (d/pull db '[*] [:player/email "dennis@example.com"])
+  (def db-player (d/q '[:find ?player . ;. means there is exactly 1
+                        :where
+                        [?player :player/firstName "Dennis"]]
+                      db))
+  (d/pull db '[:player/firstName :player/lastName :player/email] db-player)
+  (d/q '[:find (pull ?player [:player/firstName :player/lastName :player/email]) .
+         :where
+         [?player :player/firstName "Dennis"]]
+       db)
   )


no web yet

no web yet

--- src/leech/web.cljs
+++ src/leech/web.cljs
@@ -1,2 +0,0 @@
-(ns leech.web
-  (:require [cljs.nodejs :as node]))


include _all field query, but assign very small weight

--- src/wb_es/web/core.clj
+++ src/wb_es/web/core.clj
@@ -17,7 +17,8 @@
                   {:must [{:bool {:filter (get-filter options)}}
                           {:dis_max
                            {:queries [{:term {:wbid q}}
-                                      {:match {:label q}}]
+                                      {:match {:label q}}
+                                      {:match {:_all {:query q :boost 0.1}}}]
                             :tie_breaker 0.3}}]}}
                  :highlight
                  {:fields {:wbid {}
@@ -96,7 +97,8 @@
                   {:must [{:bool {:filter (get-filter options)}}
                           {:dis_max
                            {:queries [{:term {:wbid q}}
-                                      {:match {:label q}}]
+                                      {:match {:label q}}
+                                      {:match {:_all {:query q :boost 0.1}}}]
                             :tie_breaker 0.3}}]}}}
                 {:query {:bool {:filter (get-filter options)}}})


Ditto

Ditto

--- src/clojure/clojurewerkz/cassaforte/metrics.clj
+++ src/clojure/clojurewerkz/cassaforte/metrics.clj
@@ -1,3 +1,12 @@
+;; Copyright (c) 2012-2014 Michael S. Klishin, Alex Petrov, and the ClojureWerkz Team
+;;
+;; The use and distribution terms for this software are covered by the
+;; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
+;; which can be found in the file epl-v10.html at the root of this distribution.
+;; By using this software in any fashion, you are agreeing to be bound by
+;; the terms of this license.
+;; You must not remove this notice, or any other, from this software.
+
 (ns clojurewerkz.cassaforte.metrics
   "Access to metrics (console, CSV, etc) for the driver"
   (:import [com.datastax.driver.core Session]


Exercises

Exercises

--- fwpd/src/fwpd/core.clj
+++ fwpd/src/fwpd/core.clj
@@ -46,3 +46,29 @@

 ;; (glitter-filter 3 (mapify (parse (slurp filename))))

+;;;; Exercises
+;; 1. Turn the result of your glitter filter into a list of names.
+
+(defn suspect-list
+  [filtered-suspects]
+  (map #(% :name) filtered-suspects))
+
+;; (suspect-list (glitter-filter 3 (mapify (parse (slurp filename)))))
+;;=> ("Edward Cullen" "Jacob Black" "Carlisle Cullen")
+
+;; 2. Write a function, append, which will append a new suspect to your list of suspects.
+
+(defn append
+  [lst & ]
+  (apply conj suspects lst))
+
+;; (append (glitter-filter 3 (mapify (parse (slurp filename)))) {:name "Matt" :glitter-index 3})
+;;=> ({:name "Carlisle Cullen", :glitter-index 6} {:name "Jacob Black", :glitter-index 3} {:name "Edward Cullen", :glitter-index 10} {:name "Matt", :glitter-index 3})
+
+;; 3. Write a function, validate, which will check that :name and :glitter-index are present when you append. The validate function should accept two arguments: a map of keywords to validating functions, similar to conversions, and the record to be validated.
+
+(defn validate
+  [validations-map record]
+  ;;(reduce )
+  )
+


Use SNAPSHOT of jboss-as-management with debug output

to see if we can figure out the CI integ failures.

--- integration-tests/project.clj
+++ integration-tests/project.clj
@@ -58,7 +58,8 @@
                        :main integs.cluster
                        :dependencies [[org.immutant/fntest _]
                                       [clj-http _]
-                                      [environ _]]
+                                      [environ _]
+                                      [jboss-as-management "0.4.3-SNAPSHOT"]]
                        :plugins [[lein-environ "1.0.0"]]
                        :test-paths ^:replace ["test-clustering"]}
              :eap-base {:env {:eap true}


Refactor

Refactor

--- src/expound/alpha.cljc
+++ src/expound/alpha.cljc
@@ -312,8 +312,7 @@
     :else
     :problem/unknown))

-;; TODO - rename, dupe of below
-(defn group-and-sort-problems [failure problems]
+(defn grouped-and-sorted-problems [failure problems]
   (->> problems
        (group-by (juxt :expound/in (partial problem-type failure)))
        ;; We attempt to sort the problems by path, but it's not feasible to sort in
@@ -321,12 +320,6 @@
        ;; If there is an error, we just give up on sorting.
        (safe-sort-by first paths/compare-paths)))

-(defn sorted-and-grouped-problems [explain-data]
-  (->> explain-data
-       :expound/problems
-       (problems/leaf-only)
-       (group-and-sort-problems (::s/failure explain-data))))
-
 (defmethod expected-str :problem/insufficient-input [_type spec-name val path problems opts]
   (let [problem (first problems)]
     (printer/format
@@ -336,7 +329,7 @@
        "")
      (let [failure nil
            non-matching-value [:expound/value-that-should-never-match]
-           new-problems (group-and-sort-problems failure (map #(dissoc % :reason) problems))]
+           new-problems (grouped-and-sorted-problems failure (map #(dissoc % :reason) problems))]
        (string/join "\n\nor "
                     (for [[[in type] problems'] new-problems]
                       (expected-str type :expound/no-spec-name non-matching-value in problems' opts)))))))
@@ -496,7 +489,10 @@
               explain-data' (problems/annotate explain-data)
               caller (:expound/caller explain-data')
               form (:expound/form explain-data')
-              problems (sorted-and-grouped-problems explain-data')]
+              problems (->> explain-data'
+                            :expound/problems
+                            (problems/leaf-only)
+                            (grouped-and-sorted-problems (::s/failure explain-data)))]

           (printer/no-trailing-whitespace
            (str


Rename

Rename

--- src/expound/alpha.cljc
+++ src/expound/alpha.cljc
@@ -290,7 +290,7 @@

 ;; FIXME - when I decide to break compatibility for value-str-fn, maybe
 ;; make it show conform/unformed value
-(defn ^:private value-and-conformed-value [problems spec-name form path opts]
+(defn ^:private value+conformed-value [problems spec-name form path opts]
   (let [{:keys [show-conformed?]} opts
         invalid-value (if (nil? path)
                       ;; This isn't used by default
@@ -308,7 +308,7 @@
        ""))))

 (defmethod value-str :default [_type spec-name form path problems opts]
-  (show-spec-name spec-name (value-and-conformed-value problems spec-name form path {:show-conformed? true})))
+  (show-spec-name spec-name (value+conformed-value problems spec-name form path {:show-conformed? true})))

 (defn ^:private explain-missing-keys [problems]
   (let [missing-keys (map #(printer/missing-key (:pred %)) problems)]
@@ -609,19 +609,19 @@
    (expected-str type spec-name form path problems opts)))

 (defmethod value-str :expound.problem/insufficient-input [_type spec-name form path problems opts]
-  (show-spec-name spec-name (value-and-conformed-value problems spec-name form path {:show-conformed? false})))
+  (show-spec-name spec-name (value+conformed-value problems spec-name form path {:show-conformed? false})))

 (defmethod value-str :expound.problem/extra-input [_type spec-name form path problems opts]
-  (show-spec-name spec-name (value-and-conformed-value problems spec-name form path {:show-conformed? false})))
+  (show-spec-name spec-name (value+conformed-value problems spec-name form path {:show-conformed? false})))

 (defmethod value-str :expound.problem/fspec-fn-failure [_type spec-name form path problems opts]
-  (show-spec-name spec-name (value-and-conformed-value problems spec-name form path {:show-conformed? false})))
+  (show-spec-name spec-name (value+conformed-value problems spec-name form path {:show-conformed? false})))

 (defmethod value-str :expound.problem/fspec-exception-failure [_type spec-name form path problems opts]
-  (show-spec-name spec-name (value-and-conformed-value problems spec-name form path {:show-conformed? false})))
+  (show-spec-name spec-name (value+conformed-value problems spec-name form path {:show-conformed? false})))

 (defmethod value-str :expound.problem/fspec-ret-failure [_type spec-name form path problems opts]
-  (show-spec-name spec-name (value-and-conformed-value problems spec-name form path {:show-conformed? false})))
+  (show-spec-name spec-name (value+conformed-value problems spec-name form path {:show-conformed? false})))

 (defmethod expected-str :expound.problem/fspec-fn-failure [_type spec-name form path problems opts]
   (s/assert ::singleton problems)


fixed navigation active link

fixed navigation active link

--- src/ui/router.cljs
+++ src/ui/router.cljs
@@ -22,8 +22,6 @@
                    #(-> % .-token sec/dispatch!))
     (doto history (.setEnabled true))))

-(def history (History.))
-
 (defn mount [id page]
   (om/root
    page
@@ -38,15 +36,15 @@
    app-state
    {:target (.getElementById js/document id)}))

-(defn refresh-navigation []
-  (let [token (.getToken history)
+(defn refresh-navigation [app-state]
+  (let [token (.getToken (History.))
         set-active (fn [nav]
                      (assoc nav :active (= (:path nav) token)))]
-    (swap! state #(map set-active %))))
+    (swap! app-state #(map set-active %))))

-(defn on-navigate [event]
-  (refresh-navigation)
-  (secretary/dispatch! (.-token event)))
+(defn on-navigate [event handler]
+  (handler)
+  (sec/dispatch! (.-token event)))

 (defroute "/" []
   (mount "app" nav/view))


Reformatting

Reformatting

--- src/yada/protocols.clj
+++ src/yada/protocols.clj
@@ -126,10 +126,9 @@
   (parameters [_] "Return the parameters, by method. Must not return a deferred value."))

 (defprotocol ResourceVersion
-  "Entity tags. Satisfying resources MUST also satisfy
-  Representations, providing at least one
-  representation (because the representation data is used in
-  constructing the ETag header in the response)."
+  "Entity tags. Satisfying resources MUST also satisfy Representations,
+  providing at least one representation (because the representation data
+  is used in constructing the ETag header in the response)."
   (version [_ ctx] "Return the version of a resource. This is useful for
   conflict-detection. Can return nil, meaning no ETag."))


Extend security masked data protocol

Extend security masked data protocol

--- src/status_im/utils/security.cljs
+++ src/status_im/utils/security.cljs
@@ -11,6 +11,18 @@
 (deftype MaskedData [data]
   Object
   (toString [_] "******")
+
+  ICounted
+  (-count [^js this]
+    (count (.-data this)))
+
+  IEquiv
+  (-equiv [this other]
+    (if (instance? MaskedData other)
+      (= (unmask this)
+         (unmask other))
+      false))
+
   Unmaskable
   (unmask [^js this]
     (.-data this)))


fix use

fix use

--- src/neuseg/seg.clj
+++ src/neuseg/seg.clj
@@ -4,7 +4,7 @@

 (def nn (fann/loadnn "data/models/tagging.nn"))

-(def tagging (mk-invoke-fn nn 2))
+(def tagging (fann/mk-invoke-fn nn 2))

 (defn untagging [tag ch]
   (if (>= (first tag)  0)


Fix barrier-ack signature

Fix barrier-ack signature

--- src/onyx/types.clj
+++ src/onyx/types.clj
@@ -53,7 +53,7 @@

 (defrecord Barrier [src-peer-id dst-task-id replica-version epoch])

-(defrecord BarrierAck [src-peer-id dst-peer-id replica-version epoch])
+(defrecord BarrierAck [src-peer-id dst-task-id replica-version epoch])

 (defrecord Results [tree segments retries])


Fill in a gap in support for delay

Fill in a gap in support for delay

--- src/pamela/htn.clj
+++ src/pamela/htn.clj
@@ -296,6 +296,9 @@
                            ;;(dbg-println :error "ERROR, Resolve plant-fn-symbol w/in scope of caller-pclass")
                            {:type :arg-reference :name name}
                            ))
+
+                       (= type :delay)
+                       {}

                        :else
                        (do


Fix SQL in polling code. Forgot to check the asserts.

--- src/pepa/model.clj
+++ src/pepa/model.clj
@@ -460,34 +460,36 @@
               (set))})

 (defmethod changed-entities* :pages [db _ seq-num]
-  (when-let [pages (mapv :id (db/query db ["SELECT id FROM pages WHERE state_seq > ?" seq-num]))]
-    {:pages pages
-     :documents (->>
-                 (db/query db (db/sql+placeholders
-                               "SELECT DISTINCT dp.document
+  (let [pages (mapv :id (db/query db ["SELECT id FROM pages WHERE state_seq > ?" seq-num]))]
+    (when (seq pages)
+      {:pages pages
+       :documents (->>
+                   (db/query db (db/sql+placeholders
+                                 "SELECT DISTINCT dp.document
+                                  FROM document_pages AS dp
+                                  WHERE dp.page IN (%s)" pages))
+                   (mapv :document))
+       :inbox (->>
+               (db/query db (db/sql+placeholders
+                             "SELECT page FROM inbox
+                              WHERE page IN (%s)" pages))
+               (mapv :page))})))
+
+(defmethod changed-entities* :page_images [db _ seq-num]
+  (let [pages (->>
+               (db/query db ["SELECT DISTINCT p.id
+                              FROM page_images as pi
+                              LEFT JOIN pages as p ON p.id = pi.page
+                              WHERE pi.state_seq > ?" seq-num])
+               (map :id))]
+    (when (seq pages)
+      {:pages pages
+       :documents (->>
+                   (db/query db (db/sql+placeholders
+                                 "SELECT DISTINCT dp.document
                                 FROM document_pages AS dp
                                 WHERE dp.page IN (%s)" pages))
-                 (mapv :document))
-     :inbox (->>
-             (db/query db (db/sql+placeholders
-                           "SELECT page FROM inbox
-                            WHERE page IN (%s)" pages))
-             (mapv :page))}))
-
-(defmethod changed-entities* :page_images [db _ seq-num]
-  (when-let [pages (->>
-                    (db/query db ["SELECT DISTINCT p.id
-                                   FROM page_images as pi
-                                   LEFT JOIN pages as p ON p.id = pi.page
-                                   WHERE pi.state_seq > ?" seq-num])
-                    (map :id))]
-    {:pages pages
-     :documents (->>
-                 (db/query db (db/sql+placeholders
-                               "SELECT DISTINCT dp.document
-                                FROM document_pages AS dp
-                                WHERE dp.page IN (%s)" pages))
-                 (mapv :document))}))
+                   (mapv :document))})))

 (defmethod changed-entities* :files [db _ seq-num]
   {:files (->> (db/query db ["SELECT id FROM files WHERE state_seq > ?" seq-num])


Simplify meta api

Simplify meta api

--- src/qcast/html.clj
+++ src/qcast/html.clj
@@ -26,8 +26,8 @@
 (def attr= css/attr=)

 (defn meta
-  ([key dom] (meta :name key dom))
-  ([key value dom] (meta key value identity dom))
+  ([value dom] (meta value identity dom))
+  ([value transformer dom] (meta :name value transformer dom))
   ([key value transformer dom]
     (let [transformer' #(->> % (attr :content) transformer)]
       (select [:head [:meta (css/attr= key value)]] transformer' dom))))


Player/render to form-2 component

Player/render to form-2 component

--- src/app/core.cljs
+++ src/app/core.cljs
@@ -31,6 +31,11 @@
 (def eventbus-in (chan))
 (def eventbus-out (mult eventbus-in))

+(dispatch-sync [:initialize-db])
+
+(defn render-player []
+  (let [playmode (subscribe [:playmode])]
+    #(player/render (handlers/get-player @playmode))))

 (defn mount-root []
   (reagent/render [ctl/control-panel eventbus-in
@@ -39,8 +44,7 @@
                    ] (.getElementById js/document "controls"))
   (reagent/render [importer/textfield-component data/wordlists eventbus-in]
                   (.getElementById js/document "wordinputs"))
-  (let [playmode (subscribe [:playmode])]
-    (reagent/render [player/render (handlers/get-player @playmode)] (.getElementById js/document "screen"))))
+  (reagent/render [render-player] (.getElementById js/document "screen")))

 (defn restart []
@@ -48,6 +52,7 @@
   (mount-root)
   (dispatch-sync [:stop])
   (dispatch-sync [:start]))
+

 (let [eventbus (tap eventbus-out (chan))]
   (go (loop []
@@ -63,5 +68,5 @@
          (fn [evt]
            (.toggle (js/jQuery "nav"))))

-(dispatch-sync [:initialize-db])
+
 (restart)


Fix trimv typo -> trim-v

Fix trimv typo -> trim-v

--- examples/todomvc/src/todomvc/events.cljs
+++ examples/todomvc/src/todomvc/events.cljs
@@ -54,7 +54,7 @@
 ;; Below we create the interceptor chain shared by all event handlers
 ;; which manipulate todos.
 ;; A chain of interceptors is a vector.
-;; Explanation of `path` and `trimv` is given further below.
+;; Explanation of `path` and `trim-v` is given further below.
 (def todo-interceptors [check-spec-interceptor               ;; ensure the spec is still valid  (after)
                         (path :todos)                        ;; 1st param to handler will be the value from this path within db
                         ->local-store                        ;; write todos to localstore  (after)
@@ -110,13 +110,13 @@
   (fn [db [_ new-filter-kw]]     ;; new-filter-kw is one of :all, :active or :done
     (assoc db :showing new-filter-kw)))

-;; NOTE: here is a rewrite of the event handler above using `path` and `trimv`
+;; NOTE: here is a rewrite of the event handler above using `path` and `trim-v`
 ;; These interceptors are useful, but they are an advanced topic.
 ;; It will be illuminating if you compare this rewrite with the original above.
 #_(reg-event-db
   :set-showing                    ;; event-id

-  ;; this chain of 3 interceptors wrap the handler. Note use of `path` and `trimv`
+  ;; this chain of 3 interceptors wrap the handler. Note use of `path` and `trim-v`
   [check-spec-interceptor (path :showing) trim-v]

   ;; The event handler
@@ -136,7 +136,7 @@
   ;; The standard set of interceptors, defined above, which we
   ;; use for all todos-modifying event handlers. Looks after
   ;; writing todos to LocalStore, etc.
-  ;; NOTE: this chain includes `path` and `trimv`
+  ;; NOTE: this chain includes `path` and `trim-v`
   todo-interceptors

   ;; The event handler function.
@@ -145,7 +145,7 @@
   ;; And, further, it means the event handler returns just the value to be
   ;; put into `:todos` path, and not the entire `db`.
   ;; So, a path interceptor makes the event handler act more like clojure's `update-in`
-  (fn [todos [text]]   ;; because of trimv,  the 2nd parameter is NOT [_ text]
+  (fn [todos [text]]   ;; because of trim-v,  the 2nd parameter is NOT [_ text]
     (let [id (allocate-next-id todos)]
       (assoc todos id {:id id :title text :done false}))))


Fix error logging on cohort fetch.

Fix error logging on cohort fetch.

--- src/cavm/core.clj
+++ src/cavm/core.clj
@@ -60,7 +60,7 @@

 (defn async-post [url post cb]
   (let [x (agent nil)]
-    (set-error-handler! x (fn [_ err] (println "Error" err) (cb [])))
+    (set-error-handler! x (fn [_ err] (error err "Fetching cohort list") (cb [])))
     (send-off x (fn [_]
                   (cb (:body (client/post url {:body
                                                (str post)


Allow non-standard ports from xenabrowser.net.

--- src/cavm/core.clj
+++ src/cavm/core.clj
@@ -58,7 +58,7 @@
 ; XXX might want to disable http from xenabrowser.net, but currently we don't have
 ; certs on dev & beta.
 (def trusted-hosts
-  ["https?://([-_A-Za-z0-9]+.)?xenabrowser.net"
+  ["https?://([-_A-Za-z0-9]+.)?xenabrowser.net(:[0-9]+)?"
    "https://genome-cancer.ucsc.edu"])

 (def local-trusted-host "http://localhost(:[0-9]+)?")


Use assoc instead of merge in kvs.

Use assoc instead of merge in kvs.

--- src/cbfg/kvs.cljs
+++ src/cbfg/kvs.cljs
@@ -48,9 +48,9 @@
       (if-let [kvs (get-in state [:kvss name])]
         (if (= uuid (:uuid kvs))
           (cb state kvs)
-          [state (merge m {:status :mismatch :status-info [:wrong-uuid (:kvs-ident m)]})])
-        [state (merge m {:status :not-found :status-info [:no-kvs (:kvs-ident m)]})])
-      [state (merge m {:status :invalid :status-info :missing-kvs-ident-arg})])))
+          [state (assoc m :status :mismatch :status-info [:wrong-uuid (:kvs-ident m)])])
+        [state (assoc m :status :not-found :status-info [:no-kvs (:kvs-ident m)])])
+      [state (assoc m :status :invalid :status-info :missing-kvs-ident-arg)])))

 (defn kvs-do [actx state-ch res-ch cb]
   (act kvs-do actx
@@ -68,9 +68,9 @@
                          (when-let [entry (get-entry kc k v)]
                            (when (or include-deleted (not (:deleted entry)))
                              (aput scan-work res-ch
-                                   (merge m {:more true :status :ok
-                                             res-key key :entry entry})))))
-                       (aput-close scan-work res-ch (merge m {:status :ok}))))
+                                   (assoc m :more true :status :ok
+                                          res-key key :entry entry)))))
+                       (aput-close scan-work res-ch (assoc m :status :ok))))
                 nil)]
        (kvs-do actx state-ch res-ch
                (fn [state] ((kvs-checker m cb) (or kvs-snapshot state)))))))
@@ -83,8 +83,8 @@
                (act list-names actx
                     (doseq [name (keys (:kvss state))]
                       (aput list-names (:res-ch m)
-                            (merge m {:more true :status :ok :name name})))
-                    (aput-close list-names (:res-ch m) (merge m {:status :ok})))
+                            (assoc m :more true :status :ok :name name)))
+                    (aput-close list-names (:res-ch m) (assoc m :status :ok)))
                nil)))

    :kvs-open
@@ -92,25 +92,21 @@
      (kvs-do actx state-ch (:res-ch m)
              #(if-let [name (:name m)]
                 (if-let [kvs (get-in % [:kvss name])]
-                  [% (merge m {:status :ok
-                               :status-info :reopened
-                               :kvs-ident [name (:uuid kvs)]})]
+                  [% (assoc m :status :ok :status-info :reopened
+                            :kvs-ident [name (:uuid kvs)])]
                   [(-> %
                        (assoc-in [:kvss name] (make-kvs name (:next-uuid %)))
                        (assoc :next-uuid (inc (:next-uuid %))))
-                   (merge m {:status :ok
-                             :status-info :created
-                             :kvs-ident [name (:next-uuid %)]})])
-                [% (merge m {:status :invalid
-                             :status-info :missing-name-arg})])))
+                   (assoc m :status :ok :status-info :created
+                          :kvs-ident [name (:next-uuid %)])])
+                [% (assoc m :status :invalid :status-info :missing-name-arg)])))

    :kvs-remove
    (fn [actx state-ch m]
      (kvs-do actx state-ch (:res-ch m)
              (kvs-checker m (fn [state kvs]
                               [(dissoc-in state [:kvss (:name kvs)])
-                               (merge m {:status :ok
-                                         :status-info :removed})]))))
+                               (assoc m :status :ok :status-info :removed)]))))

    :multi-get
    (fn [actx state-ch m]
@@ -123,14 +119,12 @@
                          (let [entry (kc-entry-by-key kc key)]
                            (if (and entry (or include-deleted (not (:deleted entry))))
                              (aput multi-get res-ch
-                                   (merge res-m {:more true
-                                                 :status :ok
-                                                 :key key :entry entry}))
+                                   (assoc res-m :more true :status :ok
+                                          :key key :entry entry))
                              (aput multi-get res-ch
-                                   (merge res-m {:more true
-                                                 :status :not-found
-                                                 :key key})))))
-                       (aput-close multi-get res-ch (merge res-m {:status :ok}))))
+                                   (assoc res-m :more true :status :not-found
+                                          :key key)))))
+                       (aput-close multi-get res-ch (assoc res-m :status :ok))))
                 nil)]
        (kvs-do actx state-ch res-ch
                (fn [state] ((kvs-checker m cb) (or kvs-snapshot state))))))
@@ -149,7 +143,7 @@
                   (act multi-change actx
                        (doseq [res ress]
                          (aput multi-change res-ch (merge res-m res)))
-                       (aput-close multi-change res-ch (merge res-m {:status :ok})))
+                       (aput-close multi-change res-ch (assoc res-m :status :ok)))
                   [(assoc-in state [:kvss (:name kvs)] next-kvs) nil]))]
        (kvs-do actx state-ch res-ch (kvs-checker m cb))))

@@ -162,7 +156,7 @@
    :snapshot
    (fn [actx state-ch m]
      (kvs-do actx state-ch (:res-ch m)
-             (fn [state] [state (merge m {:status :ok :kvs-snapshot state})])))
+             (fn [state] [state (assoc m :status :ok :kvs-snapshot state)])))

    :sync
    (fn [actx state-ch m]
@@ -172,8 +166,8 @@
                                          (-> kvs
                                              (assoc :clean (:dirty kvs))
                                              (assoc :dirty (make-kc))))
-                               (merge m {:status :ok
-                                         :status-info [:synced (:kv-ident m)]})]))))})
+                               (assoc m :status :ok
+                                      :status-info [:synced (:kv-ident m)])]))))})

 (defn make-kvs-mgr [actx & {:keys [cmd-ch state-ch op-handlers]}]
   (let [cmd-ch (or cmd-ch (achan actx))


canvas: move click-and-drag handlers to entire viewport.

--- src/cfg/core.cljs
+++ src/cfg/core.cljs
@@ -13,10 +13,6 @@

 (enable-console-print!)

-(cmn/d "hello world!")
-
-
-

 (defui Canvas
   Object
@@ -29,43 +25,43 @@
     :margin-top 0})
   (render
    [this]
-   (dom/div {:class "canvas-viewport"}
+   (dom/div {:class "canvas-viewport"
+             ;; click-and-drag on the viewport pans the canvas
+             :onMouseDown
+             (fn [e]
+               (.preventDefault e)
+               (let [evt (or e (js/event))
+                     last-x (aget evt "clientX")
+                     last-y (aget evt "clientY")
+                     state (om/get-state this)]
+                 (om/set-state! this (assoc state :dragging true :last-x last-x :last-y last-y))))
+             :onMouseUp
+             (fn [e]
+               (.preventDefault e)
+               (let [evt (or e (js/event))
+                     state (om/get-state this)]
+                 (om/set-state! this (assoc state :dragging false))))
+             :onMouseMove
+             (fn [e]
+               (.preventDefault e)
+               (when (:dragging (om/get-state this))
+                 (let [evt (or e (js/event))
+                       state (om/get-state this)
+                       client-x (aget evt "clientX")
+                       delta-x (- client-x (:last-x state))
+                       margin-left' (+ (:margin-left state) delta-x)
+                       client-y (aget evt "clientY")
+                       delta-y (- client-y (:last-y state))
+                       margin-top' (+ (:margin-top state) delta-y)
+                       updates {:last-x client-x
+                                :margin-left margin-left'
+                                :last-y client-y
+                                :margin-top margin-top'}]
+                   (om/set-state! this (merge state updates)))))}
             (dom/div {:class "canvas"
                       :style #js{"marginLeft" (:margin-left (om/get-state this))
-                                 "marginTop" (:margin-top (om/get-state this))}
-                      :onMouseDown
-                      (fn [e]
-                        (.preventDefault e)
-                        (let [evt (or e (js/event))
-                              last-x (aget evt "clientX")
-                              last-y (aget evt "clientY")
-                              state (om/get-state this)]
-                          (om/set-state! this (assoc state :dragging true :last-x last-x :last-y last-y))))
-                      :onMouseUp
-                      (fn [e]
-                        (.preventDefault e)
-                        (let [evt (or e (js/event))
-                              state (om/get-state this)]
-                          (om/set-state! this (assoc state :dragging false))))
-                      :onMouseMove
-                      (fn [e]
-                        (.preventDefault e)
-                        (when (:dragging (om/get-state this))
-                          (let [evt (or e (js/event))
-                                state (om/get-state this)
-                                client-x (aget evt "clientX")
-                                delta-x (- client-x (:last-x state))
-                                margin-left' (+ (:margin-left state) delta-x)
-
-                                client-y (aget evt "clientY")
-                                delta-y (- client-y (:last-y state))
-                                margin-top' (+ (:margin-top state) delta-y)
-                                updates {:last-x client-x
-                                         :margin-left margin-left'
-                                         :last-y client-y
-                                         :margin-top margin-top'}]
-                            (om/set-state! this (merge state updates)))))}
-                     (om/children this)))))
+                                 "marginTop" (:margin-top (om/get-state this))}}
+              (om/children this)))))

 (def canvas (om/factory Canvas))


Fixes #4309: Do not allow empty command to be sent

--- src/status_im/chat/views/input/send_button.cljs
+++ src/status_im/chat/views/input/send_button.cljs
@@ -15,6 +15,10 @@
        (animation/timing spin-value {:toValue  to-spin-value
                                      :duration 300})))))

+(defn sendable? [input-text]
+  (let [trimmed (string/trim input-text)]
+    (not (or (string/blank? trimmed) (= trimmed "/")))))
+
 (defview send-button-view []
   (letsubs [command-completion                      [:command-completion]
             selected-command                        [:selected-chat-command]
@@ -24,10 +28,11 @@
                                                                                :command-completion command-completion})]
     {:component-did-update on-update}
     (let [{:keys [hide-send-button sequential-params]} (:command selected-command)]
-      (when (and (not (string/blank? input-text))
-                 (or (not selected-command)
-                     (some #{:complete :less-than-needed} [command-completion]))
-                 (not hide-send-button))
+      (when
+       (and (sendable? input-text)
+            (or (not selected-command)
+                (some #{:complete :less-than-needed} [command-completion]))
+            (not hide-send-button))
         [react/touchable-highlight {:on-press #(if sequential-params
                                                  (do
                                                    (when-not (string/blank? seq-arg-input-text)


whitespace

whitespace

--- support/src/figwheel/client/file_reloading.cljs
+++ support/src/figwheel/client/file_reloading.cljs
@@ -533,8 +533,3 @@
   (when (utils/html-env?)
     (when-let [f-datas (not-empty (distinctify :file files))]
       (swap! reload-css-deferred-chain reload-css-files* f-datas on-cssload))))
-
-
-
-
-


Add a function for retrieving predecessors

--- src/jungerer/graph.clj
+++ src/jungerer/graph.clj
@@ -149,3 +149,10 @@
   incoming edge of v and an outgoing edge of node."
   [^Hypergraph graph node]
   (set (.getSuccessors graph node)))
+
+(defn predecessors
+  "Returns the predecessors of node in graph as set. A predecessor of node is
+  defined as a node v which is connected to node by an edge e, where e is an
+  outgoing edge of v and an incoming edge of node."
+  [^Hypergraph graph node]
+  (set (.getPredecessors graph node)))


cues creation

cues creation

--- src/lights/my_show.clj
+++ src/lights/my_show.clj
@@ -99,9 +99,9 @@
         (with-show s (show/stop!)))
       (show/show :universes [1] :description "Accuraten"))))

-  (show/patch-fixture! :back-1 (simple-rgbd) 1 1 :x 1)
-  (show/patch-fixture! :back-2 (simple-rgbd) 1 5 :x 2)
-  (show/patch-fixture! :back-3 (simple-rgbd) 1 9 :x 3)
+  (show/patch-fixture! :back-odd-1 (simple-rgbd) 1 1 :x 1)
+  (show/patch-fixture! :back-even-2 (simple-rgbd) 1 5 :x 2)
+  (show/patch-fixture! :back-odd-3 (simple-rgbd) 1 9 :x 3)
   (show/patch-fixture! :front-1 (rgb-arch) 1 13  :x 3.5)

   ;; Return the show's symbol, rather than the actual map, which gets huge with
@@ -296,6 +296,17 @@
       (params/build-color-param :h :main-hue :s 100 :l param)))
   )
 )
+
+(defn separate-colors
+  "Asign different colors to different fixtures. Experiment."
+  []
+  (afterglow.effects/scene "Different colors"
+    (show/add-effect! :color (afterglow.effects.color/color-effect
+      "Plain red" (create-color "red") (show/fixtures-named "back-odd")))
+    (show/add-effect! :color (afterglow.effects.color/color-effect
+      "Plain Blue" (create-color "blue") (show/fixtures-named "back-even")))
+    )
+  )

 (defn reset-beat
   "Reset beat of the show"
@@ -405,14 +416,23 @@
 (defn new-cues
   "Create cues."
   []
+
+  (ct/set-cue! (:cue-grid *show*) 0 16
+    (cues/cue :color  (fn [_] (afterglow.effects/scene
+      "Blue Sparks"
+      (global-color-effect :blue)
+      (fun/sparkle (show/all-fixtures)
+                   :chance 0.07 :fade-time 500)))))
+
+
   (ct/set-cue! (:cue-grid *show*) 0 17
-    (cues/function-cue :strobe-all :strobe (show/all-fixtures) :effect-name "A new cue"))
-
-  (ct/set-cue! (:cue-grid *show*) 0 18
-    (afterglow.effects/scene "Blue Sparks"
-      (global-color-effect :blue)
-      (fun/sparkle (show/all-fixtures) :chance 0.07 :fade-time 500))
-    )
+    (cues/cue :color  (fn [_] (afterglow.effects/scene
+      "Blue and red"
+        (show/add-effect! :color-back-odd (afterglow.effects.color/color-effect
+          "Plain red" (create-color "red") (show/fixtures-named "back-odd")))
+        (show/add-effect! :color-back-even (afterglow.effects.color/color-effect
+          "Plain Blue" (create-color "blue") (show/fixtures-named "back-even")))
+    ))))
 )

 (defn make-cues


definitions with function channel

definitions with function channel

--- src/lights/my_show.clj
+++ src/lights/my_show.clj
@@ -30,7 +30,17 @@
   {:channels [(chan/color 1 :red)
               (chan/color 2 :green)
               (chan/color 3 :blue)
-              (chan/dimmer 4)]
+              (chan/functions :dimmer 4
+                0 {:type :dimmer
+                  :label "Dimmer from 0 to 189"
+                  :start 0
+                  :end 189
+                  :range :variable}
+                190 {:type :strobe
+                  :label "Strobe from 190 to 255"
+                  :start 190
+                  :end 255
+                  :range :variable})]
    :name "Simple RGB with dimmer"})

 (defn my-rgb


down correct

down correct

--- src/lights/my_show.clj
+++ src/lights/my_show.clj
@@ -154,7 +154,7 @@
   "Change light according to sawtooth osc"
   []
   (def light-param (params/build-oscillated-param
-                 (oscillators/sawtooth-beat :beat-ratio 2 :down true) :max 20))
+                 (oscillators/sawtooth-beat :beat-ratio 2 :down? true) :max 20))
   (show/add-effect! :color (global-color-effect
     (params/build-color-param :h 60 :s 100 :l light-param)))
   )


add display names

add display names

--- src-cljs/frontend/components/issues.cljs
+++ src-cljs/frontend/components/issues.cljs
@@ -20,6 +20,7 @@

 (defn issue-form [_ owner]
   (reify
+    om/IDisplayName (display-name [_] "Issue form")
     om/IInitState (init-state [_] {:issue-title ""})
     om/IRenderState
     (render-state [_ {:keys [issue-title]}]
@@ -46,6 +47,7 @@

 (defn comment-form [{:keys [issue-id parent-id]} owner {:keys [issue-db]}]
   (reify
+    om/IDisplayName (display-name [_] "Comment form")
     om/IInitState (init-state [_] {:comment-body ""})
     om/IRenderState
     (render-state [_ {:keys [comment-body]}]
@@ -81,6 +83,7 @@
 ;; XXX: handle logged-out users
 (defn vote-box [{:keys [issue]} owner]
   (reify
+    om/IDisplayName (display-name [_] "Vote box")
     om/IRender
     (render [_]
       (let [{:keys [cast! issue-db cust]} (om/get-shared owner)
@@ -107,6 +110,7 @@
 (defn single-comment [{:keys [comment-id issue-id]} owner {:keys [ancestors]
                                                            :or {ancestors #{}}}]
   (reify
+    om/IDisplayName (display-name [_] "Single comment")
     om/IInitState
     (init-state [_] {:listener-key (.getNextUniqueId (.getInstance IdGenerator))
                      :replying? false})
@@ -193,6 +197,7 @@

 (defn comments [{:keys [issue]} owner]
   (reify
+    om/IDisplayName (display-name [_] "Comments")
     om/IRender
     (render [_]
       (let [{:keys [issue-db]} (om/get-shared owner)
@@ -227,6 +232,7 @@

 (defn issue [{:keys [issue-id]} owner]
   (reify
+    om/IDisplayName (display-name [_] "Issue")
     om/IInitState
     (init-state [_] {:listener-key (.getNextUniqueId (.getInstance IdGenerator))
                      :title nil
@@ -356,6 +362,7 @@

 (defn issue-summary [{:keys [issue-id]} owner]
   (reify
+    om/IDisplayName (display-name [_] "Issue summary")
     om/IInitState
     (init-state [_] {:listener-key (.getNextUniqueId (.getInstance IdGenerator))})
     om/IDidMount
@@ -385,6 +392,7 @@

 (defn issues [app owner {:keys [submenu]}]
   (reify
+    om/IDisplayName (display-name [_] "Issues")
     om/IInitState
     (init-state [_] {:listener-key (.getNextUniqueId (.getInstance IdGenerator))})
     om/IDidMount


Move the install path to a var

Move the install path to a var

--- src/mdr2/pipeline1.clj
+++ src/mdr2/pipeline1.clj
@@ -6,6 +6,8 @@
   `/usr/lib/daisy-pipeline/scripts`."
   (:require [clojure.java.shell :refer [sh]]
             [clojure.string :as s]))
+
+(def ^:private install-path "/usr/lib/daisy-pipeline/scripts")

 (defn continuation-line? [line]
   (cond
@@ -34,7 +36,7 @@
   seq on successful validation or a seq of error messages otherwise"
   [file]
   (-> (sh "daisy-pipeline"
-          "/usr/lib/daisy-pipeline/scripts/verify/ConfigurableValidator.taskScript"
+          (str install-path "/verify/ConfigurableValidator.taskScript")
           (str "--validatorInputFile=" file)
           ;; make sure it has to be a DTBook file
           "--validatorRequireInputType=Dtbook document"
@@ -47,5 +49,5 @@
   "Invoke the audio encoder script."
   [{:keys [input output bitrate] :as args}]
   (apply sh "daisy-pipeline"
-         "/usr/lib/daisy-pipeline/scripts/modify_improve/dtb/DTBAudioEncoder.taskScript"
+         (str install-path "/modify_improve/dtb/DTBAudioEncoder.taskScript")
          (map (fn [[k v]] (format "--%s=%s" (name k) v)) args)))