remove text from landing page drawing

remove text from landing page drawing

--- src-cljs/frontend/components/drawing.cljs
+++ src-cljs/frontend/components/drawing.cljs
@@ -398,39 +398,6 @@
      :end-y (+ (:start-y browser) 50)
      :source layer-source}))

-(defn dn-text [layer-source viewport]
-  (let [browser (browser layer-source viewport)]
-    {:tool :text
-     :text "DN"
-     :start-x (+ (:start-x browser) 44)
-     :end-x (+ (:start-x browser) 44)
-     :start-y (+ (:start-y browser) 36)
-     :end-y (+ (:start-y browser) 36)
-     :props {:layer/font-size 32}
-     :source layer-source}))
-
-(defn stories-text [layer-source viewport]
-  (let [browser (browser layer-source viewport)]
-    {:tool :text
-     :text "Stories"
-     :start-x (+ (:start-x browser) 100 15)
-     :end-x (+ (:start-x browser) 100 15)
-     :start-y (+ (:start-y browser) 30)
-     :end-y (+ (:start-y browser) 30)
-     :props {:layer/font-size 16}
-     :source layer-source}))
-
-(defn jobs-text [layer-source viewport]
-  (let [browser (browser layer-source viewport)]
-    {:tool :text
-     :text "Jobs"
-     :start-x (+ (:start-x browser) 100 88)
-     :end-x (+ (:start-x browser) 100 88)
-     :start-y (+ (:start-y browser) 30)
-     :end-y (+ (:start-y browser) 30)
-     :props {:layer/font-size 16}
-     :source layer-source}))
-
 (defn story-one-a [layer-source viewport]
   (let [browser (browser layer-source viewport)]
     {:tool :rect
@@ -498,9 +465,6 @@
   (let [browser (browser layer-source viewport)
         margins-box (margins-box layer-source viewport)
         header-line (header-line layer-source viewport)
-        dn-text (dn-text layer-source viewport)
-        stories-text (stories-text layer-source viewport)
-        jobs-text (jobs-text layer-source viewport)
         story-one-a (story-one-a layer-source viewport)
         story-one-b (story-one-b layer-source viewport)
         story-two-a (story-two-a layer-source viewport)
@@ -525,13 +489,7 @@
       (add-shape 40 margins-box)
       (add-mouse-transition 7 margins-box header-line)
       (add-shape 25 header-line)
-      (add-mouse-transition 10 header-line dn-text)
-      (add-text 10 dn-text)
-      (add-mouse-transition 7 dn-text stories-text)
-      (add-text 10 stories-text)
-      (add-mouse-transition 5 stories-text jobs-text)
-      (add-text 10 jobs-text)
-      (add-mouse-transition 15 jobs-text story-one-a)
+      (add-mouse-transition 10 header-line story-one-a)
       (add-shape 15 story-one-a)
       (add-mouse-transition 5 story-one-a story-one-b)
       (add-shape 15 story-one-b)


Better property slug.

Better property slug.

--- src-cljs/kixi/hecuba/tabs/programmes.cljs
+++ src-cljs/kixi/hecuba/tabs/programmes.cljs
@@ -106,9 +106,10 @@
   "Create a slug for a property in the UI"
   [property]
   (let [property_data (:property_data property)]
-    (assoc property :slug (str (or (:property_code property_data) "CODELESS")
-                               ", "
-                               (postal-address property_data)))))
+    (assoc property :slug (let [property_code (:property_code property)]
+                            (if-let [addr (postal-address property_data)]
+                              (str (or property_code "CODELESS") ", " addr)
+                              property_code)))))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Data Fetchers


loading before cleanup.

loading before cleanup.

--- src/clj/elephantdb/common/domain.clj
+++ src/clj/elephantdb/common/domain.clj
@@ -400,6 +400,7 @@
     (when (transfer-possible? domain version)
       (doto domain
         (status/to-loading)
+        (cleanup-domain!)
         (transfer-version! version)
         (load-version! version)
         (cleanup-domain!)))))


Pedestal reference removed from websocket ns

--- src/clj/hellhound/http/websocket.clj
+++ src/clj/hellhound/http/websocket.clj
@@ -6,7 +6,6 @@
   (:require
    [clojure.core.async                   :as async]
    [clj-uuid                             :as uuid]
-   [io.pedestal.http.immutant.websockets :as websocket]
    [hellhound.logger                     :as log]
    [hellhound.http.websocket.json        :as json]))


correct function invokation

correct function invokation

--- src/clj_money/models/attachments.clj
+++ src/clj_money/models/attachments.clj
@@ -43,7 +43,7 @@
    (with-storage [s storage-spec]
      (->> criteria
           (select-attachments s )
-          after-read))))
+          (map after-read)))))

 (defn find-by-id
   [storage-spec id]


Lesson <div> - use different <span> for module code and module name

This is to prepare for an upcoming series which will make use of the
show/hide buttons to toggle the visibility of various information within
the lesson <div>s.

Signed-off-by: Pang Yan Han <22594c345857f664c61cd411f607c4d40a9d4af9@gmail.com>

--- src/cljs/cljs_nusmods/timetable.cljs
+++ src/cljs/cljs_nusmods/timetable.cljs
@@ -959,7 +959,12 @@
   (let [$divElem  ($ "<div />" (js-obj "class" "lesson"))]
     (.addClass $divElem bgColorCssClass)
     ; add background color css class
-    (.append $divElem (text ($ "<p />") (str moduleCode " " moduleName)))
+    (.append $divElem
+             (.append ($ "<div />")
+                      (text ($ "<span />" (js-obj "class" "module-code"))
+                            (str moduleCode " "))
+                      (text ($ "<span />" (js-obj "class" "module-name"))
+                            moduleName)))
     (.append $divElem (text ($ "<p />") (str lessonType " [" lessonGroup "]")))
     (.append $divElem (text ($ "<p />") venue))
     ; make the <div> less opaque for a lesson added by jQuery UI draggable


`find-replacement-lessons-within-time` - Use more destructuring

Signed-off-by: Pang Yan Han <22594c345857f664c61cd411f607c4d40a9d4af9@gmail.com>

--- src/cljs/cljs_nusmods/timetable.cljs
+++ src/cljs/cljs_nusmods/timetable.cljs
@@ -1194,15 +1194,15 @@
     (.log js/console (str "lowTimeIdx = " lowTimeIdx ", highTimeIdx = " highTimeIdx))
     (:augTTLessonInfoMapToShift
       (reduce
-        (fn [reduceResult rowIdx]
+        (fn [{:keys [augTTLessonInfoMapToShift occupiedVec]
+              :as   reduceResult}
+             rowIdx]
           (if (timetable-row-empty? day rowIdx)
               ; Skip empty row
               reduceResult

               ; Non-empty row
-              (let [occupiedVec (:occupiedVec reduceResult)
-
-                    ttLessonInfoToShift
+              (let [ttLessonInfoToShift
                     (timetable-row-get-lessons-satisfying-pred
                       day rowIdx
                       (fn [{:keys [startTime endTime]}]
@@ -1218,16 +1218,15 @@
                            (assoc augTTLessonInfoMap
                                   (assoc ttLessonInfo :day day :rowNum rowIdx)
                                   $divElem))
-                         (:augTTLessonInfoMapToShift reduceResult)
+                         augTTLessonInfoMapToShift
                          ttLessonInfoToShift)

                  :occupiedVec
-                 (reduce (fn [occVec [ttLessonInfo _]]
+                 (reduce (fn [occVec [{:keys [startTime endTime]}  _]]
                            (.log js/console ":occupiedVec")
                            (reduce (fn [ov timeIdx] (assoc ov timeIdx true))
                                    occVec
-                                   (range (:startTime ttLessonInfo)
-                                          (:endTime ttLessonInfo))))
+                                   (range startTime endTime)))
                          occupiedVec
                          ttLessonInfoToShift)})))
         {:augTTLessonInfoMapToShift {},


Fix a problem in the vubis failure handler

--- src/cljs/mdr2/productions/vubis.cljs
+++ src/cljs/mdr2/productions/vubis.cljs
@@ -39,6 +39,7 @@
    (-> db
        (assoc-in [:errors :version] (or (get-in response [:response :status-text])
                                         (get response :status-text)))
+       (assoc-in [:loading :vubis] false)
        (notifications/clear-button-state :vubis :vubis-file))))

 (rf/reg-event-fx


Logout uri

Logout uri

--- src/cylon/oauth/impl/client.clj
+++ src/cylon/oauth/impl/client.clj
@@ -34,7 +34,7 @@

 (def APP-SESSION-ID "app-session-id")

-(defrecord WebClient [store access-token-uri]
+(defrecord WebClient [store access-token-uri location-after-logout]
   component/Lifecycle
   (start [this]
     ;; If there's an :client-registry dependency, use it to
@@ -151,9 +151,10 @@

      ::logout (fn [req]
                 (purge-session! (:session-store this) (get-session-id req APP-SESSION-ID))
-                {:status 200
-                 :body "You have logged out"
-                 })})
+                (if location-after-logout
+                  (redirect location-after-logout)
+                  {:status 200
+                   :body "You have logged out"}))})

   (routes [this] ["/" {"oauth/grant" {:get ::redirection-endpoint}
                        "logout" {:get ::logout}}])
@@ -235,6 +236,7 @@
                      :access-token-uri s/Str

                      :requires-user-acceptance? s/Bool
+                     (s/optional-key :location-after-logout) s/Str
                      })
         map->WebClient)
    [:session-store :client-registry]))


Creates an entry into the coils trigger admin table

It doesn’t make the actual trigger yet though

--- src/webapp/framework/server/systemfns.clj
+++ src/webapp/framework/server/systemfns.clj
@@ -436,7 +436,40 @@

-(defn do-real []
+
+
+
+(def coils-tables-trigger-version "1")
+
+
+
+(defn create-realtime-trigger [& {:keys [:table-name]}]
+(let [coils-trigger      (korma.core/exec-raw
+                                   [" select * from coils_triggers where table_name = ?" [table-name]]
+                                   :results)
+
+        coils-trigger-exists   (pos? (count coils-trigger))
+
+        sql-to-create-trigger "
+INSERT INTO coils_triggers
+(
+  table_name,version
+) values (?,?);
+"
+        ]
+        (println "Coils trigger table exists: " coils-trigger-exists)
+
+
+        (if (not coils-trigger-exists )
+                      (korma.core/exec-raw   [sql-to-create-trigger [table-name  coils-tables-trigger-version]]   [])
+                      nil
+        )
+
+          )
+)
+
+
+(defn do-real [& {:keys [:table-name]}]
   (let [coils-admin-tables      (korma.core/exec-raw
                                    [" select * from pg_tables where schemaname='public' and tablename='coils_triggers'" []]
                                    :results)
@@ -458,8 +491,20 @@
                       (korma.core/exec-raw   [sql-to-create-admin-table []]   [])
                       nil
         )
+
+
+
+
+            (println "table name: " table-name)
+            (create-realtime-trigger :table-name table-name)
+
   )
   )
+
+
+
+
+

@@ -494,12 +539,12 @@

        (let [
              query-key   (create-query-key
-                            :db-table db-table
-                            :where where
-                            :start start
-                            :end end
-                            :params params
-                            :order order)
+                            :db-table  db-table
+                            :where     where
+                            :start     start
+                            :end       end
+                            :params    params
+                            :order     order)
              ]

            (if (get @cached-queries  query-key)
@@ -527,7 +572,7 @@

            )

-          (do-real)
+          (do-real   :table-name db-table)

           (println "-------------------------------")
           (println "@cached-queries     " @cached-queries)


Attempt to comment test breaking

Attempt to comment test breaking

This test on breaks on CI for some reason

--- test/com/wsscode/pathom/connect_test.cljc
+++ test/com/wsscode/pathom/connect_test.cljc
@@ -1412,6 +1412,7 @@
                                    ::pc/mutate-dispatch   mutate-fn})
                     p/request-cache-plugin]}))

