nullpointerexception fixed

nullpointerexception fixed

--- src/crawler/rich_char_extractor.clj
+++ src/crawler/rich_char_extractor.clj
@@ -35,92 +35,94 @@
      (state-action page-src url-ds template-removed []))

   ([page-src url-ds template-removed blacklist]
-     (let [url                  (-> url-ds :url)
-
-           proc-pg              (dom/html->xml-doc page-src)
-
-           ; xpaths nodes and associated anchor-text
-           xpaths-hrefs-text    (dom/xpaths-hrefs-tokens-no-position proc-pg
-                                                                     url
-                                                                     blacklist)
-
-           template-removed     (map
-                                 (fn [[xpath infos]]
-                                   (let [template-links (-> xpath
-                                                            template-removed
-                                                            set)]
-                                     [xpath (filter
-                                             (fn [{_ :node href :href _1 :text}]
-                                               (not
-                                                (some #{href} template-links)))
-                                             infos)]))
-                                 xpaths-hrefs-text)
-
-           xpaths-anchors-chars (map
-                                 (fn [[xpath nodes]]
-                                   [xpath (distinct
-                                           (map
-                                            (fn [a-node]
-                                              {:href (:href a-node)
-                                               :num-chars (-> a-node
-                                                              :text
-                                                              count)
-                                               :text (:text a-node)})
-                                            nodes))])
-                                 template-removed)
-
-           page-wide-nav-chars  (reduce
-                                 (fn [acc [xpath nodes]]
-                                   (+ acc
-                                      (reduce
-                                       (fn [acc a-node]
-                                         (+ acc (-> a-node
-                                                    :text
-                                                    count)))
-                                       0
-                                       nodes)))
-                                 0
-                                 template-removed)
-
-           xpath-nav-info       (filter
-                                 #(not
-                                   (or
-                                    (-> % :score zero?)
-                                    (-> % :hrefs-and-texts count zero?)))
-                                 (map
-                                  (fn [[xpath info]]
-                                    (let [potential-xpath xpath
-                                          potential-score (reduce
-                                                           (fn [acc an-info]
-                                                             (+
-                                                              acc
-                                                              (:num-chars an-info)))
-                                                           0
-                                                           info)
-                                          potential-hrefs-texts (reduce
-                                                                 (fn [acc an-info]
-                                                                   (cons {:href (:href an-info)
-                                                                          :text (:text an-info)}
-                                                                         acc))
-                                                                 '()
-                                                                 info)]
-                                      {:xpath potential-xpath
-                                       :score (/ potential-score
-                                                 (count potential-hrefs-texts))
-                                       :hrefs-and-texts potential-hrefs-texts}))
-                                  xpaths-anchors-chars))]
-
-       {:total-nav-info page-wide-nav-chars
-        :xpath-nav-info (reverse
-                         (sort-by
-                          :score
-                          (remove-subsets
-                           (utils/distinct-by-fn
-                            xpath-nav-info
-                            (fn [x] (set
-                                    (map
-                                     :href
-                                     (:hrefs-and-texts x))))))))})))
+     (if (nil? page-src)
+       []
+       (let [url                  (-> url-ds :url)
+
+             proc-pg              (dom/html->xml-doc page-src)
+
+                                        ; xpaths nodes and associated anchor-text
+             xpaths-hrefs-text    (dom/xpaths-hrefs-tokens-no-position proc-pg
+                                                                       url
+                                                                       blacklist)
+
+             template-removed     (map
+                                   (fn [[xpath infos]]
+                                     (let [template-links (-> xpath
+                                                              template-removed
+                                                              set)]
+                                       [xpath (filter
+                                               (fn [{_ :node href :href _1 :text}]
+                                                 (not
+                                                  (some #{href} template-links)))
+                                               infos)]))
+                                   xpaths-hrefs-text)
+
+             xpaths-anchors-chars (map
+                                   (fn [[xpath nodes]]
+                                     [xpath (distinct
+                                             (map
+                                              (fn [a-node]
+                                                {:href (:href a-node)
+                                                 :num-chars (-> a-node
+                                                                :text
+                                                                count)
+                                                 :text (:text a-node)})
+                                              nodes))])
+                                   template-removed)
+
+             page-wide-nav-chars  (reduce
+                                   (fn [acc [xpath nodes]]
+                                     (+ acc
+                                        (reduce
+                                         (fn [acc a-node]
+                                           (+ acc (-> a-node
+                                                      :text
+                                                      count)))
+                                         0
+                                         nodes)))
+                                   0
+                                   template-removed)
+
+             xpath-nav-info       (filter
+                                   #(not
+                                     (or
+                                      (-> % :score zero?)
+                                      (-> % :hrefs-and-texts count zero?)))
+                                   (map
+                                    (fn [[xpath info]]
+                                      (let [potential-xpath xpath
+                                            potential-score (reduce
+                                                             (fn [acc an-info]
+                                                               (+
+                                                                acc
+                                                                (:num-chars an-info)))
+                                                             0
+                                                             info)
+                                            potential-hrefs-texts (reduce
+                                                                   (fn [acc an-info]
+                                                                     (cons {:href (:href an-info)
+                                                                            :text (:text an-info)}
+                                                                           acc))
+                                                                   '()
+                                                                   info)]
+                                        {:xpath potential-xpath
+                                         :score (/ potential-score
+                                                   (count potential-hrefs-texts))
+                                         :hrefs-and-texts potential-hrefs-texts}))
+                                    xpaths-anchors-chars))]
+
+         {:total-nav-info page-wide-nav-chars
+          :xpath-nav-info (reverse
+                           (sort-by
+                            :score
+                            (remove-subsets
+                             (utils/distinct-by-fn
+                              xpath-nav-info
+                              (fn [x] (set
+                                      (map
+                                       :href
+                                       (:hrefs-and-texts x))))))))}))))

 (defn state-action-model
   [actions page-src url-ds template-removed blacklist]


Only allow one time based filter at a time

Fixes #125

--- src/day8/re_frame/trace/events.cljs
+++ src/day8/re_frame/trace/events.cljs
@@ -170,15 +170,16 @@
     (let [new-db (when-not (some #(= filter-input (:query %)) filter-items) ;; prevent duplicate filter strings
                    ;; if existing, remove prior filter for :slower-than
                    ;; TODO: rework how time filters are used.
-                   (when (and (= :slower-than filter-type)
-                              (some #(= filter-type (:filter-type %)) filter-items))
-                     (remove #(= :slower-than (:filter-type %)) filter-items))
-                   ;; add new filter
-                   (conj filter-items {:id          (random-uuid)
-                                       :query       (if (= filter-type :contains)
-                                                      (str/lower-case filter-input)
-                                                      (js/parseFloat filter-input))
-                                       :filter-type filter-type}))]
+                   (let [filter-items (if (and (= :slower-than filter-type)
+                                                 (some #(= filter-type (:filter-type %)) filter-items))
+                                        (remove #(= :slower-than (:filter-type %)) filter-items)
+                                        filter-items)]
+                     ;; add new filter
+                     (conj filter-items {:id          (random-uuid)
+                                         :query       (if (= filter-type :contains)
+                                                        (str/lower-case filter-input)
+                                                        (js/parseFloat filter-input))
+                                         :filter-type filter-type})))]
       (save-filter-items new-db)
       new-db)))


Hide main view when showing sidebar

Hide main view when showing sidebar

--- src/discuss/components/sidebar.cljs
+++ src/discuss/components/sidebar.cljs
@@ -24,11 +24,13 @@
 (defn show
   "Show sidebar."
   []
+  (lib/remove-class (gdom/getElement (lib/prefix-name "dialogue-collapse")) "in")
   (toggle true))

 (defn hide
   "Hide sidebar."
   []
+  (lib/add-class (gdom/getElement (lib/prefix-name "dialogue-collapse")) "in")
   (toggle false))


cleanup

cleanup

--- src/shuppet/elb.clj
+++ src/shuppet/elb.clj
@@ -6,7 +6,6 @@
    [clj-http.client :as client]
    [clojure.tools.logging :as log]
    [clojure.xml :as xml]
-   [clojure.data :refer [diff]]
    [clojure.zip :as zip :refer [children]]
    [slingshot.slingshot :refer [throw+ try+]]
    [clojure.data.zip.xml :refer [xml1-> text xml->]]))


Calculate graph

Calculate graph

--- src/spark/core.cljs
+++ src/spark/core.cljs
@@ -17,7 +17,15 @@
         ▄▆▂█▁"))

 (defn print-graph [args]
-  (println "▁▂█▅▂"))
+  (let [ticks '(\▁  \▂  \▃  \▄  \▅  \▆  \▇  \█)
+        numbers (map int args)
+        lower (apply min numbers)
+        upper (apply max numbers)
+        tick-diff (int (/ (* (- upper lower) 256) (dec (count ticks))))
+        tick-pos (fn [x] (int (/ (* (- x lower) 256) tick-diff)))]
+    ;(println "min: " lower ", max: " upper ", diff: " tick-diff)
+    ;(println (map #(tick-pos %) numbers))
+    (println (apply str (map #(nth ticks (tick-pos %)) numbers)))))

 (defn start [& args]
   (if (print-usage? args)


new play

new play

--- src/picsou/core.clj
+++ src/picsou/core.clj
@@ -6,6 +6,7 @@
             [picsou.time.obj :as time]
             [picsou.learn :as learn]
             [picsou.util :as util]
+            [picsou.time.api :as api]
             [clojure.java.io :as io]
             [picsou.corpus :as corpus]
             [midje.repl]))
@@ -212,26 +213,19 @@
    (let [targets (when targets (map (fn [dim] {:dim dim :label dim}) targets))
          {stash :stash
           winners :winners} (parse s context module-id targets)]
+
      ;; 1. print stash
      (print-stash stash (get-classifier module-id) winners)
-     (printf "%d tokens in stash\n" (count stash))

      ;; 2. print winners
-     (print "Winners: \n")
+     (printf "\n%d winners:\n" (count winners))
      (doseq [winner winners]
-       (case (:dim winner)
-         :time (println "Time" (:value winner) (:form winner) (:precision winner))
-         :duration (println "Duration" (select-keys winner [:value :grain]))
-         :number (println "Number" "integer?" (:integer winner) (:value winner) (:body winner))
-         :pnl (println "Potential named location: " (:pnl winner) " Within n :" (:n winner))
-         :unit (println "Unit :" (:cat winner) " => " (:value winner))
-         (println "Other: " (:dim winner) (dissoc winner :dim :rule :route :text :pos :end :index :body :start)))
-       (when (:latent winner) (println "Latent token"))
-       #_(print-tokens winner module-id))
+       (printf "%-25s %s\n" (str (name (:dim winner))
+                                 (if (:latent winner) " (latent)" ""))
+                            (api/export-value winner)))

      ;; 3. ask for details
-     (println)
-     (println (format "For further info: (details idx) where 1 <= idx <= %d" (dec (count stash))))
+     (printf "For further info: (details idx) where 1 <= idx <= %d\n" (dec (count stash)))
      (def details (fn [n]
                     (print-tokens (nth stash n) (get-classifier module-id))))
      (def token (fn [n]


Expose argument links.

Expose argument links.

--- src/topiq/view.cljs
+++ src/topiq/view.cljs
@@ -73,12 +73,21 @@
    [:#forgot-user-input] (set-attr :disabled true)})

+(defn expose-links [text]
+  (let [free-url #"([\(]?)((https?|ftp)://[a-z0-9\u00a1-\uffff-]+(\.[a-z0-9\u00a1-\uffff-]+)+(:\d{2,5})?(/\S+)?)[\)]?"
+        links (re-seq free-url text)]
+    (reduce (fn [text [_ par url]]
+              (if (empty? par)
+                (.replace text url (str "[" url "](" url ")"))
+                text)) text links)))
+
 ;; --- user post templates ---
 (defsnippet topiq-argument "templates/argument.html" [:.argument]
   [argument]
   {[:.argument-text] (-> (:content argument)
-                        render-content
-                        html-content)
+                         expose-links
+                         render-content
+                         html-content)
    [:.argument-author] (content (:author argument))
    [:.argument-ts] (content (compute-time-diff (:ts argument)))})

@@ -110,7 +119,7 @@
                                                       topiq
                                                       (.-innerHTML (dom/by-id "nav-current-user"))))})

-;; WARNING: pure arguments name clashes with compiler
+;; WARNING: pure "arguments" name clashes with compiler
 (deftemplate topiq-arguments "templates/argument.html"
   [app owner db]
   {[:.topiq-text] (html-content


Add missing render mode :p3d

Add missing render mode :p3d

--- src/quil/applet.clj
+++ src/quil/applet.clj
@@ -79,6 +79,7 @@

 (def ^{:private true}
   renderer-modes {:p2d    P2D
+                  :p3d    P3D
                   :java2d JAVA2D
                   :opengl OPENGL
                   :pdf    PDF


fix worksheet lookup

fix worksheet lookup

--- src/rester/core.clj
+++ src/rester/core.clj
@@ -187,7 +187,7 @@
 (defmethod read-rows :excel [file sheet]
   (let [wk-book (load-workbook file)
         wk-sheet (cond
-                   (string? sheet) (-> wk-book (select-sheet sheet))
+                   (string? sheet) (select-sheet sheet wk-book)
                    :else (-> wk-book sheet-seq first))]
     (into [] (->> wk-sheet row-seq
                   (map #(map (fn[i] (if-let [c (.getCell % i)] (str (read-cell c)) ""))


re-added tests to runner

re-added tests to runner

--- dev/cljs/user.cljs
+++ dev/cljs/user.cljs
@@ -31,8 +31,8 @@
     (change-favicon-to-color "#0d0")))

 (defn run-all-tests []
-;  (run-tests 'untangled.test.dom-spec)
-;  (run-tests 'untangled.test.events-spec)
+  (run-tests 'untangled.test.dom-spec)
+  (run-tests 'untangled.test.events-spec)
   (run-tests 'untangled.history-spec)
   )


Comment out player call

Comment out player call

--- src/overtone_workspace/grunbles.clj
+++ src/overtone_workspace/grunbles.clj
@@ -51,7 +51,7 @@
     (apply-by (metro (inc beat)) #'player (inc beat) rates [])
     ))

-(player (metro) [])
+;; (player (metro) [])

 (defn laserplayer [beat]
   (let [dur (/ 60.0 (metro :bpm))]      ; 15bars


Add at examples

Add at examples

--- src/overtone_workspace/grunbles.clj
+++ src/overtone_workspace/grunbles.clj
@@ -1,4 +1,5 @@
 (ns overtone-workspace.grumbles
+  ; (:require  [overtone.at-at :as at-at])
   (:use [overtone.live]))

 ;; Inspired by an example in an early chapter of the SuperCollider book
@@ -21,6 +22,16 @@

 (volume (/ 20 127))
+
+
+;; at overtone.music.time
+; (at (+ (now) 2000) (grumble))
+; (at (+ (now) 2000) #(println "hoge"))
+; (periodic 200 #(println "hoge"))
+
+;; at overtone.at-at
+; (def mypool (at-at/mk-pool))
+; (at-at/at (+ 1000 (now))  #(println "hello from the past") mypool :desc "Message from the past")

 (def metro (metronome 128))


Make x y coord calculation clearer.

Make x y coord calculation clearer.

--- src/videotest/falling/fall_core.clj
+++ src/videotest/falling/fall_core.clj
@@ -81,10 +81,10 @@
 (defn update-color-record
   [{:keys [triangle-points rgba-mat color-record] :as state}]
   (let [color-fn (fn [col row]
-                   (let [cam-x (* col CAM-BIN-SIZE)
-                         cam-y (* row CAM-BIN-SIZE)
-                         cam-x (+ cam-x CAM-BIN-SIZE-2)
-                         cam-y (+ cam-y CAM-BIN-SIZE)
+                   (let [cam-x (+ (* col CAM-BIN-SIZE)
+                                  CAM-BIN-SIZE-2)
+                         cam-y (+ (* row CAM-BIN-SIZE)
+                                  CAM-BIN-SIZE)
                          c (.get rgba-mat cam-y cam-x)]
                      (if (< 0 (count c))
                        (vec c)


CMR-2708 Adds test for offset beyond end of results

--- system-int-test/test/cmr/system_int_test/search/offset_search_test.clj
+++ system-int-test/test/cmr/system_int_test/search/offset_search_test.clj
@@ -32,4 +32,5 @@
     (is (= (:refs (search/find-refs :collection {"page_num" 1 "page_size" 5}))
            (:refs (search/find-refs :collection {"offset" 0 "page_size" 5}))))
     (is (= (:refs (search/find-refs :collection {"page_num" 2 "page_size" 5}))
-           (:refs (search/find-refs :collection {"offset" 5 "page_size" 5}))))))
+           (:refs (search/find-refs :collection {"offset" 5 "page_size" 5}))))
+    (is (= [] (:refs (search/find-refs :collection {"offset" 25 "page_size" 10}))))))


stuff

stuff

--- src/doctopus/web.clj
+++ src/doctopus/web.clj
@@ -40,8 +40,8 @@

 (defn serve-html
   "Just returns html, with the content-type set correctly"
-  [template]
-  (-> template
+  [html]
+  (-> html
       (ring-response/response)
       (ring-response/content-type "text/html")))

@@ -78,12 +78,25 @@
                   "add-tentacle" {:get serve-add-tentacle-form :post add-tentacle}
                   "docs/"         [(load-routes doctopus)]}])

+(defn- get-tentacle-from-uri
+  [request-uri]
+  (let [pieces (re-find #"/docs/([^/]+)/.+" request-uri)]
+    (if pieces (second pieces) nil)))
+
 (def application-handlers
   (bidi/make-handler routes))
+
+(defn wrap-test
+  [handler]
+  (fn [request]
+    (let [response (handler request)
+          tentacle-name (get-tentacle-from-uri (:uri request))]
+      (if tentacle-name (assoc response :body (templates/add-frame (:body response) {:name tentacle-name})) response))))

 (def application
   (-> (wrap-defaults application-handlers site-defaults)
       (wrap-route-not-found)
+      (wrap-test)
       (reload/wrap-reload)
       ((if (= (:env (server-config)) :production)
          wrap-error-page


Trim output from sh!

Trim output from sh!

--- test/powderkeg/integration_test.clj
+++ test/powderkeg/integration_test.clj
@@ -8,7 +8,7 @@
   (let [{:keys [exit out] :as ret} (apply sh args)]
     (when-not (zero? exit)
       (throw (Exception. (str "Problem while running '" (s/join " " args) "': " out))))
-    out))
+    (.trim out)))

 (defn start-master [pwd]
   (sh! "docker" "run" "-d"


add basic traces

add basic traces

--- src/fat_jar/core.clj
+++ src/fat_jar/core.clj
@@ -31,10 +31,12 @@
             ;(println parent)
             ;(println many-from-list)
             ;(println many-from-single)
-            {:output output
+            (let [result {:output output
                :v value
-              :multiple multiple}
-             )))
+              :multiple multiple}]
+              (println "result for " selector " is " result)
+              result
+             ))))

 ; (select- {:map ["vos" "name"] :to "v7"} user-data)
 ; (select- {:map ["a"] :to "v7"} user-data)
@@ -46,12 +48,18 @@
     (.newLine w))))

 (def config
-  (p/properties->map
-    (->> "./mapper.properties" io/file p/load-from)
-    true))
+  (let [properties (p/properties->map
+        (->> "./mapper.properties" io/file p/load-from)
+        true)]
+      (do
+        (map println properties)
+        properties)))

 (defn at-folder [options filename]
-  (str (:output options) "/" filename))
+  (let [path (str (:output options) "/" filename)]
+      (do
+        (println (str "accessing " path))
+        path)))

 (defn process [options]
   (do
@@ -72,6 +80,10 @@
                             (select- mapping coll))
                          (format-value [value]
                             (str (:multiple value) (:output value) "|" (clojure.string/join "|" (:v value))))]
+
+                         (println (str "destination-file " destination-file))
+                         (println (str "mappings " mappings))
+                         (println (str "user-data " user-data))

        (->>  mappings
           (map #(select-values user-data %))


remove debug code

remove debug code

--- src/fat_jar/core.clj
+++ src/fat_jar/core.clj
@@ -45,7 +45,6 @@
       (errors? options) (do (print-help options) (println (:errors options)))
       (help? options) (print-help options)
       :else (do
-        (println "doing stuff")
         (println options)
         (let [mappings (->> (config :input.mappings)
                      slurp


fix stale ns reference in docstring

fix stale ns reference in docstring

--- src/keypin/store.clj
+++ src/keypin/store.clj
@@ -57,7 +57,7 @@
   "Given duration in milliseconds, return a fetch decider (predicate) function

   ```
-  (fn [^keypin.type.record.StoreState store-state]) -> boolean
+  (fn [^keypin.type.StoreState store-state]) -> boolean
   ```

   that returns `true` if the duration has elapsed, `false` otherwise.
@@ -73,7 +73,7 @@
   "Given error-timestamp key and duration since error, return a fetch decider (predicate) function

   ```
-  (fn [^keypin.type.record.StoreState store-state]) -> boolean
+  (fn [^keypin.type.StoreState store-state]) -> boolean
   ```

   that returns `true` if error happened + duration elapsed,


jme3 tutorial 8

jme3 tutorial 8

--- src/maqueta/core.clj
+++ src/maqueta/core.clj
@@ -1,51 +1,93 @@
 (ns maqueta.core
   (:use (maqueta application assets))
-  (:import com.jme3.math.ColorRGBA
-           com.jme3.math.Vector3f
-           com.jme3.scene.Node
-           (com.jme3.animation AnimControl LoopMode)
-           com.jme3.light.DirectionalLight)
+  (:import com.jme3.collision.CollisionResults
+           com.jme3.font.BitmapText
+           (com.jme3.math ColorRGBA Ray Vector3f)
+           (com.jme3.scene Node Geometry)
+           (com.jme3.scene.shape Box Sphere))
   (:gen-class))

-(def light (DirectionalLight.))
+(defn make-cube
+  [name x y z]
+  (let [box (Box. (Vector3f. x y z) 1 1 1)
+        cube (Geometry. name box)
+        mat (load-material "Common/MatDefs/Misc/Unshaded.j3md")]
+    (.setColor mat "Color" (ColorRGBA/randomColor))
+    (.setMaterial cube mat)
+    cube))

-(def player (load-model "Models/Oto/Oto.mesh.xml"))
+(defn make-floor
+  []
+  (let [box (Box. (Vector3f. 0 -4 -5) 15 0.2 15)
+        floor (Geometry. "the Floor" box)
+        mat (load-material "Common/MatDefs/Misc/Unshaded.j3md")]
+    (.setColor mat "Color" ColorRGBA/Gray)
+    (.setMaterial floor mat)
+    floor))

-(def control (.getControl player AnimControl))
+(def shootables (doto (Node. "Shootables")
+                  (.attachChild (make-cube "a Dragon" -2 0 1))
+                  (.attachChild (make-cube "a tin can" 1 -2 0))
+                  (.attachChild (make-cube "the Sheriff" 0 1 -2))
+                  (.attachChild (make-cube "the Deputy" 1 0 -4))
+                  (.attachChild (make-floor))))

-(def channel (.createChannel control))
+(def mark (let [sphere (Sphere. 30 30 0.2)
+                mark (Geometry. "BOOM!" sphere)
+                mat (load-material "Common/MatDefs/Misc/Unshaded.j3md")]
+            (.setColor mat "Color" ColorRGBA/Red)
+            (.setMaterial mark mat)
+            mark))

-(defn walk
+(defn shoot
   [app is-pressed tpf]
   (if (not is-pressed)
-    (doto channel
-      (.setAnim "Walk" 0.5)
-      (.setLoopMode LoopMode/Loop))))
+    (let [root-node (.getRootNode app)
+          results (CollisionResults.)
+          cam (.getCamera app)
+          ray (Ray. (.getLocation cam) (.getDirection cam))]
+      (.collideWith shootables ray results)
+      (println "-----" "Collisions?" (.size results) "-----")
+      (doall (map (fn [i]
+                    (let [collision (.getCollision results i)
+                          dist (.getDistance collision)
+                          pt (.getContactPoint collision)
+                          hit (.getName (.getGeometry collision))]
+                      (println "* Collision #" i)
+                      (println " You shot" hit "at" pt "," dist "wu away.")))
+                  (range (.size results))))
+      (if (> (.size results) 0)
+        (let [closest (.getClosestCollision results)]
+          (.setLocalTranslation mark (.getContactPoint closest))
+          (.attachChild root-node mark))
+        (.detachChild root-node mark)))))

-(def on-action {:key-space walk})
+(def on-action {:button-left shoot})

-(defn cycle-done
-  [app control channel]
-  (doto channel
-    (.setAnim "stand" 0.5)
-    (.setLoopMode LoopMode/DontLoop)
-    (.setSpeed 1)))
-
-(def on-anim-cycle-done {"Walk" cycle-done})
+(defn init-cross-hairs
+  [gui-node]
+  (let [font (load-font "Interface/Fonts/Default.fnt")
+        ch (BitmapText. font false)]
+    (.detachAllChildren gui-node)
+    (doto ch
+      (.setSize (* 2 (.getRenderedSize (.getCharSet font))))
+      (.setText "+")
+      (.setLocalTranslation (- (/ (.getWidth *app-settings*) 2)
+                               (* 2
+                                  (/ (.getRenderedSize (.getCharSet font))
+                                     3)))
+                            (+ (/ (.getHeight *app-settings*) 2)
+                               (/ (.getLineHeight ch) 2))
+                            0))
+    (.attachChild gui-node ch)))

 (defn setup-fn
   [app]
   (let [root-node (.getRootNode app)
-        viewport (.getViewPort app)]
-    (.setBackgroundColor viewport ColorRGBA/LightGray)
-    (.setDirection light (.normalizeLocal (Vector3f. -0.1 -1 -1)))
-    (.addLight root-node light)
-    (.attachChild root-node player)
-    (.setLocalScale player (Vector3f. 0.5 0.5 0.5))
-    (.addListener control app)
-    (.setAnim channel "stand")))
+        gui-node (.getGuiNode app)]
+    (init-cross-hairs gui-node)
+    (.attachChild root-node shootables)))

 (defn -main [& args]
   (.start (make-app :setup-fn setup-fn
-                    :on-anim-cycle-done on-anim-cycle-done
                     :on-action on-action)))


things

things

--- src/oi_lang/obj.cljs
+++ src/oi_lang/obj.cljs
@@ -61,14 +61,39 @@
   (is (= (parse "foo bar") [[:send [:message "foo"] [:message "bar"]]]))
   (is (= (parse "foo < bar") [[:send [:message "foo"] [:message "<" [:arglist [:message "bar"]]]]])))

+(defn activate [value args]
+  (if (fn? value)
+    (apply value args)
+    (throw "unsupported activation")))
+
+(defn oi-= [a b]
+  (and (= (:type a) (:type b))
+       (= (:value a) (:value b))))
+
+(defn oi-object []
+  {:slots [] :proto nil})
+
+(def initial (oi-object))
+
+(defn oi-number [n]
+  {:type :number
+   :value n
+   :slots {"<" (fn [o] (< n o))}
+   :proto initial})
+
 (defn eval [expr]
-  expr)
+  (match expr
+    [:number n] (oi-number n)
+    [:send target [:message name args]] (activate (-> target :slots name) (map eval args))))

 (defn eval* [exprs]
   (map eval exprs))

-(def oi-false [:false])
+(def oi-false {:type :boolean
+               :value false
+               :slots []
+               :proto initial})

 (deftest eval-tests
-  (is (= (eval "42") "42"))
-  (is (= (eval "42 < 22") oi-false)))
+  (is (oi-= (eval* (parse "42")) [(oi-number 42)]))
+  (is (oi-= (eval* (parse "42 < 22")) [oi-false])))


Interval set arithmetic, rather than just single intervals.

--- src/player/core.cljs
+++ src/player/core.cljs
@@ -2,6 +2,7 @@
   (:require
     #_[om.core :as om :include-macros true]
     [clojure.set :refer [union]]
+    [cljs.tools.reader.edn :as reader]
     #_[clojure.walk :as walk]
     [sablono.core :as sab :include-macros true])
   (:require-macros
@@ -23,20 +24,87 @@
 (def time-unit (/ frame-length time-units-per-frame))
 (def precision 0.001)

-(defn empty-interval? [[start end]]
-  (> start end))
+(defn simple? [i]
+  (if-let [[imin imax] i]
+    (and (number? imin) (number? imax))
+    false))
+
+(defn empty-interval? [i]
+  (if (simple? i)
+    (> (first i) (second i))
+    (every? empty-interval? i)))
+
+(declare merge-overlapping)
+
+(defn intersection [a b]
+  (cond
+    (or (empty-interval? a) (empty-interval? b)) [Infinity Infinity]
+    (and (simple? a) (simple? b)) (let [[amin amax] a
+                                        [bmin bmax] b]
+                                    (cond
+                                      (< bmin amin) (intersection b a)
+                                      (< amax bmin) nil
+                                      :else [(.max js/Math amin bmin) (.min js/Math amax bmax)]))
+    ; b (resp. a) is a disjunction of simple intervals; intersect each with a (resp. b)
+    (simple? a) (merge-overlapping (mapv #(intersection a %) b))
+    (simple? b) (merge-overlapping (mapv #(intersection b %) a))
+    ; both are disjunctions of simple intervals. union of intersections
+    ; (a1 u a2 u a3) ^ (b1 u b2 u b3) == (a1 ^ b1 u a1 ^ b2 u a1 ^ b3) u ...
+    :else (merge-overlapping (vec
+                               ; union of unions of pairwise intersections
+                               (mapcat (fn [ai]
+                                         ; union of pairwise intersections
+                                         (mapv (fn [bi]
+                                                 (intersection ai bi))
+                                               b))
+                                       a)))))
+
+(defn sort-intervals [intervals]
+  (sort (fn [a b]
+          (cond
+            (and (simple? a) (simple? b)) (compare (first a) (first b))
+            (simple? a) (compare (first a) (ffirst b))
+            (simple? b) (compare (ffirst a) (first b))
+            :else (compare (ffirst a) (ffirst b))))
+        intervals))
+
+(defn flatten-intervals [intervals]
+  (reduce (fn [sofar interval]
+            (if (simple? interval)
+              (conj sofar interval)
+              (into sofar (flatten-intervals interval))))
+          []
+          intervals))
+
+(defn merge-overlapping [intervals]
+  (let [intervals (flatten-intervals intervals)
+        intervals (sort-intervals intervals)
+        [last-i merged] (reduce (fn [[[amin amax :as a] merged] [bmin bmax :as b]]
+                                  (if (intersection a b)
+                                    [[amin (.max js/Math amax bmax)] merged]
+                                    [[bmin bmax] (conj merged a)]))
+                                [(first intervals) []]
+                                (rest intervals))]
+    (if (empty? intervals)
+      []
+      (conj merged last-i))))
+
+(defn constrain-times [interval]
+  (if (simple? interval)
+    [(ceil-time (first interval) time-unit) (floor-time (second interval) time-unit)]
+    (mapv constrain-times interval)))

 (defn intersect-all [intervals]
-  (let [[start end] (reduce
-                      (fn [[amin amax] [bmin bmax]]
-                        [(.max js/Math amin bmin) (.min js/Math amax bmax)])
-                      [time-unit Infinity]
-                      intervals)
-        narrow-start (ceil-time start time-unit)
-        narrow-end (floor-time end time-unit)]
-    (when (and (< start end) (< narrow-end narrow-start))
-      (.warn js/console "This interval is narrower than D!" (str [start end]) (str [narrow-start narrow-end])))
-    [(ceil-time start time-unit) (floor-time end time-unit)]))
+  (constrain-times
+    (reduce (fn [a b]
+              (if-let [intr (intersection a b)]
+                intr
+                [Infinity Infinity]))
+            [time-unit Infinity]
+            intervals)))
+
+(defn union-all [intervals]
+  (merge-overlapping intervals))

 (defn third [v] (nth v 2))

@@ -60,15 +128,15 @@
     (nil? k) [0 0]
     (keyword? k) [(quantize (get ha k) precision) (get-in ha [(:state ha) :flows k] 0)]
     (vector? k) (let [other-ha (get has (first k))
-                      other-state (:state other-ha)
+                      _other-state (:state other-ha)
                       et (:entry-time ha)
-                      other-et (:entry-time other-ha)
+                      _other-et (:entry-time other-ha)
                       ex-other-ha (extrapolate other-ha et)
                       [v _f] (get-var-and-flow has other-ha (second k))
                       [exv f] (get-var-and-flow has ex-other-ha (second k))
                       ]
-                  #_(println "remote var and flow" k "from" (keys has) "in state" other-state "=" [v f]
-                             "extrapolated from" other-et "to" et "=" [exv f])
+                  #_(println "remote var and flow" k "from" (keys has) "in state" _other-state "=" [v f]
+                             "extrapolated from" _other-et "to" et "=" [exv f])
                   [exv f])
     :else (assert (or (nil? k) (keyword? k) (vector? k)) "Unrecognized variable lookup type")))

@@ -145,7 +213,7 @@
               :gt [(.max js/Math (+ rhs (/ time-unit 16)) min-t) Infinity]))))

 (defn transition-interval [has ha transition]
-  #_(println "Transition" (:id ha) (:x ha) (:target transition) (:guard transition))
+  #_(println "Transition" (:id ha) "et" (:entry-time ha) (:target transition) (:guard transition))
   (let [intervals (map #(simple-interval has ha %) (:guard transition))
         interval (intersect-all intervals)]
     #_(println "interval:" intervals "->" interval)
@@ -182,7 +250,7 @@
                                          ha
                                          Infinity
                                          (required-transitions ha)))
-        #_(println "New required transitions" (transition-intervals has
+        _ (println "New required transitions" (transition-intervals has
                                                                     ha
                                                                     Infinity
                                                                     (required-transitions ha)))
@@ -328,11 +396,11 @@
                        (assoc scene :now now
                                     :objects (follow-transitions has transitions)))
       :else (do #_(println "messy border overflow" (- now min-t))
-                (update-scene (assoc scene :now min-t
-                                           :objects (follow-transitions has transitions))
-                              now
-                              inputs
-                              (inc bailout)))
+              (update-scene (assoc scene :now min-t
+                                         :objects (follow-transitions has transitions))
+                            now
+                            inputs
+                            (inc bailout)))
       )))

 (defonce scene-a (atom {}))
@@ -399,11 +467,14 @@
 (defn make-scene-a [x] (let [ids #{:ga :gb :gc :gd}
                              walls #{[0 0 104 8]
                                      [0 8 8 16]
-                                     [96 8 8 16]}
+                                     [96 8 8 16]
+                                     ;todo: a "waterfall staircase" for goomba fall testing.
+                                     }
                              objects [(goomba :ga x 8 16 :right ids walls)
                                       (goomba :gb (+ x 18) 8 16 :left ids walls)
                                       (goomba :gc (+ x 38) 8 16 :right ids walls)
                                       (goomba :gd (+ x 58) 8 16 :left ids walls)
+                                      ; TODO: goomba falling off of platforms. add a "staircase" to the right.
                                       ; TODO: mario jumper
                                       ]
                              obj-ids (map :id objects)
@@ -472,6 +543,39 @@
            (fn [scene _owner]
              [(ha-dependencies (get-in @scene [:objects :a])) (ha-dependencies (get-in @scene [:objects :b]))])
            scene-a)
+
+(defcard interval-list-ops
+         (fn [data-atom _]
+           (let [{data :data good :good text :text} @data-atom]
+             (sab/html [:div
+                        [:input {:type      "text"
+                                 :style     {:background-color (if good "inherit" "red")
+                                             :width            "100%"}
+                                 :value     text
+                                 :on-change #(swap! data-atom (fn [d]
+                                                                (let [new-text (.-value (.-target %))
+                                                                      d (assoc d :text new-text)
+                                                                      new-data (try (reader/read-string new-text)
+                                                                                (catch :default _e nil))]
+                                                                  (if new-data
+                                                                    (assoc d :data new-data :good true)
+                                                                    (assoc d :good false)))))}]
+                        [:br]
+                        (when good
+                          [:div
+                           [:label (str "Intersections: " (map (fn [di]
+                                                                 (map (fn [dj]
+                                                                        (str di "," dj ":" (intersection di dj)))
+                                                                      data))
+                                                               data))]
+                           [:br]
+                           [:label (str "Intersect: " (intersect-all data))]
+                           [:br]
+                           [:label (str "Union: " (union-all data))]])])))
+         {:data [[0 1] [2 3]]
+          :text "[[0 1] [2 3]]"
+          :good true})
+

 (defcard ha-states-card
          (fn [scene _owner]


Implement make-board and add-random-cells functions

--- src/pot/core/bl.cljs
+++ src/pot/core/bl.cljs
@@ -1,6 +1,10 @@
 (ns pot.core.bl
   (:require-macros [cljs.core.match.macros :refer [match]])
   (:require [cljs.core.match]))
+
+(defn make-board
+  [height width]
+  (vec (repeat height (vec (repeat width nil)))))

 (defn find-empty
   [board]
@@ -24,6 +28,10 @@
     (if (seq empty-cells)
       (add-cell board (rand-nth empty-cells))
       board)))
+
+(defn add-random-cells
+  [n board]
+  (->> board (iterate add-random-cell) rest (take n) last))

 (defn process-pair
   [f s]


fixes

fixes

--- src/rester/core.clj
+++ src/rester/core.clj
@@ -163,7 +163,7 @@
     (if (:error test) test
         (let [resp (mk-request test)
               delta (verify-response resp test)
-              test (assoc test :time (:request-time resp))]
+              test (assoc test :time (/ (:request-time resp) 1000.0))]
           (if delta
             (assoc test :failure delta :resp resp)
             (do
@@ -176,24 +176,25 @@
         count-down (atom (count tests))
         test-agents (vec (map agent tests))
         exec-test (fn[test]
-                    (let [deps (map #(nth test-agents %) (:deps test))
-                          test (if (every? (comp :done deref) deps)
-                                 (assoc
-                                  (if (every? (comp :success deref) deps)
-                                    (try (exec-test-case test opts)
-                                         (catch Exception e
-                                           (log/error e "failed executing test")
-                                           (assoc test :error (str (or (.getMessage e) e)))))
-                                    (assoc test :skipped "dependents failed"))
-                                  :done true)
-                                 test)]
-                      (if (:done test)
-                        (swap! count-down dec))
-                      test))]
+                    (if (:done test) test
+                        (let [deps (map #(nth test-agents %) (:deps test))
+                              test (if (every? (comp :done deref) deps)
+                                     (assoc
+                                      (if (every? (comp :success deref) deps)
+                                        (try (exec-test-case test opts)
+                                             (catch Exception e
+                                               (log/error e "failed executing test")
+                                               (assoc test :error (str (or (.getMessage e) e)))))
+                                        (assoc test :skipped "dependents failed"))
+                                      :done true)
+                                     test)]
+                          (if (:done test)
+                            (swap! count-down dec))
+                          test)))]

     (add-watch count-down :key (fn [k r o n] (if (zero? n) (deliver p (map deref test-agents)))))
     (doseq [a test-agents i (:deps @a)]
-      (add-watch (nth test-agents i) :key (fn [k r o n] (send-off a exec-test))))
+      (add-watch (nth test-agents i) [(:id @a) i] (fn [k r o n] (send-off a exec-test))))
     (doseq [a test-agents]
       (send-off a exec-test))
     @p))


Setting default config back to derby.

Setting default config back to derby.

--- clj_record/test/model/config.clj
+++ clj_record/test/model/config.clj
@@ -1,10 +1,10 @@
 (ns clj-record.test.model.config)

-(comment
-  (def db {:classname "org.apache.derby.jdbc.EmbeddedDriver"
-	   :subprotocol "derby"
-	   :subname "/tmp/clj-record.test.db"
-	   :create true}))
+(comment)
+(def db {:classname "org.apache.derby.jdbc.EmbeddedDriver"
+	 :subprotocol "derby"
+	 :subname "/tmp/clj-record.test.db"
+	 :create true})

 (comment
   (def db {:classname "org.postgresql.Driver"
@@ -13,9 +13,9 @@
            :user "user"
            :password "pass"}))

-(comment)
-(def db {:classname "com.mysql.jdbc.Driver"
-	 :subprotocol "mysql"
-         :user "root"
-         :password "root"
-         :subname "//localhost/test"})+(comment
+  (def db {:classname "com.mysql.jdbc.Driver"
+	   :subprotocol "mysql"
+	   :user "root"
+	   :password "root"
+	   :subname "//localhost/test"}))


Removed debug print outs

Removed debug print outs

--- src/telldus/core.clj
+++ src/telldus/core.clj
@@ -50,12 +50,7 @@
 (defn send-cmd
   "Send command and return the response code or string depending on the format"
   [conn cmd-str]
-  (println "------------------------------")
-  (println "cmd:" cmd-str)
   (let [resp (send-request (:host conn) (:client-port conn) cmd-str)]
-
-    (println "resp:" resp)
-
     ;; i<num>s or "<len>:<string>"
     (if (.startsWith resp "i")
       (last (re-find #"i([0-9-]+)s" resp))


Replace the logo image with FireCloud sized similarly to the original logo.

--- src/cljs/org/broadinstitute/firecloud_ui/main.cljs
+++ src/cljs/org/broadinstitute/firecloud_ui/main.cljs
@@ -13,6 +13,10 @@

 (defn- logo []
   [:img {:src "assets/broad_logo.png" :style {:height 36}}])
+
+; Temporary replacement for the Broad Logo.
+(defn- text-logo []
+  [:div {:style {:fontSize "32px" :color (:button-blue style/colors) :fontWeight "bold"}} "FireCloud"])

 (defn- footer []
   (let [thisyear (.getFullYear (js/Date.))
@@ -93,7 +97,7 @@
                (utils/call-external-object-method :getBasicProfile)
                (utils/call-external-object-method :getName))]
           [:a {:href "javascript:;" :onClick (fn [e] (session/log-out))} "Log-Out"]]
-         (logo)
+         (text-logo)
          [:div {}
           [TopNavBar {:selected-item page
                       :on-nav (fn [item] (nav/navigate (:nav-context props) (name item)))}]]]
@@ -114,7 +118,7 @@
    (fn []
      [:div {}
       [:div {:style {:padding "50px 25px"}}
-       [:div {:style {:marginBottom "2em"}} (logo)]
+       [:div {:style {:marginBottom "2em"}} (text-logo)]
        [:div {:className "g-signin2" :data-onsuccess "onSignIn" :data-theme "dark"}]
        [:div {:style {:paddingTop "25px" :fontSize ".75em"}}
         [:p {:style {:fontWeight "bold"}} "Warning"]


allow chrome-ext outputs config in either config or manifest

--- src/main/shadow/build/targets/chrome_extension.clj
+++ src/main/shadow/build/targets/chrome_extension.clj
@@ -18,7 +18,7 @@

 (defn extract-outputs
-  [modules {:shadow/keys [outputs] :as manifest}]
+  [modules outputs]
   (reduce-kv
     (fn [modules mod-id {:keys [output-type] :as mod}]
       (assoc modules mod-id
@@ -45,7 +45,7 @@
     outputs))

 (defn configure
-  [state mode {:keys [extension-dir] :as config}]
+  [state mode {:keys [outputs extension-dir] :as config}]
   (let [extension-dir
         (io/file extension-dir)

@@ -59,6 +59,10 @@

         manifest-file
         (io/file extension-dir "manifest.json")
+
+        outputs
+        (or outputs
+            (:shadow/outputs manifest))

         modules
         (-> {:shared
@@ -67,7 +71,7 @@
              :bg-shared
              {:entries []
               :depends-on #{:shared}}}
-            (extract-outputs manifest))
+            (extract-outputs outputs))

         config
         (update config :devtools merge


improve leak-dc docs

improve leak-dc docs

--- src/overtone/sc/machinery/ugen/metadata/filter.clj
+++ src/overtone/sc/machinery/ugen/metadata/filter.clj
@@ -131,9 +131,20 @@

    {:name "LeakDC",
     :args [{:name "in", :default 0.0 :doc "input signal"}
-           {:name "coef", :default 0.995 :doc "leak coefficient. Good starting point values are to 0.995 for audiorate and  0.9 for controlrate"}]
-    :check (nth-input-stream? 0)
-    :doc "removes a DC offset from signal"
+           {:name "coef", :default 0.995
+            :doc "leak coefficient. A value of 1 indicates no leakage
+                 and 0 indicates high leakage - essentially the rate at
+                 which the offset will return back to 0"}]
+    :check (nth-input-stream? 0)
+    :doc "removes a DC offset from signal. For example, a square wave
+          contains prolonged sections of the cycle which are at +1 and
+          -1 (the top and bottom of the square sections). If you were to
+          pass this wave through leak-dc, then these top parts would
+          taper back towards 0 with a greater slope as you move coef
+          from 1 to 0..
+
+          Good starting point coef values are to 0.995 for audio rate and 0.9
+          for control rate"
     :auto-rate true}

    {:name "RLPF"


Ditto

Ditto

--- test/clojurewerkz/cassaforte/multi/stress_test.clj
+++ test/clojurewerkz/cassaforte/multi/stress_test.clj
@@ -1,9 +1,9 @@
 (ns clojurewerkz.cassaforte.multi.stress-test
   (:require [clojurewerkz.cassaforte.test-helper :as th]
-            [clojurewerkz.cassaforte.client :as client])
-  (:use clojurewerkz.cassaforte.multi.cql
-        clojure.test
-        clojurewerkz.cassaforte.query))
+            [clojurewerkz.cassaforte.client :as client]
+            [clojurewerkz.cassaforte.multi.cql :refer :all]
+            [clojure.test :refer :all]
+            [clojurewerkz.cassaforte.query :refer :all]))

 (use-fixtures :each th/initialize!)


Fix race condition in unit test

Fix race condition in unit test

Multithreading is tricky... :/

--- test/org/zalando/stups/friboo/system/cron_test.clj
+++ test/org/zalando/stups/friboo/system/cron_test.clj
@@ -10,9 +10,8 @@
 (deftest test-cron-component-lifecycle
   ;; Here we make sure that the component is started and stopped properly.
   (let [state (promise)
-        cron-component (map->TestCron {:state state})]
+        cron-component (component/start (map->TestCron {:state state}))]
+    (is (= 42 (deref state 500 :not-delivered)))
     (-> cron-component
-        component/start
         component/stop
-        component/stop) ; stopping twice shouldn't break anything
-    (is (= 42 (deref state 500 :not-delivered)))))
+        component/stop))) ; stopping twice shouldn't break anything


remove unused fn

remove unused fn

--- example/src/alias.clj
+++ example/src/alias.clj
@@ -1,12 +1,6 @@
 (ns alias
   (:require [clojure.java.io :as io]
             [joplin.repl :as repl]))
-
-(defn- url
-  ([m]
-   (url :urlf :url m))
-  ([skey tkey m]
-   (assoc m tkey (format (skey m) (:host m)))))

 (defn load-config [path]
   (-> (io/resource path)


adding loop and spliting tinymasq even further

--- examples/src/examples/fbc.clj
+++ examples/src/examples/fbc.clj
@@ -3,7 +3,6 @@
     [clojure.core.async :refer (<!! >!! <! >! chan go)]))

 (def fbc (chan 1))
-

 (go (>! fbc 1)
     (println "done"))


CMR-2416: Changing es spatial plugin to use direct linking and upgrading to Clojure 1.8

--- es-spatial-plugin/project.clj
+++ es-spatial-plugin/project.clj
@@ -16,7 +16,7 @@
 (defproject nasa-cmr/cmr-es-spatial-plugin "0.1.0-SNAPSHOT"
   :description "A Elastic Search plugin that enables spatial search entirely within elastic."
   :url "***REMOVED***projects/CMR/repos/cmr/browse/es-spatial-plugin"
-  :dependencies [[org.clojure/clojure "1.7.0"]
+  :dependencies [[org.clojure/clojure "1.8.0"]
                  [org.clojure/tools.logging "0.3.1"]
                  [org.elasticsearch/elasticsearch "1.6.2"]

@@ -52,7 +52,8 @@
          ;                      "-Dcom.sun.management.jmxremote.authenticate=false"
          ;                      "-Dcom.sun.management.jmxremote.port=1098"]
          :source-paths ["src" "dev"]}
-   :uberjar {:aot :all}}
+   :uberjar {:aot :all
+             :jvm-opts ["-Dclojure.compiler.direct-linking=true"]}}

   :aliases {;; Packages the spatial search plugin
             "package" ["do"


don't require any top-level stylesheet changes for om

--- frontend/core.cljs
+++ frontend/core.cljs
@@ -5,6 +5,7 @@
             [clojure.browser.repl :as repl]
             [clojure.string :as string]
             [dommy.core :as dommy]
+            [goog.dom]
             [goog.dom.DomHelper]
             [frontend.components.app :as app]
             [frontend.controllers.controls :as controls-con]
@@ -133,7 +134,7 @@

 (defn main [state top-level-node]
   (let [comms       (:comms @state)
-        target-name "app"
+        target-name "om-app"
         container   (sel1 top-level-node (str "#" target-name))
         uri-path    (.getPath utils/parsed-uri)
         history-path "/"
@@ -190,7 +191,14 @@
    #(when (= :build (:navigation-point @app-state))
       (put! controls-ch [:container-selected (get-in @app-state state/current-container-path)]))))

+(defn apply-app-id-hack
+  "Hack to make the top-level id of the app the same as the
+   current knockout app. Lets us use the same stylesheet."
+  []
+  (goog.dom.setProperties (sel1 "#app") #js {:id "om-app"}))
+
 (defn ^:export setup! []
+  (apply-app-id-hack)
   (let [state (app-state)]
     ;; globally define the state so that we can get to it for debugging
     (def debug-state state)


keep character on reload

keep character on reload

--- clojure/src/dnd/core.cljs
+++ clojure/src/dnd/core.cljs
@@ -26,7 +26,7 @@
   (.removeAllListeners term "key")
   (.removeAllListeners keyboard/emitter))

-(def character (atom character/base-character))
+(defonce character (atom character/base-character))

 (defonce level
   (let [{:keys [x y]} @character


Minor changes on figwheel script.

Minor changes on figwheel script.

--- scripts/figwheel.clj
+++ scripts/figwheel.clj
@@ -2,7 +2,9 @@
          '[figwheel-sidecar.repl-api :as ra])

 (ra/start-figwheel!
-  {:figwheel-options {:css-dirs ["resources/public/css"]}
+  {:figwheel-options {:css-dirs ["resources/public/css"]
+                      :server-port 3449
+                      :server-ip   "0.0.0.0"}
    :build-ids ["dev"]
    :all-builds
    [{:id "dev"


cleanup

cleanup

--- src/babel/parse.cljc
+++ src/babel/parse.cljc
@@ -185,8 +185,6 @@
                                                             right-strings)
                                       left-signs (vec (lazy-cat left-lexemes (filter map? left)))
                                       right-signs (vec (lazy-cat right-lexemes (filter map? right)))]
-                                  (println (str "left signs type:" (type left-signs)))
-                                  (println (str "right signs type:" (type right-signs)))
                                   (lazy-cat
                                    (if (and (not (empty? left-signs))
                                             (not (empty? right-signs)))


Remove platform dependent code from spec.clj

--- src/bytebuf/spec.clj
+++ src/bytebuf/spec.clj
@@ -180,17 +180,17 @@
   ([default]
    (reify
      IStaticSize
-     (size [_] (Short/BYTES))
-
-     ISpec
-     (read [_ buff pos]
-       [(Short/BYTES)
+     (size [_] 2)
+
+     ISpec
+     (read [s buff pos]
+       [(proto/size s)
         (buffer/read-short buff pos)])

-     (write [_ buff pos value]
+     (write [s buff pos value]
        (let [value (or value default)]
          (buffer/write-short buff pos value)
-         (Short/BYTES))))))
+         (proto/size s))))))

 (defn int32
   "Integer type spec constructor."
@@ -198,17 +198,17 @@
   ([default]
    (reify
      IStaticSize
-     (size [_] (Integer/BYTES))
-
-     ISpec
-     (read [_ buff pos]
-       [(Integer/BYTES)
+     (size [_] 4)
+
+     ISpec
+     (read [s buff pos]
+       [(proto/size s)
         (buffer/read-int buff pos)])

-     (write [_ buff pos value]
+     (write [s buff pos value]
        (let [value (or value default)]
          (buffer/write-int buff pos value)
-         (Integer/BYTES))))))
+         (proto/size s))))))

 (defn int64
   "Long type spec constructor."
@@ -216,53 +216,53 @@
   ([default]
    (reify
      IStaticSize
-     (size [_] (Long/BYTES))
-
-     ISpec
-     (read [_ buff pos]
-       [(Long/BYTES)
+     (size [_] 8)
+
+     ISpec
+     (read [s buff pos]
+       [(proto/size s)
         (buffer/read-long buff pos)])

-     (write [_ buff pos value]
+     (write [s buff pos value]
        (let [value (or value default)]
          (buffer/write-long buff pos value)
-         (Long/BYTES))))))
-
-(defn real32
+         (proto/size s))))))
+
+(defn float
   "Float type spec constructor."
-  ([] (real32 0))
-  ([default]
-   (reify
-     IStaticSize
-     (size [_] (Float/BYTES))
-
-     ISpec
-     (read [_ buff pos]
-       [(Float/BYTES)
+  ([] (float 0))
+  ([default]
+   (reify
+     IStaticSize
+     (size [_] 4)
+
+     ISpec
+     (read [s buff pos]
+       [(proto/size s)
         (buffer/read-float buff pos)])

-     (write [_ buff pos value]
+     (write [s buff pos value]
        (let [value (or value default)]
          (buffer/write-float buff pos value)
-         (Float/BYTES))))))
-
-(defn real64
+         (proto/size s))))))
+
+(defn double
   "Double type spec constructor."
-  ([] (real64 0))
-  ([default]
-   (reify
-     IStaticSize
-     (size [_] (Double/BYTES))
-
-     ISpec
-     (read [_ buff pos]
-       [(Double/BYTES)
+  ([] (double 0))
+  ([default]
+   (reify
+     IStaticSize
+     (size [_] 8)
+
+     ISpec
+     (read [s buff pos]
+       [(proto/size s)
         (buffer/read-double buff pos)])

-     (write [_ buff pos value]
+     (write [s buff pos value]
        (let [value (or value default)]
          (buffer/write-double buff pos value)
-         (Double/BYTES))))))
+         (proto/size s))))))

 (defn bytes
   "Fixed size byte array type spec constructor."


Add Neu im Sortiment fop output for debugging

--- src/catalog/core.clj
+++ src/catalog/core.clj
@@ -15,6 +15,12 @@
    vubis/order-and-group
    (layout.fop/document :all-formats nil nil)
    (layout.fop/generate-pdf! out)))
+
+(defn neu-im-sortiment-fop [in out]
+  (-> in
+   vubis/read-file
+   vubis/order-and-group
+   (layout.fop/generate-document :all-formats nil nil out)))

 (defn neu-in-grossdruck [in out editorial recommendations]
   (-> in


create-commit now updates HEAD as required!

--- src/clj_git/core.clj
+++ src/clj_git/core.clj
@@ -24,8 +24,6 @@

 ; Creates a new commit object (and all required tree objects)
 ; from the current index
-; TODO: Update the HEAD and branch after creating objects!
-;	(Do we need to update the index at all?)
 (defn create-commit
   ( [message]
     (create-commit message (head)))
@@ -39,4 +37,6 @@
                     "\n"
                     message "\n")]
       (doseq [e tree-structs] (write-tree (:contents e)))
-      (write-commit text))))
+      (let [new-commit-hash (write-commit text)]
+        (move-branch (head-name) new-commit-hash)
+        new-commit-hash))))


Fix bug introduced by bbdf662cfa4d9c32e49ba265009b74928828ba2d

--- src/degasolv/cli.clj
+++ src/degasolv/cli.clj
@@ -104,10 +104,13 @@
                    (string-to-requirement vetted-str-req)))
                requirements))
        present-packages
-       (reduce
-        #(update-in %1 [(:id %2)]
+       (t/spy :msg "present-packages"
+              (reduce
+               (fn package-aggregate
+                 [c [name pkg]]
+                 (update-in c [name]
                     conj
-                    %2)
+                    pkg))
         {}
         (map
          (fn [str-pkg]
@@ -128,7 +131,7 @@
                  version
                  "already present"
                  nil)])))
-         (:present-packages options)))
+         (:present-packages options))))
        aggregate-repo
        (aggregate-repositories
          index-strat


Collisions working properly

Collisions working properly

--- src/physim/core.cljs
+++ src/physim/core.cljs
@@ -1,36 +1,47 @@
 (ns physim.core
   (:require [THREE :as THREE]))

-(def particle-count 30)
+(def particle-count 10)
 (def gravity-multiplier 100)
-(def velocity-limit 10)
+(def speed-limit 5)
+(def initial-speed 0)
+
+(def scene-width window/innerWidth)
+(def scene-height window/innerHeight)

 (def particles (atom []))
 (def particle-meshes (atom []))
+(def collided-particles (atom {}))

 (defn rand-x
   []
-  (- (rand-int window/innerWidth)
-     (/ window/innerWidth 2)))
+  (- (rand-int scene-width)
+     (/ scene-width 2)))

 (defn rand-y
   []
-  (- (rand-int window/innerHeight)
-     (/ window/innerHeight 2)))
+  (- (rand-int scene-height)
+     (/ scene-height 2)))

 (defn generate-particles
   [n]
   (for [i (range n)]
     { :pos [(rand-x) (rand-y) (rand-y)]
-      :vel [(/ (* 0 (rand-x)) window/innerWidth)
-            (/ (* 0 (rand-y)) window/innerWidth)
-            (/ (* 0 (rand-y)) window/innerWidth)] }))
+      :vel [(/ (* initial-speed (rand-x)) scene-width)
+            (/ (* initial-speed (rand-y)) scene-width)
+            (/ (* initial-speed (rand-y)) scene-width)] }))

 (defn set-position!
   [mesh [x y z]]
   (set! (.-x (.-position mesh)) x)
   (set! (.-y (.-position mesh)) y)
   (set! (.-z (.-position mesh)) z))
+
+(defn rotate-angles!
+  [mesh [x y z]]
+  (set! (.-x (.-rotation mesh)) (+ (.-x (.-rotation mesh)) x))
+  (set! (.-y (.-rotation mesh)) (+ (.-y (.-rotation mesh)) y))
+  (set! (.-z (.-rotation mesh)) (+ (.-z (.-rotation mesh)) z)))

 (defn mesh-from-particle
   [p]
@@ -48,14 +59,14 @@
 (defn make-renderer!
   [meshes]
   (let [camera (THREE.PerspectiveCamera.
-                50 (/ window/innerWidth
-                      window/innerHeight) 1 10000)
+                50 (/ scene-width
+                      scene-height) 1 10000)
         scene (THREE.Scene.)
         renderer (THREE.CanvasRenderer.)]
     (set! (.-z (.-position camera)) 1000)
     (doseq [m meshes]
       (.add scene m))
-    (.setSize renderer window/innerWidth window/innerHeight)
+    (.setSize renderer scene-width scene-height)
     (.appendChild (.-body js/document) (.-domElement renderer))

     (fn []
@@ -83,8 +94,8 @@
   (let [a (calc-accel p all)
         v (map + v a)
         magv (magnitude v)
-        v (if (> magv velocity-limit)
-            (map #(* (/ % magv) vel-limit) v)
+        v (if (> magv speed-limit)
+            (map #(* (/ % magv) speed-limit) v)
             v)
         p (map + p v)]
     [p v a]))
@@ -100,13 +111,14 @@
             b (range n)]
       (let [pa (nth @particles a)
             pb (nth @particles b)
-            v (map + (:vel pa) (:vel pb))
-            pa {:pos (:pos pa) :vel v}
-            pb {:pos (:pos pb) :vel v}]
+            abdir (map - (:pos pa) (:pos pb))
+            dist (magnitude abdir)
+            abdir (map #(/ % dist) abdir)
+            bounce (map #(* % (- 20 dist)) abdir)]
         (when (and (not= a b) (collided? (:pos pa) (:pos pb)))
           (do
-            (reset! particles (assoc @particles a pa))
-            (reset! particles (assoc @particles b pb))))))))
+            (reset! particles (assoc @particles a (assoc pa :pos (map + (:pos pa) bounce) :vel (map + (:vel pa) (map #(* % (magnitude (:vel pa))) abdir)))))
+            (reset! particles (assoc @particles b (assoc pb :pos (map - (:pos pb) bounce) :vel (map - (:vel pb) (map #(* % (magnitude (:vel pb))) abdir)))))))))))

 (defn motion-tick!
   []
@@ -121,11 +133,13 @@
 (defn render
   []
   (motion-tick!)
-  ;(handle-collisions!)
+  (handle-collisions!)

   (doseq [i (range (count @particles))]
     (let [p (nth @particles i)
           m (nth @particle-meshes i)]
+      ;; static rotation for blinginess
+      (rotate-angles! m [0 2 0])
       (set-position! m (:pos p))))

   (render-scene))


Print stack trace on polling error

Print stack trace on polling error

--- src/polismath/db.clj
+++ src/polismath/db.clj
@@ -71,6 +71,7 @@
         (ko/order [:zid :tid :pid :created] :asc))) ; ordering by tid is important, since we rely on this ordering to determine the index within the comps, which needs to correspond to the tid
     (catch Exception e
       (log/error "polling failed " (.getMessage e))
+      (.printStackTrace e)
       [])))


Riemann.pool: correct exception logging.

--- src/riemann/pool.clj
+++ src/riemann/pool.clj
@@ -50,7 +50,7 @@
               (when thingy
                 (try (close thingy)
                   (catch Throwable t
-                    (warn "Closing" thingy "threw" t)))
+                    (warn t "Closing" thingy "threw")))
                 (future (grow this)))))

 (defn fixed-pool


specify vcs tag prefix for template project

--- template/project.clj
+++ template/project.clj
@@ -6,4 +6,13 @@
             :url "http://opensource.org/licenses/ISC"
             :distribution :repo}

-  :eval-in-leiningen true)
+  :eval-in-leiningen true
+
+  :release-tasks [["vcs" "assert-committed"]
+                  ["change" "version" "leiningen.release/bump-version" "release"]
+                  ["vcs" "commit"]
+                  ["vcs" "tag" "template-"]
+                  ["deploy"]
+                  ["change" "version" "leiningen.release/bump-version"]
+                  ["vcs" "commit"]
+                  ["vcs" "push"]])


fix version of cheshire

fix version of cheshire

--- prs/project.clj
+++ prs/project.clj
@@ -27,6 +27,7 @@
   :dependencies
   [[org.clojure/clojure]
    [org.clojure/tools.nrepl]
+   [cheshire] ;; newer version needed
    [com.sixsq.slipstream/SlipStreamPlacementLib-jar]
    [com.sixsq.slipstream/token]
    [compojure]


clean

clean


Add periods to warning messages

Add periods to warning messages

--- src/braid/client/register/views.cljs
+++ src/braid/client/register/views.cljs
@@ -232,15 +232,15 @@
                     :url (string/blank? (@fields :url))
                     :type (string/blank? (@fields :type))}
             validations {:name [{:valid? (not (blank? :name))
-                                 :message "Your group needs a name"}]
+                                 :message "Your group needs a name."}]
                          :url [{:valid? (not (blank? :url))
-                                :message "Your group needs a URL"}
+                                :message "Your group needs a URL."}
                                {:valid? (boolean (re-matches #"[a-z0-9-]*" (@fields :url)))
-                                :message "Your URL can only contain lowercase letters, numbers or dashes"}
+                                :message "Your URL can only contain lowercase letters, numbers or dashes."}
                                {:valid? (not (re-matches #"-.*" (@fields :url)))
-                                :message "Your URL can't start with a -"}
+                                :message "Your URL can't start with a dash."}
                                {:valid? (not (re-matches #".*-" (@fields :url)))
-                                :message "Your URL can't end with a -"}]
+                                :message "Your URL can't end with a dash."}]
                          :type [{:valid? (not (blank? :type))
                                  :message "You need to select a group type"}]}
             valid? (fn [field]


Add temp service back into server.clj

Add temp service back into server.clj

--- src/clj/org/openforis/ceo/server.clj
+++ src/clj/org/openforis/ceo/server.clj
@@ -1,9 +1,36 @@
 (ns org.openforis.ceo.server
   (:require [clojure.java.io :as io]
+            [clojure.string :as str]
+            [ring.adapter.jetty :refer [run-jetty]]
             [org.openforis.ceo.handler :refer [development-app production-app]]
-            [ring.adapter.jetty :refer [run-jetty]]))
+            [org.openforis.ceo.logging :refer [log-str]]))

-(defonce server (atom nil))
+(defonce server           (atom nil))
+(defonce clean-up-service (atom nil))
+
+(def expires-in "1 hour in msecs" (* 1000 60 60))
+
+(defn- expired? [last-mod-time]
+  (> (- (System/currentTimeMillis) last-mod-time) expires-in))
+
+(defn- delete-tmp []
+  (log-str "Removing temp files.")
+  (let [tmp-dir (System/getProperty "java.io.tmpdir")
+        dirs    (filter #(and (.isDirectory %)
+                              (str/includes? % "ceo-tmp")
+                              (expired? (.lastModified %)))
+                        (.listFiles (io/file tmp-dir)))]
+    (doseq [d    dirs
+            file (reverse (file-seq d))]
+      (io/delete-file file))))
+
+(defn- start-clean-up-service! []
+  (log-str "Starting temp file removal service.")
+  (future
+    (while true
+      (Thread/sleep expires-in)
+      (try (delete-tmp)
+           (catch Exception _)))))

 (defn start-server! [& [port mode]]
   (let [mode     (or mode "prod")
@@ -26,9 +53,13 @@
                      :key-password  "foobar"}))]
     (if (and (not has-key?) (= mode "prod"))
       (println "ERROR: there is no SSL key for enabling HTTPS! Create a SSL key for HTTPS or run with the \"dev\" option.")
-      (reset! server (run-jetty handler config)))))
+      (do (reset! server (run-jetty handler config))
+          (reset! clean-up-service (start-clean-up-service!))))))

 (defn stop-server! []
+  (when @clean-up-service
+    (future-cancel @clean-up-service)
+    (reset! clean-up-service nil))
   (when @server
     (.stop @server)
     (reset! server nil)))


fix phone query reaction

fix phone query reaction

--- src/cljs/phonecat_re_frame/core.cljs
+++ src/cljs/phonecat_re_frame/core.cljs
@@ -37,12 +37,10 @@
 (re-frame/register-handler
 =======
 (re-frame/register-subs
-:phone-query
-(fn [db [_ phone-id]]
-  (let [phone-details-reaction (reaction (:phone-details @db))]
-    (reaction ((fn []
-                 ((keyword phone-id) @phone-details-reaction)))))))
-
+ :phone-query
+ (fn [db [_ phone-id]]
+   (let [phone-details-reaction (reaction (:phone-details @db))]
+     (reaction ((keyword phone-id) @phone-details-reaction)))))

 (re-frame/register-pure-handler
 >>>>>>> dff3fe5... add back handlers for loading individual phone data


temporary fix for #34, since batched changes are not handled correctly


export to Postman

export to Postman

--- src/rester/core.clj
+++ src/rester/core.clj
@@ -18,7 +18,8 @@
             [dk.ative.docjure.spreadsheet
              :refer
              [load-workbook read-cell row-seq select-sheet sheet-seq]]
-            [json-path :refer [at-path]])
+            [json-path :refer [at-path]]
+            [clojure.set :as set])
   (:import [clojure.data.xml CData Element]
            clojure.lang.ExceptionInfo
            java.lang.Integer
@@ -268,8 +269,8 @@
             (assoc test :error (str (or (.getMessage e) e))))))))

 (defn exec-tests [tests opts]
-  (let [opts (atom opts)
-        skip-tag (:skip opts)
+  (let [skip-tag (opts "skip")
+        opts (atom opts)
         name-to-test (into {} (for [t tests] [(:test t) t]))
         test-agents (vec (map agent tests))
         exec-test (fn [test]
@@ -279,7 +280,7 @@
                           (if (every? (comp :done deref) deps)
                             (assoc
                              (cond
-                               (and skip-tag (= skip-tag skip)) (assoc test :skipped "skip requested")
+                               (and skip-tag (= skip-tag skip)) (assoc test :ignored "skip requested")
                                (true? ignore) (assoc test :ignored "ignored")
                                (every? (comp :success deref) deps)
                                (try
@@ -312,6 +313,12 @@
         (send-off a exec-test))
       @p)
     (map deref test-agents)))
+
+(defn suites [tests]
+  (reduce (fn [suites test]
+            (if (str/blank? (:suite test))
+              (update suites (dec (count suites)) update :tests conj test)
+              (conj suites {:name (:suite test) :tests [test]})))  [] tests))

 (defn summarise-results [tests]
   (let [result-keys {:error 0 :failure 0 :success 0 :skipped 0 :ignored 0 :total 0}
@@ -367,6 +374,29 @@
                         nil)])])])
               out))))

