start implementing merge interface

start implementing merge interface

--- src-cljs/cljs_workspace/om_branch_vis.cljs
+++ src-cljs/cljs_workspace/om_branch_vis.cljs
@@ -3,7 +3,8 @@
             [om.dom :as dom :include-macros true]
             [cljs-workspace.morph
               :as morphic
-              :refer [morph set-position set-fill set-extent add-morph remove-morph]]))
+              :refer [morph set-position set-fill set-extent add-morph remove-morph]]
+            [cljs-workspace.branch-merge :as branch-merge]))

 (enable-console-print!)
 ;; utilities to render a branching unrolled linked list
@@ -24,14 +25,25 @@
 ;
 ; Data structure:
 ;
-; {:id ... :data [ . . . .  {:cont ---------------------> [ . . . . . ]
+; {:id ... :data -> [ . . . .  {:cont ---------------------> {:root . :data -> [ . . . . . ]}
 ;                            :fork | }]}
 ;                                  \
 ;                                   V
-;                                  {:id ... :data [ . . . . . { . . }]}
+;                                  {:id ... :data -> [ . . . . . { . . }]}

 (def current-branch-ref (atom nil)) ;; supplied by the user of the module
 (def branch-callback-fn (atom (fn [branch] (prn "Clicked on me!"))))
+(def reverted-index (atom -1))
+(def rendered-tree (atom nil))
+
+(def highlighted-branches (atom {}))
+
+(def history-marker {:morph {:Position {:x 0 :y 1}}
+                     :shape {:Fill "lightgreen"
+                             :Extent {:x 5 :y 5}}})
+
+
+; TODO visualize the movement of one branch into the other

 (defn is-on-current [branch]
   (if @current-branch-ref
@@ -41,14 +53,37 @@
             (= @current-branch-ref (branch :root))))
     false))

+(defn get-coloring [branch]
+  (prn "HIGHLIGHTED: " @highlighted-branches)
+  (if (contains? @highlighted-branches (hash branch))
+    "red"
+    (if (is-on-current branch) "green" "black")))
+
 (defn scale-branch-model [model max-width] model)
+
+(defn highlight-branch [root path]
+  (when-let [next-step (first path)]
+    (let [branch-part (root next-step)]
+      (do
+        (swap! highlighted-branches assoc (hash branch-part) true)
+        (if (and (= 1 (count path)) (= :cont next-step))
+          (let [fp? (last @(branch-part :data))]
+            (if (contains? fp? :cont)
+              (highlight-branch fp? [:cont])))))
+      (let [fp (last @(branch-part :data))]
+        (highlight-branch fp (rest path))))))
+
+(defn visualize-merge-candidates [fork-point path-to-a path-to-b]
+  (prn "highlighting: " path-to-a " " path-to-b)
+  (highlight-branch fork-point path-to-a)
+  (highlight-branch fork-point path-to-b)
+  (refresh-view))

 (defn render-stub [branch start-point]
   [{ ; id nessecary? not for now... we do not alter the morph structure but just rerender it completely
     :morph {:MorphClass "Path"
             :Position start-point
-            :onClick (fn [e]
-                        (prn "switching via stub click to branch " (branch :id))
+            :onClick (fn [this]
                         (@branch-callback-fn branch)
                         false)}
     :shape {:ShapeClass "Path"
@@ -58,37 +93,55 @@
             :submorphs []},
             20])

-(defn render-bubble [origin r fill]
-  {:morph {:Position origin}
+(defn render-bubble [origin r fill branch]
+  { :id (if (contains? branch :id) (branch :id) (get-in branch [:root :id]))
+    :morph {:Position origin
+           :onClick (fn [this]
+                      (branch-merge/select-for-merge
+                        (if (contains? branch :id) branch (branch :root))
+                        (fn [a b]
+                          (let [[fp pa pb] (branch-merge/fork-point a b @rendered-tree)]
+                            (visualize-merge-candidates fp pa pb))))
+                      (let [fill (if (= (get-in this [:shape :Fill]) "red")
+                                    (do
+                                      ; (remove-morph branch-view (this :id) (str "box-" (this :id)))
+                                      "green")
+                                    (let [textfield { :id (str "box-" (this :id))
+                                                      :morph {:Position {:x 15 :y -3}
+                                                             :MorphClass "Text"
+                                                             :TextString (str (this :id))}
+                                                      :shape {:ShapeClass "Text"}}]
+                                       (add-morph branch-view (this :id) textfield)
+                                       "red"))]
+                        (set-fill branch-view (this :id) fill))
+                      false)}
    :shape {:ShapeClass "Ellipse"
            :Extent {:x r :y r}
-           :Fill fill}})
+           :Fill fill}
+   :submorphs []})

 (defn render-leaf [cont start-point]
-  (let [fill (if (is-on-current cont) "green" "black")]
+  (let [fill (get-coloring cont)]
     [{ ; id nessecary? not for now... we do not alter the morph structure but just rerender it completely
       :morph {:MorphClass "Path"
               :Position start-point
-              :onClick (fn [e]
+              :onClick (fn [this]
                           (if (contains? cont :root)
                             (let [b (cont :root)]
-                              (prn "switching via leaf click to branch: " (b :id))
                               (@branch-callback-fn b))
                             (let [b cont]
-                              (prn "switching via stub leaf click to branch: " (b :id))
                               (@branch-callback-fn b)))
                           false)}
       :shape {:ShapeClass "Path"
               :StrokeWidth 5
               :Fill fill
-              :PathElements [{:x 0 :y 0} {:x (count @(cont :data)) :y 0}]}
-              :submorphs [(render-bubble {:x (count @(cont :data)) :y -1} 10 fill)]}, ; place a cute bubble at the end :-)
+              :PathElements [{:x 0 :y 0} {:x (count @(cont :data)) :y 0} ]}
+              :submorphs [(render-bubble {:x (count @(cont :data)) :y -1} 10 fill cont)]}, ; place a cute bubble at the end :-)
               20]))

 (defn smoothen [vertices]
   ; interpolate last 2 edges,
   ; by substituting the last 2 points with an arc
-  (prn "smoothening: " vertices)
   (let [[middle end] (take-last 2 vertices)
         half-point (- (end :x) (middle :x))
         rounded-edge {:type :arc
@@ -107,8 +160,8 @@
             :PathElements (smoothen (map #(translat - % start) [start (assoc end :x (start :x)) end]))}})

 (defn render-fork [branch cont fork start-point]
-  (let [fill (if (is-on-current cont) "green" "black")
-        end-point {:x (count branch) :y 0} ; based on start-point and number of entries
+  (let [fill (get-coloring branch)
+        end-point {:x (count @(branch :data)) :y 0} ; based on start-point and number of entries
         [cont-path cont-space] (render-branch cont end-point) ; we have a fork, return a path that visualizes branching
         fork-start-point {:x (+ (end-point :x) 10) :y cont-space} ; based on end-point and space occupation of the cont
         [fork-path fork-space] (render-branch fork fork-start-point)
@@ -116,8 +169,7 @@
             [{; id nessecary? not for now... we do not alter the morph structure but just rerender it completely
              :morph {:MorphClass "Path"
                      :Position start-point
-                     :onClick (fn [e]
-                                (prn "switching via fork click to branch " (get-in cont [:root :id]))
+                     :onClick (fn [this]
                                 (@branch-callback-fn (cont :root))
                                 false)}
              :shape {:ShapeClass "Path"
@@ -127,38 +179,63 @@
              :submorphs [cont-path arc-path fork-path]},
               (+ cont-space fork-space)]))

+(defn attach-marker [branch-morph branch]
+  (let [marker (assoc-in history-marker [:morph :Position :x] @reverted-index)]
+    (update-in branch-morph [:submorphs] conj marker)))
+
 (defn render-branch
   ([branch]
-     ; initial call to first branch assume origin as starting point
-     (render-branch branch {:x 0 :y 0}))
+    (render-branch branch {:x 0 :y 0}))
   ([branch start-point]
      ; check if the current branch has any entries
-     (if-let [end (last @(branch :data))]
-        (if-let [cont (end :cont)] ; check for fork
-          (let [fork (end :fork)]
-            (render-fork @(branch :data) cont fork start-point))
-          (render-leaf branch start-point))
-        (render-stub branch start-point) ; this brunch has no entries yet
-      )
-  ))
-
-(defn render-tree [tree branch branch-callback]
+     (let [[bm sp]
+       (if-let [end (last @(branch :data))]
+          (if-let [cont (end :cont)] ; check for fork
+            (let [fork (end :fork)]
+              (render-fork branch cont fork start-point))
+            (render-leaf branch start-point))
+          (render-stub branch start-point) ; this brunch has no entries yet
+        )]
+        [(if (and (contains? branch :id) ; we only attach markers to the root of the branch
+                  (is-on-current branch)
+                  (> @reverted-index 0)) (attach-marker bm branch) bm) sp])))
+
+(defn refresh-view []
+  (let [[model _] (render-branch @rendered-tree)]
+      (swap! branch-view assoc :submorphs [merge-button (scale-branch-model model 400)])))
+
+(defn render-tree [tree branch branch-callback reverted]
   ; idea, walk to the leaves of the tree, and then start traversing
   ; from there and end at the root. This way we can make sure, that we
   ; reserve enough space such that all branches are neatly spaced apart)
   (when (not= @current-branch-ref branch) (prn "have to recolor!"))
+  (reset! rendered-tree tree)
   (reset! current-branch-ref branch)
   (reset! branch-callback-fn branch-callback)
-  (let [[model space] (render-branch tree)]
-      ; render stuff with om...
-      (prn container)
-      (swap! branch-view assoc :submorphs [(scale-branch-model model 400)])))
+  (reset! reverted-index reverted)
+  (let [[model _] (render-branch tree)]
+      (swap! branch-view assoc :submorphs [merge-button (scale-branch-model model 400)])))
+
+(def merge-button
+  {:id "mergeButton"
+   :morph {:Position {:x 400 :y 100}
+           :onClick (fn [this]
+                      (reset! highlighted-branches {})
+                      (refresh-view))}
+                      ;(branch-merge/merge-staged-branches @rendered-tree))}
+   :shape {:Extent {:x 60 :y 15}
+           :BorderColor "darkgrey"
+           :Fill "lightgrey"}
+   :submorphs [{:morph {:MorphClass "Text"
+                        :TextString "Merge?"
+                        :Locked true}
+                :shape {:ShapeClass "Text"}}]})

 (def branch-view (atom
   {:id "branchView"
    :shape {:Extent {:x 400 :y 100}}
    :morph {:Position {:x 50 :y 50} :isDraggable true}
-   :submorphs []}))
+   :submorphs [merge-button]}))

 (om/root
   (fn [app owner]


Use Paul as the author in the homepage.

Use Paul as the author in the homepage.


Add palette link, improve docs.

Add palette link, improve docs.

--- src/afterglow/controllers/ableton_push.clj
+++ src/afterglow/controllers/ableton_push.clj
@@ -1,6 +1,8 @@
 (ns afterglow.controllers.ableton-push
   "Allows the Ableton Push to be used as a control surface for
   Afterglow."
+  {:author "James Elliott"
+   :doc/format :markdown}
   (:require [clojure.math.numeric-tower :as math]
             [com.evocomputing.colors :as colors]
             [overtone.midi :as midi]))
@@ -16,27 +18,33 @@
 (defn velocity-for-color
   "Given a target color, calculate the MIDI note velocity which will
   achieve the closest approximation available on an Ableton Push
-  pad."
+  pad, using the thoughtful hue palette provided by Ableton:
+
+  ![Push pad palette](http://deepsymmetry.org/afterglow/research/PushColors.jpg)"
+  {:doc/format :markdown}
   [color]
   {:pre [(= (type color) :com.evocomputing.colors/color)]}
-  ;; Each hue section, starts with a desaturated version,
-  ;; then does a bright, medium, and dim version.
+  ;; Each hue section starts with a lightened version
+  ;; of the hue, then a bright, medium, and dim version
+  ;; of the fully-saturated hue.
   (let [brightness-shift (condp < (colors/lightness color)
                            60 0
                            37 1
                            15 2
                            3)]
-    (cond (< (colors/lightness color) 3)  ;; Black, off
+    (cond (< (colors/lightness color) 3)
+          ;; The color is effectively black.
           0

-          ;; The first four velocities are a white/gray section, starting
-          ;; with black as zero, through white as three.
+          ;; The color is effectively gray, so map it to the grayscale
+          ;; section, which ranges from black at zero, through white as
+          ;; three.
           (< (colors/saturation color) 20)
           (min 3 (- 4 brightness-shift))

           ;; Find the note value that approximates the hue and lightness.
           ;; From note 4 to note 59, the pads are in groups of four for
-          ;; a single hue, starting with the desaturated version, then
+          ;; a single hue, starting with the lightened version, then
           ;; the bright, medium, and dim versions.
           :else
           (let [hue-section (+ 4 (* 4 (math/floor (* 13 (/ (colors/hue color) 360)))))]


indentify file type before loading.

indentify file type before loading.

--- src/cljs/infinitelives/pixi/resources.cljs
+++ src/cljs/infinitelives/pixi/resources.cljs
@@ -96,10 +96,35 @@
             (PIXI/Texture.fromImage
              (str url "#") true (aget PIXI/scaleModes "NEAREST"))})))

+(defn- identify-file [url]
+  (condp #(%1 %2) (string/get-extension url)
+    #{"ogg" "mp3" "wav"} :sound
+    #{"png" "jpg" "gif"} :image
+    :unknown))
+
 (defn register
   [url obj]
-  (register-texture url obj)
-  (sound/register-sound url))
+  (case (identify-file url)
+    :image
+    (register-texture url obj)
+
+    :sound
+    (sound/register-sound url obj)
+
+    :default
+    ))
+
+(defn- load-image [url finished]
+  (let [i (js/Image.)]
+    (set! (.-onload i) #(put! finished [url i]))
+    (set! (.-onerror i) #(put! finished [url nil]))
+    (set! (.-onabort i) #(js/alert "abort"))
+    (set! (.-src i) url)
+    i))
+
+(defn- load-sound [url finished]
+  (go
+    (put! finished [url (<! (sound/load-sound url))])))

 (defn load-urls
   "loads each url in the passed in list as an image. Updates the progress
@@ -112,12 +137,16 @@
           num-urls (count urls)                   ;; how many urls
           images (doall                           ;; start loading all the urls
                   (map (fn [src]
-                         (let [i (js/Image.)]
-                           (set! (.-onload i) #(put! finished [src i]))
-                           (set! (.-onerror i) #(put! finished [src nil]))
-                           (set! (.-onabort i) #(js/alert "abort"))
-                           (set! (.-src i) src)
-                           i))
+                         (case (identify-file src)
+                           :image
+                           (load-image src finished)
+
+                           :sound
+                           (load-sound src finished)
+
+                           :unknown
+                           (load-image src finished)
+                           ))
                        urls))]
       (go
         (loop [i 1]


fix colors, bidi for href

fix colors, bidi for href

--- src/cljs/swarmpit/component/node/list.cljs
+++ src/cljs/swarmpit/component/node/list.cljs
@@ -36,13 +36,13 @@
   (cond
     (< stat 75) {:name  "actual"
                  :value stat
-                 :color "#509E50"}
+                 :color "#43a047"}
     (> stat 90) {:name  "actual"
                  :value stat
-                 :color "rgb(244, 67, 54)"}
+                 :color "#d32f2f"}
     :else {:name  "actual"
            :value stat
-           :color "#9e931b"}))
+           :color "#ffa000"}))

 (rum/defc node-graph [stat label]
   (let [data [(node-used stat)
@@ -68,17 +68,6 @@
                {:width    30
                 :position "center"} label))))])))

-
-;(html
-;  [:div.node-item
-;   [:a {:href (str "/#/nodes/" (:id item))
-;        :style {:color "inherit"
-;                :textDecoration "inherit"}}
-;    (node-item-header item)
-;    (node-item-engine-and-address item)
-;    (node-item-states item)
-;    (node-item-stats item)]])
-
 (defn- node-item
   [item]
   (let [cpu (-> item :resources :cpu (int))
@@ -87,7 +76,7 @@
     (comp/grid
       {:item true}
       (html
-        [:a {:href  (str "/#/nodes/" (:id item))
+        [:a {:href  (routes/path-for-frontend :node-info {:id (:id item)})
              :style {:color          "inherit"
                      :textDecoration "inherit"}}
          (comp/card


Use a faster query to retrieve report_timestamp

This was performing a correlated subquery with an ORDER BY clause on
reports in order to retrieve the latest report for each node, which is
slow and runs many times. Now we take advantage of the latest_reports
table to make fetching the latest report inexpensive. In testing, the
round trip time for /v2/nodes with 179 nodes went from ~700ms to ~33ms.

--- src/com/puppetlabs/puppetdb/query/node.clj
+++ src/com/puppetlabs/puppetdb/query/node.clj
@@ -26,12 +26,11 @@
                      subquery1.deactivated,
                      certname_catalogs.timestamp AS catalog_timestamp,
                      certname_facts_metadata.timestamp AS facts_timestamp,
-                     (SELECT end_time FROM reports
-                       WHERE certname = subquery1.name
-                       ORDER BY end_time DESC LIMIT 1) AS report_timestamp
+                     reports.end_time AS report_timestamp
                      FROM (%s) subquery1
                        LEFT OUTER JOIN certname_catalogs ON subquery1.name = certname_catalogs.certname
                        LEFT OUTER JOIN certname_facts_metadata ON subquery1.name = certname_facts_metadata.certname
+                       LEFT OUTER JOIN reports ON subquery1.name = reports.certname AND reports.hash IN (SELECT report FROM latest_reports)
                      ORDER BY subquery1.name ASC"
                     subselect)]
     (apply vector sql params)))


add fulcro-union-path

add fulcro-union-path

--- src/com/wsscode/pathom/fulcro/network.cljs
+++ src/com/wsscode/pathom/fulcro/network.cljs
@@ -275,3 +275,11 @@
                                  (fulcro.network/send network query #(doseq [f ok] (f %)) #(doseq [f err] (f %)))))
                    delay)]
      (map->BatchNetwork {:send-fn send-fn}))))
+
+(defn fulcro-union-path
+  "Use fulcro's union dispatching capabilities."
+  [{:keys [ast] :as env}]
+  (let [component (:component ast)
+        props     (p/entity env)
+        [type _]  (prim/get-ident component props)]
+    type))


fix cljs omission

fix cljs omission

--- src/tick/core.cljc
+++ src/tick/core.cljc
@@ -878,13 +878,13 @@
      (end [m] (end-composite m))))

 #?(:cljs
-   (extend-protocol ITimeSpan
+   (extend-protocol p/ITimeSpan
      PersistentArrayMap
      (beginning [m] (beginning-composite m))
      (end [m] (end-composite m))))

 #?(:cljs
-   (extend-protocol ITimeSpan
+   (extend-protocol p/ITimeSpan
      PersistentHashMap
      (beginning [m] (beginning-composite m))
      (end [m] (end-composite m))))


Directories for output-file should be created regardles of write-main?

--- src/adzerk/boot_cljs/middleware.clj
+++ src/adzerk/boot_cljs/middleware.clj
@@ -56,8 +56,8 @@
         init-fns     (:init-fns main)
         requires     (into (sorted-set) (:require main))
         init-nss     (into requires (->> init-fns (keep namespace) (map symbol)))]
