Work in progress to add monoids.

Work in progress to add monoids.

--- PersistentDataStructures/finger_trees.clj
+++ PersistentDataStructures/finger_trees.clj
@@ -1,14 +1,53 @@
 ; :mode=clojure:

-(defrecord node-2 [a b])
-(defrecord node-3 [a b c])
-(defrecord finger-tree-empty [])
-(defrecord finger-tree-single [v])
-(defrecord finger-tree-deep [l m r])
-
-(defn make-node-2 [a b] (node-2. a b))
-(defn make-node-3 [a b c] (node-3. a b c))
+(defrecord monoid [measure-fn combine-fn])
+(defrecord node-2 [v a b])
+(defrecord node-3 [v a b c])
+(defrecord finger-tree-empty [monoid])
+(defrecord finger-tree-single [monoid e])
+(defrecord finger-tree-deep [monoid v l m r])
+
 (derive Object ::any)
+
+; Extract the (possibly cached) measure from an object.
+; Some parts of the structure cache the monoid, which makes the argument redundant..
+(defmulti extract-measure (fn [object monoid] (class object)))
+(defmethod extract-measure node-2 [{v :v} _] v)
+(defmethod extract-measure node-3 [{v :v} _] v)
+(defmethod extract-measure finger-tree-empty [{{cf :combine-fn} :monoid} _] (cf))
+(defmethod extract-measure finger-tree-single [{monoid :monoid e :e} _] (extract-measure e monoid))
+(defmethod extract-measure finger-tree-deep [{v :v} _] (force v))
+(defmethod extract-measure ::any [e {mf :measure-fn}] (mf e))
+
+; Constructor functions
+(defn make-node-2 [monoid a b]
+    (node-2.
+        (apply
+            (:combine-fn monoid)
+            (map (fn [e] (extract-measure e monoid)) [a b]))
+        a b))
+(defn make-node-3 [monoid a b c]
+    (node-3.
+        (apply
+            (:combine-fn monoid)
+            (map (fn [e] (extract-measure e monoid)) [a b c]))
+        a b c))
+(defn make-finger-tree-empty [monoid]
+    (finger-tree-empty. monoid))
+(defn make-finger-tree-single [monoid e]
+    (finger-tree-single. monoid e))
+(defn make-finger-tree-deep [monoid l m r]
+    (finger-tree-deep.
+        monoid
+        (delay (apply
+            (:combine-fn monoid)
+            (map
+                (fn [e] (extract-measure e monoid))
+                (concat
+                    l
+                    ((fn [v] (if (nil? v) [] [v])) (force m))
+                    r))))
+        l m r))

 ; Reverse cons
 (defn snoc [a lst] (concat lst [a]))
@@ -17,40 +56,42 @@

 ; Adds a new element to the front of the finger tree
 (defmulti push-front (fn [tree value] (class tree)))
-(defmethod push-front finger-tree-empty [_ a]
-    (finger-tree-single. a))
-(defmethod push-front finger-tree-single [{r :v} a]
-    (finger-tree-deep. [a] (delay (finger-tree-empty.)) [r]))
-(defmethod push-front finger-tree-deep [{l :l m :m r :r} a]
+(defmethod push-front finger-tree-empty [tree a]
+    (make-finger-tree-single (:monoid tree) a))
+(defmethod push-front finger-tree-single [{r :e monoid :monoid} a]
+    (make-finger-tree-deep monoid [a] (delay (make-finger-tree-empty monoid)) [r]))
+(defmethod push-front finger-tree-deep [{monoid :monoid l :l m :m r :r} a]
     (if (<= (count l) 3)
-        (finger-tree-deep. (cons a l) m r)
-        (finger-tree-deep.
+        (make-finger-tree-deep monoid (cons a l) m r)
+        (make-finger-tree-deep
+            monoid
             [a (first l)]
             (let [m-forced (force m)]
-                (delay (push-front m-forced (apply make-node-3 (rest l)))))
+                (delay (push-front m-forced (apply make-node-3 monoid (rest l)))))
             r)))

 ; Adds a new element to the back of the finger tree
 (defmulti push-back (fn [tree value] (class tree)))
-(defmethod push-back finger-tree-empty [_ a]
-    (finger-tree-single. a))
-(defmethod push-back finger-tree-single [{r :v} a]
-    (finger-tree-deep. [r] (delay (finger-tree-empty.)) [a]))
-(defmethod push-back finger-tree-deep [{l :l m :m r :r} a]
+(defmethod push-back finger-tree-empty [{monoid :monoid} a]
+    (make-finger-tree-single monoid a))
+(defmethod push-back finger-tree-single [{r :e monoid :monoid} a]
+    (make-finger-tree-deep monoid [r] (delay (make-finger-tree-empty monoid)) [a]))
+(defmethod push-back finger-tree-deep [{monoid :monoid l :l m :m r :r} a]
     (if (<= (count r) 3)
-        (finger-tree-deep. l m (snoc a r))
-        (finger-tree-deep.
+        (make-finger-tree-deep monoid l m (snoc a r))
+        (make-finger-tree-deep
+            monoid
             l
             (let [m-forced (force m)]
-                (delay (push-back m-forced (apply make-node-3 (tser r)))))
+                (delay (push-back m-forced (apply make-node-3 monoid (tser r)))))
             [(last r) a])))

-(defn nodes [a b & r]
+(defn nodes [monoid a b & r]
     (case (count r)
-        0 [(node-2. a b)]
-        1 [(node-3. a b (first r))]
-        2 [(node-2. a b) (apply make-node-2 r)]
-        (cons (node-3. a b (first r)) (apply nodes (rest r)))))
+        0 [(make-node-2 monoid a b)]
+        1 [(make-node-3 monoid a b (first r))]
+        2 [(make-node-2 monoid a b) (apply make-node-2 monoid r)]
+        (cons (make-node-3 monoid a b (first r)) (apply nodes monoid (rest r)))))

 (defmulti app3 (fn [l m r] [(class l) (class r)]))
 (defmethod app3 [finger-tree-empty ::any] [l m r]
@@ -68,15 +109,16 @@
             (rest m)
             r)))
 (defmethod app3 [finger-tree-single ::any] [l m r]
-    (push-front (app3 (finger-tree-empty.) m r) (:v l)))
+    (push-front (app3 (make-finger-tree-empty (:monoid l)) m r) (:e l)))
 (defmethod app3 [::any finger-tree-single] [l m r]
-    (push-back (app3 l m (finger-tree-empty.)) (:v r)))
+    (push-back (app3 l m (make-finger-tree-empty (:monoid r))) (:e r)))
 (defmethod app3 [finger-tree-deep finger-tree-deep] [l m r]
-    (finger-tree-deep.
+    (make-finger-tree-deep
+        (:monoid l)
         (:l l)
         (app3
             (force (:m l))
-            (apply nodes (concat (:r l) m (:l r)))
+            (apply nodes (:monoid l) (concat (:r l) m (:l r)))
             (force (:m r)))
         (:r r)))

@@ -88,13 +130,14 @@
 (defmethod concatenate [::any finger-tree-empty] [a _] a)
 (defmethod concatenate [finger-tree-empty ::any] [_ b] b)
 (defmethod concatenate [::any finger-tree-single] [a b]
-    (push-back a (:v b)))
+    (push-back a (:e b)))
 (defmethod concatenate [finger-tree-single ::any] [a b]
-    (push-front (:v a) b))
+    (push-front (:e a) b))
 (defmethod concatenate [finger-tree-deep finger-tree-deep] [a b]
-    (finger-tree-deep.
+    (make-finger-tree-deep
+        (:monoid a)
         (:l a)
-        (app3 (force (:m a)) (apply nodes (concat (:r a) (:l b))) (force (:m b)))
+        (app3 (force (:m a)) (apply nodes (:monoid a) (concat (:r a) (:l b))) (force (:m b)))
         (:r b)))

 ; Functions to print finger-trees to graphviz
@@ -103,18 +146,18 @@
 (defmulti print-entry (fn [entry parent-id] (class entry)))
 (defmethod print-entry node-2 [node parent-id]
     (do
-        (println (object-id node) " [label=\"Node2\"]")
+        (println (object-id node) " [label=\"Node2\\n" (extract-measure node nil) "\"]")
         (println parent-id " -> " (object-id node) " [weight=2]")
         (print-entry (:a node) (object-id node))
         (print-entry (:b node) (object-id node))))
 (defmethod print-entry node-3 [node parent-id]
     (do
-        (println (object-id node) " [label=\"Node3\"]")
+        (println (object-id node) " [label=\"Node3\\n" (extract-measure node nil) "\"]")
         (println parent-id " -> " (object-id node) " [weight=2]")
         (print-entry (:a node) (object-id node))
         (print-entry (:b node) (object-id node))
         (print-entry (:c node) (object-id node))))
-(defmethod print-entry :default [entry parent-id]
+(defmethod print-entry ::any [entry parent-id]
     (do
         (println (object-id entry) " [label=\"" entry "\"]")
         (when parent-id (println parent-id " -> " (object-id entry) " [weight=1]"))))
@@ -129,12 +172,12 @@
 (defmethod print-finger-tree finger-tree-empty [_ _] nil)
 (defmethod print-finger-tree finger-tree-single [node parent-id]
     (do
-        (println (object-id node) " [label=\"Single\"]")
+        (println (object-id node) " [label=\"Single\\n" (extract-measure node {:monoid node}) "\"]")
         (when parent-id (println parent-id " -> " (object-id node) " [weight=4]"))
-        (print-entry (:v node) (object-id node))))
+        (print-entry (:e node) (object-id node))))
 (defmethod print-finger-tree finger-tree-deep [node parent-id]
     (do
-        (println (object-id node) " [label=\"Deep\"]")
+        (println (object-id node) " [label=\"Deep\\n" (extract-measure node {:monoid node}) "\"]")
         (when parent-id (println parent-id " -> " (object-id node) " [weight=4]"))
         (print-digits (:l node) (object-id node))
         (print-finger-tree (force (:m node)) (object-id node))
@@ -145,6 +188,9 @@
         (println "digraph {")
         (print-finger-tree tree nil)
         (println "}")))))
+
+(def count-monoid
+    (monoid. (fn [_] 1) +))

 (defn go [t vec func filename]
     (do
@@ -156,10 +202,10 @@
             (go (func t (first vec)) (rest vec) func filename))))

 (println "Forwards..")
-(def t1 (go (finger-tree-empty.) (range 1 20) push-front "/tmp/forwards.dot"))
+(def t1 (go (make-finger-tree-empty count-monoid) (range 1 20) push-front "/tmp/forwards.dot"))

 (println "Backwards..")
-(def t2 (go (finger-tree-empty.) (range 20 40) push-back "/tmp/backwards.dot"))
+(def t2 (go (make-finger-tree-empty count-monoid) (range 20 40) push-back "/tmp/backwards.dot"))

 (print-finger-tree-to-file
     (concatenate t1 t2)


Add comments to failing test.

Add comments to failing test.

--- test/haystack/search_test.clj
+++ test/haystack/search_test.clj
@@ -14,6 +14,9 @@

 ;; Defining these search use cases is an attempt
 ;; at preventing these perturbations of the force.
+
+;; In general, we should define a failing test before
+;; modifying the algorithm.

 (test-search matnrs-check
  {:search "2843977 2542450"}
@@ -43,7 +46,7 @@
 ;; needs to remain, because "12pvc" should be valid hits.
 (test-search pvc-check
  {:search "2pvc"}
- (not-in-top 10 29531)
- (in-top 10 29797)
+ (not-in-top 10 29531)  ;; summit part #: 12PVC
+ (in-top 10 29797)      ;; summit part #: 2PVCC
  )


CMR-5743: Fixed the way to retrieve application-public-root-url (#788)

--- collection-renderer-lib/src/cmr/collection_renderer/services/collection_renderer.clj
+++ collection-renderer-lib/src/cmr/collection_renderer/services/collection_renderer.clj
@@ -150,4 +150,4 @@
                  "edsc_url" (search-edsc-url)
                  "concept_id" concept-id
                  "additional_information" additional-information
-                 "search_public_root_url" (config/application-public-root-url :search)}))))
+                 "search_public_root_url" (config/application-public-root-url context)}))))


CMR-2112 Write results to CSV

CMR-2112 Write results to CSV

