Reformatted calendar.clj by zprint

Reformatted calendar.clj by zprint

--- src/clj_calendar/calendar.clj
+++ src/clj_calendar/calendar.clj
@@ -11,123 +11,125 @@
 ;

 (ns clj-calendar.calendar
-    "Namespace that contains various functions for handling calendar and dates.")
+  "Namespace that contains various functions for handling calendar and dates.")

 (def unified-date-format
-    "String template used to format datetime as a date (only)."
-    (new java.text.SimpleDateFormat "yyyy-MM-dd"))
+  "String template used to format datetime as a date (only)."
+  (new java.text.SimpleDateFormat "yyyy-MM-dd"))

 (def unified-date-time-format
-    "String template used to format datetime as a date followed by time."
-    (new java.text.SimpleDateFormat "yyyy-MM-dd HH:mm:ss"))
+  "String template used to format datetime as a date followed by time."
+  (new java.text.SimpleDateFormat "yyyy-MM-dd HH:mm:ss"))

 (defn get-calendar
-    "Gets an instance of calendar using the default time zone and default locale."
-    []
-    (java.util.Calendar/getInstance))
+  "Gets an instance of calendar using the default time zone and default locale."
+  []
+  (java.util.Calendar/getInstance))

 (defn get-calendar-for-week
-    "Gets a calendar (instance of java.util.Calendar) for given year and week."
-    [year week]
-    (let [cal (get-calendar)]
-        (.clear cal)
-        (.set cal java.util.Calendar/WEEK_OF_YEAR week)
-        (.set cal java.util.Calendar/YEAR year)
-        cal))
+  "Gets a calendar (instance of java.util.Calendar) for given year and week."
+  [year week]
+  (let [cal (get-calendar)]
+    (.clear cal)
+    (.set cal java.util.Calendar/WEEK_OF_YEAR week)
+    (.set cal java.util.Calendar/YEAR year)
+    cal))

 (defn get-year
-    "Returns the year for the current date."
-    [calendar]
-    (.get calendar java.util.Calendar/YEAR))
+  "Returns the year for the current date."
+  [calendar]
+  (.get calendar java.util.Calendar/YEAR))

 (defn get-month
-    "Returns the month of the current year."
-    [calendar]
-    (inc (.get calendar java.util.Calendar/MONTH)))
+  "Returns the month of the current year."
+  [calendar]
+  (inc (.get calendar java.util.Calendar/MONTH)))

 (defn get-day
-    "Returns the day of the current month"
-    [calendar]
-    (.get calendar java.util.Calendar/DAY_OF_MONTH))
+  "Returns the day of the current month"
+  [calendar]
+  (.get calendar java.util.Calendar/DAY_OF_MONTH))

 (defn get-week
-    "Returns week number within the current year."
-    [calendar]
-    (.get calendar java.util.Calendar/WEEK_OF_YEAR))
+  "Returns week number within the current year."
+  [calendar]
+  (.get calendar java.util.Calendar/WEEK_OF_YEAR))

 (defn get-day-of-week
-    "Returns day of week for given date."
-    [calendar]
-    (.get calendar java.util.Calendar/DAY_OF_WEEK))
+  "Returns day of week for given date."
+  [calendar]
+  (.get calendar java.util.Calendar/DAY_OF_WEEK))

 (defn calculate-first-day-of-week
-    "Calculate first day of week for given date."
-    [calendar]
-    (- (.getFirstDayOfWeek calendar) (get-day-of-week calendar)))
+  "Calculate first day of week for given date."
+  [calendar]
+  (- (.getFirstDayOfWeek calendar) (get-day-of-week calendar)))

 (defn get-first-day-of-week
-    "Returns first day of given week."
-    [calendar]
-    (let [first-day-of-week (.clone calendar)]
-        (.add first-day-of-week java.util.Calendar/DAY_OF_WEEK (calculate-first-day-of-week first-day-of-week ))
-        first-day-of-week))
+  "Returns first day of given week."
+  [calendar]
+  (let [first-day-of-week (.clone calendar)]
+    (.add first-day-of-week
+          java.util.Calendar/DAY_OF_WEEK
+          (calculate-first-day-of-week first-day-of-week))
+    first-day-of-week))

 (defn get-last-day-of-week
-    "Return last day of given week."
-    [calendar]
-    (let [first-day-of-week (get-first-day-of-week calendar)
-          last-day-of-week  (.clone first-day-of-week)]
-        (.add last-day-of-week java.util.Calendar/DAY_OF_YEAR, 6)
-        last-day-of-week))
+  "Return last day of given week."
+  [calendar]
+  (let [first-day-of-week (get-first-day-of-week calendar)
+        last-day-of-week  (.clone first-day-of-week)]
+    (.add last-day-of-week java.util.Calendar/DAY_OF_YEAR 6)
+    last-day-of-week))

 (defn format-date-using-desired-format
-    "Format given date using desired format, for example 'yyyy-MM-dd' etc."
-    [calendar desired-format]
-    (let [date-format (new java.text.SimpleDateFormat desired-format)]
-        (.format date-format (.getTime calendar))))
+  "Format given date using desired format, for example 'yyyy-MM-dd' etc."
+  [calendar desired-format]
+  (let [date-format (new java.text.SimpleDateFormat desired-format)]
+    (.format date-format (.getTime calendar))))

 (defn format-date
-    "Format given date using the following date/time format: 'yyyy-MM-dd'"
-    [calendar]
-    (format-date-using-desired-format calendar "yyyy-MM-dd"))
+  "Format given date using the following date/time format: 'yyyy-MM-dd'"
+  [calendar]
+  (format-date-using-desired-format calendar "yyyy-MM-dd"))

 (defn format-time
-    "Format given date using the following date/time format: 'HH:mm:ss'"
-    [calendar]
-    (format-date-using-desired-format calendar "HH:mm:ss"))
+  "Format given date using the following date/time format: 'HH:mm:ss'"
+  [calendar]
+  (format-date-using-desired-format calendar "HH:mm:ss"))

 (defn format-date-time
-    "Format given date using the following date/time format: 'yyyy-MM-dd HH:mm:ss'"
-    [calendar]
-    (format-date-using-desired-format calendar "yyyy-MM-dd HH:mm:ss"))
+  "Format given date using the following date/time format: 'yyyy-MM-dd HH:mm:ss'"
+  [calendar]
+  (format-date-using-desired-format calendar "yyyy-MM-dd HH:mm:ss"))

 (defn get-first-day-of-week-formatted
-    "Get date of first day of given week formatted as yyyy-mm-dd."
-    [calendar]
-    (format-date (get-first-day-of-week calendar)))
+  "Get date of first day of given week formatted as yyyy-mm-dd."
+  [calendar]
+  (format-date (get-first-day-of-week calendar)))

 (defn get-last-day-of-week-formatted
-    "Get date of last day of given week formatted as yyyy-mm-dd."
-    [calendar]
-    (format-date (get-last-day-of-week calendar)))
+  "Get date of last day of given week formatted as yyyy-mm-dd."
+  [calendar]
+  (format-date (get-last-day-of-week calendar)))

 (defn format-from-to-date-for-week
-    "Return a string containing formatted first and last days of week."
-    [year week]
-    (let [cal (get-calendar-for-week year week)]
-        (str (get-first-day-of-week-formatted cal)
-             " - "
-             (get-last-day-of-week-formatted cal))))
+  "Return a string containing formatted first and last days of week."
+  [year week]
+  (let [cal (get-calendar-for-week year week)]
+    (str (get-first-day-of-week-formatted cal)
+         " - "
+         (get-last-day-of-week-formatted cal))))

 (defn minute-of-day
-    "Returns the (index of) minute of current day."
-    []
-    (let [calendar (get-calendar)]
-        (+ (* 60 (.get calendar java.util.Calendar/HOUR_OF_DAY))
-           (.get calendar java.util.Calendar/MINUTE))))
+  "Returns the (index of) minute of current day."
+  []
+  (let [calendar (get-calendar)]
+    (+ (* 60 (.get calendar java.util.Calendar/HOUR_OF_DAY))
+       (.get calendar java.util.Calendar/MINUTE))))

 (defn format-current-date
-    "Format current date using the following template: yyyy-MM-dd"
-    []
-    (format-date (new java.util.Date)))
+  "Format current date using the following template: yyyy-MM-dd"
+  []
+  (format-date (new java.util.Date)))


Tweak decimals a little

Tweak decimals a little

--- src/clj_simple_chart/core.clj
+++ src/clj_simple_chart/core.clj
@@ -139,7 +139,7 @@
 (defn number-of-decimals [scale]
   (let [domain (:domain (meta scale))
         domain-diff (Math/abs (apply - domain))]
-    (cond (>= domain-diff 10) 0
+    (cond (>= domain-diff 8) 0
           (>= domain-diff 1) 1
           :else 2)))

@@ -227,39 +227,23 @@
                     (fmt d)]]) tiks)]))

-(def width 500)
-(def height 500)
+(def width 470)
+(def height 470)
 (def margin {:top 50 :bottom 50 :left 60 :right 60})

 (def y (scale-linear {:color "red" :domain [0 0.7] :range [height 0]}))
 (def y2 (scale-linear {:color "blue" :domain [0 1.69] :range [height 0]}))
 (def x (scale-linear {:color "green" :domain [0 100] :range [0 width]}))
+(def x-top (scale-linear {:color "fuchsia" :domain [0 8] :range [0 width]}))

 (defn diagram
   []
   [:svg {:width  (+ (:left margin) (:right margin) width)
          :height (+ (:top margin) (:bottom margin) height)
          :xmlns  "http://www.w3.org/2000/svg"}
-   ;[:circle {:cx 0 :cy 0 :r 50 :fill "yellow" :stroke "black"}]
-   ;[:circle {:cx (+ (:left margin) (:right margin) width) :cy 0 :r 50 :fill "yellow" :stroke "black"}]
-   ;[:circle {:cx (+ (:left margin) (:right margin) width) :cy (+ (:top margin) (:bottom margin) height) :r 50 :fill "yellow" :stroke "black"}]
-   ;[:circle {:cx 0 :cy (+ (:top margin) (:bottom margin) height) :r 50 :fill "yellow" :stroke "black"}]
    [:g {:transform (translate (:left margin) (:top margin))}
-    (left-y-axis y)
+    [:g (left-y-axis y)]
     [:g {:transform (translate width 0)} (right-y-axis y2)]
     [:g {:transform (translate 0 height)} (bottom-x-axis x)]
-    [:g (top-x-axis x)]
-    #_[:g {:transform (translate (/ width 2) 0)}
-       (right-y-axis (scale-linear {:color "green" :domain [0 10] :range [height 0]}))]
-
-    ;[:rect {:x 0 :y 0 :width width :height height :fill "none" :stroke "black"}]
-    ;[:circle {:cx 50 :cy 100 :r 10 :fill "yellow" :stroke "black"}]
-    ;[:circle {:cx (x 25) :cy (y 25) :r 25 :fill "yellow" :stroke-width 5 :stroke "black"}]
-    ;[:circle {:cx (x 50) :cy (y 50) :r 25 :fill "cyan" :stroke-width 5 :stroke "black"}]
-    ;[:circle {:cx (x 75) :cy (y 25) :r 25 :fill "red" :stroke-width 5 :stroke "black"}]
-    ;[:circle {:cx 50 :cy 100 :r 1 :fill "yellow" :stroke "black"}]
-    ;[:line {:x1 50 :y1 100 :x2 width :y2 100 :stroke "red"}]
-    ;[:text {:x 50 :y 100 :dy ".32em" :font-size "200px"} "1,234"]
-    ;[:line {:x1 0 :y1 0 :x2 width :y2 height :stroke "blue"}]
-    ;[:line {:x1 width :y1 0 :x2 0 :y2 height :stroke "blue"}]
+    [:g (top-x-axis x-top)]
     ]])