+#_
 #?(:clj
    (deftest test-reader-async
      (testing "read async"


Only run integs in-container.

Only run integs in-container.

--- integration-tests/project.clj
+++ integration-tests/project.clj
@@ -20,7 +20,7 @@
   :modules {:parent nil
             :inherited {:plugins [[lein-immutant "2.0.0-SNAPSHOT"]]
                         :aliases {"all"  ^:replace ["do" "clean," "test"]
-                                  "test" ^:displace ["do" "test," "immutant" "test"]}}}
+                                  "test" ^:displace ["immutant" "test"]}}}

   :aliases {"test" "do"}
   :profiles {:default [:base :system :user :provided :dev :integs]


Minor change on grid rendering on workarea.

--- frontend/uxbox/ui/workspace/workarea.cljs
+++ frontend/uxbox/ui/workspace/workarea.cljs
@@ -41,7 +41,7 @@
 (def ^:static grid-color "#cccccc")

 (defn grid-render
-  [own enabled? zoom]
+  [own zoom]
   (letfn [(vertical-line [position value padding]
             (let [ticks-mod (/ 100 zoom)
                   step-size (/ 10 zoom)]
@@ -85,6 +85,8 @@
     (let [padding (* 20 zoom)
           ticks-mod (/ 100 zoom)
           step-size (/ 10 zoom)
+          workspace (rum/react wb/workspace-state)
+          enabled? (:grid-enabled workspace false)
           vertical-ticks (range (- padding wb/document-start-y)
                                 (- wb/viewport-height wb/document-start-y padding)
                                 step-size)
@@ -107,7 +109,7 @@
   (util/component
    {:render grid-render
     :name "grid"
-    :mixins [mx/static]}))
+    :mixins [mx/static rum/reactive]}))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Viewport
@@ -116,15 +118,15 @@
 (defn viewport-render
   []
   (let [workspace (rum/react wb/workspace-state)
+        drawing? (:drawing workspace)
         zoom 1]
     (html
-     [:svg#viewport
-      {:width wb/viewport-height
-       :height wb/viewport-width}
-      [:g.zoom
-       {:transform (str "scale(" zoom ", " zoom ")")}
+     [:svg.viewport {:width wb/viewport-height
+                     :height wb/viewport-width
+                     :class (when drawing? "drawing")}
+      [:g.zoom {:transform (str "scale(" zoom ", " zoom ")")}
        (wc/canvas)
-       (grid (:grid-enabled workspace false) zoom)]])))
+       (grid zoom)]])))

 (def viewport
   (util/component


Add reinit helper function to the user ns

--- dev/user.clj
+++ dev/user.clj
@@ -64,12 +64,13 @@
   )

 (defn re-init-dev
-  ([port]
+  ([s port]
    (do
-     (stop system-s3)
-     (start system-s3 port)))
+     (stop s)
+     (start s port)))
   ([]
-   (re-init-dev 8080)))
+   (re-init-dev system-local 8080)))
+

 (defn mime-stats [path]
   (defn benchmark [file]


Ensure REPL will start with compilation errors.

Add some gymnastics to make sure we can get the REPL up even with errors
in our code.

--- dev/user.clj
+++ dev/user.clj
@@ -1,8 +1,14 @@
 (ns user
   (:require
+
+
+   ;; DO NOT ADD ANYTHING HERE THAT MIGHT REMOTELY HAVE A COMPILATION ERROR.
+   ;; THIS IS TO ENSURE WE CAN ALWAYS GET A REPL STARTED.
+   ;;
+   ;; see (init) below.
+
    [com.stuartsierra.component :as component]
    [clojure.tools.namespace.repl :refer [refresh refresh-all]]
-   [kixi.hecuba.application.system :refer (new-system)]
    [clojure.pprint :refer (pprint)]
    [clojure.reflect :refer (reflect)]
    [clojure.repl :refer (apropos dir doc find-doc pst source)]
@@ -11,8 +17,13 @@
 (defn init
   "Constructs the current development system."
   []
-  (alter-var-root #'system
-    (constantly (new-system))))
+  ;; We do some gymnastics here to make sure that the REPL can always start
+  ;; even in the presence of compilation errors.
+  (require '[kixi.hecuba.application.system])
+
+  (let [new-system (resolve 'kixi.hecuba.application.system/new-system)]
+    (alter-var-root #'system
+                    (constantly (new-system)))))

 (defn start
   "Starts the current development system."


Remove unused vars, thanks eastwood.

Remove unused vars, thanks eastwood.

--- src/oc/storage/representations/content.clj
+++ src/oc/storage/representations/content.clj
@@ -1,13 +1,9 @@
 (ns oc.storage.representations.content
   "Resource representations for OpenCompany content resources (which receive comments and reactions)."
-  (:require [defun.core :refer (defun defun-)]
+  (:require [defun.core :refer (defun-)]
             [oc.lib.hateoas :as hateoas]
             [oc.storage.config :as config]
             [oc.storage.representations.media-types :as mt]))
-
-(defn- change-url
-  ([resource-uuid]
-   (str config/change-server-url "/change/read/post/" resource-uuid)))

 (defun- interaction-url


Moved the cons in accumulate for clarity as to why we add a 0.

--- src/overtunes/songs/canone_alla_quarta.clj
+++ src/overtunes/songs/canone_alla_quarta.clj
@@ -67,7 +67,7 @@
 ;            (run [0 3 1 3 -1 0])
 ;            ))

-(defn accumulate [series] (cons 0 (reductions + series)))
+(defn accumulate [series] (reductions + (cons 0 series)))
 (def repeats (partial mapcat (partial apply repeat)))
 (def runs (partial mapcat run))


changing value of current line index

changing value of current line index

--- src/hackerrank/save_the_prisoner.clj
+++ src/hackerrank/save_the_prisoner.clj
@@ -12,7 +12,7 @@
 ; (println (get-current-path))

 (def test-file-path "resources\\test-case.txt")
-(def ^:dynamic test-file-line-current-index 0)
+(def test-file-line-current-index (atom 0))
 ; (println (slurp test-file-path))

 ; http://stackoverflow.com/questions/36579613/how-to-read-n-lines-from-a-file-in-clojure
@@ -46,6 +46,8 @@
 (defn save-the-prisoner [t]
 	nil)

-(println test-file-line-current-index)
-(set! test-file-line-current-index 1)
+(println @test-file-line-current-index)		; get value of atom
+(println test-file-line-current-index)		; get atom
+; https://en.wikibooks.org/wiki/Clojure_Programming/By_Example
+(swap! test-file-line-current-index inc)	; mutating permanent state variable
 (println test-file-line-current-index)


add a function, load-md

add a function, load-md

--- src/kalar_plugins/templates/page.clj
+++ src/kalar_plugins/templates/page.clj
@@ -12,26 +12,36 @@

 (def ^:private date-formatter (SimpleDateFormat. "yyyy-MM-dd"))

-(defn load-markdown [^String file]
-  (letfn
-    [(extract-date-from-filename [filename]
-       (-> (re-matcher  #"^\d{4}-\d{1,2}-\d{1,2}" filename) re-find format-date))
-     (format-date [date-str] (.parse date-formatter date-str))
-     (build-dest [filename]
-       (string/replace filename #"(\d{4})-(\d{1,2})-(\d{1,2})-(.+)\.(md|markdown)$" "$1/$2/$3/$4.html"))]
+(defn load-markdown
+  ([^String file]
+   (letfn
+     [(extract-date-from-filename [filename]
+        (-> (re-matcher  #"^\d{4}-\d{1,2}-\d{1,2}" filename) re-find format-date))
+      (format-date [date-str] (.parse date-formatter date-str))
+      (build-dest [filename]
+        (string/replace filename #"(\d{4})-(\d{1,2})-(\d{1,2})-(.+)\.(md|markdown)$" "$1/$2/$3/$4.html"))]

-    (let [input    (new StringReader (slurp file))
-          output   (new StringWriter)
-          filename (.getName (io/file file))
-          date     (extract-date-from-filename filename)
-          metadata (md/md-to-html input output :parse-meta? true :heading-anchors true)
-          html     (.toString output)
-          url (if (nil? (-> metadata :link first))
-                (str (:journal-path (config/read-config)) "/" (build-dest filename))
-                (-> metadata :link first))
-          dest-file (io/file (kfile/find-dest) (string/replace url #"^/" ""))]
-      (merge metadata {:body html :url url :dest-file dest-file :date date :src file}))))
+     (let [input    (new StringReader (slurp file))
+           output   (new StringWriter)
+           filename (.getName (io/file file))
+           date     (extract-date-from-filename filename)
+           metadata (md/md-to-html input output :parse-meta? true :heading-anchors true)
+           html     (.toString output)
+           url (if (nil? (-> metadata :link first))
+                 (str (:journal-path (config/read-config)) "/" (build-dest filename))
+                 (-> metadata :link first))
+           dest-file (io/file (kfile/find-dest) (string/replace url #"^/" ""))]
+       (merge metadata {:body html :url url :dest-file dest-file :date date :src file})))))

+(defn- load-md
+  "Load a markdown file."
+  ([md]
+    (let [input (new StringReader (slurp md))
+          output (new StringWriter)
+          metadata (md/md-to-html input outpu :parse-meta? true :heading-anchors true)
+          body (.toString output)]
+      (merge metadata {:body body}))
+    ))

 (defn load-md-excerpt [^String md]
   (let [compiled (load-markdown md)
@@ -79,11 +89,12 @@
           )))))

 (defn- gen-paginate-page [dir]
-  "dir is the directory where posts are put."
+  ^{:doc "dir is the directory where posts are put."}
   (letfn [(create-paginate [total paginate-url-pattern]
             (cons "index.html"
                   (map #(str/replace paginate-url-pattern #":num" (str %)) (range 2 (+ 1 total)))))]
     (let [paginate (:paginate (config/read-config))
+          ;;
           mds (map #(load-md-excerpt (.getAbsolutePath %)) (-> dir io/file .listFiles reverse))
           mdchunks (partition-all paginate mds)
           paginate (create-paginate (count mdchunks) (:paginate-path (config/read-config)))


add generate task

add generate task

--- jar-placement-lib/build.boot
+++ jar-placement-lib/build.boot
@@ -25,6 +25,7 @@
                    [environ]
                    [com.sixsq.slipstream/SlipStreamPricingLib-jar]
                    [com.sixsq.slipstream/SlipStreamClientAPI-jar]
+                   [onetom/boot-lein-generate]
                    [adzerk/boot-test]
                    [adzerk/boot-reload]
                    [tolitius/boot-check]]))))
@@ -32,6 +33,7 @@
 (require
   '[adzerk.boot-test :refer [test]]
   '[adzerk.boot-reload :refer [reload]]
+  '[boot.lein :refer [generate]]
   '[tolitius.boot-check :refer [with-yagni with-eastwood with-kibit with-bikeshed]])

 (set-env!


Implement open

Implement open

--- src/caesium/magicnonce/secretbox.clj
+++ src/caesium/magicnonce/secretbox.clj
@@ -142,7 +142,7 @@
   Analogous to [[caesium.crypto.secretbox/secretbox-open-easy]]."
   [^bytes nonced-ctext ^bytes key]
   (let [out (byte-array (- (alength nonced-ctext) s/noncebytes s/macbytes))]
-    ))
+    (open-to-buf! out nonced-ctext key)))

 (defn decrypt-to-buf!
   "Like [[open-to-buf!]], but with different argument order."


fix remove public chat bug

fix remove public chat bug

Signed-off-by: yenda <96f164ad4d9b2b0dacf8ebee2bb1eeb3aa69adf1@status.im>

--- src/status_im/ui/screens/chat/actions.cljs
+++ src/status_im/ui/screens/chat/actions.cljs
@@ -49,7 +49,7 @@
   [view-my-wallet
    (share-chat chat-id)
    (clear-history)
-   (delete-chat chat-id true)])
+   (delete-chat chat-id false)])

 (defn actions [group-chat? chat-id public?]
   (cond


fibo perf

fibo perf

--- src/clj/algorithms_clj/perf_fibo.clj
+++ src/clj/algorithms_clj/perf_fibo.clj
@@ -106,8 +106,8 @@

 (defn run-bench*
   [name f n]
-  (println name ": ------------------------------")
-  (perf/quick-bench (f n)))
+  (println "\n" name ": ------------------------------")
+  (perf/bench (f n)))

 (defmacro run-bench
   [[f n]]


fix gnucash scheduled trans interpretation

--- src/clj/clj_money/import/gnucash.clj
+++ src/clj/clj_money/import/gnucash.clj
@@ -357,7 +357,7 @@
                                                                  (map (juxt (comp keyword :key)
                                                                             :value))
                                                                  (into {}))]
-                                                      (if (:credit-formula m)
+                                                      (if (seq (:credit-formula m))
                                                         [[:action :credit]
                                                          [:quantity (:credit-formula m)]
                                                          [:account-id (:account m)]]


Small UI tweaks

Small UI tweaks

--- src/cljs/love_letter_cljs/views.cljs
+++ src/cljs/love_letter_cljs/views.cljs
@@ -354,7 +354,7 @@
        [:button {:on-click #(dispatch [:new-game])} "New Game"]

        [:h3.text-center (str "Player " @current-player-id ", go!")]
-       [:h3.text-center (str (s/capitalize (name @phase)) " " @resolvable?)]
+       #_[:h3.text-center (str (s/capitalize (name @phase)) " " @resolvable?)]

        [:div#draw-pile {:style {:position "absolute" :left "27%" :bottom "60%"}}
         [draw-deck (str (count @deck))]]
@@ -365,8 +365,8 @@
        [:div#player-display {:style {:position "absolute" :left "80%" :top "20%"}}
         [player-display @current-player-id @players]]

-       [:div#player-display {:style {:position "absolute" :left "30%" :top "60%"}}
-        [:h6.text-center "Message Log"]
+       [:div#player-display {:style {:position "absolute" :left "0%" :top "45%" :width "100%"}}
+        [:h6.text-left "Message Log"]
         [game-log]]


removed SVG obsolete code

removed SVG obsolete code

--- src/cljs/passa_paraula/ui/views.cljs
+++ src/cljs/passa_paraula/ui/views.cljs
@@ -14,27 +14,6 @@
 (def cur-letter-color "purple")
 (def letter-color "black")
 (def letter-width "1")
-
-(def highlight-letter-color "orange")
-(def highlight-letter-width "5")
-
-
-
-(defn svg-letter-circle-component
-  [x y pos letter]
-  [:g {:transform (str "translate(" x "," y ")")}
-   ^{:key pos}
-   [:circle {:id pos
-             :r (:circle-radius @ui-state)
-             :stroke (if (= pos (game/cur-letter-id))
-                       highlight-letter-color
-                       letter-color)
-             :strokeWidth (if (= pos (game/cur-letter-id))
-                             highlight-letter-width
-                             letter-width)
-             :fill (get status-colors (game/get-letter-status pos)) }]
-   [:text {:dx "-5" :dy "5"} letter]])
-

 (defn set-letter-color [pos]
   (if (= pos (game/cur-letter-id))
@@ -74,12 +53,6 @@
    [:div
     (for [circle (build-circles)]
       [letter-circle-component (:x circle) (:y circle) (:pos circle) (:letter circle)])]])
-
-
-(defn svg-board-component []
-  [:svg {:height "500" :width "500"}
-   (for [circle (build-circles)]
-     [svg-letter-circle-component (:x circle) (:y circle) (:pos circle) (:letter circle)])])

 (defn format-time [t]


Use reference FASTA when pileuping

Use reference FASTA when pileuping

--- src/clojure/cljam/pileup/mpileup.clj
+++ src/clojure/cljam/pileup/mpileup.clj
@@ -3,25 +3,12 @@
             [cljam.cigar :as cgr]
             [cljam.sequence :as cseq]
             [cljam.io :as io]
+            [cljam.fasta :as fa]
             [cljam.util :refer [ubyte]]
             [cljam.util.sam-util :refer [phred->fastq fastq->phred]]
             [cljam.pileup.common :refer [window-width step center]]
-            [cljam.pileup.pileup :refer [rpositions]]))
-
-(defn- wrap
-  [rname positions counts seq qual]
-  (map (fn [{:keys [pos count qual seq]}]
-         {:rname rname
-          :pos pos
-          :ref \N ; FIXME
-          :count count
-          :seq seq
-          :qual qual})
-       (map merge
-            (map (partial hash-map :pos) positions)
-            (map (partial hash-map :count) counts)
-            (map (partial hash-map :qual) qual)
-            (map (partial hash-map :seq) seq))))
+            [cljam.pileup.pileup :refer [rpositions]])
+  (:import cljam.fasta.FASTAReader))

 (defn- pickup-qual [aln pos]
   (if (= (:qual aln) "*")
@@ -84,11 +71,37 @@
                (PileupStatus. 0 nil nil))) positions))
     (repeat (count positions) (PileupStatus. 0 nil nil))))

+(defn- pickup-ref
+  [ref-line pos]
+  (let [idx (- pos (:offset ref-line))]
+    (if (neg? idx)
+      \N
+      (if-let [ref (nth (:seq ref-line) idx)]
+        ref
+        \N))))
+
+(defn- wrap
+  [rname ref-line positions counts seq qual]
+  (map (fn [{:keys [pos count qual seq]}]
+         {:rname rname
+          :pos   pos
+          :ref   (if (nil? ref-line)
+                   \N
+                   (pickup-ref ref-line pos))
+          :count count
+          :seq   seq
+          :qual  qual})
+       (map merge
+            (map (partial hash-map :pos) positions)
+            (map (partial hash-map :count) counts)
+            (map (partial hash-map :qual) qual)
+            (map (partial hash-map :seq) seq))))
+
 (defn- count-for-positions
-  [alns rname positions]
+  [alns ref-line rname positions]
   (if (pos? (count alns))
     (let [cfas (map #(count-for-alignment % rname positions) alns)]
-      (wrap rname positions
+      (wrap rname ref-line positions
             (apply map (fn [& args]
                          (reduce + (map :count args))) cfas)
             (apply map (fn [& args]
@@ -118,6 +131,12 @@
                              :end right
                              :depth :deep})))

+(defn- read-ref-fasta-line
+  [fa-rdr rname]
+  (if-not (nil? fa-rdr)
+   (first
+    (filter #(= (:rname %) rname) (fa/read fa-rdr)))))
+
 (defn- search-ref
   [refs rname]
   (first
@@ -125,25 +144,27 @@
            refs)))

 (defn- pileup*
-  ([rdr ^String rname ^Long rlength ^Long start ^Long end]
+  ([rdr ^FASTAReader fa-rdr ^String rname ^Long rlength ^Long start ^Long end]
      (flatten
       (let [parts (partition-all step (rpositions start end))]
         (map (fn [positions]
                (let [^Long pos (if (= (count positions) step)
                                  (nth positions center)
                                  (nth positions (quot (count positions) 2)))
-                     ^clojure.lang.LazySeq alns (read-alignments rdr rname rlength pos)]
-                 (count-for-positions alns rname positions)))
+                     ^clojure.lang.LazySeq alns (read-alignments rdr rname rlength pos)
+                     ref-line (read-ref-fasta-line fa-rdr rname)]
+                 (count-for-positions alns ref-line rname positions)))
              parts)))))

 (defn pileup
   ([rdr ^String rname]
      (pileup rdr rname -1 -1))
-  ([rdr ^String rname ^Long start* ^Long end*]
+  ([rdr ^String rname ^Long start* ^Long end* & {:keys [ref-fasta] :or {ref-fasta nil}}]
      (let [r (search-ref (.refs rdr) rname)]
        (if (nil? r)
          nil
          (pileup* rdr
+                  ref-fasta
                   rname (:len r)
                   (if (neg? start*) 0 start*)
                   (if (neg? end*) (:len r) end*))))))


correct def-fx type -> :async-flow

correct def-fx type -> :async-flow

--- src/day8/re_frame/async_flow_fx.cljs
+++ src/day8/re_frame/async_flow_fx.cljs
@@ -121,7 +121,7 @@
 ;; -- Register effects handler with re-frame

 (re-frame/def-fx
-  :aync-flow
+  :async-flow
   (fn [{:as flow :keys [id]}]
     (re-frame/def-event-fx
       (or id default-id)                                 ;; add debug middleware if dp-patth set ???  XXX


fix throw-str test

fix throw-str test

--- test/com/billpiel/mem_tracer/core_test.clj
+++ test/com/billpiel/mem_tracer/core_test.clj
@@ -331,7 +331,7 @@

                 (fact "string output is correct"
                       (remove-iso-ctrl (mt/entry->string trace))
-                      => "[31m  [m[33m [33m| com.billpiel.mem-tracer.test.ns1/func-throws[m [33m| [33m:a[0m[m")
+                      => "[31m  [m[33m [33m| com.billpiel.mem-tracer.test.ns1/func-throws[m [33m| [33m:a[0m[m [33m| [1;37;41mTHROW[m => [35m\"Exception from func-throws: :a\"[0m [33m| [31m[[0m[35m\"com.billpiel.mem_tracer.test.ns1$func_throws ns1.clj:14\"[0m[31m][0m[m")

                 (mt/untrace-ns 'com.billpiel.mem-tracer.test.ns1))))


Fix context ordered-list.

Fix context ordered-list.

--- messaging/src/immutant/messaging.clj
+++ messaging/src/immutant/messaging.clj
@@ -40,9 +40,9 @@
    than rely on the messaging functions to lazily create them as
    needed:

-   1) for communicating with a remote HornetQ instance
-   2) for sharing a context among a batch of messaging operations
-   3) for decoupling the client-id from the subscription name for
+   1. for communicating with a remote HornetQ instance
+   2. for sharing a context among a batch of messaging operations
+   3. for decoupling the client-id from the subscription name for
       durable topic subscriptions (see [[subscribe]])

    You are responsible for closing any contexts created via this


some helpers for working with nimbus storage has been added

--- src/clj/backtype/storm/nimbus/storage.clj
+++ src/clj/backtype/storm/nimbus/storage.clj
@@ -1,8 +1,9 @@
 (ns backtype.storm.nimbus.storage
   (:import [java.io InputStream OutputStream FileInputStream FileOutputStream File])
   (:import [java.util List Map])
-  (:import [org.apache.commons.io FileUtils])
+  (:import [org.apache.commons.io FileUtils IOUtils])
   (:use [backtype.storm log config util])
+  (:import [backtype.storm.utils Utils])
   (:import [backtype.storm.nimbus INimbusStorage]))

 (defn create-local-storage [conf]
@@ -48,3 +49,19 @@
     (create-custom-storage storage-name conf)
     (create-local-storage conf)))

+(defn upload-file-to-storage [file storage path]
+  (let [stream (.create storage path)]
+    (try
+      (IOUtils/copy (FileInputStream. file) stream)
+      (finally (.close stream)))))
+
+(defn ensure-clean-dir-in-storage [storage path]
+  (.mkdirs storage path)
+  (if-let [files (.list storage path)]
+    (.delete storage files)))
+
+(defn serialize-to-storage [obj storage path]
+  (let [stream (.create storage path)]
+    (try
+      (IOUtils/write (Utils/serialize obj) stream)
+      (finally (.close stream)))))


Move missplace param

Move missplace param

--- src/clj/collect_earth_online/db/users.clj
+++ src/clj/collect_earth_online/db/users.clj
@@ -151,7 +151,7 @@
     (if-let [error-msg (get-password-reset-errors user email reset-key password password-confirmation)]
       (data-response error-msg)
       (do
-        (call-sql {:log? false} "update_password" email password)
+        (call-sql "update_password" {:log? false} email password)
         (data-response "")))))

 (defn- get-verify-email-errors [user email reset-key]


fixed return type of integer_factors

fixed return type of integer_factors

--- src/clojush/problems/tozier/winkler01.clj
+++ src/clojush/problems/tozier/winkler01.clj
@@ -100,7 +100,7 @@
   (fn [state]
     (if (not (empty? (:integer state)))
       (push-item (keep-number-reasonable (sort (prime-factors-as-sorted-vector (stack-ref :integer 0 state))))
-                 :integer
+                 :vector_integer
                  (pop-item :integer state))
       state)))


add undefined as known global so it doesn't end up in externs

doesn't hurt anything but shouldn't be there

--- src/main/shadow/build/closure.clj
+++ src/main/shadow/build/closure.clj
@@ -276,6 +276,7 @@
          postMessage
          process
          require
+         undefined
          WebSocket
          Worker
          XMLHttpRequest


remove cli version print

remove cli version print

confuses everyone using lein/deps thinking thats the relevant
version when it isn't.

--- src/main/shadow/cljs/npm/cli.cljs
+++ src/main/shadow/cljs/npm/cli.cljs
@@ -819,7 +819,7 @@
                 (log "shadow-cljs - server pid exists but server appears to be dead, proceeding without server.")
                 (fs/unlinkSync server-pid-file))

-              (log "shadow-cljs - config:" config-path " cli version:" version " node:" js/process.version)
+              (log "shadow-cljs - config:" config-path)

               (cond
                 (or (:cli-info options)


Fix serious bug in parsing of forall lists

--- src/edu/berkeley/ai/util/propositions.clj
+++ src/edu/berkeley/ai/util/propositions.clj
@@ -116,7 +116,7 @@

 (defn parse-pddl-conjunction-forall [conj]
   (let [{:keys [pos neg forall]}
-	(group-by #(cond (= (first %) 'not) :not (= (first %) 'forall) :forall :else :pos)
+	(group-by #(cond (= (first %) 'not) :neg (= (first %) 'forall) :forall :else :pos)
 		  (pddl-conjunction->seq conj))]
     [pos
      (map (fn [term] (assert-is (= 2 (count term))) (second term)) neg)


updating example solution with suggestions from @haus

--- exercises/secret-handshake/src/example.clj
+++ exercises/secret-handshake/src/example.clj
@@ -1,17 +1,19 @@
 (ns secret-handshake)

-(defn- to-binary-seq [integer]
-  (reverse (seq (Integer/toString integer 2))))
+(defn- int->reversed-binary [int]
+  (-> int
+      (Integer/toBinaryString)
+      (reverse)))

 (defn- convert [integer]
   (filter some?
           (map (fn [command binary]
                  (if (= \1 binary) command))
                ["wink" "double blink" "close your eyes" "jump"]
-               (to-binary-seq integer))))
+               (int->reversed-binary integer))))

 (defn commands [integer]
   (let [cmds (convert integer)]
-    (if (= \1 (nth (to-binary-seq integer) 4 \0))
+    (if (= \1 (nth (int->reversed-binary integer) 4 \0))
       (reverse cmds)
       cmds)))


Mark function as private

Mark function as private

--- src/io/aviso/rook/jetty_async_adapter.clj
+++ src/io/aviso/rook/jetty_async_adapter.clj
@@ -13,7 +13,7 @@
      [response :as r]]
     [ring.adapter.jetty :as jetty]))

-(defn customized-proxy-handler
+(defn- customized-proxy-handler
   [handler]
   (proxy [AbstractHandler] []
     (handle [_ ^Request base-request request response]


ensure metadata is not lost in syntax-quoted forms

--- src/main/clojure/clojure/tools/reader.clj
+++ src/main/clojure/clojure/tools/reader.clj
@@ -514,9 +514,11 @@
     ret))

 (defn- syntax-quote-coll [type coll]
-  (let [res (list 'clojure.core/sequence
-                  (cons 'clojure.core/concat
-                        (expand-list coll)))]
+  (let [res (list 'clojure.core/rest
+                  (list 'clojure.core/sequence
+                        (list 'clojure.core/seq
+                              (cons 'clojure.core/concat
+                                    (expand-list coll)))))]
     (if type
       (list 'clojure.core/apply type res)
       res)))


dial back the update frequency to a normal cadence.

--- src/metabase/task/upgrade_checks.clj
+++ src/metabase/task/upgrade_checks.clj
@@ -47,7 +47,6 @@
                                    (triggers/start-now)
                                    (triggers/with-schedule
                                      ;; run twice a day
-                                     ;(cron/cron-schedule "0 15 6,18 * * ? *")
-                                     (cron/cron-schedule "15,45 * * * * ? *"))))
+                                     (cron/cron-schedule "0 15 6,18 * * ? *"))))
   ;; submit ourselves to the scheduler
   (task/schedule-task! @upgrade-checks-job @upgrade-checks-trigger))


Concat instead.

Concat instead.

--- src/onyx/coordinator/log/datomic.clj
+++ src/onyx/coordinator/log/datomic.clj
@@ -144,9 +144,8 @@
                                    (last-offered-job db))
         inactive-candidates (mapcat (partial next-inactive-task db) job-seq)
         active-candidates (mapcat (partial next-active-task db) job-seq)]
-    (or (seq (filter identity inactive-candidates))
-        (seq (filter identity active-candidates))
-        [])))
+    (concat (filter identity inactive-candidates)
+            (filter identity active-candidates))))

 (defn select-nodes [ent]
   (select-keys ent [:node/peer :node/payload :node/ack


Multimethod for reaction in submit job.

Multimethod for reaction in submit job.

--- src/onyx/log/commands/submit_job.clj
+++ src/onyx/log/commands/submit_job.clj
@@ -19,21 +19,30 @@
   [{:keys [args]} old new]
   {:job (:id args)})

+(defmulti reallocate?
+  (fn [scheduler old new state]
+    scheduler))
+
+(defmethod reallocate? :onyx.job-scheduler/greedy
+  [scheduler old new state]
+  (not (seq (common/alive-jobs old (:jobs old)))))
+
+(defmethod reallocate? :onyx.job-scheduler/round-robin
+  [scheduler old new state]
+  (if-let [allocation (common/peer->allocated-job (:allocations new) (:id state))]
+    (let [peer-counts (common/balance-jobs new)
+          peers (get (common/job->peers new) (:job allocation))]
+      (when (> (count peers) (get peer-counts (:job allocation)))
+        (let [n (- (count peers) (get peer-counts (:job allocation)))
+              peers-to-drop (common/drop-peers new (:job allocation) n)]
+          (when (some #{(:id state)} (into #{} peers-to-drop))
+            true))))
+    true))
+
 (defmethod extensions/reactions :submit-job
   [entry old new diff peer-args]
-  (cond (and (= (:job-scheduler old) :onyx.job-scheduler/greedy)
-             (not (seq (common/alive-jobs old (:jobs old)))))
-        [{:fn :volunteer-for-task :args {:id (:id peer-args)}}]
-        (= (:job-scheduler old) :onyx.job-scheduler/round-robin)
-        (if-let [allocation (common/peer->allocated-job (:allocations new) (:id peer-args))]
-          (let [peer-counts (common/balance-jobs new)
-                peers (get (common/job->peers new) (:job allocation))]
-            (when (> (count peers) (get peer-counts (:job allocation)))
-              (let [n (- (count peers) (get peer-counts (:job allocation)))
-                    peers-to-drop (common/drop-peers new (:job allocation) n)]
-                (when (some #{(:id peer-args)} (into #{} peers-to-drop))
-                  [{:fn :volunteer-for-task :args {:id (:id peer-args)}}]))))
-          [{:fn :volunteer-for-task :args {:id (:id peer-args)}}])))
+  (when (reallocate? (:job-scheduler old) old new peer-args)
+    [{:fn :volunteer-for-task :args {:id (:id peer-args)}}]))

 (defmethod extensions/fire-side-effects! :submit-job
   [entry old new diff state]


CMR-5282: Fixed DataGranule DayNightFlag parsing and generating in UMM-G to work with ISO SMAP granules.

--- umm-spec-lib/src/cmr/umm_spec/umm_g/data_granule.clj
+++ umm-spec-lib/src/cmr/umm_spec/umm_g/data_granule.clj
@@ -2,10 +2,22 @@
   "Contains functions for parsing UMM-G JSON DataGranule into umm-lib granule model
    DataGranule and generating UMM-G JSON DataGranule from umm-lib granule model DataGranule."
   (:require
-   [cmr.umm.umm-granule :as g]
+   [clojure.set :as set]
    [clojure.string :as string]
-   [cmr.umm-spec.util :as util])
+   [cmr.umm-spec.util :as util]
+   [cmr.umm.umm-granule :as g])
   (:import cmr.umm.umm_granule.UmmGranule))
+
+(def umm-lib-day-night->umm-g-day-night
+  "Defines the day night flag mapping between umm-lib and UMM-G models."
+  {"DAY" "Day"
+   "NIGHT" "Night"
+   "BOTH" "Both"
+   "UNSPECIFIED" "Unspecified"})
+
+(def umm-g-day-night->umm-lib-day-night
+  "Defines the day night flag mapping between UMM-G and umm-lib models."
+  (set/map-invert umm-lib-day-night->umm-g-day-night))

 (defn umm-g-data-granule->DataGranule
   "Returns the umm-lib granule model DataGranule from the given UMM-G DataGranule."
@@ -14,7 +26,7 @@
     (g/map->DataGranule
       (let [{:keys [Identifiers DayNightFlag ProductionDateTime
                     ArchiveAndDistributionInformation]} data-granule]
-        {:day-night (string/upper-case DayNightFlag)
+        {:day-night (get umm-g-day-night->umm-lib-day-night DayNightFlag "UNSPECIFIED")
          :producer-gran-id (->> Identifiers
                                 (some #(when (= "ProducerGranuleId" (:IdentifierType %)) %))
                                 :Identifier)
@@ -35,7 +47,7 @@
   (when data-granule
     (let [{:keys [producer-gran-id day-night crid-ids feature-ids
                   production-date-time size]} data-granule]
-      {:DayNightFlag (string/capitalize day-night)
+      {:DayNightFlag (get umm-lib-day-night->umm-g-day-night day-night "Unspecified")
        :Identifiers (let [producer-gran-id (when producer-gran-id
                                              [{:Identifier producer-gran-id
                                                :IdentifierType "ProducerGranuleId"}])


Stop printing every save

Stop printing every save

--- src/hundred_pushups/events.cljs
+++ src/hundred_pushups/events.cljs
@@ -150,13 +150,12 @@
 (reg-event-fx
  :db/save.er
  (fn [_world event]
-   (println event)
    {}))

 (reg-event-fx
  :db/save.ok
  (fn [_world event]
-   (println event)))
+   {}))

 (reg-event-fx
  :db/save


Comment

Comment

--- src/re_frame_async_flow_fx/core.cljs
+++ src/re_frame_async_flow_fx/core.cljs
@@ -107,6 +107,8 @@
                  :dispatch (concat (map :dispatch ready-tasks))}))))

+;; -- Register handler with re-frame
+
 (re-frame.core/def-fx
   :aync-flow
   (fn [{:as flow :keys [id]}]


fix build-reports incorrectly marking CLJS deps as duplicates

made everything red when using multiple :modules, is only supposed
to mark duplicated npm packages as red.

--- src/main/shadow/cljs/build_report/ui.cljs
+++ src/main/shadow/cljs/build_report/ui.cljs
@@ -240,15 +240,16 @@
   (sg/render rt-ref root-el (ui-root)))

 (defn check-dupes [db]
-  (let [groups
-        (db/all-of db :group)
+  (let [npm-groups
+        (->> (db/all-of db :group)
+             (filter #(= :npm (:group-type %))))

         group-dupes
         (reduce
           (fn [m {:keys [group-name] :as group}]
             (update m group-name conj-set (:db/ident group)))
           {}
-          groups)]
+          npm-groups)]

     (reduce-kv
       (fn [db group-name group-ids]


Fix group commands

Fix group commands

--- src/status_im/chat/events/input.cljs
+++ src/status_im/chat/events/input.cljs
@@ -245,7 +245,7 @@
             metadata
             args]
      :as   content} :content
-    :keys  [chat-id jail-id data-type event-after-creator message-id current-time]}]
+    :keys  [chat-id group-id jail-id data-type event-after-creator message-id current-time]}]
   (let [{:keys [dapp? dapp-url name]} (get contacts chat-id)
         metadata        (merge metadata
                                (when dapp?
@@ -267,6 +267,7 @@

         request-data    {:message-id   message-id
                          :chat-id      chat-id
+                         :group-id     group-id
                          :jail-id      (or owner-id jail-id)
                          :content      {:command       (:name command)
                                         :scope-bitmask (:scope-bitmask command)
@@ -290,25 +291,27 @@
   If it's normal command instead (determined by nil response to `:on-send` jail request),
   processing continues by requesting command preview before actually sending the command
   message."
-  [{:keys [current-chat-id] :as db} {{:keys [bot]} :command :as content} message-id current-time]
-  (let [params-template          {:content      content
-                                  :chat-id      current-chat-id
-                                  :jail-id      (or bot current-chat-id)
-                                  :message-id   message-id
-                                  :current-time current-time}
-        on-send-params           (merge params-template
-                                        {:data-type           :on-send
-                                         :event-after-creator (fn [_ jail-response]
-                                                                [::check-command-type
-                                                                 jail-response
-                                                                 params-template])})
-        after-validation-events  [[::request-command-data on-send-params]]
-        validation-params        (merge params-template
-                                        {:data-type           :validator
-                                         :event-after-creator (fn [_ jail-response]
-                                                                [::proceed-validation
-                                                                 jail-response
-                                                                 after-validation-events])})]
+  [{:keys [current-chat-id chats] :as db} {{:keys [bot]} :command :as content} message-id current-time]
+  (let [params-template         {:content      content
+                                 :chat-id      current-chat-id
+                                 :group-id     (when (get-in chats [current-chat-id :group-chat])
+                                                 current-chat-id)
+                                 :jail-id      (or bot current-chat-id)
+                                 :message-id   message-id
+                                 :current-time current-time}
+        on-send-params          (merge params-template
+                                       {:data-type           :on-send
+                                        :event-after-creator (fn [_ jail-response]
+                                                               [::check-command-type
+                                                                jail-response
+                                                                params-template])})
+        after-validation-events [[::request-command-data on-send-params]]
+        validation-params       (merge params-template
+                                       {:data-type           :validator
+                                        :event-after-creator (fn [_ jail-response]
+                                                               [::proceed-validation
+                                                                jail-response
+                                                                after-validation-events])})]
     (request-command-data db validation-params)))

 ;;;; Handlers


indentation part 2

indentation part 2

--- src/metabase/events/metabot_lifecycle.clj
+++ src/metabase/events/metabot_lifecycle.clj
@@ -32,7 +32,7 @@
           (cond
             (nil? slack-token)      (metabot/stop-metabot!)
             (not metabot-enabled)   (metabot/stop-metabot!)
-             :else (metabot/restart-metabot!))))
+            :else                   (metabot/restart-metabot!))))
       (catch Throwable e
         (log/warn (format "Failed to process driver notifications event. %s" topic) e)))))


(maint) Update version for 6.5.0 release

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(def ps-version "6.4.1-SNAPSHOT")
+(def ps-version "6.5.0-SNAPSHOT")
 ;; This should go away when we move to using clj-parent for jetty9 3.x
 (def jetty9-version "3.0.1")


bump attempts threshold to 10

bump attempts threshold to 10

--- src/metabase/api/common/throttle.clj
+++ src/metabase/api/common/throttle.clj
@@ -72,7 +72,7 @@

 (def ^:private ^:const throttler-defaults
   {:initial-delay-ms   (* 15 1000)
-   :attempts-threshold 5
+   :attempts-threshold 10
    :delay-exponent     1.5
    :attempt-ttl-ms     (* 1000 60 60)})


Switch from atom to var

Switch from atom to var

--- src/midje/internal_ideas/fact_context.clj
+++ src/midje/internal_ideas/fact_context.clj
@@ -3,22 +3,12 @@
   midje.internal-ideas.fact-context
   (:use [clojure.string :only [join]]))

-(def fact-context (atom []))
+(def ^{:dynamic true} *fact-context* [])

 (defn nested-descriptions []
-  @fact-context)
-
-(defn- enter-runtime-context [description]
-  (swap! fact-context conj description))
-
-(defn- leave-runtime-context []
-  (swap! fact-context #(vec (butlast %))))
+  *fact-context*)

 (defmacro within-runtime-fact-context [description & body]
-  `(try
-     (#'enter-runtime-context ~description)
-     ~@body
-     (finally
-       (#'leave-runtime-context))))
+  `(binding [*fact-context* (conj *fact-context* ~description)]
+     ~@body))

-


Scroll to selection after refreshing tree

--- src/net/sekao/nightcode/projects.clj
+++ src/net/sekao/nightcode/projects.clj
@@ -169,7 +169,9 @@
            (.select selection-model item))))
      ; select the first project if there is nothing selected
      (when (= -1 (.getSelectedIndex selection-model))
-       (.select selection-model (int 0))))))
+       (.select selection-model (int 0)))
+     ; update scroll position
+     (.scrollTo tree (.getSelectedIndex selection-model)))))

 (fdef update-project-tree-selection!
   :args (s/cat :tree spec/pane? :selection string?))


Refactor 1011

Refactor 1011

--- solutions/uri/1011/1011.clj
+++ solutions/uri/1011/1011.clj
@@ -6,7 +6,10 @@
   (loop [line (read-line)]
     (when line
        (let [radius (Double/parseDouble line)]
-         (printf "VOLUME = %.3f%n" (*(*(/ 4.0 3.0) pi) (Math/pow radius 3))))
+         (printf "VOLUME = %.3f%n"
+                 (-> (/ 4.0 3.0)
+                     (* pi)
+                     (* (Math/pow radius 3)))))
        (recur (read-line)))))

 (main)


Incorporate the servlet mapping to get the :path arg

--- web/src/immutant/web/internal/servlet.clj
+++ web/src/immutant/web/internal/servlet.clj
@@ -59,7 +59,7 @@
   (character-encoding [request] (.getCharacterEncoding request))
   (headers [request]            (i/headers->map request))
   (body [request]               (.getInputStream request))
-  (context [request]            (.getContextPath request))
+  (context [request]            (str (.getContextPath request) (.getServletPath request)))
   (path-info [request]          (.getPathInfo request))
   (ssl-client-cert [request]    (first (.getAttribute request "javax.servlet.request.X509Certificate"))))


Update Leiningen user profile

Update Leiningen user profile

- Setup Alembic
- Add lein-ancient
- Change page size to 50

--- clojure/lein.symlink/profiles.clj
+++ clojure/lein.symlink/profiles.clj
@@ -1,13 +1,15 @@
 {:user {:signing {:gpg-key "8ED1CE42"}

-        :dependencies [[clj-stacktrace "0.2.7"]
+        :dependencies [[alembic "0.2.1"]
+                       [clj-stacktrace "0.2.7"]
+                       [criterium "0.4.2"]
                        [org.clojure/tools.namespace "0.2.4"]
                        [slamhound "1.3.1"]
-                       [spyscope "0.1.4"]
-                       [criterium "0.4.2"]]
+                       [spyscope "0.1.4"]]

         :plugins [[codox "0.6.6"]
                   [jonase/eastwood "0.0.2"]
+                  [lein-ancient "0.5.4"]
                   [lein-cljsbuild "1.0.0"]
                   [lein-clojars "0.9.1"]
                   [lein-cloverage "1.0.2"]
@@ -17,10 +19,12 @@
                   [lein-pprint "1.1.1"]
                   [lein-swank "1.4.4"]]

-        :injections [(require 'spyscope.core
-                              '[clojure.repl :refer [source]]
-                              '[clojure.tools.namespace.repl :as repl]
-                              '[criterium.core :refer [bench quick-bench]])]
+        :injections [(require
+                      '[alembic.still :refer [distill]]
+                      '[clojure.repl :refer [source]]
+                      '[clojure.tools.namespace.repl :as repl]
+                      '[criterium.core :refer [bench quick-bench]]
+                      'spyscope.core)]

         :aliases {"slamhound" ["run" "-m" "slam.hound"]}
-        :search-page-size 30}}
+        :search-page-size 50}}


Add cloverage to lein plugins

Add cloverage to lein plugins

--- clojure/lein.symlink/profiles.clj
+++ clojure/lein.symlink/profiles.clj
@@ -1,9 +1,11 @@
 {:user {:dependencies [[slamhound "1.3.1"]
                        [org.clojure/tools.namespace "0.2.4"]
                        [clj-stacktrace "0.2.7"]]
-        :plugins [[lein-difftest "2.0.0"]
+
+        :plugins [[lein-pprint "1.1.1"]
+                  [lein-difftest "2.0.0"]
+                  [lein-cloverage "1.0.2"]
                   [lein-marginalia "0.7.1"]
-                  [lein-pprint "1.1.1"]
                   [lein-swank "1.4.4"]
                   [lein-kibit "0.0.8"]]


Fix tile layout

Fix tile layout

--- android/src/clojure/net/nightweb/views.clj
+++ android/src/clojure/net/nightweb/views.clj
@@ -51,15 +51,14 @@
                       [:text-view {:text-color Color/WHITE
                                    :layout-width :fill
                                    :layout-weight 1}]
-                      [:linear-layout {:orientation 0}
+                      [:linear-layout {:orientation 0
+                                       :layout-width :fill}
                        [:text-view {:text-color Color/WHITE
                                     :single-line true
-                                    :layout-width :fill
-                                    :layout-height :fill
                                     :layout-weight 1
                                     :ellipsize end}]
                        [:text-view {:text-color Color/WHITE
-                                    :layout-width :fill}]]]])
+                                    :single-line true}]]]])
         ^ImageView image (.getChildAt tile-view 0)
         ^LinearLayout linear-layout (.getChildAt tile-view 1)
         ^TextView text-top (.getChildAt linear-layout 0)


Fix test-case for concept stability

Fix test-case for concept stability

Signed-off-by: Daniel Borchmann <3d0f3b9ddcacec30c4008c5e030e6c13a478cb4f@algebra20.de>

--- src/test/clojure/conexp/fca/misc_test.clj
+++ src/test/clojure/conexp/fca/misc_test.clj
@@ -137,5 +137,5 @@
                           (* (concept-stability context [A B])
                              (expt 2 (count A))))
                         (concepts context)))
-         (expt 2 (count (attributes context)))))))
+         (expt 2 (count (objects context)))))))


