only run :build-notify when actually configured

--- src/main/shadow/cljs/devtools/client/env.cljs
+++ src/main/shadow/cljs/devtools/client/env.cljs
@@ -154,14 +154,15 @@

 (defn run-custom-notify! [msg]
   ;; look up every time it case it gets reloaded
-  (let [fn (js/goog.getObjectByName custom-notify-fn js/$CLJS)]
-    (if-not (fn? fn)
-      (js/console.warn "couldn't find custom :build-notify" custom-notify-fn)
-      (try
-        (fn msg)
-        (catch :default e
-          (js/console.error "Failed to run custom :build-notify" custom-notify-fn)
-          (js/console.error e))))))
+  (when (seq custom-notify-fn)
+    (let [fn (js/goog.getObjectByName custom-notify-fn js/$CLJS)]
+      (if-not (fn? fn)
+        (js/console.warn "couldn't find custom :build-notify" custom-notify-fn)
+        (try
+          (fn msg)
+          (catch :default e
+            (js/console.error "Failed to run custom :build-notify" custom-notify-fn)
+            (js/console.error e)))))))

 (defn make-task-fn [{:keys [log-missing-fn log-call-async log-call]} {:keys [fn-sym fn-str async]}]
   (fn [next]


Precondition tests

Precondition tests

--- test/ganjika/core_test.clj
+++ test/ganjika/core_test.clj
@@ -30,4 +30,10 @@
     (is (= 25 (square 10/2)))
     ;; without type coercion
     (is (= 25 (no.coercion.ns/square (int 5))))
-    (is (thrown? ClassCastException (no.coercion.ns/square 5)))))
+    (is (thrown? ClassCastException (no.coercion.ns/square 5))))
+
+  (testing "Validation works"
+    ;; can't accept nils
+    (is (thrown? AssertionError (eval `(def-java-fns nil))))
+    ;; if currying is disabled, argument must be a class
+    (is (thrown? AssertionError (eval `(def-java-fns (new Object) :disable-currying))))))


Fix source alignment

Fix source alignment

--- src/afterglow/rhythm.clj
+++ src/afterglow/rhythm.clj
@@ -264,8 +264,8 @@
     (dosync
      (ensure bpm)
      (ensure bpb)
-     (let [phase (metro-beat-phase metro)
-           shift (* (metro-tick metro) (if (> phase 0.5) (dec phase) phase))
+     (let [phase         (metro-beat-phase metro)
+           shift         (* (metro-tick metro) (if (> phase 0.5) (dec phase) phase))
            new-bar-start (round (- (now) shift (* (dec start-bar) (metro-tock metro))))]
        (ref-set start new-bar-start))))

@@ -274,8 +274,8 @@
      (ensure bpm)
      (ensure bpb)
      (ensure bpp)
-     (let [phase (metro-beat-phase metro)
-           shift (* (metro-tick metro) (if (> phase 0.5) (dec phase) phase))
+     (let [phase            (metro-beat-phase metro)
+           shift            (* (metro-tick metro) (if (> phase 0.5) (dec phase) phase))
            new-phrase-start (round (- (now) shift (* (dec start-phrase) (metro-ding metro))))]
        (ref-set start new-phrase-start))))

@@ -400,11 +400,11 @@
   (metro-bpb [metro new-bpb]
     (dosync
      (ensure bpm)
-     (let [cur-bar (metro-bar metro)
-           new-tock (beat-ms new-bpb @bpm)
+     (let [cur-bar   (metro-bar metro)
+           new-tock  (beat-ms new-bpb @bpm)
            new-start (- (now) (* new-tock (dec cur-bar)))
-           phase (metro-beat-phase metro)  ; Preserve beat phase
-           shift (* (metro-tick metro) phase)]
+           phase     (metro-beat-phase metro) ; Preserve beat phase
+           shift     (* (metro-tick metro) phase)]
        (ref-set start (round (- new-start shift)))
        (ref-set bpb new-bpb))))

@@ -415,10 +415,10 @@
      (ensure bpm)
      (ensure bpb)
      (let [cur-phrase (metro-phrase metro)
-           new-ding (beat-ms (* @bpb new-bpp) @bpm)
-           new-start (- (now) (* new-ding (dec cur-phrase)))
-           phase (metro-bar-phase metro)  ; Preserve beat & bar phase
-           shift (* (metro-tock metro) phase)]
+           new-ding   (beat-ms (* @bpb new-bpp) @bpm)
+           new-start  (- (now) (* new-ding (dec cur-phrase)))
+           phase      (metro-bar-phase metro) ; Preserve beat & bar phase
+           shift      (* (metro-tock metro) phase)]
        (ref-set start (round (- new-start shift)))
        (ref-set bpp new-bpp))))

@@ -431,11 +431,11 @@
      (ensure bpm)
      (ensure bpb)
      (ensure bpp)
-     (let [beat (marker-number instant @start (metro-tick metro))
-           bar (marker-number instant @start (metro-tock metro))
-           phrase (marker-number instant @start (metro-ding metro))
-           beat-phase (marker-phase instant @start (metro-tick metro))
-           bar-phase (marker-phase instant @start (metro-tock metro))
+     (let [beat         (marker-number instant @start (metro-tick metro))
+           bar          (marker-number instant @start (metro-tock metro))
+           phrase       (marker-number instant @start (metro-ding metro))
+           beat-phase   (marker-phase instant @start (metro-tick metro))
+           bar-phase    (marker-phase instant @start (metro-tock metro))
            phrase-phase (marker-phase instant @start (metro-ding metro))]
        (MetronomeSnapshot. @start @bpm @bpb @bpp instant beat bar phrase beat-phase bar-phase phrase-phase))))


:configurator and :join? arguments to run-jetty.

--- src/ring/adapter/jetty.clj
+++ src/ring/adapter/jetty.clj
@@ -45,14 +45,27 @@
       (add-ssl-connector! server options))
     server))

-(defn run-jetty
+(defn #^Server run-jetty
   "Serve the given handler according to the options.
   Options:
+    :configurator (Optional, function; called with the Server instance.)
     :port (Optional, Integer)
     :host (Optional, String)
+    :join? (Optional, true by default. If false, don't block.)
     :ssl-port, :keystore, :key-password, :truststore, :trust-password"
   [handler options]
-  (doto #^Server (create-server options)
-    (.setHandler (proxy-handler handler))
-    (.start)
-    (.join)))
+  (let [#^Server s (create-server (dissoc options :configurator))]
+    (when-let [configurator (:configurator options)]
+      ;; Optional additional configuration, such as
+      ;; adding JMX.
+      (configurator s))
+
+    (doto s
+      (.setHandler (proxy-handler handler))
+      (.start))
+
+    (when (:join options true)
+      (.join s))
+
+    ;; Finally, return the Server.
+    s))


[up] Adding money ot user, when he creates event.

--- src/ombs/handler/addevent.clj
+++ src/ombs/handler/addevent.clj
@@ -26,6 +26,8 @@
   "Main function for creating new event."
   (if (isvalid/new-event? event price date)
     (do
+      (dbpay/debit-payment (db/get-eid event date) (sess/get :username)
+                           (read-string price))
       (if (zero? (funcs/parse-int parts))
         (add-solid-event params)
         (add-partial-event (update params :parts funcs/parse-int)))


Added bar to metronome

Added bar to metronome

--- src/overtone/music/rhythm.clj
+++ src/overtone/music/rhythm.clj
@@ -11,11 +11,19 @@
       (metro-start [metro] [metro start-beat]
         "Returns the start time of the metronome. Also restarts the metronome at
      'start-beat' if given.")
+      (metro-bar-start [metro] [metro start-bar])
       (metro-tick [metro]
         "Returns the duration of one metronome 'tick' in milleseconds.")
+      (metro-tock [metro]
+    "Returns the duration of one bar in milliseconds.")
       (metro-beat [metro] [metro beat]
         "Returns the next beat number or the timestamp (in milliseconds) of the
      given beat.")
+      (metro-bar [metro] [metro  bar]
+    "Returns the next bar number or the timestamp (in milliseconds) of the
+     given bar")
+      (metro-bpb [metro] [metro new-bpb]
+    "Get the current beats per bar or change it to new-bpb")
       (metro-bpm [metro] [metro new-bpm]
         "Get the current bpm or change the bpm to 'new-bpm'."))))

@@ -37,7 +45,7 @@
 ;  ([] (bar 1))
 ;  ([b] (* (bar 1) (first @*signature) b)))

-(deftype Metronome [start bpm]
+(deftype Metronome [start bar-start bpm bpb]

   IMetronome
   (metro-start [metro] @start)
@@ -45,17 +53,36 @@
     (let [new-start (- (now) (* start-beat (metro-tick metro)))]
       (reset! start new-start)
       new-start))
+  (metro-bar-start [metro] @bar-start)
+  (metro-bar-start [metro start-bar]
+    (let [new-bar-start (- (now) (* start-bar (metro-tock metro)))]
+      (reset! bar-start new-bar-start)
+      new-bar-start))
   (metro-tick  [metro] (beat-ms 1 @bpm))
+  (metro-tock  [metro] (beat-ms @bpb @bpm))
   (metro-beat  [metro] (inc (long (/ (- (now) @start) (metro-tick metro)))))
   (metro-beat  [metro b] (+ (* b (metro-tick metro)) @start))
+  (metro-bar   [metro] (inc (long (/ (- (now) @bar-start) (metro-tock metro)))))
+  (metro-bar   [metro b] (+ (* b (metro-tock metro)) @bar-start))
   (metro-bpm   [metro] @bpm)
   (metro-bpm   [metro new-bpm]
-    (let [cur-beat (metro-beat metro)
-          new-tick (beat-ms 1 new-bpm)
-          new-start (- (metro-beat metro cur-beat) (* new-tick cur-beat))]
+    (let [cur-beat      (metro-beat metro)
+          cur-bar       (metro-bar metro)
+          new-tick      (beat-ms 1 new-bpm)
+          new-tock      (* @bpb new-tick)
+          new-start     (- (metro-beat metro cur-beat) (* new-tick cur-beat))
+          new-bar-start (- (metro-bar metro cur-bar) (* new-tock cur-bar))]
       (reset! start new-start)
+      (reset! bar-start new-bar-start)
       (reset! bpm new-bpm))
     [:bpm new-bpm])
+  (metro-bpb   [metro] @bpb)
+  (metro-bpb   [metro new-bpb]
+    (let [cur-bar       (metro-bar metro)
+          new-tock      (beat-ms new-bpb @bpm)
+          new-bar-start (- (metro-bar metro cur-bar) (* new-tock cur-bar))]
+      (reset! bar-start new-bar-start)
+      (reset! bpb new-bpb)))

   clojure.lang.ILookup
   (valAt [this key] (.valAt this key nil))
@@ -79,6 +106,10 @@
   with no arguments to get the next beat number, or pass it a beat number
   to get the timestamp to play a note at that beat.

+  Metronome also works with bars. Set the number of beats per bar using
+  metro-bpb (defaults to 4). metro-bar returns a timestamp that can be used
+  to play a note relative to a specified bar.
+
   (def m (metronome 128))
   (m)          ; => <next beat number>
   (m 200)      ; => <timestamp of beat 200>
@@ -86,8 +117,10 @@
   (m :bpm 140) ; => set bpm to 140"
   [bpm]
   (let [start (atom (now))
-        bpm   (atom bpm)]
-    (Metronome. start bpm)))
+        bar-start (atom @start)
+        bpm   (atom bpm)
+        bpb   (atom 4)]
+    (Metronome. start bar-start bpm bpb)))

 ;== Grooves
 ;


Use correct namespace name for garden-watcher

--- src/leiningen/new/chestnut/src/clj/chestnut/styles.clj
+++ src/leiningen/new/chestnut/src/clj/chestnut/styles.clj
@@ -1,5 +1,5 @@
 (ns {{project-ns}}.styles
-  (:require [garden-reloader.def :refer [defstyles]]))
+  (:require [garden-watcher.def :refer [defstyles]]))

 (defstyles style
   [:h1 {:text-decoration "underline"}])


Use local clojure wrapper around Java method call.

--- jar-async/src/slipstream/async/collector.clj
+++ jar-async/src/slipstream/async/collector.clj
@@ -61,7 +61,7 @@
         (when (nil? v)
           (log/log-error
             "Timeout collecting vms for user "
-            (.getName user)
+            (get-name user)
             " on cloud "
             (.getConnectorInstanceName connector)))))
     (go (>! ch (Collector/collect user connector)))))
