date picker demo WIP - refactor to use common code for parameters TODO: collapse when clicked outside

--- src/re_demo/date.cljs
+++ src/re_demo/date.cljs
@@ -15,124 +15,114 @@
             (disj @set-atom member)
             (conj @set-atom member))))

-(defn inline-date
-  []
-  (let [model1       (r/atom (now))
-        model4       (r/atom (iso8601->date "20140914"))
-        disabled?    (r/atom false)
-        show-today?  (r/atom true)
-        show-weeks?  (r/atom false)
-        days-map     {:Su "S" :Mo "M" :Tu "T" :We "W" :Th "T" :Fr "F" :Sa "S"}
-        enabled-days (r/atom (-> days-map keys set))
-        day-check    (fn [day] [v-box
-                                :align :center
-                                :children [[:label     {:class "day-enabled"} (day days-map)]
-                                           [checkbox
-                                            :model     (@enabled-days day)
-                                            :on-change #(toggle-inclusion! enabled-days day)
-                                            :style     {:margin-top "-2px"}]]])]
+(def days-map {:Su "S" :Mo "M" :Tu "T" :We "W" :Th "T" :Fr "F" :Sa "S"})
+
+(defn- parameters-with
+  [content enabled-days disabled? show-today? show-weeks?]
+  (let [day-check (fn [day] [v-box
+                       :align :center
+                       :children [[:label {:class "day-enabled"} (day days-map)]
+                                  [checkbox
+                                   :model (@enabled-days day)
+                                   :on-change #(toggle-inclusion! enabled-days day)
+                                   :style {:margin-top "-2px"}]]])]
     (fn []
       [v-box
        :gap "20px"
        :align :start
-       :children [[h-box
+       :children [[label :style {:font-style "italic"} :label "parameters:"]
+                  [h-box
                    :gap "20px"
                    :align :start
-                   :children [[label :label "options: "]
-                              [checkbox
-                               :label "Disabled"
+                   :children [[checkbox
+                               :label ":disabled"
                                :model disabled?
                                :on-change #(reset! disabled? %)]
                               [checkbox
-                               :label "Show today"
+                               :label ":show-today"
                                :model show-today?
                                :on-change #(reset! show-today? %)]
                               [checkbox
-                               :label "Show weeks"
+                               :label ":show-weeks"
                                :model show-weeks?
-                               :on-change #(reset! show-weeks? %)]
-                              ]]
+                               :on-change #(reset! show-weeks? %)]]]
                   [h-box
                    :gap "2px"
                    :align :center
-                   :children [[label :label "enabled days:"]
-                              [gap :width "5px"]
-                              [day-check :Su]
+                   :children [[day-check :Su]
                               [day-check :Mo]
                               [day-check :Tu]
                               [day-check :We]
                               [day-check :Th]
                               [day-check :Fr]
                               [day-check :Sa]
+                              [gap :width "5px"]
+                              [label :label ":enabled-days"]
                               [gap :width "15px"]
                               [:label
-                               {:class "day-enabled"}
+                               {:class "day-enabled" :style {:color "orange"}}
                                "(warning: excluding selected day causes assertion error)"]]]
-                  [h-box
-                   :gap "20px"
-                   :align :start
-                   :children [[inline-picker
-                               :model        model1
-                               :disabled     disabled?
-                               :show-today   @show-today?
-                               :show-weeks   @show-weeks?
-                               :enabled-days @enabled-days
-                               :on-change    #(reset! model1 %)]
-                              [inline-picker
-                               :model        model4
-                               :minimum      (iso8601->date "20140831")
-                               :maximum      (iso8601->date "20141019")
-                               :show-today   @show-today?
-                               :show-weeks   @show-weeks?
-                               :enabled-days #{:Su}
-                               :disabled     disabled?
-                               :on-change    #(reset! model4 %)]
-                              ]]]])))
+                  content]])))

-(defn popup-date
-  []
-  ;; API same as inline-date-picker above
-  (let [example-date (iso8601->date "20140914") ;; A sunday. Must be one of :enabled-days
-        model        (r/atom example-date)
-        disabled?    (r/atom false)
-        show-today?  (r/atom true)
-        show-weeks?  (r/atom true)]
-    (fn
-      []
-      [v-box
-       :gap "5px"
-       :align :start
-       :children [[h-box
-                   :gap "20px"
-                   :align :start
-                   :children [[label :label "options: "]
-                              [checkbox
-                               :label "Disabled"
-                               :model disabled?
-                               :on-change #(reset! disabled? %)]
-                              [checkbox
-                               :label "Show today"
-                               :model show-today?
-                               :on-change #(reset! show-today? %)]
-                              [checkbox
-                               :label "Show weeks"
-                               :model show-weeks?
-                               :on-change #(reset! show-weeks? %)]]]
-                  [:label
-                   {:style {:font-size "12px" :font-weight "normal"}}
-                   "(show today & show weeks won't refresh while dropped down)"]
-                  [h-box
-                   :size "auto"
-                   :align :start
-                   :children [[gap :size "120px"]
-                              [dropdown-picker
-                               :model        model
-                               :show-today   @show-today?
-                               :show-weeks   @show-weeks?
-                               :enabled-days #{:Su}
-                               :format       "dd MMM, yyyy"
-                               :disabled     disabled?
-                               :on-change    #(reset! model %)]]]]])))
+
+
+  (defn show-variant
+    [variation]
+    (let [model1       (r/atom (now))
+          model2       (r/atom (iso8601->date "20140914"))
+          disabled?    (r/atom false)
+          show-today?  (r/atom true)
+          show-weeks?  (r/atom false)
+          enabled-days (r/atom (-> days-map keys set))]
+      (case variation
+        "1" [(fn []
+               [parameters-with
+                [h-box
+                 :gap "20px"
+                 :align :start
+                 :children [[(fn []
+                               [inline-picker
+                                :model model1
+                                :disabled disabled?
+                                :show-today @show-today?
+                                :show-weeks @show-weeks?
+                                :enabled-days @enabled-days
+                                :on-change #(reset! model1 %)])]
+                            ;; restricted to both minimum & maximum date
+                            [(fn []
+                               [inline-picker
+                                :model model2
+                                :minimum (iso8601->date "20140831")
+                                :maximum (iso8601->date "20141019")
+                                :show-today @show-today?
+                                :show-weeks @show-weeks?
+                                :enabled-days @enabled-days
+                                :disabled disabled?
+                                :on-change #(reset! model2 %)])]]]
+                enabled-days
+                disabled?
+                show-today?
+                show-weeks?])]
+        "2" [(fn []
+               [parameters-with
+                [h-box
+                 :size "auto"
+                 :align :start
+                 :children [[gap :size "120px"]
+                            [(fn []
+                               [dropdown-picker
+                                :model model1
+                                :show-today @show-today?
+                                :show-weeks @show-weeks?
+                                :enabled-days @enabled-days
+                                :format "dd MMM, yyyy"
+                                :disabled disabled?
+                                :on-change #(reset! model1 %)])]]]
+                enabled-days
+                disabled?
+                show-today?
+                show-weeks?])])))
+

 (defn notes
   [selected-variation]
@@ -143,29 +133,29 @@
                [:label {:style {:font-variant "small-caps"}} "required"]
                 [:ul
                  [:li.spacer [:strong ":model"]
-                  "- goog.date.UtcDateTime can be reagent/atom. Represents displayed month and actual selected day. Must be one of :enabled-days"]
+                  " - goog.date.UtcDateTime can be reagent/atom. Represents displayed month and actual selected day. Must be one of :enabled-days"]
                  [:li.spacer [:strong ":on-change"]
-                  "- callback will be passed single arg of the selected goog.date.UtcDateTime."]
+                  " - callback will be passed single arg of the selected goog.date.UtcDateTime."]
                  ]
                [:label {:style {:font-variant "small-caps"}} "optional"]
                 [:ul
                  [:li.spacer [:strong ":disabled"]
-                  "- boolean can be reagent/atom. (default false) If true, navigation is allowed but selection is disabled."]
+                  " - boolean can be reagent/atom. (default false) If true, navigation is allowed but selection is disabled."]
                  [:li.spacer [:strong ":enabled-days"]
-                  "- set of any #{:Su :Mo :Tu :We :Th :Fr :Sa} If nil or empty, all days are enabled."]
+                  " - set of any #{:Su :Mo :Tu :We :Th :Fr :Sa} If nil or empty, all days are enabled."]
                  [:li.spacer [:strong ":show-weeks"]
-                  "- boolean. (default false) If true, first column shows week numbers."]
+                  " - boolean. (default false) If true, first column shows week numbers."]
                  [:li.spacer [:strong ":show-today"]
-                  "- boolean. (default false) If true, today's date is highlighted different to selection. When both today's date and selected day are the same, selected highlight takes precedence."]
+                  " - boolean. (default false) If true, today's date is highlighted different to selection. When both today's date and selected day are the same, selected highlight takes precedence."]
                  [:li.spacer [:strong ":minimum"]
-                  "- optional goog.date.UtcDateTime inclusive beyond which navigation and selection is blocked."]
+                  " - optional goog.date.UtcDateTime inclusive beyond which navigation and selection is blocked."]
                  [:li.spacer [:strong ":maximum"]
-                  "- optional goog.date.UtcDateTime inclusive beyond which navigation and selection is blocked."]
+                  " - optional goog.date.UtcDateTime inclusive beyond which navigation and selection is blocked."]
                  [:li.spacer [:strong ":hide-border"]
-                  "- boolean. Default false."]
+                  " - boolean. Default false."]
                  (when (= "2" @selected-variation)
                    [:li.spacer [:strong ":format"]
-                    "- string format for dropdown label showing currently selected date see cljs_time.format Default \"yyyy MMM dd\""])]]]])
+                    " - string format for dropdown label showing currently selected date see cljs_time.format Default \"yyyy MMM dd\""])]]]])

 (def variations [{:id "1" :label "Inline"}
                  {:id "2" :label "Dropdown"}
@@ -193,8 +183,4 @@
                                                         :width     "300px"
                                                         :on-select #(reset! selected-variation %)]]]
                                            [gap :size "0px"] ;; Force a bit more space here
-                                           (case @selected-variation
-                                             "1" [inline-date]
-                                             "2" [popup-date]
-                                             ;;TODO: implement min/max variation
-                                             )]]]]]])))+                                           [show-variant @selected-variation]]]]]]])))


Sort eids in history model

Sort eids in history model

