lower resource usage for producer

lower resource usage for producer

--- kafka-clj/src/kafka_clj/client.clj
+++ kafka-clj/src/kafka_clj/client.clj
@@ -16,6 +16,12 @@

 (defn- get-partition-count [topic brokers-metadata]
   (count (get brokers-metadata topic)))
+
+
+(defn smart-get [x k]
+  (if (or (delay? x) (future? x))
+    (get @x k)
+    (get x k)))

 (defn select-rr-partition! [topic {:keys [topic-partition-ref brokers-metadata] :as state}]
@@ -155,16 +161,23 @@
         )))))

-(defn find-hashed-connection [k producers upper-limit]
+(defn find-hashed-connection [broker k producers upper-limit]
   "Finds the value with a key that when hashed and moded against upper-limit is the same for k
    this is an optimization for hashed partitioning where the original keys are stored in the producers-ref
    i.e. topic:partition but the connections are created on (mod (hash k) upper-limit)"
   (let [hashed-k (hash k)
 	     [_ producer] (first
-                       (filter (fn [[producer-k v]]
-                         (= (mod (hash producer-k) upper-limit) (mod hashed-k upper-limit))) producers))]
+                       (filter (fn [[producer-k {:keys [host port]}]]
+                                 (and (= host (smart-get broker :host)) (= port (smart-get broker :port))
+                                    (= (mod (hash producer-k) upper-limit) (mod hashed-k upper-limit)))) producers))]
       producer))
+

+(defn find-producer [broker k producers]
+  (let [[_ producer] (first
+                       (filter (fn [_ v] (= (smart-get v :host) (smart-get broker :host)))
+                         producers))]
+        producer))

 (defn select-producer-buffer! [connector topic partition {:keys [producers-ref brokers-metadata producer-error-ch conf] :as state}]
   "Select a producer or create one,
@@ -177,13 +190,13 @@
                            (fn [x]
                              (if-let [producer (get @producers-ref k)]
                                x ; return map the producer already exists
-                               (if-let [producer (find-hashed-connection k @producers-ref (get conf :producer-connections-max 12))]
-                                 (assoc x k producer) ; found a producer based on hash
-                                 (assoc x k (delay
-	                                            (let [[partition broker] (select-broker topic partition brokers-metadata)
-	                                                  producer-buffer (create-producer-buffer connector topic partition producer-error-ch broker conf)]
-		                                             (add-remove-on-error-listener! producers-ref topic k producer-buffer brokers-metadata)
-	                                               producer-buffer))))))))
+                               (let [[partition broker] (select-broker topic partition brokers-metadata)]
+	                               (if-let [producer (find-hashed-connection broker k @producers-ref (get conf :producer-connections-max 4))]
+	                                 (assoc x k producer) ; found a producer based on hash and broker for the same partition
+	                                 (assoc x k (delay ;else create a new producer
+		                                            (let [producer-buffer (create-producer-buffer connector topic partition producer-error-ch broker conf)]
+			                                             (add-remove-on-error-listener! producers-ref topic k producer-buffer brokers-metadata)
+		                                               producer-buffer)))))))))
             k)))))

@@ -259,11 +272,11 @@
                                (into {} (filter (complement nil?)
                                             (map (fn [[k producer-buffer]]
 								                                                    (let [[topic partition] (clojure.string/split k #"\:")
-								                                                          host (:host producer-buffer)]
-								                                                      (if (some #(= (:host %) host) (get metadata topic))
+								                                                          host (smart-get producer-buffer :host)]
+								                                                      (if (some #(= (:host %) host) (smart-get metadata topic))
 								                                                        [k producer-buffer]
 								                                                        (do
-                                                                          (prn "closing producer " host " topic " topic)
+                                                                          (prn "closing producer " host " topic " topic " prodbuffer " producer-buffer)
 								                                                          (close-producer-buffer! producer-buffer)
 								                                                          nil))))
                                               m))))
@@ -271,7 +284,7 @@
                           (let [metadata (get-metadata metadata-producers conf)]
 	                          (dosync
                               (alter brokers-metadata (fn [x] metadata))
-                              (alter producer-ref (fn [x] (update-producers @metadata @x)))
+                              (alter producer-ref (fn [x] (update-producers metadata x)))
                               )))

         metadata-fixdelay


Call `flat-form->sg-columns` with correct args.

Signed-off-by: Njagi Mwaniki <b6a4ba60ad861b9c9afb6daea7294be4be68f44c@urbanslug.com>

--- src/hatti/views/table.cljs
+++ src/hatti/views/table.cljs
@@ -86,11 +86,11 @@
    Get one with (partial formatter field language)."
   [field language field-key row cell value columnDef dataContext]
   (let [clj-value (js->clj value :keywordize-keys true)]
-    (forms/format-answer field
-                         clj-value
-                         :language language
-                         :compact? true
-                         :field-key field-key)))
+    (format-answer field
+                   clj-value
+                   :language language
+                   :compact? true
+                   :field-key field-key)))

 (defmethod action-buttons :default
   [owner]
@@ -326,8 +326,8 @@
             colset! #(put! shared/event-chan
                            {:new-columns
                             (flat-form->sg-columns flat-form
-                                                   (= :label %)
-                                                   new-language)})]
+                                                   :get-label? (= :label %)
+                                                   :language   new-language)})]
         (when (not= new-language language)
           (om/set-state! owner :language new-language)
           (colset! field-key))


test hook

test hook

--- src/main/cawala/api/read.clj
+++ src/main/cawala/api/read.clj
@@ -6,7 +6,7 @@
                      :person/relation :friend}
                  2  {:db/id 2 :person/name "Sally" :person/age 22
                      :person/relation :friend}
-                 3  {:db/id 3 :person/name "Allie" :person/age 65
+                 3  {:db/id 3 :person/name "Allie" :person/age 64
                      :person/relation :enemy}
                  4  {:db/id 4 :person/name "Zoe" :person/age 32
                      :person/relation :friend}


optimize EmptyList -equiv

optimize EmptyList -equiv

--- src/main/cljs/cljs/core.cljs
+++ src/main/cljs/cljs/core.cljs
@@ -2709,6 +2709,11 @@
   (-reduce [coll f] (seq-reduce f coll))
   (-reduce [coll f start] (seq-reduce f start coll)))

+(defn ^boolean list?
+  "Returns true if x implements IList"
+  [x]
+  (satisfies? IList x))
+
 (es6-iterable List)

 (deftype EmptyList [meta]
@@ -2748,7 +2753,11 @@

   ISequential
   IEquiv
-  (-equiv [coll other] (equiv-sequential coll other))
+  (-equiv [coll other]
+    (if (or (list? other)
+            (sequential? other))
+      (nil? (seq other))
+      false))

   IHash
   (-hash [coll] empty-ordered-hash)
@@ -2858,11 +2867,6 @@
           (implements? ISeq coll))
     (Cons. nil x coll nil)
     (Cons. nil x (seq coll) nil)))
-
-(defn ^boolean list?
-  "Returns true if x implements IList"
-  [x]
-  (satisfies? IList x))

 (defn hash-keyword [k]
   (int (+ (hash-symbol k) 0x9e3779b9)))


latest ClojureScript version

latest ClojureScript version

--- Clojure-Websockets/MainApp/project.clj
+++ Clojure-Websockets/MainApp/project.clj
@@ -22,7 +22,7 @@
                  [ring/ring-defaults "0.1.4"]
                  [clj-time "0.9.0"]
                  [pandect "0.5.1"]
-                 [org.clojure/clojurescript "0.0-3119"]
+                 [org.clojure/clojurescript "0.0-3126"]
                  [tailrecursion/cljs-priority-map "1.1.0"]
                  [org.clojure/data.priority-map "0.0.5"]
                  [reagent "0.5.0"]


Add fps counter

Add fps counter

--- minimal-3d/desktop/src-common/minimal_3d/core.clj
+++ minimal-3d/desktop/src-common/minimal_3d/core.clj
@@ -3,7 +3,8 @@
 (ns minimal-3d.core
   (:require [play-clj.core :refer :all]
             [play-clj.g3d :refer :all]
-            [play-clj.math :as m]))
+            [play-clj.math :as m]
+            [play-clj.ui :refer :all]))

 (defscreen main-screen
   :on-show
@@ -32,7 +33,25 @@
       (perspective! :update))
     (render! screen entities)))

+(defscreen text-screen
+  :on-show
+  (fn [screen entities]
+    (update! screen :camera (orthographic) :renderer (stage))
+    (assoc (label "0" (color :black))
+           :id :fps
+           :x 5))
+  :on-render
+  (fn [screen entities]
+    (->> (for [entity entities]
+           (case (:id entity)
+             :fps (doto entity (label! :set-text (str (game :fps))))
+             entity))
+         (render! screen)))
+  :on-resize
+  (fn [screen entities]
+    (height! screen 300)))
+
 (defgame minimal-3d
   :on-create
   (fn [this]
-    (set-screen! this main-screen)))
+    (set-screen! this main-screen text-screen)))


fix index out of bounds error in new resolve-var call

trouble with exists? again ...

--- src/main/shadow/build/cljs_hacks.cljc
+++ src/main/shadow/build/cljs_hacks.cljc
@@ -312,38 +312,49 @@
                          ;;
                          ;; cannot blindly accept by ns-root since clojure.string creates clojure
                          ;; but clojure.lang does not exist so didn't warn about clojure.lang.MapEntry