Eliminate resolve/resolve* distinction

Eliminate resolve/resolve* distinction

--- test-cljs/frontend/test_send.cljs
+++ test-cljs/frontend/test_send.cljs
@@ -316,28 +316,27 @@
        (doto to (put! v) (close!)))))
   to)

-(defn resolve* [context mapping children]
-  (async/pipe
-   (async/merge
-    (for [ast children
-          :let [read-from-key (get-in ast [:params :<] (:key ast))]]
-      (if (contains? mapping read-from-key)
-        (let [resolver (get mapping read-from-key)]
-          (pipe-values (resolver context ast)
-                       (chan 1 (map #(hash-map (:key ast) %)))))
-        (if-let [[keys resolver]
-                 (first (filter #(contains? (key %) read-from-key) mapping))]
-          (pipe-values (resolver context ast)
-                       (chan 1 (comp
-                                (map #(get % read-from-key))
-                                (map #(hash-map (:key ast) %)))))
-          (throw (ex-info "Unknown key" {:key read-from-key}))))))
-   (:channel context)))
-
-
-(defn resolve [context root-mapping query]
-  (let [ast (om/query->ast query)]
-    (resolve* context root-mapping (:children ast))))
+(defn resolve [context resolvers query-or-ast]
+  (let [ast (if (vector? query-or-ast)
+              (om/query->ast query-or-ast)
+              query-or-ast)
+        children (:children ast)]
+    (async/pipe
+     (async/merge
+      (for [ast children
+            :let [read-from-key (get-in ast [:params :<] (:key ast))]]
+        (if (contains? resolvers read-from-key)
+          (let [resolver (get resolvers read-from-key)]
+            (pipe-values (resolver context ast)
+                         (chan 1 (map #(hash-map (:key ast) %)))))
+          (if-let [[keys resolver]
+                   (first (filter #(contains? (key %) read-from-key) resolvers))]
+            (pipe-values (resolver context ast)
+                         (chan 1 (comp
+                                  (map #(get % read-from-key))
+                                  (map #(hash-map (:key ast) %)))))
+            (throw (ex-info "Unknown key" {:key read-from-key}))))))
+     (:channel context))))

 (def parser
   (om/parser {:read (bodhi/read-fn
@@ -352,11 +351,11 @@

    :root/user
    (fn [context ast]
-     (resolve* (assoc context
-                      :channel (chan)
-                      :user/name (:user/name (:params ast)))
-               resolvers
-               (:children ast)))
+     (resolve (assoc context
+                     :channel (chan)
+                     :user/name (:user/name (:params ast)))
+              resolvers
+              ast))

    :user/name
    (fn [context ast]
@@ -390,11 +389,11 @@
    (fn [context ast]
      (p/alet [get-user (get-in context [:apis :get-user])
               user (p/await (get-user {:name (:user/name context)}))]
-       (resolve* (assoc context
-                        :channel (chan)
-                        :user/name (:favorite-fellow-user-name user))
-                 resolvers
-                 (:children ast))))})
+       (resolve (assoc context
+                       :channel (chan)
+                       :user/name (:favorite-fellow-user-name user))
+                resolvers
+                ast)))})

 (deftest new-thing-works
   (async done


Use _ for an unused local binding

Use _ for an unused local binding

--- test/cljam/io/bcf/writer_test.clj
+++ test/cljam/io/bcf/writer_test.clj
@@ -275,7 +275,7 @@
                 "##FILTER=<ID=PASS,Description=\"All filters passed\",IDX=0>"
                 (str "#" (cstr/join \tab header) \newline (char 0))]
                (cstr/join \newline))
-        _ (with-open [w (bcf-writer/writer tmp {} header)])
+        _ (with-open [_ (bcf-writer/writer tmp {} header)])
         bytes (bb->seq (bgzf->bb tmp))]
     (is (= (concat (.getBytes "BCF\2\2") [(.length s) 0 0 0] (.getBytes s))
            bytes))


Check for nil result from managed-track

Check for nil result from managed-track

--- src-cljs/frontend/controllers/controls.cljs
+++ src-cljs/frontend/controllers/controls.cljs
@@ -1004,11 +1004,14 @@

 (defmethod post-control-event! :track-external-link-clicked
   [target message {:keys [path event properties]} previous-state current-state]
-  (let [redirect #(js/window.location.replace path)]
-    (go (alt!
-          (analytics/managed-track event properties) ([v] (do (utils/mlog "tracked" v "... redirecting")
-                                                              (redirect)))
-          (async/timeout 5000) (redirect)))))
+  (let [redirect #(js/window.location.replace path)
+        track-ch (analytics/managed-track event properties)]
+    (if track-ch
+      (go (alt!
+            track-ch ([v] (do (utils/mlog "tracked" v "... redirecting")
+                              (redirect)))
+            (async/timeout 5000) (redirect)))
+      (redirect))))

 (defmethod control-event :language-testimonial-tab-selected
   [target message {:keys [index]} state]


Revert errant sleep added to min-peers-test

--- test/onyx/peer/min_peers_test.clj
+++ test/onyx/peer/min_peers_test.clj
@@ -30,7 +30,7 @@
   {:lifecycle/before-task-start inject-out-ch})

 (defn my-inc [{:keys [n] :as segment}]
-  (Thread/sleep 15000)
+  ;(Thread/sleep 15000)
   (assoc segment :n (inc n)))

 (deftest ^:smoke min-peers-test


Show ugly marker on available interaction when interaction flag is activated.

Deactivated by default and requires a designer review.

--- src/uxbox/view/ui/viewer/shapes.cljs
+++ src/uxbox/view/ui/viewer/shapes.cljs
@@ -6,8 +6,10 @@

 (ns uxbox.view.ui.viewer.shapes
   (:require [goog.events :as events]
+            [lentes.core :as l]
             [uxbox.util.mixins :as mx :include-macros true]
             [uxbox.main.state :as st]
+            [uxbox.main.geom :as geom]
             [uxbox.main.ui.shapes.rect :refer (rect-shape)]
             [uxbox.main.ui.shapes.icon :refer (icon-shape)]
             [uxbox.main.ui.shapes.text :refer (text-shape)]
@@ -16,6 +18,10 @@
             [uxbox.main.ui.shapes.circle :refer (circle-shape)]
             [uxbox.view.ui.viewer.interactions :as itx])
   (:import goog.events.EventType))
+
+(def itx-flag-ref
+  (-> (comp (l/key :flags) (l/lens :interactions))
+      (l/derive st/state)))

 ;; --- Interactions Wrapper

@@ -38,9 +44,18 @@

 (mx/defc interactions-wrapper
   {:did-mount interactions-wrapper-did-mount
-   :will-unmount interactions-wrapper-will-unmount}
+   :will-unmount interactions-wrapper-will-unmount
+   :mixins [mx/reactive mx/static]}
   [shape factory]
-  [:g {:id (str "itx-" (:id shape))} (factory shape)])
+  (let [show-itx? (mx/react itx-flag-ref)
+        rect (geom/inner-rect shape)]
+    [:g {:id (str "itx-" (:id shape))}
+     (factory shape)
+     (when show-itx?
+       [:circle {:fill "red"
+                 :cx (:x rect)
+                 :cy (:y rect)
+                 :r 10}])]))

 ;; --- Shapes


Maybe fix sign-out problem

Maybe fix sign-out problem

--- src/cljs/elevent_client/authentication.cljs
+++ src/cljs/elevent_client/authentication.cljs
@@ -39,12 +39,12 @@
                                    [:negative "Sign in failed"]])})))

 (defn sign-out! []
-  (set! js/window.location (routes/home))
   (swap! state/session dissoc :token :user :stripe-token :payment-info :permissions)
   (put! state/api-refresh-chan true)
   (put! state/remove-messages-chan :sign-in-succeeded)
   (put! state/add-messages-chan [:sign-out-succeeded
-                                 [:positive "Sign out succeeded"]]))
+                                 [:positive "Sign out succeeded"]])
+  (set! js/window.location (routes/home)))

 (defn sign-up! [form]
   (put! state/auth-sign-up-chan form))


Clean up intermediate log refactoring in to-child

Switch the new functional logging ns alias to log, now that it no longer
references clojure.tools.logging at all.

--- src/clojure/frereth_cp/message/to_child.clj
+++ src/clojure/frereth_cp/message/to_child.clj
@@ -14,8 +14,7 @@
             [frereth-cp.message.constants :as K]
             [frereth-cp.message.helpers :as help]
             [frereth-cp.message.specs :as specs]
-            ;; TODO: Refactor-rename this to log
-            [frereth-cp.shared.logging :as log2]
+            [frereth-cp.shared.logging :as log]
             [frereth-cp.util :as utils]
             [manifold.deferred :as dfrd]
             [manifold.stream :as strm])
@@ -27,9 +26,9 @@
 ;;;; Specs

 (s/def ::callback
-  (s/fspec :args (s/cat :log-state ::log2/state
+  (s/fspec :args (s/cat :log-state ::log/state
                         :message ::specs/bs-or-eof)
-           :ret ::log2/state))
+           :ret ::log/state))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;; Magic numbers
@@ -82,7 +81,7 @@
              ::specs/contiguous-stream-count]
      :as incoming} ::specs/incoming
     :keys [::specs/message-loop-name]
-    log-state ::log2/state
+    log-state ::log/state
     :as state}
    k-v-pair]
   (let [prelog (utils/pre-log message-loop-name)
@@ -93,12 +92,12 @@
         ;; If we've received 1 byte, the strm-hwm is at 0.
         ;; If start is 0 or 1, then we might have some overlap.
         ;; As long as stop is somewhere past strm-hwm.
-        log-state (log2/debug log-state
-                              ::consolidate-message-block
-                              (str "Does " start "-" stop " close a hole in "
-                                   gap-buffer " after "
-                                   contiguous-stream-count
-                                   " contiguous bytes?"))]
+        log-state (log/debug log-state
+                             ::consolidate-message-block
+                             (str "Does " start "-" stop " close a hole in "
+                                  gap-buffer " after "
+                                  contiguous-stream-count
+                                  " contiguous bytes?"))]
     ;; For now, this top-level if check is redundant.
     ;; I'd rather be safe and trust the JIT than remove it
     ;; under the assumption that callers will be correct.
@@ -112,20 +111,20 @@
         (let [log-state
               (if (< start contiguous-stream-count)
                 (let [bytes-to-skip (- contiguous-stream-count start)
-                      log-state (log2/info log-state
-                                           ::consolidate-message-block
-                                           (str "Skipping "
-                                                bytes-to-skip
-                                                " previously received bytes in "
-                                                buf))]
+                      log-state (log/info log-state
+                                          ::consolidate-message-block
+                                          (str "Skipping "
+                                               bytes-to-skip
+                                               " previously received bytes in "
+                                               buf))]
                   (.skipBytes buf bytes-to-skip)
                   log-state)
                 log-state)
-              log-state (log2/debug log-state
-                                    ::consolidate-message-block
-                                    (str "Consolidating entry 1/"
-                                         (count (::specs/gap-buffer
-                                                 incoming))))]
+              log-state (log/debug log-state
+                                   ::consolidate-message-block
+                                   (str "Consolidating entry 1/"
+                                        (count (::specs/gap-buffer
+                                                incoming))))]
           (-> state
               (update ::specs/incoming
                       (fn [cur]
@@ -141,25 +140,25 @@
                             ;; Microbenchmarks and common sense indicate that
                             ;; assoc is significantly faster than update
                             (assoc ::specs/contiguous-stream-count stop))))
-              (assoc ::log2/state log-state)))
+              (assoc ::log/state log-state)))
         (let [log-state
-              (log2/debug log-state
-                          ::consolidate-message-block
-                          "Dropping previously consolidated block")
+              (log/debug log-state
+                         ::consolidate-message-block
+                         "Dropping previously consolidated block")
               to-drop (val (first gap-buffer))
               log-state (if-not (keyword? to-drop)
                           (try
                             (.release to-drop)
                             log-state
                             (catch RuntimeException ex
-                              (log2/exception log-state
-                                              ex
-                                              "Failed to release"
-                                              to-drop)))
+                              (log/exception log-state
+                                             ex
+                                             "Failed to release"
+                                             to-drop)))
                           log-state)]
           (-> state
               (update-in [::specs/incoming ::specs/gap-buffer] pop-map-first)
-              (assoc ::log2/state log-state))))
+              (assoc ::log/state log-state))))
       ;; Gap starts past the end of the stream.
       (do
         (reduced state)))))