+    (.mkdirs out-file)
     (when write-main?
-      (.mkdirs out-file)
       (doto cljs-file
         (io/make-parents)
         (spit (format-ns-forms (main-ns-forms cljs-ns init-nss init-fns)))))


Minor: terserer code

Minor: terserer code

--- src/yadic/core.clj
+++ src/yadic/core.clj
@@ -131,9 +131,8 @@
 ; Concrete value
 ; ----------------------------------

-
 (defn concrete [instance]
-  (fn->activator (constantly instance) []))
+  (fn-activator (constantly instance)))

 ; Conversion to activators
 ; ----------------------------------


ImmutableRangeSet union-all

ImmutableRangeSet union-all

--- src/atom_finder/util/FnRangeSet.clj
+++ src/atom_finder/util/FnRangeSet.clj
@@ -59,4 +59,4 @@

 (defn union-all
   [range-sets]
-  (reduce (fn [rs1 rs2] ImmutableRangeSet/union)))
+  (reduce #(.union %1 %2) range-sets))


reformat

reformat

--- src/promdash_annotation_server/handler.clj
+++ src/promdash_annotation_server/handler.clj
@@ -5,7 +5,8 @@
             [taoensso.faraday :as far]))

 (def client-opts
-  {:access-key (System/getenv "AWS_ACCESS_KEY") :secret-key (System/getenv "AWS_SECRET_KEY")
+  {:access-key (System/getenv "AWS_ACCESS_KEY")
+   :secret-key (System/getenv "AWS_SECRET_KEY")
    :endpoint (get (System/getenv) "AWS_DYNAMODB_ENDPOINT" "http://localhost:8000")
    :table-name "promdash-annotations"})


Introduce "finished" event

Introduce "finished" event

--- src/cljs/asciinema_player/core.cljs
+++ src/cljs/asciinema_player/core.cljs
@@ -77,7 +77,7 @@
                          (do
                            (dispatch [:update-state apply-changes v])
                            (recur))
-                         (dispatch [:update-state #(-> % (dissoc :stop) (assoc :play-from 0))]))
+                         (dispatch [:finished]))
           stop-playback-chan nil))) ; do nothing, break the loop
     (go
       (<! stop-playback-chan)
@@ -137,6 +137,9 @@
   (let [position (new-position (:current-time state) (:duration state) 5)]
     (handle-seek state dispatch [position])))

+(defn handle-finished [state _]
+  (-> state (dissoc :stop) (assoc :play-from 0)))
+
 (defn handle-frames-response [state dispatch [frames-json]]
   (dispatch [:toggle-play])
   (assoc state :loading false
@@ -149,6 +152,7 @@
                      :seek handle-seek
                      :rewind handle-rewind
                      :fast-forward handle-fast-forward
+                     :finished handle-finished
                      :frames-response handle-frames-response
                      :update-state handle-update-state})


Remove redundant lookup of certname in catalog object

Signed-off-by: Deepak Giridharagopal <d11186354d1ef01ca06ae37d7e23e827da13e85f@puppetlabs.com>

--- src/com/puppetlabs/cmdb/command.clj
+++ src/com/puppetlabs/cmdb/command.clj
@@ -96,7 +96,7 @@
       (when-not (scf-storage/certname-exists? certname)
         (scf-storage/add-certname! certname))
       (scf-storage/replace-catalog! catalog))
-    (log/info (format "[replace catalog] %s" (:certname catalog)))))
+    (log/info (format "[replace catalog] %s" certname))))

 ;;; Message queue I/O and utilities


lint error fix

lint error fix

--- src/metabase/task/send_anonymous_stats.clj
+++ src/metabase/task/send_anonymous_stats.clj
@@ -4,10 +4,10 @@
             (clojurewerkz.quartzite [jobs :as jobs]
                                     [triggers :as triggers])
             [clojurewerkz.quartzite.schedule.cron :as cron]
+            [metabase.util.stats :as stats]
             (metabase [config :as config]
                       [public-settings :as public-settings]
-                      [task :as task]
-                      [util.stats :as stats])))
+                      [task :as task])))

 (def ^:private ^:const job-key     "metabase.task.anonymous-stats.job")
 (def ^:private ^:const trigger-key "metabase.task.anonymous-stats.trigger")


more fixes

more fixes

--- src/crawler/rich_char_extractor.clj
+++ src/crawler/rich_char_extractor.clj
@@ -43,7 +43,8 @@
                                              {:href (:href a-node)
                                               :num-chars (-> a-node
                                                              :text
-                                                             count)})
+                                                             count)
+                                              :text (:text a-node)})
                                            nodes)])
                                  template-removed)

