GET /reader?target_spec=<foo> works as intended

--- src/babel/reader.clj
+++ src/babel/reader.clj
@@ -44,13 +44,8 @@
               (write-str {:source (get-in gcacs [:source])
                           :target_spec target_spec
                           ;; TODO: eventually add :source-v2
-                          :gcacs gcacs
                           :targets (get-in gcacs [:targets])
-                          :targets-v2
-                          (map (fn [surface]
-                                 {:surface surface
-                                  :roots ["foo","bar"]})
-                               (get-in gcacs [:targets]))}))})
+                          :targets-v2 (get-in gcacs [:targets-v2])}))})
       (GET "/:expr" request
            (let [expr (:expr (:route-params request))]
              (log/debug (str "expr(1):" expr))
@@ -152,7 +147,8 @@
             (let [results
                   (db/exec-raw [(str "SELECT source.surface AS source, source.id AS source_id,
                                              target.surface AS target,target.root AS target_root,
-                                             source.structure AS structure
+                                             source.structure AS structure,
+                                             target.structure::text AS target_structure
                                         FROM (SELECT surface, source.structure->'synsem'->'sem'
                                                      AS sem,
                                                      source.structure AS structure, source.id
@@ -161,7 +157,7 @@
                                                  AND source.structure->'synsem'->'sem' @> '"
                                      json-semantics "' LIMIT 1) AS source
                                   INNER JOIN (SELECT DISTINCT surface, target.structure->'synsem'->'sem' AS sem,
-                                                              root
+                                                              root,structure
                                                          FROM expression_with_root AS target
                                                         WHERE target.language=?
                                                           AND target.structure->'synsem'->'sem' = '" json-semantics "') AS target
@@ -182,11 +178,27 @@
                            (get-in (strip-refs (deserialize
                                                 (read-string (:target target-expression))))
                                               [:synsem :sem])))))
-            (let [debug (log/debug (str "source-structure:"
-                                        (first (map :structure results))))]
-              {:source (first (map :source results))
-               :source-id (first (map :source_id results))
-               :target-roots (map :target_root results)
+            (let [debug (log/trace (str "source-structure:"
+                                        (first (map :structure results))))
+                  debug (log/debug (str "read from target_structure:"
+                                        (first (map :target_structure results))))
+                  debug (log/debug (str "hello:"
+                                        (read-str (first (map :target_structure results)))))
+                  debug (log/debug (str "hello2:"
+                                        (json-read-str (first (map :target_structure results)))))]
+              {:source-id (first (map :source_id results))
+               :source (first (map :source results))
+               :targets-v2 (map (fn [result]
+                                 {:surface (get result :target)
+                                  :root (:target_root result)
+                                  :lexemes
+                                  (let [structure (json-read-str (:target_structure result))]
+                                    (remove nil?
+                                            [(get-in structure [:comp :italiano :italiano])
+                                             (get-in structure [:root :italiano :infinitive])
+                                             (get-in structure [:root :italiano :infinitive])
+                                             (get-in structure [:root :italiano :italiano])]))})
+                               results)
                :targets (map :target results)})))))))))

 (defn get-lexeme [canonical language & [ spec ]]


different color effects on one cue

different color effects on one cue

--- src/lights/my_show.clj
+++ src/lights/my_show.clj
@@ -427,11 +427,11 @@

   (ct/set-cue! (:cue-grid *show*) 0 17
     (cues/cue :color  (fn [_] (afterglow.effects/scene
-      "Blue and red"
-        (show/add-effect! :color-back-odd (afterglow.effects.color/color-effect
-          "Plain red" (create-color "red") (show/fixtures-named "back-odd")))
-        (show/add-effect! :color-back-even (afterglow.effects.color/color-effect
-          "Plain Blue" (create-color "blue") (show/fixtures-named "back-even")))
+      "Blue and red 2"
+        (afterglow.effects.color/color-effect
+          "Plain red" (create-color "red") (show/fixtures-named "back-odd"))
+        (afterglow.effects.color/color-effect
+          "Plain Blue" (create-color "blue") (show/fixtures-named "back-even"))
     ))))
 )


reader: fix red-regex

reader: fix red-regex

--- src/blind/reader.clj
+++ src/blind/reader.clj
@@ -581,13 +581,13 @@
         (if (nil? ch)
           (reader-error rdr "EOF while reading regex")
           (do
-              (if (identical? \\ ch)
-                (let [ch (read-char rdr)]
-                  (if (nil? ch)
-                    (reader-error rdr "EOF while reading regex"))
-                  (.append sb ch)
-                  (recur (read-char rdr)))
-                (recur (read-char rdr)))))))))
+            (.append sb ch )
+            (when (identical? \\ ch)
+              (let [ch (read-char rdr)]
+                (if (nil? ch)
+                  (reader-error rdr "EOF while reading regex"))
+                (.append sb ch)))
+            (recur (read-char rdr))))))))

 (defn read-discard
   [rdr _]


Handle exceptions in store stream helpers.

--- src/blocks/store.clj
+++ src/blocks/store.clj
@@ -143,27 +143,33 @@
       blocks
       (fn test-block
         [block]
-        (let [id (:id block)
-              hex (multihash/hex id)]
-          (cond
-            ; Ignore any blocks which don't match the algorithm.
-            (and algorithm (not= algorithm (:algorithm id)))
-            (d/success-deferred true)
-
-            ; Drop blocks until an id later than `after`.
-            (and after (pos? (compare after hex)))
-            (d/success-deferred true)
-
-            ; Terminate the stream if block is later than `before` or `limit`
-            ; blocks have already been returned.
-            (or (and before (neg? (compare before hex)))
-                (and (pos-int? limit) (< limit (swap! counter inc))))
-            (do (s/close! out)
-                (d/success-deferred false))
-
-            ; Otherwise, pass the block along.
-            :else
-            (s/put! out block))))
+        (if (instance? Throwable block)
+          ; Propagate error on the stream.
+          (do (s/put! out block)
+              (s/close! out)
+              (d/success-deferred false))
+          ; Determine if block matches query criteria.
+          (let [id (:id block)
+                hex (multihash/hex id)]
+            (cond
+              ; Ignore any blocks which don't match the algorithm.
+              (and algorithm (not= algorithm (:algorithm id)))
+              (d/success-deferred true)
+
+              ; Drop blocks until an id later than `after`.
+              (and after (pos? (compare after hex)))
+              (d/success-deferred true)
+
+              ; Terminate the stream if block is later than `before` or `limit`
+              ; blocks have already been returned.
+              (or (and before (neg? (compare before hex)))
+                  (and (pos-int? limit) (< limit (swap! counter inc))))
+              (do (s/close! out)
+                  (d/success-deferred false))
+
+              ; Otherwise, pass the block along.
+              :else
+              (s/put! out block)))))
         out
         {:description {:op "select-blocks"}})
     (s/source-only out)))
@@ -197,27 +203,34 @@
           (fn remove-drained
             [inputs]
             (remove #(identical? ::drained (second %)) inputs))
+          ; Find the next earliest block to return.
           (fn find-next
             [inputs]
             (if (empty? inputs)
               ; Every input is drained.
               (do (s/close! out) true)
-              ; Determine the next block to output.
-              (let [earliest (first (sort-by :id (map second inputs)))]
-                (d/chain
-                  (s/put! out earliest)
-                  (fn check-put
-                    [result]
-                    (if result
-                      ; Remove any blocks matching the one emitted.
-                      (d/recur (mapv (fn remove-earliest
-                                       [[input head :as pair]]
-                                       (if (= (:id earliest) (:id head))
-                                         [input nil]
-                                         pair))
-                                     inputs))
-                      ; Out was closed on us.
-                      false))))))))
+              ; Check inputs for errors.
+              (if-let [error (->> (map second inputs)
+                                  (filter #(instance? Throwable %))
+                                  (first))]
+                ; Propagate error.
+                (do (s/put! out error) false)
+                ; Determine the next block to output.
+                (let [earliest (first (sort-by :id (map second inputs)))]
+                  (d/chain
+                    (s/put! out earliest)
+                    (fn check-put
+                      [result]
+                      (if result
+                        ; Remove any blocks matching the one emitted.
+                        (d/recur (mapv (fn remove-earliest
+                                         [[input head :as pair]]
+                                         (if (= (:id earliest) (:id head))
+                                           [input nil]
+                                           pair))
+                                       inputs))
+                        ; Out was closed on us.
+                        false)))))))))
       (s/source-only out))))

@@ -249,6 +262,18 @@
               (s/drain-into source out)
               #(s/close! out))