@@ -204,9 +203,9 @@

 (s/fdef read-bytes-from-parent!
         :args (s/cat :io-handle ::specs/io-handle
-                     :log-state ::log2/state
+                     :log-state ::log/state
                      :buffer bytes?)
-        :ret (s/keys :req  [::log2/state
+        :ret (s/keys :req  [::log/state
                             ::specs/bs-or-eof]))
 (defn read-bytes-from-parent!
   "Parent wrote bytes to its outbuffer. Read them."
@@ -239,7 +238,7 @@
             ;; available via io-handle.
             ;; That feels like a terrible option, but it may be
             ;; my best bet.
-            my-log-state (log2/error my-log-state
+            my-log-state (log/error my-log-state
                                      ::read-bytes-from-parent!
                                      "Need the sender's lamport clock")]
         (if (<= 0 n)
@@ -250,16 +249,16 @@
           ;; we could just return that count
           ;; (yuck!)
           (let [holder (byte-array n)
-                my-log-state (log2/debug my-log-state
+                my-log-state (log/debug my-log-state
                                          ::read-bytes-from-parent!
                                          (str n
                                               "bytes received from parent"))]
             (b-t/byte-copy! holder 0 n buffer)
             holder)
-          {::log2/state my-log-state
+          {::log/state my-log-state
            ::specs/bs-or-eof ::specs/normal}))
       (let [my-log-state
-            (log2/info my-log-state
+            (log/info my-log-state
                        ::read-bytes-from-parent!
                        "No bytes available for child. Blocking Parent Monitor")]
         ;; Q: Do I really need to work with this "read single byte to unblock
@@ -273,25 +272,25 @@
                            ::specs/normal))
               bytes-available (.available child-in)]
           (assert bytes-available)
-          (let [my-log-state (log2/info my-log-state
+          (let [my-log-state (log/info my-log-state
                                         ::read-bytes-from-parent!
                                         "Parent Monitor thread unblocked")
                 result
                 (cond (neg? byte1) (let [my-log-state
-                                         (log2/warn my-log-state
+                                         (log/warn my-log-state
                                                     ::read-bytes-from-parent!
                                                     "Parent monitor received EOF")]
                                      ;; The part that writes to our paired Pipe
                                      ;; closed its half.
                                      ;; Do the same for sanitation.
                                      (.close child-in)
-                                     {::log2/state my-log-state
+                                     {::log/state my-log-state
                                       ::specs/bs-or-eof ::specs/normal})
-                      (keyword? byte1) {::log2/state my-log-state
+                      (keyword? byte1) {::log/state my-log-state
                                         ::specs/bs-or-eof byte1}
                       (< 0 bytes-available)
                       (let [my-log-state
-                            (log2/debug my-log-state
+                            (log/debug my-log-state
                                         ::read-bytes-from-parent!
                                         "Trying to read"
                                         {::bytes-available bytes-available
@@ -303,7 +302,7 @@
                                                               (dec max-n)))]
                           (if (<= 0 n)
                             (let [holder (byte-array (inc n))
-                                  my-log-state (log2/debug my-log-state
+                                  my-log-state (log/debug my-log-state
                                                            ::read-bytes-from-parent!
                                                            (str
                                                             (inc n)
@@ -311,32 +310,32 @@
                                                             byte1))]
                               (aset-byte holder 0 (b-t/possibly-2s-complement-8 byte1))
                               (b-t/byte-copy! holder 1 n buffer)
-                              {::log2/state my-log-state
+                              {::log/state my-log-state
                                ::specs/bs-or-eof holder}))))
                       :else (byte-array [byte1]))]
             (when (keyword? result)
               ;; We got this because the connected PipedOutputStream closed.
               (.close child-in))
             {::specs/bs-or-eof result
-             ::log2/state my-log-state}))))))
+             ::log/state my-log-state}))))))

 (s/fdef trigger-from-parent!
         :args (s/cat :io-handle ::specs/io-handle
-                     :my-logs ::log2/entries
+                     :my-logs ::log/entries
                      :buffer bytes?
                      :cb ::callback
-                     :trigger (s/keys :req [::log2/lamport]))
+                     :trigger (s/keys :req [::log/lamport]))
         :ret any?)
 (defn trigger-from-parent!
   "Stream handler for coping with bytes sent by parent"
-  [{:keys [::log2/logger
+  [{:keys [::log/logger
            ::specs/message-loop-name]
     :as io-handle}
    buffer
    cb
    {:keys [::result-writer
            ::specs/bs-or-eof]
-    my-logs ::log2/state
+    my-logs ::log/state
     :as trigger}]
   (let [my-logs
         (try
@@ -360,9 +359,9 @@
           (let [start-time (System/currentTimeMillis)
                 my-logs
                 (try
-                  (as-> (log2/debug my-logs
-                                    ::parent-monitor-loop
-                                    "Triggering child callback")
+                  (as-> (log/debug my-logs
+                                   ::parent-monitor-loop
+                                   "Triggering child callback")
                       my-logs
                     (try
                       ;; The rest of this function is really just support and error
@@ -372,43 +371,43 @@
                       (cb bs-or-eof)
                        my-logs
                       (catch ExceptionInfo ex
-                        (log2/exception my-logs
-                                        ex
-                                        "Failed"
-                                        (.getData ex)))
+                        (log/exception my-logs
+                                       ex
+                                       "Failed"
+                                       (.getData ex)))
                       (catch Exception ex
-                        (log2/exception my-logs
-                                        ex
-                                        ::parent-monitor-loop
-                                        "Low-level failure"))))
+                        (log/exception my-logs
+                                       ex
+                                       ::parent-monitor-loop
+                                       "Low-level failure"))))
                   (catch ExceptionInfo ex
-                    (log2/exception my-logs
-                                    ex
-                                    ::parent-monitor-loop
-                                    (str "At least we can log something interesting with this")
-                                    (.getData ex))
-                    (log2/flush-logs! logger my-logs)
+                    (log/exception my-logs
+                                   ex
+                                   ::parent-monitor-loop
+                                   (str "At least we can log something interesting with this")
+                                   (.getData ex))
+                    (log/flush-logs! logger my-logs)
                     (assert (not ex) "Child callback failed"))
                   (catch Exception ex
-                    (let [my-logs (log2/error my-logs
-                                              ex
-                                              ::parent-monitor-loop
-                                              "This is not acceptable behavior at all")
+                    (let [my-logs (log/error my-logs
+                                             ex
+                                             ::parent-monitor-loop
+                                             "This is not acceptable behavior at all")
                           prelog (utils/pre-log message-loop-name)]
-                      (log2/flush-logs! logger my-logs)
+                      (log/flush-logs! logger my-logs)
                       (assert (not ex) (str prelog
                                             "Child callback failed")))))]
             (let [end-time (System/currentTimeMillis)
                   msg (cl-format nil
                                  "Child callback took ~:d millisecond(s)"
                                  (- end-time start-time))]
-              (log2/debug my-logs ::parent-monitor-loop msg)))
+              (log/debug my-logs ::parent-monitor-loop msg)))
           (catch Exception ex
             ;; This really shouldn't be possible
-            (log2/exception my-logs
-                            ex
-                            ::parent-monitor-loop
-                            "Redundant error handler")))]
+            (log/exception my-logs
+                           ex
+                           ::parent-monitor-loop
+                           "Redundant error handler")))]
     (deliver result-writer my-logs)))

 (s/fdef write-bytes-to-child-stream!
@@ -419,7 +418,7 @@
 (defn write-bytes-to-child-stream!
   "Forward the byte-array inside the buffer"
   [parent-trigger
-   {log-state ::log2/state
+   {log-state ::log/state
     :as state}
    ^ByteBuf buf]
   ;; This was really just refactored out of the middle of a reduce call,
@@ -433,12 +432,12 @@
     (let [bs (byte-array (.readableBytes buf))
           n (count bs)]
       (.readBytes buf bs)
-      (let [{:keys [::log2/lamport]
-             :as log-state} (log2/info log-state
-                                       ::write-bytes-to-child-stream!
-                                       (str "Signalling child's input loop with "
-                                            n
-                                            " bytes"))
+      (let [{:keys [::log/lamport]
+             :as log-state} (log/info log-state
+                                      ::write-bytes-to-child-stream!
+                                      (str "Signalling child's input loop with "
+                                           n
+                                           " bytes"))
             log-state
             (try
               (let [start-time (System/currentTimeMillis)]
@@ -463,7 +462,7 @@
                       ;; (and how tough to reach one?)
                       triggered @(strm/put! parent-trigger
                                             {::result-writer succeeded
-                                             ::log2/state log-state
+                                             ::log/state log-state
                                              ::specs/bs-or-eof bs})
                       log-state @succeeded
                       end-time (System/currentTimeMillis)
@@ -471,27 +470,27 @@
                       msg (cl-format nil "Triggering child took ~:d ms" delta)]
                   (if (< (* 1000000 callback-threshold-warning) delta)
                     (if (< (* 1000000 callback-threshold-error) delta)
-                      (log2/error log-state
-                                  ::write-bytes-to-child-stream!
-                                  msg)
-                      (log2/warn log-state
+                      (log/error log-state
                                  ::write-bytes-to-child-stream!
-                                 msg))
-                    (log2/debug log-state
+                                 msg)
+                      (log/warn log-state
                                 ::write-bytes-to-child-stream!
-                                msg))))
+                                msg))
+                    (log/debug log-state
+                               ::write-bytes-to-child-stream!
+                               msg))))
               (catch RuntimeException ex
                 ;; It's very tempting to just re-raise this exception,
                 ;; especially if I'm inside an agent.
                 ;; For now, just log and swallow it.
-                (log2/exception log-state
-                                ex
-                                ::write-bytes-to-child-stream!
-                                "Failure in child callback.")))
+                (log/exception log-state
+                               ex
+                               ::write-bytes-to-child-stream!
+                               "Failure in child callback.")))
             ;; And drop the consolidated blocks