@@ -78,6 +79,11 @@
                                              (fn [acc an-info]
                                                (cons (:href an-info) acc))
                                              '()
+                                             info)
+                                     :texts (reduce
+                                             (fn [acc an-info]
+                                               (cons (:text an-info) acc))
+                                             '()
                                              info)})
                                   xpaths-anchors-chars))]


Correct comment

Correct comment

--- src/wireframes/shapes/wavefront_loader.clj
+++ src/wireframes/shapes/wavefront_loader.clj
@@ -14,7 +14,7 @@
         converter2 (partial c/parse-string #" +" converter1)]
     (fn [s]
       (let [vertices (converter2 s)]
-        ; discard any polygons with less than two faces
+        ; discard any polygons with less than three faces
         (when (> (count vertices) 2)
           {:polygons (->> vertices (mapv first) fv/vector)})))))


complete refactor of hazelcast mesh

complete refactor of hazelcast mesh

We stopped using the results of explode-endpoint, but we didn't calling it

--- src/puppetlabs/cthun/meshing/hazelcast.clj
+++ src/puppetlabs/cthun/meshing/hazelcast.clj
@@ -31,9 +31,8 @@
   [location-map]
   (flatten (for [key (.keySet location-map)]
              (for [value (.get location-map key)]
-               (let [[client type] (cs/explode-endpoint value)]
-                 {:broker key
-                  :endpoint value})))))
+               {:broker key
+                :endpoint value}))))

 (defn broker-for-endpoint
   "look up the endpoint in the location-map, return broker names"


unsubscribe a worker-config listener

unsubscribe a worker-config listener

--- src/hivewing_core/worker_config.clj
+++ src/hivewing_core/worker_config.clj
@@ -51,6 +51,10 @@
   [worker-uuid handler]
     (pubsub/subscribe-change "worker-config" worker-uuid handler))

+(defn worker-config-stop-watching-changes
+  [listener]
+  (pubsub/unsubscribe listener))
+
 (defn worker-config-set
   "Set the configuration on the worker. Provided a uuid and the paramters as a hash.
   The keys for the parameters should be strings or keywords.


Make the names of the section match the slide pics.


Additional pop is test

Additional pop is test


[#84] VACUUM can't be executed in a transaction

--- backend/src/org/akvo/dash/import/csv.clj
+++ backend/src/org/akvo/dash/import/csv.clj
@@ -95,10 +95,10 @@
   (let [path (:path spec)
         headers? (:headers? spec)
         n-cols (get-num-cols path \,)
-        col-names (if headers?
-                    (get-headers path \,)
-                    (vec (for [i (range 1 (inc n-cols))]
-                           (str "Column " i))))
+        col-titles (if headers?
+                     (get-headers path \,)
+                     (vec (for [i (range 1 (inc n-cols))]
+                            (str "Column " i))))
         temp-table (str table-name "_temp")
         copy-manager (CopyManager. (cast BaseConnection (:connection tenant-conn)))]
     (jdbc/execute! tenant-conn [(get-create-table-sql temp-table n-cols "text" true)])
@@ -106,6 +106,6 @@
     (.copyIn copy-manager (get-copy-sql temp-table n-cols headers?) (io/input-stream path))
     (jdbc/execute! tenant-conn [(get-insert-sql temp-table table-name n-cols)])
     (jdbc/execute! tenant-conn [(get-drop-table-sql temp-table)])
-    (jdbc/execute! tenant-conn [(get-vacuum-sql table-name)])
+    (jdbc/execute! tenant-conn [(get-vacuum-sql table-name)] :transaction? false)
     {:success? true
-     :columns (get-column-tuples col-names)}))
+     :columns (get-column-tuples col-titles)}))


cleanup

cleanup

--- src/ardoq/swagger/swagger_v3.clj
+++ src/ardoq/swagger/swagger_v3.clj
@@ -332,6 +332,7 @@

 (defn create-reference [client ardoq-data {source :source target :target}]
   (prn "Creating reference from" source "to" target)
+
   (-> {
         :source source
         :target target
@@ -339,14 +340,11 @@
         :rootWorkspace (get-in ardoq-data [:workspace :_id])
         :targetWorkspace (get-in ardoq-data [:workspace :_id])}
      (api-client/map->Reference)
-     (api-client/create client)
-     ))
+     (api-client/create client)))

 (defn delete-reference [client ardoq-data ref-key]
   (prn "Deleting reference from" (:source ref-key) "to" (:target ref-key))
-
-  (prn (get-in ardoq-data [:key->reference ref-key]))

   (-> (get-in ardoq-data [:key->reference ref-key])
     (api-client/map->Reference)
@@ -375,9 +373,6 @@
     (mark-as-orphans client ardoq-data (:to-mark-as-orphan orphan-components))
     (sync-references client ardoq-data ardoq-sync-components spec-data)

-    (prn (set (keys (:key->reference ardoq-data))))
-
-
     (prn "synced")

   ))


handle bad numbers in carbon handler

handle bad numbers in carbon handler

--- src/org/spootnik/cyanite/carbon.clj
+++ src/org/spootnik/cyanite/carbon.clj
@@ -8,12 +8,23 @@
             [gloss.core                 :refer [string]]
             [lamina.core                :refer [receive-all map* siphon]]))

+(defn parse-num
+  "parse a number into the given value, return the
+  default value if it fails"
+  [parse default number]
+  (try (parse number)
+    (catch NumberFormatException e
+      (debug "got an invalid number" number (.getMessage e))
+      default)))
+
 (defn formatter
   "Split each line on whitespace, discard nan metric lines
    and format correct lines for each resolution"
   [index rollups input]
-  (let [[path metric time] (s/split (.trim input) #" ")]
-    (when (not= metric "nan")
+  (let [[path metric time] (s/split (.trim input) #" ")
+        metric (parse-num #(Double/parseDouble %) "nan" metric)
+        time (parse-num #(Long/parseLong %) "nan" time)]
+    (when (and (not= metric "nan") (not= time "nan"))
       ;; hardcode empty tenant for now
       (when index (path/register index "" path))
       (for [{:keys [rollup period rollup-to]} rollups]
@@ -21,8 +32,8 @@
          :rollup rollup
          :period period
          :ttl    (* period rollup)
-         :time   (rollup-to (Long/parseLong time))
-         :metric (Double/parseDouble metric)}))))
+         :time   (rollup-to time)
+         :metric metric}))))

 (defn handler
   "Send each metric over to the cassandra store"


core: condp

core: condp

--- core/data/core.clj
+++ core/data/core.clj
@@ -2905,6 +2905,47 @@
           (swap! mem assoc args ret)
           ret)))))

+(defmacro condp
+  "Takes a binary predicate, an expression, and a set of clauses.
+  Each clause can take the form of either:
+
+  test-expr result-expr
+
+  test-expr :>> result-fn
+
+  Note :>> is an ordinary keyword.
+
+  For each clause, (pred test-expr expr) is evaluated. If it returns
+  logical true, the clause is a match. If a binary clause matches, the
+  result-expr is returned, if a ternary clause matches, its result-fn,
+  which must be a unary function, is called with the result of the
+  predicate as its argument, the result of that call being the return
+  value of condp. A single default expression can follow the clauses,
+  and its value will be returned if no clause matches. If no default
+  expression is provided and no clause matches, an
+  IllegalArgumentException is thrown."
+  {:added "1.0"}
+
+  [pred expr & clauses]
+  (let [gpred (gensym "pred__")
+        gexpr (gensym "expr__")
+        emit (fn emit [pred expr args]
+               (let [[[a b c :as clause] more]
+                     (split-at (if (= :>> (second args)) 3 2) args)
+                     n (count clause)]
+                 (cond
+                   (= 0 n) `(throw (ex-info (str "No matching clause: " ~expr) {}))
+                   (= 1 n) a
+                   (= 2 n) `(if (~pred ~a ~expr)
+                              ~b
+                              ~(emit pred expr more))
+                   :else `(if-let [p# (~pred ~a ~expr)]
+                            (~c p#)
+                            ~(emit pred expr more)))))]
+    `(let [~gpred ~pred
+           ~gexpr ~expr]
+       ~(emit gpred gexpr clauses))))
+
 (defn empty?
   "Returns true if coll has no items - same as (not (seq coll)).
   Please use the idiom (seq x) rather than (not (empty? x))"


CMR-2186: Clean up and refactor code

CMR-2186: Clean up and refactor code

--- search-app/src/cmr/search/services/query_execution/facets_v2_results_feature.clj
+++ search-app/src/cmr/search/services/query_execution/facets_v2_results_feature.clj
@@ -76,29 +76,23 @@
   (util/key-sorted-map [:title :type :applied :count :links :has_children :children]))

 (defn- parse-hierarchical-bucket-v2
-  "Parses the elasticsearch aggregations response for hierarchical fields."
+  "Parses the elasticsearch aggregations response to generate version 2 facets."
   [field-hierarchy bucket-map]
   (when-let [field (first field-hierarchy)]
-    (let [empty-response (merge sorted-facet-map
-                                {:has_children false
-                                 :type :group})
-          value-counts (for [bucket (get-in bucket-map [field :buckets])
+    (let [value-counts (for [bucket (get-in bucket-map [field :buckets])
                              :let [sub-facets (parse-hierarchical-bucket-v2 (rest field-hierarchy)
                                                                             bucket)]]
                          (merge sorted-facet-map
                                 {:has_children false}
-                                (when-not (= sub-facets empty-response)
-                                  sub-facets)
+                                sub-facets
                                 {:title (:key bucket)
                                  :count (get-in bucket [:coll-count :doc_count] (:doc_count bucket))
                                  :type :filter}))]
-      (if (seq value-counts)
-        (let [field-snake-case (csk/->snake_case_string field)]
-          {:title field-snake-case
-           :type :group
-           :has_children true
-           :children value-counts})
-        nil))))
+      (when (seq value-counts)
+        {:title (csk/->snake_case_string field)
+         :type :group
+         :has_children true
+         :children value-counts}))))

 (defn hierarchical-bucket-map->facets-v2
   "Takes a map of elastic aggregation results for a nested field. Returns a hierarchical facet for
@@ -113,24 +107,17 @@
   (remove nil?
     (for [field-name field-names
           :let [value-counts (frf/buckets->value-count-pairs (field-name bucket-map))
-                has-children (some? (seq value-counts))
-                base-node {:title (field-name fields->human-readable-label)
-                           :type :group
-                           ;; TODO with another ticket
-                           ;  :applied ;; either true or false
-                           :has_children has-children}]]
+                has-children (some? (seq value-counts))]]
       (when has-children
-        (assoc base-node :children (map (fn [[term count]]
-                                          {:title term
-                                           :type :filter
-                                           ;; TODO with another ticket
-                                           ;; applied ;; either true or false
-                                           :count count
-                                           ;; TODO with another ticket
-                                           ; :links ;; Apply or remove the given term to the provided search
-                                           :has_children false})
-                                        value-counts))))))
-
+        {:title (field-name fields->human-readable-label)
+         :type :group
+         :has_children true
+         :children (map (fn [[term count]]
+                          {:title term
+                           :type :filter
+                           :count count
+                           :has_children false})
+                        value-counts)}))))

 (defn- add-links-to-facets
   "Adds applied and links keys to the facets-v2 map."


readFile returns a buffer

readFile returns a buffer

--- src/bitsplit_cli/filesystem.cljs
+++ src/bitsplit_cli/filesystem.cljs
@@ -1,5 +1,6 @@
 (ns bitsplit-cli.filesystem
     (:use
+        [cljs.reader :only (read-string)]
         [bitsplit.storage.protocol
             :only (Storage all lookup save! delete!)]))

@@ -14,7 +15,10 @@
         (if (= filename "FAKE")
             @fake-file
             (if (.existsSync fs filename)
-                (.readFileSync fs filename)
+                (->> filename
+                    (.readFileSync fs)
+                    .toString
+                    read-string)
                 default))))

 (defn- write-file [filename data]


Don't convert to byte bufs when not necessary

--- test/caesium/magicnonce/secretbox_test.clj
+++ test/caesium/magicnonce/secretbox_test.clj
@@ -50,7 +50,7 @@

     (is (u/array-eq st/ptext (ms/decrypt st/secret-key ctext)))

-    (let [forgery (bb/->indirect-byte-buf (r/randombytes (bb/buflen ctext)))]
+    (let [forgery (r/randombytes (bb/buflen ctext))]
       (is (thrown-with-msg?
            RuntimeException #"Ciphertext verification failed"
            (ms/decrypt st/secret-key forgery))))


Improved error handling

Improved error handling

--- src/rdf_path_examples/resources.clj
+++ src/rdf_path_examples/resources.clj
@@ -8,7 +8,8 @@
             [clojure.tools.logging :as log]
             [clojure.walk :refer [keywordize-keys]]
             [liberator.core :refer [defresource]])
-  (:import [org.apache.jena.sparql.engine.http QueryExceptionHTTP]))
+  (:import [org.apache.jena.sparql.engine.http QueryExceptionHTTP]
+           [schema.utils ErrorContainer]))

 (def ^:private default-response
   {:representation {:media-type "application/ld+json"}})
