set canvas node on mount

set canvas node on mount

--- src/cellf/core.cljs
+++ src/cellf/core.cljs
@@ -473,7 +473,9 @@
       owner]
    (reify
      om/IDidMount
-     (did-mount [_]
+     (did-mount
+       [_]
+       (swap! app-state assoc :canvas-node (om/get-node owner canvas-ref))
        (when (.getItem js/localStorage ls-key)
          (swap! app-state assoc :previous-grant? true)
          (get-camera! true))


CMR-6499: Change ESRI shapefile processing to be more generic

--- search-app/src/cmr/search/services/parameters/converters/shapefile.clj
+++ search-app/src/cmr/search/services/parameters/converters/shapefile.clj
@@ -216,32 +216,13 @@
           data-store (FileDataStoreFinder/getDataStore shp-file)
           feature-source (.getFeatureSource data-store)
           features (.getFeatures feature-source)
-          feature-count (error-if (.size features)
-                                  #(< % 1)
-                                  "Shapefile has no features"
-                                  temp-dir)
-          _ (error-if feature-count
-                      #(> % (max-shapefile-features))
-                      (format "Shapefile feature count [%d] exceeds the %d feature limit"
-                              feature-count
-                              (max-shapefile-features))
-                      nil)
-          _ (debug (format "Found [%d] features" feature-count))
-          iterator (.features features)]
+          iterator (.features features)
+          feature-list (ArrayList.)]
       (try
-        (loop [conditions [] total-point-count 0]
-          (if (.hasNext iterator)
-            (let [feature (.next iterator)
-                  [feature-conditions num-points] (feature->conditions feature {:boundary-winding :cw})
-                  new-point-count (+ total-point-count num-points)]
-              (when (> new-point-count (max-shapefile-points))
-                (errors/throw-service-error :bad-request
-                                            (format "Number of points in shapefile exceeds the limit of %d"
-                                                    (max-shapefile-points))))
-              (if (> (count feature-conditions) 0)
-                (recur (conj conditions (gc/or-conds feature-conditions)) new-point-count)
-                (recur conditions total-point-count)))
-            conditions))
+        (while (.hasNext iterator)
+          (let [feature (.next iterator)]
+            (.add feature-list feature)))
+        (features->conditions feature-list mt/shapefile)
         (finally
           (.close iterator)
           (-> data-store .getFeatureReader .close)


Add assertion for build id

Add assertion for build id

--- sidecar/src/figwheel_sidecar/auto_builder.clj
+++ sidecar/src/figwheel_sidecar/auto_builder.clj
@@ -80,6 +80,7 @@
 ;; connection

 (defn connect-script-temp-dir [build]
+  (assert (:id build) (str "Following build needs an id: " build))
   (str "target/figwheel_temp/" (name (:id build))))

 (defn connect-script-path [build]


Adding an update-in on device-list-item to fix the JS error

--- src-cljs/kixi/hecuba/web/chart.cljs
+++ src-cljs/kixi/hecuba/web/chart.cljs
@@ -77,10 +77,10 @@
           selected        (= device-id (first (:selected cursor)))]
       (apply dom/input #js {:className (when selected "selected")
                             :type "checkbox"
-                            :onClick
+                            :onClick
                             (fn [e]
                               (.log js/console "Clicked")
-                              (om/update! cursor [:selected] (fn [selected] (vector device-id))))}
+                              (om/update! cursor update-in [:selected] (fn [selected] (vector device-id))))}
             device-name)))))

 ;;;;;;;;;; Component 2: Chart UI ;;;;;;;;;;


Make prod mode the default for noir

Make prod mode the default for noir

--- src/engulf/core.clj
+++ src/engulf/core.clj
@@ -9,7 +9,7 @@
 (defn start-webserver [args]
   (nr-server/load-views "src/engulf/views")

-  (let [mode (keyword (or (first args) :dev))
+  (let [mode (keyword (or (first args) :prod))
           port (Integer. (get (System/getenv) "PORT" "3000"))
           noir-handler (nr-server/gen-handler {:mode mode})]
       (start-http-server


always use ssl

always use ssl

--- src/goodbot/bot.clj
+++ src/goodbot/bot.clj
@@ -39,6 +39,7 @@
   (dosync (alter bot assoc
                  :prefixes {}
                  :datomic-uri datomic-uri
+                 :ssl? true
                  :plugins plugins)
           (println "connecting to datomic at" datomic-uri))
   (db/start bot)


remove unnecessary println statement

remove unnecessary println statement

--- docs/sc-book/sc-one.clj
+++ docs/sc-book/sc-one.clj
@@ -737,7 +737,6 @@
                                 amps  (repeatedly num-res #(ranged-rand 0.3 0.9))
                                 rings (repeatedly num-res #(ranged-rand 1 4))
                                 specs [freqs amps rings]
-                                _ (println specs)
                                 pan (softclip (* 2 (lf-noise1:kr (ranged-rand 3 6))))]
                             (pan2 (klank specs (* 0.03 (dust (/ 1 6)) ))
                                   pan)))]


placeholder: function naming in Clojure

placeholder: function naming in Clojure

--- clojure/lazy_seq_again.clj
+++ clojure/lazy_seq_again.clj
@@ -47,17 +47,17 @@
         [dx dy] (if should-turn [(- dy) dx] [dx dy])]
     (make-spiral-memory memory (+ x dx) (+ y dy) dx dy)))

-(defn write-squares
+(defn spiralize
   ([]
-   (write-squares (make-spiral-memory)))
+   (spiralize (make-spiral-memory)))
   ([spiral-memory]
-   (lazy-seq (cons spiral-memory (write-squares (write (walk spiral-memory)))))))
+   (lazy-seq (cons spiral-memory (spiralize (write (walk spiral-memory)))))))

 (defn get-square-value [{memory :memory square :square}] (get memory square))

-(println (take 50 (map get-square-value (write-squares))))
+(println (take 50 (map get-square-value (spiralize))))

-(def after-747 (first (for [{memory :memory square :square} (write-squares)
+(def after-747 (first (for [{memory :memory square :square} (spiralize)
                             :when (> (get memory square) 747)]
                         (get memory square))))


CMR-4681: Cosmetic change

CMR-4681: Cosmetic change

--- search-app/src/cmr/search/services/query_execution/facets/granule_v2_facets.clj
+++ search-app/src/cmr/search/services/query_execution/facets/granule_v2_facets.clj
@@ -28,10 +28,10 @@
   expensive aggregation queries that would have to run against more than one granule index."
   [context]
   (let [collection-ids (:query-collection-ids context)
-        cnt (count collection-ids)]
-    (when-not (= 1 (count collection-ids))
+        collection-count (count collection-ids)]
+    (when-not (= 1 collection-count)
       [(str "Granule V2 facets are limited to a single collection, but query matched "
-            (if (zero? cnt) "an undetermined number of" cnt)
+            (if (zero? collection-count) "an undetermined number of" collection-count)
             " collections.")])))

 (def validations


supporting running specific classes

supporting running specific classes

--- src/celestial/puppet_standalone.clj
+++ src/celestial/puppet_standalone.clj
@@ -82,8 +82,12 @@
       )))

-(defmethod pconstruct :puppet-std [{:keys [run-opts] :as type} {:keys [machine env] :as spec}]
-  (let [remote {:host (machine :ip) :user (or (machine :user) "root")}
-        by-env (get-in type [:puppet-std env])
-        with-opts (update-in by-env [:args] (fn [a] (concat a ((or run-opts {}) :args))))]
-    (Standalone. remote (assoc with-opts :hostname (machine :hostname)))))
+(defmethod pconstruct :puppet-std
+  [{:keys [run-opts] :as type :or {run-opts {}}} {:keys [machine env] :as spec}]
+  (let [remote {:host (machine :ip) :user (or (machine :user) "root")}]
+    (Standalone. remote
+      (-> (get-in type [:puppet-std env])
+        (update-in [:args] (fn [a] (concat a (run-opts :args))))
+        (merge (select-keys run-opts [:classes]))
+        (assoc :hostname (machine :hostname))
+        ))))


removed douplicate def

removed douplicate def

--- main/src/dda/pallet/dda_managed_ide/app.clj
+++ main/src/dda/pallet/dda_managed_ide/app.clj
@@ -30,8 +30,6 @@
    [dda.pallet.dda-managed-ide.domain :as domain]))

 (def with-dda-ide infra/with-dda-ide)
-
-(def DdaIdeDomainConfig domain/DdaIdeDomainConfig)

 (def DdaIdeDomainConfig domain/DdaIdeDomainConfig)


CMR-5493: Prefix schema-validation-lib with cmr.

--- schema-validation-lib/project.clj
+++ schema-validation-lib/project.clj
@@ -1,4 +1,4 @@
-(defproject nasa-cmr/schema-validation-lib "0.1.0-SNAPSHOT"
+(defproject nasa-cmr/cmr-schema-validation-lib "0.1.0-SNAPSHOT"
   :description "Provides json schema validation code"
   :url "https://github.com/nasa/Common-Metadata-Repository/tree/master/schema-validation-lib"
   :plugins [[lein-exec "0.3.7"]


Make options argument optional

Make options argument optional

--- src/cljs/asciinema_player/core.cljs
+++ src/cljs/asciinema_player/core.cljs
@@ -303,10 +303,11 @@

 (defn ^:export CreatePlayer
   "JavaScript API for creating the player, delegating to create-player."
-  [dom-node width height frames-url duration options]
-  (let [options (-> options
-                    (js->clj :keywordize-keys true)
-                    (rename-keys {:autoPlay :auto-play :fontSize :font-size}))]
-    (create-player dom-node width height frames-url duration options)))
+  ([dom-node width height frames-url duration] (CreatePlayer dom-node width height frames-url duration {}))
+  ([dom-node width height frames-url duration options]
+   (let [options (-> options
+                     (js->clj :keywordize-keys true)
+                     (rename-keys {:autoPlay :auto-play :fontSize :font-size}))]
+     (create-player dom-node width height frames-url duration options))))

 (enable-console-print!)


Remove backspace behavior

Remove backspace behavior

--- src/clojure/paredit_widget/core.clj
+++ src/clojure/paredit_widget/core.clj
@@ -61,7 +61,6 @@
    [nil "]"] :paredit-close-square
    [nil "{"] :paredit-open-curly
    [nil "}"] :paredit-close-curly
-   [nil "Backspace"] :paredit-backward-delete
    [nil "\""] :paredit-doublequote ;; \"
    ["C" "9"] :paredit-backward-slurp-sexp
    ["C" "0"] :paredit-forward-slurp-sexp
@@ -76,8 +75,7 @@
    ["M" "Right"] :paredit-expand-right})

 (def ^:const advanced-alternative-keymap
-  {[nil "⌫"] :paredit-backward-delete
-   ["C" "Open Bracket"] :paredit-backward-barf-sexp
+  {["C" "Open Bracket"] :paredit-backward-barf-sexp
    ["C" "Close Bracket"] :paredit-forward-barf-sexp
    ["M" "←"] :paredit-expand-left
    ["M" "→"] :paredit-expand-right})


Random serve on click

Random serve on click

--- src-cljs/pong/core.cljs
+++ src-cljs/pong/core.cljs
@@ -9,7 +9,12 @@
 (enable-console-print!)

 ;; Globals ----------------------------------------------------------
-(def canvas-size {:w 646 :h 400})
+(def canvas-size
+  (let [[w h] [646 400]]
+    {:w w
+     :h h
+     :hw (/ w 2)
+     :hh (/ h 2)}))

 (def paddle-offset 12)

@@ -19,10 +24,7 @@
 (def ball-size (* 0.04 (:w canvas-size)))

 (def init-paddle-y
-  "Start the paddles centered vertically."
-  (let [scr-half-y    (/ (:h canvas-size) 2)
-        paddle-half-y (/ (:h paddle-size) 2)]
-    (- scr-half-y paddle-half-y)))
+  (- (:hh canvas-size) (/ (:h paddle-size) 2)))

 (def colours {:bg     "#699D32"
               :paddle "#2A7E77"
@@ -50,10 +52,14 @@
                  update-fn
                  (partial draw-rect (:paddle colours))))

-(defn center-ball [{:keys [h w] :as ball} {canvas-w :w canvas-h :h}]
-  (-> ball
-      (assoc :x (- (/ canvas-w 2) (/ w 2)))
-      (assoc :y (- (/ canvas-h 2) (/ h 2)))))
+(defn center-on [[x y] {:keys [w h] :as obj}]
+  (-> obj
+      (assoc :x (- x (/ w 2)))
+      (assoc :y (- y (/ w 2)))))
+
+(defn center-ball [ball {:keys [hw hh]}]
+  (center-on [hw hh] ball))
+

 (defn client->canvas-coords
   "Transforms mouse coords from client space to canvas space.
@@ -77,13 +83,25 @@
                  nil
                  (partial draw-rect (:bg colours))))

