Expose jobs via mbeans [IMMUTANT-34]

Expose jobs via mbeans [IMMUTANT-34]

--- modules/jobs/src/main/clojure/immutant/jobs/internal.clj
+++ modules/jobs/src/main/clojure/immutant/jobs/internal.clj
@@ -60,35 +60,6 @@
   (let [s (scheduler singleton)]
     (wait-for-scheduler s #(.getScheduler s))))

-(try-defn (import org.projectodd.polyglot.jobs.BaseScheduledJob)
-  ^{:internal true} create-job
-  "Instantiates and starts a job"
-  [f name spec singleton]
-  (let [scheduler (scheduler singleton)]
-    (doto
-        (proxy [BaseScheduledJob ScheduledJobMBean]
-            [ClojureJob (app-name) name "" spec singleton]
-          (start []
-            (wait-for-scheduler
-             scheduler
-             #(.addJob scheduler
-                       name (app-name)
-                       (ClojureJob. (registry/fetch "clojure-runtime") f)))
-            (let [^BaseScheduledJob this this] ;; hack to eliminate reflection
-              (proxy-super start)))
-          (getScheduler []
-            (.getScheduler scheduler)))
-      .start)))
-
-(defn ^{:internal true} stop-job
-  "Stops (unschedules) a job, removing it from the scheduler."
-  [job]
-  (if-not (.isShutdown (.getScheduler job))
-    (.stop job)))
-
-;; we don't currently register an mbean for each job, since we can't
-;; yet easily unregister the mbean
-;; ignore reflection here for now, since we don't even use it yet
 (try-defn (import org.immutant.jobs.as.JobsServices) register-job-mbean [name job]
   (.installMBean
    (job-schedulizer)
@@ -98,3 +69,34 @@
               (aset 1 name)))
    "immutant.jobs"
    job))
+
+(try-defn (import org.projectodd.polyglot.jobs.BaseScheduledJob)
+  ^{:internal true} create-job
+  "Instantiates and starts a job"
+  [f name spec singleton]
+  (let [scheduler (scheduler singleton)
+        job
+        (doto
+            (proxy [BaseScheduledJob ScheduledJobMBean]
+                [ClojureJob (app-name) name "" spec singleton]
+              (start []
+                (wait-for-scheduler
+                 scheduler
+                 #(.addJob scheduler
+                           name (app-name)
+                           (ClojureJob. (registry/fetch "clojure-runtime") f)))
+                (let [^BaseScheduledJob this this] ;; hack to eliminate reflection
+                  (proxy-super start)))
+              (getScheduler []
+                (.getScheduler scheduler)))
+          .start)]
+    (register-job-mbean name job)
+    job))
+
+(defn ^{:internal true} stop-job
+  "Stops (unschedules) a job, removing it from the scheduler."
+  [job]
+  (if-not (.isShutdown (.getScheduler job))
+    (.stop job)))
+
+


CMR-3285 removes proto repl saved values

--- access-control-app/src/cmr/access_control/services/acl_search_service.clj
+++ access-control-app/src/cmr/access_control/services/acl_search_service.clj
@@ -238,7 +238,6 @@
                                     (partial cpv/validate-map [:options :provider])
                                     (partial cpv/validate-map [:options :permitted-user])
                                     (partial cpv/validate-map [:group_permission])])]