-            log-state (log2/debug log-state
-                                  ::write-bytes-to-child-stream!
-                                  "Dropping block we just finished sending to child")]
+            log-state (log/debug log-state
+                                 ::write-bytes-to-child-stream!
+                                 "Dropping block we just finished sending to child")]
         (.release buf)
         (-> state
             (update-in
@@ -507,7 +506,7 @@
             ;; That gets quite a bit more finicky.
             ;; TODO: Consider my options.
             (update-in [::specs/incoming ::specs/receive-written] + n)
-            (assoc ::log2/state log-state))))
+            (assoc ::log/state log-state))))
     (catch RuntimeException ex
       ;; Reference implementation specifically copes with
       ;; EINTR, EWOULDBLOCK, and EAGAIN.
@@ -522,8 +521,8 @@
       ;; single vector of bytes, but the performance implications
       ;; of that don't seem worth imposing.
       (reduced (update state
-                       ::log2/state
-                       log2/exception
+                       ::log/state
+                       log/exception
                        ex
                        ::write-bytes-to-child-stream!
                        "Failed to forward message to child")))))
@@ -538,7 +537,7 @@
 (s/fdef possibly-close-stream!
         :args (s/cat :io-handle ::specs/io-handle
                      :state ::specs/state
-                     :log-state ::log2/state)
+                     :log-state ::log/state)
         :ret ::specs/state)
 (defn possibly-close-stream!
   "Maybe signal child that it won't receive anything else"
@@ -549,23 +548,23 @@
             ::specs/receive-total-bytes
             ::specs/receive-written]
      :as incoming} ::specs/incoming