Color log arrows based on color of next/prev log message colors

--- src/cljc/robinson/render.cljc
+++ src/cljc/robinson/render.cljc
@@ -1315,25 +1315,31 @@
       ;; ui-hint
       (put-string screen 0 0 (get-in state [:world :ui-hint]) :white :black)
       ;; draw log
-      (let [current-time    (rw/get-time state)
-            log-idx         (get-in state [:world :log-idx] 0)
-            num-logs        (count (filter #(= current-time (get % :time)) (get-in state [:world :log])))
-            up-arrow-char   \u2191
-            down-arrow-char \u2193
-            msg-above?      (< log-idx (dec num-logs ))
-            msg-below?      (pos? log-idx)
-            message         (if (zero? num-logs)
-                              {:message "" :time 0 :color :black}
-                              (nth (reverse (get-in state [:world :log])) log-idx))
-            darken-factor   (inc  (* (/ -1 5) (- current-time (message :time))))
-            log-color       (darken-rgb (color->rgb (get message :color)) darken-factor)
-            characters      (markup->chars 0 0 (format "%s%s %s" (if msg-above?
-                                                                   (str "<color fg=\"highlight\">/</color>-" up-arrow-char)
-                                                                   "   ")
-                                                                 (if msg-below?
-                                                                   (str "<color fg=\"highlight\">*</color>-" down-arrow-char)
-                                                                   "   ")
-                                                                 (or (message :text) "" )))]
+      (let [current-time     (rw/get-time state)
+            log-idx          (get-in state [:world :log-idx] 0)
+            num-logs         (count (filter #(= current-time (get % :time)) (get-in state [:world :log])))
+            up-arrow-char    \u2191
+            down-arrow-char  \u2193
+            msg-above?       (< log-idx (dec num-logs))
+            msg-below?       (pos? log-idx)
+            up-arrow-color   (when msg-above?
+                               (get (nth (reverse (get-in state [:world :log])) (inc log-idx)) :color))
+            down-arrow-color (when msg-below?
+                               (get (nth (reverse (get-in state [:world :log])) (dec log-idx)) :color))
+            message          (if (zero? num-logs)
+                               {:message "" :time 0 :color :black}
+                               (nth (reverse (get-in state [:world :log])) log-idx))
+            darken-factor    (inc  (* (/ -1 5) (- current-time (message :time))))
+            log-color        (darken-rgb (color->rgb (get message :color)) darken-factor)
+            characters       (markup->chars 0 0 (format "%s%s %s" (if msg-above?
+                                                                    (str "<color fg=\"highlight\">/</color>-<color fg=\"" (name up-arrow-color) "\">" up-arrow-char "</color>")
+                                                                    "   ")
+                                                                  (if msg-below?
+                                                                    (str "<color fg=\"highlight\">*</color>-<color fg=\"" (name down-arrow-color) "\">" down-arrow-char "</color>")
+                                                                    "   ")
+                                                                  (if (get message :text)
+                                                                    (str "<color fg=\"" (name (get message :color)) "\">" (get message :text) "</color>")
+                                                                    "")))]
         (log/info "num-log-msgs" num-logs)
         (log/info "message" message)
         (put-chars screen characters)))


Check if job is running vs assuming running & check complete.

--- src/clojure/parkour/graph.clj
+++ src/clojure/parkour/graph.clj
@@ -295,6 +295,10 @@
       (finally
         (-> (Runtime/getRuntime) (.removeShutdownHook hook#))))))

+(defn ^:private job-running?
+  "True iff `job` is current running."
+  [^Job job] (ignore-errors (not (.isComplete job))))
+
 (defn ^:private abort-fn
   "Function for terminating `job`, killing it and cleaning up output path(s)."
   {:tag `Runnable}
@@ -303,7 +307,7 @@
         fs-paths (mapv (juxt (partial fs/path-fs job) identity)
                        (dsink/output-paths job))]
     (fn []
-      (when-not (.isComplete job)
+      (when (job-running? job)
         (log/warn "Stopping job" jname)
         (ignore-errors (.killJob job)))
       (doseq [[fs path] fs-paths]


Random split and back to recommended training order

--- src/quark/slp_runner.clj
+++ src/quark/slp_runner.clj
@@ -6,6 +6,7 @@
             [clojure.pprint :refer [pprint]]
             [clojure.string :as str]
             [atom-finder.util :refer :all]
+            [swiss.arrows :refer :all]
             )
   (:import
             [slp.core.counting.giga GigaCounter]
@@ -16,10 +17,18 @@

 (defn pair->vec [p] [(.left p) (.right p)])

-(time-mins (do
+(defn init-java-lexer []
+  (doto-class LexerRunner
+              (setLexer (JavaLexer.))
+              (setPerLine false)
+              (addSentenceMarkers true)
+              (useExtension "java")))

-;(def train-set (java.io.File. (expand-home "~/opt/src/SLP-Core")))
-(def train-set (java.io.File. (expand-home )))
+(defn init-modeler [& {:keys [self-test] :or {self-test false}}]
+  (doto-class ModelRunner
+              (perLine false)
+              (setNGramOrder 6)
+              (selfTesting self-test)))

 (defn ngram-java
   ([train-path] (ngram-java train-path train-path))
@@ -27,33 +36,43 @@
    (let [train-set (java.io.File. (expand-home train-path))
          test-set (java.io.File. (expand-home test-path))]

-     (doto-class LexerRunner
-                 (setLexer (JavaLexer.))
-                 (setPerLine false)
-                 (addSentenceMarkers true)
-                 (useExtension "java"))
+     (init-java-lexer)
+     (init-modeler :self-test (= train-path test-path))

-     (let [jm-giga-model (JMModel. (GigaCounter.))]
+     (let [model (-<>> (JMModel. (GigaCounter.))
+                       (doto <> (ModelRunner/learn train-set))
+                       (NestedModel. test-set)
+                       (InverseMixModel. <> (CacheModel.))
+                       (doto <> (.setDynamic true)))]

-     (doto-class ModelRunner
-                 (perLine false)
-                 (selfTesting (.equals train-set test-set))
-                 (setNGramOrder 6)
-                 (learn jm-giga-model train-set))
+       {:model model
+        :modeled-files (->> (ModelRunner/model model test-set)
+                            .iterator iterator-seq (map pair->vec) (into {}))}
+       ))))

-     (let [nested-model (NestedModel. test-set jm-giga-model)
-           mix-model (doto (InverseMixModel. nested-model (CacheModel.))
-                           (.setDynamic true))]
-
-       (let [modeled-files (->> (ModelRunner/model mix-model test-set)
-                            .iterator iterator-seq (map pair->vec) (into {}))]
-
-       {:model model :modeled-files modeled-files}))))))
-
-(def ngram-res (ngram-java "~/atom-finder/src/java"))
+(def ngram-res (time-mins (ngram-java "~/atom-finder/src/java")))

 (def statistics (->> ngram-res :modeled-files ModelRunner/getStats))

 (printf "Modeled %d tokens, average entropy:\t%.4f\n" (.getCount statistics) (.getAverage statistics))
-))

+(defn random-split [amount lst]
+  (let [shuffled-lst (shuffle lst)]
+    (-> shuffled-lst count (* amount) double java.lang.Math/round (split-at shuffled-lst))))
+
+(def nginx-c-files (->> "~/opt/src/atom-finder/nginx" expand-home c-files (random-split 0.9)))
+
+(defn model-files [train-files test-files]
+  (init-java-lexer)
+  (init-modeler :self-test false)
+
+  (let [model (-<>> (JMModel. (GigaCounter.))
+                    (doto <> (ModelRunner/learn train-set))
+                    (NestedModel. test-set)
+                    (InverseMixModel. <> (CacheModel.))
+                    (doto <> (.setDynamic true)))]
+
+    {:model model
+     :modeled-files (->> (ModelRunner/model model test-set)
+                         .iterator iterator-seq (map pair->vec) (into {}))}
+    ))


There were a large number of new `html` and `svg` attributes, events and `CSS` styles. Update all of them. Fixes #129

--- src/re_com/validate.cljs
+++ src/re_com/validate.cljs
@@ -177,73 +177,100 @@
 ;; Custom :validate-fn functions
 ;; ----------------------------------------------------------------------------

-;; Reference: http://facebook.github.io/react/docs/tags-and-attributes.html#html-attributes
-;;            http://facebook.github.io/react/docs/events.html#supported-events  (https://developer.mozilla.org/en-US/docs/Web/Events#Standard_events for more)
-
 (def html-attrs #{; ----- HTML attributes (:class and :style commented out as they are not valid in re-com)
-                  :accept :accept-charset :access-key :action :allow-full-screen :allow-transparency :alt :async :auto-complete :auto-focus :auto-play
-                  :cell-padding :cell-spacing :char-set :checked #_:class :class-name :cols :col-span :content :content-editable :context-menu :controls
-                  :coords :cross-origin :data :date-time :defer :dir :disabled :download :draggable :enc-type :form :form-action :form-enc-type :form-method
-                  :form-no-validate :form-target :frame-border :height :hidden :href :href-lang :html-for :http-equiv :icon :id :label :lang :list :loop :manifest
-                  :margin-height :margin-width :max :max-length :media :media-group :method :min :multiple :muted :name :no-validate :open :pattern :placeholder
-                  :poster :preload :radio-group :read-only :rel :required :role :rows :row-span :sandbox :scope :scrolling :seamless :selected :shape :size :sizes
-                  :span :spell-check :src :src-doc :src-set :start :step #_:style :tab-index :target :title :type :use-map :value :width :wmode
+                  ; ----- Reference: https://facebook.github.io/react/docs/dom-elements.html#all-supported-html-attributes
+                  :accept :accept-charset :access-key :action :allow-full-screen :allow-transparency :alt :async :auto-complete :auto-focus :auto-play :capture
+                  :cell-padding :cell-spacing :challenge :char-set :checked :cite #_:class :class-name :cols :col-span :content :content-editable :context-menu :controls
+                  :coords :cross-origin :data :date-time :default :defer :dir :disabled :download :draggable :enc-type :form :form-action :form-enc-type :form-method
+                  :form-no-validate :form-target :frame-border :headers :height :hidden :high :href :href-lang :html-for :http-equiv :icon :id :input-mode :integrity
+                  :is :key-params :key-type :kind :label :lang :list :loop :low :manifest
+                  :margin-height :margin-width :max :max-length :media :media-group :method :min :min-length :multiple :muted :name :no-validate :nonce :open :optimum :pattern :placeholder
+                  :poster :preload :profile :radio-group :read-only :rel :required :reversed :role :rows :row-span :sandbox :scope :scoped :scrolling :seamless :selected :shape :size :sizes
+                  :span :spell-check :src :src-doc :src-lang :src-set :start :step #_:style :summary :tab-index :target :title :type :use-map :value :width :wmode :wrap
                   ; ----- SVG attributes
-                  :cx :cy :d :dx :dy :fill :fill-opacity :font-family :font-size :fx :fy :gradient-transform :gradient-units :marker-end :marker-mid :marker-start
-                  :offset :opacity :pattern-content-units :pattern-units :points :preserve-aspect-ratio :r :rx :ry :spread-method :stop-color :stop-opacity :stroke
-                  :stroke-dasharray :stroke-linecap :stroke-opacity :stroke-width :text-anchor :transform :version :view-box :x :x1 :x2 :y :y1 :y2
+                  ; ----- Reference: https://facebook.github.io/react/docs/dom-elements.html#all-supported-svg-attributes
+                  :accentheight :accumulate :additive :alignment-baseline :allow-reorder :alphabetic :amplitude :arabic-form :ascent :attribute-name :attribute-type
+                  :auto-reverse :azimuth :base-frequency :base-profile :baseline-shift :bbox :begin :bias :by :calc-mode :cap-height :clip :clip-path :clip-path-units
+                  :clip-rule :color-interpolation :color-interpolation-filters :color-profile :color-rendering :content-script-type :content-style-type :cursor :cx :cy :d
+                  :decelerate :descent :diffuse-constant :direction :display :divisor :dominant-baseline :dur :dx :dy :edge-mode :elevation :enable-background :end :exponent
+                  :external-resources-required :fill :fill-opacity :fill-rule :filter :filter-res :filter-units :flood-color :flood-opacity :focusable :font-family :font-size
+                  :font-size-adjust :font-stretch :font-style :font-variant :font-weight :format :from :fx :fy :g1 :g2 :glyph-name :glyph-orientation-horizontal :glyph-orientation-vertical
+                  :glyph-ref :gradient-transform :gradient-units :hanging :horiz-adv-x :horiz-origin-x :ideographic :image-rendering :in :in2 :intercept :k :k1 :k2 :k3 :k4
+                  :kernel-matrix :kernel-unit-length :kerning :key-points :key-splines :key-times :length-adjust :letter-spacing :lighting-color :limiting-cone-angle :local
+                  :marker-end :marker-height :marker-mid :marker-start :marker-units :marker-width :mask :mask-content-units :mask-units :mathematical :mode :num-octaves
+                  :offset :opacity :operator :order :orient :orientation :origin :overflow :overline-position :overline-thickness :paint-order :panose1 :path-length
+                  :pattern-content-units :pattern-transform :pattern-units :pointer-events :points :points-at-x :points-at-y :points-at-z :preserve-alpha :preserve-aspect-ratio
+                  :primitive-units :r :radius :ref-x :ref-y :rendering-intent :repeat-count :repeat-dur :required-extensions :required-features :restart :result :rotate :rx :ry
+                  :scale :seed :shape-rendering :slope :spacing :specular-constant :specular-exponent :speed :spread-method :start-offset :std-deviation :stemh :stemv :stitch-tiles
+                  :stop-color :stop-opacity :strikethrough-position :strikethrough-thickness :string :stroke :stroke-dasharray :stroke-dashoffset :stroke-linecap :stroke-linejoin
+                  :stroke-miterlimit :stroke-opacity :stroke-width :surface-scale :system-language :table-values :target-x :target-y :text-anchor :text-decoration :text-length
+                  :text-rendering :to :transform :u1 :u2 :underline-position :underline-thickness :unicode :unicode-bidi :unicode-range :units-per-em :v-alphabetic :v-hanging
+                  :v-ideographic :v-mathematical :values :vector-effect :version :vert-adv-y :vert-origin-x :vert-origin-y :view-box :view-target :visibility :widths :word-spacing
+                  :writing-mode :x :x1 :x2 :x-channel-selector :x-height :xlink-actuate :xlink-arcrole :xlink-href :xlink-role :xlink-show :xlink-title :xlink-type :xml-base
+                  :xml-lang :xml-space :y :y1 :y2 :y-channel-selector :z :zoom-and-pan
                   ; ----- Event attributes
-                  :on-blur :on-change :on-click :on-copy :on-cut :on-double-click :on-drag :on-drag-end :on-drag-enter :on-drag-exit :on-drag-leave
-                  :on-drag-over :on-drag-start :on-drop :on-focus :on-input :on-key-down :on-key-press :on-key-up :on-mouse-down :on-mouse-enter
-                  :on-mouse-leave :on-mouse-move :on-mouse-out :on-mouse-over :on-mouse-up :on-paste :on-scroll :on-submit :on-touch-cancel
-                  :on-touch-end :on-touch-move :on-touch-start :on-wheel
-                  :on-blur-capture :on-change-capture :on-click-capture :on-copy-capture :on-cut-capture :on-double-click-capture :on-drag-capture
-                  :on-drag-end-capture :on-drag-enter-capture :on-drag-exit-capture :on-drag-leave-capture :on-drag-over-capture :on-drag-start-capture
-                  :on-drop-capture :on-focus-capture :on-input-capture :on-key-down-capture :on-key-press-capture :on-key-up-capture :on-mouse-down-capture
-                  :on-mouse-enter-capture :on-mouse-leave-capture :on-mouse-move-capture :on-mouse-out-capture :on-mouse-over-capture :on-mouse-up-capture
-                  :on-paste-capture :on-scroll-capture :on-submit-capture :on-touch-cancel-capture :on-touch-end-capture :on-touch-move-capture
-                  :on-touch-start-capture :on-wheel-capture})
-
-;; Reference: http://facebook.github.io/react/docs/tags-and-attributes.html#supported-attributes
-
+                  ; ----- Reference: https://facebook.github.io/react/docs/events.html#supported-events
+                  :on-copy :on-cut :on-paste :on-composition-end :on-composition-start :on-composition-update :on-key-down
+                  :on-key-press :on-key-up :on-focus :on-blur :on-change :on-input :on-submit :on-click
+                  :on-context-menu :on-double-click :on-drag :on-drag-end :on-drag-enter :on-drag-exit :on-drag-leave
+                  :on-drag-over :on-drag-start :on-drop :on-mouse-down :on-mouse-enter :on-mouse-leave :on-mouse-move
+                  :on-mouse-out :on-mouse-over :on-mouse-up :on-select :on-touch-cancel :on-touch-end :on-touch-move
+                  :on-touch-start :on-scroll :on-wheel :on-abort :on-can-play :on-can-play-through :on-duration-change
+                  :on-emptied :on-encrypted :on-ended :on-error :on-loaded-data :on-loaded-metadata :on-load-start
+                  :on-pause :on-play :on-playing :on-progress :on-rate-change :on-seeked :on-seeking :on-stalled
+                  :on-suspend :on-time-update :on-volume-change :on-waiting :on-load #_:on-error :on-animation-start
+                  :on-animation-end :on-animation-iteration :on-transition-end
+                  ; ----- '--capture' versions of the above events
+                  :on-copy-capture :on-cut-capture :on-paste-capture :on-composition-end-capture :on-composition-start-capture :on-composition-update-capture :on-key-down-capture
+                  :on-key-press-capture :on-key-up-capture :on-focus-capture :on-blur-capture :on-change-capture :on-input-capture :on-submit-capture :on-click-capture
+                  :on-context-menu-capture :on-double-click-capture :on-drag-capture :on-drag-end-capture :on-drag-enter-capture :on-drag-exit-capture :on-drag-leave-capture
+                  :on-drag-over-capture :on-drag-start-capture :on-drop-capture :on-mouse-down-capture :on-mouse-enter-capture :on-mouse-leave-capture :on-mouse-move-capture
+                  :on-mouse-out-capture :on-mouse-over-capture :on-mouse-up-capture :on-select-capture :on-touch-cancel-capture :on-touch-end-capture :on-touch-move-capture
+                  :on-touch-start-capture :on-scroll-capture :on-wheel-capture :on-abort-capture :on-can-play-capture :on-can-play-through-capture :on-duration-change-capture
+                  :on-emptied-capture :on-encrypted-capture :on-ended-capture :on-error-capture :on-loaded-data-capture :on-loaded-metadata-capture :on-load-start-capture
+                  :on-pause-capture :on-play-capture :on-playing-capture :on-progress-capture :on-rate-change-capture :on-seeked-capture :on-seeking-capture :on-stalled-capture
+                  :on-suspend-capture :on-time-update-capture :on-volume-change-capture :on-waiting-capture :on-load-capture #_:on-error-capture :on-animation-start-capture
+                  :on-animation-end-capture :on-animation-iteration-capture :on-transition-end-capture})
+
+; ----- Reference: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/data-*
+; -----            https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA
 (def extension-attrs #{:data :aria})

-;; Reference: https://developer.mozilla.org/en-US/docs/Web/CSS/Reference
-
 (def css-styles #{; ----- Standard CSS styles
+                  ; ----- Reference: https://developer.mozilla.org/en-US/docs/Web/CSS/Reference
                   :align-content :align-items :align-self :all :animation :animation-delay :animation-direction :animation-duration :animation-fill-mode
                   :animation-iteration-count :animation-name :animation-play-state :animation-timing-function :backface-visibility :background
                   :background-attachment :background-blend-mode :background-clip :background-color :background-image :background-origin :background-position
-                  :background-repeat :background-size :block-size :border :border-block-end :border-block-end-color :border-block-end-style
-                  :border-block-end-width :border-block-start :border-block-start-color :border-block-start-style :border-block-start-width :border-bottom
-                  :border-bottom-color :border-bottom-left-radius :border-bottom-right-radius :border-bottom-style :border-bottom-width :border-collapse
-                  :border-color :border-image :border-image-outset :border-image-repeat :border-image-slice :border-image-source :border-image-width
-                  :border-inline-end :border-inline-end-color :border-inline-end-style :border-inline-end-width :border-inline-start :border-inline-start-color
-                  :border-inline-start-style :border-inline-start-width :border-left :border-left-color :border-left-style :border-left-width :border-radius
-                  :border-right :border-right-color :border-right-style :border-right-width :border-spacing :border-style :border-top :border-top-color
-                  :border-top-left-radius :border-top-right-radius :border-top-style :border-top-width :border-width :bottom :box-decoration-break :box-shadow
-                  :box-sizing :break-after :break-before :break-inside :caption-side :ch :clear :clip :clip-path :cm :color :column-count :column-fill
-                  :column-gap :column-rule :column-rule-color :column-rule-style :column-rule-width :columns :column-span :column-width :content
-                  :counter-increment :counter-reset :cursor :deg :direction :display :dpcm :dpi :dppx :em :empty-cells :ex :filter :flex :flex-basis
-                  :flex-direction :flex-flow :flex-grow :flex-shrink :flex-wrap :float :font :font-family :font-feature-settings :font-kerning
-                  :font-language-override :font-size :font-size-adjust :font-stretch :font-style :font-synthesis :font-variant :font-variant-alternates
-                  :font-variant-caps :font-variant-east-asian :font-variant-ligatures :font-variant-numeric :font-variant-position :font-weight :grad :grid
-                  :grid-area :grid-auto-columns :grid-auto-flow :grid-auto-position :grid-auto-rows :grid-column :grid-column-end :grid-column-start :grid-row
-                  :grid-row-end :grid-row-start :grid-template :grid-template-areas :grid-template-columns :grid-template-rows :height :hyphens :hz
-                  :image-orientation :image-rendering :image-resolution :ime-mode :in :inherit :initial :inline-size :isolation :justify-content :khz :left
-                  :letter-spacing :line-break :line-height :list-style :list-style-image :list-style-position :list-style-type :margin :margin-block-end
-                  :margin-block-start :margin-bottom :margin-inline-end :margin-inline-start :margin-left :margin-right :margin-top :marks :mask :mask-type
-                  :max-block-size :max-height :max-inline-size :max-width :min-block-size :min-height :min-inline-size :min-width :mix-blend-mode :mm :ms
-                  :object-fit :object-position :offset-block-end :offset-block-start :offset-inline-end :offset-inline-start :opacity :order :orphans :outline
-                  :outline-color :outline-offset :outline-style :outline-width :overflow :overflow-wrap :overflow-x :overflow-y :padding :padding-block-end
-                  :padding-block-start :padding-bottom :padding-inline-end :padding-inline-start :padding-left :padding-right :padding-top :page-break-after
-                  :page-break-before :page-break-inside :pc :perspective :perspective-origin :pointer-events :position :pt :px :quotes :rad :rem :resize
-                  :right :ruby-align :ruby-merge :ruby-position :s :scroll-behavior :shape-image-threshold :shape-margin :shape-outside :table-layout :tab-size
-                  :text-align :text-align-last :text-combine-upright :text-decoration :text-decoration-color :text-decoration-line :text-decoration-style
-                  :text-indent :text-orientation :text-overflow :text-rendering :text-shadow :text-transform :text-underline-position :top :touch-action
-                  :transform :transform-origin :transform-style :transition :transition-delay :transition-duration :transition-property
-                  :transition-timing-function :turn :unicode-bidi :unicode-range :unset :vertical-align :vh :visibility :vmax :vmin :vw :white-space :widows
-                  :width :will-change :word-break :word-spacing :word-wrap :writing-mode :z-index
+                  :background-repeat :background-size :block-size :border :border-block-end :border-block-end-color :border-block-end-style :border-block-end-width
+                  :border-block-start :border-block-start-color :border-block-start-style :border-block-start-width :border-bottom :border-bottom-color
+                  :border-bottom-left-radius :border-bottom-right-radius :border-bottom-style :border-bottom-width :border-collapse :border-color :border-image
+                  :border-image-outset :border-image-repeat :border-image-slice :border-image-source :border-image-width :border-inline-end :border-inline-end-color
+                  :border-inline-end-style :border-inline-end-width :border-inline-start :border-inline-start-color :border-inline-start-style :border-inline-start-width
+                  :border-left :border-left-color :border-left-style :border-left-width :border-radius :border-right :border-right-color :border-right-style
+                  :border-right-width :border-spacing :border-style :border-top :border-top-color :border-top-left-radius :border-top-right-radius :border-top-style
+                  :border-top-width :border-width :bottom :box-decoration-break :box-shadow :box-sizing :break-after :break-before :break-inside :caption-side :ch :clear
+                  :clip :clip-path :cm :color :column-count :column-fill :column-gap :column-rule :column-rule-color :column-rule-style :column-rule-width :columns
+                  :column-span :column-width :content :counter-increment :counter-reset :cursor :deg :direction :display :dpcm :dpi :dppx :em :empty-cells :ex :filter
+                  :flex :flex-basis :flex-direction :flex-flow :flex-grow :flex-shrink :flex-wrap :float :font :font-family :font-feature-settings :font-kerning
+                  :font-language-override :font-size :font-size-adjust :font-stretch :font-style :font-synthesis :font-variant :font-variant-alternates :font-variant-caps
+                  :font-variant-east-asian :font-variant-ligatures :font-variant-numeric :font-variant-position :font-weight :fr :grad :grid :grid-area :grid-auto-columns
+                  :grid-auto-flow :grid-auto-position :grid-auto-rows :grid-column :grid-column-end :grid-column-gap :grid-column-start :grid-gap :grid-row :grid-row-end
+                  :grid-row-gap :grid-row-start :grid-template :grid-template-areas :grid-template-columns :grid-template-rows :height :hyphens :hz :image-orientation
+                  :image-rendering :image-resolution :ime-mode :in :inherit :initial :inline-size :isolation :justify-content :khz :left :letter-spacing :line-break
+                  :line-height :list-style :list-style-image :list-style-position :list-style-type :margin :margin-block-end :margin-block-start :margin-bottom
+                  :margin-inline-end :margin-inline-start :margin-left :margin-right :margin-top :marks :mask :mask-clip :mask-composite :mask-image :mask-mode
+                  :mask-origin :mask-position :mask-repeat :mask-size :mask-type :max-block-size :max-height :max-inline-size :max-width :min-block-size :min-height
+                  :min-inline-size :min-width :mix-blend-mode :mm :ms :object-fit :object-position :offset-block-end :offset-block-start :offset-inline-end
+                  :offset-inline-start :opacity :order :orphans :outline :outline-color :outline-offset :outline-style :outline-width :overflow :overflow-wrap
+                  :overflow-x :overflow-y :padding :padding-block-end :padding-block-start :padding-bottom :padding-inline-end :padding-inline-start :padding-left
+                  :padding-right :padding-top :page-break-after :page-break-before :page-break-inside :pc :perspective :perspective-origin :pointer-events :position
+                  :pt :px :quotes :rad :rem :resize :revert :right :ruby-align :ruby-merge :ruby-position :s :scroll-behavior :scroll-snap-coordinate :scroll-snap-destination
+                  :scroll-snap-type :shape-image-threshold :shape-margin :shape-outside :table-layout :tab-size :text-align :text-align-last :text-combine-upright
+                  :text-decoration :text-decoration-color :text-decoration-line :text-decoration-style :text-emphasis :text-emphasis-color :text-emphasis-position
+                  :text-emphasis-style :text-indent :text-orientation :text-overflow :text-rendering :text-shadow :text-transform :text-underline-position :top
+                  :touch-action :transform :transform-box :transform-origin :transform-style :transition :transition-delay :transition-duration :transition-property
+                  :transition-timing-function :turn :unicode-bidi :unicode-range :unset :vertical-align :vh :visibility :vmax :vmin :vw :white-space :widows :width
+                  :will-change :word-break :word-spacing :word-wrap :writing-mode :z-index
                   ; ----- Browser specific styles
                   :-webkit-user-select :-moz-user-select :-ms-user-select :user-select
                   :-webkit-flex-flow :-webkit-flex-direction :-webkit-flex-wrap :-webkit-justify-content :-webkit-align-items :-webkit-align-content


fixed scrolling down

fixed scrolling down

--- src/re_complete/app.cljs
+++ src/re_complete/app.cljs
@@ -153,7 +153,7 @@
   (let [number-of-visible-items (:visible-items options)
         one-item-height (:item-height options)
         selected-item-number (+ 1 selected-item-index)]
-    (cond (> selected-item-number (second @current-view)) (do (set! (.-scrollTop node) (* selected-item-number one-item-height))
+    (cond (> selected-item-number (second @current-view)) (do (set! (.-scrollTop node) (* (- selected-item-number 1) one-item-height))
                                                               (swap! current-view (fn [current-view]
                                                                                [(inc (second current-view)) (+ (second current-view) number-of-visible-items)])))
           (= selected-item-number 1) (do (set! (.-scrollTop node) 0)


Various improvements, including more notes. Better figwheel behaviour.

--- src/re_demo/buttons.cljs
+++ src/re_demo/buttons.cljs
@@ -257,6 +257,13 @@
                    :gap "10px"
                    :style {:font-size "small"}
                    :children [[component-title "[info-button ... ]"]
+
+                              [label :class "small-caps" :label "notes:"]
+
+                              [label :label "A tiny information button, which is light grey and unobrusive. When pressed, displays a popup contining helpful information. "]
+
+                              [label :label "Designed to be used with input fields, to explain the purpose of the field."]
+
                               [args-table info-button-args-desc]]]
                   [v-box
                    :children [[component-title "Demo"]
@@ -282,53 +289,50 @@

 (defn data-row
-  []
-  (let []
-    (fn
-      [row first? last? col-widths mouse-over click-msg]
-      (let [mouse-over-row? (identical? @mouse-over row)]
-        [h-box
-         :class    "rc-div-table-row"
-         :attr     {:on-mouse-over (handler-fn (reset! mouse-over row))
-                    :on-mouse-out  (handler-fn (reset! mouse-over nil))}
-         :children [[h-box
-                     :width (:sort col-widths)
-                     :gap "2px"
-                     :align :center
-                     :children [[row-button
-                                 :md-icon-name    "md-arrow-back md-rotate-90" ;; "md-arrow-back md-rotate-90", "md-play-arrow md-rotate-270", "md-expand-less"
-                                 :mouse-over-row? mouse-over-row?
-                                 :tooltip         "Move this line up"
-                                 :disabled?       (and first? mouse-over-row?)
-                                 :on-click        #(reset! click-msg (str "move row " (:id row) " up"))]
-                                [row-button
-                                 :md-icon-name    "md-arrow-forward md-rotate-90" ;; "md-arrow-forward md-rotate-90", "md-play-arrow md-rotate-90", "md-expand-more"
-                                 :mouse-over-row? mouse-over-row?
-                                 :tooltip         "Move this line down"
-                                 :disabled?       (and last? mouse-over-row?)
-                                 :on-click        #(reset! click-msg (str "move row " (:id row) " down"))]]]
-                    [label :label (:name row) :width (:name col-widths)]
-                    [label :label (:from row) :width (:from col-widths)]
-                    [label :label (:to   row) :width (:to   col-widths)]
-                    [h-box
-                     :gap      "2px"
-                     :width    (:actions col-widths)
-                     :align    :center
-                     :children [[row-button
-                                 :md-icon-name    "md-content-copy"
-                                 :mouse-over-row? mouse-over-row?
-                                 :tooltip         "Copy this line"
-                                 :on-click        #(reset! click-msg (str "copy row " (:id row)))]
-                                [row-button
-                                 :md-icon-name    "md-mode-edit"
-                                 :mouse-over-row? mouse-over-row?
-                                 :tooltip         "Edit this line"
-                                 :on-click        #(reset! click-msg (str "edit row " (:id row)))]
-                                [row-button
-                                 :md-icon-name    "md-delete"
-                                 :mouse-over-row? mouse-over-row?
-                                 :tooltip         "Delete this line"
-                                 :on-click        #(reset! click-msg (str "delete row " (:id row)))]]]]]))))
+  [row first? last? col-widths mouse-over click-msg]
+  (let [mouse-over-row? (identical? @mouse-over row)]
+    [h-box
+     :class    "rc-div-table-row"
+     :attr     {:on-mouse-over (handler-fn (reset! mouse-over row))
+                :on-mouse-out  (handler-fn (reset! mouse-over nil))}
+     :children [[h-box
+                 :width (:sort col-widths)
+                 :gap "2px"
+                 :align :center
+                 :children [[row-button
+                             :md-icon-name    "md-arrow-back md-rotate-90" ;; "md-arrow-back md-rotate-90", "md-play-arrow md-rotate-270", "md-expand-less"
+                             :mouse-over-row? mouse-over-row?
+                             :tooltip         "Move this line up"
+                             :disabled?       (and first? mouse-over-row?)
+                             :on-click        #(reset! click-msg (str "move row " (:id row) " up"))]
+                            [row-button
+                             :md-icon-name    "md-arrow-forward md-rotate-90" ;; "md-arrow-forward md-rotate-90", "md-play-arrow md-rotate-90", "md-expand-more"
+                             :mouse-over-row? mouse-over-row?
+                             :tooltip         "Move this line down"
+                             :disabled?       (and last? mouse-over-row?)
+                             :on-click        #(reset! click-msg (str "move row " (:id row) " down"))]]]
+                [label :label (:name row) :width (:name col-widths)]
+                [label :label (:from row) :width (:from col-widths)]
+                [label :label (:to   row) :width (:to   col-widths)]
+                [h-box
+                 :gap      "2px"
+                 :width    (:actions col-widths)
+                 :align    :center
+                 :children [[row-button
+                             :md-icon-name    "md-content-copy"
+                             :mouse-over-row? mouse-over-row?
+                             :tooltip         "Copy this line"
+                             :on-click        #(reset! click-msg (str "copy row " (:id row)))]
+                            [row-button
+                             :md-icon-name    "md-mode-edit"
+                             :mouse-over-row? mouse-over-row?
+                             :tooltip         "Edit this line"
+                             :on-click        #(reset! click-msg (str "edit row " (:id row)))]
+                            [row-button
+                             :md-icon-name    "md-delete"
+                             :mouse-over-row? mouse-over-row?
+                             :tooltip         "Delete this line"
+                             :on-click        #(reset! click-msg (str "delete row " (:id row)))]]]]]))

 (defn data-table
@@ -376,6 +380,9 @@
                    :style {:font-size "small"}
                    :children [[component-title "[row-button ... ]"]
                               [label :class "small-caps" :label "notes:"]
+                              [label :label "Designed for tables which have per-row buttons. To avoid visual clutter, they only appear on row mouse over."]
+                              [label :label "To experiement, mouse over the table in the demo.  Notice that buttons appear for each row, muted initially, but more strongly as the mouse is over them specifically."]
+
                               [:p
                                "Material design icons can be found "
                                [hyperlink-href
@@ -500,29 +507,33 @@
 (def demos [{:id 0 :label "button"                :component button-demo}
             {:id 1 :label "md-circle-icon-button" :component md-circle-icon-button-demo}
             {:id 2 :label "md-icon-button"        :component md-icon-button-demo}
-            {:id 3 :label "info-button"        :component info-button-demo}
+            {:id 3 :label "info-button"           :component info-button-demo}
             {:id 4 :label "row-button"            :component row-button-demo}
             {:id 5 :label "hyperlink"             :component hyperlink-demo}
             {:id 6 :label "hyperlink-href"        :component hyperlink-href-demo}
             ])

+
+;; This is not the way you'd store state in a "real" app.  We're just taking shortcuts for demo purposes.
+;; If we put this atom at global scope and use defonce, it works better with figwheel refreshes.
+(defonce selected-demo-id (reagent/atom 0))
+
+
 (defn panel2
   []
-  (let [selected-demo-id (reagent/atom 0)]
-    (fn []
-      [v-box
-       :gap "10px"
-       :children [[panel-title "Button Components" ]
-                  [h-box
-                   :gap      "50px"
-                   :children [[v-box
-                               :gap      "10px"
-                               :children [[component-title "Components"]
-                                          [vertical-bar-tabs
-                                           :model     selected-demo-id
-                                           :tabs      demos
-                                           :on-change #(reset! selected-demo-id %)]]]
-                              [(get-in demos [@selected-demo-id :component])]]]]])))
+  [v-box
+   :gap "10px"
+   :children [[panel-title "Button Components" ]
+              [h-box
+               :gap      "50px"
+               :children [[v-box
+                           :gap      "10px"
+                           :children [[component-title "Components"]
+                                      [vertical-bar-tabs
+                                       :model     selected-demo-id
+                                       :tabs      demos
+                                       :on-change #(reset! selected-demo-id %)]]]
+                          [(get-in demos [@selected-demo-id :component])]]]]])

 (defn panel   ;; Only required for Reagent to update panel2 when figwheel pushes changes to the browser


Simplified guard memo key calculation a little more.

--- src/ha/ha.cljc
+++ src/ha/ha.cljc
@@ -462,7 +462,7 @@

 (defn memoized-guard [ha-defs ha-vals ha-val g time-unit]
   (set! guard-check (inc guard-check))
-  (let [memo-key [(.-id ha-val) g]]
+  (let [memo-key (conj g (.-id ha-val))]
     (if-let [memo (and guard-memo
                        (get guard-memo memo-key))]
       (do


Angle bracket fixes.

Angle bracket fixes.

--- resources/code/1.3.2.5.clj
+++ resources/code/1.3.2.5.clj
@@ -1 +1 @@
-(fn [<formal-parameters>] <body>)
+(fn [<-formal-parameters->] <-body->)


as demo of state management added a event-sequencer in the default pipeline

--- core/src/samsara_core/core.clj
+++ core/src/samsara_core/core.clj
@@ -1,5 +1,6 @@
 (ns samsara-core.core
   (:require [moebius.core :refer :all])
+  (:require [moebius.kv :as kv])
   (:require [digest :refer [sha-256]]))

@@ -60,12 +61,21 @@
       :source event})))

+(defenrich event-sequencer
+  #_"It adds a 'seqn' attribute to the event with a monotonic incremental counter
+    which helps to generate a sequence of the order the events have been processed."
+  [state {:keys [sourceId] :as event}]
+  (let [seqn   (inc (or (kv/get state sourceId :count) 0))
+        state' (kv/set state sourceId :count seqn)]
+    [state' (assoc event :seqn seqn)]))
+

 (defn make-samsara-pipeline [config]
   (pipeline
    inject-kibana-timestamp
    is-timestamp-reliable
    inject-id
+   event-sequencer
    (format-to-qanal (:index config))))


Update core.cljs

Update core.cljs

--- examples/simple/src/simpleexample/core.cljs
+++ examples/simple/src/simpleexample/core.cljs
@@ -51,7 +51,7 @@
   :timer
   (fn
     [db _]                       ;; db is the app-db atom
-    (reaction (:timer @db))))    ;; wrap the compitation in a reaction
+    (reaction (:timer @db))))    ;; wrap the computation in a reaction

 (register-sub


switch to your new issue when you create it

--- src-cljs/frontend/components/issues.cljs
+++ src-cljs/frontend/components/issues.cljs
@@ -25,26 +25,26 @@
     om/IInitState (init-state [_] {:issue-title ""})
     om/IRenderState
     (render-state [_ {:keys [issue-title]}]
-      (let [issue-db (om/get-shared owner :issue-db)
-            cust (om/get-shared owner :cust)]
-        (html
-          [:form.menu-invite-form.make {:on-submit #(do (utils/stop-event %)
-                                                      (when (seq issue-title)
-                                                        (d/transact! issue-db [{:db/id -1
-                                                                                :issue/created-at (datetime/server-date)
-                                                                                :issue/title issue-title
-                                                                                :issue/author (:cust/email cust)
-                                                                                :frontend/issue-id (utils/squuid)}])
-                                                        (om/set-state! owner :issue-title "")))}
-           [:input {:type "text"
-                    :value issue-title
-                    :required "true"
-                    :data-adaptive ""
-                    :onChange #(om/set-state! owner :issue-title (.. % -target -value))}]
-           [:label {:data-placeholder (gstring/format "Sounds good; %s characters so far"
-                                                      (count issue-title))
-                    :data-placeholder-nil "How can we improve Precursor?"
-                    :data-placeholder-busy "Your idea in 64 characters or less"}]])))))
+      (let [{:keys [issue-db cust cast!]} (om/get-shared owner)]
+        (html
+         [:form.menu-invite-form.make {:on-submit #(do (utils/stop-event %)
+                                                       (when (seq issue-title)
+                                                         (let [tx (d/transact! issue-db [{:db/id -1
+                                                                                :issue/created-at (datetime/server-date)
+                                                                                :issue/title issue-title
+                                                                                :issue/author (:cust/email cust)
+                                                                                :frontend/issue-id (utils/squuid)}])]
+                                                           (cast! :issue-expanded {:issue-id (d/resolve-tempid (:db-after tx) (:tempids tx) -1)}))
+                                                         (om/set-state! owner :issue-title "")))}
+          [:input {:type "text"
+                   :value issue-title
+                   :required "true"
+                   :data-adaptive ""
+                   :onChange #(om/set-state! owner :issue-title (.. % -target -value))}]
+          [:label {:data-placeholder (gstring/format "Sounds good; %s characters so far"
+                                                     (count issue-title))
+                   :data-placeholder-nil "How can we improve Precursor?"
+                   :data-placeholder-busy "Your idea in 64 characters or less"}]])))))

 (defn comment-form [{:keys [issue-id parent-id]} owner {:keys [issue-db]}]
   (reify
@@ -254,9 +254,9 @@
     om/IRenderState
     (render-state [_ {:keys [title description]}]
       (let [{:keys [cast! issue-db]} (om/get-shared owner)
-            issue (utils/inspect (ds/touch+ (d/entity @issue-db issue-id)))]
-        (html
-         [:div
+            issue (ds/touch+ (d/entity @issue-db issue-id))]
+        (html
+         [:div.make
           [:div.single-issue-head
            ; (om/build vote-box {:issue issue})
            ; [:h4 (or title (:issue/title issue ""))]
@@ -425,7 +425,7 @@
         (html
          [:div.menu-view
           [:div.content
-           (let [deleted (set/difference rendered-issue-ids (utils/inspect all-issue-ids))
+           (let [deleted (set/difference rendered-issue-ids all-issue-ids)
                  added (set/difference all-issue-ids rendered-issue-ids)]
              (when (or (seq deleted) (seq added))
                [:div.make


add timestamps

add timestamps

--- src-cljs/frontend/components/issues.cljs
+++ src-cljs/frontend/components/issues.cljs
@@ -28,6 +28,7 @@
           [:form.menu-invite-form.make {:on-submit #(do (utils/stop-event %)
                                                       (when (seq issue-title)
                                                         (d/transact! issue-db [{:db/id -1
+                                                                                :issue/created-at (datetime/server-date)
                                                                                :issue/title issue-title
                                                                                :issue/author (:cust/email cust)
                                                                                :frontend/issue-id (utils/squuid)}])
@@ -54,6 +55,7 @@
                                  (when (seq comment-body)
                                    (d/transact! issue-db [{:db/id issue-id
                                                            :issue/comments (merge {:db/id -1
+                                                                                :comment/created-at (datetime/server-date)
                                                                                :comment/body comment-body
                                                                                :comment/author (:cust/email cust)
                                                                                :frontend/issue-id (utils/squuid)}
@@ -125,7 +127,7 @@
         (html
          [:div.comment
           [:div (:comment/body comment)
-           [:div "by " (:comment/author comment)]]
+           [:div "by " (:comment/author comment) " on " (datetime/month-day (:comment/created-at comment))]]
           [:div.reply
            (if replying?
              (om/build comment-form {:issue-id issue-id
@@ -175,11 +177,11 @@
     om/IRenderState
     (render-state [_ {:keys [title description]}]
       (let [{:keys [cast! issue-db]} (om/get-shared owner)
-            issue (ds/touch+ (d/entity @issue-db issue-id))]
+            issue (utils/inspect (ds/touch+ (d/entity @issue-db issue-id)))]
         (html
          [:div.content.make
           (om/build vote-box {:issue issue})
-          [:p "by: " (:issue/author issue)]
+          [:p "by: " (:issue/author issue) " on " (datetime/month-day (:issue/created-at issue))]
           [:p "Title "
            [:input {:value (or title (:issue/title issue ""))
                     :on-change #(om/set-state! owner :title (.. % -target -value))}]]


remove gemclass.clj core_deftype.clj core/protocols

--- clojure/src/main/resources/clojure/core.clj
+++ clojure/src/main/resources/clojure/core.clj
@@ -5814,14 +5814,15 @@
 (alter-meta! (find-ns 'clojure.core) assoc :doc "Fundamental library of the Clojure language")
 (load "core_proxy")
 (load "core_print")
-(load "genclass")
-(load "core_deftype")
-(load "core/protocols")
+;(load "genclass")
+;(load "core_deftype")
+;(load "core/protocols")
+
 ;(load "gvec")
 ;(load "instant")
 ;(load "uuid")

-(defn reduce
+#_(defn reduce
   "f should be a function of 2 arguments. If val is not supplied,
   returns the result of applying f to the first 2 items in coll, then
   applying f to that result and the 3rd item, etc. If coll contains no
@@ -5837,7 +5838,7 @@
   ([f val coll]
      (clojure.core.protocols/coll-reduce coll f val)))

-(extend-protocol clojure.core.protocols/IKVReduce
+#_(extend-protocol clojure.core.protocols/IKVReduce
  nil
  (kv-reduce
   [_ f init]
@@ -5870,7 +5871,7 @@
   (.kvreduce vec f init)))

-(defn into
+#_(defn into
   "Returns a new coll consisting of to-coll with all of the items of
   from-coll conjoined."
   {:added "1.0"


Replace hyphen in filename with underscore & rename ns

--- word-count/word_count_test.clj
+++ word-count/word_count_test.clj
@@ -1,28 +1,28 @@
 (ns word-count.test (:require [clojure.test :refer :all]))
-(load-file "word-count.clj")
+(load-file "word_count.clj")

 (deftest count-one-word
   (is (= {"word" 1}
-         (phrase/word-count "word"))))
+         (word-count/word-count "word"))))

 (deftest count-one-of-each
   (is (= {"one" 1 "of" 1 "each" 1}
-         (phrase/word-count "one of each"))))
+         (word-count/word-count "one of each"))))

 (deftest count-multiple-occurrences
   (is (= {"one" 1 "fish" 4 "two" 1 "red" 1 "blue" 1}
-         (phrase/word-count "one fish two fish red fish blue fish"))))
+         (word-count/word-count "one fish two fish red fish blue fish"))))

 (deftest ignore-punctuation
   (is (= {"car" 1, "carpet" 1 "as" 1 "java" 1 "javascript" 1}
-         (phrase/word-count "car : carpet as java : javascript!!&@$%^&"))))
+         (word-count/word-count "car : carpet as java : javascript!!&@$%^&"))))

 (deftest include-numbers
   (is (= {"testing" 2 "1" 1 "2" 1}
-         (phrase/word-count "testing, 1, 2 testing"))))
+         (word-count/word-count "testing, 1, 2 testing"))))

 (deftest normalize-case
   (is (= {"go" 3}
-         (phrase/word-count "go Go GO"))))
+         (word-count/word-count "go Go GO"))))

 (run-tests)


Make `ortho-perspective` snippet static in preparation for automated tests.

--- src/cljc/quil/snippets/lights_camera/camera.cljc
+++ src/cljc/quil/snippets/lights_camera/camera.cljc
@@ -75,23 +75,27 @@

 (defsnippet ortho-perspective
   ["ortho" "perspective"]
-  {:renderer :p3d
-   :setup (q/frame-rate 1)}
+  {:renderer :p3d}

   (q/background 240)
-  (comment "flip between ortho and perspective camera every frame")
-  (comment "enable ortho camera")
+
+  (comment "set camera to look from [400, 100, 200] at point [100, 0, 0]")
+  (q/camera 400 100 200 100 0 0 0 0 -1)
+
   (comment "in ortho all figures will look the same regardless distance")
+  (q/ortho)
+  (comment "draw 3 red boxes with x coordinates 0, 100 and 200")
+  (q/fill 200 0 0)
+  (doseq [x [0 100 200]]
+   (q/with-translation [x 50 0]
+     (q/box 50)))
+
   (comment "in perspective (default) all figures will look smaller the farther they are")
-  (if (even? (q/frame-count))
-    (q/ortho)
-    (q/perspective))
-  (comment "set camera to look from [300, 0, 300] at point [100, 0, 0]")
-  (q/camera 300 0 300 100 0 0 0 0 -1)
-  (q/fill 0 127 127)
-  (comment "draw 3 boxes with x coordinates 0, 100 and 200")
+  (q/perspective)
+  (comment "draw 3 green boxes with x coordinates 0, 100 and 200")
+  (q/fill 0 200 0)
   (doseq [x [0 100 200]]
-    (q/with-translation [x 0 0]
+    (q/with-translation [x -50 0]
       (q/box 50))))

 #?(:clj


Checkbox group use value-fn function

Checkbox group use value-fn function

--- src/cljs/re_form/inputs/checkbox_group_impl.cljs
+++ src/cljs/re_form/inputs/checkbox_group_impl.cljs
@@ -33,7 +33,7 @@
   (fn [{:keys [value on-change value-fn label-fn items] :as props}]
     (let [label-fn (or label-fn pr-str)
           value-fn (or value-fn identity)
-          setgen #(-> % vector set)
+          setgen #(-> % value-fn vector set)
           cont #(s/subset? % value)
           change-fn (fn [set-item]
                       (if (cont set-item)


Refactor grouping compilation

Refactor grouping compilation

--- src/onyx/peer/task_compile.clj
+++ src/onyx/peer/task_compile.clj
@@ -100,34 +100,24 @@
   (compile-ack-retry-lifecycle-functions lifecycles task-name :lifecycle/after-retry-segment))

 (defn task-map->grouping-fn [task-map]
-  (let [group-key (:onyx/group-by-key task-map)]
+  (if-let [group-key (:onyx/group-by-key task-map)]
     (cond (keyword? group-key)
           group-key
           (sequential? group-key)
           #(select-keys % group-key)
           :else
-          #(get % group-key))))
+          #(get % group-key))
+    (if-let [group-fn (:onyx/group-by-fn task-map)]
+      (operation/resolve-fn {:onyx/fn (:onyx/group-by-fn task-map)}))))

 (defn compile-grouping-fn
   "Compiles outgoing grouping task info into a task->group-fn map
   for quick lookup and group fn calls"
   [catalog egress-ids]
-  (merge (->> catalog
-              (filter (fn [entry]
-                        (and (:onyx/group-by-key entry)
-                             egress-ids
-                             (egress-ids (:onyx/name entry)))))
-              (map (juxt :onyx/name task-map->grouping-fn))
-              (into (t/hash-map)))
-         (->> catalog
-              (filter (fn [entry]
-                        (and (:onyx/group-by-fn entry)
-                             egress-ids
-                             (egress-ids (:onyx/name entry)))))
-              (map (fn [entry]
-                     [(:onyx/name entry)
-                      (operation/resolve-fn {:onyx/fn (:onyx/group-by-fn entry)})]))
-              (into (t/hash-map)))))
+  (->> catalog
+       (map (juxt :onyx/name task-map->grouping-fn))
+       (filter second)
+       (into (t/hash-map))))

 (defn filter-windows [windows task]
   (filter #(= (:window/task %) task) windows))


cleanup

cleanup

--- src/group_redis/partition.clj
+++ src/group_redis/partition.clj
@@ -55,21 +55,10 @@
   ;(prn "perform-assignments is-flag " (empheral-get connector (partition-flag-path topic)) " - d1 "   (empheral-get connector (assignments-path topic))
    ; " d2 " (distribute-ids (get-member-keys connector topic) ids)  " ids " ids " members " (get-member-keys connector topic))

-  (prn
-    "path " (assignments-path topic)
-    " 1rst : " (empheral-get connector (partition-flag-path topic)) " = " (is-partition-flag? connector topic)
-    " 2nd : "
-
-    (not= (empheral-get connector (assignments-path topic)) (distribute-ids (get-member-keys connector topic) ids))
-
-    " 3rd "  (and ;only perform assignments if the partion flag is false and the calculated assignment differs from the saved one
-        (not (empheral-get connector (partition-flag-path topic)))
-        (not= (empheral-get connector (assignments-path topic)) (distribute-ids (get-member-keys connector topic) ids))))
   (if (and ;only perform assignments if the partion flag is false and the calculated assignment differs from the saved one
         (not (empheral-get connector (partition-flag-path topic)))
         (not= (empheral-get connector (assignments-path topic)) (distribute-ids (get-member-keys connector topic) ids)))
       (do
-        (prn "set!!")
         (expire-set connector 120 (partition-flag-path topic) true))

       ))
@@ -82,7 +71,6 @@

    Returns true if any waiting was actually done (i.e if the sync barrier was entered or not)"
   [connector host topic ids]
-  (prn host " is-partition-flag? " (is-partition-flag? connector topic) " topic " topic "is master " (is-master!? connector host topic))
   (if (is-partition-flag? connector topic)
     (let [start-time (System/currentTimeMillis)]
       ;notify syncpoint
@@ -103,11 +91,8 @@
                      (doseq [ks (empheral-ls connector (sync-point-path-keys connector topic))]
                        (empheral-del connector (:path ks)))
                      ;set the assignments and un set the partition flag
-                     (prn "set assignements " members " " ids " = " (distribute-ids members ids))
                      (empheral-set connector (assignments-path topic) (distribute-ids members ids))
-                     (empheral-del connector (partition-flag-path topic)))
-                   (prn  "sync keys " (empheral-ls connector (sync-point-path-keys connector topic)) " members " (map :path (get-partition-members connector topic))))
-                 )
+                     (empheral-del connector (partition-flag-path topic)))))

                (if (is-partition-flag? connector topic)
 		             (do (Thread/sleep 100) (recur (inc c)))))))
@@ -130,7 +115,7 @@
     (controlled-assignments connector host-name topic ids curr-assignments))
   ([connector host topic ids curr-assignments]
      ;identify master
-    (prn "is-master!? " host  " " (is-master!? connector host topic))
+    ;(prn "is-master!? " host  " " (is-master!? connector host topic))
     (empheral-set connector (str topic "/partition-members/" host) (System/currentTimeMillis))

     (if (is-master!? connector host topic) ;here the master sets the assignment flag (sync barrier) only if needed


Update index.clj

Update index.clj

added changes online

--- src/help_me_im_dumb/index.clj
+++ src/help_me_im_dumb/index.clj
@@ -10,6 +10,16 @@
 (def POSTINGS-LIST-DB "term-postings-mapping")
 (def URL-MAPPING-FILENAME "resources/url-mapping.txt")
 (def DOCID-DOC-MAPPING-DB "docid-doc-mapping")
+
+(def STOP-WORDS
+  "List of words to ignore"
+  " source: http://www.wordfrequency.info/free.asp?s=y "
+  #{"the" "be" "and" "of" "a" "in" "to" "have" "it" "i" "that" "for" "you" "he" "she" "with" "on" "do" "say" "this" "they" "at" "but" "we" "is" "his" "hers"})
+
+(defn not-stop-word?
+  [w]
+  "Returns boolean based on is/isn't stop word"
+  (if (STOP-WORDS w) false true))

 (declare create-indicies-helper read-in-dictionary)

@@ -43,7 +53,7 @@

 (defn normalize-tokens
   [tokens]
-  (map s/lower-case tokens))
+  (filter not-stop-word? (map s/lower-case tokens)))

 (defn sanitize-tokens
   [tokens]


Bumps version to 1.34.3-SNAPSHOT

Bumps version to 1.34.3-SNAPSHOT

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


according to the SC book (Figure 1.5) the dust ugen should also support control rate. I'm also assuming this applies to dust2

--- src/overtone/sc/ugen/noise.clj
+++ src/overtone/sc/ugen/noise.clj
@@ -174,13 +174,13 @@

       {:name "Dust"
        :args [{:name "density", :default 0.0}]
-       :rates #{:ar}
+       :rates #{:ar :kr}
        :doc "Generates random impulses from 0 to +1.
   density - average number of impulses per second."}

       {:name "Dust2"
        :args [{:name "density", :default 0.0}]
-       :rates #{:ar}
+       :rates #{:ar :kr}
        :doc "Generates random impulses from -1 to +1.
   density - average number of impulses per second"}])


Layout manager #41

Layout manager #41


(SERVER-1148) Bump test-restart-comes-back timeout to 5 minutes

This commit bumps the timeout that the `test-restart-comes-back` test
uses to wait for a restart to complete from 90 seconds to 5 minutes.  It
appears that 90 seconds may not have been a long enough time to wait
based on the results of some test runs in Travis, where the JRubyPuppet
pool instance initialization after the restart sometimes appears to not
have completed before the timeout is reached.

--- test/integration/puppetlabs/services/jruby/jruby_pool_int_test.clj
+++ test/integration/puppetlabs/services/jruby/jruby_pool_int_test.clj
@@ -341,7 +341,7 @@
        (tk-internal/restart-tk-apps [app])
        (let [start (System/currentTimeMillis)]
          (while (and (not= (count @call-seq) 5)
-                     (< (- (System/currentTimeMillis) start) 90000))
+                     (< (- (System/currentTimeMillis) start) 300000))
            (Thread/yield)))
        (let [shutdown-service (tk-app/get-service app :ShutdownService)]
          (is (nil? (tk-internal/get-shutdown-reason shutdown-service))


(SERVER-537) Disable HUP test

(SERVER-537) Disable HUP test

As the TK HUP support is not yet released, this commit disables the test
that exercised the HUP support. This can be re-enabled once the TK
version in use supports HUP signals.

--- test/integration/puppetlabs/services/jruby/jruby_pool_int_test.clj
+++ test/integration/puppetlabs/services/jruby/jruby_pool_int_test.clj
@@ -296,7 +296,7 @@
 (defprotocol BonusService
   (bonus-service-fn [this]))

-(deftest ^:integration test-hup-comes-back
+#_(deftest ^:integration test-hup-comes-back
   (testing "After a HUP signal puppetserver can still handle requests"
     (let [call-seq (atom [])
           lc-fn (fn [context action] (swap! call-seq conj action) context)


Keep fleshing out the Swagger support

Keep fleshing out the Swagger support

--- src/io/aviso/rook/swagger.clj
+++ src/io/aviso/rook/swagger.clj
@@ -7,6 +7,7 @@
   (:require [schema.core :as s]
             [clojure.string :as str]
             [medley.core :as medley]
+            [io.aviso.toolchest.macros :refer [cond-let]]
             [io.aviso.toolchest.collections :refer [pretty-print]]
             [clojure.tools.logging :as l]))

@@ -37,20 +38,133 @@
     (str/join "/")
     (str "/")))

-(defn default-path-item-object-constructor
+;; Revisit order of parameters in these for ease of ->> threading; should swagger-object always be the last?
+
+(defn default-path-params-injector
+  "Identifies each path parameter and adds a value for it to the swagger-object at the path defined by params-key."
+  [swagger-options swagger-object routing-entry params-key]
+  (let [path-ids (->> routing-entry :path (filter keyword?))
+        reducer (fn [so path-id]
+                  (update-in so params-key
+                             conj {:name     path-id
+                                   :in       :path
+                                   :required :true}))]
+    (reduce reducer swagger-object path-ids)))
+
+(defn default-query-params-injector
+  "Identifies each query parameter via the :query-schema metadata and injects it."
+  [swagger-options swagger-object routing-entry params-key]
+  (if-let [schema (-> routing-entry :meta :query-schema)]
+    ;; Assumes that the schema is a map.
+    (let [reducer (fn [so [key-id key-schema]]
+                    (cond-let
+                      ;; Just ignore these, they are a convinience for the caller ("be generous in what you accept").
+                      (= s/Any key-id)
+                      so
+
+                      [[k required] (cond (s/optional-key? key-id)
+                                          [(.k key-id) false]
+
+                                          (s/required-key? key-id)
+                                          [(.k key-id) true]
+
+                                          (keyword? key-id)
+                                          [key-id true]
+
+                                          :else
+                                          (throw (ex-info (format "No idea what to do with query schema key %s." key-id)
+                                                          {:routing-entry routing-entry
+                                                           :key-id        key-id
+                                                           :key-schema    key-schema})))]
+
+                      :else
+                      (update-in so params-key
+                                 conj {:name     k
+                                       :in       :query
+                                       :required required})))]
+      (reduce reducer swagger-object schema))
+    ; no :query-schema
+    swagger-object))
+
+(defn schema->swagger-schema
+  [swagger-options schema]
+  ;; To be done!
+  (medley/remove-vals nil?
+                      {:required   []
+                       :description (-> schema meta :doc)
+                       :properties {}}))
+
+(defn to-schema-reference
+  "Converts a schema to a schema reference; the schema must be named.  Returns a tuple
+  of the possibly updated swagger object and a string reference to the schema within the swagger object
+  (as a path string)."
+  ;; TODO: return the {:schema {"$ref" ...}} map instead?
+  [swagger-options swagger-object schema]
+  (cond-let
+    [schema-name (s/schema-name schema)
+     schema-ns (-> schema meta :ns)]
+
+    (or (nil? schema-name) (nil? schema-ns))
+    (throw (ex-info "Unable to create a Swagger schema from an anonymous Prismatic schema."
+                    schema))
+
+    ;; Avoid forward slash in the swagger name, as that's problematic.
+    [swagger-name (str schema-ns \: schema-name)
+     swagger-reference (str "#/definitions/" swagger-name)
+     swagger-schema (get-in swagger-object [:definitions swagger-name])]
+
+    (some? swagger-schema)
+    [swagger-object swagger-reference]
+
+    [new-schema (schema->swagger-schema swagger-options schema)
+     swagger-object' (assoc-in swagger-object [:definitions swagger-name] new-schema)]
+
+    :else
+    [swagger-object' swagger-reference]))
+
+(defn default-body-params-injector
+  "Uses the :body-schema metadata to identify the body params."
+  [swagger-options swagger-object routing-entry paths-key]
+  (if-let [schema (-> routing-entry :meta :body-schema)]
+
+    ;; Assumption: it's a map and named
+    (let [[swagger-object' schema-reference] (to-schema-reference swagger-options swagger-object schema)]
+      (update-in swagger-object' paths-key
+                 conj {:name     :request-body
+                       :in       :body
+                       :required true
+                       :schema   {"$ref" schema-reference}}))
+    ; no schema:
+    swagger-object))
+
+(defn default-path-item-object-injector
+  "Injects a PathItemObject based on a routing entry.
+
+  The paths-key is a coordinate into the swagger-object where the PathItemObject should be created.
+
+  Returns the modified swagger-object. "
   [swagger-options swagger-object routing-entry paths-key]
   (let [{endpoint-meta :meta} routing-entry
         swagger-meta (:swagger endpoint-meta)
         description (or (:description swagger-meta)
                         (:doc endpoint-meta))
-        summary (:summary swagger-meta)]
-    (assoc-in swagger-object paths-key
-              (medley/remove-vals nil?
-                                  {:description description
-                                   :summary summary
-                                   :operation-id (:function endpoint-meta)}))))
-
-(defn default-route-converter
+        summary (:summary swagger-meta)
+        path-params-injector (:path-params-injector swagger-options default-path-params-injector)
+        query-params-injector (:query-params-injector swagger-options default-query-params-injector)
+        body-params-injector (:body-params-injector swagger-options default-body-params-injector)
+        params-key (concat paths-key ["parameters"])]
+    (as-> swagger-object %
+          (assoc-in % paths-key
+                    (medley/remove-vals nil?
+                                        {:description  description
+                                         :summary      summary
+                                         :operation-id (:function endpoint-meta)}))
+          (path-params-injector swagger-options % routing-entry params-key)
+          (query-params-injector swagger-options % routing-entry params-key)
+          (body-params-injector swagger-options % routing-entry params-key)
+          (update-in % params-key #(sort-by :name %)))))
+
+(defn default-route-injector
   "The default route converter.  The swagger-options may contain an override of this function.

   swagger-options
@@ -70,31 +184,25 @@

   :meta
   : The merged meta-data of the endpoint function, with defaults from the enclosing namespace,
-    and including :function as the string name of the endpoint."
+    and including :function as the string name of the endpoint.
+
+  Returns the modified swagger-object."
   [swagger-options swagger-object routing-entry]
-  (l/debug "merging" routing-entry)
   (let [path-str (-> routing-entry :path path->str)
+        ;; Ignoring :all for the moment.
         method-str (-> routing-entry :method name)
-        pio-constructor (:path-item-object-constructor swagger-options default-path-item-object-constructor)]
+        pio-constructor (:path-item-object-injector swagger-options default-path-item-object-injector)]
+    ;; Invoke the constructor for the path info. It may need to make changes to the :definitions, so we have
+    ;; to let it modify the entire Swagger object ... but we help it out by providing the path
+    ;; to where the PathInfoObject (which describes what Rook calls a "route").
     (pio-constructor swagger-options swagger-object routing-entry
-       ;; Ignoring :all right now.
-       [:paths path-str method-str])
-
-    )
-  )
+                     [:paths path-str method-str])))

 (defn- routing-entry->map
   [[method path _ endpoint-meta]]
   {:method method
    :path   path
    :meta   endpoint-meta})
-
-
-(defn tap'
-  [message data]
-  (l/debugf "%s: %s" message (pretty-print data))
-  data)
-

 (defn construct-swagger-object
   "Constructs the root Swagger object from the Rook options, swagger options, and the routing table
@@ -102,12 +210,11 @@
   [swagger-options routing-table]
   (let [{:keys [skeleton route-converter]
          :or   {skeleton        default-swagger-skeleton
-                route-converter default-route-converter}} swagger-options]
+                route-converter default-route-injector}} swagger-options]
     (->> routing-table
          vals
          (apply concat)
          (map routing-entry->map)
-         (tap' "routing entries")
          ;; Add the :no-swagger meta data to edit it out.
          (remove #(-> % :meta :no-swagger))
          (reduce (partial route-converter swagger-options) skeleton))))


add :db.unique/identity to section/id-sk so upserts work


whitespace

whitespace


agreement for essere-agreement with number and gender for past tense

--- src/babel/italiano/morphology/verbs.cljc
+++ src/babel/italiano/morphology/verbs.cljc
@@ -262,6 +262,57 @@

 (def replace-patterns-past-tense
   [
+   {:p [#"^([^ ]+)esa" "$1eso"]
+    :u {:synsem {:subcat {:1 {:agr {:number :sing
+                                    :gender :fem}}}
+                 :infl :past}}}
+   {:p [#"^([^ ]+)ese" "$1eso"]
+    :u {:synsem {:subcat {:1 {:agr {:number :sing
+                                    :gender :fem}}}
+                 :infl :past}}}
+   {:p [#"^([^ ]+)esi" "$1eso"]
+    :u {:synsem {:subcat {:1 {:agr {:number :plur
+                                    :gender :masc}}}
+                 :infl :past}}}
+   {:p [#"^([^ ]+)([aiu])ta" "$1$2to"]
+    :u {:synsem {:subcat {:1 {:agr {:number :sing
+                                    :gender :fem}}}
+                 :infl :past}}}
+   {:p [#"^([^ ]+)([aiu])te" "$1$2to"]
+    :u {:synsem {:subcat {:1 {:agr {:number :plur
+                                    :gender :fem}}}
+                 :infl :past}}}
+   {:p [#"^([^ ]+)([aiu])ti" "$1$2to"]
+    :u {:synsem {:subcat {:1 {:agr {:number :plur
+                                    :gender :masc}}}
+                 :infl :past}}}
+
+   {:p [#"^([^ ]+)tita" "$1tito"]
+    :u {:synsem {:subcat {:1 {:agr {:number :sing
+                                    :gender :fem}}}
+                 :infl :past}}}
+   {:p [#"^([^ ]+)tite" "$1tito"]
+    :u {:synsem {:subcat {:1 {:agr {:number :plur
+                                    :gender :fem}}}
+                 :infl :past}}}
+   {:p [#"^([^ ]+)titi" "$1tito"]
+    :u {:synsem {:subcat {:1 {:agr {:number :plur
+                                    :gender :masc}}}
+                 :infl :past}}}
+
+   {:p [#"^([^ ]+)asta" "$1asto"]
+    :u {:synsem {:subcat {:1 {:agr {:number :sing
+                                    :gender :fem}}}
+                 :infl :past}}}
+   {:p [#"^([^ ]+)aste" "$1asto"]
+    :u {:synsem {:subcat {:1 {:agr {:number :plur
+                                    :gender :fem}}}
+                 :infl :past}}}
+   {:p [#"^([^ ]+)asti" "$1asto"]
+    :u {:synsem {:subcat {:1 {:agr {:number :plur
+                                    :gender :masc}}}
+                 :infl :past}}}
+
    {:p [#"^([^ ]+)ata" "$1are"]
     :u {:synsem {:subcat {:1 {:agr {:number :sing
                                     :gender :fem}}}


Preserving icon url after accumulating/cleaning up site times

https://app.asana.com/0/50978096561390/65221189956312

--- src/background/relevance/background.cljs
+++ src/background/relevance/background.cljs
@@ -138,14 +138,21 @@
   :data-load
   (fn [app-state [_ loaded]]
     (let [migrated  (migrations/migrate-to-latest loaded)
+          t         (now)
           new-urls  (->
                       (:url-times migrated)
-                      (data/time-clean-up (- (now) (* 7 ms-day)) 30)
-                      (data/time-clean-up (- (now) (* 14 ms-day)) 90)
-                      (data/time-clean-up (- (now) (* 30 ms-day)) 300))
+                      (data/time-clean-up (- t (* 7 ms-day)) 30)
+                      (data/time-clean-up (- t (* 14 ms-day)) 90)
+                      (data/time-clean-up (- t (* 30 ms-day)) 300))
+          site-data (:site-times migrated)
           new-sites (if (not= new-urls (:url-times migrated))
-                      (data/accumulate-site-times new-urls)
-                      (:site-times migrated))
+                      (->>
+                        ;; Accumulate site times but preserve the icons we had before
+                        (data/accumulate-site-times new-urls)
+                        (map #(vector (key %)
+                                      (assoc (val %) :icon (get-in site-data [(key %) :icon]))))
+                        (into {}))
+                      site-data)
           new-data  (assoc migrated :url-times new-urls :site-times new-sites)]
       ; (console/trace "Data load" loaded "migrated" new-data)
       ;; Save the migrated data we just received
@@ -350,8 +357,7 @@
             (go (dispatch [:handle-activation
                            (first (<! (tabs/query {:active true :windowId windowId})))])))
           (assoc app-state :active-tab nil))
-        app-state)
-      )
+        app-state))
     ))


Increase generated char range

Increase generated char range

--- src/main/cljc/mikron/compiler/processor/gen.cljc
+++ src/main/cljc/mikron/compiler/processor/gen.cljc
@@ -47,7 +47,7 @@
     `(math/rand))

   (defmethod gen :char [_ _]
-    `(char (math/rand-long 10000)))
+    `(char (math/rand-long 50000)))

   (defmethod gen :boolean [_ _]
     `(< 0.5 (math/rand)))


resolved the issue that when a topology has not been assigned a task, the storm-ui breaks

--- src/clj/backtype/storm/daemon/nimbus.clj
+++ src/clj/backtype/storm/daemon/nimbus.clj
@@ -787,7 +787,10 @@
               task-info (storm-task-info storm-cluster-state storm-id)
               base (.storm-base storm-cluster-state storm-id nil)
               assignment (.assignment-info storm-cluster-state storm-id nil)
-              task-summaries (dofor [[task component] task-info]
+              no-assigned-tasks? (empty? (:task->node+port assignment))
+              task-summaries (if no-assigned-tasks?
+                               []
+                               (dofor [[task component] task-info]
                                     (let [[node port] (get-in assignment [:task->node+port task])
                                           host (-> assignment :node->host (get node))
                                           heartbeat (.task-heartbeat storm-cluster-state storm-id task)
@@ -806,7 +809,7 @@
                                                         errors
                                                         )
                                         (.set_stats stats))
-                                      ))
+                                      )))
               ]
           (TopologyInfo. storm-id
                          (:storm-name base)


read-storm-topology is now using storage

--- src/clj/backtype/storm/daemon/nimbus.clj
+++ src/clj/backtype/storm/daemon/nimbus.clj
@@ -300,12 +300,11 @@
    (FileUtils/writeByteArrayToFile (File. (master-stormconf-path stormroot)) (Utils/serialize storm-conf))
    ))

-(defn- read-storm-topology [conf storm-id]
-  (let [stormroot (master-stormdist-root conf storm-id)]
+(defn- read-storm-topology [storage storm-id]
+  (let [stormroot (nimbus-storage-stormdist-root storm-id)]
     (Utils/deserialize
-      (FileUtils/readFileToByteArray
-        (File. (master-stormcode-path stormroot))
-        ))))
+      (IOUtils/toByteArray
+        (.open storage (master-stormcode-path stormroot))))))

 (declare compute-executor->component)

@@ -314,7 +313,7 @@
         storage (:storage nimbus)
         storm-base (.storm-base (:storm-cluster-state nimbus) storm-id nil)
         topology-conf (read-storm-conf storage conf storm-id)
-        topology (read-storm-topology conf storm-id)
+        topology (read-storm-topology storage storm-id)
         executor->component (->> (compute-executor->component nimbus storm-id)
                                  (map-key (fn [[start-task end-task]]
                                             (ExecutorDetails. (int start-task) (int end-task)))))]
@@ -408,7 +407,7 @@
         storm-base (.storm-base (:storm-cluster-state nimbus) storm-id nil)
         component->executors (:component->executors storm-base)
         storm-conf (read-storm-conf storage conf storm-id)
-        topology (read-storm-topology conf storm-id)
+        topology (read-storm-topology storage storm-id)
         task->component (storm-task-info topology storm-conf)]
     (->> (storm-task-info topology storm-conf)
          reverse-map
@@ -423,7 +422,7 @@
   (let [conf (:conf nimbus)
         storage (:storage nimbus)
         executors (compute-executors nimbus storm-id)
-        topology (read-storm-topology conf storm-id)
+        topology (read-storm-topology storage storm-id)
         storm-conf (read-storm-conf storage conf storm-id)
         task->component (storm-task-info topology storm-conf)
         executor->component (into {} (for [executor executors
@@ -698,7 +697,7 @@
         conf (:conf nimbus)
         storage (:storage nimbus)
         storm-conf (read-storm-conf storage conf storm-id)
-        topology (system-topology! storm-conf (read-storm-topology conf storm-id))
+        topology (system-topology! storm-conf (read-storm-topology storage storm-id))
         num-executors (->> (all-components topology) (map-val num-start-executors))]
     (log-message "Activating " storm-name ": " storm-id)
     (.activate-storm! storm-cluster-state
@@ -1013,10 +1012,10 @@
         (to-json (read-storm-conf storage conf id)))

       (^StormTopology getTopology [this ^String id]
-        (system-topology! (read-storm-conf storage conf id) (read-storm-topology conf id)))
+        (system-topology! (read-storm-conf storage conf id) (read-storm-topology storage id)))

       (^StormTopology getUserTopology [this ^String id]
-        (read-storm-topology conf id))
+        (read-storm-topology storage id))

       (^ClusterSummary getClusterInfo [this]
         (let [storm-cluster-state (:storm-cluster-state nimbus)
@@ -1059,7 +1058,9 @@

       (^TopologyInfo getTopologyInfo [this ^String storm-id]
         (let [storm-cluster-state (:storm-cluster-state nimbus)
-              task->component (storm-task-info (read-storm-topology conf storm-id) (read-storm-conf storage conf storm-id))
+              storm-topology (read-storm-topology storage storm-id)
+              storm-conf (read-storm-conf storage conf storm-id)
+              task->component (storm-task-info storm-topology storm-conf)
               base (.storm-base storm-cluster-state storm-id nil)
               assignment (.assignment-info storm-cluster-state storm-id nil)
               beats (.executor-beats storm-cluster-state storm-id (:executor->node+port assignment))


Fix project type in dummy data generator.

--- src/clj/hatnik/web/server/dummy_data.clj
+++ src/clj/hatnik/web/server/dummy_data.clj
@@ -40,7 +40,7 @@
 (defn create-quil-project [db user-id]
   (let [proj-id (stg/create-project! db {:name "Quil"
                                          :user-id user-id
-                                         :type "reqular"})]
+                                         :type "regular"})]
     (stg/create-action! db user-id {:project-id proj-id
                                     :type "email"
                                     :subject "{{library}} {{version}} released"


Make AI player action-ctx function optional

--- src/clj/zetawar/players/embedded_ai.cljs
+++ src/clj/zetawar/players/embedded_ai.cljs
@@ -97,7 +97,7 @@
     (let [db @conn
           game (game/game-by-id db game-id)
           {:keys [action-ctx actor-score-fn base-action-score-fn unit-action-score-fn]} fns
-          action (or (binding [*action-ctx* action-ctx
+          action (or (binding [*action-ctx* (or action-ctx (constantly nil))
                                *actor-score-fn* actor-score-fn
                                *base-action-score-fn* base-action-score-fn
                                *unit-action-score-fn* unit-action-score-fn]


working on unit handling

working on unit handling

--- src/cljc/ow/starbuck/message_router.cljc
+++ src/cljc/ow/starbuck/message_router.cljc
@@ -55,7 +55,13 @@
 (defn- get-component-unit [{:keys [ruleset] :as router} component]
   (-> (:units ruleset)
       owc/map-invert-coll
-      component))
+      (get component)))
+
+(defn- get-tunnel [{:keys [unit] :as router} component]
+  (and unit
+       (let [cunit (get-component-unit router component)]
+         (and (not= unit cunit)
+              cunit))))

 (defn- handle-events [eventhandlers msg]
   (reduce (fn [s [key eventhandler]]
@@ -75,7 +81,7 @@
            :evmsgs []}
           eventhandlers))

-(defn advance [{:keys [unit ruleset] :as router} msg]
+(defn advance [{:keys [ruleset] :as router} msg]
   "Takes a message, runs it against ruleset and returns a sequence of routed messages."
   (debug "routing starting with" (printable-msg msg))
   (if (< (::transition-count msg) 100)
@@ -96,9 +102,10 @@
     (do (warn "dropping message due to high transition-count")
         [])))

-(defn make-router [ruleset & {:keys [unit dispatch?]
-                              :or {dispatch? true}}]
+(defn make-router [ruleset components & {:keys [unit dispatch?]
+                                         :or {dispatch? true}}]
   {:unit unit
+   :components components
    :ruleset ruleset
    :dispatch? dispatch?})

@@ -121,13 +128,19 @@
          ::transition-count 0
          ::max-transitions max-transitions))

-(defn dispatch [{:keys [unit] :as router} msg]
-  (let [component (peek (::component msg))]
-    (cond (fn? component)                   [true  (component msg)]
-          (satisfies? ap/Channel component) [true  (a/put! component msg)]
-          (satisfies? p/Tunnel component)   [true  (->> (update msg ::component pop)
-                                                        (p/send component))]
-          true                              [false component])))
+(defn dispatch [{:keys [components] :as router} msg]
+  (when-let [component (peek (::component msg))]
+    (let [tunnel (get-tunnel router component)
+          dest (or tunnel component)
+          destcomp (get components dest)]
+      (cond (fn? destcomp)                   (destcomp msg)
+            (satisfies? ap/Channel destcomp) (a/put! destcomp msg)
+            (satisfies? p/Tunnel destcomp)   (p/send destcomp msg)
+            true (throw (ex-info "cannot dispatch" {:router router
+                                                    :msg msg
+                                                    :tunnel tunnel
+                                                    :component component
+                                                    :dest dest}))))))

 #_(defn- process [this req]
   (advance req (:ruleset this)))
@@ -177,4 +190,19 @@
        first
        (dispatch))

+
+  (dispatch {:unit :server
+             :components {:a #(println "a" %)
+                          :b #(println "b" %)
+                          :c #(println "c" %)
+                          :d #(println "d" %)
+                          :e #(println "e" %)
+                          :f #(println "f" %)
+                          :browser #(println "browser" %)
+                          :server #(println "server" %)}
+             :ruleset {:units {:browser #{:a :b :c}
+                               :server #{:d :e :f}}}}
+            {::component (list :c)
+             :foo :bar})
+
   )


Make comic-list filtering robust about loading

--- src/cljs/comic_reader/ui/comic_list.cljs
+++ src/cljs/comic_reader/ui/comic_list.cljs
@@ -100,7 +100,8 @@
     (str "" s)))

 (defn prefix-filter-comics [prefix comics]
-  (if-not (str/blank? prefix)
+  (if (and (not (str/blank? prefix))
+           (seqable? comics))
     (let [filter-re (re-pattern (str "(?i)^"
                                      (re-string prefix)))]
       (filter (fn [{name :comic/name}]