@@ -74,8 +74,8 @@
         (if (nil? res)
           (log/log-error
             "Timeout updating metrics for user "
-            (.getName user))
-          (log/log-info (str "executed update-metric request for " (.getName user))))))
+            (get-name user))
+          (log/log-info (str "executed update-metric request for " (get-name user))))))
     (go (>! ch (updator/update user)))))

 (def not-nil? (complement nil?))
@@ -90,7 +90,7 @@
         (let [[[user connector] ch] (alts! [chan (timeout timeout-processing-loop)])]
           (when (not-nil? user)
             (try
-              (log/log-debug (str "executing collect request for " (.getName user) " and " (.getConnectorInstanceName connector)))
+              (log/log-debug (str "executing collect request for " (get-name user) " and " (.getConnectorInstanceName connector)))
               (collect! user connector)
               (if (updator/metering-enabled?)
                 (update-metric! user))


Issue 9729: Implemented imCMS releases names generation

git-svn-id: b7e9aa1d6cd963481915708f70423d437278b157@18372 bd66a97b-2aff-0310-9095-89ca5cabf5a6


fixing a few issues post merge

fixing a few issues post merge

--- storm-core/src/clj/backtype/storm/ui/core.clj
+++ storm-core/src/clj/backtype/storm/ui/core.clj
@@ -758,7 +758,7 @@
        "executorsTotal" (count executors)
        "schedulerInfo" (.get_sched_status summ)
        "debug" (if (not-nil? debug-options) (.is_enable debug-options) false)
-       "samplingPct" (if (not-nil? debug-options) (.get_samplingpct debug-options) 100)}))
+       "samplingPct" (if (not-nil? debug-options) (.get_samplingpct debug-options) 100)
        "replicationCount" (.get_replication_count summ)}))

 (defn spout-summary-json [topology-id id stats window]
@@ -1083,7 +1083,7 @@
     (json-response (topology-op-response id "deactivate") (m "callback")))
   (POST "/api/v1/topology/:id/debug/:action/:spct" [:as {:keys [cookies servlet-request]} id action spct & m]
     (assert-authorized-user servlet-request "debug" (topology-config id))
-    (with-nimbus nimbus
+    (thrift/with-configured-nimbus-connection nimbus
       (let [tplg (->> (doto
                         (GetInfoOptions.)
                         (.set_num_err_choice NumErrorsChoice/NONE))
@@ -1095,7 +1095,7 @@
     (json-response (topology-op-response id (str "debug/" action)) (m "callback")))
   (POST "/api/v1/topology/:id/component/:component/debug/:action/:spct" [:as {:keys [cookies servlet-request]} id component action spct & m]
     (assert-authorized-user servlet-request "debug" (topology-config id))
-    (with-nimbus nimbus
+    (thrift/with-configured-nimbus-connection nimbus
       (let [tplg (->> (doto
                         (GetInfoOptions.)
                         (.set_num_err_choice NumErrorsChoice/NONE))


Deselect current tool with esc

Deselect current tool with esc

--- src/uxbox/data/shapes.cljs
+++ src/uxbox/data/shapes.cljs
@@ -320,7 +320,9 @@
   (reify
     rs/UpdateEvent
     (-apply-update [_ state]
-      (assoc-in state [:workspace :selected] #{}))))
+      (-> state
+          (assoc-in [:workspace :selected] #{})
+          (assoc-in [:workspace :drawing] nil)))))

 (defn group-selected
   []


[CS DC] Make the processor less CPU hungry

`(while true)` churns at ~100% CPU usage, while trying to deref the SQS
processing future does not. That future should never deref, so it's
safe.

And, if the future throws an exception, the processor will now shut
down (whereas before it would just sit there no longer doing
work). That's nice.

--- src/vip/data_processor.clj
+++ src/vip/data_processor.clj
@@ -72,4 +72,4 @@
                                    (log/info "VIP Data Processor shutting down...")
                                    (q/publish {:id id :event "stopping"} "qa-engine.status")
                                    (future-cancel consumer))))
-      (while true))))
+      @consumer)))


Learning how to use gen-class

Learning how to use gen-class

--- src/c4_arena/players.clj
+++ src/c4_arena/players.clj
@@ -40,3 +40,9 @@
                          (put! ch-in {:type "move" :move (.makeDecision search c4-state)}))
                        (recur)))))
     {:id "aima" :ch-in ch-in :ch-out ch-out}))
+
+(gen-class
+ :name c4-arena.players.C4TrompGame
+ :prefix "c4tromp-")
+
+(defn c4tromp-toString [this] "Hello World!")


add heroku port again

add heroku port again