-                         (if-let [hit (potential-ns-match? cljs-provides s)]
-                           (let [guessed-ns hit
-                                 guessed-sym (symbol (subs s (-> hit str count inc)))]
-
-                             ;; this path happens way too often and should be fixed properly
-                             (log/debug ::autofix-symbol
-                               {:sym sym
-                                :guessed-ns guessed-ns
-                                :guessed-sym guessed-sym})
-
-                             ;; although this split will sometimes produce valid matches it won't always work
-                             ;; cljs.core.-invoke works and ens up as cljs.core/-invoke
-                             ;; tailrecursion.priority-map.PersistentPriorityMap.EMPTY
-                             ;; ends as tailrecursion.priority-map/PersistentPriorityMap.EMPTY
-                             ;; since EMPTY is a property the analyzer doesn't not anything about
-
-                             (merge (ana/gets @env/*compiler* ::ana/namespaces guessed-ns :defs guessed-sym)
-                               {:op :var
-                                :name (symbol (str guessed-ns) (str guessed-sym))
-                                :ns guessed-ns}))
-
-                           ;; not known namespace root, resolve as js/ as a last ditch effort
-                           ;; this should probably hard fail instead but that would break too many builds
-                           ;; resolving as js/* is closer to the default behavior
-                           ;; and will most likely be for cases where we are actually accessing a global
-                           ;; ala process.env.FOO which will then warn properly
-                           (do (when (some? confirm)
-                                 (confirm env current-ns sym))
-                               {:op :js-var
-                                :name (symbol "js" s)
-                                :ns 'js}
-                               )))))))))
+                         (let [hit (potential-ns-match? cljs-provides s)]
+                           (cond
+                             ;; (exists? some.cljs.ns/foo) will emit a runtime lookup for some, some.cljs, some.cljs.ns
+                             ;; but not actually use them in any other way so lets pretend this is a raw JS var
+                             (= hit sym)
+                             {:op :js-var
+                              :name (symbol "js" s)
+                              :ns 'js}
+
+                             ;; partial match
+                             hit
+                             (let [guessed-ns hit
+                                   guessed-sym (symbol (subs s (-> hit str count inc)))]
+
+                               ;; this path happens way too often and should be fixed properly
+                               (log/debug ::autofix-symbol
+                                 {:sym sym
+                                  :guessed-ns guessed-ns
+                                  :guessed-sym guessed-sym})
+
+                               ;; although this split will sometimes produce valid matches it won't always work
+                               ;; cljs.core.-invoke works and ens up as cljs.core/-invoke
+                               ;; tailrecursion.priority-map.PersistentPriorityMap.EMPTY
+                               ;; ends as tailrecursion.priority-map/PersistentPriorityMap.EMPTY
+                               ;; since EMPTY is a property the analyzer doesn't not anything about
+
+                               (merge (ana/gets @env/*compiler* ::ana/namespaces guessed-ns :defs guessed-sym)
+                                 {:op :var
+                                  :name (symbol (str guessed-ns) (str guessed-sym))
+                                  :ns guessed-ns}))
+
+                             ;; not known namespace root, resolve as js/ as a last ditch effort
+                             ;; this should probably hard fail instead but that would break too many builds
+                             ;; resolving as js/* is closer to the default behavior
+                             ;; and will most likely be for cases where we are actually accessing a global
+                             ;; ala process.env.FOO which will then warn properly
+                             :else
+                             (do (when (some? confirm)
+                                   (confirm env current-ns sym))
+                                 {:op :js-var
+                                  :name (symbol "js" s)
+                                  :ns 'js}
+                                 ))))))))))

            :else
            (do (when (some? confirm)


Make the name of the manifest member a constant

--- src/mdr2/production/path.clj
+++ src/mdr2/production/path.clj
@@ -4,6 +4,7 @@
             [environ.core :refer [env]]))

 (def production-path (env :production-path))
+(def manifest-member "package.opf")

 (defn- multi-volume?
   "Return true if `production` has multiple volumes"
@@ -69,7 +70,7 @@
   ([production]
    (manifest-path production nil))
   ([production volume]
-   (file (recorded-path production volume) "package.opf")))
+   (file (recorded-path production volume) manifest-member)))

 (defn all
   "Return all the paths needed for a particular `production`"


Various improvements to middleware, mostly comments

--- src/re_frame/middleware.cljs
+++ src/re_frame/middleware.cljs
@@ -8,10 +8,6 @@

 ;; See docs in the Wiki: https://github.com/Day8/re-frame/wiki

-(defn noop
-  "Middleware which does nothing"
-  [handler]
-  handler)

 (defn pure
   "Acts as an adaptor, allowing handlers to be writen as pure functions.
@@ -37,7 +33,8 @@

 (defn debug
   "Middleware which logs debug information to js/console for each event.
-  Includes a clojure.data/diff of the db, before vs after, showing changes."
+  Includes a clojure.data/diff of the db, before vs after, showing the changes
+  caused by the event."
   [handler]
   (fn new-handler
     [db v]
@@ -62,8 +59,8 @@

 (defn trim-v
-  "Middleware which removes the first element of v. Its use means you can write
-  more asthetically pleasing handlers.
+  "Middleware which removes the first element of v which allows you to write
+  more asthetically pleasing handlers. No leading underscore on the event-v!
   Your handlers will look like this:
       (defn my-handler
         [db [x y z]]    ;; <-- instead of [_ x y z]
@@ -79,7 +76,8 @@
   "Supplies a sub-tree of `db` to the handler. A narrowed view.
   Assumes \"pure\" is in the middleware pipeline prior.
   Grafts the result back into db.
-  If a get-in of the path results in a nil, then \"default-fn\" will be called to supply a value."
+  If a get-in of the path results in a nil, then \"default-fn\" will be called to supply a value.
+  XXX very like update-in. Should the name be more indicative of that closeness? "
   ([p]
     (path p hash-map))
   ([p default-fn]
@@ -97,16 +95,47 @@

 (defn validate
-  "Middleware factory which applies a given validation function \"f\" to db
-  after the handler is finished.
-  This validation function f, might further change db, by perhaps
-   assoc-ing warnings and errors into db. "
+  "Middleware factory which runs a given function \"f\" in the after position.
+  \"f\" is given the new db value and is expected to perform certain kinds of
+  \"overall\" checks on this new state, adding to it (or removing) necessary
+  errors and warnings.
+  This need is such a common pattern!! There are invariably a category of
+  checks that require \"overall knowledge\".
+  For example, imagine that todomvc had to do duplicate detection - if any
+  two todos had the same text, highlight them, and put a warning down the
+  bottom.
+  That requires access to all todos, plus the ability to assoc in one or
+  more duplicate reports. Perhaps make the background of these todos pink
+  as a sign of the problem.
+  And that's just one kind of check, there may be a few that need to run
+  on every change.
+  \"f\" would need to be both adding and removing the duplicate warnings.
+  We don't want to pollute each handler with calls to \"f\", so we
+  simply add it to the middleware for each handler, and presto the checks are
+  always run.
+  This is a genuine part of the Derived Data, flowing thing."
   [f]
   (fn middleware
     [handler]
     (fn new-handler
       [db v]
       (f (handler db v)))))
+
+
+
+(defn after
+  "Middleware factory which runs a function \"f\" in the \"after handler\"
+  position presumably for side effects.
+  \"f\" is given the value of \"db\". It's return value is ignored.
+  Examples: \"f\" can run schema validation. Or write current state to localstorage. etc."
+  [f]
+  (fn middleware
+    [handler]
+    (fn new-handler
+      [db v]
+      (let [new-db (handler db v)]
+        (f new-db)   ;; call f for side effects
+        new-db))))

 ;; warning: untested
@@ -120,18 +149,3 @@
       (logger v)
       (handler db v))))

-
-;; warning: untested
-;; check the state of db AFTER the handler has run, using a prismatic Schema.
-#_(defn check-schema
-"Middleware for checking that a handlers mutations leave the state in a schema-matching way"
-[a-prismatic-schema]
-(fn middleware
-  [next-handler]
-  (fn handler
-    [db v]
-    (let [val    (next-handler db v)
-          valid? true]   ;; XXXXX  replace true by code which checks the schema using original parameter
-      (if (not valid?)
-        (warn "re-frame: schema not valid after:" v))
-      val))))


Fix grouping of debug/middleware

Fix grouping of debug/middleware

--- src/re_frame/middleware.cljs
+++ src/re_frame/middleware.cljs
@@ -50,9 +50,9 @@
           [before after] (data/diff db new-db)
           db-changed? (or (some? before) (some? after))]
       (if db-changed?
-        (do (group "clojure.data/diff for: " v
-              (log "only before: " before)
-              (log "only after : " after))
+        (do (group "clojure.data/diff for: " v)
+            (log "only before: " before)
+            (log "only after : " after)
             (groupEnd))
         (log "clojure.data/diff no changes for: " v))
       new-db)))


made analytics/track :external-click schema validate its events

--- src-cljs/frontend/analytics/core.cljs
+++ src-cljs/frontend/analytics/core.cljs
@@ -123,9 +123,6 @@
                                  (.getTime (js/Date. (:stop_time build))))
                               1000 60 60)})))

-(defn merror-unsupported-event [event]
-  (merror "Cannot log unsupported event type "event", please add it to the list of supported events"))
-
 (defmulti track (fn [data]
                   (when (frontend.config/analytics-enabled?)
                     (:event-type data))))
@@ -141,12 +138,10 @@
                                                                      :current-state current-state})))

 (s/defmethod track :external-click [event-data :- ExternalClickEvent]
-  (let [{:keys [event properties owner current-state]} event-data]
-    (if (supported-click-and-impression-events (:event event-data))
-      (segment/track-external-click event (supplement-tracking-properties {:properties properties
-                                                                           :owner owner
-                                                                           :current-state current-state}))
-      (merror-unsupported-event (:event event-data)))))
+  (let [{:keys [event :- SupportedEvents properties owner current-state]} event-data]
+    (segment/track-external-click event (supplement-tracking-properties {:properties properties
+                                                                         :owner owner
+                                                                         :current-state current-state}))))

 (s/defmethod track :pageview [event-data :- PageviewEvent]
   (let [{:keys [navigation-point properties owner current-state]} event-data]


Fix error when filtering by followed and unfollowed boards in digest endpoint.

--- src/oc/storage/resources/activity.clj
+++ src/oc/storage/resources/activity.clj
@@ -23,10 +23,11 @@
                      :status-board-uuid
                      :status-org-uuid)
         allowed-board-uuids (set (map :uuid allowed-boards))
+        unfollow-boards-set (set (:unfollow-board-uuids follow-data))
         filtered-board-uuids (cond (:following follow-data)
-                                   (clj-set/difference allowed-board-uuids (:unfollow-board-uuids follow-data))
+                                   (clj-set/difference allowed-board-uuids unfollow-boards-set)
                                    (:unfollowing follow-data)
-                                   (clj-set/intersection allowed-board-uuids (:unfollow-board-uuids follow-data))
+                                   (clj-set/intersection allowed-board-uuids unfollow-boards-set)
                                    :else
                                    allowed-board-uuids)
         index-value (if (sequential? allowed-boards)
@@ -51,10 +52,11 @@
                       :status-board-uuid
                       :status-org-uuid)
          allowed-board-uuids (set (map :uuid allowed-boards))
+         unfollow-boards-set (set (:unfollow-board-uuids follow-data))
          filtered-board-uuids (cond (:following follow-data)
-                                    (clj-set/difference allowed-board-uuids (:unfollow-board-uuids follow-data))
+                                    (clj-set/difference allowed-board-uuids unfollow-boards-set)
                                     (:unfollowing follow-data)
-                                    (clj-set/intersection allowed-board-uuids (:unfollow-board-uuids follow-data))
+                                    (clj-set/intersection allowed-board-uuids unfollow-boards-set)
                                     :else
                                     allowed-board-uuids)
          index-value (if (sequential? allowed-boards)


make all resource helpers take explicit conn arg

--- src/open_company/resources/common.clj
+++ src/open_company/resources/common.clj
@@ -175,56 +175,47 @@

 (defn create-resource
   "Create a resource in the DB, returning the property map for the resource."
-  [table-name resource timestamp]
+  [conn table-name resource timestamp]
   (let [timed-resource (merge resource {
           :created-at timestamp
           :updated-at timestamp})
-        insert (pool/with-pool [conn pool/rethinkdb-pool]
-                 (with-timeout default-timeout
-                   (-> (r/table table-name)
-                       (r/insert timed-resource)
-                       (r/run conn))))]
+        insert (with-timeout default-timeout
+                 (-> (r/table table-name)
+                     (r/insert timed-resource)
+                     (r/run conn)))]
   (if (= 1 (:inserted insert))
     timed-resource
     (throw (RuntimeException. (str "RethinkDB insert failure: " insert))))))

 (defn read-resource
-  "
-  Given a table name and a primary key value, retrieve the resource from the database,
-  or return nil if it doesn't exist.
-  "
-  [table-name primary-key-value]
-  (pool/with-pool [conn pool/rethinkdb-pool]
-    (-> (r/table table-name)
+  "Given a table name and a primary key value, retrieve the resource from the database,
+  or return nil if it doesn't exist."
+  [conn table-name primary-key-value]
+  (-> (r/table table-name)
       (r/get primary-key-value)
-      (r/run conn))))
+      (r/run conn)))

 (defn read-resources
-  "
-  Given a table name, and an optional index name and value, and an optional set of fields, retrieve
-  the resources from the database.
-  "
-  ([table-name fields]
-  (pool/with-pool [conn pool/rethinkdb-pool]
-    (with-timeout default-timeout
-      (-> (r/table table-name)
-          (r/with-fields fields)
-          (r/run conn)))))
-
-  ([table-name index-name index-value]
-  (pool/with-pool [conn pool/rethinkdb-pool]
-    (with-timeout default-timeout
-      (-> (r/table table-name)
-          (r/get-all [index-value] {:index index-name})
-          (r/run conn)))))
-
-  ([table-name index-name index-value fields]
-  (pool/with-pool [conn pool/rethinkdb-pool]
-    (with-timeout default-timeout
-      (-> (r/table table-name)
-          (r/get-all [index-value] {:index index-name})
-          (r/pluck fields)
-          (r/run conn))))))
+  "Given a table name, and an optional index name and value, and an optional set of fields, retrieve
+  the resources from the database."
+  ([conn table-name fields]
+   (with-timeout default-timeout
+     (-> (r/table table-name)
+         (r/with-fields fields)
+         (r/run conn))))
+
+  ([conn table-name index-name index-value]
+   (with-timeout default-timeout
+     (-> (r/table table-name)
+         (r/get-all [index-value] {:index index-name})
+         (r/run conn))))
+
+  ([conn table-name index-name index-value fields]
+   (with-timeout default-timeout
+     (-> (r/table table-name)
+         (r/get-all [index-value] {:index index-name})
+         (r/pluck fields)
+         (r/run conn)))))

 (defn read-resources-in-order
   "
@@ -238,44 +229,41 @@
 (defn update-resource
   "Given a table name, the name of the primary key, and the original and updated resource,
   update a resource in the DB, returning the property map for the resource."
-  ([table-name primary-key-name original-resource new-resource]
-  (update-resource table-name primary-key-name original-resource new-resource (current-timestamp)))
-
-  ([table-name primary-key-name original-resource new-resource timestamp]
+  ([conn table-name primary-key-name original-resource new-resource]
+  (update-resource conn table-name primary-key-name original-resource new-resource (current-timestamp)))
+
+  ([conn table-name primary-key-name original-resource new-resource timestamp]
   (let [timed-resource (merge new-resource {
           primary-key-name (original-resource primary-key-name)
           :created-at (:created-at original-resource)
           :updated-at timestamp})
-        update (pool/with-pool [conn pool/rethinkdb-pool]
-                 (with-timeout default-timeout
-                   (-> (r/table table-name)
-                       (r/get (original-resource primary-key-name))
-                       (r/replace timed-resource)
-                       (r/run conn))))]
+        update (with-timeout default-timeout
+                 (-> (r/table table-name)
+                     (r/get (original-resource primary-key-name))
+                     (r/replace timed-resource)
+                     (r/run conn)))]
   (if (or (= 1 (:replaced update)) (= 1 (:unchanged update)))
     timed-resource
     (throw (RuntimeException. (str "RethinkDB update failure: " update)))))))

 (defn delete-resource
   "Delete the specified resource and return `true`."
-  ([table-name primary-key-value]
-   (let [delete (pool/with-pool [conn pool/rethinkdb-pool]
-                  (with-timeout default-timeout
-                    (-> (r/table table-name)
-                        (r/get primary-key-value)
-                        (r/delete)
-                        (r/run conn))))]
+  ([conn table-name primary-key-value]
+   (let [delete (with-timeout default-timeout
+                  (-> (r/table table-name)
+                      (r/get primary-key-value)
+                      (r/delete)
+                      (r/run conn)))]
     (if (= 1 (:deleted delete))
       true
       (throw (RuntimeException. (str "RethinkDB delete failure: " delete))))))

-  ([table-name key-name key-value]
-   (let [delete (pool/with-pool [conn pool/rethinkdb-pool]
-                  (with-timeout default-timeout
-                    (-> (r/table table-name)
-                        (r/get-all [key-value] {:index key-name})
-                        (r/delete)
-                        (r/run conn))))]
+  ([conn table-name key-name key-value]
+   (let [delete (with-timeout default-timeout
+                  (-> (r/table table-name)
+                      (r/get-all [key-value] {:index key-name})
+                      (r/delete)
+                      (r/run conn)))]
      (if (zero? (:errors delete))
       true
       (throw (RuntimeException. (str "RethinkDB delete failure: " delete)))))))
@@ -284,12 +272,11 @@

 (defn delete-all-resources!
   "Use with caution! Failure can result in partial deletes of just some resources. Returns `true` if successful."
-  [table-name]
-  (let [delete (pool/with-pool [conn pool/rethinkdb-pool]
-                 (with-timeout default-timeout
-                   (-> (r/table table-name)
-                       (r/delete)
-                       (r/run conn))))]
+  [conn table-name]
+  (let [delete (with-timeout default-timeout
+                 (-> (r/table table-name)
+                     (r/delete)
+                     (r/run conn)))]
     (if (pos? (:errors delete))
       (throw (RuntimeException. (str "RethinkDB delete failure: " delete)))
       true)))


improve doc for sin-osc-fb

improve doc for sin-osc-fb

--- src/overtone/sc/ugen/metadata/osc.clj
+++ src/overtone/sc/ugen/metadata/osc.clj
@@ -34,9 +34,10 @@
        :doc "Outputs a sine wave with values oscillating between -1 and 1 similar to osc except that the table has already been fixed as a sine table of 8192 entries."}

       {:name "SinOscFB",
-       :args [{:name "freq", :default 440.0}
-              {:name "feedback", :default 0.0}],
-       :doc "very fast sine oscillator"}
+       :args [{:name "freq", :default 440.0 :doc "Frequency of oscillator"}
+              {:name "feedback", :default 0.0 :doc "amplitude of phase feedback in radians"}]
+       :summary "Sine oscillator with phase modulation feedback"
+       :doc "Different feedback values results in a modulation between a sine wave and a sawtooth like wave. Overmodulation causes chaotic oscillation."}

       {:name "OscN",
        :args [{:name "bufnum" :doc "Buffer index.  The buffer size must be a power of 2.  The buffer should NOT be filled using Wavetable format (b_gen commands should set wavetable flag to false.  Raw signals (not converted with asWavetable) can be saved to disk and loaded into the buffer."}


more logging

more logging

--- test/babel/test/la.cljc
+++ test/babel/test/la.cljc
@@ -86,7 +86,9 @@
         ;; for specific literal strings in the result.
         subj (get-in result [:semantics :subj :pred])
         possible-answer (first (get result :targets))]
-    (log/info (str "reader2 test: result:" result))
+    (log/debug (str "reader2 test: keys of result:" (keys result)))
+    (log/debug (str "reader2 subj: " subj))
+    (log/debug (str "reader2 possible-answer:" possible-answer))
     (is
      (or
       (and


Fix ~/.lein/profiles.clj

Fix ~/.lein/profiles.clj

- Don't add cider/nrepl as Cider take care of it now :)

--- clojure/profiles.clj
+++ clojure/profiles.clj
@@ -1,8 +1,7 @@
 {:user
  {:plugins [[lein-localrepo "0.5.4"] ;; https://github.com/kumarshantanu/lein-localrepo
             [lein-nevam "0.1.2"]     ;; Convert pom.xml to project.clj
-            [lein-pprint "1.2.0"]    ;; Pretty-print a representation of the project map
-            [nrepl "0.6.0"]]
+            [lein-pprint "1.2.0"]]   ;; Pretty-print a representation of the project map
   :dependencies [[alembic "0.3.2"]
                  [pjstadig/humane-test-output "0.8.3"]]
   :injections [(require 'pjstadig.humane-test-output)


redirect to resoure after creating conference | fs / cb | #3

--- src/clj/conference_rating/handler.clj
+++ src/clj/conference_rating/handler.clj
@@ -2,14 +2,14 @@
   (:require [compojure.core :refer [GET POST defroutes]]
             [compojure.route :refer [not-found resources]]
             [ring.middleware.defaults :refer [site-defaults wrap-defaults api-defaults]]
-            [ring.util.response :refer [response]]
+            [ring.util.response :refer [created response]]
             [hiccup.core :refer [html]]
             [ring.middleware.json :as json]
             [hiccup.page :refer [include-js include-css]]
             [prone.middleware :refer [wrap-exceptions]]
             [ring.middleware.reload :refer [wrap-reload]]
             [environ.core :refer [env]]
-            [conference-rating.db-handler :refer [add-conference]]
+            [conference-rating.db-handler :as db]
             ))

 (def home-page
@@ -39,12 +39,16 @@
     [{:conference-name "Conference 1" :id "1"}
      {:conference-name "Conference 2" :id "2"}]))

+(defn add-conference []
+  (let [add-result (db/add-conference)
+        id         (.toHexString (:_id add-result))]
+    (created (str "/api/conferences/" id))))
+
 (defroutes routes
            (GET "/" [] home-page)
            (GET "/api/conferences" [] (get-conferences))
            (GET "/api/conferences/:id" [id] (get-conference id))
-           (POST "/api/conferences/" [] (do (add-conference)
-                                            (response {})))
+           (POST "/api/conferences/" [] (add-conference))
            (resources "/")
            (not-found "Not Found"))


ensure transaction-item transaction-date value is correct

--- src/clj_money/models/transactions.clj
+++ src/clj_money/models/transactions.clj
@@ -118,6 +118,14 @@
        (map #(item-value-sum transaction %))
        (apply =)))

+(defn- ^{:clj-money.validation/message "Each item must have the same transaction-date as the transaction"
+         :clj-money.validation/path [:items]}
+  transaction-dates-must-match
+  [{:keys [transaction-date items] :as transaction}]
+  (->> items
+       (map :transaction-date)
+       (apply = transaction-date)))
+
 (defn- before-item-validation
   [item]
   (cond-> item
@@ -141,7 +149,11 @@
   "Performs operations required before validation"
   [transaction]
   (-> (coercion/coerce coercion-rules transaction)
-      (update-in [:items] #(map before-item-validation %))))
+      (update-in [:items] (fn [items]
+                            (->> items
+                                 (map #(assoc % :transaction-date
+                                                (:transaction-date transaction)))
+                                 (map before-item-validation))))))

 (defn- after-validation
   [{transaction-date :transaction-date :as transaction}]
@@ -378,6 +390,7 @@
 (defn- validation-rules
   [storage]
   [#'sum-of-credits-must-equal-sum-of-debits
+   #'transaction-dates-must-match
    (validation/create-rule (partial no-reconciled-items-changed? storage)
                            [:items]
                            "A reconciled transaction item cannot be changed")])


Refactor to have all Form-2 reagent component when we have subscribe (except where we cannot).

--- src/cljs/cljs_browser_repl/views.cljs
+++ src/cljs/cljs_browser_repl/views.cljs
@@ -110,12 +110,14 @@

 (defn gist-login-popover-dialog
   []
-  (let [showing? (reagent/atom false)
+  (let [console (subscribe [:get-console :cljs-console])
+        console-created? (subscribe [:console-created? :cljs-console])
+        showing? (reagent/atom false)
         auth-data (reagent/atom {:username "" :password ""})
         save-auth-data (reagent/atom nil)
         ok-fn #(do (reset! showing? false)
                    (let [{:keys [username password]} @auth-data
-                         text (console/dump-console! @(subscribe [:get-console :cljs-console]))]
+                         text (console/dump-console! @console)]
                      (gist/create-gist username password text on-gist-created gist-error-handler)))
         cancel-fn #(do
                      (reset! auth-data @save-auth-data)
@@ -131,7 +133,7 @@
                 :class "cljs-btn"
                 :tooltip "Create Gist"
                 :tooltip-position :below-center
-                :disabled? (not @(subscribe [:console-created? :cljs-console]))]
+                :disabled? (not @console-created?)]
      :popover  [gist-login-popover-dialog-body showing? auth-data ok-fn cancel-fn]]))

 (defn cljs-buttons
@@ -140,7 +142,7 @@
    component)."
   []
   (let [console  (subscribe [:get-console :cljs-console])
-        created? (subscribe [:console-created? :cljs-console])
+        console-created? (subscribe [:console-created? :cljs-console])
         example-mode? (subscribe [:example-mode? :cljs-console])]
     (fn []
       [v-box
@@ -151,14 +153,14 @@
                    :class "cljs-btn"
                    :tooltip "Reset"
                    :tooltip-position :left-center
-                   :disabled? (not @created?)]
+                   :disabled? (not @console-created?)]
                   [md-icon-button
                    :md-icon-name "zmdi-format-clear-all"
                    :on-click #(cljs/cljs-clear-console! @console)
                    :class "cljs-btn"
                    :tooltip "Clear"
                    :tooltip-position :left-center
-                   :disabled? (not @created?)]
+                   :disabled? (not @console-created?)]
                   [gist-login-popover-dialog]
                   [md-icon-button
                    :md-icon-name "zmdi-stop"


changed server url

changed server url

Former-commit-id: 17497b53596f537f094233820b8bf2959191b655

--- src/status_im/constants.cljs
+++ src/status_im/constants.cljs
@@ -2,7 +2,7 @@

 (def ethereum-rpc-url "http://localhost:8545")

-(def server-address "http://rpc0.status.im:20000/")
+(def server-address "http://api.status.im/")
 ;; (def server-address "http://10.0.3.2:3000/")
 ;; (def server-address "http://localhost:3000/")


Clean up logging.

Clean up logging.

--- src/onyx/messaging/aeron.clj
+++ src/onyx/messaging/aeron.clj
@@ -20,11 +20,12 @@
 (defrecord AeronPeerGroup [opts]
   component/Lifecycle
   (start [component]
-    (taoensso.timbre/info "Starting Aeron peer group")
+    (taoensso.timbre/info "Starting Aeron Peer Group")
     (let [media-driver (MediaDriver/launch)]
       (assoc component :media-driver media-driver)))

   (stop [{:keys [media-driver] :as component}]
+    (taoensso.timbre/info "Stopping Aeron Peer Group")
     (.close media-driver)
     (assoc component :media-driver nil)))

@@ -149,7 +150,6 @@

 (defmethod extensions/open-peer-site AeronConnection
   [messenger assigned]
-  (timbre/info "Open peer site " messenger assigned)
   (let [inbound-ch (:inbound-ch (:messenger-buffer messenger))
         release-ch (:release-ch messenger)
         daemon (:acking-daemon messenger)
@@ -183,7 +183,6 @@

 (defmethod extensions/connect-to-peer AeronConnection
   [messenger event {:keys [aeron/external-addr aeron/port]}]
-  (timbre/info "Connect to peer " external-addr port)
   (let [ctx (.errorHandler (Aeron$Context.) no-op-error-handler)
         aeron (Aeron/connect ctx)
         channel (aeron-channel external-addr port)


Liveness timeout property should be a string

--- src/onyx/messaging/aeron.clj
+++ src/onyx/messaging/aeron.clj
@@ -187,7 +187,7 @@
     (let [embedded-driver? (arg-or-default :onyx.messaging.aeron/embedded-driver? opts)
           inter-service-timeout (arg-or-default :onyx.messaging.aeron/inter-service-timeout-ns opts)
           ;; client liveness timeout should match inter-service-timeout
-          _ (System/setProperty "aeron.client.liveness.timeout" inter-service-timeout)
+          _ (System/setProperty "aeron.client.liveness.timeout" (str inter-service-timeout))
           media-driver-context (if embedded-driver?
                                  (doto (MediaDriver$Context.)))
           media-driver (if embedded-driver?


fix get-math-tick

fix get-math-tick

--- src/polismath/components/postgres.clj
+++ src/polismath/components/postgres.clj
@@ -359,7 +359,7 @@

 (defn get-math-tick
   [postgres zid]
-  (first (query postgres ["select math_tick from math_ticks where zid = (?) and math_env = (?);" zid (name (-> postgres :config :math-env))])))
+  (:math_tick (first (query postgres ["select math_tick from math_ticks where zid = (?) and math_env = (?);" zid (name (-> postgres :config :math-env))]))))

 (defn load-conv


fix up SCALES so that they all add up to 12 (the num of semitones in an octave)

--- src/overtone/music/pitch.clj
+++ src/overtone/music/pitch.clj
@@ -128,16 +128,16 @@
    :whole-tone        [2 2 2 2 2 2]
    :chromatic         [1 1 1 1 1 1 1 1 1 1 1 1]
    :harmonic-minor    [2 1 2 2 1 3 1]
-
-   :octatonic         [2 1 2 1 2 1 2]
-   :messiaen1         [2 2 2 2 2]
-   :messiaen2         [2 1 2 1 2 1 2]
-   :messiaen3         [2 1 1 2 1 1 2 1]
-   :messiaen4         [1 1 3 1 1 1 3]
-   :messiaen5         [1 4 1 1 4]
-   :messiaen6         [2 2 1 1 2 2 1]
-   :messiaen7         [1 1 1 2 1 1 1 1 2]
-   :lydian-mixolydian [2 1 2 1 2 1 2]})
+   :melodic-minor-asc [2 1 2 2 2 2 1]
+   :hungarian-minor   [2 1 3 1 1 3 1]
+   :octatonic         [2 1 2 1 2 1 2 1]
+   :messiaen1         [2 2 2 2 2 2]
+   :messiaen2         [1 2 1 2 1 2 1 2]
+   :messiaen3         [2 1 1 2 1 1 2 1 1]
+   :messiaen4         [1 1 3 1 1 1 3 1]
+   :messiaen5         [1 4 1 1 4 1]
+   :messiaen6         [2 2 1 1 2 2 1 1]
+   :messiaen7         [1 1 1 2 1 1 1 1 2 1]})

 ;; * Diatonic function
 ;;   - in terms of centeredness around the root, this is the order


synchronise the creation of the first studio group as it is required to exist before the second group can be created. Hopefully fixes sporadic FAILURE /g_new Group not found warning on startup.

--- src/overtone/studio/core.clj
+++ src/overtone/studio/core.clj
@@ -102,7 +102,7 @@
 (on-deps :studio-setup-completed ::start-mixer start-mixer)

 (defn setup-studio []
-  (let [g (group :head ROOT-GROUP)
+  (let [g (with-server-sync #(group :head ROOT-GROUP))
         f (group :after g)
         m (group :tail ROOT-GROUP)
         r (group :tail ROOT-GROUP)]


Migrated new route generation to new parsed taxonomy structure, and re-integrated it into main pipeline

--- src/lonelyplanet/model.clj
+++ src/lonelyplanet/model.clj
@@ -93,10 +93,10 @@
   "Generate a route to the top destination from the current destination"
   [loc acc]
   (aprint (str "At node " (-> loc z/node :tag) " " (-> loc z/node :attrs :id)))
-  (let [parent (-> loc z/up z/leftmost)                     ;; grab leftmost parent which is the :li
+  (let [parent (-> loc z/up z/up)
         loc-id (-> loc z/node :attrs :id)]
     (aprint (str "Node parent: " (if parent (str (-> parent z/node :tag) " " (-> parent z/node :attrs :id)) nil)))
-    (if parent (recur parent (cons loc-id acc)) acc)))
+    (if parent (recur parent (cons loc-id acc)) (cons loc-id acc))))

 (defn gen-meta
   "Generate destination meta-info for the view"
@@ -122,7 +122,7 @@
         hierarchy (-> tax-zip z/next z/next (walk&transform-zipper transform-taxonomy-nodes)
                       z/root z/xml-zip z/next z/next (walk&transform-zipper prune-taxonomy-nodes)
                       z/root z/xml-zip z/next z/next z/node) ;; navigate to root :ul element
-        dest-metas (-> tax-zip leaves location-metas)
+        dest-metas (-> hierarchy gen-routes)
         destinations (-> destinations gen-parser :content)]
     {:destinations (for [destination destinations]
                      (let [destination-id (-> destination :attrs :atlas_id)]


Forgot desc when converting

Forgot desc when converting

--- src/lt/plugins/sancho.cljs
+++ src/lt/plugins/sancho.cljs
@@ -100,11 +100,11 @@
                {:callback kw :symbol sym})))

 (cmd/command {:command :sancho.open-crossclj-url
-              :desc "IncClojure: Open crossclj page for current symbol"
+              :desc "Sancho: Open crossclj page for current symbol"
               :exec (partial resolve-current-word-and-call :open-crossclj-url)})

 (cmd/command {:command :sancho.open-grimoire-url
-              :desc "IncClojure: Open grimoire page for current symbol"
+              :desc "Sancho: Open grimoire page for current symbol"
               :exec (partial resolve-current-word-and-call :open-grimoire-url)})

 (defn GET [url cb]
@@ -131,7 +131,7 @@
               {:ns ns :var var :url (->grimoire-examples-url ns var)}))))

 (cmd/command {:command :sancho.open-grimoire-examples
-              :desc "IncClojure: Open grimoire examples locally for current symbol"
+              :desc "Sancho: Open grimoire examples locally for current symbol"
               :exec (partial resolve-current-word-and-call :fetch-and-open-grimoire-examples)})

 (comment


Throw exception for breaking change

Throw exception for breaking change

--- src/play_clj/g2d_physics.clj
+++ src/play_clj/g2d_physics.clj
@@ -184,6 +184,8 @@
 (defmacro circle-shape
   "Returns a [CircleShape](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/physics/box2d/CircleShape.html)."
   [& options]
+  (when-not (keyword? (first options))
+    (throw (Exception. "Replace (circle-shape radius) with (circle-shape :set-radius radius :set-position radius)")))
   `(u/calls! ^CircleShape (circle-shape*) ~@options))

 (defmacro circle-shape!


Write a function for mapping life coords to screen

--- src/petulant_life/main.clj
+++ src/petulant_life/main.clj
@@ -29,6 +29,15 @@
 (defn destroy []
   (Display/destroy))

+(defn life->screen [size padding life-board]
+  (let [coord (fn [x] (+ (* padding
+                            (inc x))
+                         (* size x)))]
+    (map (fn [[x y]]
+           [(coord x) (coord y)
+            size size])
+         life-board)))
+
 ;; Running the simulation / graphics.
 (defn run [shader]
   (while (not (Display/isCloseRequested))
@@ -38,7 +47,7 @@
                            shader
                            [1 0 0 1])

-        (r/draw-rectangles [[70 10 50 50]]
+        (r/draw-rectangles (life->screen 50 10 [[0 0] [1 0] [1 1]])
                            shader
                            [0 1 0 1])


adding used ip marking

adding used ip marking

--- src/proxmox/generators.clj
+++ src/proxmox/generators.clj
@@ -92,17 +92,24 @@
 (def range-keys [])

 (defn ip-range
-  ""
+  "Configured ip range"
   []
   (try+
     (let [[s e] (map ip-to-long (get* :hypervisor :proxmox :generators :ip-range))]
       [s e])
     (catch [:type :celestial.common/missing-conf] e nil)))

+(defn mark-used
+  "marks existing ips as used"
+  []
+  (doseq [ip (map ip-to-long (get* :hypervisor :proxmox :generators :used-ips))]
+    (wcar (car/zadd "ips" 1 ip))))
+
 (defn initialize-range
   "Initializes ip range zset 0 marks unused 1 marks used (only if missing)."
   []
-  (if-let [[s e] (ip-range)]
+  (when-let [[s e] (ip-range)]
+    (mark-used)
     (wcar
       (when-not (= 1 (car/exists "ips"))
         (doseq [ip (range s (+ 1 e))]
@@ -139,6 +146,8 @@
        return nil "
       {:ips "ips"} {:rel-ip (ip-to-long ip)}))))

+
+
 (comment
   (release-ip "192.168.5.130")
   (gen-ip {})


should be or

should be or

--- src/proxmox/generators.clj
+++ src/proxmox/generators.clj
@@ -35,7 +35,7 @@
   (loop [i 5]
     (when (> i 0)
       (let [id (+ 100 (gen-ct-id))]
-        (if-not (and (ct-exists id) (qm-exists id))
+        (if-not (or (ct-exists id) (qm-exists id))
           id
           (recur (- i 1)))))))


thanks Anderkent for unquote-quote here

thanks Anderkent for unquote-quote here

--- src/runtime/testengine.clj
+++ src/runtime/testengine.clj
@@ -6,18 +6,12 @@
   [cls & restt]
   (list
     `is
-    (let [tocls (eval cls)
-          a 'thrown?]
-;      (apply
-;        #
-`(
-           ;list
-           ~a
-           ~tocls
-
-        ~@restt
-        )
-;        )
+    (let [tocls (eval cls)]
+      `(
+         ~'thrown? ;thanks Anderkent for unquote-quote here
+         ~tocls
+         ~@restt
+         )
       )
     )
   )


handle mouse in and mouse out for shapes

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

--- plugins/SlideExplorer2/src/slide_explorer/canvas1.clj
+++ plugins/SlideExplorer2/src/slide_explorer/canvas1.clj
@@ -502,12 +502,16 @@
     (fn [x y] ((widget action-type)
                  (- x offset-x) (- y offset-y)))))

+(defn match-shapes [[x y] data]
+  (->> data
+       (filter #(-> (.createTransformedShape
+                           (% :transform) (% :shape)) (.contains x y)))))
+
 (defn triggered-mouse-actions [action-type [x y] data]
   (->> data
        expand-memo
-       (filter #(and (% action-type)
-                     (-> (.createTransformedShape
-                           (% :transform) (% :shape)) (.contains x y))))
+       (filter action-type)
+       (match-shapes [x y])
        (map #(create-action % action-type))))

 (defn run-mouse-actions [e action-type reference]
@@ -515,6 +519,23 @@
     (doseq [action (triggered-mouse-actions action-type [x y] @reference)]
       (action x y))))

+(defn mouse-is-over [[x y] data]
+  (->> data
+       expand-memo
+       (remove #(empty? (select-keys % [:mouse-in :mouse-out])))
+       (match-shapes [x y])))
+
+(defn handle-mouse-move [e reference canvas]
+  (let [data @reference
+        last-widgets-under-mouse ((meta canvas) ::last-widgets-under-mouse)
+        widgets-under-mouse (set (map #(select-keys % [:mouse-in :mouse-out :shape]) (mouse-is-over [(.getX e) (.getY e)] data)))
+        in (clojure.set/difference widgets-under-mouse last-widgets-under-mouse)
+        out (clojure.set/difference last-widgets-under-mouse widgets-under-mouse)]
+    (alter-meta! canvas assoc ::last-widgets-under-mouse
+                 widgets-under-mouse)
+    (doseq [action (map :mouse-in in)] (when action (action)))
+    (doseq [action (map :mouse-out out)] (when action (action)))))
+
 (defn activate-dragging! [e reference canvas]
   (let [x (.getX e) y (.getY e)]
     (alter-meta! canvas assoc ::dragging-action
@@ -539,6 +560,7 @@
                             (run-mouse-actions e :mouse-down reference))
           (mouseReleased [e] (stop-dragging! canvas)
                              (run-mouse-actions e :mouse-up reference))
+          (mouseMoved [e] (handle-mouse-move e reference canvas))
           (mouseDragged [e] (continue-dragging e canvas)))]
     (doto canvas
       (.addMouseListener mouse-adapter)
@@ -607,8 +629,10 @@
     :x 100
     :y 100}
    {:type :arc
+    :mouse-in #(swap! grafix assoc-in [2 :fill] :red)
+    :mouse-out #(swap! grafix assoc-in [2 :fill] :pink)
     :scale 2
-      :mouse-up (fn [x y] (println "yo: " x y))
+      :mouse-up (fn [x y] (println "coords: " x y))
      :l 100
      :y 200
      :w 50


Fixes per PR feedback.

Fixes per PR feedback.

--- frontend/components/dashboard.cljs
+++ frontend/components/dashboard.cljs
@@ -12,7 +12,7 @@
   (:require-macros [frontend.utils :refer [html]]))

 (defn show-trial-notice? [projects plan]
-  (let [some-private-repos (some identity (map #(not (get-in % [:feature_flags :oss])) projects))]
+  (let [some-private-repos (some #(not (get-in % [:feature_flags :oss])) projects)]
     (and some-private-repos
          (plan-model/trial? plan)
          ;; We probably gave them a special deal, better not to bug them


smart background transition for nav using binding

--- frontend/components/landing_b.cljs
+++ frontend/components/landing_b.cljs
@@ -32,7 +32,9 @@
                            (om/set-state! owner [:header-cta-visible] (neg? (.-bottom (.getBoundingClientRect cta))))
                            (om/set-state! owner [:header-bkg-visible] (< (.-bottom (.getBoundingClientRect nav-bkg)) 70))
                            (om/set-state! owner [:header-cta-invisible] (< (.-top (.getBoundingClientRect no-cta)) vh))
-                           (om/set-state! owner [:header-bkg-invisible] (< (.-top (.getBoundingClientRect nav-no-bkg)) 70)))]
+                           (om/set-state! owner [:header-bkg-invisible] (< (.-top (.getBoundingClientRect nav-no-bkg)) 70))
+                           (om/set-state! owner [:header-bkg-scroller] (min (js/Math.abs (.-top (.getBoundingClientRect nav-no-bkg)))
+                                                                            (js/Math.abs (- 70 (.-bottom (.getBoundingClientRect nav-bkg)))))))]
     (om/set-state! owner [:browser-resize-key]
                    (goog.events/listen
                     (sel1 (om/get-shared owner [:target]) ".app-main")
@@ -55,12 +57,15 @@
       (let [ab-tests (:ab-tests app)
             controls-ch (om/get-shared owner [:comms :controls])]
         (html [:div.home.page
-               [:nav.home-nav {:class (concat
+               [:nav.home-nav {:style (merge {}
+                                             (when (> 70 (:header-bkg-scroller state))
+                                               {:background-size (str "100% " (:header-bkg-scroller state) "px")}))
+                               :class (concat
                                        (when (:header-logo-visible state) ["logo-visible"])
                                        (when (:header-cta-visible state) ["cta-visible"])
                                        (when (:header-bkg-visible state) ["bkg-visible"])
-                                       (when (:header-cta-invisible state) ["cta-invisible"])
-                                       (when (:header-bkg-invisible state) ["bkg-invisible"]))}
+                                       (when (:header-bkg-invisible state) ["bkg-invisible"])
+                                       (when (:header-cta-invisible state) ["cta-invisible"]))}
                 [:a.promo "What is Continuous Integration?"]
                 [:a.login "Log In"]
                 (om/build drawings/logo-circleci app)


[#840] Resolve eastwood warning -- don't shadow apply with local fn

--- backend/test/akvo/lumen/transformation_test.clj
+++ backend/test/akvo/lumen/transformation_test.clj
@@ -106,19 +106,19 @@
   (let [dataset-id (import-file "GDP.csv" {:dataset-name "GDP Undo Test"})
         {previous-table-name :table-name} (latest-dataset-version-by-dataset-id test-conn
                                                                                {:dataset-id dataset-id})
-        apply (partial tf/apply test-conn dataset-id)]
-    (is (= ::lib/ok (first (apply {:type :undo}))))
-    (let [[tag _] (do (apply {:type :transformation
-                                 :transformation {"op" "core/to-lowercase"
-                                                  "args" {"columnName" "c1"}
-                                                  "onError" "fail"}})
-                      (apply {:type :transformation
-                                 :transformation {"op" "core/change-datatype"
-                                                  "args" {"columnName" "c5"
-                                                          "newType" "number"
-                                                          "defaultValue" 0}
-                                                  "onError" "default-value"}})
-                      (apply {:type :undo}))]
+        apply-transformation (partial tf/apply test-conn dataset-id)]
+    (is (= ::lib/ok (first (apply-transformation {:type :undo}))))
+    (let [[tag _] (do (apply-transformation {:type :transformation
+                                             :transformation {"op" "core/to-lowercase"
+                                                              "args" {"columnName" "c1"}
+                                                              "onError" "fail"}})
+                      (apply-transformation {:type :transformation
+                                             :transformation {"op" "core/change-datatype"
+                                                              "args" {"columnName" "c5"
+                                                                      "newType" "number"
+                                                                      "defaultValue" 0}
+                                                              "onError" "default-value"}})
+                      (apply-transformation {:type :undo}))]
       (is (= ::lib/ok tag))
       (is (not (:exists (table-exists test-conn {:table-name previous-table-name}))))
       (is (= (:columns (dataset-version-by-dataset-id test-conn
@@ -133,7 +133,7 @@
                                         {:rnum 1
                                          :column-name "c1"
                                          :table-name table-name})))))
-      (apply {:type :undo})
+      (apply-transformation {:type :undo})
       (let [table-name (:table-name
                         (latest-dataset-version-by-dataset-id test-conn
                                                               {:dataset-id dataset-id}))]
@@ -145,13 +145,13 @@

 (deftest ^:functional combine-transformation-test
   (let [dataset-id (import-file "name.csv" {:has-column-headers? true})
-        apply (partial tf/apply test-conn dataset-id)]
-    (let [[tag _] (apply {:type :transformation
-                             :transformation {"op" "core/combine"
-                                              "args" {"columnNames" ["c1" "c2"]
-                                                      "newColumnTitle" "full name"
-                                                      "separator" " "}
-                                              "onError" "fail"}})]
+        apply-transformation (partial tf/apply test-conn dataset-id)]
+    (let [[tag _] (apply-transformation {:type :transformation
+                                         :transformation {"op" "core/combine"
+                                                          "args" {"columnNames" ["c1" "c2"]
+                                                                  "newColumnTitle" "full name"
+                                                                  "separator" " "}
+                                                          "onError" "fail"}})]
       (is (= ::lib/ok tag))
       (let [table-name (:table-name
                         (latest-dataset-version-by-dataset-id test-conn
@@ -173,10 +173,10 @@

 (deftest ^:functional date-parsing-test
   (let [dataset-id (import-file "dates.csv" {:has-column-headers? true})
-        apply (partial tf/apply test-conn dataset-id)]
-    (let [[tag {:strs [datasetId]}] (do (apply (date-transformation "c1" "YYYY"))
-                                        (apply (date-transformation "c2" "DD/MM/YYYY"))
-                                        (apply (date-transformation "c3" "YYYY-MM-DD")))]
+        apply-transformation (partial tf/apply test-conn dataset-id)]
+    (let [[tag {:strs [datasetId]}] (do (apply-transformation (date-transformation "c1" "YYYY"))
+                                        (apply-transformation (date-transformation "c2" "DD/MM/YYYY"))
+                                        (apply-transformation (date-transformation "c3" "YYYY-MM-DD")))]
       (is (= ::lib/ok tag))
       (let [table-name (:table-name (latest-dataset-version-by-dataset-id test-conn
                                                                           {:dataset-id datasetId}))
@@ -222,9 +222,9 @@

 (deftest ^:functional derived-column-test
   (let [dataset-id (import-file "derived-column.csv" {:has-column-headers? true})
-        apply (partial tf/apply test-conn dataset-id)]
-    (do (apply (change-datatype-transformation "c2"))
-        (apply (change-datatype-transformation "c3")))
+        apply-transformation (partial tf/apply test-conn dataset-id)]
+    (do (apply-transformation (change-datatype-transformation "c2"))
+        (apply-transformation (change-datatype-transformation "c3")))

     (testing "Import and initial transforms"
       (is (= (latest-data dataset-id)
@@ -233,26 +233,29 @@
               {:rnum 3 :c1 nil :c2 4.0 :c3 5.0}])))

     (testing "Basic text transform"
-      (apply (derive-column-transform {"args" {"code" "row['foo'].toUpperCase()"
-                                               "newColumnTitle" "Derived 1"
-                                               "newColumnType" "text"}
-                                       "onError" "leave-empty"}))
+      (apply-transformation (derive-column-transform
+                             {"args" {"code" "row['foo'].toUpperCase()"
+                                      "newColumnTitle" "Derived 1"
+                                      "newColumnType" "text"}
+                              "onError" "leave-empty"}))
       (is (= ["A" "B" nil] (map :d1 (latest-data dataset-id)))))

     (testing "Basic text transform with drop row on error"
-      (apply (derive-column-transform {"args" {"code" "row['foo'].replace('a', 'b')"
-                                               "newColumnTitle" "Derived 3"
-                                               "newColumnType" "text"}
-                                       "onError" "delete-row"}))
+      (apply-transformation (derive-column-transform
+                             {"args" {"code" "row['foo'].replace('a', 'b')"
+                                      "newColumnTitle" "Derived 3"
+                                      "newColumnType" "text"}
+                              "onError" "delete-row"}))
       (is (= ["b" "b"] (map :d2 (latest-data dataset-id))))
       ;; Undo this so we have all the rows in the remaining tests
-      (apply {:type :undo}))
+      (apply-transformation {:type :undo}))

     (testing "Basic text transform with abort"
-      (apply (derive-column-transform {"args" {"code" "row['foo'].length"
-                                               "newColumnTitle" "Derived 2"
-                                               "newColumnType" "number"}
-                                       "onError" "fail"}))
+      (apply-transformation (derive-column-transform
+                             {"args" {"code" "row['foo'].length"
+                                      "newColumnTitle" "Derived 2"
+                                      "newColumnType" "number"}
+                              "onError" "fail"}))
       (is (-> (latest-data dataset-id)
               first
               keys
@@ -261,81 +264,91 @@
               not)))

     (testing "Nested string transform"
-      (apply (derive-column-transform {"args" {"code" "row['foo'].toUpperCase()"
-                                               "newColumnType" "text"
-                                               "newColumnTitle" "Derived 4"}}))
+      (apply-transformation (derive-column-transform
+                             {"args" {"code" "row['foo'].toUpperCase()"
+                                      "newColumnType" "text"
+                                      "newColumnTitle" "Derived 4"}}))
       (is (= ["A" "B" nil] (map :d2 (latest-data dataset-id))))

-      (apply (derive-column-transform {"args" {"code" "row['Derived 4'].toLowerCase()"
-                                               "newColumnType" "text"
-                                               "newColumnTitle" "Derived 5"}}))
+      (apply-transformation (derive-column-transform
+                             {"args" {"code" "row['Derived 4'].toLowerCase()"
+                                      "newColumnType" "text"
+                                      "newColumnTitle" "Derived 5"}}))
       (is (= ["a" "b" nil] (map :d3 (latest-data dataset-id)))))

     (testing "Date transform"
-      (let [[tag _] (apply (derive-column-transform {"args" {"code" "new Date()"
-                                                             "newColumnType" "date"
-                                                             "newColumnTitle" "Derived 5"}
-                                                     "onError" "fail"}))]
+      (let [[tag _] (apply-transformation (derive-column-transform
+                                           {"args" {"code" "new Date()"
+                                                    "newColumnType" "date"
+                                                    "newColumnTitle" "Derived 5"}
+                                            "onError" "fail"}))]
         (is (= tag ::lib/ok))
         (is (every? number? (map :d4 (latest-data dataset-id))))))

     (testing "Valid type check"
-      (let [[tag _] (apply (derive-column-transform {"args" {"code" "new Date()"
-                                                             "newColumnType" "number"
-                                                             "newColumnTitle" "Derived 6"}
-                                                     "onError" "fail"}))]
+      (let [[tag _] (apply-transformation (derive-column-transform
+                                           {"args" {"code" "new Date()"
+                                                    "newColumnType" "number"
+                                                    "newColumnTitle" "Derived 6"}
+                                            "onError" "fail"}))]
         (is (= tag ::lib/conflict))))

     (testing "Sandboxing java interop"
-      (let [[tag _] (apply (derive-column-transform {"args" {"code" "new java.util.Date()"
-                                                             "newColumnType" "number"
-                                                             "newColumnTitle" "Derived 7"}
-                                                     "onError" "fail"}))]
+      (let [[tag _] (apply-transformation (derive-column-transform
+                                           {"args" {"code" "new java.util.Date()"
+                                                    "newColumnType" "number"
+                                                    "newColumnTitle" "Derived 7"}
+                                            "onError" "fail"}))]
         (is (= tag ::lib/conflict))))

     (testing "Sandboxing dangerous js functions"
-      (let [[tag _] (apply (derive-column-transform {"args" {"code" "quit()"
-                                                             "newColumnType" "number"
-                                                             "newColumnTitle" "Derived 7"}
-                                                     "onError" "fail"}))]
+      (let [[tag _] (apply-transformation (derive-column-transform
+                                           {"args" {"code" "quit()"
+                                                    "newColumnType" "number"
+                                                    "newColumnTitle" "Derived 7"}
+                                            "onError" "fail"}))]
         (is (= tag ::lib/conflict))))

     (testing "Fail early on syntax error"
-      (let [[tag _] (apply (derive-column-transform {"args" {"code" ")"
-                                                             "newColumnType" "text"
-                                                             "newColumnTitle" "Derived 8"}
-                                                     "onError" "fail"}))]
+      (let [[tag _] (apply-transformation (derive-column-transform
+                                           {"args" {"code" ")"
+                                                    "newColumnType" "text"
+                                                    "newColumnTitle" "Derived 8"}
+                                            "onError" "fail"}))]
         (is (= tag ::lib/bad-request))))

     (testing "Fail infinite loop"
-      (let [[tag _] (apply (derive-column-transform {"args" {"code" "while(true) {}"
-                                                             "newColumnType" "text"
-                                                             "newColumnTitle" "Derived 9"}
-                                                     "onError" "fail"}))]
+      (let [[tag _] (apply-transformation (derive-column-transform
+                                           {"args" {"code" "while(true) {}"
+                                                    "newColumnType" "text"
+                                                    "newColumnTitle" "Derived 9"}
+                                            "onError" "fail"}))]
         (is (= tag ::lib/bad-request))))

     (testing "Disallow anonymous functions"
-      (let [[tag _] (apply (derive-column-transform {"args" {"code" "(function() {})()"
-                                                             "newColumnType" "text"
-                                                             "newColumnTitle" "Derived 10"}
-                                                     "onError" "fail"}))]
+      (let [[tag _] (apply-transformation (derive-column-transform
+                                           {"args" {"code" "(function() {})()"
+                                                    "newColumnType" "text"
+                                                    "newColumnTitle" "Derived 10"}
+                                            "onError" "fail"}))]
         (is (= tag ::lib/bad-request)))

-      (let [[tag _] (apply (derive-column-transform {"args" {"code" "(() => 'foo')()"
-                                                             "newColumnType" "text"
-                                                             "newColumnTitle" "Derived 11"}
-                                                     "onError" "fail"}))]
+      (let [[tag _] (apply-transformation (derive-column-transform
+                                           {"args" {"code" "(() => 'foo')()"
+                                                    "newColumnType" "text"
+                                                    "newColumnTitle" "Derived 11"}
+                                            "onError" "fail"}))]
         (is (= tag ::lib/bad-request))))))

 (deftest ^:functional delete-column-test
   (let [dataset-id (import-file "dates.csv" {:has-column-headers? true})
-        apply (partial tf/apply test-conn dataset-id)]
-    (let [[tag _] (apply {:type :transformation
-                          :transformation {"op" "core/delete-column"
-                                           "args" {"columnName" "c2"}
-                                           "onError" "fail"}})]
+        apply-transformation (partial tf/apply test-conn dataset-id)]
+    (let [[tag _] (apply-transformation {:type :transformation
+                                         :transformation {"op" "core/delete-column"
+                                                          "args" {"columnName" "c2"}
+                                                          "onError" "fail"}})]
       (is (= ::lib/ok tag))
       (let [{:keys [columns transformations]} (latest-dataset-version-by-dataset-id test-conn
                                                                                {:dataset-id dataset-id})]
@@ -346,12 +359,12 @@

 (deftest ^:functional rename-column-test
   (let [dataset-id (import-file "dates.csv" {:has-column-headers? true})
-        apply (partial tf/apply test-conn dataset-id)]
-    (let [[tag _] (apply {:type :transformation
-                          :transformation {"op" "core/rename-column"
-                                           "args" {"columnName" "c2"
-                                                   "newColumnTitle" "New Title"}
-                                           "onError" "fail"}})]
+        apply-transformation (partial tf/apply test-conn dataset-id)]
+    (let [[tag _] (apply-transformation {:type :transformation
+                                         :transformation {"op" "core/rename-column"
+                                                          "args" {"columnName" "c2"
+                                                                  "newColumnTitle" "New Title"}
+                                                          "onError" "fail"}})]
       (is (= ::lib/ok tag))
       (let [{:keys [columns transformations]} (latest-dataset-version-by-dataset-id test-conn
                                                                                {:dataset-id dataset-id})]


Put grid on top of shapes.

Put grid on top of shapes.

--- src/uxbox/ui/workspace/canvas.cljs
+++ src/uxbox/ui/workspace/canvas.cljs
@@ -63,15 +63,16 @@
                         :width width
                         :height height}
       (background)
-      (when (contains? flags :grid)
-        (grid 1))
       [:svg.page-layout {}
        (shapes-selection)
        [:g.main {}
         (for [item (reverse (:shapes page))]
           (-> (uus/shape item)
               (rum/with-key (str item))))
-        (draw-area)]]])))
+        (draw-area)]]
+      (when (contains? flags :grid)
+        (grid 1))])))
+

 (def canvas
   (mx/component


fix activity center community invite preview (#12803)

--- src/status_im/ui/screens/notifications_center/views/notification.cljs
+++ src/status_im/ui/screens/notifications_center/views/notification.cljs
@@ -54,7 +54,7 @@
        ;;TODO (perf) move to event
        (home-item/memo-timestamp timestamp)]
       [react/view {:style styles/notification-message-container}
-       [home-item/message-content-text (select-keys message [:content :content-type]) false]
+       [home-item/message-content-text (select-keys message [:content :content-type :community-id]) false]
        (cond (= type constants/activity-center-notification-type-mention)
              [react/view {:style styles/group-info-container
                           :accessibility-label :chat-name-container}
@@ -89,4 +89,4 @@
                 :width  18
                 :height 18
                 :container-style styles/reply-icon}]
-              [home-item/message-content-text (select-keys reply-message [:content :content-type]) false]])]]]))
+              [home-item/message-content-text (select-keys reply-message [:content :content-type :community-id]) false]])]]]))


Nesting error

Nesting error

--- src/wishlistd/cljs/main.cljs
+++ src/wishlistd/cljs/main.cljs
@@ -47,8 +47,8 @@
    [:div#info-box
     [:div#info-close]
     [:div#info-text [:p "Wishlisted.org gives you a single place for all your wishlists, no signup required. Simply create a wishlist and add some wishes and optionally URLs. You will be automatically assigned your own unique URL that you can use to return to your wishlist at any time. Anyone else with the link will also be able to view and update it."]
-                    [:p "The site was built using a combination of open source technologies by Erik Kronberg and Stina Qvarnström."]]
-   [:div#info-container]]])
+                    [:p "The site was built using a combination of open source technologies by Erik Kronberg and Stina Qvarnström."]]]
+   [:div#info-container]])

 ; GETTING AND SETTING


screenbuffer test

screenbuffer test

--- clojure/src/dnd/showScreen.cljs
+++ clojure/src/dnd/showScreen.cljs
@@ -3,6 +3,8 @@
             [dnd.level :refer [width height]]
             [dnd.color :refer [COLOR color-to-vec]]
             ))
+
+(defonce terminal (nodejs/require "terminal-kit"))

 (def bresenham (nodejs/require "bresenham-js"))

@@ -102,10 +104,17 @@
 (defn show-screen [term level character]
   ;(defn callback [error] (when error (println error)))
   ;(.drawImage term
-              ;"http://www.ontariotrails.on.ca/assets/images/mastheads-all/cheltenham2.jpg"
-              ;#js {:shrink #js {:width 100 :height 100}}
-              ;callback
-              ;)
+  ;"http://www.ontariotrails.on.ca/assets/images/mastheads-all/cheltenham2.jpg"
+  ;#js {:shrink #js {:width 100 :height 100}}
+  ;callback
+  ;)
+
+  ;; (def buffer ((.. terminal -ScreenBuffer -create) #js {:dst term :width 20 :height 10}))
+  ;; (.put buffer
+  ;;       #js {:x 0 :y 2 :attr #js {:color "green" :bgColor "black"}}
+  ;;       "Pizza is Forever")
+  ;; (.draw buffer)
+

   (->> level
        (viewable-coords character)


Remove example of problem which no longer exists

--- test/transit/verify.clj
+++ test/transit/verify.clj
@@ -407,40 +407,3 @@
                        (:count time)
                        (name (:encoding time))))))
   (print-report results opts))
-
-(comment ;; example of problem with msgpack
-
-  (defn start-process  [command encoding]
-    (let [p (.start (ProcessBuilder. [command (name encoding)]))
-          out (BufferedOutputStream. (.getOutputStream p))
-          in (BufferedInputStream. (.getInputStream p))]
-      {:out out :p p :in in}))
-
-  (defn stop-process [proc]
-    (.write (:out proc) 3) ;; send Ctrl+C
-    (.flush (:out proc))
-    (.destroy (:p proc)))
-
-  (defn write-to-stream [proc transit-data]
-    (println "Send bytes:")
-    (println (count transit-data))
-    (println (Hex/encodeHexString transit-data))
-    (.write (:out proc) transit-data 0 (count transit-data))
-    (.flush (:out proc)))
-
-  (defn read-response [proc]
-    (println (.read (:in proc))))
-
-  ;; works
-  (def p (start-process "../transit-ruby/bin/roundtrip" :json))
-  (write-to-stream p (.getBytes "{\"~#'\":42}"))
-  (read-response p)
-  (stop-process p)
-
-  ;; doesn't work
-  (def p (start-process "../transit-ruby/bin/roundtrip" :msgpack))
-  (write-to-stream p (.getBytes "{\"~#'\":42}"))
-  (read-response p)
-  (stop-process p)
-
-)


Remove unused require

Remove unused require

--- src/braid/core/server/db/common.clj
+++ src/braid/core/server/db/common.clj
@@ -1,7 +1,6 @@
 (ns braid.core.server.db.common
   (:require
     [clojure.edn :as edn]
-    [clojure.set :refer [rename-keys]]
     [datomic.api :as d]))

 (defn create-entity-txn


add ring-handler to figwheel http server

--- src/leiningen/new/reagent/project.clj
+++ src/leiningen/new/reagent/project.clj
@@ -45,7 +45,8 @@

                    :figwheel {:http-server-root "public"
                               :server-port 3449
-                              :css-dirs ["resources/public/css"]}
+                              :css-dirs ["resources/public/css"]
+                              :ring-handler {{project-ns}}.handler/app}

                    :env {:dev? true}


remove debug statement

remove debug statement

--- src/cetcd/core.clj
+++ src/cetcd/core.clj
@@ -19,7 +19,6 @@
 (defmacro with-connection [config & body]
   `(do
      (let [config# (merge default-config ~config)]
-       (println config#)
        (binding [*etcd-config* config#]
          ~@body))))


Disable hash for now and just check every 6 hours

--- src/clj/sbsk/components/crawler.clj
+++ src/clj/sbsk/components/crawler.clj
@@ -92,7 +92,7 @@
   (fn []
     (log/debug "Starting crawler process...")
     (let [records (map scrub (fetch app-id app-secret page-id))
-          new-hash (hash records)]
+          new-hash #_(hash records) nil] ;; hash is unreliable so disable until we can do this better
       (if (not= new-hash @hash-atom)
         (do
           (log/info "New hash was observed:" new-hash)


Clean up debug printing

Clean up debug printing

--- src/cljs/asciinema_player/core.cljs
+++ src/cljs/asciinema_player/core.cljs
@@ -33,7 +33,6 @@
           (<! (timeout (* 1000 delay)))
           (>! ch data)
           (recur (rest coll))))
-      (print "finished sending data")
       (close! ch))
     ch))

@@ -62,7 +61,6 @@
   (map (fn [[delay changes]] [(/ delay speed) changes]) frames))

 (defn start-playback [state dispatch]
-  (print "starting")
   (let [start (js/Date.)
         play-from (:play-from state)
         speed (:speed state)
@@ -84,15 +82,13 @@
                          (do
                            (dispatch [:update-state apply-changes v])
                            (recur))
-                         (dispatch [:finished]))
+                         (do
+                           (dispatch [:finished])
+                           (print (str "finished in " (elapsed-time-since start)))))
           stop-playback-chan nil))) ; do nothing, break the loop
-    (go
-      (<! stop-playback-chan)
-      (print (str "finished in " (elapsed-time-since start))))
     (assoc state :stop stop-fn)))

 (defn stop-playback [state]
-  (print "stopping")
   (let [t ((:stop state))]
     (-> state
         (dissoc :stop)


select latest edited deck after login

select latest edited deck after login

--- src/cljs/netrunner/deckbuilder.cljs
+++ src/cljs/netrunner/deckbuilder.cljs
@@ -198,8 +198,9 @@

     om/IDidUpdate
     (did-update [this prev-props prev-state]
-      (if (and (not (empty? decks)) (not (:deck prev-state)))
-        (om/set-state! owner :deck (first (sort-by :date > decks)))))
+      (let [deck (:deck prev-state)]
+        (when-not (some #{deck} decks)
+          (om/set-state! owner :deck (first (sort-by :date > decks))))))

     om/IRenderState
     (render-state [this state]


fix issue with unknown card in deckbuilder

--- src/cljs/netrunner/deckbuilder.cljs
+++ src/cljs/netrunner/deckbuilder.cljs
@@ -141,7 +141,7 @@
      (end-edit owner)
      (let [deck (assoc (om/get-state owner :deck) :date (.toJSON (js/Date.)))
            decks (remove #(= (:_id deck) (:_id %)) (:decks @app-state))
-           cards (for [card (:cards deck)]
+           cards (for [card (:cards deck) :when (get-in card [:card :title])]
                    {:qty (:qty card) :card (get-in card [:card :title])})
            data (assoc deck :cards cards)]
        (try (js/ga "send" "event" "deckbuilder" "save") (catch js/Error e))
@@ -189,7 +189,7 @@
              "<deck game=\"0f38e453-26df-4c04-9d67-6d43de939c77\">
<card qty=\"1\" id=\""
              id (:code identity) "\">" (:title identity) "</card>
"
              "
"
-             (apply str (for [c (:cards deck)]
+             (apply str (for [c (:cards deck) :when (get-in c [:card :title])]
                           (str "<card qty=\"" (:qty c) "\" id=\"" id (get-in c [:card :code]) "\">"
                                (html-escape (get-in c [:card :title])) "</card>")))
              "
</deck>")


Adding writers to filefolder

Adding writers to filefolder

--- src/clojure/alfresco/filefolder.clj
+++ src/clojure/alfresco/filefolder.clj
@@ -19,6 +19,7 @@
             [alfresco.nodes :as n])
   (:import [org.alfresco.service.cmr.model FileFolderService
                                            FileInfo]
+           [java.io File ByteArrayInputStream]
            [org.alfresco.model ContentModel]))

 (defn ^FileFolderService file-folder-service
@@ -44,6 +45,24 @@
    (.getNodeRef (.create (file-folder-service) parent child-name ContentModel/TYPE_CONTENT)))
   ([parent child-name child-type]
    (.getNodeRef (.create (file-folder-service) parent child-name child-type))))
+
+(defn get-file-folder-writer
+  "Returns the ContentWriter for the given node & property (default to cm:content).
+   Should not normally be used directly - write! is preferable."
+  ([node] (.getWriter (file-folder-service) node)))
+
+(defmulti write!
+  "Writes content to the given file or folder"
+  #(type (first %&)))
+
+(defmethod write! java.lang.String
+  ([src node]          (write! (ByteArrayInputStream. (.getBytes src "UTF-8")) node)))
+
+(defmethod write! java.io.InputStream
+  ([src node]          (.putContent (get-file-folder-writer node) src)))
+
+(defmethod write! java.io.File
+  ([src node]          (.putContent (get-file-folder-writer node) src)))

 (defn delete!
   "Deletes the given node.  Note: duplicate of alfresco.nodes/delete!."


uncle

uncle

--- tasks.clj
+++ tasks.clj
@@ -2,7 +2,7 @@
   (:use [cake.core :only [deftask]]
         [cake.file :only [file rm rmdir]]
         [bake.core :only [log]]
-        [cake.ant :only [ant args env add-zipfileset]]
+        [uncle.core :only [ant args env add-zipfileset]]
         [cake.utils :only [os-name os-arch]])
   (:import [org.apache.tools.ant.taskdefs Copy ExecTask Replace]))


fix tasks.clj

fix tasks.clj

--- tasks.clj
+++ tasks.clj
@@ -1,4 +1,4 @@
-(ns tasks
+(ns cake.user
   (:use cake cake.core cake.ant cake.file
         [cake.utils :only [git]]
         [bake.core :only [log]]


disable test

disable test

--- test/clj/just_married/api_test.clj
+++ test/clj/just_married/api_test.clj
@@ -33,8 +33,8 @@
           resp (sut/app req)]
       (is (= (-> resp :status) 302))
       (is (true? (clojure.string/includes?
-                    (get-in resp [:headers "Location"])
-                    "main?language=it")))))
+                  (get-in resp [:headers "Location"])
+                  "main?language=it")))))

   (testing "No redirect if language set manually"
     (let [req (mock/request :get "/main?language=it")
@@ -49,15 +49,15 @@
     (let [req (mock/request :get "/login" {:password "secure-password"})
           resp (sut/app req)])))

-(deftest notify-test
-  (testing "Send a notification"
-    (let [req
-          (-> (mock/request :post "/notify")
-              (mock/json-body {:email "friend@mail.com"
-                               :name "friend"}))
-          resp (sut/app req)]
+#_(deftest notify-test
+    (testing "Send a notification"
+      (let [req
+            (-> (mock/request :post "/notify")
+                (mock/json-body {:email "friend@mail.com"
+                                 :name "friend"}))
+            resp (sut/app req)]

-      (is (= (-> resp :status) 201)))))
+        (is (= (-> resp :status) 201)))))

 (when db-reachable?
   (deftest guest-list-test


refactor tests

refactor tests

--- test/cljs/tictactoe/game_test.cljs
+++ test/cljs/tictactoe/game_test.cljs
@@ -119,13 +119,14 @@

 (defn valid-next-game?
   [old-game new-game move]
-  (let [next-player (logic/get-next-player new-game)
-        prev-player (logic/get-next-player old-game)]
+  (let [new-player (logic/get-next-player new-game)
+        old-player (logic/get-next-player old-game)
+        new-board (logic/get-board new-game)
+        old-board (logic/get-board old-game)]
     (and
-      (not= prev-player next-player)
-      (= prev-player (get (logic/get-board new-game) move))
-      (= (dissoc (logic/get-board old-game) move)
-        (dissoc (logic/get-board new-game) move))
+      (not= old-player new-player)
+      (= old-player (get new-board move))
+      (= (dissoc old-board move) (dissoc new-board move))
       )))

 (defn valid-move-properties


Remove previously introduced point transit handlers.

They are not necessary because transit already
has its own default handling mechanisim for unknown
objects.

--- src/uxbox/util/transit.clj
+++ src/uxbox/util/transit.clj
@@ -10,27 +10,13 @@
   (:import java.io.ByteArrayInputStream
            java.io.ByteArrayOutputStream))

-;; --- Point Handling
-
-(defrecord Point [x y])
-
-(def point-write-handler
-  (t/write-handler
-   (constantly "point")
-   #(into {} %)))
-
-(def point-read-handler
-  (t/read-handler map->Point))
-
 ;; --- Handlers

 (def ^:private +reader-handlers+
-  (merge dt/+read-handlers+
-         {"point" point-read-handler}))
+  dt/+read-handlers+)

 (def ^:private +write-handlers+
-  (merge dt/+write-handlers+
-         {Point point-write-handler}))
+  dt/+write-handlers+)

 ;; --- Public Api


Fix tests

Fix tests

--- test/github_changelog/github_test.clj
+++ test/github_changelog/github_test.clj
@@ -40,7 +40,7 @@

 (deftest get-pulls
   (testing "without multiple pages"
-    (let [body [{:example ""}]]
+    (let [body (sample 2 Pull)]
       (with-fake-routes-in-isolation
         {{:address api-endpoint :query-params {:state "closed"}} (mocked-response-fn body)}
         (is (= body (github/get-pulls config))))))


Abit of inbox slipped in there

Abit of inbox slipped in there

--- src/leiningen/new/cljskel/setup.clj
+++ src/leiningen/new/cljskel/setup.clj
@@ -163,5 +163,5 @@
      (try
        (do (.requestEnsureConnection db)
            (mongo-call)
-           (inbox.setup/check-write-concerns))
+           (check-write-concerns))
        (finally (.requestDone db)))))


Improve comments.  Improve debug middleware

--- src/re_frame/middleware.cljs
+++ src/re_frame/middleware.cljs
@@ -2,15 +2,22 @@
   (:require
     [reagent.ratom  :refer [IReactiveAtom]]
     [re-frame.undo  :refer [store-now!]]
-    [re-frame.utils :refer [warn]]
+    [re-frame.utils :refer [warn log dbg group groupEnd]]
     [clojure.data   :as data]))

 ;; See docs in the Wiki: https://github.com/Day8/re-frame/wiki

+(defn noop
+  "Middleware which does nothing"
+  [handler]
+  handler)
+
 (defn pure
-  "Middleware which means a handler takes a value in the first parameter, not an atom.
-  If you strip away the error/efficiency checks, it is doing this:
+  "Acts as an adaptor, allowing handlers to be writen as pure functions.
+  The re-frame router will pass in an atom as the first parameter. This middleware
+  adapts that to the value within the atom.
+  If you strip away the error/efficiency checks, this middleware does this:
      (reset! app-db (handler @app-db event-vec))"
   [handler]
   (fn new-handler
@@ -35,22 +42,22 @@
     [db v]
     (if (satisfies? IReactiveAtom db)
       (str "re-frame: \"debug\" middleware used without prior \"pure\"."))
-    (warn "event: " v)    ;; XXX don't use warn
+    (group "event: " v)
     (let [new-db  (handler db v)
           diff    (data/diff db new-db)]
-      (warn "it was: "  (first diff)  "\nis now: " (second diff))    ;; XXX don't use warn
+      (log  "before: " (first diff))
+      (log " after: " (second diff))
+      (groupEnd)
       new-db)))

-;; warning: untested
 (defn undoable
-  "Middleware which stores an undo checkpoint, prior to handler being called."
+  "Middleware which stores an undo checkpoint."
   [handler]
   (fn new-handler
     [app-db event-vec]
     (store-now!)
     (handler app-db event-vec)))
-

 (defn trim-v
@@ -64,7 +71,7 @@

 (defn path
   "Supplies a sub-tree of `app-db` to the handler.
-  Assumes pure is in the middleware pipeline prior.
+  Assumes \"pure\" is in the middleware pipeline prior.
   Grafts the result back into app-db."
   [p]
   (fn middleware
@@ -102,8 +109,6 @@
       (handler db v))))

-
-
 ;; warning: untested
 ;; check the state of db AFTER the handler has run, using a prismatic Schema.
 #_(defn check-schema


Fix typo

Fix typo

--- src/riak_mesos/scheduler.clj
+++ src/riak_mesos/scheduler.clj
@@ -25,7 +25,7 @@
                               (clj-mesos.scheduler/send-framework-message driver executor-id slave-id (.getBytes (pr-str command))))))
                         (when (= :task-running (:state status))
                           (swap! active-executors conj [(:executor-id status) (:slave-id status)]))
-                        (let [id-from status (comp #(Integer/parseInt %) str last :task-id)]
+                        (let [id-from-status (comp #(Integer/parseInt %) str last :task-id)]
                           (cond
                             (= (:task-state status) :task-staging) nil
                             (= (:task-state status) :task-starting) nil


Cleanup the initialization of the inputs

--- src/io/cyanite.clj
+++ src/io/cyanite.clj
@@ -59,7 +59,6 @@
     (let [config (config/load-path path)]
       (start-logging! (merge config/default-logging (:logging config)))
       (-> (component/system-map
-           :input  (input/build-input (:input config))
            :clock  (map->SystemClock {})
            :queues (queue/map->BlockingMemoryQueue (:queue config))
            :drift  (build-drift (:drift config))


Reverse date sorting for posts

Reverse date sorting for posts

--- src/jkpl/parse.clj
+++ src/jkpl/parse.clj
@@ -52,6 +52,8 @@
   (assoc (parse-page conf filename content :page-type "post")
          :date (parse-date filename)))

+(defn- reverse-compare [a b] (compare b a))
+
 (defn- parse-pages
   [conf coll]
   (->> coll
@@ -62,7 +64,7 @@
   [conf coll]
   (->> coll
        (map (partial apply parse-post conf))
-       (sort-by :date)
+       (sort-by :date reverse-compare)
        link-posts))

 (defn site


Disable wallet initialization in desktop. Part of #5739

Signed-off-by: Pedro Pombeiro <f8c34e1c5d363d76a4b9e8313641f62c1029c3e7@users.noreply.github.com>

--- src/status_im/init/core.cljs
+++ src/status_im/init/core.cljs
@@ -168,6 +168,13 @@
            console-contact
            (assoc :contacts/contacts {constants/console-chat-id console-contact}))}))

+(defn initialize-wallet [cofx]
+  (when-not platform/desktop?
+    (handlers-macro/merge-fx cofx
+                             (models.wallet/update-wallet)
+                             (transactions/run-update)
+                             (transactions/start-sync))))
+
 (defn login-only-events [address {:keys [db] :as cofx}]
   (when (not= (:view-id db) :create-account)
     (handlers-macro/merge-fx cofx
@@ -191,9 +198,7 @@
                            (chat/process-pending-messages)
                            (browser/initialize-browsers)
                            (browser/initialize-dapp-permissions)
-                           (models.wallet/update-wallet)
-                           (transactions/run-update)
-                           (transactions/start-sync)
+                           (initialize-wallet)
                            (accounts.update/update-sign-in-time)
                            (login-only-events address)))


[#7537] fix Contact stuck on login screen

Signed-off-by: Igor Mandrigin <042dc4512fa3d391c5170cf3aa61e6a638f84342@mandrigin.ru>

--- src/status_im/init/core.cljs
+++ src/status_im/init/core.cljs
@@ -201,8 +201,19 @@

 (defn login-only-events [cofx address stored-pns]
   (fx/merge cofx
-            {:notifications/request-notifications-permissions nil}
-            (navigation/navigate-to-cofx :home nil)
+            (cond->
+             {:notifications/request-notifications-permissions nil}
+
+              platform/ios?
+              ;; on ios navigation state might be not initialized yet when
+              ;; navigate-to call happens.
+              ;; That's why it should be delayed a bit.
+              ;; TODO(rasom): revisit this later and find better solution
+              (assoc :dispatch-later
+                     [{:ms       1
+                       :dispatch [:navigate-to :home]}]))
+            (when-not platform/ios?
+              (navigation/navigate-to-cofx :home nil))
             (notifications/process-stored-event address stored-pns)
             (when platform/desktop?
               (chat-model/update-dock-badge-label))))


Test test-job-name->version-3 (improper and/or missing version)

--- test/emender_jenkins/results_test.clj
+++ test/emender_jenkins/results_test.clj
@@ -224,6 +224,15 @@
 (deftest test-job-name->version-3
     "Check the emender-jenkins.results/job-name->version function."
     (testing "the emender-jenkins.results/job-name->version function."
+        (are [x y] (= x y)
+            "unknown" (job-name->version "test-Product-Book1-en-US")
+            "unknown" (job-name->version "test-Product_Book1")
+            "unknown" (job-name->version "test-Product")
+            "unknown" (job-name->version "test"))))
+
+(deftest test-job-name->version-4
+    "Check the emender-jenkins.results/job-name->version function."
+    (testing "the emender-jenkins.results/job-name->version function."
         (is (= "unknown" (job-name->version nil)))))

 (deftest test-job-name->book-name-1