[AcqEng] Fix stale system state cache in image tags.

Our TaggedImages were coming out of the SWIG layer with up-to-date copies of
the system state cache. However, the acquisition engine was keeping around a
stale copy of the same cache, and overwriting the images' copy with its old
copy. The engine's copy of the cache was only updated before snaps or sequence
acquisitions. Consequently, any properties that changed in the middle of a
sequence acquisition would not be reflected in the image tags. This change
removes the use of the system state cache by the acquisition engine, so that
the image's copy of the cache is preserved unmodified.

git-svn-id: 03a8048b5ee8463be5048a3801110fb50f378627@15510 d0ab736e-dc22-4aeb-8dc9-08def0aa14fd

--- acqEngine/src/org/micromanager/acq_engine.clj
+++ acqEngine/src/org/micromanager/acq_engine.clj
@@ -105,7 +105,6 @@

 (defn generate-metadata [event state]
   (merge
-    (state :system-state)
     (:metadata event)
     (let [[x y] (let [xy-stage (state :default-xy-stage)]
                   (when-not (empty? xy-stage)


Notes on managing state.

Notes on managing state.

--- test/com/nomistech/clojure_the_language/intro_to_state.clj
+++ test/com/nomistech/clojure_the_language/intro_to_state.clj
@@ -54,6 +54,21 @@
 ;;;; ___________________________________________________________________________
 ;;;; Atoms and concurrency

+;;;; Illustration of multiple threads competing to update an atom.
+;;;;
+;;;; - Each thread uses `swap!` with a function that runs for a long time.
+;;;;
+;;;; - Clojure allows each thread to be optimistic.
+;;;;
+;;;; - When a thread finishes:
+;;;;   - If the current value is the same as the value when the operation
+;;;;     started
+;;;;     then
+;;;;         the new value is swapped in
+;;;;     else
+;;;;         the swap operation is retried
+;;;;         (using the current value as input to the swap operation).
+
 (def atom-to-demo-competing-updates (atom 0))

 (def n-competitors 100)
@@ -79,3 +94,11 @@
   (let [[final-value n-attempts] (demo-competition-to-modify-atom)]
     (fact final-value => n-competitors)
     (fact (> n-attempts n-competitors) => truthy)))
+
+;;;; ___________________________________________________________________________
+
+;;;; TODO:
+;;;; - Look at your notes
+;;;; - More on atoms?
+;;;; - Refs
+;;;; - Single big atoms vs multiple small refs


Fix example project ci failure

Fix example project ci failure

--- examples/todomvc/project.clj
+++ examples/todomvc/project.clj
@@ -8,7 +8,7 @@
                  [reagent "0.10.0"]
                  [re-frame "0.12.0"]
                  [day8.re-frame/tracing "0.5.6"]
-                 [day8.re-frame/re-frame-10x "LATEST"]
+                 [day8.re-frame/re-frame-10x "0.6.6"]
                  [secretary "1.2.3"]]

   :plugins      [[day8/lein-git-inject "0.0.14"]


fix `:contact.ui/close-contact-pressed` event

Most likely a typo was introduced during refactoring.

--- src/status_im/ui/screens/chat/views.cljs
+++ src/status_im/ui/screens/chat/views.cljs
@@ -41,7 +41,7 @@
          [vector-icons/icon :icons/add {:color colors/blue}]
          [react/i18n-text {:style style/add-contact-text :key :add-to-contacts}]]]
        [react/touchable-highlight
-        {:on-press            #(re-frame/dispatch [:contacts.ui/close-contact-pressed contact-identity])
+        {:on-press            #(re-frame/dispatch [:contact.ui/close-contact-pressed contact-identity])
          :accessibility-label :add-to-contacts-close-button}
         [vector-icons/icon :icons/close {:color           colors/black
                                          :container-style style/add-contact-close-icon}]]])))


Fix typo in `core-cljs-requires` definition.

--- src/leiningen/new/chestnut.clj
+++ src/leiningen/new/chestnut.clj
@@ -23,7 +23,7 @@
     ["org.httpkit.server :refer [run-server]"]
     ["ring.adapter.jetty :refer [run-jetty]"]))

-(defn colre-cljs-requires [opts]
+(defn core-cljs-requires [opts]
   (if (om-tools? opts)
     ["om.dom :as dom :include-macros true"]
     ["om-tools.dom :as dom :include-macros true"]))


Make the URL to cards.html clickable

Make the URL to cards.html clickable

Many terminal emulators (such as iTerm) will recognize a URL and let you click it, but only if it includes the scheme.

--- src/leiningen/new/devcards.clj
+++ src/leiningen/new/devcards.clj
@@ -10,7 +10,7 @@
               :sanitized (name-to-path name)}]
     (main/info (str "Generating fresh 'lein new' devcards project.\n"
                     "cd into your project directory\n"
-                    "Run 'lein figwheel' and then open localhost:3449/cards.html in your browser."
+                    "Run 'lein figwheel' and then open http://localhost:3449/cards.html in your browser."
                     ""))
     (->files data
              ["project.clj" (render "project.clj" data)]


Write `typical-monitor-pressure-seq`

Write `typical-monitor-pressure-seq`

--- src/test_utils/fracture_diagnostics.cljc
+++ src/test_utils/fracture_diagnostics.cljc
@@ -420,6 +420,13 @@
                                   (magnitude (pressure-as (typical-monitor-pressure :psi) :kPa)))]
      (make-measurement pressure-magnitude pressure-unit))))

