fix network options in stack generator

fix network options in stack generator

--- src/clj/swarmpit/docker/engine/mapper/compose.clj
+++ src/clj/swarmpit/docker/engine/mapper/compose.clj
@@ -97,7 +97,7 @@
    (if (in-stack? stack-name net)
      {:driver      (:driver net)
       :internal    (when (:internal net) true)
-      :driver_opts (:options net)}
+      :driver_opts (-> net :options (name-value->map))}
      {:external true})})

 (defn volume


changed IndependendDRawer's macro to private; renamed drawer_state into state; fixed drawing thread to wait until surfaceChanged will initialize bitmap; tweaked drawing thread to remove messages from queue right when they read it; tweaked with-canvas macro to omit drawing of bitmap if there's no non-after-actions specified;

--- src/clojure/android/clojure/IndependentDrawer.clj
+++ src/clojure/android/clojure/IndependentDrawer.clj
@@ -18,7 +18,7 @@
               :name android.clojure.IndependentDrawer
               :extends android.view.SurfaceView
               :implements [android.view.SurfaceHolder$Callback]
-              :state drawer_state
+              :state state
               :init drawer-init
               :post-init drawer-post-init)
   (:import [android.content Context]
@@ -32,7 +32,8 @@
             ConcurrentLinkedQueue
             LinkedBlockingQueue
             ThreadPoolExecutor
-            TimeUnit]))
+            TimeUnit])
+  (:use [clojure.test :only (function?)]))

 (defn- log
   ([msg] (android.util.Log/d "IndependentDrawer" msg))
@@ -89,85 +90,97 @@
                        format
                        width
                        height]
-  (reset! (.drawing-bitmap ^DrawerState (.drawer_state this))
-          (if-let [orig-bmap ^Bitmap @(.drawing-bitmap ^DrawerState (.drawer_state this))]
-            (Bitmap/createScaledBitmap orig-bmap width height true)
-            (Bitmap/createBitmap width height android.graphics.Bitmap$Config/ARGB_8888)))
-  (reset! (.drawing-canvas ^DrawerState (.drawer_state this))
-          (Canvas. @(.drawing-bitmap ^DrawerState (.drawer_state this)))))
+  (let [new-bitmap ^Bitmap
+        (if-let [orig-bmap ^Bitmap @(.drawing-bitmap ^DrawerState (.state this))]
+          (Bitmap/createScaledBitmap orig-bmap width height true)
+          (Bitmap/createBitmap width height android.graphics.Bitmap$Config/ARGB_8888))]
+    (reset! (.drawing-bitmap ^DrawerState (.state this))
+            new-bitmap)
+    (reset! (.drawing-canvas ^DrawerState (.state this))
+            (Canvas. new-bitmap))))

 (declare make-drawing-thread)

 (defn -surfaceCreated [^android.clojure.IndependentDrawer this
                        ^SurfaceHolder holder]
-  (reset! (.surface-available? ^DrawerState (.drawer_state this)) true)
+  (reset! (.surface-available? ^DrawerState (.state this)) true)
   (let [thread ^Thread (make-drawing-thread this)]
-    (reset! (.drawing-thread ^DrawerState (.drawer_state this))
+    (reset! (.drawing-thread ^DrawerState (.state this))
             thread)
     (.start thread)))

 (defn -surfaceDestroyed [^android.clojure.IndependentDrawer this
                          ^SurfaceHolder holder]
-  (reset! (.surface-available? ^DrawerState (.drawer_state this)) false)
+  (reset! (.surface-available? ^DrawerState (.state this)) false)
   (loop []
     (when (not (try
-                 (.join ^Thread @(.drawing-thread ^DrawerState (.drawer_state this)))
+                 (.join ^Thread @(.drawing-thread ^DrawerState (.state this)))
                  true
                  (catch InterruptedException e
                    false)))
       (recur))))

-(defmacro with-canvas
-  "action will be executed with canvas-var bound to drawing canvas whole
-contents is stored in drawing bitmap and will be preserved between
-different actions.
+(defmacro ^{:private true} with-canvas
+  "when non-empty-action evaluates to true the action will be executed
+with canvas-var bound to drawing canvas whose contents is stored in drawing
+bitmap and will be preserved between different actions.

 after-action will be executed with canvas-var bounded to the
 resulting canvas with drawing-bitmap drawn on. Content of this canvas will
 not be preserved."
-  ([canvas-var surface-view action after-action]
-     `(with-canvas ~canvas-var ~surface-view ~action ~after-action nil))
-  ([canvas-var surface-view action after-action post-action]
+  ([canvas-var surface-view non-empty-action action after-action]
      `(if-let [surface-canvas# ^Canvas (.. ~surface-view (getHolder) (lockCanvas))]
         (try
-          (let [~canvas-var ^Canvas @(.drawing-canvas ^DrawerState (.drawer_state ~surface-view))]
-            ~action)
-          (.drawBitmap surface-canvas#
-                       ^Bitmap @(.drawing-bitmap ^DrawerState
-                                                 (.drawer_state ~surface-view))
-                       0.0
-                       0.0
-                       nil)
+          (when ~non-empty-action
+            (let [~canvas-var ^Canvas @(.drawing-canvas ^DrawerState (.state ~surface-view))]
+              (assert ~canvas-var "error: drawing-canvas of surface view is nil")
+              ~action)
+            (.drawBitmap surface-canvas#
+                         ^Bitmap @(.drawing-bitmap ^DrawerState
+                                                   (.state ~surface-view))
+                         0.0
+                         0.0
+                         nil))
           (let [~canvas-var ^Canvas surface-canvas#]
+            (assert ~canvas-var)
             ~after-action)
           (finally
-            ~post-action
             (.. ~surface-view (getHolder) (unlockCanvasAndPost surface-canvas#))))
         (log "Unexpected error: lockCanvas returned nil"))))

-(defmacro call-on-func-or-func-seq [f func-or-coll]
+(defmacro ^{:private true} call-on-func-or-func-seq [f func-or-coll]
   `(when ~func-or-coll
-     (if (seq? ~func-or-coll)
-       (dorun (map ~f ~func-or-coll))
-       (~f ~func-or-coll))))
+     (if (function? ~func-or-coll)
+       (~f ~func-or-coll)
+       (dorun (map ~f ~func-or-coll)))))

 (defn- ^Thread make-drawing-thread [^android.clojure.IndependentDrawer this]
-  (let [msg-queue ^ConcurrentLinkedQueue (.message-queue ^DrawerState (.drawer_state this))]
+  (let [msg-queue ^ConcurrentLinkedQueue (.message-queue ^DrawerState (.state this))]
     (Thread.
      (fn []
        (log "Drawing thread's born")
+       ;; wait while surfaceChanged will set up drawing canvas for up
        (loop []
-         (when @(.surface-available? ^DrawerState (.drawer_state this))
-           (if-let [msg (.peek msg-queue)]
+         (when-not @(.drawing-canvas ^DrawerState (.state this))
+           (Thread/sleep 25 0)
+           (recur)))
+       (log "Drawing thread's ready to draw")
+       (loop []
+         (when @(.surface-available? ^DrawerState (.state this))
+           ;; note: if exceptions happens when we're processing this message -
+           ;; let it be, it's removed from queue here and there's no other
+           ;; way around. If you try other ways around make sure they're
+           ;; correct with respect to concurrent clear-drawing-queue invokations
+           (if-let [msg (.poll msg-queue)]
              (case (msg :type)
                :plain
                (let [{:keys [actions after-actions]} msg]
                  (with-canvas canvas this
+                   (not (nil? actions))
                    (call-on-func-or-func-seq #(% canvas) actions)
-                   (call-on-func-or-func-seq #(% canvas) after-actions)
-                   (.poll msg-queue)))
+                   (call-on-func-or-func-seq #(% canvas) after-actions)))
                :animation
                ;; if type is :animation then anim-actions and anim-after-actions are
                ;; sequences of functions of two argumetns:
@@ -176,6 +189,7 @@
                      msg
                      start-time (System/currentTimeMillis)]
                  (with-canvas canvas this
+                   (not (nil? anim-actions))
                    (call-on-func-or-func-seq #(% canvas 0) anim-actions)
                    (call-on-func-or-func-seq #(% canvas 0) anim-after-actions))
                  (Thread/sleep pause-time 0)
@@ -185,6 +199,7 @@
                      (assert (<= 0 diff))
                      (when (< diff duration)
                        (with-canvas canvas this
+                         (not (nil? anim-actions))
                          (call-on-func-or-func-seq #(% canvas (/ diff duration))
                                                    anim-actions)
                          (call-on-func-or-func-seq #(% canvas (/ diff duration))
@@ -192,11 +207,10 @@
                        (Thread/sleep pause-time 0)
                        (recur))))
                  (with-canvas canvas this
+                   (not (nil? anim-actions))
                    (call-on-func-or-func-seq #(% canvas 1) anim-actions)
                    (call-on-func-or-func-seq #(% canvas 1) anim-after-actions))
-                 (Thread/sleep pause-time 0)
-                 ;; completed action or not - remove it anyway
-                 (.poll msg-queue)))
+                 (Thread/sleep pause-time 0)))
              (Thread/sleep 100 0))
            (recur)))
        (log "Drawing thread dies"))
@@ -236,7 +250,7 @@
            (contains? #{:plain :animation} (msg :type)))
     (.add ^ConcurrentLinkedQueue
           (.message-queue ^DrawerState
-                          (.drawer_state drawer))
+                          (.state drawer))
           msg)
     (log "Error: attempt to send invalid message: %s" msg)))


Update web template

Update web template

--- src/clojure/leiningen/new/web_clojure/project.clj
+++ src/clojure/leiningen/new/web_clojure/project.clj
@@ -1,8 +1,8 @@
 (defproject {{name}} "0.0.1-SNAPSHOT"
   :description "FIXME: write this!"
   :dependencies [[org.clojure/clojure "1.6.0"]
-                 [org.clojure/clojurescript "0.0-2202"]
-                 [ring "1.2.2"]]
+                 [org.clojure/clojurescript "0.0-2227"]
+                 [ring "1.3.0"]]
   :plugins [[lein-cljsbuild "1.0.3"]
             [lein-ring "0.8.10"]]
   :hooks [leiningen.cljsbuild]


Revert "Merge branch 'apache-use-hb-cache-for-topo-info' of https://github.com/d2r/storm into STORM-599"

This reverts commit ac3bfc1815962cc2458ae9c6bbf04912210dd153, reversing
changes made to f874464795685860c31fef5307f8ced39ed9480a.

--- storm-core/src/clj/backtype/storm/daemon/nimbus.clj
+++ storm-core/src/clj/backtype/storm/daemon/nimbus.clj
@@ -365,8 +365,7 @@
                        nimbus-time
                        (>= (time-delta nimbus-time) timeout))
        :nimbus-time nimbus-time
-       :executor-reported-time reported-time
-       :heartbeat hb}))
+       :executor-reported-time reported-time}))

 (defn update-heartbeat-cache [cache executor-beats all-executors timeout]
   (let [cache (select-keys cache all-executors)]
@@ -1262,9 +1261,11 @@
               _ (check-authorization! nimbus storm-name topology-conf "getTopologyInfo")
               task->component (storm-task-info (try-read-storm-topology conf storm-id) topology-conf)
               base (.storm-base storm-cluster-state storm-id nil)
+              storm-name (if base (:storm-name base) (throw (NotAliveException. (str storm-id))))
               launch-time-secs (if base (:launch-time-secs base) (throw (NotAliveException. (str storm-id))))
+              task->component (storm-task-info (try-read-storm-topology conf storm-id) topology-conf)
               assignment (.assignment-info storm-cluster-state storm-id nil)
-              beats (map-val :heartbeat @(:heartbeats-cache nimbus))
+              beats (.executor-beats storm-cluster-state storm-id (:executor->node+port assignment))
               all-components (-> task->component reverse-map keys)
               errors (->> all-components
                           (map (fn [c] [c (get-errors storm-cluster-state storm-id c)]))


Separate and improved stuff on going from BigInts to other things.

--- test/clojure_the_language/clojure_numerics_test.clj
+++ test/clojure_the_language/clojure_numerics_test.clj
@@ -207,13 +207,6 @@
 ;;;   address the need for type-insensitive equivalence tests.

 (fact (== 2 2N 2M 2.0M 2.0) => true) ; true even for inexact things
-
-;;;; ___________________________________________________________________________
-
-(fact (type (- 2N 1N)) => clojure.lang.BigInt)
-(fact (type (/ 4N 2N)) => clojure.lang.BigInt)
-(fact (type (/ 2N 4N)) => clojure.lang.Ratio)
-

 ;;;; ___________________________________________________________________________
 ;;;; ---- `=-and-same-type` ----
@@ -264,3 +257,28 @@
       (let [unboxed-max-long Long/MAX_VALUE]
         (unchecked-inc unboxed-max-long))
       => Long/MIN_VALUE)))
+
+;;;; ___________________________________________________________________________
+;;;; ---- Going from BigInts to smaller ----
+;;;; ---- Going from BigInts to other things ----
+
+(fact "Does not demote from BigInt"
+  (type (- max-long-plus-1 Long/MAX_VALUE))
+  => clojure.lang.BigInt)
+
+(fact "When the ratio of two BigInts is an integer, the result is a BigInt"
+  (type (/ 4N 2N))
+  => clojure.lang.BigInt)
+
+(fact "When the ratio of two BigInts is not an integer, the result is a Ratio"
+  (/ 3N 2N) => 3/2
+  (let [v (+' Long/MAX_VALUE 2)]
+    (type v)        => clojure.lang.BigInt
+    (type (/ v 2))) => clojure.lang.Ratio)
+
+;; (defmacro my-=>
+;;   ([form expected-value]
+;;      `(let [] (fact ~form ~'=> ~expected-value))))
+
+;; (fact (my-=> 3 3))
+;; (fact (my-=> 3 4))


carry-reagent: bump version

carry-reagent: bump version

--- contrib/reagent/project.clj
+++ contrib/reagent/project.clj
@@ -1,5 +1,5 @@
 (defproject
-  carry-reagent "0.1.0"
+  carry-reagent "0.2.0"
   :description "Reagent bindings for Carry."
   :url "https://github.com/metametadata/carry/tree/master/contrib/reagent"
   :license {:name "MIT" :url "http://opensource.org/licenses/MIT"}


Ensure that `:initialCenterCoordinate` attribute gets the correct data

Mapview component accepts the `:initialCenterCoordinate` which always must have
longitude and latitude attributes. This ensures that they will always be present
even when they are missing from the map passed retreived from the app state.

--- src/status_im/chat/views/api/geolocation/views.cljs
+++ src/status_im/chat/views/api/geolocation/views.cljs
@@ -23,6 +23,10 @@
                 #(reset! cur-loc-geocoded (json->clj %))
                 #(reset! cur-loc-geocoded nil))
       true)))
+
+(defn get-coord [{:keys [latitude longitude]}]
+  {:latitude (or latitude 0)
+   :longitude (or longitude 0)})

 (defn place-item [{:keys [title address pin-style] [latitude longitude] :center}]
   [touchable-highlight {:on-press #(do
@@ -58,7 +62,7 @@
                               (dispatch [:set-chat-seq-arg-input-text "Dropped pin"])
                               (dispatch [:chat-input-blur :seq-input-ref])
                               (dispatch [:load-chat-parameter-box (:command command)]))
-                    :initialCenterCoordinate coord
+                    :initialCenterCoordinate (get-coord coord)
                     :showsUserLocation true
                     :initialZoomLevel 10
                     :logoIsHidden true
@@ -140,10 +144,11 @@
         result          (reaction (when @pin-location (get-places @pin-location pin-geolocation)))
         result2         (reaction (when @pin-location (get-places @pin-location pin-nearby true)))]
     (fn []
-      (let [_ @result _ @result2]
+      (let [_ @result _ @result2
+            coord (select-keys (:coords geolocation) [:latitude :longitude])]
         [view
          [view
-          [mapview {:initial-center-coordinate (select-keys (:coords geolocation) [:latitude :longitude])
+          [mapview {:initial-center-coordinate (get-coord coord)
                     :initialZoomLevel 10
                     :onRegionDidChange #(reset! pin-location (js->clj % :keywordize-keys true))
                     :logoIsHidden true
@@ -171,4 +176,4 @@
                       [place-item {:title text :address place_name :center center}]
                       (when (not= feature (last (:features @pin-nearby)))
                         [view st/item-separator])])
-                   (:features @pin-nearby)))])]))))+                   (:features @pin-nearby)))])]))))


