fix variable name typo in junction

fix variable name typo in junction

--- src/clj/lambdacd/steps/control_flow.clj
+++ src/clj/lambdacd/steps/control_flow.clj
@@ -102,13 +102,13 @@
         child-step-id  (step-id/child-id parent-step-id child-number)]
     (assoc parent-ctx :step-id child-step-id)))

-(defn ^{:display-type :parallel} junction [condition-step success-step failiure-step]
+(defn ^{:display-type :parallel} junction [condition-step success-step failure-step]
   (fn [args ctx]
     (post-process-container-results
       (let [condition-step-result (core/execute-step args (child-context ctx 1) condition-step)]
         (if (= :success (:status condition-step-result))
           (core/execute-step args (child-context ctx 2) success-step)
-          (core/execute-step args (child-context ctx 3) failiure-step))))))
+          (core/execute-step args (child-context ctx 3) failure-step))))))

 (defn alias
   "just runs child but child is displayed with the given alias in visualization"


Use property accessors to get JS properties

--- src/cljs/cglossa/search_inputs/cwb.cljs
+++ src/cljs/cglossa/search_inputs/cwb.cljs
@@ -68,7 +68,7 @@

 (defn- on-phonetic-changed [event query-cursor]
   (let [q        (:query @query-cursor)
-        checked? (aget event "target" "checked")
+        checked? (.-target.checked event)
         query    (if checked?
                    (if (str/blank? q)
                      "[phon=\".*\" %c]"
@@ -77,10 +77,10 @@
     (swap! query-cursor assoc :query query)))

 (defn- on-headword-search-changed [event query-cursor]
-  (swap! query-cursor assoc :headword-search (aget event "target" "checked")))
+  (swap! query-cursor assoc :headword-search (.-target.checked event)))

 (defn- on-key-down [event query-cursor]
-  (when (= "Enter" (aget event "key"))
+  (when (= "Enter" (.-key event))
     (.preventDefault event)
     (search! query-cursor)))

@@ -161,7 +161,7 @@
                             (str/replace #"\s*\[\]\s*" " .* ")
                             (str/replace #"^\.\*$" ""))
         on-text-changed (fn [event query-cursor phonetic?]
-                          (let [value (aget event "target" "value")
+                          (let [value (.-target.value event)
                                 query (if (= value "") "" (phrase->cqp value phonetic?))]
                             (swap! query-cursor assoc :query query)))]
     [single-input-view corpus query-cursor displayed-query show-remove-btn?
@@ -175,7 +175,7 @@
   [corpus query-cursor show-remove-btn? remove-query-handler]
   (let [displayed-query (:query @query-cursor)
         on-text-changed (fn [event query-cursor _]
-                          (let [value      (aget event "target" "value")
+                          (let [value      (.-target.value event)
                                 query      (->non-headword-query value)
                                 hw-search? (= (->headword-query query) value)]
                             (swap! query-cursor assoc :query query :headword-search hw-search?)))]


fix contact/tuition form

fix contact/tuition form

--- src/cljs/daveconservatoire/site/ui.cljs
+++ src/cljs/daveconservatoire/site/ui.cljs
@@ -593,21 +593,20 @@
                 (dom/p nil "If you might find this useful, please complete the contact form and we can arrange a free consultation lesson to discuss your requirements."))
               (dom/div #js {:className "span6"}
                 (dom/div #js {:className "form"}
-                  (dom/form #js {:id "contact-form" :action "/tuition" :method "post"}
+                  (dom/form #js {:id "contact-form" :action "https://formspree.io/dave@daveconservatoire.org" :method "post"}
                     (dom/p #js {:className "note"} "Fields marked (*) are required.")
                     (dom/div #js {:className "control-group"}
                       (dom/label #js {:htmlFor "ContactForm_name" :className "required"} "Name*")
-                      (dom/input #js {:name "ContactForm[name]" :id "ContactForm_name" :type "text"})
+                      (dom/input #js {:name "name" :id "ContactForm_name" :type "text"})
                       (dom/div #js {:className "errorMessage" :id "ContactForm_name_em_"}))
                     (dom/div #js {:className "control-group"}
                       (dom/label #js {:htmlFor "ContactForm_email" :className "required"} "Email*")
-                      (dom/input #js {:name "ContactForm[email]" :id "ContactForm_email" :type "text"})
+                      (dom/input #js {:name "_replyto" :id "ContactForm_email" :type "text"})
                       (dom/div #js {:className "errorMessage" :id "ContactForm_email_em_"}))
                     (dom/div #js {:className "control-group"}
                       (dom/label #js {:htmlFor "ContactForm_body" :className "required"} "Message*")
-                      (dom/textarea #js {:name "ContactForm[body]" :id "ContactForm_body" :type "text"})
+                      (dom/textarea #js {:name "message" :id "ContactForm_body" :type "text"})
                       (dom/div #js {:className "errorMessage" :id "ContactForm_body_em_"}))
-                    (dom/div #js {:className "g-recaptcha" :data-sitekey "6LeLxhkTAAAAAPRgeOsY44L4N27hvPhRjKFM4BP4"})
                     (dom/div #js {:className "form-actions"}
                       (dom/button #js {:type "submit" :className "btn btn-primary"} "Submit")
                       (dom/button #js {:type "reset" :className "btn"} "Reset"))))))))))))
@@ -626,21 +625,20 @@
             (dom/div #js {:className "row"}
               (dom/div #js {:className "span6"}
                 (dom/div #js {:className "form"}
-                  (dom/form #js {:id "contact-form" :action "/tuition" :method "post"}
+                  (dom/form #js {:id "contact-form" :action "https://formspree.io/dave@daveconservatoire.org" :method "post"}
                     (dom/p #js {:className "note"} "Fields marked (*) are required.")
                     (dom/div #js {:className "control-group"}
                       (dom/label #js {:htmlFor "ContactForm_name" :className "required"} "Name*")
-                      (dom/input #js {:name "ContactForm[name]" :id "ContactForm_name" :type "text"})
+                      (dom/input #js {:name "name" :id "ContactForm_name" :type "text"})
                       (dom/div #js {:className "errorMessage" :id "ContactForm_name_em_"}))
                     (dom/div #js {:className "control-group"}
                       (dom/label #js {:htmlFor "ContactForm_email" :className "required"} "Email*")
-                      (dom/input #js {:name "ContactForm[email]" :id "ContactForm_email" :type "text"})
+                      (dom/input #js {:name "_replyto" :id "ContactForm_email" :type "text"})
                       (dom/div #js {:className "errorMessage" :id "ContactForm_email_em_"}))
                     (dom/div #js {:className "control-group"}
                       (dom/label #js {:htmlFor "ContactForm_body" :className "required"} "Message*")
-                      (dom/textarea #js {:name "ContactForm[body]" :id "ContactForm_body" :type "text"})
+                      (dom/textarea #js {:name "message" :id "ContactForm_body" :type "text"})
                       (dom/div #js {:className "errorMessage" :id "ContactForm_body_em_"}))
-                    (dom/div #js {:className "g-recaptcha" :data-sitekey "6LeLxhkTAAAAAPRgeOsY44L4N27hvPhRjKFM4BP4"})
                     (dom/div #js {:className "form-actions"}
                       (dom/button #js {:type "submit" :className "btn btn-primary"} "Submit")
                       (dom/button #js {:type "reset" :className "btn"} "Reset"))))))))))))


next frame channel

next frame channel

--- src/cljs/infinitelives/pixi/events.cljs
+++ src/cljs/infinitelives/pixi/events.cljs
@@ -35,6 +35,19 @@
   ^{:arglist '([callback])
     :doc "schedules the passed in callback to be fired once, next animation frame."}
   request-animation-frame (make-request-animation-frame))
+
+(defn next-frame
+  "returns a single use channel which closes on next frame callback.
+  pulling from it waits exactly one frame. eg
+
+  ```
+  ;; wait one frame
+  (<! (next-frame))
+  ```"
+  []
+  (let [c (chan)]
+    (request-animation-frame #(close! c))
+    c))

 ;;


specific x and y anchor set functions

specific x and y anchor set functions

--- src/cljs/infinitelives/pixi/sprite.cljs
+++ src/cljs/infinitelives/pixi/sprite.cljs
@@ -86,6 +86,12 @@
 (defn set-anchor! [sprite x y]
   (set! (.-anchor sprite) (make-point x y)))

+(defn set-anchor-x! [sprite x]
+  (set! (.-anchor.x sprite) x))
+
+(defn set-anchor-y! [sprite y]
+  (set! (.-anchor.y sprite) y))
+
 (defn set-alpha! [sprite alpha]
   (set! (.-alpha sprite) alpha))


missing example

missing example

--- src/cljs/infinitelives/pixi/sprite.cljs
+++ src/cljs/infinitelives/pixi/sprite.cljs
@@ -78,7 +78,7 @@

 (defn set-texture! [sprite tex]
   (if (keyword? tex)
-    (set! (.-texture sprite) (texture/get tex))
+    (set! (.-texture sprite) (texture/get-texture tex))
     (set! (.-texture sprite) tex)))

 (defn set-visible! [sprite visibility]


Add get method for registry helpers.

Add get method for registry helpers.

--- src/clojure/catacumba/impl/registry.clj
+++ src/clojure/catacumba/impl/registry.clj
@@ -24,6 +24,7 @@

 (ns catacumba.impl.registry
   "Functions and helpers for work with ratpack registry."
+  (:refer-clojure :exclude [get])
   (:import ratpack.registry.Registry
            ratpack.registry.RegistrySpec
            java.util.Optional))
@@ -34,6 +35,11 @@
   (let [^Optional v (.maybeGet reg clazz)]
     (when (.isPresent v)
       (.get v))))
+
+(defn get
+  {:internal true}
+  [^Registry reg clazz]
+  (.get reg clazz))

 (defn add!
   {:internal true}


Copy over stuff from `event` tutorial project.

Text fields for adding event name and location, date input, and button
to add to listings.

--- src/clojure/my/stuff/fitlogger/main.clj
+++ src/clojure/my/stuff/fitlogger/main.clj
@@ -28,23 +28,84 @@
              (res/get-string R$string/your_input_fmt input))
            :long)))

+
+(defn get-elmt [activity elmt]
+  (str (.getText ^TextView (find-view activity elmt))))
+
+(defn set-elmt [activity elmt s]
+  (on-ui (config (find-view activity elmt) :text s)))
+
+(defn format-events [events]
+  (->>
+   (map (fn [[location event]]
+            (format "%s - %s\n" location event))
+          events)
+   (join "                        ")))
+
+(defn format-listing [lst]
+  (->> (map (fn [[date events]]
+            (format "%s - %s" date (format-events events)))
+          lst)
+     join))
+
+(def listing (atom (sorted-map)))
+
+(defn update-ui [activity]
+  (set-elmt activity ::listing (format-listing @listing))
+  (set-elmt activity ::location "")
+  (set-elmt activity ::name ""))
+
+(defn add-event [activity]
+  (let [date-key (try
+                   (read-string (get-elmt activity ::date))
+                   (catch RuntimeException e "Date string is empty!"))]
+    (when (number? date-key)
+      (swap! listing update-in [date-key] (fnil conj [])
+             [(get-elmt activity ::location) (get-elmt activity ::name)])
+      (update-ui activity))))
+
+(defn date-picker [activity]
+  (proxy [DialogFragment DatePickerDialog$OnDateSetListener] []
+    (onCreateDialog [savedInstanceState]
+      (let [c (Calendar/getInstance)
+            year (.get c Calendar/YEAR)
+            month (.get c Calendar/MONTH)
+            day (.get c Calendar/DAY_OF_MONTH)]
+        (DatePickerDialog. activity this year month day)))
+    (onDateSet [view year month day]
+      (set-elmt activity ::date
+                (format "%d%02d%02d" year (inc month) day)))))
+
+(defn show-picker [^Activity activity dp]
+  (. dp show (. activity getFragmentManager) "datePicker"))
+
+(defn main-layout [activity]
+  [:linear-layout {:orientation :vertical}
+   [:edit-text {:hint "Event name",
+                :id ::name}]
+   [:edit-text {:hint "Event location",
+                :id ::location}]
+   [:linear-layout {:orientation :horizontal}
+    [:text-view {:hint "Event date",
+                 :id ::date}]
+    [:button {:text "...",
+              :on-click (fn [_] (show-picker activity
+                                            (date-picker activity)))}]]
+   [:button {:text "+ Event",
+             :on-click (fn [_]
+                         (add-event activity))}]
+   [:text-view {:text (format-listing @listing),
+                :id ::listing}]])
+
 ;; This is how an Activity is defined. We create one and specify its onCreate
 ;; method. Inside we create a user interface that consists of an edit and a
 ;; button. We also give set callback to the button.
-(defactivity my.stuff.fitlogger.MainActivity
+(defactivity my.stuff.events.MainActivity
   :key :main

   (onCreate [this bundle]
     (.superOnCreate this bundle)
     (neko.debug/keep-screen-on this)
     (on-ui
-      (set-content-view! (*a)
-        [:linear-layout {:orientation :vertical
-                         :layout-width :fill
-                         :layout-height :wrap}
-         [:edit-text {:id ::user-input
-                      :hint "Type text here"
-                      :layout-width :fill}]
-         [:button {:text R$string/touch_me ;; We use resource here, but could
-                                           ;; have used a plain string too.
-                   :on-click (fn [_] (notify-from-edit (*a)))}]]))))
+     (set-content-view! (*a) (main-layout (*a)))
+     (set-elmt (*a) ::listing (format-listing @listing)))))


Make separate lazy

Make separate lazy

--- src/useful.clj
+++ src/useful.clj
@@ -51,12 +51,11 @@
   "Split coll into two sequences, one that matches pred and one that doesn't. Unlike, the
   version in clojure.contrib.seq-utils, this is not lazy, but pred is only called once per item."
   [pred coll]
-  (reduce (fn [[yes no] item]
-            (if (pred item)
-              [(conj yes item) no]
-              [yes (conj no item)]))
-          [[] []]
-          coll))
+  (let [coll (map (fn [x]
+                    [x (pred x)])
+                  coll)]
+    (vec (map #(map first (% second coll))
+              [filter remove]))))

 (defmacro if-ns [ns-reference then-form & [else-form]]
   "Try to load a namespace reference. If successful, evaluate then-form otherwise evaluate else-form."


adjusting project name for example javaapp

--- javaapp/project.clj
+++ javaapp/project.clj
@@ -1,4 +1,4 @@
-(defproject javaapp "0.1.1-SNAPSHOT"
+(defproject clj-factum/exmple-javaapp "0.1.1-SNAPSHOT"
   :description "FIXME: write description"
   :url "http://example.com/FIXME"
   :license {:name "Eclipse Public License"


Release ring-analytics 0.3.3

Release ring-analytics 0.3.3

--- systems/ring-analytics/project.clj
+++ systems/ring-analytics/project.clj
@@ -2,7 +2,7 @@
 ;; License, v. 2.0. If a copy of the MPL was not distributed with this
 ;; file, You can obtain one at http://mozilla.org/MPL/2.0/.

-(defproject containium.systems/ring-analytics "0.3.2"
+(defproject containium.systems/ring-analytics "0.3.3"
   :description "Ring requests and responses stored in ElasticSearch for use with Kibana"
   :url "http://containium.org"
   :scm {:dir "../../"}


Updated tests: test-render-name-field-existence and test-render-name-field-existence

--- test/zg/server_test.clj
+++ test/zg/server_test.clj
@@ -105,10 +105,16 @@
         (is (callable? 'zg.server/split-words))))

-(deftest test-proper-word?-existence
-    "Check that the zg.server/proper-word? definition exists."
-    (testing "if the zg.server/proper-word? definition exists."
-        (is (callable? 'zg.server/proper-word?))))
+(deftest test-proper-word-for-whitelist?-existence
+    "Check that the zg.server/proper-word-for-whitelist? definition exists."
+    (testing "if the zg.server/proper-word-for-whitelist? definition exists."
+        (is (callable? 'zg.server/proper-word-for-whitelist?))))
+
+
+(deftest test-proper-word-for-blacklist?-existence
+    "Check that the zg.server/proper-word-for-blacklist? definition exists."
+    (testing "if the zg.server/proper-word-for-blacklist? definition exists."
+        (is (callable? 'zg.server/proper-word-for-blacklist?))))

 (deftest test-process-add-word-existence


Fixing issue: https://github.com/thinktopic/cortex/issues/129 (#131)

--- src/cortex/compute/javacpp_datatype.clj
+++ src/cortex/compute/javacpp_datatype.clj
@@ -161,6 +161,14 @@
   (->> (marshal/buffer-type-iterator copy-to-impl)
        (into {})))

+(extend-type Pointer
+  marshal/PTypeToCopyToFn
+  (get-copy-to-fn [dest dest-offset]
+    (marshal/get-copy-to-fn (as-buffer dest) dest-offset))
+  dtype/PCopyQueryIndirect
+  (get-indirect-copy-fn [dest dest-offset]
+    (marshal/get-copy-to-fn dest dest-offset)))
+

 (defn float->double-ary-time-test
   []


Refactor include of clojure.string

Refactor include of clojure.string

--- src/nextbus/next_three_fetcher.clj
+++ src/nextbus/next_three_fetcher.clj
@@ -1,5 +1,6 @@
 (ns nextbus.next-three-fetcher
-  (:require [net.cgrand.enlive-html :as html]))
+  (:require [net.cgrand.enlive-html :as html]
+            [clojure.string :as s]))

 (def rtd-url "http://m.rtd-denver.com/mobi/getMyStop.do?stopId=&lightRailStation=&pnr=24")

@@ -24,13 +25,13 @@
 ;   :attrs {:bgcolor "#f4f4f4"},
 ;   :content ("14th/Walnut (Sb)")}
 (defn extract-first-content [td]
-    (clojure.string/replace (first (:content td)) #"[\n\t\r]" ""))
+    (s/replace (first (:content td)) #"[\n\t\r]" ""))

 (defn format-time [s]
-  (let [z (clojure.string/replace s #"^\d:" #(str "0" %1))]
+  (let [z (s/replace s #"^\d:" #(str "0" %1))]
     (if (.endsWith z "a")
-      (clojure.string/replace z "a" "")
-      (clojure.string/replace (clojure.string/replace z #"^\d+" #(str (+ 12 (Integer/parseInt %1)))) "p" ""))))
+      (s/replace z "a" "")
+      (s/replace (s/replace z #"^\d+" #(str (+ 12 (Integer/parseInt %1)))) "p" ""))))

 (defn process-row [row]
   [


Fix selection of a random start point for markov. DRY up markov a bit.

--- src/engulf/formulas/markov_requests.clj
+++ src/engulf/formulas/markov_requests.clj
@@ -1,5 +1,6 @@
 (ns engulf.formulas.markov-requests
-  "Support for generating markov chains of requests"
+  "Support for generating markov chains of requests."
+  ;; TODO: This file's a bit of a messy in terms of organization and naming
   (:use clojure.pprint
         [clojure.string :only [lower-case]]
         [clojure.walk :only [keywordize-keys]])
@@ -8,38 +9,42 @@
             [cheshire.core :as json])
   (:import java.util.TreeMap))

+(defn counts->treemap
+  [counts]
+  (let [m (TreeMap.)]
+    (reduce
+     (fn [offset [req-id weight]]
+       (let [off-ceil (+ offset weight)]
+         (.put m off-ceil req-id)
+         off-ceil))
+     0.0
+     counts)
+    m))
+
 (defn compile-transitions
-  "Compile a system's transitions into a format suitable for efficient markov chain generation. Internally this creates a lookup table of URLs with treemaps used to map probabilities onto numerical ranges."
+  "Compile transitions into a format suitable for efficient markov chain generation. Internally this creates a lookup table of requests with treemaps used to map probabilities onto numerical ranges."
   [transitions]
   (doall
    (reduce
-    (fn [out [url-id edges]]
+    (fn [out [req-id edges]]
       (assoc out
-        url-id
-        (let [m (TreeMap.)]
-          (reduce
-           (fn [offset [edge-url-id weight]]
-             (let [off-ceil (+ offset weight)]
-               (.put m off-ceil edge-url-id)
-               off-ceil))
-           0.0
-           edges)
-          m)))
+        req-id
+        (counts->treemap edges)))
     {}
     transitions)))

 (defn chain
   "Returns a lazy sequence of requests. Not guaranteed to terminate."
-  ([compiled]
-     (chain compiled :rand))
-  ([{:keys [transitions request-keys requests] :as compiled} request]
-     (let [r (request-keys (rand-int (count request-keys)))]
-       (if-let [edges (transitions r)]
-         (let [e (.ceilingEntry edges (rand))]
-           (if-let [e-req (.getValue e)]
-             (lazy-seq (cons (first (requests e-req)) (chain compiled e-req)))
-             (throw (Exception.  "This should never happen. The morkov chain is compromised!"))))
-         (throw (Exception. (str "Could not find edge for: " request)))))))
+  ([{:keys [weighted-requests] :as compiled}]
+     (chain compiled (.getValue (.ceilingEntry weighted-requests (rand)))))
+  ([{:keys [transitions requests] :as compiled} request]
+     (if-let [edges (transitions request)]
+       (let [e (.ceilingEntry edges (rand))]
+         (if-let [e-req (.getValue e)]
+           (lazy-seq (cons (first (requests e-req)) (chain compiled e-req)))
+           (throw (Exception.
+                   "This should never happen. The morkov chain is compromised!"))))
+       (throw (Exception. (str "Could not find edge for: " request))))))

 (defn build-requests
   [parsed]
@@ -58,8 +63,8 @@
 (defn counted-tuples
   [parsed requests]
   (let [tuples (partition 2 1 parsed)
-        first-edge (first (first tuples))
-        last-edge (last (last tuples))
+        first-node (first (first tuples))
+        last-node (last (last tuples))
         counted (reduce
                  (fn [m [a b]]
                    (let [ac (.hashCode a)
@@ -71,28 +76,39 @@
                  tuples)]
     ;; loop the end to the front to finish it
     (-> counted
-        (update-in [(.hashCode last-edge) (.hashCode first-edge)] incr-or-one)
-        (update-in [(.hashCode last-edge) :total] incr-or-one))))
+        (update-in [(.hashCode last-node) (.hashCode first-node)] incr-or-one)
+        (update-in [(.hashCode last-node) :total] incr-or-one))))

 (defn counted-probabilities
   [counted]
   (map
-   (fn [[request edges]]
+   (fn [[request nodes]]
      [request
-      (reduce (fn [m [ereq ecount]]
-                (if (= ereq :total)
+      (reduce (fn [m [nreq ncount]]
+                (if (= nreq :total)
                   m
-                  (assoc m ereq (float (/ ecount (:total edges))))))
+                  (assoc m nreq (float (/ ncount (:total nodes))))))
               {}
-              edges)])
+              nodes)])
    counted))
+
+(defn weighted-requests
+  [{total :total :as requests}]
+  (reduce
+   (fn [m [k v]]
+     (if (= k :total)
+       m
+       (let [[_ cnt] v]
+         (assoc m k (/ cnt total)))))
+   {}
+   requests))

 (defn compile-preprocessed
   "Compiles a preprocessed corpus into a format suitable for the (chain) method"
   [{:keys [requests counted]}]
   (let [probabilities (counted-probabilities counted)]
     {:requests requests
-     :request-keys (vec (filter #(not= :total %) (keys requests)))
+     :weighted-requests (counts->treemap (weighted-requests requests))
      :transitions (compile-transitions probabilities)}))

 (defn parse
@@ -115,6 +131,7 @@
      :counted counted}))

 (defn corpus-chain
+  "Takes an array of requests, returns a lazy seq of the chain"
   [corpus]
   (-> corpus
       preprocess-corpus


Using cursors

Using cursors

--- src/pink_panther/android/core.cljs
+++ src/pink_panther/android/core.cljs
@@ -7,22 +7,21 @@

 (def logo-img (js/require "./images/cljs.png"))

+(defonce state (r/atom {:tasks [{:value "One"}
+                                {:value "Two"}
+                                {:value "Three"}]}))
+
 (defn app-root []
   (let [greeting (subscribe [:get-greeting])]
     (fn []
       [ui/view
-       [ui/todo-element "WOW"]
-       [ui/todo-element "WOW"]
-       [ui/todo-element "WOW"]])))
-      ; [ui/list-view
-      ;  [ui/text "FOo Bar"]])))
-      ; [ui/view {:style {:flex-direction "column" :margin 40 :align-items "center"}}
-      ;  [ui/text {:style {:font-size 30 :font-weight "100" :margin-bottom 20 :text-align "center"}} @greeting]
-      ;  [ui/image {:source logo-img
-      ;             :style  {:width 80 :height 80 :margin-bottom 30}}]
-      ;  [ui/touchable-highlight {:style {:background-color "#999" :padding 10 :border-radius 5}
-      ;                           :on-press #(ui/alert "HELLO!")}
-      ;   [ui/text {:style {:color "white" :text-align "center" :font-weight "bold"}} "press me"]]])))
+       [ui/scroll-view
+        (->> @state :tasks count
+             range
+             (map (fn [i] ^{:key i} [ui/todo-element (r/cursor state [:tasks i])])))
+        [ui/touchable-highlight {:style {:background-color "#999" :padding 10 :border-radius 5}
+                                 :on-press #(swap! state update :tasks conj {:value "New Task"})}
+         [ui/text {:style {:color "white" :text-align "center" :font-weight "bold"}} "press me"]]]])))

 (defn init []
       (dispatch-sync [:initialize-db])


Add headings.

Add headings.

--- src/african_polyphony_and_polyrhythm/talk.clj
+++ src/african_polyphony_and_polyrhythm/talk.clj
@@ -2,10 +2,16 @@
   (:require [overtone.live :refer :all :exclude [stop scale]]
             [leipzig.melody :refer :all]
             [leipzig.canon :refer [canon]]
-            [leipzig.scale :refer [scale A B high low]]
+            [leipzig.scale :refer [scale A B high low from]]
             [leipzig.temperament :as temperament]
             [leipzig.live :as live]
             [leipzig.live :refer [stop]]))
+
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+; Ostinato with variations ;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 (defn vary
   "Apply f to the note at time t."
@@ -49,6 +55,12 @@
   "Generate version of the model using the variations fns."
   [model & variations]
   ((apply juxt identity variations) model))
+
+
+
+;;;;;;;;;;;;;;
+; Aga Terumo ;
+;;;;;;;;;;;;;;

 (def child
   (let [model (->> (rhythm [2/5 3/5 1/5 1/5 3/5]) (all :part :child))
@@ -94,7 +106,12 @@
     (tempo (bpm 90))
     live/play))

-; Clapping music
+
+
+;;;;;;;;;;;;;;;;;;
+; Clapping Music ;
+;;;;;;;;;;;;;;;;;;
+
 (defn clapping-music []
   (let [forever (comp rand-variations list)
         african-bell-pattern (rhythm [1/8 1/8 1/4 1/8 1/4 1/4 1/8 1/4])]
@@ -105,6 +122,12 @@
   (->> (clapping-music)
        live/play))

+
+
+;;;;;;;;;;;;;;;;;;
+; Natural scales ;
+;;;;;;;;;;;;;;;;;;
+
 ; Natural numbers
 (comment
   (range 0 8))
@@ -130,6 +153,12 @@
   (->> (phrase (repeat 1/4) (range 0 8))
        (where :pitch (comp temperament/equal A major))
        live/play))
+
+
+
+;;;;;;;;;;;;;;;;;;;;;
+; Ndereje Balendoro ; p 343
+;;;;;;;;;;;;;;;;;;;;;

 (def tete
   (let [model (phrase [8/4 3/4 5/4] (repeat 0))
@@ -172,16 +201,13 @@
     (part model a b c d)))

 (defn big [notes]
-  (->> notes
-       (map (partial where :pitch #(+ % 5)))))
+  (->> notes (map #(where :pitch (from 5) %))))

 (defn pan [{:keys [pitch] :as note}]
-  (if pitch
-    (let [p (-> note :pitch (/ 18) dec)]
-      (if (odd? pitch)
-        (assoc note :pan (- p))
-        (assoc note :pan p)))
-    note))
+  (let [p (cond (not pitch) 0
+                (odd? pitch) (-> pitch (/ 18) dec -)
+                (even? pitch) (-> pitch (/ 18) dec))]
+    (assoc note :pan p)))

 (def ndereje-balendoro ; p 343
   (->> [tete ta ha tulule bongo
@@ -199,7 +225,12 @@
     (tempo (bpm 120))
     (live/play)))

-; Instruments
+
+
+;;;;;;;;;;;;;;;
+; Instruments ;
+;;;;;;;;;;;;;;;
+
 (definst drum [freq 440 vol 0.5 pan 0]
   (-> (* 2/3 (brown-noise))
       (+ (* 1/2 (sin-osc (* 3 freq))))


Name the drum parts after drums, not claps.

--- src/african_polyphony_and_polyrhythm/talk.clj
+++ src/african_polyphony_and_polyrhythm/talk.clj
@@ -51,7 +51,7 @@
   ((apply juxt identity variations) model))

 (def first-drum
-  (let [model (->> (rhythm [2/5 3/5 1/5 1/5 3/5]) (all :part :clap1))
+  (let [model (->> (rhythm [2/5 3/5 1/5 1/5 3/5]) (all :part :child))
         a (split 6/5 1/10)
         b (split 5/5 1/10)
         c (comp (split 17/15 2/15) (split 5/5 2/15) (skip 6/5))
@@ -59,15 +59,15 @@
     (part model a b c d)))

 (def second-drum
-  (let [model (->> (rhythm [2/5 2/5 4/5 1/5 1/5]) (all :part :clap2))
+  (let [model (->> (rhythm [2/5 2/5 4/5 1/5 1/5]) (all :part :mother))
         a (skip 9/5)
         b (skip 0)
         c (comp a b)
-        d #(then % (->> (rhythm (repeat 5 2/5)) (all :part :clap2)))]
+        d #(then % (->> (rhythm (repeat 5 2/5)) (all :part :mother)))]
     (part model a b c d)))

 (def third-drum
-  (let [model (->> (rhythm [2/5 1/5 2/5]) (all :part :clap3))
+  (let [model (->> (rhythm [2/5 1/5 2/5]) (all :part :father))
         a (skip 2/5)
         b (skip 3/5)
         c (comp (split 0 1/5) a)
@@ -101,8 +101,8 @@

 (defn clapping-music []
   (let [african-bell-pattern (rhythm [1/8 1/8 1/4 1/8 1/4 1/4 1/8 1/4])]
-    (->> african-bell-pattern forever (all :part :clap1)
-         (canon #(->> % (take 32) (then (rhythm [1/8])) forever (all :part :clap2))))))
+    (->> african-bell-pattern forever (all :part :mother)
+         (canon #(->> % (take 32) (then (rhythm [1/8])) forever (all :part :child))))))

 (comment
   (->> (clapping-music)
@@ -215,13 +215,13 @@
       (pan2 pan)
       (* vol)))

-(defmethod live/play-note :clap1 [_]
+(defmethod live/play-note :child [_]
   (drum 225 :pan 0.75))

-(defmethod live/play-note :clap2 [_]
+(defmethod live/play-note :mother [_]
   (drum 150 :pan -0.75))

-(defmethod live/play-note :clap3 [_]
+(defmethod live/play-note :father [_]
   (drum 75 :pan 0))

 (definst horn [freq 440 vol 0.5 pan 0]


Consolidate the duplicated variations fns.

--- src/african_polyphony_and_polyrhythm/talk.clj
+++ src/african_polyphony_and_polyrhythm/talk.clj
@@ -103,14 +103,12 @@
   (when pitch (horn :freq pitch :pan (or 0 pan))))

 (defn rand-variations [variations]
-  (concat
-    (rand-nth variations)
-    (lazy-seq (after 4 (rand-variations variations)))))
-
-(defn rand-variations2 [variations]
-  (concat
-    (rand-nth variations)
-    (lazy-seq (after 2 (rand-variations2 variations)))))
+  (let [variation (rand-nth variations)]
+    (concat
+      variation
+      (lazy-seq
+        (->> (rand-variations variations)
+             (after (duration variation) ))))))

 (defn part [model & variations]
   ((apply juxt identity variations) model))
@@ -213,13 +211,12 @@
         e (comp (split 3/5 1/10) d)
         f (split 0 1/5)
         g (comp (split 0 1/10) f)]
-    (->> (part model a b c d e f g)
-         (map (partial times 2)))))
+    (part model a b c d e f g)))

 (def aga-terumo ; p299
   (let [drums [first-drum second-drum third-drum]]
     (->> drums
-         (map rand-variations2)
+         (map rand-variations)
          ;(map first)
          (reduce with))))


quote test code

quote test code

--- src/atom_finder/questions/random_examples.clj
+++ src/atom_finder/questions/random_examples.clj
@@ -19,7 +19,7 @@
    )
   )

-(->>
+'((->>
  "~/opt/src/linux"
  expand-home
  c-files
@@ -28,7 +28,7 @@
  (take 10000)
  (def random-c-files)
  time-mins
- )
+ ))

 (quote
 (->>


scroll to section only on first render (bugfix)

--- src/cljs/swarmpit/component/service/edit.cljs
+++ src/cljs/swarmpit/component/service/edit.cljs
@@ -334,12 +334,15 @@
 (def scroll-to-section
   {:after-render
    (fn [state]
-     (let [section (-> state :rum/args first :params :section)
-           el (.getElementById js/document section)]
-       (when (and el section)
-         (do
-           (.scrollIntoView el true)
-           (.scrollBy js/window 0 -74))))
+     (let [loaded? (state/get-value (conj state/form-state-cursor :scrolled))]
+       (when (nil? loaded?)
+         (let [section (-> state :rum/args first :params :section)
+               el (.getElementById js/document section)]
+           (when (and el section)
+             (do
+               (.scrollIntoView el true)
+               (.scrollBy js/window 0 -74)
+               (state/update-value [:scrolled] true state/form-state-cursor))))))
      state)})

 (rum/defc form < rum/reactive


moved clojure to /src/clojure

moved clojure to /src/clojure

--- clojure/compose/compose.cljs
+++ clojure/compose/compose.cljs
@@ -1,14 +0,0 @@
-(ns compose.compose)
-
-(enable-console-print!)
-
-(defn process-v1 [compose] {:version "2", :services compose})
-
-(defn process-v2 [compose] compose)
-
-(defn process-compose [compose]
-  (if-not (:version compose)
-    (process-v1 compose)
-    (process-v2 compose)))
-
-(defn ^:export mapv2 [x] (clj->js (process-compose (js->clj x :keywordize-keys true))))


deleting src directory

deleting src directory

--- src/lt/plugins/python.cljs
+++ src/lt/plugins/python.cljs
@@ -1,324 +0,0 @@
-(ns lt.plugins.python
-  (:require [lt.object :as object]
-            [lt.objs.eval :as eval]
-            [lt.objs.console :as console]
-            [lt.objs.command :as cmd]
-            [lt.objs.clients.tcp :as tcp]
-            [lt.objs.sidebar.clients :as scl]
-            [lt.objs.dialogs :as dialogs]
-            [lt.objs.files :as files]
-            [lt.objs.popup :as popup]
-            [lt.objs.platform :as platform]
-            [lt.objs.editor :as ed]
-            [lt.objs.plugins :as plugins]
-            [lt.plugins.watches :as watches]
-            [lt.objs.proc :as proc]
-            [clojure.string :as string]
-            [lt.objs.clients :as clients]
-            [lt.objs.notifos :as notifos]
-            [lt.util.load :as load]
-            [lt.util.cljs :refer [js->clj]])
-  (:require-macros [lt.macros :refer [behavior defui]]))
-
-;;****************************************************
-;; Proc
-;;****************************************************
-
-(def shell (load/node-module "shelljs"))
-(def py-path (files/join plugins/*plugin-dir* "py-src/ltmain.py"))
-
-(behavior ::on-out
-                  :triggers #{:proc.out}
-                  :reaction (fn [this data]
-                              (let [out (.toString data)]
-                                (object/update! this [:buffer] str out)
-                                (when (> (.indexOf out "Connected") -1)
-                                  (do
-                                    (notifos/done-working)
-                                    (object/merge! this {:connected true})
-                                    ;(object/destroy! this)
-                                    )))))
-
-(behavior ::on-error
-                  :triggers #{:proc.error}
-                  :reaction (fn [this data]
-                              (let [out (.toString data)]
-                                (when-not (> (.indexOf (:buffer @this) "Connected") -1)
-                                  (object/update! this [:buffer] str data)
-                                  ))
-                              ))
-
-(behavior ::on-exit
-                  :triggers #{:proc.exit}
-                  :reaction (fn [this data]
-                              ;(object/update! this [:buffer] str data)
-                              (when-not (:connected @this)
-                                (notifos/done-working)
-                                (popup/popup! {:header "We couldn't connect."
-                                               :body [:span "Looks like there was an issue trying to connect
-                                                      to the project. Here's what we got:" [:pre (:buffer @this)]]
-                                               :buttons [{:label "close"}]})
-                                (clients/rem! (:client @this)))
-                              (proc/kill-all (:procs @this))
-                              (object/destroy! this)
-                              ))
-
-(object/object* ::connecting-notifier
-                :triggers []
-                :behaviors [::on-exit ::on-error ::on-out]
-                :init (fn [this client]
-                        (object/merge! this {:client client :buffer ""})
-                        nil))
-
-(defn run-py [{:keys [path project-path name client venv] :as info}]
-  (let [n (notifos/working "Connecting..")
-        obj (object/create ::connecting-notifier client)
-        env (if venv
-              {"VIRTUAL_ENV" venv}
-              {})
-        env (if (:ipython-exe @python)
-              (assoc env "LT_IPYTHON_PATH" (:ipython-exe @python))
-              env)]
-    (proc/exec {:command (or (:python-exe @python) (:venv-py info) "python")
-                :args [py-path tcp/port (clients/->id client)]
-                :cwd (or venv project-path)
-                :env env
-                :obj obj})))
-
-
-(defn check-python [obj]
-  (assoc obj :python (or (:python-exe @python)
-                         (:venv-py obj)
-                         (.which shell "python"))))
-
-(defn check-client [obj]
-  (assoc obj :python-client (files/exists? py-path)))
-
-(defn find-project [obj]
-  (let [p (:path obj)
-        roots (files/get-roots)]
-    (loop [cur p
-           prev ""]
-      (if (or (empty? cur)
-              (roots cur)
-              (= cur prev))
-        (assoc obj :project-path nil)
-        (if (and (not (files/exists? (files/join cur "__init__.py")))
-                 (files/dir? cur))
-          (assoc obj :project-path cur)
-          (recur (files/parent cur) cur))))))
-
-(defn find-venv [obj]
-  (let [to-find (if (platform/win?)
-                  "bin\\python"
-                  "bin/python")
-        vpy (files/walk-up-find (:path obj) to-find)]
-    (if (empty? vpy)
-      obj
-      (assoc obj
-        :venv (-> vpy (files/parent) (files/parent))
-        :venv-py vpy))))
-
-(defn notify [obj]
-  (let [{:keys [python project-path path python-client client]} obj]
-    (cond
-     (or (not python) (empty? python)) (do
-                                         (clients/rem! client)
-                                         (notifos/done-working)
-                                         (popup/popup! {:header "We couldn't find Python."
-                                                      :body "In order to evaluate in Python files, a Python interpreter has to be installed and on your system PATH."
-                                                      :buttons [{:label "Download Python"
-                                                                 :action (fn []
-                                                                           (platform/open "http://www.python.org/download/"))}
-                                                                {:label "ok"}]}))
-     (not project-path) (do
-                          (clients/rem! client)
-                          (notifos/done-working)
-                          (popup/popup! {:header "We couldn't find this file."
-                                       :body "In order to evaluate in Python files, the file has to be on disk somewhere."
-                                       :buttons [{:label "Save this file"
-                                                  :action (fn []
-                                                            (cmd/exec! :save)
-                                                            (try-connect obj))}
-                                                 {:label "Cancel"
-                                                  :action (fn []
-                                                            )}]}))
-     :else (run-py obj))
-    obj))
-
-(defn check-all [obj]
-  (-> obj
-      (find-venv)
-      (check-python)
-      (check-client)
-      (find-project)
-      (notify)))
-
-;;****************************************************
-;; Eval
-;;****************************************************
-
-(defn try-connect [{:keys [info]}]
-  (let [path (:path info)
-        client (clients/client! :python.client)]
-    (check-all {:path path
-                :client client})
-    client))
-
-(defn python-watch [meta src]
-  (let [meta (js/JSON.stringify (clj->js meta))]
-    (str "sys.modules['lttools'].__dict__['watch'](" src ", " meta ")")))
-
-(behavior ::watch-src
-                  :triggers #{:watch.src+}
-                  :reaction (fn [editor cur meta src]
-                              (python-watch meta src)))
-
-(behavior ::on-eval
-                  :triggers #{:eval}
-                  :reaction (fn [editor]
-                              (object/raise python :eval! {:origin editor
-                                                             :info (assoc (@editor :info)
-                                                                     :code (watches/watched-range editor nil nil python-watch))})))
-
-(behavior ::on-eval.one
-                  :triggers #{:eval.one}
-                  :reaction (fn [editor]
-                              (let [code (watches/watched-range editor nil nil python-watch)
-                                    pos (ed/->cursor editor)
-                                    info (:info @editor)
-                                    info (if (ed/selection? editor)
-                                           (assoc info
-                                             :code (ed/selection editor)
-                                             :meta {:start (-> (ed/->cursor editor "start") :line)
-                                                    :end (-> (ed/->cursor editor "end") :line)})
-                                           (assoc info :pos pos :code code))]
-                                (object/raise python :eval! {:origin editor
-                                                             :info info}))))
-
-(behavior ::python-watch
-                  :triggers #{:editor.eval.python.watch}
-                  :reaction (fn [editor res]
-                              (when-let [watch (get (:watches @editor) (-> res :meta :id))]
-                                (let [str-result (:result res)]
-                                  (object/raise (:inline-result watch) :update! str-result)))))
-
-(behavior ::python-result
-                  :triggers #{:editor.eval.python.result}
-                  :reaction (fn [editor res]
-                              (notifos/done-working)
-                              (object/raise editor :editor.result (:result res) {:line (:end (:meta res))
-                                                                                :start-line (-> res :meta :start)})))
-
-(behavior ::python-success
-                  :triggers #{:editor.eval.python.success}
-                  :reaction (fn [editor res]
-                              (notifos/done-working)
-                              (object/raise editor :editor.result "✓" {:line (-> res :meta :end)
-                                                                       :start-line (-> res :meta :start)})))
-
-(behavior ::python-exception
-                  :triggers #{:editor.eval.python.exception}
-                  :reaction (fn [editor ex]
-                              (notifos/done-working)
-                              (object/raise editor :editor.exception (:ex ex) {:line (-> ex :meta :end)
-                                                                               :start-line (-> ex :meta :start)})
-                              ))
-
-(defui image [src]
-  [:img {:src (str "data:image/png;base64," src)}])
-
-(defui canvas []
-  [:canvas])
-
-(behavior ::python-image
-                  :triggers #{:editor.eval.python.image}
-                  :reaction (fn [editor img]
-                              ;(console/log (pr-str img))
-                              (object/raise editor :editor.result.underline (image (:image img)) {:line (-> img :meta :end)
-                                                                                :start-line (-> img :meta :start)})
-                              ))
-
-(behavior ::python-printer
-                  :triggers #{:editor.eval.python.print}
-                  :reaction (fn [editor p]
-                              (console/loc-log {:file (files/basename (:file p))
-                                                :line "stdout"
-                                                :content (:msg p)})))
-
-(behavior ::eval!
-                  :triggers #{:eval!}
-                  :reaction (fn [this event]
-                              (let [{:keys [info origin]} event
-                                    client (-> @origin :client :default)]
-                                (notifos/working "")
-                                (clients/send (eval/get-client! {:command :editor.eval.python
-                                                                 :origin origin
-                                                                 :info info
-                                                                 :create try-connect})
-                                              :editor.eval.python
-                                              info
-                                              :only
-                                              origin))))
-
-(def pyzmq-warned false)
-
-(behavior ::pyzmq-error
-                  :triggers #{:python.client.error.pyzmq}
-                  :reaction (fn [this]
-                              (when-not pyzmq-warned
-                                (set! pyzmq-warned true)
-                                (popup/popup! {:header "Some IPython dependencies are missing."
-                                               :body "Looks like you have IPython installed, but you also need pyzmq in order for Light Table to take advantage of the IPython client. You can continue with the default client for a scaled down experience."
-                                               :buttons [{:label "Install instructions"
-                                                          :action (fn []
-                                                                    (platform/open "http://ipython.org/ipython-doc/stable/install/install.html"))}
-                                                         {:label "ok"}]}))))
-
-(behavior ::ipython-error
-                  :triggers #{:python.client.error.ipython-version}
-                  :reaction (fn [this]
-                              (when-not pyzmq-warned
-                                (set! pyzmq-warned true)
-                                (popup/popup! {:header "Light Table requires IPython 1.0+"
-                                               :body "Looks like you have an older version of IPython installed. You can continue with the default client for a scaled down experience."
-                                               :buttons [{:label "Install instructions"
-                                                          :action (fn []
-                                                                    (platform/open "http://ipython.org/ipython-doc/stable/install/install.html"))}
-                                                         {:label "ok"}]}))))
-
-(behavior ::connect
-                  :triggers #{:connect}
-                  :reaction (fn [this path]
-                              (try-connect {:info {:path path}})))
-
-
-(object/object* ::python-lang
-                :tags #{:python.lang})
-
-(def python (object/create ::python-lang))
-
-(scl/add-connector {:name "Python"
-                    :desc "Select a directory to serve as the root of your python project."
-                    :connect (fn []
-                               (dialogs/dir python :connect))})
-
-(behavior ::python-exe
-                  :triggers #{:object.instant}
-                  :desc "Python: Set the path to the python executable for clients"
-                  :type :user
-                  :params [{:label "path"
-                            :type :path}]
-                  :exclusive true
-                  :reaction (fn [this exe]
-                              (object/merge! python {:python-exe exe})))
-
-(behavior ::ipython-exe
-                  :triggers #{:object.instant}
-                  :desc "Python: Set the path to ipython for clients"
-                  :type :user
-                  :exclusive true
-                  :params [{:label "path"
-                            :type :path}]
-                  :reaction (fn [this exe]
-                              (object/merge! python {:ipython-exe exe})))


cljs.js/*load-fn* should be passed the munged library name as string without extension

--- src/main/cljs/cljs/js.cljs
+++ src/main/cljs/cljs/js.cljs
@@ -23,9 +23,14 @@
   (binding [*print-fn* *print-err-fn*]
     (apply println args)))

+(defn ns->relpath
+  "Given a namespace as a symbol return the relative path sans extension"
+  [ns-sym]
+  (string/replace (ana/munge-path ns-sym) \. \/))
+
 (defonce
   ^{:doc "Each runtime environment provides a different way to load libraries.
-  Whatever function *load-fn* is bound to will be passed a library name
+  Whatever function *load-fn* is bound to will be passed a munged library name
   (a string) and a callback. The callback should be invoked with the source of
   the library (a string)."
     :dynamic true}
@@ -72,7 +77,7 @@
      (reset! *loaded* #{}))
    (when-not (contains? @*loaded* name)
      (let [env (:*env* bound-vars)]
-       (*load-fn* name
+       (*load-fn* (ns->relpath name)
          (fn [source]
            (if source
              (eval-str* bound-vars source opts
@@ -137,7 +142,7 @@
          (let [dep (first deps)]
            (when-not (or (not-empty (get-in compiler [::namespaces dep :defs]))
                          (contains? (:js-dependency-index compiler) (name dep)))
-             (*load-fn* name
+             (*load-fn* (ns->relpath name)
                (fn [source]
                  (if-not (nil? source)
                    (analyze* bound-vars source opts


pass src dir into compile-java

pass src dir into compile-java

--- src/cake/tasks/compile.clj
+++ src/cake/tasks/compile.clj
@@ -5,14 +5,14 @@
         [cake.contrib.find-namespaces :only [find-clojure-sources-in-dir read-file-ns-decl]])
   (:import [org.apache.tools.ant.taskdefs Copy Javac Java]))

-(defn compile-java []
-  (let [start (System/currentTimeMillis)
-        src   (file "src" "jvm")]
+(defn compile-java [src]
+  (let [start (System/currentTimeMillis)]
     (when (.exists src)
       (ant Javac {:destdir     (file "classes")
                   :classpath   (classpath)
                   :srcdir      (path src)
                   :fork        true
+                  :verbose     (verbose?)
                   :debug       true
                   :debug-level "source,lines"
                   :failonerror true}))
@@ -65,7 +65,7 @@
 (deftask compile #{deps compile-native}
   "Compile all clojure and java source files. Use 'cake compile force' to recompile."
   (copy-native)
-  (compile-java)
+  (compile-java (file "src" "jvm"))
   (compile-clojure))

 ;; add actions to compile-native if you need to compile native libraries


Use keep-with-next.within-column instead of keep-with-next

--- src/catalog/layout/fop.clj
+++ src/catalog/layout/fop.clj
@@ -66,7 +66,7 @@
                          :retrieve-boundary "page-sequence"}]])

 (defn- set-marker [title]
-  [:fo:block {:keep-with-next "always"}
+  [:fo:block {:keep-with-next.within-column "always" :role "NonStruct"}
    [:fo:marker {:marker-class-name running-header-class-name} title]])

 (defn- external-link [url title]
@@ -227,16 +227,16 @@

 (defn- ausleihe [signature]
   (when signature
-    (block {:keep-with-previous "always"} (bold "Ausleihe:") " " signature)))
+    (block {:keep-with-previous.within-column "always"} (bold "Ausleihe:") " " signature)))

 (defn- ausleihe-multi [signatures]
   (when signatures
-    (block {:keep-with-previous "always"}
+    (block {:keep-with-previous.within-column "always"}
            (bold "Ausleihe:") " " (layout/braille-signatures signatures))))

 (defn- verkauf [product-number price]
   (when product-number
-    (block {:keep-with-previous "always"}
+    (block {:keep-with-previous.within-column "always"}
            (bold "Verkauf:") " " price ". " (layout/braille-signatures product-number))))

 (defmulti entry-sexp (fn [{fmt :format} opts] fmt))


Clean up subscriber segment reading.

Clean up subscriber segment reading.

--- src/onyx/messaging/aeron/subscriber.clj
+++ src/onyx/messaging/aeron/subscriber.clj
@@ -253,21 +253,23 @@
                 spub (.valAt ^CljInt2ObjectHashMap short-id-status-pub short-id)]
             (some-> spub status-pub/set-heartbeat!)
             (cond (= msg-type t/message-id)
-                  (let [seg-dec (sdec/wrap buffer bs (+ offset (bdec/length base-dec)))]
-                    (when (nil? batch) (set! batch (transient [])))
-                    (check-correlation-id-alignment aligned header)
-                    (if (< (count batch) batch-size)
-                      (let [ticket ^AtomicLong (status-pub/get-ticket spub)
-                            ticket-val ^long (.get ticket)
-                            position (.position header)
-                            ticket? (and (< ticket-val position)
-                                         (.compareAndSet ticket ticket-val position))]
-                        (.addAndGet read-bytes length)
-                        (when ticket? (sdec/read-segments! seg-dec batch messaging-decompress))
-                        ControlledFragmentHandler$Action/CONTINUE)
-
-                      ;; we've read a full batch worth
-                      ControlledFragmentHandler$Action/ABORT))
+                  (do (when (nil? batch) (set! batch (transient [])))
+                      (check-correlation-id-alignment aligned header)
+                      (if (< (count batch) batch-size)
+                        (let [ticket ^AtomicLong (status-pub/get-ticket spub)
+                              ticket-val ^long (.get ticket)
+                              position (.position header)
+                              ticket? (and (< ticket-val position)
+                                           (.compareAndSet ticket ticket-val position))]
+                          (when ticket?
+                            (.addAndGet read-bytes length)
+                            (-> buffer
+                                (sdec/wrap bs (+ offset (bdec/length base-dec)))
+                                (sdec/read-segments! batch messaging-decompress)))
+                          ControlledFragmentHandler$Action/CONTINUE)
+
+                        ;; we've read a full batch worth
+                        ControlledFragmentHandler$Action/ABORT))

                   (nil? spub)
                   ControlledFragmentHandler$Action/CONTINUE
@@ -285,7 +287,7 @@
                     ControlledFragmentHandler$Action/ABORT)

                   (= msg-type t/ready-id)
-                  ;; pre-lookup ticket for fast dispatch
+                  ;; pre-lookup ticket for fast dispatch later
                   (let [ticket (lookup-ticket ticket-counters replica-version short-id session-id)]
                     (-> spub
                         (status-pub/set-session-id! session-id ticket)


create fix

create fix

--- joplin.core/src/joplin/core.clj
+++ joplin.core/src/joplin/core.clj
@@ -134,7 +134,8 @@
                     (clojure.string/replace migration-id "-" "_")
                     ".clj")]
       (println "creating" path)
-      (spit path (format "(ns %s
+      (try
+        (spit path (format "(ns %s
   (:use [%s]))

 (defn up [db]
@@ -147,4 +148,6 @@
 " (apply str (interpose "."
                         (concat
                          (-> (:migrator target) (clojure.string/split #"/") rest)
-                         [migration-id]))) ns)))))
+                         [migration-id]))) ns))
+        (catch Exception e
+          (println "Error creating file" path))))))


don't remove thread from app-state when hiding

--- src/chat/client/store.cljs
+++ src/chat/client/store.cljs
@@ -131,7 +131,6 @@
   (transact! [:user :open-thread-ids] #(conj % (thread :id))))

 (defn hide-thread! [thread-id]
-  (transact! [:threads] #(dissoc % thread-id))
   (transact! [:user :open-thread-ids] #(disj % thread-id)))

 (defn id->thread [thread-id]


:sparkles: Add watch:tests command to tools.clj script.

--- frontend/tools.clj
+++ frontend/tools.clj
@@ -130,12 +130,9 @@
   (task ["dbg-dist:main"])
   (task ["dbg-dist:worker"]))

-
-
-
 ;; --- Tests Tasks

-(defmethod task "build-tests"
+(defmethod task "build:tests"
   [& args]
   (api/build (api/inputs "src" "test")
              (assoc default-build-options
@@ -146,6 +143,30 @@
                     :output-to "target/tests/main.js"
                     :output-dir "target/tests/main"
                     :optimizations :none)))
+
+(defmethod task "watch:tests"
+  [args]
+  (println "Start watch loop...")
+  (letfn [(run-tests []
+            (let [{:keys [out err]} (shell/sh "node" "target/tests/main.js")]
+              (println out err)))
+          (start-watch []
+            (try
+              (api/watch (api/inputs "src" "test")
+                         (assoc default-build-options
+                                :main 'uxbox.tests.main
+                                :watch-fn run-tests
+                                :target :nodejs
+                                :source-map true
+                                :output-to "target/tests/main.js"
+                                :output-dir "target/tests/main"
+                                :optimizations :none))
+              (catch Exception e
+                (println "ERROR:" e)
+                (Thread/sleep 2000)
+                start-watch)))]
+    (trampoline start-watch)))
+

 ;; --- Figwheel Config & Tasks


code review comment

code review comment

--- src/thesis/clausal_normal_form.clj
+++ src/thesis/clausal_normal_form.clj
@@ -18,6 +18,7 @@
       (move-nots-inward transformed)
       (expr-transform [:not [:not "x"]] "x" transformed))))

+; TODO this is not needed anymore, there are no comparisons at this stage
 (defn- flip-not-expressions [predicate]
   (->> predicate
        (expr-transform [:not [:> "x" "y"]] [:<= "x" "y"])


Making switching environment easier

Making switching environment easier

--- src/name_bazaar/ui/db.cljs
+++ src/name_bazaar/ui/db.cljs
@@ -21,17 +21,11 @@
    :load-node-addresses? false
    :server-url "https://api.namebazaar.io"})

-(def mainnet-deployment-config
-  {:node-url "http://localhost:8545"
-   :load-node-addresses? true
-   :server-url "https://api.namebazaar.io"})
-
 (def default-db
   (merge
     district0x.ui.db/default-db
     ;development-config
     production-config
-    ;mainnet-deployment-config
     {:active-page (d0x-ui-utils/match-current-location constants/routes)
      :smart-contracts smart-contracts
      :now (t/now)


take a single item or a collection, of either point keywords or swiss ephemeris id numbers, which can be mixed, and return a lazy sequence of results

--- src/clj/ephemeris/core.clj
+++ src/clj/ephemeris/core.clj
@@ -2,18 +2,21 @@
   (:require [ephemeris.points :refer (lookup)])
   (:import (swisseph SwissEph SweDate SweConst)))

-(defn calc-now [what]
-  (let [sw (SwissEph.)
+(defn calc-now [stuff]
+  (let [s (flatten [stuff])
+        sw (SwissEph.)
         sd (SweDate.)
         jd (.getJulDay sd)
-        res (double-array 6)
-        err (StringBuffer.)]
-    (do
-      (.swe_calc_ut sw jd
-                    what
-                    (. SweConst SEFLG_SPEED)
-                    res
-                    err)
-      {(lookup what) {:lon (aget res 0)
-                      :lat (aget res 1)
-                      :sdd (aget res 3)}})))
+        flag (. SweConst SEFLG_SPEED)]
+    (for [i s]
+      (let [what (if (keyword? i) (lookup i) i)
+            res (double-array 6)
+            err (StringBuffer.)
+            rc (.swe_calc_ut sw jd
+                what
+                flag
+                res
+                err)]
+        {(lookup what) {:lon (aget res 0)
+                        :lat (aget res 1)
+                        :sdd (aget res 3)}}))))


implement Waiver

implement Waiver

--- src/clj/game/cards-ice.clj
+++ src/clj/game/cards-ice.clj
@@ -219,7 +219,7 @@

    "Asteroid Belt"
    (space-ice end-the-run)
-
+
    "Bandwidth"
    {:abilities [{:msg "give the Runner 1 tag"
                  :effect (effect (tag-runner :runner 1)
@@ -260,7 +260,7 @@
                                       (move state side card
                                             (conj (server->zone state target) :ices))
                                       (update-run-ice state side))})]}
-
+
    "Burke Bugs"
    {:abilities [(trace-ability 0 (assoc trash-program :not-distinct true
                                         :player :runner
@@ -277,7 +277,7 @@

    "Changeling"
    (morph-ice "Barrier" "Sentry" end-the-run)
-
+
    "Checkpoint"
    {:effect take-bad-pub
     :abilities [(trace-ability 5 {:label "Do 3 meat damage when this run is successful"
@@ -304,7 +304,7 @@
       :events {:runner-turn-ends ab
                :corp-turn-ends ab}
       :abilities [end-the-run]})
-
+
    "Clairvoyant Monitor"
    {:abilities [(do-psi {:label "Place 1 advancement token and end the run"
                          :player :corp
@@ -439,7 +439,7 @@

    "Gemini"
    (constellation-ice (do-net-damage 1))
-
+
    "Grim"
    {:effect take-bad-pub
     :abilities [trash-program]}
@@ -706,7 +706,7 @@
    "Orion"
    ;; TODO: wormhole subroutine
    (space-ice trash-program end-the-run)
-
+
    "Pachinko"
    {:abilities [{:label "End the run if the Runner is tagged"
                  :req (req tagged)
@@ -847,7 +847,7 @@

    "Taurus"
    (constellation-ice trash-hardware)
-
+
    "TMI"
    {:trace {:base 2
             :msg "keep TMI rezzed"
@@ -927,7 +927,21 @@

    "Virgo"
    (constellation-ice give-tag)
-
+
+   "Waiver"
+   {:abilities [(trace-ability 5 {:label "Reveal the Runner's Grip and trash cards"
+                                  :msg (msg "reveal all cards in the Runner's Grip: " (join ", " (map :title (:hand runner)))
+                                            ". Cards with a play/install cost less than or equal to " (- target (second targets))
+                                            " will be trashed")
+                                  :effect (req (let [delta (- target (second targets))]
+                                                 (doseq [c (:hand runner)]
+                                                   (when (<= (:cost c) delta)
+                                                     (resolve-ability
+                                                       state side
+                                                       {:msg (msg "trash " (:title c))
+                                                        :effect (effect (trash c))}
+                                                      card nil)))))})]}
+
    "Wall of Static"
    {:abilities [end-the-run]}

@@ -955,7 +969,7 @@
    "Wormhole"
    ;; TODO: create an ability for wormhole
    (space-ice)
-
+
    "Wotan"
    {:abilities [end-the-run]}


recompile protobufs if src or class dir is older than proto dir.

--- src/clj/protobuf/tasks.clj
+++ src/clj/protobuf/tasks.clj
@@ -47,12 +47,16 @@
             (recur (into files (proto-dependencies proto-file)))))))))

 (defn modtime [dir]
-  (apply max (map #(.lastModified %) (file-seq (file dir)))))
+  (let [files (rest (file-seq (file dir)))]
+    (if (empty? files)
+      0
+      (apply max (map #(.lastModified %) files)))))

 (defn protoc
   ([protos] (protoc protos "build/protosrc"))
   ([protos dest]
-     (when (> (modtime "proto") (modtime dest))
+     (when (or (> (modtime "proto") (modtime dest))
+               (> (modtime "proto") (modtime "classes")))
        (doseq [proto protos]
          (log "compiling" proto "to" dest)
          (extract-dependencies (file "proto" proto))


fix bug in assert-expr extension

fix bug in assert-expr extension

--- src/clojure/fudje/core.clj
+++ src/clojure/fudje/core.clj
@@ -18,12 +18,16 @@
                                  [probably-expected# probably-supplied#]
                                  [probably-supplied# probably-expected#]) ;; make sure we got the order right

-         [only-expected# only-value# both#] (data/diff expected# supplied#)]
+         [only-expected# only-value# both#] (data/diff expected# supplied#)
+         failure# (boolean (cond-> only-expected#
+                                   (coll? only-expected#) seq))]
      (if only-expected#
        (test/do-report {:type :fail, :message ~msg :expected expected#, :actual (list
                                                                                '~'found only-value#
                                                                                '~'instead-of only-expected#)})
-       (test/do-report {:type :pass, :message ~msg :expected expected#, :actual both#}))))
+       (test/do-report {:type :pass, :message ~msg :expected expected#, :actual both#}))
+     (not failure#)))
+
 ;================================================================================================================

 (defn- apply-mock [mock args]


Addresses #563 by configuring Log4J not to swallow exceptions.

--- src/onyx/log/zookeeper.clj
+++ src/onyx/log/zookeeper.clj
@@ -1,6 +1,7 @@
 (ns onyx.log.zookeeper
   (:require [clojure.core.async :refer [chan >!! <!! close! thread]]
             [com.stuartsierra.component :as component]
+            [org.apache.log4j BasicConfigurator]
             [taoensso.timbre :refer [fatal warn info trace]]
             [onyx.log.curator :as zk]
             [onyx.extensions :as extensions]
@@ -96,6 +97,7 @@

   (start [component]
     (taoensso.timbre/info "Starting ZooKeeper" (if (:zookeeper/server? config) "server" "client connection. If Onyx hangs here it may indicate a difficulty connecting to ZooKeeper."))
+    (BasicConfigurator/configure)
     (let [onyx-id (:onyx/tenancy-id config)
           server (when (:zookeeper/server? config) (TestingServer. (int (:zookeeper.server/port config))))
           conn (zk/connect (:zookeeper/address config))]


adding parameter metadata to test gui

adding parameter metadata to test gui

--- src/overtone/inst/drum.clj
+++ src/overtone/inst/drum.clj
@@ -4,6 +4,21 @@

 (definst kick [freq 80 mod-freq 5 mod-index 5
                 sustain 0.4 amp 0.8 noise 0.025]
+  (let [pitch-contour (line:kr (* 2 freq) freq 0.02)
+        drum (lpf (sin-osc pitch-contour (sin-osc mod-freq (/ mod-index 1.3))) 1000)
+        drum-env (env-gen (perc 0.005 sustain) :action FREE)
+        hit (hpf (* noise (white-noise)) 500)
+        hit (lpf hit (line 6000 500 0.03))
+        hit-env (env-gen (perc))]
+    (* amp (+ (* drum drum-env) (* hit hit-env)))))
+
+
+(definst kick2 [freq {:default 80 :min 10 :max 20000 :step 1}
+                amp {:default 0.8 :min 0.001 :max 1.0 :step 0.001}
+                mod-freq {:default 5 :min 0.001 :max 10.0 :step 0.01}
+                mod-index {:default 5 :min 0.001 :max 10.0 :step 0.01}
+                sustain {:default 0.4 :min 0.001 :max 1.0 :step 0.001}
+                noise {:default 0.025 :min 0.001 :max 1.0 :step 0.001}]
   (let [pitch-contour (line:kr (* 2 freq) freq 0.02)
         drum (lpf (sin-osc pitch-contour (sin-osc mod-freq (/ mod-index 1.3))) 1000)
         drum-env (env-gen (perc 0.005 sustain) :action FREE)
@@ -32,7 +47,8 @@
         snd (* snd (env-gen (perc attack release 1 -10) :action FREE))]
     (* 2 snd amp)))

-(definst c-hat [amp 0.3 t 0.07]
+(definst c-hat [amp {:default 0.1 :min 0.001 :max 1.0 :step 0.001}
+                t   {:default 0.07 :min 0.001 :max 1.0 :step 0.001}]
   (let [env (env-gen (perc 0.001 t) 1 1 0 1 FREE)
         noise (white-noise)
         sqr (* (env-gen (perc 0.01 0.04)) (pulse 880 0.2))


free up o-hats upon completion of the envelopes

--- src/overtone/inst/drum.clj
+++ src/overtone/inst/drum.clj
@@ -41,13 +41,13 @@
 (definst o-hat [amp 0.4 t 0.3 low 6000 hi 2000]
   (let [low (lpf (white-noise) low)
         hi (hpf low hi)
-        env (line 1 0 t)]
+        env (line 1 0 t :action :free)]
     (* env hi)))

 (definst o-hat-demo [amp 0.4 t 0.3 low 6000 hi 2000]
   (let [low (lpf (white-noise) (mouse-x 100 20000))
         hi (hpf low (mouse-y 20 20000))
-        env (line 1 0 t)]
+        env (line 1 0 t :action :free)]
     (* env hi)))

 (definst round-kick [amp 0.5 decay 0.6 freq 65]


beef up load-sample docstring

beef up load-sample docstring

--- src/overtone/sc/sample.clj
+++ src/overtone/sc/sample.clj
@@ -48,6 +48,12 @@

     ; load a sample a
     (load-sample \"/home/rosejn/studio/samples/kit/boom.wav\")
+
+  Takes optional params :start and :size. Allocates buffer to number of channels
+  of file and number of samples requested (:size), or fewer if sound file is
+  smaller than requested. Reads sound file data from the given starting frame
+  in the file (:start). If the number of frames argument is less than or equal
+  to zero, the entire file is read.

   "
   [path & args]


More tests

More tests

--- test/circle/model/test_project.clj
+++ test/circle/model/test_project.clj
@@ -1,4 +1,4 @@
-(ns circle.model.test_project
+(ns circle.model.test-project
   (:use circle.model.project)
   (:require [circle.backend.build.test-utils :as test])
   (:use midje.sweet))
@@ -6,4 +6,12 @@
 (test/ensure-test-project)

 (fact "ssh-key-for-url finds the key for dummy project"
-  (ssh-key-for-url "https://github.com/arohner/circle-dummy-project") => truthy)+  (ssh-key-for-url "https://github.com/arohner/circle-dummy-project") => truthy)
+
+(fact "get-by-url works"
+  (test/ensure-test-project)
+  (let [url "https://github.com/arohner/circle-dummy-project"]
+    (get-by-url! url) => (contains {:vcs_url url})))
+
+(fact "next-build-num works"
+  (next-build-num (get-by-url! "https://github.com/arohner/circle-dummy-project")) => integer?)


Enable programmatically opening or closing panel

--- src/day8/re_frame_10x.cljs
+++ src/day8/re_frame_10x.cljs
@@ -258,3 +258,6 @@

 (defn ^:export factory-reset! []
   (rf/dispatch [:settings/factory-reset]))
+
+(defn ^:export show-panel! [show-panel?]
+  (rf/dispatch [:settings/show-panel? show-panel?]))


Added new `swap` function to list of available tokens

--- src/simple_symbolic_regression_clojure/gp.clj
+++ src/simple_symbolic_regression_clojure/gp.clj
@@ -115,7 +115,7 @@
 ; TODO: This is too problem specific and should be in core not in gp,
 ; which will require making it an argument to make-baby?
 (def token-generator
-  ['(rand-int 100) :x :+ :- :* :÷])
+  ['(rand-int 100) :x :+ :- :* :÷ :swap])

 (defn make-unscored-baby


test sandbox

test sandbox

--- test/shuppet/unit/core_shuppet.clj
+++ test/shuppet/unit/core_shuppet.clj
@@ -16,6 +16,7 @@
     "this is a test config"))

 (def configuration @#'shuppet.core-shuppet/configuration)
+(def execute-string @#'shuppet.core-shuppet/execute-string)

 (fact-group :unit
             (fact "app list can be customized"
@@ -24,4 +25,11 @@

             (fact "configuration source can be customized"
                   (binding [*configuration*  (TestConfig.)]
-                    (configuration ..env.. ..name..) => "this is a test config")))
+                    (configuration ..env.. ..name..) => "this is a test config"))
+
+            (fact "string is correctly evaluated"
+                  (execute-string "(def val \"ok\")val") => "ok")
+
+            (fact "long running code times out"
+                  (execute-string "(Thread/sleep 600000000)") => (throws java.util.concurrent.TimeoutException))
+            )


Update the table-created call to use a db name

--- src/doctopus/db/schema.clj
+++ src/doctopus/db/schema.clj
@@ -25,9 +25,10 @@

 (defn table-created?
   "check our database for a table"
-  [table-name]
-  (-> (sql/query db-spec [(str "select count(*) from information_schema.tables "
-                               "where table_name='" table-name "'")])
+  [db-name table-name]
+  (-> (sql/query (build-db-spec-by-name db-name)
+                 [(str "select count(*) from information_schema.tables "
+                       "where table_name='" table-name "'")])
       first :count pos?))

 (def head-schema


added back in sexp assertion

added back in sexp assertion

--- test/vineyard/hello_world_test.clj
+++ test/vineyard/hello_world_test.clj
@@ -33,8 +33,6 @@
   (let [parsed   (parser/parse (source))
         compiled (compiler/compile parsed)
         ran      (run compiled)]
-    ;; This is intermetently failing for no good reason. The things that should
-    ;; be equal are printing as equal.
-    ;; (is (= (sexp) parsed))
+    (is (= (sexp) parsed))
     (is (= (str/trim (js)) compiled))
     (is (= (error-free (out)) ran))))


Missing arg for Join

Missing arg for Join

--- src/aurora/btree.cljs
+++ src/aurora/btree.cljs
@@ -526,7 +526,7 @@
                                   (when (true? (aget iterator->var->present? i j))
                                     (apush var-iterators (aget join-iterators i))))
                                 var-iterators))
-        join (Join. seek-key join-iterators var->iterators)]
+        join (Join. seek-key join-iterators var->iterators false)]
     (.reset join)
     join))


test (empty?) rather than (empty? (seq)): should be faster

--- src/babel/forest.cljc
+++ src/babel/forest.cljc
@@ -243,7 +243,7 @@
                                (lazy-cat shuffled-candidate-lexical-complements phrasal-complements)
                                (lazy-cat phrasal-complements shuffled-candidate-lexical-complements)))))]
           (let [run-time (- (current-time) start-time)]
-            (if (empty? (seq return-val))
+            (if (empty? return-val)

               ;; else, no complements could be added to this bolt: Throw an exception
               (let [message


Fix missing set.

Fix missing set.

--- src/forces_assemble/db.clj
+++ src/forces_assemble/db.clj
@@ -1,5 +1,6 @@
-(ns forces-assemble.db
-  (:require [forces-assemble.config :as config]
+(ns focrces-assemble.db
+  (:require [clojure.set]
+            [forces-assemble.config :as config]
             [environ.core :refer [env]]
             [monger.core :as mg]
             [monger.collection :as mc]


fixed display of stopped uploads

fixed display of stopped uploads

--- src/frontend/renderer.cljs
+++ src/frontend/renderer.cljs
@@ -81,7 +81,7 @@
                       (if (:paused? ((:uploads @app-state/app-state) (.-clientid data)))
                         (dom/button #js {:onClick #(core/resume-upload!  (.-clientid data))} "RESUME")
                         (dom/button #js {:onClick #(core/pause-upload!   (.-clientid data))} "PAUSE"))))
-                  (if (:stopped? ((:uploads @app-state/app-state) (.-clientid data)))
+                  (if-not (:started? ((:uploads @app-state/app-state) (.-clientid data)))
                     "STOPPED!")
                   (((:users @app-state/app-state) (.-uploaderid data)) "name")
                   " - " (* 100 (/ (.-bytesreceived data) (.-totalsize data))) "% - "


removed occurrences of client-id in renderer

--- src/frontend/renderer.cljs
+++ src/frontend/renderer.cljs
@@ -138,10 +138,8 @@
       (let [uploads-data (map (fn [id]
                                 (let [upload-info (first (filter #(= id (.-id %1))
                                                                  (vals (:current-uploads-info data))))
-                                      client-id (when-not (nil? upload-info)
-                                                  (.-clientid upload-info))
                                       file-hash-info ((:room-file-hashes data) id)]
-                                  [((:uploads data) client-id) upload-info file-hash-info]))
+                                  [((:uploads data) id) upload-info file-hash-info]))
                               (:room-uploads-order data))]
         (apply dom/div nil
           (om/build-all build-upload-id-view


CMR-3156: Added more temporary logging.

CMR-3156: Added more temporary logging.

--- oracle-lib/src/cmr/oracle/connection.clj
+++ oracle-lib/src/cmr/oracle/connection.clj
@@ -52,14 +52,15 @@
       (info "Database conn info" (db-conn-info-safe-for-logging oracle-store))
       {:ok? false :problem (.getMessage e)})
     (catch java.lang.NoClassDefFoundError e
-      (let [msg (.getMessage e)]
-        (error "tempoary logging:" e)
-        (if (re-matches #".*Could not initialize class oracle.security.*" msg)
-          ;; shut down the app so that it could be restarted by puppet
-          (do (error "Caught java.lang.NoClassDefFoundError" e)
-            (when (shutdown-on-oracle-class-error)
-              (System/exit 0)))
-          (throw e))))))
+      (error "temporary logging:" e)
+      (if (re-matches #".*Could not initialize class oracle.security.*" (.getMessage e))
+        ;; shut down the app so that it could be restarted by puppet
+        (do (error "Caught java.lang.NoClassDefFoundError" e)
+          (when (shutdown-on-oracle-class-error)
+            (System/exit 0)))
+        (throw e)))
+    (catch Throwable e
+      (error "temporary logging, caught throwable:" e))))

 (defn health
   "Returns the oracle health with timeout handling."


Include submission review fields if submission-review? is true

Signed-off-by: ivermac <cd640042a8f3b0ff08bacdf4feae34fdd495051d@gmail.com>

--- src/hatti/views/table.cljs
+++ src/hatti/views/table.cljs
@@ -161,7 +161,8 @@
                   owner]
            :or {get-label? true}}]
   (let [has-hxl? (any? false? (map #(nil? (-> % :instance :hxl)) form))
-        columns (for [field (all-fields form)]
+        columns (for [field (cond-> (all-fields form)
+                              submission-review?  submission-review-fields)]
                   (let [{:keys [name type full-name]
                          {:keys [hxl]} :instance} field
                         label (if get-label? (get-label field language) name)
@@ -180,8 +181,7 @@
                      :hxl hxl}))]
     (clj->js (cond-> columns
                (not hide-actions-column?)
-               (conj (actions-column owner has-hxl?))
-               submission-review?  submission-review-fields))))
+               (conj (actions-column owner has-hxl?))))))

 (defn init-sg-pager [grid dataview]
   (let [Pager (.. js/Slick -Controls -Pager)]
@@ -394,8 +394,7 @@
     (.setItems dataview
                (clj->js
                 (cond-> data
-                  submission-review?
-                  replace-review-num-status-with-text-status))
+                  submission-review? replace-review-num-status-with-text-status))
                _id)
     (resizeColumns grid)
     [grid dataview]))
@@ -467,12 +466,15 @@
                      :name  [:strong "Name"]}
             {:keys [flat-form]} (om/get-shared owner)
             new-language (:current (om/observe owner (shared/language-cursor)))
+            {:keys [submission-review?]} @shared/app-state
             colset! #(put! shared/event-chan
                            {:new-columns
-                            (flat-form->sg-columns flat-form
-                                                   :get-label? (= :label %)
-                                                   :language   new-language
-                                                   :owner owner)})]
+                            (flat-form->sg-columns
+                             flat-form
+                             :get-label? (= :label %)
+                             :language   new-language
+                             :submission-review? submission-review?
+                             :owner owner)})]
         (when (not= new-language language)
           (om/set-state! owner :language new-language)
           (colset! field-key))


Fix test flakiness on CI.

Fix test flakiness on CI.


Bumps version to 1.51.7-SNAPSHOT

Bumps version to 1.51.7-SNAPSHOT

--- scheduler/project.clj
+++ scheduler/project.clj
@@ -13,7 +13,7 @@
 ;; See the License for the specific language governing permissions and
 ;; limitations under the License.
 ;;
-(defproject cook "1.51.6"
+(defproject cook "1.51.7-SNAPSHOT"
   :description "This launches jobs on a Mesos cluster with fair sharing and preemption"
   :license {:name "Apache License, Version 2.0"}
   :dependencies [[org.clojure/clojure "1.8.0"]


Remove print

Remove print

--- src/lt/objs/langs/clj.cljs
+++ src/lt/objs/langs/clj.cljs
@@ -673,7 +673,6 @@
                               :editor.eval.clj.result
                               :editor.eval.cljs.result}
                   :reaction (fn [editor res]
-                              (prn (:client @editor))
                               (when (not= :hints (-> res :meta :result-type)) ;; dont recurse endlessly
                                 (when-let [client (-> @editor :client :default)] ;; dont eval unless we're already connected
                                   (when @client


fix events handling on hosted cards

fix events handling on hosted cards

--- src/clj/game/core.clj
+++ src/clj/game/core.clj
@@ -1005,7 +1005,8 @@
                          :zone '(:onhost))] ;; hosted cards should not be in :discard or :hand etc
      (update! state side (update-in card [:hosted] #(conj % c)))
      (when-let [events (:events (card-def target))]
-       (register-events state side events c))
+       (when installed
+         (register-events state side events c)))
      c)))

 (defn runner-install


fix core download

fix core download

--- src/cljs/sm/core.cljs
+++ src/cljs/sm/core.cljs
@@ -108,26 +108,25 @@
                        l available-subtitles] [s l])]
     (r/reduce (p-upload-subtitle notify) query (r/spool variants))))

-(defn- p-download [{:keys [download] :as query}]
+(defn- p-download [{:keys [download basepath] :as query}]
   (go-catch
-    (let [download (<? (download-subtitle download (node/create-write-stream target-path)))]
+    (let [target-path (subtitle-target-path basepath (sm/subtitle-language (:subtitle download)))
+          download (<? (download-subtitle download (node/create-write-stream target-path)))]
       (-> query
           (assoc :download download)
           (assoc :view-path (:downloaded-path download))))))

-(defn- p-run-search [{:keys [search-languages basepath] :as query} notify]
+(defn- p-run-search [{:keys [search-languages] :as query} notify]
   (go-catch
     (if (seq search-languages)
       (do
         (<! (notify query :search))
-        (if-let [{:keys [subtitle] :as result} (<? (find-first query))]
-          (let [target-path (subtitle-target-path basepath (sm/subtitle-language subtitle))
-                result (assoc result :target target-path)]
-            (-> query
-                (assoc :download result)
-                (notify :download) <!
-                (p-download) <?
-                (notify :downloaded) <!))
+        (if-let [result (<? (find-first query))]
+          (-> query
+              (assoc :download result)
+              (notify :download) <!
+              (p-download) <?
+              (notify :downloaded) <!)
           (<! (notify query :not-found))))
       (<! (notify query :unchanged)))))

@@ -148,7 +147,7 @@
              (notify :info) <!
              (p-upload-local-subtitles notify) <?
              (p-run-search notify) <?)
-         (catch js/Error e (>! c [:error (.-stack e)]))
+         (catch js/Error e (>! c [:error e]))
          (finally (close! c))))
      nil)
    c))


Remove redundant test, remove commented out test

--- test/datascript/test/pull_api.cljs
+++ test/datascript/test/pull_api.cljs
@@ -115,20 +115,9 @@
     (testing "Reverse component references yield a single result"
       (is (= {:name "Part A.A" :_part {:db/id 10}}
              (d/pull test-db [:name :_part] 11))))
-
-    (testing "Reverse component references yield a single result"
-      (is (= {:name "Part A.A" :_part {:db/id 10}}
-             (d/pull test-db [:name :_part] 11))))

     (testing "Like explicit recursion, expansion will not allow loops"
-      (is (= rpart (d/pull recdb '[:name :part] 10))))
-
-    (testing "We don't expect this to actually pass to be honest, since
-to be honest I'm really not sure what constitutes sensible behaviour in
-this situation - this test will at least print out the result we currently
-get."
-      ;;(is (= :??? (d/pull mutdb '[:name :part :spec] 10)))
-      )))
+      (is (= rpart (d/pull recdb '[:name :part] 10))))))

 (deftest test-pull-wildcard
   (is (= {:db/id 1 :name "Petr" :aka ["Devil" "Tupen"]


Fix test

Fix test


Extracted helper for getting the pages in the test.

--- test/ahnentafel/server/handler_test.clj
+++ test/ahnentafel/server/handler_test.clj
@@ -7,25 +7,26 @@

 (deftest handlers
   (let [app-data {:version "x.x.x"}
-        handler (make-handler app-data)]
+        handler (make-handler app-data)
+        get-page (fn [url] (handler (mock/request :get url)))]
+
    (testing "home page"
      (with-redefs [pages/home (fn [data] (str "homepage: " data))]
-       (let [response (handler (mock/request :get "/"))]
+       (let [response (get-page "/")]
          (is (= (:status response) 200))
          (is (= (:body response)
                 (str "homepage: " app-data))))))

    (testing "404 response"
-     (let [response (handler (mock/request :get "/unknown"))]
+     (let [response (get-page "/unknown")]
        (is (= (:status response) 404))
        (is (.contains (:body response) "/unknown not found."))
-       (is (= (get-in response [:headers  "Content-Type"])
-              "text/html"))))
+       (is (= (get-in response [:headers  "Content-Type"]) "text/html"))))

    (testing "record page"
      (with-redefs [pages/record (fn [data & xref]
                                   (str "record page: " data " " xref))]
-       (let [response (handler (mock/request :get "/records/@I23@"))]
+       (let [response (get-page "/records/@I23@")]
          (is (= (:status response) 200))
          (is  (= (:body response)
                  (str "record page: " app-data " " '("@I23@")))))))))


CMR-1381 Removes unused function.

CMR-1381 Removes unused function.

--- transmit-lib/src/cmr/transmit/metadata_db.clj
+++ transmit-lib/src/cmr/transmit/metadata_db.clj
@@ -206,13 +206,6 @@
                  :headers {config/token-header (config/echo-system-token)}
                  :throw-exceptions false})))

-(defn update-provider
-  [context provider]
-  (let [{:keys [status body]} (update-provider-raw context provider)]
-    (when-not (contains? #{200 404 400} status)
-      (errors/internal-error!
-       (format "Failed to update provider status: %s body: %s" status body)))))
-
 (defn delete-provider-raw
   "Delete the provider with the matching provider-id from the CMR metadata repo,
   returns the raw response coming back from metadata-db."


CMR-4841: Address Leo's comment after merge. (#497)

--- transmit-lib/src/cmr/transmit/metadata_db.clj
+++ transmit-lib/src/cmr/transmit/metadata_db.clj
@@ -334,11 +334,11 @@
         ;; For CMR-4841 - log the first 255 characters of the response body if
         ;; the parsing of the html throws exception.
         response-body (:body response)
-        response-body-logged (subs response-body 0 (min 255 (count response-body)))
         body (try
                (json/decode response-body)
                (catch Exception e
-                 (warn "Exception occurred while parsing the response body: " response-body-logged)
+                 (warn "Exception occurred while parsing the response body: "
+                       (util/trunc response-body 255))
                  (throw e)))
         {:strs [concept-id revision-id]} body]
     (case status


Add missing quote in log output (#702)

Add missing quote in log output (#702)

--- figwheel-main/src/figwheel/main.cljc
+++ figwheel-main/src/figwheel/main.cljc
@@ -57,7 +57,8 @@
       (log/info (str "Compiling build"
                      (when id? (str " " id?))
                      " to \""
-                     (or output-to output-dir)))
+                     (or output-to output-dir)
+                     "\""))
       (try
         (let [warnings (volatile! [])
               out *out*


more printing

more printing

--- src/deltalog/core.clj
+++ src/deltalog/core.clj
@@ -1,26 +1,41 @@
 (ns deltalog.core
   (:import [com.google.code.or OpenReplicator]
            [com.google.code.or.binlog BinlogEventListener]
-           [com.google.code.or.binlog.impl.event WriteRowsEvent UpdateRowsEvent])
+           [com.google.code.or.binlog.impl.event WriteRowsEvent UpdateRowsEvent
+            TableMapEvent QueryEvent DeleteRowsEvent])
   (:gen-class))

-(defn write-rows [table timestamp rows]
-  (spit (str "/Users/chris/raw/" table) (str "t=" timestamp " "(clojure.string/join ", " (map #(.getColumns %) rows)) "\n") :append true))
+(defn write-event [table timestamp value]
+  (let [out (str "t=" timestamp " " value "\n")]
+;    (spit (str "/Users/chris/raw/" table) out :append true)
+    (print out)))

 (defmulti handle-event class)

 (defmethod handle-event WriteRowsEvent
   [e]
-  (write-rows (.getTableId e) (.. e getHeader getTimestamp) (.getRows e)))
+  (write-event (.getTableId e) (.. e getHeader getTimestamp) e))

 (defmethod handle-event UpdateRowsEvent
   [e]
-  (write-rows (.getTableId e) (.. e getHeader getTimestamp) (.. e getRows getAfter)))
+  (write-event (.getTableId e) (.. e getHeader getTimestamp) e))
+
+(defmethod handle-event DeleteRowsEvent
+  [e]
+  (write-event (.getTableId e) (.. e getHeader getTimestamp) e))
+
+(defmethod handle-event TableMapEvent
+  [e]
+  (write-event (.getTableId e) (.. e getHeader getTimestamp) e))
+
+(defmethod handle-event QueryEvent
+  [e]
+  (write-event (.getTableId e) (.. e getHeader getTimestamp) e))

 (defmethod handle-event :default
   [e]
-  (println "skip"))
+  (println (str e "\n")))

 (deftype MyListener []
   BinlogEventListener
@@ -42,4 +57,4 @@
     (.setBinlogEventListener listener)))

 (defn -main []
-  (.start (replicator "mysql-bin.000002" 2129629 (MyListener.))))
+  (.start (replicator "mysql-bin.000003" 226096 (MyListener.))))


Remove profile speed test

Remove profile speed test

--- test/com/wsscode/pathom/system_test.clj
+++ test/com/wsscode/pathom/system_test.clj
@@ -113,30 +113,6 @@
   [{{::pc/keys [output]} ::pc/resolver-data} _]
   (pct/parser (assoc pct/parser-env ::pt/include-nils? false) output))

-(defn profile-speed-props [env]
-  (let [props (gen/generate (gen/vector-distinct gen/keyword-ns {:min-elements 8
-                                                                 :max-elements 100})
-                4)]
-    (props/for-all [query (s.query/make-gen {::s.query/gen-property
-                                             (fn [_] (gen/elements props))
-
-                                             ::s.query/gen-params
-                                             (fn [_] (gen/map gen/keyword gen/simple-type-printable {:max-elements 3}))}
-                            ::s.query/gen-query)]
-      (let [plugins       [pp/profile-plugin]
-            parser        (p/parser {::p/plugins plugins
-                                     :mutate     pt/mutate-fn})
-
-            async-parser  (p/async-parser {::p/plugins plugins
-                                           :mutate     pt/mutate-fn})
-            {:keys [async-reader] :as env} env]
-        (= (catch-run-parser parser env query)
-           (catch-run-parser (comp <!! async-parser) (assoc env ::p/reader async-reader) query))))))
-
-(test/defspec profile-speed
-  {:max-size 16 :num-tests 30
-   :seed     1530060220973} (profile-speed-props pct/parser-env))
-
 (comment
   (let [props (gen/generate (gen/vector-distinct gen/keyword-ns {:min-elements 8
                                                                  :max-elements 100})


CMR-1412: Removed unused requires

CMR-1412: Removed unused requires

--- system-int-test/test/cmr/system_int_test/search/collection_concept_revision_retrieval_test.clj
+++ system-int-test/test/cmr/system_int_test/search/collection_concept_revision_retrieval_test.clj
@@ -1,15 +1,11 @@
 (ns cmr.system-int-test.search.collection-concept-revision-retrieval-test
   "Integration test for collection concept map retrieval with params"
   (:require [clojure.test :refer :all]
-            [cmr.umm.echo10.collection :as c]
             [cmr.system-int-test.utils.ingest-util :as ingest]
             [cmr.system-int-test.utils.search-util :as search]
             [cmr.system-int-test.utils.index-util :as index]
             [cmr.system-int-test.data2.collection :as dc]
-            [cmr.mock-echo.client.echo-util :as e]
-            [cmr.system-int-test.system :as s]
             [cmr.system-int-test.data2.core :as d]
-            [cmr.system-int-test.utils.dev-system-util :as dev-sys-util]
             [cmr.common.util :refer [are2]]
             [cmr.transmit.config :as transmit-config]))


Use deftype for user data events.

Use deftype for user data events.

--- frontend/src/uxbox/main/data/users.cljs
+++ frontend/src/uxbox/main/data/users.cljs
@@ -20,7 +20,7 @@

 ;; --- Profile Fetched

-(defrecord ProfileFetched [data]
+(deftype ProfileFetched [data]
   ptk/UpdateEvent
   (update [this state]
     (assoc state :profile data)))
@@ -31,7 +31,7 @@

 ;; --- Fetch Profile

-(defrecord FetchProfile []
+(deftype FetchProfile []
   ptk/WatchEvent
   (watch [_ state s]
     (->> (rp/req :fetch/profile)
@@ -44,7 +44,7 @@

 ;; --- Profile Updated

-(defrecord ProfileUpdated [data]
+(deftype ProfileUpdated [data]
   ptk/WatchEvent
   (watch [_ state s]
     (rx/of (profile-fetched data)
@@ -56,7 +56,7 @@

 ;; --- Update Profile

-(defrecord UpdateProfile [data on-success on-error]
+(deftype UpdateProfile [data on-success on-error]
   ptk/WatchEvent
   (watch [_ state s]
     (letfn [(handle-error [{payload :payload}]
@@ -80,7 +80,7 @@

 ;; --- Password Updated

-(defrecord PasswordUpdated []
+(deftype PasswordUpdated []
   ptk/WatchEvent
   (watch [_ state stream]
     (rx/of (uum/info (tr "settings.password-saved")))))
@@ -91,7 +91,7 @@

 ;; --- Update Password (Form)

-(defrecord UpdatePassword [data]
+(deftype UpdatePassword [data]
   ptk/WatchEvent
   (watch [_ state s]
     (let [params {:old-password (:old-password data)
@@ -113,7 +113,7 @@

 ;; --- Update Photo

-(defrecord UpdatePhoto [file done]
+(deftype UpdatePhoto [file done]
   ptk/WatchEvent
   (watch [_ state stream]
     (->> (rp/req :update/profile-photo {:file file})


Make the import robust against garbage in setinfo

there is plenty of garbage in there

--- src/mdr2/abacus/import.clj
+++ src/mdr2/abacus/import.clj
@@ -103,7 +103,11 @@

 (defn cleanup-commercial-production
   [m]
-  (let [volumes (second (re-matches #"\d of (\d+)" (:setInfo m "1 of 1")))
+  (let [;; the quality of this data is so poor that we just assume 1
+        ;; if we get garbage. See select count(*), value from meta
+        ;; where element='setInfo' group by value
+        volumes (or (second (re-matches #"\d of (\d+)" (:setInfo m "1 of 1")))
+                    "1")
         language (string/lower-case (:language m "de"))
         total_time (to-millis (:totalTime m "0:0:0"))]
     (-> m


Use clojure spec to validate response

Use clojure spec to validate response

--- test/github_changelog/git_test.clj
+++ test/github_changelog/git_test.clj
@@ -1,8 +1,10 @@
 (ns github-changelog.git-test
-  (:require [clojure.test :refer [are deftest is testing]]
+  (:require [clojure.spec.alpha :as s]
+            [clojure.test :refer [are deftest is testing]]
             [github-changelog.fs :as fs]
             [github-changelog.git :as sut]
-            [github-changelog.git-helper :as gh]))
+            [github-changelog.git-helper :as gh]
+            [github-changelog.spec :as spec]))

 (def config {:user "user" :repo "repo"})

@@ -82,7 +84,7 @@
         (fs/rm-dir repo)))))

 (deftest initial-commit
-  (let [single-initial-commit? #(= 40 (count (sut/initial-commit %)))]
+  (letfn [(single-initial-commit? [x] (s/conform ::spec/sha x))]
     (testing "single initial commit"
       (let [[repo] (gh/init-repo)]
         (try


Use more readable conf in Cloure clinet

Use more readable conf in Cloure clinet

--- hr-client/hr-clojure/src/infinispan/test.clj
+++ hr-client/hr-clojure/src/infinispan/test.clj
@@ -9,7 +9,8 @@
   "Creates simple HR client, puts key/value into remote server and reads it back"
   [& args]
   (def conf (ConfigurationBuilder.))
-  (.port (.host (.addServer conf) "127.0.0.1") ConfigurationProperties/DEFAULT_HOTROD_PORT)
+  ;;(.port (.host (.addServer conf) "127.0.0.1") ConfigurationProperties/DEFAULT_HOTROD_PORT)
+  (-> (.addServer conf) (.host "127.0.0.1") (.port ConfigurationProperties/DEFAULT_HOTROD_PORT))
   (def cm (RemoteCacheManager. (.build conf)))
   (def cache (.getCache cm))
   (println "Sending key -> value")


Remove temporary fix for #344

Remove temporary fix for #344

--- src/onyx/peer/function.clj
+++ src/onyx/peer/function.clj
@@ -38,17 +38,6 @@
 (defrecord Function [replica peer-replica-view state messenger egress-tasks]

   p-ext/PipelineInput
-
- ;;; Start temp fix for: https://github.com/onyx-platform/onyx/issues/344
-  (ack-segment [this event message-id])
-
-  (retry-segment [this event message-id])
-
-  (pending? [this event message-id])
-
-  (drained? [this event])
-  ;;; End temp fix.
-
   p-ext/Pipeline

   (read-batch


util/s3.clj: restore variadic versions of get-object-*

--- src/org/altlaw/util/s3.clj
+++ src/org/altlaw/util/s3.clj
@@ -70,18 +70,24 @@
              (.getObjectDetails (get-s3) (get-bucket bucket-name)
                                 object-key)))))

-(defn get-object-stream [bucket-name object-key]
-  (catch-s3-errors
-   (let [object (get-object bucket-name object-key)
-         input (.getDataInputStream object)]
-     (if (= (.getContentEncoding object) "gzip")
-       (GZIPInputStream. input)
-       input))))
+(defn get-object-stream
+  ([object]
+     (catch-s3-errors
+      (let [input (.getDataInputStream object)]
+        (if (= (.getContentEncoding object) "gzip")
+          (GZIPInputStream. input)
+          input))))
+  ([bucket-name object-key]
+     (catch-s3-errors
+      (get-object-stream (get-object bucket-name object-key)))))

-(defn get-object-string [bucket-name object-key]
-  (catch-s3-errors
-   (with-open [stream (get-object-stream bucket-name object-key)]
-     (IOUtils/toString stream "UTF-8"))))
+(defn get-object-string
+  ([object]
+     (catch-s3-errors
+      (IOUtils/toString (get-object-stream object) "UTF-8")))
+  ([bucket-name object-key]
+     (catch-s3-errors
+      (IOUtils/toString (get-object-stream bucket-name object-key) "UTF-8"))))

 (defn put-object-stream [bucket-name object-key stream metadata]
   (catch-s3-errors


Add buffer-write-relay!

Add buffer-write-relay!

--- src/overtone/sc/buffer.clj
+++ src/overtone/sc/buffer.clj
@@ -190,6 +190,22 @@
          (throw (Exception. (str "the data you attempted to write to buffer " (:id buf) "was too large for its capacity. Use a smaller data list and/or a lower start index.")))
          (apply snd "/b_setn" (:id buf) start-idx size doubles)))))

+
+(defn buffer-write-relay!
+  "Similar to buffer-write! except it is capable of handling very large
+  buffers by slicing them up and writing each slice separately. Can be
+  very slow."
+  ([buf data] (buffer-write-relay! buf 0 data))
+  ([buf start-idx data]
+     (assert (buffer? buf))
+     (loop [data-left data
+            idx       0]
+       (let [to-write  (take MAX-OSC-SAMPLES data-left)
+             data-left (drop MAX-OSC-SAMPLES data-left)]
+         (when-not (empty? to-write)
+           (buffer-write! buf idx to-write)
+           (recur data-left (+ idx (count to-write))))))))
+
 (defn buffer-fill!
   "Fill a buffer range with a single value. Modifies the buffer in place
   on the server. Defaults to filling in the full buffer unless start and