Improvements after @otfrom's PR comments.

--- src/clj/kixi/hecuba/data/measurements/calculations.clj
+++ src/clj/kixi/hecuba/data/measurements/calculations.clj
@@ -327,12 +327,12 @@
          measurements/parse-measurements
          (day->on-off-periods off-peak-periods)
          (map (fn [[period xs]]
-                (apply + (map :value (filter #(number? (:value %)) xs)))))
+                (reduce + (map :value (filter #(number? (:value %)) xs)))))
          (apply-on-off-peak cost-per-on-peak-kwh cost-per-off-peak-kwh))))

 (defmethod apply-tariff :simple [tariff measurements]
   (let [{:keys [cost-per-kwh]} tariff
-        total-consumption (apply + (map :value (filter #(number? (:value %)) (measurements/parse-measurements measurements))))]
+        total-consumption (reduce + (map :value (filter #(number? (:value %)) (measurements/parse-measurements measurements))))]
     (-> total-consumption
         (* cost-per-kwh))))

@@ -443,7 +443,7 @@
   [store calculated-sensor start end measurements]
   (db/with-session [session (:hecuba-session store)]
     (let [{:keys [sensor_id device_id]} calculated-sensor
-          calculated-data  [{:value (str (apply + (map :value (filter #(number? (:value %)) measurements))))
+          calculated-data  [{:value (str (reduce + (map :value (filter #(number? (:value %)) measurements))))
                              :timestamp (tc/to-date end)
                              :month (time/get-month-partition-key end)
                              :device_id device_id


Dropdowns should return the same clojurescript value (and type) that goes in. Closes #14.

--- src/cljs/reagent_toolbox_docs/components/dropdown.cljs
+++ src/cljs/reagent_toolbox_docs/components/dropdown.cljs
@@ -16,18 +16,19 @@
      [ui/display-and-eval-code
       "(defn dropdown-test
          []
-         (let [countries [{:value \"EN-gb\" :label \"England\"}
-                          {:value \"ES-es\" :label \"Spain\"}
-                          {:value \"TH-th\" :label \"Thailand\"}
-                          {:value \"EN-en\" :label \"USA\"}]
-               state (reagent.ratom/atom {:value \"ES-es\"})]
+         (let [countries [{:value nil :label \"None\"}
+                          {:value :en :label \"English\"}
+                          {:value :es :label \"Spainish\"}
+                          {:value :eo :label \"Esperanto\"}
+                          {:value \"many\" :label \"Many languages\"}]
+               state (reagent.ratom/atom :es)]
            (fn []
              [:div
               [:p \"Value: \" (pr-str @state)]
               [reagent-toolbox.core/dropdown {:auto true
-                                              :on-change #(swap! state assoc :value %)
+                                              :on-change #(reset! state %)
                                               :source countries
-                                              :value (:value @state)}]])))
+                                              :value @state}]])))

        [dropdown-test]"]


No need to make symbol dynamic

No need to make symbol dynamic

--- desktop/src/nightmod/core/desktop_launcher.clj
+++ desktop/src/nightmod/core/desktop_launcher.clj
@@ -26,8 +26,8 @@
 (def ^:const window-height 768)
 (def ^:const editor-width 700)

-(def ^:dynamic editor-controls [:save :undo :redo :font-dec :font-inc
-                                :doc :paredit :paredit-help])
+(def editor-controls [:save :undo :redo :font-dec :font-inc
+                      :doc :paredit :paredit-help])

 (defn create-layered-pane
   "Returns the pane with the editors."


creating fake any case

creating fake any case

--- src/test/clojure/com/narkisr/common_test.clj
+++ src/test/clojure/com/narkisr/common_test.clj
@@ -19,6 +19,7 @@
   (def file-path (str "fake/" uuid "/" uuid ".html"))
   (couch/delete-db "playground")
   (couch/create-non-existing-db "playground")
+  (sh "mkdir" "fake")
   (mount-with-group "http://127.0.0.1:5983/" "playground" "fake" "fuse-threads")
   (java.lang.Thread/sleep 1000)
   (sh "mkdir" (str "fake/" uuid))


remove proxy route hack

remove proxy route hack

--- src/frontend/proxy.clj
+++ src/frontend/proxy.clj
@@ -68,7 +68,7 @@
 ;; This is for development only. Do not commit code with values in this set.
 ;; Instead, add the route to the backend. (And while you're there, add it to the
 ;; nginx config if necessary.)
-(def new-urls #{#"/workflows/"})
+(def new-urls #{})

 (defn- match? [regex-or-string target]
   (condp instance? regex-or-string


count allergies more than once if the score allows.

--- clojure/allergies/allergies.clj
+++ clojure/allergies/allergies.clj
@@ -18,7 +18,7 @@
      :else (let [allergy-score (Math/pow 2 allergy-num)
                  allergy (nth allergies allergy-num)]
              (if (>= s allergy-score)
-               (recur (- s allergy-score) (dec allergy-num) (cons allergy acc))
+               (recur (- s allergy-score) allergy-num (cons allergy acc))
                (recur s (dec allergy-num) acc))))))

 (defn allergic_to?


Refine day 7 2017 solution and add a docstring.

--- clojure/src/advent2017/day7.clj
+++ clojure/src/advent2017/day7.clj
@@ -1,6 +1,10 @@
 (ns advent2017.day7
+  "Part 1 finds the node with the highest cumulative weight, which is the
+  bottom-most node. Part 2 starts at the bottom most node, calculating the
+  cumulative weight for each one, if the weight of one child is not equal the
+  process is repeated for that child until no more imbalances are found. The
+  result is the corrected weight value for the problematic child."
   (:require [advent2017.core :refer [read-puzzle ->lines]]))
-

 (defn line->node [s]
   (let [[x xs]       (clojure.string/split s #" -> " 2)
@@ -36,32 +40,31 @@
         (recur w ks)))))

 (defn weights [input nodes]
-  (map (juxt identity (partial weight input)) nodes))
+  (map (juxt (partial weight input) identity) nodes))

 (defn solve-1 [input]
   (->> (keys input)
        (weights input)
-       (apply max-key second)
-       (first)))
+       (apply max-key first)
+       (second)))

-(defn odd-one [xs]
-  (->> xs
-       (sort-by second)
-       (partition-by second)
-       (filter #(= 1 (count %)))
-       (first)
-       (ffirst)))
+(defn unbalanced [xs]
+  (let [correct (set (for [[w a] xs
+                           [v b] xs
+                           :when (and (not= a b) (= w v))]
+                       [w a]))
+        [w a]   (first (clojure.set/difference (set xs) correct))]
+    (when a
+      [(- w (ffirst correct)) a])))

 (defn solve-2 [input]
-  (loop [root         (solve-1 input)
-         prev-weights []]
-    (let [[w children] (input root)
-          weights      (weights input children)
-          new-root     (odd-one weights)
-          ]
-      (if (nil? new-root)
-        (+ w (apply - (sort (set (map second prev-weights)))))
-        (recur new-root weights)))))
+  (loop [node       (solve-1 input)
+         correction 0]
+    (let [[w children]        (input node)
+          [correction' node'] (unbalanced (weights input children))]
+      (if (nil? node')
+        (- w correction)
+        (recur node' correction')))))

 (comment
   (assert (= (solve-1 sample-puzzle) "tknk"))


Set proper default config.

Set proper default config.

--- frontend/scripts/figwheel.clj
+++ frontend/scripts/figwheel.clj
@@ -2,8 +2,8 @@
          '[figwheel-sidecar.repl-api :as ra])

 (def options
-  {"uxbox.config.url" "http://127.0.0.1:6060/api"
-   ;; "uxbox.config.url" "https://test.uxbox.io/api"
+  {;;"uxbox.config.url" "http://127.0.0.1:6060/api"
+   "uxbox.config.url" "https://test.uxbox.io/api"
    })

 (ra/start-figwheel!


Make private and add clarifying comment

Make private and add clarifying comment

--- src/graphql_clj/validator/rules/no_fragment_cycles.clj
+++ src/graphql_clj/validator/rules/no_fragment_cycles.clj
@@ -18,7 +18,8 @@
         fields (filter #(= :field (:node-type %)) selection-set)]
     (reduce #(into %1 (get-spread-nodes %2)) spread-nodes fields))) ;; TODO stackoverflow risk?

-(defn detect-cycles
+(defn- detect-cycles
+  "Recursively search for child fragments that reference the given parent fragment-definition"
   [{:keys [name] :as n} {:keys [visited-frags] :as s}]
   (let [spread-nodes (get-spread-nodes n)]
     (if (empty? spread-nodes)


hwe doesn't work with xubuntu

hwe doesn't work with xubuntu

--- main/src/dda/pallet/dda_managed_vm/infra/basics.clj
+++ main/src/dda/pallet/dda_managed_vm/infra/basics.clj
@@ -35,6 +35,13 @@
             :configure-no-swappiness))

 (defn install-virtualbox-guest-additions
+  "make virtual machine run properly sized on virtualbox"
+  [facility]
+  (actions/as-action
+   (logging/info (str facility "-install system: virtualbox-guest")))
+  (actions/packages :aptitude ["virtualbox-guest-x11"]))
+
+(defn install-virtualbox-guest-additions-hwe
   "make virtual machine run properly sized on virtualbox"
   [facility]
   (actions/as-action


CMR-3685: Changed cache timeout

CMR-3685: Changed cache timeout

--- common-app-lib/src/cmr/common_app/api/enabled.clj
+++ common-app-lib/src/cmr/common_app/api/enabled.clj
@@ -19,7 +19,7 @@

 (defconfig enabled-cache-time-seconds
   "The number of seconds to cache the health of the application."
-  {:default 50
+  {:default 5
    :type Long})

 (defn create-enabled-cache


api: kill codec requirement

api: kill codec requirement

--- src/io/cyanite/api.clj
+++ src/io/cyanite/api.clj
@@ -2,7 +2,6 @@
   "Cyanite's 'HTTP interface"
   (:require [com.stuartsierra.component :as component]
             [cheshire.core              :as json]
-            [ring.util.codec            :as codec]
             [io.cyanite.engine.rule     :as rule]
             [io.cyanite.engine          :as engine]
             [io.cyanite.engine.queue    :as q]


deflake minmax-instance scaling test (#1554)

--- waiter/integration/waiter/autoscaling_test.clj
+++ waiter/integration/waiter/autoscaling_test.clj
@@ -229,6 +229,7 @@
           requests-per-thread 20
           request-delay-ms 2000
           custom-headers {:x-kitchen-delay-ms request-delay-ms
+                          :x-waiter-grace-period-secs 600  ;; avoid triggering expired instances on slow startup
                           :x-waiter-max-instances 5
                           :x-waiter-min-instances 2
                           :x-waiter-name (rand-name)
@@ -241,18 +242,16 @@
           _ (log/info "making canary request...")
           {:keys [cookies service-id]} (request-fn)
           get-target-instances
-          (fn []
-            (let [instances
-                  (loop [routers (routers waiter-url)
-                         target-instances 0]
-                    (if-let [[_ router-url] (first routers)]
-                      (let [{:keys [state]} (service-state router-url service-id :cookies cookies)]
-                        (recur (rest routers)
-                               (max target-instances
-                                    (int (get-in state [:autoscaler-state :scale-to-instances] 0)))))
-                      target-instances))]
-              (log/debug "target instances:" instances)
-              instances))]
+          (fn get-target-instances []
+            (let [router-urls (->> waiter-url routers (mapv second))
+                  router-target-instances (for [router-url router-urls]
+                                            (-> router-url
+                                                (service-state service-id :cookies cookies)
+                                                (get-in [:state :autoscaler-state :scale-to-instances] 0)
+                                                int))
+                  max-target-instances (reduce max router-target-instances)]
+              (log/debug "target instances:" max-target-instances)
+              max-target-instances))]
       (with-service-cleanup
         service-id
         (log/info "waiting up to 20 seconds for autoscaler to catch up for" service-id)


simplify error handling

simplify error handling

--- src/shuppet/elb.clj
+++ src/shuppet/elb.clj
@@ -65,10 +65,8 @@
   (try+
    (elb-request {"Action" "DescribeLoadBalancers"
                  "LoadBalancerNames.member.1" name})
-   (catch [:type :shuppet.aws/clj-http] {:keys [code]}
-     (if (and (= code "LoadBalancerNotFound"))
-       nil
-       (throw+)))))
+   (catch [:code "LoadBalancerNotFound"] _
+       nil)))

 (defn check-string-value [remote k v]
   (let [remote-value (xml1->


improved error message

improved error message

--- src/shuppet/git.clj
+++ src/shuppet/git.clj
@@ -194,7 +194,7 @@
           (send-error 404 message)))
       (catch NullPointerException e
         (rm "-rf" (repo-path name branch))
-        (send-error (str "HEAD revision not found in remote repo '" name "': " e)))
+        (send-error (str "Missing branch '" branch "' for application '" name "'.")))
       (catch MissingObjectException e
         (rm "-rf" (repo-path name branch))
         (send-error (str "Missing object for revision HEAD in repo '" name "': " e))))))


orbifoldInvariant3d.clj: implemented orbifold invariant (but abelian looks funny)

--- clojure/org/gavrog/clojure/orbifoldInvariant3d.clj
+++ clojure/org/gavrog/clojure/orbifoldInvariant3d.clj
@@ -2,7 +2,9 @@
   (:use (org.gavrog.clojure
           delaney
           delaney2d
-          partition)))
+          partition
+          fundamental
+          cosets)))

 (defn- orbifold-type [ds idcs D]
   (case (count idcs)
@@ -74,3 +76,13 @@
     (filter-graph #(not= "1" (:type %)))
     (quotient-graph #(= (:type %1) (:type %2)))
     sort))
+
+(defn orbifold-invariant [ds]
+  (let [g (orbifold-graph ds)
+        inv (let [{:keys [nr-generators relators]} (fundamental-group ds)]
+              (abelian-invariants nr-generators relators))
+        a (map (comp :type second) g)
+        b [(if (oriented? ds) 2 (if (weakly-oriented? ds) 1 0))
+           (reduce + (map (comp count :adjs second) g))
+           (count inv)]]
+        (apply str (interpose "/" (concat a b inv)))))


Actually clean up Docker instances that lose contact

--- src/lazubot/docker.clj
+++ src/lazubot/docker.clj
@@ -86,6 +86,8 @@
   [worker-doc]
   (dosync
    (commute workers dissoc (:id worker-doc)))
+  (shell/sh "docker" "kill" (:id worker-doc))
+  (shell/sh "docker" "rm" (:id worker-doc))
   (add-worker!))

 (defn acquire-worker-doc!


button styling

button styling

--- src/leftover/core.cljs
+++ src/leftover/core.cljs
@@ -13,7 +13,10 @@
       (render [_]
         (dom/div #js {:id "content" :className "col-sm-6"}
                  (obb/toolbar {}
-                              (obb/button {:onClick (fn [] (js/alert "test"))} (:text app))
-                              )))))
+                              (obb/button {
+                                           :bs-style "primary"
+                                           :onClick (fn [] (js/alert "test"))
+                                           }
+                                          (:text app)))))))
   app-state
   {:target (. js/document (getElementById "app"))})


Push incomplete box-add command to work with it locally during Clojure/conj.

--- src/leiningen/voom.clj
+++ src/leiningen/voom.clj
@@ -305,6 +305,22 @@
                            :desired-new-deps desired-new-deps
                            :tmp-file-name (str tmp-file)})))))))

+(defn repo-project-files
+  [gitdir]
+  (->
+   (git {:gitdir gitdir} "ls-files" "project.clj" "**/project.clj")
+   :out
+   s/split-lines))
+
+(defn box-add
+  [proj & args]
+  (let [res (for [rdir (all-repos-dirs)
+                  pfile (repo-project-files rdir)]
+              [rdir pfile])]
+    (doseq [[^File r p] res]
+      (let [pf (str (.getParent r) "/" p)]
+        (prn (.getParent r) p (select-keys (project/read pf) [:group :name]))))))
+
 ;; === lein entrypoint ===

 (defn nope [& args]
@@ -315,7 +331,7 @@
 (def sub-commands
   {"build-deps" build-deps
    "freshen" freshen
-   "task-add" nope
+   "box-add" box-add
    "new-task" nope})

 (defn voom


Avoid stack overflow by realizing lazy seq

--- src/main/hbase_region_inspector/core.clj
+++ src/main/hbase_region_inspector/core.clj
@@ -184,7 +184,7 @@
   [regions]
   (let [[loc tot] (reduce #(let [{loc :local-size-mb tot :store-file-size-mb
                                   :or {loc 0 tot 0}} %2]
-                             (map + %1 [loc tot]))
+                             (doall (map + %1 [loc tot])))
                           [0 0] regions)
         accum {:local-size-mb loc}]
     (if (pos? tot)


Add explicit test for glue

Add explicit test for glue

--- test/useful/seq_test.clj
+++ test/useful/seq_test.clj
@@ -27,6 +27,26 @@
 (deftest test-separate
   (is (= ['(5 1 7) '(2 4 6 2)] (separate odd?  [2 4 6 5 1 2 7])))
   (is (= ['(2 4 6 2) '(5 1 7)] (separate even? [2 4 6 5 1 2 7]))))
+
+(deftest test-glue
+  ;; Make sure all items of the same type wind up in the same batch,
+  ;; and each batch is as close to size 6 as possible without going over.
+
+  ;; The D batch is too large, and glue promises to return a too-large batch
+  ;; in preference to splitting up a batch.
+  (is (= '((a1 a2 a3 a4 b1)
+           (c1 c2)
+           (d1 d2 d3 d4 d5 d6 d7)
+           (e8))
+         (glue into []
+               (fn [batch more]
+                 (>= 6 (+ (count batch) (count more))))
+               (constantly false)
+               '((a1 a2 a3 a4)
+                 (b1)
+                 (c1 c2)
+                 (d1 d2 d3 d4 d5 d6 d7)
+                 (e8))))))

 (deftest test-partition-between
   (testing "returns a totally lazy sequence"


FIX wrap impl of `IDidMount` with `did-mount`

--- src-cljs/frontend/components/pages/build.cljs
+++ src-cljs/frontend/components/pages/build.cljs
@@ -69,7 +69,8 @@
 (defn- merge-actions [{:keys [build]} owner]
   (reify
     om/IDidMount
-    ((om/get-shared owner :track-event) {:event-type :merge-impression})
+    (did-mount [_]
+      ((om/get-shared owner :track-event) {:event-type :merge-impression}))
     om/IRender
     (render [_]
       (let [pull-request-number (last (build-model/pull-request-numbers build))


Fix bug where card collection throws on nil card

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


CMR-1844: Modified a test in response to a review comment.

--- system-int-test/test/cmr/system_int_test/virtual_product_test.clj
+++ system-int-test/test/cmr/system_int_test/virtual_product_test.clj
@@ -298,11 +298,13 @@
                  "The order of the output granules should match the corresponding input. Duplicates
                  in the source should be preserved."
                  [source-granule non-virtual-granule1 virtual-granule1 non-virtual-granule2
-                  virtual-granule2 virtual-granule3 non-virtual-granule3 virtual-granule4
-                  source-granule non-virtual-granule1 virtual-granule1]
+                  non-virtual-granule3 non-virtual-granule4 virtual-granule2 virtual-granule3
+                  non-virtual-granule3 non-virtual-granule3 virtual-granule4 source-granule
+                  non-virtual-granule1 virtual-granule1 ]
                  [source-granule non-virtual-granule1 source-granule non-virtual-granule2
-                  source-granule source-granule non-virtual-granule3 source-granule
-                  source-granule non-virtual-granule1 source-granule]))
+                  non-virtual-granule3 non-virtual-granule4 source-granule source-granule
+                  non-virtual-granule3 non-virtual-granule3 source-granule source-granule
+                  non-virtual-granule1 source-granule]))

     (testing "Translating a granule which is deleted"
       (util/are2 [deleted-granule request-json expected-response-json]


We weren't actually renaming any keys

We weren't actually renaming any keys

--- src-cljs/frontend/api.cljs
+++ src-cljs/frontend/api.cljs
@@ -11,7 +11,7 @@
 (def build-keys-mapping {:username :org
                          :reponame :repo
                          :default_branch :branch
-                         :vcs_type :vcs_type})
+                         :vcs-type :vcs_type})

 (defn project-build-key
   "Takes project hash and filter down to keys that identify the build."


Cleaner exits in non-gui mode

Cleaner exits in non-gui mode

--- src/brevis/core.clj
+++ src/brevis/core.clj
@@ -101,7 +101,10 @@
                    "FPS" fps)))
       (if (or (:terminated? state)
               (:close-requested @*gui-state*));; shouldnt be using gui state for this
-        state
+        (do (println "Halting.")
+          state
+          (doseq [dh @destroy-hooks] (dh))
+          (System/exit 0))
         (recur ((:update state) [t (get-dt)] state)
                (+ t (get-dt))
                (if (> t (+ twrite write-interval)) t twrite)


Fix numeric sampleIDs in clinicalMatrix.

--- src/cgdata/core.clj
+++ src/cgdata/core.clj
@@ -290,10 +290,10 @@
   (let [[_ samples] (s/split line #"\t" 2)]
     (str "sampleID\t" samples)))

-(defn- ammend-lines
+(defn- ammend-header
   "Coerce first column name to sampleID"
-  [lines]
-  (concat (cons (ammend-sample-field (first lines)) (rest lines))))
+  [header]
+  (assoc header 0 "sampleID"))

 (defn fix-vec [v size]
   (let [c (count v)]
@@ -302,13 +302,18 @@
       (< c size) (apply conj v (repeat (- size c) ""))
       :else v)))

+
+(defn matrix-data-parse
+  [metadata features lines parse]
+  (let [header (ammend-header (parse (first lines)))
+        ncols (count header)]
+    (cons (data-line features header "category") ; coerce sampleID type
+          (chunked-pmap #(data-line features (fix-vec (parse %) ncols))
+                        (rest lines)))))
+
 (defmethod matrix-data :default
   [metadata features lines]
-  (let [lines (ammend-lines lines)
-        ncols (count (tabbed (first lines)))]
-    (cons (data-line features (tabbed (first lines)) "category") ; coerce sampleID type
-          (chunked-pmap #(data-line features (fix-vec (tabbed %) ncols))
-                        (rest lines)))))
+  (matrix-data-parse metadata features lines tabbed))

 (defn- transpose
   "Transpose cells of a tsv, using the first row to fix the number of columns."
@@ -320,10 +325,9 @@
 (defmethod matrix-data "clinicalMatrix"
   [metadata features lines]
   (let [lines (->> lines
-                  (ammend-lines)
                   (map tabbed)
                   (transpose))]
-    (chunked-pmap #(data-line features %) lines)))
+    (matrix-data-parse metadata #(data-line features %) lines identity)))

 (defn- cgdata-meta [file]
   (let [mfile (io/as-file (str file ".json"))]


(maint) Remove unneeded str call in proxy tests

--- test/clj/puppetlabs/trapperkeeper/services/webserver/jetty9_service_proxy_test.clj
+++ test/clj/puppetlabs/trapperkeeper/services/webserver/jetty9_service_proxy_test.clj
@@ -598,16 +598,16 @@
                       :path "/hello"}
        :proxy-opts   {:follow-redirects true}
        :ring-handler redirect-test-handler}
-      (let [response (http-get (str "http://localhost:9000/hello/"))]
-        (is (= (:status response) 200))
-        (is (= (:body response) "Hello, World!")))
-      (let [response (http-get (str "http://localhost:9000/hello/world"))]
-        (is (= (:status response) 200))
-        (is (= (:body response) "Hello, World!")))
-      (let [response (http-get (str "http://localhost:10000/hello-proxy"))]
-        (is (= (:status response) 200))
-        (is (= (:body response) "Hello, World!")))
-      (let [response (http-get (str "http://localhost:10000/hello-proxy/world"))]
+      (let [response (http-get "http://localhost:9000/hello/")]
+        (is (= (:status response) 200))
+        (is (= (:body response) "Hello, World!")))
+      (let [response (http-get "http://localhost:9000/hello/world")]
+        (is (= (:status response) 200))
+        (is (= (:body response) "Hello, World!")))
+      (let [response (http-get "http://localhost:10000/hello-proxy")]
+        (is (= (:status response) 200))
+        (is (= (:body response) "Hello, World!")))
+      (let [response (http-get "http://localhost:10000/hello-proxy/world")]
         (is (= (:status response) 200))
         (is (= (:body response) "Hello, World!")))))

@@ -621,7 +621,7 @@
                       :port 9000
                       :path "/hello"}
        :ring-handler redirect-test-handler}
-      (let [response (http-get (str "http://localhost:10000/hello-proxy"))]
+      (let [response (http-get "http://localhost:10000/hello-proxy")]
         (is (= (:status response) 404)))))

   (testing "proxy-redirect to non-target host fails"
@@ -635,7 +635,7 @@
                       :path "/hello"}
        :proxy-opts   {:follow-redirects true}
        :ring-handler redirect-wrong-host}
-      (let [response (http-get (str "http://localhost:10000/hello-proxy"))]
+      (let [response (http-get "http://localhost:10000/hello-proxy")]
         (is (= (:status response) 502)))))

   (testing "proxy redirect to correct host in fully qualified url works"
@@ -649,16 +649,16 @@
                       :path "/hello"}
        :proxy-opts   {:follow-redirects true}
        :ring-handler redirect-same-host}
-      (let [response (http-get (str "http://localhost:9000/hello/"))]
-        (is (= (:status response) 200))
-        (is (= (:body response) "Hello, World!")))
-      (let [response (http-get (str "http://localhost:9000/hello/world"))]
-        (is (= (:status response) 200))
-        (is (= (:body response) "Hello, World!")))
-      (let [response (http-get (str "http://localhost:10000/hello-proxy"))]
-        (is (= (:status response) 200))
-        (is (= (:body response) "Hello, World!")))
-      (let [response (http-get (str "http://localhost:10000/hello-proxy/world"))]
+      (let [response (http-get "http://localhost:9000/hello/")]
+        (is (= (:status response) 200))
+        (is (= (:body response) "Hello, World!")))
+      (let [response (http-get "http://localhost:9000/hello/world")]
+        (is (= (:status response) 200))
+        (is (= (:body response) "Hello, World!")))
+      (let [response (http-get "http://localhost:10000/hello-proxy")]
+        (is (= (:status response) 200))
+        (is (= (:body response) "Hello, World!")))
+      (let [response (http-get "http://localhost:10000/hello-proxy/world")]
         (is (= (:status response) 200))
         (is (= (:body response) "Hello, World!")))))

@@ -673,10 +673,10 @@
                       :path "/hello"}
        :proxy-opts   {:follow-redirects true}
        :ring-handler redirect-different-proxy-path}
-      (let [response (http-get (str "http://localhost:9000/hello/"))]
-        (is (= (:status response) 200))
-        (is (= (:body response) "Hello, World!")))
-      (let [response (http-get (str "http://localhost:10000/hello-proxy"))]
+      (let [response (http-get "http://localhost:9000/hello/")]
+        (is (= (:status response) 200))
+        (is (= (:body response) "Hello, World!")))
+      (let [response (http-get "http://localhost:10000/hello-proxy")]
         (is (= (:status response) 200))
         (is (= (:body response) "Hello, World!"))))))


Move exception middleware up so it can see params.

--- src/clojars/web.clj
+++ src/clojars/web.clj
@@ -133,6 +133,7 @@
         {:credential-fn (credential-fn db)
          :workflows [(workflows/interactive-form)
                      (registration/workflow db)]})
+       (wrap-exceptions reporter)
        (wrap-anti-forgery)
        (wrap-x-frame-options)
        (wrap-keyword-params)
@@ -142,8 +143,7 @@
        (wrap-secure-session)
        (wrap-resource "public")
        (wrap-content-type)
-       (wrap-not-modified)
-       (wrap-exceptions reporter))))
+       (wrap-not-modified))))

 (defn handler-optioned [{:keys [db error-reporter stats search mailer]}]
   (clojars-app (:spec db) error-reporter stats search mailer))


use clojure.spec

use clojure.spec

--- examples/ring-spec-swagger/src/example/server.clj
+++ examples/ring-spec-swagger/src/example/server.clj
@@ -10,7 +10,22 @@
             [ring.middleware.params :as params]
             [ring.adapter.jetty :as jetty]
             [muuntaja.core :as m]
+            [clojure.spec.alpha :as s]
+            [spec-tools.spec :as spec]
             [clojure.java.io :as io]))
+
+(s/def ::file multipart/temp-file-part)
+(s/def ::file-params (s/keys :req-un [::file]))
+
+(s/def ::name spec/string?)
+(s/def ::size spec/int?)
+(s/def ::file-response (s/keys :req-un [::name ::size]))
+
+(s/def ::x spec/int?)
+(s/def ::y spec/int?)
+(s/def ::total spec/int?)
+(s/def ::math-request (s/keys :req-un [::x ::y]))
+(s/def ::math-response (s/keys :req-un [::total]))

 (def app
   (ring/ring-handler
@@ -25,8 +40,8 @@

         ["/upload"
          {:post {:summary "upload a file"
-                 :parameters {:multipart {:file multipart/temp-file-part}}
-                 :responses {200 {:body {:name string?, :size int?}}}
+                 :parameters {:multipart ::file-params}
+                 :responses {200 {:body ::file-response}}
                  :handler (fn [{{{:keys [file]} :multipart} :parameters}]
                             {:status 200
                              :body {:name (:filename file)
@@ -46,14 +61,14 @@

         ["/plus"
          {:get {:summary "plus with spec query parameters"
-                :parameters {:query {:x int?, :y int?}}
-                :responses {200 {:body {:total int?}}}
+                :parameters {:query ::math-request}
+                :responses {200 {:body ::math-response}}
                 :handler (fn [{{{:keys [x y]} :query} :parameters}]
                            {:status 200
                             :body {:total (+ x y)}})}
           :post {:summary "plus with spec body parameters"
-                 :parameters {:body {:x int?, :y int?}}
-                 :responses {200 {:body {:total int?}}}
+                 :parameters {:body ::math-request}
+                 :responses {200 {:body ::math-response}}
                  :handler (fn [{{{:keys [x y]} :body} :parameters}]
                             {:status 200
                              :body {:total (+ x y)}})}}]]]


unbreak the first run

unbreak the first run

Signed-off-by: Chris Granger <5654cde260ae99bc4d30054171b8bcd902efd19a@gmail.com>

--- src/aurora/editor/ui2.cljs
+++ src/aurora/editor/ui2.cljs
@@ -395,15 +395,9 @@
   (reset! run-stack #js {:calls [(nth (interpreter/run-example interpreter/example-c x) 2)]})
   (queue-render))

-(re-run 1)

 (defn find-id [thing id]
   (first (filter #(= (aget % "id") id) (aget thing "calls"))))
-
-(-> @run-stack
-    (aget "calls")
-    (aget 0)
-    (aget "id"))

 (defn traverse-path [stack path]
   (loop [stack stack
@@ -448,7 +442,8 @@
 (add-watch aurora-state :foo (fn [_ _ _ cur]
                                (queue-render)))

-(queue-render)
-
-
-
+(re-run 1)
+
+
+
+


working on adjoining lexemes to trees

working on adjoining lexemes to trees

--- src/babel/english/lab.cljc
+++ src/babel/english/lab.cljc
@@ -96,26 +96,35 @@

 (def the-static-tree (create-the-static-tree))

-(def lexemes (flatten (vals (:lexicon model))))
+(def lexemes
+  (flatten (vals (:lexicon model))))

 (defn basecamp []
   (let [tree the-static-tree]
-    (->> (-> lexemes
-             shuffle)
-         (map (fn [lexeme]
-                (let [tree (u/copy tree)
-                      lexeme (u/copy lexeme)]
-                  (u/assoc-in! tree [:head :head] lexeme))))
-         (filter #(not (= :fail %))))))
-
+    (morph (-> tree
+               (basecamp-at [:head :head])
+               (u/dissoc-paths [[:head :head]])
+               (basecamp-at [:head :comp :head :head])
+               (u/dissoc-paths [[:head :comp :head :head]])
+               (basecamp-at [:head :comp :head :comp])
+               (u/dissoc-paths [[:head :comp :head]])
+               (basecamp-at [:head :comp :comp])
+               (u/dissoc-paths [[:head]])
+               (basecamp-at [:comp :head :head])
+               (u/dissoc-paths [[:comp :head :head]])
+               (basecamp-at [:comp :head :comp])
+               (u/dissoc-paths [[:comp :head]])
+               (basecamp-at [:comp :comp])
+               (u/dissoc-paths [[:comp]])))))
+
 (defn basecamp-at [tree path]
-  (->> (-> lexemes
-           shuffle)
-       (map (fn [lexeme]
-              (let [tree (u/copy tree)
-                    lexeme (u/copy lexeme)]
-                (u/assoc-in! tree path lexeme))))
-       (filter #(not (= :fail %)))))
+  (println (str "@" path))
+  (first (->> (shuffle lexemes)
+              (map (fn [lexeme]
+                     (let [tree (u/copy tree)
+                           lexeme (u/copy lexeme)]
+                        (u/assoc-in! tree path lexeme))))
+              (filter #(not (= :fail %))))))

 (defn nextcamp []
   (let [parse (-> "the small dogs you see" parse first)]


Handle power state of Plex client slightly better

--- src/laogai/plex.clj
+++ src/laogai/plex.clj
@@ -11,19 +11,27 @@
   (str "http://" (:addr plex) ":" (:port plex) "/"))

 (defn on?
+  "Returns true if Plex client is currently connected
+  Note: This has a significant delay to disappear from the list"
   []
-  (try
-    (.isReachable (InetAddress/getByName (-> config :appletv :addr)) 1500)
-    (catch Exception e false)))
+  (some #(= (:client plex)
+            (-> % :attrs :name))
+        (-> (http/get (str base "clients")
+                      {:retry-handler
+                       (fn [ex try-count http-context]
+                         (println "Plex Error:" ex)
+                         (if (> try-count 4) false true))})
+            :body xml/parse-str :content)))

 (defn sessions
   "Parse returned XML of all current Plex sessions"
   []
-  (xml/parse-str (:body (http/get (str base "status/sessions")
-                                  {:retry-handler
-                                   (fn [ex try-count http-context]
-                                     (println "Plex Error:" ex)
-                                     (if (> try-count 4) false true))}))))
+  (-> (http/get (str base "status/sessions")
+                {:retry-handler
+                 (fn [ex try-count http-context]
+                   (println "Plex Error:" ex)
+                   (if (> try-count 4) false true))})
+      :body xml/parse-str))

 (defn client
   "Returns the parsed XML contents of the Plex client session"
@@ -31,10 +39,7 @@
   (first (filter #(and (= :Player (:tag %))
                        (= (:client plex)
                           (:title (:attrs %))))
-                 (-> (sessions)
-                     :content
-                     first
-                     :content))))
+                 (-> (sessions) :content first :content))))

 (defn watching?
   "Returns boolean value dependent on whether the Plex client is in a session"


begin panning constraint code

begin panning constraint code

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

--- plugins/SlideExplorer2/src/slide_explorer/tiles.clj
+++ plugins/SlideExplorer2/src/slide_explorer/tiles.clj
@@ -79,4 +79,18 @@
         nb (floor-int (/ (+ -1 (.getHeight rectangle) (.y rectangle)) tile-height))]
     (for [nx (range nl (inc nr))
           ny (range nt (inc nb))]
-      [nx ny])))+      [nx ny])))
+
+;; FINDING EXTENT OF TILES
+
+(defn index-range [indices tag]
+  (let [indices (map tag indices)]
+    {:min (apply min indices)
+     :max (apply max indices)}))
+
+(defn tile-range [acquired-images]
+  (let [tags [:nx :ny :nz]]
+    (zipmap tags (map #(index-range acquired-images %) tags))))
+
+
+


change lang keys

change lang keys

--- src/cljs/salava/extra/application/ui/issuer.cljs
+++ src/cljs/salava/extra/application/ui/issuer.cljs
@@ -18,6 +18,8 @@
     (subs text 1)
     text))

+;;TODO (everytime issuer info changes, a new id is given, hence possible discrepancies in favourites list and issuer list)
+;fix favourites list -> compare issuer based on name and merge if name is same
 (defn create-favourite-list [favourites all]
   (sort-by :issuer_content_name (distinct-by :issuer_content_id (filter (fn [app] (some #(= (:id %) (:issuer_content_id app)) favourites)) all))))

@@ -191,8 +193,8 @@
      [:div.col-sm-10.buttons
       [:button.btn.btn-default {:style {:display display}
                                 :on-click #(do
-                                             (swap! state assoc :show-issuer-info false :issuer-content {:name (t :extra-application/Allissuers)})
-                                             (issuer-applications "" state)) }  (t :extra-application/Reset)]
+                                             (swap! state assoc :show-issuer-info false :issuer-content {:name (t :core/All)})
+                                             (issuer-applications "" state)) }  (t :core/All)]
       [:button.issuer-button {:class (str "btn btn-active")
                               :id "btn-all"
                               :on-click #(do
@@ -213,8 +215,13 @@
        [:div.row.issuer-grid
         [:div.col-xs-12
          (if-not (blank? banner)
+           [:div.info-block.col-xs-12
+                        [:h2.uppercase-header.pull-left
+              (issuer-image image)
+              " "
+              name]
            [:img.img-responsive
-            {:src (str "/" banner)}])
+            {:src (str "/" banner)}]])
          [:div.col-xs-12.info-block
           [:div.col-xs-12
            (when (blank? banner)


Add notes abvout reactify-component alternatives

--- examples/react-sortable-hoc/src/example/core.cljs
+++ examples/react-sortable-hoc/src/example/core.cljs
@@ -8,8 +8,11 @@

 (def DragHandle
   (js/SortableHOC.SortableHandle.
-    (r/reactify-component
-      (fn [] [:span "::"]))))
+    ;; Alternative to r/reactify-component, which doens't convert props and hiccup,
+    ;; is to just provide fn as component and use as-element or create-element
+    ;; to return React elements from the component.
+    (fn []
+      (r/as-element [:span "::"]))))

 (def SortableItem
   (js/SortableHOC.SortableElement.
@@ -18,6 +21,17 @@
         [:li
          [:> DragHandle]
          value]))))
+
+;; Alternative without reactify-component
+;; props is JS object here
+#_
+(def SortableItem
+  (js/SortableHOC.SortableElement.
+    (fn [props]
+      (r/as-element
+        [:li
+         [:> DragHandle]
+         (.-value props)]))))

 (def SortableList
   (js/SortableHOC.SortableContainer.


alias hayt instead of duplicating fns

alias hayt instead of duplicating fns

--- src/clojure/clojurewerkz/cassaforte/query.clj
+++ src/clojure/clojurewerkz/cassaforte/query.clj
@@ -1,44 +1,23 @@
 (ns clojurewerkz.cassaforte.query
-  (:require [qbits.hayt :as hayt]
-            [qbits.hayt.utils :as utils]
-            [qbits.hayt.cql :as cql]
-            [qbits.hayt.fns :as cql-fn]))
+  (:require
+   [flatland.useful.ns :as uns]
+   [qbits.hayt.cql :as cql]))
+
+(def ->raw
+  "Compiles a hayt query into its raw string value"
+  cql/->raw)
+
+(def ->prepared
+  "Compiles a hayt query into a vector composed of the prepared string
+  query and a vector of parameters."
+  cql/->prepared)
+
+(doseq [module '(dsl fns utils)]
+  (uns/alias-ns (symbol (str "qbits.hayt." module))))

 ;;
-;; Renderers
+;; Cassaforte Mods
 ;;
-
-(defn ->raw
-  "Execute raw query"
-  [query]
-  (binding [cql/*prepared-statement* false]
-    (cql/emit-query query)))
-
-(defn ->prepared
-  "Compile a query into a vector composed of the prepared string
-  query and a vector of parameters."
-  [query]
-  (binding [cql/*prepared-statement* true
-            cql/*param-stack* (atom [])]
-    [(cql/emit-query query)
-     @cql/*param-stack*]))
-
-;;
-;; Queries
-;;
-
-(defn select-query
-  "http://cassandra.apache.org/doc/cql3/CQL.html#selectStmt
-
-Takes a table identifier and additional clause arguments:
-
-* columns (defaults to *)
-* where
-* order-by
-* limit
-* table (optionaly using composition)"
-  [table & clauses]
-  (into {:select table :columns :*} clauses))

 (defn insert-query
   "http://cassandra.apache.org/doc/cql3/CQL.html#insertStmt
@@ -63,335 +42,13 @@
   (into {:update table
          :set-columns set-columns} clauses))

-(defn delete-query
-  "http://cassandra.apache.org/doc/cql3/CQL.html#deleteStmt
-
-Takes a table identifier and additional clause arguments:
-
-* columns (defaults to *)
-* using
-* where
-* table (optionaly using composition)"
-  [table & clauses]
-  (into {:delete table :columns (keyword "")} clauses))
-
-(defn truncate-query
-  "http://cassandra.apache.org/doc/cql3/CQL.html#truncateStmt
-
-Takes a table identifier."
-  [table]
-  {:truncate table})
-
-(defn drop-keyspace-query
-  "http://cassandra.apache.org/doc/cql3/CQL.html#dropKeyspaceStmt
-
-Takes a keyspace identifier"
-  [keyspace]
-  {:drop-keyspace keyspace})
-
-(defn drop-table-query
-  "http://cassandra.apache.org/doc/cql3/CQL.html#dropTableStmt
-
-Takes a table identifier"
-  [table]
-  {:drop-table table})
-
-(defn drop-index-query
-  "http://cassandra.apache.org/doc/cql3/CQL.html#dropIndexStmt
-
-Takes an index identifier."
-  [index]
-  {:drop-index index})
-
-(defn create-index-query
-  "http://cassandra.apache.org/doc/cql3/CQL.html#createIndexStmt
-
-Takes a table identifier and additional clause arguments:
-
-* index-column
-* index-name
-* table (optionaly using composition)"
-  [table name & clauses]
-  (into {:create-index name :on table} clauses))
-
-(defn create-keyspace-query
-  "http://cassandra.apache.org/doc/cql3/CQL.html#createKeyspaceStmt
-
-Takes a keyspace identifier and clauses:
-* with
-* keyspace (optionaly using composition)"
-  [keyspace & clauses]
-  (into {:create-keyspace keyspace} clauses))
-
-(defn create-table-query
-  "Takes a table identifier and additional clause arguments:
-
-* column-definitions
-* with"
-  [table & clauses]
-  (into {:create-table table} clauses))
-
-(defn alter-table-query
-  "http://cassandra.apache.org/doc/cql3/CQL.html#alterTableStmt
-
-Takes a table identifier and additional clause arguments:
-
-* alter-column
-* add
-* with
-* alter
-* rename"
-  [table & clauses]
-  (into {:alter-table table} clauses))
-
-(defn alter-column-family-query
-  "http://cassandra.apache.org/doc/cql3/CQL.html#alterTableStmt
-
-Takes a column-familiy identifier and additional clause arguments:
-
-* alter-column
-* add
-* with
-* alter
-* rename
-* column-family (optionaly using composition)"
-  [column-family & clauses]
-  (into {:alter-column-family column-family} clauses))
-
-(defn alter-keyspace-query
-  "http://cassandra.apache.org/doc/cql3/CQL.html#alterKeyspaceStmt
-
-Takes a keyspace identifier and a `with` clause.
-* keyspace (optionaly using composition)"
-  [keyspace & clauses]
-  (into {:alter-keyspace keyspace} clauses))
-
-(defn batch-query
-  "http://cassandra.apache.org/doc/cql3/CQL.html#batchStmt
-
-Takes hayt queries  optional clauses:
-* using
-* counter
-* logged "
-  [& clauses]
-  (into {:logged true} clauses))
-
-(defn use-keyspace-query
-  "http://cassandra.apache.org/doc/cql3/CQL.html#useStmt
-
-Takes a keyspace identifier"
-  [keyspace]
-  {:use-keyspace keyspace})
-
-(defn grant-query
-  "Takes clauses:
-* resource
-* user"
-  [perm & clauses]
-  (into {:grant perm} clauses))
-
-(defn revoke-query
-  "Takes clauses:
-* resource
-* user"
-  [perm & clauses]
-  (into {:revoke perm} clauses))
-
-(defn create-user-query
-  "Takes clauses:
-* password
-* superuser (defaults to false)"
-  [user & clauses]
-  (into {:create-user user :superuser false} clauses))
-
-(defn alter-user-query
-  "Takes clauses:
-* password
-* superuser (defaults to false)"
-  [user & clauses]
-  (into {:alter-user user :superuser false} clauses))
-
-(defn drop-user-query
-  [user]
-  {:drop-user user})
-
-(defn list-users-query
-  []
-  {:list-users nil})
-
-(defn list-perm-query
-  "Takes clauses:
-* perm (defaults to ALL if not supplied)
-* user
-* resource
-* recursive (defaults to true)"
-  [& clauses]
-  (into {:list-perm :ALL :recursive true} clauses))
-
-;;
-;; Clauses
-;;
-
-(defn columns
-  "Clause: takes columns identifiers"
-  [& columns]
-  {:columns columns})
-
-(defn column-definitions
-  "Clause: "
-  [column-definitions]
-  {:column-definitions column-definitions})
-
 (defn using
   "Clause: takes keyword/value pairs for :timestamp and :ttl"
   [& args]
   {:using (apply hash-map args)})
-
-(defn limit
-  "Clause: takes a numeric value"
-  [n]
-  {:limit n})
-
-(defn order-by
-  "Clause: takes vectors of 2 elements, where the first is the column
-  identifier and the second is the ordering as keyword.
-  ex: :asc, :desc"
-  [& columns] {:order-by columns})
-
-(defn queries
-  "Clause: takes hayt queries to be executed during a batch operation."
-  [& queries]
-  {:batch queries})

 (defn where
   "Clause: takes a map or a vector of pairs to compose the where
 clause of a select/update/delete query"
   [& args]
   {:where (partition 2 args)})
-
-(defn values
-  "Clause: Takes a map of columns to be inserted"
-  [values]
-  {:values values})
-
-(defn set-columns
-  "Clause: Takes a map of columns to be updated"
-  [values]
-  {:set-columns values})
-
-(defn with
-  "Clause: compiles to a CQL with clause (possibly nested maps)"
-  [values]
-  {:with values})
-
-(defn index-name
-  "Clause: Takes an index identifier"
-  [value]
-  {:index-name value})
-
-(defn alter-column
-  "Clause: takes a table identifier and a column type"
-  [& args]
-  {:alter-column args})
-
-(defn add-column
-  "Clause: takes a table identifier and a column type"
-  [& args]
-  {:add-column args})
-
-(defn rename-column
-  "Clause: rename from old-name to new-name"
-  [& args]
-  {:rename-column args})
-
-(defn drop-column
-  "Clause: Takes a column Identifier"
-  [id]
-  {:drop-column id})
-
-(defn allow-filtering
-  "Clause: sets ALLOW FILTERING on select queries, defaults to true is
-   used without a value"
-  ([value]
-     {:allow-filtering value})
-  ([]
-     (allow-filtering true)))
-
-(defn logged
-  "Clause: Sets LOGGED/UNLOGGED attribute on BATCH queries"
-  ([value]
-     {:logged value})
-  ([]
-     (logged true)))
-
-(defn counter
-  "Clause: Sets COUNTER attribute on BATCH queries"
-  ([value]
-     {:counter value})
-  ([]
-     (counter true)))
-
-(defn superuser
-  "Clause: To be used with alter-user and create-user, sets superuser status"
-  ([value]
-     {:superuser value})
-  ([]
-     (superuser true)))
-
-(defn password
-  "Clause: To be used with alter-user and create-user, sets password"
-  [value]
-  {:password value})
-
-(defn recursive
-  "Clause: Sets recusivity on list-perm (LIST PERMISSION) queries"
-  ([value]
-     {:recursive value})
-  ([]
-     (recursive true)))
-
-(defn resource
-  "Clause: Sets resource to be modified/used with grant or list-perm"
-  [value]
-  {:resource value})
-
-(defn user
-  "Clause: Sets user to be modified/used with grant or list-perm"
-  [value]
-  {:user value})
-
-(defn perm
-  "Clause: Sets permission to be listed with list-perm"
-  [value]
-  {:list-perm value})
-
-(defn custom
-  "Clause: Sets CUSTOM status on create-index query"
-  ([x]
-     {:custom x})
-  ([]
-     (custom true)))
-
-;;
-;;
-;;
-
-(def now
-  "Returns a now() CQL function"
-  (constantly (cql-fn/cql-fn "now")))
-
-(def count*
-  "Returns a count(*) CQL function"
-  (constantly (cql-fn/cql-fn "COUNT" :*)))
-
-(def count1
-  "Returns a count(1) CQL function"
-  (constantly (cql-fn/cql-fn "COUNT" 1)))
-
-;;
-;;
-;;
-
-(def map-type (comp keyword utils/map-type))
-(def list-type (comp keyword utils/list-type))
-(def set-type (comp keyword utils/set-type))


CMR-493: Removed debug output.

CMR-493: Removed debug output.

--- src/cmr/search/services/legacy_parameters.clj
+++ src/cmr/search/services/legacy_parameters.clj
@@ -105,8 +105,6 @@
   "Process legacy product specific attributes by parsing the query string and updating params
   with attributes matching the new cmr csv style"
   [params query-string]
-  (println params)
-  (println query-string)
   (psa-pre-validation params)
   (let [param-strings (map rc/url-decode (s/split query-string #"&"))
         param-tuples (keep legacy-psa-param->tuple param-strings)


First pass at a recursive version of the reader.

--- src/blutwurst/database.clj
+++ src/blutwurst/database.clj
@@ -73,30 +73,35 @@
                    {:name (.getString rs "PKTABLE_NAME")}))
   result)))

+(defn- read-dependencies [rs last-key from-columns to-columns destination-table result]
+  (if (not (.next rs))
+    (assoc result from-columns (assoc destination-table :columns to-columns))
+    (let [key-name (.getString rs "FK_NAME")
+          current-column (.getString rs "FKCOLUMN_NAME")
+          current-to-column (.getString rs "PKCOLUMN_NAME")]
+      (recur rs
+             key-name
+             (if (= key-name last-key)
+               (conj from-columns current-column)
+               (vector current-column))
+             (if (= key-name last-key)
+               (conj to-columns current-to-column)
+               (vector current-to-column))
+             (if (= key-name last-key)
+               destination-table
+               {:name (.getString rs "PKTABLE_NAME") :schema (.getString rs "PKTABLE_SCHEM")})
+             (if (= key-name last-key)
+               result
+               (assoc result from-columns (assoc destination-table :columns to-columns))))
+      )))
+
 (defn- retrieve-dependencies-for-table [meta-data table]
- (let [rs (.getImportedKeys meta-data nil (:schema table) (:name table))
-       ]
- (with-local-vars [ last-key nil result {}]
-  (while (.next rs)
-   (do
-    (var-set result (assoc (var-get result) (vector (.getString rs "FKCOLUMN_NAME"))
-     {:name (.getString rs "PKTABLE_NAME")
-     :schema (.getString rs "PKTABLE_SCHEM")
-     :columns (vector (.getString rs "PKCOLUMN_NAME"))}))
-
-    (trace (.getString rs "PK_NAME"))
-    (trace (.getString rs "FK_NAME"))
-    (trace "PK: ")
-    (trace (.getString rs "PKTABLE_SCHEM"))
-    (trace (.getString rs "PKTABLE_NAME"))
-    (trace (.getString rs "PKCOLUMN_NAME"))
-    (trace "FK: ")
-    (trace (.getString rs "FKTABLE_SCHEM"))
-    (trace (.getString rs "FKTABLE_NAME"))
-    (trace (.getString rs "FKCOLUMN_NAME"))
-  ))
-  (var-get result))
- ))
+  (read-dependencies (.getImportedKeys meta-data nil (:schema table) (:name table))
+                     nil
+                     []
+                     []
+                     {}
+                     {}))

 (defn- retrieve-keys
  "This function is responsible for building an adjacency matrix illustrating the key relationships


:nail_care:

--- src/com/wsscode/pathom/connect/run_graph.cljc
+++ src/com/wsscode/pathom/connect/run_graph.cljc
@@ -256,7 +256,6 @@
         (assoc ::run-next run-next)))))

 (defn extend-node-run-next [{::keys [index-syms] :as out} {::keys [run-next run-next-stack] :as env}]
-  ; TODO handle graph here
   (if run-next
     (if-let [node-ids (seq (get index-syms (pc-sym env)))]
       (reduce
@@ -330,7 +329,7 @@
       (set/subset? (all-attribute-resolvers env (pc-attr env)) syms)
       (update ::unreachable-attrs conj (pc-attr env)))))

-(defn compute-missing [out {::keys [previous-out] :as env} missing]
+(defn compute-missing-chain [out {::keys [previous-out] :as env} missing]
   (if (seq missing)
     (let [root-node (get-root-node out)

@@ -356,6 +355,13 @@
                 unreachable-attrs (filter #(set/subset? (all-attribute-resolvers env %) unreachable-syms) still-missing)]
             (update out' ::unreachable-attrs into unreachable-attrs)))))
     out))
+
+(defn get-resolver-extension-node-id
+  [{::keys [index-syms] :as out} env]
+  (let [resolver (pc-sym env)]
+    (and (contains? (::index-syms out) resolver)
+         (not (dynamic-resolver? env resolver))
+         (first (get index-syms resolver)))))

 (defn resolver-input-paths
   [out
@@ -371,17 +377,14 @@
         (dissoc out ::root)
         ; resolvers loop
         (reduce
-          (fn [{::keys [unreachable-syms index-syms] :as out} resolver]
+          (fn [{::keys [unreachable-syms] :as out} resolver]
             (if (contains? unreachable-syms resolver)
               out
               (let [env (assoc env pc-sym resolver)]
-                (if (and (contains? (::index-syms out) resolver)
-                         (not (dynamic-resolver? env resolver)))
-                  (let [sym-node-id (first (get index-syms resolver))]
-                    (cond-> (extend-node-run-next out env)
-                      sym-node-id
-                      (-> (update-in [::nodes sym-node-id ::requires] merge-io {(pc-attr env) {}})
-                          (update-in [::nodes sym-node-id ::provides] merge-io {(pc-attr env) {}}))))
+                (if-let [sym-node-id (get-resolver-extension-node-id out env)]
+                  (-> (extend-node-run-next out env)
+                      (update-in [::nodes sym-node-id ::requires] merge-io {(pc-attr env) {}})
+                      (update-in [::nodes sym-node-id ::provides] merge-io {(pc-attr env) {}}))
                   (let [node (create-sym-node out env)]
                     (-> out
                         (include-node node)
@@ -393,7 +396,7 @@

         (if (::root <>)
           (-> <>
-              (compute-missing (assoc env ::previous-out out) missing)
+              (compute-missing-chain (assoc env ::previous-out out) missing)
               (compute-root-or env {::node-id (::root out)}))
           <>)))))

@@ -416,39 +419,48 @@
                   (remove #(contains? entity (:key %)))
                   children))))))

+(defn compute-attribute-graph-item
+  [{::keys [root] :as out}
+   {:com.wsscode.pathom.connect/keys [index-oir attribute]
+    :as                              env}]
+  (if (attribute-provided? out attribute)
+    (update-in out [::nodes root ::requires] merge-io {attribute {}})
+    (let [new-out
+          (as-> out <>
+            (dissoc <> ::root)
+            (reduce-kv
+              (fn [out inputs resolvers]
+                (resolver-input-paths out env inputs resolvers))
+              <>
+              (get index-oir attribute)))]
+      (if (::root new-out)
+        (compute-root-and new-out env {::node-id root})
+        (assoc new-out ::root root)))))
+
 (defn compute-attribute-graph
-  [{::keys [root unreachable-attrs] :as out}
+  [{::keys [unreachable-attrs] :as out}
    {::keys                           [available-data]
     :com.wsscode.pathom.connect/keys [index-oir]
-    :as                              env}
-   {attr :key}]
+    {attr :key}                      :edn-query-language.ast/node
+    :as                              env}]
   (let [env (assoc env pc-attr attr)]
-    (if (contains? available-data attr)
+    (cond
+      (or (contains? available-data attr)
+          (contains? unreachable-attrs attr))
       out
-      (if (contains? index-oir attr)
-        (if (contains? unreachable-attrs attr)
-          out
-          (if (attribute-provided? out attr)
-            (update-in out [::nodes root ::requires] merge-io {attr {}})
-            (let [new-out
-                  (as-> out <>
-                    (dissoc <> ::root)
-                    (reduce-kv
-                      (fn [out inputs resolvers]
-                        (resolver-input-paths out env inputs resolvers))
-                      <>
-                      (get index-oir attr)))]
-              (if (::root new-out)
-                (compute-root-and new-out env {::node-id root})
-                (assoc new-out ::root root)))))
-        ; attr unreachable
-        (add-unreachable-attr out attr)))))
+
+      (contains? index-oir attr)
+      (compute-attribute-graph-item out env)
+
+      :else
+      (add-unreachable-attr out attr))))

 (defn compute-run-graph
   ([out
     env]
    (reduce
-     (fn [out ast] (compute-attribute-graph out env ast))
+     (fn [out ast] (compute-attribute-graph out
+                     (assoc env :edn-query-language.ast/node ast)))
      out
      (remove (comp eql/ident? :key) (:children (ast-node env)))))


Check for mhash existence before encoding.

--- src/multihash/core.clj
+++ src/multihash/core.clj
@@ -172,13 +172,15 @@
 (defn hex
   "Encodes a multihash into a hexadecimal string."
   [mhash]
-  (hex/encode (encode mhash)))
+  (when mhash
+    (hex/encode (encode mhash))))

 (defn base58
   "Encodes a multihash into a Base-58 string."
   [mhash]
-  (b58/encode (encode mhash)))
+  (when mhash
+    (b58/encode (encode mhash))))

 (defn decode-array


Fix errors in store cache. Add debug logging.

--- src/org/spootnik/cyanite/store_cache.clj
+++ src/org/spootnik/cyanite/store_cache.clj
@@ -1,7 +1,7 @@
 (ns org.spootnik.cyanite.store_cache
   "Caching facility for Cyanite"
   (:require [clojure.string :as str]
-            [clojure.core.async :as async :refer [>!]]
+            [clojure.core.async :as async :refer [>!!]]
             [clojure.tools.logging :refer [error info debug]]
             [org.spootnik.cyanite.store :as store]))

@@ -40,12 +40,15 @@
 (defn create-flusher
   [mkeys mkey pkeys tenant period rollup time ttl fn-get fn-agg fn-store fn-key]
   (fn []
-    (doseq [path @pkeys]
-      (fn-store tenant period rollup time path
-                (fn-agg (fn-get
-                         (fn-key tenant period rollup time path)
-                         @pkeys)) ttl))
-    (swap! mkeys #(dissoc % mkey))))
+    (try
+      (doseq [path @pkeys]
+        (fn-store tenant period rollup time path
+                  (fn-agg (fn-get
+                           (fn-key tenant period rollup time path)
+                           @pkeys)) ttl))
+      (swap! mkeys #(dissoc % mkey))
+      (catch Exception e
+        (info e "Cache flushing exception")))))

 (defn run-delayer!
   [rollup fn-flusher]
@@ -98,13 +101,13 @@

 (defn store-chan
   [tenant period rollup time path data ttl chan]
-  (>! chan {:tenant tenant
-            :period period
-            :rollup rollup
-            :time   time
-            :path   path
-            :metric data
-            :ttl    ttl}))
+  (>!! chan {:tenant tenant
+             :period period
+             :rollup rollup
+             :time   time
+             :path   path
+             :metric data
+             :ttl    ttl}))

 (defn simple-cache
   [{:keys [store fn-agg] :or {fn-agg agg-avg}}]
@@ -114,7 +117,11 @@
         cache-get (fn [key pkeys] (get @(get-data pkeys) key))
         cache-key (fn [tenant period rollup time path] (hash path))
         schan (store/channel-for store)
-        fn-store (partial store-chan schan)]
+        ;;fn-store (partial store-chan schan)
+        fn-store (fn [tenant period rollup time path data ttl]
+                   (store-chan tenant period rollup time path data ttl schan))
+        ]
+
     (reify
       StoreCache
       (put! [this tenant period rollup time path data ttl]
@@ -122,14 +129,18 @@
               pkeys (set-keys! mkeys tenant period rollup time path ttl
                                cache-get fn-agg fn-store cache-key)
               adata (get-data @pkeys)]
-          (swap! adata #(assoc % ckey (conj (get % ckey) data)))))
+          (swap! adata #(assoc % ckey (conj (get % ckey) data)))
+          ;;(-show-keys this)
+          ;;(-show-cache this)
+          ;;(-show-meta this)
+          ))
       (flush! [this]
         (run-flusher! mkeys))
-      (-show-keys [this] (println "MKeys:" mkeys))
+      (-show-keys [this] (debug "MKeys:" mkeys))
       (-show-cache [this]
-        (println "Cache:")
+        (debug "Cache:")
         (doseq [[mkey pkeys] @mkeys]
-          (println (get-data @pkeys))))
+          (debug (get-data @pkeys))))
       (-show-meta [this]
         (doseq [[mkey pkeys] @mkeys]
-          (println "Meta:" mkey (meta @pkeys)))))))
+          (debug "Meta:" mkey (meta @pkeys)))))))


general endpoint for binary uploads

general endpoint for binary uploads

--- iwaswhere-web/src/clj/iwaswhere_web/upload.clj
+++ iwaswhere-web/src/clj/iwaswhere_web/upload.clj
@@ -19,13 +19,13 @@
                       "visits.json" (i/import-visits-fn rdr put-fn {} filename)
                       (prn req))
                     "OK"))
-        audio-post-fn (fn [filename req put-fn]
-                        (let [filename (str f/data-path "/audio/" filename)]
-                          (prn req)
-                          (io/copy (:body req) (java.io.File. filename)))
-                        "OK")
+        binary-post-fn (fn [dir filename req]
+                         (let [filename (str f/data-path "/" dir "/" filename)]
+                           (prn req)
+                           (io/copy (:body req) (java.io.File. filename)))
+                         "OK")
         app (routes
-              (PUT "/upload/audio/:filename" [filename :as r] (audio-post-fn filename r put-fn))
+              (PUT "/upload/:dir/:file" [dir file :as r] (binary-post-fn dir file r))
               (POST "/upload/:filename" [filename :as r] (post-fn filename r put-fn)))]
     (future
       (j/run-jetty app {:port 3001 :join? false})))


add test host

add test host

--- src/clj/lesezeichen/db.clj
+++ src/clj/lesezeichen/db.clj
@@ -16,6 +16,7 @@

 (defn send-registry [email auth-code]
   (postal/send-message
+   {:host "192.168.1.165"}
    {:from "authentication@topiq.es"
     :to [email]
     :subject "Registry token"


improved error message when proto files are missing

--- src/clj/protobuf/tasks.clj
+++ src/clj/protobuf/tasks.clj
@@ -39,14 +39,14 @@
     (second (re-matches #".*\"(.*)\".*" line))))

 (defn extract-resource [name dest-dir]
-  (let [loader (.getClassLoader clojure.lang.RT)
-        url    (.findResource loader name)
-        conn   (.openConnection url)]
-    (if (instance? JarURLConnection conn)
-      (let [jar  (cast JarURLConnection conn)
-            dest (File. dest-dir (.. jar getJarEntry getName))]
-        (copy (.getInputStream jar) dest))
-      (copy (File. (.getFile url)) (File. dest-dir name)))))
+  (if-let [url (.findResource (.getClassLoader clojure.lang.RT) name)]
+    (let [conn (.openConnection url)]
+      (if (instance? JarURLConnection conn)
+        (let [jar  (cast JarURLConnection conn)
+              dest (File. dest-dir (.. jar getJarEntry getName))]
+          (copy (.getInputStream jar) dest))
+        (copy (File. (.getFile url)) (File. dest-dir name))))
+    (throw (Exception. (format "unable to find %s on classpath" name)))))

 (defn extract-dependencies
   "extract all files proto is dependent on"


better wording

better wording

--- src/clj/runbld/process.clj
+++ src/clj/runbld/process.clj
@@ -239,7 +239,7 @@
         listeners [file-ch es-ch stdout-ch stderr-ch]
         result (exec program args scriptfile cwd
                      env listeners log-extra timeout)
-        ;; The process has exited, flush the channels
+        ;; The process has exited, wait for these channels to close
         _ (doall (map <!!
                       [file-process es-process]))
         ;; stdout and stderr channels might hang on bad input.


Change 'Show History' to a link

Change 'Show History' to a link

--- src/cljs/pushpop/core.cljs
+++ src/cljs/pushpop/core.cljs
@@ -120,8 +120,10 @@
          :on-sort-end (on-sort-end :sort-stack-end)
          :should-cancel-start #(not (str/blank? filter-text))}]]
       [:h4
-       {:on-click (on-click :toggle-history)}
-       (if showing-history? "Hide History" "Show History")]
+       [:a
+        {:href "#"
+         :on-click (on-click :toggle-history)}
+        (if showing-history? "Hide History" "Show History")]]
       [:div
        (when showing-history?
         (into [:ol.history]
@@ -135,7 +137,7 @@
    [:h1 "Push pop"]
    [:div
     (if (empty? stack)
-     [:h2 "And you're done."]
+     [:h2 "Looks like you're done."]
      [:div.current-item
       [:h2 "Up Next: " (first stack)]
       [:button.pop-button


update form on change manifest

update form on change manifest

--- src/cljs/re_form/core.cljs
+++ src/cljs/re_form/core.cljs
@@ -67,7 +67,7 @@
                (fn [idx e] [:span.error {:key idx} e])
                (or @errors [])))])))

-(defn init [{:keys [name validate-fn] :as form}]
+(defn init [{:keys [name validate-fn value] :as form}]
   (rf/dispatch [:re-form/init (dissoc form :validate-fn)])

   (when validate-fn
@@ -82,11 +82,14 @@
   (reagent/create-class
    {:component-will-mount
     (fn [] (init props))
+    :component-will-receive-props
+    (fn [this props]
+      (init (nth props 1)))
     :component-will-unmount
     (fn [] (deinit props))
     :display-name (str (:name props))
     :reagent-render
-    (fn [{:keys [name] :as props} & body]
+    (fn [{:keys [name value] :as props} & body]
       [ctx/set-context {:form-name name :base-path []}
        (into [:div.re-form] body)] )}))


[model] fix the incorrect usage of '<!'

[model] fix the incorrect usage of '<!'

--- src/cljs_douban/model.cljs
+++ src/cljs_douban/model.cljs
@@ -9,17 +9,17 @@

 (defn next-song []
   "get the next song information"
+  (when @song-list
+    (swap! song-list pop))
   (go (let [left (count @song-list)]
         (cond
           ;; fetch new playlist
           (<= left 1) (reset! song-list
-                              ((<! (rpc/song-op "n" :channel @current-channel-id))
-                               "song"))
+                              ((<! (rpc/song-op "n" :channel @current-channel-id)) "song"))
           ;; fetch new playlist while playing
-          (<= left 2) (swap! song-list
-                             #(into % ((<! (rpc/song-op "p" :channel @current-channel-id))
-                                       "song")))
-
+          (<= left 2) (reset! song-list
+                              (into @song-list
+                                    ((<! (rpc/song-op "p" :channel @current-channel-id)) "song")))
           :else (swap! song-list pop)))
       (peek @song-list)))


Shorten class created by schema/representation-seq (#147)

This is causing issues on ecryptfs, this change brings file path length
of AOT'd class from 176 to 77

See: https://github.com/juxt/edge/issues/22

--- src/yada/schema.clj
+++ src/yada/schema.clj
@@ -68,20 +68,38 @@
     (s/optional-key :encoding) #{String}}
    not-empty))

+;; representation-seq & merge-representation are written due to short file
+;; length limits on ecryptfs. Using a pulled out function & nested maps results
+;; in a smaller .class
+;; see: https://github.com/juxt/edge/issues/22
+(defn- merge-representation
+  [media-type charset language encoding]
+  (merge
+   (when media-type {:media-type media-type})
+   (when charset {:charset charset})
+   (when language {:language language})
+   (when encoding {:encoding encoding})))
+
 (defn representation-seq
   "Return a sequence of all possible individual representations from the
   result of coerce-representations."
   [reps]
-  (for [rep reps
-        media-type (or (:media-type rep) [nil])
-        charset (or (:charset rep) [nil])
-        language (or (:language rep) [nil])
-        encoding (or (:encoding rep) [nil])]
-    (merge
-     (when media-type {:media-type media-type})
-     (when charset {:charset charset})
-     (when language {:language language})
-     (when encoding {:encoding encoding}))))
+  (mapcat
+    (fn [rep]
+      (mapcat
+        (fn [media-type]
+          (mapcat
+            (fn [charset]
+              (mapcat
+                (fn [language]
+                  (map
+                    (fn [encoding]
+                      (merge-representation media-type charset language encoding))
+                    (or (:encoding rep) [nil])))
+                (or (:language rep) [nil])))
+            (or (:charset rep) [nil])))
+        (or (:media-type rep) [nil])))
+    reps))

 (defprotocol MediaTypeCoercion
   (as-media-type [_] ""))


use :ignore-warnings config for REPL as well

--- src/main/shadow/cljs/devtools/client/shared.cljs
+++ src/main/shadow/cljs/devtools/client/shared.cljs
@@ -187,8 +187,7 @@
           (assoc :time-finish (js/Date.now))
           (callback)))

-    ;; FIXME: let client input decide if eval should happen regardless of warnings
-    (seq warnings)
+    (and (seq warnings) (false? env/ignore-warnings))
     (let [{:keys [callback]} state]
       (-> state
           (dissoc :runtime :callback :queue)


Fix class cast exception caused by `^BufferedReader` type hint

--- src/onyx/tasks/seq.clj
+++ src/onyx/tasks/seq.clj
@@ -36,7 +36,7 @@
                    (line-seq (BufferedReader. rdr)))}))

 (defn close-reader [event lifecycle]
-  (.close ^BufferedReader (:seq/rdr event)))
+  (.close ^FileReader (:seq/rdr event)))

 (def in-file-calls
   {:lifecycle/before-task-start inject-in-reader


react-infinite fix

react-infinite fix

--- src/name_bazaar/ui/components/infinite_list.cljs
+++ src/name_bazaar/ui/components/infinite_list.cljs
@@ -1,6 +1,6 @@
 (ns name-bazaar.ui.components.infinite-list
   (:require
-    [cljsjs.react-infinite]
+    [react-infinite]
     [medley.core :as medley]
     [re-frame.core :refer [subscribe dispatch]]
     [district0x.ui.components.misc :as d0x-misc :refer [row row-with-cols col]]


indentation fix

indentation fix

--- src/cellf/core.cljs
+++ src/cellf/core.cljs
@@ -193,32 +193,31 @@
           (recur 0)
           (recur (inc tick)))))))

-(defn on-js-reload [])

 (defonce gum (take! (media/get-media) (fn [{:keys [status data]}]
-    (if (= status :success)
-      (let [video  (.createElement js/document "video")
-            canvas (.createElement js/document "canvas")]
-        (aset canvas "width" capture-size)
-        (aset canvas "height" capture-size)
-        (aset video "autoplay" "autoplay")
-        (aset video "onplaying" (fn []
-          (let [vw (.-videoWidth video)
-                vh (.-videoHeight video)]
-            (js-delete video "onplaying")
-            (swap! app-state merge {
-              :stream      data
-              :grid-px     (get-max-grid-px)
-              :vid-node    video
-              :vid-w       vw
-              :vid-h       vh
-              :vid-ratio   (/ vw vh)
-              :vid-offset  (* 100 (/ (max 1 (.abs js/Math (- vw vh))) (max 1 (* vw 2))))
-              :canvas-node canvas
-              :ctx         (.getContext canvas "2d")})
-            (js/setTimeout start! 500))))
-        (aset video "src" data))
-      (swap! app-state assoc :media-error? true)))))
+  (if (= status :success)
+    (let [video  (.createElement js/document "video")
+          canvas (.createElement js/document "canvas")]
+      (aset canvas "width" capture-size)
+      (aset canvas "height" capture-size)
+      (aset video "autoplay" "autoplay")
+      (aset video "onplaying" (fn []
+        (let [vw (.-videoWidth video)
+              vh (.-videoHeight video)]
+          (js-delete video "onplaying")
+          (swap! app-state merge {
+            :stream      data
+            :grid-px     (get-max-grid-px)
+            :vid-node    video
+            :vid-w       vw
+            :vid-h       vh
+            :vid-ratio   (/ vw vh)
+            :vid-offset  (* 100 (/ (max 1 (.abs js/Math (- vw vh))) (max 1 (* vw 2))))
+            :canvas-node canvas
+            :ctx         (.getContext canvas "2d")})
+          (js/setTimeout start! 500))))
+      (aset video "src" data))
+    (swap! app-state assoc :media-error? true)))))

 (om/root


CMR-1354: Adding a commen to clarify sorting behavior.

--- search-app/src/cmr/search/data/query_to_elastic.clj
+++ search-app/src/cmr/search/data/query_to_elastic.clj
@@ -315,6 +315,8 @@
         sub-sort-fields (if (:all-revisions? query)
                           collection-all-revision-sub-sort-fields
                           collection-latest-sub-sort-fields)
+        ;; We want the specified sort then to sub-sort by the score.
+        ;; Only if neither is present should it then go to the default sort.
         specified-score-combined (seq (concat specified-sort score-sort-order))]
     (concat (or specified-score-combined default-sort) sub-sort-fields)))


beef up on-event docstring

beef up on-event docstring

--- src/overtone/event.clj
+++ src/overtone/event.clj
@@ -26,12 +26,13 @@
       true)))

 (defn on-event
-  "Runs handler whenever events of type event-type are fired.  The handler can
+  "Takes an event-type (name of the event) a key (to refer back to this handler in the future) and a handler fn.
+  Runs handler whenever events of type event-type are fired.  The handler can
   optionally except a single event argument, which is a map containing the
   :event-type property and any other properties specified when it was fired.

-  (on-event ::booted #(do-stuff))
-  (on-event ::midi-note-down (fn [event] (funky-bass (:note event))))
+  (on-event \"/tr\" ::status-check handler)
+  (on-event :midi-note-down ::midi-note-down-handler (fn [event] (funky-bass (:note event))))

   Handlers can return :done to be removed from the handler list after execution."
   [event-type key handler]


slackで返信にユーザー名が重複してしまったのを修正

slackで返信にユーザー名が重複してしまったのを修正

--- src/panpan/persona.clj
+++ src/panpan/persona.clj
@@ -10,13 +10,12 @@
   (handler/regexp
     arg
     #"ぬるぽ"
-    (fn [_] (str "@" user " ガッ"))
+    (fn [_] "ガッ")

     #"(パンダ|ぱんだ)"
     (fn [_]
-      (str "@" user " "
-           (rand-nth ["呼んだ？" "なぁに？" "ん？" "はーい、え？違う？"
-                      "こっち見んな" "？" "僕のこと？" "うるさいぞ"])))
+      (rand-nth ["呼んだ？" "なぁに？" "ん？" "はーい、え？違う？"
+                 "こっち見んな" "？" "僕のこと？" "うるさいぞ"]))

     #"(なに|何)(たべ|食べ)(よう|ようかな|る?|る？|たい?|たい？)"
     (fn [_]


cleanup export modules

cleanup export modules

--- src/replikativ/js.cljs
+++ src/replikativ/js.cljs
@@ -6,6 +6,7 @@
             [replikativ.crdt.ormap.stage :as ormap-stage]
             [goog.net.WebSocket]
             [goog.Uri]
+            [cljs.nodejs :as nodejs]
             [goog.events]
             [replikativ.crdt.ormap.realize :as ormap-realize]
             [replikativ.crdt.lwwr.realize :as lwwr-realize]
@@ -56,7 +57,6 @@
   (let [opts (js->clj opts)]
     (promise (ormap-stage/create-ormap! stage :id (get opts "id") :description (get opts "description")))))

-
 (defn ^:export createLWWR [stage opts]
   (let [opts (js->clj opts)]
     (promise (lwwr-stage/create-lwwr! stage :id (get opts "id") :description (get opts "description")))))
@@ -101,31 +101,22 @@
 (when ^boolean js/COMPILED
   (set! js/goog.global js/global))

-(set! (.-exports js/module) #js {:clientPeer    clientPeer
-                                 :connect       connect
-                                 :onNode        on-node?
-                                 :createStage   createStage
-                                 :newMemStore   newMemStore
-                                 :LWWR          #js {:create createLWWR
-                                                     :stream streamLWWR
-                                                     :set    setRegister}
-                                 :ORMap         #js {:create    createORMap
-                                                     :stream    streamORMap
-                                                     :associate associate}
-                                 :createUUID    cljs.core/uuid
-                                 :toEdn         cljs.core/js->clj
-                                 :hashIt        hasch.core/uuid})
+(set! (.-exports js/module) #js {:newMemStore newMemStore
+                                 :clientPeer  clientPeer
+                                 :createStage createStage
+                                 :connect     connect
+                                 :LWWR        #js {:create createLWWR
+                                                   :stream streamLWWR
+                                                   :set    setRegister}
+                                 :ORMap       #js {:create    createORMap
+                                                   :stream    streamORMap
+                                                   :associate associate}
+                                 :createUUID  cljs.core/uuid
+                                 :toEdn       cljs.core/js->clj
+                                 :hashIt      hasch.core/uuid})

-(comment
-  (defn on-node? []
-    (and (exists? js/process)
-         (exists? js/process.versions)
-         (exists? js/process.versions.node)
-         true))
+(when on-node?
+  (nodejs/enable-util-print!)
   (defn ^:export -main [& args]
     (.log js/console "Loading replikativ js code."))
-  (when ^boolean js/COMPILED
-    (set! js/goog.global js/global))
-  (nodejs/enable-util-print!)
-  (set! cljs.core/*main-cli-fn* -main)
-  )
+  (set! cljs.core/*main-cli-fn* -main))


Add core.async dep for kehaar 1.0.0 compatibility

--- resources/leiningen/new/kraken_works/project.clj
+++ resources/leiningen/new/kraken_works/project.clj
@@ -5,6 +5,7 @@
             :url "http://www.eclipse.org/legal/epl-v10.html"}
   :dependencies [[org.clojure/clojure "1.9.0"]
                  [org.clojure/tools.logging "0.4.1"]
+                 [org.clojure/core.async "0.4.474"]
                  [democracyworks/resource-config "1.0.0"]
 {{#datomic?}}
                  [democracyworks/datomic-toolbox "2.0.5"


[fix 7652] fetching indicator on Home tab

Signed-off-by: Jakub Sokołowski <1d3764b91b902f6b45836e2498da81fe35caf6d6@status.im>

--- src/status_im/ui/screens/home/views.cljs
+++ src/status_im/ui/screens/home/views.cljs
@@ -294,8 +294,7 @@
                                         :animating true}]]

             :else
-            [react/view {:style {:flex 1
-                                 :z-index -1}}
+            [react/view {:style {:flex 1}}
              [connectivity/connectivity-view]
              [animated-search-input search-filter]
              (if (and (not search-filter)


Home show search when input is focused or has content

Fixes #11017

Signed-off-by: Gheorghe Pinzaru <742a0a3885ab52ea1795e48e261ec4223e194612@gmail.com>

--- src/status_im/ui/screens/home/views.cljs
+++ src/status_im/ui/screens/home/views.cljs
@@ -146,9 +146,9 @@
           :keyboard-should-persist-taps :always
           :data                         chats
           :render-fn                    (fn [home-item] [inner-item/home-list-item home-item])
-          :header                       (when (or (seq chats) @search-active?)
+          :header                       (when (or (seq chats) @search-active? (seq search-filter))
                                           [search-input-wrapper search-filter chats])
-          :empty-component              (when @search-active?
+          :empty-component              (when (or @search-active? (seq search-filter))
                                           [start-suggestion search-filter])
           :footer                       (if (and (not hide-home-tooltip?) (not @search-active?))
                                           [home-tooltip-view]


cleaning core

cleaning core

--- clojure/src/dnd/core.cljs
+++ clojure/src/dnd/core.cljs
@@ -16,17 +16,6 @@
 (defonce net (nodejs/require "net"))

 (declare term)
-
-(defn setup [term]
-  (do
-    (.applicationKeypad term)
-    (.hideCursor term)
-    (.grabInput term #js { :mouse "button" :focus true })
-    ))
-
-(defn teardown [term]
-  (.removeAllListeners term "key")
-  (.removeAllListeners keyboard/emitter))

 (defonce character (atom
                      (assoc character/base-character
@@ -62,9 +51,30 @@
       (character/drop-item! level character lastItem)
       (show-screen))))

+(def queue (atom #queue []))
+
+(defn pusher! [& arguments] (swap! queue conj arguments))
+
+(defn setup [term]
+  (doto term
+    (.clear)
+    (.applicationKeypad)
+    (.hideCursor )
+    (.grabInput #js { :mouse "button" :focus true }))
+
+  (keyboard/HandleCharacterKeys term level character)
+  (.on keyboard/emitter "move" (partial pusher! "move"))
+  (.on keyboard/emitter "get"  (partial pusher! "get"))
+  (.on keyboard/emitter "drop" (partial pusher! "drop"))
+  (.on keyboard/emitter "inventory" (partial pusher! "inventory")))
+
+(defn teardown [term]
+  (.removeAllListeners term "key")
+  (.removeAllListeners keyboard/emitter))
+
 (defn popper! [queue]
   (go-loop [q queue]
-    (if (not (empty? @queue))
+    (when-not (empty? @queue)
       (let [next-action (peek @queue)
             action-name (first next-action)
             args        (rest next-action)
@@ -76,8 +86,7 @@
                           )]

         (apply function args)
-        (swap! queue pop))
-      nil)
+        (swap! queue pop)))

     (<! (timeout 100))
     (recur queue))
@@ -85,55 +94,28 @@

 (defn herp [term]
-  (.clear term)
-  (.grabInput term true)
-  (.red term "YEAH")
-  ;; (.on term "key"  #((let [string (str "key was " %)]
-  ;;                    (println string)
-  ;;                    (.send client string)
-  ;;                    )))
-  ;; (.on term "data" #((let [string (str "data was " %)]
-  ;;                    (println string)
-  ;;                    (.send client string)
-  ;;                    )))
-  (teardown term)
-  (setup term)
+  (.on term "key"  #((let [string (str "key was " %)]
+                     (println string)
+                     (.send client string)
+                     )))
+  (.on term "data" #((let [string (str "data was " %)]
+                     (println string)
+                     (.send client string)
+                     ))))

-  (def queue (atom #queue []))
-  (defn pusher! [& arguments] (swap! queue conj arguments))
-
-  (keyboard/HandleCharacterKeys term level character)
-  (.on keyboard/emitter "move" (partial pusher! "move"))
-  (.on keyboard/emitter "get"  (partial pusher! "get"))
-  (.on keyboard/emitter "drop" (partial pusher! "drop"))
-  (.on keyboard/emitter "inventory" (partial pusher! "inventory"))
-
-  (prn "first show screen")
-  (show-screen)
-  (popper! queue))
-
-(defn telnet-server [client]
-  (prn "telnet-server")
-
-  (def term
-    (.createTerminal tkit #js {:stdin client :stdout client}))
-
-  (herp term))

 (defn -main []
   (prn "main")
   (if (-> (last process.argv)
           (= "server"))
-    (doto (.createServer net telnet-server)
+    (doto (.createServer net #(def term (.createTerminal tkit #js {:stdin % :stdout %})))
       (.listen 23))
-    (doto (def term (.-terminal tkit))
-      (herp)
-      ))
-  )
+    (def term (.-terminal tkit)))
+
+  (teardown term)
+  (setup term)
+  (show-screen)
+  (popper! queue))

 (set! *main-cli-fn* -main)

-;; (-main)
-
-
-(show-screen)


* script/test: add transient vector benchmark

--- benchmark/cljs/benchmark_runner.cljs
+++ benchmark/cljs/benchmark_runner.cljs
@@ -29,6 +29,16 @@
 (simple-benchmark [coll [1 2 3]] (next coll) 1000000)
 (println)

+(println ";;; transients")
+(print "transient vector, conj! 1000000 items")
+(time
+ (let [v (transient [])]
+   (loop [i 0 v v]
+     (if (> i 1000000)
+       (persistent! v)
+       (recur (inc i) (conj! v i))))))
+(println)
+
 (println ";;; map / record ops")
 (simple-benchmark [coll {:foo 1 :bar 2}] (get coll :foo) 1000000)
 (simple-benchmark [coll {:foo 1 :bar 2}] (-lookup coll :foo nil) 1000000)


CMR-2631: Fixed reindex of tag tombstone.

--- indexer-app/src/cmr/indexer/data/concepts/tag.clj
+++ indexer-app/src/cmr/indexer/data/concepts/tag.clj
@@ -6,13 +6,18 @@

 (defmethod es/parsed-concept->elastic-doc :tag
   [context concept parsed-concept]
-  (let [{:keys [concept-id]} concept
+  (let [{:keys [concept-id deleted]} concept
         {:keys [tag-key description originator-id]}
         parsed-concept]
-    {:concept-id concept-id
-     :tag-key.lowercase (str/lower-case tag-key)
-     :description description
-     :originator-id.lowercase  (str/lower-case originator-id)}))
+    (if deleted
+      ;; This is only called by re-indexing (bulk indexing)
+      ;; Regular deleted tags would have gone through the index-service/delete-concept path.
+      {:concept-id concept-id
+       :deleted deleted}
+      {:concept-id concept-id
+       :tag-key.lowercase (str/lower-case tag-key)
+       :description description
+       :originator-id.lowercase  (str/lower-case originator-id)})))

 (defn tag-association->elastic-doc
   "Converts the tag association into the portion going in the collection elastic document."


Back to nul keys for now

Back to nul keys for now

--- src/icecap/core.clj
+++ src/icecap/core.clj
@@ -1,5 +1,6 @@
 (ns icecap.core
   (:require [caesium.core :refer [sodium-init]]
+            [icecap.codec :refer [safebase64-decode]]
             [icecap.crypto :as crypto]
             [icecap.rest :as rest]
             [icecap.store.mem :refer [mem-store]]
@@ -10,7 +11,10 @@

 (defn run
   []
-  (let [[seed-key salt] (map safebase64-decode [(env :seed-key) (env :salt)])
+  (let [[seed-key salt] (map (comp safebase64-decode
+                                   crypto/nul-byte-array)
+                             [crypto/seed-key-bytes
+                              crypto/salt-bytes])
         components {:store (mem-store)
                     :kdf (crypto/blake2b-kdf seed-key salt)
                     :scheme (crypto/secretbox-scheme)}


build,boot: support (copy_rule now creates destinations directories if neccessary).

git-svn-id: e7e61699ce1738538ffebb75374fbea0924bc775@8695 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02


div rearrangment

div rearrangment

--- src/cljs/org/broadinstitute/firecloud_ui/page/workspace/method_config_importer.cljs
+++ src/cljs/org/broadinstitute/firecloud_ui/page/workspace/method_config_importer.cljs
@@ -98,12 +98,12 @@
                  [:hr]
                  (get-in @state [:selected-conf "name"])[:br]
                  (get-in @state [:selected-conf "namespace"]) [:br]
-                 (get-in @state [:selected-conf "snapshotId"])
+                 (get-in @state [:selected-conf "snapshotId"])]
                  [:div {:style {:position "absolute" :right 2 :top 2}}
                   [:div {:style {:backgroundColor (:button-blue style/colors) :color "#fff"
                                  :padding "0.5em" :cursor "pointer"}
                          :onClick (fn [] (swap! state assoc :show-import-mc-modal? false))}
-                   (icons/font-icon {:style {:fontSize "60%"}} :x)]]]
+                   (icons/font-icon {:style {:fontSize "60%"}} :x)]]
                 [:div {:style {:padding "22px 48px 40px"
                                :backgroundColor (:background-gray style/colors)}}
                  [ModalImportOptionsAndButton {:init-Name (get-in @state [:selected-conf "name"])


add parent selector

add parent selector

--- sass-dsl/src/sass_dsl/transform.clj
+++ sass-dsl/src/sass_dsl/transform.clj
@@ -48,3 +48,12 @@
               (ins-replacement c-s-replacements)
               zip/remove)
           loc))))))
+
+(defn is-parent-selector
+  "Is the parent at the zipper location a selector?"
+  [loc]
+  {:pre [(not (nil? loc))]}
+  (if (and
+       (common/is-element loc)
+       (common/get-parent loc))
+    (common/is-selector (common/get-parrent loc))))


Add :kind to schema definitions for execution

--- src/graphql_clj/parser.clj
+++ src/graphql_clj/parser.clj
@@ -58,7 +58,7 @@
                                identity]

    :type-definition           ["<'type'> <ignored> ident ( <ignored> implements )? <ignored>? type-fields"
-                               (fn [ident & decls] (apply merge {:tag :type-definition :name ident} decls))]
+                               (fn [ident & decls] (apply merge {:tag :type-definition :name ident :kind :OBJECT} decls))]

    :implements                ["<'implements'> ( <ignored> basic-type-no-req )+" (fn [ & types ] {:implements types})]

@@ -68,22 +68,22 @@
                                #(with-meta (assoc % :tag :extend-type-definition) nil)]

    :interface-definition      ["<'interface'> <ignored> ident <ignored>? type-fields"
-                               #(merge {:tag :interface-definition :name %1} %2)]
+                               #(merge {:tag :interface-definition :name %1 :kind :INTERFACE} %2)]

    :input-definition          ["<'input'> <ignored> ident <ignored>? type-fields"
-                               #(mmerg {:tag :input-definition :name %1} %2)]
+                               #(mmerg {:tag :input-definition :name %1 :kind :INPUT_OBJECT} %2)]

    ;; members are coearsed to match the result of basic-type but
    ;; without the required.
    :union-definition          ["<'union'> <ignored> ident <ignored>? <'='> <ignored>? basic-type-no-req ( <ignored>? <'|'> <ignored>? basic-type-no-req )*"
                                (fn [ident & members]
-                                 {:tag :union-definition :name ident :members (vec members)})]
+                                 {:tag :union-definition :name ident :kind :UNION :members (vec members)})]

    :schema-definition         ["<'schema'> <ignored>? <'{'> <ignored>? ( schema-type <ignored>? )* <'}'>"
                                (fn [ & members ] {:tag :schema-definition :members (vec members)})]

    :enum-definition           ["<'enum'> <ignored> ident <ignored>? <'{'> <ignored>? ( enum-constant <ignored>? )* <'}'>"
-                               (fn [ ident & constants ] {:tag :enum-definition :name ident :constants (vec constants) })]
+                               (fn [ ident & constants ] {:tag :enum-definition :name ident :kind :ENUM :constants (vec constants) })]

    :enum-constant             ["ident ( <ignored>? directives )?"
                                (fn enum-constant
@@ -99,13 +99,14 @@
                                  ([ident arguments] (mmerg (directive ident) arguments)))]

    :directive-definition      ["<'directive'> <ignored> <'@'> <ignored>? ident ( <ignored> type-condition )?"
-                               (fn ([ident] {:tag :directive-definition :name ident})
-                                  ([ident type-condition] {:tag :directive-definition :name ident :on (:on type-condition)}))]
+                               (fn
+                                 ([ident] {:tag :directive-definition :name ident :kind :DIRECTIVE})
+                                 ([ident type-condition] {:tag :directive-definition :name ident :kind :DIRECTIVE :on (:on type-condition)}))]

    :type-condition            ["<'on'> <ignored> basic-type-no-req" (fn [on] {:on on})]

    :scalar-definition         ["<'scalar'> <ignored> ident"
-                               (fn[n] {:tag :scalar-definition :name n})]
+                               (fn[n] {:tag :scalar-definition :name n :kind :SCALAR})]

    :type-fields               ["<'{'> <ignored>? ( type-field <ignored>? )* <'}'>" (fn [ & fields ] {:fields (vec fields)})]


update type

update type

--- src/graphql_clj/parser.clj
+++ src/graphql_clj/parser.clj
@@ -189,7 +189,7 @@
     (log/debug "type: " type)
     (if (map? type)
       type
-      (get type-map type))))
+      (get-type-meta type))))

 (defn get-field-type-from-object-type
   "FIXME"
@@ -310,7 +310,7 @@
   (log/debug "execute-fields: fields: " fields)
   (into {} (map (fn [field]
                   (let [response-key (get-selection-name field)
-                        field-type (get-field-type-from-object-type parent-type field)
+                        ;; field-type (get-field-type-from-object-type parent-type field)
                         ;; resolved-object (resolve-field-on-object field-type root-value field)
                         field-entry (get-field-entry parent-type root-value field)]
                     (log/spy field-entry)))


Fix bad navigation call

Fix bad navigation call

Signed-off-by: Andrey Shovkoplyas <b713972e59b8e606e23253c4a13e948139fea4d1@gmail.com>

--- src/status_im/ui/screens/wallet/request/events.cljs
+++ src/status_im/ui/screens/wallet/request/events.cljs
@@ -14,7 +14,6 @@
    (assert whisper-identity)
    (let [request-command (get-in db [:id->command ["request" #{:personal-chats}]])]
      (handlers-macro/merge-fx cofx
-                              (navigation/navigate-to-clean :home)
                               (chat-model/start-chat whisper-identity nil)
                               (commands-sending/send whisper-identity
                                                      request-command


Admin can now set player's sg ownership

Admin can now set player's sg ownership

--- src/hphelper/live/view.clj
+++ src/hphelper/live/view.clj
@@ -200,13 +200,43 @@
    [:td (-> pMap :mutation :description)]
    ])

-
 (defn- print-player-stats-table
   "Creates a table of player stats for the GM's pleasure"
   [^String uid]
   [:table {:border 1} [:tr [:td] [:td "M"] [:td "V"] [:td "Su"] [:td "H"] [:td "So"] [:td "W"] [:td "Mutation"]]
    (map single-player-stats (-> (lcon/get-game uid) :hps vals))
    ]
+  )
+
+(defn- print-sg-set-table
+  "Creates a table of links to set service group ownership"
+  [baseURL guid]
+  (log/trace "print-sg-set-table." baseURL guid)
+  (let [g (lcon/get-game guid)
+        aPass (:adminPass g)
+        serviceGroups (->> g :serviceGroups (map :sg_abbr))
+        hpNames (->> g :hps vals (map :name))]
+    (log/trace "aPass:" aPass "serviceGroups:" serviceGroups "hpNames:" (pr-str hpNames))
+    [:table
+     (for [sg serviceGroups]
+       [:tr
+        [:td sg]
+        (for [hpName hpNames]
+          [:td
+           [:a {:href (str baseURL "/api/admin/"
+                           guid "/"
+                           aPass "/set-sg-owner/"
+                           sg "/"
+                           hpName "/")
+                }
+            hpName
+            ]
+           ]
+          )
+        ]
+       )
+     ]
+    )
   )

 (defn edit-game
@@ -223,7 +253,8 @@
                  confirm "/")
             (first (:indicies (lcon/get-game uid))))
           [:div [:a {:href (str baseURL "/api/admin/" uid "/" (:adminPass (lcon/get-game uid)) "/debug/")} "Debug Result"]]
-          [:div (print-player-stats-table uid)]
+          [:div [:h3 "Player Stats"] (print-player-stats-table uid)]
+          [:div [:h3 "Set Player SG"] (print-sg-set-table baseURL uid)]
           ]]])
      "Incorrect confirmation"
      ))


Add extra test for whether message on p3's queues will return nothing

--- test/onyx/messaging/immutable_messenger_test.clj
+++ test/onyx/messaging/immutable_messenger_test.clj
@@ -140,7 +140,9 @@
     (let [mnext (-> m-p3
                     (m/ack-barrier)
                     (m/next-epoch))
-          messages2 (remove nil? (mapcat (fn [_] (m/receive-messages m-p3)) (range 20)))]
+          messages2 (remove nil? (mapcat (fn [_] (m/receive-messages m-p3)) (range 20)))
+
+          ]
       (is (= [:m5 :m6] messages2))
       (is (not (m/all-barriers-seen? mnext)))
       (let [m-p1-acks (m/receive-acks m-p1)
@@ -148,4 +150,13 @@
             m-p2-next-acks (m/receive-acks m-p2)]
         (is (not (empty? m-p1-acks)))
         (is (not (empty? m-p2-acks)))
-        (is (empty? m-p2-next-acks))))))
+        (is (empty? m-p2-next-acks))
+        ;; Late joiner :p4 on same queues at p3 should not obtain any messages
+        (let [m-p4 (component/start (am/atom-messenger pg :p4))
+              m (-> m-p4
+                    (m/set-replica-version 1)
+                    (m/register-subscription t1-queue-p1)
+                    (m/register-subscription t1-queue-p2)
+                    (m/register-publication t2-ack-queue))]
+
+          (is (empty? (remove nil? (mapcat (fn [_] (m/receive-messages m-p4)) (range 20))))))))))