--- system-int-test/test/cmr/system_int_test/ingest/ops_collections_translation_test.clj
+++ system-int-test/test/cmr/system_int_test/ingest/ops_collections_translation_test.clj
@@ -2,6 +2,8 @@
   "Translate OPS collections into various supported metadata formats."
   (:require
     [clj-http.client :as client]
+    [clojure.data.csv :as csv]
+    [clojure.java.io :as io]
     [clojure.string :as str]
     [clojure.test :refer :all]
     [cmr.common.concepts :as concepts]
@@ -22,6 +24,15 @@
 (use-fixtures :each (ingest/reset-fixture {"provguid1" "PROV1"}))

 (def context (lkt/setup-context-for-test lkt/sample-keyword-map))
+
+(def write-errors-to-file
+  false)
+
+(def CSV_FILENAME
+  "Ops_Umm_Translation_Errors.csv")
+
+(def CSV_HEADER
+  ["Provider Id" "Concept Id" "Entry Title" "Errors"])

 (def starting-page-num
   "The starting page-num to retrieve collections for the translation test."
@@ -284,7 +295,7 @@
     (let [collections (get-collections validation-search-page-size page-num)
           error-results (remove nil? (map translate-and-validation-collection collections))
           all-results (conj results error-results)]
-      (println "Processed Page " page-num " " (count error-results) " errors")
+      (info "Processed Page " page-num " " (count error-results) " errors")
       (if (>= (count collections) validation-search-page-size)
         (recur (+ page-num 1) all-results)
         all-results))))
@@ -303,9 +314,25 @@
            (recur (+ page-num 1)))))
      (info "Finished OPS collections translation.")))

+(defn- validation-result->row
+  "Take a validation result and return a row formatted for CSV"
+  [result]
+  (let [{:keys [provider-id concept-id entry-title errors]} result
+        error-string (str/join "; " errors)]
+    [provider-id concept-id entry-title error-string]))
+
 #_(deftest ops-collections-validation
    (testing "get-collections the current collections in ops against the current UMM schema"
      (def results (get-ops-collections-umm-validation-errors))
+     (let [rows (cons CSV_HEADER
+                      (map validation-result->row (flatten results)))
+           string-writer (StringWriter.)]
+       (if write-errors-to-file
+         (with-open [out-file (io/writer CSV_FILENAME)]
+           (csv/write-csv out-file rows))
+         (do
+           (csv/write-csv string-writer rows)
+           (def error-csv (str string-writer)))))
     (info "Finished OPS collections translation.")))

 (comment


Fixed timer bug.

Fixed timer bug.

--- src/cljs/wombats_web_client/components/countdown_timer.cljs
+++ src/cljs/wombats_web_client/components/countdown_timer.cljs
@@ -53,13 +53,11 @@
             minutes-formatted (str (when (< minutes-adjusted 10) "0") minutes-adjusted)]
         (str (when (> hours 0) (str hours ":")) minutes-formatted ":" seconds-formatted))