@@ -25,7 +26,14 @@
                         (catch QueryExceptionHTTP e
                           (views/error {:status 500
                                         :error-msg (.getMessage e)}))))
-  :handle-malformed views/error
+  :handle-malformed (fn [{:keys [malformed-error]
+                          :as ctx}]
+                      (cond (string? malformed-error)
+                              (views/error (assoc ctx :error-msg malformed-error))
+                            (map? malformed-error)
+                              (views/error (assoc ctx
+                                                  :error-msg "Integrity constraint violation"
+                                                  :see-also malformed-error))))
   :handle-ok (fn [{{configuration :params} :request
                    :keys [rdf-path]}]
                (generate-examples configuration rdf-path))
@@ -35,7 +43,10 @@
                 (let [configuration (parse-query-params query-params)
                       path (json-ld/json-ld->rdf-model body)]
                   (if-let [error (or (:error configuration) (validate-path path))]
-                    [true (assoc default-response :error-msg error)]
+                    [true (assoc default-response
+                                 :malformed-error (if (instance? ErrorContainer configuration)
+                                                    (str error)
+                                                    error))]
                     [false {:request {:params (merge {:limit 5} (keywordize-keys configuration))}
                             :rdf-path path}])))
   :new? (constantly false)


[#672] WIP fixed type sniffing bug

[#672] WIP fixed type sniffing bug

--- backend/src/akvo/lumen/import/csv.clj
+++ backend/src/akvo/lumen/import/csv.clj
@@ -19,6 +19,7 @@
   Defaults to 'text'."
   [value]
   (condp #(%1 %2) value
+    ;; date-string? :date
     nil? :nil
     number? :number
     :text))
@@ -27,13 +28,14 @@
   "Determines if all types in the given column are unified"
   [type-kw coll]
   {:pre [(contains? #{:date :number :text} type-kw)]}
-  (apply = (map #(contains? #{:nil type-kw} %) coll)))
+  (every? true? (map #(contains? #{:nil type-kw} %) coll)))

-(defn get-column-type
+(defn get-common-type
   "Determines the common type of the given coll of types.
   Defaults to 'text' if types cannot be unified."
   [coll]
   (condp #(all-of-type? %1 %2) coll
+    :date {:client "date" :psql "timestamptz"}
     :number {:client "number" :psql "double precision"}
     :text {:client "text" :psql "text"}
     {:client "text" :psql "text"}))
@@ -42,7 +44,7 @@
   "Returns a seq of the common types of each column in the given dataset"
   [{:keys [column-names] :as dataset}]
   (->> (map #(incanter/$map get-type % dataset) column-names)
-       (map get-column-type)))
+       (map get-common-type)))

 (defn get-column-tuples
   "Returns a sequence of maps containing column names, titles & types


More relevant base set of imports

More relevant base set of imports

--- test/cljs/go_test.clj
+++ test/cljs/go_test.clj
@@ -24,9 +24,10 @@
     (println "package" package)
     (println "import (")
     (doseq [import (concat ["testing"
+                            "math"
+                            "reflect"
                             "github.com/stretchr/testify/assert"
-                            "github.com/hraberg/cljs.go/js"
-                            "github.com/hraberg/cljs.go/js/Math"]
+                            "github.com/hraberg/cljs.go/js"]
                            imports)]
       (println "\t" (pr-str import)))
     (println "\t" "." (pr-str "github.com/hraberg/cljs.go/cljs/core"))


fix(frontend): fix wrong arity decl on navigate function

--- frontend/src/uxbox/util/router.cljs
+++ frontend/src/uxbox/util/router.cljs
@@ -95,8 +95,8 @@
       (navigate! router id params qparams))))

 (defn nav
-  ([id] (navigate id nil nil))
-  ([id params] (navigate id params nil))
+  ([id] (nav id nil nil))
+  ([id params] (nav id params nil))
   ([id params qparams]
    {:pre [(keyword? id)]}
    (Navigate. id params qparams)))


lein-cljfmt 0.6.2

lein-cljfmt 0.6.2

--- dot/lein/profiles.clj
+++ dot/lein/profiles.clj
@@ -6,6 +6,6 @@
             [lein-pprint "1.2.0"]
             [jonase/eastwood "0.3.3"]
             [com.billpiel/sayid "0.0.17"]
-            [lein-cljfmt "0.6.1"]]
+            [lein-cljfmt "0.6.2"]]
   :dependencies [[slamhound "1.5.5"]]
   :aliases {"slamhound" ["run" "-m" "slam.hound"]}}}


increase the timeout

increase the timeout

as I have no idea why this is failing on CI

--- test/functional/functional_test.clj
+++ test/functional/functional_test.clj
@@ -25,7 +25,7 @@
     (set-driver! (init-driver {:webdriver driver}))
     (compare-and-set! driver-atom nil driver))

-  (implicit-wait 1000)
+  (implicit-wait 2000)

   (test-fn)


Docs and minor formatting

Docs and minor formatting

--- cortex/src/cortex/nn/core.cljc
+++ cortex/src/cortex/nn/core.cljc
@@ -22,12 +22,17 @@
     (cp/calc m input)))

 (defn output
-  "Gets the ouput for a module. Throws an exception if not available."
+  "Gets the ouptut for a module. Assumes that either `calc` or a `forward` pass has been run.
+
+   Throws an exception if not available."
   ([m]
     (or (cp/output m) (error "No output available for module: " #?(:clj (class m) :cljs (type m))))))

 (defn calc-output
-  "Runs the calculation for a module. Returns the module output."
+  "Performs the calculation for a module, as per `calc`. This is intended for use when you just want
+   to use the module for computation, and do not care about the resulting module stats.
+
+   Returns the module output as per `output`."
   ([m input]
    (cp/output (cp/calc m input))))

@@ -100,7 +105,7 @@
              :packed-grads grads)
       module]))
   ([optimiser module]
-   (optimise optimiser module 1)))
+    (optimise optimiser module 1)))

 ;; ===========================================================================
 ;; Module construction and combinator functions


minor fix to missing require in cljs version of tests

--- test/smooth_spec/provided_spec.cljc
+++ test/smooth_spec/provided_spec.cljc
@@ -6,7 +6,7 @@
                ))
   #?(:cljs (:require-macros [cljs.test :refer (are is deftest run-tests testing)]
              [smooth-spec.provided :as p]
-             [smooth-spec.core :refer [specification behavior provided with-timeline async tick assertions]]
+             [smooth-spec.core :refer [specification behavior provided with-timeline async tick assertions when-mocking]]
              ))
   #?(:cljs (:require [cljs.test :refer [do-report]]
              )


update batch

update batch

