Extract error messages.

Extract error messages.

--- src/ombs/validate.clj
+++ src/ombs/validate.clj
@@ -3,9 +3,10 @@
     [noir.validation :as vld]
     [ombs.db :as db]
     [clojure.pprint :refer [pprint]]
+    [clojure.walk :refer [macroexpand-all]]
     ))

-(def- errors
+(def errors
   {
    :event {
            :empty-name      "Event name should not be empty"
@@ -16,29 +17,27 @@
            :unexist         "Event does not exist!"
            :finished        "Event is history."
            }
-   }
-  :register {
-             :short-pass      "Password should be longer than 7 chars"
-             :notmatch-pass   "Password doesn't match"
-             }
-  :user {
-         :empty-name "Username can't be empty"
-         :not-found "User not found"
-         :exists "Username already used!"
-         }
-  :login {
-          :invalid "Incorrect Login or password"
-          }
+   :register {
+              :short-pass      "Password should be longer than 7 chars"
+              :notmatch-pass   "Password doesn't match"
+              }
+   :user {
+          :empty-name "Username can't be empty"
+          :not-found "User not found"
+          :exists "Username already used!"
+          }
+   :login {
+           :invalid "Incorrect Login or password"
+           }
+   }
   )

-(defn- message [&tags] (message (vec tags)))
+(defn- message [ & tgs ] (get-in errors (vec tgs)))

 (defn errors-string
   ([] (reduce str (map #(str "|" % "|") (vld/get-errors))))
-  ([tags] (reduce str (map #(str "|" % "|") (let [errs (vld/get-errors tags)]
-                                              (println (str "errs: " errs))
-                                              errs
-                                              )))))
+  ([tags] (reduce str (map #(str "|" % "|") (vld/get-errors tags)))
+   ))

 (defmacro create-rule [tag data]
   `(vld/rule ~@(list (first data)) [~tag ~(last data)] )
@@ -51,7 +50,7 @@
   [tag ve-pairs]
   `(do
      (vld/clear-errors!)
-     ~@(map #(macroexpand (list 'create-rule tag %)) ve-pairs)
+     ~@(map #(list 'create-rule tag %) ve-pairs)
      (not (vld/errors? ~tag)))
   )

@@ -78,23 +77,25 @@
 (defn login? [username password]
   (create-validator :login
                     [[ (vld/has-value? username) (message :user :empty-name)]
-                     [ (empty? (db/get-user username)) (message :user :unexist)]
-                     [ (= password (:password (db/get-user username))) :login :invalid]
-                     ]))
+                     [ (vld/has-value? (db/get-user username)) (message :user :not-found)]
+                     [ (= password (:password (db/get-user username))) (message :login :invalid)]
+                     ])
+  )

 (defn ids? [eid uid]
   "Check, if id's is correct. Used with (db/get-*id)"
   (create-validator :pay
                     [
-                     [(nil? uid) (message :user :empty-name)]
-                     [(nil? eid) (message :event :unexist)]
-                     ]))
+                     [(not= nil uid) (message :user :empty-name)]
+                     [(not= nil eid) (message :event :unexist)]
+                     ])
+  )

 (defn participation? [ename date uname]
   (create-validator :participation
                     [
+                     [(not= (db/get-status ename date) (db/statuses :finished)) (message :event :finished)]
                      [(vld/has-value? ename) (message :event :empty-name)]
                      [(vld/has-value? date) (message :event :empty-date)]
                      [(vld/has-value? uname) (message :user :empty-name)]
-                     [(not= (db/get-status ename date) (db/statuses :finished)) ]
                      ]))


seconds bug

seconds bug

--- src/ontrail/stats.clj
+++ src/ontrail/stats.clj
@@ -82,7 +82,7 @@
         minkm (/ 60.0 kmh)
         min (int minkm)
         s (int (* 60.0 (- minkm min)))]
