clj-progress 0.2.1

clj-progress 0.2.1

--- project.clj
+++ project.clj
@@ -17,7 +17,7 @@
                  [com.climate/claypoole "0.4.0"]
                  [me.raynes/fs "1.4.6"]
                  [throttler "1.0.0"]
-                 [intervox/clj-progress "0.1.6"]
+                 [intervox/clj-progress "0.2.1"]
                  [clojure-humanize "0.1.0"]]
   :main ^:skip-aot whisper2cyanite.cli
   :target-path "target/%s"


back to snapshot (a little late)

back to snapshot (a little late)

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject datasplash "0.5.3"
+(defproject datasplash "0.5.4-SNAPSHOT"
   :description "Clojure API for a more dynamic Google Cloud Dataflow and (hopefully) Apache BEAM"
   :url "https://github.com/ngrunwald/datasplash"
   :license {:name "Eclipse Public License"


(maint) Bump version to 5.2.8-SNAPSHOT

(maint) Bump version to 5.2.8-SNAPSHOT

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(def pdb-version "5.2.7")
+(def pdb-version "5.2.8-SNAPSHOT")
 (def clj-parent-version "1.4.3")
 (def tk-jetty9-ver "2.3.1")


Version 6.0.3-SNAPSHOT

Version 6.0.3-SNAPSHOT

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(def ps-version "6.0.2")
+(def ps-version "6.0.3-SNAPSHOT")

 (defn deploy-info
   [url]


make test case builder runnable from any directory

--- lib/test/cases/build.clj
+++ lib/test/cases/build.clj
@@ -10,7 +10,13 @@
          '[clojure.data.json :as json]
          '[clojure.string :as string :refer [split-lines]])

-(def cases-path ".")
+;; Get the directory of this file.
+;; source: http://stackoverflow.com/a/3986092/142317
+(defn dirname [path] (.getParent (java.io.File. path)))
+(defn expand-path [path] (.getCanonicalPath (java.io.File. path)))
+(def DIRNAME (expand-path (dirname *file*)))
+
+(def cases-path DIRNAME)

 (defn error
   [file-line-no msg]


Improve docstring

Improve docstring

--- library/src/doo/core.clj
+++ library/src/doo/core.clj
@@ -176,7 +176,21 @@

 (defn run-script
   "Runs the script defined in :output-to of compiler-opts
-   and runs it in the selected js-env."
+   in the selected js-env.
+
+  (run-script js-env compiler-opts)
+  (run-script js-env compiler-opts opts)
+
+where:
+
+  js-env - any of :phantom, :slimer, :node, :rhino, :chrome, :firefox,
+           :ie, :safari, or :opera
+  compiler-opts - the options passed to the ClojureScript when it
+                  compiled the script that doo should run
+  opts - a map that can contain:
+    :paths - a map from runners (keywords) to string commands for bash.
+    :alias - a map from aliases (keywords) to vectors of aliases and
+             runners. See doo.core/resolve-alias"
   ([js-env compiler-opts]
    (run-script js-env compiler-opts {}))
   ([js-env compiler-opts opts]


Remove dependency on c.u.graph for compatible subcontexts

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

--- src/main/clojure/conexp/fca/misc.clj
+++ src/main/clojure/conexp/fca/misc.clj
@@ -12,8 +12,7 @@
             [conexp.fca
              [contexts :refer :all]
              [exploration :refer :all]
-             [implications :refer :all]]
-            [conexp.util.graph :as graph]))
+             [implications :refer :all]]))

 ;;; Compatible Subcontexts

@@ -33,26 +32,17 @@
   [ctx]
   (if (not (context-reduced? ctx))
     (illegal-argument "Context given to compatible-subcontexts has to be reduced."))
-  (let [up-arrows        (up-arrows ctx)
-        down-arrows      (down-arrows ctx)
-        subcontext-graph (graph/transitive-closure
-                          (struct graph/directed-graph
-                                  (disjoint-union (objects ctx) (attributes ctx))
-                                  (fn [[x idx]]
-                                    (condp = idx
-                                      0 (for [[g m] up-arrows
-                                              :when (= g x)]
-                                          [m 1])
-                                      1 (for [[g m] down-arrows
-                                              :when (= m x)]
-                                          [g 0])))))
-        down-down        (set-of [g m] [m (attributes ctx)
-                                        [g idx] (graph/get-neighbors subcontext-graph [m 1])
-                                        :when (= idx 0)])
-        compatible-ctx   (make-context (objects ctx)
-                                       (attributes ctx)
-                                       (fn [g m]
-                                         (not (contains? down-down [g m]))))]
+  (let [up-arrows         (up-arrows ctx)
+        down-arrows       (down-arrows ctx)
+        transitive-arrows (transitive-closure
+                           (union (set-of [[g 0] [m 1]] | [g m] up-arrows)
+                                  (set-of [[m 1] [g 0]] | [g m] down-arrows)))
+        down-down         (set-of [g m] [[[m idx-m] [g idx-g]] transitive-arrows
+                                         :when (and (= 1 idx-m) (= 0 idx-g))])
+        compatible-ctx    (make-context (objects ctx)
+                                        (attributes ctx)
+                                        (fn [g m]
+                                          (not (contains? down-down [g m]))))]
     (for [[G-H N] (concepts compatible-ctx)]
       (make-context-nc (difference (objects ctx) G-H) N (incidence ctx)))))


Remove magic numbers to be easily understood

--- storm-core/test/clj/backtype/storm/config_test.clj
+++ storm-core/test/clj/backtype/storm/config_test.clj
@@ -66,28 +66,33 @@
                 (catch Exception e e)))))))

 (deftest test-integer-validator
-   (let [validator ConfigValidation/IntegerValidator]
-        (.validateField validator "test" 1000)
-        (is (thrown-cause? java.lang.IllegalArgumentException
-           (.validateField validator "test" 1.34)))
-        (is (thrown-cause? java.lang.IllegalArgumentException
-           (.validateField validator "test" 9223372036854775807)))))
+  (let [validator ConfigValidation/IntegerValidator]
+    (.validateField validator "test" nil)
+    (.validateField validator "test" 1000)
+    (is (thrown-cause? java.lang.IllegalArgumentException
+          (.validateField validator "test" 1.34)))
+    (is (thrown-cause? java.lang.IllegalArgumentException
+          (.validateField validator "test" (inc Integer/MAX_VALUE))))))

 (deftest test-integers-validator
   (let [validator ConfigValidation/IntegersValidator]
+    (.validateField validator "test" nil)
     (.validateField validator "test" [1000 0 -1000])
     (is (thrown-cause? java.lang.IllegalArgumentException
           (.validateField validator "test" [0 10 1.34])))
     (is (thrown-cause? java.lang.IllegalArgumentException
-          (.validateField validator "test" [-100 9223372036854775807])))))
+          (.validateField validator "test" [0 nil])))
+    (is (thrown-cause? java.lang.IllegalArgumentException
+          (.validateField validator "test" [-100 (inc Integer/MAX_VALUE)])))))

 (deftest test-double-validator
   (let [validator ConfigValidation/DoubleValidator]
+    (.validateField validator "test" nil)
     (.validateField validator "test" 10)
     ;; we can provide lenient way to convert int/long to double with losing precision
-    (.validateField validator "test" 2147483647)
-    (.validateField validator "test" 9223372036854775807)
-    (.validateField validator "test" 1.7976931348623157E308)))
+    (.validateField validator "test" Integer/MAX_VALUE)
+    (.validateField validator "test" (inc Integer/MAX_VALUE))
+    (.validateField validator "test" Double/MAX_VALUE)))

 (deftest test-topology-workers-is-integer
   (let [validator (CONFIG-SCHEMA-MAP TOPOLOGY-WORKERS)]
@@ -99,7 +104,7 @@
   (let [validator (CONFIG-SCHEMA-MAP TOPOLOGY-STATS-SAMPLE-RATE)]
     (.validateField validator "test" 0.5)
     (.validateField validator "test" 10)
-    (.validateField validator "test" 1.7976931348623157E308)))
+    (.validateField validator "test" Double/MAX_VALUE)))

 (deftest test-isolation-scheduler-machines-is-map
   (let [validator (CONFIG-SCHEMA-MAP ISOLATION-SCHEDULER-MACHINES)]


Rename chart-state to chart-model

Rename chart-state to chart-model

This is really a 'model' rather than a container for state. It should
store things like the colours that should be used, names, axis headings.

Since the model doesn't change, it is no longer declared in an atom, but
declared as a value.

--- src-cljs/kixi/hecuba/web/chart.cljs
+++ src-cljs/kixi/hecuba/web/chart.cljs
@@ -56,14 +56,12 @@

 ;;;;;;;;;; Application state ;;;;;;;;;;;;;;;;;

-(def chart-state
-  (atom {:selected {:left #{}
-                    :right #{}}
-         :property "rad003"
-         :devices [{:hecuba/name "01"
-                    :name "External temperature"}
-                   {:hecuba/name "02"
-                    :name "External humidity"}]}))
+(def chart-model
+  {:property "rad003"
+   :devices [{:hecuba/name "01"
+              :name "External temperature"}
+             {:hecuba/name "02"
+              :name "External humidity"}]})

 ;;;;;;;;;;; Component 1:  Form containing list of devices for both axis plots ;;;;;;;;;;

@@ -159,4 +157,4 @@
                       {:key :hecuba/name :init-state chans})))))))

-(om/root chart-state (create-form-and-chart [:devices]) (.getElementById js/document "app"))
+(om/root chart-model (create-form-and-chart [:devices]) (.getElementById js/document "app"))


Algorithm for peer shift.

Algorithm for peer shift.

--- src/onyx/log/commands/submit_job.clj
+++ src/onyx/log/commands/submit_job.clj
@@ -10,19 +10,34 @@
       (update-in [:jobs] conj (:id args))
       (update-in [:jobs] vec)
       (assoc-in [:task-schedulers (:id args)] (:task-scheduler args))
-      (assoc-in [:tasks (:id args)] (:tasks args))))
+      (assoc-in [:tasks (:id args)] (:tasks args))
+      (assoc-in [:allocations (:id args)] {})))

 (defmethod extensions/replica-diff :submit-job
   [{:keys [args]} old new]
   {:job (:id args)})

+(defn job->n-peers [replica]
+  (let [j (count (:jobs replica))
+        p (count (:peers replica))
+        min-peers (int (/ p j))
+        r (/ min-peers j)
+        n (numerator r)
+        max-peers (inc min-peers)]
+    (into {}
+          (map-indexed
+           (fn [i [job-id tasks]]
+             {job-id (if (< i n) max-peers min-peers)})
+           (:allocations replica)))))
+
 (defmethod extensions/reactions :submit-job
   [entry old new diff peer-args]
-  (if (and (= (:job-scheduler old) :onyx.job-scheduler/greedy)
-           (not (seq (:jobs old))))
-    [{:fn :volunteer-for-task
-      :args {:id (:id peer-args)}}]
-    []))
+  (cond (and (= (:job-scheduler old) :onyx.job-scheduler/greedy)
+             (not (seq (:jobs old))))
+        [{:fn :volunteer-for-task
+          :args {:id (:id peer-args)}}]
+        (= (:job-scheduler old) :onyx.job-scheduler/round-robin)
+        42))

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


Provide helpful aeron message.

Provide helpful aeron message.

--- src/onyx/peer/peer_group_manager.clj
+++ src/onyx/peer/peer_group_manager.clj
@@ -254,16 +254,29 @@
                    (count our-peers)))))
     0))