--- src/yetibot/core/models/history.clj
+++ src/yetibot/core/models/history.clj
@@ -2,11 +2,13 @@
   (:require
     [yetibot.core.db.history :refer :all]
     [clojure.string :refer [join split]]
+    [clojure.core.reducers :as r]
     [yetibot.core.models.users :as u]
     [taoensso.timbre :refer [info warn error spy]]
     [datomico.core :as dc]
     [datomic.api :as d]
     [datomico.db :refer [q] :as db]
+    [yetibot.core.util :refer [with-fresh-db]]
     [datomico.action :refer [all where raw-where]]))

 ;;;; read
@@ -50,9 +52,10 @@
    :where [['?e :history/body '?body]
            [(list re-find re '?body)]]})

-(defn all-entities [] '{:find [?e]
-                        :where [[?e :history/body ?body ?tx]
-                                [?tx :db/txInstant ?ts]]})
+(defn all-entities [] '
+  {:find [?e]
+   :where [[?e :history/body ?body ?tx]
+           [?tx :db/txInstant ?ts]]})

 (defn head [n query] (take n (q query)))

@@ -76,18 +79,25 @@
 (defn touch-all [eids]
   (->> eids
        (map first)
+       sort
        (map db/entity)
        (map d/touch)))
+
+;; scratch space to experiment
+(comment
+  (with-fresh-db
+    db/*db*
+    )
+  d/seek-datoms
+  d/since
+  )
+

 (defn touch-and-fmt [eids]
   (->> eids
       touch-all
       (map format-entity)))

-
-(comment
-  (def entities (q '[:find ?e :where [?e :history/body]]))
-  )

 ;; history filters
 (def ^:private cmd-history #"^\!")


Flag a packet for the protocol it was decoded from

--- src/mavlink/core.clj
+++ src/mavlink/core.clj
@@ -734,6 +734,7 @@
                                  input-stream
                                  output-channel
                                  {:message'id (:msg-key message-info)
+                                  :protocol' :mavlink2
                                   :sequence'id
                                     (byte-to-long (new Long (.get buffer 4)))
                                   :system'id
@@ -837,6 +838,7 @@
                                  input-stream
                                  output-channel
                                  {:message'id (:msg-key message-info)
+                                  :protocol' :mavlink1
                                   :sequence'id
                                     (byte-to-long (new Long (.get buffer 2)))
                                   :system'id


Function to segment beats

Function to segment beats

--- src/tenor/entities.clj
+++ src/tenor/entities.clj
@@ -12,13 +12,22 @@
         (Integer. (nth components 4)))
       (throw (Exception. "Invalid notation")))))

-(defn time-signature [beat-count & [sig]]
+(defn time-signature [note-count & [sig]]
   (cond
-    (> beat-count 3)
-    (let [beats (rand-nth [2 3 4])
-          sig (concat (or sig '()) (range 1 (inc beats)))]
-      (time-signature (- beat-count beats) sig))
-    (and (<= beat-count 3) (> beat-count 0))
-    (let [sig (concat (or sig '()) (range 1 (inc beat-count)))]
+    (> note-count 3)
+    (let [beat (rand-nth [2 3 4])
+          sig (concat (or sig '()) (range 1 (inc beat)))]
+      (time-signature (- note-count beat) sig))
+    (and (<= note-count 3) (> note-count 0))
+    (let [sig (concat (or sig '()) (range 1 (inc note-count)))]
       (time-signature 0 sig))
     :else sig))
+
+(defn segment-beat [note-count note-value]
+  (let [sixteenth-count (* (/ 16 note-value) note-count)
+        notes (range 1 (inc sixteenth-count))]
+    (filter
+      (fn [x] (or (= 1 x) (rand-nth [true false])))
+      notes)))
+
+(defrecord Measure [note time-signature])


Whitespace fix

Whitespace fix

--- src/mdr2/handler.clj
+++ src/mdr2/handler.clj
@@ -90,7 +90,7 @@
 (def rest-api
   "REST API for ABACUS handler"
   (-> api-routes
-      (wrap-defaults (assoc-in api-defaults [:params  :multipart] true))
+      (wrap-defaults (assoc-in api-defaults [:params :multipart] true))
       stacktrace/wrap-stacktrace-log))


Циркулярная зависимость date-time в core.cljs

--- radiolamp-6P3S/src/r6p3s/core.cljs
+++ radiolamp-6P3S/src/r6p3s/core.cljs
@@ -17,7 +17,7 @@
             ;;[r6p3s.ui.collapser :as collapser]
             [r6p3s.ui.container :as container]
             [r6p3s.ui.container-fluid :as container-fluid]
-            [r6p3s.ui.datatime :as datatime]
+            ;;[r6p3s.ui.datatime :as datatime]
             [r6p3s.ui.form-group :as form-group]
             [r6p3s.ui.glyphicon :as glyphicon]
             [r6p3s.ui.label :as label]


Bind default values for width and height

This avoids a NullPointerException when trying to construct the polygon
with the float-array values.

--- totem-destroyer/desktop/src-common/totem_destroyer/core.clj
+++ totem-destroyer/desktop/src-common/totem_destroyer/core.clj
@@ -66,7 +66,7 @@
 (defn get-entity-at-cursor
   [screen entities]
   (let [coords (input->screen screen (input! :get-x) (input! :get-y))]
-    (find-first (fn [{:keys [body width height breakable?] :as entity}]
+    (find-first (fn [{:keys [body width height breakable?] :or {width 0 height 0} :as entity}]
                   (let [rot (body! body :get-angle)
                         x-pos (x (body! body :get-position))
                         y-pos (y (body! body :get-position))]


it was broken... have to fix later with tests
Revert "Copy my improved versions of dasherize and camelize from cake"

This reverts commit 844aa974d028d60a21d7febd416e828b311c4feb.

--- src/useful/string.clj
+++ src/useful/string.clj
@@ -1,16 +1,17 @@
 (ns useful.string
   (:use [clojure.string :only [join split capitalize]]))

-(defn camelize [str]
-  (s/replace str
-             #"-(\w)"
-             (comp s/upper-case second))[s & [lower]])
+(defn camelize [s & [lower]]
+  (let [parts (split (str s) #"-|_")]
+    (apply str
+           (if lower
+             (cons (first parts) (map capitalize (rest parts)))
+             (map capitalize parts)))))

-(defn dasherize [name]
-  (s/replace name
-             #"(?<![A-Z])[A-Z]+"
-             (comp (partial str "-")
-                   s/lower-case)))
+(defn dasherize [s]
+  (.. (re-matcher #"\B([A-Z])" (str s))
+      (replaceAll "-$1")
+      toLowerCase))

 (defn underscore [s]
   (.. (re-matcher #"\B([A-Z])" (str s))


Add LD flag and change copy

Add LD flag and change copy

--- src-cljs/frontend/components/project_settings.cljs
+++ src-cljs/frontend/components/project_settings.cljs
@@ -544,11 +544,12 @@
                                      "If you have SSH keys, sensitive env vars or AWS credentials stored in your project settings and "
                                      "untrusted forks can make pull requests against your repo, then this option "
                                      "isn't for you!"])})
-            (describe-flag {:flag :build-prs-only
-                             :title "Only build pull requests"
-                             :blurb [:p
-                                     "By default, we will build all the commits for this project. Once turned on, we will only build branches "
-                                     "that have associated pull requests open. Note: This feature is always turned off for your default branch."]})
+            (when (feature/enabled? :build-prs-only)
+              (describe-flag {:flag :build-prs-only
+                              :title "Only build pull requests"
+                              :blurb [:p
+                                      "By default, we will build all the commits for this project. Once turned on, we will only build branches "
+                                      "that have associated pull requests open. Note: For your default branch, we will always build all commits."]}))
             (describe-flag {:flag :osx-code-signing-enabled
                             :title "Code Signing Support"
                             :blurb [:p


Limiting the resize to correct behavior

Limiting the resize to correct behavior

--- src/uxbox/shapes.cljs
+++ src/uxbox/shapes.cljs
@@ -125,20 +125,20 @@

 (defmethod move-vertex ::rect
   [shape vid {dx :x dy :y lock :lock}]
-  (let [[dx dy] (if lock [dx dx] [dx dy])]
+  (let [{:keys [x1 x2 y1 y2]} shape]
     (case vid
       1 (assoc shape
-               :x1 (+ (:x1 shape) dx)
-               :y1 (+ (:y1 shape) dy))
+               :x1 (min x2 (+ x1 dx))
+               :y1 (min y2 (+ y1 dy)))
       2 (assoc shape
-               :x2 (+ (:x2 shape) dx)
-               :y1 (+ (:y1 shape) dy))
+               :x2 (max x1 (+ x2 dx))
+               :y1 (min y2 (+ y1 dy)))
       3 (assoc shape
-               :x1 (+ (:x1 shape) dx)
-               :y2 (+ (:y2 shape) dy))
+               :x1 (min x2 (+ x1 dx))
+               :y2 (max y1 (+ y2 dy)))
       4 (assoc shape
-               :x2 (+ (:x2 shape) dx)
-               :y2 (+ (:y2 shape) dy)))))
+               :x2 (max x1 (+ x2 dx))
+               :y2 (max y1 (+ y2 dy))))))

 (defmethod move-vertex :builtin/circle
   [shape vid {dx :x dy :y lock :lock}]


Remove cli code

Remove cli code

--- src/rill/cli.clj
+++ src/rill/cli.clj
@@ -1,21 +0,0 @@
-(ns rill.cli
-  (:require [rill.event-store.psql :refer [psql-event-store]]
-            [rill.event-channel :refer [event-channel]]
-            [rill.event-stream :refer [all-events-stream-id]]
-            [rill.event-store.atom-store.event :refer [unprocessable?]]
-            [clojure.core.async :refer [<!!]])
-  (:gen-class))
-
-(defn -main [url]
-  {:pre [url]}
-  (let [ch (event-channel (psql-event-store url)
-                          all-events-stream-id -1 0)]
-    (println "Printing all events...")
-    (loop []
-      (if-let [e (<!! ch)]
-        (do (if (unprocessable? e)
-              (println "Skipped message.")
-              (prn e))
-            (recur))))))
-
-


Make thumbs up bigger

Make thumbs up bigger

Will probably just convert it to a loading symbol

--- src/cljs/onyx_dashboard/components/deployment.cljs
+++ src/cljs/onyx_dashboard/components/deployment.cljs
@@ -29,7 +29,8 @@
                                    {})
                  :bs-style "primary"}
                 (if (:id deployment)
-                  (dom/i {:style {:align "center"}
-                          :class (if (:up-to-date? deployment)
-                                   "fa fa-thumbs-o-up"
-                                   "fa fa-thumbs-o-down")})))))))
+                  (dom/div {:style {:text-align "center"}}
+                           (dom/i {:style {:font-size 42}
+                                   :class (if (:up-to-date? deployment)
+                                            "fa fa-thumbs-o-up"
+                                            "fa fa-thumbs-o-down")}))))))))


gen-cases passed

gen-cases passed

--- src/neuseg/train.clj
+++ src/neuseg/train.clj
@@ -14,8 +14,8 @@
 (defn- zip [& colls]
   (map flatten (partition (count colls) (apply interleave colls))))

-(defn- format-case [coll]
-  (clojure.string/join "\n" (map (partial clojure.string/join " ") (split-at 32 coll))))
+(defn- format-case [input output]
+  (clojure.string/join "\n" (map (partial clojure.string/join " ") [input output])))

 (defn tagging [text]
   (let [seged (seg text)]
@@ -28,9 +28,9 @@
           (recur (rest raw) (nthrest sgd 2) (conj ret 1 1)))))))

 (defn gen-cases [text]
-  (clojure.string/join "\n"
-    (map format-case (zip (map mdot (vec (Neighbors/slider 4 unizero  (map get-vector (iterator-seq (NGram/unigram text))))))
-                          (map mdot (vec (Neighbors/slider 4 bizero   (map get-vector (iterator-seq (NGram/bigram text))))))
-                          (map mdot (vec (Neighbors/slider 4 trizero  (map get-vector (iterator-seq (NGram/trigram text))))))
-                          (map mdot (vec (Neighbors/slider 4 quadzero (map get-vector (iterator-seq (NGram/quadgram text)))))))
-                          (partition 2 (tagging text)))))
+  (str (clojure.string/join "\n"
+         (map format-case (zip (map mdot (vec (Neighbors/slider 4 unizero  (map get-vector (iterator-seq (NGram/unigram text))))))
+                               (map mdot (vec (Neighbors/slider 4 bizero   (map get-vector (iterator-seq (NGram/bigram text))))))
+                               (map mdot (vec (Neighbors/slider 4 trizero  (map get-vector (iterator-seq (NGram/trigram text))))))
+                               (map mdot (vec (Neighbors/slider 4 quadzero (map get-vector (iterator-seq (NGram/quadgram text)))))))
+                               (partition 2 (tagging text))))) "\n")


Add a zero-arg version of done-working

Add a zero-arg version of done-working

--- src/lt/objs/notifos.cljs
+++ src/lt/objs/notifos.cljs
@@ -13,10 +13,12 @@
     (set-msg! msg))
   (statusbar/loader-inc))

-(defn done-working [msg]
-  (when msg
-    (set-msg! msg))
-  (statusbar/loader-dec))
+(defn done-working
+  ([]
+   (statusbar/loader-dec))
+  ([msg]
+   (set-msg! msg)
+   (statusbar/loader-dec)))

 (defn msg* [m opts]
   (object/merge! statusbar/statusbar-loader (merge {:message m :class ""} opts)))


a release

a release

--- src/ontrail/keen.clj
+++ src/ontrail/keen.clj
@@ -14,7 +14,7 @@
         [compojure.core :only (defroutes ANY POST GET PUT DELETE)]))

 (def conman
-  (make-reusable-conn-manager {:timeout 10 :threads 3 :default-per-route 3}))
+  (make-reusable-conn-manager {:timeout 10 :threads 50 :default-per-route 50}))

 (def connection
   (merge {:accept :json}


Fix schema error.

Fix schema error.

--- src/onyx/schema.clj
+++ src/onyx/schema.clj
@@ -40,7 +40,6 @@
    (s/optional-key :onyx/language) Language
    (s/optional-key :onyx/batch-timeout) (s/pred pos? 'pos?)
    (s/optional-key :onyx/doc) s/Str
-   (s/optional-key :onyx/min-peers) (s/pred pos? 'pos?)
    (s/optional-key :onyx/max-peers) (s/pred pos? 'pos?)
    s/Keyword s/Any})


fixed z-indexes

fixed z-indexes

--- src-cljs/pepa/style.cljs
+++ src-cljs/pepa/style.cljs
@@ -101,7 +101,7 @@
     [:header {:min-height (px header-height)
               :max-height (px header-height)
               :line-height (px header-height)
-              :z-index 1000
+              :z-index 110
               :background-color header-color
               :padding {:left (px header-padding)
                         :right (px header-padding)}}]))
@@ -113,7 +113,7 @@
                  :top (px 0)
                  :width (px draggable-size)
                  :height (px draggable-size)
-                 :z-index 10
+                 :z-index 120
                  :cursor :ew-resize
                  :background {:image (image-url "resize.svg")
                               :size [(px draggable-size)
@@ -141,7 +141,7 @@
                :left (px 0)
                :right (px 0)
                :top (px 0)
-               :z-index 100
+               :z-index 20
                :height (px (- header-height 2))
                :background header-color}]
     ;; Logo


Added :paredit-backward-slurp-sexp

Added :paredit-backward-slurp-sexp

--- src/paredit/core.clj
+++ src/paredit/core.clj
@@ -740,6 +740,13 @@
       (recur u))
     loc))

+(defn- up-to-left-sibling
+  [loc]
+  (if (= loc (-> loc z/leftmost non-puncts-to-right first))
+    (when-let [u (z/up loc)]
+      (recur u))
+    loc))
+
 (defmethod paredit
   :paredit-forward-slurp-sexp
   [cmd {:keys #{parse-tree buffer}} {:keys [^String text offset length] :as t}]
@@ -771,3 +778,44 @@
             ret)
           t))
       t)))
+
+(defmethod paredit
+  :paredit-backward-slurp-sexp
+  [cmd {:keys #{parse-tree buffer}} {:keys [^String text offset length] :as t}]
+  (with-important-memoized
+    (if-let [rloc (-?> parse-tree (parsed-root-loc true))]
+      (let [[l r] (normalized-selection rloc offset length)
+            ;; TODO need to check if we are in a string (still slurp, but move end-quote)
+            starting-loc (if (*tag-closing-brackets* (loc-tag l))  ;; if on closing punct, must select parent differently
+                           (loc-for-offset rloc offset)
+                           (if-let [nl (z/up (parse-node l))]
+                             nl l))]
+        (if-let [slurper (up-to-left-sibling starting-loc)]
+          (let [slurpees (non-puncts-to-left (z/left slurper))
+                slurp-text (apply str (map loc-text slurpees))
+                slurp-to-loc (first slurpees)
+                slurp-to-so (start-offset slurp-to-loc)
+                slurper-node (parse-node slurper)
+                slurper-so (start-offset slurper-node)
+                slurper-eo (end-offset slurper-node)
+                replace-offset slurp-to-so
+                replace-to-offset (inc slurper-so)
+                text-to-replace (.substring text slurp-to-so replace-to-offset)
+                open-punct (*tag-opening-brackets* (loc-tag slurper))
+                replace-text (str open-punct slurp-text)
+                replace-length (.length text-to-replace)
+                ;; TODO potentially need to re-indent the slurped-in text (if multi-line)
+                ret (-> t
+                        (assoc-in [:text] (t/str-replace text replace-offset replace-length replace-text))
+                        (update-in [:modifs] conj {:offset replace-offset :length replace-length :text replace-text}))]
+            (printf "text-to-replace: '%s'
+replace-text: '%s'
+slurp-text: '%s'
+open-punct: '%s'"
+                      text-to-replace
+                      replace-text
+                      slurp-text
+                      open-punct)
+            ret)
+          t))
+      t)))


Add 56 as a possible bitrate

Add 56 as a possible bitrate

--- src/mdr2/encode.clj
+++ src/mdr2/encode.clj
@@ -15,7 +15,9 @@
   "Max number of bytes that fit on a CD-ROM"
   698748928)

-(def sampling-rates {:mono 22050.0 :stereo 44100.0})
+(def sampling-rates
+  "Possible sample rates for encoding a DTB"
+  {:mono 22050.0 :stereo 44100.0})

 (defn sampling-rate
   "Return the sampling rate that should be used for the given
@@ -58,8 +60,8 @@
         "-o" iso-name encoded-path)))

 (def bitrates
-  "Possible bitrates for encoding"
-  [128 64 48])
+  "Possible bitrates for encoding a DTB"
+  [128 64 56 48])

 (defn ideal-bitrate
   "Calculate the ideal bitrate based on the size of a production and


generalize the selector for toggling the search form

--- src/aspire/templates.clj
+++ src/aspire/templates.clj
@@ -70,7 +70,7 @@
   (let [tf (if tf true false)]
     (liven nodes
            [:form#search] (en/set-attr :data-active tf)
-           [:body#onboarding] (en/set-attr :data-search-active tf))))
+           [:body] (en/set-attr :data-search-active tf))))

 ;; Templates
 ;; -----------------------


annotate output

annotate output

--- src/atom_finder/core.clj
+++ src/atom_finder/core.clj
@@ -6,11 +6,6 @@
            [org.eclipse.cdt.internal.core.dom.parser.cpp CPPASTTranslationUnit]
            [org.eclipse.cdt.internal.core.dom.rewrite.astwriter ASTWriter]))

-
-;(def filename "/Users/dgopstein/nyu/confusion/atoms/simplifications/2000-natori/nonconfusing.c")
-;(def filename "/Users/dgopstein/nyu/confusion/atom-finder/src/atom_finder/macro-in-expression.c")
-
-;(def root (translation-unit (resource-path "if-starts-in-expression.c")))

 (defn find-atoms-in-file
   "Find every example of each of the given atoms in the given file"
@@ -22,7 +17,6 @@
   "Find all preprocessor directives not at the top level in directory"
   [dirname]
 (time
- ; (prn (count (for [filename (map #(.getPath %) (c-files "/Users/dgopstein/opt/src/mono"))]
  (prn (count (pmap

               (fn [file]
@@ -44,51 +38,41 @@
               (c-files dirname)
               )))))

-; (preprocessor-in-dir "/Users/dgopstein/opt/src/gcc")
-; (preprocessor-in-dir "/Users/dgopstein/opt/src/linux")
-; (preprocessor-in-dir "/Users/dgopstein/opt/src/gcc/gcc/testsuite/c-c++-common")
-; (preprocessor-in-dir "/Users/dgopstein/nyu/confusion/atom-finder/src/test/resources")

-;(atom-finder.find-atom/preprocessors-in-contexts define-only expression-classifier (tu "/Users/dgopstein/opt/src/gcc/gcc/testsuite/gcc.target/aarch64/aapcs64/abitest.h"))
-; (atom-finder.find-atom/define-in-contexts (translation-unit "/Users/dgopstein/opt/src/gcc/gcc/testsuite/gcc.c-torture/compile/limits-exprparen.c") expression-classifier)
-(atom-finder.find-atom/preprocessors-in-contexts define-only if-body-classifier (tu "/Users/dgopstein/opt/src/linux/drivers/scsi/hpsa.c"))
+(def ^:private running-jar
+    "Resolves the path to the current running jar file."
+  (-> :keyword class (.. getProtectionDomain getCodeSource getLocation getPath)))

-;(require '[clojure.contrib.repl-utils :as ru])
-                                        ;(map #(-> % .getClass .getSimpleName) (.getAllPreprocessorStatements (translation-unit (resource-path "define-in-if-loop.c"))))
-;(.getRawSignature (first (.getAllPreprocessorStatements (translation-unit (resource-path "define-in-if-loop.c")))))
-;(instance? org.eclipse.cdt.core.dom.ast.IASTPreprocessorMacroDefinition  (first (.getAllPreprocessorStatements (translation-unit (resource-path "define-in-if-loop.c")))))
-;(atom-finder.find-atom/macros-in-contexts (translation-unit (resource-path "union.c")))
-;(get-in-tree  (translation-unit (resource-path "union.c")) [0 0 0])
-
-(print-tree (translation-unit (resource-path "define-in-if-loop.c")))
+(defn list-resources [path]
+  (let [jar (java.util.jar.JarFile. path)
+        entries (.entries jar)]
+    (loop [result  []]
+      (if (.hasMoreElements entries)
+        (recur (conj result (.. entries nextElement getName)))
+                result))))

 (defn -main
   [& args]

-  ;(print-tree root)
-  ;;(get-in-tree root [0 2 1 0 1]) ;; "%d %d\n""
-  ;(.getLeadingSyntax (get-in-tree root [0 2 0 0 1 1 0 1]))
-  ;(fn-pow #(.getNext %) (.getTrailingSyntax (get-in-tree root [0 2 0 0 1 1 0 0])) 5)
-  ;(write (get-in-tree root [0 2 0 0 1 1 0 1]))
-  ;(.getExpansionLocation (nth (.getMacroDefinitions root) 0))
-  ;(.getNodeOffset (.getExpansionLocation (nth (.getMacroDefinitions root) 0)))
-  ;(.getNodeLength (.getExpansionLocation (nth (.getMacroDefinitions root) 0)))
-  ;(map #(.getNodeOffset %) (.getNodeLocations (get-in-tree root [0 2 0 0 1 1 0 ])))
-  ;(map #(.getNodeLength %) (.getNodeLocations (get-in-tree root [0 2 0 0 1 1 0 ])))
-  ;(map #(.getNodeLength %) (.getNodeLocations (get-in-tree root [0 2 0 0])))
-  ;(write (get-in-tree root [0 2 1 ]))
+  ;(def root (translation-unit (resource-path "if-starts-in-expression.c")))

-  ;(def nine+seven-node (get-in-tree root [0 2 0 0 1 1 0 ]))
-  ;(def printf-node (get-in-tree root [0 2 1 ]))
+  ;; the place where all test-files live
+  (def resource-dir (.getParent (java.io.File. (resource-path "define-in-if-loop.c"))))

+  (defn PRINTLN [s]
+    (println
+     "\n==============================================================="
+     s
+     "\n==============================================================="))

-  ;(contains-location? root 41 1)
-  ;(contains-location? nine+seven-node 41 1)
-  ;(contains-location? printf-node 41 1)
-  ;(write (location-parent root 41 1))
+  (PRINTLN "\nCount how many \"Preprocessor in Statement\" atoms are in the resource directory files")
+  (preprocessor-in-dir resource-dir)

+  (PRINTLN "\nPrint the AST of the file containing the atom")
+  (print-tree (translation-unit (resource-path "macro-in-expression.c")))

-  ;(doseq [ancestor (filter-depth 3 root)]
-  ;  (println (typename ancestor) (write ancestor) "\n-----------------\n"))
+  (PRINTLN "\nPrint the line of the atom in the file")
+  (println (atom-finder.find-atom/preprocessors-in-contexts define-only expression-classifier (tu (resource-path "macro-in-expression.c"))))

+  (System/exit 0)
   )


fix q15

fix q15

--- src/puzzule/q15.clj
+++ src/puzzule/q15.clj
@@ -15,4 +15,4 @@
              (reduce + (map (fn [move-pare] (apply #(move steps (+ a %1) (- b %2) cnt) move-pare))
                             (move-pares steps))))))

-(move steps 0 n 0)
+(def answer (move steps 0 n 0))


Declare exch and bind queue before starting work.

--- src/monocle/rabbitmq.clj
+++ src/monocle/rabbitmq.clj
@@ -66,6 +66,7 @@
   (with-rabbit [chan (assoc {:uri uri
                              :timeout 5000}
                        :ssl (:ssl opts))]
+    (bind-queue chan exch key key)
     (write-chan [chan exch key] reader batch)))

 (defn get-rabbitmq [[chan exch queue]]


unused channels removed

unused channels removed

--- Clojure-Websockets/MainApp/src/clj/birdwatch/communicator/component.clj
+++ Clojure-Websockets/MainApp/src/clj/birdwatch/communicator/component.clj
@@ -40,13 +40,11 @@
            :query-results (chan)
            :tweet-missing (chan)
            :missing-tweet-found (chan)
-           :persistence (chan)
-           :rt-persistence (chan)
            :tweet-count (chan)
            :register-perc (chan)
            :perc-matches (chan)))
   (stop [component] (log/info "Stop Communicator Channels Component")
-        (assoc component :query nil :query-results nil :tweet-missing nil :missing-tweet-found nil
-                         :persistence nil :rt-persistence nil :tweet-count nil)))
+        (assoc component :query nil :query-results nil :tweet-missing nil
+                         :missing-tweet-found nil :tweet-count nil)))

 (defn new-communicator-channels [] (map->Communicator-Channels {}))


Add docs for :present.

Add docs for :present.

--- src/quil/applet.clj
+++ src/quil/applet.clj
@@ -263,7 +263,7 @@
    :opts           - Short form for true\false options. Sets added parameters in true.
                      You can use supported parameters without :opts but :opts has a higher priority.
                      Example: :opts [:keep-on-top]
-                     Supported parameters: :keep-on-top, :exit-on-close, :resizable
+                     Supported parameters: :keep-on-top, :exit-on-close, :resizable, :present

    :keep-on-top    - Sets whether sketch window should always be above other windows.
                      Note: some platforms might not support always-on-top windows.
@@ -271,6 +271,8 @@
    :exit-on-close  - Sets behavior of JVM when sketch is closed.

    :resizable      - Sets whether sketch is resizable by the user.
+
+   :present        - Switch to sketch present mode (fullscreen without borders, OS panels).

    :setup          - a fn to be called once when setting the sketch up.


Better schema. Try to handle multiple aggregate vars.

--- src/aurora/language.cljs
+++ src/aurora/language.cljs
@@ -119,12 +119,10 @@
                  (dotimes [j (alength dirtied-rules)]
                    (aset rule->dirty? (aget dirtied-rules j) true)))))))))

-(deftype AggregateFlow [input-index output-kind output-name output-fields aggregate-function]
+(deftype AggregateFlow [prefix-len input-index output-kind output-name output-fields aggregate-function]
   Object
   (run [this kn rule->dirty? kind->name->rules]
-       (prn :input input-index)
-       (let [prefix-len (- (.-key-len input-index) 1)
-             current-key nil
+       (let [current-key nil
              inputs #js []
              output-facts&vals #js []]
          (.foreach input-index
@@ -189,9 +187,13 @@
         kind->name->rules (atom {})
         name->transient? (atom {})
         clauses (.keys (.get-or-create-index kn "know" "clauses" #js ["rule-id" "when|know|remember|forget" "clause-id" "name"]))
-        fields (.keys (.get-or-create-index kn "know" "clause-fields" #js ["clause-id" "constant|variable" "key" "val"]))
+        fields (.keys (.get-or-create-index kn "know" "clause-fields" #js ["clause-id" "constant|variable|aggregate" "key" "val"]))
+        aggregate-vars (.keys (.get-or-create-index kn "know" "clause-aggregate-vars" #js ["aggregate-id" "ix" "var"]))
+        aggregate-funs (.keys (.get-or-create-index kn "know" "clause-aggregate-funs" #js ["aggregate-id" "js"]))
         rule-id->clauses (atom (into {} (for [[k vs] (group-by #(nth % 0) clauses)] [k (set (map vec vs))])))
-        clause-id->fields (atom (into {} (for [[k vs] (group-by #(nth % 0) fields)] [k (set (map vec vs))])))]
+        clause-id->fields (atom (into {} (for [[k vs] (group-by #(nth % 0) fields)] [k (set (map vec vs))])))
+        aggregate-id->aggregate-vars (atom (into {} (for [[k vs] (group-by #(nth % 0) aggregate-vars)] [k (set (map vec vs))])))
+        aggregate-id->aggregate-funs (atom (into {} (for [[k vs] (group-by #(nth % 0) aggregate-funs)] [k (set (map vec vs))])))]

     ;; rewrite clauses
     (doseq [[rule-id clauses] @rule-id->clauses]
@@ -199,8 +201,7 @@
               :when (not (#{"=constant" "=variable" "=function" "filter"} name))]
         (let [fields (get @clause-id->fields clause-id)
               var->key (atom {})]
-          (doseq [[_ field-type key val] fields
-                  :when (not (#{"aggregate-variable" "aggregate-function"} key))]
+          (doseq [[_ field-type key val] fields]
             (if (= field-type "constant")
               ;; rewrite (foo 1) to (foo x) (constant= x 1)
               (let [new-var (new-id)
@@ -323,17 +324,23 @@
                   :when (not= clause-type "when")]
             (let [clause-fields (get @clause-id->fields clause-id)
                   fields (make-array num-vars)
-                  aggregate-variable (first (for [[_ field-type key val] clause-fields
-                                                  :when (= key "aggregate-variable")]
-                                              val))
-
-                  aggregate-function (first (for [[_ field-type key val] clause-fields
-                                                  :when (= key "aggregate-function")]
-                                              val))
-                  output-name (if (nil? aggregate-variable)
+                  aggregate-keys&ids (for [[_ field-type key val] clause-fields
+                                           :when (= field-type "aggregate")]
+                                       [key val])
+                  _ (assert (<= (count aggregate-keys&ids) 1)) ;; TODO handle multiple aggregates
+                  aggregate-key (first (first aggregate-keys&ids))
+                  aggregate-id (second (first aggregate-keys&ids))
+                  ix->aggregate-keys&vars (into (sorted-map)
+                                                (for [[_ ix var] (@aggregate-id->aggregate-vars aggregate-id)]
+                                                  [ix [(new-id) var]]))
+                  aggregate-funs (for [[_ js] (@aggregate-id->aggregate-funs aggregate-id)]
+                                   js)
+                  _ (assert (<= (count aggregate-funs) 1))
+                  aggregate-fun (first aggregate-funs)
+                  output-name (if (nil? aggregate-key)
                                 clause-name
                                 (str "aggregate-" rule-id))
-                  output-type (if (nil? aggregate-variable)
+                  output-type (if (nil? aggregate-key)
                                 clause-type
                                 "know")]

@@ -341,32 +348,43 @@
               (doseq [[_ field-type key val] clause-fields
                       :when (= field-type "variable")]
                 (aset fields (var->ix val) key))
+              (doseq [[ix [key var]] ix->aggregate-keys&vars]
+                (aset fields (var->ix var) key))
               (apush output-kinds output-type)
               (apush output-names output-name)
               (apush output-fields fields)

               ;; ensure indexes exist
-              (let [filtered-fields (into-array (filter #(not (or (nil? %) (= aggregate-variable %))) fields))
-                    ;; make sure aggregate-variable is last if it exists
-                    _ (when-not (nil? aggregate-variable)
-                        (apush filtered-fields aggregate-variable))
+              (let [filtered-fields (into-array (filter #(not (or (nil? %) (= aggregate-key %))) fields))
+                    ;; make sure aggregate-variables are last
+                    _ (when-not (nil? aggregate-key)
+                        (doseq [[ix [key var]] ix->aggregate-keys&vars]
+                          (apush filtered-fields key)))
+                    final-fields (make-array num-vars)
+                    _ (doseq [[_ field-type key val] clause-fields
+                              :when (= field-type "variable")]
+                        (aset final-fields (var->ix val) key))
+                    final-fields (into-array (filter #(not (nil? %)) final-fields))
+                    _ (when-not (nil? aggregate-key)
+                        (apush final-fields aggregate-key))
                     ;; TODO get transient? from schema instead
                     transient? (identical? clause-type "know")]
                 (assert (not= (not transient?) (get @name->transient? clause-name)) clause-name)
                 (swap! name->transient? assoc clause-name transient?)
                 (swap! kind->name->rules update-in [clause-type clause-name] #(or % #{}))
-                (.ensure-index kn "know" clause-name filtered-fields)
+                (.ensure-index kn "know" clause-name final-fields)
                 (when (false? transient?)
-                  (.ensure-index kn "forget" clause-name filtered-fields)
-                  (.ensure-index kn "remember" clause-name filtered-fields))
+                  (.ensure-index kn "forget" clause-name final-fields)
+                  (.ensure-index kn "remember" clause-name final-fields))

                 ;; create aggregate flow if needed
-                (when-not (nil? aggregate-variable)
+                (when-not (nil? aggregate-key)
                   (let [input-index (.get-or-create-index kn "know" output-name filtered-fields)
-                        aggregate-function (aget js/aurora.aggregates aggregate-function)]
+                        aggregate-function (js/eval aggregate-fun)
+                        prefix-len (- (count final-fields) 1)]
                     (swap! name->transient? assoc output-name true)
                     (swap! kind->name->rules update-in ["know" output-name] #(conj (or % #{}) output-name))
-                    (swap! rule->flow assoc output-name (AggregateFlow. input-index clause-type clause-name filtered-fields aggregate-function)))))))
+                    (swap! rule->flow assoc output-name (AggregateFlow. prefix-len input-index clause-type clause-name final-fields aggregate-function)))))))

           (swap! rule->flow assoc rule-id (SolverFlow. solver output-kinds output-names output-fields)))))

@@ -388,12 +406,16 @@

 (.get-or-create-index kn "know" "clauses" #js ["rule-id" "when|know|remember|forget" "clause-id" "name"])

-(.get-or-create-index kn "know" "clause-fields" #js ["clause-id" "constant|variable" "key" "val"])
+(.get-or-create-index kn "know" "clause-fields" #js ["clause-id" "constant|variable|aggregate" "key" "val"])
+
+(.get-or-create-index kn "know" "clause-aggregate-vars" #js ["aggregate-id" "ix" "var"])
+
+(.get-or-create-index kn "know" "clause-aggregate-funs" #js ["aggregate-id" "js"])

 (.add-facts kn "know" "clauses" #js ["rule-id" "when|know|remember|forget" "clause-id" "name"] #js [#js ["single-edge" "when" "get-edges" "edge"]
                                                                                #js ["single-edge" "know" "output-connected" "connected"]])

-(.add-facts kn "know" "clause-fields" #js ["clause-id" "constant|variable" "key" "val"] #js [#js ["get-edges" "variable" "x" "xx"]
+(.add-facts kn "know" "clause-fields" #js ["clause-id" "constant|variable|aggregate" "key" "val"] #js [#js ["get-edges" "variable" "x" "xx"]
                                                                                #js ["get-edges" "variable" "y" "yy"]
                                                                                #js ["output-connected" "variable" "x" "xx"]
                                                                                #js ["output-connected" "variable" "y" "yy"]])
@@ -402,7 +424,7 @@
                                                                                #js ["transitive-edge" "when" "get-right-connected" "connected"]
                                                                                #js ["transitive-edge" "know" "output-transitive-connected" "connected"]])

-(.add-facts kn "know" "clause-fields" #js ["clause-id" "constant|variable" "key" "val"] #js [#js ["get-left-edge" "variable" "x" "xx"]
+(.add-facts kn "know" "clause-fields" #js ["clause-id" "constant|variable|aggregate" "key" "val"] #js [#js ["get-left-edge" "variable" "x" "xx"]
                                                                                #js ["get-left-edge" "variable" "y" "yy"]
                                                                                #js ["get-right-connected" "variable" "x" "yy"]
                                                                                #js ["get-right-connected" "variable" "y" "zz"]
@@ -414,7 +436,7 @@
                                                                                #js ["function-edge" "when" "make-str" "=function"]
                                                                                #js ["function-edge" "remember" "know-str" "str-edge"]])

-(.add-facts kn "know" "clause-fields" #js ["clause-id" "constant|variable" "key" "val"] #js [#js ["get-function-edge" "variable" "x" "xx"]
+(.add-facts kn "know" "clause-fields" #js ["clause-id" "constant|variable|aggregate" "key" "val"] #js [#js ["get-function-edge" "variable" "x" "xx"]
                                                                                #js ["get-function-edge" "variable" "y" "yy"]
                                                                                #js ["filter-edge" "constant" "js" "xx == \"a\""]
                                                                                #js ["make-str" "variable" "variable" "zz"]
@@ -425,7 +447,7 @@
                                                                                #js ["-function-edge" "when" "-make-str" "=function"]
                                                                                #js ["-function-edge" "forget" "-know-str" "str-edge"]])

-(.add-facts kn "know" "clause-fields" #js ["clause-id" "constant|variable" "key" "val"] #js [#js ["-get-function-edge" "variable" "x" "xx"]
+(.add-facts kn "know" "clause-fields" #js ["clause-id" "constant|variable|aggregate" "key" "val"] #js [#js ["-get-function-edge" "variable" "x" "xx"]
                                                                                #js ["-get-function-edge" "variable" "y" "yy"]
                                                                                #js ["-make-str" "variable" "variable" "zz"]
                                                                                #js ["-make-str" "constant" "js" "\"edge \" + xx + \" \" + yy"]
@@ -441,7 +463,7 @@
                                                                                #js ["overlap" "when" "some-interval" "interval"]
                                                                                #js ["overlap" "remember" "rem-bar" "bar"]])

-(.add-facts kn "know" "clause-fields" #js ["clause-id" "constant|variable" "key" "val"] #js [#js ["get-foos" "variable" "x" "xx"]
+(.add-facts kn "know" "clause-fields" #js ["clause-id" "constant|variable|aggregate" "key" "val"] #js [#js ["get-foos" "variable" "x" "xx"]
                                                                                #js ["get-foos" "variable" "y" "yy"]
                                                                                #js ["some-interval" "variable" "lo" "xx"]
                                                                                #js ["some-interval" "variable" "hi" "yy"]
@@ -452,16 +474,18 @@
                                                                                #js ["count-overlap" "when" "some-more-interval" "interval"]
                                                                                #js ["count-overlap" "remember" "rem-quux" "quux"]])

-(.add-facts kn "know" "clause-fields" #js ["clause-id" "constant|variable" "key" "val"] #js [#js ["get-more-foos" "variable" "x" "xx"]
+(.add-facts kn "know" "clause-fields" #js ["clause-id" "constant|variable|aggregate" "key" "val"] #js [#js ["get-more-foos" "variable" "x" "xx"]
                                                                                #js ["get-more-foos" "variable" "y" "yy"]
                                                                                #js ["some-more-interval" "variable" "lo" "xx"]
                                                                                #js ["some-more-interval" "variable" "hi" "yy"]
                                                                                #js ["some-more-interval" "variable" "in" "zz"]
                                                                                #js ["rem-quux" "variable" "x" "xx"]
                                                                                #js ["rem-quux" "variable" "y" "yy"]
-                                                                                #js ["rem-quux" "variable" "z" "zz"]
-                                                                                #js ["rem-quux" "constant" "aggregate-variable" "z"]
-                                                                                #js ["rem-quux" "constant" "aggregate-function" "count"]])
+                                                                                #js ["rem-quux" "aggregate" "z" "count-zz"]])
+
+(.add-facts kn "know" "clause-aggregate-vars" #js ["aggregate-id" "ix" "var"] #js [#js ["count-zz" 0 "zz"]])
+
+(.add-facts kn "know" "clause-aggregate-funs" #js ["aggregate-id" "js"] #js [#js ["count-zz" "cljs.core.count"]])

 (def flows (compile kn))


Bugfix: prevent infinite recursion in gensym

Because clojure.core/gensym is bound to oxcart.core/gensym, oxcart.core/gensym
would recursively call itself until it kills the JVM. This patch grabs the root
of the clojure.core/gensym var so that calling the "reference" gensym is still
possible despite bindings.

--- src/oxcart/core.clj
+++ src/oxcart/core.clj
@@ -30,6 +30,9 @@
 (def root-directory
   @#'clojure.core/root-directory)

+(def clojure-gensym
+  @#'clojure.core/gensym)
+

 (def ^:dynamic *load-configuration*
   "Dynamic var that oxcart/load uses to stash its configuration.
@@ -61,7 +64,7 @@

   ([x]
      (with-meta
-       (clojure.core/gensym x)
+       (clojure-gensym x)
        {:gensym true})))


fix test

fix test

--- test/com/rpl/specter/core_test.cljc
+++ test/com/rpl/specter/core_test.cljc
@@ -169,8 +169,8 @@
                   k1))
     pred (gen/elements [inc dec])]
    (let [m2 (s/transform [k1 k2] pred m1)]
-     (= (assoc-in m1 [k1 k2] nil) (assoc-in m2 [k1 k2] nil))
-     (= (pred (get-in m1 [k1 k2])) (get-in m2 [k1 k2]))
+     (and (= (assoc-in m1 [k1 k2] nil) (assoc-in m2 [k1 k2] nil))
+          (= (pred (get-in m1 [k1 k2])) (get-in m2 [k1 k2])))
      )))

 (defspec replace-in-test


handle common headers

handle common headers

--- src/rester/core.clj
+++ src/rester/core.clj
@@ -245,7 +245,7 @@
                                      (or (get exp-headers "Content-Type") "")))]
       (-> test (update :url replace-opts opts)
           (update :headers str->map #":" opts false)
-          (update :headers merge (:common-headers options))
+          (update :headers merge (options "commonHeaders"))
           (update :params str->map  [#"&|(\s*,\s*)" #"\s*=\s*"] opts true)
           (update :payload #(-> % (replace-opts opts)
                                 ((if (:dont_parse_payload options) identity json->clj))))
@@ -404,13 +404,12 @@
 (defn- to-opts [args]
   (->> args
        (partition 2)
-       (reduce (fn [[result [k v]]]
+       (reduce (fn [result [k v]]
                  (let [k (if-not (.startsWith k ":")
                            (do (log/warn "argument key expected to start with :" k) k)
                            (subs k 1))]
-                   (if (.startsWith k "headers.")
-                     (update result :common-headers assoc (str/replace-first "headers." "") v)
-                     (assoc result k v)))) {})))
+                   (assoc result k v))) {})
+       ((fn[m] (update m "commonHeaders" str->map #"=")))))

 (defn run-tests [args]
   (let [pool-size (Integer/parseInt (or (System/getProperty "thread-pool-size") "4"))]


result list contains all data

result list contains all data

--- src/ontrail/exercise.clj
+++ src/ontrail/exercise.clj
@@ -31,32 +31,34 @@
         (str (subs stripped 0 truncated-len))
         stripped))))

-(defn as-ex-result [result]
-  (let [pace (get-pace {:duration (:duration result)
-                        :distance (:distance result)
-                        :sport (:sport result)})
-        duration (to-human-time (:duration result))
-        distance (to-human-distance (:distance result))
-        truncated-body (strip-and-truncate (:body result))
-        _id (:_id result)
-        sport (:sport result)
-        user (:user result)
+(defn as-ex-result [exercise]
+  (let [id (str (:_id exercise))
+        user (:user exercise)
+        user-profile (:profile (mc/find-one-as-map ONUSER {:username user}))
+        heart-rate-reserve (get-heart-rate-reserve exercise user-profile)
+        comments (:comments exercise)
+        distance (to-human-distance (:distance exercise))
+        comment-count (if-not (nil? comments) (count comments) 0)
         avatar (get-avatar-url user)
-        comments (:comments result)
-        comment-count (if-not (nil? comments) (count comments) 0)
-        date (to-human-date (:creationDate result))]
-    {:pace pace
-     :title (:title result)
-     :duration duration
+        date (to-human-date (:creationDate exercise))]
+    (.debug logger (format " get ex=%s" id))
+    {:id id
+     :user user
      :distance distance
-     :body truncated-body
-     :did (get-verb sport)
-     :sport sport
-     :user user
+     :title (:title exercise)
+     :body (:body exercise)
+     :tags (:tags exercise)
+     :did (get-verb (:sport exercise))
+     :sport (:sport exercise)
      :avatar avatar
-     :id (str _id)
      :date date
-     :commentCount comment-count}))
+     :duration (to-human-time (:duration exercise))
+     :creationDate (to-human-date (:creationDate exercise))
+     :avghr (:avghr exercise)
+     :hrReserve heart-rate-reserve
+     :pace (get-pace exercise)
+     :commentCount comment-count
+     :comments comments}))

 (defn as-ex-result-list [results]
   (map as-ex-result results))


fixed and cleaned short term analysis tests

--- test/forma/trends/analysis_test.clj
+++ test/forma/trends/analysis_test.clj
@@ -131,15 +131,15 @@
  271: last period in test time series"
  (count (telescoping-long-trend 23 100 271 ndvi reli rain)) => 172
  (count (first (telescoping-long-trend 23 100 271 ndvi reli rain))) => 3
- (count (telescoping-short-trend 30 10 23 100 110 ndvi reli))  => 11
- (last  (telescoping-short-trend 30 10 23 100 110 ndvi reli))  => (roughly -63.2393))
+ (count (telescoping-short-trend 30 10 23 100 271 ndvi reli))  => 172
+ (last  (telescoping-short-trend 30 10 23 100 271 ndvi reli))  => (roughly -89.45618))

 (fact
  "test that the magnitude of the short-term drop of the
  transformed (shifted down) time series is higher than that of the
  original time series"
- (let [s-drop (telescoping-short-trend 30 10 23 138 (count ndvi) ndvi reli)
-       big-drop (telescoping-short-trend 30 10 23 138 (count ndvi) (shift-down-end ndvi) reli)]
+ (let [s-drop (telescoping-short-trend 30 10 23 138 271 ndvi reli)
+       big-drop (telescoping-short-trend 30 10 23 138 271 (shift-down-end ndvi) reli)]
    (- (abs (reduce min big-drop)) (abs (reduce min s-drop))) => pos?))

 ;; Benchmark
@@ -182,7 +182,6 @@
           (transpose
            (telescoping-long-trend 23 start end ndvi-ts reli-ts rain-ts))))))

-<<<<<<< HEAD
 (defn short-trend-results
   "returns three vectors, the first with the hansen statistic for time
   series ranging from 0 through 135 (end of training period) and 136;
@@ -192,63 +191,37 @@
   in there anyway to ensure forward compatibility"
   [m]
   (let [start 135
+        end 136
         [ndvi-ts reli-ts] ((juxt :ndvi :reli) m)]
-    (schema/timeseries-value start (count ndvi-ts)
-     (telescoping-short-trend 30 10 23 start ndvi-ts reli-ts))))
-
-(def long-trend-query
-  (<- [?han-stat ?long-drop ?long-tstat]
-      (ts-tap ?ts-map)
-      (long-trend-results ?ts-map :> ?han-stat ?long-drop ?long-tstat)
-      (:distinct false)))
-
-(def short-trend-query
-  (?<- (stdout) [?min-drop]
-      (ts-tap ?ts-map)
-      (short-trend-results ?ts-map :> ?min-drop)
-      (:distinct false)))
-
-(fact
- "duplicate time series will produce two sets of identical results, given that :distinct is set to false; otherwise, results would "
- long-trend-query =>
- (produces-some [[{:start-idx 135
-                   :end-idx 136
-                   :series [1.2393550741169639 1.2133709085855648]}
-                  {:start-idx 135
-                   :end-idx 136
-                   :series [2.4915869043482424 1.3049908881259853]}
-                  {:start-idx 135
-                   :end-idx 136
-                   :series [1.1504228201940752 0.5951173333726173]}]]))
-=======
+    (schema/timeseries-value start end
+     (telescoping-short-trend 30 10 23 start end ndvi-ts reli-ts))))
+
 (deftest long-trends-test
-  (fact
-    "duplicate time series will produce two sets of identical results, given that :distinct is set to false; otherwise, results would "
-    (let [long-trend-query (<- [?han-stat ?long-drop ?long-tstat]
-                               (ts-tap ?ts-map)
-                               (long-trend-results ?ts-map :> ?han-stat ?long-drop ?long-tstat)
-                               (:distinct false))]
-      long-trend-query =>
-      (produces-some [[{:start-idx 135
-                        :end-idx 136
-                        :series [1.2393550741169639 1.2133709085855648]}
-                       {:start-idx 135
-                        :end-idx 136
-                        :series [2.4915869043482424 1.3049908881259853]}
-                       {:start-idx 135
-                        :end-idx 136
-                        :series [1.1504228201940752 0.5951173333726173]}]]))))
-
-;; (defn telescoping-short-trend
-;;   "returns a vector of the short-term trend coefficients over time
-;;   series blocks of length `long-block`, smoothed by moving average
-;;   window of length `short-block`.  The coefficients are calculated
-;;   along the entire time-series, but only apply to periods at and after
-;;   the end of the training period."
-;;   [long-block short-block freq training-end spectral-ts reli-ts]
-;;   (let [leading-buffer (+ 2 (- training-end (+ long-block short-block)))]
-;;     (->> (windowed-trend long-block freq spectral-ts reli-ts)
-;;          (utils/moving-average short-block)
-;;          (reductions min)
-;;          (drop (dec leading-buffer)))))
->>>>>>> cf4b45156cf92b9a7b32a8590e367eadfd707a5c
+  (facts
+   "check that the long- and short-term statistics match the expected
+values of the test data vectors."
+   (let [long-trend-query
+         (<- [?han-stat ?long-drop ?long-tstat]
+             (ts-tap ?ts-map)
+             (long-trend-results ?ts-map :> ?han-stat ?long-drop ?long-tstat)
+             (:distinct false))
+         short-trend-query
+         (<- [?min-drop]
+             (ts-tap ?ts-map)
+             (short-trend-results ?ts-map :> ?min-drop)
+             (:distinct false))]
+     long-trend-query =>
+     (produces-some [[{:start-idx 135
+                       :end-idx 136
+                       :series [1.2393550741169639 1.2133709085855648]}
+                      {:start-idx 135
+                       :end-idx 136
+                       :series [2.4915869043482424 1.3049908881259853]}
+                      {:start-idx 135
+                       :end-idx 136
+                       :series [1.1504228201940752 0.5951173333726173]}]])
+     short-trend-query =>
+     (produces-some [[{:start-idx 135
+                       :end-idx 136
+                       :series [-63.23936661263988 -63.23936661263988]}]]))))
+


adding ES launching

adding ES launching

--- src/celestial/launch.clj
+++ src/celestial/launch.clj
@@ -27,6 +27,7 @@
     [celestial.redis :only (clear-locks)]
     [taoensso.timbre :only (set-config! set-level!)])
   (:require
+    [es.node :as es]
     [celestial.persistency.migrations :as mg]
     [hypervisors.networking :refer [initialize-networking]]
     [celestial.jobs :as jobs]))
@@ -44,11 +45,13 @@
     (set-config! [:appenders :spit :enabled?] true)
     (set-level! (log* :level))))

-(defn clean-up []
+(defn clean-up
+  "Clean/release resources, used also as a shutdown hook"
+  []
   (debug "Shutting down...")
-  (jobs/shutdown-workers)
-  (jobs/clear-all)
-  (clear-locks))
+  (jobs/clean-shutdown)
+  (clear-locks)
+  (es/stop))

 (defn add-shutdown []
   (.addShutdownHook (Runtime/getRuntime) (Thread. clean-up)))
@@ -66,6 +69,7 @@
     (generate-store (cert-conf :keystore) (cert-conf :password))))

 (defn start-nrepl
+  "Starts nrepl if enabled"
   []
   (when-let [port (get* :celestial :nrepl :port)]
     (info (<< "starting nrepl on port ~{port}"))
@@ -74,7 +78,7 @@
 (def jetty (atom nil))

 (defn setup
-  "one time setup"
+  "One time setup"
   []
   (initialize-networking)
   (setup-logging)
@@ -91,7 +95,7 @@
       :ssl-port (get! :celestial :https-port)}))

 (defn start
-  "main componenets startup (jetty, job workers etc..)"
+  "Main componenets startup (jetty, job workers etc..)"
   [jetty]
   (jobs/initialize-workers)
   (info (slurp (resource "main/resources/celestial.txt")))


Fixup invalid if in adapters.init

Fixup invalid if in adapters.init

--- src/yetibot/core/adapters/init.clj
+++ src/yetibot/core/adapters/init.clj
@@ -27,7 +27,6 @@
   (let [c (get-config adapters-schema [:yetibot :adapters])]
     (if (:error c)
       (throw (ex-info "Invalid adapters config" c))
-      (warn c)
       (:value c))))

 (defn report-ex [f n]


use ensure-connected! for conciseness

use ensure-connected! for conciseness

--- src/overtone/sc/info.clj
+++ src/overtone/sc/info.clj
@@ -39,8 +39,7 @@
   of the static values in this info map. Note, the number of running synths
   will also include the synth used to obtain this information."
   []
-  (when (server-disconnected?)
-    (throw (Exception. "Please connect to a server before attempting to ask for server-info.")))
+  (ensure-connected!)
   (let [prom        (promise)
         response-id (next-id :response-id)]
     (on-event


Fix documentation typo

Fix documentation typo

--- src/overtone/sc/node.clj
+++ src/overtone/sc/node.clj
@@ -394,8 +394,8 @@
 ;; SCLang (as opposed to from the command line) there will also be a 'default
 ;; group' with an ID of 1 which is the default target for all new Nodes. See
 ;; RootNode and default_group for more info.
-;; A ParGroup is behaves similarly to a group and has the same interface, but
-;; will allow parallel audio processing for nodes within it when run in the
+;; A ParGroup behaves similarly to a group and has the same interface, but
+;; will allow parallel audio processing for nodes within it when run on the
 ;; Supernova synthesis server.

@@ -727,33 +727,33 @@
   {:kill* node-free*})

-;;/g_queryTree				get a representation of this group's node subtree.
-;;	[
-;;		int - group ID
-;;		int - flag: if not 0 the current control (arg) values for synths will be included
-;;	] * N
+;;/g_queryTree        get a representation of this group's node subtree.
+;;  [
+;;    int - group ID
+;;    int - flag: if not 0 the current control (arg) values for synths will be included
+;;  ] * N
 ;;
 ;; Request a representation of this group's node subtree, i.e. all the groups and
 ;; synths contained within it. Replies to the sender with a /g_queryTree.reply
 ;; message listing all of the nodes contained within the group in the following
 ;; format:
 ;;
-;;	int - flag: if synth control values are included 1, else 0
-;;	int - node ID of the requested group
-;;	int - number of child nodes contained within the requested group
-;;	then for each node in the subtree:
-;;	[
-;;		int - node ID
-;;		int - number of child nodes contained within this node. If -1this is a synth, if >=0 it's a group
-;;		then, if this node is a synth:
-;;		symbol - the SynthDef name for this node.
-;;		then, if flag (see above) is true:
-;;		int - numControls for this synth (M)
-;;		[
-;;			symbol or int: control name or index
-;;			float or symbol: value or control bus mapping symbol (e.g. 'c1')
-;;		] * M
-;;	] * the number of nodes in the subtree
+;;  int - flag: if synth control values are included 1, else 0
+;;  int - node ID of the requested group
+;;  int - number of child nodes contained within the requested group
+;;  then for each node in the subtree:
+;;  [
+;;    int - node ID
+;;    int - number of child nodes contained within this node. If -1this is a synth, if >=0 it's a group
+;;    then, if this node is a synth:
+;;    symbol - the SynthDef name for this node.
+;;    then, if flag (see above) is true:
+;;    int - numControls for this synth (M)
+;;    [
+;;      symbol or int: control name or index
+;;      float or symbol: value or control bus mapping symbol (e.g. 'c1')
+;;    ] * M
+;;  ] * the number of nodes in the subtree

 (defonce ^{:dynamic true} *node-tree-data* nil)


update seed with a second group

update seed with a second group

--- src/chat/server/seed.clj
+++ src/chat/server/seed.clj
@@ -11,6 +11,7 @@
 (defn seed! []
   (db/with-conn
     (let [group-1 (db/create-group! {:id (db/uuid) :name "Braid"})
+          group-2 (db/create-group! {:id (db/uuid) :name "Chat"})
           user-1 (db/create-user! {:id (db/uuid)
                                    :email "foo@example.com"
                                    :nickname "foo"
@@ -23,6 +24,8 @@
                                    :avatar ""})
           _ (db/user-add-to-group! (user-1 :id) (group-1 :id))
           _ (db/user-add-to-group! (user-2 :id) (group-1 :id))
+          _ (db/user-add-to-group! (user-1 :id) (group-2 :id))
+          _ (db/user-add-to-group! (user-2 :id) (group-2 :id))

           tag-1 (db/create-tag! {:id (db/uuid) :group-id (group-1 :id) :name "braid"})
           tag-2 (db/create-tag! {:id (db/uuid) :group-id (group-1 :id) :name "watercooler"})
@@ -53,6 +56,23 @@
                                  :thread-id (msg :thread-id)
                                  :user-id (user-2 :id)
                                  :created-at (java.util.Date.)
-                                 :content "Yep"})]
+                                 :content "Yep"})
+
+          tag-3 (db/create-tag! {:id (db/uuid) :group-id (group-2 :id) :name "abcde"})
+
+          _ (db/user-subscribe-to-tag! (user-1 :id) (tag-3 :id))
+          _ (db/user-subscribe-to-tag! (user-2 :id) (tag-3 :id))
+
+          msg (db/create-message! {:id (db/uuid)
+                                   :user-id (user-1 :id)
+                                   :thread-id (db/uuid)
+                                   :created-at (java.util.Date.)
+                                   :content "Hello?"
+                                   :mentioned-tag-ids [(tag-3 :id)]})
+          _ (db/create-message! {:id (db/uuid)
+                                 :thread-id (msg :thread-id)
+                                 :user-id (user-2 :id)
+                                 :created-at (java.util.Date.)
+                                 :content "Hi!"})]
       (println "users" user-1 user-2)
       (println "tags" tag-2 tag-2))))


Limit docstring width to 80 chars

Limit docstring width to 80 chars

--- src/overtone/sc/ugen.clj
+++ src/overtone/sc/ugen.clj
@@ -37,8 +37,8 @@
   (.replaceAll (.toLowerCase (str n)) "[-|_]" ""))

 (defn overtone-ugen-name
-  "A basic camelCase to with-dash name converter tuned to convert SuperCollider names to Overtone names.
-  Most likely needs improvement."
+  "A basic camelCase to with-dash name converter tuned to convert SuperCollider
+  names to Overtone names. Most likely needs improvement."
   [n]
   (let [n (.replaceAll n "([a-z])([A-Z])" "$1-$2")
         n (.replaceAll n "([A-Z])([A-Z][a-z])" "$1-$2")
@@ -106,8 +106,8 @@
   * (env-gen:ar ...)
   * (env-gen:kr ...)

-  UGens will also have a base-name without a rate suffix that uses the default rate
-  for that ugen:
+  UGens will also have a base-name without a rate suffix that uses the default
+  rate for that ugen:
   * (env-gen ...)   ;; Uses :kr, control rate for EnvGen

   The default rate is determined by the rate precedence:
@@ -147,7 +147,9 @@
     (assoc ugen :args mapped-args)))

 (defn- append-seq-args
-  "Handles argument modes :append-sequence and :append-sequence-set-num-outs, where some ugens take a seq for one argument which needs to be appended to the end of the argument list when sent to SC."
+  "Handles argument modes :append-sequence and :append-sequence-set-num-outs,
+  where some ugens take a seq for one argument which needs to be appended to the
+  end of the argument list when sent to SC."
   [spec ugen]
   (let [args-specs     (args-with-specs (:args ugen) spec :mode)
         pred          #(or (= :append-sequence (second %))
@@ -185,13 +187,13 @@
   (assoc ugen :args (floatify (:args ugen))))

 (defn- with-init-fn
-  "Creates the final argument initialization function which is applied to arguments
-  at runtime to do things like re-ordering and automatic filling in of arguments.
-  Typically appending input arrays as the last argument and filling in the number of
-  in or out channels for those ugens that need it.
-
-  If an init function is already present it will get called after doing the mapping and
-  mode transformations."
+  "Creates the final argument initialization function which is applied to
+  arguments at runtime to do things like re-ordering and automatic filling in
+  of arguments. Typically appending input arrays as the last argument and
+  filling in the number of in or out channels for those ugens that need it.
+
+  If an init function is already present it will get called after doing the
+  mapping and mode transformations."
   [spec]
   (let [defaulter (partial add-default-args spec)
         mapper    (partial map-ugen-args spec)
@@ -316,7 +318,8 @@
       (take greatest-count (parallel-seqs seqs)))))

 (defn make-expanding
-  "Takes a function and returns a multi-channel-expanding version of the function."
+  "Takes a function and returns a multi-channel-expanding version of the
+  function."
   [f expand-flags]
   (fn [& args]
     (let [expanded (mapply f (multichannel-expand expand-flags args))]
@@ -337,7 +340,7 @@
 (defrecord ControlProxy [name value rate])
 (derive ControlProxy ::ugen)

-(defn control-proxy
+(defn control-proxy
   [name value]
   (ControlProxy. name value (:kr RATES)))

@@ -378,13 +381,15 @@
     (ugen spec rate special args)))

 (defn- make-buffer-id
-  "Returns a function that converts any buffer arguments to their :id property value."
+  "Returns a function that converts any buffer arguments to their :id property
+  value."
   [fun]
   (fn [& args]
     (apply fun (map #(if (buffer? %) (:id %) %) args))))

 (defn- make-ugen-fn
-  "Returns a function representing the given ugen that will fill in default arguments, rates, etc."
+  "Returns a function representing the given ugen that will fill in default
+  arguments, rates, etc."
   [spec rate special]
   (let [expand-flags (map #(:expands? %) (:args spec))]
     (make-buffer-id
@@ -422,7 +427,8 @@
 (defn- def-ugen
   "Create and intern a set of functions for a given ugen-spec.
     * base name function using default rate and no suffix (e.g. env-gen )
-    * base-name plus rate suffix functions for each rate (e.g. env-gen:ar, env-gen:kr)
+    * base-name plus rate suffix functions for each rate (e.g. env-gen:ar,
+      env-gen:kr)
   "
   [to-ns spec special]
   (let [metadata {:doc (:full-doc spec)
@@ -480,8 +486,8 @@
 (load "ugen/generic_ops")

 (defn intern-ugens
-  "Iterate over all UGen meta-data, generate the corresponding functions and intern them
-  in the current or otherwise specified namespace."
+  "Iterate over all UGen meta-data, generate the corresponding functions and
+  intern them in the current or otherwise specified namespace."
   [& [to-ns]]
   (let [to-ns (or to-ns *ns*)]
     (doseq [ugen (filter #(not (or (= "UnaryOpUGen" (:name %))


Fix broken tests that were causing the build to fail

--- umm-spec-lib/src/cmr/umm_spec/xml_to_umm_mappings/echo10/data_contact.clj
+++ umm-spec-lib/src/cmr/umm_spec/xml_to_umm_mappings/echo10/data_contact.clj
@@ -49,6 +49,11 @@

 (def default-contact-person-role
   "Technical Contact")
+
+(defn- truncate-short-name?
+  "Return true if ShortName is greater and 85 characters and should be truncated"
+  [short-name]
+  (> (count short-name) u/SHORTNAME_MAX))

 (defn- parse-contact-mechanisms
   "Parse ECHO10 contact mechanisms to UMM."
@@ -125,7 +130,7 @@
     (for [contact contacts]
       (let [organization-name (u/with-default (value-of contact "OrganizationName") sanitize?)
             short-name (u/truncate-with-default organization-name u/SHORTNAME_MAX sanitize?)
-            long-name (when sanitize? organization-name)]
+            long-name (when (and sanitize? (truncate-short-name? organization-name)) organization-name)]
        {:Roles (remove nil? (u/map-with-default echo10-contact-role->umm-data-center-role
                                                [(value-of contact "Role")]
                                                default-data-center-role
@@ -153,7 +158,7 @@
   [doc data-centers center-name center-role sanitize?]
   (let [center (value-of doc (str "/Collection/" center-name))
         short-name (u/truncate-with-default center u/SHORTNAME_MAX sanitize?)
-        long-name (when sanitize? center)]
+        long-name (when (and sanitize? (truncate-short-name? center)) center)]
     (if center
       ;; Check to see if we already have an entry for this data center - the role and short name
       ;; match. If so, don't create a new record.


If output-to is :print if compiler redirects output. In that case set sourceMappingURL to source-map to avoid trying to open file :print.

Also update source map to use //# (new format) instead of //@ (old format).

--- src/clj/cljs/closure.clj
+++ src/clj/cljs/closure.clj
@@ -939,7 +939,9 @@

 (defn add-source-map-link [{:keys [source-map output-to] :as opts} js]
   (if source-map
-    (str js "\n//@ sourceMappingURL=" (path-relative-to (io/file output-to) {:url source-map}))
+      (if (= output-to :print)
+        (str js "\n//# sourceMappingURL=" source-map)
+        (str js "\n//# sourceMappingURL=" (path-relative-to (io/file output-to) {:url source-map})))
     js))

 (defn build


open browser of app

open browser of app

--- src/clj/dbquery/core.clj
+++ src/clj/dbquery/core.clj
@@ -1,31 +1,30 @@
 (ns dbquery.core
   (:gen-class)
-  (:import [java.util Date]
-           [java.text SimpleDateFormat]
-           [java.io FileReader])
-  (:require [compojure.core :refer :all]
+  (:require [cheshire.generate :refer [add-encoder]]
+            [clojure.core.cache :as cache]
+            [clojure.data.csv :as csv]
+            [clojure.java.io :as io]
+            [clojure.tools.logging :as log]
+            [compojure.core :refer :all]
             [compojure.route :as route]
-            ;; [compojure.handler :refer [site]]
+            [crypto.password.bcrypt :as password]
+            [dbquery.databases :as db :refer :all]
+            [dbquery.model :refer :all]
+            [dbquery.utils :refer :all]
+            [korma.core :as k]
+            [liberator.core :refer [defresource]]
+            [liberator.dev :refer [wrap-trace]]
+            [org.httpkit.server :refer [run-server]]
+            [ring.middleware.defaults :refer :all]
             [ring.middleware.json :refer :all]
-            [ring.util.response :refer [response redirect]]
-            [ring.middleware.defaults :refer :all]
+            [ring.middleware.multipart-params :as mp]
             [ring.middleware.reload :as reload]
-            [ring.middleware.multipart-params :as mp]
-            [org.httpkit.server :refer [run-server]]
-            [dbquery.databases :refer :all]
-            [dbquery.utils :refer :all]
-            [clojure.java.io :as io]
-            [clojure.string :as s]
-            [korma.core :as k]
-            [dbquery.model :refer :all]
-            [clojure.core.cache :as cache]
-            [liberator.core :refer [defresource resource]]
-            [liberator.dev :refer [wrap-trace]]
-            [clojure.tools.logging :as log]
-            [clojure.data.csv :as csv]
-            [cheshire.generate :refer [add-encoder]]
-            [crypto.password.bcrypt :as password]
-            [dbquery.databases :as db]))
+            [ring.util.response :refer [redirect]])
+  (:import java.awt.Desktop
+           java.io.FileReader
+           java.net.URI
+           java.text.SimpleDateFormat
+           java.util.Date))

 ;; custom json encoder for dates
 (defn- date-time-encoder [fmt]
@@ -40,7 +39,10 @@
   (add-encoder java.sql.Date (date-time-encoder "dd/MM/yyyy"))
   (add-encoder java.sql.Timestamp (date-time-encoder "dd/MM/yyyy HH:mm:ss"))
   (add-encoder java.sql.RowId #(.writeString %2 %1))
-  (add-encoder (Class/forName "oracle.sql.ROWID") #(.writeString %2 (.stringValue %1))))
+  (try
+    (add-encoder (Class/forName "oracle.sql.ROWID") #(.writeString %2 (.stringValue %1)))
+    (catch Exception e
+      (log/warn "failed registering encoder for oracle.sql.ROWID. Add Oracle JDBC driver to the classpath if using Oracle DB"))))

 (def ds-cache (atom (cache/lru-cache-factory {})))

@@ -289,4 +291,10 @@
     (sync-db "dev")
     (add-encoders)
     (run-server (reload/wrap-reload #'all-routes)
-                {:port (Integer/parseInt port) :thread 50})))
+                {:port (Integer/parseInt port) :thread 50})
+    (if (Desktop/isDesktopSupported)
+      (try
+        (doto (Desktop/getDesktop)
+          (.browse (URI. (str "http://localhost:" port))))
+        (catch Exception e
+          (log/warn "failed to open browser" e))))))


[core] if raw datum input is OOB then trim it to bounds and insert

--- src/clj_dstream/core.clj
+++ src/clj_dstream/core.clj
@@ -97,9 +97,15 @@
     position-value
     (map-indexed (fn [idx position-val]
                    (let [{:keys [::domain-start ::domain-end ::domain-interval]} (get phase-space idx)]
-                     (if (or (> position-val domain-end)
+                     (when-not (or (> position-val domain-end)
                              (< position-val domain-start))
-                       (throw
+                       (do
+                         ;;TODO what do here?
+                         ;; do throw exception,
+                         ;; conform data into range (creating hotspots on edge?),
+                         ;; or just ignore the datum?
+                           (max domain-start (min domain-end position-val)))
+                       #_(throw
                          (ex-info
                            "Raw data value outside range" {:keys idx
                                                            :data {:value  position-val


add delayed balancing to import

add delayed balancing to import

--- src/clj_money/import.clj
+++ src/clj_money/import.clj
@@ -10,6 +10,7 @@
             [clj-money.models.accounts :as accounts]
             [clj-money.models.budgets :as budgets]
             [clj-money.models.transactions :as transactions]
+            [clj-money.import.gnucash]
             [clj-money.models.helpers :refer [with-transacted-storage]]))

 (defmulti read-source
@@ -103,5 +104,6 @@
                                  (swap! context #(import-budget % budget)))
                                (fn [transaction]
                                  (swap! context #(import-transaction % transaction))))]
-      (read-source source-type input callback)
+      (transactions/with-delayed-balancing s (-> @context :entity :id)
+        (read-source source-type input callback))
       (:entity @context))))


Adds function to differ between put,post and get request in regards to :query-params or :form-params.

--- src/clj_spotify/core.clj
+++ src/clj_spotify/core.clj
@@ -76,8 +76,17 @@
     )
   )

-;TODO - solve json data in request body on put/post etc.
-;       (= "get" (name 'verb)) add one of these for default, put and post.
+(defn set-params-type
+  "Return either :query-params or :form-params key depending on value of verb"
+  [verb]
+ (let [verb-type (type verb)]
+  (if
+    (or (= verb-type clj_http.client$put) (= verb-type clj_http.client$post))
+    :form-params
+    :query-params
+    ))
+  )
+
 ;TODO - better doc string
 (defmacro def-spotify-api-call
   "Creates a function f with doc-string d that calls the http-verb verb for url url."
@@ -86,7 +95,7 @@
      ~doc-string
      ([m#] (~f m# nil))
      ([m# t#]
-      (let [query-params# {:query-params (modify-form-params m#) :oauth-token t# :content-type :json}]
+      (let [query-params# {(set-params-type ~verb) (modify-form-params m#) :oauth-token t# :content-type :json}]
         (prn query-params#)
         (->
           (try