+(defn update-ball [event world-state ent]
+  (let [{:keys [vx vy w h]} (:value ent)]
+    (-> ent
+        (update-in [:value :x] (fn [old-x]
+                                 (clamp (+ old-x vx) 0
+                                        (- (:w canvas-size) w))))
+        (update-in [:value :y] (fn [old-y]
+                                 (clamp (+ old-y vy) 0
+                                        (- (:h canvas-size) h)))))))
+
 (def ball
-  (let [ball-dim {:x 0
-                  :y 0
-                  :w ball-size
-                  :h ball-size}]
+  (let [ball-dim {:x  0
+                  :y  0
+                  :w  ball-size
+                  :h  ball-size
+                  :vx 0
+                  :vy 0}]
     (canvas/entity (center-ball ball-dim canvas-size)
-                   nil
+                   update-ball
                    (partial draw-rect (:ball colours)))))

 (defn update-player-paddle
@@ -121,6 +139,14 @@
   (assoc world-state
     :mouse-coords (client->canvas-coords canvas (client-coords event))))

+(defn serve-ball
+  "Serve the ball if it is not already in play."
+  [event world-state]
+  (assoc-in world-state [:entities 3 :value :vx]
+            (if (even? (rand-int 50))
+              1
+              -1)))
+
 (defn render-scene
   "Loop over the entities calling each ones draw fn."
   [ctx world-state]
@@ -141,7 +167,8 @@
       :initial-state {:entities     [background player-paddle ai-paddle ball]
                       :mouse-coords [0 0]}

-      :on-tick      update-state
-      :on-mousemove (partial update-mouse-coords canvas)
-      :event-target canvas
-      :to-draw      (partial render-scene ctx)))))
+      :on-tick       update-state
+      :on-mousemove  (partial update-mouse-coords canvas)
+      :on-click      serve-ball
+      :event-target  canvas
+      :to-draw       (partial render-scene ctx)))))


use remove rather than filter

use remove rather than filter

--- test/digitalocean_expect/test.clj
+++ test/digitalocean_expect/test.clj
@@ -40,15 +40,15 @@
 ; only use prescribed sizes
 (expect 0
   (count
-    (filter (complement large?)
-      (filter (complement medium?)
-        (filter (complement small?) (map :size_id nodes))))))
+    (remove large?
+      (remove medium?
+        (remove small? (map :size_id nodes))))))

 ; only use prescribed regions
 (expect 0
   (count
-    (filter (complement london?)
-      (filter (complement sf?) (map :region_id nodes)))))
+    (remove london?
+      (remove sf? (map :region_id nodes)))))

 ; no more than 2 large nodes
 (expect (< (count (filter large? (map :size_id nodes))) 2))


Remove oAuth providers from gateway form (for now)

--- src/braid/client/gateway/user_auth/views.cljs
+++ src/braid/client/gateway/user_auth/views.cljs
@@ -41,8 +41,9 @@
                   }]]
         (when (= :invalid @status)
           [:div.error-message (first @errors)])
-        [:p "Or, log in with: "
-         [auth-providers-view]]]])))
+        ; TODO
+        #_[:p "Or, log in with: "
+           [auth-providers-view]]]])))

 (defn returning-password-field-view []
   (let [field-id :gateway.user-auth/password
@@ -214,7 +215,8 @@
                                  (dispatch [:gateway/update-value field-id value])))}]]
         (when (= :invalid @status)
           [:div.error-message (first @errors)])
-        [:p "Or, register with: "
+        ; TODO
+        #_[:p "Or, register with: "
          [auth-providers-view]]]])))

 (defn register-button-view []


Improvements to Twitter API adapter

Improvements to Twitter API adapter

Record rates of different status codes lifted from the twitter api
documentation.

If we get a rate limit then wait until it has been lifted and then
repeat request.

Allow requesters to be killed in between requests.

--- src/clj/com/beardandcode/twitter_news/api.clj
+++ src/clj/com/beardandcode/twitter_news/api.clj
@@ -5,10 +5,12 @@
            [org.apache.http.util EntityUtils]
            [com.twitter.hbc.httpclient.auth OAuth1])
   (:require [clojure.core.async :as async]
+            [clojure.tools.logging :as log]
             [cheshire.core :as json]
             [com.stuartsierra.component :as component]
             [metrics.core :refer [new-registry]]
             [metrics.meters :refer [mark! meter]]
+            [metrics.timers :refer [timer time!]]
             [throttler.core :refer [throttle-chan]]
             [com.beardandcode.twitter-news.stats :as stats]))

@@ -26,34 +28,64 @@
       (.signRequest auth request nil)
       request)))

-(defn- execute->json [request]
+;; from the twitter api documentation
+(def all-statuses [200 304 400 401 403 404 406 410 420 422 429 500 502 503 504])
+
+(defn- execute->json [request status-meters]
+  (log/infof "Requesting from %s" (.toString request))
   (let [response (.execute (HttpClients/createDefault) request)
+        status-code (.getStatusCode (.getStatusLine response))
         body-string (EntityUtils/toString (.getEntity response) "UTF-8")]
     (.close response)
-    (json/parse-string body-string)))
+    (if-let [meter (status-meters status-code)] (mark! meter))
+    (if (= status-code 429)
+      (let [limit-cleared-ms (-> response
+                                 (.getHeaders "X-Rate-Limit-Reset")
+                                 first (.getValue) Long/parseLong (* 1000))
+            until-cleared-ms (- limit-cleared-ms (System/currentTimeMillis))]
+        (log/infof "Rate was limited, clearing at %d so we are waiting for %dms"
+                  limit-cleared-ms until-cleared-ms)
+        (if (> until-cleared-ms 0) (async/<! (async/timeout until-cleared-ms)))
+        (execute->json request status-meters))
+      (json/parse-string body-string))))

 (defn- throttled-requester [name metrics-registry auth request-fn num per-period]
   (let [request-chan (async/chan (stats/buffer (str name ".waiting") 100 metrics-registry))
         throttled-chan (throttle-chan request-chan num per-period)
-        request-rate (meter metrics-registry (str name ".rate"))]
+        control-chan (async/chan)
+        request-rate (meter metrics-registry (str name ".rate"))
+        response-timer (timer metrics-registry (str name ".response-time"))
+        status-meters (reduce #(assoc %1 %2 (meter metrics-registry (str name ".status." %2)))
+                              {} all-statuses)]
+    (log/infof "Requester[%s] starting" name)
     (async/go-loop []
-      (let [{:keys [params out-chan]} (async/<! throttled-chan)]
-        (async/>! out-chan (execute->json (request-fn auth params)))
-        (async/close! out-chan)
-        (mark! request-rate)
-        (recur)))
-    (fn [params]
-      (let [out-chan (async/chan)]
-        (async/go (async/>! request-chan {:params params :out-chan out-chan}))
-        out-chan))))
+      (let [[v ch] (async/alts! [throttled-chan control-chan])]
+        (if (= ch throttled-chan)
+          (let [{:keys [params out-chan]} v]
+            (async/>! out-chan (time! response-timer
+                                      (execute->json (request-fn auth params) status-meters)))
+            (async/close! out-chan)
+            (mark! request-rate)
+            (recur))
+          (log/infof "Requester[%s] stopping" name))))
+    (fn
+      ([] (async/>!! control-chan :kill))
+      ([params]
+       (let [out-chan (async/chan)]
+         (async/go (async/>! request-chan {:params params :out-chan out-chan}))
+         out-chan)))))

 (defn- all-tweets-from [requester user]
   (let [out-chan (async/chan)]
     (async/go-loop [response (async/<! (requester {"screen_name" user "count" 200}))]
       (if (> (count response) 0)
         (let [lowest-id (->> response
-                             (map #(get % "id_str"))
-                             (map #(Long/parseLong %))
+                             (map #(if-let [id (get % "id_str")]
+                                     id
+                                     (do (println %) "0")))
+                             (map #(try
+                                     (Long/parseLong %)
+                                     (catch Exception e (println %) (.printStackTrace e))))
                              sort first)]
           (doseq [tweet response] (async/>! out-chan tweet))
           (recur (async/<! (requester {"screen_name" user "count" 200 "max_id" (dec lowest-id)}))))
@@ -77,7 +109,9 @@
                                         auth (get-request base-url "/favorites/list.json") 1 :minute)))))
   (stop [client]
     (if (not tweets-requester) client
-        (dissoc client :metrics-registry :tweets-requester :favourites-requester)))
+        (do (tweets-requester)
+            (favourites-requester)
+            (dissoc client :metrics-registry :tweets-requester :favourites-requester))))

   TwitterClient
   (tweets [_ user]


Rollbacking df53ed09209827c822153450b47ce425f621775f serviceAliases change on service edit page

--- src/cljs/swarmpit/component/service/edit.cljs
+++ src/cljs/swarmpit/component/service/edit.cljs
@@ -58,7 +58,7 @@
     {:on-success
      (fn [networks]
        (state/set-value (->> networks
-                             (map #(select-keys % [:networkName]))
+                             (map #(select-keys % [:networkName :serviceAliases]))
                              (into [])) networks/cursor))}))

 (defn- update-service-handler


show update status in status section instead of separate one

--- src/cljs/swarmpit/component/service/list.cljs
+++ src/cljs/swarmpit/component/service/list.cljs
@@ -21,14 +21,12 @@
               {:name  "Replicas"
                :width "10%"}
               {:name  "Status"
-               :width "15%"}
-              {:name  "Update"
-               :width "15%"}])
+               :width "30%"}])

 (def render-item-keys
-  [[:serviceName] [:repository :image] [:mode] [:status :info] [:state] [:status :message]])
+  [[:serviceName] [:repository :image] [:mode] [:status :info] [:state]])

-(defn- render-item-status-message [value]
+(defn- render-item-update-state [value]
   (if (some? value)
     (comp/label-update value)))

@@ -39,12 +37,15 @@
     "partly running" (comp/label-yellow value)))

 (defn- render-item
-  [item _]
-  (let [value (val item)]
+  [item service]
+  (let [update (get-in service [:status :message])
+        value (val item)]
     (case (key item)
-      :state (render-item-state value)
+      :state (html [:span
+                    [:span (render-item-state value)]
+                    [:span " "]
+                    [:span (render-item-update-state update)]])
       :info (comp/label-info value)
-      :message (render-item-status-message value)
       value)))

 (defn- onclick-handler


Fix javascript game template

Fix javascript game template

--- src/clojure/leiningen/new/game_javascript.clj
+++ src/clojure/leiningen/new/game_javascript.clj
@@ -14,6 +14,6 @@
                ["README.md" (render "README.md" data)]
                [".gitignore" (render "gitignore" data)]
                ["src/{{path}}.clj" (render "server.clj" data)]
-               ["resources/public/index.html" "index.html"]
-               ["resources/public/main.js" "main.js"]
-               ["resources/public/phaser.min.js" "phaser.min.js"])))
+               ["resources/public/index.html" (render "index.html")]
+               ["resources/public/main.js" (render "main.js")]
+               ["resources/public/phaser.min.js" (render "phaser.min.js")])))


Improved view-vctr and view-ge docstrings.

--- src/clojure/uncomplicate/neanderthal/core.clj
+++ src/clojure/uncomplicate/neanderthal/core.clj
@@ -161,7 +161,7 @@
    (vctr factory (cons x xs))))

 (defn view-vctr
-  "Attach a dense vector to the raw data of `x`.
+  "Attach a dense vector to the raw data of `x`, with optional stride multiplicator `stride-mult`.

   Changes to the resulting object affect the source `x`, even the parts of data that might not
   be accessible by `x`. Use with caution!
@@ -218,7 +218,7 @@
    (ge factory (.mrows a) (.ncols a) a nil)))

 (defn view-ge
-  "Attach a GE matrix to the raw data of `a`.
+  "Attach a GE matrix to the raw data of `a`, with optional stride multiplicator.

   Changes to the resulting object affect the source `a`, even the parts of data that might not
   be accessible by a. Use with caution!


Fix off-by-one error and convert to vectors in knock-off-chip-off-the-old-block

--- src/clojush/pushgp/selection/preselection.clj
+++ src/clojush/pushgp/selection/preselection.clj
@@ -105,11 +105,11 @@
               (if (or subset? single?)
                 (let [all (shuffle (range (count (first (:history (first pop))))))
                       keepers (cons (first all)
-                                    (if single? [] (take (rand (count all)) all)))]
+                                    (if single? [] (take (rand (count all)) (rest all))))]
                   (fn [ind]
-                    (map (fn [errs]
-                           (for [i keepers] (nth errs i)))
-                         (:history ind))))
+                    (mapv (fn [errs]
+                           (vec (for [i keepers] (nth errs i)))
+                         (:history ind)))))
                 :history)
               diffs (first knock-spec)
               outof (second knock-spec)


Support uuid on js stringify

Support uuid on js stringify