+(def media-driver-backoff-ms 500)
+
 (defmethod action :monitor [{:keys [heartbeat-fn!] :as state} _]
   (heartbeat-fn!)
-  (cond (and (:up? state) (not (media-driver-healthy?)))
-        (action state [:stop-peer-group])
-        (and (not (:up? state)) (media-driver-healthy?))
-        (action state [:start-peer-group])
-        :else
-        (-> state
-            (update :shutting-down-futures remove-shutdown-futs)
-            (shutting-down-task-metrics))))
+  (let [state-shutdown (-> state
+                           (update :shutting-down-futures remove-shutdown-futs)
+                           (shutting-down-task-metrics))]
+    (cond (and (:up? state) (not (media-driver-healthy?)))
+          (do
+           (warn "Aeron media driver has not started up, thus stopping all peers until it's up again.")
+           (action state-shutdown [:stop-peer-group]))
+
+          (and (not (:up? state)) (media-driver-healthy?))
+          (do
+           (warn "Aeron media driver is healthy, thus starting all peers.")
+           (action state-shutdown [:start-peer-group]))
+
+          :else
+          (do
+           (when-not (media-driver-healthy?)
+             (warn "Aeron media driver has not started up. Waiting for media driver before starting peers, and backing off for 500ms.")
+             (LockSupport/parkNanos (ms->ns media-driver-backoff-ms)))
+           state-shutdown))))

 (defn update-scheduler-lag! [{:keys [set-scheduler-lag-fn! inbox-entries]}]
   (if (> (count inbox-entries) 1)


readded bulb data to replies

readded bulb data to replies

--- src/bonews_rest/scraper/threads.clj
+++ src/bonews_rest/scraper/threads.clj
@@ -73,6 +73,12 @@
     (into (list user) (:users bulbs))
     (list user)))

+(defn rm-nil-bulb
+  [reply]
+  (if (nil? (reply :bulbs))
+    (dissoc reply :bulbs)
+    reply))
+
 (defn get-data-helper
   [rows]
   (for [row rows
@@ -91,6 +97,7 @@
             :url        reply-url
             :post-time  post-time
             :user       user-id
+            :bulbs      (dissoc bulbs :users)
           }
           user         {
             :id         user-id
@@ -98,7 +105,7 @@
             :url        user-url
           }
           users        (consolidate-users user bulbs)]]
-    [reply users]))
+    [(rm-nil-bulb reply) users]))

 (defn collate-users
   [tdata]
@@ -135,23 +142,8 @@
 ;       :users    (get-users-data    rows)
 ;     }))

-(defn rm-users-from-bulb
-  [reply]
-  (update-in reply [:bulbs] dissoc :users))
-
-(defn clean-replies
-  [replies]
-  (utils/remove-nils (map rm-users-from-bulb replies)))
-
-(defn clean-data
-  [data]
-  (let [replies          (:replies       data)
-        cleaned-replies  (clean-replies  replies)]
-  (assoc data :replies cleaned-replies)))
-
 (defn get-data
   ([url]
-    ; (clean-data (get-data-by-url url)))
     (get-data-by-url url))
   ([subforum-id thread-id]
     nil))


Fix the github hook, as far as I can tell.

It still spews errors about not being able to start an already started project,
and about being unable to shutdown amazon nodes, but I think those are the
result of the dummy project not really starting remote nodes.

--- src/circle/backend/build/config.clj
+++ src/circle/backend/build/config.clj
@@ -4,6 +4,7 @@
   (:require [circle.backend.ssh :as ssh])
   (:require [clojure.string :as str])
   (:require [circle.backend.build :as build])
+  (:require [circle.backend.build.run :as run])
   (:require [circle.model.project :as project])
   (:require [circle.backend.github-url :as github])
   (:require [circle.backend.ec2 :as ec2])
@@ -251,7 +252,6 @@
   "Given a parsed github commit hook json, return a build that needs to be run, or nil"
   [github-json]
   (let [url (-> github-json :repository :url)
-        config (get-config-for-url url)
-        project (project/get-by-url! url)
-        vcs-revision (-> github-json :after)]
-    (build-from-url url :vcs_revision vcs-revision)))
+        vcs-revision (-> github-json :after)
+        build (build-from-url url :vcs_revision vcs-revision)]
+    (run/run-build build)))


remove json delay

remove json delay