-      ;; set to 0 time and clear timer
-      (do
-        (clear-timers cmpnt-state)
-        "0:00"))))
+      ;; set to 0 time
+      "0:00")))

 (defn countdown-timer
-  [start-time id]
+  [start-time]

   (let [cmpnt-state (reagent/atom {:interval-fn nil
                                    :timeout-fn nil
@@ -88,7 +86,7 @@
       :component-will-unmount #(clear-timers cmpnt-state)

       :reagent-render
-      (fn []
+      (fn [start-time]
         ;; triggers a rerender for active timers, will not affect timers with no interval timer
         (:update-counter @cmpnt-state)


CMR-2250: Refactor atom to use map-indexed instead

--- system-int-test/test/cmr/system_int_test/search/collection_highlights_search_test.clj
+++ system-int-test/test/cmr/system_int_test/search/collection_highlights_search_test.clj
@@ -220,18 +220,16 @@
                                          {:include-highlights true}
                                          {:keyword "MODIS/Terra"})))))

-;; TODO Switch atom to map-indexed
-
 (deftest reserved-characters-test
   ;; This test documents the current elasticsearch highlighting behavior with respect to reserved
-  ;; characters. The behavior is inconsistent for the : ? and * characters
+  ;; characters. The behavior is inconsistent for the : ? and * characters.
   (let [reserved-strings #{"+" "-" "=" "&&" "||" ">" "<" "!" "(" ")" "{" "}" "[" "]" "^" "\"" "~" "*"
                            "?" ":" "\\" "/"}
-        reserved-strings-with-different-behavior #{":" "?" "*"}
-        counter (atom 0)]
-    (doseq [reserved-string reserved-strings]
-      (swap! counter inc)
-      (make-coll @counter {:summary (format "MODIS%sTERRA dataset." reserved-string)}))
+        reserved-strings-with-different-behavior #{":" "?" "*"}]
+    ;; Ingest one collection with a different reserved character for each collection. For example,
+    ;; MODIS+TERRA, MODIS-TERRA, MODIS&&TERRA, etc.
+    (dorun (map-indexed #(make-coll (inc %1) {:summary (format "MODIS%sTERRA dataset." %2)})
+                        reserved-strings))
     (index/wait-until-indexed)

     (testing "Most reserved characters are not highlighted when they are searched against."
@@ -253,12 +251,12 @@

     (testing "Wildcard searches do not highlight any strings with reserved characters except for
              colon."
-      (doseq [reserved-string #{"*" "?"}]
-        (is (= (set [nil nil nil ["MODIS:TERRA dataset."] nil nil nil nil nil nil])
-               (set (get-search-results-summaries (search/find-concepts-in-json-with-json-query
-                                                    :collection
-                                                    {:include-highlights true}
-                                                    {:keyword (format "MODIS%sTERRA"
-                                                                      reserved-string)})))))))))
-
-
+             (doseq [reserved-string #{"*" "?"}]
+               (is (= (set [nil nil nil ["MODIS:TERRA dataset."] nil nil nil nil nil nil])
+                      (set (get-search-results-summaries
+                             (search/find-concepts-in-json-with-json-query
+                                                           :collection
+                                                           {:include-highlights true}
+                                                           {:keyword (format "MODIS%sTERRA"
+                                                                             reserved-string)})))))))))
+


Test subselects with named parameters.

Test subselects with named parameters.

--- test/fhofherr/clj_db_util/jdbc_template_test.clj
+++ test/fhofherr/clj_db_util/jdbc_template_test.clj
@@ -6,16 +6,29 @@

 (deftest named-parameters
-  (let [stmt "SELECT 1 AS result FROM dual WHERE 1 = :number"]
-    (is (= {:result 1}
-         (t/query-str h2
-                      (test-db/h2-private-in-memory)
-                      stmt
-                      :params {:number 1}
-                      :result-set-fn first)))
-    (is (nil?
-         (t/query-str h2
-                      (test-db/h2-private-in-memory)
-                      stmt
-                      :params {:number 2}
-                      :result-set-fn first)))))
+  (testing "simple statements"
+    (let [stmt "SELECT 1 AS result FROM dual WHERE 1 = :number"]
+      (is (= {:result 1}
+             (t/query-str h2
+                          (test-db/h2-private-in-memory)
+                          stmt
+                          :params {:number 1}
+                          :result-set-fn first)))
+      (is (nil?
+            (t/query-str h2
+                         (test-db/h2-private-in-memory)
+                         stmt
+                         :params {:number 2}
+                         :result-set-fn first)))))
+  (testing "subselects"
+    (let [stmt "SELECT 1 AS result
+                FROM dual
+                WHERE 1 = :number
+                  AND EXISTS (SELECT 1 FROM DUAL WHERE 2 = :another-number)"]
+      (is (= {:result 1}
+             (t/query-str h2
+                          (test-db/h2-private-in-memory)
+                          stmt
+                          :params {:number 1
+                                   :another-number 2}
+                          :result-set-fn first))))))


adds support for utilization in the simulator output (#376)

--- waiter/src/waiter/simulator.clj
+++ waiter/src/waiter/simulator.clj
@@ -53,6 +53,7 @@
   Stats:
     total-queue-time       The total amount of ticks that clients have been sitting in the queue.
     total-idle-server-time The total amount of ticks that servers have been sitting idle.
+    utilization            The percentage of servers that are in use during the current tick.
     scale-ups              The total number of scale up operations.
     scale-downs            The total number of scale down operations."
   [{:strs [idle-ticks request-ticks startup-ticks]}
@@ -112,7 +113,11 @@
         active-requests' (vec (concat (drop requests-to-cancel (filter #(< tick %) active-requests))
                                       (map (fn [_] (+ tick (randomized request-ticks))) (range requests-created))))
         queued-clients' (max 0 (- interested-clients available-servers))
-        idle-servers' (+ (max 0 (- available-servers interested-clients)) requests-to-cancel)]
+        idle-servers' (+ (max 0 (- available-servers interested-clients)) requests-to-cancel)
+        total-instances (+ (count starting-servers') (count active-requests') idle-servers')
+        utilization (if (pos? total-instances)
+                      (* 100.0 (/ (count active-requests') total-instances))
+                      0.0)]
     (assoc current-state :idle-clients idle-clients'
                          :interested-clients interested-clients
                          :activating-clients activating-clients
@@ -126,9 +131,10 @@
                          :starting-servers starting-servers'
                          :outstanding-requests (+ (count active-requests') queued-clients')
                          :total-clients (+ (count active-requests') (count idle-clients') queued-clients')
-                         :total-instances (+ (count starting-servers') (count active-requests') idle-servers')
+                         :total-instances total-instances
                          :total-queue-time (+ total-queue-time queued-clients)
                          :total-idle-server-time (+ total-idle-server-time idle-servers)
+                         :utilization utilization
                          :healthy-instances (+ (count active-requests') idle-servers')
                          :scale-amount scale-amount
                          :target-instances target-instances


Set proper defaults for api urls.

Set proper defaults for api urls.

--- scripts/figwheel.clj
+++ scripts/figwheel.clj
@@ -16,7 +16,7 @@
       :parallel-build false
       :optimizations :none
       :closure-defines {"uxbox.common.constants.url"
-                        "http://localhost:6060/api"}
+                        "https://test.uxbox.io/api"}
       :warnings {:ns-var-clash false}
       :language-in  :ecmascript6
       :language-out :ecmascript5
@@ -33,7 +33,7 @@
       :parallel-build false
       :optimizations :none
       :closure-defines {"uxbox.common.constants.url"
-                        "http://localhost:6060/api"}
+                        "https://test.uxbox.io/api"}
       :warnings {:ns-var-clash false}
       :language-in  :ecmascript6
       :language-out :ecmascript5


insights: slight testability refactor

insights: slight testability refactor

--- src-cljs/frontend/components/insights.cljs
+++ src-cljs/frontend/components/insights.cljs
@@ -185,7 +185,7 @@
     ;; positive bar
     (-> enter
         (.insert "rect")
-        (.attr #js {"class" #(.-outcome %)
+        (.attr #js {"class" #(str "bar " (.-outcome %))
                     "y" #(y-pos-scale (.-build_time_minutes %))
                     "x" #(x-scale (.-build_num %))
                     "width" (.rangeBand x-scale)
@@ -194,21 +194,25 @@
     ;; negative (queue time) bar
     (-> enter
         (.insert "rect")
-        (.attr #js {"class" "queue"
+        (.attr #js {"class" "bar queue"
                     "y" y-middle
                     "x" #(x-scale (.-build_num %))
                     "width" (.rangeBand x-scale)
                     "height" #(- (y-neg-scale (.-queued_time_minutes %)) y-middle)}))))

+(defn chartable-builds [builds]
+  (->> builds
+       (filter build-graphable)
+       reverse
+       (map add-queued-time)
+       (map add-minute-measures)))
+
 (defn project-insights-bar [builds owner]
-  (let [chart-builds (->> builds
-                           (filter build-graphable)
-                           reverse
-                           (map add-queued-time)
-                           (map add-minute-measures))]
+  (let [chart-builds (chartable-builds builds)]
     (reify
       om/IDidUpdate
       (did-update [_ prev-props prev-state]
+        (.error js/console  "update called.")
         (let [el (om/get-node owner)]
           (visualize-insights-bar! el chart-builds)))
       om/IRender


Fix lib.auth-test

Fix lib.auth-test

--- backend/test/akvo/lumen/lib/auth_test.clj
+++ backend/test/akvo/lumen/lib/auth_test.clj
@@ -29,13 +29,13 @@
               :bucketColumn "c4"},
              :status "OK",
              :id v-id})
-           {:dataset-ids #{ds-id}, :visualisation-ids #{v-id}, :spec-valid? spec-valid?})))
+           {:dashboard-ids #{}, :dataset-ids #{ds-id}, :visualisation-ids #{v-id}, :spec-valid? spec-valid?})))
   (let [ds-id "1"
         spec-valid? false]
     (is (= (auth/ids
             :akvo.lumen.specs.visualisation.maps/layers
             [{:aggregationMethod "avg", :popup [], :filters [], :layerType "geo-location", :legend {:title "latitude", :visible true}, :rasterId nil, :pointSize 3, :pointColorMapping [], :longitude nil, :datasetId ds-id, :title "Untitled layer 1", :geom "d1", :pointColorColumn "c2", :latitude nil, :visible true}])
-           {:dataset-ids #{ds-id}, :visualisation-ids #{}, :spec-valid? spec-valid?})))
+           {:dashboard-ids #{} :dataset-ids #{ds-id}, :visualisation-ids #{}, :spec-valid? spec-valid?})))
   (let [ds-id "5cac541e-ba6c-4c78-969a-c55d624fc5ba"
         spec-valid? true]
     (is (= (auth/ids
@@ -86,6 +86,7 @@
               :latitude nil,
               :visible true}])
            {:dataset-ids #{ds-id},
+            :dashboard-ids #{}
             :visualisation-ids #{},
             :spec-valid? spec-valid?}))))


improve logging message

improve logging message

--- src/babel/directory.cljc
+++ src/babel/directory.cljc
@@ -24,7 +24,7 @@
                       (do (log/debug (str "starting to load english model.."))
                           (let [model (babel.english.grammar/medium)]
                             (log/info (str "finished loading english model: "
-                                           "type: " (type model)))
+                                           (:name model)))
                             model)))))
      :es (fn []
            (if (realized? es)


use hashCode instead of (hash)

use hashCode instead of (hash)

--- src/bzzz/index_store.clj
+++ src/bzzz/index_store.clj
@@ -135,8 +135,8 @@
                                                  (filter (fn [doc]
                                                            ;; FIXME: use consistent hashing
                                                            (let [hashCode (if-let [id (:id doc)]
-                                                                            (hash id)
-                                                                            (hash doc))]
+                                                                            (.hashCode id)
+                                                                            (.hashCode doc))]
                                                              (= n (mod hashCode number-of-shards))))
                                                          documents)
                                                  facets


remove old drop fn from seed

remove old drop fn from seed

--- src/chat/server/seed.clj
+++ src/chat/server/seed.clj
@@ -1,9 +1,6 @@
 (ns chat.server.seed
   (:require [chat.server.db :as db]
             [environ.core :refer [env]]))
-
-(defn drop! []
-  (datomic.api/delete-database db/*uri*))

 (defn seed! []
   (let [group-1 (db/create-group! {:id (db/uuid) :name "Braid"})


Don't leak component local state.

Don't leak component local state.

--- src/cleanstreet/map.cljs
+++ src/cleanstreet/map.cljs
@@ -2,9 +2,6 @@
   (:require [reagent.core :as reagent]
             [re-frame.core :refer [subscribe dispatch]]
             [clojure.data :as data]))
-
-(defn- initial-render [& _]
-  [:div {:style {:height "600px"}}])

 (defn- build-map [component]
   (let [map-canvas (reagent/dom-node component)
@@ -100,4 +97,5 @@
   (let [paths (subscribe [:paths])
         editing (subscribe [:is-new-path])
         new-path (subscribe [:new-path])]
-    [google-map-wrapper @paths @editing @new-path]))
+    (fn []
+      [google-map-wrapper @paths @editing @new-path])))


remove a bunch of reflection warnings

remove a bunch of reflection warnings

--- src/clj/cljs/closure.clj
+++ src/clj/cljs/closure.clj
@@ -45,6 +45,7 @@
            java.net.URL
            java.util.logging.Level
            java.util.jar.JarFile
+           java.util.List
            com.google.common.collect.ImmutableList
            com.google.javascript.jscomp.CompilerOptions
            com.google.javascript.jscomp.CompilationLevel
@@ -164,8 +165,8 @@
     (map #(io/resource %)
          (filter #(do
                     (and
-                      (.startsWith % lib-path)
-                      (.endsWith % ".js")))
+                      (.startsWith ^String % lib-path)
+                      (.endsWith ^String % ".js")))
                  (jar-entry-names jar-path)))))
 (declare to-url)
 (defn find-js-fs
@@ -173,13 +174,13 @@
   [path]
   (let [file (io/file path)]
     (when (.exists file)
-      (map to-url (filter #(.endsWith (.getName %) ".js") (file-seq (io/file path)))))))
+      (map to-url (filter #(.endsWith ^String (.getName ^File %) ".js") (file-seq (io/file path)))))))

 (defn find-js-classpath
   "finds all js files on the classpath matching the path provided"
   [path]
-  (let [process-entry #(if (.endsWith % ".jar")
+  (let [process-entry #(if (.endsWith ^String % ".jar")
                            (find-js-jar % path)
                            (find-js-fs (str % "/" path)))
         cpath-list (let [sysp (System/getProperty  "java.class.path" )]
@@ -579,13 +580,13 @@
   "Create an index of Google dependencies by namespace and file name."
   []
   (letfn [(parse-list [s] (when (> (count s) 0)
-                            (-> (.substring s 1 (dec (count s)))
+                            (-> (.substring ^String s 1 (dec (count s)))
                                 (string/split #"'\s*,\s*'"))))]
     (->> (line-seq (io/reader (io/resource "goog/deps.js")))
          (map #(re-matches #"^goog\.addDependency\(['\"](.*)['\"],\s*\[(.*)\],\s*\[(.*)\]\);.*" %))
          (remove nil?)
          (map #(drop 1 %))
-         (remove #(.startsWith (first %) "../../third_party"))
+         (remove #(.startsWith ^String (first %) "../../third_party"))
          (map #(hash-map :file (str "goog/"(first %))
                          :provides (parse-list (second %))
                          :requires (parse-list (last %))
@@ -747,12 +748,12 @@
   "Use the Closure Compiler to optimize one or more JavaScript files."
   [opts & sources]
   (let [closure-compiler (make-closure-compiler)
-        externs (load-externs opts)
+        ^List externs (load-externs opts)
         compiler-options (make-options opts)
         sources (if (= :whitespace (:optimizations opts))
                   (cons "var CLOSURE_NO_DEPS = true;" sources)
                   sources)
-        inputs (map #(js-source-file (javascript-name %) %) sources)
+        ^List inputs (map #(js-source-file (javascript-name %) %) sources)
         result ^Result (.compile closure-compiler externs inputs compiler-options)]
     (if (.success result)
       ;; compiler.getSourceMap().reset()


Fix improvement windowing

Fix improvement windowing

--- src/clojush/evaluate.clj
+++ src/clojush/evaluate.clj
@@ -205,7 +205,7 @@
                                 ":print-history must be true for :case-stagnation"))
                             (if (empty? (rest (:history ind)))
                               (vec (repeat (count (:errors ind)) 1000000))
-                              (vec (for [case-history (take 10 (apply map list (:history ind)))] ;;;; NOTE WINDOW
+                              (vec (for [case-history (map (partial take 10) (apply map list (:history ind)))] ;;;; NOTE WINDOW
                                      (if (zero? (first case-history))
                                        ;; note only zero is solved
                                        ;; error-threshold applies to total so can't be used here


filter hidden files out

filter hidden files out

--- src/codeitlater/core.clj
+++ src/codeitlater/core.clj
@@ -41,13 +41,17 @@
   "return a lazy sequence including all files"
   (map #(.getPath %) (file-seq (io/file root))))

+(defn is-hidden-file? [filepath]
+  "check file is hidden file or not"
+  (if (re-find #"#.*$" filepath) true nil))

 ;;(partial read-comments-inline commentMark)
 (defn read-files
   "Read all files depend on root path and file types, find comments inside and return."
   ([commentDict root]
    (doall (for [filepath (get-all-files root)
-                :when (not (.isDirectory (io/file filepath)))
+                :when (not (or (.isDirectory (io/file filepath))
+                               (is-hidden-file? filepath)))
                 :let [mark (get commentDict (re-find #"(?<=\w)\.\w+$" filepath))]
                 :when mark
                 :let [comment (read-comments-in-file filepath mark)]
@@ -60,7 +64,8 @@
                         (list (re-pattern (str ".+" filetype "$"))
                               (str "." filetype)))]
      (doall (for [filepath (get-all-files root)
-                  :when (not (.isDirectory (io/file filepath)))
+                  :when (not (or (.isDirectory (io/file filepath))
+                                 (is-hidden-file? filepath)))
                   typepattern typepatterns
                   :when (re-matches (first typepattern) filepath)
                   :let [mark (get commentDict (re-find #"(?<=\w)\.\w+$" filepath))]


Factor out color, fix coordinate calculation.

--- src/afterglow/controllers/ableton_push.clj
+++ src/afterglow/controllers/ableton_push.clj
@@ -7,35 +7,40 @@

 (defonce user-port-out (midi/midi-out "Ableton Push User Port"))

+(defn velocity-for-color
+  "Given a target color, calculate the MIDI note velocity which will
+  achieve the closest approximation available on an Ableton Push
+  pad."
+  [color]
+  {:pre [(= (type color) :com.evocomputing.colors/color)]}
+  ;; Each hue section, starts with a desaturated version,
+  ;; then does a bright, medium, and dim version.
+  (let [brightness-shift (condp < (colors/lightness color)
+                           60 0
+                           37 1
+                           15 2
+                           3)]
+    (cond (< (colors/lightness color) 3)  ;; Black, off
+          0
+
+          ;; The first four velocities are a white/gray section, starting
+          ;; with black as zero, through white as three.
+          (< (colors/saturation color) 20)
+          (min 3 (- 4 brightness-shift))
+
+          ;; Find the note value that approximates the hue and lightness.
+          ;; From note 4 to note 59, the pads are in groups of four for
+          ;; a single hue, starting with the desaturated version, then
+          ;; the bright, medium, and dim versions.
+          :else
+          (let [hue-section (+ 4 (* 4 (math/floor (* 13 (/ (colors/hue color) 360)))))]
+            (+ hue-section brightness-shift)))))
+
 (defn set-pad-color
   "Set the color of one of the 64 touch pads to the closest
   approximation available for a desired color."
   [x y color]
-  {:pre [(<= 0 x 7) (<= 0 y 7) (= (type color) :com.evocomputing.colors/color)]}
-  (let [note (+ 36 (* x y))  ;; Note from grid coordinates
-        ;; For hues, starts with a desaturated version,
-        ;; then does a bright, medium, and dim version.
-        brightness-shift (condp < (colors/lightness color)
-                           60 0
-                           37 1
-                           15 2
-                           3)]
-    (println "lightness" (colors/lightness color) "brightness-shift" brightness-shift)
-    (cond (< (colors/lightness color) 3)  ;; Black, off
-          (midi/midi-note-off user-port-out note)
+  {:pre [(<= 0 x 7) (<= 0 y 7)]}
+  (let [note (+ 36 x (* y 8))]  ;; Calculate note from grid coordinates
+    (midi/midi-note-on user-port-out note (velocity-for-color color))))

-          ;; The first four velocities are a white/gray section, starting
-          ;; with black as zero, through white as three.
-          (< (colors/saturation color) 20)
-          (midi/midi-note-on user-port-out note
-                             (min 3 (- 4 brightness-shift)))
-
-          ;; Find the note value that approximates the hue and lightness.
-          ;; From note 4 to note 59, the pads are in groups of four for
-          ;; a single hue, startind with the desaturated version, then
-          ;; the bright, medium, and dim versions.
-          :else
-          (let [hue-section (+ 4 (* 4 (math/floor (* 13 (/ (colors/hue color) 360)))))]
-            (println "hue section" hue-section)
-            (midi/midi-note-on user-port-out note (+ hue-section brightness-shift))))))
-


adjusted hp-filter parameter slightly for Berk. presentation


Add colors to cards.

Add colors to cards.

--- src/cljs/hatnik/web/client/components.cljs
+++ src/cljs/hatnik/web/client/components.cljs
@@ -39,7 +39,8 @@
                    (state/set-current-action action)
                    (.modal ($ :#iModal)))
         :className "panel panel-default"}
-   (dom/div #js {:className "panel-body"}
+   (dom/div
+    #js {:className "panel-body bg-success"}
             (render-action-type (get action "type"))
             (str " "
                  (get action "library")
@@ -54,8 +55,9 @@
 (defn add-new-action [project-id]
   (dom/div #js {:className "panel panel-default panel-info"
               :onClick #(add-action project-id)}
-           (dom/div #js {:className "panel-body"}
-                    "Add new action")))
+           (dom/div #js {:className "panel-body bg-info"}
+                    (dom/span #js {:className "glyphicon glyphicon-plus"})
+                    " Add new action")))

 (defn actions-table [id actions]


refactor: rename function

refactor: rename function

--- src/blogiseq/core.clj
+++ src/blogiseq/core.clj
@@ -10,7 +10,7 @@
   (:gen-class))

 ;;;;;;;;;;;;;;; Menu gen
-(defn menu-edn->hiccup
+(defn articles-edn->hiccup
   [edn]
   [:ul
   (map
@@ -28,7 +28,7 @@
   (-> path
     parse-meta-edn
     :articles
-    menu-edn->hiccup))
+    articles-edn->hiccup))

 (def left
   [:div


clarify IParseErrorMessage invoke in `cljs.repl/pst`

--- src/clj/cljs/repl.clj
+++ src/clj/cljs/repl.clj
@@ -966,6 +966,8 @@
          (when ret
            (let [ret (update-in ret [:value]
                        (fn [msg]
+                         ;; give REPL environments a chance to fix or
+                         ;; or elide redundant information
                          (if (satisfies? IParseErrorMessage repl-env)
                            (-parse-error-message repl-env msg ret *repl-opts*)
                            msg)))]


Update tests to reflect master problem spec

--- exercises/pangram/test/pangram_test.clj
+++ exercises/pangram/test/pangram_test.clj
@@ -32,6 +32,7 @@
 (deftest mixed-case-and-punctuation
   (is (pangram? "\"Five quacking Zephyrs jolt my wax bed.\"")))

-(deftest non-ascii-characters
-  (is (pangram?
-       "Victor jagt zwölf Boxkämpfer quer über den großen Sylter Deich.")))
+(deftest upper-and-lower-not-counted-separately
+  (is
+    (false?
+      (pangram? "the quick brown fox jumps over with lazy FX"))))


pr comments

pr comments

--- access-control-app/src/cmr/access_control/services/auth_util.clj
+++ access-control-app/src/cmr/access_control/services/auth_util.clj
@@ -64,22 +64,22 @@

 (defn- get-instance-acls
  "Returns any ACLs that grant the given permission to the context user on a specific group by its concept-id or legacy-guid."
- [context action-description permission group]
+ [context action-description group]
  (let [concept-id (:concept-id group)
        legacy-guid (:legacy-guid group)
-       permissions (cond (= action-description "update") [:update]
+       permissions (case action-description
+                         "update" [:update]
                          ;; Update and delete permissions grant read as well, there is no explicit read permissions
                          ;; for single instance acls
-                         (= action-description "read") [:update :delete]
-                         (= action-description "delete") [:delete]
-                         :else [permission])]
+                         "read" [:update :delete]
+                         "delete" [:delete]
+                         "create" [:create])]
    (when (or legacy-guid concept-id)
-     (for [permission permissions
-           :let [acls (acl/get-permitting-acls context :single-instance-object "GROUP_MANAGEMENT" permission)
-                 acls (filter #(or (= concept-id (-> % :single-instance-object-identity :target-guid))
-                                   (= legacy-guid (-> % :single-instance-object-identity :target-guid))) acls)]
-           :when (not-empty acls)]
-       acls))))
+     (let [acls (mapcat #(acl/get-permitting-acls context :single-instance-object "GROUP_MANAGEMENT" %) permissions)]
+       (seq (filter
+             #(or (= concept-id (get-in % [:single-instance-object-identity :target-guid]))
+                  (= legacy-guid (get-in % [:single-instance-object-identity :target-guid])))
+             acls))))))

 (defn- describe-group
   [group]
@@ -102,7 +102,7 @@
   [context action-description permission group]
   (when-not (transmit-config/echo-system-token? context)
     (let [context (put-sids-in-context context)]
-      (when-not (or (get-instance-acls context permission action-description group)
+      (when-not (or (get-instance-acls context action-description group)
                     (get-provider-acls context permission group)
                     (get-system-level-group-acls context permission))
         (throw-group-permission-error action-description group)))))


grammar

grammar

--- access-control-app/src/cmr/access_control/services/auth_util.clj
+++ access-control-app/src/cmr/access_control/services/auth_util.clj
@@ -68,7 +68,7 @@
  (let [concept-id (:concept-id group)
        legacy-guid (:legacy-guid group)
        permissions (cond (= action-description "update") [:update]
-                         ;; Update and delete permissions grant read as well, there is no explicity read permissions
+                         ;; Update and delete permissions grant read as well, there is no explicit read permissions
                          ;; for single instance acls
                          (= action-description "read") [:update :delete]
                          (= action-description "delete") [:delete]


CMR-2585 Adds test users to access control ACL tests

--- access-control-app/int_test/cmr/access_control/int_test/access_control_group_acl_test.clj
+++ access-control-app/int_test/cmr/access_control/int_test/access_control_group_acl_test.clj
@@ -6,7 +6,7 @@
             [cmr.access-control.test.util :as u]))

 (use-fixtures :once (fixtures/int-test-fixtures))
-(use-fixtures :each (fixtures/reset-fixture {"prov1guid" "PROV1" "prov2guid" "PROV2"}))
+(use-fixtures :each (fixtures/reset-fixture {"prov1guid" "PROV1" "prov2guid" "PROV2"} ["user1" "user2" "user3" "user4" "user5"]))

 (deftest create-system-group-test


upgrade

upgrade

--- spinning/project.clj
+++ spinning/project.clj
@@ -1,5 +1,5 @@
 (defproject
-  boot-project
+  ing-spinning
   "0.1.0-SNAPSHOT"
   :dependencies
   [[adzerk/boot-cljs "0.0-3308-0" :scope "test"]
@@ -7,7 +7,7 @@
    [adzerk/boot-reload "0.3.1" :scope "test"]
    [pandeiro/boot-http "0.6.3-SNAPSHOT" :scope "test"]
    [org.clojure/clojure "1.7.0"]
-   [org.clojure/clojurescript "1.7.28"]
+   [org.clojure/clojurescript "1.7.48"]
    [ankha "0.1.5-SNAPSHOT"]
    [ion/poly "0.1.0-SNAPSHOT"]
    [klang "0.2.0-SNAPSHOT"]


Refer start function for restarting the server

--- dev-src/clj/comic_reader/frontend_dev.clj
+++ dev-src/clj/comic_reader/frontend_dev.clj
@@ -1,7 +1,7 @@
 (ns comic-reader.frontend-dev
   (:require [clojure.java.browse :refer [browse-url]]
             [clojure.repl :refer :all]
-            [comic-reader.system :refer [go stop]]
+            [comic-reader.system :refer [go start stop]]
             [figwheel-sidecar.repl-api :refer :all]))

 (defn- cwd []


Deprecate quoted :main

Deprecate quoted :main

--- plugin/src/leiningen/doo.clj
+++ plugin/src/leiningen/doo.clj
@@ -150,6 +150,23 @@
                       cli-build)]
     (find-by-id (project->builds project) build-id)
     (project->test-build project)))
+
+(def ^:private main-quoting-warning
+"
+[doo] WARNING: In project.clj :compiler-opts, value for :main is quoted. This is
+      deprecated and Doo will stop supporting it. To make this warning go away,
+      please change {:main '%s} to {:main %s}.
+")
+
+(defn- fix-quoting
+  "For backwards compability, remove quoting around `:main` config key."
+  [{:keys [main] :as compiler}]
+  (if (and (list? main) (= 'quote (first main)))
+    (do
+      (let [new-main (second main)]
+        (println (str/trim (format main-quoting-warning new-main new-main)))
+        (assoc compiler :main new-main)))
+    compiler))

 ;; ======================================================================
 ;; doo
@@ -189,6 +206,7 @@
                       (add-dep ['doo "0.1.9-SNAPSHOT"]))
          {:keys [source-paths compiler]}
          (cli->build cli project' opts)
+         compiler (fix-quoting compiler)
          ;; opts may have meta-merge metadata, which needs to be passed
          ;; into run-local-project. Unquote does not preserve metadata,
          ;; so we print opts into a string and read it back.


Use default keyboard for username input

Use default keyboard for username input

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


optimize dynamic SQL template by pre-converting single param types to '?'

--- src/asphalt/core.clj
+++ src/asphalt/core.clj
@@ -428,7 +428,13 @@
          (make-row-maker result-types)
          (make-column-reader result-types))
        (isql/->DynamicSqlTemplate
-         sanitized-st
+         (reduce (fn [st token] (cond
+                                  (and (string? token) (string? (last st))) (conj (pop st) (str (last st) token))
+                                  (and (vector? token) (string? (last st))
+                                    (contains? t/single-typemap (second     ; pre-convert single value params to '?'
+                                                                  token)))  (conj (pop st) (str (last st) \?))
+                                  :otherwise                                (conj st token)))
+           [] sanitized-st)
          (make-param-setter (mapv first kt-pairs) (mapv second kt-pairs))
          (make-row-maker result-types)
          (make-column-reader result-types))))))


Category as string

Category as string

--- src/feedme.clj
+++ src/feedme.clj
@@ -8,7 +8,7 @@
   (let [content (or (.getDescription e) (nth (.getContents e) 0))]
     {
      :author (.getAuthor e)
-     :categories (into [] (.getCategories e))
+     :categories (into [] (map #(.getName %) (.getCategories e)))
      :content-type (.getMode content)
      :content (.getValue content)
      :link (.getLink e)
@@ -29,5 +29,4 @@
      :type (.getFeedType feed)
      :published (.getPublishedDate feed)
      :title (.getTitle feed)
-     :entries (map entry (.getEntries feed))
-     }))
+     :entries (map entry (.getEntries feed))}))


Transformed some helper functions to macros.

--- src/helper.clj
+++ src/helper.clj
@@ -14,7 +14,7 @@
   `(loop [args# ~coll]
      (if (empty? args#) nil (do (~@f (first args#))
                                 (recur (rest args#))))))
-
+
 (defmacro lambda
   "Takes the free argument as first parameter and the function value as
     following parameters as function body, i.e.
@@ -47,7 +47,27 @@
   (if (empty? more) `(.*. ~f ~g)
       `(f*g ~f (chain ~g ~@more ))))

-(defn do-map-tree
+(defmacro do-map-tree
+  "Returns a function that maps a named list tree using the given functions
+   to a new tree structure, utilizing side effects heavily.
+   (This is Java inspired madness....)
+   (A list tree is a tree which nodes are of the form (name child1 child2)
+    (where the childs are optional) such that the whole tree is represented
+    by its root node.)
+
+   Parameters:
+     mk        _function that maps a node name to the new node data structure
+     add       _function that takes as arguments the root and the child node
+                (as side effect!!)"
+  [mk add]
+  `(fn mapper# [tree#]
+     (let [root# (~mk (first tree#))
+           childs# (rest tree#)]
+       (do
+         (one-by-one childs# (lambda (x#) (~add root# (mapper# x#))))
+         root#))))
+
+(defmacro do-map-tree*
   "Maps a named list tree using the given functions to a new tree structure,
    utilizing side effects heavily. (This is Java inspired madness....)
    (A list tree is a tree which nodes are of the form (name child1 child2)
@@ -60,8 +80,4 @@
                 (as side effect!!)
      tree      _the tree that is mapped"
   [mk add tree]
-  (let [root (mk (first tree))
-        childs (rest tree)]
-    (do
-      (one-by-one childs (lambda (x) (add root (do-map-tree mk add x))))
-      root )))
+  `((do-map-tree ~mk ~add) ~tree))


Update project template

Update project template

--- project-template/project.clj
+++ project-template/project.clj
@@ -1,7 +1,7 @@
 (defproject sketch "0.1.0-SNAPSHOT"
   :description "A template for a sketch with Quil/Processing"
   :dependencies [[org.clojure/clojure "1.10.1"]
-                 [genartlib/genartlib "0.1.21"]] ; utility functions
+                 [genartlib/genartlib "0.1.22"]] ; utility functions
   :jvm-opts ["-Xms4000m" "-Xmx4000M" ; 4GB heap size
              "-server"
              "-Dsun.java2d.uiScale=1.0"] ; adjust scaling for high DPI displays


moving to new eip function and fixing terminate and stop

--- src/aws/provider.clj
+++ src/aws/provider.clj
@@ -13,9 +13,9 @@
   (:require
     [amazonica.aws.ec2 :as ec2]
     [aws.common :refer (with-ctx instance-desc creds image-id)]
-    [aws.networking :refer (update-ip set-hostname pub-dns)]
+    [aws.networking :refer
+      (update-ip set-hostname pub-dns assoc-pub-ip describe-eip)]
     [aws.volumes :refer (delete-volumes handle-volumes)]
-    [aws.sdk.eip :as eip]
     [aws.validations :refer (provider-validation)]
     [celestial.persistency :as p]
     [clojure.core.strint :refer (<<)]
@@ -70,7 +70,7 @@
        (handle-volumes spec endpoint instance-id)
        (when-let [ip (get-in spec [:machine :ip])]
          (debug (<<  "Associating existing ip ~{ip} to instance-id"))
-          (with-ctx eip/assoc-pub-ip instance-id ip))
+         (with-ctx (assoc-pub-ip endpoint instance-id ip)))
        (update-ip spec endpoint instance-id)
        (wait-for-ssh (pub-dns endpoint instance-id) user [5 :minute])
        (set-hostname spec endpoint instance-id user)
@@ -82,8 +82,8 @@
       (with-ctx ec2/start-instances {:instance-ids [instance-id]})
       (wait-for-status this "running" [5 :minute])
       (when-let [ip (get-in spec [:machine :ip])]
-        (debug (<<  "Associating existing ip ~{ip} to instance-id"))
-        (with-ctx eip/assoc-pub-ip instance-id ip))
+        (debug (<<  "Associating existing ip ~{ip} to ~{instance-id}"))
+        (with-ctx (assoc-pub-ip endpoint instance-id ip)))
       (update-ip spec endpoint instance-id)
       (wait-for-ssh (pub-dns endpoint instance-id) user [5 :minute])
       ))
@@ -92,7 +92,7 @@
     (with-instance-id
       (debug "deleting" instance-id)
       (delete-volumes endpoint instance-id (spec :system-id))
-      (with-ctx ec2/terminate-instances {:instance-ids instance-id})
+      (with-ctx ec2/terminate-instances {:instance-ids [instance-id]})
       (wait-for-status this "terminated" [5 :minute])
       ; for reload support
       (s/update-system (spec :system-id)
@@ -102,11 +102,11 @@
   (stop [this]
     (with-instance-id
        (debug "stopping" instance-id)
-       (when-not (first (:addresses (with-ctx eip/describe-eip instance-id)))
+       (when-not (first (:addresses (with-ctx (describe-eip endpoint instance-id))))
          (debug "clearing dynamic ip from system")
          (s/update-system (spec :system-id)
            (dissoc-in* (s/get-system (spec :system-id)) [:machine :ip])))
-       (with-ctx ec2/stop-instances {:instance-ids instance-id})
+       (with-ctx ec2/stop-instances {:instance-ids [instance-id]})
        (wait-for-status this "stopped" [5 :minute])))

   (status [this]


cleanup

cleanup

--- src/babel/reader.clj
+++ src/babel/reader.clj
@@ -105,13 +105,6 @@

         target-expression
         (target-timing-fn (babel.generate/generate target-spec target-model))
-
-        pred (unify/get-in target-expression
-                                    [:synsem :sem :pred])
-        subj (unify/get-in target-expression
-                                    [:synsem :sem :subj :pred])
-        tense (unify/get-in target-expression
-                                     [:synsem :sem :tense])
         source-spec
         (unify/strip-refs
          (unify/unify


Clojure ETL full-dataset test incorrectly removes first element

The form of the test data uses a subvec with an index of 1:
(subvec (clojure.string/split "AEIOULNRST" #"") 1)
That removes the first element from the list so "A" is lost and
the current example fails that test. Fix it so the initial letter
is not removed and example is correct for test.

Signed-off-by: Geoff Lane <c3918f39022407dee6a0056ceca9b1aa80e8e4ce@zorched.net>

--- assignments/clojure/etl/etl_test.clj
+++ assignments/clojure/etl/etl_test.clj
@@ -22,13 +22,13 @@
            "u"  1 "v"  4 "w" 4 "x" 8 "y" 4
            "z" 10 }
          (etl/transform {
-             1 (subvec (clojure.string/split "AEIOULNRST" #"") 1)
-             2 (subvec (clojure.string/split "DG" #"") 1)
-             3 (subvec (clojure.string/split "BCMP" #"") 1)
-             4 (subvec (clojure.string/split "FHVWY" #"") 1)
-             5 (subvec (clojure.string/split "K" #"") 1)
-             8 (subvec (clojure.string/split "JX" #"") 1)
-            10 (subvec (clojure.string/split "QZ" #"") 1)
+             1 (clojure.string/split "AEIOULNRST" #"")
+             2 (clojure.string/split "DG" #"")
+             3 (clojure.string/split "BCMP" #"")
+             4 (clojure.string/split "FHVWY" #"")
+             5 (clojure.string/split "K" #"")
+             8 (clojure.string/split "JX" #"")
+            10 (clojure.string/split "QZ" #"")
          }))))

 (run-tests)


:pencil2: Log message typo

:pencil2: Log message typo

Co-authored-by: Mathieu Brunot <cbb78c9d6ecc8139b4697c3352cc1f1edbdf61d7@monogramm.io>

--- backend/src/app/http/auth/gitlab.clj
+++ backend/src/app/http/auth/gitlab.clj
@@ -74,7 +74,7 @@
       (let [data (json/read-str (:body res))]
         (get data "access_token"))
       (catch Throwable e
-        (log/error "unexpected error on parsing response body from gitlab access tooken request" e)
+        (log/error "unexpected error on parsing response body from gitlab access token request" e)
         nil))))

@@ -150,4 +150,3 @@
        :headers {"location" (str uri)}
        :cookies (session/cookies sid)
        :body ""})))
-


Fix key name in stash-jsonapi-redis-list

--- src/baleen/stash.clj
+++ src/baleen/stash.clj
@@ -73,7 +73,7 @@
   [context list-name remote-name json-api-type overwrite]
   (l/info "Attempt stash" list-name " -> " remote-name)
   (with-open [^Jedis redis-conn (baleen-redis/get-connection context)]
-    (let [list-name-key (str (bcontext/get-app-name context))
+    (let [list-name-key (str (bcontext/get-app-name context) "-" list-name)
           list-range (.lrange redis-conn list-name-key 0 -1)
           key-exists (.exists redis-conn list-name-key)]
       (if-not key-exists


use /dangerzone/* API namespace

use /dangerzone/* API namespace

--- src-cljs/frontend/api.cljs
+++ src-cljs/frontend/api.cljs
@@ -20,7 +20,7 @@

 (defn get-bitbucket-repos [api-ch & {:keys [page]
                                   :or {page 1}}]
-  (ajax/ajax :get (str "/api/v2/user/repos/bitbucket?page=" page)
+  (ajax/ajax :get (str "/api/dangerzone/user/repos/bitbucket?page=" page)
              :bitbucket-repos
              api-ch
              :context {:page page}))


styles

styles

--- frontend/components/language_landing.cljs
+++ frontend/components/language_landing.cljs
@@ -27,9 +27,9 @@
                         :ss-3 "/assets/img/outer/languages/ruby-ss-1.png"
                         :testimonial-author-1 "/assets/img/outer/stories/john.jpg"
                         :testimonials [{:text "Nullam id dolor id nibh ultricies vehicula ut id elit. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Integer posuere erat a ante venenatis."
-                                       :img "/assets/img/outer/stories/john.jpg"
-                                       :author "Kevin Rose"
-                                       :title "Entrepneur @Google"}
+                                        :img "/assets/img/outer/stories/john.jpg"
+                                        :author "Kevin Rose"
+                                        :title "Entrepneur @Google"}
                                        {:text "text 2"
                                         :img "/assets/img/outer/stories/john.jpg"
                                         :author "Clark Kent"
@@ -120,16 +120,23 @@
                     ]
                    ]
                   ]
-                 [:div.languages-body
-                  [:div.languages-cta
-                   [:div.languages-cta-headline
-                    "How do I start using my " (:language template) " app with Circle?"]
-                   [:div.languages-cta-step
-                    "Start by signing up using GitHub"]
-                   [:div.languages-cta-step
-                    "Run one of your Ruby projects on Circle"]
-                   [:div.languages-cta-step
-                    "That's it! If you hit any problems just us a message and we'll help you out."]
+
+                 [:div.languages-cta
+                  [:div.languages-body
+                   [:h3
+                    "How do I start using my " (:language template) " app with CircleCI?"]
+                   [:div.languages-cta-steps
+                    [:div.languages-cta-step
+                     [:div.step-number "1"]
+                      "Start by signing up using GitHub"
+                     ]
+                     [:div.languages-cta-step
+                      [:div.step-number "2"]
+                      "Run one of your Ruby projects on Circle"]
+                     [:div.languages-cta-step
+                      [:div.step-number "3"]
+                      "That's it! If you hit any problems just us a message and we'll help you out."]
+                     ]
                    [:a.languages-cta-button {:href="#"}
                     "Sign Up With GitHub"]
                    ]]


Reset to initial when target flipped

Reset to initial when target flipped

--- src/constraint/core.cljs
+++ src/constraint/core.cljs
@@ -191,16 +191,30 @@
        rand-nth
        first))

+(defn get-target-edges
+  [world-state]
+  (into {}
+        (filter
+         (comp #{:green}
+               #(nth % 2)
+               second)
+         (:edges world-state))))
+
+
 (defn move-randomly
   [world-state]
   (swap! ticker dec)
   (if (neg? @ticker)
     (do
       (reset! ticker @interval)
-      (if-let [m (get-random-legal-move-name world-state)]
-        (flip-update-edge m world-state)
-        (reset-to-initial world-state)
-        ))
+      (let [old     (get-target-edges (:initial world-state))
+            current (get-target-edges world-state)]
+        (if (some true? (vals (merge-with not= old current)))
+          (reset-to-initial world-state)
+          (if-let [m (get-random-legal-move-name world-state)]
+            (flip-update-edge m world-state)
+            (reset-to-initial world-state)
+            ))))
     world-state))


Attempt to filter to tokens matching hash

This will speed up deploys for users with multiple tokens since we
don't try to verify all tokens for a user.

--- src/clojars/auth.clj
+++ src/clojars/auth.clj
@@ -103,21 +103,26 @@
     (log/with-context {:tag :authentication
                        :username username
                        :type :token}
-      (if-let [token (and password
-                          (->> (db/find-user-tokens-by-username db username)
-                               (remove :disabled)
-                               (some #(when (creds/bcrypt-verify password (:token %)) %))))]
-        (do
-          (db/set-deploy-token-used db (:id token))
-          (when-not (:token_hash token)
-            ;; set token hashes for tokens that were created before we
-            ;; added the hash to the db
-            (db/set-deploy-token-hash db (:id token) password))
-          (log/info {:status :success})
-          {:username username
-           :token token})
-        (log/info {:status :failed
-                   :reason :invalid-token})))))
+      (let [password-hash (when password
+                            (db/hash-deploy-token password))]
+        (if-let [token (and password
+                            (->> (db/find-user-tokens-by-username db username)
+                                 (remove :disabled)
+                                 (filter #(let [{:keys [token_hash]} %]
+                                            (or (not token_hash) ;; pre-hash token
+                                                (= password-hash token_hash))))
+                                 (some #(when (creds/bcrypt-verify password (:token %)) %))))]
+          (do
+            (db/set-deploy-token-used db (:id token))
+            (when-not (:token_hash token)
+              ;; set token hashes for tokens that were created before we
+              ;; added the hash to the db
+              (db/set-deploy-token-hash db (:id token) password))
+            (log/info {:status :success})
+            {:username username
+             :token token})
+          (log/info {:status :failed
+                     :reason :invalid-token}))))))

 (defn valid-totp-token?
   [otp {:as _user :keys [otp_secret_key]}]


Pass the prod-system the required configuration

--- src/clojars/main.clj
+++ src/clojars/main.clj
@@ -25,7 +25,7 @@
   (let [yeller (yeller/client {:token (:yeller-token config)
                                :environment (:yeller-environment config)})]
     (Thread/setDefaultUncaughtExceptionHandler yeller)
-    (let [system (component/start (prod-system))]
+    (let [system (component/start (prod-system config yeller))]
       (println "clojars-web: starting jetty on" (str "http://" (:bind config) ":" (:port config)))
       (admin/init (get-in system [:db :spec])
                   (:search system)))))


Magnitude spectrum

Magnitude spectrum

--- src/clojure/core.clj
+++ src/clojure/core.clj
@@ -6,6 +6,7 @@
            [xtract_mel_filter]
            [xtract_features_]
            [xtract_window_types_]
+           [xtract_spectrum_]

           [javax.sound.sampled AudioSystem]))

@@ -14,6 +15,8 @@
 (defonce xtract-hann     (.swigValue (xtract_window_types_/XTRACT_HANN)))

 (defonce xtract-equal-gain (.swigValue (xtract_mfcc_types_/XTRACT_EQUAL_GAIN)))
+
+(defonce xtract-spectrum-magnitude (.swigValue (xtract_spectrum_/XTRACT_MAGNITUDE_SPECTRUM)))

 (defn- double->clojure [vs len]
   (let [ls (map-indexed
@@ -137,7 +140,24 @@
               (when (not= f0 0.0)
                 (println "f0       :" f0)
                 (println "midi-note:" (/ cents 100)))))
-          )))
+
+
+          ;;    xtract_windowed(&data[n], BLOCKSIZE, window, windowed);
+          ;;  public static int xtract_windowed(SWIGTYPE_p_double data, int N, SWIGTYPE_p_void argv, SWIGTYPE_p_double result)
+          (let [windowed (make-double (range 0 block-size))
+                spectrum (make-double (range 0 block-size))
+
+                argd (make-double [(/ SAMPLERATE block-size)
+                                   xtract-spectrum-magnitude
+                                   (double 0)
+                                   (double 0)])]
+            (xtract/xtract_windowed ds block-size (xtract/doublea_to_voidp w) windowed)
+            (xtract/xtract_init_fft block-size xtract-spectrum)
+            (xtract/xtract_spectrum windowed block-size (xtract/doublea_to_voidp argd) spectrum)
+            (xtract/xtract_free_fft)
+
+            (println "Magnitude Spectrum: " (pr-str (double->clojure spectrum block-size)))
+            ))))

     (xtract/xtract_free_window w)
     (xtract/xtract_free_window subw)


Added list-concat function (non-lazy).

Added list-concat function (non-lazy).

--- src/clojush/util.clj
+++ src/clojush/util.clj
@@ -20,7 +20,6 @@
      :vector_string (fn [thing] (and (vector? thing) (string? (first thing))))
      :vector_boolean (fn [thing] (and (vector? thing) (or (= (first thing) true) (= (first thing) false))))}))

-
 (defn recognize-literal
   "If thing is a literal, return its type -- otherwise return false."
   [thing]
@@ -44,14 +43,22 @@
           (fn [node children] (with-meta children (meta node)))
           root))

+(defn list-concat
+  "Returns a (non-lazy) list of the items that result from calling concat
+  on args."
+  [& args]
+  (apply list (apply concat args)))
+
 (defn not-lazy
-  "Returns lst if it is not a list, or a non-lazy version of lst if it is."
+  "Returns lst if it is not a seq, or a non-lazy list of lst if it is."
   [lst]
   (if (seq? lst)
     (apply list lst)
     lst))

 (defn ensure-list
+  "Returns a non-lazy list of the contents of thing if thing is a seq.
+  Returns a list containing thing otherwise."
   [thing]
   (if (seq? thing)
     (not-lazy thing)


No longer need to work arond dot forms

No longer need to work arond dot forms

Syntax-quote for dot forms has been fixed upstream

--- planck-cljs/src-bundle/cljs/test.clj
+++ planck-cljs/src-bundle/cljs/test.clj
@@ -80,8 +80,8 @@
   (when ana/*load-tests*
     `(do
        (def ~(vary-meta name assoc :test `(fn [] ~@body))
-         (fn [] (cljs.test/test-var (~'.-cljs$lang$var ~name))))
-       (set! (~'.-cljs$lang$var ~name) (var ~name)))))
+         (fn [] (cljs.test/test-var (.-cljs$lang$var ~name))))
+       (set! (.-cljs$lang$var ~name) (var ~name)))))

 (defmacro async
   "Wraps body as a CPS function that can be returned from a test to


* benchmark/cljs/benchmark_runner.cljs: improve ObjMap get performance

--- benchmark/cljs/benchmark_runner.cljs
+++ benchmark/cljs/benchmark_runner.cljs
@@ -1,5 +1,6 @@
 (ns cljs.benchmark-runner
-  (:refer-clojure :exclude [println]))
+  (:refer-clojure :exclude [println])
+  (:require [cljs.reader :as reader]))

 (def println print)

@@ -42,4 +43,8 @@
 (simple-benchmark [coll (range 500000)] (reduce + coll) 1)
 (println)

+(println ";;; reader")
+(simple-benchmark [s "{:foo [1 2 3]}"] (reader/read-string s) 1000)
+(println)
+
 (println "\n")


Make cljs-value check safe

Make cljs-value check safe

--- src/devtools/format.cljs
+++ src/devtools/format.cljs
@@ -23,7 +23,10 @@
 ; [14:04:36] dnolen: https://github.com/clojure/clojurescript/blob/c2550c4fdc94178a7957497e2bfde54e5600c457/src/clj/cljs/core.clj#L901
 ; [14:05:00] dnolen: this property is unlikely to change - still it's probably not something anything anyone should use w/o a really good reason
 (defn cljs-value? [value]
-  (exists? (aget value "constructor" "cljs$lang$type")))
+  (try
+    (exists? (aget value "constructor" "cljs$lang$type"))
+    (catch js/Object _
+      false)))

 (defn js-value? [value]
   (not (cljs-value? value)))


Add quote marks to log message.

Add quote marks to log message.

--- src/dragon/generator.clj
+++ src/dragon/generator.clj
@@ -6,6 +6,6 @@

 (defn run
   [routes out-dir]
-  (log/infof "Generating static content to %s ..." out-dir)
+  (log/infof "Generating static content to '%s' ..." out-dir)
   (stasis/export-pages routes out-dir)
   (log/info "Static generation complete."))


Include encoding example

Include encoding example

--- src/demo/caching.clj
+++ src/demo/caching.clj
@@ -8,6 +8,7 @@
 ;;; changing them requires Java interop, as would any mutable Java
 ;;; data structure. Of course, reading entries can be done with core
 ;;; Clojure functions.
+

 ;;; Writing

@@ -83,6 +84,35 @@
 (.clear baz)

+;;; Encoding
+
+;;; Cache entries not encoded by default, but may be "wrapped" in a
+;;; codec. Provided codecs include :edn, :json, and :fressian. The
+;;; latter two require additional dependencies: 'cheshire' and
+;;; 'org.clojure/data.fressian', respectively.
+(def encoded (c/with-codec baz :edn))
+
+(.put encoded :a {:b 42})
+(:a encoded)                            ;=> {:b 42}
+
+;;; Access via non-encoded caches still possible
+(get baz :a)                            ;=> nil
+(get baz ":a")                          ;=> "{:b 42}"
+
+;;; Infinispan caches don't allow null keys or values
+(try
+  (.put baz nil :a)                     ;=> Null keys are not supported!
+  (.put baz :b nil)                     ;=> Null values are not supported!
+  (catch NullPointerException _))
+
+;;; But nil keys and values are fine in an encoded cache
+(.put encoded nil :a)
+(.put encoded :b nil)
+(get encoded nil)                       ;=> :a
+(:b encoded)                            ;=> nil
+(contains? encoded :b)                  ;=> true
+
+
 ;;; Memoization

 (defn slow-fn [& _]


use _table_ parameter for determining count of existing expressions.

--- src/babel/writer.clj
+++ src/babel/writer.clj
@@ -279,9 +279,10 @@
         current-target-count
         (:count
          (first
-          (exec-raw ["SELECT count(*) FROM expression
-                         WHERE structure @> ?::jsonb
-                           AND language=?"
+          (exec-raw [(str
+                      "SELECT count(*) FROM " table "
+                        WHERE structure @> ?::jsonb
+                          AND language=?")
                        [(json/write-str spec) target-language]]
                       :results)))]
     (log/debug (str "current-target-count for spec: " spec "=" current-target-count))


Clarify documention for secure flag

Clarify documention for secure flag

--- src/adzerk/boot_reload.clj
+++ src/adzerk/boot_reload.clj
@@ -82,7 +82,7 @@
    w ws-host WSADDR  str  "The (optional) websocket host address to pass to clients."
    j on-jsload SYM   sym  "The (optional) callback to call when JS files are reloaded."
    a asset-path PATH str  "The (optional) asset-path. This is removed from the start of reloaded urls."
-   s secure          bool  "(Optional) flag to indicate whether to connect via wss. Defaults to false."]
+   s secure          bool "Flag to indicate whether the client should connect via wss. Defaults to false."]

   (let [pod  (make-pod)
         src  (tmp-dir!)


Move playlist in state atom

Move playlist in state atom

--- src/airhead_cljs/core.cljs
+++ src/airhead_cljs/core.cljs
@@ -3,13 +3,11 @@
   (:require [reagent.core :as r]
             [ajax.core :refer [GET POST]]))

-(def state (r/atom {:server "http://localhost:8080"}))
+(def state (r/atom {:server "http://localhost:8080"
+                    :playlist []}))

-
-(defn change-server! [event]
-  (swap! state
-         assoc :server
-         (-> event .-target .-value)))
+(defn update-state! [k value]
+  (swap! state assoc k value))

 ;; -------------------------
 ;; Views
@@ -17,19 +15,18 @@
 (defn server-form []
   [:div
    [:input {:type "text"
-            :value (:server @state)
-            :on-change change-server!}]])
+            :value (@state :server)
+            :on-change #(update-state! :server
+                                       (-> % .-target .-value))}]])

 (defn playlist-div []
-  (let [playlist (r/atom [])
-        handler #(reset! playlist (% "items"))]
-    (GET "http://localhost:8080/api/queue"
-         {:handler handler
-          :response-format :json})
-    (fn []
-      [:div [:h2 "Playlist"]
-       [:ul (for [track @playlist]
-              [:li (track "title")])]])))
+  (GET "http://localhost:8080/api/queue"
+       {:handler #(update-state! :playlist (% "items"))
+        :response-format :json})
+  (fn []
+    [:div [:h2 "Playlist"]
+     [:ul (for [track (@state :playlist)]
+            [:li (track "title")])]]))

 (defn home-page []
   [:div [:h1 "Airhead"]


Fix to is-file-modified for when index.inode is 0

--- src/clj_git/core.clj
+++ src/clj_git/core.clj
@@ -14,13 +14,15 @@

 ; Use the following rules to quickly check for modified files:
 ;         if filesystem mtime matches index           -> return False
-;   else  if filesystem size differs from index       -> return True
+;   else  if filesystem filesize differs from index   -> return True
 ;   else  check hash from filesystem vs index         -> return hash comparison
+; NOTE: Do not check mtime and filesize when index inode == 0..
 (defn is-file-modified [filename]
-  (let [index-entry (->> (read-index) (filter #(= (:name %) filename)) first)]
+  (let [index-entry (->> (read-index) (filter #(= (:name %) filename)) first)
+        good-index  (not= (:inode index-entry) 0)] ; TODO: Lookup why this is needed
     (cond
-      (= 0 (.compareTo (:mtime index-entry) (file-mtime filename))) false
-      (not= (:filesize index-entry) (file-size filename))           true
+      (and good-index (= 0 (.compareTo (:mtime index-entry) (file-mtime filename))))  false
+      (and good-index (not= (:filesize index-entry) (file-size filename)))            true
       :else                 (not= (:hash index-entry) (hash-file filename))
     )))


Added (-main) listing modified files

Added (-main) listing modified files

--- src/clj_git/core.clj
+++ src/clj_git/core.clj
@@ -6,6 +6,12 @@
   (:gen-class))

 (def SHA-1-HEX-LENGTH 40)
+
+(declare modified)
+(defn -main [& args]
+  (println "Unstaged Changes:")
+  (doseq [x (modified)]
+    (println (str "  " x))))

 (defn to-str [x] (apply str (map char x)))


Support numbers as hiccup-vector children (in ClojureScript); they'll be converted to strings and rendered as textNodes on the DOM.

--- src/cljs/c2/dom.cljs
+++ src/cljs/c2/dom.cljs
@@ -109,6 +109,7 @@
   [x]
   (match [x]
          [(str :when string?)] str
+         [(n   :when number?)] (str n)
          [(m   :when map?)] m ;;todo, actually check to make sure map has nsp, tag, attr, and children keys
          ;;todo, make explicit match here for attr map and clean up crazy Pinot logic below
          [[tag & content]]   (let [[_ tag id class] (re-matches re-tag (name tag))


Apparently start-nailgun is blocking.

Apparently start-nailgun is blocking.

--- src/clojars/main.clj
+++ src/clojars/main.clj
@@ -25,8 +25,7 @@
   (configure args)
   (promote/start)
   (start-jetty)
-  (start-nailgun)
-  (when-let [port (config :nrepl-port)]
-    (nrepl/start-server :port 7991 :bind "127.0.0.1")))
+  (nrepl/start-server :port 7991 :bind "127.0.0.1")
+  (start-nailgun))

 ; (defonce server (run-jetty #'clojars-app {:port 8080 :join? false}))


Exploration of new params

Exploration of new params

--- src/clojure/core.clj
+++ src/clojure/core.clj
@@ -200,42 +200,78 @@

                             (xtract/xtract_peak_spectrum spectrum (double (/ block-size 2)) (xtract/doublea_to_voidp argv) peaks)

+
 ;;                            public static int xtract_rms_amplitude(SWIGTYPE_p_double data, int N, SWIGTYPE_p_void argv, double[] result)

                             (let [rms (double-array [0])
                                   noiseness (double-array [0])
                                   loudness (double-array [0])
                                   tonality (double-array [0])
+                                  irregularity_k (double-array [0])
                                   argv [(/ SAMPLERATE block-size)]
+                                  spectral-irregularity (double-array [0])
+                                  spectral-centroid (double-array [0])
+                                  spectral-variance (double-array [0])

                                   spectral-inharmonicity (spectral-inharmonicity
                                                           peaks block-size
                                                           f0 0.5 NUM_HARMONICS 0)]

                               (xtract/xtract_rms_amplitude ds block-size (apply xtract-args argv) rms)
-;;                              (xtract/xtract_noisiness     ds block-size (xtract-args NUM_HARMONICS ) noiseness)
-
-                              (let [_ 10
-                                    ;;bark-cofficents (make-double (range 0 xtract-bark-bands))
-                                   ]
-
-                               ;; (println :BAND bark-band-limits)
-;;                                (xtract/xtract_bark_coefficients spectrum half-block-size (xtract-args ) bark-cofficents)
-;;                                (xtract/xtract_loudness      ds block-size (apply xtract-args argv) loudness)
-                                )
-
-                              ;;TODO
-                              (xtract/xtract_tonality      ds block-size (xtract-args ) tonality)
-
-                              {(* idx SAMPLERATE)
-                               {:spectral-inharmonicity spectral-inharmonicity
-                                :rms_amplitude (first rms)
-                                ;;                              :noisiness (first noiseness)
-                                ;;                                :loudness (first loudness)
-                                ;;                               :tonality (first tonality)
-                                :midi midi
-                                :f0 f0}
-                               }))
+
+                              (xtract/xtract_spectral_centroid spectrum block-size nil spectral-centroid)
+                              (xtract/xtract_irregularity_j    spectrum half-block-size nil spectral-irregularity)
+
+
+                              (let [spectral-skewness (double-array [0])
+                                    spectral-std-deviation (double-array [0])
+                                     spectral-mean (double-array [0])
+                                    spectral-kurtosis (double-array [0])
+                                    argv (make-double [])]
+
+                                (xtract/xtract_spectral_mean spectrum block-size nil spectral-mean)
+                                (xtract/xtract_variance spectrum block-size (xtract-args (first spectral-mean)) spectral-variance)
+                                (xtract/xtract_spectral_standard_deviation spectrum block-size (xtract-args (first spectral-variance)) spectral-std-deviation)
+
+                                (println :std (first spectral-std-deviation))
+                                (println :cen (first spectral-centroid))
+
+                                (let [argv (make-double [(first spectral-mean)
+                                                         (first spectral-std-deviation)]) ])
+
+                                ;;fails
+                                (xtract/xtract_spectral_skewness spectrum block-size (xtract/doublea_to_voidp argv) spectral-skewness)
+                                (xtract/xtract_spectral_kurtosis spectrum block-size (xtract/doublea_to_voidp argv) spectral-kurtosis)
+
+                                ;;                              (xtract/xtract_noisiness     ds block-size (xtract-args NUM_HARMONICS ) noiseness)
+
+                                (let [_ 10
+                                      ;;bark-cofficents (make-double (range 0 xtract-bark-bands))
+                                      ]
+
+                                  ;; (println :BAND bark-band-limits)
+                                  ;;                                (xtract/xtract_bark_coefficients spectrum half-block-size (xtract-args ) bark-cofficents)
+                                  ;;                                (xtract/xtract_loudness      ds block-size (apply xtract-args argv) loudness)
+                                  )
+
+                                ;;TODO
+;;                                (xtract/xtract_tonality      ds block-size (xtract-args ) tonality)
+
+                                {(* idx SAMPLERATE)
+                                 {:spectral-inharmonicity   spectral-inharmonicity
+                                  :spectral-irregularity    (first spectral-irregularity)
+                                  :spectral-centroid        (first spectral-centroid)
+
+                                  :todo {:spectral-skewness (first spectral-skewness)
+                                         :spectral-kurtosis (first spectral-kurtosis)}
+                                  :rms_amplitude            (first rms)
+
+                                  ;;                              :noisiness (first noiseness)
+                                  ;;                                :loudness (first loudness)
+                                  ;;                               :tonality (first tonality)
+                                  :midi midi
+                                  :f0 f0}
+                                 })))
                               ;;(println "Magnitude Spectrum: " (pr-str (double->clojure spectrum block-size)))
                           )))))
                 s))


Again, TEMPORARILY comment out parent2 instructions

--- src/clojush/args.clj
+++ src/clojush/args.clj
@@ -860,10 +860,10 @@
                                                  [:integer :boolean :exec :float :tag :code :environment]
                                                  [:integer :boolean :exec :float :tag :code]))]
                                  '(genome_append_parent1
-                                    genome_append_parent2
+                                    ;genome_append_parent2
                                     genome_length
                                     genome_parent1_length
-                                    genome_parent2_length
+                                    ;genome_parent2_length
                                     autoconstructive_integer_rand
                                     autoconstructive_boolean_rand
                                     genome_autoconstructing


Updated to newest ClojureCL changes.

Updated to newest ClojureCL changes.

--- src/clojure/uncomplicate/neanderthal/internal/device/clblast.clj
+++ src/clojure/uncomplicate/neanderthal/internal/device/clblast.clj
@@ -13,12 +13,13 @@
              [core :refer [Releaseable release let-release with-release info
                            wrap-int wrap-double wrap-float]]
              [utils :refer [with-check dragan-says-ex]]]
-            [uncomplicate.fluokitten.core :refer [extract]]
             [uncomplicate.clojurecl
              [core :refer :all]
              [info :refer [max-work-group-size queue-device]]
              [toolbox :refer [enq-read-int enq-read-double enq-read-float]]]
-            [uncomplicate.clojurecl.internal.constants :refer [dec-error]]
+            [uncomplicate.clojurecl.internal
+             [api :refer [extract]]
+             [constants :refer [dec-error]]]
             [uncomplicate.neanderthal
              [core :refer [transfer!]]
              [native :refer [native-float native-double]]]


skip android files

skip android files

--- src/jsx_fun/core.clj
+++ src/jsx_fun/core.clj
@@ -108,9 +108,12 @@
   ([dir]
    (compile dir "out"))
   ([dir outdir]
-   (letfn [(dir? [^File x] (.isDirectory x))]
+   (letfn [(dir? [^File x] (.isDirectory x))
+           (android? [^File x]
+             (some #{"android"} (string/split (.getName x) #"\.")))]
      (.mkdir (io/file outdir))
-     (doseq [file (remove dir? (file-seq (io/file dir)))]
+     (doseq [file (remove #(or (dir? %) (android? %))
+                    (file-seq (io/file dir)))]
        (let [out-file (io/file outdir (.getName file))]
          (spit out-file
            (transform-commonjs
@@ -147,7 +150,7 @@

   (deps-graph
     (.getAbsolutePath (io/file "deps/closure-library/closure"))
-    ["resources"])
+    ["out"])

   (compile "resources")


Add index on schema_migrations.version

Add index on schema_migrations.version

--- src/jupiter/core.clj
+++ src/jupiter/core.clj
@@ -1,10 +1,12 @@
 (ns jupiter.core
+  (:import [java.sql.SQLException])
   (:require [clojure.tools.logging :as log]
             [clojure.java.jdbc :as jdbc]))

-; TODO: handle index on schema_migrations table
 (def ^{:private true} schema-migrations-table-ddl
-  ["CREATE TABLE IF NOT EXISTS schema_migrations (version text NOT NULL)"])
+  ["CREATE TABLE IF NOT EXISTS schema_migrations (version text NOT NULL);
+   CREATE UNIQUE INDEX index_schema_migrations_on_version
+   ON schema_migrations (version);"])

 (def ^{:private true} migration-pattern
   #"\A\d+_.+\.sql\z")
@@ -38,7 +40,9 @@
 (defn- apply-migrations [datasource migrations])

 (defn ensure-schema-migrations-table [datasource]
-  (jdbc/execute! datasource schema-migrations-table-ddl))
+  (try
+    (jdbc/execute! datasource schema-migrations-table-ddl)
+    (catch java.sql.SQLException _)))

 (defn migrate [datasource migrations-path]
   (apply-migrations datasource (pending-migrations migrations-path)))


Add arity 1 for `lens` function.

Add arity 1 for `lens` function.

Allowing create read only lenses.

--- src/lentes/core.cljc
+++ src/lentes/core.cljc
@@ -7,13 +7,20 @@
   "Given a function for getting the focused value from a state (getter)
   and a function that takes the state and and update function (setter),
   constructs a lens."
-  [getter setter]
-  (fn [next]
-    (fn
-      ([s]
+  ([getter]
+   (fn [next]
+     (fn
+       ([s]
         (next (getter s)))
-      ([s f]
-        (setter s #(next % f))))))
+       ([s f]
+        (throw (ex-info "Read only lense!" {}))))))
+  ([getter setter]
+   (fn [next]
+     (fn
+       ([s]
+        (next (getter s)))
+       ([s f]
+        (setter s #(next % f)))))))

 ;; base lenses


Added additional granule acl search tests.

--- test/cmr/system_int_test/search/acls/granule_acl_search_test.clj
+++ test/cmr/system_int_test/search/acls/granule_acl_search_test.clj
@@ -14,27 +14,23 @@
 (use-fixtures :each (ingest/reset-fixture {"provguid1" "PROV1"
                                            "provguid2" "PROV2"
                                            "provguid3" "PROV3"
-                                           "provguid4" "PROV4"} false))
-
-(def coll-num (atom 0))
-(def gran-num (atom 0))
+                                           "provguid4" "PROV4"
+                                           "provguid5" "PROV5"} false))

 (defn make-coll
-  ([prov]
-   (make-coll prov {}))
-  ([prov attribs]
-   (let [n (swap! coll-num inc)]
-     (d/ingest prov
-               (dc/collection
-                 (merge {:entry-title (str "coll" n)}
-                        attribs))))))
+  ([n prov]
+   (make-coll n prov {}))
+  ([n prov attribs]
+   (d/ingest prov
+             (dc/collection
+               (merge {:entry-title (str "coll" n)}
+                      attribs)))))

 (defn make-gran
-  ([coll]
-   (make-gran coll {}))
-  ([coll attribs]
+  ([n coll]
+   (make-gran n coll {}))
+  ([n coll attribs]
    (let [prov (:provider-id coll)
-         n (swap! gran-num inc)
          attribs (merge {:granule-ur (str "gran" n)}
                         attribs)]
      (d/ingest prov (dg/granule coll attribs)))))
@@ -45,17 +41,15 @@
     (ingest/create-provider "provguid1" "PROV1" false)
     (ingest/create-provider "provguid2" "PROV2" false)
     (ingest/create-provider "provguid3" "PROV3" false)
-    (ingest/create-provider "provguid4" "PROV4" false))
+    (ingest/create-provider "provguid4" "PROV4" false)
+    (ingest/create-provider "provguid5" "PROV5" false))
   )

 (deftest granule-search-with-acls-test
-  ;; TODO add acls for collection entry title that doesn't exist
-  ;; TODO test a search with no acls applied
+  ;; TODO test a search with no acls existing

   (do
-    (reset! coll-num 0)
-    (reset! gran-num 0)
-
+    ;; -- PROV1 --
     ;; Guests have access to coll1
     (e/grant-guest (e/gran-catalog-item-id "provguid1" (e/coll-id ["coll1"])))
     ;; coll 2 has no granule permissions
@@ -63,66 +57,142 @@
     (e/grant-guest (e/gran-catalog-item-id "provguid1" nil (e/gran-id {:min-value 10
                                                                        :max-value 20
                                                                        :include-undefined true})))
+
+    ;; -- PROV2 --
+    ;; Combined collection identifier and granule identifier
+    (e/grant-guest
+      (e/gran-catalog-item-id "provguid2" (e/coll-id ["coll7"]) (e/gran-id {:min-value 30
+                                                                            :max-value 40})))
     (e/grant-registered-users
       (e/gran-catalog-item-id "provguid2" (e/coll-id ["coll3"] {:min-value 1 :max-value 3})))
     (e/grant-registered-users
       (e/gran-catalog-item-id "provguid2" (e/coll-id [] {:min-value 4 :max-value 6})))

+    ;; Acls that grant nothing
+    (e/grant-guest (e/gran-catalog-item-id "provguid2" (e/coll-id ["nonexist1"])))
+    (e/grant-guest (e/gran-catalog-item-id "provguid2" (e/coll-id [] {:min-value 4000 :max-value 4000})))
+    (e/grant-registered-users (e/gran-catalog-item-id "provguid2" (e/coll-id ["nonexist2"])))
+    (e/grant-guest (e/gran-catalog-item-id "provguid2"
+                                           (e/coll-id ["notexist3"]) (e/gran-id {:min-value 30
+                                                                                :max-value 40})))
+    ;; -- PROV3 --
     ;; Guests have full access to provider 3
     (e/grant-guest (e/gran-catalog-item-id "provguid3"))
+
+    ;; -- PROV4 --
+    ;; no acls
+
+    ;; -- PROV5 --
+    ;; lots of access value filters
+    (e/grant-registered-users
+      (e/gran-catalog-item-id "provguid5" (e/coll-id ["coll51"]) (e/gran-id {:include-undefined true})))
+    (e/grant-registered-users
+      (e/gran-catalog-item-id "provguid5" (e/coll-id ["coll52"]) (e/gran-id {:min-value 10})))
+    (e/grant-registered-users
+      (e/gran-catalog-item-id "provguid5" (e/coll-id ["coll53"]) (e/gran-id {:max-value 10})))
+
     ;; Clear out acl caches
     (ingest/clear-caches))

-  (let [coll1 (make-coll "PROV1")
-        coll2 (make-coll "PROV1")
-        coll3 (make-coll "PROV2" {:access-value 2})
-        coll4 (make-coll "PROV2" {:access-value 5})
-        coll5 (make-coll "PROV3")
-        coll6 (make-coll "PROV4")
+  (let [coll1 (make-coll 1 "PROV1")
+        coll2 (make-coll 2 "PROV1")
+        coll3 (make-coll 3 "PROV2" {:access-value 2})
+        coll4 (make-coll 4 "PROV2" {:access-value 5})
+        coll5 (make-coll 5 "PROV3")
+        coll6 (make-coll 6 "PROV4")
+        coll7 (make-coll 7 "PROV2")
+        coll51 (make-coll 51 "PROV5")
+        coll52 (make-coll 52 "PROV5")
+        coll53 (make-coll 53 "PROV5")
+        all-colls [coll1 coll2 coll3 coll4 coll5 coll6 coll7 coll51 coll52 coll53]

         ;; - PROV1 -
-        gran1 (make-gran coll1)
-        gran2 (make-gran coll1)
+        gran1 (make-gran 1 coll1)
+        gran2 (make-gran 2 coll1)

         ;; Permitted through undefined access value
-        gran3 (make-gran coll2)
+        gran3 (make-gran 3 coll2)
         ; Not permitted at all (outside of access value range)
-        gran4 (make-gran coll2 {:access-value 9})
+        gran4 (make-gran 4 coll2 {:access-value 9})
         ;; Permitted through access value range
-        gran5 (make-gran coll2 {:access-value 10})
+        gran5 (make-gran 5 coll2 {:access-value 10})

         ;; - PROV2 -
         ;; Permitted by collection id and coll access value
-        gran6 (make-gran coll3)
+        gran6 (make-gran 6 coll3)
         ;; Permitted by collection 4's access value
-        gran7 (make-gran coll4)
+        gran7 (make-gran 7 coll4)
+
+        ;; Not permitted from granule access value
+        gran10 (make-gran 10 coll7)
+        ;; Permitted by access value
+        gran11 (make-gran 11 coll7 {:access-value 31})

         ;; - PROV3 -
         ;; All granules in prov 3 are permitted
-        gran8 (make-gran coll5)
-        gran9 (make-gran coll5 {:access-value 0})
+        gran8 (make-gran 8 coll5)
+        gran9 (make-gran 9 coll5 {:access-value 0})

         ;; - PROV4 - no permitted access
-        gran10 (make-gran coll6)
+        gran10 (make-gran 10 coll6)
+
+        ;; - PROV5 -
+        ;; Not permitted because it has an access value
+        gran51 (make-gran 51 coll51 {:access-value 0})
+        ;; Permitted because it doesn't have an access value
+        gran52 (make-gran 52 coll51 {:access-value nil})
+
+        ;; permitted because it is above min
+        gran53 (make-gran 53 coll52 {:access-value 11})
+        ;; permitted because it is equal to min
+        gran54 (make-gran 54 coll52 {:access-value 10})
+        ;; not permitted below min
+        gran55 (make-gran 55 coll52 {:access-value 9})
+
+        ;; permitted below max
+        gran56 (make-gran 56 coll53 {:access-value 9})
+        ;; permitted equal to max
+        gran57 (make-gran 57 coll53 {:access-value 10})
+        ;; not permitted above max
+        gran58 (make-gran 58 coll53 {:access-value 11})
+
+        ;; Tokens
         guest-token (e/login-guest)
-        user1-token (e/login "user1")]
+        user1-token (e/login "user1")
+
+        guest-permitted-granules [gran1 gran2 gran3 gran5 gran11 gran8 gran9]
+        user-permitted-granules [gran6 gran7 gran52 gran53 gran54 gran56 gran57]]

     (index/refresh-elastic-index)

-    (testing "search as guest"
-      (let [refs-result (search/find-refs :granule {:token guest-token})
-            expected [gran1 gran2 gran3 gran5 gran8 gran9]
-            match? (d/refs-match? expected refs-result)]
-        (when-not match?
-          (println "Expected:" (map :concept-id expected))
-          (println "Actual:" (map :id (:refs refs-result)))
-          (println "Expected:" (map :granule-ur expected))
-          (println "Actual:" (map :name (:refs refs-result))))
-        (is match?)))
-
-    #_(testing "search as registered users"
-        (is (d/refs-match? [gran6 gran7]
-                           (search/find-refs :granule {:token user1-token}))))
+    (are [expected params]
+         (let [refs-result (search/find-refs :granule params)
+               match? (d/refs-match? expected refs-result)]
+           (when-not match?
+             (println "Expected:" (map :concept-id expected))
+             (println "Actual:" (map :id (:refs refs-result)))
+             (println "Expected:" (map :granule-ur expected))
+             (println "Actual:" (map :name (:refs refs-result))))
+           match?)
+         guest-permitted-granules {:token guest-token}
+         user-permitted-granules {:token user1-token}
+
+         ;; Test searching with each collecion id as guest and user
+         ;; Entry title searches
+         [gran1 gran2] {:token guest-token :entry-title "coll1"}
+         [gran3 gran5] {:token guest-token :entry-title "coll2"}
+         [gran1 gran2 gran3 gran5 gran11] {:token guest-token :entry-title ["coll1" "coll2" "coll7"]}
+
+         ;; concept id
+         [gran1 gran2] {:token guest-token :concept-id (:concept-id coll1)}
+         [gran3 gran5] {:token guest-token :concept-id (:concept-id coll2)}
+         guest-permitted-granules
+         {:token guest-token :concept-id (cons "C999-PROV1" (map :concept-id all-colls))}
+         ; user-permitted-granules
+         ; {:token guest-token :concept-id (cons "C999-PROV1" (map :concept-id all-colls))}
+
+
+         )

     ;; TODO test searching
     ;; with no collection concept ids


Korrektur <html> zu <!DOCTYPE html>

Korrektur <html> zu <!DOCTYPE html>

--- src/hello_world/core.clj
+++ src/hello_world/core.clj
@@ -29,7 +29,7 @@
 ; maybe this sets the guthaben to 99

 (defn page [name empfaenger]
-  (str ""
+  (str "<!DOCTYPE html>"
        (if name
   (str "Nice to meet you, " name "! \n" "

")
         (str "<form>"


Avoid reflection in Exception ctor.

Avoid reflection in Exception ctor.

--- ring-servlet/src/ring/util/servlet.clj
+++ ring-servlet/src/ring/util/servlet.clj
@@ -92,7 +92,7 @@
     (nil? body)
       nil
     :else
-      (throw (Exception. (format "Unrecognized body: %s" body)))))
+      (throw (Exception. ^String (format "Unrecognized body: %s" body)))))

 (defn update-servlet-response
   "Update the HttpServletResponse using a response map."


cleanup

cleanup

--- src/babel/english/morphology.cljc
+++ src/babel/english/morphology.cljc
@@ -582,8 +582,6 @@
       ;; default case.
       (str english "s"))))

-(declare fo-ps-en)
-
 (defn fo-ps-en [expr & {:keys [show-notes]
                         :or {show-notes true}}]
   "show the phrase-structure of a phrase structure tree, e.g [hh21 'mangiare (to eat)' [cc10 'il (the)' 'pane(bread)']]"
@@ -608,7 +606,6 @@
      (map (fn [each]
             (fo-ps-en each))
           expr)
-

      (and (map? expr)
           (:italiano expr)


Add combine-list function.

Add combine-list function.

--- src/beebster_clj/views.clj
+++ src/beebster_clj/views.clj
@@ -66,7 +66,12 @@
     "get-iplayer"]))

-
+(defn combine-list
+  "zip thumb, title and index from search into one list."
+  [search]
+  (map list (get-thumb-from-search search)
+       (get-title-and-episode search)
+       (get-index-from-search search)))

 (defn display-results
   "check if search contaings iplayer's warning notice for
@@ -77,25 +82,22 @@
   (cond
    (nil? resultlist)
    (html
-    [:p "No matches foudn."])
+    [:p "No matches found."])
    (some #(re-find #"These programmes should" %) resultlist)
    (html
     (for [i resultlist]
       [:p (str i)]))
    :else
-   (let [imgs (get-thumb-from-search resultlist)
-         desc (get-title-and-episode resultlist)
-         ind (get-index-from-search resultlist)]
+   (let [comb (combine-list resultlist)]
      (html
-      (for [i imgs]
-        (for [a (range (count imgs))]
-          [:div.table
-           [:div.tablecell
-            [:div.t1
-             [:a {:href (get-url (nth ind a)) :alt (nth desc a)}
-              [:img.img {:src i}]]]
-            [:div.t1
-             (str (nth desc a))]]]))
+      (for [[img desc ind] comb]
+        [:div.table
+         [:div.tablecell
+          [:div.t1
+           [:a {:href (get-url ind) :alt desc}
+            [:img.img {:src img}]]]
+          [:div.t1
+           (str desc)]]])
       [:div.clear " "]))))

 (defn category-page