--- kafka-clj/src/kafka_clj/consumer.clj
+++ kafka-clj/src/kafka_clj/consumer.clj
@@ -158,6 +158,7 @@
 							         (let [k #{(:topic msg) (:partition msg)}]
 							           (if (is-new-msg? current-offsets resp k msg)
 				                   (do
+                               ;(prn "!!!!!!!!!sending message")
                                (>!! msg-ch msg)
 		                           (p-send msg)
                                (.mark m-consume-reads) ;metrics mark
@@ -168,7 +169,8 @@
 							         (do (error "Fetch error: " msg) (tuple resp (conj errors msg)))
 							         :else (throw (RuntimeException. (str "The message type " msg " not supported")))))
 		               (catch Exception e
-	                  (do (prn-fetch-error e state msg)
+	                  (do (.printStackTrace e)
+                        (prn-fetch-error e state msg)
 	                      (tuple resp errors))
 	                  )))
                   (do (error "State not supported " state)
@@ -314,16 +316,21 @@
    (merge-broker-offsets broker-offsets v))

-(defn close-and-reconnect [bootstrap-brokers producers topics conf]
-  (doseq [producer producers]
-    (shutdown producer))
-
-  (info "close-and-reconnect: " bootstrap-brokers " topic " topics)
-  (if-let [metadata (get-metadata bootstrap-brokers conf)]
-    (let [broker-offsets (doall (get-broker-offsets metadata topics conf))
-          producers (doall (create-producers broker-offsets conf))]
-      [producers broker-offsets])
-    (throw (RuntimeException. "No metadata from brokers " bootstrap-brokers))))
+(defn close-and-reconnect [bootstrap-brokers producers topics errors conf]
+
+  (let [reconnect (some (fn [x] (not (instance? FetchError x))) errors)]
+
+    (if reconnect
+		  (doseq [producer producers]
+		    (shutdown producer)))
+
+
+	  (info "close-and-reconnect: " bootstrap-brokers " topic " topics " reconnect " reconnect)
+	  (if-let [metadata (get-metadata bootstrap-brokers conf)]
+	    (let [broker-offsets (doall (get-broker-offsets metadata topics conf))
+	          producers (if reconnect (doall (create-producers broker-offsets conf)) producers)]
+	      [producers broker-offsets])
+	    (throw (RuntimeException. "No metadata from brokers " bootstrap-brokers)))))

 (defn- ^long coerce-long [v]
   "Will return a long value, if v is a long its returned as is, if its a number its cast to a long,
@@ -417,7 +424,7 @@
 	       (do
 	         (info "updating " topic " " partition " to " record)
 	         (p-send {:topic topic :partition partition :offset (:offset record)}))
-	       (error "The record " topic " " partition " cannot be found"))))
+	       (info "The record " topic " " partition " cannot be found"))))
     (p-close)))

 (defn consume-producers! [bootstrap-brokers
@@ -438,9 +445,9 @@
 	       (let [[v errors] q]
 			    (if (> (count errors) 0)
 			      (do
-			         (error "Error close and reconnect1: " errors)
+			         (error "Error close and reconnect: " errors)

-			         (let [[producers broker-offsets] (close-and-reconnect bootstrap-brokers producers topics conf)]
+			         (let [[producers broker-offsets] (close-and-reconnect bootstrap-brokers producers topics errors conf)]
 	                ;;here we need to delete the offsets that have had errors from the storage
 	                ;;or better yet set them to storage
                  ;persist-error-offsets [group-conn broker-offsets errors conf]
@@ -491,7 +498,7 @@
   (let [
         metrics (create-metrics)
         msg-ch (chan 100)
-        msg-buff (buffered-chan msg-ch 1000 1000)
+        msg-buff (buffered-chan msg-ch 1000 1000 1000)
         redis-conf (get conf :redis-conf {:heart-beat-freq 10})
         group-conn (let [c (create-group-connector (get redis-conf :redis-host "localhost") redis-conf)
                          host-name (get conf :host-name nil) ]


moar failures

moar failures

--- src/jepsen/voltdb/dirty_read.clj
+++ src/jepsen/voltdb/dirty_read.clj
@@ -180,12 +180,11 @@
          :concurrency 15
          :generator (gen/phases
                       (->> (rw-gen)
-                           (gen/stagger 1/1000)
+                           (gen/delay 1/100)
                            (gen/nemesis
-                             (gen/seq (cycle [(gen/sleep 1)
-                                              {:type :info :f :start}
+                             (gen/seq (cycle [{:type :info :f :start}
                                               {:type :info :f :stop}])))
-                           (gen/time-limit 120))
+                           (gen/time-limit 300))
                       (gen/nemesis (gen/once {:type :info :f :stop}))
                       (gen/log "Rejoining all down nodes")
                       (gen/clients


:8ball: clojure RNA Transcription - passes tests

--- clojure/rna-transcription/rna_transcription.clj
+++ clojure/rna-transcription/rna_transcription.clj
@@ -1,3 +1,11 @@
 (ns rna-transcription)

-(defn to-rna [s] s)
+(defn- single-to-rna [c]
+  (assert (some #{c} [\A \C \G \T]) (str "Unknown nucleotide: " c))
+  (cond
+    (= c \A) \U
+    (= c \C) \G
+    (= c \G) \C
+    (= c \T) \A))
+
+(defn to-rna [s] (apply str (map single-to-rna s)))


New functions: format-time and format-time-

--- src/clj_calendar/format_datetime.clj
+++ src/clj_calendar/format_datetime.clj
@@ -13,3 +13,21 @@
 (ns clj-calendar.format-datetime
     "Namespace that contains various functions for handling calendar and dates.")

+(defn format-time
+    "Format a given time unit into human readable format."
+    [amount unit]
+    (format "%d %s ago" amount unit))
+
+(defn format-time-
+    "Format time into human readable format."
+    [amount1 amount2 unit1 unit2]
+    (if (= amount1 1)
+        (cond
+            (= amount2 0) (format "one %s ago" unit1)
+            (= amount2 1) (format "one %s and one %s ago" unit1 unit2)
+            :else         (format "one %s and %d %ss ago" unit1 amount2 unit2))
+        (cond
+            (= amount2 0) (format "%d %ss ago" amount1 unit1)
+            (= amount2 1) (format "%d %ss and one %s ago" amount1 unit1 unit2)
+            :else         (format "%d %ss and %d %ss ago" amount1 unit1 amount2 unit2))))
+


Changed greeting

Changed greeting

--- src/clojure_on_azure/routes/home.clj
+++ src/clojure_on_azure/routes/home.clj
@@ -3,7 +3,7 @@
             [clojure-on-azure.views.layout :as layout]))

 (defn home []
-  (layout/common [:h1 "Hello World!"]))
+  (layout/common [:h1 "Hello Azure Websites!"]))

 (defroutes home-routes
   (GET "/" [] (home)))


Fix typo :wrench:

Fix typo :wrench:

--- src/metabase/driver/druid/js.clj
+++ src/metabase/driver/druid/js.clj
@@ -37,16 +37,16 @@
        (apply str body)
        " }"))

-(defn- arthitmetic-operator
+(defn- arithmetic-operator
   "Interpose artihmetic OPERATOR between ARGS, and wrap the entire expression in parens."
   ^String [operator & args]
   (parens (s/join (str " " (name operator) " ")
                   (map ->js args))))

-(def ^{:arglists '([& args])} ^String + "Interpose `+` between ARGS, and wrap the entire expression in parens." (partial arthitmetic-operator :+))
-(def ^{:arglists '([& args])} ^String - "Interpose `-` between ARGS, and wrap the entire expression in parens." (partial arthitmetic-operator :-))
-(def ^{:arglists '([& args])} ^String * "Interpose `*` between ARGS, and wrap the entire expression in parens." (partial arthitmetic-operator :*))
-(def ^{:arglists '([& args])} ^String / "Interpose `/` between ARGS, and wrap the entire expression in parens." (partial arthitmetic-operator :/))
+(def ^{:arglists '([& args])} ^String + "Interpose `+` between ARGS, and wrap the entire expression in parens." (partial arithmetic-operator :+))
+(def ^{:arglists '([& args])} ^String - "Interpose `-` between ARGS, and wrap the entire expression in parens." (partial arithmetic-operator :-))
+(def ^{:arglists '([& args])} ^String * "Interpose `*` between ARGS, and wrap the entire expression in parens." (partial arithmetic-operator :*))
+(def ^{:arglists '([& args])} ^String / "Interpose `/` between ARGS, and wrap the entire expression in parens." (partial arithmetic-operator :/))

 (defn fn-call
   "Generate a JavaScript function call.


Lint fix :shirt:

Lint fix :shirt:

--- src/metabase/util/encryption.clj
+++ src/metabase/util/encryption.clj
@@ -17,7 +17,8 @@
                               :iterations 100000}) ; 100,000 iterations takes about ~160ms on my laptop
                  64))

-(defonce ^:private ^bytes default-secret-key
+;; apperently if you're not tagging in an arglist, `^bytes` will set the `:tag` metadata to `clojure.core/bytes` (ick) so you have to do `^{:tag 'bytes}` instead
+(defonce ^:private ^{:tag 'bytes} default-secret-key
   (when-let [secret-key (env/env :mb-encryption-secret-key)]
     (when (seq secret-key)
       (assert (>= (count secret-key) 16)


Remove unused start-replicasets-watch! overload (#502)

--- waiter/src/waiter/scheduler/kubernetes.clj
+++ waiter/src/waiter/scheduler/kubernetes.clj
@@ -814,33 +814,32 @@

 (defn start-replicasets-watch!
   "Start a thread to continuously update the watch-state atom based on watched ReplicaSet events."
-  ([scheduler] (start-replicasets-watch! scheduler default-watch-options))
-  ([{:keys [api-server-url watch-state orchestrator-name replicaset-api-version] :as scheduler} options]
-   (start-k8s-watch!
-     scheduler
-     (->
-       {:query-fn global-rs-state-query
-        :resource-key :service-id->service
-        :resource-name "ReplicaSets"
-        :resource-url (str api-server-url "/apis/" replicaset-api-version
-                           "/replicasets?labelSelector=managed-by="
-                           orchestrator-name)
-        :metadata-key :rs-metadata
-        :update-fn (fn rs-watch-update [{rs :object update-type :type}]
-                     (let [now (t/now)
-                           {service-id :id :as service} (replicaset->Service rs)
-                           version (k8s-object->resource-version rs)]
-                       (when service
-                         (scheduler/log "rs state update:" update-type version service)
-                         (swap! watch-state
-                                #(as-> % state
-                                   (case update-type
-                                     "ADDED" (assoc-in state [:service-id->service service-id] service)
-                                     "MODIFIED" (assoc-in state [:service-id->service service-id] service)
-                                     "DELETED" (utils/dissoc-in state [:service-id->service service-id]))
-                                   (assoc-in state [:rs-metadata :timestamp :watch] now)
-                                   (assoc-in state [:rs-metadata :version :watch] version))))))}
-       (merge options)))))
+  [{:keys [api-server-url watch-state orchestrator-name replicaset-api-version] :as scheduler} options]
+  (start-k8s-watch!
+    scheduler
+    (->
+      {:query-fn global-rs-state-query
+       :resource-key :service-id->service
+       :resource-name "ReplicaSets"
+       :resource-url (str api-server-url "/apis/" replicaset-api-version
+                          "/replicasets?labelSelector=managed-by="
+                          orchestrator-name)
+       :metadata-key :rs-metadata
+       :update-fn (fn rs-watch-update [{rs :object update-type :type}]
+                    (let [now (t/now)
+                          {service-id :id :as service} (replicaset->Service rs)
+                          version (k8s-object->resource-version rs)]
+                      (when service
+                        (scheduler/log "rs state update:" update-type version service)
+                        (swap! watch-state
+                               #(as-> % state
+                                  (case update-type
+                                    "ADDED" (assoc-in state [:service-id->service service-id] service)
+                                    "MODIFIED" (assoc-in state [:service-id->service service-id] service)
+                                    "DELETED" (utils/dissoc-in state [:service-id->service service-id]))
+                                  (assoc-in state [:rs-metadata :timestamp :watch] now)
+                                  (assoc-in state [:rs-metadata :version :watch] version))))))}
+      (merge options))))

 (defn kubernetes-scheduler
   "Returns a new KubernetesScheduler with the provided configuration. Validates the


Reformat day8.re-frame-10x.view.subs ns

Reformat day8.re-frame-10x.view.subs ns

--- src/day8/re_frame_10x/view/subs.cljs
+++ src/day8/re_frame_10x/view/subs.cljs
@@ -233,12 +233,12 @@
                                   :style {:margin     (css-join pod-padding pod-padding "0px" pod-padding)
                                           :overflow-x "auto"
                                           :overflow-y "hidden"}
-                                  :children [(if (or value? #_ previous-value?)
+                                  :children [(if (or value? #_previous-value?)
                                                [components/simple-render
                                                 main-value
                                                 ["sub-path" path]]
-                                               not-run-yet-msg
-                                               )]]))]
+                                               not-run-yet-msg)]]))]
+
                             [animated/component
                              (animated/v-box-options
                                {:enter-animation "accordionVertical"
@@ -253,9 +253,9 @@
                                      [diff-before diff-after _] (clojure.data/diff previous-value value)]
                                  [rc/v-box
                                   :children [[rc/v-box
-                                              :class    "app-db-path--link"
-                                              :style    {:background-color cljs-dev-tools-background}
-                                              :justify  :end
+                                              :class "app-db-path--link"
+                                              :style {:background-color cljs-dev-tools-background}
+                                              :justify :end
                                               :children [[rc/hyperlink-href
                                                           ;:class  "app-db-path--label"
                                                           :label "ONLY BEFORE"
@@ -275,9 +275,9 @@
                                                                       ["app-db-diff" path]]
                                                            :else no-prev-value-msg)]]
                                              [rc/v-box
-                                              :class    "app-db-path--link"
-                                              :style    {:background-color cljs-dev-tools-background}
-                                              :justify  :end
+                                              :class "app-db-path--link"
+                                              :style {:background-color cljs-dev-tools-background}
+                                              :justify :end
                                               :children [[rc/hyperlink-href
                                                           ;:class  "app-db-path--label"
                                                           :label "ONLY AFTER"
@@ -320,11 +320,11 @@
                :size "1"
                :child ""]
               [rc/box
-               :width "132px" ;; common/gs-131s + 1 border
+               :width "132px"                               ;; common/gs-131s + 1 border
                :justify :center
                :child [rc/label :style {:font-size "9px"} :label "ACTIVITY"]]
               [rc/box
-               :width "32px" ;; common/gs-31s + 1 border
+               :width "32px"                                ;; common/gs-31s + 1 border
                :justify :center
                :child [rc/label :style {:font-size "9px"} :label "LAYER"]]
               [rc/box
@@ -332,10 +332,10 @@
                :justify :center
                :child [rc/label :style {:font-size "9px"} :label "PINNED"]]
               [rc/box
-               :width "51px" ;;  50px + 1 border
+               :width "51px"                                ;;  50px + 1 border
                :justify :center
                :child [rc/label :style {:font-size "9px"} :label "DIFFS"]]
-              [rc/gap-f :size "6px"]]]) ;; Add extra space to look better when there is/aren't scrollbars
+              [rc/gap-f :size "6px"]]])                     ;; Add extra space to look better when there is/aren't scrollbars

 (defn pod-section []
@@ -347,15 +347,15 @@
                            (cons {:path [:subs/current-epoch-sub-state] :id "debug" :value @(rf/subscribe [:subs/current-epoch-sub-state])} visible-subs)
                            visible-subs)]
     [rc/v-box
-     :size     "1"
-     :style    {:overflow-y "auto"}
+     :size "1"
+     :style {:overflow-y "auto"}
      :children [(if (and (empty? all-subs) @*finished-animation?)
                   [no-pods]
                   [pod-header-column-titles])
                 [rc/v-box
-                 :size     "auto"
-                 :style    {:overflow-x "hidden"
-                            :overflow-y "auto"}
+                 :size "auto"
+                 :style {:overflow-x "hidden"
+                         :overflow-y "auto"}
                  :children [(for [p all-subs]
                               ^{:key (:id p)}
                               [pod (merge p
@@ -382,18 +382,18 @@
     [:div.filter
      [:div.filter-control
       [:div.filter-control-input {:style {:margin-left 10}}
-       [:input {:type      "text"
-                :value     @filter-str
+       [:input {:type        "text"
+                :value       @filter-str
                 :placeholder "Type to filter subs"
-                :on-change #(rf/dispatch [:subs/set-filter
-                                          (-> % .-target .-value)])}]]]]))
+                :on-change   #(rf/dispatch [:subs/set-filter
+                                            (-> % .-target .-value)])}]]]]))

 (defn render []
   []
   [rc/v-box
-   :size     "1"
-   :style    {:margin-right common/gs-19s}
+   :size "1"
+   :style {:margin-right common/gs-19s}
    :children [[panel-header]
               [filter-section]
               [pod-section]


rewrote rep* and rep+ so that they are not mutually recursive anymore. this is less elegant, but calls much less functions, helping prevent stack overflows.

--- src/name/choi/joshua/fnparse.clj
+++ src/name/choi/joshua/fnparse.clj
@@ -259,7 +259,16 @@
   of b were found, or nil if there was no match. (Note that this means that, in the latter
   case, the result would be [nil given-state].) The new rule can never simply return nil."
   [subrule]
-  (opt (rep+ subrule)))
+  (fn [state]
+    (loop [cur-product [], cur-state state]
+      (if-let [[subproduct substate] (subrule cur-state)]
+        (if (seq (*remainder-accessor* substate))
+          (recur (conj cur-product subproduct) substate)
+          [(conj cur-product subproduct) substate])
+        [(if (not= cur-product []) cur-product) cur-state]))))
+  ; The following code was used until I found that the mutually recursive calls to rep+
+  ; resulted in an easily inflated function call stack.
+;  (opt (rep+ subrule)))

 (defn rep+
   "Creates a rule that is the zero-or-more greedy repetition of the given subrule. It
@@ -267,14 +276,17 @@
   its subrule fails. Its result is the sequence of results from the subrule's repetitions.
   (def a (rep* b)) is equivalent to the EBNF:
     a = {b}-;
-  The new rule's products would be either the vector [b-product ...] for how many matches
-  of b were found. If there was no match, then nil is simply returned."
+  The new rule's products would be the vector [b-product ...] for how many matches
+  of b were found. If there was no match, then the rule fails."
   [subrule]
-  (complex [cur-remainder get-remainder
-            :when (seq cur-remainder)
-            first-subproduct subrule
-            rest-subproducts (rep* subrule)]
-    (cons first-subproduct rest-subproducts)))
+  (complex [first-product subrule, rest-products (rep* subrule)]
+    (vec (cons first-product rest-products))))
+  ; See note at rep*.
+;  (complex [cur-remainder get-remainder
+;            :when (seq cur-remainder)
+;            first-subproduct subrule
+;            rest-subproducts (rep* subrule)]
+;    (cons first-subproduct rest-subproducts)))

 (defn except
   "Creates a rule that is the exception from the first given subrules with the second given


Fix netty by closing channels and merging go-loops

--- src/onyx/messaging/netty_tcp.clj
+++ src/onyx/messaging/netty_tcp.clj
@@ -215,45 +215,37 @@
                 (.handler (client-channel-initializer (new-client-handler))))]
         (.channel ^ChannelFuture (.connect b host port))))))

-(defn app [daemon parsed-ch inbound-ch release-ch retry-ch shutdown-ch]
+(defn app [daemon messenger buf-recv-ch inbound-ch release-ch retry-ch shutdown-ch]
   (go-loop []
-           (when-let [msg (first (alts!! [parsed-ch shutdown-ch]))]
-             (try
-               (let [t ^byte (:type msg)]
-                 (cond (= t protocol/messages-type-id)
-                       (doseq [message (:messages msg)]
-                         (>!! inbound-ch message))
-
-                       (= t protocol/ack-type-id)
-                       (acker/ack-message daemon
-                                          (:id msg)
-                                          (:completion-id msg)
-                                          (:ack-val msg))
-
-                       (= t protocol/completion-type-id)
-                       (>!! release-ch (:id msg))
-
-                       (= t protocol/retry-type-id)
-                       (>!! retry-ch (:id msg))
-
-                       :else
-                       (throw (ex-info "Unexpected message received from Netty" {:message msg}))))
-             (catch Exception e
-               (taoensso.timbre/error e)
-               (throw e))))
-           (recur)))
-
-(defn buf-recv-loop [messenger buf-recv-ch parsed-ch shutdown-ch]
-  (go-loop []
-           (when-let [buf (first (alts!! [buf-recv-ch shutdown-ch]))]
-             (try
-               (let [decompressed (protocol/read-buf (:decompress-f messenger) buf)]
-                 (>!! parsed-ch decompressed)
-                 ;; undo retain added in server handler
-                 (.release ^ByteBuf buf))
-               (catch Throwable t
-                 (timbre/fatal t "Exception in recv loop.")))
-             (recur))))
+          (let [[buf ch] (alts!! [buf-recv-ch shutdown-ch])]
+            (when buf
+              (try
+                (let [msg (protocol/read-buf (:decompress-f messenger) buf)]
+                  ;; undo retain added in server handler
+                  (.release ^ByteBuf buf)
+                  (let [t ^byte (:type msg)]
+                    (cond (= t protocol/messages-type-id)
+                          (doseq [message (:messages msg)]
+                            (>!! inbound-ch message))
+
+                          (= t protocol/ack-type-id)
+                          (acker/ack-message daemon
+                                             (:id msg)
+                                             (:completion-id msg)
+                                             (:ack-val msg))
+
+                          (= t protocol/completion-type-id)
+                          (>!! release-ch (:id msg))
+
+                          (= t protocol/retry-type-id)
+                          (>!! retry-ch (:id msg))
+
+                          :else
+                          (throw (ex-info "Unexpected message received from Netty" {:message msg})))))
+                (catch Exception e
+                  (taoensso.timbre/error e)
+                  (throw e)))
+              (recur)))))

 (defrecord NettyTcpSockets [peer-group]
   component/Lifecycle
@@ -284,10 +276,9 @@
     (taoensso.timbre/info "Stopping Netty TCP Sockets")
     (try
       (when-let [rs @resources]
-        (let [{:keys [shutdown-fn shutdown-ch parsed-ch]} rs]
-          (shutdown-fn)
-          (close! parsed-ch)
-          (close! shutdown-ch))
+        (let [{:keys [shutdown-fn shutdown-ch]} rs]
+          (close! shutdown-ch)
+          (shutdown-fn))
         (reset! resources nil))
       (catch Exception e (timbre/fatal e)))
     (assoc component :bind-addr nil :external-addr nil
@@ -305,7 +296,6 @@
 (defmethod extensions/open-peer-site NettyTcpSockets
   [messenger assigned]
   (let [buf-recv-ch (chan 10000)
-        parsed-ch (chan (clojure.core.async/dropping-buffer 10000))
         inbound-ch (:inbound-ch (:messenger-buffer messenger))
         release-ch (:release-ch messenger)
         retry-ch (:retry-ch messenger)
@@ -316,15 +306,12 @@
                                         (:netty/port assigned)
                                         buf-recv-ch)
         shutdown-ch (chan 1)
-        buf-loop (buf-recv-loop messenger buf-recv-ch parsed-ch shutdown-ch)
-        app-loop (app daemon parsed-ch inbound-ch release-ch retry-ch shutdown-ch)]
+        app-loop (app daemon messenger buf-recv-ch inbound-ch release-ch retry-ch shutdown-ch)]
     (reset! (:resources messenger)
             {:shutdown-fn shutdown-fn
              :shutdown-ch shutdown-ch
              :buf-recv-ch buf-recv-ch
-             :buf-loop buf-loop
-             :app-loop app-loop
-             :parsed-ch parsed-ch})))
+             :app-loop app-loop})))

 (defmethod extensions/connect-to-peer NettyTcpSockets
   [messenger event {:keys [netty/external-addr netty/port]}]


Fix filter.

Fix filter.

--- src/onyx/peer/task_lifecycle.clj
+++ src/onyx/peer/task_lifecycle.clj
@@ -217,7 +217,7 @@
       (>!! outbox-ch entry))))

 (defn only-relevant-branches [flow task]
-  (filter #(= (:flow/from (:name task)) %) flow task))
+  (filter #(= (:flow/from (:name task)) %) flow))

 (defn compile-flow-conditions [flow-conditions task-name]
   (let [conditions (only-relevant-branches flow-conditions task-name)]


works on existing also

works on existing also

--- integration/dda/pallet/crate/dda_servertest_crate/instantiate_existing.clj
+++ integration/dda/pallet/crate/dda_servertest_crate/instantiate_existing.clj
@@ -30,7 +30,8 @@
   {:login "jem"
    :password "test1234"})

-(def domain-config {:file {:root-sth {:path "/root"
+(def domain-config {:netstat {:sshd {:port "22"}}
+                    :file {:root-sth {:path "/root"
                                       :exist? true}
                            :etc {:path "/etc"
                                  :exist? true}


Task lifecycle should check for seal. This prevents the peer from continuing to message which has been causing aeron crashes in offer. It makes logical sense to me to check for seal in the lifecycle, however a review is definitely required!

--- src/onyx/peer/task_lifecycle.clj
+++ src/onyx/peer/task_lifecycle.clj
@@ -267,9 +267,9 @@
 (defn compile-fc-exs [flow-conditions task-name]
   (compile-flow-conditions flow-conditions task-name :flow/thrown-exception?))

-(defn run-task-lifecycle [init-event kill-ch ex-f]
+(defn run-task-lifecycle [init-event seal-ch kill-ch ex-f]
   (try
-    (while (first (alts!! [kill-ch] :default true))
+    (while (first (alts!! [seal-ch kill-ch] :default true))
       (-> init-event
           (inject-batch-resources)
           (read-batch)
@@ -353,7 +353,7 @@
         (release-messages! messenger pipeline-data)
         (thread (forward-completion-calls! pipeline-data completion-ch))
         (listen-for-sealer job-id task-id pipeline-data seal-resp-ch outbox-ch)
-        (thread (run-task-lifecycle pipeline-data kill-ch ex-f))
+        (thread (run-task-lifecycle pipeline-data seal-resp-ch kill-ch ex-f))

         (assoc component :pipeline-data pipeline-data :seal-ch seal-resp-ch))
       (catch Exception e
@@ -417,3 +417,5 @@
   (fn [{:keys [onyx.core/id onyx.core/lifecycle-id]}]
     (taoensso.timbre/trace (format "[%s / %s] Closed batch plugin resources" id lifecycle-id))))

+
+


CMR-1351: Adds check for nil gran-end in validation

This fixes a bug in which a nil granule end datetime could results
in a failed validation. A nil end datetime should mean the granule
has no end datetime, i.e., it never ends.

--- umm-lib/src/cmr/umm/validation/granule.clj
+++ umm-lib/src/cmr/umm/validation/granule.clj
@@ -143,6 +143,8 @@
   ;; Anything other than this should result in an error:
   ;; timeline: ---coll-start---gran-start---gran-end---coll-end--->
   ;; with no granule end date: ---coll-start---gran-start---coll-end--->
+  ;; NOTE: nil values for coll-end or gran-end are considered to be infinitely
+  ;; far in the future
   (cond
     (t/before? gran-start coll-start)
     (format "Granule start date [%s] is earlier than collection start date [%s]."
@@ -156,7 +158,7 @@
     (format "Granule end date [%s] is later than collection end date [%s]."
             gran-end coll-end)

-    (t/after? gran-start gran-end)
+    (and gran-end (t/after? gran-start gran-end))
     (format "Granule start date [%s] is later than granule end date [%s]."
             gran-start gran-end)))


removed accidental debug output

removed accidental debug output

--- src/io/sarnowski/swagger1st/core.clj
+++ src/io/sarnowski/swagger1st/core.clj
@@ -40,25 +40,20 @@
   "Resolves a $ref reference to its content."
   [r d]
   (let [path (rest (string/split r #"/"))]
-    (log/info "getting data from path" path)
     (get-in d path)))

 (defn- denormalize-refs
   "Searches for $ref objects and replaces those with their target."
   [definition]
-  (walk/postwalk (fn [element]
-                   (if (map? element)
-                     (do
-                       (log/info "element IS MAP:" element)
-                       (if-let [r (get element "$ref")]
-                         (do
-                           (log/info "found ref" element)
-                           (get-definition r definition))
-                         element))
-                     (do
-                       (log/info "element is not a map:" element)
-                       element)))
-                 definition))
+  (let [check-ref (fn [element]
+                    (if-let [r (get element "$ref")]
+                      (get-definition r definition)
+                      element))]
+    (walk/postwalk (fn [element]
+                     (if (map? element)
+                       (check-ref element)
+                       element))
+                   definition)))

 (defn- inherit-map
   "Merges a map from parent to definition, overwriting keys with definition."


Fix repl namespace name in lein-template.

--- lein-template/src/main/leiningen/new/aviary.clj
+++ lein-template/src/main/leiningen/new/aviary.clj
@@ -33,8 +33,8 @@
              [".hgignore" (render "hgignore" data)]
              [".gitignore" (render "gitignore" data)]
              ["project.clj" (render "project.clj" data)]
-             ["src/dev/{{path}}/dev.clj" (render "src/dev/aviary/repl.clj" data)]
-             ["src/dev/{{path}}/dev.cljs" (render "src/dev/aviary/repl.cljs" data)]
+             ["src/dev/{{path}}/repl.clj" (render "src/dev/aviary/repl.clj" data)]
+             ["src/dev/{{path}}/repl.cljs" (render "src/dev/aviary/repl.cljs" data)]
              ["src/main/{{path}}/site.clj" (render "src/main/aviary/site.clj" data)]
              ["src/main/{{path}}/styles.clj" (render "src/main/aviary/styles.clj" data)]
              ["src/main/{{path}}/markup.clj" (render "src/main/aviary/markup.clj" data)]


CMR-2911: Addressing code review comments.

--- system-int-test/test/cmr/system_int_test/search/collection_sorting_search_test.clj
+++ system-int-test/test/cmr/system_int_test/search/collection_sorting_search_test.clj
@@ -263,20 +263,25 @@
     (index/wait-until-indexed)

     (testing "Keyword searching is by score"
-     (is (d/refs-match-order? [coll2 coll3 coll1] (search/find-refs :collection {:keyword "wood"}))))
+      (is (d/refs-match-order? [coll2 coll3 coll1] (search/find-refs :collection {:keyword "wood"})))
+      (testing "Adding in other parameters still sorts by score"
+        (is (d/refs-match-order?
+             [coll2 coll3 coll1]
+             (search/find-refs :collection {:keyword "wood"
+                                            :platform "wood"})))))

     (testing "Everything else should default to entry title"
-     (are [params]
-       (d/refs-match-order? [coll1 coll2 coll3] (search/find-refs :collection params))
-       {:platform "wood"}
-       {:instrument "wood"}
-       {:sensor "wood"}
-       {:science-keywords {"0" {:any "wood"}}}
-       {:project "wood"}
-       {:two-d-coordinate-system-name "wood"}
-       {:processing-level-id "wood"}
-       {:data-center "wood"}
-       {:archive-center "wood"}))))
+      (are [params]
+        (d/refs-match-order? [coll1 coll2 coll3] (search/find-refs :collection params))
+        {:platform "wood"}
+        {:instrument "wood"}
+        {:sensor "wood"}
+        {:science-keywords {"0" {:any "wood"}}}
+        {:project "wood"}
+        {:two-d-coordinate-system-name "wood"}
+        {:processing-level-id "wood"}
+        {:data-center "wood"}
+        {:archive-center "wood"}))))

 (deftest multiple-sort-key-test
   (let [c1 (make-coll "PROV1" "et10" 10 nil)


Fix enabling/disabling custom buttons

Fix enabling/disabling custom buttons

--- src/net/sekao/nightcode/builders.clj
+++ src/net/sekao/nightcode/builders.clj
@@ -127,7 +127,7 @@
     (.executeScript (format "setTextSize(%s)" (:text-size pref-state)))))

 (def ^:const ids [:.run :.build :.run-with-repl :.reload-file :.reload-selection :.clean :.stop])
-(def ^:const disable-when-running [:.run :.build :.run-with-repl :.clean])
+(def ^:const disable-when-running [:.run :.build :.run-with-repl :.clean :#tasks])
 (def ^:const disable-when-not-running [:.reload-file :.reload-selection :.stop])
 (def ^:const custom-task-ids [:.run :.build])


:pencil2: Fix typo

:pencil2: Fix typo

--- backend/src/uxbox/services/users.clj
+++ backend/src/uxbox/services/users.clj
@@ -161,7 +161,7 @@
                 :code ::username-already-exists))))

 (defn- register-user
-  "Create the user entry onthe database with limited input
+  "Create the user entry on the database with limited input
   filling all the other fields with defaults."
   [conn {:keys [username fullname email password] :as params}]
   (check-user-registred! conn params)


Update figwheel.clj

Update figwheel.clj

--- scripts/figwheel.clj
+++ scripts/figwheel.clj
@@ -16,10 +16,8 @@
                 :asset-path "js"
                 :parallel-build false
                 :optimizations :none
-                ;; :closure-defines {"uxbox.repo.core.url"
-                ;;                   "https://test.uxbox.io/api"}
                 :closure-defines {"uxbox.repo.core.url"
-                                  "http://localhost:6060/api"}
+                                  "https://test.uxbox.io/api"}
                 :warnings {:ns-var-clash false}
                 :pretty-print true
                 :language-in  :ecmascript5


* benchmark/cljs/benchmark_runner.cljs: add PHM specific benchmarks

--- benchmark/cljs/benchmark_runner.cljs
+++ benchmark/cljs/benchmark_runner.cljs
@@ -79,6 +79,16 @@
                       (recur (inc i) (assoc m :foo 2))
                       m))
                   1)
+(println ";;; persistent hash maps")
+(def pmap (into cljs.core.PersistentHashMap/EMPTY
+            [[:a 0] [:b 1] [:c 2] [:d 3] [:e 4] [:f 5] [:g 6] [:h 7]
+             [:i 8] [:j 9] [:k 10] [:l 11] [:m 12] [:n 13] [:o 14] [:p 15]
+             [:q 16] [:r 17] [:s 18] [:t 19] [:u 20] [:v 21] [:w 22] [:x 23]
+             [:y 24] [:z 25] [:a0 26] [:b0 27] [:c0 28] [:d0 29] [:e0 30] [:f0 31]]))
+(simple-benchmark [coll pmap] (:f0 coll) 100000)
+(simple-benchmark [coll pmap] (get coll :f0) 100000)
+(simple-benchmark [coll pmap] (-lookup coll :f0 nil) 100000)
+(simple-benchmark [coll pmap] (assoc coll :g0 32) 100000)
 (println)

 (println ";;; seq ops")


add apply benchmarks, demonstrate that list construction is horribly slow and apply to construct list is worse.

--- benchmark/cljs/benchmark_runner.cljs
+++ benchmark/cljs/benchmark_runner.cljs
@@ -80,6 +80,8 @@

 (println ";; apply")
 (simple-benchmark [coll (into [] (range 1000000))] (apply + coll) 1)
+(simple-benchmark [] (list 1 2 3 4 5) 100000)
+(simple-benchmark [xs (seq [1 2 3 4 5])] (apply list xs) 100000)
 (println)

 (println ";;; obj-map")
@@ -98,11 +100,6 @@
 (simple-benchmark [coll (array-map :foo :bar :baz :woz :lol :rofl)] (-lookup coll :lol) 1000000)
 (println)
 (def data-atom (atom {:x 0}))
-
-(println ";;; small map in atom")
-(simple-benchmark [coll (atom {:x 0})] (swap! coll update-in [:x] inc) 100000)
-(simple-benchmark [coll (atom (array-map :x 0))] (swap! coll update-in [:x] inc) 100000)
-(println)

 (println ";;; map / record ops")
 (simple-benchmark [coll {:foo 1 :bar 2}] (get coll :foo) 1000000)


[CS] Fix loading of empty CSVs

[CS] Fix loading of empty CSVs

--- src/vip/data_processor/db/sqlite.clj
+++ src/vip/data_processor/db/sqlite.clj
@@ -80,4 +80,5 @@

 (defn bulk-import [rows table]
   (doseq [chunk (chunk-rows rows statement-parameter-limit)]
-    (korma/insert table (korma/values chunk))))
+    (when-not (empty? chunk)
+      (korma/insert table (korma/values chunk)))))


removed uneeded libs

removed uneeded libs

--- support/src/cljs_livereload/core.clj
+++ support/src/cljs_livereload/core.clj
@@ -7,8 +7,6 @@
    [watchtower.core :as wt :refer [watcher compile-watcher watcher* rate ignore-dotfiles file-filter extensions on-change]]
    [clojure.core.async :refer [go-loop <!! chan put! sliding-buffer timeout map< mult tap close!]]
    [clojure.string :as string]
-   [digest :as digest]
-   [clojure.java.io :refer [as-file]]
    [fs.core :as fs]))

 (defn setup-file-change-sender [{:keys [file-change-atom compile-wait-time] :as server-state}


Added 4 tests containing 17 assertions.

Added 4 tests containing 17 assertions.

--- test/clinvar_submitter/form_test.clj
+++ test/clinvar_submitter/form_test.clj
@@ -24,6 +24,14 @@
 (def summary "The following criteria were met: PM2, PP3, PP2, PP1, PS4")
 (def rules ["PM2" "PP3" "PP2" "PP1" "PS4"])
 (def pmid-citations "PMID:15358028, PMID:15858117, PMID:21511876, PMID:23396983, PMID:24510615")
+(def v (ld/ld1-> t i "variant" "relatedContextualAllele" (ld/prop= t true "preferred")))
+(def variantIdentifier "http://reg.genome.network/allele/CA012832")
+(def altDesignations "")
+(def refseq "NC_000014.9")
+(def start "23424148")
+(def stop "23424148")
+(def ref "T")
+(def alt "C")

 (deftest test-get-interpretation
@@ -49,5 +57,17 @@
   (is (= pmid-citations (form/evidence-pmid-citations t e)))
   (print :summary summary "\n":rules rules "\n":pmid-citations pmid-citations"\n")
   (print "---------------------------------------------------------\n")))
+
+(deftest test-get-variant
+  (testing "If variants are retrieved correctly"
+  (is (= variantIdentifier (form/variant-identifier v)))
+  (is (= altDesignations (form/variant-alt-designations v)))
+  (is (= refseq (form/variant-refseq t v)))
+  (is (= start (form/variant-start t v)))
+  (is (= stop (form/variant-stop t v)))
+  (is (= ref (form/variant-ref t v)))
+  (is (= alt (form/variant-alt v)))
+  (print :variantIdentifier variantIdentifier "\n":altDesignations altDesignations "\n":refseq refseq"\n")
+  (print "---------------------------------------------------------\n")))

 (run-tests)


compare is same as phase-2

compare is same as phase-2

--- Jobs/rnaseq-compare-job-template.clj
+++ Jobs/rnaseq-compare-job-template.clj
@@ -1,10 +1,10 @@

 {:nodes
- {:comp
-  {:name "gen-feature-counts",
+ {:ph2
+  {:name "rnaseq-phase2",
    :type "tool",
    :args []}
   :prn1 {:type "func",
          :name "prn"}},
  :edges
- {:comp [:prn1]}}
+ {:ph2 [:prn1]}}


Small fix on a test.

Small fix on a test.

--- test/cljs/replumb/repl_test.cljs
+++ test/cljs/replumb/repl_test.cljs
@@ -154,6 +154,6 @@
       (is (= 1 (count @results)) "Evaluating an undefined symbol should return one message only")
       (is (not (success? (first @results))) "Evaluating an undefined symbol should not succeed")
       (is (valid-eval-error? (unwrap-result (first @results))) "Evaluating an undefined symbol should result in an js/Error")
-      (is #(re-find #"undeclared Var.*_arsenununpa42" (unwrap-result (first @results))) "Evaluating an undefined symbol should")
+      (is (re-find #"undeclared Var.*_arsenununpa42" (extract-message (unwrap-result (first @results)))) "Evaluating an undefined symbol should")
       (reset! results [])
       (repl/reset-env!))))


fixed tests, pushin

fixed tests, pushin

--- test/hivewing_core/hive_test.clj
+++ test/hivewing_core/hive_test.clj
@@ -20,10 +20,10 @@
 (deftest create-a-hive-with-specific-uuid
   (let [beekeeper-uuid (:uuid (beekeeper-create {:email "my_email@example.com"}))
         apiary-uuid    (:uuid (apiary-create {:beekeeper_uuid beekeeper-uuid}))
-        uuid            "12345678-1234-1234-1234-123456789012"
+        uuid           #uuid "12345678-1234-1234-1234-123456789012"
         hive-result    (hive-create {:uuid uuid :apiary_uuid apiary-uuid})
         hive-retrieval (hive-get (:uuid hive-result))]
-      (is (= uuid (:uuid hive-result)))
+      (is (= (str uuid) (str (:uuid hive-result))))
       ))

 (deftest create-a-hive


text change

text change

--- src/name_bazaar/ui/pages/offering_detail_page.cljs
+++ src/name_bazaar/ui/pages/offering_detail_page.cljs
@@ -177,7 +177,7 @@
               :floated "right"}
              [share-buttons
               {:url @(subscribe [:page-share-url :route.offerings/detail {:offering/address address}])
-               :title (str "I'm offering " (:offering/name offering) " on NameBazaar")}]]]]
+               :title (str "Check out offering for " (:offering/name offering) " on NameBazaar")}]]]]
           (if offering-loaded?
             [offering-detail]
             [:div.padded [content-placeholder]])]


Toggles a survey's features in the map.

Toggles a survey's features in the map.

--- src/pasmo_gigi/geo/ui/navigation/nav_handlers.cljs
+++ src/pasmo_gigi/geo/ui/navigation/nav_handlers.cljs
@@ -6,7 +6,7 @@
   (:require-macros [cljs.core.async.macros :refer [go]]))

 (def app-state {:surveys        []
-                :survey-details []
+                :survey-details {:type "FeatureCollection" :features []}
                 :rendered-map?  false})

@@ -18,12 +18,6 @@
                        (map #(assoc % :css "collection-item")))]
       (dispatch [:received-surveys surveys]))))

-(defn validate-geojson
-  [coords]
-  (go
-    (let [resp (<! (http/post "http://geojsonlint.com/validate" {:json-params coords}))]
-      (.log js/console "validate: " (clj->js resp)))))
-
 (defn fetch-survey-details
   [survey]
   (go
@@ -31,12 +25,53 @@
           month (:month survey)
           url   (str "/api/survey-details?year=" year "&month=" month)
           resp  (<! (http/get url {"accept" "application/json"}))]
-      (dispatch [:received-survey-deatils (:body resp)]))))
+      (dispatch [:received-survey-deatils (get-in resp [:body :features])]))))

+(defn remove-coords
+  [coords coord-to-remove]
+  (remove (fn [coord]
+            (= (get-in coord [:survey :id]) (:_id coord-to-remove)))
+          coords))
+
+
+(defn find-updated-surveys
+  "Finds surveys that have been updated and toggles its
+  css class.
+  If a survey matches the year and month, but it
+  is not 'active', then an xhr request is made
+  to fetch that survey's features; and an `active`
+  css class is attached to it. If the survey is `active`, then
+  the css class `active` is removed from it."
+  [surveys year month]
+  (map (fn [survey]
+         (if (and (= year (:year survey))
+                  (= month (:month survey)))
+           (if (= "collection-item active" (:css survey))
+             (assoc survey :css "collection-item")
+             (do (fetch-survey-details survey)
+                 (assoc survey :css "collection-item active")))
+           survey))
+       surveys))
+
+(defn get-final-features
+  "Removes all features for the surveys that are `unselected`.
+  The survey's css is not changed yet, and it is active, so we
+  need to check for that and the survey's year and month to determine
+  which feature to remove."
+  [{:keys [surveys features year month]}]
+  (reduce (fn [acc survey]
+            (if (and (= year (:year survey))
+                     (= month (:month survey))
+                     (= "collection-item active" (:css survey)))
+              (remove-coords acc survey)
+              acc))
+          features
+          surveys))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;; Handlers
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
 (register-handler
  :initialize-db
  (fn [_ _]
@@ -51,22 +86,22 @@
 (register-handler
  :fetch-survey-details
  (fn [app-db [_ survey]]
-   (let [updated-surveys (map (fn [it]
-                                (let [year  (:year survey)
-                                      month (:month survey)]
-                                  (if (and (= year (:year it)) (= month (:month it)))
-                                    (if (= "collection-item active" (:css it))
-                                      (assoc it :css "collection-item")
-                                      (do
-                                        (fetch-survey-details survey)
-                                        (assoc it :css "collection-item active")))
-                                    (assoc it :css "collection-item"))))
-                              (:surveys app-db))]
-
-     (assoc app-db :surveys updated-surveys))))
+   (let [year            (:year survey)
+         month           (:month survey)
+         surveys         (:surveys app-db)
+         features        (get-in app-db [:survey-details :features])
+         updated-surveys (find-updated-surveys surveys year month)
+         final-features  (get-final-features {:year year :month month :features features :surveys surveys})]
+     (map-coords final-features)
+     (-> app-db
+         (assoc-in [:survey-details :features] final-features)
+         (assoc :surveys updated-surveys)))))

 (register-handler
  :received-survey-deatils
- (fn [app-db [_ details]]
-   (map-coords details)
-   (assoc app-db :survey-details details)))
+ (fn [app-db [_ features]]
+   (let [geo-json (concat (get-in app-db [:survey-details :features]) features)]
+     (map-coords geo-json)
+     (assoc-in app-db
+                [:survey-details :features]
+                geo-json))))


Removed space

Removed space

--- theladbible/src/theladbible/core.clj
+++ theladbible/src/theladbible/core.clj
@@ -3,4 +3,4 @@
 (defn -main
   "Just a thing."
   [x]
-  (println x " with love, The LAD Bible dev team x"))
+  (println x "with love, The LAD Bible dev team x"))


Clean up channel handling code

Clean up channel handling code

--- frontend/core.cljs
+++ frontend/core.cljs
@@ -24,7 +24,7 @@
             [frontend.utils :as utils :refer [mlog merror third]]
             [secretary.core :as sec])
   (:require-macros [cljs.core.async.macros :as am :refer [go go-loop alt!]]
-                   [frontend.utils :refer [inspect timing]])
+                   [frontend.utils :refer [inspect timing swallow-errors]])
   (:use-macros [dommy.macros :only [node sel sel1]]))

 (enable-console-print!)
@@ -80,6 +80,43 @@
                   :mouse-up {:ch mouse-up-ch
                              :mult (async/mult mouse-up-ch)}})))

+(defn controls-handler
+  [value state container]
+  (when true (:log-channels? utils/initial-query-map)
+        (mlog "Controls Verbose: " value))
+  (swallow-errors
+   (let [previous-state @state]
+     (swap! state (partial controls-con/control-event container (first value) (second value)))
+     (controls-pcon/post-control-event! container (first value) (second value) previous-state @state))))
+
+(defn nav-handler
+  [value state history]
+  (when true (:log-channels? utils/initial-query-map)
+        (mlog "Navigation Verbose: " value))
+  (swallow-errors
+   (let [previous-state @state]
+     (swap! state (partial nav-con/navigated-to history (first value) (second value)))
+     (nav-pcon/post-navigated-to! history (first value) (second value) previous-state @state))))
+
+(defn api-handler
+  [value state container]
+  (when true (:log-channels? utils/initial-query-map)
+        (mlog "API Verbose: " (first value) (second value) (utils/third value)))
+  (swallow-errors
+    (let [previous-state @state]
+      (swap! state (partial api-con/api-event container (first value) (second value) (utils/third value)))
+      (api-pcon/post-api-event! container (first value) (second value) (utils/third value) previous-state @state))))
+
+(defn ws-handler
+  [value state pusher]
+  (when true (:log-channels? utils/initial-query-map)
+        (mlog "websocket Verbose: " (pr-str (first value)) (second value) (utils/third value)))
+  (swallow-errors
+    (let [previous-state @state]
+      ;; XXX: should these take the container like the rest of the controllers?
+      (swap! state (partial ws-con/ws-event pusher (first value) (second value)))
+      (ws-pcon/post-ws-event! pusher (first value) (second value) previous-state @state))))
+
 (defn main [state top-level-node]
   (let [comms       (:comms @state)
         target-name "app"
@@ -96,51 +133,10 @@
       :opts {:comms comms}})
     (go (while true
           (alt!
-           (:controls comms) ([v]
-                                (when true (:log-channels? utils/initial-query-map)
-                                      (mlog "Controls Verbose: " v))
-                                (try
-                                  (let [previous-state @state]
-                                    (swap! state (partial controls-con/control-event container (first v) (second v)))
-                                    (controls-pcon/post-control-event! container (first v) (second v) previous-state @state))
-                                  (catch js/Error e
-                                    (merror e)
-                                    (when (:rethrow-errors? utils/initial-query-map)
-                                      (throw e)))))
-           (:nav comms) ([v]
-                           (when true (:log-channels? utils/initial-query-map)
-                                 (mlog "Navigation Verbose: " v))
-                           (try
-                             (let [previous-state @state]
-                               (swap! state (partial nav-con/navigated-to history-imp (first v) (second v)))
-                               (nav-pcon/post-navigated-to! history-imp (first v) (second v) previous-state @state))
-                             (catch js/Error e
-                               (merror e)
-                               (when (:rethrow-errors? utils/initial-query-map)
-                                 (throw e)))))
-           (:api comms) ([v]
-                           (when true (:log-channels? utils/initial-query-map)
-                                 (mlog "API Verbose: " (first v) (second v) (drop 2 v)))
-                           (try
-                             (let [previous-state @state]
-                               (swap! state (partial api-con/api-event container (first v) (second v) (utils/third v)))
-                               (api-pcon/post-api-event! container (first v) (second v) (utils/third v) previous-state @state))
-                             (catch js/Error e
-                               (merror e)
-                               (when (:rethrow-errors? utils/initial-query-map)
-                                 (throw e)))))
-           (:ws comms) ([v]
-                           (when true (:log-channels? utils/initial-query-map)
-                                 (mlog "websocket Verbose: " (pr-str (first v)) (second v) (drop 2 v)))
-                           (try
-                             (let [previous-state @state]
-                               ;; XXX: should these take the container like the rest of the controllers?
-                               (swap! state (partial ws-con/ws-event pusher-imp (first v) (second v)))
-                               (ws-pcon/post-ws-event! pusher-imp (first v) (second v) previous-state @state))
-                             (catch js/Error e
-                               (merror e)
-                               (when (:rethrow-errors? utils/initial-query-map)
-                                 (throw e)))))
+           (:controls comms) #(controls-handler % state container)
+           (:nav comms) #(nav-handler % state history-imp)
+           (:api comms) #(api-handler % state container)
+           (:ws comms) #(ws-handler % state pusher-imp)
            ;; Capture the current history for playback in the absence
            ;; of a server to store it
            (async/timeout 10000) (do (print "TODO: print out history: ")))))))


Fix broken test.

Fix broken test.

--- test/berry/lexical_analysis/error_handler_test.clj
+++ test/berry/lexical_analysis/error_handler_test.clj
@@ -16,5 +16,5 @@

   (testing "enclosed-string"

-    (is (thrown-with-msg? java.text.ParseException #"Enclosed string starting at line 2, column 10"
+    (is (thrown-with-msg? java.text.ParseException #"Unclosed string starting at line 2, column 10."
                           (unclosed-string {:current-line 2 :current-column 10 :offset 50})))))