--- src/clj/om_next_leaflet/geojson.clj
+++ src/clj/om_next_leaflet/geojson.clj
@@ -59,24 +59,24 @@
 (def ^{:private true}
   lines
   "全路線を読み取った Collection (delayed)。"
-  (delay (read-all-data "JRW-railroad.geojson" json->line)))
+  (read-all-data "JRW-railroad.geojson" json->line))

 (def ^{:private true}
   stations
   "全駅を読み取った Collection (delayed)。"
-  (delay (read-all-data "JRW-stations.geojson" json->station)))
+  (read-all-data "JRW-stations.geojson" json->station))

 (defn get-lines
   "条件に適合する路線情報を返す。"
   ([] (get-lines identity))
   ([filter-fn]
-     (filter filter-fn @lines)))
+     (filter filter-fn lines)))

 (defn get-stations
   "条件に適合する駅を返す。"
   ([] (get-stations identity))
   ([filter-fn]
-     (filter filter-fn @stations)))
+     (filter filter-fn stations)))

 (defn distance
   "２つの点の間の距離(km)を求める。
@@ -124,7 +124,7 @@

 (defn- line-name->line-id
   [line-name]
-  (->> @lines
+  (->> lines
        (filter #(= (:line-name %) line-name))
        first
        :id))


display evidence, update evidence list

display evidence, update evidence list

--- src/cljs/salava/badge/ui/modal.cljs
+++ src/cljs/salava/badge/ui/modal.cljs
@@ -18,7 +18,8 @@
             [salava.social.ui.badge-message-modal :refer [badge-message-link]]
             [salava.admin.ui.reporttool :refer [reporttool1]]
             [salava.badge.ui.verify :refer [check-badge]]
-            [salava.core.ui.tag :as tag]))
+            [salava.core.ui.tag :as tag]
+            [clojure.string :refer [blank?]]))

 (defn init-badge-connection [state badge-id]
@@ -34,7 +35,7 @@
      {:handler (fn [data]
                  (do (reset! state (assoc data :id id
                                      :show-link-or-embed-code nil
-                                     ::show_evidence_options false
+                                     :show_evidence_options false
                                      :initializing false
                                      :content-language (init-content-language (:content data))
                                      :tab-no tab-no
@@ -61,7 +62,8 @@
                 (swap! state assoc :badge-settings data (assoc data :new-tag ""))
                 (if (= context "settings")
                   (swap! state assoc :tab [se/settings-tab-content data state init-data]
-                         :tab-no 2)
+                         :tab-no 2
+                         :evidences (:evidences data))
                   (swap! state assoc :tab [se/share-tab-content data state init-data]
                          :tab-no 3)))}))

@@ -228,25 +230,38 @@
             [:div [:a {:target "_blank" :href evidence_url} (t :badge/Openevidencepage) "..."]]]])

       (if (and (pos? show_evidence) (not (empty? evidences)))
-        [:div.row
+        [:div.row {:id "badge-settings"}
          [:div.col-md-12
-          [:h2.uppercase-header (if (= (count evidences) 1)  (t :badge/Evidence) (str (t :badge/Evidences) ": " (count evidences)) ) ]
-          (reduce (fn [r e]
-                    (let [{:keys [name narrative description genre audience url]} e]
-                      (conj r [:div {:style {:margin-bottom "10px"}}
-                               (if name [:div.inline [:label (t :badge/Name) ": "] name])
-                               (if narrative [:div [:label (t :badge/Narrative)] narrative])
-                               (if description [:div [:label (t :admin/Description)]  description])
-                               (if genre [:div [:label (t :badge/Genre) ": "] genre])
-                               (if audience [:div [:label (t :badge/Audience) ": "] audience])
-                               [:div [:a {:target "_blank" :href url} (t :badge/Openevidencepage) "..."]]
-                               ]
-                            )
-                      )) [:div] evidences)
-          ]
-         ]
-        )]]
-    ))
+          [:h2.uppercase-header (if (= (count evidences) 1)  (t :badge/Evidence) (str (t :badge/Evidence) " (" (count evidences) ")") ) ]
+          (reduce (fn [r evidence]
+                    (let [{:keys [genre description narrative name audience id url mtime ctime]} evidence]
+                      (conj r
+                            [:div.panel.panel-default
+                             [:div.panel-heading {:id (str "heading" id)
+                                                  :role "tab"}
+                              [:div.panel-title
+                               [:div.url [:div {:style {:float "left"}} [:i.fa.fa-link]] [:a {:target "_blank" :href url} (t :badge/Openevidencepage) "..."]]
+                              (when-not (every? #(blank? %) (vector genre description narrative name audience))
+                                 [:div.show-more [:a {:role "button" :data-toggle "collapse"
+                                                      :data-parent "#accordion"
+                                                      :href (str "#collapse" id)
+                                                      :aria-expanded "true"
+                                                      :aria-controls (str "collapse" id)} (t :admin/Showmore)]])]]
+                             (when-not (every? #(blank? %) (vector genre description narrative name audience))
+                               [:div {:id (str "collapse" id)
+                                      :class "panel-collapse collapse"
+                                      :role "tabpanel"
+                                      :aria-labelledby (str "heading" id)}
+                                [:div.panel-body.evidence-panel-body {:style {:padding-top "10px"}}
+                                 (when-not (blank? name) [:div.inline [:label (t :badge/Name) ": "] name])
+                                 (when-not (blank? genre) [:div [:label (t :badge/Genre) ": "] genre])
+                                 (when-not (blank? audience) [:div [:label (t :badge/Audience) ": "] audience])
+                                 (when-not (blank? narrative) [:div [:label (t :badge/Narrative)] [:div.description narrative]])
+                                 (when-not (blank? description) [:div [:label (t :admin/Description)]  [:div.description description]])
+                                 ]])])
+                      )
+                    )[:div {:id "accordion" :class "panel-group evidence-list" :role "tablist" :aria-multiselectable "true"}] evidences)
+          ]])]]))

 (defn modal-navi [state]
   (let [invalid? (or (bh/badge-expired? (:expires_on @state)) (pos? (:revoked @state)))


html statt plain text

html statt plain text

--- src/clojure_getting_started/web.clj
+++ src/clojure_getting_started/web.clj
@@ -9,8 +9,8 @@

 (defn splash []
   {:status 200
-   :headers {"Content-Type" "text/plain"}
-   :body (str "Hier gibt's noch nix zu gucken, geh'n se weiter ...")})
+   :headers {"Content-Type" "text/html"}
+   :body (str "
Hier gibt's noch nix zu gucken, geh'n se weiter ...
")})

 (defroutes app
   (GET "/camel" {{input :input} :params}


Debug meta-update calls

Debug meta-update calls

--- src/clojush/instructions/genome.clj
+++ src/clojush/instructions/genome.clj
@@ -262,8 +262,8 @@
                                      (assoc genome
                                        index
                                        (let [g (nth genome index)]
-                                         (assoc g :close (inc (:close g)))))
-                                     :genome))))
+                                         (assoc g :close (inc (:close g))))))
+                        :genome)))
       state)))

 (define-registered
@@ -282,8 +282,8 @@
                                      (assoc genome
                                        index
                                        (let [g (nth genome index)]
-                                         (assoc g :close (max 0 (dec (:close g))))))
-                                     :genome))))
+                                         (assoc g :close (max 0 (dec (:close g)))))))
+                        :genome)))
       state)))

 (define-registered


Fix nilpo

Fix nilpo

--- src/puppeteer/domain/usecase/deploy.clj
+++ src/puppeteer/domain/usecase/deploy.clj
@@ -67,11 +67,12 @@
             (map
               (fn [tls]
                 (let [hosts (.getHosts tls)]
-                  (.setHosts tls
-                    (if (some #(= % host) hosts)
-                      hosts
-                      (doto hosts
-                        (.add host))))))
+                  (doto tls
+                    (.setHosts
+                      (if (some #(= % host) hosts)
+                        hosts
+                        (doto hosts
+                          (.add host)))))))
               tls))
           (.setRules
             (if (some #(= (:host %) host) rules)


(PDB-3268) Don't migrate on schema_migration query failures

This commit, if the schema_migrations query fails, will only attempt the
migrations if it fails due to an `undefined_table` error. In this case,
the database has not been initialized and so all migrations will be
applied. In all other cases, the error will be thrown.

This was the original intention of the error-handling here as per
commit fc0252c (PR #1707)

--- src/puppetlabs/puppetdb/scf/migrate.clj
+++ src/puppetlabs/puppetdb/scf/migrate.clj
@@ -1564,13 +1564,10 @@
           results (jdbc/with-db-transaction []  (query-to-vec query))]
       (apply sorted-set (map :version results)))
     (catch java.sql.SQLException e
-      (let [message (.getMessage e)
-            sql-state (.getSQLState e)]
-        (if (and (or (= sql-state "42P01") ; postgresql: undefined_table
-                     (= sql-state "42501")) ; hsqldb: user lacks privilege or object not found
-                 (re-find #"(?i)schema_migrations" message))
-          (sorted-set)
-          (throw e))))))
+      (let [sql-state (.getSQLState e)]
+        (if (= sql-state "42P01") ; postgresql: undefined_table
+            (sorted-set)
+            (throw e))))))

 (defn pending-migrations
   "Returns a collection of pending migrations, ordered from oldest to latest."


Use `cider.piggieback` (#74)

Use `cider.piggieback` (#74)

The current config does not seem to work with newer versions of cider, as something changed with `cemerick.piggieback/wrap-cljs-repl`.

--- src/leiningen/new/re_frame/project.clj
+++ src/leiningen/new/re_frame/project.clj
@@ -39,7 +39,7 @@
   :less {:source-paths ["less"]
          :target-path  "resources/public/css"}
 {{/less?}}{{#cider?}}
-  :repl-options {:nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]}
+  :repl-options {:nrepl-middleware [cider.piggieback/wrap-cljs-repl]}
 {{/cider?}}
 {{#aliases?}}

@@ -60,7 +60,7 @@
                    [day8.re-frame/re-frame-10x "0.3.3"]
                    [day8.re-frame/tracing "0.5.1"]{{/10x?}}{{#cider?}}
                    [figwheel-sidecar "0.5.16"]
-                   [cider/piggieback "0.2.3"]{{/cider?}}{{#re-frisk?}}
+                   [cider/piggieback "0.3.5"]{{/cider?}}{{#re-frisk?}}
                    [re-frisk "0.5.3"]{{/re-frisk?}}]

     :plugins      [[lein-figwheel "0.5.16"]{{#test?}}


Add trace to reader3 plan

Add trace to reader3 plan

--- src/com/wsscode/pathom/connect.cljc
+++ src/com/wsscode/pathom/connect.cljc
@@ -1192,6 +1192,12 @@
     :as      env}]
   (pcp/prepare-ast env (p/query->ast parent-query)))

+(defn reader3-compute-run-graph [env]
+  (let [plan-trace-id (pt/trace-enter env {::pt/event ::compute-plan})
+        plan          (pcp/compute-run-graph env)]
+    (pt/trace-leave env plan-trace-id {::pt/event ::compute-plan ::plan plan})
+    plan))
+
 (defn reader3
   [{::keys   [indexes max-resolver-weight]
     ::p/keys [async-parser?]
@@ -1199,7 +1205,7 @@
     :as      env}]
   (let [ast            (reader3-prepare-ast env)
         available-data (-> env p/entity data->shape eql/query->ast pci/ast->io)
-        plan           (pcp/compute-run-graph
+        plan           (reader3-compute-run-graph
                          (merge env indexes {:edn-query-language.ast/node ast
                                              ::pcp/available-data         available-data}))]
     (if-let [root (pcp/get-root-node plan)]


Inline schema?

Inline schema?

--- src/main/cljc/mikron/runtime/core.cljc
+++ src/main/cljc/mikron/runtime/core.cljc
@@ -11,11 +11,6 @@
   #?(:cljs (:require-macros [mikron.runtime.core])))

 (defrecord Schema [processors global-options])
-
-(defn ^{:tag #?(:clj nil :cljs boolean)} schema?
-  "Returns `true` if `arg` is an instance of `Schema`, `false` otherwise."
-  [arg]
-  (instance? Schema arg))

 (defonce ^:private registry-ref (atom {}))

@@ -36,7 +31,7 @@
 (defn resolve-schema
   "Returns a reified schema for the given argument."
   ^Schema [arg]
-  (or (and (schema? arg) arg)
+  (or (and (instance? Schema arg) arg)
       (@registry-ref arg)
       (@local-registry-ref arg)
       (throw (ex-info "Invalid schema" {:arg arg}))))


Hide top subreddits when route is not home

--- src/reddio_frontend/screens/app.cljs
+++ src/reddio_frontend/screens/app.cljs
@@ -5,7 +5,9 @@
             [reddio-frontend.screens.home.top-subreddits :as top-subreddits]))

 (defn app []
-  [:> bridge/root-provider
-   [:div.app
-    [header/main]
-    [top-subreddits/main {:url-path "/r/listentothis"}]]])
+  (let [route @(rf/subscribe [:route])]
+    [:> bridge/root-provider
+     [:div.app
+      [header/main]
+      (when (= route "/")
+        [top-subreddits/main {:url-path "/r/listentothis"}])]]))


Fixup returning bad ctx from fx

Fixup returning bad ctx from fx

--- src/day8/re_frame/trace/events.cljs
+++ src/day8/re_frame/trace/events.cljs
@@ -83,13 +83,13 @@
   :global/enable-tracing
   (fn [ctx _]
     (utils.traces/enable-tracing!)
-    ctx))
+    nil))

 (rf/reg-event-fx
   :global/disable-tracing
   (fn [ctx _]
     (utils.traces/disable-tracing!)
-    ctx))
+    nil))

 ;; Traces


Missed newline in example-tweaking.

Missed newline in example-tweaking.

--- examples/parkour/examples/matrixify.clj
+++ examples/parkour/examples/matrixify.clj
@@ -47,7 +47,8 @@
   [dseq]
   (->> dseq (into []) (sort-by first)
        (reductions (fn [[_ t] [i n]]
-                     [(inc i) (+ t n)]) [0 0])
+                     [(inc i) (+ t n)])
+                   [0 0])
        (into {})))

 (defn absind


Vertical align option menu

Vertical align option menu

--- src/discuss/components/options.cljs
+++ src/discuss/components/options.cljs
@@ -9,9 +9,9 @@
 (defn- option-row
   "Generic row for multiple settings."
   [description content]
-  (dom/div #js {:className "row"}
-           (dom/div #js {:className "col-md-offset-1 col-md-2"} description)
-           (dom/div #js {:className "col-md-8"} content)))
+  (dom/div #js {:className "text-center"}
+           (dom/div nil description)
+           (dom/div nil content)))

 (defn- language
   "Component for a single language selection."
@@ -38,4 +38,4 @@
     (render [_]
       (dom/div nil
                (vlib/view-header (translate :options :heading))
-               (language-row)))))+               (language-row)))))


wip: query validator - work around for enum value

--- src/graphql_clj/query_validator.clj
+++ src/graphql_clj/query_validator.clj
@@ -60,7 +60,9 @@
       :boolean-value (= 'Boolean (:name t))
       :int-value     (or (= 'Int (:name t)) (= 'Float (:name t)))
       :float-value   (= 'Float (:name t))
-      :string-value  (= 'String (:name t))
+      :string-value  (or (= 'String (:name t))
+                         true ; FIXME: work around for enum values
+                         )
       :null-value    (not (:required t))
       :enum-value    true ;; TODO
       :list-value    false


Update words.clj

Update words.clj

--- src/iyye/subcon/knowledge/words.clj
+++ src/iyye/subcon/knowledge/words.clj
@@ -1,5 +1,5 @@
 ; Iyye - AI agent
-; Copyright (C) 2016-2017  Sasha Yumzya
+; Copyright (C) 2016-2018  Sasha Yumzya

 ; This program is free software: you can redistribute it and/or modify
 ; it under the terms of the GNU Affero General Public License as
@@ -56,6 +56,15 @@
         relation (->Iyye_Relation action-atom Predicate Types Function PredicateFunction [])]
     relation))

+(def time-start (persistence/current-time-to-string))
+(defn get-supertypes [atype]
+  "gets types: self, type, immidiate parents"               ; FIXME Yumzia:0 get all parents
+  (let [rels (:Relations atype)]
+    (conj (for [supertype rels :when (:super (:Data supertype))]
+            {:Name (:super (:Data supertype)) :Predicate (:Predicate supertype)})
+          {:Name "type" :Predicate (->Iyye_ModalPredicate :IYE :AXIOM time-start :ALWAYS)}
+          {:Name (:Name (:atom atype)) :Predicate (->Iyye_ModalPredicate :IYE :AXIOM time-start :ALWAYS)})))
+
 (defn create-iyye-instance [values])

 (defn load-iyye-atom-from-db [uname])
@@ -91,8 +100,18 @@
           (save-iyye-type-to-db type)))))

 (defn check-params [action params]
-  (let [act-params (:Types action)]
-    (compare act-params (map #(:Name (:atom %)) params))))  ; FIXME Yumzya context aware compare
+  (let [act-params (:Types action)
+        params-types (map #(get-supertypes %) params)
+        ;   vec-params (vec (map #(:Name (:atom %)) params))
+        pairs (map vector act-params params-types)
+        ok (every? true? (for [cur pairs]
+                  (if (= :UNKNOWN (first cur))
+                    (empty? (second cur))
+                    (some true? (map #(= (first cur) %) (map :Name (second cur)))))))]
+    ;   (future (Thread/sleep 1000) (ioframes/process-output IO (str "okok " ok)))
+    ok)
+    ;(compare act-params vec-params)
+    )  ; FIXME Yumzya context aware compare

 (defn apply-relation [relation params]
   (when (check-params relation params)
@@ -104,19 +123,22 @@

 (defn- run-action [cmd params IO func]
   (let [actions-list (get-iyye-relations cmd)
-        params-list (map get-iyye-types params)]
+        params-list (apply concat (map get-iyye-types params))]
     (case (count actions-list)
-      0 (ioframes/process-output IO (str "failed to parse: no matching action to " cmd))
-      1 (let [action (first actions-list)]
-          (when (not (func action params-list))
-            (ioframes/process-output IO (str "failed to parse: types mismatch " cmd ": " action ":" params))))
-      (let [matching-actions (for [action @actions-list :when (check-params action params-list)] action)]
-        (if (empty? matching-actions)
-          (ioframes/process-output IO (str "failed to parse: no many matched parameters to " cmd ": " actions-list))
-          (func (first matching-actions) params-list)))))) ; FIXME Yumzya first
+      0 (future (Thread/sleep 1000) (ioframes/process-output IO (str "failed to parse: no matching action to " cmd)))
+      1 (let [action (first actions-list)
+              result (func action params-list)]
+          (if result
+            (future (Thread/sleep 1000) (ioframes/process-output IO (pr-str result)))))
+      (let [matching-actions
+            (for [action actions-list :when (check-params action params-list)] action)
+            nothing (count matching-actions)
+            result (func (first matching-actions) params-list)]
+        (if result
+          (future (Thread/sleep 1000) (ioframes/process-output IO (pr-str result)))
+          (future (Thread/sleep 1000) (ioframes/process-output IO (str "False"))))))))

 (defn action [cmd params IO]
-  ; (ioframaes/process-output IO (str " scwords: " cmd))
   (if (= \? (last cmd))
     (run-action (subs cmd 0 (dec (count cmd))) params IO apply-query)
     (run-action cmd params IO apply-relation)))


macro namespaces must be renamed

macro namespaces must be renamed

--- src/main/clojure/cljs/analyzer.cljc
+++ src/main/clojure/cljs/analyzer.cljc
@@ -1573,11 +1573,15 @@
           {:ns ns
            :var (symbol (str clash-ns) (str name))})))))

+(defn macro-ns-name [name]
+  (symbol (str name "$macros")))
+
 (defmethod parse 'ns
   [_ env [_ name & args :as form] _ opts]
   (when-not (symbol? name)
     (throw (error env "Namespaces must be named by a symbol.")))
-  (let [segments (string/split (clojure.core/name name) #"\.")]
+  (let [name     (cond-> name *cljs-macros-ns* macro-ns-name)
+        segments (string/split (clojure.core/name name) #"\.")]
     (when (= 1 (count segments))
       (warning :single-segment-namespace env {:name name}))
     (when (some js-reserved segments)


Automatically compile and deps in eval-in-project if needed.

The heuristic for whether it's needed is just "is the directory empty
or not", which obviously isn't perfect, but whatever--it's just a
convenience thing.

--- src/leiningen/compile.clj
+++ src/leiningen/compile.clj
@@ -10,6 +10,8 @@
   (:import org.apache.tools.ant.taskdefs.Java
            java.lang.management.ManagementFactory
            (org.apache.tools.ant.types Environment$Variable)))
+
+(declare compile)

 (defn compilable-namespaces
   "Returns a seq of the namespaces that are compilable, regardless of whether
@@ -87,7 +89,12 @@
   set correctly for the project. Pass in a handler function to have it called
   with the java task right before executing if you need to customize any of its
   properties (classpath, library-path, etc)."
-  [project form & [handler]]
+  [project form & [handler skip-auto-compile]]
+  (when (and (not skip-auto-compile)
+             (empty? (.list (file (:compile-path project)))))
+    (compile project))
+  (when (empty? (find-lib-jars project))
+    (deps project))
   (let [java (Java.)
         native-path (or (:native-path project)
                         (find-native-lib-path project))]
@@ -126,15 +133,13 @@
   [project]
   ;; dependencies should be resolved by explicit "lein deps",
   ;; otherwise it will be done only if :library-path is empty
-  (when (empty? (find-lib-jars project))
-    (deps project :skip-dev))
   (.mkdir (file (:compile-path project)))
   (if (seq (compilable-namespaces project))
     (if-let [namespaces (seq (stale-namespaces project))]
       (eval-in-project project
                        `(doseq [namespace# '~namespaces]
                           (println "Compiling" namespace#)
-                          (clojure.core/compile namespace#)))
+                          (clojure.core/compile namespace#))
+                       nil :skip-auto-compile)
       (println "All :namespaces already compiled."))
     (println "No :namespaces listed for compilation in project.clj.")))
-


expose :ns-aliases as config option

expose :ns-aliases as config option

aliasing mechanism already existed before, just wasn't
accessible via config via :build-options {:ns-aliases {from to}}.

--- src/main/shadow/build.clj
+++ src/main/shadow/build.clj
@@ -232,6 +232,21 @@
 (defn copy-js-options-to-npm [{:keys [mode js-options] :as state}]
   (update-in state [:npm :js-options] merge js-options {:mode mode}))

+;; may not be a good idea to expose this but it is the easiest way I can currently
+;; think of to work around re-frame-debug tracing stubs problem which requires
+;; switching the classpath. with this we just tell it to use a different ns when resolving
+;; day8.re-frame.tracing and switching the implementation that way.
+;; :ns-aliases functionality already exist, it just wasn't exposed to config
+(defn copy-ns-aliases
+  [state]
+  (let [m (get-in state [:build-options :ns-aliases])]
+    (if-not (seq m)
+      state
+      (-> state
+          (update state :ns-aliases merge m)
+          (update state :ns-aliases-reverse merge (set/map-invert m)))
+      )))
+
 (defn configure
   ([build-state mode config]
     (configure build-state mode config {}))
@@ -335,6 +350,7 @@
               (= :dev mode)
               (assoc-in [:compiler-options :optimizations] :none))

+            (copy-ns-aliases)
             (copy-js-options-to-npm)
             )))))


Set to depend on 1.6.0 / 0.0-3030

Set to depend on 1.6.0 / 0.0-3030

There is nothing in Ambly that requires 1.7.0.
Since it is "infrastructure / library" code, specify
oldest supported version. This has an advantage
that it makes it easier for consumers to use
newer versions of Clojure and ClojureScript as
they see fit.

--- Clojure/project.clj
+++ Clojure/project.clj
@@ -3,6 +3,6 @@
   :url "https://github.com/omcljs/ambly"
   :license {:name "Eclipse Public License"
             :url "http://www.eclipse.org/legal/epl-v10.html"}
-  :dependencies [[org.clojure/clojure "1.7.0-beta3"]
-                 [org.clojure/clojurescript "0.0-3269"]
+  :dependencies [[org.clojure/clojure "1.6.0"]
+                 [org.clojure/clojurescript "0.0-3030"]
                  [com.github.rickyclarkson/jmdns "3.4.2-r353-1"]])


server joke buffer

server joke buffer

--- src/node/server/core.cljs
+++ src/node/server/core.cljs
@@ -11,18 +11,19 @@

 (def express (nodejs/require "express"))

-(defn handler [req res]
+(defn handler [jokes-chan req res]
   (if (= "https" (aget (.-headers req) "x-forwarded-proto"))
     (.redirect res (str "http://" (.get req "Host") (.-url req)))
     (go
       (.set res "Content-Type" "text/html")
-      (.send res (html5 (jokes-page (<! (fresh-jokes 5))))))))
+      (.send res (html5 (jokes-page (<! jokes-chan)))))))

 (defn server [handler port success]
-  (doto (express)
-    (.get "/" handler)
-    (.use (.static express "../resources/public"))
-    (.listen port success)))
+  (let [jokes (fresh-jokes 5 2)]
+    (doto (express)
+      (.get "/" #(handler jokes %1 %2))
+      (.use (.static express "../resources/public"))
+      (.listen port success))))

 (defn -main [& mess]
   (let [port (or (.-PORT (.-env js/process)) 1337)]


Use duration spec of timer entity for validation

--- src/time_tracker/timers/pubsub/spec.clj
+++ src/time_tracker/timers/pubsub/spec.clj
@@ -22,6 +22,6 @@
   (s/keys :req-un [::timers-spec/project-id ::started-time ::created-time ::notes]))

 (s/def ::update-timer-args
-  (s/keys :req-un [::timer-id ::duration ::current-time ::notes]))
+  (s/keys :req-un [::timer-id ::timers-spec/duration ::current-time ::notes]))


Agregando dependencia de sqlite 3.16

Agregando dependencia de sqlite 3.16

--- db-lab/project.clj
+++ db-lab/project.clj
@@ -14,7 +14,7 @@
                  [org.clojure/java.jdbc "0.7.0-alpha1"]
                  [com.layerware/hugsql "0.4.7"]
                  [org.hsqldb/hsqldb "2.3.4"]
-
+                 [org.xerial/sqlite-jdbc "3.16.1"]

                  ]
   :plugins [[lein-gorilla "0.3.6"]])


incerase message buffer size

incerase message buffer size

--- src/ontrail/websocket.clj
+++ src/ontrail/websocket.clj
@@ -14,7 +14,7 @@

 (def #^{:private true} logger (org.slf4j.LoggerFactory/getLogger (str *ns*)))

-(def message-buffer-size 100)
+(def message-buffer-size 500)

 ;; Ring for in-memory persistence of last messages.
 ;; conjoining to end, popping from beginning.


remove unused return value

remove unused return value

--- src/otto/repositories.clj
+++ src/otto/repositories.clj
@@ -19,8 +19,7 @@
                 (= (:name organization) o))) @a))
   (update [this organization repository-data]
     (let [k (repository-key organization repository-data)]
-      (dosync (alter a assoc-in [k] repository-data)))
-      true))
+      (dosync (alter a assoc-in [k] repository-data)))))

 (defn make-repository
   [attributes]


improve docstrings

improve docstrings

--- src/overtone/sc/synth.clj
+++ src/overtone/sc/synth.clj
@@ -230,6 +230,7 @@
    name default pairs, name [default rate] pairs or a vector of maps:

   (defsynth foo [freq 440] ...)
+  (defsynth foo [freq [440 :ar]] ...)
   (defsynth foo [freq {:default 440 :rate :ar}] ...)

   Returns a vec of param maps"
@@ -573,6 +574,13 @@
   (def foo
     (synth [freq 440] (out 0 (sin-osc freq))))

+  Params can also be given rates. By default, they are :kr, however
+  another rate can be specified by using either a pair of [default rate]
+  or a map with keys :default and rate:
+
+  (defsynth foo [freq [440 :kr] gate [0 :tr]] ...)
+  (defsynth foo [freq {:default 440 :rate :kr}] ...)
+
   A doc string can also be included:
   (defsynth bar
     \"The phatest space pad ever!\"
@@ -591,6 +599,7 @@

   These can also be abbreviated:
   (foo :tgt 2 :pos :head)
+
   "
   [s-name & s-form]
   {:arglists '([name doc-string? params ugen-form])}


routing: link can also replace token

routing: link can also replace token

--- examples/_common/middleware/routing.cljs
+++ examples/_common/middleware/routing.cljs
@@ -34,8 +34,9 @@
     (.getToken -goog-history))

   (replace-token
-    [_this new-token]
-    (.replaceToken -goog-history new-token))
+    [this new-token]
+    (when (not= (token this) new-token)
+      (.replaceToken -goog-history new-token)))

   (set-token
     [_this token]
@@ -90,8 +91,7 @@
                (println "[routing] start")
                (add-watch model ::token-watcher
                           (fn [_key _atom old-state new-state]
-                            (when (and (not= (::token old-state) (::token new-state))
-                                       (not= (::token new-state) (token history)))
+                            (when (not= (::token old-state) (::token new-state))
                               (replace-token history (::token new-state)))))

                (reset! unlisten
@@ -113,12 +113,14 @@
              [::on-api-event token]
              (dispatch-action [::set-token token])

-             [::on-link-click href]
+             [::on-link-click href replace?]
              (let [token (if (clojure.string/starts-with? href "#")
                            ; hrefs can contain hashes, token - can't
                            (subs href 1)
                            href)]
-               (set-token history token))
+               (if replace?
+                 (replace-token history token)
+                 (set-token history token)))

              :else
              (app-control model signal dispatch-signal dispatch-action)))))
@@ -161,16 +163,17 @@
            (not (zero? (.-button e))))))

 (defn -on-click
-  [e href dispatch]
+  [e href replace? dispatch]
   (when (-pure-click? e)
     (.preventDefault e)
-    (dispatch [::on-link-click href])))
+    (dispatch [::on-link-click href replace?])))

 (defn link
   "Link component which changes current URL without sending request to server.
   Requires routing middleware to be added.
+  Will replace current token instead of pushing if :replace? attribute is true.

   Inspired by: https://github.com/STRML/react-router-component/blob/master/lib/Link.js"
-  [dispatch {:keys [href] :as attrs} & body]
-  (into [:a (assoc attrs :on-click #(-on-click % href dispatch))]
+  [dispatch {:keys [href replace?] :as attrs} & body]
+  (into [:a (assoc attrs :on-click #(-on-click % href replace? dispatch))]
         body))


extend to ffilter to accept a predicate

extend to ffilter to accept a predicate

--- dada-core/src/main/clojure/org/dada/dsl.clj
+++ dada-core/src/main/clojure/org/dada/dsl.clj
@@ -623,8 +623,14 @@
 	       tgt-data-tuple))]))
   )

-(defn ffilter [key required-value]
-  (split key (fn [candidate-value] (if (= candidate-value required-value) (list candidate-value) '()))))
+(defn != [lhs rhs] (not (= lhs rhs)))
+
+(defn ffilter
+  ([key predicate required]
+   (let [yes (list value) no '()]
+     (split key (fn [candidate] (if (predicate candidate required) yes no)))))
+  ([key required]
+   (ffilter key = required)))

 ;; pivot fn must supply such a closed list of values to be used as
 ;; attribute metadata for output model....


update schema for pen tool's path

update schema for pen tool's path

--- src/pc/datomic/schema.clj
+++ src/pc/datomic/schema.clj
@@ -33,6 +33,7 @@
    (enum :layer.type/group)
    (enum :layer.type/text)
    (enum :layer.type/line)
+   (enum :layer.type/path)

    (attribute :layer/start-x
               :db.type/float)
@@ -83,6 +84,9 @@
    (attribute :layer/font-size
               :db.type/long)

+   (attribute :layer/path
+              :db.type/string)
+
    ;; Wonder what happens if we make a layer a child of one of its children...
    (attribute :layer/child
               :db.type/long


whitespace

whitespace

--- src/org/martinklepsch/derivatives.cljc
+++ src/org/martinklepsch/derivatives.cljc
@@ -82,12 +82,12 @@
                  derivative
                  (throw (ex-info (str "No derivative defined for " drv-k) {:key drv-k})))))
      :release! (fn release! [drv-k token]
-              (let [registry  (:registry @state)
-                    new-reg   (if (= #{token} (get registry drv-k))
-                                (dissoc registry drv-k)
-                                (update registry drv-k disj token))]
-                (sync! new-reg)
-                nil))}))
+                 (let [registry  (:registry @state)
+                       new-reg   (if (= #{token} (get registry drv-k))
+                                   (dissoc registry drv-k)
+                                   (update registry drv-k disj token))]
+                   (sync! new-reg)
+                   nil))}))

 ;; RUM specific code ===========================================================


changes integration test to verify blacklist-on-503 behavior (#537)

--- waiter/integration/waiter/killed_instance_test.clj
+++ waiter/integration/waiter/killed_instance_test.clj
@@ -14,14 +14,12 @@
 ;; limitations under the License.
 ;;
 (ns waiter.killed-instance-test
-  (:require [clj-time.core :as t]
-            [clojure.core.async :as async]
+  (:require [clojure.core.async :as async]
             [clojure.string :as str]
             [clojure.test :refer :all]
             [clojure.tools.logging :as log]
             [plumbing.core :as pc]
-            [waiter.util.client-tools :refer :all]
-            [waiter.util.date-utils :as du]))
+            [waiter.util.client-tools :refer :all]))

 (deftest ^:parallel ^:integration-slow ^:resource-heavy test-delegate-kill-instance
   (testing-using-waiter-url
@@ -50,7 +48,7 @@
         (wait-for #(= 0 (num-instances waiter-url service-id)) :timeout 180)))))

 (defn- trigger-blacklisting-of-instance [target-url request-headers cookies]
-  (log/info "requesting killing of instance")
+  (log/info "issuing request which will respond with a 503 on" target-url)
   (let [{:keys [instance-id] :as response}
         (make-request-with-debug-info
           request-headers
@@ -67,61 +65,45 @@
     (when (some #(= "blacklisted" %) (:status-tags instance-state))
       (get-in responder-state [:instance-id->blacklist-expiry-time instance-keyword]))))

-(deftest ^:parallel ^:integration-slow ^:explicit test-blacklisted-instance-not-reserved
-  ;; Verifies that a blacklisted instance is not used to process a request.
-  ;; The test first blacklists an instance on all routers.
-  ;; It then makes a few requests and verifies if they responded inside the blacklist
-  ;; expiry period that the blacklisted instance was not used to process the request.
+(deftest ^:parallel ^:integration-fast ^:explicit test-instance-blacklisted-on-503
+  ;; Verifies the instance blacklisted on a 503 response behavior.
+  ;; Separate unit tests assert that a blacklisted instance is not used to process a request.
   (testing-using-waiter-url
-    (log/info "Testing blacklisted instance is not reserved")
-    (let [router-id->router-url (routers waiter-url)
-          num-routers (count router-id->router-url)
-          extra-headers {:x-waiter-blacklist-on-503 true
-                         :x-waiter-concurrency-level (* 2 num-routers)
-                         :x-waiter-name (rand-name)
-                         :x-waiter-scale-up-factor 0.99}
-          make-request-fn (fn make-request-fn []
-                            (make-request-with-debug-info
-                              extra-headers #(make-kitchen-request waiter-url %)))
-          {:keys [cookies request-headers instance-id service-id] :as response} (make-request-fn)]
-      (assert-response-status response 200)
-      (log/info "canary instance-id:" instance-id)
-      (with-service-cleanup
-        service-id
-        (dotimes [_ 4] ;; incrementally cause longer blacklist duration for instance
+    (log/info "Testing instance is blacklisted on 503 response.")
+    (doseq [blacklist-on-503 [true false]]
+      (log/info "Verifying behavior when blacklisted on 503 is" blacklist-on-503)
+      (let [router-id->router-url (routers waiter-url)
+            num-routers (count router-id->router-url)
+            extra-headers {:x-waiter-blacklist-on-503 blacklist-on-503
+                           :x-waiter-concurrency-level (* 2 num-routers)
+                           :x-waiter-name (rand-name)
+                           :x-waiter-scale-up-factor 0.99}
+            make-request-fn (fn make-request-fn []
+                              (make-request-with-debug-info
+                                extra-headers #(make-kitchen-request waiter-url %)))
+            {:keys [cookies request-headers instance-id service-id] :as response} (make-request-fn)]
+        (assert-response-status response 200)
+        (log/info "canary instance-id:" instance-id)
+        (with-service-cleanup
+          service-id
           (->> router-id->router-url
                (map (fn [[_ router-url]]
                       (launch-thread
                         (trigger-blacklisting-of-instance router-url request-headers cookies))))
                (map async/<!!)
-               doall))
+               doall)

-        (let [router-id->blacklist-expiry-time-str
-              (pc/map-from-keys
-                (fn [router-id]
-                  (let [router-url (router-id->router-url router-id)]
-                    (instance-blacklisted-by-router? router-url service-id instance-id cookies)))
-                (keys router-id->router-url))]
-          (doseq [[router-id _] router-id->router-url]
-            (is (-> router-id router-id->blacklist-expiry-time-str str/blank? not)
-                (str "instance not blacklisted on router"
-                     {:instance-id instance-id
-                      :router-id router-id
-                      :router-id->blacklist-expiry-time-str router-id->blacklist-expiry-time-str})))
-
-          (let [router-id->blacklist-expiry-time (pc/map-vals du/str-to-date router-id->blacklist-expiry-time-str)
-                instance-id->request-count (atom {})]
-            (parallelize-requests
-              (max 10 (* 4 num-routers))
-              1
-              (fn []
-                (let [request-start-time (t/now)
-                      {:keys [instance-id router-id]} (make-request-fn)]
-                  (if (t/before? request-start-time (router-id->blacklist-expiry-time router-id))
-                    (swap! instance-id->request-count update instance-id (fnil inc 0))
-                    (log/warn "request responded after blacklist period, not including instance" instance-id)))))
-            (log/info "instance-id->request-count:" @instance-id->request-count)
-            (if-not (seq @instance-id->request-count)
-              (log/warn "no requests completed after blacklist expiry time of" instance-id)
-              (is (not (contains? @instance-id->request-count instance-id))
-                  (str {:instance-id instance-id :instance-id->request-count @instance-id->request-count})))))))))
+          (let [router-id->blacklist-expiry-time-str
+                (pc/map-from-keys
+                  (fn [router-id]
+                    (let [router-url (router-id->router-url router-id)]
+                      (instance-blacklisted-by-router? router-url service-id instance-id cookies)))
+                  (keys router-id->router-url))]
+            (doseq [[router-id _] router-id->router-url]
+              (is (-> router-id router-id->blacklist-expiry-time-str str/blank? not (= blacklist-on-503))
+                  (str "instance "
+                       (when blacklist-on-503 "not ")
+                       "blacklisted on router"
+                       {:instance-id instance-id
+                        :router-id router-id
+                        :router-id->blacklist-expiry-time-str router-id->blacklist-expiry-time-str})))))))))


Fix sample.project.clj typo.

Fix sample.project.clj typo.

--- sample.project.clj
+++ sample.project.clj
@@ -34,6 +34,7 @@
   ;; Dependencies are listed as [group-id/name version].
   :dependencies [[org.clojure/clojure "1.1.0"]
                  [org.clojure/clojure-contrib "1.1.0"]
+                 [org.jclouds/jclouds "1.0-RC6" :classifier "jdk15"]
                  [log4j "1.2.15" :exclusions [javax.mail/mail
                                               javax.jms/jms
                                               com.sun.jdmk/jmxtools


re-get the filtered lines in sorted blocks of 6

--- ohack/src/ohack/core.clj
+++ ohack/src/ohack/core.clj
@@ -227,6 +227,17 @@
       index-group-list (collect-into-consecutive (keys index-line-list))

       ]
-  index-group-list
+
+  ;; from the 6-line groups, get lines from the original index-line maps
+  ;; and sorted by increasing line indexes.
+  ;; how this works:
+  ;; 1. each set of 6 indexes gets passed to the lambda function
+  ;; 2. using index-to-line, select the 6 matching lines as a hash-map
+  ;; 3. sort by keys to ensure increasing line index order
+  ;; 4. get the vals, i.e., the lines in correct order
+  ;; now, we have a seq containing sets of 6 lines
+  (map #(vals (sort (select-keys index-to-line %)))
+       ;; these will be grouped into sets of 6 lines, with indexes
+       (sort index-group-list))

   )


:lipstick: Cosmetic changes on builtin colors ns.

--- frontend/src/uxbox/builtins/colors.cljs
+++ frontend/src/uxbox/builtins/colors.cljs
@@ -6,7 +6,7 @@

 (ns uxbox.builtins.colors
   (:require [uxbox.util.uuid :as uuid]
-            [uxbox.util.data :refer (index-by)]))
+            [uxbox.util.data :refer [index-by-id]]))

 (def collections-list
   [{:name "UXBOX"
@@ -672,4 +672,4 @@
               "#3D464D"}}])

 (def collections
-  (index-by collections-list :id))
+  (index-by-id collections-list))


CMR-7809: Explicitly include geotools packages and where to find them in Service-Bridge (#1365)

* CMR-7809: Package bumps

* CMR-7809: Adding repository for osgeo deps

* CMR-7809: Fixed repo link

--- cmr-exchange/service-bridge/project.clj
+++ cmr-exchange/service-bridge/project.clj
@@ -20,7 +20,8 @@
   :url "https://github.com/cmr-exchange/cmr-service-bridge"
   :license {:name "Apache License, Version 2.0"
             :url "http://www.apache.org/licenses/LICENSE-2.0"}
-  :exclusions [[org.clojure/clojurescript]]
+  :exclusions [[org.clojure/clojurescript]
+               [org.eclipse.emf/org.eclipse.emf.ecore]]
   :dependencies [[cheshire "5.10.0"]
                  [clojusc/trifl "0.4.2"]
                  [clojusc/twig "0.4.1"]
@@ -49,11 +50,14 @@
                  [org.clojure/core.cache "0.7.2"]
                  [org.clojure/data.xml "0.2.0-alpha5"]
                  [org.clojure/java.classpath "0.3.0"]
+                 [org.geotools/gt-geometry "24.5"]
+                 [org.geotools/gt-referencing "24.5"]
                  [ring/ring-core "1.7.1"]
                  [ring/ring-codec "1.1.2"]
                  [ring/ring-defaults "0.3.2"]
                  [selmer "1.12.12"]
                  [tolitius/xml-in "0.1.0"]]
+  :repositories [["osgeo" "https://repo.osgeo.org/repository/release/"]]
   :jvm-opts ["-XX:-OmitStackTraceInFastThrow"
              "-Xms2g"
              "-Xmx2g"]


set content type for the error page

set content type for the error page

--- src/selmer/middleware.clj
+++ src/selmer/middleware.clj
@@ -11,5 +11,6 @@
         (let [{:keys [type error-template] :as data} (ex-data ex)]
           (if (= :selmer-validation-error type)
             {:status 500
+             :headers {"Content-Type" "text/html; charset=utf-8"}
              :body (parser/render error-template data)}
             (throw ex)))))))


Added format-with

Added format-with

--- src/semantic_csv/core.clj
+++ src/semantic_csv/core.clj
@@ -327,3 +327,33 @@
 ;;      ["y" "x"])

+;; ## format-with
+
+(defn format-with
+  "Formats the values in `data` entries. First argument is a map of `colname -> format-fn` to be applied to
+  entries for the given column name. Optional second argument is an options hash, with which you can specify
+  an option for `:ignore-first`, useful for when you've already applied `vectorify` and don't want to run the
+  format functions on the header row."
+  ([formatters data]
+   (format-with formatters {} data))
+  ([formatters {:keys [ignore-first] :as opts} data]
+   (->> data
+        (?>> ignore-first (drop 1))
+        ;; A little silly, this actually just uses cast-with
+        (cast-with formatters data)
+        (?>> ignore-first (cons (first data))))))
+
+;; Note that this is actually just the `cast-with` function with an option for `:ignore-first`, potentially
+;; useful when you have a header row you want to ignore.
+;;
+;;     => (let [data [{:this "a" :that "b"}
+;;                    {:this "x" :that "y"}]]
+;;          (->> data
+;;               vectorify
+;;               (format-with {:this (partial str "val-")}
+;;                            {:ignore-first true})))
+;;     (["this" "that"]
+;;      ["val-a" "b"]
+;;      ["val-x" "y"])
+
+


removed an unnecessary character

removed an unnecessary character

--- src/status_im/ui/screens/views.cljs
+++ src/status_im/ui/screens/views.cljs
@@ -42,7 +42,7 @@
             [status-im.profile.photo-capture.screen :refer [profile-photo-capture]]
             [status-im.profile.qr-code.screen :refer [qr-code-view]]
             [status-im.ui.screens.wallet.send.views :refer [send-transaction]]))
--           ;;[status-im.ui.screens.wallet.receive.views :refer [receive-transaction]]
+            ;;[status-im.ui.screens.wallet.receive.views :refer [receive-transaction]]

 (defn validate-current-view
   [current-view signed-up?]


update buffer state checks

update buffer state checks

--- ohack/src/ohack/core.clj
+++ ohack/src/ohack/core.clj
@@ -201,7 +201,12 @@
                  ;; we need to send a fresh buffer if:
                  ;; it is full, OR
                  ;; the incoming value is not a consecutive index
-                 ;; relative to the last value in the buffer
-                 buf
+                 ;; relative to the last value in the buffer, OR
+                 ;; the buffer is empty (i.e. first iteration,
+                 ;; thus last-val is nil)
+                 (if (or (nil? last-val) ;; also short-circuits the subtraction
+                         buf-full?
+                         (not= 1 (- cur-val last-val)))
+                   )
                  (conj rtn (first input)))))))
   )


Remove chart alert when property/project/programme has changed.

--- src-cljs/kixi/hecuba/tabs/hierarchy.cljs
+++ src-cljs/kixi/hecuba/tabs/hierarchy.cljs
@@ -97,6 +97,11 @@
         (om/update! data [:programmes :selected] programmes)
         (om/update! data [:projects :programme_id] programmes)
         (om/update! data [:properties :programme_id] programmes)
+        (om/update! data [:properties :sensors :selected] #{})
+        (om/update! data [:properties :sensors :alert] {})
+        (om/update! data [:properties :chart :sensors] #{})
+        (om/update! data [:properties :chart :measurements] [])
+        (om/update! data [:properties :chart :unit] "")
         (om/transact! data [:programmes :data] (fn [d] (mapv #(cond
                                                                (= old-programmes (:programme_id %)) (assoc % :selected false)
                                                                (= programmes (:programme_id %)) (assoc % :selected true)
@@ -109,6 +114,11 @@
         (log "Setting selected project to: " projects)
         (om/update! data [:projects :selected] projects)
         (om/update! data [:properties :project_id] projects)
+        (om/update! data [:properties :sensors :selected] #{})
+        (om/update! data [:properties :sensors :alert] {})
+        (om/update! data [:properties :chart :sensors] #{})
+        (om/update! data [:properties :chart :measurements] [])
+        (om/update! data [:properties :chart :unit] "")
         (om/update! data [:properties :editable] (-> @data :projects :editable))
         (om/transact! data [:projects :data] (fn [d] (mapv #(cond
                                                              (= old-projects (:project_id %)) (assoc % :selected false)
@@ -125,7 +135,10 @@
         (log "Setting property details to: " properties)
         (om/update! data [:properties :selected] properties)
         (om/update! data [:properties :sensors :selected] #{})
-       ;; (om/update! data [:properties :chart :sensors] #{})
+        (om/update! data [:properties :sensors :alert] {})
+        (om/update! data [:properties :chart :sensors] #{})
+        (om/update! data [:properties :chart :unit] "")
+        (om/update! data [:properties :chart :measurements] [])
         (om/transact! data [:properties :data] (fn [d] (mapv #(cond
                                                              (= old-properties (:entity_id %)) (assoc % :selected false)
                                                              (= properties (:entity_id %)) (assoc % :selected true)


CMR-3622: Addressed the PR comments.

CMR-3622: Addressed the PR comments.

--- ingest-app/src/cmr/ingest/api/ingest.clj
+++ ingest-app/src/cmr/ingest/api/ingest.clj
@@ -250,13 +250,13 @@
           save-collection-result (ingest/save-collection
                                    request-context
                                    (set-user-id concept request-context headers)
-                                   validation-options)
-          entry-title (get save-collection-result :entry-title)
-          logging-concept (assoc concept :entry-title entry-title)]
+                                   validation-options)]
       (info (format "Ingesting collection %s from client %s"
-              (concept->loggable-string logging-concept)
+              (concept->loggable-string (assoc concept :entry-title (:entry-title save-collection-result)))
               (:client-id request-context)))
       (generate-ingest-response headers (contextualize-warnings
+                                          ;; entry-title is added just for the logging above.
+                                          ;; dissoc it so that it remains the same as the original code.
                                           (dissoc save-collection-result :entry-title))))))

 (defn delete-collection


Add skilss header

Add skilss header

--- app/src/cljs/app/components.cljs
+++ app/src/cljs/app/components.cljs
@@ -126,20 +126,22 @@

 (defn single-skill-component
   [skill]
-  [:div.mdl-card
-   [:div.skillcategory.mdl-card__title
-    [:h2 (:category skill)]]
-   [:div.skilllevel.mdl-card__title
+  [:div.mdl-grid
+   [:div.skillcategory.mdl-cell.mdl-cell--12-col
+    [:h3 (:category skill)]]
+   [:div.skilllevel.mdl-cell.mdl-cell--12-col
     [:h3 (:level skill)]]
-   (into [:div.skilldetail]
+   (into [:div.skilldetail.mdl-cell.mdl-cell--3-col]
          (map #(skilldetail-component %) (:details skill)))])

 (defn skill-component
   [skills]
   [:div#skills
    [section-component
-    (into [:div.skill]
-          (map #(single-skill-component %) skills))]])
+    [:div.mdl-grid--no-spacing
+     [:h3.employmentheader "Skills"]
+     (into [:div.skill.mdl-cell.mdl-cell--12-col]
+           (map #(single-skill-component %) skills))]]])

 (defn single-language-component
   [language]


rotate-90 test

rotate-90 test

--- test/infinitelives/utils/vec2_test.cljs
+++ test/infinitelives/utils/vec2_test.cljs
@@ -107,6 +107,11 @@
        (vec2/rotate (vec2/vec2 10 10) (* 3 pi-on-2))
        (vec2/vec2 10 -10))))

+(deftest rotate-90
+  (is (vec2/equals
+       (vec2/rotate-90 (vec2/vec2 1 0))
+       (vec2/vec2 0 1))))
+
 (deftest random-unit
   (loop [tests 20]
     (let [v1 (vec2/random-unit)


creating local directory for cluster config

--- src/terraboot/cluster.clj
+++ src/terraboot/cluster.clj
@@ -377,6 +377,16 @@
                                        :fallback-dns (vpc/fallback-dns vpc/vpc-cidr-block)
                                        :number-of-masters min-number-of-masters}
                                 :lifecycle { :create_before_destroy true }
+
+                                })
+
+             ;; local resources: easy customized local access to the cluster
+             (cluster-resource "template_file" "cassandra_deploy"
+                               {:template (snippet "local-exec/cassandra-production.json")
+                                :vars {:cassandra_node_count min-number-of-slaves
+                                       :cassandra_seed_count (max (quot min-number-of-slaves 3) 1)}
+                                :provisioner {"local-exec" {"cassandra-marathon"
+                                                            {:command (str "mkdir -p ~/" cluster-name  "; echo '" (cluster-output-of "template_file" "cassandra_deploy" "rendered") "' > ~/" cluster-name "/cassandra-marathon-" cluster-name ".json" )}}}
                                 })

              (asg "slaves"


Adjust repl/user requires.

Adjust repl/user requires.

--- repl/user.clj
+++ repl/user.clj
@@ -3,10 +3,10 @@
     [clojure.java.io :as io]
     [clojure.string :as str]
     [clojure.tools.namespace.repl :refer [refresh]]
-    [puget.printer :as puget :refer [cprint]]
     [vault.blob.core :as blob]
     [vault.data.core :as data]
     [vault.entity.core :as entity]
+    [vault.index.core :as index]
     (vault.tool
       [config :as tool-conf])))


add convenience var bindings

add convenience var bindings

--- ohack/src/ohack/core.clj
+++ ohack/src/ohack/core.clj
@@ -195,7 +195,8 @@
           next-rtn (if buf-full? (conj rtn buf) rtn)]
       (if (empty? input)
         rtn
-        (let []
+        (let [last-val (last buf)
+              cur-val (first input)]
           (recur (rest input)
                  ;; we need to send a fresh buffer if:
                  ;; it is full, OR


:bug: Make paste undoable

:bug: Make paste undoable

--- frontend/src/uxbox/main/data/workspace.cljs
+++ frontend/src/uxbox/main/data/workspace.cljs
@@ -247,6 +247,7 @@
   (CopyToClipboard.))

 (defrecord PasteFromClipboard [id]
+  udp/IPageUpdate
   ptk/UpdateEvent
   (update [_ state]
     (let [page (get-in state [:workspace :page])


need / to serve apt-mirror

need / to serve apt-mirror

--- server.cljs
+++ server.cljs
@@ -3,6 +3,6 @@

 (defn -main []
   (let [app (express)]
-    (.use app (serve-static "/vagrant/cache/apt-mirror/mirror/archive.ubuntu.com"))
+    (.use app (serve-static "/vagrant/cache/apt-mirror/mirror/archive.ubuntu.com/"))
     (.listen app 3000 (fn []
                         (println "Server started on port 3000")))))


Updated output directory for test

Updated output directory for test

--- test/clj/forma/source/gadmiso_test.clj
+++ test/clj/forma/source/gadmiso_test.clj
@@ -26,7 +26,7 @@
     (-> (format "/tmp/%s" uuid)
         (utils/ls)
         (first)
-        (.getPath)) => (format "/tmp/%s/gadm2.csv" "12345")))
+        (.getPath) => (format "/tmp/gadm2/%s/gadm2.csv" uuid))))

 (fact "Check `csv-dir->line-seq`."
   (let [uuid "12345"


adding update current player

adding update current player

--- cartagena-web/src/cartagena_web/main.cljs
+++ cartagena-web/src/cartagena_web/main.cljs
@@ -257,7 +257,24 @@
               :handler on-new-game
               :error-handler on-error}))

+(defn on-update-active-player [response]
+  (reset! app-state (assoc @app-state :actions-remaining (:actions-remaining response)
+                                     :current-player (:current-player response))))
+
+(defn update-active-player! [{:keys [actions-remaining current-player player-order]}]
+  (ajax/POST "http://localhost:3000/update-active-player"
+             {:params {:actions-remaining actions-remaining
+                       :current-player current-player
+                       :player-order player-order}
+              :handler on-update-active-player
+              :error on-error}))
+
 (defn on-play-card [response]
+  ;; TODO: call update current player
+  (reset! app-state (assoc @app-state :board (:board response)
+                                      :discard-pile (:discard-pile response)
+                                      :players (conj (remove #{(active-player @app-state)} (:players @app-state)) (:player response))))
+  (update-active-player! @app-state)
   (println "on-play-card" response))

 (defn play-card! [player card from-space board discard-pile]


RS & AB | 128 | Fix function name change

--- src/mooncake/handler.clj
+++ src/mooncake/handler.clj
@@ -35,7 +35,7 @@

 (defn retrieve-activities-from-source [source-k-v-pair]
   (let [[source-key source-url] source-k-v-pair
-        activities (get-json-from-url source-url)]
+        activities (get-json-from-activity-source source-url)]
     (map #(assoc % :activity-src source-key) activities)))

 (defn retrieve-activities [activity-sources]


fix docstrings

fix docstrings

--- src/mvMusic/file_ops.clj
+++ src/mvMusic/file_ops.clj
@@ -78,8 +78,8 @@
        (vec)))

 (defn replace-url-chars
+  "Converts url path characters back to file path characters."
   [path]
-  "Converts url path characters back to file path characters."
   (-> (string/replace path path-delimiter "/")
       (string/replace space-replacement " ")
       (string/replace dot-replacement ".")))
@@ -96,8 +96,8 @@
     path))

 (defn clean
-  [path]
   "Takes url path parameter and returns safe, path parameter with url characters
   replaced"
+  [path]
   (->> (sanitize (replace-url-chars path))
        (java.io.File. (io/as-file (:music-folder cfg-map)))))


Use formatter for day of week.

Use formatter for day of week.

--- src/oc/email/content.clj
+++ src/oc/email/content.clj
@@ -14,8 +14,8 @@
 (def iso-format (time-format/formatters :date-time))
 (def date-format (time-format/formatter "MMMM d"))
 (def date-format-year (time-format/formatter "MMMM d YYYY"))
-(def reminder-date-format (time-format/formatter "MMMM d"))
-(def reminder-date-format-year (time-format/formatter "MMMM d YYYY"))
+(def reminder-date-format (time-format/formatter "EEEE, MMMM d"))
+(def reminder-date-format-year (time-format/formatter "EEEE, MMMM d YYYY"))

 (def profile-url (str config/web-url "/profile/notifications"))

@@ -502,22 +502,12 @@

 ;; Reminder notification

-(defn- day-string [d]
- (case d
-  1 "Monday"
-  2 "Tuesday"
-  3 "Wednesday"
-  4 "Thursday"
-  5 "Friday"
-  6 "Saturday"
-  "Sunday"))
-
 (defn- reminder-due-date [timestamp]
   (let [d (time-format/parse iso-format timestamp)
         n (time/now)
         same-year? (= (time/year n) (time/year d))
         output-format (if same-year? reminder-date-format reminder-date-format-year)]
-    (str (day-string (time/day-of-week d)) ", " (time-format/unparse output-format d))))
+    (time-format/unparse output-format d)))

 (defn reminder-notification-headline [reminder-data]
   (str (first-name (:author reminder-data)) " created a new reminder for you"))


Log after parsing request body and response body json

--- src/rsvp_backend/app.clj
+++ src/rsvp_backend/app.clj
@@ -22,11 +22,11 @@

 (def main-handler
   (-> (br/make-handler routes)
-      json/wrap-json-body
+      logging/wrap-log-request-response
+      logging/wrap-error-logging
+      (json/wrap-json-body {:keywords? true :bigdecimals? true})
       json/wrap-json-response
       params/wrap-params
-      logging/wrap-log-request-response
-      logging/wrap-error-logging
       cors/wrap-cors-policy))

 (log/set-level! (util/get-config :logging :level))


Add decimal helpers

Add decimal helpers

--- src/runbld/util/data.clj
+++ src/runbld/util/data.clj
@@ -1,4 +1,5 @@
 (ns runbld.util.data
+  (:refer-clojure :exclude [bigdec])
   (:require [clojure.walk]))

 ;; http://dev.clojure.org/jira/browse/CLJ-1468
@@ -22,3 +23,17 @@
        (apply f maps)))
    maps))

+(defn safe-div
+  ([n m]
+   (if (and m (pos? m))
+     (/ n m)
+     0)))
+
+(defn bigdec
+  "Set f to n places after the decimal."
+  ([f]
+   (clojure.core/bigdec f))
+  ([f n]
+   (when f
+     (-> (clojure.core/bigdec f)
+         (.setScale n BigDecimal/ROUND_HALF_UP)))))


Implement auto :unprocessed-items/keys reprocessing

--- src/taoensso/faraday.clj
+++ src/taoensso/faraday.clj
@@ -70,6 +70,11 @@
             com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient
             java.nio.ByteBuffer))

+;; TODO setReturnConsumedCapacity enum for:
+;; GetItem PutItem UpdateItem DeleteItem
+;; Query Scan
+;; BatchGetItem BatchWriteItem
+
 ;;;; Connections

 (def ^:private db-client*
@@ -162,18 +167,20 @@
 (def db-item->clj-item (partial utils/keyword-map db-val->clj-val))
 (def clj-item->db-item (partial utils/name-map    clj-val->db-val))

+(defn- cc-units [^ConsumedCapacity cc] (some-> cc (.getCapacityUnits)))
+
 (defprotocol AsMap (as-map [x]))

 (defmacro ^:private am-item-result [result get-form]
   `(when-let [get-form# ~get-form]
      (with-meta (db-item->clj-item get-form#)
-       {:consumed-capacity (.getConsumedCapacity ~result)})))
+       {:consumed-capacity (cc-units (.getConsumedCapacity ~result))})))

 (defmacro ^:private am-query|scan-result [result & [meta]]
   `(let [result# ~result]
      (with-meta (mapv db-item->clj-item (.getItems result#))
        (merge {:count (.getCount result#)
-               :consumed-capacity (.getConsumedCapacity result#)
+               :consumed-capacity (cc-units (.getConsumedCapacity result#))
                :last-prim-kvs (as-map (.getLastEvaluatedKey result#))}
               ~meta))))

@@ -209,31 +216,33 @@

   BatchGetItemResult
   (as-map [r]
-    (with-meta (utils/keyword-map as-map (.getResponses r))
-      {:unprocessed-keys  (utils/keyword-map as-map (.getUnprocessedKeys r))
-       :consumed-capacity (.getConsumedCapacity r)}))
+    {:items             (utils/keyword-map as-map (.getResponses r))
+     :unprocessed       (.getUnprocessedKeys r)
+     :consumed-capacity (cc-units (.getConsumedCapacity r))})
+
   BatchWriteItemResult
   (as-map [r]
-    {:unprocessed-items (utils/keyword-map as-map (.getUnprocessedItems r))
-     :consumed-capacity (.getConsumedCapacity r)})
+    {:unprocessed       (.getUnprocessedItems r)
+     :consumed-capacity (cc-units (.getConsumedCapacity r))})

   DescribeTableResult
-  (as-map [r] (let [t (.getTable r)]
-                {:name          (keyword (.getTableName t))
-                 :creation-date (.getCreationDateTime t)
-                 :item-count    (.getItemCount t)
-                 :size          (.getTableSizeBytes t)
-                 :throughput    (as-map (.getProvisionedThroughput t))
-                 :indexes       (as-map (.getLocalSecondaryIndexes t))
-                 :status        (utils/un-enum (.getTableStatus t))
-                 :prim-keys
-                 (let [schema (as-map (.getKeySchema t))
-                       defs   (as-map (.getAttributeDefinitions t))]
-                   (merge-with merge
-                     (reduce-kv (fn [m k v] (assoc m (:name v) {:key-type  (:type v)}))
-                                {} schema)
-                     (reduce-kv (fn [m k v] (assoc m (:name v) {:data-type (:type v)}))
-                                {} defs)))}))
+  (as-map [r]
+    (let [t (.getTable r)]
+      {:name          (keyword (.getTableName t))
+       :creation-date (.getCreationDateTime t)
+       :item-count    (.getItemCount t)
+       :size          (.getTableSizeBytes t)
+       :throughput    (as-map (.getProvisionedThroughput t))
+       :indexes       (as-map (.getLocalSecondaryIndexes t))
+       :status        (utils/un-enum (.getTableStatus t))
+       :prim-keys
+       (let [schema (as-map (.getKeySchema t))
+             defs   (as-map (.getAttributeDefinitions t))]
+         (merge-with merge
+           (reduce-kv (fn [m k v] (assoc m (:name v) {:key-type  (:type v)}))
+                      {} schema)
+           (reduce-kv (fn [m k v] (assoc m (:name v) {:data-type (:type v)}))
+                      {} defs)))}))

   LocalSecondaryIndexDescription
   (as-map [d] {:name       (keyword (.getIndexName d))
@@ -515,21 +524,32 @@
                                                       :my-range ["0" "1"]}]
                                           :attrs []}}))

-;; TODO Add loops+merging for :unprocessed-keys (meta) and :unprocessed-items
-
-;; BatchGetItem will return a partial result if the response size limit is
-;; exceeded, the table's provisioned throughput is exceeded, or an internal
-;; processing failure occurs. If a partial result is returned, the operation
-;; returns a value for UnprocessedKeys . You can use this value to retry the
-;; operation starting with the next item to get.
-
-;; * The UnprocessedKeys value is in the same form as RequestItems, so the value
-;; can be provided directly to a subsequent BatchGetItem operation. For more
-;; information, see RequestItems in the Request Parameters section.
-
-;; Typically, you would call BatchWriteItem in a loop. Each iteration would
-;; check for unprocessed items and submit a new BatchWriteItem request with
-;; those unprocessed items until all items have been processed.
+(defn- merge-unprocessed
+  [creds more-f last-result]
+  (loop [{:keys [items unprocessed consumed-capacity]} last-result]
+    (when (seq unprocessed) (println "REPROCESSING!: " unprocessed))
+    (if-not (seq unprocessed)
+      (if items
+        (with-meta items {:consumed-capacity consumed-capacity})
+        last-result)
+
+      (let [{items* :items unprocessed* :unprocessed
+             consumed-capacity* :consumed-capacity}
+            (more-f creds unprocessed)]
+
+        (recur (merge {:unprocessed       unprocessed*
+                       :consumed-capacity (when consumed-capacity
+                                            (+ consumed-capacity
+                                               consumed-capacity*))}
+                      (when (or items items*)
+                        {:items (into (or items []) items*)})))))))
+
+(defn- batch-get-item* [creds raw-request]
+  (merge-unprocessed creds batch-get-item*
+   (as-map
+    (.batchGetItem (db-client creds)
+      (doto (BatchGetItemRequest.) ; {table-str KeysAndAttributes}
+        (.setRequestItems raw-request))))))

 (defn batch-get-item
   "Retrieves a batch of items in a single request.
@@ -543,15 +563,26 @@
      :friends {:prim-kvs [{:catagory \"favorites\" :id [1 2 3]}
                           {:catagory \"recent\"    :id [7 8 9]}]}})"
   [creds requests]
-  (as-map
-   (.batchGetItem (db-client creds)
-     (doto (BatchGetItemRequest.) ; {table-str KeysAndAttributes}
-       (.setRequestItems (batch-request-items requests))))))
+  (batch-get-item* creds (batch-request-items requests)))
+
+(comment
+  (def bigval (.getBytes (apply str (range 14000))))
+  (defn- ids [from to] (for [n (range from to)] {:id n :name bigval}))
+  (batch-write-item creds {:faraday.tests.main {:put (ids 0 5)}})
+  (batch-get-item   creds {:faraday.tests.main {:prim-kvs {:id (range 3)}}}))

 (defn- write-request [action item]
   (case action
     :put    (doto (WriteRequest.) (.setPutRequest    (doto (PutRequest.)    (.setItem item))))
     :delete (doto (WriteRequest.) (.setDeleteRequest (doto (DeleteRequest.) (.setKey  item))))))
+
+(defn- batch-write-item*
+  [creds raw-request]
+  (merge-unprocessed creds batch-write-item*
+   (as-map
+    (.batchWriteItem (db-client creds)
+      (doto (BatchWriteItemRequest.)
+        (.setRequestItems raw-request))))))

 (defn batch-write-item
   "Executes a batch of Puts and/or Deletes in a single request.
@@ -563,18 +594,15 @@
                        {:user-id 2 :username \"jane\"}]
               :delete [{:user-id [3 4 5]}]}})"
   [creds requests]
-  (as-map
-    (.batchWriteItem (db-client creds)
-      (doto (BatchWriteItemRequest.)
-        (.setRequestItems
-         (utils/name-map
-          ;; {<table> <table-reqs> ...} -> {<table> [WriteRequest ...] ...}
-          (fn [table-request]
-            (reduce into []
-             (for [action (keys table-request)
-                   :let [items (attr-multi-vs (table-request action))]]
-               (mapv (partial write-request action) items))))
-          requests))))))
+  (batch-write-item* creds
+    (utils/name-map
+     ;; {<table> <table-reqs> ...} -> {<table> [WriteRequest ...] ...}
+     (fn [table-request]
+       (reduce into []
+         (for [action (keys table-request)
+               :let [items (attr-multi-vs (table-request action))]]
+           (mapv (partial write-request action) items))))
+     requests)))

 ;;;; API - queries & scans


update channel-page description

update channel-page description

--- src/chat/client/views/pages/channel.cljs
+++ src/chat/client/views/pages/channel.cljs
@@ -26,10 +26,9 @@
                 "Subscribe")))

           (dom/div #js {:className "description"}
-            (dom/span nil "One day, a channel description will be here.")
-            (dom/br nil)
-            (dom/br nil)
-            (dom/span nil "Currently only showing your open threads for this channel. Showing all threads for this channel coming soon."))
+            (dom/p nil "One day, a channel description will be here.")
+            (dom/p nil "Currently only showing your open threads for this channel.")
+            (dom/p nil "Soon, you will see all recent threads for this channel."))

           (apply dom/div #js {:className "threads"}
             (concat


CMR-707: Change keyword search to use 'AND' instead of 'OR'

--- src/cmr/search/data/query_to_elastic.clj
+++ src/cmr/search/data/query_to_elastic.clj
@@ -136,7 +136,8 @@
                                                   query_string-reserved-characters-regex
                                                   "\\\\$1")
                               :analyzer :whitespace
-                              :default_field field}}}))
+                              :default_field field
+                              :default_operator :and}}}))

   cmr.search.models.query.StringCondition
   (condition->elastic


Removed old code comment.

Removed old code comment.

--- test/cmr/exchange/common/tests/unit/results/errors.clj
+++ test/cmr/exchange/common/tests/unit/results/errors.clj
@@ -8,8 +8,6 @@
   (merge errors/status-map
          {errors/server-error-code #{"Server problem"}}))

-;; XXX Some of these tests may need to be moved into
-;;     cmr.exchange.common.tests.unit.results.errors
 (deftest any-client-errors?
   (is (not (errors/any-client-errors? {:errors []})))
   (is (errors/any-client-errors? errors/status-map


CMR-2751: Fixing call to reindex all collections.

--- ingest-app/src/cmr/ingest/services/jobs.clj
+++ ingest-app/src/cmr/ingest/services/jobs.clj
@@ -93,7 +93,7 @@
 (def-stateful-job ReindexAllCollections
   [ctx system]
   (let [context {:system system}]
-    (reindex-all-collections context)))
+    (reindex-all-collections context false)))

 (defn cleanup-expired-collections
   "Finds collections that have expired (have a delete date in the past) and removes them from


Display unicode characters

Display unicode characters

--- desktop/src/nightweb_desktop/server.clj
+++ desktop/src/nightweb_desktop/server.clj
@@ -11,6 +11,13 @@
 (def port (atom (or (utils/read-pref :port) 4707)))
 (def server (atom nil))

+(defn return-html
+  [html]
+  (-> html
+      res/response
+      (res/content-type "text/html")
+      (res/charset "UTF-8")))
+
 (defn handler
   [request]
   (if (= :post (:request-method request))
@@ -22,9 +29,9 @@
         res/response)
     (let [params (f/url-decode (:query-string request))]
       (case (:uri request)
-        "/" (res/response (pages/get-main-page params))
-        "/c" (res/response (pages/get-category-page params))
-        "/b" (res/response (pages/get-basic-page params))
+        "/" (return-html (pages/get-main-page params))
+        "/c" (return-html (pages/get-category-page params))
+        "/b" (return-html (pages/get-basic-page params))
         (if (>= (.indexOf (:uri request) c/nw-dir) 0)
           (res/file-response (clojure.string/replace (:uri request) ".webp" "")
                              {:root @c/base-dir})


Tiny cleanup

Tiny cleanup

--- test/snergly/algorithms_properties.clj
+++ test/snergly/algorithms_properties.clj
@@ -13,7 +13,7 @@

 ;; This seems like a perfect application for property-based testing.  There's
 ;; no way to inspect a maze and prove that it was generated by a correct
-;; implementation of, say. Wilson's algorithm.  And the inherent randomness of
+;; implementation of, say, Wilson's algorithm.  And the inherent randomness of
 ;; the algorithms means that any particular example I come up with might not
 ;; expose all of the issues.
 ;;
@@ -161,6 +161,20 @@
                ;(println (str "Change sets: " (into [] (map empty? change-sets#))))
                (every? not-empty change-sets#)))))

+       (when (contains? ~specs :updates-link-2)
+         (defspec ~(symbol (str alg-name "-links-two-cells-each-update"))
+           5
+           (prop/for-all [grid# gen-grid]
+             (let [reports# (all-grids (algorithm-functions ~alg-name) grid#)
+                   update-change-sets# (map :changed-cells (rest reports#))
+                   ;deltas# (partition 2 (interleave grids# (rest reports##)))
+                   ;matched-up# (partition 2 (interleave update-change-sets# deltas#))
+                   ]
+               (every? (fn [cs#] (= 2 (count cs#)))
+                       update-change-sets#)))))
+
+       ;; This isn't working, and it's too complex, anyway.  I might remove it
+       ;; and trust that :each-changes plus :updates-link-2 suffice.
        #_(when (contains? ~specs :accurate-changes)
            (defspec ~(symbol (str alg-name "-cells-changed-is-accurate"))
              5
@@ -170,17 +184,6 @@
                      actual-changes# (actual-changes reports#)]
                  (every? (fn [[a# c#]] (= a# c#)) (partition 2 (interleave actual-changes# update-change-sets#)))))))

-       (when (contains? ~specs :updates-link-2)
-         (defspec ~(symbol (str alg-name "-links-two-cells-each-update"))
-           5
-           (prop/for-all [grid# gen-grid]
-             (let [reports# (all-grids (algorithm-functions ~alg-name) grid#)
-                   update-change-sets# (map :changed-cells (rest reports#))
-                   ;deltas# (partition 2 (interleave grids# (rest reports##)))
-                   ;matched-up# (partition 2 (interleave update-change-sets# deltas#))
-                   ]
-               (every? (fn [cs#] (= 2 (count cs#)))
-                       update-change-sets#)))))
        )
     ))

@@ -188,6 +191,7 @@
 (check-algorithm-properties "sidewinder")
 (check-algorithm-properties "aldous-broder")
 (check-algorithm-properties "wilsons")
+;; The following two cannot yet pass :each-changes and :updates-link-2
 (check-algorithm-properties "hunt-and-kill" :perfect :first-new :all-changed)
 (check-algorithm-properties "recursive-backtracker" :perfect :first-new :all-changed)

@@ -214,7 +218,7 @@
 ;;     reported twice).
 ;; * (maybe) if no intermediate-chan, the result grid shows all cells changed

-;; What kinds of properties can I asert about find-distances?
+;; What kinds of properties can I assert about find-distances?
 ;;
 ;; * Each cell is changed exactly once
 ;; * :max is monotonically increasing (starting with 1)


test helpers

test helpers

--- test/funcgo/core_test.clj
+++ test/funcgo/core_test.clj
@@ -39,35 +39,13 @@
 12345
 ")

-(fact "can define things" (funcgo-parse "
-package foo
-import (
-)

-a := 12345
-") => "(ns foo)
+(defn parse [expr]
+  (funcgo-parse (str "package foo;import (;)" expr)))

-(def a 12345)
-")
+(defn parsed [expr]
+  (str "(ns foo)\n\n" expr "\n"))

-(fact "can call functions" (funcgo-parse "
-package foo
-import (
-)
-
-f(x)
-") => "(ns foo)
-
-(f x)
-")
-
-(fact "labels are all-caps" (funcgo-parse "
-package foo
-import (
-)
-
-FOO
-") => "(ns foo)
-
-:foo
-")
+(fact "can define things"   (parse "a := 12345") => (parsed "(def a 12345)"))
+(fact "can call functions"  (parse "f(x)")       => (parsed "(f x)"))
+(fact "labels are all-caps" (parse "FOO")        => (parsed ":foo"))


fix tests

fix tests

--- test/cambo/core_test.clj
+++ test/cambo/core_test.clj
@@ -37,7 +37,7 @@
 (deftest keyset-test
   (is (= :foo
          (keyset [:foo])))
-  (is (= [:foo "bar" 13]
+  (is (= ["bar" (range 13 14) :foo]
          (keyset [:foo "bar" 13]))))

 ;;; PATHS
@@ -62,8 +62,8 @@
                            [:video [0 (range 5 8)] :title]]))))

 (deftest pathsets-test
-  (is (= [[:one [:two :three]]
-          [:one "four" [0 1]]]
+  (is (= [[:one [:three :two]]
+          [:one "four" [(range 0 2)]]]
          (pathsets {:one {:two leaf
                           :three leaf
                           "four" {0 leaf
@@ -74,12 +74,12 @@
     (is (= [[:one :two]]
            (length-tree-pathsets {2 {:one {:two leaf}}}))))
   (testing "complex path"
-    (is (= [[:one [:two :three]]]
+    (is (= [[:one [:three :two]]]
            (length-tree-pathsets {2 {:one {:two leaf
                                            :three leaf}}}))))
   (testing "simple and complex path"
-    (is (= [[:one [:two :three]]
-            [:one [0 1 2 3] :summary]]
+    (is (= [[:one [:three :two]]
+            [:one [(range 0 4)] :summary]]
            (length-tree-pathsets {2 {:one {:two leaf
                                            :three leaf}}
                                   3 {:one {0 {:summary leaf}
@@ -88,9 +88,9 @@
                                            3 {:summary leaf}}}}))))
   (testing "pathmap that has overlapping branch and leaf nodes"
     (is (= [[:lolomo]
-            [:lolomo [:summary 13 14]]
-            [:lolomo [15 16 17] [:rating :summary]]
-            [:lolomo [13 14] :summary]]
+            [:lolomo [(range 13 15) :summary]]
+            [:lolomo [(range 15 18)] [:summary :rating]]
+            [:lolomo [(range 13 15)] :summary]]
            (length-tree-pathsets {1 {:lolomo leaf}
                                   2 {:lolomo {:summary leaf
                                               13 leaf
@@ -123,12 +123,12 @@
                   [:one (range 0 4) :summary]])))))

 (deftest collapse-test
-  (is (= [[:genres 0 :titles [0 1] [:name :rating]]]
+  (is (= [[:genres 0 :titles [(range 0 2)] [:name :rating]]]
          (collapse [[:genres 0 :titles 0 :name]
                     [:genres 0 :titles 0 :rating]
                     [:genres 0 :titles 1 :name]
                     [:genres 0 :titles 1 :rating]])))
-  (is (= [[:genres 0 :titles [0 1] [:name :rating]]]
+  (is (= [[:genres 0 :titles [(range 0 2)] [:name :rating]]]
          (collapse [[:genres 0 :titles 0 [:name :rating]]
                     [:genres 0 :titles 1 :name]
                     [:genres 0 :titles 1 :rating]]))))