--- src/clj/bulldog/core.clj
+++ src/clj/bulldog/core.clj
@@ -92,7 +92,7 @@
     state))

 (defn -main [& args]
-  (let [port (second args)]
+  (let [port (or (System/getenv "PORT") (second args))]
     (start-server (if port (Integer/parseInt port) 8080) "bamboozle")
     (println "Server startet at localhost:8080")))


CLJS-382: use set to track visited requires so contains? works properly

Signed-off-by: Stuart Sierra <1d6e1cf70ec6f9ab28d3ea4b27a49a77654d370e@stuartsierra.com>

--- src/clj/cljs/closure.clj
+++ src/clj/cljs/closure.clj
@@ -533,7 +533,7 @@
   [opts requires]
   (let [index (js-dependency-index opts)]
     (loop [requires requires
-           visited requires
+           visited (set requires)
            deps #{}]
       (if (seq requires)
         (let [node (get index (first requires))


When compiling node, toggle *main-cli-fn* last refs #355

--- src/clj/cljs/closure.clj
+++ src/clj/cljs/closure.clj
@@ -878,14 +878,13 @@
               ana/*cljs-warn-on-undeclared*
               (true? (opts :warnings))]
       (let [compiled (-compile source all-opts)
-            compiled (concat
-                      (if (coll? compiled) compiled [compiled])
-                      (when (= :nodejs (:target all-opts))
-                        [(-compile (io/resource "cljs/nodejscli.cljs") all-opts)]))
             js-sources (if (coll? compiled)
                          (binding []
                            (apply add-dependencies all-opts compiled))
                          (add-dependencies all-opts compiled))
+            js-sources (concat js-sources
+                               (when (= :nodejs (:target all-opts))
+                                 [(-compile (io/resource "cljs/nodejscli.cljs") all-opts)]))
             optim (:optimizations all-opts)]
         (if (and optim (not= optim :none))
           (->> js-sources


CLJS-950: Revert adding compiled-by string to CLJS deps file

 Breaks hashbang support for Node.js, more importantly CLJS-944 is not a ClojureScript problem it's a cljsbuild one

--- src/clj/cljs/closure.clj
+++ src/clj/cljs/closure.clj
@@ -752,8 +752,7 @@
     (nil? output-to) js

     (string? output-to)
-    (spit output-to
-      (str (comp/compiled-by-string opts) "\n" js))
+    (spit output-to js)

     :else (println js)))


Fixed hard-coded t-res in adjust-fires

Fixed hard-coded t-res in adjust-fires

--- src/clj/forma/schema.clj
+++ src/clj/forma/schema.clj
@@ -131,7 +131,7 @@
   ;; TODO: add a sample f-series, result
   [{:keys [est-start est-end t-res]} f-series]
   (let [[start end] (for [pd [est-start est-end]]
-                      (date/datetime->period "32" pd))]
+                      (date/datetime->period t-res pd))]
     [(->> (:series f-series)
           (u/trim-seq start (inc end) (:start-idx f-series))
           (timeseries-value start))]))


Reverted back an edit made to create-conv-layer

--- test/clj/cortex/convolutional_layer_tests.clj
+++ test/clj/cortex/convolutional_layer_tests.clj
@@ -35,8 +35,7 @@
         input (b/array  (flatten (map #(repeat num-channels %)
                                               (range 1 (+ (* input-dim input-dim) 1)))))
         weights (b/array  (map #(repeat (* k-dim k-dim num-channels) %)
-                                       ;(range 1 (+ n-kernels 1))))
-                                       (take n-kernels (repeat -1))))
+                                       (range 1 (+ n-kernels 1))))
         bias (b/zero-array  [1 n-kernels])]
     (conv/->Convolutional weights bias conv-config)))


Fix doc string for put-index!

Fix doc string for put-index!

--- src/clj_ravendb/rest.clj
+++ src/clj_ravendb/rest.clj
@@ -46,12 +46,9 @@
 (defn- put-index!
   "Creates or updates an index, where an index takes
   the form:
-  idx {
-    :name index-name
-    :alias document-alias
-    :where where-clause
-    :select projection
-  }
+  idx {:index index-name
+       :where [[:== :field "value"]]
+       :select [:field]}

   Optionally takes a map of options.
   :request-builder is a custom request builder fn.


make flaky teste for legacy feature more stable?

--- test/clj/lambdacd/internal/execution_test.clj
+++ test/clj/lambdacd/internal/execution_test.clj
@@ -250,7 +250,7 @@
                      (some-ctx-with :step-results-channel step-results-channel
                                     :step-id [0]
                                     :build-number 2))
-      (Thread/sleep 200) ; result-channel is now filled async, wait a bit to make sure it's filled
+      (Thread/sleep 500) ; result-channel is now filled async, wait a bit to make sure it's filled
       (is (= [{:build-number 2 :step-id [1 0] :step-result {:status :running}}
               {:build-number 2 :step-id [1 0] :step-result {:foo :baz :status :success}}
               {:build-number 2 :step-id [2 0] :step-result {:status :running}}


Use channels and change state model

Use channels and change state model

* This allows for editing entered notes

--- src/cljs/notes/core.cljs
+++ src/cljs/notes/core.cljs
@@ -12,16 +12,117 @@
               [om.dom :as dom :include-macros true]))

 (defn now [] (new js/Date))
+(defn guid []
+  (.getNextUniqueId (.getInstance IdGenerator)))
 (def custom-formatter (time-format/formatter "dd/MM/yyyy"))
 (def app-title (str "Notes " (time-format/unparse custom-formatter (time-core/date-time (.getFullYear (now)) (+ 1 (.getMonth (now))) (.getDate (now))))))
-(def app-state (atom {:entered [] :current { :tab 0 :title "" }}))
+(defn new-note [tab] { :id (guid) :tab tab :title "" :status "edited" })
+(def app-state (atom {:notes [(new-note 0)]}))
+
+(defn edit [e note owner comm]
+  (let [note-val @note
+        node (om/get-node owner "editField")]
+    (put! comm [:edit note-val])
+    ))
+
+(defn change [e note owner]
+  (om/set-state! owner :edit-text (.. e -target -value)))
+
+(defn submit [e note owner comm]
+  (when-let [edit-text (om/get-state owner :title)]
+    (if (string/blank? (.trim edit-text))
+      (do
+        (om/update! note :title edit-text)
+        (put! comm [:save @note]))
+      (put! comm [:destroy @note])
+    ))
+  false)
+
+(defn destroy-note [app {:keys [id]}]
+  (om/transact! app :notes
+    (fn [notes] (into [] (remove #(= (:id %) id) notes)))
+    [:delete id]))
+
+(defn mark-edited [n edited-id]
+  (if (= (:id n) edited-id)
+    (assoc n :status "edited")
+    (assoc n :status "entered")))
+
+(defn edit-note [app {:keys [id]}]
+  (let [note-list (:notes @app)
+        final-list (notes-with-editing-row-updated note-list id)]
+    (om/update! app :notes final-list)
+  )
+)
+
+(defn notes-with-editing-row-updated [notes-list id]
+    (vec (map #(mark-edited % id) notes-list))
+)
+
+(defn save-note [app note]
+  (let [existing-list (:notes @app)
+        updated-list (conj existing-list note)
+        final-list (notes-with-editing-row-updated updated-list (:id note))]
+    (om/update! app :notes final-list)
+  )
+)
+
+(defn hidden [is-hidden]
+  (if is-hidden
+    #js {:display "none"}
+    #js {}))
+
+(defn focus-input [note owner]
+  (when (= (:status note) "edited")
+    (let [node (om/get-node owner "editField")
+    len  (.. node -value -length)]
+    (.focus node)
+    (.setSelectionRange node len len)))
+)

 (defn note-view  [note owner]
   (reify
-    om/IRender
-    (render [this]
-      (indent-element (dom/li nil (:title note)) (:tab note))
-      )))
+    om/IInitState
+    (init-state [_]
+      {:edit-text (:title note)})
+    om/IDidMount
+    (did-mount [this]
+      (focus-input note owner))
+    om/IDidUpdate
+    (did-update [_ _ _]
+      (focus-input note owner))
+    om/IRenderState
+    (render-state [_ {:keys [comm] :as state}]
+        (indent-element (dom/li nil
+          (dom/div #js {:className "view"
+            :style (hidden (= (:status note) "edited"))
+            }
+            (dom/label
+              #js {:onDoubleClick #(edit % note owner comm)}
+              (:title note))
+            (dom/button
+              #js {:className "destroy"
+                   :onClick (fn [_] (put! comm [:destroy @note]))}
+              "Delete")
+          )
+          (dom/input
+            #js {:ref "editField"
+                 :className "edit"
+                 :placeholder "Enter note here..."
+                 :style (hidden (not (= (:status note) "edited")))
+                 :value (om/get-state owner :edit-text)
+                 :onBlur #(submit % note owner comm)
+                 :onChange #(change % note owner)
+                 :onKeyDown #(handle-new-note-keydown % note owner comm)})) (:tab note)))))
+
+(defn input-view [note owner]
+  (dom/li nil (dom/input #js {:type "text" :ref "newNote"
+    :placeholder "Enter note here..."
+    :onKeyDown #(handle-new-note-keydown % note owner)
+    :value (:title note)
+    })
+  )
+)

 (defn indent-element [content tab]
   (if (== 0 tab) content
@@ -39,6 +140,7 @@
    40 "down"
    46 "del"
    32 "space"
+   27 "escape"
    186 ";"})

 (defn event-modifiers
@@ -76,13 +178,13 @@
 (defn alphanumeric [s]
   (re-find #"^[a-z0-9]+$" s))

-(defn handle-new-note-keydown [e app owner]
+(defn handle-new-note-keydown [e note owner comm]
   (let [code (event->key e)
         which (.-which e)
         key (.toLowerCase (js/String.fromCharCode which))]
   (if (or (alphanumeric key) (== code "space"))
   (do
-    (om/transact! app [:current :title]
+    (om/transact! note :title
       #(str % key)
       [:title nil])
   )
@@ -90,32 +192,33 @@
   (case code
     "enter"
     (do
-      (let [new-field (om/get-node owner "newNote")]
+      (let [new-field (om/get-node owner "editField")]
       (when-not (string/blank? (.. new-field -value trim))
-        (let [new-note {:id (guid)
-                        :title (.-value new-field)
-                        :status "pending"
-                        :tab (get-in @app [:current :tab])}]
-          (om/transact! app :entered
-            #(conj % new-note)
-            [:create new-note])
-          (om/transact! app [:current :title]
-            (fn [_] "")
-            [:clean-current]))
-        ))
+        (let [note (new-note (:tab @note))]
+          (put! comm [:save note])
+        )))
         false)
     "tab" (do
-      (om/transact! app [:current :tab]
+      (om/transact! note :tab
         #(+ % 1)
         [:tab nil])
       false)
     "shift+tab" (do
-      (om/transact! app [:current :tab]
+      (om/transact! note :tab
         #(- % 1)
         [:tab nil])
       false)
-    nil
-    )))))
+    "up" (do
+      (put! comm [:up note])
+      false)
+    "down" (do
+      (put! comm [:down note])
+      false)
+    "escape" (do
+      (put! comm [:up note])
+      (put! comm [:destroy @note])
+      false)
+    nil)))))

 (defn focus-on-input []
   (let [element (.querySelector js/document "input")
@@ -124,60 +227,67 @@
     (do (.focus element)
        (.setSelectionRange element length length))))

-(defn list-view [app owner]
+(defn index-of [coll v]
+  (let [i (count (take-while #(not= v %) coll))]
+    (when (or (< i (count coll))
+            (= v (last coll)))
+      i)))
+
+(defn go-up [app note]
+  (let [existing-list (:notes @app)
+        index (index-of (:notes @app) @note)
+        note-above (get existing-list (- index 1))
+        final-list (notes-with-editing-row-updated existing-list (:id note-above))]
+    (if (> index 0)
+      (om/update! app :notes final-list)
+    )
+  )
+)
+
+(defn go-down [app note]
+  (let [existing-list (:notes @app)
+        index (index-of (:notes @app) @note)
+        last-row-index (- (.-length (clj->js existing-list)) 1)]
+    (if (= index last-row-index)
+      (let [n (new-note (:tab @note))]
+        (save-note app n)
+      )
+      (let [note-above (get existing-list (+ index 1))
+            final-list (notes-with-editing-row-updated existing-list (:id note-above))]
+        (om/update! app :notes final-list)))
+  )
+)
+
+(defn handle-event [type app val]
+  (case type
+    :destroy (destroy-note app val)
+    :edit    (edit-note app val)
+    :up      (go-up app val)
+    :down    (go-down app val)
+    :save    (save-note app val)
+    :cancel  (destroy-note app val)
+    nil))
+
+(defn notes-app [app owner]
   (reify
-    om/IInitState
-    (init-state [_]
-      {:delete (chan)})
-    om/IDidMount
-    (did-mount [this]
-      (focus-on-input)
-    )
-    om/IDidUpdate
-    (did-update [this prev-props prev-state]
-      (focus-on-input)
-    )
     om/IWillMount
     (will-mount [_]
-      (let [delete (om/get-state owner :delete)]
-        (go (loop []
-              (let [note (<! delete)]
-                (om/transact! app :entered
-                  (fn [xs] (vec (remove #(= note %) xs))))
-                (recur))))))
+      (let [comm (chan)]
+        (om/set-state! owner :comm comm)
+        (go (while true
+              (let [[type value] (<! comm)]
+                (handle-event type app value))))))
     om/IRenderState
-    (render-state [this state]
+    (render-state [_ {:keys [comm]}]
       (dom/div nil
         (dom/h1 nil app-title)
         (apply dom/ul nil
-          (om/build-all note-view (:entered app)
-            {:init-state state}))
-        (dom/ul nil
-          (indent-element
-            (dom/li nil (dom/input #js {:type "text" :ref "newNote"
-              :placeholder "Enter note here..."
-              :onKeyDown #(handle-new-note-keydown % app owner)
-              :value (get-in app [:current :title])
-            })) (get-in app [:current :tab])
-          )
-          ;(dom/button #js {:onClick #(add-note app owner)} "Add note")
-        )))))
-
-(defn guid []
-  (.getNextUniqueId (.getInstance IdGenerator)))
-
-(defn add-note [app owner]
-  (let [new-note (-> (om/get-node owner "newNote")
-                        .-value)]
-    (when new-note
-      (om/transact! app :entered #(conj % new-note)))))
+          (om/build-all note-view (:notes app)
+          {:init-state {:comm comm}
+           :key :id }
+          ))))))

 (om/root
-  (fn [app owner]
-    (reify om/IRender
-      (render [_]
-        (dom/div nil
-          (om/build list-view app)
-          ))))
+  notes-app
   app-state
   {:target (. js/document (getElementById "app"))})


Adding location page

Adding location page

--- src/cljs/ohds/pages.cljs
+++ src/cljs/ohds/pages.cljs
@@ -26,3 +26,16 @@
   [:div
    [:h4 {:style {:color "red"}} "Invalid Username or Passoword"]
    [login-page do-login app-state]])
+
+
+(defn location-page []
+  (let [location-id (atom "External ID")
+        name (atom "Name")]
+    (fn []
+      [:div [:h2 "Location Page"]
+       [:div
+        [:label "Parent Location"] [:select "Location Hierarchy"]]
+       [:div [:label "Name"] [c/atom-input name]]
+       [:div [:label "External ID"] [c/atom-input location-id]]
+       [:div [:label "Type"] [:select [:option {:value "foo"} "Stuff"] "Type"]]
+       [:div [:a {:href "/individual"} "go to individual page"]]])))


Cone mesh

Cone mesh


Add :checks-if-autoconstructing meta-error

--- src/clojush/evaluate.clj
+++ src/clojush/evaluate.clj
@@ -214,6 +214,14 @@
                           (= cat :checks-autoconstructing)
                           (if (some (fn [instruction-map]
                                       (and (= (:instruction instruction-map) 'genome_autoconstructing)
+                                           (not (:silent instruction-map))))
+                                    (:genome ind))
+                            0
+                            1)
+                          ;
+                          (= cat :checks-if-autoconstructing)
+                          (if (some (fn [instruction-map]
+                                      (and (= (:instruction instruction-map) 'genome_if_autoconstructing)
                                            (not (:silent instruction-map))))
                                     (:genome ind))
                             0


Add test for default behvior when no supported output type is provided.

--- test/dsbdp/test/data_processing_dsl_tests.clj
+++ test/dsbdp/test/data_processing_dsl_tests.clj
@@ -97,6 +97,16 @@
         data-processing-fn (create-proc-fn dsl-expression)
         result (data-processing-fn pcap-byte-array-test-data)]
     (is (= expected (str result)))))
+
+(deftest output-type-defaults-to-java-map-test
+  (let [expected {"udpSrc" 2048, "udpDst" 4096}
+        dsl-expression {:output-type :this-is-no-supported-output-type
+                        :rules [['udpSrc '(int16 50)]
+                                ['udpDst '(int16 52)]]}
+        data-processing-fn (create-proc-fn dsl-expression)
+        result (data-processing-fn pcap-byte-array-test-data)]
+    (is (instance? Map result))
+    (is (= expected result))))


a bit

a bit

--- src/codeitlater/core.clj
+++ src/codeitlater/core.clj
@@ -76,19 +76,23 @@
                     filepath))))))

 ;;:= TODO: lalala
-;;:= MARK: hahaha
+;;:= MARK: hahaha
+;;:= TODO: finish help flag
 (defn -main [& args]
   (let [options (-> args (parse-opts command) (get :options))
         {dir :dir
          filetypes :filetype
          jsonpath :json
          jsonpathx :jsonx
-         keyword :keyword} options
+         keyword :keyword
+         help :help} options
         commentdict (into (read-json jsonpath) (read-json jsonpathx))]
     ;(println commentdict)
     ;(println options)
-    (cond filetypes (cilformat/list2tree (read-files commentdict dir (str/split filetypes #" ")) keyword)
-          dir (cilformat/list2tree (read-files commentdict dir) keyword))
+    (cond
+      help (print (-> args (parse-opts command) (get :summary)))
+      filetypes (cilformat/list2tree (read-files commentdict dir (str/split filetypes #" ")) keyword)
+      dir (cilformat/list2tree (read-files commentdict dir) keyword))
     ;; https://stackoverflow.com/questions/36251800/what-is-clojures-flush-and-why-is-it-necessary
     (flush)))


silence closed channel exceptions

silence closed channel exceptions

--- src/riemann/transport/tcp.clj
+++ src/riemann/transport/tcp.clj
@@ -3,6 +3,7 @@
   incoming events to the core's streams, queries the core's index for states."
   (:import [java.net InetSocketAddress]
            [java.util.concurrent Executors]
+           [java.nio.channels ClosedChannelException]
            [org.jboss.netty.bootstrap ServerBootstrap]
            [org.jboss.netty.buffer ChannelBuffers]
            [org.jboss.netty.channel ChannelHandler
@@ -57,8 +58,10 @@
             (.close channel)))))

     (exceptionCaught [context ^ExceptionEvent exception-event]
-      (warn (.getCause exception-event) "TCP handler caught")
-      (.close (.getChannel exception-event)))))
+      (let [cause (.getCause exception-event)]
+        (when-not (= ClosedChannelException (class cause))
+          (warn (.getCause exception-event) "TCP handler caught")
+          (.close (.getChannel exception-event)))))))

 (defn tcp-server
   "Create a new TCP server for a core. Starts immediately. Options:


Change `event_source` to send alerts.

Change `event_source` to send alerts.

--- src/wonko/event_source.clj
+++ src/wonko/event_source.clj
@@ -37,7 +37,10 @@
       (client/counter :found-sku-with-negative-min-value nil)
       (client/counter :defensive/compute {:status :start})
       (client/counter :defensive/compute {:status :done})
-      (client/counter :cogs/job {:status :feed-unavailable} :alert true)
+      (client/counter :cogs/job {:status :feed-unavailable})
+
+
+      (client/alert :s3-down {:msg "Couldn't reach S3 for something."})

       ;; events of this form are not supported currently
       ;; (client/gauge :cogs-job-stats {:successes 107 :errors 3 :exec-time 42})
@@ -57,4 +60,4 @@
       (client/counter :get-user-token {:status 400})
       (client/gauge :get-buckets-exec-time {:status 200} 10)
       (client/gauge :get-user-token-exec-time {:status 200} 15)
-      (client/counter :no-current-experiment {} :alert true))))
+      (client/counter :no-current-experiment {}))))


Adds basic markup

Adds basic markup

--- src/wordly/routes/home.clj
+++ src/wordly/routes/home.clj
@@ -3,7 +3,13 @@
             [wordly.views.layout :as layout]))

 (defn home []
-  (layout/common [:h1 "Hello World!"]))
+  (layout/common [:h1 "Wordly"]
+                 [:form
+                  [:label "URL"]
+                  [:input {:type "text"}]
+                  [:input {:type "submit" :value "Submit"}]
+                  ]
+                 ))

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


CMR-348: Removed unnecessary parameter validation test.

--- test/cmr/search/test/services/parameter_validation.clj
+++ test/cmr/search/test/services/parameter_validation.clj
@@ -72,10 +72,7 @@
            (pv/orbit-number-validation :granule (assoc valid-params :orbit-number "A,10")))))
   (testing "Non-numeric stop-orbit-number"
     (is (= [(on-msg/invalid-orbit-number-msg)]
-           (pv/orbit-number-validation :granule (assoc valid-params :orbit-number "10,A")))))
-  (testing "Start orbit-number greater than stop orbit-number"
-    (is (= [(on-msg/invalid-orbit-number-msg)]
-           (pv/orbit-number-validation :granule (assoc valid-params :orbit-number "10,1"))))))
+           (pv/orbit-number-validation :granule (assoc valid-params :orbit-number "10,A"))))))

 (deftest temporal-format-validation :collection-start-date-test
   (testing "valid-start-date"


Replaced pst-str instance in wrap-stacktrace

--- ring-devel/src/ring/middleware/stacktrace.clj
+++ ring-devel/src/ring/middleware/stacktrace.clj
@@ -45,7 +45,7 @@
               [:tbody (map elem-partial (:trace-elems ex))]]]]])))

 (defn- js-ex-response [e]
-  (-> (response (pst-str e))
+  (-> (response (with-out-str (pst e)))
       (status 500)
       (content-type "text/javascript")))


Check for ring handler when upstarting ring box.

--- systems/ring/src/containium/systems/ring.clj
+++ systems/ring/src/containium/systems/ring.clj
@@ -112,6 +112,7 @@
 (defn- box->ring-app
   [name {:keys [project] :as box}]
   (let [ring-conf (clean-ring-conf (-> project :containium :ring))
+        _ (assert (and ring-conf (:handler ring-conf)) (print-str ":ring system config requires a :handler, but ring-conf only contains: " ring-conf))
         handler-fn @(boxure/eval box `(do (require '~(symbol (namespace (:handler ring-conf))))
                                           ~(:handler ring-conf)))]
     (RingApp. name box handler-fn ring-conf)))


Change the transfer function since the cassandra schema requires short_url.

--- src/uuuurrrrllll/transfer.clj
+++ src/uuuurrrrllll/transfer.clj
@@ -2,6 +2,7 @@
   (:require [clojurewerkz.welle.buckets :as wb]
             [clojurewerkz.welle.core :as wc]
             [clojurewerkz.welle.kv :as kv]
+            [uuuurrrrllll.util :refer [gen-short-url]]
             [uuuurrrrllll.riak :refer [get-all-entries]])
   (:use [clojurewerkz.cassaforte.client :as client]
         [clojurewerkz.cassaforte.cql]
@@ -11,7 +12,8 @@
 (def table "message")

 (defn transfer-in-memory []
-  (insert-batch table (get-all-entries)))
+  (pmap #(insert table %)
+        (map #(assoc % :short_url (gen-short-url 5)) (get-all-entries))))

 (defn transfer []
   (spit "f" "[")


Fix missing argument on error handler.

Fix missing argument on error handler.

--- src/uxbox/frontend/errors.clj
+++ src/uxbox/frontend/errors.clj
@@ -63,7 +63,7 @@
     (instance? clojure.lang.ExceptionInfo err)
     (handle-exception err)

-    (instance? org.jooq.exception.DataAccessException)
+    (instance? org.jooq.exception.DataAccessException err)
     (handle-data-access-exception err)

     :else


Remove println.

Remove println.

--- src/uxbox/services/images.clj
+++ src/uxbox/services/images.clj
@@ -187,7 +187,6 @@
 (defn get-images-by-user
   [conn user collection]
   (let [sqlv (sql/get-images {:user user :collection collection})]
-    (println sqlv)
     (->> (sc/fetch conn sqlv)
          (map data/normalize-attrs))))


Fix per https://github.com/MastodonC/kixi.hecuba/pull/638#discussion_r39143500

(Plus removal of unused function)

--- src/cljs/kixi/hecuba/tabs/hierarchy/tapestry.cljs
+++ src/cljs/kixi/hecuba/tabs/hierarchy/tapestry.cljs
@@ -90,10 +90,6 @@
      :palette-scale viz/linear-scale
      :layout        svg-heatmap-with-title
      }))
-
-(defn int-to-dow
-  [num]
-  (nth ["S" "M" "T" "W" "T" "F" "S"] (mod num 7)))

 (defn int-to-tod
   [num]
@@ -150,10 +146,10 @@
                                                   :pos 10
                                                   :label-dist -35
                                                   :label {:text-anchor "start"}
-                                                  :format #(cond
-                                                             (= % 0) lcb
-                                                             (= % gradations) ucb
-                                                             (= % (/ gradations 2)) midcb)})
+                                                  :format #(condp = %
+                                                              0 lcb
+                                                              gradations ucb
+                                                              (/ gradations 2) midcb)})
                                         :data     [(merge (heatmap-spec
                                                            :yellow-magenta-cyan
                                                            (vec (for [x (map #(/ % gradations)(range 0 gradations))]


feat(web/src-cljs/web/core.cljs): add map page placeholder

--- web/src-cljs/web/core.cljs
+++ web/src-cljs/web/core.cljs
@@ -15,11 +15,17 @@
          [:ul.nav.navbar-nav
           [:li {:class (when (= :home (session/get :page)) "active")}
            [:a {:on-click #(secretary/dispatch! "#/")} "Home"]]
+          [:li {:class (when (= :map (session/get :page)) "active")}
+           [:a {:on-click #(secretary/dispatch! "#/map")} "Map"]]
           [:li {:class (when (= :about (session/get :page)) "active")}
            [:a {:on-click #(secretary/dispatch! "#/about")} "About"]]]]]])

 (defn about-page []
   [:div "this is the story of web... work in progress"])
+
+(defn map-page []
+  [:div
+   [:h2 "Welcome to the map!"]])

 (defn home-page []
   [:div
@@ -27,12 +33,14 @@

 (def pages
   {:home home-page
+   :map map-page
    :about about-page})

 (defn page []
   [(pages (session/get :page))])

 (defroute "/" [] (session/put! :page :home))
+(defroute "/map" [] (session/put! :page :map))
 (defroute "/about" [] (session/put! :page :about))

 (defn mount-components []


Added cpu and mem to process runner health checks.

--- src/cmr/dev/env/manager/components/process.clj
+++ src/cmr/dev/env/manager/components/process.clj
@@ -128,10 +128,18 @@
   [this]
   (let [process-response nil
         http-response nil
-        ping-response nil]
+        ping-response nil
+        cpu (process/get-cpu (:process-data this))
+        mem (process/get-mem (:process-data this))]
     {:process nil
      :http nil
-     :ping nil}))
+     :ping nil
+     :cpu {
+       :status (if (>= cpu 50) :high :ok)
+       :details {:value cpu :type :percent}}
+     :mem {
+       :status (if (>= mem 20) :high :ok)
+       :details {:value mem :type :percent}}}))

 (def healthful-behaviour
   {:get-status get-status})


Rounding off usage percent.

Rounding off usage percent.

--- src-cljs/frontend/components/org_settings.cljs
+++ src-cljs/frontend/components/org_settings.cljs
@@ -962,7 +962,7 @@
   (reify
     om/IRender
     (render [_]
-      (let [percent (* 100 (/ usage max))]
+      (let [percent (.round js/Math (* 100 (/ usage max)))]
         (html
          [:div.usage-group
           [:div.month-label month]


Port defmacro change to clojurescript

Port defmacro change to clojurescript

--- src/main/clojure/cljs/test/check/cljs_test.clj
+++ src/main/clojure/cljs/test/check/cljs_test.clj
@@ -19,21 +19,18 @@
   [default-times], or with a map containing any of the keys
   [:seed :max-size :num-tests]."
   {:arglists '([name property] [name num-tests? property] [name options? property])}
-  [name & args]
-  (let [property           (second args)
-        [options property] (if property
-                             [(first args) property]
-                             [nil (first args)])]
-    `(do
-       (defn ~(vary-meta name assoc
-                         ::defspec true
-                         :test `#(cljs.test.check.cljs-test/assert-check
+  ([name property] `(defspec ~name nil ~property))
+  ([name options property]
+   `(do
+      (defn ~(vary-meta name assoc
+                        ::defspec true
+                        :test `#(cljs.test.check.cljs-test/assert-check
                                    (assoc (~name) :test-var (str '~name))))
-         ([] (let [options# (process-options ~options)]
-               (apply ~name (:num-tests options#) (apply concat options#))))
-         ([~'times & {:keys [~'seed ~'max-size] :as ~'quick-check-opts}]
-            (apply
-             cljs.test.check/quick-check
-             ~'times
-             (vary-meta ~property assoc :name (str '~property))
-             (apply concat ~'quick-check-opts)))))))
+        ([] (let [options# (process-options ~options)]
+              (apply ~name (:num-tests options#) (apply concat options#))))
+        ([~'times & {:keys [~'seed ~'max-size] :as ~'quick-check-opts}]
+         (apply
+           cljs.test.check/quick-check
+           ~'times
+           (vary-meta ~property assoc :name (str '~property))
+           (apply concat ~'quick-check-opts)))))))


fix ordering bug

fix ordering bug

--- src/matcha.clj
+++ src/matcha.clj
@@ -11,6 +11,22 @@
             [clojure.data :as data]
             [clojure.pprint :as pprint]))

+
+(defn describe-list [call xs]
+  (str "(" call " " (clojure.string/join " " xs) ")"))
+
+(defn standard-describe-mismatch [x]
+  (pr-str x))
+
+(defn pp [x]
+  (with-out-str (pprint/pprint x)))
+
+(defn describe-class-mismatch [x]
+  (str (pp x)
+       (if (clojure.core/nil? x)
+         ""
+         (str " <" (class x) ">"))))
+
 (defprotocol Matcher
   (match [this a] "returns a truthy value if the matcher matches the given value")
   (description [this] "returns a human readable description of the matcher")
@@ -26,21 +42,6 @@
   ([match description] (make-record-matcher match description describe-class-mismatch))
   ([match description describe-mismatch]
    (->RecordMatcher match description describe-mismatch)))
-
-(defn describe-list [call xs]
-  (str "(" call " " (clojure.string/join " " xs) ")"))
-
-(defn standard-describe-mismatch [x]
-  (pr-str x))
-
-(defn pp [x]
-  (with-out-str (pprint/pprint x)))
-
-(defn describe-class-mismatch [x]
-  (str (pp x)
-       (if (clojure.core/nil? x)
-         ""
-         (str " <" (class x) ">"))))

 (extend-protocol Matcher java.util.Map
   (match [this a] ((:match this) a))


Redirect hub root to /datapages/.

Redirect hub root to /datapages/.

--- src/cavm/views/datasets.clj
+++ src/cavm/views/datasets.clj
@@ -140,6 +140,10 @@
           (upload-files ip loader docroot file)))
   (GET ["/download/:dataset" :dataset #".+"] [dataset :as {docroot :docroot}]
        (response/file-response dataset {:root docroot :index-files? false}))
+  (GET "/" [:as req] (response/redirect
+                       (str "https://xenabrowser.net/datapages/?hub="
+                            (name (:scheme req)) "://"
+                            (:server-name req) ":" (:server-port req))))
   (GET "/data/:exp" [exp] (expression exp))
   (POST "/data/" r (expression (body-string r)))
   (POST "/update/" [file always delete :as {ip :remote-addr loader :loader}]


CMR-1161: Addressed review comments.

CMR-1161: Addressed review comments.

--- transmit-lib/src/cmr/transmit/metadata_db.clj
+++ transmit-lib/src/cmr/transmit/metadata_db.clj
@@ -41,8 +41,7 @@
          status (:status response)]
      (if (= 200 status)
        (cheshire/parse-string (:body response) true)
-       (if (and (= false throw-service-error?) (= 404 status))
-         nil
+       (when (and throw-service-error? (= 404 status))
          (errors/throw-service-error
            :not-found
            (str "Failed to retrieve concept " concept-id " from metadata-db: " (:body response))))))))


Pulled in missing date-time function from postprocess branch

--- src/clj/forma/date_time.clj
+++ src/clj/forma/date_time.clj
@@ -267,3 +267,11 @@
            "16" [ordinal 16]
            "8" [ordinal 8]
            "1" [ordinal 1])))
+
+(defn convert-period-res
+  "Convert a period from in-res to corresponding period at out-res.
+
+   By converting a period to a date, we get the first date within a period. Converting date to period, we get the period in which that first date falls, at the new resolution."
+  [res-in res-out period]
+  (->> (period->datetime res-in period)
+       (datetime->period res-out)))


apply fix to badge admintool

apply fix to badge admintool

--- src/clj/salava/admin/db.clj
+++ src/clj/salava/admin/db.clj
@@ -233,19 +233,20 @@

 (defn get-badge-modal [ctx badgeid]
   (let [badge  (b/get-badge ctx badgeid nil)
-        emails (vec (u/email-addresses ctx (:owner badge)))]
-    (hash-map :name (:name badge)
-              :image_file (:image_file badge)
-              :item_owner_id (:owner badge)
+        emails (vec (u/email-addresses ctx (:owner badge)))
+        default-content (->> badge :content (filter #(= (:language_code %) (:default_language_code %))) first)]
+    (hash-map :name (:name default-content)
+              :image_file (:image_file default-content)
+              :item_owner_id (:owner badge)
               :item_owner (str (:first_name badge) " " (:last_name badge))
-              :info {:issuer_content_name (:issuer_content_name badge)
-                     :issuer_content_url (:issuer_content_url badge)
-                     :issuer_contact (:issuer_contact badge)
-                     :issuer_image (:issuer_image badge)
-                     :creator_name (:creator_name badge)
-                     :creator_url (:creator_url badge)
-                     :creator_email (:creator_email badge)
-                     :creator_image (:creator_image badge)
+              :info {:issuer_content_name (:issuer_content_name default-content)
+                     :issuer_content_url (:issuer_content_url default-content)
+                     :issuer_contact (:issuer_contact default-content)
+                     :issuer_image (:issuer_image default-content)
+                     :creator_name (:creator_name default-content)
+                     :creator_url (:creator_url default-content)
+                     :creator_email (:creator_email default-content)
+                     :creator_image (:creator_image default-content)
                      :emails emails})))

 (defn get-public-badge-content-modal [ctx badge-id user-id]
@@ -322,7 +323,7 @@
         profiles (jdbc/with-db-connection
                    [conn (:connection (get-db ctx))]
                    (jdbc/query conn (into [query] params)))]
-
+
     (->> profiles
          (take 50))))


No longer reverse the string we send (the server will do that).

--- src/cljs/om_sente/core.cljs
+++ src/cljs/om_sente/core.cljs
@@ -31,11 +31,11 @@
     (om/set-state! owner field value)))

 (defn send-text-on-enter
-  "When user presses ENTER, send the reversed value of the field to the server
+  "When user presses ENTER, send the value of the field to the server
   and clear the field's input state."
   [e owner state]
   (when (== (.-keyCode e) 13)
-    (chsk-send! [:test/echo (clojure.string/reverse (:text state))])
+    (chsk-send! [:test/echo (:text state)])
     (om/set-state! owner :text "")))

 (defn text-sender


Add cljs path for creating a webgl terminal

--- src/cljx/robinson/main.cljx
+++ src/cljx/robinson/main.cljx
@@ -11,7 +11,8 @@
   (:require
             [clojure.data.generators :as dg]
             [clojure.stacktrace :as st]
-            [robinson.swingterminal :as swingterminal]
+            #+clj  [robinson.swingterminal :as swingterminal]
+            #+cljs [robinson.webglterminal :as webglterminal]
             [robinson.aterminal :as aterminal]
             [clojure.java.io :as io]
             [clojure.pprint :as pp]
@@ -145,7 +146,13 @@
         settings (clojure.edn/read-string
                    (slurp "config/settings.edn"))
         terminal  (or screen
+                      #+clj
                       (swingterminal/make-terminal 80 24 [255 255 255] [0 0 0] nil
+                                               (get settings :windows-font)
+                                               (get settings :else-font)
+                                               (get settings :font-size))
+                      #+clj
+                      (webglterminal/make-terminal 80 24 [255 255 255] [0 0 0] nil
                                                (get settings :windows-font)
                                                (get settings :else-font)
                                                (get settings :font-size)))


fixed date parsing bug in stop-iteration?

--- src/clueweb_disqus/core.clj
+++ src/clueweb_disqus/core.clj
@@ -1,7 +1,9 @@
 (ns clueweb-disqus.core
   (:require [cheshire.core :refer :all]
             [clj-http.client :as client]
+            [clj-time.coerce :as c]
             [clj-time.core :as t]
+            [clj-time.format :as f]
             [clojure.java.io :as io])
   (:use [clojure.pprint :only [pprint]]))

@@ -35,6 +37,7 @@
             (-> credentials (get since-epoch) :api-key)
             "&since="
             since-epoch
+            "&order=asc"
             (if cursor (str "&cursor=" cursor) "")))))

 (defn rate-limited-download
@@ -45,22 +48,22 @@
             (swap! requests-in-session inc)
             (-> a-url client/get :body parse-string))

-        (and (< (t/in-minutes (t/duration @session-start-time t/now))
+        (and (< (t/in-minutes (t/interval @session-start-time (t/now)))
                 60)
              (> 1000 @requests-in-session))
         (do (swap! requests-in-session inc)
             (-> a-url client/get :body parse-string))

-        (and (< (t/in-minutes (t/duration @session-start-time t/now))
+        (and (< (t/in-minutes (t/interval @session-start-time (t/now)))
                 60)
              (<= 1000 @requests-in-session))
         (let [time-to-sleep (* 1000
                                (-
                                 3600
                                 (t/in-secs
-                                 (t/duration @session-start-time
+                                 (t/interval @session-start-time
                                              (t/now)))))]
-          (do (Thead/sleep time-to-sleep) ; sleep till the end of the
+          (do (Thread/sleep time-to-sleep) ; sleep till the end of the
                                           ; hour
                                           ; and then restart the session
               (swap! session-start-time (fn [x] (t/now)))
@@ -73,11 +76,26 @@
         filename-to-write (str start-epoch "-" writer-file-name)
         stats-f-to-write (str start-epoch "-" stats-file-name)]
     (do (with-open [wrtr (io/writer filename-to-write :append true)]
-          (pprint content-to-write wrtr))
+          (doall (doseq [c content-to-write]
+                   (pprint c wrtr))))
         (if (.exists (java.io.File. stats-f-to-write))
-          (let [count
-                (inc (read-string (slurp stats-f-to-write)))]
-            (spit stats-f-to-write count))))))
+          (let [cnt
+                (+ (read-string (slurp stats-f-to-write))
+                   (count content-to-write))]
+            (spit stats-f-to-write cnt))
+          (spit stats-f-to-write (count content-to-write))))))
+
+(defn stop-iteration?
+  [start-epoch page-response]
+  (let [credentials (load-credentials)
+        formatter   (f/formatters :date-hour-minute-second)]
+    (<= (-> credentials (get start-epoch) :stop Long/parseLong)
+        (try (-> (f/parse formatter
+                          (-> page-response last (get "createdAt")))
+                 c/to-long
+                 (/ 1000))
+             (catch Exception e (do (pprint (last page-response))
+                                    true)))))) ; stop anyway

 (defn discover-iteration
   [start-epoch first-page-content]
@@ -94,12 +112,13 @@

             next-pg-content (rate-limited-download next-pg-url)]
         (write-content start-epoch next-pg-content)
-        (recur start-epoch
-               next-pg-content)))))
+        (when-not (stop-iteration? start-epoch (get next-pg-content "response"))
+          (recur start-epoch
+                 next-pg-content))))))

 (defn threads-since
   [start-epoch]
   (let [request-url (create-url start-epoch)
         first-page  (rate-limited-download request-url)]
     (write-content start-epoch first-page)
-    (discover-iteration start-epoch first-page-content)))
+    (discover-iteration start-epoch first-page)))


Some code for forces

Some code for forces

but no real implementation yet.

Signed-off-by: Daniel Borchmann <25857343a15bf1edafebc2912e82ecf775c585c1@mailbox.tu-dresden.de>

--- src/conexp/layout/force.clj
+++ src/conexp/layout/force.clj
@@ -37,7 +37,7 @@
 	   (for ~bindings
 	     (double ~expr))))

-;; Repulsive Energy
+;; Repulsive Energy and Force

 (defn- node-line-distance
   "Returns the distance from node to the line between [x_1, y_1] and [x_2, y_2]."
@@ -70,7 +70,14 @@
    (catch Exception e
      pos-infinity)))

-;; Attractive Energy
+(defn- repulsive-force
+  "Computes the n-th component of the vector of repulsive forces
+  acting on the inf-irreducible elements of layout. The vector
+  itself has 2n entries."
+  [layout inf-irrs n]
+  (throw (UnsupportedOperationException. "Not yet implemented.")))
+
+;; Attractive Energy and Force

 (defn- attractive-energy
   "Computes the attractive energy of the given layout."
@@ -78,7 +85,14 @@
   (sum [[x y] node-connections]
        (double (line-length-squared (node-positions x) (node-positions y)))))

-;; Gravitative Energy
+(defn- attractive-force
+  "Computes the n-th component of the vector of attractive forces
+  acting on the inf-irreducible elements of layout. The vector
+  itself has 2n entries."
+  [layout inf-irrs n]
+  (throw (UnsupportedOperationException. "Not yet implemented.")))
+
+;; Gravitative Energy and Force

 (defn- phi
   "Returns the angle between a inf-irreducible node [x_1,y_1]
@@ -116,19 +130,30 @@
      (catch Exception e
        pos-infinity))))

-;; Overall Energy
-
-(def *repulsive-energy-amount* 1)
-(def *attractive-energy-amount* 1)
-(def *gravitative-energy-amount* 1)
+(defn- gravitative-force
+  "Computes the n-th component of the vector of gravitative forces
+  acting on the inf-irreducible elements of layout. The vector itself
+  has 2n entries."
+  [layout inf-irrs n]
+  (throw (UnsupportedOperationException. "Not yet implemented.")))
+
+;; Overall Energy and Force
+
+(def *repulsive-amount* 1)
+(def *attractive-amount* 1)
+(def *gravitative-amount* 1)

 (defn- layout-energy
   "Returns the overall energy of the given layout."
   [layout additional-information]
-  (+ (* *repulsive-energy-amount* (repulsive-energy layout))
-     (* *attractive-energy-amount* (attractive-energy layout))
-     (* *gravitative-energy-amount* (gravitative-energy layout additional-information))))
-
+  (+ (* *repulsive-amount* (repulsive-energy layout))
+     (* *attractive-amount* (attractive-energy layout))
+     (* *gravitative-amount* (gravitative-energy layout additional-information))))
+
+(defn- layout-force
+  "Computes overall force _component_ of index n in the inf-irreducible elements."
+  [layout inf-irrs n additional-information]
+  (throw (UnsupportedOperationException. "Not yet implemented.")))

 (defn- energy-by-inf-irr-positions
   "Returns a function calculating the energy of an attribute additive
@@ -148,6 +173,16 @@
 		       {:inf-irrs seq-of-inf-irrs,
 			:upper-neighbours-of-inf-irrs upper-neighbours})))))

+(defn- force-by-inf-irr-positions
+  "Returns a function representing the forces on the infimum
+  irreducible elements of lattice. The function returned takes as
+  input and index representing the coordinate to derive at and returns
+  itself a function from a placement of the inf-irreducible elements
+  to the force component given by the index. seq-of-inf-irrs gives the
+  order of the inf-irreducible elements."
+  [lattice seq-of-inf-irrs]
+  (throw (UnsupportedOperationException. "Not yet implemented.")))
+
 ;; Force Layout

 (defn force-layout
@@ -181,15 +216,17 @@

 ;;;

-(comment "For Testing"
-
-(require 'conexp :reload-all)
-(def lat (conexp/concept-lattice (conexp/rand-context #{1 2 3 4 5 6} 0.4)))
+(require 'conexp)
 (defn simple-layered-force-layout [lat]
   (force-layout lat (conexp/simple-layered-layout lat)))
+
+(comment "For Testing"
+
+(def lat (conexp/concept-lattice (conexp/rand-context #{1 2 3 4 5 6} 0.4)))
 (conexp/draw-lattice lat simple-layered-force-layout)

 )
+
 ;;;

 nil


add occupation

add occupation

--- src/pc/crm.clj
+++ src/pc/crm.clj
@@ -55,13 +55,14 @@
           cust-count-yesterday (cust-model/cust-count (d/as-of db midnight-pt))
           dribbble-profile (some-> cust :cust/guessed-dribbble-username get-dribbble-profile)
           cust-name (str/trim (str (:cust/first-name cust) " " (:cust/last-name cust)))
-          message (str (format "New user (#%s, #%s today): <https://plus.google.com/%s|%s> <%s|%s>"
+          message (str (format "New user (#%s, #%s today): <https://plus.google.com/%s|%s> <%s|%s>\nOccupation: %s"
                                cust-count
                                (- cust-count cust-count-yesterday)
                                (:google-account/sub cust)
                                cust-name
                                (admin-urls/cust-info-from-cust cust)
-                               (:cust/email cust))
+                               (:cust/email cust)
+                               (or (:cust/occupation cust) "Unknown"))
                        (when dribbble-profile
                          (format "\nDribbble: <%s|%s> %s followers "
                                  (get dribbble-profile "html_url")


SelectBufferedOptsSchema

SelectBufferedOptsSchema

--- src/er_cassandra/record.clj
+++ src/er_cassandra/record.clj
@@ -68,6 +68,12 @@
    {(s/optional-key :where) WhereSchema
     (s/optional-key :order-by) OrderBySchema}))

+(s/defschema SelectBufferedOptsSchema
+  (merge
+   SelectOptsSchema
+   {(s/optional-key :fetch-size) s/Int
+    (s/optional-key :buffer-size) s/Int}))
+
 (s/defschema PartitionKeySchema
   (s/conditional
    keyword?


Fix bug w/ conflicting card collection react keys

This fixes a bug where cards that are part of the card collection
component can have the same react key if the individual card components
have `nil` keys, causing react to only render the first child.

--- src-cljs/frontend/components/pieces/card.cljs
+++ src-cljs/frontend/components/pieces/card.cljs
@@ -60,7 +60,8 @@
       (for [card cards]
         ;; Reuse the card's key. Thus, if each card is built with a unique key,
         ;; each .item will be built with a unique key.
-        [:.item {:key (.-key card)}
+        [:.item (when-let [react-key (.-key card)]
+                  {:key react-key})
          card])]))))

 (dc/do


almost working transpose table: implementation & experiments (commented out)

--- src/hackerrank/security/keyword_transposition.clj
+++ src/hackerrank/security/keyword_transposition.clj
@@ -45,7 +45,10 @@
     (conj (map str/join (partition-all (count s) (remove-chars string alphabet-seq))) s)))

 (defn transpose-table [table]
-  table)
+  (defn transpose-row [table i]
+    (join (map #(if (>= i (count %)) "" (nth % i)) table)))
+
+  (map #(transpose-row table %) (range (count (first table)))))

 (defn keyword-transposition

@@ -60,13 +63,33 @@
 ;; uncomment for hackerrank:
 ;; (println (keyword-transposition))

-(map str/join (partition (count "sport") alphabet-seq))

-(let [s (distinct-string "sport")]
-    (conj (partition (count s) alphabet-seq)) s)
+
+
+;; (map str/join (partition (count "sport") alphabet-seq))
+;; (let [s (distinct-string "sport")]
+;;     (conj (partition (count s) alphabet-seq)) s)

 ;; (remove-chars "sport" "abcdsport")
 ;; (seq "sport")
 ;; (seq "abcdsport")
 ;; (set/difference (set (seq "abcdsport")) (set (seq "sport")))
 ;; (str/join (set/difference (set (seq "abcdsport")) (set (seq "sport"))))
+
+;;;; transpose-table
+;; (def table ["safku" "pbglv" "ochmw" "rdinx" "tejqy"])
+;; (def a (map first table))
+;; (def b (map second table))
+;; (def c (map #(nth % 2) table))
+;; c
+;; (map #(str %1 %2) a b)
+
+;; (reduce str a)
+
+;; (dotimes [i (count (first table))]
+;;   (println (join (map #(nth % i) table))))
+
+;; (defn transpose-row [table i]
+;;   (join (map #(nth % i) table)))
+
+;; (map #(transpose-row table %) (range (count (first table))))


CMR-2482: Added test for cascaded tag/tag association deletes

--- metadata-db-app/int_test/cmr/metadata_db/int_test/concepts/delete_test.clj
+++ metadata-db-app/int_test/cmr/metadata_db/int_test/concepts/delete_test.clj
@@ -30,6 +30,24 @@

 (deftest delete-group-general
   (cd-spec/general-delete-test :access-group ["REG_PROV" "SMAL_PROV" "CMR"]))
+
+;; test tag delete cascades to tag associations
+(deftest tag-delete-cascades-to-tag-associations
+  (let [tag-collection (util/create-and-save-collection "REG_PROV" 1)
+        tag (util/create-and-save-tag 1)
+        tag-association (util/create-and-save-tag-association tag-collection tag 1 1)
+        tag-association-id (:concept-id tag-association)
+        {status :status tag-association-concept :concept} (util/get-concept-by-id tag-association-id)
+        _ (util/delete-concept (:concept-id tag))
+        {tombstone-status :status tombstone :concept} (util/get-concept-by-id tag-association-id)]
+
+    (testing "tag association was saved and is not a tombstone"
+      (is (= 200 status))
+      (is (not (:deleted tag-association-concept))))
+
+    (testing "tag association is tombstoned after tag is deleted"
+      (is (= 200 tombstone-status))
+      (is (:deleted tombstone)))))

 ;; collections must be tested separately to make sure granules are deleted as well
 (deftest delete-collection-using-delete-end-point-test


added a flexible options variable to validation so specific validations that need more info havea way to insert it

--- src/midje/error_handling/validation_errors.clj
+++ src/midje/error_handling/validation_errors.clj
@@ -59,12 +59,12 @@

 ;; Validate

-(defmulti validate (fn [form]
+(defmulti validate (fn [form & options]
                      (if (named? (first form))
                        (name (first form))
                        :validate-seq)))

-(defmethod validate :validate-seq [form]
+(defmethod validate :validate-seq [form & options]
   (spread-validation-error (map validate form)))

-(defmethod validate :default [form] (rest form))+(defmethod validate :default [form & options] (rest form))


changed next session date

changed next session date

--- src/cljs/work_sessions/components/headers.cljs
+++ src/cljs/work_sessions/components/headers.cljs
@@ -31,7 +31,7 @@
    [:p
     (unescapeEntities "The session length is 1 hour, 13.30 — 14.30 Helsinki and Moscow time.")]
    [:p
-    (unescapeEntities "The next session will be in a week — on 9 June, time stays the same.")]
+    (unescapeEntities "The next session will be in a week — on 16 June, time stays the same.")]
    [:p
     "Join a simultaneous work session from your computer by opening "
     [:a {:href (str "http://sws.eeefff.org" session-room-url)
@@ -84,7 +84,7 @@
    [:p
     (unescapeEntities "Продолжительность сессии — 1 час, с 13.30 до 14.30 по Хельсинки и Москве.")]
    [:p
-    (unescapeEntities "Следующая сессия будет через неделю — 9 июня в это же время.")]
+    (unescapeEntities "Следующая сессия будет через неделю — 16 июня в это же время.")]
    [:p
     "Если ты присоединяешься к сессии при помощи компьютера. Открываешь в "
     [:a {:href "https://www.google.com/chrome/"


Add client/shutdown!, fixes #17

Add client/shutdown!, fixes #17

--- src/clojure/clojurewerkz/cassaforte/client.clj
+++ src/clojure/clojurewerkz/cassaforte/client.clj
@@ -257,6 +257,10 @@
     (alter-var-root (var *default-cluster*) (constantly cluster))
     (alter-var-root (var *default-session*) (constantly session))
     session))
+
+(defn disconnect!
+  []
+  (.shutdown *default-cluster*))

 (defn render-query
   "Renders compiled query"


Add profiles endpoint to Amon definition

--- src/kixi/hecuba/amon.clj
+++ src/kixi/hecuba/amon.clj
@@ -17,6 +17,7 @@
    [kixi.hecuba.api.devices :as devices]
    [kixi.hecuba.api.entities :as entities]
    [kixi.hecuba.api.measurements :as measurements]
+   [kixi.hecuba.api.profiles :as profiles]
    [kixi.hecuba.api.programmes :as programmes]
    [kixi.hecuba.api.projects :as projects]
    [kixi.hecuba.api.properties :as properties]
@@ -64,6 +65,8 @@
                  :sensors-by-property (sensors/index-by-property opts p)
                  :datasets            (datasets/index opts p)
                  :dataset             (datasets/resource opts p)
+                 :profiles            (profiles/index opts p)
+                 :profile             (profiles/resource opts p)
                  })))

@@ -109,6 +112,10 @@
          [["entities/" [sha1-regex :entity-id] "/devices/" [sha1-regex :device-id] "/measurements/" :reading-type "/" :timestamp] (:measurement handlers)]
          [["entities/" [sha1-regex :entity-id] "/devices/" [sha1-regex :device-id] "/hourly_rollups/" :reading-type] (:hourly-rollups handlers)]
          [["entities/" [sha1-regex :entity-id] "/devices/" [sha1-regex :device-id] "/daily_rollups/" :reading-type] (:daily-rollups handlers)]
+
+         [["entities/" [sha1-regex :entity-id] "/profiles/"] (:profiles handlers)]
+         [["entities/" [sha1-regex :entity-id] "/profiles"] (bidi/->Redirect 301 (:profiles handlers))]
+         [["entities/" [sha1-regex :entity-id] "/profiles/" [sha1-regex :profile-id]] (:profile handlers)]
          ]
         wrap-cookies)])


Fix build command

Fix build command

--- src/leiningen/chenex.clj
+++ src/leiningen/chenex.clj
@@ -31,7 +31,7 @@
   [temp]
   (lmain/info (yellow-text "Writing a new chenex configuration.\n"))
   (let [t# (first temp)
-        loc# (try (-> (str "chenex/templates/" t# ".clj") io/resource slurp)
+        loc# (try (-> (str "greenyouse/chenex/templates/" t# ".clj") io/resource slurp)
                   (catch Exception _ (lmain/abort (red-text (str "Chenex Error: template " (first temp) " not found.\n
 Options are: cljx")))))]
     (do (io/make-parents "builds/chenex-build.clj")


turn validation tests back on

turn validation tests back on

--- test/onyx/validation_test.clj
+++ test/onyx/validation_test.clj
@@ -166,7 +166,7 @@
           :onyx/batch-size 2}]

         correct-workflow [[:in :intermediate] [:intermediate :out]]]
-    #_(testing "bad-jobs-1"
+    (testing "bad-jobs-1"
       (is (not (:success? (onyx.api/submit-job peer-config {:catalog illegal-catalog :workflow workflow
                                                             :task-scheduler :onyx.task-scheduler/balanced}))))


Fallback to the default number of days for csv report if no parameter is specified.

--- src/oc/storage/api/orgs.clj
+++ src/oc/storage/api/orgs.clj
@@ -529,7 +529,7 @@
     ;; Validations
   :malformed? (by-method {:options false
                           :get (fn [ctx] (if-let* [ctx-params (-> ctx :request :params keywordize-keys)
-                                                   days (Integer/parseInt (or (get ctx-params :days) "1")) ;; get number of days from request or fallback to 1
+                                                   days (Integer/parseInt (get ctx-params :days (str config/default-csv-days))) ;; get number of days from request or fallback to the default number
                                                    _valid? (lib-schema/valid? schema/Num days)]
                                            [false {:days days}]
                                            true))})


Fix tests.

Fix tests.

--- test/beicon/core_spec.cljs
+++ test/beicon/core_spec.cljs
@@ -340,7 +340,7 @@
                  :acc
                  (fn [_ _ _ v]
                    (vswap! vacc conj v)))
-      (s/to-atom a st)
+      (s/to-atom st a)
       (s/on-end st #(do (t/is (= @a 3))
                         (t/is (= @vacc [1 2 3]))
                         (done))))))
@@ -349,7 +349,7 @@
   (t/async done
     (let [st (s/from-coll [1 2 3])
           a (atom [])]
-      (s/to-atom a st conj)
+      (s/to-atom st a conj)
       (s/on-end st #(do (t/is (= @a [1 2 3]))
                         (done))))))


a few more tests

a few more tests

--- test/dalap/test/escape.clj
+++ test/dalap/test/escape.clj
@@ -10,19 +10,27 @@
       "This should behave the same as `clojure.core/str`")
   (is (= ((core/gen-str-escaper #(.toUpperCase (.toString %))) "abc" 123)
          "ABC123")
-      "This should behave the same as `clojure.core/str`"))
+      "uppercase version of str"))

-(deftest test-html-char-escaping
+(deftest test-low-level-char-escaping
   (doseq [[k v] html/html-esc-map]
-    [(is (= (html/escape-html-char-entities k) v))
-     (is (= (html/escape-html (str k)) v))]))
+    [(is (= (html/escape-html-char-entities k) v)
+         "test lower-level escaper")
+     (is (= (html/escape-html (str k)) v)
+         "test via HtmlEscapable protocol")]))

-(deftest test-html-string-escaping
-  (is (= (html/escape-html "&-<->-\"")
-         "&-<->-"")))
+(deftest test-HtmlEscapable
+  (doseq [[inp outp] {
+                      nil ""
+                      (core/safe "&") "&"
+                      (core/safe \&) "&"
+                      (core/safe "&-<->-\"") "&-<->-\""
+                      \& "&"
+                      "abcd&e" "abcd&e"
+                      "&-<->-\"" "&-<->-""
+                      }]
+    (is (= (html/toHtmlEscapedStr inp) (html/escape-html inp) outp))))

-(deftest test-html-pre-escaped
-  (is (= (html/escape-html (core/safe "&-<->-\""))
-         "&-<->-\""))
+(deftest test-mixed-pre-escaped-and-not
   (is (= (html/escape-html (core/safe "&-<->-\"") "-&->")
          "&-<->-\"-&->")))


CMR-563: Renamed paramters.

CMR-563: Renamed paramters.

--- src/cmr/system_int_test/utils/transformer.clj
+++ src/cmr/system_int_test/utils/transformer.clj
@@ -15,9 +15,9 @@

 (defn transform-concepts
   "Transform concepts given as concept-id, revision tuples into the given format"
-  [umm format]
+  [umm-records format]
   (let [mime-type (format mt/format->mime-type)
-        tuples (map #(vector (:concept-id %) (:revision-id %)) umm)
+        tuples (map #(vector (:concept-id %) (:revision-id %)) umm-records)
         response (client/post (url/transformer-url)
                               {:accept mime-type
                                :throw-exceptions false
@@ -29,5 +29,5 @@

 (defn expected-response
   "Returns the expected xml for a given vector of umm records"
-  [umm format]
-  (map #(ummc/umm->xml % format) umm))
+  [umm-records format]
+  (map #(ummc/umm->xml % format) umm-records))


Add :var metadata on 'describe' groups and remove 'name' metadata from 'it'

--- src/main/clojure/com/stuartsierra/lazytest.clj
+++ src/main/clojure/com/stuartsierra/lazytest.clj
@@ -96,12 +96,13 @@
        will become tags on the group."
   [& args]
   (let [[sym args] (get-arg symbol? args)
+	v (when sym (resolve sym))
 	[doc args] (get-arg string? args)
 	[opts body] (get-options args)
 	contexts (seconds (:given opts))
 	tags (set (:tags opts))
 	metadata (merge (standard-metadata &form doc sym)
-			{:tags tags}
+			{:tags tags, :var v}
 			(dissoc opts :given :tags))]
     `(wrap-context ~(:given opts)
       (let [~(with-meta (gensym) {::in-describe true}) nil
@@ -132,7 +133,7 @@
   (let [[doc args] (get-arg string? args)
 	[opts body] (get-options args)
 	tags (set (:tags opts))
-	metadata (merge (standard-metadata &form doc sym)
+	metadata (merge (standard-metadata &form doc)
 			{:tags tags}
 			(dissoc opts :tags))]
     `(with-meta (fn ~(find-local-args &env) ~@body)


Remove clojure snapshot dep from test project.

--- test_projects/sample/test/test_nom_nom_nom.clj
+++ test_projects/sample/test/test_nom_nom_nom.clj
@@ -5,6 +5,6 @@
 (defn f [x]
   (.list x))

-(deftest should-use-1.1.0-SNAPSHOT
-  (is (= "1.1.0-master-SNAPSHOT" (clojure-version)))
+(deftest should-use-1.1.0
+  (is (= "1.1.0" (clojure-version)))
   (f (java.io.File. "/tmp")))


Added support for CSS-style shortcuts on tag name

--- lib/compojure/html/html.clj
+++ lib/compojure/html/html.clj
@@ -33,7 +33,7 @@

 (def h escape-html)    ; Shortcut for escaping HTML

-(defn- make-attrs
+(defn- map-to-attrs
   "Turn a map into a string of XML attributes."
   [attrs]
   (str-map
@@ -43,57 +43,60 @@

 (def xml)

-(defn- make-tag
+(defn- create-tag
   "Wrap some content in an XML tag."
   [tag attrs content]
-  (str* "<" tag (make-attrs attrs) ">"
+  (str* "<" tag (map-to-attrs attrs) ">"
           content
         "</" tag ">"))

-(defn- make-closed-tag
+(defn- create-closed-tag
   "Make a closed XML tag with no content."
   [tag attrs]
-  (str* "<" tag (make-attrs attrs) " />"))
+  (str* "<" tag (map-to-attrs attrs) " />"))

-(defn- xml-map
+(defn- map-xml
   "Turn a list of XML into a string using a supplied formatter."
   [format trees]
   (str-map (partial xml format) trees))

-(defn basic-xml-formatter
+(defn- raw-xml-formatter
   "Format XML without any indentation or extra whitespace."
-  [next-format tag attrs body]
+  [next-format tag attrs & body]
   (if body
-    (make-tag tag attrs (xml-map next-format body))
-    (make-closed-tag tag attrs)))
+    (create-tag tag attrs (map-xml next-format body))
+    (create-closed-tag tag attrs)))

-(defn block-xml-formatter
+(defn- indented-xml-formatter
   "Format XML with indentation and with no 'single' tags."
-  [next-format tag attrs body]
+  [next-format tag attrs & body]
   (str (if body
-         (let [content (xml-map next-format body)]
-           (make-tag tag attrs (str "\n" (indent content))))
-         (make-tag tag attrs ""))
+         (let [content (map-xml next-format body)]
+           (create-tag tag attrs (str "\n" (indent content))))
+         (create-tag tag attrs ""))
        "\n"))

-(defn expand-seqs
+(defn- expand-seqs
   "Expand out all the sequences in a collection."
   [coll]
   (mapcat #(if (seq? %) % (list %)) coll))
+
+(defn- ensure-attrs
+  "Ensure the tag has a map of attributes."
+  [[tag & body]]
+  (if (map? (first body))
+    (list* tag body)
+    (list* tag {} body)))

 (defn xml
   "Turns a tree of vectors into a string of XML. Any sequences in the
   tree are expanded out."
   ([tree]
-    (xml basic-xml-formatter tree))
+    (xml raw-xml-formatter tree))
   ([format tree]
     (if (vector? tree)
-      (let [tree (expand-seqs tree)]
-        (if-let tag (first tree)
-          (if (map? (second tree))
-            (format format tag (second tree) (rrest tree))
-            (format format tag {} (rest tree)))
-          ""))
+      (apply format format
+        (expand-seqs (ensure-attrs tree)))
       (str tree))))

 (def #^{:private true
@@ -108,13 +111,31 @@
   #{:br :dd :dt :h1 :h2 :h3 :h4 :h5 :h6 :hr :li :link
     :option :td :textarea :title})

-(defn html-formatter
+(defn- merge-id-and-class
+  "Merge a given id and class into an attributes map."
+  [attrs id class]
+  (merge attrs
+    (if id    {:id id})
+    (if class {:class class})))
+
+(defn- parse-css-tag
+  "Pulls the id and class attributes from a tag name formatted in a CSS style.
+  e.g. :div#content -> [:div  {:id \"content\"}]
+       :span.error  -> [:span {:class \"error\"}]"
+  [tag attrs]
+  (let [lexer-regex        #"(\\w+)(#(\\w+))?(\\.(\\w+))?"
+        [_ tag _ id _ cls] (re-matches lexer-regex (str* tag))
+        attrs              (merge-id-and-class attrs id cls)]
+    [tag attrs]))
+
+(defn- html-formatter
   "Format HTML in a readable fashion."
-  [next-format tag attrs body]
-  (let [format  (if (contains? html-block-tags tag)
-                  block-xml-formatter
-                  basic-xml-formatter)
-        content (format html-formatter tag attrs body)]
+  [next-format tag attrs & body]
+  (let [[tag attrs] (parse-css-tag tag attrs)
+        format      (if (contains? html-block-tags tag)
+                      indented-xml-formatter
+                      raw-xml-formatter)
+        content     (apply format html-formatter tag attrs body)]
     (if (contains? html-line-tags tag)
       (str content "\n")
       content)))
@@ -122,4 +143,4 @@
 (defn html
   "Nicely formats a tree of vectors into HTML."
   [& trees]
-  (xml-map html-formatter trees))
+  (map-xml html-formatter trees))


fix electron css reloading

fix electron css reloading

fixes #371

--- src/main/shadow/cljs/devtools/client/browser.cljs
+++ src/main/shadow/cljs/devtools/client/browser.cljs
@@ -156,23 +156,35 @@
   (when js/goog.global.document
     (goog.Uri/parse js/document.location.href)))

+(defn match-paths [old new]
+  (if (= "file" (.getScheme page-load-uri))
+    ;; new is always an absolute path, strip first /
+    ;; FIXME: assuming that old is always relative
+    (let [rel-new (subs new 1)]
+      (and (= old rel-new) rel-new))
+    ;; special handling for browsers including relative css
+    (let [^goog node-uri (goog.Uri/parse old)
+          node-uri-resolved (.resolve page-load-uri node-uri)
+          node-abs (.getPath ^goog node-uri-resolved)]
+
+      (and (or (= (.hasSameDomainAs page-load-uri node-uri))
+               (not (.hasDomain node-uri)))
+           (= node-abs new)
+           new))))
+
 (defn handle-asset-watch [{:keys [updates] :as msg}]
   (doseq [path updates
           ;; FIXME: could support images?
           :when (str/ends-with? path "css")]
     (doseq [node (array-seq (js/document.querySelectorAll "link[rel=\"stylesheet\"]"))
-            :let [^goog node-uri (goog.Uri/parse (.getAttribute node "href"))
-                  node-uri-resolved (.resolve page-load-uri node-uri)
-                  node-abs (.getPath ^goog node-uri-resolved)]
-            :when (and (or (= (.hasSameDomainAs page-load-uri node-uri))
-                           (not (.hasDomain node-uri)))
-                       (= node-abs path))]
+            :let [path-match (match-paths (.getAttribute node "href") path)]
+            :when path-match]

       (let [new-link
             (doto (.cloneNode node true)
-              (.setAttribute "href" (str path "?r=" (rand))))]
-
-        (devtools-msg "load CSS" path)
+              (.setAttribute "href" (str path-match "?r=" (rand))))]
+
+        (devtools-msg "load CSS" path-match)
         (gdom/insertSiblingAfter new-link node)
         (gdom/removeNode node)
         ))))


Trigger a rerender when we get a tx-report

--- src-cljs/frontend/core.cljs
+++ src-cljs/frontend/core.cljs
@@ -191,7 +191,6 @@
 (defn main [state top-level-node history-imp]
   (let [comms                    (:comms @state)
         cast!                    (fn [message data & [transient?]]
-                                   (print "Should cast " message)
                                    (put! (:controls comms) [message data transient?]))
         histories                (atom [])
         container                (find-app-container top-level-node)
@@ -213,7 +212,9 @@
     (d/listen! (:db @state)
                (fn [tx-report]
                  (print "TX: " tx-report)
-                 (print "Send the tx to the server, unless the tx came from the server - not sure how to differentiate")))
+                 (print "Send the tx to the server, unless the tx came from the server - not sure how to differentiate")
+                 ;; Trigger a re-render
+                 (cast! :db-updated [] true)))

     (js/document.addEventListener "keydown" handle-key-down false)
     (js/document.addEventListener "keyup" handle-key-up false)


expect workflows under `:results` key

expect workflows under `:results` key

--- src-cljs/frontend/send.cljs
+++ src-cljs/frontend/send.cljs
@@ -100,10 +100,7 @@
   (api/get-project-workflows
    (callback-api-chan
     (fn [response]
-      (let [;; While https://github.com/circleci/api-service/pull/25 rolls out...
-            api-runs (if (contains? response :results)
-                       (:results response)
-                       response)
+      (let [api-runs (:results response)
             novelty {:circleci/organization
                      {:organization/project
                       {:project/name project-name
@@ -179,7 +176,9 @@
    (callback-api-chan
     (fn [resp]
       (let [novelty {:circleci/organization
-                     {:organization/workflow-runs (mapv adapt-to-run resp)}}]
+                     {:organization/workflow-runs (->> resp
+                                                       :results
+                                                       (mapv adapt-to-run))}}]
         (send-cb novelty query))))
    (:organization/name params)
    (:organization/vcs-type params)))
@@ -250,7 +249,9 @@
                         :branch/name)]
     (api/get-branch-workflows (callback-api-chan
                                (fn [response]
-                                 (let [runs (mapv adapt-to-run response)
+                                 (let [runs (->> response
+                                                 :results
+                                                 (mapv adapt-to-run))
                                        novelty {:circleci/organization
                                                 {:organization/project
                                                  {:project/branch


Добавлен компонент, список чекбоксов

Добавлен компонент, список чекбоксов

--- radiolamp-6P3S/src/ixinfestor/omut.cljs
+++ radiolamp-6P3S/src/ixinfestor/omut.cljs
@@ -1576,10 +1576,78 @@
             dom/div #js {:className "btn-group" :role "group"})))))

-
-
 ;; END toggle batton
 ;;..................................................................................................
+
+;;;**************************************************************************************************
+;;;* BEGIN many to many input checkers
+;;;* tag: <nany to many input checkres>
+;;;*
+;;;* description: Элемент ввода данных на основании многие ко многим
+;;;*
+;;;**************************************************************************************************
+
+
+(def input-select-checkboxes-app-init
+  {:data []})
+
+
+(defn input-select-checkboxes--make-data [app key-text key-value rows]
+  (assoc app :data (->> rows
+                        (map (fn [row]
+                               (assoc row
+                                      :value (get row key-value false)
+                                      :text  (get row key-text "..."))))
+                        vec)))
+
+
+(defn input-select-checkboxes--get-selected [app]
+  (->> app :data (filter :value)))
+
+
+
+(defn input-select-checkboxes [app own
+                               {:keys [on-click-fn]
+                                :or   { }
+                                :as   opts}]
+  (reify
+    om/IRender
+    (render [_]
+      (->> app
+           :data
+           (map (fn [app-row]
+                  (letfn [(on-click [_]
+                            (om/transact! app-row :value not)
+                            (when on-click-fn (on-click-fn)))]
+                    (let [{:keys [value text]} @app-row]
+                      #_(ui-button
+                         {:type      (if value :success :default)
+                          :active?   value
+                          :disabled? disabled?
+                          :block?    true
+                          :style     #js {:textAlign "left"}
+                          :on-click  (fn [_]
+                                       (om/transact! app-row :value not)
+                                       (when onClick-fn (onClick-fn)))
+                          :text      text})
+                      (dom/div
+                       #js {:className "checkbox"}
+                       (dom/label
+                        nil
+                        (dom/input #js {:type       "checkbox"
+                                        :checked    value
+                                        :onClick    (on-click-com-fn on-click)
+                                        :onTouchEnd (on-click-com-fn on-click)
+                                        })
+                        text))))))
+           (apply dom/div #js {:className ""})))))
+
+
+;;; END many to many input checkers
+;;;..................................................................................................
+
+
+

 ;;**************************************************************************************************
@@ -1689,6 +1757,7 @@

 ;; END table
 ;;..................................................................................................
+


Fix error

Fix error

--- src/whisper2cyanite/core.clj
+++ src/whisper2cyanite/core.clj
@@ -125,9 +125,7 @@
 (defn- process-file
   "Process a file."
   [file dir mstore pstore tenant from to options processor]
-  (let [path (whisper/file-to-name file dir)
-        mstore-processed (:processed (:data-mstore-stats options))
-        pstore-processed (:processed (:data-pstore-stats options))]
+  (let [path (whisper/file-to-name file dir)]
     (when pstore
       (swap! pstore-processed inc)
       (process-path processor path))


cluster aggregated top vs. node averages

--- dash/src/clj/hface/stats.clj
+++ dash/src/clj/hface/stats.clj
@@ -72,10 +72,11 @@
     (if (> (count stats) 1)    ;; more than one node in the cluster

       ;; multiple nodes
-      (for [[k v] (apply merge-with vector
+      (for [[k v] (apply merge-with +                             ;; replace "+" with "vector" and enable average top below if needed
                          (map (comp :runtime-props :member-state)
                               (vals stats)))]
-        [(no-dots k) (non-negative-average (flatten v))])
+        ;; [(no-dots k) (non-negative-average (flatten v))])      ;; average top per node
+        [(no-dots k) v])                                          ;; overall aggregated cluster top

       ;; single node
       (for [[k v] (-> stats vals first :member-state :runtime-props)]


Fix to isolate output of multiple cljs builders

This appears to be necessary otherwise the output of one cljs builder
overwrites another.

--- modules/cljs/src/modular/cljs.clj
+++ modules/cljs/src/modular/cljs.clj
@@ -52,7 +52,7 @@
        (alter cljs-compiler-state (fn [m] (assoc-in m [builder] new-state)))
        (alter cljs-compiler-compile-count (fn [m] (update-in m [builder] (fnil inc 0))))))

-    (println (format "Compiled %d times since last full compile" (get @cljs-compiler-compile-count builder))))
+    (println (format "Compiled %d times since last full compile (%s)" (get @cljs-compiler-compile-count builder) builder)))

   :done)

@@ -124,12 +124,16 @@

 (defn new-cljs-builder [& {:as opts}]
   (->> opts
-        (merge {:id ::default
-                :context "/cljs/"
-                :source-path "src-cljs"
-                :target-dir "target/cljs"
-                :work-dir "target/cljs-work"
-                :optimizations :none
-                :pretty-print true})
-        (s/validate new-cljs-builder-schema)
-        map->ClojureScriptBuilder))
+       (merge {:id ::default
+               :context (if-let [id (:id opts)]
+                              (format "/cljs-%s/" (name id))
+                              "/cljs/")
+               :source-path "src-cljs"
+               :target-dir (if-let [id (:id opts)]
+                             (str "target/cljs/" (name id))
+                             "target/cljs")
+               :work-dir "target/cljs-work"
+               :optimizations :none
+               :pretty-print true})
+       (s/validate new-cljs-builder-schema)
+       map->ClojureScriptBuilder))


combined the two lets, and moved the user desires checking check above the start of validation code.

--- src/midje/semi_sweet.clj
+++ src/midje/semi_sweet.clj
@@ -157,10 +157,10 @@
    To strip tests from production code, set either clojure.test/*load-tests*
    or midje.semi-sweet/*check* to false."
   [& args]
-  (valid-let [[call-form arrow expected-result & other-stuff]   (validate &form)]
-    (when (user-desires-checking?)
-      (let [ [fakes overrides] (fakes-and-overrides other-stuff)]
-        (when-valid fakes
-          (expect-expansion call-form arrow expected-result fakes overrides))))))
+  (when (user-desires-checking?)
+    (valid-let [[call-form arrow expected-result & fakes+overrides] (validate &form)
+                [fakes overrides] (fakes-and-overrides fakes+overrides)]
+      (when-valid fakes
+        (expect-expansion call-form arrow expected-result fakes overrides)))))


fixes missing signature in messages.

fixes missing signature in messages.

--- src/ontrail/exercise.clj
+++ src/ontrail/exercise.clj
@@ -39,6 +39,7 @@
            new-comments (newcomment-cache id)
            bare-ex {:id id
                     :user user
+                    :synopsis (:synopsis user-profile)
                     :isNew (is-new exercise last-visit)
                     :distance distance
                     :title (:title exercise)


Breaking change! node-get-control now only accepts one arg and returns a value. Use new node-get-controls for old behaviour.

--- src/overtone/sc/node.clj
+++ src/overtone/sc/node.clj
@@ -482,18 +482,23 @@
   (apply snd "/n_set" (to-sc-id node) (floatify (stringify (idify name-values))))
   node)

-(defn node-get-control
+(defn node-get-controls
   "Get one or more synth control values by name.  Returns a map of
   key/value pairs, for example:

   {:freq 440.0 :attack 0.2}"
-  [node names]
+  [node control-names]
   (ensure-connected!)
   (ensure-node-active! node "getting node control values")
   (let [res   (recv "/n_set")
-        cvals (do (apply snd "/s_get" (to-sc-id node) (stringify names))
+        cvals (do (apply snd "/s_get" (to-sc-id node) (stringify control-names))
                   (:args (deref! res (str "attempting to get control values " name " for node " (with-out-str (pr node))))))]
     (apply hash-map (keywordify (drop 1 cvals)))))
+
+(defn node-get-control
+  "Get a single synth control value by name."
+  [node control-name]
+  (get (node-get-controls node [control-name]) (keyword (name control-name))))

 ;; This can be extended to support setting multiple ranges at once if necessary...
 (defn node-control-range*


Removed File object creation.

Removed File object creation.

--- src/pandect/gen/core.clj
+++ src/pandect/gen/core.clj
@@ -98,14 +98,16 @@
         id-raw (symbol (str id "*"))
         id-raw-file (symbol (str id "*-file"))
         sym (gensym "v")
-        fsym (vary-meta sym assoc :tag `String)]
+        fsym (vary-meta sym assoc :tag `String)
+        call-direct `(~f ~sym)
+        call-file `(with-open [in# (FileInputStream. ~fsym)] (~f in#))]
     (vector
-      `(defn ~id-raw [~sym] (~f ~sym))
-      `(defn ~id-raw-file [~fsym] (~f (File. ~fsym)))
-      `(defn ~id-bytes [~sym] ~(hash->bytes code-gen `(~f ~sym)))
-      `(defn ~id-file [~fsym] ~(hash->string code-gen `(~f (File. ~fsym))))
-      `(defn ~id-file-bytes [~fsym] ~(hash->bytes code-gen `(~f (File. ~fsym))))
-      `(defn ~id [~sym] ~(hash->string code-gen `(~f ~sym))))))
+      `(defn ~id-raw [~sym] ~call-direct)
+      `(defn ~id-raw-file [~fsym] ~call-file)
+      `(defn ~id-bytes [~sym] ~(hash->bytes code-gen call-direct))
+      `(defn ~id-file [~fsym] ~(hash->string code-gen call-file))
+      `(defn ~id-file-bytes [~fsym] ~(hash->bytes code-gen call-file))
+      `(defn ~id [~sym] ~(hash->string code-gen call-direct)))))

 (defn generate-hash
   "Generate protocol and computing functions using the give code generator and


temp meta tag to verify site url on pinterest

--- src/pc/views/content.clj
+++ src/pc/views/content.clj
@@ -102,6 +102,9 @@
     [:link {:rel "stylesheet"       :href (pc.assets/asset-path "/css/app.css")}]
     [:link {:rel "stylesheet"       :href "https://fonts.googleapis.com/css?family=Roboto:500,900,100,300,700,400"}]

+    ;; temporary meta tag, to verify account on pinterest
+    [:meta {:name "p:domain_verify" :content "3382b742326a852747a8bbb04e8462e5"}]
+
     [:style "#om-app{min-height:100vh;background-size:10px 10px,10px 10px,100px 100px,100px 100px;background-color:rgba(51,51,51,1);background-image:linear-gradient(to bottom,rgba(85,85,85,.25)10%,rgba(85,85,85,0)10%),linear-gradient(to right,rgba(85,85,85,.25)10%,rgba(85,85,85,0)10%),linear-gradient(to bottom,rgba(85,85,85,.57)1%,rgba(85,85,85,0)1%),linear-gradient(to right,rgba(85,85,85,.57)1%,rgba(85,85,85,0)1%);}#om-app:active{cursor:wait;}"]

     (embed-json-in-head "window.Precursor"


indenting

indenting

--- src/proxmox/provider.clj
+++ src/proxmox/provider.clj
@@ -216,7 +216,8 @@
       (mappings {:ip :ip_address :os #{:ostemplate :flavor} :domain :searchdomain})
       (transform (machine-ts machine))
       (transform (proxmox-ts machine))
-      generate (selections [ct-ks ex-ks net-ks])))
+       generate
+      (selections [ct-ks ex-ks net-ks])))

 (defn validate [node [ct extended network :as args]]
   (validate-provider ct extended network)