-    (str min "." s " min/km")))
+    (str min "." (format "%02d" s) " min/km")))

 (defn get-percentiles [stats]
   (try (let [c (cumul (:paceHist stats))


Eliminate unused namespaces

Eliminate unused namespaces

--- ClojureScript/planck/src/planck/core.cljs
+++ ClojureScript/planck/src/planck/core.cljs
@@ -1,16 +1,11 @@
 (ns planck.core
   (:require-macros [cljs.env.macros :refer [with-compiler-env]])
   (:require [cljs.js :as cljs]
-            [cljs.pprint :refer [pprint]]
             [cljs.tagged-literals :as tags]
             [cljs.tools.reader :as r]
             [cljs.tools.reader.reader-types :refer [string-push-back-reader]]
             [cljs.analyzer :as ana]
             [cljs.repl :as repl]
-            [clojure.string :as s]
-            [cljs.env :as env]
-            [cljs.stacktrace]
-            [planck.stacktrace]
             [planck.io]))

 (defonce st (cljs/empty-state))
@@ -180,7 +175,7 @@
                 (set! *e error)
                 (println "Error occurred")
                 (println (.-stack (.-cause error)))
-                (prn (planck.stacktrace/raw-stacktrace->canonical-stacktrace
+                #_(prn (planck.stacktrace/raw-stacktrace->canonical-stacktrace
                        (.-stack (.-cause error)) {}))
                 #_(prn (cljs.stacktrace/parse-stacktrace {}
                          (.-stack (.-cause error))


Redirect old iOS doc location to its new name

--- src-cljs/frontend/utils/docs.cljs
+++ src-cljs/frontend/utils/docs.cljs
@@ -165,4 +165,6 @@
     "configure-php" "language-php"
     "reference-api" "api"
     "reference-api#build" "api#build"
+
+    "ios" "ios-builds-on-os-x"
     token))


Remove redundancy

Remove redundancy


logging

logging

--- src/ophion/ingest.clj
+++ src/ophion/ingest.clj
@@ -50,7 +50,6 @@
         type-id (.getTypeId id)
         edge-id (.getRelationId id)
         to-id (.getInVertexId id)]
-    (log/info "ingesting" (.getName file))
     (merge
      (lift-properties data)
      {:_janusId edge-id


track blog post with Mixpanel

track blog post with Mixpanel

--- src/pc/views/blog.clj
+++ src/pc/views/blog.clj
@@ -150,7 +150,9 @@
              [:a.nav-link.nav-pricing {:href "/pricing" :title "Pricing"}   "Pricing"]
              [:a.nav-link.nav-blog    {:href "/blog"    :title "Blog"}      "Blog"]
              [:a.nav-link.nav-app     {:href "/new"     :title "Launch"}    "App"]
-             [:a.nav-link.nav-twitter {:href "https://twitter.com/PrecursorApp" :title "@PrecursorApp"} twitter]]]))))
+             [:a.nav-link.nav-twitter {:href "https://twitter.com/PrecursorApp" :title "@PrecursorApp"} twitter]]]
+           [:script {:type "text/javascript"}
+            (format "mixpanel.track(\"View blog\", {blog_post: \"%s\"})" (hiccup.core/h (:title post "Overview")))]))))

 (defn slug->rss [slug pub-date unique-id]
   (let [post ((post-fn slug))]


Make keyword more idiomatic

Make keyword more idiomatic

--- src/play_clj/core.clj
+++ src/play_clj/core.clj
@@ -101,7 +101,7 @@
 (defn set-screen!
   [^Game game & screens]
   (let [add-inputs! (fn []
-                      (input! :setInputProcessor (InputMultiplexer.))
+                      (input! :set-input-processor (InputMultiplexer.))
                       (doseq [screen screens]
                         (add-input! (:input-processor screen))
                         (add-input! (:gesture-detector screen))))


Add :x and :y to all screen maps

Add :x and :y to all screen maps

--- src/play_clj/core.clj
+++ src/play_clj/core.clj
@@ -61,13 +61,19 @@
   [screen screen-fn]
   (screen-fn))

+(defn ^:private merge-coords
+  [{:keys [input-x input-y] :as screen}]
+  (let [x (or input-x (game :x))
+        y (or input-y (game :y))]
+    (merge screen (input->screen screen x y))))
+
 (defn defscreen*
   [{:keys [screen entities
            on-show on-render on-hide on-pause on-resize on-resume on-timer]
     :as options}]
   (let [execute-fn! (fn [func & {:keys [] :as options}]
                       (when func
-                        (let [screen-map (merge @screen options)
+                        (let [screen-map (merge-coords (merge @screen options))
                               old-entities @entities]
                           (some->> (with-meta
                                      #(normalize (func screen-map old-entities))


Factor out unknown doc formatting into helper function.

--- src/puget/printer.clj
+++ src/puget/printer.clj
@@ -277,70 +277,59 @@
    (color-doc :symbol (subs (str value) 2))])

+
+;;;;; OTHER TYPES ;;;;;
+
+(defn- unknown-doc
+  "Renders common syntax doc for an unknown representation of a value."
+  ([value]
+   (unknown-doc value (str value)))
+  ([value repr]
+   (unknown-doc value (.getName (class value)) repr))
+  ([value tag repr]
+   (illegal-when-strict value)
+   [:span
+    (color-doc :class-delimiter "#<")
+    (color-doc :class-name tag)
+    (color-doc :class-delimiter "@")
+    (system-id value)
+    " "
+    repr
+    (color-doc :class-delimiter ">")]))
+
+
 (defmethod canonize clojure.lang.IDeref
   [value]
-  (illegal-when-strict value)
-  [:span
-   (color-doc :class-delimiter "#<")
-   (color-doc :class-name (.getName (class value)))
-   (color-doc :class-delimiter "@")
-   (system-id value) " "
-   (canonize @value)
-   (color-doc :class-delimiter ">")])
+  (unknown-doc value (canonize @value)))

 (defmethod canonize clojure.lang.Atom
   [value]
-  (illegal-when-strict value)
-  [:span
-   (color-doc :class-delimiter "#<")
-   (color-doc :class-name "Atom")
-   (color-doc :class-delimiter "@")
-   (system-id value) " "
-   (canonize @value)
-   (color-doc :class-delimiter ">")])
+  (unknown-doc value "Atom" (canonize @value)))

 (defmethod canonize clojure.lang.IPending
   [value]
-  (illegal-when-strict value)
-  [:span
-   (color-doc :class-delimiter "#<")
-   (color-doc :class-name (.getName (class value)))
-   (color-doc :class-delimiter "@")
-   (system-id value) " "
-   (if (realized? value)
-     (canonize @value)
-     (color-doc :nil "pending"))
-   (color-doc :class-delimiter ">")])
+  (unknown-doc value
+    (if (realized? value)
+      (canonize @value)
+      (color-doc :nil "pending"))))

 (defmethod canonize clojure.lang.Delay
   [value]
-  (illegal-when-strict value)
-  [:span
-   (color-doc :class-delimiter "#<")
-   (color-doc :class-name "Delay")
-   (color-doc :class-delimiter "@")
-   (system-id value) " "
-   (if (realized? value)
-     (canonize @value)
-     (color-doc :nil "pending"))
-   (color-doc :class-delimiter ">")])
+  (unknown-doc value "Delay"
+    (if (realized? value)
+      (canonize @value)
+      (color-doc :nil "pending"))))

 (defmethod canonize java.util.concurrent.Future
   [value]
-  (illegal-when-strict value)
-  [:span
-   (color-doc :class-delimiter "#<")
-   (color-doc :class-name "Future")
-   (color-doc :class-delimiter "@")
-   (system-id value) " "
-   (if (future-done? value)
-     (canonize @value)
-     (color-doc :nil "pending"))
-   (color-doc :class-delimiter ">")])
+  (unknown-doc value "Future"
+    (if (future-done? value)
+      (canonize @value)
+      (color-doc :nil "pending"))))

 (prefer-method canonize clojure.lang.ISeq clojure.lang.IPending)
@@ -350,7 +339,7 @@

-;;;;; OTHER TYPES ;;;;;
+;;;;; SPECIAL TYPES ;;;;;

 (defmethod canonize :tagged-value
   [tagged-value]
@@ -364,12 +353,7 @@

 (defmethod canonize :default
   [value]
-  (illegal-when-strict value)
-  [:span
-   (color-doc :class-delimiter "#<")
-   (color-doc :class-name (.getName (class value)))
-   " " (str value)
-   (color-doc :class-delimiter ">")])
+  (unknown-doc value))


Add pprint-str and cprint-str functions.

--- src/puget/printer.clj
+++ src/puget/printer.clj
@@ -188,6 +188,20 @@
 (defprinter pprint canonize {:width 80})

+(defn pprint-str
+  "Pretty-print a value to a string."
+  ([value]
+   (-> value
+       pprint
+       with-out-str
+       str/trim-newline))
+  ([value opts]
+   (-> value
+       (pprint opts)
+       with-out-str
+       str/trim-newline)))
+
+
 (defn cprint
   "Like pprint, but turns on colored output."
   ([value]
@@ -196,3 +210,17 @@
   ([value opts]
    (binding [*colored-output* true]
      (pprint value opts))))
+
+
+(defn cprint-str
+  "Pretty-prints a value to a colored string."
+  ([value]
+   (-> value
+       cprint
+       with-out-str
+       str/trim-newline))
+  ([value opts]
+   (-> value
+       (cprint opts)
+       with-out-str
+       str/trim-newline)))


date picker demo WIP - remove redundant anon function level

--- src/re_demo/date.cljs
+++ src/re_demo/date.cljs
@@ -75,53 +75,51 @@
           show-weeks?  (r/atom false)
           enabled-days (r/atom (-> days-map keys set))]
       (case variation
-        "1" [(fn []
-               [parameters-with
-                [h-box
-                 :gap "20px"
-                 :align :start
-                 :children [[(fn []
-                               [inline-picker
-                                :model model1
-                                :disabled disabled?
-                                :show-today @show-today?
-                                :show-weeks @show-weeks?
-                                :enabled-days @enabled-days
-                                :on-change #(reset! model1 %)])]
-                            ;; restricted to both minimum & maximum date
-                            [(fn []
-                               [inline-picker
-                                :model model2
-                                :minimum (iso8601->date "20140831")
-                                :maximum (iso8601->date "20141019")
-                                :show-today @show-today?
-                                :show-weeks @show-weeks?
-                                :enabled-days @enabled-days
-                                :disabled disabled?
-                                :on-change #(reset! model2 %)])]]]
-                enabled-days
-                disabled?
-                show-today?
-                show-weeks?])]
-        "2" [(fn []
-               [parameters-with
-                [h-box
-                 :size "auto"
-                 :align :start
-                 :children [[gap :size "120px"]
-                            [(fn []
-                               [dropdown-picker
-                                :model model1
-                                :show-today @show-today?
-                                :show-weeks @show-weeks?
-                                :enabled-days @enabled-days
-                                :format "dd MMM, yyyy"
-                                :disabled disabled?
-                                :on-change #(reset! model1 %)])]]]
-                enabled-days
-                disabled?
-                show-today?
-                show-weeks?])])))
+        "1" [parameters-with
+             [h-box
+              :gap "20px"
+              :align :start
+              :children [[(fn []
+                            [inline-picker
+                             :model model1
+                             :disabled disabled?
+                             :show-today @show-today?
+                             :show-weeks @show-weeks?
+                             :enabled-days @enabled-days
+                             :on-change #(reset! model1 %)])]
+                         ;; restricted to both minimum & maximum date
+                         [(fn []
+                            [inline-picker
+                             :model model2
+                             :minimum (iso8601->date "20140831")
+                             :maximum (iso8601->date "20141019")
+                             :show-today @show-today?
+                             :show-weeks @show-weeks?
+                             :enabled-days @enabled-days
+                             :disabled disabled?
+                             :on-change #(reset! model2 %)])]]]
+             enabled-days
+             disabled?
+             show-today?
+             show-weeks?]
+        "2" [parameters-with
+             [h-box
+              :size "auto"
+              :align :start
+              :children [[gap :size "120px"]
+                         [(fn []
+                            [dropdown-picker
+                             :model model1
+                             :show-today @show-today?
+                             :show-weeks @show-weeks?
+                             :enabled-days @enabled-days
+                             :format "dd MMM, yyyy"
+                             :disabled disabled?
+                             :on-change #(reset! model1 %)])]]]
+             enabled-days
+             disabled?
+             show-today?
+             show-weeks?])))

 (defn notes
@@ -157,9 +155,10 @@
                    [:li.spacer [:strong ":format"]
                     " - string format for dropdown label showing currently selected date see cljs_time.format Default \"yyyy MMM dd\""])]]]])

+
 (def variations [{:id "1" :label "Inline"}
-                 {:id "2" :label "Dropdown"}
-                 #_{:id "3" :label "Inline with min/max"}])
+                 {:id "2" :label "Dropdown"}])
+

 (defn panel
   []


Wait, where did that require go

Wait, where did that require go

--- test/caesium/crypto/generichash_test.clj
+++ test/caesium/crypto/generichash_test.clj
@@ -1,6 +1,6 @@
 (ns caesium.crypto.generichash-test
   (:require [caesium.crypto.generichash :refer :all]
-            [caesium.crypto]
+            [caesium.crypto.util :refer [unhexify array-eq]]
             [clojure.test :refer :all]))

 (deftest blake2b-kat-test


Tidy up rrun

Tidy up rrun

--- src/snergly/core.cljs
+++ src/snergly/core.cljs
@@ -253,11 +253,11 @@
 (defn rrun
   "Randomize all of the maze parameters and run."
   []
-  (let [algorithm (rand-nth (:app/algorithms init-data))
-        analysis (rand-nth (:app/analyses init-data))
-        rdimen (+ 5 (rand-int 8)) ; 5..12
-        cdimen (+ 5 (rand-int 8)) ; 5..12
-        ]
+  (let [algorithm        (rand-nth (:app/algorithms init-data))
+        analysis         (rand-nth (:app/analyses init-data))
+        valid-dimensions (range 5 13)
+        rdimen           (rand-nth valid-dimensions)
+        cdimen           (rand-nth valid-dimensions)]
     (xact! reconciler
            (snergly.core/set-maze {:maze-key :algorithm :value algorithm})
            (snergly.core/set-maze {:maze-key :rows :value rdimen})
@@ -304,6 +304,9 @@

 ;; REPL things:
 ;;
+;; Run a random test:
+;; (rrun)
+;;
 ;; Get to the right namespace:
 ;; (in-ns 'snergly.core)
 ;;


New apps will now have repos created in 'poke' and 'prod', rather than 'dev' and 'prod'.

--- src/tyranitar/git.clj
+++ src/tyranitar/git.clj
@@ -335,7 +335,7 @@

 (defn create-application
   [name]
-  {:repositories [(create-application-env name "dev")
+  {:repositories [(create-application-env name "poke")
                   (create-application-env name "prod")]})

 (defn write-properties-file


Set initial state correctly.

Set initial state correctly.

--- src/app/cljs/one/sample/view.cljs
+++ src/app/cljs/one/sample/view.cljs
@@ -130,6 +130,7 @@
   (one.logging/start-display (one.logging/console-output))

   (set-value! (by-id "text-input") "The quick brown fox jumped over the lazy dog.")
+  (dispatch/fire [:field-changed "text-input"] (value (by-id "text-input")))

   (let [text-box (by-id "text-dvorak-input")]
       (event/listen (goog.events.KeyHandler. text-box)


refactore unnecessary ui-config

refactore unnecessary ui-config

--- backend/test/lambdaui/testpipeline/core.clj
+++ backend/test/lambdaui/testpipeline/core.clj
@@ -28,10 +28,12 @@

 (defn start-server [port]
-  (let [simple-pipeline (lambdacd/assemble-pipeline pipe/pipeline-structure {:home-dir (util/create-temp-dir) :ui-config {:name "SIMPLE PIPELINE" :location :backend-location}})
-        trigger-pipeline (lambdacd/assemble-pipeline pipe-with-trigger/pipeline-structure {:home-dir (util/create-temp-dir) :ui-config {:name "TRIGGER PIPELINE" :location :backend-location}})
-        long-running-pipeline (lambdacd/assemble-pipeline long-running-pipe/pipeline-structure {:home-dir (util/create-temp-dir) :ui-config {:name "LONG-RUNNING PIPELINE" :location :backend-location}})]
-    (reset! current-pipeline simple-pipeline)
+  (let [simple-pipeline (lambdacd/assemble-pipeline pipe/pipeline-structure {:home-dir (util/create-temp-dir) :name "SIMPLE PIPELINE"})
+        trigger-pipeline (lambdacd/assemble-pipeline pipe-with-trigger/pipeline-structure {:home-dir (util/create-temp-dir) :name "TRIGGER PIPELINE" })
+        long-running-pipeline (lambdacd/assemble-pipeline long-running-pipe/pipeline-structure {:home-dir (util/create-temp-dir) :name "LONG-RUNNING PIPELINE"})]
+
+    (reset! current-pipeline trigger-pipeline)
+
     (reset! server

             (let [routes


Events for villages growing or shrinking

--- src/amindblowingworld/civs.clj
+++ src/amindblowingworld/civs.clj
@@ -43,6 +43,23 @@
 (def ^:dynamic saved-biome-map nil)

 (declare settlement-at)
+(declare run-randomly)
+(declare get-settlement)
+(declare get-tribe)
+
+(defn get-settlement [id]
+  (get-in @game [:settlements id]))
+
+(defn get-tribe [id]
+  (get-in @game [:tribe id]))
+
+(defn update-settlement [settlement]
+  (let [id (.id settlement)]
+    (swap! game assoc-in [:settlements id] settlement)))
+
+(defn update-tribe [tribe]
+  (let [id (.id tribe)]
+    (swap! game assoc-in [:tribes id] tribe)))

 (defn calc-biome-map [world]
   (let [ w (-> world .getDimension .getWidth)
@@ -108,8 +125,35 @@
       rp
       (free-random-land))))

+(defn chance [p]
+  (< (rand) p))
+
 (defn update-tribe-fun [id-tribe]
-  (fn [] (println "Updating " id-tribe)))
+  (fn []
+    ;(println "Updating " id-tribe)
+    ))
+
+(defn update-settlement-pop [id-settlement new-pop]
+  (let [s (get-settlement id-settlement)
+        pos (> new-pop (:pop s))
+        s (assoc s :pop new-pop)]
+    (if pos
+      (record-event (str "Population of " (.name s) " growing to " (.pop s)) nil)
+      (record-event (str "Population of " (.name s) " shrinking to " (.pop s)) nil))
+    (update-settlement s)))
+
+(defn update-settlement-fun [id-settlement]
+  (fn []
+    (let [s     (get-settlement id-settlement)
+          event (rand-nth [:growing :shrinking :stable])]
+      (when (= event :growing)
+        (let [perc (+ 1.0 (/ (rand) 4.0))
+              new-pop (int (* (.pop s) perc))]
+          (update-settlement-pop id-settlement new-pop)))
+      (when (= event :shrinking)
+        (let [perc (- 1.00 (/ (rand) 4.0))
+              new-pop (int (* (.pop s) perc))]
+          (update-settlement-pop id-settlement new-pop))))))

 (defn- create-tribe-in-game [game]
   (let [id-tribe (.next-id game)
@@ -124,6 +168,8 @@
         tribe (Tribe. id-tribe name-tribe language [id-settlement])
         game (assoc-in game [:tribes id-tribe] tribe)
         game (assoc-in game [:settlements id-settlement] settlement)]
+      (run-randomly (update-tribe-fun id-tribe) 3000 10000)
+      (run-randomly (update-settlement-fun id-settlement) 3000 10000)
       (record-event (str "Creating tribe " name-tribe) pos)
       (record-event (str "Creating village " name-settlement) pos)
       (update-biome-map)


Indention fix

Indention fix

--- test/clj_http/test/core.clj
+++ test/clj_http/test/core.clj
@@ -415,8 +415,8 @@
          (localhost "/redirect-to-get")
          {:response-interceptor
           (fn [^HttpResponse resp ^HttpContext ctx]
-            (let [^HttpInetConnection conn (.getAttribute ctx
-                                        ExecutionContext/HTTP_CONNECTION)]
+            (let [^HttpInetConnection conn
+                  (.getAttribute ctx ExecutionContext/HTTP_CONNECTION)]
               (swap! saved-ctx conj {:remote-port (.getRemotePort conn)
                                      :http-conn conn})))})]
     (is (= 200 status))


FIX to YAML in save workspace

FIX to YAML in save workspace

--- webui/src/webui/routes/api.clj
+++ webui/src/webui/routes/api.clj
@@ -32,7 +32,7 @@
    :body (json/generate-string data)})

 (defn save-workspace [workspace]
-  (info (yaml/parse-string (json/parse-string workspace))))
+  (json-response (yaml/generate-string (json/parse-string workspace))))

 (defn load-workspace []
   (json-response "hola"))


Fix benchmark.

Fix benchmark.

--- src/clojure/nanomsg/benchmark.clj
+++ src/clojure/nanomsg/benchmark.clj
@@ -17,7 +17,7 @@
   (let [sended    (atom 0)
         received  (atom 0)
         pubsock   (nn/socket :pub)]
-    (nn/bind pubsock "ipc:///tmp/bench")
+    (nn/bind! pubsock "ipc:///tmp/bench")
     (sleep 1000)

     (let [reporter (fn []
@@ -30,10 +30,10 @@
                        (recur @sended @received)))
           receiver (fn []
                      (let [sock (nn/socket :sub)]
-                       (nn/connect sock "ipc:///tmp/bench")
-                       (nn/subscribe sock "test")
+                       (nn/connect! sock "ipc:///tmp/bench")
+                       (nn/subscribe! sock "test")
                        (loop []
-                         (let [r (nn/recv sock)]
+                         (let [r (nn/recv! sock)]
                            (swap! received inc))
                          (recur))))]

@@ -44,5 +44,5 @@
       (thread reporter)

       (doseq [x (range 1000000000000)]
-        (nn/send pubsock "test foobar")
+        (nn/send! pubsock "test foobar")
         (swap! sended inc)))))


+lexical processing rule: if not(reflexive), then reflexive = false.

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -1831,6 +1831,10 @@
                                     :subcat {:2 {:reflexive false}}}}
                           {:synsem {:subcat {:2 {:reflexive false}}}})

+                 ;; if not(reflexive), then reflexive = false.
+                 (if-then {:synsem {:sem {:reflexive false}}}
+                          {:synsem {:sem {:reflexive false}}})
+
                  ;; subject-and-reflexive-pronoun agreement
                  (if-then {:synsem {:sem {:reflexive true}
                                     :cat :verb


"eat dinner" is intransitive

"eat dinner" is intransitive

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -555,8 +555,8 @@
                    :sem {:pred :mangiare}}}

    "eat dinner" {:synsem {:cat :verb
-                          :sem {:pred :have-dinner}}
-                 :transitivize false
+                          :sem {:pred :have-dinner}
+                          :subcat {:2 '()}}
                  :english {:present {:3sing "eats dinner"}
                            :participle "eating dinner"
                            :past "ate dinner"}}


+that/those: the former is singular; the latter, plural

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -1700,6 +1700,7 @@
                               :2 '()}}}
            ;; "that" as in "that woman"
            {:synsem {:cat :det
+                     :agr {:number :sing}
                      :sem {:pred :demonstrative}
                      :def :def}}]

@@ -1804,6 +1805,12 @@
                                :subcat {:2 {:cat :comp ;; "that"
                                             :subcat '()}
                                         :3 '()}}})])
+
+   "those" {:synsem {:cat :det
+                     :agr {:number :plur}
+                     :sem {:pred :demonstrative}
+                     :def :def}}
+
    "throw" {:english {:past "threw"}
             :synsem {:cat :verb
                      :sem {:pred :throw}}}


This must be the worst best Clojure hack I've made

--- examples/repl.clj
+++ examples/repl.clj
@@ -1,14 +1,20 @@
-#!/usr/bin/env inlein
+#!/bin/sh
+
+#_#_#_#_#_#_
+eval "exec $(inlein --sh-cmd "$0" "$@")"

 ;; Your own, self-customised repl with all the tools you'd like to use!
 ;;
 ;; Note: Some signals may be broken with the JVM client, as it cannot pass
-;; signals to the child process easily. This can be fixed with a native client
-;; but for now, there aren't any.
+;; signals to the child process easily. As a result, the incredibly nasty hack
+;; above is used to make shell call inlein, which in turn creates a shell
+;; command which in turn is exec'd by shell. It's effectively a bit like
+;; trampoline inlined. (This is also possible to fix with a non-jvm inlein
+;; client, but we're not there yet)

 '{:dependencies [[org.clojure/clojure "1.8.0"]
-                 [reply "0.3.7"]
-                 [net.cgrand/parsley "0.9.3"] ;; to fix reply warning
+                 [reply "0.3.7" :exclusions [net.cgrand/parsley]]
+                 [net.cgrand/parsley "0.9.3"] ;; to fix parsley warning
                  [org.clojure/math.numeric-tower "0.0.4"]
                  [org.clojure/math.combinatorics "0.1.1"]
                  [spyscope "0.1.5"]
@@ -20,6 +26,7 @@
          '[clojure.pprint :refer [pprint]]
          '[clojure.tools.trace :as trace]
          'spyscope.core)
+
 ;; For pythonistas, we alias ** to expt
 (def ** expt)


Mock out launch-media-driver!

Mock out launch-media-driver!

--- test/desdemona/cli_test.clj
+++ test/desdemona/cli_test.clj
@@ -53,6 +53,12 @@
       (is (= result [::exited 1]))
       (is (= stdout (s/join \newline (concat error-lines usage-lines))))))
   (testing "regular run"
-    (let [[result stdout] (with-fake-launcher-side-effects (aeron/-main))]
-      (is (= result ::blocked-forever))
-      (is (= stdout "Launched the Media Driver. Blocking forever...\n")))))
+    (let [launched (atom false)]
+      (with-redefs [aeron/launch-media-driver!
+                    (fn [ctx]
+                      (is (not (.dirsDeleteOnStart ctx)))
+                      (reset! launched true))]
+        (let [[result stdout] (with-fake-launcher-side-effects (aeron/-main))]
+          (is @launched)
+          (is (= result ::blocked-forever))
+          (is (= stdout "Launched the Media Driver. Blocking forever...\n")))))))


refine import with ext. actions test

refine import with ext. actions test

--- test/clj_money/import_test.clj
+++ test/clj_money/import_test.clj
@@ -15,7 +15,8 @@
             [clj-money.serialization :as serialization]
             [clj-money.factories.user-factory]
             [clj-money.test-helpers :refer [reset-db
-                                            pprint-diff]]
+                                            pprint-diff
+                                            find-accounts]]
             [clj-money.models.entities :as entities]
             [clj-money.models.commodities :as commodities]
             [clj-money.models.accounts :as accounts]
@@ -358,16 +359,23 @@
         commodity (commodities/find-by storage-spec {:entity-id (:id entity)
                                                      :symbol "AAPL"})
         lots (lots/search storage-spec {:commodity-id (:id commodity)})
-        account (accounts/find-by storage-spec {:entity-id (:id entity)
-                                            :name "401k"})
-        commodity-account (accounts/find-by storage-spec
-                                            {:parent-id (:id account)
-                                             :commodity-id (:id commodity)})
+        [ira four-o-one-k] (map #(accounts/find-by storage-spec
+                                                   {:name %
+                                                    :entity-id (:id entity)})
+                                ["IRA" "401k"])
         expected-lots [{:purchase-date (t/local-date 2015 1 17)
                         :shares-purchased 200M
                         :shares-owned 200M
-                        :account-id (:id account)}]
+                        :purchase-price 5M ; originally purchased 100 shares at $10/share
+                        :commodity-id (:id commodity)
+                        :account-id (:id ira)}]
         actual-lots (map #(dissoc % :updated-at :created-at :id) lots)]
+    (is (:trading (:tags ira))
+        "The IRA account has the correct tags")
+    (is (:trading (:tags four-o-one-k))
+        "The 401k account has the correct tags")
+    (is (= 0M (:balance four-o-one-k)) "All shares have been transfered out of 401k")
+    (is (= 1000M (:balance ira)) "Shares have been transfered into IRA")
     (pprint-diff expected-lots actual-lots)
     (is (= expected-lots actual-lots)
         "The commodity has the correct lots after import")))


show uploading indicator

show uploading indicator

--- src/braid/ui/views/thread.cljs
+++ src/braid/ui/views/thread.cljs
@@ -186,6 +186,9 @@
           (when-not new?
             [messages-view thread])

+          (when uploading?
+            [:div.uploading-indicator "\uf110"])
+
           [new-message-view {:thread-id (thread :id)
                              :new-thread? new?
                              :placeholder (if new?


Add bootstrap file refs

Add bootstrap file refs

--- _config.clj
+++ _config.clj
@@ -22,15 +22,18 @@
  :lang "en"

  ;; default site data
- :site {:atom-base  "http://www.pbarnett.me" ; please change "localhost:8080" to your blog domain
+ :site {:atom-base  "http://www.pbarnett.me"
         :charset    "utf-8"
         :site-title "Pance's Blog"
         :twitter    "pance888"
-        :css        ["http://fonts.googleapis.com/css?family=Josefin+Sans"
+        :css        #_["http://fonts.googleapis.com/css?family=Josefin+Sans"
                      "/css/main.css"
                      "/css/extra.css"]
-        :device-css ["/css/smartphone.css"]
-        :js         ["/js/main.js"]}
+                     ["//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css"
+                      "//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-theme.min.css"]
+        ;;:device-css ["/css/smartphone.css"]
+        :js         ["//code.jquery.com/jquery.js"
+                     "//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"]}

  ;; post file compile hook
  :compile-with-post ["index.html.clj" "atom.xml.clj"]


Fix count of traces

Fix count of traces

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

 (rf/reg-sub
   :traces/number-of-traces
-  :<- [:traces/trace-root]
+  :<- [:traces/all-traces]
   (fn [traces _]
     (count traces)))


it's ... moving . . .!

it's ... moving . . .!

--- src/didactic_waddle/sketch01.cljs
+++ src/didactic_waddle/sketch01.cljs
@@ -2,7 +2,13 @@
   (:require [quil.core :as q :include-macros true]
             [quil.middleware :as m]))

-(def update-state identity)
+(defn update-state [s]
+  (map (fn [c]
+         (assoc
+           c
+           :x (+ 1 (:x c)),
+           :y (+ 1 (:y c))
+           )) s))
 (def size 500)
 (def dist 10)
 (def TwoPI (* Math/PI 2))
@@ -10,20 +16,23 @@
 (defn setup []
   (q/frame-rate 60)
   (q/color-mode :hsb)
-  (q/no-loop)
-  (map (fn [n] {:x (* dist (mod n 51)),
-                :y (* dist (quot n 51))})
+  ; (q/no-loop)
+  (map (fn [n] {:x (mod n 51),
+                :y (quot n 51),
+                :n n})
        (range 2750)))

 (defn draw-circle [circ]
   (q/no-stroke)
   (let [x (:x circ)
         y (:y circ)
-        noise (q/noise (/ x 300) (/ y 300))
+        noise (q/noise (/ x 30) (/ y 30))
+        x-loc (* dist (mod (:n circ) 51))
+        y-loc (* dist (quot (:n circ) 51))
         radius (* (Math/sqrt noise) dist 1.2)
         ]
     (q/fill (* 255 noise) 200 200)
-    (q/arc x y radius radius 0 TwoPI)))
+    (q/arc x-loc y-loc radius radius 0 TwoPI)))

 (defn draw-state [state]
   (q/background 250)


removed jblas namespace

removed jblas namespace

--- src/clj/forma/matrix/jblas.clj
+++ src/clj/forma/matrix/jblas.clj
@@ -1,49 +0,0 @@
-(ns forma.matrix.jblas
-  (:import [org.jblas FloatMatrix]))
-
-(defn feature-vec [n]
-  (FloatMatrix.
-   (into-array (for [x (range n)]
-                 (float-array (cons 1 (take 22 (repeatedly rand))))))))
-
-(defn test-mult [n]
-  (let [xs  (feature-vec n)
-        xst (.transpose xs)]
-    (time (let [result (.mmul xst xs)]
-            [(.rows result)
-             (.columns result)]))))
-
-;; user> (test-mult 10000)
-;; "Elapsed time: 6.99 msecs"
-;; [23 23]
-
-;; user> (test-mult 100000)
-;; "Elapsed time: 43.88 msecs"
-;; [23 23]
-
-;; user> (test-mult 1000000)
-;; "Elapsed time: 383.439 msecs"
-;; [23 23]
-
-(defn matrix-stream [rows cols]
-  (repeatedly #(FloatMatrix/randn rows cols)))
-
-(defn square-benchmark
-  "Times the multiplication of a square matrix."
-  [n]
-  (let [[a b c] (matrix-stream n n)]
-    (time (.mmuli a b c))
-    nil))
-
-;; forma.matrix.jblas> (square-benchmark 10)
-;; "Elapsed time: 0.113 msecs"
-;; nil
-;; forma.matrix.jblas> (square-benchmark 100)
-;; "Elapsed time: 0.548 msecs"
-;; nil
-;; forma.matrix.jblas> (square-benchmark 1000)
-;; "Elapsed time: 107.555 msecs"
-;; nil
-;; forma.matrix.jblas> (square-benchmark 2000)
-;; "Elapsed time: 793.022 msecs"
-;; nil


added function "ensure-selection-visible" to keep selection in view of the list-boxes when you ask with sdoc for a ns or var that are out of the visible row of items - the function will scroll the selection in view. Function called when selection changes and when refresh-browser is called.

--- src/clj_ns_browser/browser.clj
+++ src/clj_ns_browser/browser.clj
@@ -195,6 +195,14 @@
     (when-let [r (try (re-pattern (config t-f :text)) (catch Exception e nil))]
       (filter #(re-find r %) string-seq))))

+(defn ensure-selection-visible
+  "Scroll the selection of a listbox within view.
+  Input lbx is a swing listbox reference.
+  or input: root and keyword-id lbx-kw for the listbox."
+  ([lbx] (.ensureIndexIsVisible lbx (.getSelectedIndex lbx)))
+  ([root lbx-kw]
+    (let [id (partial select-id root)]
+      (.ensureIndexIsVisible (id lbx-kw) (.getSelectedIndex (id lbx-kw))))))

 (defn find-in-doc-strings
   [pat-in-str]
@@ -339,6 +347,16 @@
           :key  "menu R"
           :handler (fn [e]
             (auto-refresh-browser-handler {:root (to-root e)}))))
+
+(add-app-action :auto-refresh-browser-action
+  (action :name "Auto-Refresh"
+          :handler (fn [e] (let [root (to-root e)
+                                 id (partial select-id root)]
+                              (println "e:" e)
+                              (println "getSource:" (.getSource e))
+                             (if (config (id :auto-refresh-browser-cb) :selected?)
+                               (.start (seesaw.meta/get-meta root :auto-refresh-browser-timer))
+                               (.stop (seesaw.meta/get-meta root :auto-refresh-browser-timer)))))))

 ;; Init functions called during construction of a frame with its widget hierarchy
@@ -409,12 +427,13 @@
       (b/transform widget-model-count (id :vars-lb))
       (id :vars-entries-lbl))
     ;; new ns selected in ns-lb =>
-    ;; dis/enable require-btn, update fqn in doc-tf
+    ;; dis/enable require-btn, update fqn in doc-tf, scroll within view
     (b/bind
       (b/selection (id :ns-lb))
         (b/tee
           (b/bind
             (b/transform (fn [ns]
+              (ensure-selection-visible (id :ns-lb))
               (if (and ns (some #(= ns %) @all-ns-unloaded-atom))
                 true
                 false)))
@@ -447,6 +466,7 @@
     (b/bind
       (b/selection (id :vars-lb))
       (b/transform (fn [v]
+        (ensure-selection-visible (id :vars-lb))
         (if v
           (let [fqn (fqname (selection (id :ns-lb)) v)]
             (if (and fqn (not= fqn ""))
@@ -723,6 +743,8 @@
     (swap! vars-lb-refresh-atom not)
     (when-not (= (selection (id :ns-lb)) selected-ns) (selection! (id :ns-lb) selected-ns))
     (selection! (id :vars-lb) selected-var)
+    (ensure-selection-visible (id :ns-lb))
+    (ensure-selection-visible (id :vars-lb))
     {:root root :selected-ns selected-ns :selected-var selected-var}))

 ;;seesaw.core/toggle-full-screen! (locks up computer!!! don't use)
@@ -759,7 +781,7 @@
           vars-categorized-cb (checkbox-menu-item :text "Categorized Listing" :id :vars-categorized-cb)
           vars-search-doc-also-cb (checkbox-menu-item :text "Search Docs Also" :id :vars-search-doc-also-cb)

-          auto-refresh-browser-cb (checkbox-menu-item :text "Auto-Refresh" :id :auto-refresh-browser-cb)
+          auto-refresh-browser-cb (checkbox-menu-item :action (id :auto-refresh-browser-action) :id :auto-refresh-browser-cb)
           auto-refresh-browser-timer (timer auto-refresh-browser-handler  :initial-value {:root root}
                                             :initial-delay 1000   :start? false)
           color-coding-cb (checkbox-menu-item :text "Color Coding" :id :color-coding-cb)
@@ -770,6 +792,8 @@
           vars-lb-popup (popup :id :vars-lb-popup)

           ]
+
+      (seesaw.meta/put-meta! root :auto-refresh-browser-timer auto-refresh-browser-timer)

       (config! root :menubar main-menu)


Updating import/require for goog closure

Not tested

--- src/cljs/file_upload/core.cljs
+++ src/cljs/file_upload/core.cljs
@@ -7,8 +7,7 @@
             [goog.history.EventType :as HistoryEventType])
   (:import goog.History
            goog.net.IframeIo
-           goog.net.EventType
-           [goog.events EventType]))
+           [goog.net.EventType :as NetEventType]))

 ;; -------------------------
 ;; Views
@@ -118,7 +117,7 @@
 (defn iframeio-upload-file [form-id]
   (let [el (.getElementById js/document form-id)
         iframe (IframeIo.)]
-    (events/listen iframe goog.net.EventType.COMPLETE
+    (events/listen iframe NetEventType.COMPLETE
                    (fn [event]
                      (let [rsp (.getResponseJson iframe)
                            status ()])


Fix branch name.

Fix branch name.

--- src/cljx/geschichte/stage.cljx
+++ src/cljx/geschichte/stage.cljx
@@ -336,7 +336,7 @@
   new-repository default arguments. Returns go block to synchronize."
   (go<? (let [user (or user (get-in @stage [:config :user]))
               nrepo (repo/new-repository user description :is-public? is-public?)
-              branch :master
+              branch "master"
               id (get-in nrepo [:meta :id])
               metas {user {id #{branch}}}
               ;; id is random uuid, safe swap!


Clean component.cljs up

Clean component.cljs up

--- src/cloact/impl/component.cljs
+++ src/cloact/impl/component.cljs
@@ -54,8 +54,7 @@
 ;; tricky. The upside is that we don't have to do any allocations.

 (defn- args-of [C]
-  (-> C (aget "props") .-cljsArgs)
-  #_(-> C .-props .-cljsArgs))
+  (-> C (aget "props") .-cljsArgs))

 (defn- props-in-args [args]
   (let [p (nth args 1 nil)]
@@ -95,7 +94,7 @@
 ;;; Function wrapping

 (defn- do-render [C f]
-  (let [res (f (cljs-props C) C (aget "state" C) #_(.-state C))
+  (let [res (f (cljs-props C) C (.-state C))
         conv (if (vector? res)
                (tmpl/as-component res)
                (if (fn? res)
@@ -121,8 +120,7 @@
       ;; reset! doesn't call -notifyWatches unless -watches is set
       (set! (.-watches C) {})
       (when f
-        (set! (.-cljsOldState C) (merge (aget "state" C)
-                                        #_(.-state C) (f C)))))
+        (set! (.-cljsOldState C) (merge (.-state C) (f C)))))

     :componentWillReceiveProps
     (fn [C props]
@@ -161,8 +159,6 @@
     f))

 (defn- get-wrapper [key f name]
-  ;; (when (and name (fn? f) (nil? (aget f "displayName")))
-  ;;   (aset f "displayName" (str name key)))
   (let [wrap (custom-wrapper key f)]
     (when (and wrap f)
       (assert (fn? f)


Storing tag & attrs directly in state now.

--- src/clojure/freactive/dom.cljs
+++ src/clojure/freactive/dom.cljs
@@ -67,27 +67,28 @@

 (declare get-transition)

-(defn- init-element-meta! [state element-spec]
+(defn- init-element-meta! [state element-spec tag attrs]
   (let [m (meta element-spec)]
     (set! (.-meta state) m)
     (when-let [on-disposed (get m :node-disposed)]
-      (set! (.-disposed-callback state) on-disposed))))
-
-(defn- reset-element-spec! [state spec]
+      (set! (.-disposed-callback state) on-disposed)))
+  (set! (.-tag state) tag)
+  (set! (.-attrs state) attrs))
+
+(defn- reset-element-spec! [state spec tag attrs]
   (when-let [on-disposed (.-disposed-callback state)]
     (on-disposed)
     (set! (.-disposed-callback state) nil))
   (set! (.-element-spec state) spec)
-  (init-element-meta! state spec))
-
-(defn- init-element-state! [dom-node element-spec]
+  (init-element-meta! state spec tag attrs))
+
+(defn- init-element-state! [dom-node element-spec tag attrs]
   (let [node-id (str auto-node-id)
         state (ElementState. node-id false element-spec nil)]
     (set! auto-node-id (inc auto-node-id))
     (set-attr! dom-node "data-freactive-id" node-id)
-    (init-element-meta! state element-spec)
+    (init-element-meta! state element-spec tag attrs)
     (aset element-state-lookup node-id state)
-    ;;(set! element-state-lookup (assoc element-state-lookup dom-node state))
     state))

 (defn- register-with-parent-state [parent-state child-key state]
@@ -540,7 +541,7 @@
   (when-not (text-node? new-elem)
     (let [parent-state (get-element-state parent)
           parent-state (or parent-state
-                           (init-element-state! parent nil))]
+                           (init-element-state! parent nil nil nil))]
       (let [state (get-element-state new-elem)]
         (set! (.-parent-state state) parent-state)
         (register-with-parent-state parent-state (get-node-id new-elem) state)
@@ -587,17 +588,18 @@

 (defn- try-diff [parent vdom cur-dom-node top-level]
   (let [cur-state (get-element-state cur-dom-node)
-        cur-vdom (get-virtual-dom (.-element-spec cur-state))]
-    (if (keyword-identical? (first vdom) (first cur-vdom))
+        cur-tag (.-tag cur-state)
+        new-tag (first vdom)]
+    (if (keyword-identical? new-tag cur-tag)
       (do
         ;(println "diff hit" (first vdom))
-        (let [old-attrs? (second cur-vdom)
+        (let [old-attrs (.-attrs cur-state)
               new-attrs? (second vdom)
               new-attrs (when (map? new-attrs?) new-attrs?)]
-          (reset-element-spec! cur-state vdom)
+          (reset-element-spec! cur-state vdom new-tag new-attrs)
           (replace-attrs! cur-dom-node
                           cur-state
-                          (when (map? old-attrs?) old-attrs?)
+                          old-attrs
                           new-attrs)
           (let [new-children (if new-attrs (nnext vdom) (next vdom))
                 dangling-child (try-diff-subseq cur-dom-node (.-firstChild cur-dom-node) new-children)]
@@ -748,7 +750,7 @@
               (do
                 (let [new-elem (get-new-elem)
                       cur (.-cur-element state)]
-                  (when (not= (get-virtual-dom cur) (get-virtual-dom new-elem))
+                  (when-not (identical? (get-virtual-dom cur) (get-virtual-dom new-elem))
                     (let [hide (get-transition cur :node-detaching)]
                       (if hide
                         (do
@@ -834,10 +836,11 @@
       virtual-dom

       :default
-      (let [node (create-dom-node (first virtual-dom))
-            state (init-element-state! node elem-spec)
+      (let [tag (first virtual-dom)
+            node (create-dom-node tag)
             attrs? (second virtual-dom)
             attrs (when (map? attrs?) attrs?)
+            state (init-element-state! node elem-spec tag attrs)
             children (if attrs (nnext virtual-dom) (next virtual-dom))]
         (doseq [[k v] attrs]
           (bind-attr! node k v state))


Rename deftrait's match-pred? to param-map for clarity

--- src/clojure/neko/ui/traits.clj
+++ src/clojure/neko/ui/traits.clj
@@ -119,7 +119,7 @@
              [identity identity]))))))

 (alter-meta! #'deftrait
-             assoc :arglists '([name docstring? match-pred? [params*] body]))
+             assoc :arglists '([name docstring? param-map? [params*] body]))

 ;; ## Utility functions


http-kit/clojure: Define additional constants.

--- src/clojure/src/dnsresolvh.clj
+++ src/clojure/src/dnsresolvh.clj
@@ -24,6 +24,35 @@
 (defmacro ONE-SPACE-STRING []  " ")
 (defmacro PRINT-BANNER-OPT [] "-V")

+; Common error messages.
+(defmacro ERR-PORT-MUST-BE-POSITIVE-INT [](str ": <port_number> must be "
+                                               "a positive integer value, "
+                                               "in the range 1024-49151."))
+
+; Print this error message when there are no any args passed.
+(defmacro ERR-MUST-BE-ONE-TWO-ARGS-1 [](str ": There must be one or two args "
+                                            "passed: "))
+(defmacro ERR-MUST-BE-ONE-TWO-ARGS-2 [] " args found"  )
+
+; Print this usage info just after any inappropriate input.
+(defmacro MSG-USAGE-TEMPLATE-1 [] "Usage: "            )
+(defmacro MSG-USAGE-TEMPLATE-2 [] " <port_number> [-V]")
+
+;; Constant: The minimum port number allowed.
+(defmacro MIN-PORT []  1024)
+
+;; Constant: The maximum port number allowed.
+(defmacro MAX-PORT [] 49151)
+
+; Daemon name, version, and copyright banners.
+(defmacro DMN-NAME        [] "DNS Resolver Daemon (dnsresolvd)"       )
+(defmacro DMN-DESCRIPTION [](str "Performs DNS lookups for the given "
+                                 "hostname passed in an HTTP request"))
+(defmacro DMN-VERSION-S-- [] "Version"                                )
+(defmacro DMN-VERSION     [] "0.1"                                    )
+(defmacro DMN-COPYRIGHT-- [] "Copyright (C) 2017-2019"                )
+(defmacro DMN-AUTHOR      [] "Radislav Golubtsov <ragolubtsov@my.com>")
+
 ; TODO: Implement further helper stuff.

 ; vim:set nu et ts=4 sw=4:


signal rewriting

signal rewriting

--- src/clojure2d/extra/signal.clj
+++ src/clojure2d/extra/signal.clj
@@ -27,7 +27,9 @@
             [clojure2d.color :as c]
             [clojure.java.io :refer :all]
             [clojure2d.math.joise :as j]
-            [clojure2d.math.vector :as v])
+            [clojure2d.math.vector :as v]
+            [criterium.core :as bench]
+            [clojure2d.math.random :as r])
   (:import [clojure2d.pixels Pixels]
            [clojure2d.math.vector Vec2 Vec3]))

@@ -296,7 +298,9 @@
 ;; state management functions and transducer operations
 ;; minimizing destructuring as much as possible...

-(deftype StateWithS [^double sample state]) ; sample and effect state, StateWithF or vector of StateWithF
+(deftype StateWithS [^double sample state]
+  Object
+  (toString [_] (str sample))) ; sample and effect state, StateWithF or vector of StateWithF
 (deftype StateWithF [f state]) ; effect and its state

 (defn- next-effect
@@ -383,6 +387,53 @@
 (def make-effects-filter (partial make-filter-fn apply-effects))
 (def make-effect-filter (partial make-filter-fn apply-effect))

+;;; test
+
+(deftype EffectList [sample effect state next]
+  Object
+  (toString [_] (str sample)))
+
+(defn single-pass
+  ""
+  [^EffectList e sample]
+  (if (nil? (.next e))
+    (let [^StateWithS r ((.effect e) sample (.state e))]
+      (EffectList. (.sample r) (.effect e) (.state r) nil))
+    (let [^EffectList prev (single-pass (.next e) sample)]
+      (let [^StateWithS r ((.effect e) (.sample prev) (.state e))]
+        (EffectList. (.sample r) (.effect e) (.state r) prev)))))
+
+(defn make-effect-list
+  ""
+  [init f]
+  (EffectList. 0.0 f init nil))
+
+(defn compose-effects
+  ""
+  [^EffectList e & es]
+  (if (nil? es)
+    e
+    (EffectList. (.sample e) (.effect e) (.state e) (apply compose-effects es))))
+
+;; (def lp1 (make-effect :simple-lowpass {:rate 44100 :cutoff 10000}))
+;; (def lp2 (make-effect :simple-lowpass {:rate 44100 :cutoff 5000}))
+;; (def lp3 (make-effect :simple-lowpass {:rate 44100 :cutoff 2000}))
+;; (def dj (make-effect :dj-eq {:lo (r/drand -5 5) :mid (r/drand -5 5) :hi (r/drand -5 5) :peak_bw 1.3 :shelf_slope 1.5 :rate (r/irand 4000 100000)}))
+
+;; (def lll1 lp1)
+;; (def lll2 (create-state [lp1 lp2 lp3]))
+
+;; (def lll3 (compose-effects lp1 lp2 lp3))
+
+;; (bench/quick-bench (call lll1 (r/drand -1.0 1.0)))
+
+;; (single-pass lll1 1.0)
+;; (process-effects-one-pass 1.0 lll2)
+
+;; (bench/quick-bench (single-pass lll1 (r/drand -1.0 1.0)))
+;; (bench/quick-bench (process-effects-one-pass (r/drand -1.0 1.0) lll2))
+
+
 ;;; multimethod - effect creators

 (defmulti make-effect (fn [m conf] m))
@@ -400,23 +451,20 @@
     (/ tinterval (+ tau tinterval))))

 (defmethod make-effect :simple-lowpass [_ conf]
-  (let [alpha (calc-filter-alpha (:rate conf) (:cutoff conf))]
-    (fn
-      ([^double sample ^double prev]
-       (let [s1 (* sample alpha)
-             s2 (- prev (* prev alpha))
-             nprev (+ s1 s2)]
-         (StateWithS. nprev nprev)))
-      ([] 0.0))))
+  (let [alpha (calc-filter-alpha (:rate conf) (:cutoff conf))]
+    (make-effect-list 0.0 (fn
+                            ([^double sample ^double prev]
+                             (let [s1 (* sample alpha)
+                                   s2 (- prev (* prev alpha))
+                                   nprev (+ s1 s2)]
+                               (StateWithS. nprev nprev)))))))

 (defmethod make-effect :simple-highpass [_ conf]
   (let [lpfilter (make-effect :simple-lowpass conf)]
-    (fn
-      ([^double sample state]
-       (let [^StateWithS res (lpfilter sample state)]
-         (StateWithS. (- sample (.sample res)) (.state res))))
-      ([]
-       (lpfilter)))))
+    (make-effect-list lpfilter (fn
+                                 ([^double sample lp]
+                                  (let [^EffectList res (single-pass lpfilter sample)]
+                                    (StateWithS. (- sample (.sample res)) res)))))))

 ;; BIQUAD FILTERS


'Enhance' a docstring

'Enhance' a docstring

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

--- src/conexp/fca/exploration.clj
+++ src/conexp/fca/exploration.clj
@@ -45,7 +45,7 @@

   If you want to use automorphisms of the underlying context, you have
   to construct a special handler using the «make-handler»
-  function. See its documentation."
+  function. See the corresponding documentation of «make-handler»"
   [ctx, :background-knowledge #{}, :handler default-handler]
   (assert (set? background-knowledge))
   (loop [implications background-knowledge,


don't use stream->seq !

don't use stream->seq !

--- src/er_cassandra/model/select.clj
+++ src/er_cassandra/model/select.clj
@@ -65,8 +65,7 @@
   ([^ModelSession session ^Entity entity key record-or-key-value opts]
    (with-context deferred-context
      (mlet [select-s (select-buffered session entity key record-or-key-value opts)]
-       (return
-        (s/stream->seq select-s))))))
+       (s/reduce conj [] select-s)))))

 (defn select-one
   "select a single record, using an index table if necessary"
@@ -84,9 +83,8 @@
                       entity
                       key
                       record-or-key-value
-                      (merge opts {:limit 1}))
-            record (s/take! select-s)]
-       (return record)))))
+                      (merge opts {:limit 1}))]
+       (s/take! select-s)))))

 (defn select-one-instance
   "select a single record, unless the record is already a record retrieved
@@ -113,20 +111,20 @@

   ([^ModelSession session ^Entity entity key record-or-key-value opts]
    (with-context deferred-context
-     (mlet [select-s (select-buffered session
-                                      entity
-                                      key
-                                      record-or-key-value
-                                      (merge opts {:limit 1}))]
-       (if (s/drained? select-s)
+     (mlet [r (select-one session
+                          entity
+                          key
+                          record-or-key-value
+                          opts)]
+       (if r
+         (return r)
          (d/error-deferred (ex-info
                             "no record"
                             {:reason [:fail
                                       {:entity entity
                                        :key key
                                        :record-or-key-value record-or-key-value}
-                                      :no-matching-record]}))
-         (s/take! select-s))))))
+                                      :no-matching-record]})))))))

 (defn ensure-one-instance
   "select-one-instance but errors if there is no record"
@@ -154,9 +152,8 @@
   ([^ModelSession session ^Entity entity key record-or-key-values opts]
    (->> (or record-or-key-values '())
         (s/map (fn [record-or-key-value]
-                 (select-buffered session entity key record-or-key-value (merge opts {:limit 1}))))
+                 (select-one session entity key record-or-key-value opts)))
         (s/realize-each)
-        (s/concat)
         return)))

 (defn select-many
@@ -176,8 +173,25 @@
                   key
                   record-or-key-values
                   opts)]
-       (return
-        (s/stream->seq sm-s))))))
+       (s/reduce conj [] sm-s)))))
+
+(defn select-many-instances-buffered
+  "select-many records, unless the record-or-key-values were already
+  retrives from the db, in which case return them directly (but still
+  select any which were not already retrieved from the db)"
+  ([^ModelSession session ^Entity entity record-or-key-values]
+   (select-many-instances-buffered session entity (t/uber-key entity) record-or-key-values {}))
+
+  ([^ModelSession session ^Entity entity key record-or-key-values]
+   (select-many-instances-buffered session entity key record-or-key-values {}))
+
+  ([^ModelSession session ^Entity entity key record-or-key-values opts]
+   (with-context deferred-context
+     (->> record-or-key-values
+          (s/map (fn [record-or-key-value]
+                   (select-one-instance session entity key record-or-key-value opts)))
+          (s/realize-each)
+          return))))

 (defn select-many-instances
   "select-many records, unless the record-or-key-values were already
@@ -190,13 +204,17 @@
    (select-many-instances session entity key record-or-key-values {}))

   ([^ModelSession session ^Entity entity key record-or-key-values opts]
-   (->> record-or-key-values
-        (map (fn [record-or-key-value]
-               (select-one-instance session entity key record-or-key-value opts)))
-        combine-responses)))
+   (with-context deferred-context
+     (mlet [smib-s (select-many-instances-buffered
+                    session
+                    entity
+                    key
+                    record-or-key-values
+                    opts)]
+       (s/reduce conj [] smib-s)))))

 (defn select-many-cat-buffered
-  "issue one select query for each record-or-key-value and concatenates
+  "issue one select query for each record-or-key-value and concatenate
    the responses"
   ([^ModelSession session ^Entity entity record-or-key-values]
    (select-many-cat-buffered session entity (t/uber-key entity) record-or-key-values {}))
@@ -230,5 +248,4 @@
                    key
                    record-or-key-values
                    opts)]
-       (return
-        (s/stream->seq smb-s))))))
+       (s/reduce conj [] smb-s)))))


print all the alia-session args

print all the alia-session args

--- src/er_cassandra/session/alia.clj
+++ src/er_cassandra/session/alia.clj
@@ -57,7 +57,7 @@
                                                (lb/dc-aware-round-robin-policy
                                                 datacenter)))

-        _ (info "create-alia-session*" cluster-args)
+        _ (info "create-alia-session*" args)
         cluster (alia/cluster cluster-args)
         alia-session (alia/connect cluster)]
     (alia/execute alia-session (str "USE " keyspace ";"))


add descriptions to menu items

add descriptions to menu items

--- src/aspire/security.clj
+++ src/aspire/security.clj
@@ -82,9 +82,13 @@
 ;; access based on parameters in the route (e.g., you can update
 ;; *your* profile, but not just any profile)?
 (def menu-items
-  {:admin {:route "/admin" :name "Admin" :weight 100 :authorized? (authorized? :admin)}
-   :home {:route "/" :name "Home" :weight 0 :authorized? (constantly true)}
-   :onboarding {:route "/welcome" :name "Competency Map" :weight 10 :authorized? (constantly true)}})
+  {:admin {:route "/admin" :name "Admin" :weight 100 :desc "Perform administrative functions" :authorized? (authorized? :admin)}
+   :home {:route "/" :name "Home" :weight 0 :desc "Main Aspire page" :authorized? (constantly true)}
+   :onboarding {:route "/welcome"
+                :name "Competency Map"
+                :weight 10
+                :desc "Add learning to your playlist"
+                :authorized? (constantly true)}})

 (defn menu [request]
   (let [ca (friend/current-authentication request)]


Rename an argument in resolve-dependencies to make docs more consistent for the future

--- src/degasolv/resolver_core.clj
+++ src/degasolv/resolver_core.clj
@@ -70,7 +70,7 @@
          spec)))))

 (defn resolve-dependencies
-  [specs
+  [requirements
    query & {:keys [present-packages
                    conflicts
                    strategy
@@ -187,4 +187,4 @@
        present-packages
        {}
        conflicts
-       specs))))
+       requirements))))


if spec is a sequence, then mapcat over it

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -43,11 +43,17 @@
            (repeatedly function))))))

 (defn generate [spec grammar lexicon index morph]
-  (if (empty? grammar)
-    (do
-      (log/error (str "grammar is empty."))
-      (exception (str "grammar is empty."))))
-  (first (take 1 (generate-all spec grammar lexicon index morph))))
+  (if (or (vector? spec)
+          (seq? spec))
+    (first (take 1
+                 (mapcat (fn [each-spec]
+                           (generate-all each-spec grammar lexicon index morph))
+                         spec)))
+    (if (empty? grammar)
+      (do
+        (log/error (str "grammar is empty."))
+        (exception (str "grammar is empty.")))
+      (first (take 1 (generate-all spec grammar lexicon index morph))))))

 (defn generate-all-with-model [spec {grammar :grammar
                                      index :index


max-total-depth 4

max-total-depth 4

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -11,7 +11,7 @@
                                         ref? remove-false remove-top-values-log
                                         strip-refs show-spec unify unifyc)]))
 ;; during generation, will not search deeper than this:
-(def ^:const max-total-depth 2)
+(def ^:const max-total-depth 4)

 (declare add-complement)
 (declare lexemes-before-phrases)


rename gen-docs task to docs

rename gen-docs task to docs

--- src/cake/tasks/docs.clj
+++ src/cake/tasks/docs.clj
@@ -5,10 +5,10 @@
         (cake [core :only [deftask]]
               [task :only [tasks]])))

-(deftask gen-docs #{deps}
+(deftask docs #{deps}
   "Generate documentation for tasks."
-  "If a filename is passed, documentation is written to that file. Otherwise,
-it is written to tasks.md in the current directory."
+  "If a filename is passed, documentation is written to that file."
+  "Otherwise, it is written to tasks.md in the current directory."
   {[file] :task-docs}
   (let [file (or file "tasks.md")]
     (log (str "Generating documentation in " file "."))


minors

minors

--- src/jarkeeper/views/common.clj
+++ src/jarkeeper/views/common.clj
@@ -17,6 +17,8 @@
 (defn common-footer []
   [:footer.row
    [:div.small-12.columns
-    [:p "Jarkeeper brought to you by "
-      [:a {:href "http://hashobject.com/"} "Hashobject team"] "—2 two people who love opensource."]
-    [:p.copyright "Hashobject, 2013"]]])
+    [:p "Brought to you by "
+      [:a {:href "http://hashobject.com/"} "Hashobject team"] "."]
+    [:p
+     [:a {:href "http://github.com/hashobject/jarkeeper.com"} "Jarkeeper"]
+     " is open source project hosted on GitHub."]]])


DM + CM #20 - Use database in invitation integration tests

--- integration/objective8/api/invitations_integration_tests.clj
+++ integration/objective8/api/invitations_integration_tests.clj
@@ -29,7 +29,7 @@
     :objective-id objective-id
     :invited-by-id invited-by-id }))

-(def the-invation (an-invitation))
+(def the-invitation (an-invitation))
 (def the-invitation-as-json (json/generate-string (an-invitation)))
 (def the-stored-invitation (assoc (an-invitation) :_id INVITATION_ID))

@@ -40,28 +40,18 @@
         [(before :contents (do (helpers/db-connection)
                                (helpers/truncate-tables)))
          (after :facts (helpers/truncate-tables))]
+
         (fact "the invitation is stored"
-              (p/request app (str "/api/v1/objectives/" OBJECTIVE_ID "/writer-invitations")
-                         :request-method :post
-                         :content-type "application/json"
-                         :body the-invitation-as-json) => (helpers/check-json-body the-stored-invitation)
-                         (provided
-                          (invitations/store-invitation! the-invitation) => the-stored-invitation))
-
-        (fact "the http response indicates the location of the invitation"
-              (against-background
-               (invitations/store-invitation! anything) => the-stored-invitation)
-
-              (let [result (p/request app (str "/api/v1/objectives/" OBJECTIVE_ID "/writer-invitations")
-                                      :request-method :post
-                                      :content-type "application/json"
-                                      :body the-invitation-as-json)
-                    response (:response result)
-                    headers (:headers response)]
-                response => (contains {:status 201})
-                headers => (contains {"Location" (contains
-                                                  (str "/api/v1/objectives/" OBJECTIVE_ID
-                                                       "/writer-invitations/" INVITATION_ID))})))
+              (let [{obj-id :_id created-by-id :created-by-id} (sh/store-an-objective)
+                    the-invitation (an-invitation obj-id created-by-id)
+                    {response :response} (p/request app (str "/api/v1/objectives/" obj-id "/writer-invitations")
+                                                    :request-method :post
+                                                    :content-type "application/json"
+                                                    :body (json/generate-string the-invitation))]
+                (:status response) => 201
+                (:body response) => (helpers/json-contains (assoc the-invitation
+                                                                  :_id integer?))
+                (:headers response) => (helpers/location-contains (str "/api/v1/objectives/" obj-id "/writer-invitations/"))))

         (fact "a 423 (resource locked) status is returned when drafting has started on the objective"
               (let [{obj-id :_id created-by-id :created-by-id} (sh/store-an-objective-in-draft)


Give this test more timeout to see if that helps.

--- integration-tests/apps/messaging/literals/test/literals/core_test.clj
+++ integration-tests/apps/messaging/literals/test/literals/core_test.clj
@@ -6,7 +6,7 @@
             [immutant.messaging :as msg]))

 (def publish (partial msg/publish "queue.literals"))
-(def receive (partial msg/receive "queue.literals"))
+(def receive (partial msg/receive "queue.literals" :timeout 30000))
 (def listen (partial msg/listen "queue.literals"))

 (defmacro with-tools-readers [& body]


Kirjaudu enterillä

Kirjaudu enterillä

--- mtg-pairings-server/src/cljs/mtg_pairings_server/components/main.cljs
+++ mtg-pairings-server/src/cljs/mtg_pairings_server/components/main.cljs
@@ -41,7 +41,10 @@

 (defn header []
   (let [user (subscribe [::subs/logged-in-user])
-        dci-number (atom "")]
+        dci-number (atom "")
+        login! (fn []
+                 (dispatch [::events/login @dci-number])
+                 (reset! dci-number ""))]
     (fn header-render []
       [ui/app-bar
        {:id                 :header
@@ -54,12 +57,14 @@
                                                      :input-style {:color :white}
                                                      :value       @dci-number
                                                      :on-change   (fn [_ new-value]
-                                                                    (reset! dci-number new-value))}]
+                                                                    (reset! dci-number new-value))
+                                                     :on-key-down (fn [e]
+                                                                    (when (= 13 (.-keyCode e))
+                                                                      (login!)))}]
                                                    [ui/flat-button
                                                     {:label       "Kirjaudu"
                                                      :label-style {:color :white}
-                                                     :on-click    #(do (dispatch [::events/login @dci-number])
-                                                                       (reset! dci-number ""))}]]))
+                                                     :on-click    login!}]]))
         :icon-element-left  (reagent/as-element
                               [ui/icon-menu
                                {:icon-button-element (reagent/as-element


replace other layer

replace other layer

--- src-cljs/frontend/datascript.cljs
+++ src-cljs/frontend/datascript.cljs
@@ -124,7 +124,7 @@
                         :layer/stroke-color "blue"
                         :layer/name         "Text Layer 2"
                         :document/id        document-id
-                        :layer/text         "Cmd-click to open the Radial menu"
+                        :layer/text         "Cmd-click to open the Radial menu, share the url to collaborate"
                         :layer/font-family  "Helvetica Neue"
                         :layer/font-size    25
                         :entity/type        :layer}])


minor tweaks to repl web ui + updated deps

--- src/main/shadow/cljs/ui/repl.cljs
+++ src/main/shadow/cljs/ui/repl.cljs
@@ -49,7 +49,8 @@
     (do (js/console.log "unknown cmd" cmd)
         state)))