--- src/com/wsscode/pathom/graphql.cljc
+++ src/com/wsscode/pathom/graphql.cljc
@@ -20,7 +20,8 @@
        first))

 (defn stringify [x]
-  #?(:clj  (json/write-str x)
+  #?(:clj  (json/write-str (cond-> x
+                             (uuid? x) str))
      :cljs (js/JSON.stringify (clj->js x))))

 (defn params->graphql


Delete bootstrap test - not a feature anymore.

--- test/onyx/peer/bootstrap_test.clj
+++ test/onyx/peer/bootstrap_test.clj
@@ -1,77 +0,0 @@
-(ns onyx.peer.bootstrap-test
-  (:require [com.stuartsierra.component :as component]
-            [onyx.system :refer [onyx-development-env]]
-            [midje.sweet :refer :all]
-            [onyx.queue.hornetq-utils :as hq-util]
-            [onyx.peer.task-lifecycle-extensions :as l-ext]
-            [onyx.peer.pipeline-extensions :as p-ext]
-            [onyx.api]))
-
-(def id (java.util.UUID/randomUUID))
-
-(def config (load-config))
-
-(def env-config (assoc (:env-config config) :onyx/id id))
-
-(def peer-config
-  (assoc (:peer-config config)
-    :onyx/id id
-    :onyx.peer/job-scheduler :onyx.job-scheduler/balanced))
-
-(def env (onyx.api/start-env env-config))
-
-(def peer-group (onyx.api/start-peer-group peer-config))
-
-(def out-queue (str (java.util.UUID/randomUUID)))
-
-(defn my-inc [{:keys [n] :as segment}]
-  (assoc segment :n (inc n)))
-
-(def workflow {:in-bootstrapped {:inc :out}})
-
-(def id (str (java.util.UUID/randomUUID)))
-
-(hq-util/create-queue! hq-config out-queue)
-
-(defmethod p-ext/apply-fn [:input :onyx-memory-test-plugin]
-  [event] {:onyx.core/results [{:n 42}]})
-
-(def catalog
-  [{:onyx/name :in-bootstrapped
-    :onyx/type :input
-    :onyx/medium :onyx-memory-test-plugin
-    :onyx/bootstrap? true
-    :onyx/batch-size 2}
-
-   {:onyx/name :inc
-    :onyx/fn :onyx.peer.bootstrap-test/my-inc
-    :onyx/type :function
-    :onyx/batch-size 5}
-
-   {:onyx/name :out
-    :onyx/ident :hornetq/write-segments
-    :onyx/type :output
-    :onyx/medium :hornetq
-    :hornetq/queue-name out-queue
-    :hornetq/host (:host (:non-clustered (:hornetq config)))
-    :hornetq/port (:port (:non-clustered (:hornetq config)))
-    :onyx/batch-size 5}])
-
-(def v-peers (onyx.api/start-peers! 1 peer-group))
-
-(onyx.api/submit-job
- peer-config
- {:catalog catalog :workflow workflow
-  :task-scheduler :onyx.task-scheduler/balanced})
-
-(def results (hq-util/consume-queue! hq-config out-queue 1))
-
-(doseq [v-peer v-peers]
-  (onyx.api/shutdown-peer v-peer))
-
-(onyx.api/shutdown-peer-group peer-group)
-
-(onyx.api/shutdown-env env)
-
-(fact results => [{:n 43} :done])
-


Start to add tests for monitor

Start to add tests for monitor

--- test/reagenttest/testmonitor.cljs
+++ test/reagenttest/testmonitor.cljs
@@ -45,12 +45,12 @@
   (let [runs (running)
         start (rv/atom 0)
         c3-count (rv/atom 0)
-        c1 (reaction @start 1)
-        c2 (reaction @start)
+        c1f (fn [] @start 1)
+        c2f (fn [] @start)
         c3 (rv/make-reaction
             (fn []
               (swap! c3-count inc)
-              (+ @c1 @c2))
+              (+ @(monitor c1f) @(monitor c2f)))
             :auto-run true)]
     (is (= @c3-count 0))
     (is (= @c3 1))
@@ -64,22 +64,11 @@

 (deftest test-from-reflex
   (let [runs (running)]
-    (let [!counter (rv/atom 0)
-          !signal (rv/atom "All I do is change")
-          co (run!
-              ;;when I change...
-              @!signal
-              ;;update the counter
-              (swap! !counter inc))]
-      (is (= 1 @!counter) "Constraint run on init")
-      (reset! !signal "foo")
-      (is (= 2 @!counter)
-          "Counter auto updated")
-      (dispose co))
     (let [!x (rv/atom 0)
-          !co (rv/make-reaction #(inc @!x) :auto-run true)]
-      (is (= 1 @!co) "CO has correct value on first deref")
-      (swap! !x inc)
+          f #(inc @!x)
+          !co (run! @(monitor f))]
+      (is (= 1 @!co) "CO has correct value on first deref")
+      (swap! !x inc)
       (is (= 2 @!co) "CO auto-updates")
       (dispose !co))
     (is (= runs (running)))))
@@ -89,42 +78,42 @@
   (dotimes [x testite]
     (let [runs (running)
           a (rv/atom 0)
-          a1 (reaction (inc @a))
-          a2 (reaction @a)
+          af (fn [x] (+ @a x))
+          a1 (monitor af 1)
+          a2 (monitor af 0)
           b-changed (rv/atom 0)
           c-changed (rv/atom 0)
-          b (reaction
-             (swap! b-changed inc)
-             (inc @a1))
-          c (reaction
-             (swap! c-changed inc)
-             (+ 10 @a2))
+          mf (fn [v x spy]
+               (swap! spy inc)
+               (+ @v x))
           res (run!
-               (if (< @a2 1) @b @c))]
+               (if (< @a2 1)
+                 @(monitor mf a1 1 b-changed)
+                 @(monitor mf a2 10 c-changed)))]
       (is (= @res (+ 2 @a)))
       (is (= @b-changed 1))
       (is (= @c-changed 0))
-
+
       (reset! a -1)
       (is (= @res (+ 2 @a)))
       (is (= @b-changed 2))
       (is (= @c-changed 0))
-
+
       (reset! a 2)
       (is (= @res (+ 10 @a)))
       (is (<= 2 @b-changed 3))
       (is (= @c-changed 1))
-
+
       (reset! a 3)
       (is (= @res (+ 10 @a)))
       (is (<= 2 @b-changed 3))
       (is (= @c-changed 2))
-
+
       (reset! a 3)
       (is (= @res (+ 10 @a)))
       (is (<= 2 @b-changed 3))
       (is (= @c-changed 2))
-
+
       (reset! a -1)
       (is (= @res (+ 2 @a)))
       (dispose res)


Added more comments.

Added more comments.

--- system-int-test/test/cmr/system_int_test/ingest/ops_collections_translation_test.clj
+++ system-int-test/test/cmr/system_int_test/ingest/ops_collections_translation_test.clj
@@ -28,60 +28,9 @@

 (def skipped-collections
   "A set of collection concept-ids that will be skipped."
-  #{"C1214613964-SCIOPS" ;;Temporal_Coverage Start_Date is 0000-07-01
-    "C1214603044-SCIOPS" ;;Online_Resource is not a valid value for 'anyURI'
+  #{;; The following collections have invalid Temporal_Coverage date
+    "C1214613964-SCIOPS" ;;Temporal_Coverage Start_Date is 0000-07-01
     "C1215196994-NOAA_NCEI" ;;Temporal_Coverage Start_Date is 0000-01-01
-
-    ;; The following ASF collections all failed with similar spatial validation errors:
-    ;; <errors><error><path>SpatialCoverage/Geometries/0</path><errors><error>Spatial validation error: The shape contained duplicate points. Points 1 [lon=-83.8365106476704 lat=10.2523150519645] and 17 [lon=-83.8365106476704 lat=10.2523150519645] were considered equivalent or very close.</error></errors></error></errors>
-    ;; CMR-2330
-    ; "C1214421256-ASF"
-    ; "C1214447436-ASF"
-    ; "C1214447971-ASF"
-    ; "C1214435173-ASF"
-    ; "C1214435382-ASF"
-    ; "C1214435672-ASF"
-    ; "C1214435901-ASF"
-    ; "C1214434814-ASF"
-    ; "C1214434985-ASF"
-    ; "C1214439292-ASF"
-    ; "C1214445358-ASF"
-    ; "C1214421468-ASF"
-    ; "C1214434220-ASF"
-    ; "C1214449277-ASF"
-    ; "C1214450717-ASF"
-    ; "C179001728-ASF"
-    ; "C1213921626-ASF"
-    ; "C1213921661-ASF"
-    ; "C1213928843-ASF"
-    ; "C1213927035-ASF"
-    ; "C179001730-ASF"
-    ; "C1213925022-ASF"
-    ; "C1213926419-ASF"
-    ; "C1213926777-ASF"
-    ; "C1213927939-ASF"
-    ; "C1213928209-ASF"
-
-    ;; The following collections failed ingest validation, but not xml schema validation.
-    ;; I have changed the validation from ingest validation to xml validation, so we don't need to skip them now.
-    ; "C4695156-LARC_ASDC" ;; iso-smap tiling validation not in umm-lib
-    ; "C5520300-LARC_ASDC" ;; iso-smap tiling validation not in umm-lib
-    ; "C7244490-LARC_ASDC" ;; iso-smap tiling validation not in umm-lib
-    ; "C1000000240-LARC_ASDC" ;; iso-smap tiling validation not in umm-lib
-    ; "C5511253-LARC_ASDC" ;; iso-smap tiling validation not in umm-lib
-    ; "C7146790-LARC_ASDC" ;; iso-smap tiling validation not in umm-lib
-    ; "C7271330-LARC_ASDC" ;; iso-smap tiling validation not in umm-lib
-    ; "C1000000260-LARC_ASDC" ;; iso-smap tiling validation not in umm-lib
-    ; "C5920490-LARC_ASDC" ;; iso-smap tiling validation not in umm-lib
-    ; "C5784291-LARC_ASDC" ;; iso-smap tiling validation not in umm-lib
-    ; "C7092790-LARC_ASDC" ;; iso-smap tiling validation not in umm-lib
-    ; "C4695163-LARC_ASDC" ;; iso-smap tiling validation not in umm-lib
-    ; "C5784292-LARC_ASDC" ;; iso-smap tiling validation not in umm-lib
-    ; "C7299610-LARC_ASDC" ;; iso-smap tiling validation not in umm-lib
-    ; "C1000000300-LARC_ASDC" ;; iso-smap tiling validation not in umm-lib
-    ; "C5862870-LARC_ASDC" ;; iso-smap tiling validation not in umm-lib
-    ; "C5784310-LARC_ASDC" ;; iso-smap tiling validation not in umm-lib
-
     "C1214603072-SCIOPS" ;;The value '<http://www.bioone.org/doi/abs/10.1672/0277-5212%282006%2926%5B528%3AACFEAW%5D2.0.CO%3B2?journalCode=wetl>' of element 'Online_Resource' is not valid.
     "C1214613924-SCIOPS" ;;'0000-01-01T00:00:00.000Z' is not a valid value of union type 'DateOrTimeOrEnumType'
     "C1215196702-NOAA_NCEI" ;;Line 192 - cvc-datatype-valid.1.2.3: '0000-01-01T00:00:00.000Z' is not a valid value of union type 'DateOrTimeOrEnumType'.
@@ -103,6 +52,8 @@
     "C1214613961-SCIOPS" ;;Line 53 - cvc-datatype-valid.1.2.3: '0000-01-01T00:00:00.000Z' is not a valid value of union type 'DateOrTimeOrEnumType'.
     "C1215196984-NOAA_NCEI" ;;Line 53 - cvc-datatype-valid.1.2.3: '0000-01-01T00:00:00.000Z' is not a valid value of union type 'DateOrTimeOrEnumType'.

+    ;; The following collections have invalid URL data
+    "C1214603044-SCIOPS" ;;Online_Resource is not a valid value for 'anyURI'
     "C1214603622-SCIOPS" ;;'<http://sofia.usgs.gov/projects/remote_sens/sflsatmap.html>' is not a valid value for 'anyURI'
     "C1214603943-SCIOPS" ;;Line 208 - cvc-datatype-valid.1.2.1: '<http://sofia.usgs.gov/publications/papers/uranium_and_sulfur/>' is not a valid value for 'anyURI'.
     "C1214603330-SCIOPS" ;;Line 132 - cvc-datatype-valid.1.2.1: '<http://fresc.usgs.gov/products/ProductDetails.aspx?ProductNumber=1267>' is not a valid value for 'anyURI'.
@@ -112,6 +63,31 @@
     "C1214595389-SCIOPS" ;;Line 108 - cvc-datatype-valid.1.2.1: 'IPY  http://ipy.antarcticanz.govt.nz/projects/southern-victoria-land-geology/' is not a valid value for 'anyURI'.
     "C1214608487-SCIOPS" ;;Line 303 - cvc-datatype-valid.1.2.1: 'Scanned images: http://atlas.gc.ca/site/english/maps/archives' is not a valid value for 'anyURI'.
     "C1214603723-SCIOPS" ;;Line 132 - cvc-datatype-valid.1.2.1: '<http://sofia.usgs.gov/projects/workplans12/jem.html>' is not a valid value for 'anyURI'.
+
+    ;; The following collections failed ingest validation, but not xml schema validation.
+    ;; I have changed the validation from ingest validation to xml validation, so we don't
+    ;; need to skip them now.
+    ;; All these collections failed ingest validation due to discrepancy between umm-lib and
+    ;; umm-spec-lib. i.e. the iso-smap tiling is not supported in umm-lib. We have decided to push
+    ;; this off until later. It will become obsolete once we switch to umm-spec-lib for ingest
+    ;; validation. See CMR-1869.
+    ; "C4695156-LARC_ASDC"
+    ; "C5520300-LARC_ASDC"
+    ; "C7244490-LARC_ASDC"
+    ; "C1000000240-LARC_ASDC"
+    ; "C5511253-LARC_ASDC"
+    ; "C7146790-LARC_ASDC"
+    ; "C7271330-LARC_ASDC"
+    ; "C1000000260-LARC_ASDC"
+    ; "C5920490-LARC_ASDC"
+    ; "C5784291-LARC_ASDC"
+    ; "C7092790-LARC_ASDC"
+    ; "C4695163-LARC_ASDC"
+    ; "C5784292-LARC_ASDC"
+    ; "C7299610-LARC_ASDC"
+    ; "C1000000300-LARC_ASDC"
+    ; "C5862870-LARC_ASDC"
+    ; "C5784310-LARC_ASDC"

     })

@@ -194,7 +170,7 @@
           (info "Translating collections on page-num: " page-num)
           (doseq [coll colls]
             (verify-translation-via-schema-validation coll))
-            ; (verify-translation-via-ingest-validation coll))
+          ; (verify-translation-via-ingest-validation coll))
           (when (>= (count colls) search-page-size)
             (recur (+ page-num 1)))))
       (info "Finished OPS collections translation.")