-    log-state ::log2/state
+    log-state ::log/state
     :as state}]
   (let [log-state
-        (log2/debug log-state
-                    ::possibly-close-stream!
-                    "Process EOF?"
-                    incoming)]
+        (log/debug log-state
+                   ::possibly-close-stream!
+                   "Process EOF?"
+                   incoming)]
     (if (not= ::specs/false receive-eof)
       (if (= receive-written receive-total-bytes)
         (let [log-state
-              (log2/info log-state
+              (log/info log-state
                          ::possibly-close-stream!
                          "Have received everything other side will send")
               log-state (if-not from-parent-trigger
-                          (log2/error log-state
-                                      ::possibly-close-stream!
-                                      "Missing from-parent-trigger, so we can't close it")
+                          (log/error log-state
+                                     ::possibly-close-stream!
+                                     "Missing from-parent-trigger, so we can't close it")
                           log-state)
               log-state (try
                           ;; This actual point is easy to miss in the middle of all
@@ -573,20 +572,20 @@
                           (close-parent-input! io-handle)
                           log-state
                           (catch RuntimeException ex
-                            (log2/exception log-state
-                                            ex
-                                            ::possibly-close-stream!
-                                            "Trying to close to-child failed")))
-              log-state (log2/warn log-state
-                                   ::possibly-close-stream!
-                                   "EOF flag received."
-                                   (select-keys incoming
-                                                [::specs/contiguous-stream-count
-                                                 ::specs/receive-eof
-                                                 ::specs/receive-total-bytes
-                                                 ::specs/receive-written]))]
+                            (log/exception log-state
+                                           ex
+                                           ::possibly-close-stream!
+                                           "Trying to close to-child failed")))
+              log-state (log/warn log-state
+                                  ::possibly-close-stream!
+                                  "EOF flag received."
+                                  (select-keys incoming
+                                               [::specs/contiguous-stream-count
+                                                ::specs/receive-eof
+                                                ::specs/receive-total-bytes
+                                                ::specs/receive-written]))]
           (assoc state
-                 ::log2/state log-state)))
+                 ::log/state log-state)))
       state)))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -600,7 +599,7 @@

 (s/fdef start-parent-monitor!
         :args (s/cat :io-handle ::specs/io-handler
-                     :parent-log ::log2/state
+                     :parent-log ::log/state
                      :callback ::callback)
         :ret ::specs/child-input-loop)
 (defn start-parent-monitor!
@@ -609,7 +608,7 @@
   ;; Maybe I should add an optional parameter during startup:
   ;; if you don't provide
   ;; this, it will default to calling this.
-  [{:keys [::log2/logger
+  [{:keys [::log/logger
            ::specs/child-in
            ::specs/message-loop-name]
     trigger ::specs/from-parent-trigger
@@ -629,12 +628,12 @@
    ;; For that matter, I don't have any evidence that
    ;; it would improve anything.
    cb]
-  (let [my-logs (log2/init (::log2/lamport parent-log))
+  (let [my-logs (log/init (::log/lamport parent-log))
         buffer (byte-array K/standard-max-block-length)
-        my-logs (log2/info my-logs
-                           ::parent-monitor-loop
-                           "Starting the loop watching for bytes the parent has sent toward the child")
-        my-logs (log2/flush-logs! logger my-logs)]
+        my-logs (log/info my-logs
+                          ::parent-monitor-loop
+                          "Starting the loop watching for bytes the parent has sent toward the child")
+        my-logs (log/flush-logs! logger my-logs)]
     (let [result (strm/consume (partial trigger-from-parent!
                                         io-handle
                                         buffer
@@ -643,9 +642,9 @@
           finished (dfrd/deferred)]
       (-> result
           (dfrd/chain (fn [success]
-                        (let [my-logs (log2/warn my-logs
-                                                 ::parent-monitor-loop
-                                                 "parent-monitor source exhausted")]
+                        (let [my-logs (log/warn my-logs
+                                                ::parent-monitor-loop
+                                                "parent-monitor source exhausted")]
                           ;; Writing to the from-parent-trigger stream
                           ;; here seems like the obvious thing to do.
                           ;; But closing that was the signal that
@@ -655,21 +654,21 @@
                                                 buffer
                                                 cb
                                                 {::result-writer finished
-                                                 ::log2/state my-logs
+                                                 ::log/state my-logs
                                                  ::specs/bs-or-eof ::specs/normal})))
                       (fn [_]
                         (println "EOF signalled!")
                         finished)
                       (fn [logs]
-                        (log2/flush-logs! logger logs)
-                        (log2/flush-logs! logger my-logs)))
+                        (log/flush-logs! logger logs)
+                        (log/flush-logs! logger my-logs)))
           (dfrd/catch (fn [ex]
-                        (log2/exception my-logs
-                                        ex
-                                        ::parent-monitor-loop
-                                        "Error escaped")))
+                        (log/exception my-logs
+                                       ex
+                                       ::parent-monitor-loop
+                                       "Error escaped")))
           (dfrd/finally (fn [logs]
-                          (log2/flush-logs! logger logs))))
+                          (log/flush-logs! logger logs))))
       result)))

 (s/fdef forward!
@@ -684,16 +683,16 @@
     :as io-handle}
    {:keys [::specs/message-loop-name]
     original-incoming ::specs/incoming
-    log-state ::log2/state
+    log-state ::log/state
     :as state}]
   {:pre [log-state]}
