Fix email subject for reset, verify and digest.

--- src/oc/email/mailer.clj
+++ src/oc/email/mailer.clj
@@ -107,8 +107,8 @@
               (assoc :from default-from)
               (assoc :reply-to default-reply-to)
               (assoc :subject (case token-type
-                                  :reset "Carrot Password Reset"
-                                  :verify "Carrot Email Verification")))]
+                                  :reset "Reset your password"
+                                  :verify "Please verify your email")))]
     (try
       (spit html-file (content/token-html token-type msg)) ; create the email in a tmp file
       (inline-css html-file inline-file) ; inline the CSS
@@ -128,7 +128,9 @@
         inline-file (str uuid-fragment ".inline.html")
         msg (keywordize-keys message)
         org-name (:org-name msg)
-        frequency (if (= (keyword (:digest-frequency msg)) :daily) "Daily" "Weekly")]
+        daily? (= (keyword (:digest-frequency msg)) :daily)
+        frequency (if daily? "Daily" "Weekly")
+        digest-email-subject (if daily? "Your daily brief" "Your weekly brief")]
     (try
       (spit html-file (content/digest-html msg)) ; create the email in a tmp file
       (inline-css html-file inline-file) ; inline the CSS
@@ -137,7 +139,7 @@
               :source digest-source
               :from default-from
               :reply-to default-reply-to
-              :subject (str c/email-digest-prefix org-name " " frequency " Digest")}
+              :subject digest-email-subject}
              {:html (slurp inline-file)})
       (finally
         ; remove the tmp files


year to year result summary

year to year result summary

--- src/ontrail/summary.clj
+++ src/ontrail/summary.clj
@@ -67,7 +67,7 @@
   (let [first-day (time/date-time year 1 1)
         last-day (time/date-time year 12 31)
         year-cond {:creationDate {:$gte first-day :$lte last-day}}]
-    (get-overall-summary-cond user year-cond)))
+    (assoc (get-overall-summary-cond user year-cond) :year year)))

 (defn get-month-summary-sport [user year month]
   (let [first-day (time/date-time year month 1)


Fix issue where checkpoint recovery used new input stream on each read.

--- src/onyx/storage/s3.clj
+++ src/onyx/storage/s3.clj
@@ -103,8 +103,9 @@
     (try
      (let [nbytes (.getContentLength (.getObjectMetadata object))
            bs (byte-array nbytes)
+           input-stream (.getObjectContent object)
            n-read (loop [offset 0]
-                    (let [n-read (.read (.getObjectContent object) bs offset (- nbytes offset))]
+                    (let [n-read (.read input-stream bs offset (- nbytes offset))]
                       (if-not (= n-read -1)
                         (recur (+ offset n-read))
                         offset)))]


update buss-set! docstring

update buss-set! docstring

--- src/overtone/sc/bus.clj
+++ src/overtone/sc/bus.clj
@@ -91,8 +91,7 @@
 ;(on-sync-event :reset reset-busses ::reset-busses)

 (defn bus-set!
-  "Takes a list of control bus indices and values and sets the buses to those values.
-  Modifies bus(ses) in place on the server.
+  "Updates bus to new val. Modification takes place on the server asynchronously.

   (bus-set! my-bus 3) ;=> Sets my-bus to the value 3"
   [bus val]


Reserve control-bus 0 as a precautionary measure.

Many synthdefs with control-bus args use id 0 as the default value. If
these synths are triggered without passing a specific bus id as a param
then the best that can happen is that the synth behaves incorrectly as
it's reading from bus 0. However, the worst situation is when the synth
writes to bus 0 - in this case if bus 0 is already assigned for use,
then the bus will be clobbered with data from the synth causing other
synths to potentially misbehave too.

By reserving bus 0, no allocated control-bus will have this id.
Therefore, accidentally writing to this bus will not have any negative
impact on other correctly executing synths.

--- src/overtone/sc/bus.clj
+++ src/overtone/sc/bus.clj
@@ -111,14 +111,13 @@
      (let [id (alloc-id :audio-bus n-channels)]
        (AudioBus. id n-channels :audio name))))

-;; Reserve busses for overtone
-(defonce ___reserve-overtone-busses____
-  (dotimes [i AUDIO-BUS-RESERVE-COUNT]
-    (audio-bus)))
-
-;; (defn reset-buses
-;;   [event-info]
-;;   nil)
+;; Reserve first control bus. This is a precautionary measure to stop
+;; synths which have control bus args with defaults of 0 which aren't
+;; overridden on triggering from clobbering important bus data. By
+;; reserving the first control bus (with an id of 0) we ensure that this
+;; bus isn't used for important data.
+(defonce ___reserve-overtone-first-control-bus___
+  (control-bus "Reserved Bus 0"))

 ;(on-sync-event :reset reset-buses ::reset-buses)


bump js-joda tz-dep to be compatible with js-joda core. fixes #136

--- src/deps.cljs
+++ src/deps.cljs
@@ -1,2 +1,2 @@
-{:npm-deps {"@js-joda/timezone" "2.2.0"
+{:npm-deps {"@js-joda/timezone" "2.5.0"
             "@js-joda/locale_en-us" "3.1.1"}}


work on hyperlink

work on hyperlink

--- src/re_demo/basics.cljs
+++ src/re_demo/basics.cljs
@@ -202,21 +202,35 @@
     (let [showing? (reagent/atom false)
           pos      :right-below]
       [v-box
+       :gap      "20px"
        :children [[title :label "Hyperlinks"]
-                  [gap :size "20px"]
-                  [h-box
+                  [h-box
+                   :gap      "20px"
                    :children [[popover-anchor-wrapper
                                :showing? showing?
                                :position pos
                                :anchor   [hyperlink
                                           :showing?  showing?
                                           :toggle-on :click
-                                          :label     "click link popover"]
+                                          :label     "using hyperlink"]
                                :popover [popover-content-wrapper
                                          :showing? showing?
                                          :position pos
                                          :title    "Popover Title"
                                          :body     "popover body"]]
+                              [popover-anchor-wrapper
+                               :showing? showing?
+                               :position pos
+                               :anchor   [button
+                                          :label    "using button"
+                                          :class    "btn-link"
+                                          :on-click #()]
+                               :popover [popover-content-wrapper
+                                         :showing? showing?
+                                         :position pos
+                                         :title    "Popover Title"
+                                         :body     "popover body"]]
+
                               ]]
                   ]])))


Add content type to default route

Add content type to default route

--- src/test_fb/handler.clj
+++ src/test_fb/handler.clj
@@ -1,13 +1,16 @@
 (ns test-fb.handler
   (:require [ring.middleware.defaults :refer (wrap-defaults site-defaults secure-site-defaults)]
-            [ring.util.response :refer (not-found response)]
+            [ring.util.response :refer (not-found response content-type)]
             [taoensso.timbre :as log]
             [clojure.string :refer (trim blank?)]
             [clojure.java.io :as io]
             ))

 (defn handler [request]
-  (response "hello world"))
+  (->
+    (response "hello world")
+    (content-type "text/plain")
+    ))

 (def app
   (-> handler


Use sorted map for avid failing tests that depends on order.

--- test/suricatta/dsl_test.clj
+++ test/suricatta/dsl_test.clj
@@ -251,7 +251,7 @@
 (deftest dsl-update
   (testing "Update statement without condition using map"
     (let [q (-> (dsl/update :t1)
-                (dsl/set {:id 2 :name "foo"}))]
+                (dsl/set (sorted-map :id 2 :name "foo")))]
       (is (= (fmt/get-sql q)
              "update t1 set id = ?, name = ?"))))


Indentation fixes, attempt 1.

Indentation fixes, attempt 1.

--- satellite-slave/src/satellite_slave/core.clj
+++ satellite-slave/src/satellite_slave/core.clj
@@ -170,26 +170,26 @@
                 ;; safe-env is set but not a hash-map, default
                 :else (merge
                  (select-keys (System/getenv)
-                               ["JAVA" "http_proxy" "https_proxy"
-                                "no_proxy"])
-                  {"PATH" "/bin/:/usr/bin/:/sbin/:/usr/sbin/"}))]
-        (doseq [{:keys [riemann test]} (:comets settings)]
-          ( chime-at (:schedule test)
-                (fn [_]
-                  (try
-                    (let [riemann (assoc riemann
-                                         :time (.toSeconds TimeUnit/MILLISECONDS
-                                                           (System/currentTimeMillis))
-                                         :service (str (:service settings)
-                                                       (:service riemann)))
-                          test-output (run-test (dissoc test :schedule))
-                          final-event (eventify riemann test-output)]
-                      (doseq [client clients]
-                        (send-event client final-event)))
-                    (catch Exception ex
-                      (log/error (str "service: " (:service riemann) " "
-                                      "command: " (:command test))
-                                 ex))))))
+                              ["JAVA" "http_proxy" "https_proxy"
+                               "no_proxy"])
+                 {"PATH" "/bin/:/usr/bin/:/sbin/:/usr/sbin/"}))]
+    (doseq [{:keys [riemann test]} (:comets settings)]
+      ( chime-at (:schedule test)
+                 (fn [_]
+                   (try
+                     (let [riemann (assoc riemann
+                                          :time (.toSeconds TimeUnit/MILLISECONDS
+                                                            (System/currentTimeMillis))
+                                          :service (str (:service settings)
+                                                        (:service riemann)))
+                           test-output (run-test (dissoc test :schedule))
+                           final-event (eventify riemann test-output)]
+                       (doseq [client clients]
+                         (send-event client final-event)))
+                     (catch Exception ex
+                       (log/error (str "service: " (:service riemann) " "
+                                       "command: " (:command test))
+                                  ex))))))
     (async/<!! finish-chan)))

 (defn init-logging


Return empty map from redirect event in create group

Otherwise confuses re-frame as it tries to treat the returned string
as a bunch of effects

--- src/braid/core/client/gateway/forms/create_group/events.cljs
+++ src/braid/core/client/gateway/forms/create_group/events.cljs
@@ -71,7 +71,8 @@
 (reg-event-fx
   ::redirect
   (fn [_ [_ url]]
-    (set! js/window.location url)))
+    (set! js/window.location url)
+    {}))

 (reg-event-fx
   ::handle-registration-error


Fix handler in jetty start

Fix handler in jetty start

--- jetty/src/com/palletops/bakery/jetty.clj
+++ jetty/src/com/palletops/bakery/jetty.clj
@@ -1,6 +1,5 @@
 (ns com.palletops.bakery.jetty
   "Component for running jetty server.
-  Requires [ring/ring-jetty-adapter \"1.3.0\"].
   Provides an idempotent start and stop."
   (:require
    [com.palletops.api-builder.api :refer [defn-api]]
@@ -9,7 +8,7 @@
    [schema.core :as schema]))

 (defn- start
-  [{:keys [handler {:keys [port join?] :as config}]}]
+  [handler {:keys [port join?] :as config}]
   {:pre [handler port]}
   (jetty/run-jetty handler config))

@@ -17,12 +16,12 @@
   [{:keys [^org.eclipse.jetty.server.Server server]}]
   (.stop server))

-(defrecord Jetty [config server]
+(defrecord Jetty [handler config server]
   ILifecycle
   (start [component]
     (if server
       component
-      (assoc component :server (start config))))
+      (assoc component :server (start handler config))))
   (stop [component]
     (if server
       (do


Fix keys.

Fix keys.

--- test/onyx/peer/dashboard_colors_flow_test.clj
+++ test/onyx/peer/dashboard_colors_flow_test.clj
@@ -71,19 +71,16 @@
    {:onyx/name :process-red
     :onyx/fn :onyx.peer.dashboard-colors-flow-test/process-red
     :onyx/type :function
-    :onyx/consumption :concurrent
     :onyx/batch-size batch-size}

    {:onyx/name :process-blue
     :onyx/fn :onyx.peer.dashboard-colors-flow-test/process-blue
     :onyx/type :function
-    :onyx/consumption :concurrent
     :onyx/batch-size batch-size}

    {:onyx/name :process-green
     :onyx/fn :onyx.peer.dashboard-colors-flow-test/process-green
     :onyx/type :function
-    :onyx/consumption :concurrent
     :onyx/batch-size batch-size}

    {:onyx/name :red-out


Remove unused binding

Remove unused binding

--- src-cljs/frontend/components/pages/team.cljs
+++ src-cljs/frontend/components/pages/team.cljs
@@ -243,8 +243,7 @@
     om/IWillUpdate
     (will-update [_ _ {:keys [selected-org-ident]}]
       (let [[_ [vcs-type name]] selected-org-ident
-            api-chan (om/get-shared owner [:comms :api])
-            selected-org (when selected-org-ident (get-in app selected-org-ident))]
+            api-chan (om/get-shared owner [:comms :api])]
         (when (not= (:selected-org-ident (om/get-render-state owner))
                     selected-org-ident)
           (api/get-org-settings-normalized name vcs-type api-chan))))


Consistent names for functions.

Consistent names for functions.

--- src/clj/popchange/lib/raster_calculation.clj
+++ src/clj/popchange/lib/raster_calculation.clj
@@ -315,7 +315,7 @@
            (s/replace "{REPLACE_COLOUR_RAMP}" (apply str (colour-map-stops-xml stops)))))
       (python raster-to-png-script tiff style-filename png))))