CMR-2920 another comment i missed

CMR-2920 another comment i missed

--- mock-echo-app/src/cmr/mock_echo/api/urs.clj
+++ mock-echo-app/src/cmr/mock_echo/api/urs.clj
@@ -166,10 +166,4 @@
         (context "/:username" [username]
           (GET "/" {:keys [request-context] :as request}
             (assert-urs-basic-auth-info request)
-            (get-user request-context username))))
-
-      (context "/oauth" []
-        (GET "/authorize" {params :query-params}
-          (let [redirect-uri (get params "redirect_uri")
-                state (get params "state")]
-            (rsp/redirect (str redirect-uri "?state=" state "&code=12345&username=User123"))))))))
+            (get-user request-context username)))))))


Extract command-sequence->input-str function

--- test/app/test/interactive.clj
+++ test/app/test/interactive.clj
@@ -2,6 +2,9 @@
   (:use [app.interactive]
         [conjure.core]
         [clojure.test]))
+
+(defn- command-sequence->input-str [command-sequence]
+  (clojure.string/join "\r" command-sequence))

 (deftest can-quit
   (let [input-command "quit\r"]
@@ -14,7 +17,7 @@

 (deftest shows-help
   (let [command-sequence ["help" "quit"]
-        input-string (clojure.string/join "\r" command-sequence)]
+        input-string (command-sequence->input-str command-sequence)]
     (with-in-str
       input-string
       (mocking [println print flush]
@@ -24,7 +27,7 @@

 (deftest list-shows-error-if-no-classes-loaded
   (let [command-sequence ["list" "quit"]
-        input-string (clojure.string/join "\r" command-sequence)]
+        input-string (command-sequence->input-str command-sequence)]
     (with-in-str
       input-string
       (mocking [println print flush]


Add testcase for chaining handlers on by-method routing directive.

--- test/catacumba/core_tests.clj
+++ test/catacumba/core_tests.clj
@@ -263,16 +263,19 @@
           (is (= (:status response2) 200))))))

   (testing "Chaining handlers by request method"
-    (let [handler1 (fn [ctx] "from get")
+    (let [p (promise)
+          handler1 (fn [ctx] "from get")
           handler2 (fn [ctx] "from post")
+          handler3 (fn [ctx] (deliver p true) (ct/delegate))
           router (ct/routes [[:prefix "foo"
                               [:by-method
-                               {:get handler1
+                               {:get [handler3 handler1]
                                 :post handler2}]]])]
       (with-server {:handler router}
         (let [response (client/get (str base-url "/foo"))]
           (is (= (:body response) "from get"))
-          (is (= (:status response) 200)))
+          (is (= (:status response) 200))
+          (is (true? (deref p 1000 nil))))
         (let [response (client/post (str base-url "/foo"))]
           (is (= (:body response) "from post"))
           (is (= (:status response) 200))))))


Test run-dsl-query not assuming hardcoded 'x


bad namespace

bad namespace

--- test/er_cassandra/model/callbacks/search_key_callback_test.clj
+++ test/er_cassandra/model/callbacks/search_key_callback_test.clj
@@ -1,4 +1,4 @@
-(ns er-cassandra.model.search-key-callback-test
+(ns er-cassandra.model.callbacks.search-key-callback-test
   (:require
    [clojure.test :as test :refer [deftest is are]]
    [er-cassandra.model.callbacks.search-key-callback :as cb]))


Swapped local stylesheets & scripts for CDNd ones.

--- test/lambda_blog/fixtures.clj
+++ test/lambda_blog/fixtures.clj
@@ -12,8 +12,6 @@
            :brand "Test Blog"
            :favicon "media/favicon.png"
            :footer-contents "Some footer contents"
-           :footer-scripts ["js/bootstrap.min.js"
-                            "js/lambda-blog.js"]
            :logo "media/logo-main.png"
            :logo-button "media/logo-button.png"
            :navigation [["Static Page 1" "./static-1.html"]
@@ -24,11 +22,13 @@
                         ["Archives" "./archives.html"]]
            :output-dir "/out/"
            :root "localhost:8000"
-           :scripts ["js/jquery-1.11.0.min.js"
-                     "js/jquery.tablesorter.min.js"]
-           :stylesheets ["style/theme.css"
-                         "style/lambda-blog.css"
-                         "style/font-awesome.min.css"]
+           :scripts ["http://code.jquery.com/jquery-2.2.0.min.js"
+                     "js/jquery.tablesorter.min.js"
+                     "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"]
+           :stylesheets ["https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"
+                         "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css"
+                         "https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css"
+                         "style/lambda-blog.css"]
            :title "Test Blog"})

 (defn read-static-pages []
@@ -86,5 +86,4 @@
       (generate-all! :tags entries-by-tag)
       (copy-dir! "resources/media" "media")
       (copy-dir! "resources/style" "style")
-      (copy-dir! "resources/fonts" "fonts")
       (copy-dir! "resources/js" "js")))


Created a proper insert-wishlist (with code)

--- src/wishlistd/models/queries.clj
+++ src/wishlistd/models/queries.clj
@@ -22,31 +22,36 @@
 ;[:wishlist :int]
 ;["constraint fk_wish_wishlist foreign key(wishlist) references Wishlist(id) on delete cascade"])))

+
+;; CRUD
+
 (defn get-wishlist [{:keys [code]}] ; code is unique
   (sql/with-connection db
     (sql/with-query-results results
       ["select * from wishlist where code=?" code]
       (first (into [] results)))))

-(defn create-wishlist [wishlist]
-  (let [inserted (insert-wishlist wishlist) ; returns the wishlist
-        code (generate-code (:id inserted))] ; returns the code
-    (update-wishlist (assoc inserted :code code))))
+(defn update-wishlist [wishlist]
+  (let [{:keys [id]} wishlist]
+    (sql/with-connection db
+      (sql/update-values :wishlist ["id=?" id] wishlist))))

-(defn insert-wishlist [wishlist]
+(defn- helper-insert-wishlist [wishlist]
   (first
     (sql/with-connection db
       (sql/insert-records :wishlist wishlist))))
+
+(defn insert-wishlist [wishlist]
+  (let [inserted (helper-insert-wishlist wishlist) ; make wishlist
+        code (generate-code (:id inserted)) ; make code
+        finished (assoc inserted :code code)] ; add code to list
+    (update-wishlist finished)
+    (get-wishlist finished)))

 (defn delete-wishlist [{:keys [code]}] ; code is unique
   (first
     (sql/with-connection db
       (sql/delete-rows :wishlist ["code=?" code]))))
-
-(defn update-wishlist [wishlist]
-  (let [{:keys [id]} wishlist]
-    (sql/with-connection db
-      (sql/update-values :wishlist ["id=?" id] wishlist))))

 (defn get-wishes-for-wishlist [{:keys [id]}]
   (sql/with-connection db
@@ -71,4 +76,6 @@
 ;   (sql/with-connection db
 ;     (sql/with-query-results results
 ;       ["select last_value+1 as last_value from wishlist_id_seq"]
-;       (generate-code (:last_value (first (into [] results)))))))+;       (generate-code (:last_value (first (into [] results)))))))
+
+;; ADVANCED STUFF


Some more examples of split points

Some more examples of split points

--- src/edu/berkeley/ai/domains/hybrid_blocks.clj
+++ src/edu/berkeley/ai/domains/hybrid_blocks.clj
@@ -177,10 +177,10 @@

 (set! *warn-on-reflection* false)

-(defn animate-hb-seq [env action-names]
+(defn animate-hb-seq [env action-names delay-ms]
   (reduce (fn [s a]
 	    (visualize-hb-state s)
-	    (Thread/sleep 1000)
+	    (Thread/sleep delay-ms)
 	    (envs/safe-next-state s (hs/get-hs-action env a)))
 	  (envs/get-initial-state env) action-names))

@@ -222,6 +222,13 @@
 		  '[[get e d] [up-holding e 18] [right-holding e 11]])

   (map :name (first (a-star-graph-search (ss-node (make-hybrid-blocks-strips-env 6 2 [1 1] '[[a 1 1 2 1] [b 4 1 2 1]] '[[a [[b]]]] 1)))))
+
+  (map :name (first (a-star-graph-search (ss-node (make-hybrid-blocks-strips-env 6 2 [1 1] '[[a 1 1 2 1] [b 4 1 2 1]] '[[a [[b]]]])))))
+
+  (let [env (make-hybrid-blocks-strips-env 6 2 [1 1] '[[a 1 1 2 1] [b 4 1 2 1]] '[[a [[b]]]]) [as rew] (time (a-star-graph-search (ss-node env)))] (animate-hb-seq env (map :name as) 500) rew)
+
+ ; Suboptimal due to split points, optimal with discrete grid = 1
+ (let [env (make-hybrid-blocks-strips-env 10 4 [1 1] '[[a 1 3 6 1] [b 7 1 2 1 [[c 0 1 2 2]]]] '[[a [[b] [c]]]]) [as rew] (time (a-star-graph-search (ss-node env)))] (animate-hb-seq env (map :name as) 500) rew)
 )


Make sure the archive-url is correct even for 6-digit container-ids

the classic y2k problem

This will be correct as long as the container-ids do not have 7
digits, which will not happen "for another 100 years" according to
some sources on the internal irc channel