Ensure sync ns is required

Ensure sync ns is required

It currently would be required when needed, but kind of by coincidence.
Explicitly require it so it's clear that it needs to be required before
websocket requests start coming in

--- src/braid/server/handler.clj
+++ src/braid/server/handler.clj
@@ -12,6 +12,8 @@
             [clojure.tools.nrepl.server :as nrepl]
             ; requiring router so mount sees state
             [braid.server.socket :refer [router]]
+            ; require so multimethods get registered
+            [braid.server.sync]
             [braid.server.routes.socket :refer [sync-routes]]
             [braid.server.routes.client :refer [desktop-client-routes
                                                 mobile-client-routes


Quick backup, may not be needed.

Quick backup, may not be needed.

--- src/brevis/example/swarm.clj
+++ src/brevis/example/swarm.clj
@@ -76,8 +76,7 @@
 (defn random-bird
   "Make a new random bird."
   []
-  (let [bird (make-bird (random-bird-position))]
-    bird))
+  (make-bird (random-bird-position)))

 (defn bound-acceleration
   "Keeps the acceleration within a reasonable range."


Add tests for raising errors in async Jetty

--- ring-jetty-adapter/test/ring/adapter/test/jetty.clj
+++ ring-jetty-adapter/test/ring/adapter/test/jetty.clj
@@ -274,6 +274,14 @@
                        (.write w "data: world\n\n")
                        (.flush w)))))})))

+(defn- error-cps [request respond raise]
+  (raise (ex-info "test" {:foo "bar"})))
+
+(defn- sometimes-error-cps [request respond raise]
+  (if (= (:uri request) "/error")
+    (error-cps request respond raise)
+    (hello-world-cps request respond raise)))
+
 (deftest run-jetty-cps-test
   (testing "async response in future"
     (with-server hello-world-cps-future {:port test-port, :async? true}
@@ -298,4 +306,20 @@
         (is (.startsWith (get-in response [:headers "content-type"])
                          "text/event-stream"))
         (is (= (:body response)
-               "data: hello\n\ndata: world\n\n"))))))
+               "data: hello\n\ndata: world\n\n")))))
+
+  (testing "error response"
+    (with-server error-cps {:port test-port, :async? true}
+      (let [response (http/get test-url {:throw-exceptions false})]
+        (is (= (:status response) 500)))))
+
+  (testing "mixed error with normal responses"
+    (with-server sometimes-error-cps {:port test-port, :async? true}
+      (let [response (http/get (str test-url "/error") {:throw-exceptions false})]
+        (is (= (:status response) 500)))
+      (let [response (http/get test-url {:throw-exceptions false})]
+        (is (= (:status response) 200)))
+      (let [response (http/get (str test-url "/error") {:throw-exceptions false})]
+        (is (= (:status response) 500)))
+      (let [response (http/get test-url {:throw-exceptions false})]
+        (is (= (:status response) 200))))))


Increase thread test timeout to 100 seconds

--- ring-jetty-adapter/test/ring/adapter/test/jetty.clj
+++ ring-jetty-adapter/test/ring/adapter/test/jetty.clj
@@ -151,7 +151,7 @@
       (let [thread-count (count (all-threads))]
         (is (thrown? Exception (run-jetty hello-world {:port 4347})))
         (loop [i 0]
-          (when (and (< i 300) (not= thread-count (count (all-threads))))
-            (Thread/sleep 100)
+          (when (and (< i 400) (not= thread-count (count (all-threads))))
+            (Thread/sleep 250)
             (recur (inc i))))
         (is (= thread-count (count (all-threads))))))))


master: previous version not stable

master: previous version not stable