-(defn tiff->vector!
+(defn tiff->vector-zip!
   [tiff dst vector-file-ext ogr-format]
   (let [basename (util/md5 tiff)
         wd (wdir "/" basename "_tmp")
@@ -329,8 +329,8 @@

 (defn tiff->shapefile-zip!
   [tiff dst]
-  (tiff->vector! tiff dst ".shp" "ESRI Shapefile"))
+  (tiff->vector-zip! tiff dst ".shp" "ESRI Shapefile"))

 (defn tiff->mapinfo-zip!
   [tiff dst]
-  (tiff->vector! tiff dst ".tab" "Mapinfo File"))
+  (tiff->vector-zip! tiff dst ".tab" "Mapinfo File"))


formating update

formating update

--- collectors/http/test/http_collector/core_test.clj
+++ collectors/http/test/http_collector/core_test.clj
@@ -14,17 +14,17 @@

 (facts "Collecting from end points"
        (fact "Service is down if no connection"
-             (collect-endpoint "http://localhost:12000") => {:error "Connection Refused",
+             (collect-endpoint "http://localhost:12000") => {:error  "Connection Refused",
                                                              :status "DOWN",
-                                                             :type "error",
-                                                             :url "http://localhost:12000"}
+                                                             :type   "error",
+                                                             :url    "http://localhost:12000"}
              (provided (http/get anything) =throws=> (java.net.ConnectException.)))

        (fact "Service running and healthy"
              (collect-endpoint "http://kuona.io:9002/status") => {:status "UP",
-                                                                  :url "http://kuona.io:9002/status"}
+                                                                  :url    "http://kuona.io:9002/status"}
              (provided (http/get anything) => {:headers {:Content-Type "json"}
-                                               :body (generate-string {:status "UP"})})))
+                                               :body    (generate-string {:status "UP"})})))

 (facts "Content testing"
        (fact "test run against content"


(maint) Move some private stuff to the private section

--- src/puppetlabs/trapperkeeper/services/status/status_core.clj
+++ src/puppetlabs/trapperkeeper/services/status/status_core.clj
@@ -54,6 +54,21 @@

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Private
+
+(defmacro with-timeout [timeout-s default & body]
+  `(let [f# (future (do ~@body))
+         result# (deref f# (* 1000 ~timeout-s) ~default)]
+     (future-cancel f#)
+     result#))
+
+(defn- maybe-explain
+  "Given the result of a call to schema.core/check, potentially unwrap it with
+  validation-error-explain if it is a ValidationError object. Otherwise, pass
+  the argument through."
+  [schema-failure]
+  (if (instance? schema.utils.ValidationError schema-failure)
+    (validation-error-explain schema-failure)
+    schema-failure))

 (schema/defn check-timeout
   "Given a status level keyword, returns a number of seconds to use as a timeout
@@ -146,21 +161,6 @@
     status-version)
   (let [status-map (service-status-map svc-version status-version status-fn)]
     (swap! status-fns-atom update-in [svc-name] conj status-map)))
-
-(defmacro with-timeout [timeout-s default & body]
-  `(let [f# (future (do ~@body))
-         result# (deref f# (* 1000 ~timeout-s) ~default)]
-     (future-cancel f#)
-     result#))
-
-(defn- maybe-explain
-  "Given the result of a call to schema.core/check, potentially unwrap it with
-  validation-error-explain if it is a ValidationError object. Otherwise, pass
-  the argument through."
-  [schema-failure]
-  (if (instance? schema.utils.ValidationError schema-failure)
-    (validation-error-explain schema-failure)
-    schema-failure))

 (schema/defn ^:always-validate guarded-status-fn-call
   "Given a status check function, a status detail level, and a timeout in


Removed duplicate test for fast concept computation

Signed-off-by: Daniel Borchmann <25857343a15bf1edafebc2912e82ecf775c585c1@tu-dresden.de>

--- src/test/clojure/conexp/contrib/algorithms/concepts_test.clj
+++ src/test/clojure/conexp/contrib/algorithms/concepts_test.clj
@@ -1,43 +0,0 @@
-;; Copyright (c) Daniel Borchmann. All rights reserved.
-;; The use and distribution terms for this software are covered by the
-;; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
-;; which can be found in the file LICENSE at the root of this distribution.
-;; By using this software in any fashion, you are agreeing to be bound by
-;; the terms of this license.
-;; You must not remove this notice, or any other, from this software.
-
-(ns conexp.contrib.algorithms.concepts-test
-  (:use [conexp.base :only (set-of-range def-)]
-        [conexp.fca.contexts :only (rand-context)]
-        [conexp.contrib.exec :only (program-exists?)]
-        conexp.contrib.algorithms)
-  (:use clojure.test))
-
-;;;
-
-(defn- add-if-not-exists [invalids program-name keyword]
-  (when-not (program-exists? program-name)
-    (conj invalids keyword)))
-
-(def- concepts-methods (let [invalid-methods (-> #{}
-                                                 (add-if-not-exists "pcbo" :pcbo)
-                                                 (add-if-not-exists "fcbo" :fcbo))]
-                         (remove #(or (.startsWith ^String (name %) "default")
-                                      (contains? invalid-methods %))
-                                 (keys (methods concepts)))))
-
-(def- test-runs 50)
-
-(deftest test-concepts
-  (dotimes [_ test-runs]
-    (let [ctx (rand-context (set-of-range (rand 15)) (rand)),
-          rst (map set (keep #(try (concepts % ctx) (catch Exception _ nil))
-                             concepts-methods))]
-      (if-not (apply = rst)
-        (do (println "concepts returned different result for\n" ctx)
-            (is false))
-        (is true)))))
-
-;;;
-
-nil


increase max-total-depth from 15 to 25 for generation

--- src/babel/english/demo.cljc
+++ src/babel/english/demo.cljc
@@ -11,7 +11,7 @@

 ;; during generation, will not decend deeper than this when creating a tree:
 ;; should also be possible to override per-language.
-(def ^:const max-total-depth 15)
+(def ^:const max-total-depth 25)

 (defn demo [ & [n spec]]
   (let [demo-specs


reflexive pronouns are not places or cities

--- src/babel/italiano/pos.cljc
+++ src/babel/italiano/pos.cljc
@@ -95,8 +95,11 @@
 (defn transitivize [lexicon]
   (lexiconfn/transitivize lexicon transitive verb-subjective))

+;; TODO: move place/city to if/then rules.
 (def pronoun-reflexive
   {:synsem {:cat :noun
+            :sem {:place false
+                  :city false}
             :pronoun true
             :case :acc
             :reflexive true}})


[PDOK-2056] after review if-not --> when-not

--- src/main/clojure/pdok/featured/processor.clj
+++ src/main/clojure/pdok/featured/processor.clj
@@ -126,7 +126,7 @@
   (process-new-feature processor (assoc feature :action :change)))

 (defn- process-close-feature [{:keys [persistence projectors] :as processor} feature]
-  (let [change-before-close (if-not (empty? (:attributes feature))
+  (let [change-before-close (when-not (empty? (:attributes feature))
                                (process-change-feature processor
                                                        (-> feature
                                                            (assoc :action :change)


Remove stale code

Remove stale code

--- src/braid/client/store.cljs
+++ src/braid/client/store.cljs
@@ -62,17 +62,16 @@
 (def check-app-state! (s/validator AppState))

 (defn transact! [v]
-  (let [old-state @app-state]
-   (try
-     (do
-       (check-app-state! v)
-       (reset! app-state v))
-     (catch ExceptionInfo e
-       (errorf "State consistency error: %s"
-                (:error (ex-data e)))
-       (swap! app-state helpers/display-error
-              (gensym :internal-consistency)
-              "Something has gone wrong")))))
+  (try
+    (do
+      (check-app-state! v)
+      (reset! app-state v))
+    (catch ExceptionInfo e
+      (errorf "State consistency error: %s"
+              (:error (ex-data e)))
+      (swap! app-state helpers/display-error
+             (gensym :internal-consistency)
+             "Something has gone wrong"))))

 ; GETTERS


Updated Jetty dependencies to 6.1.26

Updated Jetty dependencies to 6.1.26

--- ring-jetty-adapter/project.clj
+++ ring-jetty-adapter/project.clj
@@ -3,6 +3,6 @@
   :url "http://github.com/mmcgrana/ring"
   :dependencies [[ring/ring-core "0.3.4"]
                  [ring/ring-servlet "0.3.4"]
-                 [org.mortbay.jetty/jetty "6.1.14"]
-                 [org.mortbay.jetty/jetty-util "6.1.14"]]
+                 [org.mortbay.jetty/jetty "6.1.26"]
+                 [org.mortbay.jetty/jetty-util "6.1.26"]]
   :dev-dependencies [[clj-http "0.1.1"]])


make set-ab-test work now that ab-tests are in shared

--- src-cljs/frontend/core.cljs
+++ src-cljs/frontend/core.cljs
@@ -73,6 +73,11 @@
                  (aget "abOverrides")
                  (utils/js->clj-kw))))

+(defn set-ab-override [test-name value]
+  (when (nil? (aget js/window "renderContext" "abOverrides"))
+    (aset js/window "renderContext" "abOverrides" #js {}))
+  (aset js/window "renderContext" "abOverrides" (name test-name) value))
+
 (defn get-ab-tests [ab-test-definitions]
   (let [overrides (get-ab-overrides)]
     (ab/setup! ab-test-definitions :overrides overrides)))
@@ -286,10 +291,17 @@
 (defn ^:export set-ab-test
   "Debug function for setting ab-tests, call from the js console as frontend.core.set_ab_test('new_test', false)"
   [test-name value]
-  (let [test-path [:ab-tests (keyword (name test-name))]]
-    (println "starting value for" test-name "was" (get-in @debug-state test-path))
-    (swap! debug-state assoc-in test-path value)
-    (println "value for" test-name "is now" (get-in @debug-state test-path))))
+  (let [test-key (keyword (name test-name))]
+    (println "starting value for" test-name "was" (-> @debug-state
+                                                      :ab-test-definitions
+                                                      get-ab-tests
+                                                      test-key))
+    (set-ab-override (name test-name) value)
+    (reinstall-om!)
+    (println "value for" test-name "is now" (-> @debug-state
+                                                :ab-test-definitions
+                                                get-ab-tests
+                                                test-key))))

 (defn ^:export app-state-to-js
   "Used for inspecting app state in the console."


broke it

broke it

--- src-cljs/tea_time/core.cljs
+++ src-cljs/tea_time/core.cljs
@@ -65,7 +65,7 @@

 ;; (def teas-list (reagent/atom nil))
-(def new-tea (reagent/atom nil))
+;; (def new-tea (reagent/atom nil))
 (def edit-tea-id (reagent/atom nil))
 (def edit-tea (reagent/atom nil))
 (def edit-tea-snap (reagent/atom nil))


Cleaned up tea list view.

Cleaned up tea list view.

--- src-cljs/tea_time/core.cljs
+++ src-cljs/tea_time/core.cljs
@@ -74,6 +74,7 @@
 (re-frame/register-handler
   :process-teas-response
   (fn [app-db [_ response]]
+    (println response)
     (assoc-in app-db [:teas-list] response)))

 (re-frame/register-handler
@@ -163,24 +164,17 @@
   (let [teas (re-frame/subscribe [:teas])]
     (fn []
       [:div.row
-       [:ul
-        (map (fn [tea]
-               (println tea)
-               [:li (:name tea)]) @teas)]])))
-      ;[:ul
-        ;[:table.table.table-striped]
-        ;[:thead
-          ;[:tr]
-          ;[:th ""]
-          ;[:th "Tea Name"]
-          ;[:th "Edit"]]
-        ;[:tbody
-          ;(map (fn [tea] ;[tea @teas-list]
-                ;^{:key tea}
-                ;[:tr
-                  ;[:td [:li]]
-                  ;[:td (second tea)]
-                  ;[:td [:input.btn.btn-success {:type "button" :value "Edit" :on-click (fn [_] (update-edit-form (first tea) (second tea)))}]]]) @teas)]])))
+        [:table.table.table-striped
+          [:thead
+            [:tr
+              [:th "Tea Name"]]]
+          [:tbody
+            (map (fn [tea]
+                    ^{:key tea}
+                    [:tr
+                      [:td.pull-left (:name tea)]
+                      [:td [:input.btn.btn-success {:type "button" :value "Edit" :on-click (fn [_] (update-edit-form (:id tea) (:name tea)))}]]])
+              @teas)]]])))

 (defn sync-atom-to-event
   [the-atom target-value]
@@ -233,6 +227,10 @@
                                                                                (reset! edit-tea-snap nil))}]]
        [:input.btn.btn-danger {:type "button" :value (str "Delete " @edit-tea-snap) :on-click #(delete-tea @edit-tea)}]]]]))

+;; tea-edit can be re-written so that it will look like the tea is being
+;; modified in place on the DOM -- as a sort of preview -- then once the
+;; update button is clicked, the result can be sent to the db.
+
 ;; this passes the value of the new tea atom into the post-to-teas-db function

 (defn list-page []


CMR-3764: Fixed typo

CMR-3764: Fixed typo

--- message-queue-lib/test/cmr/message_queue/test/queue/sqs.clj
+++ message-queue-lib/test/cmr/message_queue/test/queue/sqs.clj
@@ -10,7 +10,7 @@
   #'sqs/normalize-queue-name queue-name)

 (deftest normalize-queue-name
-  (testing "with-and-without-previx"
+  (testing "with-and-without-prefix"
     (are3
       [environ queue-name norm-name]
       (with-env-vars {"CMR_APP_ENVIRONMENT" environ}


fix staged response name

fix staged response name

Former-commit-id: 5749f76be55cfd998caf67dc0857755c17438398

--- src/status_im/chat/views/staged_command.cljs
+++ src/status_im/chat/views/staged_command.cljs
@@ -11,12 +11,15 @@
   (dispatch [:unstage-command staged-command]))

 (defn simple-command-staged-view [staged-command]
-  (let [command (:command staged-command)]
+  (let [{:keys [type name] :as command} (:command staged-command)]
     [view st/staged-command-container
      [view st/staged-command-background
       [view st/staged-command-info-container
        [view (st/staged-command-text-container command)
-        [text {:style st/staged-command-text} (str "!" (:name command))]]
+        [text {:style st/staged-command-text}
+         (if (= :command type)
+           (str "!" name)
+           name)]]
        [touchable-highlight {:style   st/staged-command-cancel
                              :onPress #(cancel-command-input staged-command)}
         [image {:source res/icon-close-gray


fix test

fix test

--- test/babel/test/en.cljc
+++ test/babel/test/en.cljc
@@ -211,7 +211,8 @@
                                        :iobj {:pred :luisa}
                                        :pred :be-called
                                        :subj {:pred :lei}
-                                       :tense :present}}}
+                                       :tense :present}
+                                 :subcat '()}}
                        :truncate false)))))

 (deftest jean-s


Session options are better described as config

--- test/uruk/core_test.clj
+++ test/uruk/core_test.clj
@@ -103,143 +103,145 @@

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;; Session options
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-(defn is-default-session-options?
-  "True if given session options conform to the expected default
-  SessionOptions; false otherwise."
-  [session-options]
-  (and (is (instance? RequestOptions (:default-request-options session-options)))
-       (is (instance? RequestOptions (:effective-request-options session-options)))
-       (is (instance? Logger (:logger session-options))) ;; FIXME need better test
-       (is (nil? (:user-object session-options)))
-       (is (= 0 (:transaction-timeout session-options)))
-       (is (nil? (:transaction-mode session-options)))))
-
-(deftest default-session-options
-  (testing "A session with no explicitly-set options must have default options"
+;;;; Session configuration
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(defn is-default-session-config?
+  "True if given session configuration conforms to the expected
+  default Session; false otherwise."
+  [session]
+  (and (is (instance? RequestOptions (:default-request-options session)))
+       (is (instance? RequestOptions (:effective-request-options session)))
+       (is (instance? Logger (:logger session))) ;; FIXME need better test
+       (is (nil? (:user-object session)))
+       (is (= 0 (:transaction-timeout session)))
+       (is (nil? (:transaction-mode session)))))
+
+(deftest default-session-config
+  (testing "A session with no explicitly-set configuration must have default configuration"
     (testing "basic session creation with full database specified"
-      (is-default-session-options? (session->map (create-session db))))
+      (is-default-session-config? (session->map (create-session db))))
     (testing "session creation with URI content source"
-      (is-default-session-options? (session->map
-                                    (create-session
-                                     db (make-uri-content-source "xdbc://localhost:8383/")
-                                     {}))))
+      (is-default-session-config? (session->map
+                                   (create-session
+                                    db (make-uri-content-source "xdbc://localhost:8383/")
+                                    {}))))
     (testing "session creation with URI content source using options"
-      (is-default-session-options? (session->map
-                                    (create-session
-                                     db (make-uri-content-source
-                                         "xdbc://localhost:8383/"
-                                         {:preemptive-auth false
-                                          :default-logger (Logger/getLogger "foobar")})))))
+      (is-default-session-config? (session->map
+                                   (create-session
+                                    db (make-uri-content-source
+                                        "xdbc://localhost:8383/"
+                                        {:preemptive-auth false
+                                         :default-logger (Logger/getLogger "foobar")})))))
     (testing "session creation with hosted content source"
-      (is-default-session-options? (session->map
-                                    (create-session
-                                     db (make-hosted-content-source "localhost" 8383)
-                                     {}))))
+      (is-default-session-config? (session->map
+                                   (create-session
+                                    db (make-hosted-content-source "localhost" 8383)
+                                    {}))))
     (testing "session creation with hosted content source using options"
-      (is-default-session-options? (session->map
-                                    (create-session
-                                     db (make-hosted-content-source "localhost" 8383
-                                                                    {:content-base "TutorialDB"})
-                                     {}))))
+      (is-default-session-config? (session->map
+                                   (create-session
+                                    db (make-hosted-content-source "localhost" 8383
+                                                                   {:content-base "TutorialDB"})
+                                    {}))))
     ;; TODO once we want to delve into extreme complexity of ConnectionProvider
     ;; (testing "session creation with connectionProvider content source"
-    ;;   (is-default-session-options? (session->map
+    ;;   (is-default-session-config? (session->map
     ;;                                 (create-session
     ;;                                  db (make-cp-content-source ...)
     ;;                                  {}))))
     ;; TODO once we want to delve into extreme complexity of ConnectionProvider
     ;; (testing "session creation with connectionProvider content source with options"
-    ;;   (is-default-session-options? (session->map
+    ;;   (is-default-session-config? (session->map
     ;;                                 (create-session
     ;;                                  db (make-cp-content-source ...)
     ;;                                  {}))))
     ))

 ;; (deftest accept-only-valid-session-options
-;;   (testing "Invalid session options should throw an error"
+;;   (testing "Invalid session config options should throw an error"
 ;;     (let [sess-opts (session-options
 ;;                      (create-session db
 ;;                                      {:this-does-not-exist "irrelevant string"}))])))

-(defn as-expected-session-options?
-  [session-options expected-options]
-  (and (is (= (:timeout-millis (:default-request-options expected-options))
-              (.getTimeoutMillis (:default-request-options session-options))
-              (.getTimeoutMillis (:effective-request-options session-options))))
-       (is (instance? Logger (:logger session-options))) ;; TODO test Logger better--name?
-       (is (empty? (:user-object session-options))) ;; XXX is this all we can test user-object?
-       (is (= (:transaction-timeout session-options)
-              (:transaction-timeout expected-options)))
-       (is (= (:transaction-mode session-options)
-              (:transaction-mode expected-options)))))
-
-(deftest set-session-options
-  (testing "A session with explicitly-set options must reflect those options"
+(defn as-expected-session-config?
+  "True if given `session` is configured as according to
+  `expected-config`; false otherwise."
+  [session expected-config]
+  (and (is (= (:timeout-millis (:default-request-options expected-config))
+              (.getTimeoutMillis (:default-request-options session))
+              (.getTimeoutMillis (:effective-request-options session))))
+       (is (instance? Logger (:logger session))) ;; TODO test Logger better--name?
+       (is (empty? (:user-object session))) ;; XXX is this all we can test user-object?
+       (is (= (:transaction-timeout session)
+              (:transaction-timeout expected-config)))
+       (is (= (:transaction-mode session)
+              (:transaction-mode expected-config)))))
+
+(deftest set-session-config
+  (testing "A session with explicitly-set configuration must reflect that configuration"
     (let [opts {:default-request-options {:timeout-millis 75}
                 ;; TODO test default Req Opts more?
                 ;; TODO test effective Req Opts more?
                 :transaction-timeout 56
                 :transaction-mode :query}]
       (testing "with standard database map"
-        (as-expected-session-options? (session->map
-                                       (create-session db opts))
-                                      opts))
+        (as-expected-session-config? (session->map
+                                      (create-session db opts))
+                                     opts))
       (testing "with uri content source"
-        (as-expected-session-options? (session->map
-                                       (create-session db
-                                                       (make-uri-content-source "xdbc://localhost:8383/")
-                                                       opts))
-                                      opts))
+        (as-expected-session-config? (session->map
+                                      (create-session db
+                                                      (make-uri-content-source "xdbc://localhost:8383/")
+                                                      opts))
+                                     opts))
       (testing "with uri content source using options"
-        (as-expected-session-options? (session->map
-                                       (create-session
-                                        db (make-uri-content-source "xdbc://localhost:8383/"
-                                                                    {:preemptive-auth false})
-                                        opts))
-                                      opts))
+        (as-expected-session-config? (session->map
+                                      (create-session
+                                       db (make-uri-content-source "xdbc://localhost:8383/"
+                                                                   {:preemptive-auth false})
+                                       opts))
+                                     opts))
       (testing "with hosted content source"
-        (as-expected-session-options? (session->map
-                                       (create-session
-                                        db (make-hosted-content-source "localhost" 8383)
-                                        opts))
-                                      opts))
+        (as-expected-session-config? (session->map
+                                      (create-session
+                                       db (make-hosted-content-source "localhost" 8383)
+                                       opts))
+                                     opts))
       (testing "with hosted content source using content base"
-        (as-expected-session-options? (session->map
-                                       (create-session
-                                        db (make-hosted-content-source "localhost" 8383
-                                                                       {:content-base "TutorialDB"})
-                                        opts))
-                                      opts))
+        (as-expected-session-config? (session->map
+                                      (create-session
+                                       db (make-hosted-content-source "localhost" 8383
+                                                                      {:content-base "TutorialDB"})
+                                       opts))
+                                     opts))
       (testing "with hosted content source using user, password, content-base"
-        (as-expected-session-options? (session->map
-                                       (create-session
-                                        db (make-hosted-content-source "localhost" 8383
-                                                                       {:user "rest-admin"
-                                                                        :password "x"
-                                                                        :content-base "TutorialDB"})
-                                        opts))
-                                      opts))
+        (as-expected-session-config? (session->map
+                                      (create-session
+                                       db (make-hosted-content-source "localhost" 8383
+                                                                      {:user "rest-admin"
+                                                                       :password "x"
+                                                                       :content-base "TutorialDB"})
+                                       opts))
+                                     opts))
       (testing "with hosted content source using user and password"
-        (as-expected-session-options? (session->map
-                                       (create-session
-                                        db (make-hosted-content-source "localhost" 8383
-                                                                       {:user "rest-admin"
-                                                                        :password "x"})
-                                        opts))
-                                      opts))
+        (as-expected-session-config? (session->map
+                                      (create-session
+                                       db (make-hosted-content-source "localhost" 8383
+                                                                      {:user "rest-admin"
+                                                                       :password "x"})
+                                       opts))
+                                     opts))
       ;; TODO once we want to delve into extreme complexity of ConnectionProvider
-      ;; (as-expected-session-options? (session->map-options
+      ;; (as-expected-session-config? (session->map
       ;;                                (create-session
       ;;                                 db (make-cp-content-source ...)
       ;;                                 opts))
       ;;                               opts)
       )))

-;; TODO accept-only-valid-session-options
+;; TODO accept-only-valid-session-config

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


small fix

small fix

--- src/clj/salava/page/pdf.clj
+++ src/clj/salava/page/pdf.clj
@@ -146,7 +146,7 @@

                                                              (when (and (= "html" (:type %)) (not (= "-" (:content %))))
                                                                [:paragraph.generic {:keep-together false :align :left}
-                                                                [:chunk.bold {:size 11 :style :bold} (str (t :page/html ul) ": ")]"\n"
+                                                                [:chunk.bold {:size 11 :style :bold} (str (t :page/Html ul) ": ")]"\n"
                                                                 [:spacer 1]
                                                                 (clojure.walk/postwalk
                                                                   (fn [n] (if (:tag n) (transform-node n) n))(strip-html-tags (:content %)))"\n"


404 on non-existent sessions.

404 on non-existent sessions.

--- src/clj/shale/resources.clj
+++ src/clj/shale/resources.clj
@@ -177,12 +177,12 @@
            (and (not (false? (::new? context)))
                 (::session context)))
    :exists? (fn [context]
-              (let [session (sessions/view-model
-                              (->session-pool context)
-                              (->session-id context))]
-                (if-not (nil? session)
-                  {::session session
-                   ::id (:id session)})))})
+              (let [session-pool (->session-pool context)
+                    session-id (->session-id context)]
+                (if (sessions/view-model-exists? session-pool session-id)
+                  (if-let [session (sessions/view-model session-pool session-id)]
+                    {::session session
+                     ::id (:id session)}))))})

 (defresource session-resource [id] shared-session-resource)


Escape special characters in string fields on serialization

--- src/cljam/io/vcf/writer.clj
+++ src/cljam/io/vcf/writer.clj
@@ -49,10 +49,15 @@
     (cstr/upper-case (name k))
     (->camelCaseString k)))

+(defn- escape-special-chars [s]
+  (-> s (cstr/replace "\\" "\\\\") (cstr/replace "\"" "\\\"")))
+
 (defn- add-extra-fields
   [fields m required-keys]
   (reduce-kv (fn [fields k v]
-               (conj fields (str (->PascalCaseString k) "=\"" v "\"")))
+               (conj fields
+                     (str (->PascalCaseString k) "=\""
+                          (escape-special-chars v) "\"")))
              fields
              (apply dissoc m required-keys)))

@@ -78,17 +83,17 @@
   (-> [(str "ID=" (:id m))
        (str "Number=" (nil->dot (:number m)))
        (str "Type=" (nil->dot (:type m)))
-       (str "Description=\"" (:description m) "\"")]
-      (cond->
-        (:source m) (conj (str "Source=\"" (:source m) "\""))
-        (:version m) (conj (str "Version=\"" (:version m) "\""))
+       (str "Description=\"" (escape-special-chars (:description m)) "\"")]
+      (cond->
+        (:source m) (conj (str "Source=\"" (escape-special-chars (:source m)) "\""))
+        (:version m) (conj (str "Version=\"" (escape-special-chars (:version m)) "\""))
         (:idx m) (conj (str "IDX=" (:idx m))))
       (pack-meta-info m [:id :number :type :description :source :version :idx])))

 (defn- stringify-meta-info-filter
   [m]
   (-> [(str "ID=" (:id m))
-       (str "Description=\"" (:description m) "\"")]
+       (str "Description=\"" (escape-special-chars (:description m)) "\"")]
       (cond->
         (:idx m) (conj (str "IDX=" (:idx m))))
       (pack-meta-info m [:id :description :idx])))
@@ -98,7 +103,7 @@
   (-> [(str "ID=" (:id m))
        (str "Number=" (nil->dot (:number m)))
        (str "Type=" (nil->dot (:type m)))
-       (str "Description=\"" (:description m) "\"")]
+       (str "Description=\"" (escape-special-chars (:description m)) "\"")]
       (cond->
         (:idx m) (conj (str "IDX=" (:idx m))))
       (pack-meta-info m [:id :number :type :description :idx])))