-  (let [log-state (log2/debug log-state
-                              ::forward!
-                              "Top of forward!")
+  (let [log-state (log/debug log-state
+                             ::forward!
+                             "Top of forward!")
         {{:keys [::specs/receive-eof]
           :as consolidated-incoming} ::specs/incoming
-         log-state ::log2/state
-         :as consolidated} (consolidate-gap-buffer (assoc state ::log2/state log-state))
+         log-state ::log/state
+         :as consolidated} (consolidate-gap-buffer (assoc state ::log/state log-state))
         ->child-buffer (::specs/->child-buffer consolidated-incoming)
         _ (println "Gap-buffer consolidated. ->child-buffer:" (pr-str ->child-buffer))
         block-count (count ->child-buffer)
@@ -703,15 +702,15 @@
                    (keys consolidated)
                    "\nin\n"
                    consolidated)
-        log-state (try (log2/debug log-state
-                                   ::forward!
-                                   "Consolidated block(s) ready to go to child."
-                                   {::block-count block-count
-                                    ::specs/receive-eof receive-eof})
+        log-state (try (log/debug log-state
+                                  ::forward!
+                                  "Consolidated block(s) ready to go to child."
+                                  {::block-count block-count
+                                   ::specs/receive-eof receive-eof})
                        (catch Exception ex
                          (println "Log Problem:" ex)
                          log-state))
-        consolidated (assoc consolidated ::log2/state log-state)]
+        consolidated (assoc consolidated ::log/state log-state)]
     (println "Consolidation of" block-count "blocks logged")
     (if (< 0 block-count)
       (try
@@ -725,8 +724,8 @@
         (catch Exception ex
           (println "Failed writing bytes to child-stream:\n" ex)))
       (let [result (update consolidated
-                           ::log2/state
-                           log2/warn
+                           ::log/state
+                           log/warn
                            ::forward!
                            "0 bytes to forward to child")]
         (possibly-close-stream! io-handle result)))


fix broken args to commit-pairs

fix broken args to commit-pairs


Correcting namespace name.

Correcting namespace name.

--- test/cmr/system_int_test/search/collection_platform_instrument_sensor_search_test.clj
+++ test/cmr/system_int_test/search/collection_platform_instrument_sensor_search_test.clj
@@ -1,4 +1,4 @@
-(ns cmr.system-int-test.search.collection-platform-search-test
+(ns cmr.system-int-test.search.collection-platform-instrument-sensor-search-test
   "Integration test for CMR collection search by platform, instrument and sensor short-names"
   (:require [clojure.test :refer :all]
             [cmr.system-int-test.utils.ingest-util :as ingest]


표현 축약

표현 축약


CMR-6537-4 updated subscription search test

--- system-int-test/test/cmr/system_int_test/search/subscription/subscription_search_test.clj
+++ system-int-test/test/cmr/system_int_test/search/subscription/subscription_search_test.clj
@@ -527,3 +527,29 @@
       "Sort by name then provider id descending order"
       ["-name" "-provider"]
       [subscription2 subscription1 subscription4 subscription3])))
+
+(deftest json-result-format-test
+  (let [collection (data2-core/ingest-umm-spec-collection
+                    "PROV1"
+                    (data-umm-c/collection
+                     {:ShortName "coll3"
+                      :EntryTitle "entry-title3"})
+                    {:token "mock-echo-system-token"})
+        subscription (subscriptions/ingest-subscription-with-attrs {:native-id "Sub1"
+                                                                    :Name "Subscription1"
+                                                                    :SubscriberId "SubId1"
+                                                                    :Query "platform=NOAA-6"
+                                                                    :CollectionConceptId (:concept-id collection)
+                                                                    :provider-id "PROV1"})
+        query {:name (:Name subscription)}
+        _ (index/wait-until-indexed)
+        response (first (:items (subscriptions/search-json-raw query)))]
+    (is (= #{:collection_concept_id
+             :concept_id
+             :name
+             :native_id
+             :provider_id
+             :revision_id
+             :subscriber_id}
+           (set (keys response))))
+    (is (= (:concept-id subscription) (:concept_id response)))))