+(defn typical-monitor-pressure-seq
+  ([] (typical-monitor-pressure-seq (rand-pressure-unit)))
+  ([pressure-unit] (cond (= pressure-unit :psi)
+                         (map #(make-measurement % :psi) (p-mon-seq))
+                         (= pressure-unit :kPa)
+                         (map #(pressure-as % pressure-unit) (typical-monitor-pressure-seq :psi)))))
+
 (def measured-at-location [:downhole :surface])

 (defn typical-monitor-temperature


fixed typos and misplaced paren

fixed typos and misplaced paren

--- test/ctia/flows/hooks/redis_event_hook_test.clj
+++ test/ctia/flows/hooks/redis_event_hook_test.clj
@@ -24,7 +24,7 @@
                                              (fn test-events-pubsub-fn [ev]
                                                (swap! results conj ev)
                                                (.countDown finish-signal)))]
-      (let [{judgment-1-id :id
+      (let [{judgement-1-id :id
              :as judgement-1}
             (post "ctia/judgement"
                   :body {:observable {:value "1.2.3.4"
@@ -58,56 +58,56 @@
                          :priority 100
                          :severity 100
                          :confidence "Low"
-                         :valid_time {:start_time "2016-02-11T00:40:48.212-00:00"}})])
+                         :valid_time {:start_time "2016-02-11T00:40:48.212-00:00"}})]

-      (is (.await finish-signal 10 TimeUnit/SECONDS)
-          "Unexpected timeout waiting for subscriptions")
-      (is (= [{:owner "Unknown"
-               :entity {:valid_time
-                        {:start_time #inst "2016-02-11T00:40:48.212-00:00",
-                         :end_time #inst "2525-01-01T00:00:00.000-00:00"},
-                        :observable {:value "1.2.3.4", :type "ip"},
-                        :type "judgement",
-                        :source "source",
-                        :disposition 1,
-                        :disposition_name "Clean",
-                        :priority 100,
-                        :id judgement-1-id
-                        :severity 100,
-                        :confidence "Low",
-                        :owner "Unknown"}
-               :id judgement-1-id}
-              {:owner "Unknown"
-               :entity {:valid_time
-                        {:start_time #inst "2016-02-11T00:40:48.212-00:00",
-                         :end_time #inst "2525-01-01T00:00:00.000-00:00"},
-                        :observable {:value "1.2.3.4", :type "ip"},
-                        :type "judgement",
-                        :source "source",
-                        :disposition 2,
-                        :disposition_name "Malicious",
-                        :priority 100,
-                        :id judgement-2-id
-                        :severity 100,
-                        :confidence "Low",
-                        :owner "Unknown"}
-               :id judgement-2-id}
-              {:owner "Unknown"
-               :entity {:valid_time
-                        {:start_time #inst "2016-02-11T00:40:48.212-00:00",
-                         :end_time #inst "2525-01-01T00:00:00.000-00:00"},
-                        :observable {:value "1.2.3.4", :type "ip"},
-                        :type "judgement",
-                        :source "source",
-                        :disposition 3,
-                        :disposition_name "Suspicious",
-                        :priority 100,
-                        :id judgement-3-id
-                        :severity 100,
-                        :confidence "Low",
-                        :owner "Unknown"}
-               :id judgement-3-id}]
-             (->> @results
-                  (map #(dissoc % :timestamp :http-params))
-                  (map #(update % :entity dissoc :created)))))
+        (is (.await finish-signal 10 TimeUnit/SECONDS)
+            "Unexpected timeout waiting for subscriptions")
+        (is (= [{:owner "Unknown"
+                 :entity {:valid_time
+                          {:start_time #inst "2016-02-11T00:40:48.212-00:00",
+                           :end_time #inst "2525-01-01T00:00:00.000-00:00"},
+                          :observable {:value "1.2.3.4", :type "ip"},
+                          :type "judgement",
+                          :source "source",
+                          :disposition 1,
+                          :disposition_name "Clean",
+                          :priority 100,
+                          :id judgement-1-id
+                          :severity 100,
+                          :confidence "Low",
+                          :owner "Unknown"}
+                 :id judgement-1-id}
+                {:owner "Unknown"
+                 :entity {:valid_time
+                          {:start_time #inst "2016-02-11T00:40:48.212-00:00",
+                           :end_time #inst "2525-01-01T00:00:00.000-00:00"},
+                          :observable {:value "1.2.3.4", :type "ip"},
+                          :type "judgement",
+                          :source "source",
+                          :disposition 2,
+                          :disposition_name "Malicious",
+                          :priority 100,
+                          :id judgement-2-id
+                          :severity 100,
+                          :confidence "Low",
+                          :owner "Unknown"}
+                 :id judgement-2-id}
+                {:owner "Unknown"
+                 :entity {:valid_time
+                          {:start_time #inst "2016-02-11T00:40:48.212-00:00",
+                           :end_time #inst "2525-01-01T00:00:00.000-00:00"},
+                          :observable {:value "1.2.3.4", :type "ip"},
+                          :type "judgement",
+                          :source "source",
+                          :disposition 3,
+                          :disposition_name "Suspicious",
+                          :priority 100,
+                          :id judgement-3-id
+                          :severity 100,
+                          :confidence "Low",
+                          :owner "Unknown"}
+                 :id judgement-3-id}]
+               (->> @results
+                    (map #(dissoc % :timestamp :http-params))
+                    (map #(update % :entity dissoc :created))))))
       (lr/close-listener listener))))


fix :js-module-index issue

fix :js-module-index issue

--- src/main/shadow/cljs/build.clj
+++ src/main/shadow/cljs/build.clj
@@ -1459,8 +1459,8 @@

           (-> state
               (assoc-in [:sources name] rc)
-              ;; no idea why :js-module-index is {Str Str} and not {Str Sym}
-              (update-in [:compiler-env :js-module-index] assoc js-require (str ns))
+              ;; FIXME: properly identify what :js-module-index is supposed to be
+              (update-in [:compiler-env :js-module-index] assoc (str ns) ns)
               )))
       state
       js-requires)))


Fix the doc string

Fix the doc string

--- src/mdr2/schema_validation.clj
+++ src/mdr2/schema_validation.clj
@@ -17,8 +17,10 @@
    :column (.getColumnNumber exception)})

 (defn validation-errors
-  "Return the first validation error when validating `file` against
-  the given Relaxng `schema`. If the file is valid nil is returned."
+  "Return a list of validation errors when validating `file` against
+  the given Relaxng `schema`. If the file is valid an empty list is
+  returned. The errors are returned in the form a map contaings the
+  keys :error, :line and :column"
   [file schema]
   ;; basically a minimal port of
   ;; http://stackoverflow.com/questions/15732/whats-the-best-way-to-validate-an-xml-file-against-an-xsd-file


corrected typo

corrected typo

--- src/midje/ideas/background.clj
+++ src/midje/ideas/background.clj
@@ -45,7 +45,7 @@

   (defmacro before
     "Code to run before a given wrapping target (:facts, :contents, :checks).
-     Take an optional keyword argument :after, for any code to run afterward.
+     Can take an optional keyword argument :after, for any code to run afterward.
      Used with background and against-background"
     [wrapping-target before-form & {:keys [after]}]
     (ensure-correct-form-variable `(try


Add test example for mocking with reification.

--- test/active/clojure/mock_monad_test.cljc
+++ test/active/clojure/mock_monad_test.cljc
@@ -53,3 +53,13 @@
           (ex1)
           (ex1)))]
     (is (= "I don't care, I am mocking you." result))))
+
+(def reified-command
+  (monad/reify-as (ask nil) ::reification))
+
+(deftest mock-reified
+  (let [result
+        (mock/mock-run-monad
+          [(mock/mock-result ::reification true)]
+          reified-command)]
+    (is (true? result))))


CMR-989: Removes :refer from granule validation

--- umm-lib/src/cmr/umm/validation/granule.clj
+++ umm-lib/src/cmr/umm/validation/granule.clj
@@ -5,7 +5,7 @@
             [clojure.string :as str]
             [cmr.common.validations.core :as v]
             [cmr.umm.spatial :as umm-s]
-            [cmr.umm.start-end-date :refer [start-date end-date]]
+            [cmr.umm.start-end-date :as sed]
             [cmr.spatial.validation :as sv]
             [cmr.umm.validation.utils :as vu]
             [cmr.umm.validation.validation-helper :as h]
@@ -80,10 +80,10 @@
   (let [temporal (:temporal granule)
         coll-temporal (:temporal (:parent granule))]
     (when (and temporal coll-temporal)
-      (when-let [msg (temporal-error-message (start-date :granule temporal)
-                                             (end-date :granule temporal)
-                                             (start-date :collection coll-temporal)
-                                             (end-date :collection coll-temporal))]
+      (when-let [msg (temporal-error-message (sed/start-date :granule temporal)
+                                             (sed/end-date :granule temporal)
+                                             (sed/start-date :collection coll-temporal)
+                                             (sed/end-date :collection coll-temporal))]
         {[:temporal] [msg]}))))

 (defn- operation-modes-reference-collection


fix shortname conflicts

fix shortname conflicts

--- src/io/perun.clj
+++ src/io/perun.clj
@@ -290,7 +290,7 @@
 (deftask sitemap
   "Generate sitemap"
   [f filename FILENAME str "generated sitemap filename"
-   f filterer FILTER   code "filter function"
+   _ filterer FILTER   code "filter function"
    o target   OUTDIR   str "the output directory"
    u url      URL      str "base URL"]
   (let [pod     (create-pod sitemap-deps)
@@ -314,7 +314,7 @@
 (deftask rss
   "Generate RSS feed"
   [f filename    FILENAME    str "generated RSS feed filename"
-   f filterer    FILTER     code "filter function"
+   _ filterer    FILTER     code "filter function"
    o target      OUTDIR      str "the output directory"
    t title       TITLE       str "feed title"
    p description DESCRIPTION str "feed description"


Just finished reading. What an awesome book

--- src/joy/ch17.clj
+++ src/joy/ch17.clj
@@ -348,3 +348,49 @@
            (traverse DB visit))))

 (defn div [n d] (int (/ n d)))
+
+(defn readr [prompt exit-code]
+  (let [input (clojure.main/repl-read prompt exit-code)]
+    (if (= input ::tl)
+      exit-code
+      input)))
+
+(defmacro local-context []
+  (let [symbols (keys &env)]
+    (zipmap (map (fn [sym] `(quote ~sym))
+                 symbols)
+            symbols)))
+
+(local-context)
+(let [a 1 b 2]
+  (let [b 200]
+    (local-context)))
+
+(defn contextual-eval [ctx expr]
+  (eval
+   `(let [~@(mapcat (fn [[k v]] [k `'~v]) ctx)]
+      ~expr)))
+
+(defmacro break []
+  `(clojure.main/repl
+    :prompt #(print "debug=> ")
+    :read readr
+    :eval (partial contextual-eval (local-context))))
+
+(defn div [n d] (break) (int (/ n d)))
+
+(defn keys-apply [f ks m]
+  (break)
+  (let [only (select-keys m ks)]
+    (break)
+    (zipmap (keys only) (map f (vals only)))))
+
+(keys-apply inc [:a :b] {:a 1 :b 2 :c 3})
+
+(defmacro awhen [expr & body]
+  (break)
+  `(let [~'it ~expr]
+     (if ~'it
+       (do (break) ~@body))))
+
+(awhen [1 2 3] (it 2))


Added '-main fns for some examples...

Added '-main fns for some examples...

* overtone.examples.getting-started.melody

--- src/overtone/examples/getting_started/melody.clj
+++ src/overtone/examples/getting_started/melody.clj
@@ -36,12 +36,23 @@
   (let [play-note (fn [[beat midi]] (at (metro beat) (-> midi midi->hz harpsichord)))]
     (dorun (map play-note notes))))

+(defn after [beats metro] (comp metro #(+ % beats)))
+
 (defn play-round [metro notes]
-  (let [after (fn [beats metro] (comp metro #(+ % beats)))]
-    (play metro notes)
-    (play (after 4 metro) notes)
-    (play (after 8 metro) notes)
-    (play (after 16 metro) notes)))
+  (play metro notes)
+  (play (after 4 metro) notes)
+  (play (after 8 metro) notes)
+  (play (after 16 metro) notes))

 ;(play (metronome 120) melody)
 ;(play-round (metronome 120) melody)
+
+(defn -main [& args]
+  (let [metro (metronome 120)]
+
+    ;; play the melody
+    (play metro melody)
+    (play-round (after 16 metro) melody)
+
+    ;; wait for the melody to finish
+    (Thread/sleep (- (metro 48) (now)))))


bug #4917 and #4914 - not showing message in chat after wallet send

Signed-off-by: Julien Eluard <c768e13f1ba4c3ebed2909a1fc1e4b50bb021a2f@gmail.com>

--- src/status_im/ui/screens/wallet/send/events.cljs
+++ src/status_im/ui/screens/wallet/send/events.cljs
@@ -277,7 +277,7 @@
  ::transaction-completed
  (fn [{db :db now :now} [_ {:keys [id response] :as params} modal?]]
    (let [{:keys [hash error]} response
-         {:keys [method]} (get-in db [:wallet :send-transaction])
+         {:keys [method from-chat?]} (get-in db [:wallet :send-transaction])
          db'             (assoc-in db [:wallet :send-transaction :in-progress?] false)]
      (if (and error (string? error) (not (string/blank? error))) ;; ignore error here, error will be handled in :transaction-failed
        {:db db'}
@@ -289,11 +289,17 @@
                (update-in [:wallet :transactions-unsigned] dissoc id)
                true
                (update-in [:wallet :send-transaction] merge clear-send-properties {:tx-hash hash}))}
-        (if modal?
+        (cond
+          modal?
           (cond-> {:dispatch [:navigate-back]}
             (= method constants/web3-send-transaction)
             (assoc :dispatch-later [{:ms 400 :dispatch [:navigate-to-modal :wallet-transaction-sent-modal]}]))
-          {:dispatch [:execute-stored-command]}))))))
+
+          from-chat?
+          {:dispatch [:execute-stored-command]}
+
+          :else
+          {:dispatch [:navigation-replace :wallet-transaction-sent]}))))))

 (defn on-transactions-modal-completed [raw-results]
   (let [result (types/json->clj raw-results)]


PDOK-1599: disable test

PDOK-1599: disable test

--- src/test/clojure/pdok/featured/extracts_test.clj
+++ src/test/clojure/pdok/featured/extracts_test.clj
@@ -18,13 +18,11 @@
 (defn two-features [] (list (test-feature "name1" "A" "B")
                              (test-feature "name2" "C" "D")))

-(def test-two-rendered-features
+(deftest test-two-rendered-features
   (let [[error features-for-extract] (features-for-extract "test" "dummy" "gml2extract" (two-features) "src/test/resources/templates")]
     (is (= 2 )(count features-for-extract))))

-(def ^{:private true} extract-type-citygml "citygml")
-
-(deftest test-rendered-feature-gml
+(def test-rendered-feature-gml
   (let [_ (println (str "feature one " (one-feature)))
         [error features-for-extract] (features-for-extract "test" "dummy" "gml2extract" (one-feature) "src/test/resources/templates")
         _ (println (str "error " error))
@@ -34,6 +32,7 @@
     (is (boolean (re-find #"<geo><gml:Polygon" result-feature)))
     (is (boolean (re-find #"<naam>PDOK</naam>" result-feature)))))

+(def ^{:private true} extract-type-citygml "citygml")

 (defn write-xml-to-database [dataset feature-type path template-dir]
   "Helper function to write features to an extract-schema."


Extend the rdf with sbs:idVorstufe and sbs:idMaster

--- src/mdr2/rdf.clj
+++ src/mdr2/rdf.clj
@@ -3,52 +3,60 @@

   RDF files are needed to pass meta data to the archive."
   (:require [clojure.data.xml :as xml]
+            [clojure.string :as s]
             [mdr2.production.path :as path]
             [mdr2.dtb :as dtb]))

 (defn get-meta-data [production]
   (merge production (dtb/meta-data (path/recorded-path production))))

-(defn- rdf-sexp
-  [{:keys [title creator subject description publisher date identifier source language rights
+(defn- rdf-sexp
+  [{:keys [id title creator subject description publisher date type format
+           identifier source language rights
            source_date source_edition source_publisher source_rights source_title
            multimedia_type multimedia_content narrator producer produced_date
            revision revision_date revision_description
-           total_time audio_format type]}]
+           total_time audio_format periodical_number]}]
   [:rdf:DRF {:xmlns:rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
              :xmlns:dc "http://purl.org/dc/elements/1.1/"
-             :xmlns:dtb "http://www.daisy.org/z3986/2005/dtbook/"}
+             :xmlns:dtb "http://www.daisy.org/z3986/2005/dtbook/"
+             :xmlns:sbs "http://www.sbszh.ch/sbs/namespace"}
    ;; see also
    ;; http://www.daisy.org/z3986/2005/Z3986-2005.html#Over
    [:rdf:Description
-    [:dc:title title]
-    [:dc:creator creator]
-    [:dc:subject subject]
-    [:dc:description description]
-    [:dc:publisher publisher]
-    ;; what about dc:Contributor?
-    [:dc:date date]
-    [:dc:type type]
-    [:dc:format "ANSI/NISO Z39.86-2005"] ; we are talking about DAISY3 here
-    [:dc:identifier identifier]
-    [:dc:source source]
-    [:dc:language language]
-    [:dc:rights rights]
-    [:dtb:sourceDate source_date]
-    [:dtb:sourceEdition source_edition]
-    [:dtb:sourcePublisher source_publisher]
-    [:dtb:sourceRights source_rights]
-    [:dtb:sourceTitle source_title]
-    [:dtb:multimediaType multimedia_type]
-    [:dtb:multimediaContent multimedia_content]
-    [:dtb:narrator narrator]
-    [:dtb:producer producer]
-    [:dtb:producedDate produced_date]
-    [:dtb:revision revision]
-    [:dtb:revisionDate revision_date]
-    [:dtb:revisionDescription revision_description]
-    [:dtb:totalTime total_time]
-    [:dtb:audioFormat audio_format]]])
+    (for [[k v]
+          (->> [:dc:title title
+                :dc:creator creator
+                :dc:subject subject
+                :dc:description description
+                :dc:publisher publisher
+                ;; what about dc:Contributor?
+                :dc:date date
+                :dc:type type
+                :dc:format format
+                :dc:identifier identifier
+                :dc:source source
+                :dc:language language
+                :dc:rights rights
+                :dtb:sourceDate source_date
+                :dtb:sourceEdition source_edition
+                :dtb:sourcePublisher source_publisher
+                :dtb:sourceRights source_rights
+                :dtb:sourceTitle source_title
+                :dtb:multimediaType multimedia_type
+                :dtb:multimediaContent multimedia_content
+                :dtb:narrator narrator
+                :dtb:producer producer
+                :dtb:producedDate produced_date
+                :dtb:revision revision
+                :dtb:revisionDate revision_date
+                :dtb:revisionDescription revision_description
+                :dtb:totalTime total_time
+                :dtb:audioFormat audio_format
+                :sbs:idVorstufe periodical_number
+                :sbs:idMaster (str "DAM " id)]
+               (partition 2))]
+      (when v [k v]))]])

 (defn rdf
   "Create rdf for a given production"


Removed silly code.

Removed silly code.

--- src/onix/web.clj
+++ src/onix/web.clj
@@ -84,8 +84,6 @@
      (cheshire/generate-string)
      (response json-content-type))))

-(status)
-
 (defn- create-application
   [req]
   (let [body (cheshire/parse-string (slurp (:body req)))


Fix typo in pepa.log comment

Fix typo in pepa.log comment

--- src/pepa/log.clj
+++ src/pepa/log.clj
@@ -4,7 +4,7 @@

 ;;; Logger is a special component. Instead of being available via
 ;;; `component/using' we inject it into every component already in the
-;;; system. That wasy ::loggre is available in every component and can
+;;; system. That wasy ::logger is available in every component and can
 ;;; be used like:
 ;;;
 ;;; (log/info some-component ...)


Fixed problem with the pusher not logging how far along it was.

--- src/cmr/common/channels.clj
+++ src/cmr/common/channels.clj
@@ -56,7 +56,7 @@
     (loop [items items num-items 1]
       (when (and items (not (closed? chan)))

-        (if-let [item (first items)]
+        (when-let [item (first items)]
           (push chan item)

           ;; Intermediate logging
@@ -70,12 +70,11 @@

 (defn consume-all
   "Consumes all the messages on the channel with the function f. Continues to wait until channel
-  returns nil or stop-fn returns true for an item."
-  [chan f]
+  returns nil."
+  [chan f sleeper]
   (let [start (System/currentTimeMillis)]
     (loop [item (pull chan) num-items 1]
       (when item
-
         ;; process the item
         (f item)

@@ -128,6 +127,13 @@
   (pull c)
   (count (:queue c))

+  (process-tasks :tasks-fn #(range 4000)
+                 :processor (fn [t]
+                              (info "processing " t)
+                              (Thread/sleep 10))
+                 :num-threads 4
+                 :task-name "sleep-test")
+
   (future
     (push-seq c (range 100))
     (println "Finished pushing 100 items")


Changing default echo rest port to 3008.

--- src/cmr/transmit/config.clj
+++ src/cmr/transmit/config.clj
@@ -21,7 +21,7 @@

 (def bootstrap-port (cfg/config-value-fn :bootstrap-port 3006 parse-port))

-(def echo-rest-port (cfg/config-value-fn :echo-rest-port 3007 parse-port))
+(def echo-rest-port (cfg/config-value-fn :echo-rest-port 3008 parse-port))

 (def echo-system-token (cfg/config-value-fn :echo-system-token "mock-echo-system-token"))


CMR-978: Addressed review comments.

CMR-978: Addressed review comments.

--- umm-lib/src/cmr/umm/validation/parent_weaver.clj
+++ umm-lib/src/cmr/umm/validation/parent_weaver.clj
@@ -37,7 +37,7 @@
     (-> granule
         (assoc :parent coll)
         (update-in [:spatial-coverage] set-parent (:spatial-coverage coll))
-        (update-in [:platform-refs] set-parent (:platforms coll))
+        (update-in [:platform-refs] set-parents-by-name (:platforms coll) :short-name)
         (update-in [:product-specific-attributes]
                    set-parents-by-name (:product-specific-attributes coll) :name)))

@@ -48,7 +48,6 @@
     [obj parent]
     (assoc obj :parent parent))

-
   java.util.List
   (set-parent
     [obj parent]
@@ -56,21 +55,17 @@

   PlatformRef
   (set-parent
-    [platform-ref platforms]
-    (let [{:keys [short-name]} platform-ref
-          platform (first (filter #(= short-name (:short-name %)) platforms))]
-      (-> platform-ref
-          (assoc :parent platform)
-          (update-in [:instrument-refs] set-parent (:instruments platform)))))
+    [platform-ref platform]
+    (-> platform-ref
+        (assoc :parent platform)
+        (update-in [:instrument-refs] set-parents-by-name (:instruments platform) :short-name)))

   InstrumentRef
   (set-parent
-    [instrument-ref instruments]
-    (let [{:keys [short-name]} instrument-ref
-          instrument (first (filter #(= short-name (:short-name %)) instruments))]
-      (-> instrument-ref
-          (assoc :parent instrument)
-          (update-in [:sensor-refs] set-parents-by-name (:sensors instrument) :short-name))))
+    [instrument-ref instrument]
+    (-> instrument-ref
+        (assoc :parent instrument)
+        (update-in [:sensor-refs] set-parents-by-name (:sensors instrument) :short-name)))

   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   ;; The protocol is extended to nil so we can attempt to set the parent on items which do not have


Rename 'should' to 'is', fix some local names

--- src/main/clojure/com/stuartsierra/lazytest.clj
+++ src/main/clojure/com/stuartsierra/lazytest.clj
@@ -95,7 +95,7 @@
   `(let [active# ~active
          contexts# ~contexts
          merged# (reduce open-context active# contexts#)
-         ~states (map merged contexts#)]
+         ~states (map merged# contexts#)]
      (try
       ~@body
       (finally
@@ -155,7 +155,7 @@

 ;;; Public API

-(defmacro should
+(defmacro is
   "A series of assertions.  Each assertion is a simple expression,
   which will be compiled into a function.  A string will be attached
   as :doc metadata on the following assertion."
@@ -174,7 +174,7 @@
                           :line ~(:line (meta form))}
                          nil))
                nxt))
-      `(SimpleContainer ~r {:generator should
+      `(SimpleContainer ~r {:generator 'is
                             :line ~(:line (meta &form))
                             :form '~&form}
                         nil))))
@@ -206,7 +206,7 @@
                             :line ~(:line (meta form))}
                            nil))
                  nxt))
-        `(SimpleContainer ~r {:generator given
+        `(SimpleContainer ~r {:generator 'given
                               :line ~(:line (meta &form))
                               :form '~&form}
                           nil)))))
@@ -217,9 +217,9 @@
   [:name :doc :ns :file] and a is remaining arguments."
   [args]
   (let [m {:ns *ns*, :file *file*}
-        m    (if (symbol? (first args)) (assoc m :name (first args)))
+        m    (if (symbol? (first args)) (assoc m :name (first args)) m)
         args (if (symbol? (first args)) (next args) args)
-        m    (if (string? (first args)) (assoc m :doc (first args)))
+        m    (if (string? (first args)) (assoc m :doc (first args)) m)
         args (if (string? (first args)) (next args) args)]
     [m args]))

@@ -237,16 +237,16 @@
   decl   => name? docstring? option* child*

   name  => a symbol, will def a Var if provided.
-  child => 'should' or 'given' or nested 'testing'.
+  child => 'is' or 'given' or nested 'testing'.

   options => keyword/value pairs, recognized keys are:
     :contexts => vector of contexts to run only once for this container.
     :strategy => a test-running strategy."
   [& decl]
-  (let [[m decl] (assoc (attributes decl)
-                   :line (:line (meta &form))
-                   :generator `testing
-                   :form &form)
+  (let [[m decl] (attributes decl)
+        m (assoc m :line (:line (meta &form))
+                 :generator `testing
+                 :form &form)
         [opts decl] (options decl)
         {:keys [contexts strategy]} opts
         children (vec decl)
@@ -269,10 +269,10 @@
   name  => a symbol, will def a Var if provided.
 "
   [& decl]
-  (let [[m decl] (assoc (attributes decl)
-                   :line (:line (meta &form))
-                   :generator `dotest
-                   :form &form)
+  (let [[m decl] (attributes decl)
+        m (assoc m :line (:line (meta &form))
+                 :generator `dotest
+                 :form &form)
         bindings (first decl)
         body (next decl)
         sym (gensym "c")]


Allow multiple namespaces for gencompletions

--- src/main/clojure/vimclojure/gencompletions.clj
+++ src/main/clojure/vimclojure/gencompletions.clj
@@ -13,19 +13,18 @@
 ;
 ; See also: http://en.wikibooks.org/wiki/Clojure_Programming

-(ns vimclojure.gencompletions
-  (:gen-class
-     :main true))
+(ns vimclojure.gencompletions)

 (defmacro with-out-file [pathname & body]
   `(with-open [stream# (new java.io.FileWriter ~pathname)]
      (binding [*out* stream#]
        ~@body)))

-(defn -main
-  [nspace]
-  (require (symbol nspace))
-  (let [completions (keys (ns-publics (symbol nspace)))]
-    (with-out-file (str nspace "-keys.txt")
-      (doseq [x (sort completions)]
-        (println x)))))
+(defn main
+  [& nspaces]
+  (doseq [nspace nspaces]
+    (require (symbol nspace))
+    (let [completions (keys (ns-publics (symbol nspace)))]
+      (with-out-file (str "completions-" nspace ".txt")
+        (doseq [x (sort completions)]
+          (println x))))))


Redid bit-switch function for increased perf

--- src/longshi/fressian/js.cljs
+++ src/longshi/fressian/js.cljs
@@ -15,19 +15,39 @@
 (def ^:private two-power-24 (bit-shift-left 1 24))
 (def ^:private two-power-32 (* two-power-16 two-power-16))
 ;;Integer helpers
-(defn bit-switch
+(def zero-table #js [31 22 30 21 18 10 29 2 20 17 15 13 9 6 28 1 23 19 11 3 16 14 7 24 12 4 8 25 5 26 27 0])
+(defn leading-zeros [v]
+  "finds the number of zeros before the most significant bit
+
+  x (int) - Positive integer to get the number of leading zeros
+
+  This is based off of an algorithm of finding the most significant bit
+  http://graphics.stanford.edu/~seander/bithacks.html#IntegerLogDeBruijn
+  "
+  (let [x (loop [x v y 1]
+            (if (<= y 16)
+              (recur (bit-or x (bit-shift-right x y)) (bit-shift-left y 1))
+              x))]
+    (aget zero-table (unsigned-bit-shift-right (* x 0x07C4ACDD) 27))))
+(defn bit-switch [x]
   "Gets the 64 minus the number of bits needed for the number

   x (Long) - Google Closure Long (for perf reasons) to get the bits of

   -1 and 0 return 64."
-  [x]
   (cond
-    (or (.equals Long.ONE x) (.equals Long.NEG_ONE x)) 64
-    :else
-    (if (neg? x)
-      (- 64 (.getNumBitsAbs (.not x)))
-      (- 64 (.getNumBitsAbs x)))))
+    (== 0 (.-low_ x) (.-high_ x)) 64
+    (== -1 (.-low_ x) (.-high_ x)) 64
+    (neg? (.-high_ x))
+    (let [low (bit-not (.-low_ x))
+          high (bit-not (.-high_ x))
+          high-zeros (if (zero? high) 32 0)
+          leading-bits (if (zero? high) low high)]
+      (+ high-zeros (leading-zeros leading-bits)))
+   :else
+   (let [high-zeros (if (zero? (.-high_ x)) 32 0)
+         leading-bits (if (zero? (.-high_ x)) (.-low_ x) (.-high_ x))]
+     (+ high-zeros (leading-zeros leading-bits)))))

 (defn string-chunk-utf8!
   "Writes up to 64K bytes of a string


made rearranged the code to make more sense

--- src/lseq_tree/lseq_node.cljc
+++ src/lseq_tree/lseq_node.cljc
@@ -6,6 +6,94 @@
   (.indexOf xs n))

 (defrecord Node [triple element sub-counter children])
+
+(declare count-elements count-children filled-node make-node)
+
+(defn node-zip
+  [root]
+  (z/zipper :children (comp seq :children) make-node root))
+
+(defn node
+  [[triple & xs] element]
+  (if (= (count xs) 0)
+    (Node. triple element 0 [])
+    (Node. triple nil 1 [(node xs element)])))
+
+(declare add del fetch index-of indexes)
+
+(declare nth-child replace-node merge-node)
+
+(defn add
+  "adds a node with one child at each level(a limb) to the children of a node"
+  [node limb]
+  (let [paths (indexes node limb)
+        node-loc (node-zip node)]
+    (if (last paths)
+      (replace-node paths node-loc limb)
+      (merge-node paths node-loc limb))))
+
+(defn del
+  [node limb]
+  (let [paths (indexes node limb)]
+    (if (last paths)
+      (loop [[head & tail] paths
+             node-loc (nth-child (node-zip node) head)]
+        (if (empty? tail)
+          (-> node-loc
+              (z/edit assoc :element nil)
+              z/root)
+          (recur tail (nth-child node-loc head))))
+      node)))
+
+(declare left-to-right)
+
+(defn index-of
+  "returns the zero-based index of a limb in a node"
+  [node limb]
+  (let [paths (indexes node limb)]
+    (if (last paths)
+      (loop [[head & tail] paths,
+             {:keys [children] :as node} node,
+             acc (if (:element node) 1 0)]
+        (if head
+          (recur tail
+                 (nth children head)
+                 (+ acc (left-to-right head node)))
+          (dec acc)))
+      nil))) ;zero-based index
+
+(defn indexes
+  "returns a vector of numbers for each level that the index of a limb is
+  located at in a node. returns nil instead of a number when it can't find the
+  limb (eg [1 2 3 nil])"
+  [node limb]
+  (loop [path [], node node, limb limb]
+    (let [{:keys [children]} node
+          index (find-in (map :triple children) (:triple limb))]
+      ;does the node contain the limb
+      (if (or (< index 0)
+              (and (= index 0) (= (count children) 0)))
+        (conj path nil)
+        ;does the limb have more children
+        (if (or (= (count (:children limb)) 0)
+                (= (count children) 0))
+          (conj path index)
+          (recur (conj path index)
+                 (nth children index)
+                 (first (:children limb))))))))
+
+(declare crawl-to crawl-out)
+
+(defn fetch [node index]
+  "takes a node and an index and returns a recreation of the node at that index
+  as a limb"
+  (-> node
+      (crawl-to index)
+      (crawl-out)))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Helpers
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 (defn count-elements
   [{:keys [sub-counter element]}]
@@ -29,18 +117,6 @@
             element
             sub-counter
             (sorted :triple children))))
-
-(defn node-zip
-  [root]
-  (z/zipper :children (comp seq :children) make-node root))
-
-(defn node
-  [[triple & xs] element]
-  (if (= (count xs) 0)
-    (Node. triple element 0 [])
-    (Node. triple nil 1 [(node xs element)])))
-
-(declare add del fetch index-of indexes)

 (defn nth-child
   "Returns the loc of the nth child of the node at this loc, or
@@ -77,28 +153,6 @@
            (nth-child node-loc head)
            (first (:children limb)))))

-(defn add
-  "adds a node with one child at each level(a limb) to the children of a node"
-  [node limb]
-  (let [paths (indexes node limb)
-        node-loc (node-zip node)]
-    (if (last paths)
-      (replace-node paths node-loc limb)
-      (merge-node paths node-loc limb))))
-
-(defn del
-  [node limb]
-  (let [paths (indexes node limb)]
-    (if (last paths)
-      (loop [[head & tail] paths
-             node-loc (nth-child (node-zip node) head)]
-        (if (empty? tail)
-          (-> node-loc
-              (z/edit assoc :element nil)
-              z/root)
-          (recur tail (nth-child node-loc head))))
-      node)))
-
 (defn left-to-right
   "a strategy that returns the sum of the branches to the left of a position
   in a node"
@@ -111,41 +165,6 @@
         (recur (dec pos)
                (z/right branch)
                (+ sub-counter acc*))))))
-
-(defn index-of
-  "returns the zero-based index of a limb in a node"
-  [node limb]
-  (let [paths (indexes node limb)]
-    (if (last paths)
-      (loop [[head & tail] paths,
-             {:keys [children] :as node} node,
-             acc (if (:element node) 1 0)]
-        (if head
-          (recur tail
-                 (nth children head)
-                 (+ acc (left-to-right head node)))
-          (dec acc)))
-      nil))) ;zero-based index
-
-(defn indexes
-  "returns a vector of numbers for each level that the index of a limb is
-  located at in a node. returns nil instead of a number when it can't find the
-  limb (eg [1 2 3 nil])"
-  [node limb]
-  (loop [path [], node node, limb limb]
-    (let [{:keys [children]} node
-          index (find-in (map :triple children) (:triple limb))]
-      ;does the node contain the limb
-      (if (or (< index 0)
-              (and (= index 0) (= (count children) 0)))
-        (conj path nil)
-        ;does the limb have more children
-        (if (or (= (count (:children limb)) 0)
-                (= (count children) 0))
-          (conj path index)
-          (recur (conj path index)
-                 (nth children index)
-                 (first (:children limb))))))))

 (defn crawl-to
   "returns a zipper with it's location where the index in a node"
@@ -173,10 +192,4 @@
         (recur (z/up zip) child)
         build))))

-(defn fetch [node index]
-  "takes a node and an index and returns a recreation of the node at that index
-  as a limb"
-  (-> node
-      (crawl-to index)
-      (crawl-out)))


add markup for repositories view

add markup for repositories view

--- src/otto/html.clj
+++ src/otto/html.clj
@@ -11,14 +11,33 @@
               (let [n (:name o)]
                 [:li (if (= o current)
                        {:class "current"})
-                 [:a {:href (format "/%s" n)} n]])) organizations)])
+                 [:a {:href (format "/%s" n)} n]]))
+            organizations)])
+
+(defn- format-string
+  [string]
+  (if (clojure.string/blank? string)
+    "–"
+    string))
+
+(defn- format-date
+  [date]
+  (if (nil? date)
+    "–"
+    (.format (java.text.SimpleDateFormat. "dd-MM-yyyy") date)))

 (defn- repository-collection
   [repositories]
   (if (empty? repositories)
     [:p "Listing currently unavailable."]
-    [:ul (for [[_ repository-data] repositories]
-           [:li (:name repository-data)])]))
+    [:table (for [[_ repository] repositories]
+              [:tr (if (= true (:private repository))
+                     {:class "private"})
+               [:td (:name repository)
+                    (if (= true (:fork repository))
+                      [:span {:class "fork"} "fork"])]
+               [:td (format-string (:language repository))]
+               [:td (format-date (:pushed_at repository))]])]))

 (defn organization-view
   [organizations organization repositories]


Remove commented out code

Remove commented out code

--- src/main/clojure/cascade.clj
+++ src/main/clojure/cascade.clj
@@ -29,7 +29,6 @@
   preceding the parameters vector. The function's forms are an implicit inline block."
   [& forms]
   (let [[fn-name fn-params template-forms] (parse-function-def forms)]
-    ;   (printf "(defview %s ^%s %s %s)\n" fn-name (meta fn-name) fn-params template-forms)
     `(defn ~fn-name ~(or (meta fn-name) {}) ~fn-params
       (template ~@template-forms))))


gzip source maps

gzip source maps

--- src/main/shadow/cljs/devtools/server/ring_gzip.clj
+++ src/main/shadow/cljs/devtools/server/ring_gzip.clj
@@ -48,7 +48,7 @@
         (seq? body)
         (instance? InputStream body)
         (and (instance? File body)
-             (re-seq #"(?i)\.(htm|html|css|js|json|xml)" (pr-str body))))))
+             (re-seq #"(?i)\.(htm|html|css|js|json|xml|map|edn)" (.getName ^File body))))))

 (def ^:private min-length 859)


pass draw function into boilerplate wrapper

--- src-cljs/jasons_game/ui.cljs
+++ src-cljs/jasons_game/ui.cljs
@@ -7,7 +7,7 @@
 ;; Styles

 (def styles {:cursor {:stroke 0}
-             :actor {:stroke 0, :fill [255, 0, 0]}
+             :actor {:stroke 0, :fill [0, 255, 0]}
              :speech-balloon {:fill [0, 0, 255]}
              :words {:fill 255}})

@@ -49,22 +49,23 @@

 ;; Sketch

-(defn draw-begin [name x y]
+(defn draw [name x y f]
   (s/push-style)
   (set-style name)
   (s/push-matrix)
-  (s/translate x y))
-
-(defn draw-end []
+  (s/translate x y)
+
+  (f)
+
   (s/pop-matrix)
   (s/pop-style))

 (def cursor-size 10)
 (defn draw-cursor [x y]
-  (draw-begin :cursor x y)
-  (s/line (- cursor-size) 0, cursor-size 0)
-  (s/line 0 (- cursor-size), 0 cursor-size)
-  (draw-end))
+  (draw :cursor x y
+        (fn []
+          (s/line (- cursor-size) 0, cursor-size 0)
+          (s/line 0 (- cursor-size), 0 cursor-size))))

 (def offset 10)
 (def point-width 20)
@@ -72,30 +73,29 @@
 (defn draw-speech-balloon [speech x y]
   (let [balloon-width (+ (s/text-width speech) 40)
         balloon-height (+ (s/text-ascent) (s/text-descent) 40)]
-    (draw-begin :speech-balloon x y)
-    (s/translate (- (/ balloon-width 2)) (- (+ offset point-height balloon-height)))
-
-    (s/begin-shape)
-    (s/vertex 0 0)
-    (s/vertex balloon-width 0)
-    (s/vertex balloon-width balloon-height)
-    (s/vertex (+ (/ balloon-width 2) point-width) balloon-height)
-    (s/vertex (/ balloon-width 2) (+ balloon-height point-height))
-    (s/vertex (/ balloon-width 2) balloon-height)
-    (s/vertex 0 balloon-height)
-    (s/end-shape)
-
-    (set-style :words)
-    (s/text speech 20 (+ 20 (s/text-ascent)))
-
-    (draw-end)))
+    (draw :speech-balloon x y
+          (fn []
+            (s/translate (- (/ balloon-width 2)) (- (+ offset point-height balloon-height)))
+
+            (s/begin-shape)
+            (s/vertex 0 0)
+            (s/vertex balloon-width 0)
+            (s/vertex balloon-width balloon-height)
+            (s/vertex (+ (/ balloon-width 2) point-width) balloon-height)
+            (s/vertex (/ balloon-width 2) (+ balloon-height point-height))
+            (s/vertex (/ balloon-width 2) balloon-height)
+            (s/vertex 0 balloon-height)
+            (s/end-shape)
+
+            (set-style :words)
+            (s/text speech 20 (+ 20 (s/text-ascent)))))))

 (def actor-radius 100)
 (defn draw-actor [x y]
-  (draw-begin :actor x y)
-  (s/ellipse 0 0 actor-radius actor-radius)
-  (draw-speech-balloon "How are you" 0 (- (/ actor-radius 2)))
-  (draw-end))
+  (draw :actor x y
+        (fn []
+          (s/ellipse 0 0 actor-radius actor-radius)
+          (draw-speech-balloon "How are you" 0 (- (/ actor-radius 2))))))

 (def sketchy {:setup (fn []
                        (s/size (.-innerWidth js/window) (.-innerHeight js/window))


Raw trope listing on the front end

Raw trope listing on the front end

Likely not keeping this as is, since we are even displaying things that
show spoilers, but committing while I work on experiments.

--- src-cljs/tropology/core.cljs
+++ src-cljs/tropology/core.cljs
@@ -1,5 +1,6 @@
 (ns tropology.core
-  (:require [reagent.core :as reagent :refer [atom]]
+  (:require [ajax.core :refer [GET POST PUT]]
+            [reagent.core :as reagent :refer [atom]]
             [clojure.string :refer [lower-case]]
             [goog.object :as gobject]
             [secretary.core :as secretary]
@@ -151,8 +152,17 @@
     ))

+
+
 (defn list-tropes [trope-code]
-  (.log js/console trope-code))
+  (.log js/console trope-code)
+  (GET (str "/api/tropes/" (lower-case trope-code))
+       {:handler (fn [response]
+                   (.log js/console (str "Done obtaining " trope-code))
+                   (.log js/console response)
+                   (swap! state assoc :tropes response))}
+       )
+  )

 (def trope-code-form
@@ -175,7 +185,12 @@
                                           [:input {:type     "button"
                                                    :value    "List tropes"
                                                    :on-click #(list-tropes (:trope-code @form-data))}]
-                                          [:div {:id "trope-list-container"}]]
+                                          [:div {:id "trope-list-container"}
+                                           [:ul
+                                            (for [trope (:tropes @state)]
+                                              [:li {:dangerouslySetInnerHTML {:__html (trope "text")}}])
+                                            ]
+                                           ]]
          :else "Nope"
          )])
     ))


Fix clojure.pprint.

Fix clojure.pprint.

--- web-server/src/clj/hatnik/web/server/handler.clj
+++ web-server/src/clj/hatnik/web/server/handler.clj
@@ -1,5 +1,6 @@
 (ns hatnik.web.server.handler
-  (:require [compojure.core :refer :all]
+  (:require clojure.pprint
+            [compojure.core :refer :all]
             [compojure.handler :as handler]
             [compojure.route :as route]
             [hatnik.web.server.example-data :as ex-data]


fix DOM warning

fix DOM warning

--- src/rpi_wall/gmail/client.cljs
+++ src/rpi_wall/gmail/client.cljs
@@ -14,14 +14,8 @@
 (defn format-email-ls
   [x]
   (if (nil? x)
-    "No s'ha pogut connectar amb gmail"
+    [:tbody [:tr [:td "No s'ha pogut connectar amb gmail"]]]
     (into [:tbody] (map format-email x))))
-
-;(defn gmail
-  ;[]
-  ;[:div.gmail
-     ;[:table#gmail [:thead [:tr [:th {:col-span 2} "gmail"]]]
-                   ;(format-email-ls @new-emails-state)]])

 (defn gmail
   []


Fix Edit Offering Page

Fix Edit Offering Page

--- src/name_bazaar/ui/pages/offering_create_page.cljs
+++ src/name_bazaar/ui/pages/offering_create_page.cljs
@@ -278,7 +278,7 @@
             offering-loaded? @(subscribe [:offering/loaded? address])
             offering @(subscribe [:offering address])]
         [app-layout
-         {:meta {:title "NameBazaar - Edit Offering" :description "Edit an offering sell your ENS name"}}
+         {:meta {:title "NameBazaar - Edit Offering" :description "Edit your ENS name offering"}}
          [ui/Segment
           [:h1.ui.header.padded "Edit Offering"]


change port

change port

--- src/rrm/core.clj
+++ src/rrm/core.clj
@@ -46,5 +46,5 @@
 (defn -main
   "Record Room Management System "
   [& args]
-  (jetty/run-jetty app {:port 80
+  (jetty/run-jetty app {:port 8080
                         :join? false}))


Invoke the MSP

Invoke the MSP

--- web/test-integration/immutant/web/integ_test.clj
+++ web/test-integration/immutant/web/integ_test.clj
@@ -59,7 +59,7 @@
                 socket (http/websocket client (url "ws")
                          :text (fn [_ s] (deliver result (decode s)))
                          :cookies @testing.web/cookies)]
-      (let [handshake (deref result 1000 {})]
+      (let [handshake (deref result 5000 {})]
         (is (= {:count 2} (:session handshake))))))
   (is (= "2" (get-body (url)))))

@@ -68,7 +68,7 @@
     (with-open [client (http/create-client)
                 socket (http/websocket client (str (url "ws") "?x=y&j=k")
                          :text (fn [_ s] (deliver result (decode s))))]
-      (let [handshake (deref result 1000 nil)]
+      (let [handshake (deref result 5000 nil)]
         (is (not (nil? handshake)))
         (is (= "Upgrade"   (-> handshake :headers (get "Connection") first)))
         (is (= "k"         (-> handshake :parameters (get "j") first)))


users no longer have to be strings

users no longer have to be strings

--- src/shoutout.clj
+++ src/shoutout.clj
@@ -18,6 +18,46 @@

 ;; functional core
 (defrecord Feature [feature-name groups users percentage])
+
+(defprotocol HasUserId
+  "see the doc string for shoutout/user-id"
+  (user-id
+    [this]
+    "converts a user (of the protocol type) into a user id (which is just a
+    string).
+    this conversion happens in a few places:
+      - to check if a user should be in the activated percentage
+      - when marking a user as active for an individual feature
+      - when checking if a user is marked as active for an feature"))
+
+(extend-type String HasUserId
+  (user-id [this] this))
+
+(extend-type java.lang.Number HasUserId
+  (user-id [this] (str this)))
+
+(defn is-active-in-percentage [{percentage :percentage} user]
+  (< (mod (crc32 (user-id user)) 100) percentage))
+
+(defn is-active-user? [{active-users :users} user]
+  (contains? active-users (user-id user)))
+
+(defn is-active-in-group? [{active-groups :groups} group-definition user]
+  (some
+    (fn [group-name]
+      ((group-definition group-name (constantly false)) user))
+
+    active-groups))
+
+(defn active-feature?
+  "works out if a user is active in a feature, by checking percentages, if
+  they're specifically marked as active, or if they're in a group that is
+  active"
+  [feature group-definition user]
+  (or
+    (is-active-in-percentage feature user)
+    (is-active-user? feature user)
+    (is-active-in-group? feature group-definition user)))

 (defn parse-percentage [^String raw]
   (if (empty? raw)
@@ -44,28 +84,6 @@
     "|"
     (s/join "," (:groups feature))))

-(defn is-active-in-percentage [{percentage :percentage} user]
-  (< (mod (crc32 user) 100) percentage))
-
-(defn is-active-user? [{active-users :users} user]
-  (contains? active-users user))
-
-(defn is-active-in-group? [{active-groups :groups} group-definition user]
-  (some
-    (fn [group-name]
-      ((group-definition group-name (constantly false)) user))
-
-    active-groups))
-
-(defn active-feature?
-  "works out if a user is active in a feature, by checking percentages, if
-  they're specifically marked as active, or if they're in a group that is
-  active"
-  [feature group-definition user]
-  (or
-    (is-active-in-percentage feature user)
-    (is-active-user? feature user)
-    (is-active-in-group? feature group-definition user)))

 ;; imperative shell
 (defprotocol ShoutoutStorage
@@ -132,7 +150,7 @@
     (fn [feature]
       (update-in feature
                 :users
-                 #(conj % user)))))
+                 #(conj % (user-id user))))))

 (defn deactivate-user
   "deactivate a feature for a particular user"
@@ -141,7 +159,7 @@
     (fn [feature]
       (update-in feature
                  :users
-                 #(disj % user)))))
+                 #(disj % (user-id user))))))

 (defn activate-percentage
   "activate a feature for a percentage of users.


better qa

better qa

--- src/picsou/qa.clj
+++ src/picsou/qa.clj
@@ -5,6 +5,7 @@
 (defn go []
   (let [all (j/parse-string (slurp "resources/export.json"))
         en (get (first (filter #(= "en" (% "body")) all)) "start")
+        ;en (take 100 en)
         results (for [[phrase start' end'] en :when (<= end' (count phrase))]
                   (let [s (subs phrase start' end')
                         {:keys [winners] :as res} (p/parse s p/default-context :en$core [{:dim :time :label "T"}])
@@ -12,6 +13,8 @@
                         covers? (and start
                                      (= 0 start)
                                      (= (count s) end))]
-                    [s covers? value]))]
-    (prn (count results))
-    (prn (count (filter second results)))))
+                    [s covers? value]))
+        ko (remove second results)]
+    (printf "%d/%d passing\n" (- (count results) (count ko)) (count results))
+    (doseq [r ko]
+      (printf "%-40s %s\n" (first r) (-> r last :start)))))


[#9470] Fix status bar in dark mode (iOS)

--- src/status_im/ui/components/status_bar/styles.cljs
+++ src/status_im/ui/components/status_bar/styles.cljs
@@ -10,10 +10,10 @@

 (styles/def status-bar-default
   {:ios     (create-status-bar-style {:background-color colors/white
-                                      :bar-style        "default"})
+                                      :bar-style        "dark-content"})
    :android (create-status-bar-style {:translucent?     true
                                       :bar-style        "dark-content"})})

 (styles/def status-bar-black
   {:ios     (create-status-bar-style {:background-color colors/transparent})
-   :android (create-status-bar-style {:background-color colors/black})})+   :android (create-status-bar-style {:background-color colors/black})})


Drag out `unexpanded-op?` as defn.

Drag out `unexpanded-op?` as defn.

--- src/smallex/grammar_checks.clj
+++ src/smallex/grammar_checks.clj
@@ -1,4 +1,8 @@
 (ns smallex.grammar-checks)
+
+(defn- unexpanded-op? [expr]
+  (and (= :op (:type expr))
+       (not (-> expr meta :alias-expansion))))

 (def ^:private single-arg-op?
   "Returns true if the op is a single-argument op, false otherwise."
@@ -24,14 +28,12 @@
   "Recursively checks that an expression uses correct arity, and returns a
   lazy seq of the erroneous calls as ExceptionInfos."
   [expr-name expr]
-  (cond (not= :op (:type expr)) ()
-        (-> expr meta :alias-expansion) () ;; Should be handled in resp. aliases
-        :else
-        (let [some-exn (op-arity-exn expr-name expr)]
-          (->> (:args expr)
-               (map #(check-expr-arity expr-name %))
-               (apply concat)
-               (concat some-exn)))))
+  (if (unexpanded-op? expr)
+    (let [some-exn (op-arity-exn expr-name expr)]
+      (->> (:args expr)
+           (map #(check-expr-arity expr-name %))
+           (apply concat)
+           (concat some-exn)))))

 (defn check-arity
   "Checks that all operations have correct arity. Returns a sequence of
@@ -51,8 +53,7 @@
   "Recursively checks that an expression has correct input arg types, and
   returns a lazy seq of the erroneous calls as ExceptionInfos."
   [expr]
-  (if (and (= :op (:type expr))
-           (not (-> expr meta :alias-expansion)))
+  (if (unexpanded-op? expr)
     (concat
      (case (:value expr)
        (:cat :opt :plus :star :or) nil
@@ -85,8 +86,7 @@
           (list (ex-info "Couldn't find the definition for symbol."
                          {:type :symbol-ref, :expr expr})))
         ;; ^^ TODO: Damerau-Levensthein? =)
-        (and (= :op (:type expr))
-             (not (-> expr meta :alias-expansion)))
+        (unexpanded-op? expr)
         (mapcat #(check-expr-symbol-refs g %) (:args expr))
         :else nil))


parse markdown only for changed files

parse markdown only for changed files

--- src/io/perun.clj
+++ src/io/perun.clj
@@ -38,15 +38,24 @@
   "Parse markdown files"
   [f create-filename CREATE_FILENAME str "Function that creates final target filename of the file"]
   (let [pod (create-pod markdown-deps)
-        options (merge +markdown-defaults+ *opts*)]
+        options (merge +markdown-defaults+ *opts*)
+        last-markdown-files (atom nil)]
     (boot/with-pre-wrap fileset
-      (let [markdown-files (->> fileset boot/user-files (boot/by-ext ["md" "markdown"]) (map #(.getPath (boot/tmp-file %))))
-            parsed-metadata (pod/with-call-in @pod
-                              (io.perun.markdown/parse-markdown
-                                ~markdown-files
-                                ~options))
-            fs-with-meta (with-meta fileset {:metadata parsed-metadata})]
-        fs-with-meta))))
+      (let [markdown-files (->> fileset
+                                (boot/fileset-diff @last-markdown-files)
+                                boot/user-files
+                                (boot/by-ext ["md" "markdown"])
+                                (map #(.getPath (boot/tmp-file %))))]
+            (do
+              (reset! last-markdown-files fileset)
+              (let [parsed-metadata (pod/with-call-in @pod
+                                      (io.perun.markdown/parse-markdown
+                                        ~markdown-files
+                                        ~options))
+                    initial-metadata (or (:metadata (meta fileset)) {})
+                    final-metadata (merge initial-metadata parsed-metadata)
+                    fs-with-meta (with-meta fileset {:metadata final-metadata})]
+          fs-with-meta))))))

 (def ^:private ttr-deps
   '[[time-to-read "0.1.0"]])
@@ -77,7 +86,7 @@
     (assoc file :filepath file-path)))

 (deftask permalink
-  "Make files permalinked"
+  "Make files permalinked. E.x. about.html will become about/index.html"
   []
   (let [options (merge +defaults+ *opts*)]
     (boot/with-pre-wrap fileset


use React.Component instead of React.createClass

--- src/rum/core.cljs
+++ src/rum/core.cljs
@@ -4,6 +4,8 @@
   (:require
     [cljsjs.react]
     [cljsjs.react.dom]
+    [goog :as goog]
+    [goog.object :as gobj]
     [sablono.core]
     [rum.cursor :as cursor]
     [rum.util :as util :refer [collect collect* call-all]]
@@ -33,18 +35,22 @@
                                   :after-render] mixins)    ;; state -> state
         will-unmount   (collect   :will-unmount mixins)     ;; state -> state
         child-context  (collect   :child-context mixins)    ;; state -> child-context
-        class-props    (reduce merge (collect :class-properties mixins))] ;; custom properties and methods
-
-    (-> {:displayName display-name
-         :getInitialState
-         (fn []
-           (this-as this
-             (let [props (.-props this)
-                   state (-> (aget props ":rum/initial-state")
-                             (assoc :rum/react-component this)
-                             (call-all init props))]
-               #js { ":rum/state" (volatile! state) })))
-         :componentWillMount
+        class-props    (reduce merge (collect :class-properties mixins)) ;; custom properties and methods
+
+        ctor (fn [props]
+               (this-as this
+                 (set! (.-state this)
+                       #js {":rum/state"
+                            (-> (gobj/get props ":rum/initial-state")
+                                (assoc :rum/react-component this)
+                                (call-all init props)
+                                volatile!)})
+                 (.call js/React.Component this props)))]
+
+    (gobj/set ctor "displayName" display-name)
+    (goog/inherits ctor js/React.Component)
+
+    (-> {:componentWillMount
          (when-not (empty? will-mount)
            (fn []
              (this-as this
@@ -59,7 +65,7 @@
            (this-as this
              (let [old-state  @(state this)
                    state      (merge old-state
-                                     (aget next-props ":rum/initial-state"))
+                                     (gobj/get next-props ":rum/initial-state"))
                    next-state (reduce #(%2 old-state %1) state did-remount)]
                ;; allocate new volatile so that we can access both old and new states in shouldComponentUpdate
                (.setState this #js {":rum/state" (volatile! next-state)}))))
@@ -68,13 +74,13 @@
            (fn [next-props next-state]
              (this-as this
                (let [old-state @(state this)
-                     new-state @(aget next-state ":rum/state")]
+                     new-state @(gobj/get next-state ":rum/state")]
                  (or (some #(% old-state new-state) should-update) false)))))
          :componentWillUpdate
          (when-not (empty? will-update)
            (fn [_ next-state]
              (this-as this
-               (let [new-state (aget next-state ":rum/state")]
+               (let [new-state (gobj/get next-state ":rum/state")]
                  (vswap! new-state call-all will-update)))))
          :render
          (fn []
@@ -102,8 +108,8 @@
       (merge class-props)
       (->> (util/filter-vals some?))
       (clj->js)
-      (js/React.createClass))))
-
+      (->> (gobj/extend (gobj/get ctor "prototype"))))
+    ctor))

 (defn- build-ctor [render mixins display-name]
   (let [class  (build-class render mixins display-name)
@@ -163,8 +169,7 @@

 (defn- render-all [queue]
-  (doseq [comp queue
-          :when (.isMounted comp)]
+  (doseq [comp queue]
     (.forceUpdate comp)))


Make redirecting to a working branch/tag work again

--- src/web/app.cljs
+++ src/web/app.cljs
@@ -34,9 +34,11 @@

   (componentWillUpdate [this new-props new-state]
     (let [{:keys [custard/state custard/states]} new-props]
-      (if (and (nil? state)
-               (not (empty? states)))
-        (let [get-fn (fn [id] (first (filter #(= id (:id %)) states)))
+      (when (and (empty? state)
+                 (not (empty? states)))
+        (println "Need to try a different state")
+        (println states)
+        (let [get-fn (fn [name] (first (filter #(= name (:name %)) states)))
               head (get-fn "HEAD")
               master (get-fn "refs/heads/master")]
           (cond


ctool run output newline bugfix

ctool run output newline bugfix

--- src/yar/core.clj
+++ src/yar/core.clj
@@ -144,7 +144,7 @@

 (defn parse-ctool-run-output
-  [input file]
+  [input file & [delimiter]]
   (let [lines (clojure.string/split input #"\n")
         dir (condp = file :out "Out: " :err "Err: ")
         to-fun (fn [lines]
@@ -161,35 +161,38 @@
     (loop [lines lines
            idx (inc (.indexOf lines dir))
            to (to-fun lines)
-           output nil]
+           output nil
+           continuation false]
       (if (= idx to)
         (let [sublines (drop (inc idx) lines)]
           (if (> (.indexOf sublines dir) -1)
             (recur sublines
                    (inc (.indexOf sublines dir))
                    (to-fun sublines)
-                   output)
+                   (str output delimiter)
+                   false)
             output))
         (let [ln (nth lines idx)]
           (recur lines
                  (inc idx)
                  to
-                 (str output (if output
+                 (str output (if continuation
                                (str "\n" ln)
-                               ln))))))))
+                               ln))
+                 true))))))

 (defn add-ctool-to-genv
-  [ret out & [err]]
+  [ret & [out err delimiter]]
   (let [output (-> ret :stdout)]
     (when err
       (swap! genv
         #(assoc % (name err)
-                (parse-ctool-run-output output :err))))
+                (parse-ctool-run-output output :err delimiter))))
     (when out
       (swap! genv
         #(assoc % (name out)
-                (parse-ctool-run-output output :out))))
+                (parse-ctool-run-output output :out delimiter))))

     @(:exit-code ret)))

@@ -210,7 +213,8 @@
       (add-ctool-to-genv
         ret
         (:out bundle)
-        (:err bundle)))))
+        (:err bundle)
+        (:delimiter bundle)))))

 (defn ctool-run-scripts
@@ -271,6 +275,12 @@
         (-> cluster :products :groups)))))

+(defn add-to-genv
+  [k v]
+  (swap! genv (fn [old]
+                (assoc old k v))))
+
+
 (defn run-checkpoint
   [t]
   (wrap-binding t
@@ -286,11 +296,13 @@
               ;;(log ret)
               (when-not (zero? (count (:stdout ret)))
                 (log {:stdout (skipstr checkpoint-exec-string)})
-                (log {:stderr (:stdout ret)}))
+                (log {:stderr (:stdout ret)})
+                (when (:out t) (add-to-genv (:out t) (:stdout ret))))

               (when-not (zero? (count (:stderr ret)))
                 (log {:stdout (skipstr checkpoint-exec-string)})
-                (log {:stderr (:stderr ret)}))
+                (log {:stderr (:stderr ret)})
+                (when (:err t) (add-to-genv (:err t) (:stderr ret))))

               @(:exit-code ret))))))))


test request sooner for prerenderer

test request sooner for prerenderer

--- src/name_bazaar/ui/core.cljs
+++ src/name_bazaar/ui/core.cljs
@@ -49,8 +49,7 @@
                                           :events [:district0x/smart-contracts-loaded :district0x/my-addresses-loaded]
                                           :dispatch-n [[:district0x/watch-my-eth-balances]
                                                        [:try-resolving-address]
-                                                       [:active-page-changed]
-                                                       [:offerings.total-count/load]]}]}
+                                                       [:active-page-changed]]}]}
                     :forward-events {:register :active-page-changed
                                      :events #{:district0x/set-active-page}
                                      :dispatch-to [:active-page-changed]}


Formatting exception string.

Formatting exception string.

--- src/onyx/messaging/aeron.clj
+++ src/onyx/messaging/aeron.clj
@@ -179,7 +179,7 @@
         (ex-info "Couldn't assign port - ran out of available ports.
                  Available ports can be configured in the peer-config.
                  e.g. {:onyx.messaging/peer-ports [40000, 40002],
-                 :onyx.messaging/peer-port-range [40200 40260]}"
+                       :onyx.messaging/peer-port-range [40200 40260]}"
                  {:opts opts}))))


Check media-driver non-nil before closing it

--- src/onyx/messaging/aeron.clj
+++ src/onyx/messaging/aeron.clj
@@ -26,7 +26,7 @@

   (stop [{:keys [media-driver] :as component}]
     (taoensso.timbre/info "Stopping Aeron Peer Group")
-    (.close media-driver)
+    (when media-driver (.close media-driver))
     (assoc component :media-driver nil)))

 (defn aeron-peer-group [opts]


Refactoring.

Refactoring.

--- src/orbitingnews/twitter.clj
+++ src/orbitingnews/twitter.clj
@@ -1,6 +1,6 @@
 (ns orbitingnews.twitter
   (:require [orbitingnews.config :as config])
-  (:import [twitter4j TwitterFactory TwitterStreamFactory StreamListener StatusListener Query QueryResult FilterQuery]
+  (:import [twitter4j TwitterFactory TwitterStreamFactory StatusListener Query QueryResult FilterQuery]
            [twitter4j.auth AccessToken])
   (:gen-class))

@@ -19,7 +19,7 @@
       (.setOAuthAccessToken access-token))
     twitter))

-(defn- oauth-stream
+(defn- oauth-stream-authorized-twitter
   "Create a twitter client with OAuth authentication"
   []
   (let [access-token (AccessToken. *access-token* *access-secret*)
@@ -39,19 +39,19 @@
     (onTrackLimitationNotice [numberOfLimitedStatuses] ())))

 (defn do-sample-stream []
-  (let [stream (oauth-stream)]
+  (let [stream (oauth-stream-authorized-twitter)]
     (.addListener stream (status-listener))
     (.sample stream)))

 (defn do-filter-stream []
   ; We want tweets with the word tweet in them
   (let [filter-query (FilterQuery. 0 (long-array []) (into-array String ["#ChristianChavezNoRaulGil"]))
-        stream (oauth-stream)]
+        stream (oauth-stream-authorized-twitter)]
     (.addListener stream (status-listener))
     (.filter stream filter-query)))

 (defn link-stream []
-  (let [stream (oauth-stream)]
+  (let [stream (oauth-stream-authorized-twitter)]
     (.addListener stream (status-listener))
     (.links stream 0)))


Sleep randomly.

Sleep randomly.

--- src/org/scode/httpgctest.clj
+++ src/org/scode/httpgctest.clj
@@ -9,9 +9,11 @@
                     File)))

 (defn serve-gengarbage [request]
-  {:status 200
-   :headers {}
-   :body "Garbage all around."})
+  (do
+    (Thread/sleep (rand 1000))
+    {:status 200
+     :headers {}
+     :body "Garbage all around."}))

 (defroutes greeter
   (GET "/gengarbage"


helper fn for determining the freq of the nth octave for a given reference freq

--- src/overtone/music/pitch.clj
+++ src/overtone/music/pitch.clj
@@ -3,7 +3,8 @@
           This is the place for functions representing general musical knowledge, like scales, chords,
           intervals, etc."
      :author "Jeff Rose"}
-  overtone.music.pitch)
+  overtone.music.pitch
+  (:require [clojure.contrib.math :as math]))

 ;; Notes in a typical scale are related by small, prime number ratios. Of all
 ;; possible 7 note scales, the major scale has the highest number of consonant
@@ -221,6 +222,12 @@
   (let [num-notes (count notes)]
     (repeatedly #(get notes (rand-int num-notes)))))

+(defn nth-octave
+  "Returns the freq n octaves from the supplied reference freq
+   i.e. (nth-ocatve 440 1) will return 880 which is the freq of the next octave from 440."
+  [freq n]
+  (* freq (math/expt 2 n)))
+
 ;; TODO:
 ;; * weighted random
 ;; * arpeggiator(s)


Change resizing functions

Change resizing functions

--- src/play_clj/core_render.clj
+++ src/play_clj/core_render.clj
@@ -97,12 +97,20 @@
   []
   (PerspectiveCamera.))

-(defn resize-camera!
+(defn size!
   [{:keys [^OrthographicCamera camera]} width height]
   (assert camera)
   (.setToOrtho camera false width height))

-(defn move-camera!
+(defn height!
+  [{:keys [width height] :as screen} new-height]
+  (size! screen (* new-height (/ width height)) new-height))
+
+(defn width!
+  [{:keys [width height] :as screen} new-width]
+  (size! screen new-width (* new-width (/ height width))))
+
+(defn move!
   [{:keys [^Camera camera]} x y]
   (assert camera)
   (when x (set! (. (. camera position) x) x))


Add support for soft bodies

Add support for soft bodies

--- src/play_clj/g3d_physics.clj
+++ src/play_clj/g3d_physics.clj
@@ -6,12 +6,15 @@
            [com.badlogic.gdx.physics.bullet Bullet]
            [com.badlogic.gdx.physics.bullet.collision btBoxShape
             btCollisionDispatcher btCylinderShape btCollisionObject
-            btCollisionWorld btDefaultCollisionConfiguration btDbvtBroadphase
+            btDefaultCollisionConfiguration btDbvtBroadphase
             btSphereShape]
            [com.badlogic.gdx.physics.bullet.dynamics btDiscreteDynamicsWorld
             btDynamicsWorld btRigidBody btRigidBody$btRigidBodyConstructionInfo
             btSequentialImpulseConstraintSolver]
-           [com.badlogic.gdx.physics.bullet.linearmath btMotionState]))
+           [com.badlogic.gdx.physics.bullet.linearmath btMotionState]
+           [com.badlogic.gdx.physics.bullet.softbody btSoftBody
+            btSoftBodyRigidBodyCollisionConfiguration btSoftBodyWorldInfo
+            btSoftRigidDynamicsWorld]))

 (def ^:private init (delay (Bullet/init)))

@@ -30,50 +33,46 @@
            :config config
            :dispatcher dispatcher
            :broadphase broad
-           :solver solver)))
+           :constraint-solver solver)))
+
+(defn ^:private soft-rigid-dynamics
+  []
+  (let [config (btSoftBodyRigidBodyCollisionConfiguration.)
+        dispatcher (btCollisionDispatcher. config)
+        broad (btDbvtBroadphase.)
+        solver (btSequentialImpulseConstraintSolver.)]
+    (assoc (World3D. (btSoftRigidDynamicsWorld. dispatcher broad solver config))
+           :config config
+           :dispatcher dispatcher
+           :broadphase broad
+           :constraint-solver solver)))

 (defn bullet-3d*
   [type]
   @init
   (case type
-    :discrete-dynamics (discrete-dynamics)
+    :rigid (discrete-dynamics)
+    :soft-rigid (soft-rigid-dynamics)
     (u/throw-key-not-found type)))

 (defmacro bullet-3d
-  "Returns a world based on btCollisionWorld.
-
-    (bullet-3d :discrete-dynamics)"
+  "Returns a world based on btDynamicsWorld.
+
+    (bullet-3d :rigid) ; can only handle rigid bodies
+    (bullet-3d :soft-rigid) ; can handle soft and rigid bodies"
   [type & options]
   `(let [world# (bullet-3d* ~type)
-         ^btCollisionWorld object# (:object world#)]
+         ^btDynamicsWorld object# (:object world#)]
      (u/calls! object# ~@options)
      world#))

 (defmacro bullet-3d!
   "Calls a single method on a `bullet-3d`."
   [screen k & options]
-  `(let [^btCollisionWorld object# (:object (u/get-obj ~screen :world))]
+  `(let [^btDynamicsWorld object# (:object (u/get-obj ~screen :world))]
      (u/call! object# ~k ~@options)))

 ; bodies
-
-(defn basic-body*
-  []
-  (Body3D. (btCollisionObject.)))
-
-(defmacro basic-body
-  "Returns a body based on btCollisionObject."
-  [& options]
-  `(let [body# (basic-body*)
-         ^btCollisionObject object# (:object body#)]
-     (u/calls! object# ~@options)
-     body#))
-
-(defmacro basic-body!
-  "Calls a single method on a `basic-body`."
-  [object k & options]
-  `(let [^btCollisionObject object# (:object (u/get-obj ~object :body))]
-     (u/call! object# ~k ~@options)))

 (defn rigid-body*
   [info]
@@ -100,10 +99,29 @@
   (btRigidBody$btRigidBodyConstructionInfo.
     mass motion-state collision-shape local-inertia))

-(defmacro rigid-body-info!
-  "Calls a single method on a `rigid-body-info`."
-  [object k & options]
-  `(u/call! ^btRigidBody$btRigidBodyConstructionInfo ~object ~k ~@options))
+(defn soft-body*
+  [info]
+  (assoc (Body3D. (btSoftBody. info))
+         :info info))
+
+(defmacro soft-body
+  "Returns a body based on btSoftBody."
+  [info & options]
+  `(let [body# (soft-body* ~info)
+         ^btSoftBody object# (:object body#)]
+     (u/calls! object# ~@options)
+     body#))
+
+(defmacro soft-body!
+  "Calls a single method on a `soft-body`."
+  [object k & options]
+  `(let [^btSoftBody object# (:object (u/get-obj ~object :body))]
+     (u/call! object# ~k ~@options)))
+
+(defn soft-body-info
+  "Returns a btSoftBodyWorldInfo."
+  []
+  (btSoftBodyWorldInfo.))

 (defn ^:private body-x
   [entity]
@@ -195,8 +213,8 @@
   (cond
     (isa? (type (:object body)) btRigidBody)
     (bullet-3d! screen :add-rigid-body (:object body))
-    :else
-    (bullet-3d! screen :add-collision-object (:object body)))
+    (isa? (type (:object body)) btSoftBody)
+    (bullet-3d! screen :add-soft-body (:object body)))
   body)

 (defn ^:private get-bodies
@@ -208,31 +226,27 @@
 (defmethod c/update-physics!
   World3D
   [screen & [entities]]
-  ; initialize bodies
+  ; initialize bodies if necessary
   (doseq [e entities]
     (let [object (u/get-obj e :object)
           body (u/get-obj e :body)]
-      (when (and object body)
-        (cond
-          (isa? (type (:object body)) btRigidBody)
-          (when-not (rigid-body! e :get-motion-state)
-            (rigid-body! e
-                         :set-motion-state
-                         (proxy [btMotionState] []
-                           (getWorldTransform [world-t])
-                           (setWorldTransform [world-t]
-                             (m/matrix-4! (. object transform) :set world-t)))))
-          :else
-          (basic-body! e :set-world-transform (. object transform))))))
+      (when (and object (isa? (type (:object body)) btRigidBody))
+        (when-not (rigid-body! e :get-motion-state)
+          (->> (proxy [btMotionState] []
+                 (getWorldTransform [world-t])
+                 (setWorldTransform [world-t]
+                   (m/matrix-4! (. object transform) :set world-t)))
+               (rigid-body! e :set-motion-state))))))
   ; remove bodies that no longer exist
   (when entities
-    (doseq [body (get-bodies screen)]
+    (doseq [^btCollisionObject body (get-bodies screen)]
       (when-not (some #(= body (-> % :body :object)) entities)
         (cond
           (isa? (type body) btRigidBody)
           (bullet-3d! screen :remove-rigid-body body)
-          :else
-          (bullet-3d! screen :remove-collision-object body))))))
+          (isa? (type body) btSoftBody)
+          (bullet-3d! screen :remove-soft-body body))
+        (.dispose body)))))

 (defmethod c/step!
   World3D
@@ -240,14 +254,13 @@
      :or {max-sub-steps 5 time-step (/ 1 60)}
      :as screen}
    & [entities]]
-  (when (isa? (type (:object (u/get-obj screen :world))) btDynamicsWorld)
-    (bullet-3d! screen :step-simulation delta-time max-sub-steps time-step)
-    (when entities
-      (map (fn [e]
-             (if (u/get-obj e :body)
-               (assoc e
-                      :x (body-x e)
-                      :y (body-y e)
-                      :z (body-z e))
-               e))
-           entities))))
+  (bullet-3d! screen :step-simulation delta-time max-sub-steps time-step)
+  (when entities
+    (map (fn [e]
+           (if (u/get-obj e :body)
+             (assoc e
+                    :x (body-x e)
+                    :y (body-y e)
+                    :z (body-z e))
+             e))
+         entities)))


[#128] Add dispatch value as the suffix for the name of the method function

--- priv/clojure/core.clj
+++ priv/clojure/core.clj
@@ -1687,7 +1687,7 @@
   "Creates and installs a new method of multimethod associated with dispatch-value. "
   {:added "1.0"}
   [multifn dispatch-val & fn-tail]
-  (let [fn-name (gensym (str (name multifn) "_method_"))]
+  (let [fn-name (symbol (str (name multifn) "_method_" dispatch-val))]
     `(do
        (defn ~fn-name ~@fn-tail)
        (erl-on-load*


Reduce number of crashes in windowing crash test.

--- test/onyx/windowing/basic_windowing_crash_test.clj
+++ test/onyx/windowing/basic_windowing_crash_test.clj
@@ -77,9 +77,9 @@
   {:lifecycle/handle-exception restartable?
    :lifecycle/after-read-batch (fn [event lifecycle]
                                  (when (or (and (some #(= (:id %) 16)
-                                             (:onyx.core/batch event))
-                                            (not @crashed?))
-                                           (zero? (rand-int 10)))
+                                                      (:onyx.core/batch event))
+                                                (not @crashed?))
+                                           (zero? (rand-int 100)))
                                    (println "CRASH IT")
                                    (reset! crashed? true)
                                   (throw (ex-info "Restart me!" {})))


Validate submit-job workflow names for HTTPCoordinator

--- src/onyx/api.clj
+++ src/onyx/api.clj
@@ -89,6 +89,7 @@
 (deftype HttpCoordinator [conn]
   ISubmit
   (submit-job [this job]
+    (validate-workflow-names job)
     (let [leader (extensions/leader (:sync conn) :election)
           data (extensions/read-node (:sync conn) leader)
           uri (format "http://%s:%s/submit-job" (:host data) (:port data))


Add `arglists` metadata to `api`

Add `arglists` metadata to `api`

--- src/such/doc.clj
+++ src/such/doc.clj
@@ -47,7 +47,10 @@
                                sort))

     (let [var (intern *ns* 'api (fn [] (browse/browse-url url)))]
-      (alter-meta! var assoc :doc (format api-doc-template (ns-name *ns*))))))
+      (alter-meta! var assoc
+                   :doc (format api-doc-template (ns-name *ns*))
+                   :arglists '([])))
+    nil))

 (api-url! "http://marick.github.io/suchwow/")


컬럼 이름 정정.

컬럼 이름 정정.

--- src/tabledoc.clj
+++ src/tabledoc.clj
@@ -39,7 +39,7 @@
                                  [:.nullable] (h/content (r :nullable))
                                  [:.data-type] (h/content (r :data_type))
                                  [:.default] (h/content (r :default))
-                                 [:.distinct] (h/content (r :distinct))
+                                 [:.distinct] (h/content (r :num_distinct))
                                  [:.comment] (h/content (r :comments)))
   [:#index-desc-title] (h/content "Index Description")
   [:tr.per-idx-row] (h/clone-for [r (tab-info :idx-desc)]


excluded punctuation tokens from word index

--- src/distillery/tasks.clj
+++ src/distillery/tasks.clj
@@ -52,7 +52,7 @@
   "Analyzes the speech recognition results of a single video and builds the video word index."
   [video]
   (print-progress "Building index for " (:id video))
-  (let [filters [proc/not-short? proc/noun? proc/min-confidence?]
+  (let [filters [proc/not-short? proc/noun? proc/min-confidence? proc/no-punctuation?]
         predicate (partial multi-filter filters)
         index (proc/video-word-index video :predicate predicate)]
     (assoc video :index index)))


fold-path wants two arguments?

fold-path wants two arguments?

--- src/active/clojure/match.clj
+++ src/active/clojure/match.clj
@@ -613,7 +613,7 @@
               [{}
                `[~(symbol b) (get-in ~message ~path ~match-value)]]
               predicate?
-              [`(~(fold-path '_) :guard [(constantly (~(:fn match-value) (get-in ~message ~path)))])
+              [`(~(fold-path path '_) :guard [(constantly (~(:fn match-value) (get-in ~message ~path)))])
                `[~(symbol b) (get-in ~message ~path)]]
               :else
               [`~path-map


fix the downloader

fix the downloader

--- src/albatross/downloader.clj
+++ src/albatross/downloader.clj
@@ -23,6 +23,7 @@
 ;;; NEEDS TO BE NOT TERRIBLE
 ;;; should handle partially downloaded better
 (defn- download-file [this filename torrent size]
+  (infof "downloading: %s" filename)
   (let [file ^java.io.File (apply io/file (conj (get-download-dir this torrent) filename))]
     (when (< (.getTotalSpace file) size)
       (with-open [out (io/output-stream file)]
@@ -72,11 +73,15 @@
       false)))

 (defn- get-rar-files [t]
-  (filter #(.endsWith (join "/" (get %1 "path")) ".rar") (:files t)))
+  (filter #(.endsWith (join "/" (get %1 :path)) ".rar") (:files t)))

 (defn- unpack-torrent [this t]
   (doseq [file (get-rar-files t)]
-    (sh "unrar" "x" "-y"  (join "/" (filter #(pos? (count %)) (get file "path"))) :dir (join "/" (get-download-dir this t)))))
+    (let [r  (sh "unrar" "x" "-y"  (join "/" (filter #(pos? (count %)) (get file :path))) :dir (join "/" (get-download-dir this t)))]
+      (if (= (:exit r) 0)
+        (do (info "unarchive success!")
+            (db/update-torrent! (assoc t :state :complete)))
+        (errorf "Error un-archiving: %s output: %s" (:name t) (:out r))))))

 (defn- do-download [this t]
   (try
@@ -105,6 +110,12 @@
       (infof (:name t) "is ready to download")
       (>!! queue t))))

+(defn- unpack-downloads[this]
+  "looks for things that should be unpacked"
+  (thread
+    (doseq [t (db/by-state :downloaded)]
+      (unpack-torrent this t))))
+
 (defrecord Downloader [dir download-queue jobs credentials remote-base-url
                        sickbeard-post-process-url concurrent-downloads]
   component/Lifecycle
@@ -115,6 +126,7 @@
       (let [num-jobs (:concurrent-downloads this)
             t (assoc this :download-queue (unique (chan num-jobs)))]
         (populate-download-queue (:download-queue t))
+        (unpack-downloads t)
         (assoc t :jobs (into [] (for [n (range num-jobs)]
                                   (downloader-job t n)))))
       this))


Added update-attrs function. Refactored build-dom-element to handle id and class more consistently.

--- src-cljs/freactive/dom.cljs
+++ src-cljs/freactive/dom.cljs
@@ -519,35 +519,6 @@
                            new-style
                            bind-style-prop!))))

-;; From hiccup.compiler:
-(def ^{:doc "Regular expression that parses a CSS-style id and class from an element name."
-       :private true}
-     re-tag #"([^\s\.#]+)(?:#([^\s\.#]+))?(?:\.([^\s#]+))?")
-
-(def ^:private node-ns-lookup
-  #js
-  {:svg "http://www.w3.org/2000/svg"})
-
-(defn register-node-prefix! [prefix xml-ns-or-handler]
-  (aset node-ns-lookup prefix xml-ns-or-handler))
-
-(def ^:dynamic *xml-namespaces* nil)
-
-(defn- get-xml-namespace [kw-ns]
-  (let [xmlns (get *xml-namespaces* kw-ns)]
-    (assert xmlns (str "Don't know how to handle namespace " kw-ns))))
-
-(def ^:private re-dot (js/RegExp. "\\." "g"))
-
-(defn- create-dom-node [xmlns tag-name]
-  (let [[_ tag id class] (re-matches re-tag tag-name)
-        node (if xmlns
-               (.createElementNS js/document xmlns tag)
-               (.createElement js/document tag))]
-    (when id (set! (.-id node) id))
-    (when class (set! (.-className node) (.replace class re-dot " ")))
-    node))
-
 ;(defn- create-dom-node-simple [tag]
 ;  (let [tag-ns (namespace tag)
 ;        node (if tag-ns
@@ -810,10 +781,56 @@
         (append-children! elem ch))
       (append-child! elem ch))))

+(defn update-attrs
+  ([vdom f & args]
+   (let [tag (first vdom)
+         attrs? (second vdom)
+         attrs (when (map? attrs?) attrs?)]
+     (concat [tag (apply f attrs args)] (if attrs (nnext vdom) (next vdom))))))
+
+;; (defn- create-dom-node [xmlns tag-name]
+;;   (let [
+;;         node ]
+;;     (when id (set! (.-id node) id))
+;;     (when class (set! (.-className node) (.replace class re-dot " ")))
+;;     node))
+
+;; From hiccup.compiler:
+(def ^{:doc "Regular expression that parses a CSS-style id and class from an element name."
+       :private true}
+     re-tag #"([^\s\.#]+)(?:#([^\s\.#]+))?(?:\.([^\s#]+))?")
+
+(def ^:private node-ns-lookup
+  #js
+  {:svg "http://www.w3.org/2000/svg"})
+
+(defn register-node-prefix! [prefix xml-ns-or-handler]
+  (aset node-ns-lookup prefix xml-ns-or-handler))
+
+;; (def ^:dynamic *xml-namespaces* nil)
+
+;; (defn- get-xml-namespace [kw-ns]
+;;   (let [xmlns (get *xml-namespaces* kw-ns)]
+;;     (assert xmlns (str "Don't know how to handle namespace " kw-ns))))
+
+(def ^:private re-dot (js/RegExp. "\\." "g"))
+
+
 (defn- build-dom-element [tag elem-spec xmlns tag-name tail]
-  (let [node (create-dom-node xmlns tag-name)
+  (let [[_ tag-name id class] (re-matches re-tag tag-name)
+        node (if xmlns
+               (.createElementNS js/document xmlns tag-name)
+               (.createElement js/document tag-name))
         attrs? (first tail)
         attrs (when (map? attrs?) attrs?)
+        attrs (cond-> attrs
+                      (and id (not (:id attrs)))
+                      (assoc :id id)
+                      class
+                      (update :class
+                              (fn [cls]
+                                (let [class (.replace class re-dot " ")]
+                                  (if cls (str class " " cls) class)))))
         state (init-element-state! node elem-spec tag)
         children (if attrs (rest tail) tail)]
     (bind-attrs! node attrs state)


standardize on when-let here

standardize on when-let here

--- src-cljs/frontend/core.cljs
+++ src-cljs/frontend/core.cljs
@@ -317,7 +317,7 @@
       (subscribe-to-user-channel user (get-in @state [:comms :ws]))
       (analytics/init-user (:login user)))
     (analytics/track-invited-by (:invited-by utils/initial-query-map))
-    (some-> (get-in @state [:render-context :weasel_url])
-            (ws-repl/connect :verbose true))
-    (some-> (get-in @state [:render-context :figwheel_url])
-            setup-figwheel!)))
+    (when-let [weasel-url (get-in @state [:render-context :weasel_url])]
+      (ws-repl/connect weasel-url :verbose true))
+    (when-let [figwheel-url (get-in @state [:render-context :figwheel_url])]
+      (setup-figwheel! figwheel-url))))


Time quiscience

Time quiscience

--- src/aurora/runtime/core.cljs
+++ src/aurora/runtime/core.cljs
@@ -45,6 +45,7 @@
 (enable-console-print!)

 (defn quiescience [prev env init-facts]
+  (js/console.time "quiescience")
   (let [aurora-facts [(language/fact :aurora/time #js [(.getTime (js/Date.))])]]
     (let [cur (language/tick (:rules env) prev)]
       (language/add-facts-compat cur :known|pretended init-facts)
@@ -54,8 +55,8 @@
              prev prev
              i 0]
         (cond
-         (>= i 10) (do (println "Aborting!") cur)
-         (language/unchanged? prev cur) cur
+         (>= i 10) (do (js/console.timeEnd "quiescience")(println "Aborting!") cur)
+         (language/unchanged? prev cur) (do (js/console.timeEnd "quiescience") cur)
          :else (let [next (language/tick (:rules env) cur)]
                  (language/add-facts-compat next :known|pretended aurora-facts)
                  (language/fixpoint! next)


fix type of babel.espanol/small: it's a function now, not a map.

--- src/babel/espanol/writer.clj
+++ src/babel/espanol/writer.clj
@@ -3,7 +3,8 @@

 (require '[babel.engine :as engine :refer [generate]])
 (require '[babel.enrich :refer [enrich]])
-(require '[babel.espanol.grammar :refer [small parse]])
+(require '[babel.espanol :refer [small]])
+(require '[babel.espanol.grammar :refer [parse]])
 (require '[babel.espanol.lexicon :refer [lexicon]])
 (require '[babel.espanol.morphology :as morph])
 (require '[babel.espanol.pos :refer :all])
@@ -121,7 +122,7 @@
                                                   (process [{:fill-one-language
                                                              {:count 1
                                                               :spec spec
-                                                              :model small
+                                                              :model (small)
                                                               }}]
                                                            "es"))


Process navigation level commands

Process navigation level commands

--- util/clojure-cli/src/commcare_cli/app_host.clj
+++ util/clojure-cli/src/commcare_cli/app_host.clj
@@ -7,6 +7,7 @@
            [org.commcare.util.cli MenuScreen EntityScreen]
            [org.commcare.core.parse ParseUtils]
            [org.javarosa.core.util.externalizable LivePrototypeFactory]
+           [org.javarosa.core.services.locale Localization]
            [org.javarosa.core.services.storage StorageManager]
            [org.javarosa.core.model.instance FormInstance]
            [org.commcare.session SessionFrame]
@@ -14,10 +15,20 @@

 (defrecord App [session engine sandbox])

+(defn long-str [& strings] (string/join "\n" strings))
+(def ^:const
+  HELP_MESSAGE
+  (long-str
+    ":exit / :quit - Terminate the session and close the CLI app"
+    ":update (-f) - Update the application live against the newest version on the server. -f optional flag to grab the newest build instead of the newest starred build"
+    ":home - Navigate to the home menu of the app"
+    ":lang <lang> - change the language to <lang> (e.g. :lang en)"
+    ":stack - Show the current session frame stack"))
+
 (defn build-user-sandbox [prototype-factory restore-file]
   (let [sandbox (MockUserDataSandbox. prototype-factory)
         restore (try (BufferedInputStream. (FileInputStream. restore-file))
-                     (catch FileNotFoundException e
+                     (catch FileNotFoundException e
                        (println "No restore file found at " restore-file)))]
     (.setAppFixtureStorageLocation sandbox (StorageManager/getStorage FormInstance/STORAGE_KEY))
     (ParseUtils/parseIntoSandbox restore sandbox, false)
@@ -29,7 +40,7 @@
         engine (CommCareConfigEngine. System/out prototype-factory)
         user-sandbox (build-user-sandbox prototype-factory restore-file)]
     (App. (CLISessionWrapper. (.getPlatform engine) user-sandbox)
-          (doto engine
+          (doto engine
             (.initFromArchive ccz)
             (.initEnvironment))
           user-sandbox)))
@@ -37,35 +48,85 @@
 (defn get-next-screen [session]
   (let [eval-context (.getEvaluationContext session)
         needed (.getNeededData session eval-context)]
-    (cond
+    (cond
       (nil? needed) nil
       (= needed SessionFrame/STATE_COMMAND_ID) (MenuScreen.)
       (= needed SessionFrame/STATE_DATUM_VAL) (EntityScreen.)
       (= needed SessionFrame/STATE_DATUM_COMPUTED)
-      (do
+      (do
         (.setComputedDatum session)
         (recur session))
       :else (throw (RuntimeException. "Unexpected frame request")))))

 (defn clear-view []
-  (map (fn [x] (println "\n")) (range 5)))
+  (doall
+    (map (fn [x] (println " ")) (range 5))))

-(defn process-command [command]
-  (cond
-    ((= command ":exit")
-(defn process-screen [screen app]
+(defn print-stack [session]
+  (let
+    [frame (.getFrame session)
+     steps (.getSteps frame)]
+    (doall
+      (map
+        (fn [step] (if (= (.getType step) SessionFrame/STATE_COMMAND_ID)
+                     (println "COMMAND: " (.getId step))
+                     (println "DATUM: " (.getId step) " - " (.getValue step))))
+        steps))))
+
+(defn set-locale [locale]
+  (if (string/blank? locale)
+    (println "Command format\n:lang [langcode]")
+    (let [localizer (Localization/getGlobalLocalizerAdvanced)
+          available-locales (.getAvailableLocales localizer)]
+      (if (nil? (some #{locale} available-locales))
+        (println "Locale '" locale "' is undefined. Available locales:")
+        (map (fn [l] (println "* " l)) available-locales)))))
+
+;; String App Screen -> Action
+;; where Action is one of [:quit :refresh :stay]
+(defn process-command [user-input app]
+  (if (= user-input ":exit")
+    :quit
+      (let [session (:session app)
+            args (string/split user-input #" ")
+            command (nth args 0)
+            arg (if (> (count args) 1) (nth args 1) nil)]
+        (cond
+          (= command ":update")
+          (do (println "TODO: app implement update")
+              :stay)
+          (= command ":home")
+          (do (.clearAllState session)
+              :refresh)
+          (= command ":back")
+           (do (.stepBack session (.getEvaluationContext session))
+               :refresh)
+          (= command ":stack")
+           (do (print-stack session)
+               :stay)
+          (= command ":lang")
+           (do (set-locale arg)
+               :stay)
+          (= command ":help")
+          (do
+            (println HELP_MESSAGE)
+            :stay)))))
+
+(defn process-screen [screen app]
   (clear-view)
-  (.getWrappedDisplaytitle screen (:sandbox app) (.getPlatform (:engine app)))
+  (println (.getWrappedDisplaytitle screen (:sandbox app) (.getPlatform (:engine app))))
+  (println "==================")
   (.prompt screen System/out)
   (let [user-input (read-line)]
     (if (string/starts-with? user-input ":")
-      (if (process-command user-input)
-        true ;;; XXX I'm here
-        (recur screen app))
-      (when
-        ; TODO: handle commands
+      (let [action (process-command user-input app)]
+        (cond (= action :quit) false
+              (= action :refresh) true
+              (= action :stay) (recur screen app)))
+      (if
         (.handleInputAndUpdateSession screen (:session app) user-input)
-        (recur screen app))))
+        (recur screen app)
+        true))))

 (defn form-entry []
   (println "TODO form entry"))


Explore different options for constructing beehive

--- test/beehive/example_usage.clj
+++ test/beehive/example_usage.clj
@@ -84,4 +84,20 @@
 (metrics/get-count (hive/rejected-metrics example-beehive) :max-concurrency)

 ;; Returns a latency percentile map for errors
-(metrics/latency (hive/latency-metrics example-beehive) :error)+(metrics/latency (hive/latency-metrics example-beehive) :error)
+
+(comment
+  ;; Replace keywords with enum impl
+  (lett [result-class {:success true :error false}
+         rejected-class #{:max-concurrency :breaker}]
+        (-> (hive result-class rejected-class)
+            (add-result-counts (count-metrics result-class))
+            (add-result-latency (latency-metrics result-class))
+            (add-backpressure (semaphore :max-concurrency)))))
+
+(comment
+  (hive-> (create-types {:success true :error false} #{:max-concurrency :breaker})
+          (add-result-counts (count-metrics))
+          (add-result-latency (latency-metrics))
+          (add-backpressure (semaphore :max-concurrency))
+          (add-backpressure (ciruit-breaker :max-concurrency))))


Make string* type spec as singleton like other type specs that does not have parameters.

--- src/bytebuf/spec/string.cljx
+++ src/bytebuf/spec/string.cljx
@@ -120,10 +120,19 @@
         (buffer/write-bytes buff pos size tmpbuf)
         size))))

-(defn string*
-  "Arbitrary length string type spec constructor."
-  []
+(def ^{:doc "Arbitrary length string type spec."}
+  string*
   (reify
+    #+clj
+    clojure.lang.IFn
+    #+clj
+    (invoke [s] s)
+
+    #+cljs
+    IFn
+    #+cljs
+    (-invoke [s] s)
+
     spec/ISpec
     (read [_ buff pos]
       (let [datasize (buffer/read-int buff pos)