-   (proto-repl.saved-values/save 2)
    (cpv/validate-parameters
      :acl safe-params
      (concat cpv/common-validations


Update hello-world do 0.18.0.

Update hello-world do 0.18.0.

--- examples/hello-world/project.clj
+++ examples/hello-world/project.clj
@@ -1,4 +1,4 @@
-(defproject hello-world "0.18.0-SNAPSHOT"
+(defproject hello-world "0.18.0"
   :license {:name "Eclipse Public License"
             :url "http://www.eclipse.org/legal/epl-v10.html"}
   :dependencies [[org.clojure/clojure "1.8.0"]


Don't let the exception escape the fixture so we see results client-side

--- integration-tests/apps/tx/src/tx/core.clj
+++ integration-tests/apps/tx/src/tx/core.clj
@@ -51,9 +51,11 @@
 ;;; Ensure each test starts with an empty table called THINGS
 (use-fixtures :each (fn [f]
                       (ic/delete-all cache)
-                      (doseq [spec specs] (sql/with-connection spec
-                                            (try (sql/drop-table :things) (catch Exception _))
-                                            (sql/create-table :things [:name "varchar(50)"])))
+                      (doseq [spec specs]
+                        (try (sql/with-connection spec
+                               (try (sql/drop-table :things) (catch Exception _))
+                               (sql/create-table :things [:name "varchar(50)"]))
+                             (catch Exception _)))
                       (f)))

 (deftest db+msg+cache-should-commit "Test happy-path XA transaction involving three resources"


Copy jars into cache when --as-jars option (fixes #290)

--- boot/core/src/boot/task/built_in.clj
+++ boot/core/src/boot/task/built_in.clj
@@ -477,6 +477,7 @@
    m merge         REGEX=FN [[regex code]] "The list of duplicate file mergers."]

   (let [tgt        (core/tmp-dir!)
+        cache      (core/cache-dir! ::uber :global true)
         dfl-scopes #{"compile" "runtime" "provided"}
         scopes     (-> dfl-scopes
                        (set/union include-scope)
@@ -496,8 +497,15 @@
         (util/info "Adding uberjar entries...\n"))
       (when as-jars
         (doseq [jar jars]
-          (let [name (str (digest/md5 jar) "-" (.getName jar))]
-            (file/copy-with-lastmod jar (io/file tgt name)))))
+          (let [hash (digest/md5 jar)
+                name (str hash "-" (.getName jar))
+                src  (io/file cache hash)]
+            (when-not (.exists src)
+              (util/dbug "Caching jar %s...\n" name)
+              (binding [file/*hard-link* false]
+                (file/copy-with-lastmod jar src)))
+            (util/dbug "Adding cached jar %s...\n" name)
+            (file/hard-link src (io/file tgt name)))))
       (core/commit! (if as-jars
                       (core/add-resource fs tgt)
                       (reduce reducer fs jars))))))


Reformatting ClojureScript tests for consistency

Now that Cursive properly supports cljs.test I can finally apply a
formatting to the file consistent with the clj ones.

--- test/cljs/tropology/test/core.cljs
+++ test/cljs/tropology/test/core.cljs
@@ -8,94 +8,90 @@
 ;

 (deftest test-process-span
-   (is (= [:span "Some text"]
-          (core/process-span [:span "Some text"])))
-   (is (nil? (core/process-span [:span {:class "notelabel"} "Some span"]))) ; notelabel spans are discarded
-   (is (= [:span {:class "highlight" :rel "arel"} "Some span here"]
-          (core/process-span [:span
-                              {:class "highlight" :id "id" :onclick "somefunction()" :rel "arel"}
-                              "Some span here"]))))
+  (is (= [:span "Some text"]
+         (core/process-span [:span "Some text"])))
+  (is (nil? (core/process-span [:span {:class "notelabel"} "Some span"]))) ; notelabel spans are discarded
+  (is (= [:span {:class "highlight" :rel "arel"} "Some span here"]
+         (core/process-span [:span
+                             {:class "highlight" :id "id" :onclick "somefunction()" :rel "arel"}
+                             "Some span here"]))))

 (deftest test-process-style
-   (is (= [:p {:style {"display" "none"}} "A paragraph"]
-          (core/process-style [:p {:style "display:none"} "A paragraph"])
-          ))
-   (is (= [:p {:style {"display" "none"}} "A paragraph"]
-          (core/process-style [:p {:style "display:none" :onclick "somefunction()"} "A paragraph"])
-          ))
-   (is (= [:p {:style {"display" "none" "height" " 21px"}} "A paragraph"]
-          (core/process-style [:p {:style "display:none;height: 21px"} "A paragraph"])
-          ))
-   )
+  (is (= [:p {:style {"display" "none"}} "A paragraph"]
+         (core/process-style [:p {:style "display:none"} "A paragraph"])
+         ))
+  (is (= [:p {:style {"display" "none"}} "A paragraph"]
+         (core/process-style [:p {:style "display:none" :onclick "somefunction()"} "A paragraph"])
+         ))
+  (is (= [:p {:style {"display" "none" "height" " 21px"}} "A paragraph"]
+         (core/process-style [:p {:style "display:none;height: 21px"} "A paragraph"])
+         ))
+  )

 (deftest test-process-a
-   (is (= [:a {:href "anime/samuraiflamenco"} "The text"] ; Only twikilinks are changed
-          (core/process-a [:a {:href "anime/samuraiflamenco"} "The text"] nil)))
-   (is (= [:a "The text"]
-          (core/process-a [:a "The text"] nil)))
-   (let [altered (core/process-a [:a {:class "twikilink" :href "anime/samuraiflamenco"} "The text"] nil)
-         tag     (first altered)
-         attrs   (second altered)
-         text    (nth altered 2)]
-     (is (= :a tag))
-     (is (= "The text" text))
-     (is (map? attrs))
-     (is (= "twikilink" (:class attrs)))              ; The class isn't touched
-     (is (nil? (:href attrs)))                        ; The href was removed
-     (is (some? (:on-click attrs)))                   ; We have a new on-click function
-     )
-   )
+  (is (= [:a {:href "anime/samuraiflamenco"} "The text"]    ; Only twikilinks are changed
+         (core/process-a [:a {:href "anime/samuraiflamenco"} "The text"] nil)))
+  (is (= [:a "The text"]
+         (core/process-a [:a "The text"] nil)))
+  (let [altered (core/process-a [:a {:class "twikilink" :href "anime/samuraiflamenco"} "The text"] nil)
+        tag (first altered)
+        attrs (second altered)
+        text (nth altered 2)]
+    (is (= :a tag))
+    (is (= "The text" text))
+    (is (map? attrs))
+    (is (= "twikilink" (:class attrs)))                     ; The class isn't touched
+    (is (nil? (:href attrs)))                               ; The href was removed
+    (is (some? (:on-click attrs)))                          ; We have a new on-click function
+    )
+  )

 (deftest test-process-trope
-   (let [trope  [:span
-                 [:div
-                  [:p "This is an innocent paragraph"]
-                  [:p "This is just as innocent, but "
-                   [:a {:class "twikilink" :href "main/anime"} "it contained a link!"]
-                   " and some more text"
-                   ]
-                  [:span "The end."]
-                  ]
-                 [:div
-                  [:span "Then a span of text"
-                   [:span {:class "notelabel"} "with a note"]
-                   ", but not really."
-                   ]
-                  [:span {:style "white-space: nowrap;text-decoration: none"}
-                   "A styled span."
-                   [:p {:style "font-size:16px;font-weight:normal"} "With a styled p inside."]
-                   [:a {:href "#"} "And a link that's ignored"]
-                   ]]
-                 ]
-         result (core/process-trope trope [true])]
-     (is (= 3 (count result)))
-     (is (= :span (first result)))
-     (is (= [:div
-             [:span "Then a span of text" nil ", but not really."]
-             [:span {:style {"white-space" " nowrap" "text-decoration" " none"}}
-              "A styled span."
-              [:p {:style {"font-size" "16px" "font-weight" "normal"}} "With a styled p inside."]
-              [:a {:href "#"} "And a link that's ignored"]
-              ]]
-            (nth result 2)))
-     (let [link-div (second result)
-           a-elem   (get-in link-div [2 2])
-           attrs    (second a-elem)]
-       (is (= 4 (count link-div)))
-       (is (= :div (first link-div)))
-       (is (= [:p "This is an innocent paragraph"]
-              (nth link-div 1)))
-       (is (= :p (get-in link-div [2 0])))
-       (is (= "This is just as innocent, but " (get-in link-div [2 1])))
-       (is (= 3 (count a-elem)))
-       (is (= :a (first a-elem)))
-       (is (map? attrs))
-       (is (nil? (:href attrs)))
-       (is (some? (:on-click attrs)))
-       (is (= " and some more text" (get-in link-div [2 3])))
-       (is (= [:span "The end."] (get-in link-div [3])))
-       )
-     )
-   )
+  (let [trope [:span
+               [:div
+                [:p "This is an innocent paragraph"]
+                [:p "This is just as innocent, but "
+                 [:a {:class "twikilink" :href "main/anime"} "it contained a link!"] " and some more text"]
+                [:span "The end."]]
+               [:div
+                [:span "Then a span of text"
+                 [:span {:class "notelabel"} "with a note"]
+                 ", but not really."]
+                [:span {:style "white-space: nowrap;text-decoration: none"}
+                 "A styled span."
+                 [:p {:style "font-size:16px;font-weight:normal"} "With a styled p inside."]
+                 [:a {:href "#"} "And a link that's ignored"]
+                 ]]
+               ]
+        result (core/process-trope trope [true])]
+    (is (= 3 (count result)))
+    (is (= :span (first result)))
+    (is (= [:div
+            [:span "Then a span of text" nil ", but not really."]
+            [:span {:style {"white-space" " nowrap" "text-decoration" " none"}}
+             "A styled span."
+             [:p {:style {"font-size" "16px" "font-weight" "normal"}} "With a styled p inside."]
+             [:a {:href "#"} "And a link that's ignored"]
+             ]]
+           (nth result 2)))
+    (let [link-div (second result)
+          a-elem (get-in link-div [2 2])
+          attrs (second a-elem)]
+      (is (= 4 (count link-div)))
+      (is (= :div (first link-div)))
+      (is (= [:p "This is an innocent paragraph"]
+             (nth link-div 1)))
+      (is (= :p (get-in link-div [2 0])))
+      (is (= "This is just as innocent, but " (get-in link-div [2 1])))
+      (is (= 3 (count a-elem)))
+      (is (= :a (first a-elem)))
+      (is (map? attrs))
+      (is (nil? (:href attrs)))
+      (is (some? (:on-click attrs)))
+      (is (= " and some more text" (get-in link-div [2 3])))
+      (is (= [:span "The end."] (get-in link-div [3])))
+      )
+    )
+  )


add config

add config

--- kafka-clj/src/kafka_clj/redis/cluster.clj
+++ kafka-clj/src/kafka_clj/redis/cluster.clj
@@ -99,7 +99,7 @@
   (cond
     (nil? v) (into-array String [])
     (string? v) (into-array String [v])
-    (into-array String v)))
+    :else (into-array String v)))

 (defn ^Config create-sentinal-config [redis-conf]
   {:pre [(vector (:sentinel-addresses redis-conf)) (:master-name redis-conf)]}


changed readme

changed readme

--- test/midje_doc/midje_doc_guide.clj
+++ test/midje_doc/midje_doc_guide.clj
@@ -67,6 +67,9 @@

 [[{:tag "qs-first-doc" :title "test/docs/my_first_document.clj"}]]
 (comment
+(ns docs.my-first-document
+  (:require [midje.sweet :refer :all]))
+
 [[:chapter {:tag "hello" :title "Hello Midje Doc"}]]

 "This is an introduction to writing with midje-doc."


Refactored timer view into individual components that update on different cadences.

--- ui/src/ui/core.cljs
+++ ui/src/ui/core.cljs
@@ -1,12 +1,12 @@
 (ns ui.core
   (:require-macros [cljs.core.async.macros :refer [go-loop]])
-  (:require [om.core :refer [IRender IRenderState IInitState IWillMount root transact!]]
-            [om.dom :refer [circle li line polygon svg text ul]]
-            [cljs-time.coerce :refer [to-date to-long to-string]]
-            [cljs-time.core :refer [now interval in-millis]]
-            [cljs.core.async :refer [timeout]]
-            [clojure.string :refer [join]]
-            [goog.math :refer [angleDx angleDy]]))
+  (:require [om.core :as om :refer [IDisplayName IRender IRenderState IInitState IWillMount]]
+            [om.dom :as dom]
+            [cljs-time.coerce :as time-coerce]
+            [cljs-time.core :as time]
+            [cljs.core.async :as async]
+            [clojure.string :as string]
+            [goog.math :as math]))

 (enable-console-print!)

@@ -16,98 +16,127 @@

 (defonce app-state (atom {:timer {:Owner "josephburnett79"
                                   :State "anon-running"
-                                  :Start (to-string (now))
+                                  :Start (time-coerce/to-string (time/now))
                                   :Stop "0001-01-01T00:00:00Z"
                                   :TimerID ""}
                           :timer-ids [{:name "Clean the kitchen"
                                        :id "clean-the-kitchen"}
                                       {:name "Take a bath"
-                                       :id "take-a-bath"}]
-                          :elapsed-seconds 0
-                          :elapsed-minutes 0
-                          :elapsed-hours 0}))
+                                       :id "take-a-bath"}]}))

 (defn pie [x y r fill tenth-degrees]
-  (let [points (map #(str (+ x (angleDx (/ % 10) r)) "," (+ y (angleDy (/ % 10) r)))
+  (let [points (map #(str (+ x (math/angleDx (/ % 10) r)) "," (+ y (math/angleDy (/ % 10) r)))
                     (range 0 tenth-degrees))
-        points-string (join " " (cons (str x "," y) points))]
-    (polygon #js {:points points-string
-                  :transform (str "rotate(-90," x "," y ")")
-                  :fill fill})))
+        points-string (string/join " " (cons (str x "," y) points))]
+    (dom/polygon #js {:points points-string
+                      :transform (str "rotate(-90," x "," y ")")
+                      :fill fill})))

-(defn timer-view [data owner]
+(defn circle [x y r fill]
+  (dom/circle #js {:r r
+                   :cx x
+                   :cy y
+                   :fill fill}))
+
+(defn timer-minutes [data owner]
+  (reify
+    IDisplayName
+    (display-name [_]
+      "Minutes on the timer")
+    IWillMount
+    (will-mount [_]
+      (go-loop []
+        (let [start (om/get-state owner :start)
+              interval-seconds (/ (time/in-millis (time/interval start (time/now))) 1000)]
+          (om/update-state! owner :elapsed-minutes #(mod (/ interval-seconds 60) 60)))
+        (<! (async/timeout 1000))
+        (recur)))
+    IInitState
+    (init-state [_]
+      {:elapsed-minutes 0})
+    IRenderState
+    (render-state [_ {x :x y :y r :r min :elapsed-minutes init :initialized}]
+      (pie x y r "#d9d9d9" (* 6 10 min)))))
+
+(defn timer-hours [data owner]
   (reify
     IWillMount
     (will-mount [_]
       (go-loop []
-        (let [interval-seconds (/ (in-millis (interval (to-date (get-in data [:timer :Start])) (now))) 1000)]
-          (transact! data :elapsed-seconds #(mod interval-seconds 60))
-          (transact! data :elapsed-minutes #(mod (/ interval-seconds 60) 60))
-          (transact! data :elapsed-hours #(mod (/ interval-seconds 60 60) 24))
-          (<! (timeout 1000))
-          (recur))))
+        (let [start (om/get-state owner :start)
+              interval-seconds (/ (time/in-millis (time/interval start (time/now))) 1000)]
+          (om/update-state! owner :elapsed-hours #(mod (/ interval-seconds 60 60) 24)))
+        (<! (async/timeout 10000))
+        (recur)))
+    IInitState
+    (init-state [_]
+      {:elapsed-hours 0})
     IRenderState
-    (render-state [_ _]
-      (let [r 200
-            x 250
-            y 250
-                                        ;interval-seconds (in-seconds (interval (to-date (:Start data)) (now)))
-            elapsed-minutes (:elapsed-minutes data) ;(mod (int (/ interval-seconds 60)) 60)
-            elapsed-hours (:elapsed-hours data) ; (int (/ interval-seconds 60 60))
-            elapsed-seconds (:elapsed-seconds data)] ; (mod interval-seconds 60)]
-        (svg #js {:width "500"
-                  :height "550"}
-             (circle #js {:r (+ 20 r)
-                          :cx x
-                          :cy y
-                          :fill "green"})
-             (circle #js {:r r
-                          :cx x
-                          :cy y
-                          :fill "white"})
-             (pie x y r "#d9d9d9" (* 6 10 elapsed-minutes))
-             (pie x y (/ r 1.4) "#cccccc" (* 30 10 elapsed-hours))
-             (line #js {:x1 (+ x (angleDx (* 6 elapsed-seconds) (/ r 1.4)))
-                        :y1 (+ y (angleDy (* 6 elapsed-seconds) (/ r 1.4)))
-                        :x2 (+ x (angleDx (* 6 elapsed-seconds) r))
-                        :y2 (+ y (angleDy (* 6 elapsed-seconds) r))
-                        :style #js {:stroke "#bfbfbf"
-                                    :strokeWidth "4px"}
-                        :transform (str "rotate(-90," x "," y")")})
-             (text #js {:x "190"
-                        :y "280"
-                        :fill "blue"
-                        :style #js {:fontSize "90px"}}
-                   (if (= 0 (int elapsed-hours))
-                     (str (int elapsed-minutes) "m")
-                     (str (int elapsed-hours) "h " (int elapsed-minutes) "m")))
-             (text #js {:x "350"
-                        :y "310"
-                        :fill "blue"}
-                   (int elapsed-seconds))
-             (text #js {:x "190"
-                        :y "550"
-                        :fill "red"
-                        :style #js {:fontSize "60px"}}
-                   "STOP"))))))
+    (render-state [_ {x :x y :y r :r hr :elapsed-hours}]
+      (pie x y (/ r 1.4) "#cccccc" (* 30 10 hr)))))
+
+(defn timer-seconds [data owner]
+  (reify
+    IWillMount
+    (will-mount [_]
+      (go-loop []
+        (let [start (om/get-state owner :start)
+              interval-seconds (/ (time/in-millis (time/interval start (time/now))) 1000)]
+          (om/update-state! owner :elapsed-seconds #(mod interval-seconds 60)))
+        (<! (async/timeout 50))
+        (recur)))
+    IInitState
+    (init-state [_]
+      {:elapsed-seconds 0})
+    IRenderState
+    (render-state [_ {x :x y :y r :r sec :elapsed-seconds}]
+      (dom/line #js {:x1 (+ x (math/angleDx (* 6 sec) (/ r 1.4)))
+                     :y1 (+ y (math/angleDy (* 6 sec) (/ r 1.4)))
+                     :x2 (+ x (math/angleDx (* 6 sec) r))
+                     :y2 (+ y (math/angleDy (* 6 sec) r))
+                     :style #js {:stroke "#bfbfbf"
+                                 :strokeWidth "4px"}
+                     :transform (str "rotate(-90," x "," y")")}))))
+
+(defn timer-view [data owner]
+  (reify
+    IDisplayName
+    (display-name [_]
+      "The timer")
+    IInitState
+    (init-state [_]
+      {:width 500
+       :height 500
+       :radius 200
+       :x 250
+       :y 250})
+    IRenderState
+    (render-state [_ {w :width h :height x :x y :y r :radius}]
+      (let [start-date (time-coerce/to-date (get-in data [:timer :Start]))
+            timer-dim {:x x :y y :r r :start start-date}]
+        (dom/svg #js {:width w
+                      :height h}
+                 (circle x y (+ r 20) "green")
+                 (circle x y r "white")
+                 (om/build timer-minutes nil {:init-state timer-dim})
+                 (om/build timer-hours nil {:init-state timer-dim})
+                 (om/build timer-seconds nil {:init-state timer-dim}))))))

 (defn menu-view [data owner]
   (reify
     IRender
     (render [_]
-      (ul nil
-          (map #(li nil (:name %)) (:timer-ids data))))))
+      (dom/ul nil
+          (map #(dom/li nil (:name %)) (:timer-ids data))))))

-
-(root timer-view app-state
-      {:target (. js/document (getElementById "timer"))})
+(om/root timer-view app-state
+         {:target (. js/document (getElementById "timer"))})

-(root menu-view app-state
-      {:target (. js/document (getElementById "menu"))})
+(om/root menu-view app-state
+         {:target (. js/document (getElementById "menu"))})

 (defn on-js-reload []
   ;; optionally touch your app-state to force rerendering depending on
   ;; your application
   ;; (swap! app-state update-in [:__figwheel_counter] inc)
 )
-


Update XorShift.clj

Update XorShift.clj

--- Clojure/XorShift.clj
+++ Clojure/XorShift.clj
@@ -51,8 +51,8 @@
 (defrecord XorShift[w x y z seeds randCount])
 (extend XorShift IXorShift MXorShift)
 (defn make-XorShift
-	([](make-XorShift Environment/TickCount))
-	([{:keys [w x y z] :or {w Environment/TickCount,x nil,y nil,z nil}}]
+	([](make-XorShift (System/currentTimeMillis)))
+	([{:keys [w x y z] :or {w (System/currentTimeMillis),x nil,y nil,z nil}}]
 		(let [x (if(= nil x) (bit-shift-left w 13) x)]
 		(let [y (if(= nil y) (bit-xor (bit-shift-right w 9) (bit-shift-left x 6)) y)]
 		(let [z (if(= nil z) (bit-shift-right y 7) z)]


require, not use

require, not use

git-svn-id: 03a8048b5ee8463be5048a3801110fb50f378627@9740 d0ab736e-dc22-4aeb-8dc9-08def0aa14fd

--- plugins/SlideExplorer2/src/slide_explorer/tile_cache.clj
+++ plugins/SlideExplorer2/src/slide_explorer/tile_cache.clj
@@ -1,8 +1,8 @@
 (ns slide-explorer.tile-cache
-  (:use [slide-explorer.cache :as cache]
-        [slide-explorer.disk :as disk]
-        [slide-explorer.persist :as persist]
-        [slide-explorer.reactive :as reactive]))
+  (:require [slide-explorer.cache :as cache]
+            [slide-explorer.disk :as disk]
+            [slide-explorer.persist :as persist]
+            [slide-explorer.reactive :as reactive]))

 (def file-executor (reactive/single-threaded-executor))


Major simplification of the pipeline2 interface

Just return the result of data.xml/parse-str and let the clients figure
out what part of that xml is of interest to them instead of mapping it
into yet another map of maps.

--- src/mdr2/pipeline2.clj
+++ src/mdr2/pipeline2.clj
@@ -58,63 +58,31 @@
           :body
           xml/parse-str))))

-(defn- attrs-to-map [element attributes]
-  (into {}
-   (for [kw attributes] [kw (attr element kw)])))
-
-(defn- elements-to-map [parent elements]
-  (into {}
-   (for [kw elements] [kw (xml1-> parent kw text)])))
-
 (defn wait [job])

 (defn jobs []
   (let [url (str ws-url "/jobs")
         response (client/get url (auth-query-params url))]
     (when (client/success? response)
-      (let [root (-> (:body response)
-                     xml/parse-str
-                     zip/xml-zip)]
-        (for [job (xml-> root :job)]
-          (merge
-           (attrs-to-map job [:id :href :status])
-           (elements-to-map job [:nicename])
-           {:log (xml1-> job :log (attr :href))
-            :results
-            (for [result (xml-> job :results :result)]
-              (attrs-to-map result [:href :from :mime-type :name :nicename]))}))))))
+      (-> response
+          :body
+          xml/parse-str))))

 (defn scripts []
   (let [url (str ws-url "/scripts")
         response (client/get url (auth-query-params url))]
     (when (client/success? response)
-      (let [root (-> (:body response)
-                     xml/parse-str
-                     zip/xml-zip)]
-        (for [script (xml-> root :script)]
-          {:id (attr script :id)
-           :href (attr script :href)
-           :nicename (xml1-> script :nicename text)
-           :description (xml1-> script :description text)})))))
+      (-> response
+          :body
+          xml/parse-str))))

 (defn script [id]
   (let [url (str ws-url "/scripts/" id)
         response (client/get url (auth-query-params url))]
     (when (client/success? response)
-      (let [script (-> (:body response)
-                       xml/parse-str
-                       zip/xml-zip)]
-        (merge
-         (attrs-to-map script [:id :href])
-         (elements-to-map script [:nicename :description :homepage])
-         {:input
-          (for [input (xml-> script :input)]
-            (attrs-to-map script [:desc :mediaType :name :sequence]))
-          :options
-          (for [option (xml-> script :option)]
-            (attrs-to-map
-             option
-             [:desc :mediaType :name :nicename :required :type :ordered :sequence]))})))))
+      (-> response
+          :body
+          xml/parse-str))))

 (defn alive? []
   (let [url (str ws-url "/alive")]


only return valid identity keys

only return valid identity keys

--- plugins/matross/connections/ssh.clj
+++ plugins/matross/connections/ssh.clj
@@ -11,9 +11,15 @@
 (defn get-identity [conn]
   ;; supported keys
   ;; https://github.com/hugoduncan/clj-ssh/blob/0.5.9/src/clj_ssh/ssh.clj#L236
-  (let [defaults {:private-key-path "~/.ssh/id_rsa"
-                  :public-key-path "~/.ssh/id_rsa.pub"}]
-    (merge defaults conn)))
+  (let [defaults {:private-key-path "~/.ssh/id_rsa"}]
+    (-> conn
+        (select-keys [:private-key
+                      :public-key
+                      :private-key-path
+                      :public-key-path
+                      :passphrase
+                      :identity])
+        ((partial merge defaults)))))

 (defn create-session [conn]
   "Use the connection definition to create a jsch session"


translate actual meaning of Pxrand

translate actual meaning of Pxrand

--- docs/sc-book/sc-three.clj
+++ docs/sc-book/sc-three.clj
@@ -192,8 +192,11 @@
 t.stop; x.release(2);
 )

+(defn no-twice-in-a-row [s]
+  (filter identity (map (fn [a b] (and (not= a b) a)) s (rest s))))
+
 (do
-  (def p (cycle [64 66 68 70 71 73 74 76]))
+  (def p (no-twice-in-a-row (chosen-from [64 66 68 70 71 73 74 76])))
   (def q (cycle [1000 2000 500]))

   (def cont (atom true))


Cleaning up defconfig macro.

Cleaning up defconfig macro.

--- common-lib/src/cmr/common/config.clj
+++ common-lib/src/cmr/common/config.clj
@@ -164,7 +164,6 @@
     (when (and (nil? parser) config-type (nil? (type->parser config-type)))
       (throw (Exception. (str "Unrecognized defconfig type: " config-type))))

-
     (let [config-name (name config-name-symbol)
           config-name-key (keyword config-name)
           getter-name config-name-symbol
@@ -175,21 +174,21 @@
           parser-fn (or parser (type->parser config-type))]

       `(let [default-value# ~default
-             parser-value# ~parser
-             config-type-value# ~config-type]
+             doc-string-value# ~doc-string]
+
          ;; Check that the type of the default value matches the type specified
-         ;; This has to be done here so that we can check the value of type.
-         (when (and (nil? parser-value#)
-                    (not= (type default-value#) config-type-value#))
+         ;; This has to be done here to allow for the default value to be the result of calling a function
+         (when (and (nil? ~parser)
+                    (not= (type default-value#) ~config-type))
            (throw
              (Exception.
                (format "The type of the default value %s does not match the specified config type %s"
-                       (type default-value#) config-type-value#))))
+                       (type default-value#) ~config-type))))

          ;; Register the config
-         (register-config ~(str *ns*) ~config-name-key ~doc-string
+         (register-config ~(str *ns*) ~config-name-key doc-string-value#
                           ;; Assoc in type to show default of string in docs.
-                          (assoc ~options :type config-type-value#))
+                          ~(assoc options :type config-type))

          ;; Create the getter
          (defn ~getter-name


Chase cider versions

Chase cider versions

--- dot/lein/profiles.clj
+++ dot/lein/profiles.clj
@@ -2,8 +2,8 @@
  {:plugins [[lein-vanity "0.2.0" :exclusions [org.clojure/clojure]]
             [lein-ancient "0.6.5"]
             [jonase/eastwood "0.2.0"]
-            [cider/cider-nrepl "0.10.0-SNAPSHOT"]
-            [refactor-nrepl "1.2.0-SNAPSHOT"]]
+            [cider/cider-nrepl "0.11.0-SNAPSHOT"]
+            [refactor-nrepl "2.0.0-SNAPSHOT"]]
   :dependencies [[slamhound "1.5.5"]
-                 [org.clojure/tools.nrepl "0.2.10"]]
+                 [org.clojure/tools.nrepl "0.2.12"]]
   :aliases {"slamhound" ["run" "-m" "slam.hound"]}}}


eastwood 0.3.4

eastwood 0.3.4

--- dot/lein/profiles.clj
+++ dot/lein/profiles.clj
@@ -4,7 +4,7 @@
             [lein-hiera "1.0.0"]
             [lein-kibit "0.1.6"]
             [lein-pprint "1.2.0"]
-            [jonase/eastwood "0.3.3"]
+            [jonase/eastwood "0.3.4"]
             [com.billpiel/sayid "0.0.17"]
             [lein-cljfmt "0.6.2"]]
   :dependencies [[slamhound "1.5.5"]]


Play death sound

Play death sound

--- minicraft/desktop/src-common/minicraft/entities.clj
+++ minicraft/desktop/src-common/minicraft/entities.clj
@@ -122,9 +122,10 @@
        update-texture-size))

 (defn ^:private is-not-victim?
-  [{:keys [x y npc?] :as attacker} {:keys [player?] :as victim}]
-  (or (not (u/is-near-entity? attacker victim u/attack-distance))
+  [{:keys [x y health npc?] :as attacker} {:keys [player?] :as victim}]
+  (or (= health 0)
       (not= npc? player?)
+      (not (u/is-near-entity? attacker victim u/attack-distance))
       (case (:direction attacker)
         :down (< (- y (:y victim)) 0) ; victim is up?
         :up (> (- y (:y victim)) 0) ; victim is down?
@@ -150,9 +151,12 @@
                       :id-2 (:id victim))
                e)
              (= e victim)
-             (assoc e
-                    :play-sound (:hurt-sound victim)
-                    :health (max 0 (- (:health e) (:damage attacker))))
+             (let [health (max 0 (- (:health e) (:damage attacker)))]
+               (assoc e
+                      :play-sound (if (and (= health 0) (:death-sound victim))
+                                    (:death-sound victim)
+                                    (:hurt-sound victim))
+                      :health health))
              :else
              e))
          entities)))
@@ -208,9 +212,10 @@
        (merge entity {:id (count entities)})))

 (defn prevent-move
-  [entities {:keys [x y x-change y-change] :as entity}]
-  (if (and (or (not= 0 x-change) (not= 0 y-change))
-           (u/is-near-entities? entities entity 1))
+  [entities {:keys [x y x-change y-change health] :as entity}]
+  (if (or (= health 0)
+          (and (or (not= 0 x-change) (not= 0 y-change))
+               (u/is-near-entities? entities entity 1)))
     (assoc entity
            :x-velocity 0
            :y-velocity 0


removed unused require namespaces

removed unused require namespaces

--- src/test/clojure/com/xebia/visualreview/project_test.clj
+++ src/test/clojure/com/xebia/visualreview/project_test.clj
@@ -15,12 +15,7 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 (ns com.xebia.visualreview.project-test
-  (:require [com.xebia.visualreview.image :as image]
-            [com.xebia.visualreview.image.persistence :as ip]
-            [com.xebia.visualreview.io :as vrio]
-            [com.xebia.visualreview.service-util-test :as sutilt]
-            [midje.sweet :refer :all]
-            [clojure.java.io :as io]
+  (:require [midje.sweet :refer :all]
             [com.xebia.visualreview.project :as project]
             [com.xebia.visualreview.persistence.util :as putil]))


fix spacing on hello world code)

fix spacing on hello world code)

--- generator/src/generator/core.clj
+++ generator/src/generator/core.clj
@@ -1,30 +1,30 @@
-  (ns generator.core
-      (:gen-class)
-      (:require [langohr.core      :as rmq]
-                            [langohr.channel   :as lch]
-                            [langohr.queue     :as lq]
-                            [langohr.consumers :as lc]
-                            [langohr.basic     :as lb]))
+(ns generator.core
+  (:gen-class)
+  (:require [langohr.core :as rmq]
+            [langohr.channel :as lch]
+            [langohr.queue :as lq]
+            [langohr.consumers :as lc]
+            [langohr.basic :as lb]))

-  (def ^{:const true}
-      default-exchange-name "logs")
+(def ^{:const true}
+  default-exchange-name "logs")

-  (defn message-handler
-      [ch {:keys [content-type delivery-tag type] :as meta} ^bytes payload]
-      (println (format "[consumer] Received a message: %s, delivery tag: %d, content type: %s, type: %s"
-                                          (String. payload "UTF-8") delivery-tag content-type type)))
+(defn message-handler
+  [ch {:keys [content-type delivery-tag type] :as meta} ^bytes payload]
+  (println (format "[consumer] Received a message: %s, delivery tag: %d, content type: %s, type: %s"
+                   (String. payload "UTF-8") delivery-tag content-type type)))

-  (defn -main
-      [& args]
-      (let [conn  (rmq/connect)
-                    ch    (lch/open conn)
-                    qname "langohr.examples.hello-world"]
-            (println (format "[main] Connected. Channel id: %d" (.getChannelNumber ch)))
-            (lq/declare ch qname {:exclusive false :auto-delete true})
-            (lc/subscribe ch qname message-handler {:auto-ack true})
-            (lb/publish ch default-exchange-name qname "Hello!" {:content-type "text/plain" :type "greetings.hi"})
-            (Thread/sleep 2000)
-            (println "[main] Disconnecting...")
-            (rmq/close ch)
-            (rmq/close conn)))
+(defn -main
+  [& args]
+  (let [conn (rmq/connect)
+        ch (lch/open conn)
+        qname "langohr.examples.hello-world"]
+    (println (format "[main] Connected. Channel id: %d" (.getChannelNumber ch)))
+    (lq/declare ch qname {:exclusive false :auto-delete true})
+    (lc/subscribe ch qname message-handler {:auto-ack true})
+    (lb/publish ch default-exchange-name qname "Hello!" {:content-type "text/plain" :type "greetings.hi"})
+    (Thread/sleep 2000)
+    (println "[main] Disconnecting...")
+    (rmq/close ch)
+    (rmq/close conn)))


be more consistent with refering the utils macros

--- src-cljs/frontend/core.cljs
+++ src-cljs/frontend/core.cljs
@@ -29,13 +29,12 @@
             [om.core :as om :include-macros true]
             [frontend.history :as history]
             [frontend.browser-settings :as browser-settings]
-            [frontend.utils :as utils :refer [mlog merror third]]
+            [frontend.utils :as utils :refer [mlog merror third] :include-macros true]
             [frontend.utils.ajax :as ajax]
             [frontend.datetime :as datetime]
             [goog.labs.dom.PageVisibilityMonitor]
             [secretary.core :as sec])
-  (:require-macros [cljs.core.async.macros :as am :refer [go go-loop alt!]]
-                   [frontend.utils :refer [inspect timing swallow-errors]])
+  (:require-macros [cljs.core.async.macros :as am :refer [go go-loop alt!]])
   (:import [cljs.core.UUID]
            [goog.events.EventType]))

@@ -161,7 +160,7 @@
   [value state history]
   (when (log-channels?)
     (mlog "Navigation Verbose: " value))
-  (swallow-errors
+  (utils/swallow-errors
    (binding [frontend.async/*uuid* (:uuid (meta value))]
      (let [previous-state @state]
        (swap! state (partial nav-con/navigated-to history (first value) (second value)))
@@ -171,7 +170,7 @@
   [value state container]
   (when (log-channels?)
     (mlog "API Verbose: " (first value) (second value) (utils/third value)))
-  (swallow-errors
+  (utils/swallow-errors
    (binding [frontend.async/*uuid* (:uuid (meta value))]
      (let [previous-state @state
            message (first value)
@@ -187,7 +186,7 @@
   [value state container]
   (when (log-channels?)
     (mlog "Errors Verbose: " value))
-  (swallow-errors
+  (utils/swallow-errors
    (binding [frontend.async/*uuid* (:uuid (meta value))]
      (let [previous-state @state]
        (swap! state (partial errors-con/error container (first value) (second value)))
@@ -270,7 +269,7 @@

     (when (and (env/development?) (= js/window.location.protocol "http:"))
-      (swallow-errors (dev/setup-figwheel {:js-callback om-setup})))
+      (utils/swallow-errors (dev/setup-figwheel {:js-callback om-setup})))

     (async/tap (:controls-mult comms) controls-tap)
     (async/tap (:nav-mult comms) nav-tap)
@@ -316,12 +315,12 @@
       (put! (get-in @state [:comms :nav]) [:error {:status error-status}])
       (sec/dispatch! (str "/" (.getToken history-imp))))
     (when (and (env/development?) (= js/window.location.protocol "http:"))
-      (swallow-errors (dev/setup-browser-repl)))))
+      (utils/swallow-errors (dev/setup-browser-repl)))))

 (defn ^:export inspect-state []
   (clj->js @debug-state))

 (defn ^:export test-rollbar []
-  (swallow-errors (throw (js/Error. "This is an exception"))))
+  (utils/swallow-errors (throw (js/Error. "This is an exception"))))

 (defonce startup (setup!))


Use resolve to fetch projects and plans

Use resolve to fetch projects and plans

--- src-cljs/frontend/send.cljs
+++ src-cljs/frontend/send.cljs
@@ -430,23 +430,63 @@
                                                      (= login name)))
                                               response))]
               {:organization/avatar-url (:avatar_url selected-org)
-               :organization/current-user-is-admin? (:admin selected-org)})))))})
+               :organization/current-user-is-admin? (:admin selected-org)})))))
+
+   :organization/projects
+   (fn [{:keys [organization/vcs-type organization/name] :as env} ast]
+     ;; Unlike most of the api functions, api/get-org-settings takes the channel
+     ;; as its last argument, so we use `partial` to make a function which takes
+     ;; it first, as `api-promise` requires.
+     (-> (api-promise (partial api/get-org-settings name vcs-type))
+         (p/then
+          (fn [response]
+            (let [projects (for [p (:projects response)]
+                             {:project/vcs-url (:vcs_url p)
+                              :project/name (vcs-url/repo-name (:vcs_url p))
+                              :project/parallelism (:parallel p)
+                              ;; Sometimes the backend returns a map of feature_flags,
+                              ;; and sometimes it returns :oss directly on the project.
+                              :project/oss? (or (:oss p)
+                                                (get-in p [:feature_flags :oss]))
+                              :project/follower-count (count (:followers p))})]
+              (mapv #(parser {:state (atom %)} (mapv om-next/ast->query (:children ast))) projects))))))
+
+   :organization/plan
+   (fn [{:keys [organization/vcs-type organization/name] :as env} ast]
+     ;; Unlike most of the api functions, api/get-org-settings takes the channel
+     ;; as its last argument, so we use `partial` to make a function which takes
+     ;; it first, as `api-promise` requires.
+     ;;
+     ;; Also: note that we do no processing/massaging of this data. The plan
+     ;; data is currently used in it's old-api form rather than using new
+     ;; namespaced, universal keys. This is debt.
+     (-> (api-promise (partial api/get-org-plan name vcs-type))))})

 (defn- resolvers-can-handle?
   "Tool for migrating to resolvers. True if the expression can be handled by the
   resolvers above."
   [expr]
-  (let [de-aliased-ast (om-parser/expr->ast (first (de-alias-expression expr #())))]
-    (or (branch-crumb-ast? de-aliased-ast)
-        (branch-runs-ast? de-aliased-ast)
+  (let [ast (om-parser/expr->ast (first (de-alias-expression expr #())))]
+    (or (branch-crumb-ast? ast)
+        (branch-runs-ast? ast)
         (= {:app/current-user [{:user/organizations [:organization/name :organization/vcs-type :organization/avatar-url]}]}
            expr)
-        (and (= :circleci/organization (:key de-aliased-ast))
-                 (= '[:organization/vcs-type
-                      :organization/name
-                      :organization/avatar-url
-                      :organization/current-user-is-admin?]
-                    (:query de-aliased-ast))))))
+        (and (= :circleci/organization (:key ast))
+             (= '[:organization/vcs-type
+                  :organization/name
+                  :organization/avatar-url
+                  :organization/current-user-is-admin?]
+                (:query ast)))
+        (and (= :circleci/organization (:key ast))
+             (= '[:organization/vcs-type
+                  :organization/name
+                  {:organization/projects [:project/follower-count
+                                           :project/vcs-url
+                                           :project/name
+                                           :project/parallelism
+                                           :project/oss?]}
+                  {:organization/plan [*]}]
+                (:query ast))))))

 (defmulti send* key)

@@ -475,41 +515,6 @@
         (let [[expr cb] (de-alias-expression expr cb)
               ast (om-parser/expr->ast expr)]
           (cond
-            ;; :route/projects
-            (and (= :circleci/organization (:key ast))
-                 (= '[:organization/vcs-type
-                      :organization/name
-                      {:organization/projects [:project/follower-count
-                                               :project/vcs-url
-                                               :project/name
-                                               :project/parallelism
-                                               :project/oss?]}
-                      {:organization/plan [*]}]
-                    (:query ast)))
-            (let [{:keys [organization/vcs-type organization/name]} (:params ast)]
-              (api/get-org-settings
-               name vcs-type
-               (callback-api-chan
-                #(let [projects (for [p (:projects %)]
-                                  {:project/vcs-url (:vcs_url p)
-                                   :project/name (vcs-url/repo-name (:vcs_url p))
-                                   :project/parallelism (:parallel p)
-                                   ;; Sometimes the backend returns a map of feature_flags,
-                                   ;; and sometimes it returns :oss directly on the project.
-                                   :project/oss? (or (:oss p)
-                                                     (get-in p [:feature_flags :oss]))
-                                   :project/follower-count (count (:followers p))})]
-                   (cb {:circleci/organization {:organization/name name
-                                                :organization/vcs-type vcs-type
-                                                :organization/projects (vec projects)}} query))))
-              (api/get-org-plan
-               name vcs-type
-               (callback-api-chan
-                #(cb {:circleci/organization {:organization/name name
-                                              :organization/vcs-type vcs-type
-                                              :organization/plan %}}
-                     query))))
-
             ;; Also :route/projects (but a separate expression for analytics, which
             ;; doesn't actually need to hit the server)
             (and (= :circleci/organization (:key ast))


Small clean up, adjusted initialization timing.

--- src-cljs/tea_time/core.cljs
+++ src-cljs/tea_time/core.cljs
@@ -79,6 +79,7 @@
 (re-frame/register-handler
   :initialize-db
   (fn [_ _]
+    (re-frame/dispatch [:load-teas])
     {:teas-list []}))

 (re-frame/register-handler
@@ -284,6 +285,5 @@
 (defn init! []
   ;; (fetch-docs!)
   (re-frame/dispatch [:initialize-db])
-  (re-frame/dispatch [:load-teas])
   (hook-browser-navigation!)
   (mount-components))


Added with-rotation, with-translation

Added with-rotation, with-translation

--- rosado/processing.clj
+++ rosado/processing.clj
@@ -772,6 +772,7 @@
   ([rgb alpha] (.tint *applet* (int rgb) (float alpha))))

 (defn translate
+	([v] (apply translate v))
   ([tx ty] (.translate *applet* (float tx) (float ty)))
   ([tx ty tz] (.translate *applet* (float tx) (float ty) (float tz))))

@@ -802,3 +803,28 @@
 	 (.vertex *applet* (float x) (float y) (float z) (float u) (float v))))

 (defn year [] (PApplet/year))
+
+;; utility functions. clj-processing specific
+
+(defmacro with-translation
+	"Berforms body with translation, restores current transformation on exit."
+	[translation-vector & body]
+	`(let [tr# ~translation-vector]
+		 (push-matrix)
+		 (translate tr#)
+		 ~@body
+		 (pop-matrix)))
+
+(defmacro with-rotation
+	"Berforms body with rotation, restores current transformation on exit.
+  Accepts a vector [angle] or [angle x-axis y-axis z-axis].
+
+  Example:
+    (with-rotation [angle]
+      (vertex 1 2))"
+	[rotation & body]
+	`(let [tr# ~rotation]
+		 (push-matrix)
+		 (apply rotate tr#)
+		 ~@body
+		 (pop-matrix)))


Подработка для подзадач

Подработка для подзадач

--- radiolamp-6P3S/src/ixinfestor/omut.cljs
+++ radiolamp-6P3S/src/ixinfestor/omut.cljs
@@ -42,10 +42,17 @@
   (and (not (js/isNaN (js/parseFloat n))) (js/isFinite n)))

-(defn parse-int-or-nil [v]
+(defn parse-int-or [v dv]
   (if (is-numeric? v)
     (js/parseInt v)
-    nil))
+    dv))
+
+
+(defn parse-int-or-nil [v]
+  (parse-int-or v nil))
+
+(defn parse-int-or-zero [v]
+  (parse-int-or v 0))

 (defn on-click-com-fn [f]
@@ -1239,6 +1246,7 @@
 (def textarea-app-init
   {:value ""})

+(defn textarea-value [app] (get app :value))

 (defn textarea [app owner {:keys [class+
                                   onChange-valid?-fn
@@ -2097,13 +2105,12 @@
 ;;**************************************************************************************************

 (def virtual-pages-app-init
-  {:current :main
-   })
+  {:current :main})

 (defn virtual-pages-current [app]
-  (@app :current))
-
-(defn virtual-pages-go-to-page [app page]
+  (app :current))
+
+(defn virtual-pages-go-to-page!! [app page]
   (om/update! app :current page))

 (defn ui-virtual-page-<<
@@ -2111,12 +2118,12 @@
    (ui-virtual-page-<< app page-key nil body))
   ([app page-key back-key body]
    (dom/div #js {:style #js {:display
-                             (if (= (virtual-pages-current app) page-key)
+                             (if (= (virtual-pages-current @app) page-key)
                                "" "none") }}
             (when back-key
               (ui-button {:type :default
                           :on-click (fn [_]
-                                      (virtual-pages-go-to-page app back-key)
+                                      (virtual-pages-go-to-page!! app back-key)
                                       1)
                           :text (dom/span nil
                                           (dom/span #js {:className "glyphicon glyphicon-backward"


[#2925] Add dev helper to create a new flow "data groups" dataset

--- backend/dev/src/dev.clj
+++ backend/dev/src/dev.clj
@@ -5,6 +5,7 @@
             [akvo.lumen.migrate :as lumen-migrate]
             [akvo.lumen.protocols :as p]
             [akvo.lumen.specs]
+            [akvo.lumen.specs.import :as i-c]
             [akvo.lumen.test-utils :as tu]
             [clojure.edn :as edn]
             [clojure.java.io :as io]
@@ -82,4 +83,23 @@
   ([label] (p/connection (:akvo.lumen.component.tenant-manager/tenant-manager system) label))
   ([] (db-conn "t1")))

+(defn new-flow-dataset
+  ([dataset-name]
+   (new-flow-dataset dataset-name [{:groupId "group1"
+                                    :groupName "repeatable group"
+                                    :repeatable true
+                                    :column-types ["option" "text"]
+                                    :max-responses 10}
+                                   {:groupId "group2"
+                                    :groupName "not repeatable group"
+                                    :repeatable false
+                                    :column-types ["number" "date"]}] 2))
+  ([dataset-name groups submissions]
+   (tu/import-file (db-conn)
+                   (:akvo.lumen.utils.local-error-tracker/local system)
+                   {:dataset-name dataset-name
+                    :kind "clj-flow"
+                    :data (i-c/flow-sample-imported-dataset groups submissions)})))

+;;(new-flow-dataset "example-data")
+


simplify logic of using default language model

--- src/babel/english/demo.cljc
+++ src/babel/english/demo.cljc
@@ -82,8 +82,7 @@
                         (println)
                         (println log-message)
                         (println)
-                        (let [language-model (if (:lm spec) (:lm spec)
-                                                 default-language-model)
+                        (let [language-model (or (:lm spec) default-language-model)
                               expressions (run-demo-with n (dissoc spec :lm) language-model)]
                           (count (pmap (fn [expression]
                                          (let [formatted (fo expression :show-notes false)]


Fix a documentation typo

Fix a documentation typo

--- src/catalog/layout/text.clj
+++ src/catalog/layout/text.clj
@@ -1,5 +1,5 @@
 (ns catalog.layout.text
-  "Render catalog items as plain textx"
+  "Render catalog items as plain text"
   (:require [catalog.layout.common :as layout :refer [empty-or-blank? wrap]]
             [clj-time
              [core :as time.core]


Drop comment.

Drop comment.

--- src/cavm/views/datasets.clj
+++ src/cavm/views/datasets.clj
@@ -116,7 +116,6 @@
    'query h2/run-query
    'filter filter-attr})

-; XXX The call to read-symbols needs a list of sources, I think.
 (defpage [:get ["/data/:expression" :expression #".+"]] {:keys [expression]}
   (h2/with-db (:db (ring-request))
     (response/json (expr/expression expression f/functions functions))))


Introduce set-state(-nr)! variants

Introduce set-state(-nr)! variants

--- src/cljs/dato/lib/core.cljs
+++ src/cljs/dato/lib/core.cljs
@@ -362,7 +362,16 @@
         eid (dato-node-id owner)]
     (d/entity db eid)))

+
+;; XXX: Unsure about -nr variant
 (defn set-state! [owner map]
+  (let [conn   (conn (om/get-shared owner [:dato]))
+        eid    (dato-node-id owner)
+        entity (merge {:db/id eid} map)]
+    (d/transact conn [entity])
+    (om/refresh! owner)))
+
+(defn set-state-nr! [owner map]
   (let [conn   (conn (om/get-shared owner [:dato]))
         eid    (dato-node-id owner)
         entity (merge {:db/id eid} map)]


Start normalizing Dato to remove blessed methods

--- src/cljs/dato/lib/core.cljs
+++ src/cljs/dato/lib/core.cljs
@@ -72,7 +72,7 @@
                                                                                (cond
                                                                                (chan? cb-or-ch) (put! cb-or-ch (:data data))
                                                                                (fn? cb-or-ch)   (cb-or-ch (:data data))
-                                                                                :else            nil))
+                                                                                :else            (ss-cast! (:data data))))
                                                                                (ss-cast! data)))))
                                                                           (.readAsText fr (.-data event))))
                                                           :on-error   (fn [event] (js/console.log ":on-error :" event))})
@@ -99,24 +99,25 @@
         ;; ???: Do the perf implications of anonymous functions mean these
         ;; shouldn't be in a tight loop?
         fn-desc->rpc       (fn fn-desc->rpc [remote-name desc]
-                             (fn [& all-args]
-                               ;; TODO: Check if last argument is a channel, an
-                               (let [cb-or-ch (last all-args)
-                                     cb       (cond
-                                                (fn? cb-or-ch)   cb-or-ch
-                                                (chan? cb-or-ch) #(put! cb-or-ch %)
-                                                :else            false)
-                                     args     (if cb
-                                                (drop-last 1 all-args)
-                                                all-args)
-                                     uuid     (d/squuid)]
-                                 (when (fn? cb)
-                                   (swap! pending-rpc assoc uuid cb-or-ch))
-                                 (dato-send! remote-name {:args   args
-                                                          :rpc/id uuid})
-                                 (if (chan? cb-or-ch)
-                                   cb-or-ch
-                                   uuid))))]
+                             (let [f (fn [& all-args]
+                                       ;; TODO: Check if last argument is a channel, an
+                                       (let [cb-or-ch (last all-args)
+                                             cb       (cond
+                                                        (fn? cb-or-ch)   cb-or-ch
+                                                        (chan? cb-or-ch) #(put! cb-or-ch %)
+                                                        :else            false)
+                                             args     (if cb
+                                                        (drop-last 1 all-args)
+                                                        all-args)
+                                             uuid     (d/squuid)]
+                                         (when (fn? cb)
+                                           (swap! pending-rpc assoc uuid cb-or-ch))
+                                         (dato-send! remote-name {:args   args
+                                                                  :rpc/id uuid})
+                                         (if (chan? cb-or-ch)
+                                           cb-or-ch
+                                           uuid)))]
+                               f))]
     {:comms    comms
      ;; Just for debugging to simulate messages coming in from the
      ;; server
@@ -184,29 +185,31 @@
                                     (recur)))
                                 (dato-send! :ss/bootstrap {})
                                 (js/console.log "1. Bootstrap")
-                                (let [{:keys [data] :as -bootstrap} (loop [msg (<! ws-ch)]
-                                                                      (if (= :ss/bootstrap-succeeded (:event msg))
-                                                                        msg
-                                                                        ;; Not the
-                                                                        ;; message
-                                                                        ;; we're
-                                                                        ;; looking for
-                                                                        ;; (could be
-                                                                        ;; something
-                                                                        ;; during
-                                                                        ;; refreshing
-                                                                        ;; with
-                                                                        ;; figwheel. Put
-                                                                        ;; the message
-                                                                        ;; back on,
-                                                                        ;; wait a few
-                                                                        ;; ms, and try
-                                                                        ;; again. Still very racy.
-                                                                        (do
-                                                                          (put! ws-ch msg)
-                                                                          (<! (async/timeout 16))
-                                                                          (recur (<! ws-ch)))))
-                                      _ (js/console.log "2. Bootstrap; " data)
+                                (let [{:keys [data] :as -rpc-response} (loop [msg (<! ws-ch)]
+                                                                         (if (= :ss/bootstrap-succeeded (get-in msg [:data :event]))
+                                                                           msg
+                                                                           ;; Not the
+                                                                           ;; message
+                                                                           ;; we're
+                                                                           ;; looking for
+                                                                           ;; (could be
+                                                                           ;; something
+                                                                           ;; during
+                                                                           ;; refreshing
+                                                                           ;; with
+                                                                           ;; figwheel. Put
+                                                                           ;; the message
+                                                                           ;; back on,
+                                                                           ;; wait a few
+                                                                           ;; ms, and try
+                                                                           ;; again. Still very racy.
+                                                                           (do
+                                                                             (put! ws-ch msg)
+                                                                             (<! (async/timeout 16))
+                                                                             (recur (<! ws-ch)))))
+                                      data                             (:data data)
+                                      _                                (js/console.log "1.5. -Bootstrap: " -rpc-response)
+                                      _                                (js/console.log "2. Bootstrap; " data)
                                       {:keys [session-id schema]}      data]
                                   (swap! ss-data merge (:ss data))
                                   (reset! ss-api (->> (:ss data)
@@ -232,15 +235,16 @@
                                                ;;(js/console.log "me")
                                                (doto app-db
                                                  (db/setup-listener! :global-listener))
-                                               (d/listen! app-db :server-tx-report
-                                                          (fn [tx-report]
-                                                            (let [datoms (tx-report->transaction tx-report)]
-                                                              (js/console.log "Listened TX: " tx-report)
-                                                              (when (or (get-in tx-report [:tx-meta :tx/broadcast?])
-                                                                        (get-in tx-report [:tx-meta :tx/persist?]))
-                                                                (let [prepped (db/prep-broadcastable-tx-report tx-report)]
-                                                                  (when @network-enabled?
-                                                                    (dato-send! :ss/tx-requested prepped)))))))
+                                               (let [request-transaction! (get-in @ss-api [:tx-requested])]
+                                                 (d/listen! app-db :server-tx-report
+                                                            (fn [tx-report]
+                                                              (let [datoms (tx-report->transaction tx-report)]
+                                                                ;;(js/console.log "Listened TX: " tx-report)
+                                                                (when (or (get-in tx-report [:tx-meta :tx/broadcast?])
+                                                                          (get-in tx-report [:tx-meta :tx/persist?]))
+                                                                  (let [prepped (db/prep-broadcastable-tx-report tx-report)]
+                                                                    (when @network-enabled?
+                                                                      (request-transaction! prepped))))))))
                                                (let [local-session-id (d/tempid :db.part/user)]
                                                  (d/transact! app-db (vals schema))
                                                  (d/transact! app-db [{:db/id                 (d/tempid :db.part/user)
@@ -279,7 +283,6 @@
   (get-in dato [:api :r-transact]) data)

 (defn transact! [dato & args]
-  (js/console.log "transact!")
   (apply (get-in dato [:api :transact!]) args))

 (defn cast! [dato event-data]


Mention subscene on index page

Mention subscene on index page

--- src/cljs/subman/search.cljs
+++ src/cljs/subman/search.cljs
@@ -50,9 +50,12 @@
                                ", "
                                [:a {:href "http://www.opensubtitles.org/"
                                     :target "_blank"} "www.opensubtitles.org"]
-                               " and "
+                               ", "
                                [:a {:href "http://www.podnapisi.net/"
                                     :target "_blank"} "podnapisi.net"]
+                               " and "
+                               [:a {:href "http://subscene.com/"
+                                    :target "_blank"} "subscene.com"]
                                "."]
                               [:p "Total indexed subtitles count: "
                                @total-count


Wrapped virtual product bootstrap test to fix CI

--- system-int-test/test/cmr/system_int_test/bootstrap/virtual_products_test.clj
+++ system-int-test/test/cmr/system_int_test/bootstrap/virtual_products_test.clj
@@ -54,41 +54,42 @@
 ;; process before checking for virtual products.

 (deftest virtual-product-bootstrap-params
-  (testing "invalid params"
-    (are2 [exp-status exp-errors provider-id entry-title]
-      (let [{:keys [status errors]}(bootstrap/bootstrap-virtual-products provider-id entry-title)]
-             (is (= exp-status status))
-             (is (= (set exp-errors) (set errors))))
+  (s/only-with-real-database
+    (testing "invalid params"
+      (are2 [exp-status exp-errors provider-id entry-title]
+            (let [{:keys [status errors]}(bootstrap/bootstrap-virtual-products provider-id entry-title)]
+              (is (= exp-status status))
+              (is (= (set exp-errors) (set errors))))

-      "missing provider-id"
-      400
-      ["provider-id and entry-title are required parameters."]
-      nil
-      "et1"
+            "missing provider-id"
+            400
+            ["provider-id and entry-title are required parameters."]
+            nil
+            "et1"

-      "missing entry-id"
-      400
-      ["provider-id and entry-title are required parameters."]
-      "PROV1"
-      nil
+            "missing entry-id"
+            400
+            ["provider-id and entry-title are required parameters."]
+            "PROV1"
+            nil

-      "missing both"
-      400
-      ["provider-id and entry-title are required parameters."]
-      nil
-      nil
+            "missing both"
+            400
+            ["provider-id and entry-title are required parameters."]
+            nil
+            nil

-      "invalid provider-id"
-      404
-      ["No virtual product configuration found for provider [FOO] and entry-title [ASTER L1A Reconstructed Unprocessed Instrument Data V003]"]
-      "FOO"
-      "ASTER L1A Reconstructed Unprocessed Instrument Data V003"
+            "invalid provider-id"
+            404
+            ["No virtual product configuration found for provider [FOO] and entry-title [ASTER L1A Reconstructed Unprocessed Instrument Data V003]"]
+            "FOO"
+            "ASTER L1A Reconstructed Unprocessed Instrument Data V003"

-      "invalid entry-id"
-      404
-      ["No virtual product configuration found for provider [LPDAAC_ECS] and entry-title [BAR]"]
-      "LPDAAC_ECS"
-      "BAR")))
+            "invalid entry-id"
+            404
+            ["No virtual product configuration found for provider [LPDAAC_ECS] and entry-title [BAR]"]
+            "LPDAAC_ECS"
+            "BAR"))))

 (deftest virtual-product-bootstrap
   (s/only-with-real-database


Reformatted code.

Reformatted code.

--- test/cmr/system_int_test/search/collection_periodic_temporal_search_test.clj
+++ test/cmr/system_int_test/search/collection_periodic_temporal_search_test.clj
@@ -11,98 +11,98 @@

 (deftest search-by-periodic-temporal
   (let [coll1 (d/ingest "CMR_PROV1" (dc/collection {:entry-title "Dataset1"
-                 :beginning-date-time "2000-01-01T12:00:00Z"
-                 :ending-date-time "2000-02-14T12:00:00Z"}))
+                                                    :beginning-date-time "2000-01-01T12:00:00Z"
+                                                    :ending-date-time "2000-02-14T12:00:00Z"}))
         coll2 (d/ingest "CMR_PROV1" (dc/collection {:entry-title "Dataset2"
-                 :beginning-date-time "2000-02-14T12:00:00Z"
-                 :ending-date-time "2000-02-15T12:00:00Z"}))
+                                                    :beginning-date-time "2000-02-14T12:00:00Z"
+                                                    :ending-date-time "2000-02-15T12:00:00Z"}))
         coll3 (d/ingest "CMR_PROV1" (dc/collection {:entry-title "Dataset3"
-                 :beginning-date-time "2000-03-15T12:00:00Z"
-                 :ending-date-time "2000-04-15T12:00:00Z"}))
+                                                    :beginning-date-time "2000-03-15T12:00:00Z"
+                                                    :ending-date-time "2000-04-15T12:00:00Z"}))
         coll4 (d/ingest "CMR_PROV1" (dc/collection {:entry-title "Dataset4"
-                 :beginning-date-time "2000-04-01T12:00:00Z"
-                 :ending-date-time "2000-04-15T12:00:00Z"}))
+                                                    :beginning-date-time "2000-04-01T12:00:00Z"
+                                                    :ending-date-time "2000-04-15T12:00:00Z"}))
         coll5 (d/ingest "CMR_PROV1" (dc/collection {:entry-title "Dataset5"
-                 :beginning-date-time "2001-01-01T12:00:00Z"
-                 :ending-date-time "2001-01-31T12:00:00Z"}))
+                                                    :beginning-date-time "2001-01-01T12:00:00Z"
+                                                    :ending-date-time "2001-01-31T12:00:00Z"}))
         coll6 (d/ingest "CMR_PROV1" (dc/collection {:entry-title "Dataset6"
-                 :beginning-date-time "2001-01-01T12:00:00Z"
-                 :ending-date-time "2001-02-14T12:00:00Z"}))
+                                                    :beginning-date-time "2001-01-01T12:00:00Z"
+                                                    :ending-date-time "2001-02-14T12:00:00Z"}))
         coll7 (d/ingest "CMR_PROV1" (dc/collection {:entry-title "Dataset7"
-                 :beginning-date-time "2001-03-15T12:00:00Z"
-                 :ending-date-time "2001-04-15T12:00:00Z"}))
+                                                    :beginning-date-time "2001-03-15T12:00:00Z"
+                                                    :ending-date-time "2001-04-15T12:00:00Z"}))
         coll8 (d/ingest "CMR_PROV1" (dc/collection {:entry-title "Dataset8"
-                 :beginning-date-time "2001-04-01T12:00:00Z"
-                 :ending-date-time "2001-04-15T12:00:00Z"}))
+                                                    :beginning-date-time "2001-04-01T12:00:00Z"
+                                                    :ending-date-time "2001-04-15T12:00:00Z"}))
         coll9 (d/ingest "CMR_PROV1" (dc/collection {:entry-title "Dataset9"
-                 :beginning-date-time "2002-01-01T12:00:00Z"
-                 :ending-date-time "2002-01-31T12:00:00Z"}))
+                                                    :beginning-date-time "2002-01-01T12:00:00Z"
+                                                    :ending-date-time "2002-01-31T12:00:00Z"}))
         coll10 (d/ingest "CMR_PROV1" (dc/collection {:entry-title "Dataset10"
-                 :beginning-date-time "2002-01-01T12:00:00Z"
-                 :ending-date-time "2002-02-14T12:00:00Z"}))
+                                                     :beginning-date-time "2002-01-01T12:00:00Z"
+                                                     :ending-date-time "2002-02-14T12:00:00Z"}))
         coll11 (d/ingest "CMR_PROV1" (dc/collection {:entry-title "Dataset11"
-                 :beginning-date-time "2002-03-14T12:00:00Z"
-                 :ending-date-time "2002-04-15T12:00:00Z"}))
+                                                     :beginning-date-time "2002-03-14T12:00:00Z"
+                                                     :ending-date-time "2002-04-15T12:00:00Z"}))
         coll12 (d/ingest "CMR_PROV1" (dc/collection {:entry-title "Dataset12"
-                 :beginning-date-time "2002-03-15T12:00:00Z"
-                 :ending-date-time "2002-04-15T12:00:00Z"}))
+                                                     :beginning-date-time "2002-03-15T12:00:00Z"
+                                                     :ending-date-time "2002-04-15T12:00:00Z"}))
         coll13 (d/ingest "CMR_PROV1" (dc/collection {:entry-title "Dataset13"
-                 :beginning-date-time "2002-04-01T12:00:00Z"
-                 :ending-date-time "2002-04-15T12:00:00Z"}))
+                                                     :beginning-date-time "2002-04-01T12:00:00Z"
+                                                     :ending-date-time "2002-04-15T12:00:00Z"}))
         coll14 (d/ingest "CMR_PROV1" (dc/collection {:entry-title "Dataset14"
-                 :beginning-date-time "1999-02-15T12:00:00Z"
-                 :ending-date-time "1999-03-15T12:00:00Z"}))
+                                                     :beginning-date-time "1999-02-15T12:00:00Z"
+                                                     :ending-date-time "1999-03-15T12:00:00Z"}))
         coll15 (d/ingest "CMR_PROV1" (dc/collection {:entry-title "Dataset15"
-                 :beginning-date-time "2003-02-15T12:00:00Z"
-                 :ending-date-time "2003-03-15T12:00:00Z"}))
+                                                     :beginning-date-time "2003-02-15T12:00:00Z"
+                                                     :ending-date-time "2003-03-15T12:00:00Z"}))
         coll16 (d/ingest "CMR_PROV2" (dc/collection {:entry-title "Dataset16"
-                 :beginning-date-time "1999-02-15T12:00:00Z"}))
+                                                     :beginning-date-time "1999-02-15T12:00:00Z"}))
         coll17 (d/ingest "CMR_PROV2" (dc/collection {:entry-title "Dataset17"
-                 :beginning-date-time "2001-02-15T12:00:00Z"}))
+                                                     :beginning-date-time "2001-02-15T12:00:00Z"}))
         coll18 (d/ingest "CMR_PROV2" (dc/collection {:entry-title "Dataset18"
-                 :beginning-date-time "2002-03-15T12:00:00Z"}))
+                                                     :beginning-date-time "2002-03-15T12:00:00Z"}))
         coll19 (d/ingest "CMR_PROV2" (dc/collection {:entry-title "Dataset19"
-                 :beginning-date-time "2001-11-15T12:00:00Z"
-                 :ending-date-time "2001-12-15T12:00:00Z"}))
+                                                     :beginning-date-time "2001-11-15T12:00:00Z"
+                                                     :ending-date-time "2001-12-15T12:00:00Z"}))
         coll20 (d/ingest "CMR_PROV2" (dc/collection {:entry-title "Dataset20"}))]
     (index/flush-elastic-index)

-  (testing "search by both start-day and end-day."
-    (let [references (search/find-refs :collection
-                       {"temporal[]" "2000-02-15T00:00:00Z, 2002-03-15T00:00:00Z, 32, 90"
-                        :page_size 100})]
-      (is (d/refs-match? [coll2 coll3 coll6 coll7 coll10 coll11 coll16 coll17] references))))
-  (testing "search by end-day."
-    (let [references (search/find-refs :collection
-                       {"temporal[]" "2000-02-15T00:00:00Z, 2002-03-15T00:00:00Z, , 90"
-                        :page_size 100})]
-      (is (d/refs-match?
-            [coll2 coll3 coll5 coll6 coll7 coll9 coll10 coll11 coll16 coll17] references))))
-  (testing "search by start-day."
-    (let [references (search/find-refs :collection
-                       {"temporal[]" "2000-02-15T00:00:00Z, 2002-03-15T00:00:00Z, 32,"
-                        :page_size 100})]
-      (is (d/refs-match?
-            [coll2 coll3 coll4 coll6 coll7 coll8 coll10 coll11 coll16 coll17 coll19] references))))
-  (testing "search by start-day without end_date."
-    (let [references (search/find-refs :collection
-                       {"temporal[]" ["2000-02-15T00:00:00Z, , 32"]
-                        :page_size 100})]
-      (is (d/refs-match?
-            [coll2 coll3 coll4 coll6 coll7 coll8 coll10 coll11 coll12 coll13 coll15 coll16 coll17 coll18 coll19]
-            references))))
-  (testing "search by start-day/end-day with date crossing year boundary."
-    (let [references (search/find-refs :collection
-                       {"temporal[]" ["2000-04-03T00:00:00Z, 2002-01-02T00:00:00Z, 93, 2"]
-                        :page_size 100})]
-      (is (d/refs-match?
-            [coll3 coll4 coll5 coll6 coll7 coll8 coll9 coll10 coll16 coll17 coll19] references))))
-  (testing "search by multiple temporal."
-    (let [references (search/find-refs :collection
-                       {"temporal[]" ["1998-01-15T00:00:00Z, 1999-03-15T00:00:00Z, 60, 90"
-                                      "2000-02-15T00:00:00Z, 2001-03-15T00:00:00Z, 40, 50"]
-                        :page_size 100})]
-      (is (d/refs-match? [coll2 coll6 coll14 coll16 coll17] references))))))
+    (testing "search by both start-day and end-day."
+      (let [references (search/find-refs :collection
+                                         {"temporal[]" "2000-02-15T00:00:00Z, 2002-03-15T00:00:00Z, 32, 90"
+                                          :page_size 100})]
+        (is (d/refs-match? [coll2 coll3 coll6 coll7 coll10 coll11 coll16 coll17] references))))
+    (testing "search by end-day."
+      (let [references (search/find-refs :collection
+                                         {"temporal[]" "2000-02-15T00:00:00Z, 2002-03-15T00:00:00Z, , 90"
+                                          :page_size 100})]
+        (is (d/refs-match?
+              [coll2 coll3 coll5 coll6 coll7 coll9 coll10 coll11 coll16 coll17] references))))
+    (testing "search by start-day."
+      (let [references (search/find-refs :collection
+                                         {"temporal[]" "2000-02-15T00:00:00Z, 2002-03-15T00:00:00Z, 32,"
+                                          :page_size 100})]
+        (is (d/refs-match?
+              [coll2 coll3 coll4 coll6 coll7 coll8 coll10 coll11 coll16 coll17 coll19] references))))
+    (testing "search by start-day without end_date."
+      (let [references (search/find-refs :collection
+                                         {"temporal[]" ["2000-02-15T00:00:00Z, , 32"]
+                                          :page_size 100})]
+        (is (d/refs-match?
+              [coll2 coll3 coll4 coll6 coll7 coll8 coll10 coll11 coll12 coll13 coll15 coll16 coll17 coll18 coll19]
+              references))))
+    (testing "search by start-day/end-day with date crossing year boundary."
+      (let [references (search/find-refs :collection
+                                         {"temporal[]" ["2000-04-03T00:00:00Z, 2002-01-02T00:00:00Z, 93, 2"]
+                                          :page_size 100})]
+        (is (d/refs-match?
+              [coll3 coll4 coll5 coll6 coll7 coll8 coll9 coll10 coll16 coll17 coll19] references))))
+    (testing "search by multiple temporal."
+      (let [references (search/find-refs :collection
+                                         {"temporal[]" ["1998-01-15T00:00:00Z, 1999-03-15T00:00:00Z, 60, 90"
+                                                        "2000-02-15T00:00:00Z, 2001-03-15T00:00:00Z, 40, 50"]
+                                          :page_size 100})]
+        (is (d/refs-match? [coll2 coll6 coll14 coll16 coll17] references))))))

 ;; Just some symbolic invalid temporal testing, more complete test coverage is in unit tests
 (deftest search-temporal-error-scenarios


CMR-5912: Include .umm-version explicitly.

--- collection-renderer-lib/project.clj
+++ collection-renderer-lib/project.clj
@@ -35,6 +35,7 @@
   :resource-paths ["resources" ~gem-install-path]
   :jvm-opts ^:replace ["-server"
                        "-Dclojure.compiler.direct-linking=true"]
+  :jar-inclusions [#"\.umm-version"]
   :profiles {:security {:plugins [[com.livingsocial/lein-dependency-check "1.1.1"]]
                         :dependency-check {:output-format [:all]
                                            :suppression-file "resources/security/suppression.xml"


Better implementation of increasing*

Better implementation of increasing*

--- src/flatland/useful/seq.clj
+++ src/flatland/useful/seq.clj
@@ -440,20 +440,20 @@

 (defn increasing*
   "Scans through a collection, comparing items via (comp (keyfn x) (keyfn y)), and finding those
-  which are in increasing order. Each input item x is output once, tagged as either {:included x} or
-  {:excluded x}. Those items which are part of an increasing sequence will be :included, while any
-  that go \"backwards\" from the current max will be :excluded."
+  which are in increasing order. Each input item x is output once, as part of a pair, [included?
+  x]. Those items which are part of an increasing sequence will have included? true, while any that
+  go \"backwards\" from the current max will have included? false."
   [keyfn comp coll]
   (lazy-seq
     (when-first [x coll]
       (let [max (keyfn x)]
-        (cons {:included x}
+        (cons [true x]
               (lazy-loop [max max, coll (rest coll)]
                 (when-first [x coll]
                   (let [key (keyfn x)]
                     (if (neg? (comp key max))
-                      (cons {:excluded x} (lazy-recur max (rest coll)))
-                      (cons {:included x} (lazy-recur key (rest coll))))))))))))
+                      (cons [false x] (lazy-recur max (rest coll)))
+                      (cons [true x] (lazy-recur key (rest coll))))))))))))

 (defn increasing
   "Throw away any elements from coll which are not in increasing order, according to keyfn and
@@ -463,4 +463,4 @@
   ([keyfn coll]
      (increasing keyfn compare coll))
   ([keyfn comp coll]
-     (keep :included (increasing* keyfn comp coll))))
+     (map second (filter first (increasing* keyfn comp coll)))))


Help links should not include trailing whitespace

--- src-cljs/frontend/components/build.cljs
+++ src-cljs/frontend/components/build.cljs
@@ -57,11 +57,11 @@
          [:div.alert-wrap
           "Error! Check out our "
           [:a {:href "/docs/troubleshooting"}
-           "help docs "]
-          "or our "
-          [:a {:href "http://discuss.circleci.com/"}
-           "community site "]
-          "for more information. If you are a paid customer, you may also consider "
+           "help docs"]
+          " or our "
+          [:a {:href "https://discuss.circleci.com/"}
+           "community site"]
+          " for more information. If you are a paid customer, you may also consider "
           [:a (common/contact-support-a-info owner :tags [:report-build-clicked {:build-url build-url}])
            "requesting for help"]
           " from a support engineer."])])))


Define parses atom and functions to record and remove them.

--- src/incise/parsers/core.clj
+++ src/incise/parsers/core.clj
@@ -18,6 +18,12 @@
                 another file appropriately."}
   parsers
   (atom {}))
+
+(defonce parses (atom {}))
+(defn dissoc-parses [deleted-paths]
+  (apply swap! parses dissoc deleted-paths))
+(defn record-parse [canonical-path ^Parse a-parse]
+  (swap! parses assoc canonical-path a-parse))

 (defn register
   "Register a parser for the given file extensions."


keep user auth rediction in appengine.users

--- src/instapapure/servlet.clj
+++ src/instapapure/servlet.clj
@@ -66,12 +66,6 @@
         body
         (footer)]))

-(defn signin [user-service]
-  (html
-    [:h1 "Sign in"]
-    [:p
-      (link-to (.createLoginURL user-service "/") "Sign in before saving articles")]))
-
 (defn delete-article
   "Delete the article specified by the id parameter"
   [id]
@@ -127,9 +121,8 @@
 (defn new-article
   "Create a new article"
   [location title summary]
-  (if (.isUserLoggedIn (users/user-service))
-    (redirect-to (articles/create-article location title summary (users/current-user)))
-    ({:status 302 :headers {"Location" (.createLoginURL (users/user-service) "/")}})))
+    (articles/create-article location title summary (users/current-user))
+    (redirect-to location))

 (defn create-article
   "Display HTML form to create a new article"


Boot show -u, show newer versions instead of outdated ones (Fixes #43)

--- boot/pod/src/boot/pod.clj
+++ boot/pod/src/boot/pod.clj
@@ -245,7 +245,7 @@
              (let [env' (-> env (assoc :dependencies [(assoc coord 1 v+)]))
                    [p' v' & _ :as coord'] (->> (map :dep (resolve-dependencies env'))
                                                (filter #(= p (first %))) first)]
-               (and (= p p') (not= v v') coord))))
+               (and (= p p') (not= v v') coord'))))
          (filter identity))))

 (defn add-dependencies


Refactor bind to fmap where possible

Refactor bind to fmap where possible

--- src/main/clojure/clojure/test/check/generators.cljc
+++ src/main/clojure/clojure/test/check/generators.cljc
@@ -393,8 +393,8 @@
   [coll]
   (assert (seq coll) "elements cannot be called with an empty collection")
   (core/let [v (vec coll)]
-    (gen-bind (choose 0 (dec (count v)))
-              #(gen-pure (rose/fmap v %)))))
+    (gen-fmap #(rose/fmap v %)
+              (choose 0 (dec (count v))))))

 (defn- such-that-helper
   [pred gen {:keys [ex-fn max-tries]} rng size]
@@ -484,16 +484,16 @@
   applicable to the domain."
   [gen]
   (assert (generator? gen) "Arg to no-shrink must be a generator")
-  (gen-bind gen
-            (fn [rose]
-              (gen-pure (rose/make-rose (rose/root rose) [])))))
+  (gen-fmap (fn [rose]
+              (rose/make-rose (rose/root rose) []))
+            gen))

 (defn shrink-2
   "Create a new generator like `gen`, but will consider nodes for shrinking
   even if their parent passes the test (up to one additional level)."
   [gen]
   (assert (generator? gen) "Arg to shrink-2 must be a generator")
-  (gen-bind gen (comp gen-pure rose/collapse)))
+  (gen-fmap rose/collapse gen))

 (def boolean
   "Generates one of `true` or `false`. Shrinks to `false`."
@@ -513,9 +513,9 @@
   [& generators]
   (assert (every? generator? generators)
           "Args to tuple must be generators")
-  (gen-bind (gen-tuple generators)
-            (fn [roses]
-              (gen-pure (rose/zip core/vector roses)))))
+  (gen-fmap (fn [roses]
+              (rose/zip core/vector roses))
+            (gen-tuple generators)))

 (def int
   "Generates a positive or negative integer bounded by the generator's
@@ -552,11 +552,11 @@
    (gen-bind
     (sized #(choose 0 %))
     (fn [num-elements-rose]
-      (gen-bind (gen-tuple (repeat (rose/root num-elements-rose)
-                                   generator))
-                (fn [roses]
-                  (gen-pure (rose/shrink-vector core/vector
-                                                roses)))))))
+      (gen-fmap (fn [roses]
+                  (rose/shrink-vector core/vector
+                                      roses))
+                (gen-tuple (repeat (rose/root num-elements-rose)
+                                   generator))))))
   ([generator num-elements]
    (assert (generator? generator) "First arg to vector must be a generator")
    (apply tuple (repeat num-elements generator)))
@@ -565,16 +565,14 @@
    (gen-bind
     (choose min-elements max-elements)
     (fn [num-elements-rose]
-      (gen-bind (gen-tuple (repeat (rose/root num-elements-rose)
-                                   generator))
-                (fn [roses]
-                  (gen-bind
-                   (gen-pure (rose/shrink-vector core/vector
-                                                 roses))
-                   (fn [rose]
-                     (gen-pure (rose/filter
-                                (fn [v] (and (>= (count v) min-elements)
-                                             (<= (count v) max-elements))) rose))))))))))
+      (gen-fmap (fn [roses]
+                  (rose/filter
+                   (fn [v] (and (>= (count v) min-elements)
+                                (<= (count v) max-elements)))
+                   (rose/shrink-vector core/vector
+                                       roses)))
+                (gen-tuple (repeat (rose/root num-elements-rose)
+                                   generator)))))))

 (defn list
   "Like `vector`, but generates lists."
@@ -582,11 +580,11 @@
   (assert (generator? generator) "First arg to list must be a generator")
   (gen-bind (sized #(choose 0 %))
             (fn [num-elements-rose]
-              (gen-bind (gen-tuple (repeat (rose/root num-elements-rose)
-                                           generator))
-                        (fn [roses]
-                          (gen-pure (rose/shrink-vector core/list
-                                                        roses)))))))
+              (gen-fmap (fn [roses]
+                          (rose/shrink-vector core/list
+                                              roses))
+                        (gen-tuple (repeat (rose/root num-elements-rose)
+                                           generator))))))

 (defn- swap
   [coll [i1 i2]]


initial cart spec

initial cart spec

--- src/clojurescript/nossal/shop/data.cljs
+++ src/clojurescript/nossal/shop/data.cljs
@@ -1,27 +1,36 @@
 (ns nossal.shop.data
-  (:require [clojure.spec.alpha :as s]))
-
+  (:require [clojure.spec.alpha :as s]
+            [re-frame.core :refer [reg-event-db reg-event-fx inject-cofx path after]]))

 (s/def ::category string?)

 (s/def ::id int?)
+(s/def ::quantity (s/and int? #(> % 0)))
 (s/def ::price (s/and float? #(> % 0)))
+(s/def ::market-price (s/and float? #(> % 0)))
 (s/def ::title string?)
 (s/def ::description string?)
 (s/def ::stock-count (s/and int? #(>= % 0)))
 (s/def ::available? boolean?)
 (s/def ::images (s/coll-of uri? :kind vector? :distinct true :into []))
 (s/def ::product (s/keys :req-un [::id
+                                  ::market-price
                                   ::price
                                   ::title
                                   ::description
                                   ::images
                                   ::category
                                   ::stock-count
-                                  ::available]))
+                                  ::available?]))
 (s/def ::products (s/and
                     (s/map-of ::id ::product)
                     #(instance? PersistentTreeMap %)))
+
+(s/def ::basket-item (s/keys :req-un [::product ::quantity]))
+(s/def ::basket-itens (s/coll-of ::basket-item :kind vector? :distinct true :into []))
+(s/def ::basket (s/keys :req-un [::id ::basket-itens]))
+
+(s/def ::db (s/keys :req-un [::products ::basket]))

 (def products-db
   [{:code 1
@@ -56,3 +65,11 @@
     :partner "banggood"
     :images ["https://img.staticbg.com/thumb/large/oaupload/banggood/images/18/97/55a957e6-ad5d-411c-a20b-2088279c13f9.jpg.webp"]}])

+
+(defn check-and-throw
+  "Throws an exception if `db` doesn't match the Spec `a-spec`."
+  [a-spec db]
+  (when-not (s/valid? a-spec db)
+    (throw (ex-info (str "spec check failed: " (s/explain-str a-spec db)) {}))))
+
+(def check-spec-interceptor (after (partial check-and-throw :nossal.data/db)))


Updating the visual spatial search to include an example of a polygon with holes.

--- src/cmr/demos/visual_spatial_search.clj
+++ src/cmr/demos/visual_spatial_search.clj
@@ -21,8 +21,7 @@
             [cmr.spatial.lr-binary-search :as lbs]))

 (defn polygon
-  "Creates a single ring polygon with the given ordinates. Points must be in counter clockwise order.
-  The polygon will be closed automatically."
+  "Creates a single ring polygon with the given ordinates. Points must be in counter clockwise order."
   [& ords]
   (let [polygon (p/polygon [(apply r/ords->ring ords)])
         outer (-> polygon :rings first derived/calculate-derived)]
@@ -93,6 +92,15 @@

 (comment

+  ;; A polygon with a hole
+  (let [outer (r/ords->ring -5.26,-2.59, 11.56,-2.77, 10.47,8.71, -5.86,8.63, -5.26,-2.59)
+        hole1 (r/ords->ring 6.95,2.05, 2.98,2.06, 3.92,-0.08, 6.95,2.05)
+        hole2 (r/ords->ring 5.18,6.92, -1.79,7.01, -2.65,5, 4.29,5.05, 5.18,6.92)
+        polygon-with-holes  (p/polygon [outer hole1 hole2])
+        search-area (polygon 0 0, 1 0, 1 1, 0 1, 0 0)]
+    (visual-interactive-search [polygon-with-holes] search-area))
+
+
   ;; A set of polygons and a search area that can be displayed.
   (let [polygon-ne (polygon 20 10, 30 20, 10 20, 20 10)
         polygon-se (polygon 30 -20, 20 -10, 10 -20, 30 -20)


partial fix for compatibility with clojure 1.3

git-svn-id: 03a8048b5ee8463be5048a3801110fb50f378627@8044 d0ab736e-dc22-4aeb-8dc9-08def0aa14fd

--- plugins/DataBrowser/src/org/micromanager/browser/utils.clj
+++ plugins/DataBrowser/src/org/micromanager/browser/utils.clj
@@ -20,8 +20,7 @@
            (java.awt.event ActionListener)
            (javax.swing AbstractAction BorderFactory JButton
                         JFileChooser KeyStroke SpringLayout
-                        SwingUtilities JSplitPane))
-  (:require [clojure.contrib.string :as string]))
+                        SwingUtilities JSplitPane)))

 ; clojure utils

@@ -40,8 +39,8 @@
 (defn partition-str [n s]
   (loop [rem s acc []]
     (if (pos? (.length rem))
-      (recur (string/drop n rem)
-             (conj acc (string/take n rem)))
+      (recur (.substring rem n)
+             (conj acc (.substring rem 0 n)))
       (seq acc))))

 (def pref-max-bytes (* 3/4 Preferences/MAX_VALUE_LENGTH))


Ignore movement cost on calculations

Ignore movement cost on calculations

https://github.com/orionsbelt-battlegrounds/mothership/issues/12

--- src/obb_rules/ai/alamo.cljc
+++ src/obb_rules/ai/alamo.cljc
@@ -58,7 +58,7 @@
         (into (common/rotate-attack-options game element))
         (into (common/move-attack-options game element))
         (into (common/move-options game element (common/eval-board game (element/element-player element))))
-        (->> (sort-by common/option-value-cost-sorter)))))
+        (->> (sort-by common/option-value-sorter)))))

 (defn- other-player
   "Gets the other player to play on the given board"
@@ -134,7 +134,7 @@
   (remove empty?
     (conj all (first (-> (take-best game element element-depth)
                          (consider-opponent-move element)
-                         (->> (sort-by common/option-value-cost-sorter))
+                         (->> (sort-by common/option-value-sorter))
                          (element-options-logger element))))))

 (defn- find-one


Fix namespace

Fix namespace

--- src/om_bootstrap/panel.cljs
+++ src/om_bootstrap/panel.cljs
@@ -56,7 +56,7 @@
                                   :collapsed? is-collapsed?})
              children))))

-(s/defn collapsible-panel :- t/Component
+(sm/defn collapsible-panel :- t/Component
   "Returns a collapsible panel"
   [opts :- Panel & children]
   (->collapsible-panel* {:opts opts


rename output repo directory

rename output repo directory

--- src/core.clj
+++ src/core.clj
@@ -17,7 +17,7 @@
 ;; location of the clojure & clojurescript repos to parse
 (def repo-dir "repos")

-(def docs-repo-dir "api-docs-generated")
+(def docs-repo-dir "output-repo")

 (def docs-branch "docs")
 (def examples-branch "examples")


Implement full-featured table component #45 - each cell to be a focus root for performance reasons

--- src/flatgui/samples/forms/tablewin2.clj
+++ src/flatgui/samples/forms/tablewin2.clj
@@ -18,7 +18,7 @@
             [flatgui.widgets.abstractbutton :as abstractbutton]
             [flatgui.paint :as fgp]))

-(def col-count 10)
+(def col-count 30)
 (def row-count 60)

 (def header-model-pos
@@ -28,7 +28,6 @@
 (def header-model-size
   [(mapv (fn [_] 1) (range 0 col-count))
    (mapv (fn [_] 1) (range 0 row-count))])
-

 (fgp/deflookfn cell-look1 (:theme :id :text :background :widget-type)
  [;(fgp/call-look flatgui.skins.flat/component-look)
@@ -100,7 +99,6 @@
                             ;; Strip some unneeded features
                             :look nil
                             :coord-map nil
-                            :accepts-focus? nil
                             :has-mouse nil
                             :enabled nil}}))

@@ -116,7 +114,6 @@
                           ;; Strip some unneeded features
                           :look nil
                           :coord-map nil
-                          :accepts-focus? nil
                           :has-mouse nil
                           :enabled nil}}))

@@ -124,12 +121,15 @@
   (let [ win-size (get-property [] :clip-size)]
     (m/defpoint (- (m/x win-size) 0.25) (- (m/y win-size) 0.625))))

+(def cell-prototypes
+  (let [v (mapv (fn [_] nil) (range 0 col-count))]
+    (assoc v 0 democell1)))
+
 (fg/defwidget "demotable"
   {:header-model-loc {:positions header-model-pos
                       :sizes header-model-size}
    :selection [nil nil]
-                                  ;; 0       1   2   3   4   5   6   7   8   9
-   :model-column->cell-prototype [democell1 nil nil nil nil nil nil nil nil nil]
+   :model-column->cell-prototype cell-prototypes
    :cell-prototype democell2
    :position-matrix m/identity-matrix
    :background (awt/color 32 16 8)


use log vs println for miner interrupt

use log vs println for miner interrupt

--- src/block_chain/miner.clj
+++ src/block_chain/miner.clj
@@ -26,7 +26,7 @@
           (log/info "got to nonce: " (get-in attempt [:header :nonce]) "against parent" (q/phash attempt)))
         (cond
           (blocks/meets-target? attempt) attempt
-          @interrupt (do (println "Miner interrupted.") nil)
+          @interrupt (do (log/info "****** Miner interrupted ******\nAgainst parent:" (q/phash attempt)) nil)
           :else (recur (blocks/hashed (update-in attempt [:header :nonce] inc)))))
       (finally (swap! miner-interrupts dissoc miner-id)))))