-(defonce state-ref (atom nil))
+(defonce state-ref
+  (atom {}))

 (defn ws-loop []
   (go (loop []
@@ -77,6 +78,8 @@
     (let [term
           (doto (xterm/Terminal. #js {:disableStdin true
                                       :convertEol true
+                                      :fontFamily "monospace"
+                                      :fontSize 12
                                       :theme #js {:foreground "#000000"
                                                   :background "#FFFFFF"
                                                   :selection "rgba(0,0,0,0.3)"}})
@@ -125,6 +128,9 @@
    :right 0
    :bottom 0
    :height "auto"
+   ;;:margin 10
+   ;; :border-radius 2
+   ;; :box-shadow "0 3px 1px -2px rgba(0,0,0,.2), 0 2px 2px 0 rgba(0,0,0,.14), 0 1px 5px 0 rgba(0,0,0,.12)"
    :flex-direction "column"})

 (defstyled term-container :div [_]
@@ -132,20 +138,23 @@
    :padding-left 10})

 (defstyled editor-container :div [_]
-  {:height 200})
+  {:height 200
+   :border-top "2px solid #eee"})

 (defstyled html-toolbar :div [_]
   {:padding 10
+   :margin-bottom 10
+   :background-color "#eee"
    :font-weight "bold"})