@@ -106,7 +111,7 @@
 (defn- stringify-meta-info-alt
   [m]
   (-> [(str "ID=" (:id m))
-       (str "Description=\"" (:description m) "\"")]
+       (str "Description=\"" (escape-special-chars (:description m)) "\"")]
       (pack-meta-info m [:id :description])))

 (defn- stringify-meta-info-sample
@@ -115,7 +120,7 @@
       (cond->
         (:genomes m) (conj (str "Genomes=" (:genomes m)))
         (:mixture m) (conj (str "Mixture=" (:mixture m))))
-      (conj (str "Description=\"" (:description m) "\""))
+      (conj (str "Description=\"" (escape-special-chars (:description m)) "\""))
       (pack-meta-info m [:id :genomes :mixture :description])))

 (defn- stringify-meta-info-pedigree


fixes #297 - date parsing

fixes #297 - date parsing

--- src/cljs/swarmpit/time.cljs
+++ src/cljs/swarmpit/time.cljs
@@ -12,7 +12,7 @@

 (defn- trim-ms
   [datetime]
-  (str/replace datetime #"\.(.+)Z$" "Z"))
+  (str/replace datetime #"\.(.+)(Z|\+.*|-.*)$" "$2"))

 (defn parse
   [datetime]
@@ -43,5 +43,5 @@
     false
     (try (do (parse datetime)
              true)
-         (catch :default e
+         (catch :default _
            false))))


Use def-tuple-query in todomvc example

Use def-tuple-query in todomvc example

--- src/cljs/todomvc/rules.cljs
+++ src/cljs/todomvc/rules.cljs
@@ -1,5 +1,4 @@
 (ns todomvc.rules
-  (:require-macros [clara.macros :refer [defrule defquery defsession]])
   (:require [clara.rules :refer [insert insert-all insert! insert-all!
                                  insert-unconditional!
                                  insert-all-unconditional!
@@ -11,7 +10,7 @@
                                   qa
                                   clara-tups->maps]]
             [clara.rules.accumulators :as acc]
-            [todomvc.tuplerules :refer-macros [def-tuple-session def-tuple-rule]]))
+            [todomvc.tuplerules :refer-macros [def-tuple-session def-tuple-rule def-tuple-query]]))

 (defn todo-tx [id title done]
   (merge
@@ -100,11 +99,11 @@
 ;; Queries
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

-(defquery find-all-done []
-  [:all [[e a v]] (= e ?e) (= a ?a) (= v ?v)]
+(def-tuple-query find-all-done []
+  [[?e ?a ?v]]
   [:test (= (attr-ns ?a) "todo")])

-(defquery find-done-count []
+(def-tuple-query find-done-count []
   [?count <- (acc/count) :from [:todo/done]])

 (def-tuple-session todos 'todomvc.rules)


Renaming

Renaming

--- src/cljs/triboard/core.cljs
+++ src/cljs/triboard/core.cljs
@@ -73,16 +73,16 @@
          y (+ yi dy)
          looser nil
          taken []]
-    (let [c (get-in board [x y])]
+    (let [cell (get-in board [x y])]
       (cond
-        (is-cell-empty? c) nil ;; No move: reached end and only 1 type of cell
-        (and looser (not= looser c)) {:winner c      ;; Who wins the cells
-                                      :looser looser ;; Who looses the cells
-                                      :move [xi yi]  ;; The move performed
-                                      :taken taken}  ;; The cells taken
+        (is-cell-empty? cell) nil ;; No move: reached end and only 1 type of cell
+        (and looser (not= looser cell)) {:winner cell   ;; Who wins the cells
+                                         :looser looser ;; Who looses the cells
+                                         :move [xi yi]  ;; The move performed
+                                         :taken taken}  ;; The cells taken
         :else (recur
                 (+ x dx) (+ y dy)
-                (or looser c)
+                (or looser cell)
                 (conj taken [x y])))
       )))


remove exception from code

remove exception from code

--- src/clojure_fabric/core.clj
+++ src/clojure_fabric/core.clj
@@ -3,9 +3,6 @@
   (:use [clojure.algo.generic.functor :only (fmap)])
   (:require [clojure.string :as str])
   (:import clojure.lang.Reflector
-
-           java.io.PrintWriter
-           java.io.StringWriter
 )
   #_
   (:import clojure.lang.Reflector
@@ -40,40 +37,6 @@
            java.text.SimpleDateFormat
            java.util.Date))

-;;;
-;;; Analysis from Reverse Engineering
-;;; ===================
-;;; * All exceptions are inherited from
-;;;     org.hyperledger.fabric.sdk.exception.BaseException
-;;;     and
-;;;     org.hyperledger.fabric_ca.sdk.exception.BaseException
-;;;
-
-(defn stack->string
-  "Converts a Java stacktrace to String representation."
-  [^Exception ex]
-  (let [sw (StringWriter.)
-        pw (PrintWriter. sw)
-        _  (.printStackTrace ex pw)]
-    (.toString sw)))
-
-(defn ex->map
-  "Converts a Fablic Exception to a Clojure map with keys:
-  :error-type
-  :message
-  :stack-trace"
-  [e]
-  {:error-type   (.getName (.getClass ^Exception e))
-   :message      (.getMessage ^Exception e)
-   :stack-trace  (stack->string e)})
-
-(comment
-  (def peer-error (org.hyperledger.fabric.sdk.exception.PeerException. "Test peer error!"))
-  (try (throw peer-error)
-       (catch org.hyperledger.fabric.sdk.exception.BaseException e
-         (ex->map e)))
-
-  )


Improved layers toolbox rendering.

Improved layers toolbox rendering.

--- src/uxbox/ui/workspace/toolboxes/layers.cljs
+++ src/uxbox/ui/workspace/toolboxes/layers.cljs
@@ -18,10 +18,6 @@
 ;; Lenses
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

-(def ^:static ^:private shapes-by-id
-  (as-> (l/key :shapes-by-id) $
-    (l/focus-atom $ st/state)))
-
 (defn- focus-page
   [pageid]
   (as-> (l/in [:pages-by-id pageid]) $
@@ -73,6 +69,13 @@
   (dom/stop-propagation event)
   (let [id (:id item)]
     (rs/emit! (dw/toggle-shape-locking id))))
+
+(defn- element-icon
+  [item]
+  (case (:type item)
+    :builtin/icon (shapes/-render-svg item)
+    :builtin/rect i/box
+    :builtin/group i/folder))

 (defn- layer-element-render
   [own item selected]
@@ -84,20 +87,21 @@
      [:li {:key (str (:id item))
            :on-click select
            :class (when selected? "selected")}
-      [:div.element-list-body {:class (when selected? "selected")}
+      [:div.element-list-body
+       {:class (when selected? "selected")}
        [:div.element-actions
-        [:div.toggle-element {:class (when-not (:hidden item) "selected")
-                              :on-click toggle-visibility}
+        [:div.toggle-element
+         {:class (when-not (:hidden item) "selected")
+          :on-click toggle-visibility}
          i/eye]
-        [:div.block-element {:class (when (:blocked item) "selected")
-                             :on-click toggle-blocking}
+        [:div.block-element
+         {:class (when (:blocked item) "selected")
+          :on-click toggle-blocking}
          i/lock]]
-
        (if (:group item)
          [:div.sublevel-element i/sublevel])
-       [:div.element-icon (shapes/-render-svg item)]
-       [:span (or (:name item)
-                  (:id item))]]])))
+       [:div.element-icon (element-icon item)]
+       [:span (:name item "Unnamed")]]])))

 (def ^:static ^:private layer-element
   (mx/component
@@ -119,20 +123,24 @@
         toggle-open (fn [event]
                       (dom/stop-propagation event)
                       (swap! local assoc :open (not open?)))
-        shapes-by-id (rum/react shapes-by-id)]
+        shapes-by-id (rum/react wb/shapes-by-id)]
     (html
      [:li.group {:class (when open? "open")}
-      [:div.element-list-body {:class (when selected? "selected")
-                               :on-click select}
+      [:div.element-list-body
+       {:class (when selected? "selected")
+        :on-click select}
        [:div.element-actions
-        [:div.toggle-element {:class (when-not (:hidden item) "selected")
-                              :on-click toggle-visibility}
+        [:div.toggle-element
+         {:class (when-not (:hidden item) "selected")
+          :on-click toggle-visibility}
          i/eye]
-        [:div.block-element {:class (when (:blocked item) "selected")
-                             :on-click toggle-blocking}
+        [:div.block-element
+         {:class (when (:blocked item) "selected")
+          :on-click toggle-blocking}
          i/lock]
-        [:div.chain-element {:class (when (:locked item) "selected")
-                             :on-click toggle-locking}
+        [:div.chain-element
+         {:class (when (:locked item) "selected")
+          :on-click toggle-locking}
          i/chain]]
        [:div.element-icon i/folder]
        [:span (:name item "Unnamed group")]
@@ -142,13 +150,11 @@
         [:ul
          (for [shape (map #(get shapes-by-id %) (:items item))
                :let [key (str (:id shape))]]
-           ;; TODO: make polymorphic
-           (case (:type shape)
-             :builtin/rect (rum/with-key (layer-element shape selected) key)
-             :builtin/circle (rum/with-key (layer-element shape selected) key)
-             :builtin/line (rum/with-key (layer-element shape selected) key)
-             :builtin/icon (rum/with-key (layer-element shape selected) key)
-             :builtin/group (rum/with-key (layer-group shape selected) key)))])])))
+           (if (= (:type shape) :builtin/group)
+             (-> (layer-group shape selected)
+                 (rum/with-key key))
+             (-> (layer-element shape selected)
+                 (rum/with-key key))))])])))

 (def ^:static ^:private layer-group
   (mx/component
@@ -160,7 +166,7 @@
   [own]
   (let [workspace (rum/react wb/workspace-l)
         selected (:selected workspace)
-        shapes-by-id (rum/react shapes-by-id)
+        shapes-by-id (rum/react wb/shapes-by-id)
         page (rum/react (focus-page (:page workspace)))
         close #(rs/emit! (dw/toggle-toolbox :layers))
         copy #(rs/emit! (dw/copy-selected))
@@ -176,21 +182,16 @@
        [:ul.element-list
         (for [shape (map #(get shapes-by-id %) (:shapes page))
               :let [key (str (:id shape))]]
-          ;; TODO: make polymorphic
-          (case (:type shape)
-            :builtin/rect (rum/with-key (layer-element shape selected) key)
-            :builtin/circle (rum/with-key (layer-element shape selected) key)
-            :builtin/line (rum/with-key (layer-element shape selected) key)
-            :builtin/icon (rum/with-key (layer-element shape selected) key)
-            :builtin/group (rum/with-key (layer-group shape selected) key)))]]
+          (if (= (:type shape) :builtin/group)
+            (-> (layer-group shape selected)
+                (rum/with-key key))
+            (-> (layer-element shape selected)
+                (rum/with-key key))))]]
       [:div.layers-tools
        [:ul.layers-tools-content
-        [:li.clone-layer {:on-click copy}
-         i/copy]
-        [:li.group-layer {:on-click group}
-         i/folder]
-        [:li.delete-layer {:on-click delete}
-         i/trash]]]])))
+        [:li.clone-layer {:on-click copy} i/copy]
+        [:li.group-layer {:on-click group} i/folder]
+        [:li.delete-layer {:on-click delete} i/trash]]]])))

 (def ^:static layers-toolbox
   (mx/component


fix cdn image upload.

fix cdn image upload.

--- s3/src/s3/core.clj
+++ s3/src/s3/core.clj
@@ -33,8 +33,10 @@
           (is-authenticated?
            cookies
            (let [user (user-from-cookie cookies)
-                 cdn-url (put-file user (:image params))]
-             (redirect (str upload-url "?o=" (url-encode cdn-url)))))))
+                 cdn-url (put-file user (:file params))]
+             {:status 200
+              :headers {"Content-Type" "text/plain"}
+              :body (url-encode cdn-url)}))))
   (resources "/")
   (not-found "not found"))