--- src/mdr2/repair.clj
+++ src/mdr2/repair.clj
@@ -53,10 +53,12 @@
 (defn archive-url
   "Return the url for an archived production given a `container-id`"
   [container-id]
-  (format "%s/0%s/%s/a0%s.tar" archive-web-root
-          (.substring container-id 0 1)
-          (.substring container-id 1 3)
-          container-id))
+  ;; zero pad the container-id so that it contains 6 digits
+  (let [padded-id (format "%06d" container-id)]
+    (format "%s/%s/%s/a%s.tar" archive-web-root
+            (.substring padded-id 0 2)
+            (.substring padded-id 2 4)
+            padded-id)))

 (defn container-id
   "Return a container-id given a `production` and optionally `sektion`
@@ -67,7 +69,7 @@
    (let [id (case sektion
               :master (prod/dam-number production)
               :dist-master (:library_signature production))]
-     (-> {:id id} production-id-to-archive-id first :id str))))
+     (-> {:id id} production-id-to-archive-id first :id))))

 (defn repair
   "Get a production from the archive and prepare it for repairing"


Create all dirs when repairing

Create all dirs when repairing

--- src/mdr2/repair.clj
+++ src/mdr2/repair.clj
@@ -62,6 +62,8 @@
       (let [dam-number (prod/dam-number production)
             tar-file (io/file (fs/tmpdir) (str dam-number ".tar"))
             tar-dir (io/file (fs/tmpdir) dam-number)]
+        ;; create all dirs for this production
+        (prod/create-dirs production)
         ;; copy tar to tmpdir
         (with-open [input (:body response)
                     output (io/output-stream tar-file)]


Pulling dream-date out into its own project

--- examples/dream_date.clj
+++ examples/dream_date.clj
@@ -1,102 +0,0 @@
-(ns dream-date
-  (:use [fogus.me.trammel :only [provide-contracts defconstrainedrecord
-                                 all-numbers? all-positive? defconstrainedfn]]))
-
-(def *canonical-days* [31 28 31 30 31 30 31 31 30 31 30 31])
-
-(defconstrainedrecord Date [year 1970 month 1 day 1]
-  [(every? number? [year month day])
-   (< month 13) (> month 0)
-   (< day 32) (> day 0)]
-
-  Object
-  (toString [this]
-    (str (:year this) "." (:month this) "." (:day this))))
-
-
-(defn leap-year?
-  [year]
-  (and (= (mod year 4) 0)
-       (not (some #{(mod year 400)}
-                  [100 200 300]))))
-
-(provide-contracts
- [leap-year? "Leap year calculation constraints"
-  [y] [number? pos?]])
-
-
-(defn gregorian-last-day-of-month
-  ([date] (gregorian-last-day-of-month (:month date) (:year date)))
-  ([month year]
-     (if (and (= month 2)
-              (leap-year? year))
-       29
-       (nth *canonical-days* (dec month)))))
-
-(provide-contracts
- [gregorian-last-day-of-month "Gregorian last day calculation constraints"
-  [d]   [map? :month :year => number? pos?]
-  [m y] [all-positive? => number? pos?]])
-
-
-(defn days-in-prior-months
-  ([date] (days-in-prior-months (:month date) (:year date)))
-  ([month year]
-     (reduce +
-             (map #(gregorian-last-day-of-month % year)
-                  (range 1 (inc month))))))
-
-(provide-contracts
- [days-in-prior-months "Prior days calculation constraints"
-  [d]   [map? :month :year => number? pos?]
-  [m y] [all-positive? => number? pos?]])
-
-
-(defn days-in-prior-years
-  [year]
-  (* 365 (dec year)))
-
-(provide-contracts
- [days-in-prior-years "Prior days from year calculation constraints"
-  [y] [number? pos?]])
-
-
-(defn julian-leap-days-in-prior-years
-  [year]
-  (quot (dec year) 4))
-
-(defn prior-century-years
-  [year]
-  (quot (dec year) 100))
-
-(provide-contracts
- [julian-leap-days-in-prior-years "Contract for JLD calculation"
-  [y] [number? pos? => integer? pos?]]
-
- [prior-century-years "Contract for PCY"
-  [y] [number? pos? => integer? pos?]])
-
-
-(defconstrainedfn gregorian->absolute
-  "Given a Gregorian date, calculate the total number of days
-   since the start of the calendar."
-  ([date] [map? :day :month :year]
-     (gregorian->absolute (:day date) (:month date) (:year date)))
-  ([day month year] [all-positive? => (= (quot % 365) year)]
-     (+ day
-        (days-in-prior-months month year)
-        (days-in-prior-years year)
-        (julian-leap-days-in-prior-years year)
-        (- (prior-century-years year))
-        (quot (dec year) 400))))
-
-(defn absolute->gregorian
-  [date]
-  (let [approx (quot date 366)
-        year   (+ approx
-                  (reduce +
-                          (for [i (range) :when (>= date (gregorian->absolute {:day 1 :month 1 :year (inc i)}))]
-                            i)))]
-    year))
-
-(absolute->gregorian 10)


Add a test for demotions

Add a test for demotions

--- test/riemann/streams_test.clj
+++ test/riemann/streams_test.clj
@@ -46,6 +46,16 @@
   "Verifies that the given stream, taking inputs, forwards outputs to children."
   [stream inputs outputs]
   `(is (~'= ~outputs (run-stream ~stream ~inputs))))
+
+(defmacro with-test-stream
+  "Exposes a fake index, verifies that the given stream, taking inputs,
+  forwards outputs to children"
+  [sym stream inputs outputs]
+  `(let [out#    (ref [])
+         ~sym    (append out#)
+         stream# ~stream]
+     (doseq [e# ~inputs] (stream# e#))
+     (is (~'= (deref out#) ~outputs))))

 (defmacro test-stream-intervals
   "Verifies that run-stream-intervals, taking inputs/intervals, forwards
@@ -1139,11 +1149,11 @@
                       (em 1/2 3/4 7/8 15/16 31/32)))

 (deftest top-test
-         (let [e (fn [s m] {:service s :metric m})
-               a (fn [m] (e :a m))
-               b (fn [m] (e :b m))
-               c (fn [m] (e :c m))
-               d (fn [m] (e :d m))]
+  (let [e (fn [s m & tags] {:service s :metric m :tags tags})
+        a (fn [m & tags] (apply e :a m tags))
+        b (fn [m & tags] (apply e :b m tags))
+        c (fn [m & tags] (apply e :c m tags))
+        d (fn [m & tags] (apply e :d m tags))]

            ; A single event
            (test-stream (top 1 :metric)
@@ -1193,7 +1203,13 @@
            ; Ring
            (test-stream (top 2 :metric)
                         [(a 1) (b 2) (c 3) (d 4)         (a 2)          (b 3)  (c 4) (d 5)]
-                        [(a 1) (b 2) (c 3) (d 4) (expire (a 2)) (expire (b 3)) (c 4) (d 5)])))
+                        [(a 1) (b 2) (c 3) (d 4) (expire (a 2)) (expire (b 3)) (c 4) (d 5)])
+
+           ; Demotion
+           (with-test-stream index
+             (top 1 :metric index bit-bucket true)
+             [(a 1) (b 2)]
+             [(a 1) (expire (a 1)) (b 2)])))

 (deftest throttle-test
          (test-stream-intervals (throttle 3 2)


Cleanup core require

Cleanup core require

--- src/leiningen/new/re_frame/src/cljs/core.cljs
+++ src/leiningen/new/re_frame/src/cljs/core.cljs
@@ -1,6 +1,5 @@
 (ns {{ns-name}}.core
   (:require
-   [reagent.core :as reagent]
    [reagent.dom :as rdom]
    [re-frame.core :as re-frame]{{#re-pressed?}}
    [re-pressed.core :as rp]{{/re-pressed?}}{{#breaking-point?}}


refactoring update-pipeline fn to also use ops/init-buffers

--HG--
branch : develop

--- test/simplecl/verlet_test.clj
+++ test/simplecl/verlet_test.clj
@@ -153,19 +153,18 @@
         (assoc state :pipeline (make-pipeline state))))))

 (defn update-pipeline
-  "Releases the current OpenCL particle buffer and generates a new one for
-  the current particles and builds an updated OpenCL processing pipeline.
+  "Releases the current OpenCL particle & spring buffers and generates new ones for
+  the current particles/spring, then builds an updated OpenCL processing pipeline.
   Returns updated physics state map."
-  [{:keys [cl-state grid p-struct s-struct p-buf q-buf s-buf c-buf
-           nump nums numc bounds gravity drag iter] :as state}]
+  [{:keys [cl-state grid p-struct s-struct p-buf s-buf] :as state}]
   (cl/with-state cl-state
     (cl/release p-buf s-buf)
     (let [{:keys [particles springs]} grid
-          cp (count particles)
-          cs (count springs)
-          p-buf (cl/as-clbuffer (gen/encode p-struct {:particles particles}) :readwrite)
-          s-buf (cl/as-clbuffer (gen/encode s-struct {:springs springs}) :readonly)
-          state (assoc state :p-buf p-buf :s-buf s-buf :nump cp :nums cs)]
+          state (merge state
+                  (ops/init-buffers 1 1
+                    :p-buf {:wrap (gen/encode p-struct {:particles particles})}
+                    :s-buf {:wrap (gen/encode s-struct {:springs springs}) :usage :readonly})
+                  {:nump (count particles) :nums (count springs)})]
       (assoc state :pipeline (make-pipeline state)))))

 (defn physics-time-step
@@ -286,4 +285,4 @@
             (time (physics-time-step step (:pipeline state) false))
             (recur (rest iter) state)))))))

-(defn -main [& args] (run-sim physics-state 5 600 5 1920 1080))
+(defn -main [& args] (run-sim physics-state 200 600 5 1920 1080))


Refactor nav bar

Refactor nav bar

--- src-cljs/frontend/components/pieces/topbar.cljs
+++ src-cljs/frontend/components/pieces/topbar.cljs
@@ -23,27 +23,30 @@
   (component
     (html
      [:div
-      [:a.logomark {:href "/dashboard"
-                    :aria-label "Dashboard"}
-       (common/ico :logo)]
       [:div.navs-container
-        [:ul.nav-items.collapsing-nav
-          [:li
-            [:a.has-icon {:href "/dashboard"
-                          :aria-label "Builds"}
-              [:i.material-icons "storage"] "Builds"]]
-          [:li
-            [:a.has-icon {:href "/build-insights"
-                          :aria-label "Insights"}
-              [:i.material-icons "assessment"] "Insights"]]
-          [:li
-            [:a.has-icon {:href "/projects"
-                          :aria-label "Projects"}
-              [:i.material-icons "book"] "Projects"]]
-          [:li
-            [:a.has-icon {:href "/team"
-                          :aria-label "Teams"}
-              [:i.material-icons "group"] "Teams"]]]
+       [:a.logomark.hidden-sm-down {:href "/dashboard"
+                     :aria-label "Dashboard"}
+        (common/ico :logo)]
+       [:a.logomark-narrow.hidden-md-up {:href "/dashboard"
+                     :aria-label "Dashboard"}
+        [:img {:src (common/icon-path "Logo-Wordmark")}]]
+       [:ul.nav-items.collapsing-nav
+         [:li
+           [:a.has-icon {:href "/dashboard"
+                         :aria-label "Builds"}
+             [:i.material-icons "storage"] "Builds"]]
+         [:li
+           [:a.has-icon {:href "/build-insights"
+                         :aria-label "Insights"}
+             [:i.material-icons "assessment"] "Insights"]]
+         [:li
+           [:a.has-icon {:href "/projects"
+                         :aria-label "Projects"}
+             [:i.material-icons "book"] "Projects"]]
+         [:li
+           [:a.has-icon {:href "/team"
+                         :aria-label "Teams"}
+             [:i.material-icons "group"] "Teams"]]]
         [:ul.nav-items.nav-items-left.collapsing-nav
          [:li.dropdown
           [:button.dropdown-toggle
@@ -63,8 +66,7 @@
            "Discuss"]]
          [:li
           [:a support-info
-           "Support"]]]
-        [:ul.nav-items
+           "Support"]]
          [:li.dropdown.user-menu
           [:button.dropdown-toggle
            {:data-toggle "dropdown"
@@ -77,7 +79,7 @@
            [:li [:a {:href "/account"} "User Settings"]]
            (when (:admin user)
              [:li [:a {:href "/admin"} "Admin"]])]]]
-        [:button.navbar-toggler.hidden-sm-up {:type "button"
+        [:button.navbar-toggler.hidden-md-up {:type "button"
                                                       :data-toggle "collapse"
                                                       :data-target "collapsing-nav"
                                                       :aria-controls "collapsing-nav"


delete core/get-post-title

delete core/get-post-title

--- src/misaki/core.clj
+++ src/misaki/core.clj
@@ -82,12 +82,6 @@
   [#^File file]
   (->> (.getName file) (str *post-dir*) slurp parse-template-options))

-; =get-post-title
-(defn get-post-title
-  "Get post title from post file(java.io.File)."
-  [#^File file]
-  (->> (.getName file) (str *post-dir*) slurp parse-template-options :title))
-
 ; =get-post-url
 (defn get-post-url
   "Generate post url from file(java.io.File)."
@@ -134,7 +128,6 @@
     (merge
       (get-post-options file)
       {:file  file
-;       :title (:title options)
        :url   (get-post-url file)
        :date  (get-date file)
        :lazy-content (delay (get-escaped-content file))})))
@@ -167,7 +160,7 @@
   "get all template files(java.io.File) from *template-dir*"
   []
   (remove #(or (.isDirectory %)
-             (not (has-extension? ".clj" %))
+               (not (has-extension? ".clj" %))
                (layout-file? %))
           (find-files *template-dir*)))


adding (running-states)

adding (running-states)

--- src/mount/core.cljc
+++ src/mount/core.cljc
@@ -181,6 +181,9 @@
           (with-ns ns name))
         v)))

+(defn running-states []
+  (keys @running))
+
 (defn- unvar-state [s]
   (->> s (drop 2) (apply str)))  ;; magic 2 is removing "#'" in state name


Remove om.now language components

Remove om.now language components

--- src/discuss/components/options.cljs
+++ src/discuss/components/options.cljs
@@ -1,53 +1,10 @@
 (ns discuss.components.options
-  (:require [om.core :as om :include-macros true]
-            [om.dom :as dom :include-macros true]
-            [om.next :as nom :refer-macros [defui]]
+  (:require [om.next :as om :refer-macros [defui]]
             [sablono.core :as html :refer-macros [html]]
             [discuss.utils.bootstrap :as bs]
             [discuss.translations :as translations :refer [translate]]
             [discuss.utils.common :as lib]
             [discuss.utils.views :as vlib]))
-
-(defn- option-row
-  "Generic row for multiple settings."
-  {:deprecated 0.4}
-  [description content]
-  (dom/div #js {:className "text-center"}
-           (dom/div nil description)
-           (dom/div nil content)))
-
-(defn- language
-  "Component for a single language selection."
-  {:deprecated 0.4}
-  [language]
-  (reify
-    om/IRender
-    (render [_]
-      (dom/span nil
-                (bs/button-default-sm #(lib/language-next! (first language)) (second language))
-                " "))))
-
-(defn- language-row
-  "Language Chooser."
-  {:deprecated 0.4}
-  []
-  (option-row (dom/span nil (vlib/fa-icon "fa-flag") (translate :options :lang :space))
-              (apply dom/div nil
-                     (map #(om/build language %) translations/available))))
-
-(defn view
-  "Main view for options."
-  {:deprecated 0.4}
-  []
-  (reify
-    om/IRender
-    (render [_]
-      (dom/div nil
-               (vlib/view-header (translate :options :heading))
-               (language-row)))))
-
-;; -----------------------------------------------------------------------------
-;; om.next

 (defn- language-button
   "Create button to set language."
@@ -60,4 +17,4 @@
           (html [:div (vlib/view-header (translate :options :heading))
                  [:div (vlib/fa-icon "fa-flag") (translate :options :lang :space)]
                  (interpose " " (mapv language-button translations/available))])))
-(def options (nom/factory Options))
+(def options (om/factory Options))


limit keys from the database query

limit keys from the database query

--- src/ontrail/csv.clj
+++ src/ontrail/csv.clj
@@ -13,6 +13,7 @@
 (defn exs [query]
   (mq/with-collection EXERCISE
     (mq/find query)
+    (mq/fields [:creationDate :title :sport :distance :duration :avghr :pace :_id :tags])
     (mq/sort {:creationDate 1})
     (mq/batch-size 1000)))


Remove redundant backticks

Remove redundant backticks

--- scheduling/src/immutant/scheduling.clj
+++ scheduling/src/immutant/scheduling.clj
@@ -27,22 +27,21 @@
   "Schedules a function to run according to a specification map
   comprised of any of the following keys:

-  * `:in` - a period after which f will be called
-  * `:at` - a time after which f will be called
-  * `:every` - the period between calls
-  * `:until` - stops the calls at a specific time
-  * `:limit` - limits the calls to a specific count
-  * `:cron` - calls f according to a [Quartz-style](http://quartz-scheduler.org/documentation/quartz-2.2.x/tutorials/tutorial-lesson-06) cron spec
+  * :in - a period after which f will be called
+  * :at - a time after which f will be called
+  * :every - the period between calls
+  * :until - stops the calls at a specific time
+  * :limit - limits the calls to a specific count
+  * :cron - calls f according to a [Quartz-style](http://quartz-scheduler.org/documentation/quartz-2.2.x/tutorials/tutorial-lesson-06) cron spec

-  Units for periods (`:in` and `:every`) are milliseconds, but can
+  Units for periods (:in and :every) are milliseconds, but can
   also be represented as a keyword or a vector of number/keyword
   pairs, e.g. `[1 :week, 4 :days, 2 :hours, 30 :minutes, 59 :seconds]`.

-  Date/Time values (`:at` and `:until`) can be a `java.util.Date`,
+  Date/Time values (:at and :until) can be a `java.util.Date`,
   millis-since-epoch, or a String in `HH:mm` format.

   For example:
-
   ```
   (schedule #(println \"I'm running!\")
     {:in [5 :minutes]
@@ -51,7 +50,6 @@
   ```

   The spec can be passed as either an explicit map or as keyword arguments:
-
   ```
   (schedule #(println \"I'm running!\")
     :at \"08:00\"
@@ -60,7 +58,6 @@
   ```

   Optional helper functions can be combined to create the spec as well:
-
   ```
   (schedule #(println \"I'm running!\")
     (-> (in 5 :minutes)
@@ -70,10 +67,10 @@

   Two additional options may be passed in the spec:

-  * `:id` - a unique identifier for the scheduled job
-  * `:singleton` - a boolean denoting the job's behavior in a cluster [true]
+  * :id - a unique identifier for the scheduled job
+  * :singleton - a boolean denoting the job's behavior in a cluster [true]

-  If called with an `:id` that has already been scheduled, the prior job
+  If called with an :id that has already been scheduled, the prior job
   will be replaced. If an id is not provided, a UUID is used instead.

   The return value is a map of the options with any missing defaults


Update docstring

Update docstring

--- src/attercop/spider.clj
+++ src/attercop/spider.clj
@@ -212,8 +212,7 @@
   max-hits in 'i' ms [Default: [5 3000]]

     :handle-status-codes ; [set] (Optional) Additional status codes to
-  be handled by the scraper besides the standard valid ones ie. 2xx
-  and 3xx.
+  be handled by the scraper besides the standard valid ones ie. 2xx.

     :graceful-shutdown? ; [bool|integer] (Optional) If non-falsy, the
   spider will be gracefully shutdown. Truthy values may be boolean or


fix db for heroku

fix db for heroku

--- src/push_ups/db.clj
+++ src/push_ups/db.clj
@@ -5,12 +5,23 @@
         [clj-time.coerce :only (from-string)]
         [clj-time.core :only (to-time-zone time-zone-for-offset)])
   (:require clojure.pprint
-            [clojure.tools.logging :as log])
-  (:import java.util.UUID))
+            [clojure.tools.logging :as log]
+            [clojure.string :as string])
+  (:import java.util.UUID
+           (java.net URI)))

-(def db (if (System/getenv "HEROKU_POSTGRESQL_RED_URL")
-          (postgres {:db (System/getenv "HEROKU_POSTGRESQL_RED_URL")})
-          (sqlite3 {:db "push-ups.db"})))
+(def db
+  (if-let [url (System/getenv "HEROKU_POSTGRESQL_RED_URL")]
+    (let [db-uri (java.net.URI. url)]
+      (->> (string/split (.getUserInfo db-uri) #":")
+           (#(identity {:db (last (string/split url #"\/"))
+                        :host (.getHost db-uri)
+                        :port (.getPort db-uri)
+                        :user (% 0)
+                        :password (% 1)
+                        :ssl true}))
+           (postgres)))
+    (sqlite3 {:db "push-ups.db"})))

 (defn setup


requiring os

requiring os

--- src/aws/validations.clj
+++ src/aws/validations.clj
@@ -16,12 +16,15 @@
     [subs.core :as subs :refer (validate! combine every-v every-kv validation)]))

 (def machine-entity
-  {:machine {:hostname #{:required :String} :domain #{:required :String} :user #{:required :String}}})
+  {:machine {
+     :hostname #{:required :String} :domain #{:required :String}
+     :user #{:required :String} :os #{:required :Keyword}
+  }})

 (def aws-entity
   {:aws {
-     :instance-type #{:required :String} :image-id #{:required :String}
-     :key-name #{:required :String} :endpoint #{:required :String}}
+     :instance-type #{:required :String} :key-name #{:required :String}
+     :endpoint #{:required :String}}
    })

@@ -32,7 +35,7 @@

 (def aws-provider
-  {:instance-type #{:required :String} :image-id #{:required :String} :key-name #{:required :String}})
+  {:instance-type #{:required :String} :key-name #{:required :String}})

 (defn provider-validation [{:keys [aws] :as spec}]
   (validate! aws aws-provider :error ::invalid-aws))


move :phrasal=true check earlier for efficiency

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -115,7 +115,8 @@
   ;; Each head child may be a leaf or
   ;; otherwise has a child with the same two options (leaf or a head child),
   ;; up to the maximum depth.
-  (if (< depth max-depth)
+  (if (and (< depth max-depth)
+           (not (= false (get-in spec [:phrasal] true))))
     (let [candidate-parents (or use-candidate-parents
                                 (->>
                                  (candidate-parents (:grammar model) spec depth)
@@ -125,13 +126,12 @@
       (if (not (empty? candidate-parents))
         (let [candidate-parent (first candidate-parents)]
           (lazy-cat
-           (if (not (= false (get-in spec [:phrasal] true)))
-             (->> (lightning-bolts model
-                                   (get-in candidate-parent [:head])
-                                   (+ 1 depth)
-                                   max-depth)
-                  (map (fn [head]
-                         (assoc-in candidate-parent [:head] head)))))
+           (->> (lightning-bolts model
+                                 (get-in candidate-parent [:head])
+                                 (+ 1 depth)
+                                 max-depth)
+                (map (fn [head]
+                       (assoc-in candidate-parent [:head] head))))
            (lightning-bolts model spec depth max-depth (rest candidate-parents))))))
     (shufflefn (get-lexemes model spec))))


more cleanup

more cleanup

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -66,12 +66,11 @@
                            paths)})))

      (mapcat (fn [{bolt :bolt comps :comps paths :paths}]
-               (let [comps-at-paths comps]
-                 ;; TODO: further flatten this into the overall ->> pipeline
-                 (map (fn [each-path-through-trellis]
-                        {:bolt bolt
-                         :comps (zipmap paths each-path-through-trellis)})
-                      (apply combo/cartesian-product comps-at-paths)))))
+               ;; TODO: further flatten this into the overall ->> pipeline
+               (map (fn [each-path-through-trellis]
+                      {:bolt bolt
+                       :comps (zipmap paths each-path-through-trellis)})
+                    (apply combo/cartesian-product comps))))

      (map (fn [{bolt :bolt comps :comps}]
             ;; TODO: further flatten this into the overall ->> pipeline


remove unnecessary copy

remove unnecessary copy

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -315,23 +315,28 @@
     (log/debug (str "lightning-bolt:  for spec: " (strip-refs spec)))
     (let [lexical ;; 1. generate list of all phrases where the head child of each parent is a lexeme.
           (mapfn (fn [parent]
-                         (if (= false (get-in parent [:head :phrasal] false))
-                           (let [candidate-lexemes (get-lex parent :head index)
-                                 filter-on-spec {:synsem {:cat (get-in parent [:head :cat] :top)
-                                                          :essere (get-in parent [:head :essere] :top)
-                                                          :sem (get-in parent [:head :synsem :sem] :top)}}
-                                 subset (filter #(not (fail? (unifyc filter-on-spec %)))
-                                                candidate-lexemes)]
-                             (filter #(not (nil? %))
-                                     (do (when (not (empty? subset))
-                                           (log/debug (str "adding lexical heads to parent:" (:rule parent)))
-
-                                           (log/debug (str " with lexemes:" (string/join ";" (sort (map morph subset)))))
-                                           (log/debug (str " with spec:" (spec-info spec))))
-                                         (if (not (empty? subset))
-                                           (over/overh (copy parent) (map copy (shuffle subset)))
-                                           []))))))
-                       parents)
+                   (log/debug (str "looking for lexical heads of parent: " (:rule parent)))
+                   (if (= false (get-in parent [:head :phrasal] false))
+                     (let [candidate-lexemes (get-lex parent :head index)
+                           filter-on-spec {:synsem {:cat (get-in parent [:head :cat] :top)
+                                                    ;; TODO: :essere is language-specific: allow
+                                                    ;; some way to have this constraint be expressed
+                                                    ;; in a language-specific way.
+                                                    :essere (get-in parent [:head :essere] :top)
+                                                    :sem (get-in parent [:head :synsem :sem] :top)}}
+                           filter-on-spec2 (get-in parent [:head])
+                           subset (filter #(not (fail? (unifyc filter-on-spec %)))
+                                          candidate-lexemes)]
+                       (filter #(not (nil? %))
+                               (do (when (not (empty? subset))
+                                     (log/trace (str "adding lexical heads to parent:" (:rule parent)))
+
+                                     (log/trace (str " with lexemes:" (string/join ";" (sort (map morph subset)))))
+                                     (log/trace (str " with spec:" (spec-info spec))))
+                                   (if (not (empty? subset))
+                                     (over/overh parent (shuffle subset))
+                                     []))))))
+                 parents)
           phrasal ;; 2. generate list of all phrases where the head child of each parent is itself a phrase.
           (if (and (< total-depth max-total-depth)
                    (= true (get-in spec [:head :phrasal] true)))


more cleanup

more cleanup

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -80,6 +80,12 @@
                   result))))
          bolts-at))

+(defn add-comps-using [bolt model path comp-paths bolts-at-paths depth max-depth top-bolt truncate? take-n]
+  (if (empty? comp-paths)
+    [bolt]
+    (mapfn (fn [bolt-at]
+             (let [result (add-bolt-at top-bolt bolt path bolt-at model depth max-depth truncate? take-n)])))))
+
 (defn add-comps
   "given a bolt, return the lazy sequence of all bolts derived from this bolt after adding,
    at each supplied path in comp-paths, the bolts for that path."
@@ -96,6 +102,7 @@
              bolt top-bolt model depth max-depth truncate? take-n)))))

 (defn add-bolt-at [top-bolt bolt path bolt-at model depth max-depth truncate? & [take-n]]
+  "at _path_ within _bolt_, add all complements derived from _bolt-at_"
   (mapfn #(do-defaults % model)
          (let [comp-paths (find-comp-paths bolt-at)]
            (mapfn #(assoc-in bolt path %)
@@ -114,12 +121,12 @@
 (defn generate
   "Return one (by default) or _n_ (using :take _n_) expressions matching spec _spec_ given the model _model_."
   [spec language-model
-   & {:keys [max-total-depth truncate-children lexicon take]
+   & {:keys [max-total-depth truncate-children lexicon take-n]
       :or {max-total-depth max-total-depth
            lexicon nil
            truncate-children true
-           take 1}}]
-  (log/debug (str "generate: spec: " spec "; take: " take))
+           take-n 1}}]
+  (log/debug (str "generate: spec: " spec "; take-n: " take-n))
   (let [depth 0
         spec
         (->
@@ -130,17 +137,16 @@
          (dissoc :dag_unify.core/serialized))
         max-depth max-total-depth]
     (->
-     (clojure.core/take
-      take
-      (reduce concat
-              (map #(do
-                      (log/trace (str "add-bolt-at:" ((:morph-ps language-model) %)))
-                      (let [result (filter (fn [x] (not (= :fail x)))
-                                           (add-bolt-at % % [] % language-model depth max-depth truncate-children take))]
-                        result))
-                   (lightning-bolts language-model spec 0 max-total-depth))))
+     (take take-n
+           (reduce concat
+                   (map (fn [bolt]
+                          (log/trace (str "add-bolt-at:" ((:morph-ps language-model) bolt)))
+                          (filter #(not (= :fail %))
+                                  (add-bolt-at bolt bolt [] bolt language-model
+                                               depth max-depth truncate-children take)))
+                        (lightning-bolts language-model spec 0 max-total-depth))))
      ((fn [seq]
-        (if (= take 1)
+        (if (= take-n 1)
           (first seq) ;; if caller only wants one, return just that one, rather than a singleton list.
           seq)))))) ;; otherwise, return the lazy seq of expressions


increase max-generated-complements from 100 to 200

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -18,7 +18,7 @@
 ;; during generation, will not decend deeper than this when creating a tree:
 ;; should also be possible to override per-language.
 (def ^:const max-total-depth 20)
-(def ^:const max-generated-complements 100)
+(def ^:const max-generated-complements 200)

 ;; use map or pmap.
 (def ^:const mapfn map)


simplify

simplify

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -143,20 +143,21 @@
                   bolts-at))))))))

 (defn add-bolt-at [top-bolt bolt path bolt-at model depth max-depth]
-  (if (= false (get-in bolt-at [:phrasal]))
-    [(do-defaults (assoc-in bolt path bolt-at) model)]
-    (let [comp-paths (find-comp-paths bolt-at)
-          comp-bolts (map #(comp-path-to-bolts bolt-at % model (+ 1 depth) max-depth)
-                          comp-paths)]
-      (when (not (some empty? comp-bolts))
-        (mapfn #(do-defaults (assoc-in bolt path %) model)
-               (add-comps bolt-at
-                          model
-                          comp-paths
-                          comp-bolts
-                          (+ 1 depth)
-                          max-depth
-                          top-bolt))))))
+  (mapfn #(do-defaults % model)
+         (if (= false (get-in bolt-at [:phrasal]))
+           [(assoc-in bolt path bolt-at)]
+           (let [comp-paths (find-comp-paths bolt-at)
+                 comp-bolts (map #(comp-path-to-bolts bolt-at % model (+ 1 depth) max-depth)
+                                 comp-paths)]
+             (when (not (some empty? comp-bolts))
+               (mapfn #(assoc-in bolt path %)
+                      (add-comps bolt-at
+                                 model
+                                 comp-paths
+                                 comp-bolts
+                                 (+ 1 depth)
+                                 max-depth
+                                 top-bolt)))))))
 (defn generate2
   "Return all expressions matching spec _spec_ given the model _model_."
   [spec model]


use a promise for babel.italiano/medium

use a promise for babel.italiano/medium

--- src/babel/italiano.cljc
+++ src/babel/italiano.cljc
@@ -14,8 +14,11 @@
    [clojure.string :as string]
    [dag_unify.core :refer [fail-path-between get-in strip-refs unifyc]]))

-(def medium
-  (grammar/medium))
+(defonce medium-model (promise))
+(defn medium []
+  (if (realized? medium-model)
+    @medium-model
+    @(deliver medium-model (grammar/medium))))

 (defonce np-grammar-model (promise))
 (defn np-grammar []
@@ -45,7 +48,7 @@
   "analyze a word: as opposed to parsing which is multi-word."
   ;; TODO: should take a language model, not a lexicon
   ([surface-form]
-   (analyze surface-form (:lexicon medium)))
+   (analyze surface-form (:lexicon (medium))))
   ([surface-form lexicon]
    (morph/analyze surface-form lexicon)))

@@ -53,7 +56,7 @@
   ([]
    (let [max-total-depth generate/max-depth
          truncate-children true
-         model medium]
+         model (medium)]
      (generate {:modified false}
                :max-total-depth max-total-depth
                :truncate-children true
@@ -61,7 +64,7 @@
   ([spec & {:keys [model do-enrich max-total-depth truncate]
             :or {do-enrich true
                  max-total-depth generate/max-depth
-                 model medium
+                 model (medium)
                  truncate true}}]
    (log/debug (str "generating with spec: " (strip-refs spec) " with max-total-depth: " max-total-depth))
    (let [result (generate/generate spec model)]
@@ -105,7 +108,7 @@

   ([input]
    (let [input (preprocess input)]
-     (parse input medium)))
+     (parse input (medium))))

   ([input model]
    (let [model (if (future? model) @model model)


CMR-1354: Intermediate commit with an attempt to fix sorting.

--- search-app/src/cmr/search/data/query_to_elastic.clj
+++ search-app/src/cmr/search/data/query_to_elastic.clj
@@ -40,7 +40,7 @@
   relevancy to sort. If true, use the temporal overlap script in elastic. This config allows
   temporal overlap calculations to be turned off if needed for performance."
   {:type Boolean
-   :default false})
+   :default true})

 (defn- doc-values-field-name
   "Returns the doc-values field-name for the given field."
@@ -270,29 +270,22 @@
    {(q2e/query-field->elastic-field :concept-seq-id :collection) {:order "asc"}}
    {(q2e/query-field->elastic-field :revision-id :collection) {:order "desc"}}])

-(defn- keyword-sort-order
+(defn- score-sort-order
   "Determine the keyword sort order based on the sort-use-relevancy-score config and the presence
    of temporal range parameters in the query"
   [query]
-  (cond
-    (and (temporal-range-extractor/contains-temporal-ranges? query)
-         (sort-use-temporal-relevancy)
-         (sort-use-relevancy-score))
-    [{:_score {:order :desc}}
-     {:_script (temporal-to-elastic/temporal-overlap-sort-script query)}
-     {:usage-relevancy-score {:order :desc :missing 0}}]
-
-    (and (temporal-range-extractor/contains-temporal-ranges? query)
-         (sort-use-temporal-relevancy))
-    [{:_score {:order :desc}}
-     {:_script (temporal-to-elastic/temporal-overlap-sort-script query)}]
-
-    (sort-use-relevancy-score)
-    [{:_score {:order :desc}}
-     {:usage-relevancy-score {:order :desc :missing 0}}]
-
-    :else
-    [{:_score {:order :desc}}]))
+  (let [use-keyword-sort? (keywords-extractor/contains-keyword-condition? query)
+        use-temporal-sort? (and (temporal-range-extractor/contains-temporal-ranges? query)
+                                (sort-use-temporal-relevancy))]
+    (concat
+     (when use-keyword-sort?
+       [{:_score {:order :desc}}])
+     (when use-temporal-sort?
+       [{:_script (temporal-to-elastic/temporal-overlap-sort-script query)}])
+     ;; We only include this if one of the others is present
+     (when (and (or use-temporal-sort? use-keyword-sort?)
+                (sort-use-relevancy-score))
+       [{:usage-relevancy-score {:order :desc :missing 0}}]))))

 (defn- temporal-sort-order
   "If there are temporal ranges in the query and temporal relevancy sorting is turned on,
@@ -315,19 +308,18 @@
   [query]
   (let [{:keys [concept-type sort-keys]} query
         ;; If the sort keys are given as parameters then keyword-sort will not be used.
-        keyword-sort (when (keywords-extractor/contains-keyword-condition? query)
-                       (keyword-sort-order query))
+        score-sort-order (score-sort-order query)
         specified-sort (q2e/sort-keys->elastic-sort concept-type sort-keys)
-        ;; Keyword-sort contains temporal, this is for the case of temporal but no keyword
-        temporal-sort (temporal-sort-order query)
         default-sort (q2e/sort-keys->elastic-sort concept-type (q/default-sort-keys concept-type))
         sub-sort-fields (if (:all-revisions? query)
                           collection-all-revision-sub-sort-fields
                           collection-latest-sub-sort-fields)]
-    (concat (or specified-sort keyword-sort temporal-sort default-sort) sub-sort-fields)))
+    (concat specified-sort
+            (or score-sort-order default-sort)
+            sub-sort-fields)))

 (extend-protocol c2s/ComplexQueryToSimple
   cmr.search.models.query.CollectionQueryCondition
   (reduce-query-condition
     [condition context]
-    (update-in condition [:condition] c2s/reduce-query-condition context)))
+    (update-in condition [:condition] c2s/reduce-query-condition context)))


fix namespace

fix namespace

--- clojure/adventofcode/src/adventofcode/days/day4.clj
+++ clojure/adventofcode/src/adventofcode/days/day4.clj
@@ -1,4 +1,4 @@
-(ns advent.4.core
+(ns adventofcode.days.day4
   (:require [clojure.string :as s]
             [clojure.java.io :as io]))


Use clojure.edn/read-string instead of clojure.core/read-string for security reasons.

--- src/bencode/decoder.clj
+++ src/bencode/decoder.clj
@@ -1,4 +1,5 @@
 (ns bencode.decoder
+  (:require [clojure [edn :as edn]])
   (:use [bencode.error]))

 (defn- digit?
@@ -56,7 +57,7 @@

 (defmethod bdecode-type ::str [seq opts]
   (let [[size seq] (read-digits seq)
-        len (read-string size)
+        len (edn/read-string size)
         text (apply str (take len (rest seq)))]
     (if (> len (count text))
       (error "Unexpected end of string")
@@ -70,7 +71,7 @@
       (let [[digits rem] (read-digits (if sign (rest number-seq) number-seq))]
         (if (or (invalid-number? digits) (not (= \e (first rem))))
           (error "Invalid number expression")
-          [(read-string (str sign digits)) (rest rem)])))))
+          [(edn/read-string (str sign digits)) (rest rem)])))))

 (defmethod bdecode-type ::seq [seq opts]
   (loop [data [] rem (rest seq)]


Fix grid-id bug.

Fix grid-id bug.

--- sonic-jam/src/sonic_jam/core.cljs
+++ sonic-jam/src/sonic_jam/core.cljs
@@ -474,7 +474,7 @@
     om/IWillMount
     (will-mount [_]
       (when (= "grid" (get cursor "type"))
-        (go (>! (om/get-state owner :get-state-ch) (get cursor "id")))))
+        (go (>! (om/get-state owner :get-state-ch) (get cursor "grid-id")))))
     om/IRenderState
     (render-state [_ state]
       (if-not (:track-expanded state)


Minor adjustments to the width and bpc options.

--- sonic-jam/src/sonic_jam/core.cljs
+++ sonic-jam/src/sonic_jam/core.cljs
@@ -100,19 +100,18 @@
                       :else (print "cannot commit"))]
         (condp = (:state state)
           :init (p (dom/span #js {:onClick #(transition {:state :width})} "{+}"))
-          :width (p (dom/span #js {:onClick #(transition {:state :init})} "{-")
-                    (dom/span #js {:onClick #(transition {:state :type :width 1})} " 1 ")
-                    (dom/span #js {:onClick #(transition {:state :type :width 2})} " 2 ")
-                    (dom/span #js {:onClick #(transition {:state :type :width 4})} " 4 ")
-                    (dom/span #js {:onClick #(transition {:state :type :width 8})} " 8 ")
-                    (dom/span #js {:onClick #(transition {:state :type :width 16})} " 16 ")
-                    (dom/span #js {:onClick #(transition {:state :type :width 32})} " 32 ")
-                    (dom/span #js {:onClick #(transition {:state :type :width 64})} " 64 ")
-                    (dom/span nil "}"))
           :type (p (dom/span #js {:onClick #(transition {:state :init})} (str "{- " (:width state) " ... "))
                    (dom/span #js {:onClick #(transition {:state :sample :type "sample"})} " sample ")
                    (dom/span #js {:onClick #(transition {:state :bpc :type "grid"})} " grid ")
                    (dom/span nil "}"))
+          :width (p (dom/span #js {:onClick #(transition {:state :init})} "{-")
+                    (dom/span #js {:onClick #(transition {:state :type :width 1})} " 1 ")
+                    (dom/span #js {:onClick #(transition {:state :type :width 2})} " 2 ")
+                    (dom/span #js {:onClick #(transition {:state :type :width 3})} " 3 ")
+                    (dom/span #js {:onClick #(transition {:state :type :width 4})} " 4 ")
+                    (dom/span #js {:onClick #(transition {:state :type :width 6})} " 6 ")
+                    (dom/span #js {:onClick #(transition {:state :type :width 8})} " 8 ")
+                    (dom/span nil "}"))
           :sample (p (dom/span #js {:onClick #(transition {:state :init})} (str "{- " (:width state) " sample ... "))
                      (apply dom/select #js {:onChange #(transition {:state :commit :sample (-> % .-target .-value)})}
                             (map #(dom/option nil %) (om/observe owner (samples))))
@@ -126,10 +125,8 @@
                   (dom/span #js {:onClick #(transition {:state :grid :bpc "1"})} " 1 ")
                   (dom/span #js {:onClick #(transition {:state :grid :bpc "2"})} " 2 ")
                   (dom/span #js {:onClick #(transition {:state :grid :bpc "4"})} " 4 ")
+                  (dom/span #js {:onClick #(transition {:state :grid :bpc "6"})} " 6 ")
                   (dom/span #js {:onClick #(transition {:state :grid :bpc "8"})} " 8 ")
-                  (dom/span #js {:onClick #(transition {:state :grid :bpc "16"})} " 16 ")
-                  (dom/span #js {:onClick #(transition {:state :grid :bpc "32"})} " 32 ")
-                  (dom/span #js {:onClick #(transition {:state :grid :bpc "64"})} " 64 ")
                   (dom/span nil "}"))
           :grid (p (dom/span #js {:onClick #(transition {:state :init})}
                              (str "{- " (:width state) " (" (:bpc state) ") ... "))


core: with-redefs-fn, with-redefs

core: with-redefs-fn, with-redefs

--- core/data/core.clj
+++ core/data/core.clj
@@ -1278,6 +1278,12 @@
       (finally
         (replace-bindings* existing-bindings)))))

+(def
+  ^{:doc "The same as with-bindings*"
+    :arglists '([binding-map f & args])
+    :added "1.0"}
+  with-redefs-fn with-bindings*)
+
 (defmacro with-bindings
   "Takes a map of Var/value pairs. Sets the vars to the corresponding values.
   Then executes body. Resets the vars back to the original
@@ -1306,6 +1312,12 @@
                              (next (next vvs)))
                       (seq ret))))]
     `(with-bindings (hash-map ~@(var-ize bindings)) ~@body)))
+
+(defmacro with-redefs
+  "The same as binding"
+  {:added "1.0"}
+  [bindings & body]
+  `(binding ~bindings ~@body))

 (defn deref
   "Also reader macro: @var/@atom/@delay. When applied to a var or atom,
@@ -3681,6 +3693,29 @@
        ([x y z & args] (or (spn x y z)
                            (some #(some % args) ps)))))))

+(defn- ^{:dynamic true} assert-valid-fdecl
+  "A good fdecl looks like (([a] ...) ([a b] ...)) near the end of defn."
+  [fdecl]
+  (when (empty? fdecl) (throw (ex-info "Parameter declaration missing" {})))
+  (let [argdecls (map
+                  #(if (seq? %)
+                     (first %)
+                     (throw (ex-info
+                             (if (seq? (first fdecl))
+                               (str "Invalid signature \""
+                                    %
+                                    "\" should be a list")
+                               (str "Parameter declaration \""
+                                    %
+                                    "\" should be a vector"))
+                             {})))
+                  fdecl)
+        bad-args (seq (remove #(vector? %) argdecls))]
+    (when bad-args
+      (throw (ex-info (str "Parameter declaration \"" (first bad-args)
+                           "\" should be a vector")
+                      {})))))
+
 (defmacro cond->
   "Takes an expression and a set of test/form pairs. Threads expr (via ->)
   through each form for which the corresponding test


Modifying tests to pick up new string output

--- src/test/clojure/jarvis/plugins/help_test.clj
+++ src/test/clojure/jarvis/plugins/help_test.clj
@@ -12,6 +12,7 @@
 ;;   ^{:description "yo" :command "dawg"}
 ;;   yo-plugin [message]
 ;;   "happy")
+

 ;; (deftest help
 ;;   (is (= (str "\n\tAll known plugins - "
@@ -29,3 +30,10 @@
 ;;            "\n\t~~<command> @<name> will private message the people listed the results of the executed command."
 ;;            "\n\tFor more details see https://github.com/RallySoftware/jarvis-core")
 ;;         (help/help (test-util/message "~help") ["help"] [#'test-plugin #'yo-plugin]))))
+
+
+
+;; (deftest help
+;;   (is (= (str "I have placed the items you are looking for in the team inbox, found to the left of this pane.")
+;;          (help/help (test-util/message "~help") ["help"] [#'test-plugin]))))
+


Rename core to main in template code

Rename core to main in template code

--- src/leiningen/new/lein_quick_om.clj
+++ src/leiningen/new/lein_quick_om.clj
@@ -11,7 +11,7 @@
               :sanitized (name-to-path name)}]
     (main/info "Generating fresh 'lein new' lein-quick-om project.")
     (->files data
-             ["src/{{sanitized}}/core.cljs" (render "core.cljs" data)]
+             ["src/{{sanitized}}/main.cljs" (render "main.cljs" data)]
              ["src/{{sanitized}}/devbar.cljs" (render "devbar.cljs" data)]
              ["src/{{sanitized}}/state_viewer.cljs" (render "state_viewer.cljs" data)]
              ["src/{{sanitized}}/ui.cljs" (render "ui.cljs" data)]


stub functions

stub functions

--- src/video_feed_transformer/transform_feed.clj
+++ src/video_feed_transformer/transform_feed.clj
@@ -36,6 +36,21 @@
                   :y1 (* row-h r)
                   :y2 (* row-h r-next)}
                  )))))
+
+(defn- get-rect-from-img [img rect]
+  "given an img and rect coords, return subimg pixels")
+
+(defn- get-matching-img-to-corpus [img corpus]
+  "given an image and a collection of imgs, return best match from corpus")
+(defn- assemble-imgs-onto-canvas [canvas imgs-and-rects]
+  "given a set of images, their rect coordinates, and a canvas, assemble the imgs
+  using the grid coords onto the canvas")
+
+(defn- get-argb-avg-of-img [img]
+  "")
+
+(defn- find-closest-match-by-argb-l2 [img-argb corpus-argb]
+  "")

 (defn- move-file [src-file dest-dir] ""
   (fs/copy+ src-file dest-dir))


remove where clause to fix missing election/source

--- src/vip/data_processor/db/tree_statistics.clj
+++ src/vip/data_processor/db/tree_statistics.clj
@@ -35,8 +35,7 @@
          coalesce(errors.error_count, 0) as error_count,
          coalesce(values.value_count, 0) as count
   FROM values
-  FULL OUTER JOIN errors ON errors.element_type = values.element_type
-  WHERE values.element_type IS NOT NULL;")))
+  FULL OUTER JOIN errors ON errors.element_type = values.element_type;")))

 (def camel-case-splitter #"(?<!(^|[A-Z]))(?=[A-Z])|(?<!^)(?=[A-Z][a-z])")


Fix test result retrieval broken in 268bcb79a650

--- src/buildviz/go_api.clj
+++ src/buildviz/go_api.clj
@@ -158,4 +158,4 @@
 (defn get-junit-xml [go-url job-instance]
   (when-let [xml-file-url (first (xml-artifacts-for-job-run go-url job-instance))]
     (log/info (format "Reading test results from %s" xml-file-url))
-    (:body (get-plain go-url xml-file-url))))
+    (get-plain go-url xml-file-url)))


When accumulating stages, ignore Go's rewrapping of old job runs and selling them as 'new'

--- src/buildviz/gosync.clj
+++ src/buildviz/gosync.clj
@@ -84,9 +84,11 @@
     (when-not (= "Unknown" result)
       (let [start-time (parse-datetime property-map "cruise_timestamp_04_building")
             end-time (parse-datetime property-map "cruise_timestamp_06_completed")
+            actual-stage-run (get property-map "cruise_stage_counter")
             outcome (if (= "Passed" result) "pass" "fail")]
         (assoc (build-times start-time end-time)
-               :outcome outcome)))))
+               :outcome outcome
+               :actual-stage-run actual-stage-run)))))

 (defn build-for [{pipeline-name :pipelineName
                   pipeline-run :pipelineRun
@@ -113,11 +115,15 @@
     (assoc (accumulate-build-times builds)
            :outcome accumulated-outcome)))

+(defn ignore-old-runs-for-rerun-stages [{stage-run :stageRun} builds]
+  (filter #(= stage-run (:actual-stage-run %)) builds))
+
 (defn build-for-job [job-instance]
   (if-let [jobs-for-accumulation (:jobs-for-accumulation job-instance)]
     (->> jobs-for-accumulation
          (map #(merge job-instance %))
          (map build-for)
+         (ignore-old-runs-for-rerun-stages job-instance)
          accumulate-builds)
     (build-for job-instance)))


Fix the "Unmatched delimiter: ]" error

Fix the "Unmatched delimiter: ]" error

--- src/caesium/binding.clj
+++ src/caesium/binding.clj
@@ -632,7 +632,7 @@
       ^long ^{LongLong {}} subklen
       ^long ^{LongLong {}} subkid
       ^bytes ^{Pinned {}} ctx
-      ^bytes ^{Pinned {}} k]]]
+      ^bytes ^{Pinned {}} k]]

     [^long ^{size_t {}} crypto_core_ristretto255_bytes []]
     [^long ^{size_t {}} crypto_core_ristretto255_hashbytes []]


Remove old test runner

Remove old test runner

--- clojure/run_tests.clj
+++ clojure/run_tests.clj
@@ -1,11 +0,0 @@
-(use 'clojure.test)
-(use 'sum-of-even-squares)
-
-(deftest ses-test
-  (is (= (sum-of-even-squares []) 0))
-  (is (= (sum-of-even-squares [7]) 0))
-  (is (= (sum-of-even-squares [7 3]) 0))
-  (is (= (sum-of-even-squares [7 3 2]) 4))
-  (is (= (sum-of-even-squares [7 3 4 1 2 9 8]) 84)))
-
-(run-tests)


operations set

operations set

--- src/celestial/model.clj
+++ src/celestial/model.clj
@@ -27,6 +27,9 @@
 (defn get-env! [] {:pre [env]} env)

 (def hypervizors #{:proxmox :aws :vcenter :vagrant :physical :docker})
+
+(def operations
+ #{:reload :destroy :provision :stage :run-action :create :start :stop :clear :clone})

 (defn figure-virt [spec] (first (filter hypervizors (keys spec))))


fix namespaced keywords for custom encoding

--- src/cheshire/custom.clj
+++ src/cheshire/custom.clj
@@ -180,7 +180,9 @@
   (.writeStartObject jg)
   (doseq [[k v] m]
     (.writeFieldName jg (if (instance? clojure.lang.Keyword k)
-                          (name k)
+                          (if-let [ns (namespace k)]
+                            (str ns "/" (name k))
+                            (name k))
                           (str k)))
     (to-json v jg))
   (.writeEndObject jg))


removed annotations

removed annotations

--- src/clabango/parser.clj
+++ src/clabango/parser.clj
@@ -9,7 +9,7 @@

 (declare lex* string->ast ast->groups)

-(defn start-of-new-token? [^String s ^Integer i]
+(defn start-of-new-token? [s i]
   (let [c (.charAt s i)
         nc (try
              (.charAt s (inc i))
@@ -23,13 +23,7 @@
         (and (= c \})
              (= nc \})))))

-
-(defn buffer-string [^String s
-                     ^String fileref
-                     ^Long i
-                     ^Integer max
-                     ^Long offset
-                     ^Long line]
+(defn buffer-string [s fileref i max offset line]
   (let [sb (StringBuffer.)]
     (loop [ni i]
       (if (or (>= ni max)
@@ -102,7 +96,7 @@
        rest-tokens]
       (throw (Exception. (str "parsing error after " a))))))

-(defn find-close-tag [^clojure.lang.LazySeq tokens]
+(defn find-close-tag [tokens]
   (let [[a b c & rest-tokens] tokens]
     (if (and (= (:token a) :open-tag)
              (string? (:token b))
@@ -343,4 +337,4 @@
 (defn render-file [filename context]
   (-> filename
       load-template
-      (render context)))
+      (render context)))


block main thread

block main thread

--- src/clj/chat42/core.clj
+++ src/clj/chat42/core.clj
@@ -1,5 +1,5 @@
 (ns chat42.core
-  (:gen-class)
+  (:gen-class :main true)
   (:require [replikativ.crdt.cdvcs.realize :refer [head-value stream-into-identity!]]
             [replikativ.crdt.cdvcs.stage :as s]
             [replikativ.stage :refer [create-stage! connect! subscribe-crdts!]]
@@ -39,13 +39,16 @@
                    (println (str "Date: " date " name: " name " text: " text)))))
     (<?? S (s/create-cdvcs! stage :description "testing" :id cdvcs-id))
     (println "Chat42 replikativ server peer up and running!")
+
     {:store store
      :peer peer
      :close-stream close-stream
      :stage stage}))

 (defn -main [& args]
-  (reset! server-state (start-all-services)))
+  (let [c (chan)]
+    (reset! server-state (start-all-services))
+    (<?? S c)))

 (comment