+            ; Source threw an error; propagate it.
+            (instance? Throwable s)
+            (d/finally
+              (s/put! out s)
+              #(s/close! out))
+
+            ; Dest threw an error; propagate it.
+            (instance? Throwable d)
+            (d/finally
+              (s/put! out d)
+              #(s/close! out))
+
             ; Block is present in both streams; drop and continue.
             (= (:id s) (:id d))
             (d/recur nil nil)


change Piece structure to know its own type name

--- src/client/core.cljs
+++ src/client/core.cljs
@@ -17,13 +17,13 @@
 (enable-console-print!)

 (def pieces
-  {:I [[0 0] [0 -1] [0 1] [0 2]]
-   :L [[0 0] [0 1] [1 1] [0 -1]]
-   :J [[0 0] [0 -1] [0 1] [-1 1]]
-   :S [[0 0] [-1 0] [0 -1] [1 -1]]
-   :Z [[0 0] [-1 -1] [0 -1] [1 0]]
-   :O [[0 0] [-1 0] [-1 1] [0 1]]
-   :T [[0 0] [-1 0] [1 0] [0 1]]})
+  {:I {:name :I :coords [[0 0] [0 -1] [0 1] [0 2]]}
+   :L {:name :L :coords [[0 0] [0 1] [1 1] [0 -1]]}
+   :J {:name :J :coords [[0 0] [0 -1] [0 1] [-1 1]]}
+   :S {:name :S :coords [[0 0] [-1 0] [0 -1] [1 -1]]}
+   :Z {:name :Z :coords [[0 0] [-1 -1] [0 -1] [1 0]]}
+   :O {:name :O :coords [[0 0] [-1 0] [-1 1] [0 1]]}
+   :T {:name :T :coords [[0 0] [-1 0] [1 0] [0 1]]}})

 (def empty-board [[0 0 0 0 0 0 0 0 0 0]
                   [0 0 0 0 0 0 0 0 0 0]
@@ -87,15 +87,16 @@

 (defn write-piece-to-board
   "Returns a new board with a the given piece written to the coordinate on the board."
-  [piece-key x y board]
-  (let [value piece-key
-        coords (piece-key pieces)]
+  [piece x y board]
+  (let [value (:name piece)
+        coords (:coords piece)]
     (write-coords-to-board coords x y value board)))

 (defn rotate-piece
   "Create a new piece by rotating the given piece clockwise."
   [piece]
-  (doall (map (fn [[x y]] [(- y) x]) piece)))
+  (let [new-coords (map (fn [[x y]] [(- y) x]) (:coords piece))]
+    (assoc piece :coords new-coords)))

 (defn coord-empty?
   "Determines if the given coordinate on the board is empty."
@@ -113,7 +114,7 @@
 (defn piece-fits?
   "Determines if the given piece will collide with anything in the current board."
   [piece x y board]
-  (every? #(coord-fits? % x y board) piece))
+  (every? #(coord-fits? % x y board) (:coords piece)))

 ; ------------------------------------------------------------
 ; DRAWING FUNCTIONS


[Change] count-rate using match

[Change] count-rate using match

--- src/clj_elm/core.clj
+++ src/clj_elm/core.clj
@@ -115,11 +115,11 @@

 (defn count-rate [pred fact exp]
   {:pre [(= (Math/abs pred) (Math/abs fact) 1) (map? @exp)]}
-  (cond
-    (and (= pred 1) (= fact 1)) (update-exp inc :TP exp)
-    (and (= pred 1) (= fact -1)) (update-exp inc :FP exp)
-    (and (= pred -1) (= fact -1)) (update-exp inc :TN exp)
-    (and (= pred -1) (= fact 1)) (update-exp inc :FN exp)))
+  (match [pred fact]
+    [ 1  1] (update-exp inc :TP exp)
+    [ 1 -1] (update-exp inc :FP exp)
+    [-1 -1] (update-exp inc :TN exp)
+    [-1  1] (update-exp inc :FN exp)))

 (defn confusion-matrix [preds facts exp]
   {:pre [(coll? preds) (coll? facts) (map? @exp)]}


mark new irefs feature as experimental

mark new irefs feature as experimental

--- src/minreact/core.cljs
+++ src/minreact/core.cljs
@@ -80,7 +80,7 @@
                (aset obj (name k) v)))
            obj)
          props]
-
+
         (object? props)
         (let [obj (js-obj)]
           (doseq [k (map name reserved-ks)]
@@ -107,7 +107,7 @@

 (defn- install-watch [c [getter iref :as selector]]
   (let [k (gensym "minreact-watch__")]
-    (state! c assoc
+    (state! c assoc
             :watch-key k
             :value (getter @iref))
     (add-watch iref k
@@ -128,7 +128,8 @@
     [identity selector]))

 (def irefs
-  "Mixin that is required in a component that uses minreact.core/bind"
+  "EXPERIMENTAL.  Mixin that is required in a component that uses
+  minreact.core/bind"
   (letfn [(remove-all! [this]
             (doseq [[r _] @(obj/get this "__minreact_bind")]
               (remove-watch r this)))
@@ -158,9 +159,9 @@
        (remove-all! this)))))

 (defn bind
-  "The component will re-render when the irefs value applied to
-  f (default: identity) and args has changed.  Returns current value
-  of iref.  Requires minreact.core/irefs mixin."
+  "EXPERIMENTAL.  The component will re-render when the irefs value
+  applied to f (default: identity) and args has changed.  Returns
+  current value of iref.  Requires minreact.core/irefs mixin."
   ([iref]
    (bind iref identity))
   ([iref f & args]
@@ -179,7 +180,7 @@
   render-child with their values.

   A selector may be:
-
+
   an IRef

   a vector [getter iref] where getter limits the observed part of


[Add] fun exp-result

[Add] fun exp-result

divide from confusion-matrix for using result.

--- src/clj_elm/core.clj
+++ src/clj_elm/core.clj
@@ -111,34 +111,37 @@
        (sign))))

 (defn update-exp [fn key exp]
-  {:pre [(fn? fn) (keyword? key) (reftype? exp) (map? @exp)]}
-  (reset! exp (assoc @exp key (fn (key @exp))))
-  exp)
+  {:pre [(fn? fn) (keyword? key) (map? exp)]}
+  (assoc exp key (fn (key exp))))

 (defn count-rate [pred fact exp]
-  {:pre [(= (Math/abs pred) (Math/abs fact) 1) (reftype? exp) (map? @exp)]}
+  {:pre [(= (Math/abs pred) (Math/abs fact) 1) (map? exp)]}
   (match [pred fact]
     [ 1  1] (update-exp inc :TP exp)
     [ 1 -1] (update-exp inc :FP exp)
     [-1 -1] (update-exp inc :TN exp)
     [-1  1] (update-exp inc :FN exp)))

+(defn exp-result [exp]
+  {:pre [(map? exp)]}
+  (let [TP (:TP exp) FP (:FP exp)
+        TN (:TN exp) FN (:FN exp)]
+    (-> exp
+        (assoc :Accuracy (/ (+ TP TN) (+ TP FP TN FN)))
+        (assoc :Recall (/ TP (+ TP FN)))
+        (assoc :Precision (/ TP (+ TP FP))))))
+
 (defn confusion-matrix [preds facts exp]
-  {:pre [(coll? preds) (coll? facts) (reftype? exp) (map? @exp)]}
+  {:pre [(coll? preds) (coll? facts) (map? exp)]}
   (if (or (empty? preds) (empty? facts))
-    (let [TP (:TP @exp) FP (:FP @exp)
-          TN (:TN @exp) FN (:FN @exp)]
-      (-> @exp
-          (assoc :Accuracy (/ (+ TP TN) (+ TP FP TN FN)))
-          (assoc :Recall (/ TP (+ TP FN)))
-          (#(reset! exp (assoc % :Precision (/ TP (+ TP FP)))))))
+    (exp-result exp)
     (let [pred (first preds)
           fact (first facts)]
       (recur (rest preds) (rest facts) (count-rate pred fact exp)))))

 (defn evaluation
   ([results facts exp]
-   {:pre [(coll? results) (coll? facts) (reftype? exp) (map? @exp)]}
+   {:pre [(coll? results) (coll? facts) (map? exp)]}
    (let [numd (count results)]
      (confusion-matrix results facts exp))))


[Add] *sign-reverse*

[Add] *sign-reverse*

for my experinment

--- src/clj_elm/core.clj
+++ src/clj_elm/core.clj
@@ -7,6 +7,8 @@
             [taoensso.timbre.profiling :refer [profile p]])
   (:import [clj_elm.data DataSet])
   (:gen-class))
+
+(def ^:dynamic *sign-reverse* false)

 (defn sign
   "The signum function for a real number x."


tweak file handlers in a normalize function

--- src/cljam/normal.clj
+++ src/cljam/normal.clj
@@ -32,11 +32,9 @@

 (defmethod normalize :bam
   [rdr wtr]
-  (with-open [rdr rdr]
-    (let [hdr (normalize-header (io/read-header rdr))]
-      (with-open [wtr wtr]
-        (io/write-header wtr hdr)
-        (io/write-refs wtr hdr)
-        ;; TODO copy all rest of stream for performance. (do not read, parse and write)
-        (doseq [blks (partition-all chunk-size (io/read-blocks rdr))]
-          (io/write-blocks wtr blks))))))
+  (let [hdr (normalize-header (io/read-header rdr))]
+    (io/write-header wtr hdr)
+    (io/write-refs wtr hdr)
+    ;; TODO copy all rest of stream for performance. (do not read, parse and write)
+    (doseq [blks (partition-all chunk-size (io/read-blocks rdr))]
+      (io/write-blocks wtr blks))))


Functional as an uberjar

Functional as an uberjar

--- src/depends/core.clj
+++ src/depends/core.clj
@@ -23,9 +23,6 @@
 (defn -main
   "Calculate class file(s) dependencies from the command line."
   [& args]
-  ;; work around dangerous default behaviour in Clojure
-  (alter-var-root #'*read-eval* (constantly false))
-
   (try
     (let [[options args banner] (cli args
                                      ["-j" "--json"  "Write JSON to stdout"                :default false :flag true]


bra va

bra va

--- src/epicea/utils.clj
+++ src/epicea/utils.clj
@@ -2,7 +2,7 @@

 (defn map-with-keys? [x ks]
   (if (map? x)
-    (every? (fn [v] (contains? ks v)) (keys x))))
+    (= ks (clojure.set/intersection (set (keys x)) ks))))

 (defn compute-matrix-index [sizes indices]
   (assert (= (count sizes)
@@ -39,7 +39,7 @@
         defargs default-args0
         args args0]
     (if (empty? defargs)
-      result
+      (reduce conj result args)
       (if (default-arg? (first defargs))
         (recur (conj result (ffirst defargs))
                (rest defargs)
@@ -54,4 +54,3 @@
   (assert (valid-partial-args? partial-args))
   (fn [& args0]
     (apply fun (merge-args partial-args args0))))
-


Update comment.

Update comment.

--- src/oc/storage/app.clj
+++ src/oc/storage/app.clj
@@ -1,5 +1,5 @@
 (ns oc.storage.app
-  "Namespace for the web application which serves the REST API."
+  "Namespace for the HTTP application which serves the REST API."
   (:gen-class)
   (:require
     [raven-clj.core :as sentry]


refactor 'validate-token

refactor 'validate-token

--- src/gangway/auth.clj
+++ src/gangway/auth.clj
@@ -62,26 +62,25 @@
     (schema/tx-entity! db :queue-auth (hatch/slam-all queue-auth :queue-auth))
     queue-auth))

-
 (defn validate-token
   "Validates a token from an incoming request,
   designed to be used in the authorized? section
   of a liberator resource.

   Params:  ctx - Liberator Context
-  db  - Datomic database connection
+  db-conn  - Datomic database connection
   Returns: boolean"
-  [ctx db]
+  [ctx db-conn]
   (let [token  (request->auth-token ctx)]
-    (if (not (empty? token))
-      (let [result (d/q '[:find ?e
+    (if (empty? token)
+      false
+      (let [db (d/db db-conn)
+            result (d/q '[:find ?e
                           :in $ ?token
                           :where [?e :queue-auth/token ?token]]
-                        (d/db db)
+                        db
                         token)]
-        (if (empty? result)
+        (if (or (empty? result)
+                (expired? result db))
           false
-          (if (expired? result db)
-            false
-            true)))
-      false)))
+          true)))))


Add docstrings to new methods

Add docstrings to new methods

--- src/om_tools/core.cljx
+++ src/om_tools/core.cljx
@@ -57,6 +57,9 @@

 #+clj
 (defn component-spec
+  "Returns a seq of quoted forms to be used inside reify/defrecord.
+   Handles making Om lifecycle protocols explicit from partial-spec and
+   merging in default implementations when not present in partial-spec."
   ([partial-spec] (component-spec partial-spec nil))
   ([partial-spec default-spec-map]
      (mapcat
@@ -66,6 +69,7 @@

 #+clj
 (defn spec-map-defaults
+  "Returns a map of protocol symbol to default implemenation"
   [name-sym]
   {`om/IDisplayName [`(~'display-name [~'_] ~(name name-sym))]})


reverted

reverted

--- src/ontrail/search.clj
+++ src/ontrail/search.clj
@@ -13,7 +13,7 @@
 (def #^{:private true} logger (org.slf4j.LoggerFactory/getLogger (str *ns*)))

 (defn tags-to-string [tags]
-  (apply str (interpose \  tags)))
+  (apply str (interpose " " tags)))

 (defn get-ex-terms [exercise]
   (let [part (partial get exercise)
@@ -28,20 +28,12 @@

 (defn fst [x y] x)

-;(defn insert-term [ex-id term]
-;  (let [index @inverted-index]
-;    (if (not (contains? index term))
-;      (fst 1 (swap! inverted-index assoc term #{ex-id}))
-;      (fst 0 (let [new-val (clojure.set/union (get index term) #{ex-id})]
-;        (swap! inverted-index assoc term new-val))))))
-
-(defn get-val [ex-id term]
-  (if (not (contains? @inverted-index term))
-    #{ex-id}
-    (clojure.set/union (get @inverted-index term) #{ex-id})))
-
 (defn insert-term [ex-id term]
-  (swap! @inverted-index assoc term (get-val ex-id term)))
+  (let [index @inverted-index]
+    (if (not (contains? index term))
+      (fst 1 (swap! inverted-index assoc term #{ex-id}))
+      (fst 0 (let [new-val (clojure.set/union (get index term) #{ex-id})]
+        (swap! inverted-index assoc term new-val))))))

 (defn insert-exercise-inmem-index [ex]
   (let [terms (get-ex-terms ex)


Wrap all inserts in a single transaction

--- adressverzeichnis/migrate.clj
+++ adressverzeichnis/migrate.clj
@@ -179,4 +179,4 @@
                               :address :permissions :numbers) persons)]
     []))

-(print (str/join "\n" (map (comp person-sql parse-person) old)))+(print (str "BEGIN;\n" (str/join "\n" (map (comp person-sql parse-person) old)) "\nCOMMIT;"))


clearing refer

clearing refer

--- src/proxmox/remote.clj
+++ src/proxmox/remote.clj
@@ -16,7 +16,6 @@
     [clojure.core.strint :refer (<<)]
     [proxmox.http-common :refer (root http-opts)]
     [celestial.common :refer (curr-time minute import-logging)]
-    [slingshot.slingshot :refer [try+]]
     [clj-http.client :as client]))

 (import-logging)


Spelling error

Spelling error

--- src/clojure/puppetlabs/certificate_authority/core.clj
+++ src/clojure/puppetlabs/certificate_authority/core.clj
@@ -182,7 +182,7 @@
    :value    public-key})

 (defn key-usage
-  "Create a `Key Usage` extension from a set of flags to emable. See the
+  "Create a `Key Usage` extension from a set of flags to enable. See the
   README.md for the keys supported."
   [flag-set critical]
   {:pre  [(set? flag-set)]


Update core.cljc

Update core.cljc

--- src/re_frame/core.cljc
+++ src/re_frame/core.cljc
@@ -442,8 +442,22 @@
     - `handler` is a function: (db event) -> db
     - `interceptors` is a collection of interceptors. Will be flattened and nils removed.

-  Note: `handler` is wrapped in its own interceptor and added to the end of the interceptor
-  chain, so that, in the end, only a chain is registered.
+  Example Usage:
+
+      (reg-event-db
+        :token
+        (fn [db event]
+          (assoc db :some-key (get event 2)))  ;; return updated db
+
+  Or perhaps:
+
+      (reg-event-db
+        :namespaced/id           ;; <-- namespaced keywords are often used
+        [one two three]          ;; <-- a seq of interceptors
+        (fn [db [_ arg1 arg2]]   ;; <-- event vector is destructured
+          (-> db
+            (dissoc arg1)
+            (update :key + arg2))))   ;; return updated db
   "
   ([id handler]
    (reg-event-db id nil handler))
@@ -459,8 +473,23 @@
     - `handler` is a function: (coeffects-map event-vector) -> effects-map
     - `interceptors` is a collection of interceptors. Will be flattened and nils removed.

-  Note: `handler` is wrapped in its own interceptor and added to the end of the interceptor
-  chain, so that, in the end, only a chain is registered.
+
+  Example Usage:
+
+      (reg-event-fx
+        :token
+        (fn [cofx event]
+          {:db (assoc (:db cofx) :some-key (get event 2))}))   ;; return a map of effects
+
+
+  Or perhaps:
+
+      (reg-event-fx
+        :namespaced/id           ;; <-- namespaced keywords are often used
+        [one two three]          ;; <-- a seq of interceptors
+        (fn [{:keys [db] :as cofx} [_ arg1 arg2]] ;; destructure both arguments
+          {:db       (assoc db :some-key arg1)          ;; return a map of effects
+           :dispatch [:some-event arg2]}))
   "
   ([id handler]
    (reg-event-fx id nil handler))
@@ -475,7 +504,7 @@
     - `id` is typically a namespaced keyword  (but can be anything)
     - `handler` is a function: (context-map event-vector) -> context-map

-  This form of registration is almost never used.
+  This form of registration is seldomAt dinner wenever used.
   "
   ([id handler]
    (reg-event-ctx id nil handler))


added absolute paths to path-join

added absolute paths to path-join

--- src/maqueta/util.clj
+++ src/maqueta/util.clj
@@ -21,4 +21,4 @@

 (defn path-join
   [& args]
-  (io/as-relative-path (apply io/file args)))
+  (.toString (apply io/file args)))


reaction generator now returns a seq not a vector

--- src/matrix_utils.clj
+++ src/matrix_utils.clj
@@ -1,4 +1,5 @@
-(ns matrix-utils)
+(ns matrix-utils
+  (:use utils clj-time.coerce clj-time.local))

 (defrecord RatingMatrix [ptpts cmts matrix])
@@ -35,8 +36,8 @@
   (let [n-reactions (or n-reactions (* n-convs n-ptpts n-cmts))]
     (letfn [(generator [wrapper-fn range]
               (take n-reactions (repeatedly #(wrapper-fn (rand-int range)))))]
-      (mapv list
-        (generator identity n-convs)
+      (map list
+        (generator identity n-convs)
         (generator #(str "p" %) n-ptpts)
         (generator #(str "c" %) n-cmts)
         (generator #(- % 1) 3)))))


fix symbol name (#831)

fix symbol name (#831)

--- ssclj/jar/src/com/sixsq/slipstream/ssclj/app/main.clj
+++ ssclj/jar/src/com/sixsq/slipstream/ssclj/app/main.clj
@@ -38,7 +38,7 @@
   (require server-ns)
   (let [start-fn (-> server-ns
                      find-ns
-                     (ns-resolve 'start-server))]
+                     (ns-resolve 'start))]
     (-> (parse-port port)
         (or default-port)
         start-fn


fix ndot arity

fix ndot arity

--- src/neuseg/train.clj
+++ src/neuseg/train.clj
@@ -7,8 +7,8 @@
   (:import (com.guokr.neuseg.util NGram
                                   NeighborSlider)))

-(defn- ndot [vecs n]
-  (let [mid (/ (dec n) 2)
+(defn- ndot [vecs]
+  (let [mid 4
         mid-vec (nth vecs mid)]
     (map (partial dot mid-vec) (concat (take mid vecs) (drop (inc mid) vecs)))))


move request logging to separate logger and log catched exceptions also.

--- src/ontrail/core.clj
+++ src/ontrail/core.clj
@@ -13,9 +13,11 @@
   (:require [compojure.handler :as handler]
             [compojure.route :as route]
             [monger.collection :as mc]
-            [ring.util.response :as response]))
+            [ring.util.response :as response]
+            [clj-stacktrace.repl :as strp]))

 (def #^{:private true} logger (org.slf4j.LoggerFactory/getLogger (str *ns*)))
+(def #^{:private true} request-logger (org.slf4j.LoggerFactory/getLogger (str *ns* ".requests")))

 (defn json-response [data & [status]]
   {:status (or status 200)
@@ -31,10 +33,12 @@

 (defn log-and-wrap-dir-index [handler]
   (fn [req]
-    (.info logger (str "HTTP" (to-logline req)))
-    (handler
-     (update-in req [:uri]
-                #(if (= "/" %) "/index.html" %)))))
+    (.info request-logger (str "HTTP" (to-logline req)))
+    (try
+      (handler
+        (update-in req [:uri] #(if (= "/" %) "/index.html" %)))
+      (catch Exception e
+        (.error logger (str "Exception in handler:\n%s" (strp/pst-str e)))))))

 (defroutes app-routes
   (GET "/rest/v1/summary/:user" [user] (json-response (get-overall-summary user)))


Flatten nested lets

Flatten nested lets

--- src/reitit/core.cljc
+++ src/reitit/core.cljc
@@ -19,7 +19,7 @@
      :cljs cljs.core.PersistentHashMap)
   (expand [this] this)

-  #?(:clj clojure.lang.Fn
+  #?(:clj  clojure.lang.Fn
      :cljs function)
   (expand [this] {:handler this})

@@ -28,21 +28,21 @@

 (defn walk [data {:keys [path meta routes expand]
                   :or {path "", meta [], routes [], expand expand}}]
-   (letfn
-     [(walk-many [p m r]
-        (reduce #(into %1 (walk-one p m %2)) [] r))
-      (walk-one [pacc macc routes]
-        (if (vector? (first routes))
-          (walk-many pacc macc routes)
-          (let [[path & [maybe-meta :as args]] routes]
-            (let [[meta childs] (if (vector? maybe-meta)
-                                  [{} args]
-                                  [maybe-meta (rest args)])
-                  macc (into macc (expand meta))]
-              (if (seq childs)
-                (walk-many (str pacc path) macc childs)
-                [[(str pacc path) macc]])))))]
-     (walk-one path meta data)))
+  (letfn
+    [(walk-many [p m r]
+       (reduce #(into %1 (walk-one p m %2)) [] r))
+     (walk-one [pacc macc routes]
+       (if (vector? (first routes))
+         (walk-many pacc macc routes)
+         (let [[path & [maybe-meta :as args]] routes
+               [meta childs] (if (vector? maybe-meta)
+                               [{} args]
+                               [maybe-meta (rest args)])
+               macc (into macc (expand meta))]
+           (if (seq childs)
+             (walk-many (str pacc path) macc childs)
+             [[(str pacc path) macc]]))))]
+    (walk-one path meta data)))

 (defn map-meta [f routes]
   (mapv #(update % 1 f) routes))


progress message for log fetch

progress message for log fetch

--- src/revdiff/core.clj
+++ src/revdiff/core.clj
@@ -54,7 +54,11 @@
 ;; object.

 (defn log [object]
-  (:out (sh "svn" "log" shhh "--stop-on-copy" "--xml" object)))
+  (print "Fetching log...")
+  (flush)
+  (let [log (:out (sh "svn" "log" shhh "--stop-on-copy" "--xml" object))]
+    (println)
+    log))

 ;; Obtain a diff from svn for the given object between the specified revisions.
 ;; Break each diff into blocks (delineated by the text "Index: "), where each


Optimize rendering.

Optimize rendering.

* Limit to 30 FPS
* Only re-draw if something visible changed

--- src/tetris/core.cljs
+++ src/tetris/core.cljs
@@ -12,7 +12,9 @@
 (def screen-height 440)
 (def blocks-h 10)
 (def blocks-v 24)
-(def game-loop-freq 10)
+(def fps 30)
+(def game-loop-freq 30)
+(def render-freq (/ 1000 30))
 (def block-size (/ screen-width blocks-h))
 (def block-border-size 1)
 (def rendering-offset [0 -2])
@@ -296,7 +298,8 @@

 (def time-flow (chan))

-(def game-state (atom {:rows (sorted-map)
+(def game-state (atom {:last-update 0
+                       :rows (sorted-map)
                        :tetrimino nil
                        :next-tetrimino (random-tetrimino)
                        :gravity-interval 500
@@ -342,26 +345,41 @@
    (doseq [block blocks]
      (draw-block ctx offset block))))

-(defn render
-  "Draws everything on the screen."
+(defn render-game?
+  [old-state new-state]
+  (let [f (juxt :tetrimino :rows)]
+    (not= (f old-state) (f new-state))))
+
+(defn render-game
+  "Draws on the screen."
   [{t :tetrimino
-    tn :next-tetrimino
-    rows :rows
-    score :score
-    level :level}]
+    rows :rows}]
+  (draw-background screen-ctx "#2a2f34")
+  (draw-blocks screen-ctx rendering-offset (tetrimino->blocks t))
+  (draw-blocks screen-ctx rendering-offset (rows->blocks rows)))
+
+(defn render-bar?
+  [old-state new-state]
+  (let [f (juxt :next-tetrimino :score :level)]
+    (not= (f old-state) (f new-state))))
+
+(defn render-bar
+  "Renders elements on the right bar."
+  [{tn :next-tetrimino score :score level :level}]
+  (draw-background preview-ctx "#3b4045")
   (aset score-text "innerText" score)
   (aset level-text "innerText" level)
-  (draw-background screen-ctx "#2a2f34")
-  (draw-background preview-ctx "#3b4045")
-  (when t (draw-blocks screen-ctx rendering-offset (tetrimino->blocks t)))
-  (when tn (draw-blocks preview-ctx (tetrimino->blocks tn)))
-  (draw-blocks screen-ctx rendering-offset (rows->blocks rows)))
+  (draw-blocks preview-ctx (tetrimino->blocks tn)))

 (defn render-loop
   "Starts the rendering loop using requestAnimationFrame callback."
-  []
-  (render @game-state)
-  (.requestAnimationFrame js/window render-loop))
+  [{:keys [last-update] :as old-state}]
+  (if (zero? (time-left last-update render-freq))
+    (let [new-state @game-state]
+      (when (render-game? old-state new-state) (render-game new-state))
+      (when (render-bar? old-state new-state) (render-bar new-state))
+      (.requestAnimationFrame js/window (partial render-loop (assoc new-state :last-update (current-timestamp)))))
+    (.requestAnimationFrame js/window (partial render-loop old-state))))

 (defn run-game-cycle
   "Puts everything together."
@@ -377,7 +395,7 @@
           (= mode :game) maybe-game-over))

 (.addEventListener js/document "keydown" #(swap! game-state handle-key-press (.-keyCode %)) false)
-(render-loop)
+(render-loop @game-state)
 (go-loop [_ nil]
   (swap! game-state run-game-cycle)
   (recur (<! (timeout (<! time-flow)))))


Assume configuration file is specified in last argument

--- src/whitman/core.clj
+++ src/whitman/core.clj
@@ -18,4 +18,4 @@
 (defn -main [& args]
   (if (< (count args) 1)
     (exit 1 "No configuration file specified")
-    (do-crawl (config/read-config (nth args 0)) :db)))
+    (do-crawl (config/read-config (last args)) :db)))


Fixing CMR-4210 changed comparator and clojure.string style as suggested in the PR.

--- umm-spec-lib/src/cmr/umm_spec/validation/platform.clj
+++ umm-spec-lib/src/cmr/umm_spec/validation/platform.clj
@@ -1,6 +1,7 @@
 (ns cmr.umm-spec.validation.platform
   "Defines validations for UMM collection platform."
   (:require
+   [clojure.string :as string]
    [cmr.common.services.errors :as errors]
    [cmr.common.validations.core :as v]
    [cmr.umm-spec.validation.umm-spec-validation-utils :as vu]))
@@ -54,14 +55,14 @@
    The element order is ShortName, Name, Value. The values are separated by the Unicode Character 'SYMBOL FOR GROUP SEPARATOR' \u241D character."
   [duplicate-name]
   (when duplicate-name
-    (let [platform-elements (clojure.string/split duplicate-name #"\u241D")
+    (let [platform-elements (string/split duplicate-name #"\u241D")
           platform-counts (count platform-elements)
           shortname (first platform-elements)
           characteristic-name (second platform-elements)
           characteristic-value (last platform-elements)]
       ;; The case of 0 or greater than 3 shouldn't exist.  If it is either value then the validation
       ;; software is not working.
-      (if (or (< platform-counts 1) (> platform-counts 3))
+      (if-not (<= 1 platform-counts 3)
         (errors/throw-service-error (Exception. "The platform validation checking for duplicates either has 0 or more than 3 elements, neither is valid. There is a software problem."))
         (case platform-counts
           1  (format "The Platform ShortName [%s] must be unique. This record contains duplicates." shortname)


Format code to yada standards

Format code to yada standards

--- src/yada/cookies.clj
+++ src/yada/cookies.clj
@@ -18,16 +18,16 @@

 ;; The form a Set-Cookie should take prior to serialization
 (s/defschema SetCookie
-  {:value                              (s/pred #(re-matches syn/cookie-value %))
-   (s/optional-key :expires)           (s/cond-pre s/Inst (s/pred #(instance? java.time.Duration %)) Rfc822String)
-   (s/optional-key :max-age)           (s/cond-pre s/Str s/Int)
-   (s/optional-key :domain)            (s/pred #(re-matches syn/subdomain %) "domain")
-   (s/optional-key :path)              (s/pred #(re-matches syn/path %))
-   (s/optional-key :secure)            s/Bool
-   (s/optional-key :http-only)         s/Bool
+  {:value (s/pred #(re-matches syn/cookie-value %))
+   (s/optional-key :expires) (s/cond-pre s/Inst (s/pred #(instance? java.time.Duration %)) Rfc822String)
+   (s/optional-key :max-age) (s/cond-pre s/Str s/Int)
+   (s/optional-key :domain) (s/pred #(re-matches syn/subdomain %) "domain")
+   (s/optional-key :path) (s/pred #(re-matches syn/path %))
+   (s/optional-key :secure) s/Bool
+   (s/optional-key :http-only) s/Bool
    ;; technically this could also support a boolean which would default
    ;; to :strict, but let's be explicit about it
-   (s/optional-key :same-site)         (s/enum :strict :lax)
+   (s/optional-key :same-site) (s/enum :strict :lax)
    (s/constrained s/Keyword namespace) s/Any})

 (s/defschema Cookies
@@ -40,8 +40,12 @@
   (sc/coercer Cookies CookieMappings))

 (def set-cookie-attrs
-  {:domain    "Domain", :max-age "Max-Age", :path      "Path"
-   :secure    "Secure", :expires "Expires", :http-only "HttpOnly"
+  {:domain "Domain"
+   :max-age "Max-Age"
+   :path "Path"
+   :secure "Secure"
+   :expires "Expires"
+   :http-only "HttpOnly"
    :same-site "SameSite"})

 (defn encode-attributes [cv]
@@ -111,8 +115,7 @@
                   :secure (assoc acc :secure v)
                   :http-only (assoc acc :http-only v)
                   :name acc
-                  (if (namespace k) (assoc acc k v) acc)
-                  ))
+                  (if (namespace k) (assoc acc k v) acc)))
               {}
               cookie-def)
              (if (instance? Cookie val)
@@ -180,5 +183,4 @@
     (let [resource-cookies (resource-cookies ctx)]
       (cond-> ctx
         request-cookies (assoc :cookies request-cookies)
-        resource-cookies (process-cookies resource-cookies)
-        ))))
+        resource-cookies (process-cookies resource-cookies)))))


Improved DELETE semantics

Improved DELETE semantics

--- src/yada/methods.clj
+++ src/yada/methods.clj
@@ -251,6 +251,33 @@

 ;; --------------------------------------------------------------------------------

+(defprotocol DeleteResult
+  (interpret-delete-result [_ ctx]))
+
+(extend-protocol DeleteResult
+  Response
+  (interpret-delete-result [response ctx]
+    (assoc ctx :response response))
+
+  Boolean
+  (interpret-delete-result [b ctx]
+    (if b (assoc-in ctx [:response :status] 204)
+        (throw (ex-info "Failed to process POST" {}))))
+
+  String
+  (interpret-delete-result [s ctx]
+    (-> ctx
+        (assoc-in [:response :status] 200)
+        (assoc-in [:response :body] s)))
+
+  clojure.lang.Fn
+  (interpret-delete-result [f ctx]
+    (interpret-delete-result (f ctx) ctx))
+
+  nil
+  (interpret-delete-result [_ ctx]
+    (assoc-in ctx [:response :status] 204)))
+
 (deftype DeleteMethod [])

 (extend-protocol Method


CMR-3685: Removed commented out function

--- common-app-lib/src/cmr/common_app/api/enabled.clj
+++ common-app-lib/src/cmr/common_app/api/enabled.clj
@@ -29,13 +29,6 @@
   (stl-cache/create-single-thread-lookup-cache
     (consistent-cache/create-consistent-cache {:hash-timeout-seconds (enabled-cache-time-seconds)})))

-; (defn expire-consistent-cache-hashes
-;   "Forces the cached hash codes of a consistent cache to expire so that subsequent requests for
-;    enabled state will check cubby for consistency."
-;   [context]
-;   (let [cache (cache/context->cache context enabled-cache-key)]
-;     (consistent-cache/expire-hash-cache-timeouts (:delegate-cache cache))))
-
 (defn service-disabled-message
   "Creates a message indicating that the given service is disabled."
   [service]
@@ -48,7 +41,7 @@

 (defn app-enabled?
   "Returns true if the application is enabled, false otherwise. We use a cache to prevent enabled?
-  check calls. Enabled can mean different things for different apps. Disabled ingest prevents
+  check calls. Enabled can mean different things for different apps. Disabled ingest prevents
   writes, but otherwise allows operations to proceed."
   [context]
   (if-let [cache (cache/context->cache context enabled-cache-key)]
@@ -61,7 +54,7 @@
 (defn- app-enabled-response
   "Creates an appropriate response for /enabled queries."
   [request-context]
-  {:status 200
+  {:status 200
    :headers {"Content-Type" (mt/with-utf-8 mt/json)}
    :body (json/generate-string (if (app-enabled? request-context) "Enabled" "Disabled"))})

@@ -71,12 +64,12 @@
   (if-let [cache (cache/context->cache context enabled-cache-key)]
     (do (cache/set-value cache enabled-cache-key false)
         ;; (expire-consistent-cache-hashes context)
-        {:status 200
+        {:status 200
          :headers {"Content-Type" (mt/with-utf-8 mt/json)}
          :body (json/generate-string "Application successfully disabled.")})
     (do
       (error "Application enabled state is not being cached. Could not disable application.")
-      {:status 500
+      {:status 500
        :headers {"Content-Type" (mt/with-utf-8 mt/json)}
        :body (json/generate-string "'Enabled' cache is not available.")})))

@@ -86,12 +79,12 @@
   (if-let [cache (cache/context->cache context enabled-cache-key)]
     (do (cache/set-value cache enabled-cache-key true)
         ;; (expire-consistent-cache-hashes context)
-        {:status 200
+        {:status 200
          :headers {"Content-Type" (mt/with-utf-8 mt/json)}
          :body (json/generate-string "Application successfully enabled.")})
     (do
       (error "Application enabled state is not being cached. Could not enable application.")
-      {:statud 500
+      {:statud 500
        :headers {"Content-Type" (mt/with-utf-8 mt/json)}
        :body (json/generate-string "'Enabled' cache is not available.")})))


a whole new world

a whole new world

--- ros/angelic_planning/src/ros/world.clj
+++ ros/angelic_planning/src/ros/world.clj
@@ -402,7 +402,7 @@
 	     :type :movable :on "table" :goal nil ;["table" (make-xy-region [17.7 18.0] [26.0 26.2])]
 	      :height 0.2}
     "bottle2" {:xyz [16.3 27.0 0.85] :rpy [0 0 0] :def (get-odwalla)
-	     :type :movable :on "table" :goal nil #_["endtable"] #_["table" (make-xy-region [16.21 16.8] [26.2 26.5])] :height 0.2}
+	     :type :movable :on "table" :goal ["endtable"] #_["table" (make-xy-region [16.21 16.8] [26.2 26.5])] :height 0.2}
     "bottle3" {:xyz [12.4 26.1 0.70] :rpy [0 0 0] :def (get-odwalla)
 	     :type :movable :on "endtable" :goal ["table" ] :height 0.2}
     }


Fixing index set app

Fixing index set app

--- index-set-app/project.clj
+++ index-set-app/project.clj
@@ -6,6 +6,7 @@
                  [nasa-cmr/cmr-acl-lib "0.1.0-SNAPSHOT"]
                  [nasa-cmr/cmr-elastic-utils-lib "0.1.0-SNAPSHOT"]
                  [nasa-cmr/cmr-common-app-lib "0.1.0-SNAPSHOT"]
+                 [org.clojure/tools.nrepl "0.2.11"]
                  [compojure "1.4.0"]
                  [ring/ring-core "1.4.0" :exclusions [clj-time]]
                  [ring/ring-json "0.4.0"]]


Update help

Update help

--- src/egg/cli.clj
+++ src/egg/cli.clj
@@ -8,6 +8,9 @@
         options-summary
         ""
         "Commands are:"
+        ""
+        "build      Run the build command, producing a Dockerfile"
+        "up         Run arbitary commands (typically against the language build-tool)"
         "validate   Validate an egg meets service requirements"
         "           (https://github.com/guardian/service)"
         ""


Clean up unbalanced parens

Clean up unbalanced parens

--- src-cljs/frontend/components/pieces/page_header.cljs
+++ src-cljs/frontend/components/pieces/page_header.cljs
@@ -19,8 +19,7 @@
             [:li
              [:a {:href path
                   :title name
-                  :on-click #((js/console.log "--------- owner:" owner)
-                              (om/get-shared owner :track-event) {:event-type track-event-type})}
+                  :on-click #((om/get-shared owner :track-event) {:event-type track-event-type})}
                  name " "]]))))))

 (defmulti crumb
@@ -54,14 +53,14 @@
   (om/build crumb-node {:name (cond
                                 tag (utils/trim-middle (utils/display-tag tag) 45)
                                 branch (utils/trim-middle (utils/display-branch branch) 45)
-                                :else "...")}
+                                :else "...")
                        :path (when branch
                                (routes/v1-dashboard-path {:vcs_type vcs_type
                                                           :org username
                                                           :repo project
                                                           :branch branch}))
                        :track-event-type :breadcrumb-project-branch-clicked
-                       :active active))
+                       :active active}))

 (defmethod crumb :build
   [{:keys [vcs_type username project build-num active]}]


Fix announcement bar

Fix announcement bar

--- src/clj/collect_earth_online/views.clj
+++ src/clj/collect_earth_online/views.clj
@@ -47,40 +47,40 @@

 (defn- announcement-banner []
   (let [announcement (slurp "announcement.txt")] ; TODO This will be moved to the front end for better UX.
-    (when (pos? (count announcement))
-      [:div#banner {:style {:background-color "#f96841"
-                            :box-shadow       "3px 1px 4px 0 rgb(0, 0, 0, 0.25)"
-                            :color            "#ffffff"
-                            :margin           "0px"
-                            :padding          "5px"
-                            :position         "fixed"
-                            :text-align       "center"
-                            :top              "0"
-                            :right            "0"
-                            :left             "0"
-                            :width            "100vw"
-                            :z-index          "10000"}}
-       [:p {:style {:font-size   "18px"
-                    :font-weight "bold"
-                    :margin      "0 30px 0 0"}}
-        announcement]
-       [:button {:style   {:background-color "transparent"
-                           :border-color     "#ffffff"
-                           :border-radius    "50%"
-                           :border-style     "solid"
-                           :border-width     "2px"
-                           :cursor           "pointer"
-                           :display          "flex"
-                           :height           "25px"
-                           :padding          "0"
-                           :position         "fixed"
-                           :right            "10px"
-                           :top              "5px"
-                           :width            "25px"}
-                 :onClick "document.getElementById('banner').style.display='none'"}
-        [:svg {:viewBox "0 0 48 48" :fill "#ffffff"}
-         [:path {:d "M38 12.83l-2.83-2.83-11.17 11.17-11.17-11.17-2.83 2.83 11.17 11.17-11.17 11.17 2.83 2.83
-                     11.17-11.17 11.17 11.17 2.83-2.83-11.17-11.17z"}]]]])))
+    [:div#banner {:style {:background-color "#f96841"
+                          :box-shadow       "3px 1px 4px 0 rgb(0, 0, 0, 0.25)"
+                          :color            "#ffffff"
+                          :display          (if (pos? (count announcement)) "block" "none")
+                          :margin           "0px"
+                          :padding          "5px"
+                          :position         "fixed"
+                          :text-align       "center"
+                          :top              "0"
+                          :right            "0"
+                          :left             "0"
+                          :width            "100vw"
+                          :z-index          "10000"}}
+     [:p {:style {:font-size   "18px"
+                  :font-weight "bold"
+                  :margin      "0 30px 0 0"}}
+      announcement]
+     [:button {:style   {:background-color "transparent"
+                         :border-color     "#ffffff"
+                         :border-radius    "50%"
+                         :border-style     "solid"
+                         :border-width     "2px"
+                         :cursor           "pointer"
+                         :display          "flex"
+                         :height           "25px"
+                         :padding          "0"
+                         :position         "fixed"
+                         :right            "10px"
+                         :top              "5px"
+                         :width            "25px"}
+               :onClick "document.getElementById('banner').style.display='none'"}
+      [:svg {:viewBox "0 0 48 48" :fill "#ffffff"}
+       [:path {:d "M38 12.83l-2.83-2.83-11.17 11.17-11.17-11.17-2.83 2.83 11.17 11.17-11.17 11.17 2.83 2.83
+                     11.17-11.17 11.17 11.17 2.83-2.83-11.17-11.17z"}]]]]))

 (defn render-page [uri]
   (fn [request]


more small changes

more small changes

--- src/clj/org/openforis/ceo/db/plots.clj
+++ src/clj/org/openforis/ceo/db/plots.clj
@@ -1,13 +1,14 @@
 (ns org.openforis.ceo.db.plots
   (:import java.sql.Timestamp)
-  (:require [org.openforis.ceo.database :refer [call-sql sql-primitive]]
+  (:require [org.openforis.ceo.utils.type-conversion :as tc]
+            [org.openforis.ceo.database        :refer [call-sql sql-primitive]]
             [org.openforis.ceo.db.institutions :refer [is-inst-admin-query?]]
-            [org.openforis.ceo.utils.type-conversion :as tc]
-            [org.openforis.ceo.views :refer [data-response]]))
+            [org.openforis.ceo.views           :refer [data-response]]))

 (defn- time-plus-five-min []
   (Timestamp. (+ (System/currentTimeMillis) (* 5 60 1000))))

+;; TODO if we use a more efficient SQL call, we can return more plots.
 (defn get-project-plots [{:keys [params]}]
   (let [project-id (tc/str->int (:projectId params))
         max-plots  (tc/str->int (:max params) 1000)]
@@ -18,18 +19,20 @@
                             :analyses assigned})
                          (call-sql "select_limited_project_plots" project-id max-plots)))))

-(defn- clean-extra-plot-info [extra-plot-info]
-  (or (dissoc (tc/jsonb->clj extra-plot-info) :gid :lat :lon :plotid)
-      {}))
-
 (defn- prepare-sample-object [plot-id project-id]
   (mapv (fn [{:keys [sample_id point sampleId geom value]}]
           {:id       sample_id
            :point    point
-           :sampleId sampleId ;TODO I dont think we we distinguish between sample_id and sampleId so this could go away
+           :sampleId sampleId ;TODO I don't think we we distinguish between sample_id and sampleId so this could go away
            :geom     (tc/jsonb->clj geom)
-           :value    (if (< 2 (count (str value))) (tc/jsonb->clj value) {})})
+           :value    (if (< 2 (count (str value)))
+                       (tc/jsonb->clj value)
+                       {})})
         (call-sql "select_plot_samples" plot-id project-id)))
+
+(defn- clean-extra-plot-info [extra-plot-info]
+  (or (dissoc (tc/jsonb->clj extra-plot-info) :gid :lat :lon :plotid)
+      {}))

 (defn- build-plot-object [plot-info project-id]
   (let [{:keys [plot_id center flagged plotId geom extra_plot_info]} plot-info]


Fix reflection warning

Fix reflection warning

--- src/clj_chrome_devtools/automation.clj
+++ src/clj_chrome_devtools/automation.clj
@@ -58,7 +58,7 @@
 (defrecord Automation [connection root on-close]
   java.lang.AutoCloseable
   (close [this]
-    (.close connection)
+    (.close ^java.lang.AutoCloseable connection)
     (when on-close
       (on-close this))))


Export gif animations at the current zoom level

--- src/cljs/goya/components/mainmenu.cljs
+++ src/cljs/goya/components/mainmenu.cljs
@@ -117,12 +117,13 @@
   (let [render-canvas (. js/document (createElement "canvas"))
         width (get-in @app/app-state [:main-app :canvas-width])
         height (get-in @app/app-state [:main-app :canvas-height])
+        zoom-factor (get-in @app/app-state [:zoom-factor])
         animation (get-in @app/app-state [:main-app :animation])
         background-color (get-in @app/app-state [:main-app :background-color])
         gif (js/GIF. #js {:workers 4
                           :quality 1
-                          :width width
-                          :height height
+                          :width (* width zoom-factor)
+                          :height (* height zoom-factor)
                           :workerScript "./gifjs/dist/gif.worker.js"})]
     (om/set-state! owner :is-processing true)
     (om/set-state! owner :progress 0)
@@ -130,8 +131,8 @@
       (let [frame (nth animation x)
             image-data (get-in frame [:image-data])
             context (.getContext render-canvas "2d")]
-        (canvasdrawing/draw-image-to-canvas image-data render-canvas width height 1 background-color)
-        (.addFrame gif context #js {:copy true :delay 300})))
+        (canvasdrawing/draw-image-to-canvas image-data render-canvas width height zoom-factor background-color)
+        (.addFrame gif context #js {:copy true :delay 200})))
     (.on gif "finished" #(download-history-animation % owner))
     (.on gif "progress" #(show-progress % owner))
     (.render gif)))


Update copy + whitespcae

Update copy + whitespcae

--- src/cljs/new_website/static_views.cljs
+++ src/cljs/new_website/static_views.cljs
@@ -17,405 +17,421 @@
 (def courses
   {:computer-science
    (str/join
-    ", "
-    ["Computer Organization and Systems"
-     "Algorithms"
-     "Optimization and Graduate Algorithms"
-     "Data Mining"
-     "Data Mining for Cyber Security"
-     "Linear Dynamical Systems"])
+     ", "
+     ["Computer Organization and Systems"
+      "Algorithms"
+      "Optimization and Graduate Algorithms"
+      "Data Mining"
+      "Data Mining for Cyber Security"
+      "Linear Dynamical Systems"])
    :physics
    (str/join
-    ", "
-    ["Quantum Field Theory I"
-     "General Relativity"
-     "Low Temperature Physics Lab"
-     "Lasers Laboratory"
-     "Statistical Mechanics and Thermodynamics I + II"
-     "Hamiltonian Mechanics"
-     "Electricity and Magnetism"
-     "Quantum Mechanics"
-     "Introduction to Particle Physics"
-     "Introduction to Cosmology"
-     "Electrons and Photons"])
+     ", "
+     ["Quantum Field Theory I"
+      "General Relativity"
+      "Low Temperature Physics Lab"
+      "Lasers Laboratory"
+      "Statistical Mechanics and Thermodynamics I + II"
+      "Hamiltonian Mechanics"
+      "Electricity and Magnetism"
+      "Quantum Mechanics"
+      "Introduction to Particle Physics"
+      "Introduction to Cosmology"
+      "Electrons and Photons"])
    :math
    (str/join
-    ", "
-    ["Graduate Algebra I + II"
-     "Functional Analysis"
-     "Convex Optimization I + II"])})
+     ", "
+     ["Graduate Algebra I + II"
+      "Functional Analysis"
+      "Convex Optimization I + II"])})

 (defcomponent resume-paragraphs-section [paragraphs _]
   (render
-   [_]
-   (dom/div
-    {:class "resume-paragraphs"}
-    (map dom/p paragraphs))))
+    [_]
+    (dom/div
+      {:class "resume-paragraphs"}
+      (map dom/p paragraphs))))

 (defcomponent resume-education-section [{:keys [school gpa content]} _]
   (render
-   [_]
-   (dom/div
-    (dom/div
-     {:class "table"}
-     (dom/i school)
-     (dom/div {:class "right"} (dom/p (str "GPA " gpa))))
-    (dom/div
-     (map dom/p content)))))
+    [_]
+    (dom/div
+      (dom/div
+        {:class "table"}
+        (dom/i school)
+        (dom/div {:class "right"} (dom/p (str "GPA " gpa))))
+      (dom/div
+        (map dom/p content)))))

 (defcomponent resume-experience-item [{:keys [title for start end content]} _]
   (render
-   [_]
-   (dom/div
-    (dom/div
-     {:class "table experience-header"}
-     (dom/p
-      (dom/strong title)
-      (dom/span (str " " for)))
-     (dom/p
-      {:class "right"}
-      (dom/span
-       (str start " - " (or end "present")))))
-    (om/build resume-paragraphs-section content))))
+    [_]
+    (dom/div
+      (dom/div
+        {:class "table experience-header"}
+        (dom/p
+          (dom/strong title)
+          (dom/span (str " " for)))
+        (dom/p
+          {:class "right"}
+          (dom/span
+            (str start " - " (or end "present")))))
+      (om/build resume-paragraphs-section content))))

 (defcomponent resume-experience-section [content _]
   (render
-   [_]
-   (dom/div
-    {:class "experience-sections"}
-    (om/build-all resume-experience-item content))))
+    [_]
+    (dom/div
+      {:class "experience-sections"}
+      (om/build-all resume-experience-item content))))

 (defcomponent resume-skills-section [{:keys [proficient experienced]} _]
   (render
-   [_]
-   (dom/div
-    (dom/div
-     {:class "table"}
-     (dom/p (dom/i "Proficient"))
-     (dom/p {:class "right"} (dom/span (str/join ", " proficient))))
-    (dom/div
-     {:class "table"}
-     (dom/p (dom/i "Experienced"))
-     (dom/p {:class "right"} (dom/span (str/join ", " experienced)))))))
+    [_]
+    (dom/div
+      (dom/div
+        {:class "table"}
+        (dom/p (dom/i "Proficient"))
+        (dom/p {:class "right"} (dom/span (str/join ", " proficient))))
+      (dom/div
+        {:class "table"}
+        (dom/p (dom/i "Experienced"))
+        (dom/p {:class "right"} (dom/span (str/join ", " experienced)))))))

 (defcomponent resume-talks-section [talks-for-resume _]
   (render
-   [_]
-   (dom/div
-    (om/build-all talks/talk-view talks-for-resume))))
+    [_]
+    (dom/div
+      (om/build-all talks/talk-view talks-for-resume))))

 (defcomponent resume-row [{:keys [title row-type content]} _]
   (render
-   [_]
-   (dom/div
-    {:class "table resume-row"}
-    (dom/div
-     (dom/h2 title))
-    (let [components {:education #'resume-education-section
-                      :paragraphs #'resume-paragraphs-section
-                      :experience #'resume-experience-section
-                      :skills #'resume-skills-section
-                      :talks #'resume-talks-section}
-          component (row-type components)]
-       (om/build component content)))))
+    [_]
+    (dom/div
+      {:class "table resume-row"}
+      (dom/div
+        (dom/h2 title))
+      (let [components {:education #'resume-education-section
+                        :paragraphs #'resume-paragraphs-section
+                        :experience #'resume-experience-section
+                        :skills #'resume-skills-section
+                        :talks #'resume-talks-section}
+            component (row-type components)]
+        (om/build component content)))))

 (defcomponent resume-view [state _]
   (will-mount
-   [_]
-   (if-not (:talks @state)
-     (GET (util/edn-endpoint "talks")
-          {:headers {"Accept" "application/edn"}
-           :response-format (edn-response-format)
+    [_]
+    (if-not (:talks @state)
+      (GET (util/edn-endpoint "talks")
+        {:headers {"Accept" "application/edn"}
+         :response-format (edn-response-format)
+         :handler
+         (fn [resp]
+           (om/transact! state :talks (constantly resp)))})))
+  (render
+    [_]
+    (dom/article
+      {:id "resume"}
+      (dom/div
+        {:id "resume-header" :class "hruled"}
+        (dom/h1 "Conrad Stansbury")
+        (dom/p "2235 California St. Apt 233")
+        (dom/p "Mountain View, CA 94040"))
+      (om/build-all
+        resume-row
+        [{:title "Education"
+          :row-type :education
+          :content {:school "Stanford University"
+                    :content ["Graduated Jun 2015, BS Physics with Distinction and Honors, "
+                              "concentration in theoretical physics"]
+                    :gpa 4.01}}
+         {:title "Coursework"
+          :row-type :paragraphs
+          :content
+          (-> courses
+            (select-keys [:computer-science :math])
+            vals)}
+         {:title "Experience"
+          :row-type :experience
+          :content [{:title "Research Intern"
+                     :for "SLAC National Laboratory"
+                     :start "June 2013"
+                     :end "June 2015"
+                     :content
+                     [(str
+                        "Working with the ATLAS group on two data analysis projects "
+                        "to improve the resolution of Large Hadron Collier "
+                        "experiments. Investigated several machine learning "
+                        "techniques for jet finding and developed a jet classifier "
+                        "competitive with state of the art.")
+                      (str
+                        "Since June 2014, researched model based clustering "
+                        "for jet finding. Wrote 10k+ lines of algorithmic C++ to "
+                        "conduct and automate statistical analyses that handle TBs of data "
+                        "and generate plots and histograms to communicate results.")]}
+                    {:title "Instructor,"
+                     :for "Stanford Physics 91SI"
+                     :start "March 2015"
+                     :end "June 2015"
+                     :content
+                     [(str
+                        "Designed and created lecture materials, met with faculty "
+                        "to plan the curriculum, and lectured weekly for Physics 91SI, "
+                        "scientific computing in Python, at Stanford.")]}
+                    {:title "FEA"
+                     :start "February 2015"
+                     :content
+                     [(str
+                        "Wrote a finite element analysis in C as well as a Scheme "
+                        "interpreter to generate meshes and provide high level problem "
+                        "definitions to the solver. Also implemented a lexer and "
+                        "a recursive descent parser combinator for reading Scheme.")]}
+                    {:title "Web Server"
+                     :start "September 2014"
+                     :end "June 2015"
+                     :content
+                     [(str
+                        "Created a web server from the "
+                        "ground up using Haskell + HTML5/CSS + JS. The site "
+                        "running on it hosts completed and ongoing projects, "
+                        "research, public documents, and papers. You're looking "
+                        "at it! (or you were until recently, I've recently moved to "
+                        "an SPA running on nginx/Clojure/ClojureScript/LESS due "
+                        "more dynamic content accumulating on my site)")]}
+                    {:title "Chess Engine"
+                     :start "June 2012"
+                     :end "December 2014"
+                     :content
+                     [(str
+                        "Designed and built a chess engine in C + x86 assembly. "
+                        "The engine uses alpha-beta pruning with aspiration windows, "
+                        "a variety of advanced data structures, and multithreading "
+                        "to assess millions of positions per second. Ran Python-"
+                        "scripted tournaments to tune engine parameters with "
+                        "machine learning.")]}]}
+         {:title "Talks"
+          :row-type :talks
+          :content (filterv #(not= (:kind %) :zanbato-tech-talk) (:talks @state))}
+         {:title "Skills"
+          :row-type :skills
+          :content {:proficient ["C{++}" "Python" "Clojure/ClojureScript"
+                                 "HTML/CSS" "JavaScript"
+                                 "UNIX" "LaTeX" "ROOT"]
+                    :experienced ["Ruby" "Mathematica/Matlab" "Haskell"]}}
+         {:title "Activities + Interests"
+          :row-type :paragraphs
+          :content [(str/join
+                      ", "
+                      ["Hiking" "running" "biking" "writing short stories" "cooking"])]}]))))
+
+(defcomponent welcome-page-view [state _]
+  (render
+    [_]
+    (dom/div
+      {:class "content-header statement"}
+      (dom/p "Hi, I'm Conrad.")
+      (dom/p
+        (dom/span "I am a graduate student in physics working as part of the ")
+        (dom/a {:href "http://research.physics.berkeley.edu/lanzara/"} "Lanzara Lab")
+        (dom/span
+          (str
+            ". My current interests include developing and using powerful new "
+            "spectroscopic tools like time resolved ARPES and THz optical reflectivity "
+            "to understand topological states of matter and correlated systems. "
+            "I am also interested in the problem of developing computational tools "
+            "to better leverage the wealth of data that modern experimental probes "
+            "and first principles calculations "
+            "provide to drive discoveries of new phases of matter in physics and "
+            "materials science.")))
+      (dom/p
+        (dom/span
+          (str
+            "Previous to my graduate student career I worked most recently as "
+            "a software engineer at Zanbato to build efficient private markets.")))
+      (dom/p
+        (dom/span
+          (str "To see some of what I've been working on, take a look around "
+            "or head over to my GitHub. Alternatively, if you want to get "
+            "in touch, send me an email or "))
+        (dom/a {:href "#/todo"} "let me know when you're free")
+        (dom/span " and I'll get back to you quickly."))
+      (dom/p "Thanks for visiting."))))
+
+(defcomponent contact-view [state _]
+  (render
+    [_]
+    (dom/div
+      {:class "contact-table contact-container"}
+      (dom/div
+        {:class "table"}
+        (dom/div {:class "heading-left"} (dom/p "Phone"))
+        (dom/div {:class "right"} (dom/p {:class "phone-number"} "703 317 7012")))
+      (dom/div
+        {:class "table"}
+        (dom/div {:class "heading-left"} (dom/p "Email"))
+        (dom/div
+          {:class "right"}
+          (dom/p "chstansbury at gmail.com")
+          (dom/p "chstan at berkeley.edu")
+          (dom/p "chstansbury at lbl.gov"))))))
+
+(defcomponent book-component [book _]
+  (render
+    [_]
+    (dom/div
+      {:class "book"}
+      (dom/cite (:title book))
+      (dom/div
+        {:class "table"}
+        (dom/p (:author book))
+        (dom/p {:class "right"} (if (:finished book) (:completion-date book) "-"))))))
+
+(defmulti paper-view
+  (fn [paper _] (:kind paper)))
+
+(defcomponentmethod paper-view :thesis
+  [thesis _]
+  (render
+    [_]
+    (dom/div
+      {:class "talks-wrapper"} ;; My CSS needs cleaning up clearly
+      (dom/p
+        (dom/a {:href (:url thesis)} (:name thesis))
+        (str ", " (:date thesis) ".  ")))))
+
+(defcomponentmethod paper-view :preprint
+  [preprint _]
+  (render
+    [_]
+    (dom/div
+      {:class "talks-wrapper"} ;; My CSS needs cleaning up clearly
+      (dom/p
+        (str/join ", " (:authors preprint))
+        ", " (dom/a {:href (:url preprint)} (:name preprint))
+        (str ", " (:arxiv-id preprint))
+        (str ", " (:date preprint) ".  ")))))
+
+(defcomponent papers-view [state _]
+  (will-mount
+    [_]
+    (if-not (:papers @state)
+      (GET (util/edn-endpoint "papers")
+        {:headers {"Accept" "application/edn"}
+         :response-format (edn-response-format)
+         :handler
+         (fn [resp]
+           (om/transact! state :papers (constantly resp)))})))
+  (render
+    [_]
+    (dom/div
+      (for [[kind label] [[:preprint "Preprints"]
+                          [:published "Published"]
+                          [:thesis "Theses"]]]
+        (let [papers (filter #(= kind (:kind %)) (:papers @state))]
+          (if (seq papers)
+            (dom/div
+              {:class "talks-container"}
+              (dom/div
+                {:class "talks-section-header"}
+                (dom/p label))
+              (om/build-all paper-view papers))))))))
+
+(defcomponent reading-view [state _]
+  (will-mount
+    [_]
+    (if-not (:reading @state)
+      (GET (util/edn-endpoint "reading")
+        {:headers {"Accept" "application/edn"}
+         :response-format (edn-response-format)
+         :handler
+         (fn [resp]
+           (om/update! state :reading resp))})))
+  (render
+    [_]
+    (dom/div
+      (dom/div
+        {:class "books-header"}
+        (dom/p "A record of books I've read lately, to come back to later."))
+      (om/build-all book-component
+        (sort (fn [x] (not (:finished x))) (:reading @state))))))
+
+(defcomponent writing-view [state _]
+  (will-mount
+    [_]
+    (if-not (:writing @state)
+      (GET (util/edn-endpoint "writing")
+        {:headers {"Accept" "application/edn"}
+         :response-format (edn-response-format)
+         :handler
+         (fn [resp]
+           (om/update! state :writing resp))})))
+  (render
+    [_]
+    (dom/div
+      (let [gen-link (fn [t l]
+                       (if-not l
+                         (dom/h2 t)
+                         (dom/a {:href (rs/blog-page {:page l})} (dom/h2 t))))]
+        (for [{:keys [title label short]} (:writing @state)]
+          (dom/div
+            {:class "project-container"}
+            (dom/div
+              {:class "project-content"}
+              (gen-link title label)
+              (dom/p
+                {:class "project-description"}
+                short))))))))
+
+(defcomponent project-view [{:keys [title picture-url description label]} _]
+  (render
+    [_]
+    (let [picture-url (or picture-url "/img/gray.png")]
+      (dom/div
+        {:class "table-div"}
+        (dom/div
+          (dom/div
+            {:class "project-image"
+             :style {:background-size "140px 140px"
+                     :background (str "url('" picture-url "') no-repeat center 0")}}))
+        (dom/div
+          {:class "project-content"}
+          (if label
+            (dom/a {:href label} title)
+            (dom/h1 title))
+
+          (dom/p description))))))
+
+(defcomponent projects-view [state _]
+  (will-mount
+    [_]
+    (if-not (:projects @state)
+      (GET (util/edn-endpoint "projects")
+        {:headers {"Accept" "application/edn"}
+         :response-format (edn-response-format)
+         :handler
+         (fn [resp]
+           (om/update! state :projects resp))})))
+  (render
+    [_]
+    (dom/div
+      {:id "project-description-list"}
+      (om/build-all project-view (:projects @state)))))
+
+(defcomponent blog-item-view [state owner]
+  (will-mount
+    [_]
+    (let [item-name (get-in @state [:navigation :args])]
+      (if-not (get-in @state [:blog-items item-name])
+        (GET (util/md-endpoint item-name)
+          {:headers {"Accept" "text/plain"}
            :handler
            (fn [resp]
-             (om/transact! state :talks (constantly resp)))})))
-  (render
-   [_]
-   (dom/article
-    {:id "resume"}
-    (dom/div
-     {:id "resume-header" :class "hruled"}
-     (dom/h1 "Conrad Stansbury")
-     (dom/p "2235 California St. Apt 233")
-     (dom/p "Mountain View, CA 94040"))
-    (om/build-all
-     resume-row
-     [{:title "Education"
-       :row-type :education
-       :content {:school "Stanford University"
-                 :content ["Graduated Jun 2015, BS Physics with Distinction and Honors, "
-                           "concentration in theoretical physics"]
-                 :gpa 4.01}}
-      {:title "Coursework"
-       :row-type :paragraphs
-       :content
-       (-> courses
-           (select-keys [:computer-science :math])
-           vals)}
-      {:title "Experience"
-       :row-type :experience
-       :content [{:title "Research Intern"
-                  :for "SLAC National Laboratory"
-                  :start "June 2013"
-                  :end "June 2015"
-                  :content
-                  [(str
-                    "Working with the ATLAS group on two data analysis projects "
-                    "to improve the resolution of Large Hadron Collier "
-                    "experiments. Investigated several machine learning "
-                    "techniques for jet finding and developed a jet classifier "
-                    "competitive with state of the art.")
-                   (str
-                    "Since June 2014, researched model based clustering "
-                    "for jet finding. Wrote 10k+ lines of algorithmic C++ to "
-                    "conduct and automate statistical analyses that handle TBs of data "
-                    "and generate plots and histograms to communicate results.")]}
-                 {:title "Instructor,"
-                  :for "Stanford Physics 91SI"
-                  :start "March 2015"
-                  :end "June 2015"
-                  :content
-                  [(str
-                    "Designed and created lecture materials, met with faculty "
-                    "to plan the curriculum, and lectured weekly for Physics 91SI, "
-                    "scientific computing in Python, at Stanford.")]}
-                 {:title "FEA"
-                  :start "February 2015"
-                  :content
-                  [(str
-                    "Wrote a finite element analysis in C as well as a Scheme "
-                    "interpreter to generate meshes and provide high level problem "
-                    "definitions to the solver. Also implemented a lexer and "
-                    "a recursive descent parser combinator for reading Scheme.")]}
-                 {:title "Web Server"
-                  :start "September 2014"
-                  :end "June 2015"
-                  :content
-                  [(str
-                    "Created a web server from the "
-                    "ground up using Haskell + HTML5/CSS + JS. The site "
-                    "running on it hosts completed and ongoing projects, "
-                    "research, public documents, and papers. You're looking "
-                    "at it! (or you were until recently, I've recently moved to "
-                    "an SPA running on nginx/Clojure/ClojureScript/LESS due "
-                    "more dynamic content accumulating on my site)")]}
-                 {:title "Chess Engine"
-                  :start "June 2012"
-                  :end "December 2014"
-                  :content
-                  [(str
-                    "Designed and built a chess engine in C + x86 assembly. "
-                    "The engine uses alpha-beta pruning with aspiration windows, "
-                    "a variety of advanced data structures, and multithreading "
-                    "to assess millions of positions per second. Ran Python-"
-                    "scripted tournaments to tune engine parameters with "
-                    "machine learning.")]}]}
-      {:title "Talks"
-       :row-type :talks
-       :content (filterv #(not= (:kind %) :zanbato-tech-talk) (:talks @state))}
-      {:title "Skills"
-       :row-type :skills
-       :content {:proficient ["C{++}" "Python" "Clojure/ClojureScript"
-                              "HTML/CSS" "JavaScript"
-                              "UNIX" "LaTeX" "ROOT"]
-                 :experienced ["Ruby" "Mathematica/Matlab" "Haskell"]}}
-      {:title "Activities + Interests"
-       :row-type :paragraphs
-       :content [(str/join
-                  ", "
-                  ["Hiking" "running" "biking" "writing short stories" "cooking"])]}]))))
-
-(defcomponent welcome-page-view [state _]
-  (render
-   [_]
-   (dom/div
-    {:class "content-header statement"}
-    (dom/p "Hi, I'm Conrad.")
-    (dom/p (str  "I'm a recent Stanford physics graduate and a software engineer "
-                 "working at Zanbato in Mountain View to build efficient "
-                 "private markets."))
-    (dom/p
-      (dom/span
-        (str "To see some of what I've been working on, take a look around "
-             "or head over to my GitHub. Alternatively, if you want to get "
-             "in touch, send me an email or "))
-      (dom/a {:href "#/todo"} "let me know when you're free")
-      (dom/span " and I'll get back to you quickly."))
-    (dom/p "Thanks for visiting."))))
-
-(defcomponent contact-view [state _]
-  (render
-   [_]
-   (dom/div
-    {:class "contact-table contact-container"}
-    (dom/div
-     {:class "table"}
-     (dom/div {:class "heading-left"} (dom/p "Phone"))
-     (dom/div {:class "right"} (dom/p {:class "phone-number"} "703 317 7012")))
-    (dom/div
-     {:class "table"}
-     (dom/div {:class "heading-left"} (dom/p "Email"))
-     (dom/div
-      {:class "right"}
-      (dom/p "chstansbury at gmail.com")
-      (dom/p "conrad.stansbury at zanbato.com"))))))
-
-(defcomponent book-component [book _]
-  (render
-   [_]
-   (dom/div
-    {:class "book"}
-    (dom/cite (:title book))
-    (dom/div
-     {:class "table"}
-     (dom/p (:author book))
-     (dom/p {:class "right"} (if (:finished book) (:completion-date book) "-"))))))
-
-(defmulti paper-view
-  (fn [paper _] (:kind paper)))
-
-(defcomponentmethod paper-view :thesis
-  [thesis _]
-  (render
-   [_]
-   (dom/div
-    {:class "talks-wrapper"} ;; My CSS needs cleaning up clearly
-    (dom/p
-     (dom/a {:href (:url thesis)} (:name thesis))
-     (str ", " (:date thesis) ".  ")))))
-
-(defcomponentmethod paper-view :preprint
-  [preprint _]
-  (render
-   [_]
-   (dom/div
-    {:class "talks-wrapper"} ;; My CSS needs cleaning up clearly
-    (dom/p
-     (str/join ", " (:authors preprint))
-     ", " (dom/a {:href (:url preprint)} (:name preprint))
-     (str ", " (:arxiv-id preprint))
-     (str ", " (:date preprint) ".  ")))))
-
-(defcomponent papers-view [state _]
-  (will-mount
-   [_]
-   (if-not (:papers @state)
-     (GET (util/edn-endpoint "papers")
-          {:headers {"Accept" "application/edn"}
-           :response-format (edn-response-format)
-           :handler
-           (fn [resp]
-             (om/transact! state :papers (constantly resp)))})))
-  (render
-   [_]
-   (dom/div
-    (for [[kind label] [[:preprint "Preprints"]
-                        [:published "Published"]
-                        [:thesis "Theses"]]]
-      (let [papers (filter #(= kind (:kind %)) (:papers @state))]
-        (if (seq papers)
-          (dom/div
-           {:class "talks-container"}
-           (dom/div
-            {:class "talks-section-header"}
-            (dom/p label))
-           (om/build-all paper-view papers))))))))
-
-(defcomponent reading-view [state _]
-  (will-mount
-   [_]
-   (if-not (:reading @state)
-     (GET (util/edn-endpoint "reading")
-          {:headers {"Accept" "application/edn"}
-           :response-format (edn-response-format)
-           :handler
-           (fn [resp]
-             (om/update! state :reading resp))})))
-  (render
-   [_]
-   (dom/div
-    (dom/div
-      {:class "books-header"}
-      (dom/p "A record of books I've read lately, to come back to later."))
-    (om/build-all book-component
-                  (sort (fn [x] (not (:finished x))) (:reading @state))))))
-
-(defcomponent writing-view [state _]
-  (will-mount
-   [_]
-   (if-not (:writing @state)
-     (GET (util/edn-endpoint "writing")
-          {:headers {"Accept" "application/edn"}
-           :response-format (edn-response-format)
-           :handler
-           (fn [resp]
-             (om/update! state :writing resp))})))
-  (render
-   [_]
-   (dom/div
-    (let [gen-link (fn [t l]
-                     (if-not l
-                       (dom/h2 t)
-                       (dom/a {:href (rs/blog-page {:page l})} (dom/h2 t))))]
-      (for [{:keys [title label short]} (:writing @state)]
-        (dom/div
-         {:class "project-container"}
-         (dom/div
-          {:class "project-content"}
-          (gen-link title label)
-          (dom/p
-           {:class "project-description"}
-           short))))))))
-
-(defcomponent project-view [{:keys [title picture-url description label]} _]
-  (render
-   [_]
-   (let [picture-url (or picture-url "/img/gray.png")]
-     (dom/div
-      {:class "table-div"}
-      (dom/div
-       (dom/div
-        {:class "project-image"
-         :style {:background-size "140px 140px"
-                 :background (str "url('" picture-url "') no-repeat center 0")}}))
-      (dom/div
-       {:class "project-content"}
-       (if label
-         (dom/a {:href label} title)
-         (dom/h1 title))
-
-       (dom/p description))))))
-
-(defcomponent projects-view [state _]
-  (will-mount
-   [_]
-   (if-not (:projects @state)
-     (GET (util/edn-endpoint "projects")
-          {:headers {"Accept" "application/edn"}
-           :response-format (edn-response-format)
-           :handler
-           (fn [resp]
-             (om/update! state :projects resp))})))
-  (render
-   [_]
-   (dom/div
-    {:id "project-description-list"}
-    (om/build-all project-view (:projects @state)))))
-
-(defcomponent blog-item-view [state owner]
- (will-mount
-   [_]
-   (let [item-name (get-in @state [:navigation :args])]
-     (if-not (get-in @state [:blog-items item-name])
-       (GET (util/md-endpoint item-name)
-            {:headers {"Accept" "text/plain"}
-             :handler
-             (fn [resp]
-               (om/update! state [:blog-items item-name] resp))}))))
- (render
-  [_]
-  (dom/div
-   (util/->render-md (get-in @state [:blog-items (get-in @state [:navigation :args])])))))
+             (om/update! state [:blog-items item-name] resp))}))))
+  (render
+    [_]
+    (dom/div
+      (util/->render-md (get-in @state [:blog-items (get-in @state [:navigation :args])])))))

 (defcomponent super-secret-cat-view [_ _]
   (render [_]
@@ -435,9 +451,9 @@
       (dom/p
         {:style {:margin-bottom "12px" :margin-left "8px"}}
         (str "As an experiment, my personal Trello board is "
-             "available below. You can post a card to it if you "
-             "would like to find a time to meet. You can also send me "
-             "an email if you want, but this is a much lower noise channel."))
+          "available below. You can post a card to it if you "
+          "would like to find a time to meet. You can also send me "
+          "an email if you want, but this is a much lower noise channel."))
       (->trello-board-view {})
       (dom/div
         {:id "post-trello-card-form"}
@@ -467,16 +483,16 @@
            :on-click (fn [_]
                        (println (:trello-card app))
                        (POST "/create-card"
-                            {:params {:name (:name (:trello-card app))
-                                      :description (:description (:trello-card app))}
-                             :headers {:x-csrf-token js/csrf}
-                             :error-handler (fn [resp] (println "Error"))
-                             :handler
-                             (fn [_]
-                               (.reload (.. js/window -location)))})
+                         {:params {:name (:name (:trello-card app))
+                                   :description (:description (:trello-card app))}
+                          :headers {:x-csrf-token js/csrf}
+                          :error-handler (fn [resp] (println "Error"))
+                          :handler
+                          (fn [_]
+                            (.reload (.. js/window -location)))})
                        (om/update! app [:trello-card] {:name "" :description ""}))}
           "Add")
         (dom/p
           {:style {:margin-top "24px"}}
           (str "The page will reload if you add a card, but it might "
-               "not show due to caching on Trello's part."))))))
+            "not show due to caching on Trello's part."))))))


:construction: Quick patch to have search working (FIXME)

--- frontend/src/uxbox/main/ui/dashboard/sidebar.cljs
+++ frontend/src/uxbox/main/ui/dashboard/sidebar.cljs
@@ -148,8 +148,8 @@
         on-search-blur
         (fn [event]
           (let [target (dom/get-target event)]
-            (dom/clean-value! target)
-            (debounced-emit! (rt/nav :dashboard-team {:team-id team-id}))))
+            (dom/clean-value! target)))
+            ;; (debounced-emit! (rt/nav :dashboard-team {:team-id team-id}))))

         on-search-change
         (fn [event]


bug/19: delete temporary files generated by generate-diff-report after saving them to persistence

--- src/main/clojure/com/xebia/visualreview/resource.clj
+++ src/main/clojure/com/xebia/visualreview/resource.clj
@@ -175,17 +175,18 @@
   (let [analysis (p/get-analysis conn run-id)
         diff-report (analysis/generate-diff-report before-file after-file)
         diff-file-id (image/insert-image! conn (:diff diff-report))
-        new-diff-id (p/save-diff! conn diff-file-id before-id after-id (:percentage diff-report) (:id analysis))
-        diff (p/get-diff conn run-id new-diff-id)]
-    {:report diff-report :diff diff}))
+        new-diff-id (p/save-diff! conn diff-file-id before-id after-id (:percentage diff-report) (:id analysis))]
+    (do
+      (.delete (:diff diff-report))
+      (p/get-diff conn run-id new-diff-id))))

 (defn- process-screenshot [conn suite-id run-id screenshot-name properties meta {:keys [tempfile]}]
   (let [screenshot-id (screenshot/insert-screenshot! conn run-id screenshot-name properties meta tempfile)
         screenshot (screenshot/get-screenshot-by-id conn screenshot-id)
         baseline-screenshot (p/get-baseline-screenshot conn suite-id "master" screenshot-name properties)
         before-file (when baseline-screenshot (io/get-file (image/get-image-path conn (:image-id baseline-screenshot))))
-        {:keys [report diff]} (proces-diff conn run-id before-file tempfile (:id baseline-screenshot) screenshot-id)]
-    (when (and baseline-screenshot (zero? (:percentage report)))
+        diff (proces-diff conn run-id before-file tempfile (:id baseline-screenshot) screenshot-id)]
+    (when (and baseline-screenshot (zero? (:percentage diff)))
       (update-diff-status! conn diff "accepted"))
     screenshot))


add :checked-arrays option

add :checked-arrays option

fixes #574

--- sidecar/src/figwheel_sidecar/schemas/cljs_options.clj
+++ sidecar/src/figwheel_sidecar/schemas/cljs_options.clj
@@ -600,6 +600,10 @@

   :language-in :es6
   :rewrite-polyfills true")
+
+;; TODO waiting on docs
+(def-key ::checked-arrays (s/or :keyval #{:warn :error}
+                                :bool   boolean?))

 ;; ** ClojureScript Compiler Warnings

@@ -1038,4 +1042,5 @@
      ::watch-fn
      ::warnings
      ::fn-invoke-direct
-     ::rewrite-polyfills])))
+     ::rewrite-polyfills
+     ::checked-arrays])))


Add support for the `:rewrite-polyfills` compiler option (#567)

* Add missing `)` to `::fn-invoke-direct` spec

* Add support for `:rewrite-polyfills`

https://clojurescript.org/reference/compiler-options#rewrite-polyfills

--- sidecar/src/figwheel_sidecar/schemas/cljs_options.clj
+++ sidecar/src/figwheel_sidecar/schemas/cljs_options.clj
@@ -591,7 +591,15 @@
 With this option enabled the compiler calls them with a faster
 f(arg0, arg1 … instead.)

-  :fn-invoke-direct true"
+  :fn-invoke-direct true")
+
+(def-key ::rewrite-polyfills boolean?
+  "If set to true, the google closure compiler will add polyfills (for example
+when you use native javascript Promise). This requires :language-in to be set
+to :es6 or higher or it will silently be ignored!
+
+  :language-in :es6
+  :rewrite-polyfills true")

 ;; ** ClojureScript Compiler Warnings

@@ -896,7 +904,8 @@
      ::external-config
      ::watch-fn
      ::warnings
-     ::fn-invoke-direct])
+     ::fn-invoke-direct
+     ::rewrite-polyfills])

    ))


[#2472] Adapt/fix combine tx

[#2472] Adapt/fix combine tx

--- backend/src/akvo/lumen/lib/transformation/combine.clj
+++ backend/src/akvo/lumen/lib/transformation/combine.clj
@@ -21,24 +21,27 @@
         {[first-column-name second-column-name] "columnNames"
          separator "separator"
          column-title "newColumnTitle"} (engine/args op-spec)]
-    (db.tx.engine/add-column tenant-conn {:table-name table-name
-                             :column-type "text"
-                             :new-column-name new-column-name})
-    (db.tx.combine/combine-columns tenant-conn
-                     {:table-name table-name
-                      :new-column-name new-column-name
-                      :first-column first-column-name
-                      :second-column second-column-name
-                      :separator separator})
-    {:success? true
-     :execution-log [(format "Combined columns %s, %s into %s"
-                             first-column-name second-column-name new-column-name)]
-     :columns (conj columns {"title" column-title
-                             "type" "text"
-                             "sort" nil
-                             "hidden" false
-                             "direction" nil
-                             "columnName" new-column-name})}))
+    (if-let [title-error (engine/column-title-error? column-title columns)]
+      title-error
+      (do
+        (db.tx.engine/add-column tenant-conn {:table-name table-name
+                                              :column-type "text"
+                                              :new-column-name new-column-name})
+        (db.tx.combine/combine-columns tenant-conn
+                                       {:table-name table-name
+                                        :new-column-name new-column-name
+                                        :first-column first-column-name
+                                        :second-column second-column-name
+                                        :separator separator})
+        {:success? true
+         :execution-log [(format "Combined columns %s, %s into %s"
+                                 first-column-name second-column-name new-column-name)]
+         :columns (conj columns {"title" column-title
+                                 "type" "text"
+                                 "sort" nil
+                                 "hidden" false
+                                 "direction" nil
+                                 "columnName" new-column-name})}))))

 (defmethod engine/columns-used "core/combine"
   [applied-transformation columns]


remove expectations

remove expectations

--- ssclj/jar/test/com/sixsq/slipstream/ssclj/resources/service_offer_schema_test.clj
+++ ssclj/jar/test/com/sixsq/slipstream/ssclj/resources/service_offer_schema_test.clj
@@ -1,8 +1,8 @@
 (ns com.sixsq.slipstream.ssclj.resources.service-offer-schema-test
-    (:require
+  (:require
+    [clojure.test :refer :all]
     [com.sixsq.slipstream.ssclj.resources.service-offer :refer :all]
     [schema.core :as s]
-    [expectations :refer :all]
     [com.sixsq.slipstream.ssclj.app.params :as p]))

 (def valid-acl {:owner {:principal "::ADMIN"
@@ -11,19 +11,22 @@
                          :type      "ROLE"
                          :right     "VIEW"}]})

-(let [timestamp "1964-08-25T10:00:00.0Z"
-      root {:id          resource-name
-            :resourceURI p/service-context
-            :created     timestamp
-            :updated     timestamp
-            :acl         valid-acl
-            :connector   {:href "myconnector"}
-            :other       "value"}]
+(def non-nil? (complement nil?))

-  (expect nil? (s/check ServiceInfo root))
-  (expect (s/check ServiceInfo (dissoc root :created)))
-  (expect (s/check ServiceInfo (dissoc root :updated)))
-  (expect (s/check ServiceInfo (dissoc root :acl)))
+(deftest check-ServiceInfo
+  (let [timestamp "1964-08-25T10:00:00.0Z"
+        root {:id          resource-name
+              :resourceURI p/service-context
+              :created     timestamp
+              :updated     timestamp
+              :acl         valid-acl
+              :connector   {:href "myconnector"}
+              :other       "value"}]

-  (expect (s/check ServiceInfo (dissoc root :connector)))
-  (expect nil? (s/check ServiceInfo (dissoc root :other))))
+    (are [expect-fn arg] (expect-fn (s/check ServiceInfo arg))
+                         nil? root
+                         non-nil? (dissoc root :created)
+                         non-nil? (dissoc root :updated)
+                         non-nil? (dissoc root :acl)
+                         non-nil? (dissoc root :connector)
+                         nil? (dissoc root :other))))


CMR-3701: Removed reference to "dc"

CMR-3701: Removed reference to "dc"

--- system-int-test/test/cmr/system_int_test/ingest/granule_parent_dependency_test.clj
+++ system-int-test/test/cmr/system_int_test/ingest/granule_parent_dependency_test.clj
@@ -9,7 +9,6 @@
     [cmr.indexer.system :as indexer-system]
     [cmr.spatial.mbr :as m]
     [cmr.spatial.polygon :as poly]
-    [cmr.system-int-test.data2.collection :as dc]
     [cmr.system-int-test.data2.core :as d]
     [cmr.system-int-test.data2.granule :as dg]
     [cmr.system-int-test.data2.umm-spec-collection :as data-umm-c]


(TK-247) Path Traversal Attack Tests

(TK-247) Path Traversal Attack Tests

--- test/clj/puppetlabs/trapperkeeper/services/webserver/jetty9_service_proxy_test.clj
+++ test/clj/puppetlabs/trapperkeeper/services/webserver/jetty9_service_proxy_test.clj
@@ -735,4 +735,58 @@
       (let [response (http-get (str "http://localhost:10000/hello-proxy"))]
         (is (= 200 (:status response)))))))

-
+; Modified from proxy-ring-handler
+(defn count-ring-handler
+  "Increments counter if the endpoint is /goodbye"
+  [counter req]
+  (condp = (:uri req)
+    "/hello/" {:status 200 :body (str "Hello, World!"
+                                        ((:headers req) "x-fancy-proxy-header")
+                                        ((:headers req) "cookie"))}
+    "/goodbye/" {:status 200 :body (str "Goodbye! Count: " (swap! counter inc))}
+    {:status 404 :body "count-ring-handler couldn't find the route"}))
+
+(deftest test-path-traversal-attacks
+  (testing "proxies aren't vulnerable to basic path traversal attacks"
+    ; goodbye-counter is used to make sure that no requests to the proxy
+    ; endpoint, /hello-proxy, end up hitting /goodbye, as they should only be
+    ; able to reach /hello
+    (let [goodbye-counter (atom 0)
+          hello-goodbye-count-ring-handler (partial count-ring-handler goodbye-counter)
+          ; Should not succeed in hitting the goodbye endpoint
+          bad-proxy-requests [; Encodings of '../'
+                              "https://localhost:10001/hello-proxy/../goodbye/"
+                              "https://localhost:10001/hello-proxy/%2e%2e%2fgoodbye/"
+                              "https://localhost:10001/hello-proxy/%2e%2e/goodbye/"
+                              "https://localhost:10001/hello-proxy/..%2fgoodbye/"
+                              ; Encodings of '../../'
+                              "https://localhost:10001/hello-proxy/world/../../goodbye/"
+                              "https://localhost:10001/hello-proxy/world/%2e%2e%2f%2e%2e%2fgoodbye/"
+                              "https://localhost:10001/hello-proxy/world/%2e%2e/%2e%2e/goodbye/"
+                              "https://localhost:10001/hello-proxy/world/..%2f..%2fgoodbye/"]]
+      (with-target-and-proxy-servers
+        {:target       (merge common-ssl-config
+                         {:ssl-host "0.0.0.0"
+                          :ssl-port 9001})
+         :proxy        (merge common-ssl-config
+                         {:ssl-host "0.0.0.0"
+                          :ssl-port 10001})
+         :proxy-config {:host "localhost"
+                        :port 9001
+                        :path "/hello"}
+         :ring-handler hello-goodbye-count-ring-handler}
+        (testing "non-proxied endpoint doesn't see any traffic"
+          (doall (for [bad-request bad-proxy-requests]
+                   (let [response (http-get bad-request default-options-for-https-client)]
+                     (is (= 404 (:status response)))
+                     ; Make sure the 404 is because jetty couldn't find the page, not
+                     ; because the ring handler didn't understand the request, which
+                     ; would have a different message in the body. The request shouldn't
+                     ; get as far as the hello-goodbye-count-ring-handler
+                     (is (re-find #"Problem accessing /hello-proxy" (:body response))))))
+          ; Counter should still be at 0
+          (is (= 0 (deref goodbye-counter))))
+        (testing "counter is working correctly"
+          ; A valid request to bump the counter
+          (http-get "https://localhost:9001/goodbye/" default-options-for-https-client)
+          (is (= 1 (deref goodbye-counter))))))))


minor

minor

--- src/io/perun/contrib/images_resize.clj
+++ src/io/perun/contrib/images_resize.clj
@@ -26,7 +26,7 @@
         image-filepath (perun/create-filepath (:out-dir options) filepath-with-resolution)
         new-file (io/file tmp image-filepath)]
     (io/make-parents new-file)
-    (ImageIO/write buffered-file (perun/extension filepath) new-file)))
+    (ImageIO/write buffered-file (:extension file) new-file)))

 (defn resize-to [tgt-path file options resolution]
   (let [io-file (-> file :full-path io/file)


Support :locals in spec-report

Support :locals in spec-report

--- src/main/clojure/com/stuartsierra/lazytest/report.clj
+++ src/main/clojure/com/stuartsierra/lazytest/report.clj
@@ -35,9 +35,9 @@
       (prn (:form m)))
     (when-let [f (:file m)] (println "File:" f))
     (when-let [l (:line m)] (println "Line:" l))
-    (when (seq (:states r))
-      (print "Context states: ")
-      (prn (:states r)))
+    (when (seq (:locals m))
+      (print "Givens: ")
+      (prn (zipmap (:locals m) (:states r))))
     (when-let [e (:throwable r)]
       (println "STACK TRACE")
       (print-cause-trace e))))