+(defn tests->postman [name tests opts]
+  (let [all-placeholders (into #{} (reduce #(concat %1 (:placeholders %2)) [] tests))
+        all-extractions (into #{} (reduce #(concat %1 (:extractions %2)) [] tests))
+        all-suites (suites tests)]
+    {:info {:name name :schema "https://schema.getpostman.com/json/collection/v2.0.0/collection.json"}
+     :variables (for [v (set/difference all-placeholders all-extractions)] {:id v :name v})
+     :item (for [{:keys [name tests]} suites]
+             {:name name
+              :item (for [t tests]
+                      {:name (:test t)
+                       :request {:url (:url t)
+                                 :method (:verb t)
+                                 :header (for [[k v] (str->map (:headers t) #":" {} false)]
+                                           {:key k :value v})
+                                 :body (:payload t)}
+                       :event (conj (for [[name path] (:extractions t)]
+                                      {:list "test"
+                                       :script (format "var resp=JSON.parse(responseBody);
+postman.setEnvironmentVariable(\"%s\", %s);
+" name (jsonpath->js path))})
+                                    {:listen "test"
+                                     :script (format "tests[\"Status code is %1$s\"] = responseCode.code === %1$s;" (:exp-status t))})})})}))
+
 (defn- to-opts [args]
   (apply hash-map (map-indexed #(if (even? %1) (subs %2 1) %2) args)))


Improve consistency in sequence function implementation.

Now return vectors as it says in the docstring.

--- src/cats/core.cljc
+++ src/cats/core.cljc
@@ -289,11 +289,11 @@
   (let [ctx (get-current-context (first mvs))]
     (with-monad ctx
       (reduce (fn [mvs mv]
-                 (mlet [v mv
-                        vs mvs]
-                       (return (cons v vs))))
-              (return '())
-              (reverse mvs)))))
+                (mlet [v mv
+                       vs mvs]
+                  (return (conj vs v))))
+              (return [])
+              mvs))))

 (defn mapseq
    "Given a function that takes a value and puts it into a


working array printing

working array printing

--- src/tic-tac-toe.clj
+++ src/tic-tac-toe.clj
@@ -8,7 +8,8 @@
 ;; 3 get player input: where to put its char
 ;; 4 check if player win

-(def array [[nil nil nil] [nil nil nil] [nil nil nil]])   ; todo - how to auto generate it
+(def array [[nil nil nil] [nil nil nil] [nil nil nil]])
+; todo - how to auto generate it
 ;; (clojure.pprint/pprint arry)

 (def arry (make-array Integer/TYPE 3 3))
@@ -31,7 +32,12 @@
 (defn join-row [row]
   (join "|" (map #(if (nil? %) " " %) row)))

-(defn print-tabl [table]
-  (map #(join "-----\n" (join-row %)) table))
+(join-row [nil 'o 'x])

-(print (print-tabl array))+(defn print-array [array]
+  (print (join "\n-----\n" (map join-row array)))
+  (println))
+
+(print-array array)
+
+(print-tabl array)


Fix typo

Fix typo

A wether is a castrated ram. :-)

--- src/leiningen/new/devcards/core.cljs
+++ src/leiningen/new/devcards/core.cljs
@@ -12,7 +12,7 @@
              [:h1 "This is your first devcard!"]]))

 (defn main []
-  ;; conditionally start the app based on wether the #main-app-area
+  ;; conditionally start the app based on whether the #main-app-area
   ;; node is on the page
   (if-let [node (.getElementById js/document "main-app-area")]
     (js/React.render (sab/html [:div "This is working"]) node)))


Small text edit

Small text edit

--- src/leiningen/new/devcards/core.cljs
+++ src/leiningen/new/devcards/core.cljs
@@ -17,9 +17,9 @@

 (defcard {{name}}-intro-card
   (dc/markdown-card
-   "# Hey there"
+   "# This is the first card for **{{ name }}**"
    "I can be found in `src/{{name}}/core.cljs`"
    "If you add cards to this file, they will appear here on this page."))

-(println "If you change this line you will see the result in the browsers console.")
+(println "If you change this line, you will see the result in the browser's console.")


Add error logging macro.

Add error logging macro.

Also, figure a way to macro-ize the debug, info and error macros themselves.

--- src/main/clojure/cascade/logging.clj
+++ src/main/clojure/cascade/logging.clj
@@ -19,21 +19,22 @@
 (defn #^Logger get-logger [#^String name]
   (LoggerFactory/getLogger name))

-; My Macro-Fu is inadequate to avoid cut-and-paste here. Also the Logger interface makes it hard
-; (there's no log-at-level method, so you have to invoke specific methods) and the . special form
-; doesn't support dynamically calling a method, etc., etc.
-
-(defmacro debug
-  [format & args]
+(defmacro log*
+	[check-fn log-fn fmt & args]
   (let [logger-name (name (ns-name *ns*))]
     `(let [logger# (get-logger ~logger-name)]
-      (and (.isDebugEnabled logger#)
-        (.debug logger# (format ~format ~@args))))))
-
+      (and
+        (. logger# ~check-fn)
+        (. logger# ~log-fn (format ~fmt ~@args))))))
+
+(defmacro debug
+  [fmt & args]
+  `(log* isDebugEnabled debug ~fmt ~@args))
+
 (defmacro info
-  [format & args]
-  (let [logger-name (name (ns-name *ns*))]
-    `(let [logger# (get-logger ~logger-name)]
-      (and (.isInfoEnabled logger#)
-        (.info logger# (format ~format ~@args))))))
-
+	[fmt & args]
+	`(log* isInfoEnabled info ~fmt ~@args))
+
+(defmacro error
+	[fmt & args]
+	`(log* isErrorEnabled error ~fmt ~@args))


pre/altcrawl.clj: renamed handle-pdf to pdf-docid-dispatch

--- src/org/altlaw/jobs/pre/altcrawl.clj
+++ src/org/altlaw/jobs/pre/altcrawl.clj
@@ -41,7 +41,7 @@
 ;; mime-type-dispatch----------------------
 ;;  |                   |                 |
 ;;  |                   |                 |
-;; handle-html         handle-pdf        warn
+;; handle-html         pdf-docid-dispatch        warn
 ;;  |       |           |      |
 ;;  |      warn         |     warn
 ;;  |                   |
@@ -105,12 +105,12 @@

 ;;; Step 3 (for PDFs): dispatch on presence of Docid

-(defn handle-pdf [download]
+(defn pdf-docid-dispatch [download]
   (if-let [docid (ids/get-docid "altcrawl" (:request_uri download))]
-    (do (debug "handle-pdf got docid " docid " for " (:request_uri download))
+    (do (debug "pdf-docid-dispatch got docid " docid " for " (:request_uri download))
         (h/counter "PDF files" "with docid")
         (convert-pdf docid download))
-    (do (warn "handle-pdf found no docid for " (:request_uri download))
+    (do (warn "pdf-docid-dispatch found no docid for " (:request_uri download))
         (h/counter "PDF files" "no docid")
         nil)))

@@ -124,7 +124,7 @@
 (defmethod mime-type-dispatch "application/pdf" [download]
   (h/counter "MIME types" "PDF")
   (debug "mime-type-dispatch got PDF from " (:request_uri download))
-  (handle-pdf download))
+  (pdf-docid-dispatch download))

 (defmethod mime-type-dispatch "text/html" [download]
   (h/counter "MIME types" "HTML")


Removes unused let-binding match-value.

Removes unused let-binding match-value.

--- src/active/clojure/match.clj
+++ src/active/clojure/match.clj
@@ -465,31 +465,27 @@
               `(path-exists-with-binding-clause ~path ~b)))

           :key-matches-without-binding
-          (let [k           (make-key (:key body))
-                match-value (match-value->matcher (:match-value body))]
+          (let [k (make-key (:key body))]
             (if (optional? mode)
               `(make-optional-clause (key-matches-without-binding-clause ~k (match-value->matcher ~(:match-value body))))
               `(key-matches-without-binding-clause ~k (match-value->matcher ~(:match-value body)))))

           :key-matches-with-binding
-          (let [k           (make-key (:key body))
-                b           (make-binding (:binding body))
-                match-value (match-value->matcher (:match-value body))]
+          (let [k (make-key (:key body))
+                b (make-binding (:binding body))]
             (if (optional? mode)
               `(make-optional-clause (key-matches-with-binding-clause ~k (match-value->matcher ~(:match-value body)) ~b))
               `(key-matches-with-binding-clause ~k (match-value->matcher ~(:match-value body)) ~b)))

           :path-matches-without-binding
-          (let [path        (mapv make-key (:path body))
-                match-value (match-value->matcher (:match-value body))]
+          (let [path (mapv make-key (:path body))]
             (if (optional? mode)
               `(make-optional-clause (path-matches-without-binding-clause ~path (match-value->matcher ~(:match-value body))))
               `(path-matches-without-binding-clause ~path (match-value->matcher ~(:match-value body)))))

           :path-matches-with-binding
-          (let [path        (mapv make-key (:path body))
-                b           (make-binding (:binding body))
-                match-value (match-value->matcher (:match-value body))]
+          (let [path (mapv make-key (:path body))
+                b    (make-binding (:binding body))]
             (if (optional? mode)
               `(make-optional-clause (path-matches-with-binding-clause ~path (match-value->matcher ~(:match-value body)) ~b))
               `(path-matches-with-binding-clause ~path (match-value->matcher ~(:match-value body)) ~b))))))))


Don't time out reads from OLA daemon.

Don't time out reads from OLA daemon.

These can take a long time if there is nothing to report!

--- src/afterglow/ola_client.clj
+++ src/afterglow/ola_client.clj
@@ -37,12 +37,11 @@

 (def ^:private
   socket-timeout
-  "How many milliseconds to wait for socket operations (both open and
-  read/write) to complete. The default is two seconds, which is
-  ridiculously long since Afterglow is designed to work with the OLA
-  server on a local socket. But this was added in order to support
-  Windows use where OLA cannot run locally. Hopefully this will be
-  more than long enough."
+  "How many milliseconds to wait when trying to open the socket to the
+  OLA daemon. The default is two seconds, which is ridiculously long
+  since Afterglow is designed to work with the OLA server on a local
+  socket. But this was added in order to support Windows use where OLA
+  cannot run locally. Hopefully this will be more than long enough."
   2000)

 (def ^:private
@@ -100,7 +99,6 @@
     (let [addr (InetSocketAddress. @olad-host @olad-port)
           sock (Socket.)]
       (.connect sock addr socket-timeout)
-      (.setSoTimeout sock socket-timeout)
       (try
         (let [in (io/input-stream sock)
               out (io/output-stream sock)]


Comment out unavailable binary op ugen

Comment out unavailable binary op ugen

--- src/overtone/sc/ugen/special_ops.clj
+++ src/overtone/sc/ugen/special_ops.clj
@@ -64,7 +64,7 @@
    "+" 0
    "-" 1
    "*" 2
-   "div" 3         ; integer division
+   ;;"div" 3      ; Defined in BinaryOpUGens.cpp enum but not implemented on the server
    "/" 4
    "mod" 5
    "=" 6


Alert aborting instead of print

Alert aborting instead of print

--- src/aurora/runtime/core.cljs
+++ src/aurora/runtime/core.cljs
@@ -58,7 +58,7 @@
         (cond
          (>= i 10) (do
                      (js/console.timeEnd "quiescience")
-                     (println "Aborting!")
+                     (js/alert "Aborting!")
                      (aurora.runtime.ui/on-bloom-tick cur (:feeder-fn env))
                      cur)
          (language/unchanged? prev cur) (do