--- hello/project.clj
+++ hello/project.clj
@@ -4,7 +4,7 @@
   :license {:name "Eclipse Public License"
             :url "http://www.eclipse.org/legal/epl-v10.html"}
   :dependencies [[org.clojure/clojure "1.8.0"]
-                 [org.clojure/data.json "0.2.7"]
+                 [org.clojure/data.json "0.2.6"]
                  [com.amazonaws/aws-lambda-java-core "1.0.0"]]
   :main ^:skip-aot hello.core
   :target-path "target/%s"


HttpInputOverHTTP is a bad word

HttpInputOverHTTP is a bad word

--- src/clj/arclight/handler.clj
+++ src/clj/arclight/handler.clj
@@ -147,8 +147,8 @@
                (read-string (slurp (str "resources/public/" file)))
                (slurp (str "resources/public/" file)))
         list (filter (partial not= "default")
-                     (into [] (map :name (db/query db ["select name from projects"]))))]
-    (-> req
+                     (into [] (map :name (db/query db ["select name from projects order by id"]))))]
+    (-> {}
         (assoc-in [:body :type] filetype)
         (assoc-in [:body :list] list)
         (assoc-in [:body :data] data))))


Add initialize indexes on app start

Add initialize indexes on app start

--- src/clj/clojuredocs/main.clj
+++ src/clj/clojuredocs/main.clj
@@ -40,6 +40,10 @@
   (mon/set-connection! (mon/make-connection mongo-url))
   (mon/add-index! :examples [:ns :name :library-url])
   (mon/add-index! :vars [:ns :name :library-url])
+  (mon/add-index! :namespaces [:name])
+  (mon/add-index! :see-alsos [:name :ns :library-url])
+  (mon/add-index! :libraries [:namespaces])
+  (mon/add-index! :var-comments [:var.ns :var.name :var.library-url])
   (let [stop-server (start-http-server entry
                       {:port port :join? false})]
     (println (format "Server running on port %d" port))


Move pluralize to util

Move pluralize to util

--- src/clj/clojuredocs/util.clj
+++ src/clj/clojuredocs/util.clj
@@ -70,5 +70,10 @@
       (str/replace #"_div" "/")
       (str/replace #"_qm" "?")))

-(defn $var-link [ns name text]
-  [:a {:href (str "/" ns "/" (munge-name name))} text])
+(defn $var-link [ns name & contents]
+  (vec (concat
+         [:a {:href (str "/" ns "/" (munge-name name))}]
+         contents)))
+
+(defn pluralize [n single plural]
+  (str n " " (if (= 1 n) single plural)))


fix translation key

fix translation key

--- src/clj/salava/user/data.clj
+++ src/clj/salava/user/data.clj
@@ -122,8 +122,10 @@
                                                [:chunk.chunk (str (t :user/Activated ul) ": ")][:chunk (str (if (true? (:activated $user)) (t :core/Yes ul) (t :core/No ul)) "  ")]
                                                [:chunk.chunk (str (t :user/Emailnotifications ul) ": ")][:chunk (str (if (true? (:email_notifications $user)) (t :core/Yes ul) (t :core/No ul)) "  ")]
                                                [:chunk.chunk (str (t :user/Profilevisibility ul) ": ")][:chunk (t (keyword (str "core/"(capitalize (:profile_visibility $user)))) ul)]"\n"
-                                               [:chunk.chunk (str (t :user/Aboutme ul) ":")]"\n"
-                                               [:paragraph (or (:about $user) "-")]]
+                                               (when-not (blank? (:about $user))
+                                                 [:paragraph
+                                                  [:chunk.chunk (str (t :user/Aboutme ul) ":")]"\n"
+                                                  [:paragraph (or (:about $user) "-")]])]
                                               [:spacer 2]
                                               [:paragraph.generic
                                                (if (> (count $emails) 1)
@@ -207,7 +209,7 @@
                                                                                [:chunk.chunk (str (t :badge/Criteria ul) ": ")][:paragraph (strip-html-tags (:criteria_content %))]"\n"])
                                                                                (when-not (blank? (:status b))
                                                                                [:phrase
-                                                                                [:chunk.chunk (str (t :user/Status ul) ": ")][:chunk  (str (:status b) "  ")]])
+                                                                                [:chunk.chunk (str (t :user/Status ul) ": ")][:chunk  (capitalize (str (t (keyword (str "social/"(:status b))) ul) "  "))]])
                                                                                (when-not (blank? (str (:verified_by_obf b)))
                                                                                [:phrase
                                                                                [:chunk.chunk (str (t :badge/Verifiedbyobf ul) ": ")][:chunk (str (if (true? (:verified_by_obf b)) (t :core/Yes ul) (t :core/No ul)) "  ")]])
@@ -231,7 +233,7 @@
                                                                                [:chunk.chunk (str (t :badge/Revoked ul) ": ")] [:chunk (str (if (true? (:revoked b)) (t :core/Yes ul) (t :core/No ul)) "  ")]])
                                                                                (when-not (blank? (:visibility b) )
                                                                                [:phrase
-                                                                                [:chunk.chunk (str (t :badge/Badgevisibility ul) ": ")] [:chunk (t (keyword (str "core/" (capitalize (:visibility b)))))]"\n"])
+                                                                                [:chunk.chunk (str (t :badge/Badgevisibility ul) ": ")] [:chunk (t (keyword (str "core/" (capitalize (:visibility b)))) ul)]"\n"])

                                                                                (when-not (blank? (:obf_url b))
                                                                                [:phrase
@@ -387,7 +389,7 @@
                                                                                (when (= "html" (:type pb))
                                                                                [:phrase
                                                                                [:spacer 0]
-                                                                                [:phrase.chunk (str (t :page/html ul) ": ")]
+                                                                                [:phrase.chunk (str (t :page/Html ul) ": ")]
                                                                                [:spacer 0]
                                                                                (or (:content pb) "-")])
                                                                                (when (= "file" (:type pb))


some refactoring

some refactoring

--- src/cljs/fluch/terminal.cljs
+++ src/cljs/fluch/terminal.cljs
@@ -80,10 +80,11 @@
              foreground-color background-color)
    })

-(s/defn calculate-block-location
+(s/defn locate-block
+  "returns the pixel location and dimensions of the block in pixels"
   [{:keys [size options]} :- schemas/Terminal
-   row-index :- s/Num
-   col-index :- s/Num]
+   col-index :- s/Num
+   row-index :- s/Num]
   (let [{:keys [font]} options
         {:keys [ratio]} font
         [x-ratio y-ratio] ratio
@@ -94,6 +95,13 @@
      :width width
      :height height}))

+(s/defn get-block :- schemas/TerminalBlock
+  "get the block at the given column-row point"
+  [{:keys [content]} :- schemas/Terminal
+   row-index :- s/Num
+   col-index :- s/Num]
+  (-> content (get row-index) (get col-index)))
+
 (defmulti draw-block
   (fn [term block row-index col-index]
     (:type block)))
@@ -101,46 +109,43 @@
 (s/defmethod draw-block "Empty"
   [term :- schemas/Terminal
    block :- schemas/EmptyBlock
-   row-index :- s/Num
-   col-index :- s/Num]
+   col-index :- s/Num
+   row-index :- s/Num]
   (let [{:keys [context options]}
         term
         {:keys [background-color]}
         options
         {:keys [x y width height]}
-        (calculate-block-location term row-index col-index)]
+        (locate-block term col-index row-index)]
     (canvas/fill-rect context x y width height :color background-color)
     ))

 (s/defmethod draw-block "Text"
   [term :- schemas/Terminal
    block :- schemas/TextBlock
-   row-index :- s/Num
-   col-index :- s/Num]
+   col-index :- s/Num
+   row-index :- s/Num]
   (let [{:keys [context options size]} term
         {:keys [foreground-color background-color text font]} (merge options block)
-        {:keys [x y width height]} (calculate-block-location term row-index col-index)]
+        {:keys [x y width height]} (locate-block term col-index row-index)]
     (canvas/fill-rect context x y width height :color background-color)
     (canvas/draw-text context text x y
                       :size size
                       :family (:family font)
-                      :foreground-color foreground-color)
-    ))
+                      :foreground-color foreground-color)))

 (defn refresh
-  [{:keys [content] :as term}]
-  (let [num-rows (count content)
-        num-cols (count (first content))]
-    (loop [i 0 j 0]
-      (draw-block term (-> content (get j) (get i)) j i)
-      (cond
-        ;; processed all blocks
-        (and (>= (inc j) num-rows) (>= (inc i) num-cols))
-        term
-        ;; at the end of the row
-        (>= (inc i) num-cols)
-        (recur 0 (inc j))
-        ;; process the next column in the row
-        :else
-        (recur (inc i) j)
-        ))))
+  [{:keys [rows cols] :as term}]
+  (loop [i 0 j 0]
+    (draw-block term (get-block term i j) i j)
+    (cond
+      ;; processed all blocks
+      (and (>= (inc j) rows) (>= (inc i) cols))
+      term
+      ;; at the end of the row
+      (>= (inc i) cols)
+      (recur 0 (inc j))
+      ;; process the next column in the row
+      :else
+      (recur (inc i) j)
+      )))


Fix back button

Fix back button