-(defn ui []
-  (html-container
-    (html-toolbar
-      "[ALPHA] shadow-cljs REPL")
-
-    (term-container {:ref attach-terminal})
-    (editor-container
-      (html/input {:ref attach-codemirror}))))
+(defn ui [state]
+  (html/div
+    (html-container
+      (html-toolbar "[ALPHA] shadow-cljs REPL")
+
+      (term-container {:ref attach-terminal})
+      (editor-container
+        (html/input {:ref attach-codemirror})))))

 (defn ^:dev/after-load start []
   (let [cmd-in
@@ -164,7 +173,10 @@
         {:ws ws
          :ws-in ws-in
          :ws-out ws-out
-         :cmd-in cmd-in}]
+         :cmd-in cmd-in}
+
+        dom-target
+        (dom/by-id "root")]

     (swap! state-ref merge init-state)

@@ -185,7 +197,12 @@
                       (.send ws (pr-str msg))
                       (recur))))

-              (rd/render (ui) (dom/by-id "root"))
+              (rd/render (ui @state-ref) dom-target)
+
+              (add-watch state-ref
+                ::render
+                (fn [_ _ new-val old-val]
+                  (rd/render (ui new-val) dom-target)))

               (ws-loop)

@@ -202,6 +219,7 @@
               (async/close! ws-in))))))

 (defn ^:dev/before-load stop []
+  (remove-watch state-ref ::render)
   (rd/unmountComponentAtNode (dom/by-id "root"))
   (when-let [ws (:ws @state-ref)]
     (.close ws)


Get rid of node-specific setup

Get rid of node-specific setup

--- src/chapter3/match.cljs
+++ src/chapter3/match.cljs
@@ -1,6 +1,4 @@
-(ns chapter3.match
-  (:require [cljs.nodejs :as nodejs]))
-(nodejs/enable-util-print!)
+(ns chapter3.match)
 (def atom? (comp not list?))
 (defn match2 [p s]
   (cond


Run update in other thread

Run update in other thread

--- src/clj/subman/core.clj
+++ src/clj/subman/core.clj
@@ -14,16 +14,18 @@
              wrap-base-url
              wrap-reload))

-(def pool (at-at/mk-pool))
+(defn init-pool []
+  (let [pool (at-at/mk-pool)]
+    (at-at/every const/update-period
+                 (fn [] filler/update-all
+                   models/update-total-count)
+                 pool)))

 (defn -main [& args]
   (try (models/create-index)
     (catch Exception e (println e)))
   (models/update-total-count)
-  (at-at/every const/update-period
-               (fn [] filler/update-all
-                 models/update-total-count)
-               pool)
+  (future (init-pool))
   (let [port (Integer/parseInt
               (or (System/getenv "PORT") const/default-port))]
     (server/run-server app {:port port})))


Cache header contents

Cache header contents

--- src/cljam/io/bigwig.clj
+++ src/cljam/io/bigwig.clj
@@ -13,7 +13,7 @@

 (def ^:private bpt-magic 0x78CA8C91)

-(declare read-structure)
+(declare read-structure read-all-headers)

 (defrecord FixedWidthHeader [magic version zoom-levels chromosome-tree-offset
                              full-data-offset full-index-offset
@@ -41,7 +41,7 @@

 (defrecord BbiChromInfo [name id size])

-(defrecord BIGWIGReader [^RandomAccessFile reader ^URL url]
+(defrecord BIGWIGReader [^RandomAccessFile reader ^URL url ^BigWigStructure headers]
   Closeable
   (close [this]
     (.close ^Closeable (.reader this)))
@@ -56,8 +56,9 @@
   to ensure the reader is properly closed."
   [f]
   (let [f (.getAbsolutePath (cio/file f))
-        reader (RandomAccessFile. f "r")]
-    (BIGWIGReader. reader (util/as-url f))))
+        reader (RandomAccessFile. f "r")
+        headers (read-all-headers reader)]
+    (BIGWIGReader. reader (util/as-url f) headers)))

 (defn- check-bigwig-magic
   "Checks if the magic is right for bigWig format. Otherwise, throws IOException."
@@ -178,6 +179,7 @@
 (defn- read-all-headers
   "Returns the all headers of bigWig format."
   [^RandomAccessFile r]
+  (.seek r 0)
   (let [fixed-width-header (read-fixed-width-header r)
         zoom-headers (read-zoom-headers r fixed-width-header)
         total-summary (read-total-summary r fixed-width-header)
@@ -226,7 +228,5 @@
   a header structure and a sequence of chromosome data."
   [^BIGWIGReader rdr]
   (let [r ^RandomAccessFile (.reader rdr)]
-    (.seek r 0)
-    (let [headers (read-all-headers r)
-          bbi-chrom-info (read-bbi-chrom-info r (:bpt-header headers))]
-      {:headers headers, :bbi-chrom-info bbi-chrom-info})))
+    (let [bbi-chrom-info (read-bbi-chrom-info r (:bpt-header (.headers rdr)))]
+      {:headers (.headers rdr), :bbi-chrom-info bbi-chrom-info})))


Remove `delay-frame` from cljs as `delay` is not supported in p5js

--- src/cljc/quil/core.cljc
+++ src/cljc/quil/core.cljc
@@ -1335,23 +1335,24 @@
   #?(:clj (PApplet/degrees (float radians))
      :cljs (.degrees (ap/current-applet) radians)))

-(defn
-  ^{:requires-bindings true
-    :processing-name "delay()"
-    :processing-link nil
-    :category "Structure"
-    :subcategory nil
-    :added "1.0"}
-  delay-frame
-  "Forces the program to stop running for a specified time. Delay
-  times are specified in thousandths of a second, therefore the
-  function call (delay 3000) will stop the program for three
-  seconds. Because the screen is updated only at the end of draw,
-  the program may appear to 'freeze', because the screen will not
-  update when the delay fn is used. This function has no affect
-  inside setup."
-  [freeze-ms]
-  (.delay (ap/current-applet) (int freeze-ms)))
+#?(:clj
+   (defn
+     ^{:requires-bindings true
+       :processing-name "delay()"
+       :processing-link nil
+       :category "Structure"
+       :subcategory nil
+       :added "1.0"}
+     delay-frame
+     "Forces the program to stop running for a specified time. Delay
+     times are specified in thousandths of a second, therefore the
+     function call (delay 3000) will stop the program for three
+     seconds. Because the screen is updated only at the end of draw,
+     the program may appear to 'freeze', because the screen will not
+     update when the delay fn is used. This function has no affect
+     inside setup."
+     [freeze-ms]
+     (.delay (ap/current-applet) (int freeze-ms))))

 (defn
   ^{:requires-bindings true