Revert "Adding support for test-ns-hook functionality of clojure.test."

This reverts commit d6f98fd74020b2e6870968a5c4df3d8114cf12f6.

--- bake/bake/test.clj
+++ bake/bake/test.clj
@@ -33,33 +33,28 @@
              (notify (str (class e) ": " (.getMessage e))))
            (reset! last-exception (System/currentTimeMillis))))))

-(defn- do-all-tests [opts ns]
-  (let [tests  (seq (filter (run? opts ns) (ns-publics ns)))
-        ns-meta (meta (find-ns ns))
-        once-fixtures (join-fixtures (:clojure.test/once-fixtures ns-meta))
-        each-fixtures (join-fixtures (:clojure.test/each-fixtures ns-meta))]
-    (once-fixtures
-      (fn []
-        (doseq [[name f] tests]
-          (each-fixtures #(test-var f)))))))
-
 (defn run-ns-tests [opts ns]
   (require ns)
-  (binding [*test-out* (StringWriter.)
-            *report-counters* (ref *initial-report-counters*)]
-    (report {:type :begin-test-ns :ns ns})
-    (if-let [hook (get (ns-publics ns) 'test-ns-hook)]
-      (hook)
-      (do-all-tests opts ns))
-    (report (assoc @*report-counters* :type :summary))
-    (let [failed?  (< 0 (apply + (map @*report-counters* [:fail :error])))
-          test-out (.toString *test-out*)]
-      (if (:autotest opts)
-        (when failed?
-          (notify test-out))
-        (do (print test-out)
-          (flush)))
-      failed?)))
+  (when-let [tests (seq (filter (run? opts ns) (ns-publics ns)))]
+    (let [ns-meta (meta (find-ns ns))
+          once-fixtures (join-fixtures (:clojure.test/once-fixtures ns-meta))
+          each-fixtures (join-fixtures (:clojure.test/each-fixtures ns-meta))]
+      (binding [*test-out* (StringWriter.)
+                *report-counters* (ref *initial-report-counters*)]
+        (report {:type :begin-test-ns :ns ns})
+        (once-fixtures
+         (fn []
+           (doseq [[name f] tests]
+             (each-fixtures #(test-var f)))))
+        (report (assoc @*report-counters* :type :summary))
+        (let [failed?  (< 0 (apply + (map @*report-counters* [:fail :error])))
+              test-out (.toString *test-out*)]
+          (if (:autotest opts)
+            (when failed?
+              (notify test-out))
+            (do (print test-out)
+                (flush)))
+          failed?)))))

 (defn run-project-tests [namespaces opts]
   (when (:autotest opts)


Bump plugin version in sample project

Bump plugin version in sample project

--- sample/project.clj
+++ sample/project.clj
@@ -10,7 +10,7 @@
   :java-source-paths ["src/java"]
   :javac-options ["-target" "1.6" "-source" "1.6" "-Xlint:-options"]

-  :plugins [[lein-droid "0.4.3"]]
+  :plugins [[lein-droid "0.4.5-SNAPSHOT"]]

   :dependencies [[org.clojure-android/clojure "1.7.0-RC1" :use-resources true]
                  ;; [com.google.android.gms/play-services "7.0.0" :extension "aar"]


Work in terms of maps so merge-with use is correct

--- src/advent_2017/day_06.cljc
+++ src/advent_2017/day_06.cljc
@@ -9,7 +9,8 @@
 (def data (as-> input x (str/trim x) (str/split x #"\t") (mapv read-string x)))

 (defn redistribute [banks]
-  (let [max-ndx     (.indexOf banks (apply max banks))
+  (let [max-val     (apply max (vals banks))
+        max-ndx     (apply min (keep (fn [[k v]] (when (= max-val v) k)) banks))
         target-ndxs (map #(mod (+ max-ndx 1 %) (count banks))
                       (range (banks max-ndx)))]
     (merge-with + (assoc banks max-ndx 0) (frequencies target-ndxs))))
@@ -19,7 +20,7 @@
             (if (last-seen banks)
               (reduced [steps (last-seen banks)])
               [(assoc last-seen banks steps) (redistribute banks)]))
-    [{} banks]
+    [{} (zipmap (range) banks)]
     (range)))

 (defn part-1 []


Formatting

Formatting

--- src/branch_handler/core.clj
+++ src/branch_handler/core.clj
@@ -12,18 +12,18 @@

 (ns branch-handler.core)

-(require '[ring.adapter.jetty      :as jetty])
-(require '[ring.middleware.params  :as http-params])
-(require '[ring.util.response      :as http-response])
-
-(require '[clojure.string          :as string])
-(require '[clojure.java.shell      :as shell])
-(require '[clojure.data.json       :as json])
-
-(require '[clojure.tools.cli       :as cli])
-(require '[clojure.tools.logging   :as log])
-
-(require '[clj-fileutils.fileutils :as file-utils])
+(require '[ring.adapter.jetty          :as jetty])
+(require '[ring.middleware.params      :as http-params])
+(require '[ring.util.response          :as http-response])
+
+(require '[clojure.string              :as string])
+(require '[clojure.java.shell          :as shell])
+(require '[clojure.data.json           :as json])
+
+(require '[clojure.tools.cli           :as cli])
+(require '[clojure.tools.logging       :as log])
+
+(require '[clj-fileutils.fileutils     :as file-utils])
 (require '[clj-jenkins-api.jenkins-api :as jenkins-api])

 (def verbose


Fix bug where order by does not maintain order of columns

--- src/cfpb/qu/query/mongo.clj
+++ src/cfpb/qu/query/mongo.clj
@@ -98,7 +98,7 @@
                                [field 1]
                                [field -1])))
                       flatten
-                      (apply sorted-map))]
+                      (apply array-map))]
         (assoc-in query [:mongo :sort] sort))
       query)))


minor

minor

--- src/client/pages/login.cljs
+++ src/client/pages/login.cljs
@@ -45,8 +45,8 @@
 ;; Events
 ;;------------------------------------------------------------------------------

-(defn- on-form-submit [e]
-  (.preventDefault e)
+(defn- on-form-submit [js-evt]
+  (.preventDefault js-evt)
   (let [username (dom/get-value "nameInput")]
     ;; TODO: more username validation here
     (when (not= username "")


remove page assembler

remove page assembler

--- src/clj/ceres/assembler.clj
+++ src/clj/ceres/assembler.clj
@@ -1 +0,0 @@
-(ns ceres.assembler)


safe-exec-cfg to participate in clojure's REQUIRE_LOCK #97 (#98)

--- src/clj/datasplash/core.clj
+++ src/clj/datasplash/core.clj
@@ -126,8 +126,9 @@
        (catch Exception e#
          ;; if var is unbound, nothing has been required
          (let [required-at-start# (try-deref required-ns)]
-           ;; lock on something that should exist!
-           (locking #'locking
+           ;; About the use of clojure.lang.RT/REQUIRE_LOCK
+           ;; https://ask.clojure.org/index.php/9893/require-is-not-thread-safe?show=9902#c9902
+           (locking clojure.lang.RT/REQUIRE_LOCK
              (let [already-required# (try-deref required-ns)]
                (let [nss# (unloaded-ns-from-ex e#)]
                  (log/debugf "Catched Exception %s at runtime with message -> %s => already initialized : %s / candidates for init : %s"


defonce'ing app state #2

defonce'ing app state #2

--- src/cljs/go_client/app.cljs
+++ src/cljs/go_client/app.cljs
@@ -23,7 +23,7 @@
                                    [:white [6 15]]])

 ;;global state
-(def ^:private state (atom {:game ear-reddening-game}))
+(defonce ^:private state (atom {:game ear-reddening-game}))

 ;;cursors
 (def game (cursor state [:game]))


Assorted sorting works sort of works

Assorted sorting works sort of works

--- src/cljs/repodoc/utils.cljs
+++ src/cljs/repodoc/utils.cljs
@@ -139,8 +139,15 @@
   by adding path separator"
   [paths]
   (map #(str "/" (clojure.string/join "/" %))
-       (sort-paths
-         (expand-paths paths))))
+       (expand-paths paths)))
+
+(defn dsu-sort-2
+  [comparator decorator sortable]
+  (map last
+       (sort comparator
+             (map (fn [x]
+                    [(decorator x) x])
+                  sortable))))

 (defn create-git-tree
   "Creates a list of maps for
@@ -148,6 +155,32 @@
   [paths]
   (let [dirfiles (path-reduce paths)
         paths (pathify (keys dirfiles))]
-    (map (fn [p]
-           {p (get dirfiles p)})
-         paths)))
+    (flatten
+      (into
+        (map (fn [p]
+               {"path" p "type" "tree"}) paths)
+        (vals dirfiles)))))
+
+(defn vector-compare-2 [val1 val2]
+  "From http://stackoverflow.com/questions/15716894/"
+  (let [value1 (first val1)
+        value2 (first val2)
+        result (apply compare (cut-vec value1 value2))]
+    (println result value1 (count value1) value2 (count value2))
+    (cond
+      (not (= result 0)) result
+      (nil? value1) 0 ; value2 will be nil as well
+      :else (let [c1 (count value1)
+                  c2 (count value2)]
+              (println "sorting else" result value1 c1 value2 c2)
+              (cond
+                (< c1 c2) -1
+                (> c1 c2) 1
+                :else 0)))))
+
+(defn sort-git-tree
+  [tree]
+  (dsu-sort-2
+    vector-compare
+    (fn [p] (let [[_ & dirs] (clojure.string/split (get p "path") #"/")] (vec dirs)))
+    tree))


Minor simplification

Minor simplification

--- src/cljs/triboard/core.cljs
+++ src/cljs/triboard/core.cljs
@@ -60,7 +60,7 @@
 (defn ^boolean is-cell-empty?
   "Indicates whether a cell is owned by any player"
   [cell]
-  (or (= cell :empty) (= cell :wall)))
+  (or (nil? cell) (= cell :empty) (= cell :wall)))

 (defn available-cells-by-dir
   "Indicates the convertible cells when clicking at [x y], and returns:
@@ -73,7 +73,7 @@
          y (+ yi dy)
          looser nil
          taken []]
-    (if-let [c (get-in board [x y])]
+    (let [c (get-in board [x y])]
       (cond
         (is-cell-empty? c) nil ;; No move: reached end and only 1 type of cell
         (and looser (not= looser c)) {:winner c      ;; Who wins the cells
@@ -84,7 +84,7 @@
                 (+ x dx) (+ y dy)
                 (or looser c)
                 (conj taken [x y])))
-      nil)))
+      )))

 (defn available-moves-at
   "Provides the list of moves that can be done from a cell"


Refactoring

Refactoring

--- src/cljs/triboard/core.cljs
+++ src/cljs/triboard/core.cljs
@@ -114,6 +114,14 @@
    :looser :empty
    :taken [pos]})

+(defn available-moves-xf
+  "Transducer to get available moves on the map"
+  [board]
+  (comp
+    (filter #(= (get-in board %) :empty))
+    (mapcat #(available-moves-at board %))
+    ))
+
 (defn with-available-moves ;; TODO - This should be optimized: much too slow (40-60 ms)
   "Compute all available moves on the board.
    And group these positions by player then by position
@@ -126,14 +134,11 @@
        :taken [[0 4]]})}}"
   [{:keys [board] :as game}]
   (assoc game :moves
-    (time
-      (transduce
-        (comp
-          (filter #(= (get-in board %) :empty))
-          (mapcat #(available-moves-at board %)))
-        #(update-in %1 [(:winner %2) (:move %2)] conj %2)
-        {}
-        all-positions)) ;; TODO - To optimize, just consider the move of the current player?
+    (transduce
+      (available-moves-xf board)
+      #(update-in %1 [(:winner %2) (:move %2)] conj %2)
+      {}
+      all-positions) ;; TODO - To optimize, just consider the move of the current player?
     ))


Correctly set faction/player-type when game starts

--- src/cljs/zetawar/views.cljs
+++ src/cljs/zetawar/views.cljs
@@ -314,8 +314,9 @@
         [:label {:for "player-type"}
          (translate :player-type-label)]
         (into [:select.form-control {:id "player-type"
-                                     :selected (or @selected-player-type
-                                                   (:faction/player-type @faction))
+                                     :value (or @selected-player-type
+                                                (some-> @faction :faction/player-type name)
+                                                "")
                                      :on-change select-player-type}]
               (for [[player-type-id {:keys [description ai]}] players/player-types]
                 [:option {:value (name player-type-id)}


Use more labels and add abbrs for each group of info

--- src/cljs/zetawar/views.cljs
+++ src/cljs/zetawar/views.cljs
@@ -288,21 +288,33 @@
 (defn status-info [{:as view-ctx :keys [conn translate]}]
   [:div
    (let [[sel-q sel-r] @(subs/selected-hex conn)
-         [tar-q tar-r] @(subs/targeted-hex conn)]
+         [tar-q tar-r] @(subs/targeted-hex conn)
+         [sel-mc sel-at sel-ar] @(subs/selected-terrain-effects conn)
+         [tar-mc tar-at tar-ar] @(subs/targeted-terrain-effects conn)]
      [:span
-      "Selected: "
+      (translate :selected-label)
       (if sel-q
-        (str
-         sel-q "," sel-r " "
-         "(" (string/join "," @(subs/selected-terrain-effects conn)) ")")
-        " -")
+        [:span
+         [:abbr {:title (translate :tile-coordinates-label) :style {:cursor "inherit"}}
+          (str sel-q "," sel-r)]
+         (if sel-mc ;; If selected doesn't contain a unit
+           [:span
+            " ("
+            [:abbr {:title (translate :terrain-effects-label) :style {:cursor "inherit"}}
+             (str sel-mc "," sel-at "," sel-ar)]
+            ")"])]
+        [:span " -"])
       " • "
-      "Targeted: "
+      (translate :targeted-label)
       (if tar-q
-        (str
-         tar-q "," tar-r " "
-         "(" (string/join "," @(subs/targeted-terrain-effects conn)) ")")
-        " -")])])
+        [:span
+         [:abbr {:title (translate :tile-coordinates-label) :style {:cursor "inherit"}}
+          (str tar-q "," tar-r)]
+         " ("
+         [:abbr {:title (translate :terrain-effects-label) :style {:cursor "inherit"}}
+          (str tar-mc "," tar-at "," tar-ar)]
+         ")"]
+        [:span " -"])])])

 (def armor-type-abbrevs
   {:unit-type.armor-type/personnel "P"


remove debug file output

remove debug file output

--- src/cljs_api_gen/result.clj
+++ src/cljs_api_gen/result.clj
@@ -106,7 +106,6 @@
   ([lib-parsed] (get-result lib-parsed nil))
   ([lib-parsed prev-result]
    (let [lib-items (transform-items lib-parsed)
-         _ (spit "test" (keys lib-items))
          library-api (make-api-result lib-items :library-api prev-result)]

      {:release {:cljs *cljs-version*  ;; clojurescript version


Add my clear-env utility function

Add my clear-env utility function

--- src/clojure/oxcart/util.clj
+++ src/clojure/oxcart/util.clj
@@ -18,6 +18,7 @@
              :refer [macroexpand-1
                      macroexpand]
              :as ana]
+            [clojure.tools.analyzer.ast :refer [prewalk]]
             [clojure.tools.analyzer.passes.elide-meta
              :refer [elides]]))

@@ -39,6 +40,11 @@
        (-> (binding [macroexpand-1 ana.jvm/macroexpand-1]
              (macroexpand form env))
            (ana.jvm/analyze env)))))
+
+
+(defn clear-env
+  [ast]
+  (prewalk ast #(dissoc %1 :env)))

 (defn take-when


Tweaked a comment.

Tweaked a comment.

--- src/clojush/examples/wc.clj
+++ src/clojush/examples/wc.clj
@@ -355,7 +355,7 @@
     (println ";;******************************")
     )) ;; To do validation, could have this function return an altered best individual
        ;; with total-error > 0 if it had error of zero on train but not on validation
-       ;; set. Would need a third category of data cases.
+       ;; set. Would need a third category of data cases, or a defined split of training cases.

 ; Define the argmap
 (def argmap


Added echo rest context as another config parameter.

--- src/cmr/transmit/config.clj
+++ src/cmr/transmit/config.clj
@@ -48,7 +48,7 @@
    :echo-rest {:protocol "http"
                :host (cfg/config-value :echo-rest-host "localhost")
                :port (echo-rest-port)
-               :context ""}})
+               :context (cfg/config-value :echo-rest-context "")}})

 (defn app-connection-system-key-name
   "The name of the app connection in the system"


fixed to return a flat sequence of documents; small refactoring

--- src/corpus_utils/kokken.clj
+++ src/corpus_utils/kokken.clj
@@ -6,6 +6,7 @@
             [me.raynes.fs :as fs]
             [schema.core :as s]
             [schema.macros :as sm]
+            [corpus-utils.text :as text]
             [corpus-utils.document :refer [DocumentSchema]]))

 ;; :sentence -> :s
@@ -90,9 +91,37 @@
        (into [])
        #_((fn [a] (doto a println)))))

-(sm/defn parse :- [DocumentSchema]
+(defonce ndc-map (into {} (text/read-tsv-URL (io/resource "ndc-3digits.tsv") false)))
+
+(sm/defn parse-document :- DocumentSchema
+  [corpus :- s/Str
+   year :- s/Str
+   number :- s/Str
+   filename :- java.io.File
+   article-loc :- s/Any #_{:tag s/Keyword :content s/Any :attrs s/Any}]
+  (let [[title author title-alt style genre] ((juxt :題名 :著者 :欄名 :文体 :ジャンル) (:attrs (z/node article-loc)))]
+    {:paragraphs
+     (->> article-loc
+          z/down
+          (iterate z/right)
+          (take-while (complement nil?))
+          ;;(take 2)
+          (mapcat partition-by-paragraph)
+          (map (fn [text] {:tags #{}
+                          :sentences text}))
+          (into []))
+     :metadata
+     {:title     title
+      :author    author
+      :publisher corpus
+      :year      (Integer/parseInt year)
+      :basename  (fs/base-name filename ".xml")
+      :corpus    corpus
+      :category  [(get ndc-map (str/replace genre #"^NDC" "") "分類なし")]}}))
+
+(sm/defn parse-document-seq :- [DocumentSchema]
   "Each XML file from The Sun corpus contains several articles, so we return a vector of documents."
-  [filename :- s/Str]
+  [filename :- java.io.File]
   (let [root-loc (-> filename
                      io/input-stream
                      xml/parse
@@ -100,35 +129,16 @@
         [corpus year number] ((juxt :雑誌名 :年 :号) (-> root-loc z/node :attrs ))]
     (->> root-loc
          z/down ;; Descend to the :記事 level.
-         (iterate z/right) ;; FIXME broken
-         ;;(take 2)
+         (iterate z/right) ;; FIXME broken. Should be a lazyseq of documents
          ;; Documents can be empty...
          (remove nil?)
-         (map (fn [article-loc]
-                (let [[title author title-alt style genre] ((juxt :題名 :著者 :欄名 :文体 :ジャンル) (:attrs (z/node article-loc)))]
-                  {:paragraphs
-                   (->> article-loc
-                        z/down
-                        (iterate z/right)
-                        (take-while (complement nil?))
-                        ;;(take 50)
-                        (mapcat partition-by-paragraph)
-                        (map (fn [text] {:tags #{}
-                                        :sentences text}))
-                        (into []))
-                   :metadata
-                   {:title     title
-                    :author    author
-                    :publisher corpus
-                    :year      (Integer/parseInt year)
-                    :basename  (fs/base-name filename ".xml")
-                    :corpus    corpus
-                    :category  [corpus genre]}}))))))
+         (take 5)
+         (map (partial parse-document corpus year number filename)))))

 (sm/defn document-seq
   [data-dir :- s/Str]
   (->> (fs/glob (str data-dir "/*.xml"))
-       (map parse)))
+       (mapcat parse-document-seq)))

 ;;(parse "/data/taiyo-corpus/XML/t189506.xml")
 ;;(sm/with-fn-validation (parse "/data/taiyo-corpus/XML/t189506.xml"))


Autoencoder edits. Currently broken I think?

--- src/cortex/impl/layers.cljc
+++ src/cortex/impl/layers.cljc
@@ -386,7 +386,8 @@
   cp/PNeuralTraining
     (forward [this input]
       (m/assign! input-tmp input)
-      (m/emap! noise-fn input-tmp) ;; input-tmp contains input with noise
+      ;; TODO: figure out how to apply noise
+      ;; (m/emap! noise-fn input-tmp) ;; input-tmp contains input with noise
       (let [noise-up (cp/calc up input-tmp)
             _ (m/assign! output-tmp (cp/output noise-up)) ;; output-tmp contains noisy output from up
             up (cp/forward up input)


Add docstring to coercions namespace

Add docstring to coercions namespace

--- src/compojure/coercions.clj
+++ src/compojure/coercions.clj
@@ -1,4 +1,5 @@
-(ns compojure.coercions)
+(ns compojure.coercions
+  "Functions for coercing route parameters into different types.")

 (defn as-int
   "Parse a string into an integer, or nil if the string cannot be parsed."


Okay, no map

Okay, no map

--- src/discuss/extensions.cljs
+++ src/discuss/extensions.cljs
@@ -1,12 +1,5 @@
 (ns discuss.extensions
   "Extending JS types to be better accessible in CLJS.")
-
-(def types [js/NodeList
-            js/HTMLCollection
-            js/HTMLDocument
-            js/HTMLDivElement
-            js/HTMLParagraphElement
-            js/HTMLSpanElement])

 (defn extend-type-fn
   "Given a type t, apply extensions."
@@ -36,4 +29,9 @@
       ([array f start]
        (ci-reduce array f start)))))

-(map #(extend-type-fn %) types)+(extend-type-fn js/NodeList)
+(extend-type-fn js/HTMLCollection)
+(extend-type-fn js/HTMLDocument)
+(extend-type-fn js/HTMLDivElement)
+(extend-type-fn js/HTMLParagraphElement)
+(extend-type-fn js/HTMLSpanElement)


add a clojure.test/is predicate, yay?

add a clojure.test/is predicate, yay?

--- pedestal-app/test/semtag_web/integration_test.clj
+++ pedestal-app/test/semtag_web/integration_test.clj
@@ -29,6 +29,19 @@
   (original-report m)
   (taxi/take-screenshot :file (screenshot-file ".clojure-test-error-")))

+;; clojure.test/is predicate just to generate a message
+(defmethod ctest/assert-expr 'ends-with? [msg form]
+  `(let [string# ~(nth form 1)
+         ending# ~(nth form 2)
+         msg# (format "Expected %s to end with %s" string# ending#)]
+     (let [result# (.endsWith string# ending#)]
+       (if result#
+         (ctest/do-report {:type :pass, :message msg#,
+                           :expected '~form, :actual nil})
+         (ctest/do-report {:type :fail, :message msg#,
+                           :expected '~form, :actual nil}))
+       result#)))
+
 (use-fixtures :each
               (fn [f]
                 (taxi/set-driver! (init-driver {:webdriver (PhantomJSDriver. (DesiredCapabilities. ))}))
@@ -50,7 +63,7 @@
   (Thread/sleep 500))

 (defn url-ends-with [& args]
-  (is (.endsWith (taxi/current-url) (apply app-url args))))
+  (is (ends-with? (taxi/current-url) (apply app-url args))))

 (deftest navbar-links-work
   (url-ends-with "")


Make instrument increment ip and is

Make instrument increment ip and is

Signed-off-by: Yen-Chin Lee <082d453d72dce940e12089a4ad48b97cfe1f3ec4@gmail.com>

--- src/emulator_4917/core.cljc
+++ src/emulator_4917/core.cljc
@@ -40,58 +40,58 @@
 (defn cmd2
   [{:keys [memory r0 r1 ip is]}]
   (make-cpu
-   :memory memory :r0 (- r0 r1) :r1 r1 :ip ip :is is))
+   :memory memory :r0 (- r0 r1) :r1 r1 :ip (inc ip) :is 2))

 ;; cmd 3: R0 = R0 + 1
 (defn cmd3
   [{:keys [memory r0 r1 ip is]}]
   (make-cpu
-   :memory memory :r0 (inc r0) :r1 r1 :ip ip :is is))
+   :memory memory :r0 (inc r0) :r1 r1 :ip (inc ip) :is 3))

 ;; cmd 4: R1 = R1 + 1
 (defn cmd4
   [{:keys [memory r0 r1 ip is]}]
   (make-cpu
-   :memory memory :r0 r0 :r1 (inc r1) :ip ip :is is))
+   :memory memory :r0 r0 :r1 (inc r1) :ip (inc ip) :is 4))

 ;; cmd 5: R0 = R0 - 1
 (defn cmd5
   [{:keys [memory r0 r1 ip is]}]
   (make-cpu
-   :memory memory :r0 (dec r0) :r1 r1 :ip ip :is is))
+   :memory memory :r0 (dec r0) :r1 r1 :ip (inc ip) :is 5))

 ;; cmd 6: R1 = R1 - 1
 (defn cmd6
   [{:keys [memory r0 r1 ip is]}]
   (make-cpu
-   :memory memory :r0 r0 :r1 (dec r1) :ip ip :is is))
+   :memory memory :r0 r0 :r1 (dec r1) :ip (inc ip) :is 6))

 ;; cmd 7: Ring bell
 (defn cmd7
   [{:keys [memory r0 r1 ip is]}]
   (println "Ring the bell!!")
   (make-cpu
-   :memory memory :r0 r0 :r1 r1 :ip ip :is is))
+   :memory memory :r0 r0 :r1 r1 :ip (inc ip) :is 7))

 ;; cmd 8: Print <data>
 (defn cmd8
   [{:keys [memory r0 r1 ip is]}]
   (println (nth memory (inc ip)))
   (make-cpu
-   :memory memory :r0 r0 :r1 r1 :ip ip :is is))
+   :memory memory :r0 r0 :r1 r1 :ip (+ ip 2) :is 8))

 ;; cmd 9: Load value from <data> to R0
 (defn cmd9
   [{:keys [memory r0 r1 ip is]}]
   (make-cpu
-   :memory memory :r1 r1 :ip ip :is is
+   :memory memory :r1 r1 :ip (+ ip 2) :is 9
    :r0 (nth memory (nth memory (inc ip)))))

 ;; cmd 10: Load value from <data> to R1
 (defn cmd10
   [{:keys [memory r0 r1 ip is]}]
   (make-cpu
-   :memory memory :r0 r0  :ip ip :is is
+   :memory memory :r0 r0 :ip (+ ip 2) :is 10
    :r1 (nth memory (nth memory (inc ip)))))

 ;; cmd 11: Store R0 into <data> position
@@ -99,20 +99,20 @@
   [{:keys [memory r0 r1 ip is]}]
   (make-cpu
    :memory (assoc memory (nth memory (inc ip)) r0)
-   :r0 r0 :r1 r1 :ip ip :is is))
+   :r0 r0 :r1 r1 :ip (+ ip 2) :is 11))

 ;; cmd 12: Store R1 into <data> position
 (defn cmd12
   [{:keys [memory r0 r1 ip is]}]
   (make-cpu
    :memory (assoc memory (nth memory (inc ip)) r1)
-   :r0 r0 :r1 r1 :ip ip :is is))
+   :r0 r0 :r1 r1 :ip (+ ip 2) :is 12))

 ;; cmd 13: jump to address <data>
 (defn cmd13
   [{:keys [memory r0 r1 ip is]}]
   (make-cpu
-   :memory memory :r0 r0 :r1 r1 :ip (nth memory (inc ip)) :is is))
+   :memory memory :r0 r0 :r1 r1 :ip (nth memory (inc ip)) :is 13))

 ;; cmd 14: jump to address <data> if R0 == 0
 (defn cmd14
@@ -120,8 +120,8 @@
   (make-cpu
    :memory memory :r0 r0 :r1 r1
    :ip (if (zero? r0)
-         (nth memory (inc ip)) ip)
-   :is is))
+         (nth memory (inc ip)) (+ ip 2))
+   :is 14))

 ;; cmd 15: jump to address <data> if R0 != 0
 (defn cmd15
@@ -129,9 +129,10 @@
   (make-cpu
    :memory memory :r0 r0 :r1 r1
    :ip (if (zero? r0)
-         ip
+         (+ ip 2)
          (nth memory (inc ip)))
-   :is is))
+   :is 15))
+

 (defn to-4bit-array
   "Convert 0xf4 to [f 4]"


Adding proper flow to handle stopping deletion gracefully

--- src/hasta_la_vista/core.clj
+++ src/hasta_la_vista/core.clj
@@ -156,9 +156,10 @@
             ^String               view-name             (:view-name view-config)
             ^PersistentHashMap    query-options         (:query-options view-config)
             ^Long                 batch-size            (:batch-size view-config)
-            ^Long                 thread-count          (get-in config [:ok :hasta-la-vista :thread-count])
-            ^Long                 thread-wait           (get-in config [:ok :hasta-la-vista :thread-wait])
-                                                                                ]
+            ^Long                 thread-count          (get-in config [:ok :hasta-la-vista :thread-count     ])
+            ^Long                 thread-wait           (get-in config [:ok :hasta-la-vista :thread-wait      ])
+            ^Long                 channel-timeout       (get-in config [:ok :hasta-la-vista :channel-timeout  ])
+                                                                                ]

       (log/info (client/get-available-servers client))

@@ -170,7 +171,7 @@
               (go-loop []
                 (let [  ids       (blocking-consumer work-chan)
                         start     (. System (nanoTime))
-                        _         (doall (pmap #(client/delete client-del %) ids))
+                        _         (doseq [id ids] (client/delete client-del id))
                         exec-time (with-precision 3 (/ (- (. System (nanoTime)) start) 1000000.0))
                         perf      (/ (count ids) exec-time) ]
                   ;; send results to stat-chan
@@ -190,9 +191,18 @@
         (let [ids (map client/view-id r)]
           (blocking-producer work-chan ids)))

-      ;; shutting down the client & the main thread
-      (client/shutdown client)
-      (exit 0)
+      ;; wait till the last message is read
+      (while true
+        (blocking-consumer
+          (go
+            (let [[result source] (alts! [stat-chan (timeout channel-timeout)])]
+              (if (= source stat-chan)
+                (log/info result)
+                ;else - timeout
+                (do
+                  (log/info "Channel timed out. Stopping...")
+                  (client/shutdown client)
+                  (exit 0)))))))

     ;; end main
     )))


WM: Add btn-default class to submission view buttons; closes #68

--- src/hatti/views/record.cljs
+++ src/hatti/views/record.cljs
@@ -32,7 +32,7 @@
         new-rank ((case dir :left dec :right inc) cur-rank)]
     [:a {:on-click (click-fn
                     #(put! shared/event-chan {:submission-to-rank new-rank}))
-         :class "pure-button" :href "#"} [:i {:class icon}]]))
+         :class "pure-button btn-default" :href "#"} [:i {:class icon}]]))

 (defn submission-closer []
   [:a {:on-click (click-fn


in (defn json-value-converter), check for keys' being strings

--- src/babel/reader.clj
+++ src/babel/reader.clj
@@ -411,7 +411,11 @@
              (= k :espanol)
              (= k :français)
              (= k :italiano)
-             (= k :latin))
+             (= k "english")
+             (= k "espanol")
+             (= k "français")
+             (= k "italiano")
+             (= k "latin"))
          (not (map? v)))
     (str v)


Add skip-last, concat-reduce, flatten

Add skip-last, concat-reduce, flatten

--- src/beicon/core.cljs
+++ src/beicon/core.cljs
@@ -2,7 +2,7 @@
   (:refer-clojure :exclude [true? map filter reduce merge repeat first
                             last mapcat repeatedly zip dedupe drop
                             take take-while map-indexed concat empty
-                            delay range throw do trampoline subs])
+                            delay range throw do trampoline subs flatten])
   (:require [beicon.impl.rxjs]
             [beicon.impl.rxjs-operators]
             [cljs.core :as c]))
@@ -415,6 +415,11 @@
   other observable sequence produces a value."
   [pob ob]
   (pipe ob (.skipUntil ^js rxop pob)))
+
+(defn skip-last
+  "Skip a specified number of values before the completion of an observable."
+  [n ob]
+  (.pipe ob (.skipLast ^js rxop (int n))))

 (defn take
   "Bypasses a specified number of elements in an observable sequence and
@@ -717,6 +722,25 @@
   [ms]
   (.interval rx ms))

+(defn flatten
+  "Just like clojure collections flatten but for rx streams. Given a stream
+  off collections will emit every value separately"
+  [ob]
+  (pipe ob (.concatMap ^js rxop identity)))
+
+(defn concat-reduce
+  "Like reduce but accepts a function that returns a stream. Will use as
+  value for the next step in the reduce the last valued emited by the stream
+  in the function."
+  [f seed ob]
+  (let [current-acc (atom seed)]
+    (->> (concat
+          (of seed)
+          (->> ob
+               (mapcat #(f @current-acc %))
+               (tap #(reset! current-acc %))))
+         (last))))
+
 ;; --- Schedulers

 (defn scheduler


Make network comms more robust.

Make network comms more robust.

--- src/defragment/hubzilla.clj
+++ src/defragment/hubzilla.clj
@@ -10,19 +10,18 @@
    {:keys [basename date encoder duration artist title link length] :as rec}]
   (log/info "sending to hubzilla" basename)
   (if (every? (comp not empty?) [date duration artist title link])
-    (let [{:keys [body headers]}
-          (try
-            (client/post url
-                         {:basic-auth [login pw]
-                          :throw-entire-message? true
-                          :as :json
-                          :retry-handler utils/retry
-                          :form-params {:title (format "%s - %s" title artist)
-                                        :status (format "%s - %s\n %s\n[audio]%s[/audio]"
-                                                        title artist duration link)}})
-            (catch Exception e
-              (log/error e)))]
-      ;; TODO: if i don't get JSON back, retry a few times?
+    (when-let [{:keys [body headers]}
+               (try
+                 (client/post url
+                              {:basic-auth [login pw]
+                               :throw-entire-message? true
+                               :as :json
+                               :retry-handler utils/retry
+                               :form-params {:title (format "%s - %s" title artist)
+                                             :status (format "%s - %s\n %s\n[audio]%s[/audio]"
+                                                             title artist duration link)}})
+                 (catch Exception e
+                   (log/error e)))]
       (log/debug "sent to hubzilla" body  " --> " headers))
     (do
       (log/error rec)


heroku deploy

heroku deploy

--- src/cai/outgoing.clj
+++ src/cai/outgoing.clj
@@ -25,7 +25,6 @@
     [{:action "typing_on"}
      {:message (templates/text-message clever_output)}]))

-
 (defn reply-to-image [sender-id image-url]
   (let [days (mod (reduce + (map #(int %) (seq image-url))) (* 3 365))
         date (time/minus (time/now) (time/days days))
@@ -41,7 +40,6 @@
        {:message (templates/image-message url)}
        {:message (templates/text-message url)})]))

-
 (defn reply-to-audio-or-video [sender-id url]
   (let [text (speech-api/stt url)
         cs-old (get-in @user-map [(keyword sender-id) :cs])


Fix for memory vector

Fix for memory vector

Signed-off-by: Yen-Chin Lee <082d453d72dce940e12089a4ad48b97cfe1f3ec4@gmail.com>

--- src/emulator_4917/core.cljc
+++ src/emulator_4917/core.cljc
@@ -14,7 +14,7 @@
             r1 0
             ip 0
             is 0}}]
-   (State. (take 16 (concat memory (repeat 16 0))) r0 r1 ip is)))
+   (State. (vec (take 16 (concat memory (repeat 16 0)))) r0 r1 ip is)))

 (defn terminate-application!
   "Clojure/Clojurescript wrapper for terminate application."


fixes the battle button not sending you to lobby

--- src/client/menu.cljs
+++ src/client/menu.cljs
@@ -14,7 +14,7 @@
     [:div.logo-31d54]
     [:div.menu-cd25d
       [:button#solo-btn.green-btn-f67eb "SOLO"]
-      [:button#battle-btn.blue-btn-41e23 "BATTLE"]]])
+      [:button#lobby-btn.blue-btn-41e23 "BATTLE"]]])

 ;;------------------------------------------------------------
 ;; Page initialization.


fixing in-dev?

fixing in-dev?

--- src/httpkit/core.clj
+++ src/httpkit/core.clj
@@ -11,7 +11,7 @@
 (defn show-landing-page [req]
   {:status  200
    :headers {"Content-Type" "application/json"}
-   :body    (json/generate-string {:foo "bar" :baz 5})})
+   :body    (json/generate-string {:foo "barrr" :baz 5})})

 (defn wrap-logging [handler]
   (fn [req]
@@ -28,7 +28,7 @@

 (defn in-dev?
   [args]
-  true)
+  (some #(= "dev" %) args))

 (defn -main
   "Starts the app"
@@ -36,6 +36,7 @@
   ;; work around dangerous default behaviour in Clojure
   ;;(alter-var-root #'*read-eval* (constantly false))
   (info "starting up ...")
+  (info "args: " args)
   (let [handler (if (in-dev? args)
                   (reload/wrap-reload (site #'all-routes)) ;; only reload when dev
                   (site all-routes))]


Fix read-data-for-entries call.

Fix read-data-for-entries call.

--- src/oc/storage/api/orgs.clj
+++ src/oc/storage/api/orgs.clj
@@ -496,7 +496,7 @@
                                                 entries (entry-res/list-latest-published-entries conn (:uuid org) allowed-boards (:days ctx))
                                                 active-users (-> (auth/active-users {:user-id (-> ctx :user :user-id)} (:team-id org) config/auth-server-url config/passphrase "Auth")
                                                                  :collection :items)
-                                                read-data (read-data-for-entries org entries active-users)]
+                                                read-data (read-data-for-entries org allowed-boards entries active-users)]
                                         {:org (api-common/rep org)
                                          :active-users (api-common/rep active-users)
                                          :entries (api-common/rep entries)


full path for logging

full path for logging

--- src/open_company/config.clj
+++ src/open_company/config.clj
@@ -91,4 +91,4 @@

    :output-fn timbre/default-output-fn ; (fn [data]) -> string

-   :appenders {:spit (appenders/spit-appender {:fname "./logs/oc-api.log"})}})+   :appenders {:spit (appenders/spit-appender {:fname "/tmp/oc-api.log"})}})


fixing stop for new instrument group setup

--- src/overtone/studio/rig.clj
+++ src/overtone/studio/rig.clj
@@ -93,7 +93,7 @@
   "Frees all synth notes for each of the current instruments"
   []
   (doseq [[name inst] @instruments*]
-    (group-clear (:group inst))))
+    (group-clear (:instance-group inst))))

 (on-sync-event :reset reset-inst-groups ::reset-instruments)


revert fast refresh

revert fast refresh

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

--- src/status_im/reloader.cljs
+++ src/status_im/reloader.cljs
@@ -53,8 +53,3 @@
                                             :background-color "rgba(255,0,0,0.5))"}))}]
        [react/text {:style {:margin-top 10 :color (if @warning? :red colors/black)}}
         @label]])))
-
-(when ^boolean js/goog.DEBUG
-  (when-let [DevSettings (.-DevSettings ^js react/native-modules)]
-    (when (.-setHotLoadingEnabled DevSettings)
-      (.setHotLoadingEnabled ^js DevSettings false))))


Renamed option

Renamed option

--- scheduling/src/immutant/scheduling.clj
+++ scheduling/src/immutant/scheduling.clj
@@ -182,7 +182,7 @@
   "If true (the default), only one instance of a given job name will
    run in a cluster. See [[schedule]].")

-(defoption ^{:arglists '([boolean] [m boolean])} allow-concurrent-exec?
+(defoption ^{:arglists '([boolean] [m boolean])} allow-concurrent-exec
   "If true (the default), the job is allowed to run concurrently.
    If false it will be forced to run sequentially on one machine.
    To disallow concurrent execution cluster wide make sure to also


Make assert more understandable and docs too.

--- project/analyze-data/src/analyze_data/naive_bayes/train.clj
+++ project/analyze-data/src/analyze_data/naive_bayes/train.clj
@@ -18,14 +18,17 @@
   "X: design matrix
    label-indices: sorted map where key i looks up indices of samples labelled
                   i. It must be true that (= (keys label-indices) (range k))
-                  for some k.
+                  for some k, i.e. there must be at least one sample per class
+                  label.

   Return a core.matrix sparse matrix where the ith row is the sum of all
   samples labelled i."
   [X label-indices]
   ; preconditions
   (if-let [classes (keys label-indices)]
-    (assert (= classes (range (+ 1 (m/emax classes))))))
+    (let [expected-classes (range (+ 1 (m/emax classes)))]
+      (assert (= classes expected-classes)
+              "data needs at least one sample for each class label")))
   ; function
   (create-sparse-matrix
     (count label-indices)
@@ -37,7 +40,8 @@
   "X: design matrix
    label-indices: sorted map where key i looks up indices of samples labelled
                   i. It must be true that (= (keys label-indices) (range k))
-                  for some k.
+                  for some k, i.e. there must be at least one sample per class
+                  label.

   Return a k x n matrix 'phi' where k is the number of class labels and n is
   the number of terms. Each entry phi[i][j] represents prob(j|y=i)."
@@ -51,7 +55,8 @@
 (defn- calc-phi-y
   "label-indices: sorted map where key i looks up indices of samples labelled
                   i. It must be true that (= (keys label-indices) (range k))
-                  for some k.
+                  for some k, i.e. there must be at least one sample per class
+                  label.
    num-samples: number of samples

   Return a vector 'phi-y' of length k where k is the number of class labels.


Fix ns.

Fix ns.

--- test/onyx/generative/lifecycles_gen_test.clj
+++ test/onyx/generative/lifecycles_gen_test.clj
@@ -1,4 +1,4 @@
-(ns onyx.generative-lifecycles-gen-test
+(ns onyx.generative.lifecycles-gen-test
   (:require [clojure.test.check :as tc]
             [clojure.test.check.generators :as gen]
             [clojure.test.check.properties :as prop]


slight tweak to user fetching fn. also fn for fetching friends' ratings for a single book

--- src/myshelf/core.clj
+++ src/myshelf/core.clj
@@ -302,4 +302,14 @@
          :content
          second
          :content
-         (map element->map))))
+         (map element->map)
+         (map :user))))
+
+(defn get-friend-ratings-for-book
+  [consumer access-token user-id book-id]
+  (let [friends (get-user-friends consumer access-token
+                                  user-id)]
+    (->> friends
+         (map #(get-book-rating consumer access-token
+                                (:id %) book-id))
+         (filter identity))))