--- src/cljs/subman/history.cljs
+++ src/cljs/subman/history.cljs
@@ -9,13 +9,10 @@
 (defn get-history
   "Get html5 history obj or fallback"
   []
-  (let [history (doto (goog.history.Html5History.)
-                  (.setUseFragment false)
-                  (.setPathPrefix "/search/")
-                  (.setEnabled true))]
-    (gevents/unlisten (.-window_ history) (.-POPSTATE gevents/EventType)
-                      (.-onHistoryEvent_ history) false history)
-    history))
+  (doto (goog.history.Html5History.)
+    (.setUseFragment false)
+    (.setPathPrefix "/search/")
+    (.setEnabled true)))

 (defn init-history
   "Init history and spy to atom"
@@ -28,7 +25,8 @@
                                 (.setToken history new-value)))))
       (gevents/listen history history-event/NAVIGATE
                       #(let [token (.-token %)]
-                         (when-not (= token @value)
+                         (when (and (= (.-isNavigatopn %))
+                                    (not= token @value))
                            (reset! value token))))
       (->> (.getToken history)
            string/urlDecode


Add name for player and character

Add name for player and character

--- src/cljs/yadnd5ecs/core.cljs
+++ src/cljs/yadnd5ecs/core.cljs
@@ -5,12 +5,29 @@

 (enable-console-print!)

-(def app-state (atom {:text "Hello Chestnut!"}))
+(def app-state (atom {:name {:player "Bob"
+                             :character "Bruenor"}}))
+
+(defcomponent name-view
+  [name owner]
+  (render
+   [_]
+   (let [{:keys [player
+                 character]} name]
+     (dom/span
+      (dom/h1 (str "Name: " player))
+      (dom/h1 (str "Character: " character))))))

 (defcomponent app-view
   [app owner]
-  (render [_]
-          (dom/h1 (:text app))))
+  (render
+   [_]
+   (dom/div
+    (dom/h1 (str "Hello " (-> app :name :character)
+                 (when-let [name (-> app :name :player)]
+                   (str " (" name ")"))
+                 "!"))
+    (om/build name-view (:name app)))))

 (defn main []
   (om/root


Improve exception message about invalid return value from rendering function

--- src/main/clojure/cascade/internal/viewbuilder.clj
+++ src/main/clojure/cascade/internal/viewbuilder.clj
@@ -29,7 +29,7 @@
     (string? any) (text-node any)
     (number? any) (raw-node (str any))
     true (throw (RuntimeException.
-      (format "A rendering function returned %s. Rendering functions should return nil, a string, a seq of DOM nodes, or a single DOM node."
+      (format "A rendering function returned %s. Rendering functions should return nil, a string, a number, a DOM node or a seq of such values."
     (pr-str any))))))

 (defn combine


Rename monkeypatched render function to make its purpose clearer

Especially in browser profiling.

--- src/day8/re_frame/trace.cljs
+++ src/day8/re_frame/trace.cljs
@@ -53,7 +53,7 @@

 (def static-fns
   {:render
-   (fn render []
+   (fn mp-render []                                         ;; Monkeypatched render
      (this-as c
        (trace/with-trace {:op-type   :render
                           :tags      {:component-path (component-path c)}


Enable case insensitive filtering

Enable case insensitive filtering

--- src/day8/re_frame/trace.cljs
+++ src/day8/re_frame/trace.cljs
@@ -118,7 +118,7 @@

 (defn search-input [{:keys [title on-save on-stop]}]
   (let [val  (r/atom title)
-        save #(let [v (-> @val str clojure.string/trim)]
+        save #(let [v (-> @val str str/trim)]
                 (on-save v))]
     (fn []
       [:input {:type        "text"
@@ -139,7 +139,7 @@
       (let [slower-than-ms-int   (js/parseInt @slower-than-ms)
             slower-than-bold-int (js/parseInt @slower-than-bold)
             op-filter            (when-not (str/blank? @filter-items)
-                                   (filter #(str/includes? (str (:operation %) " " (:op-type %)) @filter-items)))
+                                   (filter #(str/includes? (str/lower-case (str (:operation %) " " (:op-type %))) @filter-items)))
             ms-filter            (when-not (str/blank? @slower-than-ms)
                                    (filter #(< slower-than-ms-int (:duration %))))
             transducers          (apply comp (remove nil? [ms-filter op-filter]))


Refactor adding new filters

Refactor adding new filters

--- src/day8/re_frame/trace.cljs
+++ src/day8/re_frame/trace.cljs
@@ -145,16 +145,12 @@
     (fn [trace]
       (< (:query query) (:duration trace)))))

-(defn add-filter [filter-items filter-input filter-type from-mouse?]
+(defn add-filter [filter-items filter-input filter-type]
   (swap! filter-items conj {:id (random-uuid)
-                            :query (if from-mouse?
-                                     (str/lower-case (name filter-input))
-                                     (if (= @filter-type :contains)
-                                       (str/lower-case @filter-input)
-                                       (js/parseFloat @filter-input)))
-                            :filter-type (if from-mouse?
-                                           :contains
-                                           @filter-type)}))
+                            :query (if (= filter-type :contains)
+                                     (str/lower-case filter-input)
+                                     (js/parseFloat filter-input))
+                            :filter-type filter-type}))

 (defn render-traces [showing-traces filter-items filter-input trace-detail-expansions]
   (doall
@@ -183,13 +179,13 @@
                [:td {:style row-style}
                     [:div.op-string
                      [:span {:on-click (fn [ev]
-                                         (add-filter filter-items (name op-type) :contains true)
+                                         (add-filter filter-items (name op-type) :contains)
                                          (.stopPropagation ev))}
                       (str op-type)]]]
                [:td {:style    row-style}
                     [:div.op-string
                      [:span {:on-click (fn [ev]
-                                         (add-filter filter-items (name op-name) :contains true)
+                                         (add-filter filter-items (name op-name) :contains)
                                          (.stopPropagation ev))}
                       op-name]]]
                [:td
@@ -228,7 +224,7 @@
                                      (reset! input-error true)
                                      (do
                                        (reset! input-error false)
-                                       (add-filter filter-items filter-input filter-type false))))]
+                                       (add-filter filter-items @filter-input @filter-type))))]

         [:div {:style {:flex "1 0 auto" :width "100%" :height "100%" :display "flex" :flex-direction "column"}}


More testing

More testing

--- src/test/clj/clojure/core/matrix/test_complex.clj
+++ src/test/clj/clojure/core/matrix/test_complex.clj
@@ -21,5 +21,6 @@
   (is (cm/complex? (c/complex-number 1 2)))
   (is (cm/complex? (cm/complex-array 1 2)))
   (is (not (cm/complex? 3.5)))
-  (is (not (cm/complex? [1 2 3]))))
+  (is (not (cm/complex? [1 2 3])))
+  (is (cm/complex? (cm/complex-array [1 2 3]))))


fix /pricing for logged in users

fix /pricing for logged in users

--- frontend/routes.cljs
+++ frontend/routes.cljs
@@ -112,7 +112,7 @@

   (defroute v1-pricing (FragmentRoute. "/pricing") {:as params}
     (if authenticated?
-      (open-to-inner! nav-ch :account {:subpage "plans"})
+      (open-to-inner! nav-ch :account {:subpage :plans})
       (open-to-outer! nav-ch :pricing (assoc params
                                         :_analytics-page "View Pricing Outer"
                                         :_title "Plans and Pricing"))))


Add explanation label for citation

Add explanation label for citation

--- src/discuss/utils/views.cljs
+++ src/discuss/utils/views.cljs
@@ -82,17 +82,20 @@
   (let [selection (or (lib/get-selection) (:text (rlib/get-selected-reference)) "")]
     (html
      (if (> (count selection) 1)
-       [:div.input-group
-        [:span.input-group-addon.input-group-addon-left
-         (fa-icon "fa-quote-left")]
-        [:textarea.form-control {:style {:backgroundColor "rgb(250,250,250)"}
-                                 :title (t :references :disabled/tooltip)
-                                 :disabled true
-                                 :value selection}]
-        [:span.input-group-addon
-         (fa-icon "fa-quote-right")]
-        [:span.input-group-addon.pointer {:onClick remove-selection-then-reference!}
-         (fa-icon "fa-times")]]
+       [:div
+        [:label.input-group-addon {:for "citation-area"} "Ich zitiere:"]
+        [:div.input-group
+         [:span.input-group-addon.input-group-addon-left
+          (fa-icon "fa-quote-left")]
+         [:textarea.form-control {:style {:backgroundColor "rgb(250,250,250)"}
+                                  :title (t :references :disabled/tooltip)
+                                  :disabled true
+                                  :value selection
+                                  :id "citation-area"}]
+         [:span.input-group-addon
+          (fa-icon "fa-quote-right")]
+         [:span.input-group-addon.pointer {:onClick remove-selection-then-reference!}
+          (fa-icon "fa-times")]]]
        [:div.text-center {:style {:paddingBottom "1em"}}
         (if (= :create/argument (lib/current-view))
           (t :references :has-to-add)


Add panel wrapper

Add panel wrapper

--- src/discuss/utils/views.cljs
+++ src/discuss/utils/views.cljs
@@ -53,4 +53,11 @@
   (when (discuss.utils.common/loading?)
     (dom/div #js {:className "loader"}
              (dom/svg #js {:className "circular" :viewBox "25 25 50 50"}
-                      (dom/circle #js {:className "path" :cx "50" :cy "50" :r "20" :fill "none" :strokeWidth "5" :strokeMiterlimit "10"})))))+                      (dom/circle #js {:className "path" :cx "50" :cy "50" :r "20" :fill "none" :strokeWidth "5" :strokeMiterlimit "10"})))))
+
+(defn panel-wrapper
+  "Wrap content into bootstrap's panel class."
+  [content]
+  (dom/div #js {:className "panel panel-default"}
+           (dom/div #js {:className "panel-body"}
+                    content)))


More readable thread instantiation

More readable thread instantiation

--- src/onyx/messaging/aeron/embedded_media_driver.clj
+++ src/onyx/messaging/aeron/embedded_media_driver.clj
@@ -28,7 +28,7 @@
                          (MediaDriver/launch media-driver-context))]
       (when embedded-driver?
         (.addShutdownHook (Runtime/getRuntime)
-                          (Thread. (partial delete-aeron-directory-safe media-driver-context))))
+                          (Thread. (fn [] (delete-aeron-directory-safe media-driver-context)))))
       (assoc component
              :media-driver media-driver
              :media-driver-context media-driver-context)))


Core module should use :gen-class

Core module should use :gen-class

--- src/emender_service/core.clj
+++ src/emender_service/core.clj
@@ -11,7 +11,8 @@
 ;

 (ns emender-service.core
-    "Core module that contains -main function called by Leiningen to start the application.")
+    "Core module that contains -main function called by Leiningen to start the application."
+    (:gen-class))

 (require '[ring.adapter.jetty      :as jetty])
 (require '[ring.middleware.params  :as http-params])


lein-release plugin: bumped version from 0.3.29 to 0.3.30-SNAPSHOT for next development cycle

--- re_view/project.clj
+++ re_view/project.clj
@@ -1,4 +1,4 @@
-(defproject re-view "0.3.29"
+(defproject re-view "0.3.30-SNAPSHOT"
   :description "Tiny React wrapper"
   :url "https://www.github.com/braintripping/re-view/tree/master/re_view"
   :license {:name "Eclipse Public License"
@@ -6,7 +6,7 @@
   :dependencies [[org.clojure/clojure "1.9.0-alpha17"]
                  [org.clojure/clojurescript "1.9.854"]
                  [re-db "0.1.12"]
-                 [re-view-hiccup "0.1.11-SNAPSHOT"]]
+                 [re-view-hiccup "0.1.11"]]

   :plugins [[lein-cljsbuild "1.1.2"]
             #_[lein-figwheel "0.5.0-2"]


start-time instead of round-start-time

start-time instead of round-start-time

--- src/cljs/wombats_web_client/panels/game-play.cljs
+++ src/cljs/wombats_web_client/panels/game-play.cljs
@@ -33,7 +33,7 @@
 (defn- game-play-title [game show-join-button game-id]
   (let [{:keys [game/is-private
                 game/round-number
-                game/round-start-time
+                game/start-time
                 game/status]} game]

     [:div.game-play-title-container
@@ -47,7 +47,7 @@
          :pending-closed
          :active-intermission)
         [:span (str "ROUND " round-number " STARTS IN: ")
-         [countdown-timer round-start-time]]
+         [countdown-timer start-time]]

         :active
         (str "ROUND " round-number)


Some cleanup of code.

Some cleanup of code.

--- src/cljs/wombats_web_client/panels/game_play.cljs
+++ src/cljs/wombats_web_client/panels/game_play.cljs
@@ -78,24 +78,12 @@
                                     ms))]

     ;; Force a rerender when the transition-text should change
-    (when (or (= status :active-intermission)
-              (= status :pending-open)
-              (= status :pending-closed))
+    (when (contains? #{:active-intermission :pending-open :pending-closed}
+                     status)
       (case millis-left
-        3000
-        (do
-          (timeout-fn 1000)
-          "READY")
-
-        2000
-        (do
-          (timeout-fn 1000)
-          "SET")
-
-        (0 1000)
-        (do
-          (timeout-fn 1000)
-          "GO!")
+        3000 (do (timeout-fn 1000) "READY")
+        2000 (do (timeout-fn 1000) "SET")
+        (0 1000) (do (timeout-fn 1000) "GO!")

         ;; The first 3 seconds of a round ending, show transition text
         (let [time-since-round-end (- round-intermission
@@ -106,10 +94,10 @@
             (do
               (timeout-fn transition-time-left)
               (str "ROUND " (dec round-number) " OVER"))
-            (do
-              ;; This is when we need to transition to showing "READY"
-              (when (pos? (- millis-left 3000))
-                (timeout-fn (- millis-left 3000)))
+            ;; When we need to transition to show "READY"
+            (let [show-ready-ms (- millis-left 3000)]
+              (when (pos? show-ready-ms)
+                (timeout-fn show-ready-ms))
               nil)))))))

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


Update ClojureScript

Update ClojureScript

--- src/clojure/leiningen/new/web_clojure/project.clj
+++ src/clojure/leiningen/new/web_clojure/project.clj
@@ -1,7 +1,7 @@
 (defproject {{name}} "0.0.1-SNAPSHOT"
   :description "FIXME: write this!"
   :dependencies [[org.clojure/clojure "1.6.0"]
-                 [org.clojure/clojurescript "0.0-2498"]
+                 [org.clojure/clojurescript "0.0-2505"]
                  [ring "1.3.2"]]
   :plugins [[lein-cljsbuild "1.0.3"]
             [lein-ring "0.8.13"]]


add test for select-one! returning nil result

--- test/clj/com/rpl/specter/core_test.clj
+++ test/clj/com/rpl/specter/core_test.clj
@@ -378,3 +378,8 @@
      v (gen/vector (gen/elements [k1 k2 k3]))]
     (= (filter #{k1 k2} v) (select [ALL #{k1 k2}] v))
     ))
+
+(deftest nil-select-one-test
+  (is (= nil (select-one! ALL [nil])))
+  (is (thrown? Exception (select-one! ALL [])))
+  )


WIP - start plan tests with placeholders

--- test/com/wsscode/pathom/connect/planner_test.cljc
+++ test/com/wsscode/pathom/connect/planner_test.cljc
@@ -1528,6 +1528,29 @@
                  ::pcp/index-attrs       {:other-id 1 :other-id2 3 :name 1 :other 5}
                  ::pcp/root              1})))))

+(deftest compute-run-graph-placeholders-test
+  [{:>/p1 [:a]}
+   {:>/p2 [:a
+           {:b [:x]}]}
+   {:>/p3 [:c]}]
+
+  (testing "plan works"
+    (is (= (compute-run-graph
+             {::resolvers [{::pc/sym    'a
+                            ::pc/output [:a]}]
+              ::eql/query '[(:a {:x "y"})]})
+           '{::pcp/nodes             {1 {::pc/sym               a
+                                         ::pcp/params           {:x "y"}
+                                         ::pcp/node-id          1
+                                         ::pcp/requires         {:a {}}
+                                         ::pcp/input            {}
+                                         ::pcp/source-for-attrs #{:a}}}
+             ::pcp/index-syms        {a #{1}}
+             ::pcp/unreachable-syms  #{}
+             ::pcp/unreachable-attrs #{}
+             ::pcp/root              1
+             ::pcp/index-attrs       {:a 1}}))))
+
 (deftest compute-run-graph-params-test
   (testing "add params to resolver call"
     (is (= (compute-run-graph


Also need to special case '.. in runtime munge / demunge

--- src/main/cljs/cljs/core.cljs
+++ src/main/cljs/cljs/core.cljs
@@ -9845,9 +9845,10 @@
 (defn munge [name]
   ((if (symbol? name) symbol str)
     (let [name' (munge-str (str name))]
-      (if (js-reserved? name')
-        (str name' "$")
-        name'))))
+      (cond
+        (= name' "..") "_DOT__DOT_"
+        (js-reserved? name') (str name' "$")
+        :else name'))))

 (defn- demunge-str [munged-name]
   (let [r (js/RegExp. (demunge-pattern) "g")
@@ -9867,7 +9868,10 @@

 (defn demunge [name]
   ((if (symbol? name) symbol str)
-    (demunge-str (str name))))
+    (let [name' (str name)]
+      (if (= name' "_DOT__DOT_")
+        ".."
+        (demunge-str (str name))))))

 (deftype Namespace [obj name]
   Object


got rid of polymorphism for now, just trying to get design spike working

--- test/push/design_spikes/dsl_macros.clj
+++ test/push/design_spikes/dsl_macros.clj
@@ -37,14 +37,14 @@
 ;    save the entire stack into `local` and clear it
 ;    raise an Exception if it's undefined

-; + `remember [args fn :as local]
+; + `remember-calc [args fn :as local]
 ;    save the result of applying `fn` to the named `args` under key `local`

-; - `remember [stackname :as local]`
+; + `remember-top [stackname :as local]`
 ;    store top item from `stackname` under key `local`
 ;    raise an Exception if it's empty or undefined

-; - `remember [stackname :at where :as local]`
+; + `remember-nth [stackname :at where :as local]`
 ;    store item in `stackname` at position `where` under key `local`
 ;    raise an Exception if it's empty or undefined

@@ -60,16 +60,6 @@
 ;    replace the indicated stack with a new list
 ;    raise an exception if it's undefined

-
-; restrictions are your friend:
-; every time a `consume` appears, we know one more item is needed from that stack
-; every time `consume-stack` or `count-of` appears, we know we need that type
-; every time `remember stackname :as` happens, we know we need at least 1 item
-; etc ...
-; In other words, the :needs can be inferred for each instruction from its DSL definition
-
-
-;; And I THINK that supports all defined Push instructions I've ever seen....

 (def six-ints (make-interpreter :stacks {:integer '(6 5 4 3 2 1)}))
@@ -180,9 +170,6 @@
   (second integer-added) => {:int1 6, :int2 5}))

-;; check for nil :as key
-
-
 (defn remember-top
   [[interpreter locals] stackname & {:keys [as]}]
   (if (nil? as)
@@ -192,20 +179,76 @@

 (fact "remember-top stores the top item of a named stack"
-  (let [integer-added (-> [six-ints {}]
+  (let [integer-munged (-> [six-ints {}]
                           (consume :integer :as :int1)
                           (consume :integer :as :int2)
                           (remember-top :integer :as :third))]
-  (second integer-added) => {:int1 6, :int2 5, :third 4}))
+  (second integer-munged) => {:int1 6, :int2 5, :third 4}))

 (fact "remember-top has no effect if :as is not specified"
-  (let [integer-added (-> [six-ints {}]
+  (let [integer-munged (-> [six-ints {}]
                         (consume :integer :as :int1)
                         (consume :integer :as :int2)
                         (remember-top :integer))]
-  (second integer-added) => {:int1 6, :int2 5}))
-
+  (second integer-munged) => {:int1 6, :int2 5}))
+
+
+(defn remember-nth
+  [[interpreter locals] stackname & {:keys [as at]}]
+  (if (nil? as)
+    (vector interpreter locals)
+    (let [stack (get-stack interpreter stackname)
+          which (mod (or at 0) (count stack))
+          result (nth stack which)]
+      (into [] (list interpreter (assoc locals as result))))))
+
+
+(fact "remember-nth stores the nth item of a named stack"
+  (let [integer-munged (-> [six-ints {}]
+                          (consume :integer :as :int1)
+                          (consume :integer :as :int2)
+                          (remember-nth :integer :as :third :at 1))]
+  (second integer-munged) => {:int1 6, :int2 5, :third 3}))  ;; 4 *3* 2 1
+
+
+(fact "remember-nth has no effect if :as is not specified"
+  (let [integer-munged (-> [six-ints {}]
+                        (consume :integer :as :int1)
+                        (consume :integer :as :int2)
+                        (remember-nth :integer))]
+  (second integer-munged) => {:int1 6, :int2 5}))
+
+
+(fact "remember-nth acts like remember-top if :at is not specified"
+  (let [integer-munged (-> [six-ints {}]
+                        (consume :integer :as :int1)
+                        (consume :integer :as :int2)
+                        (remember-nth :integer :as :adsa))]
+  (second integer-munged) => {:int1 6, :int2 5, :adsa 4}))
+
+
+(defn remember-stack
+  [[interpreter locals] stackname & {:keys [as at]}]
+  (if (nil? as)
+    (vector interpreter locals)
+    (let [stack (get-stack interpreter stackname)]
+      (into [] (list interpreter (assoc locals as stack))))))
+
+(fact "remember-stack stores the stack specified in the :as variable"
+  (let [integer-munged (-> [six-ints {}]
+                          (consume :integer :as :int1)
+                          (consume :integer :as :int2)
+                          (remember-stack :integer :as :rest))]
+  (second integer-munged) => {:int1 6, :int2 5, :rest '(4 3 2 1)}))
+
+
+(fact "remember-stack has no effect if :as is not specified"
+  (let [integer-munged (-> [six-ints {}]
+                        (consume :integer :as :int1)
+                        (consume :integer :as :int2)
+                        (remember-stack :integer))]
+  (second integer-munged) => {:int1 6, :int2 5}))

 ; (def-pushinstruction


RS + CW | 16 | Heroku redirects to http

RS + CW | 16 | Heroku redirects to http

--- test/stonecutter_journey_test/test.clj
+++ test/stonecutter_journey_test/test.clj
@@ -33,7 +33,7 @@
    (after :contents (do (wd/quit)))]

   (fact "can go to client page"
-        (wd/to "https://stonecutter-client.herokuapp.com")
+        (wd/to "http://stonecutter-client.herokuapp.com")
         (wait-for-title "Home")
         (screenshot "client_home_page")
-        (wd/current-url) => "https://stonecutter-client.herokuapp.com/login"))
+        (wd/current-url) => "http://stonecutter-client.herokuapp.com/login"))


Improve type getter

Improve type getter

--- src/clojure/clojurewerkz/cassaforte/query/types.clj
+++ src/clojure/clojurewerkz/cassaforte/query/types.clj
@@ -24,13 +24,16 @@
    :timeuuid  (DataType/timeuuid)})

 (defn resolve-primitive-type
-  [type-name]
-  (if-let [res (get primitive-types type-name)]
-    res
-    (throw (IllegalArgumentException. (str "Column name "
-                                           " was not found, pick one of ("
-                                           (clojure.string/join "," (keys primitive-types))
-                                           ")")))))
+  [type-or-name]
+  (if (keyword? type-or-name)
+    (if-let [res (get primitive-types type-or-name)]
+      res
+      (throw (IllegalArgumentException. (str "Column name "
+                                             (name type-or-name)
+                                             " was not found, pick one of ("
+                                             (clojure.string/join "," (keys primitive-types))
+                                             ")"))))
+    type-or-name))

 (defn list-type
   [primitive-type]


wip sketch next test for txn with fee

wip sketch next test for txn with fee

--- test/block_chain/message_handlers_test.clj
+++ test/block_chain/message_handlers_test.clj
@@ -2,6 +2,7 @@
   (:require [clojure.test :refer :all]
             [block-chain.utils :refer :all]
             [clojure.math.numeric-tower :as math]
+            [clojure.pprint :refer [pprint]]
             [block-chain.wallet :as wallet]
             [block-chain.miner :as miner]
             [block-chain.transactions :as txns]
@@ -114,6 +115,34 @@
         (is (empty? @pool))
         (is (= 0 (bc/balance (:address key-a) @chain)))
         (is (= 25 (bc/balance (:address key-b) @chain)))
+        (let [miner-addr (get-in (last @chain) [:transactions 0 :outputs 0 :address])]
+          (is (= 25 (bc/balance miner-addr @chain))))
+        (is (= 1 (count (:outputs payment))))))))
+
+#_(deftest test-submitting-transaction-with-txn-fee
+  (let [chain (atom [])
+        pool (atom #{})
+        key-a (wallet/generate-keypair 512)
+        key-b (wallet/generate-keypair 512)
+        easy-diff (hex-string (math/expt 2 248))
+        block (blocks/generate-block
+               [(miner/coinbase (:address key-a))]
+               {:target easy-diff})]
+    (miner/mine-and-commit chain block)
+    (with-redefs [db/block-chain chain
+                  db/transaction-pool pool
+                  target/default (hex-string (math/expt 2 248) )]
+      (let [payment (miner/generate-payment key-a (:address key-b) 24 @chain 1)]
+        (handler {:message-type "submit_transaction"
+                  :payload payment}
+                 sock-info)
+        (is (= 1 (count @pool)))
+        (miner/mine-and-commit)
+        (is (empty? @pool))
+        (is (= 0 (bc/balance (:address key-a) @chain)))
+        (is (= 24 (bc/balance (:address key-b) @chain)))
+        (let [miner-addr (get-in (last @chain) [:transactions 0 :outputs 0 :address])]
+          (is (= 26 (bc/balance miner-addr @chain))))
         (is (= 1 (count (:outputs payment))))))))

 ;; Need Validation Logic


clone spec

clone spec

--- test/celestial/integration/persistency.clj
+++ test/celestial/integration/persistency.clj
@@ -5,6 +5,7 @@
   (:require
     [celestial.persistency :as p])
   (:use
+    [flatland.useful.map :only  (dissoc-in*)]
     midje.sweet
     [celestial.fixtures :only (redis-prox-spec redis-type is-type? user-quota redis-actions)]
     [celestial.redis :only (clear-all)]))
@@ -65,3 +66,14 @@
           (p/get-action-index :operates-on "redis") => [(str id)]
           (p/find-action-for :deploy "redis") => redis-actions
          )))
+
+(with-state-changes [(before :facts (clear-all))]
+  (fact "simple clone" :integration :redis
+        (p/add-type redis-type)
+        (let [id (p/add-system redis-prox-spec)
+              cloned (p/clone-system id "foo")]
+          (p/get-system cloned) =>
+             (-> redis-prox-spec
+                 (dissoc-in* [:proxmox :vmid])
+                 (dissoc-in* [:machine :ip])
+                 (assoc-in [:machine :hostname] "foo")))))


remove premature commit of main.clj

remove premature commit of main.clj

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

--- plugins/SlideExplorer2/src/slide_explorer/main.clj
+++ plugins/SlideExplorer2/src/slide_explorer/main.clj
@@ -141,23 +141,21 @@
         trajectory (take number-tiles (offset-tiles center-tile tile-list))
         allowed (filter #(tile-in-pixel-rectangle?
                            % pixel-rect [tile-width tile-height])
-                        trajectory)
-        z (:z screen-state)
-        acquired-images-on-slice (get @acquired-images z)]
-    (first (remove acquired-images-on-slice allowed))))
+                        trajectory)]
+    (first (remove @acquired-images allowed))))

 ;; tile acquisition management

 (def image-processing-executor (Executors/newFixedThreadPool 1))

-(defn add-tiles-at [memory-tiles {:keys [nx ny nz] :as tile-key} affine-stage-to-pixel acquired-images]
-  (swap! acquired-images update-in nz conj tile-key)
+(defn add-tiles-at [memory-tiles [nx ny] affine-stage-to-pixel acquired-images]
+  (swap! acquired-images conj [nx ny])
   (doseq [image (doall (acquire-at (inverse-transform
                                      (Point. (* 512 nx) (* 512 ny))
                                      affine-stage-to-pixel)))]
     (let [indices {:nx nx
                    :ny ny
-                   :nz (+ nz (get-in image [:tags "SliceIndex"]))
+                   :nz (get-in image [:tags "SliceIndex"])
                    :nt 0
                    :nc (or (get-in image [:tags "Channel"]) "Default")}]
       (add-to-memory-tiles
@@ -220,25 +218,22 @@
                          (alter-meta! assoc ::directory dir))
           acquired-images (atom #{})
           affine-stage-to-pixel (origin-here-stage-to-pixel-transform)
+          first-seq (acquire-at (inverse-transform (Point. 0 0) affine-stage-to-pixel))
           screen-state (show memory-tiles acquired-images)
           explore-fn #(explore memory-tiles screen-state acquired-images
                                affine-stage-to-pixel [512 512])]
+      (.mkdirs dir)
       (def mt memory-tiles)
       (def affine affine-stage-to-pixel)
       (def ss screen-state)
       (def ai acquired-images)
-      ; move this code to the viewer
-      (let [first-seq (acquire-at (inverse-transform (Point. 0 0)
-                                                     affine-stage-to-pixel))]
-        (swap! screen-state assoc :channels (initial-lut-maps first-seq)))
+      (swap! ss assoc :channels (initial-lut-maps first-seq))
       (when new?
         (explore-fn)
         (add-watch ss "explore" (fn [_ _ old new] (when-not (= old new)
                                                     (explore-fn)))))))
   ([]
-    (let [dir (file (str "tmp" (rand-int 10000000)))]
-      (.mkdirs dir)
-      (go dir true))))
+    (go (file (str "tmp" (rand-int 10000000))) true)))

 (defn save-data-set


further refactoring

further refactoring

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

--- plugins/SlideExplorer2/src/slide_explorer/main.clj
+++ plugins/SlideExplorer2/src/slide_explorer/main.clj
@@ -47,6 +47,14 @@
   (let [p (.inverseTransform pixel-to-stage-transform (Point2D$Double. x y) nil)]
     [(.x p) (.y p)]))

+(defn origin-here-stage-to-pixel-transform
+  "Set the current location to the origin of the
+   stage to pixel transform."
+  []
+  (set-destination-origin
+    (get-stage-to-pixel-transform)
+    (.getXYStagePosition gui)))
+
 ;; tagged image stuff

 (defn stack-colors
@@ -75,6 +83,17 @@
 (defn acquire-processor-sequence []
   (map tagged-image-to-processor (acquire-tagged-image-sequence)))

+(defn acquire-at
+  "Move the stage to position x,y and acquire a multi-dimensional
+   sequence of images using the acquisition engine."
+  ([x y]
+    (acquire-at (Point2D$Double. x y)))
+  ([^Point2D$Double stage-pos]
+    (let [xy-stage (core getXYStageDevice)]
+      (set-xy-position stage-pos)
+      (core waitForDevice xy-stage)
+      (acquire-processor-sequence))))
+
 ;; stage communications

 (defn get-xy-position []
@@ -86,6 +105,8 @@
   (core setXYPosition (core getXYStageDevice) (.x position) (.y position)))

 ;; run using acquisitions
+
+;;; channel setup

 (defn initial-channel-display-settings [tagged-image-processors]
   (merge-with merge
@@ -101,26 +122,18 @@
         (for [[chan lut-map] (initial-channel-display-settings tagged-image-processors)]
           [chan {:lut (lut-object lut-map)}])))

-(defn acquire-at
-  ([x y]
-    (acquire-at (Point2D$Double. x y)))
-  ([^Point2D$Double stage-pos]
-    (let [xy-stage (core getXYStageDevice)]
-      (set-xy-position stage-pos)
-      (core waitForDevice xy-stage)
-      (acquire-processor-sequence))))
-
-(defn origin-here-stage-to-pixel-transform []
-  (set-destination-origin
-    (get-stage-to-pixel-transform)
-    (.getXYStagePosition gui)))
+;; tile acquisition management

 (defn add-tiles-at [available-tiles [nx ny] affine-stage-to-pixel]
   (doseq [image (acquire-at (inverse-transform (Point. (* 512 nx) (* 512 ny)) affine-stage-to-pixel))]
-    (add-to-available-tiles available-tiles
-                            {:nx nx :ny ny :nz (get-in image [:tags "SliceIndex"]) :nt 0
-                             :nc (or (get-in image [:tags "Channel"]) "Default")}
-                            (image :proc)))
+    (add-to-available-tiles
+      available-tiles
+      {:nx nx
+       :ny ny
+       :nz (get-in image [:tags "SliceIndex"])
+       :nt 0
+       :nc (or (get-in image [:tags "Channel"]) "Default")}
+      (image :proc)))
   (await available-tiles))

 (defn available-tile-coords [available-tiles]
@@ -141,14 +154,11 @@

 (defn acquire-next-tile
   [available-tiles-agent screen-state-atom affine [tile-width tile-height]]
-  (let [screen-state @screen-state-atom
-        visible-tiles (set (tiles-in-pixel-rectangle (pixel-rectangle screen-state)
-                                                [tile-width tile-height]))
-        next-tile (next-tile @available-tiles-agent
-                                     screen-state [tile-width tile-height])]
-    (when next-tile
-      (add-tiles-at available-tiles-agent next-tile affine))
-    next-tile))
+  (when-let [next-tile (next-tile @available-tiles-agent
+                                  @screen-state-atom
+                                  [tile-width tile-height])]
+    (add-tiles-at available-tiles-agent next-tile affine))
+  next-tile)

 (def explore-executor (Executors/newFixedThreadPool 1))


tidy up noise ugen metadata

tidy up noise ugen metadata

--- src/overtone/sc/machinery/ugen/metadata/noise.clj
+++ src/overtone/sc/machinery/ugen/metadata/noise.clj
@@ -6,9 +6,9 @@

       {:name "WhiteNoise"
-       :args []
-       :rates #{:ar :kr}
        :summary "Noise whose spectrum has equal power at all frequencies."
+       :args []
+       :rates #{:ar :kr}
        :doc "Noise that contains equal amounts of energy at every
              frequency - comparable to radio static.

@@ -19,9 +19,9 @@

       {:name "BrownNoise"
-       :args []
-       :rates #{:ar :kr}
        :summary "Noise whose spectrum falls off in power by 6 dB per octave."
+       :args []
+       :rates #{:ar :kr}
        :doc "Useful for generating percussive sounds such as snares and
              hand claps. Also useful for simulating wind or sea
              effects, for producing breath effects in wind instrument
@@ -29,9 +29,9 @@

       {:name "PinkNoise"
-       :args []
-       :rates #{:ar :kr}
        :summary "Noise whose spectrum falls off in power by 3 dB per octave."
+       :args []
+       :rates #{:ar :kr}
        :doc "Noise that gives equal power over the span of each octave.

              Useful for generating percussive sounds such as snares and
@@ -43,9 +43,9 @@

       {:name "ClipNoise"
-       :args []
-       :rates #{:ar}
        :summary "Noise whose values are either -1 or 1."
+       :args []
+       :rates #{:ar}
        :doc "This produces the maximum energy for the least peak to peak amplitude.

              Useful for generating percussive sounds such as snares and
@@ -55,9 +55,9 @@

       {:name "GrayNoise"
-       :args []
-       :rates #{:ar}
        :summary "Random impulses from -1 to +1 given a density "
+       :args []
+       :rates #{:ar}
        :doc "Given a density (average number of impulses per second)
              creates a sequence of random impulses from -1 to +1.

@@ -69,8 +69,11 @@

       {:name "Crackle"
        :summary "Chaotic noise generator"
-       :args [{:name "chaos-param", :default 1.5 :doc "a parameter of the chaotic function with useful values from just below 1.0 to just above 2.0. Towards 2.0 the sound crackles.
-"}]
+       :args [{:name "chaos-param"
+               :default 1.5
+               :doc "a parameter of the chaotic function with useful
+                     values from just below 1.0 to just above
+                     2.0. Towards 2.0 the sound crackles."}]
        :rates #{:ar :kr}
        :doc "A noise generator based on a chaotic function.

@@ -81,133 +84,205 @@

       {:name "Logistic"
-       :args [{:name "chaos-param", :default 3.0 :doc "a parameter of the chaotic function with useful values from 0.0 to 4.0. Chaos occurs from 3.57 up. Don't use values outside this range if you don't want the UGen to blow up."}
-              {:name "freq", :default 1000.0 :doc "Frequency of calculation; if over the sampling rate, this is clamped to the sampling rate"}
-              {:name "init", :default 0.5 :doc "Initial value of y (see equation below)"}]
+       :args [{:name "chaos-param"
+               :default 3.0
+               :doc "a parameter of the chaotic function with useful
+                     values from 0.0 to 4.0. Chaos occurs from 3.57
+                     up. Don't use values outside this range if you
+                     don't want the UGen to blow up." }
+
+              {:name "freq"
+               :default 1000.0
+               :doc "Frequency of calculation; if over the sampling
+                     rate, this is clamped to the sampling rate"}
+
+              {:name "init"
+               :default 0.5
+               :doc "Initial value of y (see equation below)"}]
+
        :rates #{:ar}
        :doc "A noise generator based on the logistic map:

-  y = chaos-param * y * (1.0 - y)
-
-  y will stay in the range of 0.0 to 1.0 for normal values of the chaos-param. This leads to a DC offset and may cause a pop when you stop the Synth. For output you might want to combine this UGen with a LeakDC or rescale around 0.0 via mul and add: see example below. "}
+             y = chaos-param * y * (1.0 - y)
+
+             y will stay in the range of 0.0 to 1.0 for normal values of
+             the chaos-param. This leads to a DC offset and may cause a
+             pop when you stop the Synth. For output you might want to
+             combine this UGen with a LeakDC or rescale around 0.0 via
+             mul and add: see example below. "}

       {:name "LFNoise0"
-       :args [{:name "freq", :default 500.0 :doc "approximate rate at which to generate random values."}]
-       :rates #{:ar :kr}
-       :doc "Generates random values at a rate (the rate is not guaranteed but approximate)"}
+       :args [{:name "freq",
+               :default 500.0
+               :doc "approximate rate at which to generate random
+                     values." }]
+       :rates #{:ar :kr}
+       :doc "Generates random values at a rate (the rate is not
+             guaranteed but approximate)"}
+

       {:name "LFNoise1"
-       :args [{:name "freq", :default 500.0 :doc "approximate rate at which to generate random values."}]
-       :rates #{:ar :kr}
-       :doc "Generates linearly interpolated random values at the supplied rate (the rate is not guaranteed but approximate). "}
+       :args [{:name "freq",
+               :default 500.0
+               :doc "approximate rate at which to generate random
+                     values." }]
+
+       :rates #{:ar :kr}
+       :doc "Generates linearly interpolated random values at the
+             supplied rate (the rate is not guaranteed but
+             approximate). "}
+

       {:name "LFNoise2"
-       :args [{:name "freq", :default 500.0 :doc "approximate rate at which to generate random values."}]
-       :rates #{:ar :kr}
-       :doc "Generates quadratically interpolated random values at the supplied rate (the rate is not guaranteed but approximate).
-
-  Note: quadratic interpolation means that the noise values can occasionally extend beyond the normal range
-  of +-1, if the freq varies in certain ways. If this is undesirable then you might like to clip2 the values
-  or use a linearly-interpolating unit instead."}
+       :args [{:name "freq",
+               :default 500.0
+               :doc "approximate rate at which to generate random
+                     values." }]
+       :rates #{:ar :kr}
+       :doc "Generates quadratically interpolated random values at the
+             supplied rate (the rate is not guaranteed but approximate).
+
+             Note: quadratic interpolation means that the noise values
+             can occasionally extend beyond the normal range of +-1, if
+             the freq varies in certain ways. If this is undesirable
+             then you might like to clip2 the values or use a
+             linearly-interpolating unit instead." }

       {:name "LFClipNoise"
-       :args [{:name "freq", :default 500.0 :doc "approximate rate at which to generate random values."}]
-       :rates #{:ar :kr}
-       :doc "Randomly generates the values -1 or +1 at a rate given by the nearest integer division of the sample rate by the freq argument. It is probably pretty hard on your speakers!"}
+       :args [{:name "freq"
+               :default 500.0
+               :doc "approximate rate at which to generate random
+                     values." }]
+       :rates #{:ar :kr}
+       :doc "Randomly generates the values -1 or +1 at a rate given by
+             the nearest integer division of the sample rate by the freq
+             argument. It is probably pretty hard on your speakers!" }

       {:name "LFDNoise0"
-       :args [{:name "freq", :default 500.0 :doc "rate at which to generate random values."}]
-       :rates #{:ar :kr}
-       :doc "Like LFNoise0, it generates random values at a rate given
-  by the freq argument,  with two differences:
-
-  -no time quantization
-  -fast recovery from low freq values.
-
-  (LFNoise0,1,2 quantize to the nearest integer division of the samplerate
-  and they poll the freq argument only when scheduled, and thus seem
-  to hang when freqs get very low).
-
-  If you don't need very high or very low freqs, or use fixed freqs
-  LFNoise0 is more efficient."}
+       :args [{:name "freq"
+               :default 500.0
+               :doc "rate at which to generate random values."}]
+       :rates #{:ar :kr}
+       :doc "Like lf-noise0, it generates random values at a rate given
+             by the freq argument, with two differences:
+
+             * no time quantization
+
+             * fast recovery from low freq values.
+
+             (lf-noise0,1,2 quantize to the nearest integer division of
+             the samplerate and they poll the freq argument only when
+             scheduled, and thus seem to hang when freqs get very low).
+
+             If you don't need very high or very low freqs, or use fixed
+             freqs lf-noise0 is more efficient." }

       {:name "LFDNoise1"
-       :args [{:name "freq", :default 500.0 :doc "rate at which to generate random values."}]
-       :rates #{:ar :kr}
-       :doc "Like LFNoise1, it generates linearly interpolated random values
-  at a rate given by the freq argument, with two differences:
-
-  -no time quantization
-  -fast recovery from low freq values.
-
-  (LFNoise0,1,2 quantize to the nearest integer division of the samplerate
-  and they poll the freq argument only when scheduled, and thus seem
-  to hang when freqs get very low).
-
-  If you don't need very high or very low freqs, or use fixed freqs
-  LFNoise1 is more efficient."}
+       :args [{:name "freq"
+               :default 500.0
+               :doc "rate at which to generate random values."}]
+       :rates #{:ar :kr}
+       :doc "Like lf-noise1, it generates linearly interpolated random
+             values at a rate given by the freq argument, with two differences:
+
+             * no time quantization
+
+             * fast recovery from low freq values.
+
+             (lf-noise0,1,2 quantize to the nearest integer division of
+             the samplerate and they poll the freq argument only when
+             scheduled, and thus seem to hang when freqs get very low).
+
+             If you don't need very high or very low freqs, or use fixed
+             freqs lf-noise1 is more efficient." }

       {:name "LFDNoise3"
-       :args [{:name "freq", :default 500.0 :doc "rate at which to generate random values."}]
-       :rates #{:ar :kr}
-       :doc "Similar to LFNoise2, it generates polynomially interpolated random values
-  at a rate given by the freq argument, with 3 differences:
-
-  -no time quantization
-  -fast recovery from low freq values
-  -cubic instead of quadratic interpolation
-
-  (LFNoise0,1,2 quantize to the nearest integer division of the samplerate
-  and they poll the freq argument only when scheduled, and thus seem
-  to hang when freqs get very low).
-  If you don't need very high or very low freqs, or use fixed freqs
-  LFNoise2 is more efficient."}
+       :args [{:name "freq"
+               :default 500.0
+               :doc "rate at which to generate random values."}]
+       :rates #{:ar :kr}
+       :doc "Similar to lf-noise2, it generates polynomially
+             interpolated random values at a rate given by the freq
+             argument, with 3 differences:
+
+             * no time quantization
+
+             * fast recovery from low freq values
+
+             * cubic instead of quadratic interpolation
+
+             (lf-noise0,1,2 quantize to the nearest integer division of
+             the samplerate and they poll the freq argument only when
+             scheduled, and thus seem to hang when freqs get very low).
+             If you don't need very high or very low freqs, or use fixed
+             freqs lf-noise2 is more efficient." }

       {:name "LFDClipNoise"
-       :args [{:name "freq", :default 500.0 :doc "rate at which to generate random values."}]
-       :rates #{:ar :kr}
-       :doc "Like LFClipNoise, it generates the values -1 or +1 at a rate given
-  by the freq argument,  with two differences:
-
-  -no time quantization
-  -fast recovery from low freq values.
-
-  (LFClipNoise, as well as LFNoise0,1,2 quantize to the nearest integer division
-  of the samplerate, and they poll the freq argument only when scheduled;
-  thus they often seem to hang when freqs get very low).
-
-  If you don't need very high or very low freqs, or use fixed freqs
-  LFNoise0 is more efficient."}
+       :args [{:name "freq"
+               :default 500.0
+               :doc "rate at which to generate random values."}]
+       :rates #{:ar :kr}
+       :doc "Like lf-clip-noise, it generates the values -1 or +1 at a
+             rate given by the freq argument, with two differences:
+
+             * no time quantization
+
+             * fast recovery from low freq values.
+
+             (lf-clip-noise, as well as lf-noise0,1,2 quantize to the
+             nearest integer division of the samplerate, and they poll
+             the freq argument only when scheduled; thus they often seem
+             to hang when freqs get very low).
+
+             If you don't need very high or very low freqs, or use fixed
+             freqs lf-noise0 is more efficient." }

       {:name "Hasher"
-       :args [{:name "in", :default 0.0 :doc "input signal"}]
-       :rates #{:ar}
-       :doc "Returns a unique output value from zero to one for each input value according to a hash function. The same input value will always produce the same output value. The input need not be from zero to one."}
+       :args [{:name "in"
+               :default 0.0
+               :doc "input signal"}]
+       :rates #{:ar}
+       :doc "Returns a unique output value from zero to one for each
+             input value according to a hash function. The same input
+             value will always produce the same output value. The input
+             need not be from zero to one." }

       {:name "MantissaMask"
-       :args [{:name "in", :default 0.0 :doc "input signal"}
-              {:name "bits", :default 3 :doc "the number of mantissa bits to preserve. a number from 0 to 23."}]
-       :rates #{:ar}
-       :doc "Masks off bits in the mantissa of the floating point sample value. This introduces a quantization noise, but is less severe than linearly quantizing the signal."}
+       :args [{:name "in"
+               :default 0.0
+               :doc "input signal"}
+
+              {:name "bits"
+               :default 3
+               :doc "the number of mantissa bits to preserve. a number
+                     from 0 to 23." }]
+       :rates #{:ar}
+       :doc "Masks off bits in the mantissa of the floating point sample
+             value. This introduces a quantization noise, but is less
+             severe than linearly quantizing the signal." }

       {:name "Dust"
-       :args [{:name "density", :default 0.0 :doc "average number of impulses per second"}]
+       :args [{:name "density"
+               :default 0.0
+               :doc "average number of impulses per second"}]
        :rates #{:ar :kr}
        :doc "Generates random impulses from 0 to +1."}

       {:name "Dust2"
-       :args [{:name "density", :default 0.0 :doc "average number of impulses per second."}]
+       :args [{:name "density"
+               :default 0.0
+               :doc "average number of impulses per second."}]
        :rates #{:ar :kr}
        :doc "Generates random impulses from -1 to +1."}])


bug #5058 - aligned words in recovery backup phrase screen

Signed-off-by: Goran Jovic <fc686822162e6f379ea05b6f92d78d206147085c@gmail.com>

--- src/status_im/ui/screens/profile/seed/styles.cljs
+++ src/status_im/ui/screens/profile/seed/styles.cljs
@@ -36,12 +36,14 @@
   {:flex-direction :row})

 (def six-word-num
-  {:opacity        0.4
+  {:width          20
+   :text-align     :right
+   :opacity        0.4
    :font-size      15
    :letter-spacing -0.2})

 (def six-words-word
-  {:margin-left    16
+  {:margin-left    24
    :font-size      15
    :letter-spacing -0.2})


TODO has been done

TODO has been done

--- src/onyx/messaging/aeron.clj
+++ src/onyx/messaging/aeron.clj
@@ -362,8 +362,6 @@
           [len unsafe-buffer] (protocol/build-messages-msg-buf (:compress-f messenger) id batch)
           offer-f (fn [] (.offer pub unsafe-buffer 0 len))
           idle-strategy (:send-idle-strategy messenger)]
-      ;;; TODO: offer will return a particular code when the publisher is down
-      ;;; we should probably re-establish the publication in this case
       (while (= ^long (offer-f) publication-backpressured?)
         (.idle ^IdleStrategy idle-strategy 0)))))


Receiver as channel.

Receiver as channel.

--- src/open_company/lib/bot.clj
+++ src/open_company/lib/bot.clj
@@ -12,7 +12,7 @@
 (def BotTrigger
   {:api-token s/Str
    :script   {:id KnownScripts :params {s/Keyword s/Str}}
-   :receiver {:type (s/enum :all-members :user) (s/optional-key :id) s/Str}
+   :receiver {:type (s/enum :all-members :user :channel) (s/optional-key :id) s/Str}
    :bot      {:token s/Str :id s/Str}})

 (defmulti adapt (fn [type _] type))
@@ -26,20 +26,20 @@
 (defmethod adapt :stakeholder-update [_ m]
   (select-keys m [:slug :note :created-at]))

-(defn script-params
+(defn- script-params
   "Turn `ctx` into params map for bot scripts. May contain superflous fields."
   [ctx]
   (->> [:company :user :stakeholder-update]
        (map (fn [k] (med/map-keys #(keyword (name k) (name %)) (adapt k (get ctx k)))))
        (apply merge)))

-(defn add-su-note [ctx]
+(defn- add-su-note [ctx]
   (let [note (-> ctx :data :note)]
     (if-not (string/blank? note)
       (assoc-in ctx [:stakeholder-update :note] note)
       ctx)))

-(defn add-origin [params ctx]
+(defn- add-origin [params ctx]
   (if-let [origin (get-in ctx [:request :headers "origin"])]
     (assoc params :env/origin origin)
     params))
@@ -47,13 +47,16 @@
 (defn ctx->trigger [script-id ctx]
   {:pre [(map? (:company ctx)) (map? (:user ctx))]}
   (let [rid (-> ctx :user :user-id)
-        bot (-> ctx :user :bot)]
+        bot (-> ctx :user :bot)
+        channel (-> ctx :data :channel)
+        everyone? (or (= channel "__everyone__") (nil? channel))]
     {:api-token   (:jwtoken ctx)
      :bot         bot
      :script      {:id script-id, :params (-> ctx add-su-note script-params (add-origin ctx))}
-     :receiver    (case script-id
-                    :onboard {:type :user, :id rid}
-                    :stakeholder-update {:type :all-members})}))
+     :receiver    (cond
+                    (= script-id :onboard) {:type :user :id rid}
+                    (and (= script-id :stakeholder-update) (not everyone?)) {:type :channel :id channel}
+                    (= script-id :stakeholder-update) {:type :all-members})}))

 (defn send-trigger! [trigger]
   (timbre/info "Request to send msg to " c/aws-sqs-bot-queue "\n" trigger)