compiled expression returns previous stuff

--- src/clj/algorithms_clj/macro_initiation.clj
+++ src/clj/algorithms_clj/macro_initiation.clj
@@ -597,7 +597,8 @@
     tree))

 (defprotocol IEvalExpr
-  (eval-expr [this] "Evaluate the expression"))
+  (eval-expr [this] "Evaluate the expression")
+  (expr->data [this] "The form used to create it"))

 (defmacro def-data-flow
   [name tree]
@@ -607,6 +608,7 @@
        IEvalExpr
        ;; (eval-expr [~this] (eval-expr-in-env ~tree ~this))
        (eval-expr [~this] ~(compile-eval-expr tree this))
+       (expr->data [_] (quote ~tree))
        )))

 (def-data-flow Expr [+ :a [* :b :c]])
@@ -614,5 +616,6 @@
 (defn test-data-flow
   []
   (let [e (map->Expr {:a 1 :b 2 :c 3})]
-    (eval-expr e)
-    ))
+    (println (eval-expr e))
+    (println (expr->data e))
+    ))


Work on getting observable collections working.

--- src/clojure/freactive/experimental/dom.cljs
+++ src/clojure/freactive/experimental/dom.cljs
@@ -116,42 +116,60 @@
           (.appendChild parent new-node)))
       new-elem)))

-(defn- do-show-element [parent new-elem cur-elem show]
+(defn- do-show-element [parent new-elem cur-elem {:keys [show shown]
+                                                  :as transitions}]
   (let [new-elem (replace-child parent new-elem cur-elem)]
-    (when-let [show (or show (-get-transition new-elem :show))]
-      (show new-elem))
+    (if-let [show (or show (-get-transition new-elem :show))]
+      (show new-elem
+        (fn [elem] (when shown (shown elem))))
+      (when shown (shown new-elem)))
     new-elem))

 (defn- transition-element
   ([parent new-elem]
    (transition-element parent new-elem nil nil nil))
-  ([parent new-elem {:keys [hide show] :as transitions}]
-   (transition-element parent new-elem nil hide show))
-  ([parent new-elem cur-elem hide show]
+  ([parent new-elem cur-elem {:keys [hide show] :as transitions}]
    (if cur-elem
      (if-let [hide (or hide (-get-transition cur-elem :hide))]
        (hide cur-elem
-         (do-show-element parent new-elem cur-elem show))
-       (do-show-element parent new-elem cur-elem show))
-     (do-show-element parent new-elem cur-elem show))))
+         (do-show-element parent new-elem cur-elem transitions))
+       (do-show-element parent new-elem cur-elem transitions))
+     (do-show-element parent new-elem cur-elem transitions))))
+
+
+(defn- cancel-and-remove-deref-element [parent elem]
+  (reset! (.-cancellation-token elem) true)
+  (.removeChild (as-dom-node parent) (as-dom-node @(.-cur-elem elem))))
+
+(defn remove-child! [parent child]
+  (if (instance? DerefElement child)
+    (cancel-and-remove-deref-element parent child)
+    (let [parent (as-dom-node parent)
+          child (as-dom-node child)]
+      (.removeChild parent child))))

 (defn on-child-ref-invalidated* [parent [add-watch* remove-watch*]
-                                 {:keys [hide show] :as transitions}
+                                 transitions
                                  cancellation-token]
-  (fn on-child-ref-invalidated
-    ([key child-ref _ _]
-     (on-child-ref-invalidated key child-ref))
-    ([cur-elem child-ref]
-     (remove-watch* child-ref cur-elem)
-     (request-animation-frame
-       (fn [_]
-         (when-not @cancellation-token
-           (add-watch* child-ref cur-elem on-child-ref-invalidated)
-           (let [new-elem @child-ref
-                 cur @cur-elem]
-             (when (or (not cur) (not= (-get-element-spec cur) new-elem))
-               (reset! cur-elem
-                 (transition-element parent new-elem cur hide show))))))))))
+  (let [transitions
+        (assoc transitions
+          :shown (fn [new-elem]
+                   (when @cancellation-token
+                     (remove-element! parent new-elem))))]
+    (fn on-child-ref-invalidated
+      ([key child-ref _ _]
+       (on-child-ref-invalidated key child-ref))
+      ([cur-elem child-ref]
+       (remove-watch* child-ref cur-elem)
+       (request-animation-frame
+         (fn [_]
+           (when-not @cancellation-token
+             (add-watch* child-ref cur-elem on-child-ref-invalidated)
+             (let [new-elem @child-ref
+                   cur @cur-elem]
+               (when (or (not cur) (not= (-get-element-spec cur) new-elem))
+                 (reset! cur-elem
+                   (transition-element parent new-elem cur transitions)))))))))))

 (deftype DerefElement [child-ref cur-elem])

@@ -169,7 +187,7 @@
           f ((on-child-ref-invalidated* parent watch-fns transitions
                cancellation-token) cur-elem child)]
       (DerefElement. child cur-elem cancellation-token))
-    (transition-element parent @child transitions)))
+    (transition-element parent @child nil transitions)))

 (defn append-child! [parent child]
   (cond
@@ -209,17 +227,6 @@
 (defn mount! [dom-element child]
   (append-child! dom-element child))

-(defn- cancel-and-remove-deref-element [parent elem]
-  (reset! (.-cancellation-token elem) true)
-  (.removeChild (as-dom-node parent) (as-dom-node @(.-cur-elem elem))))
-
-(defn remove-child! [parent child]
-  (if (instance? DerefElement child)
-    (cancel-and-remove-deref-element parent child)
-    (let [parent (as-dom-node parent)
-          child (as-dom-node child)]
-      (.removeChild parent child))))
-
 ;(defn create-raw [elem-def]
 ;  (let [elem-def
 ;        (cond


4clojure:: practice with the functions :)

--- src/clojure_learning/4clojure-exercises.clj
+++ src/clojure_learning/4clojure-exercises.clj
@@ -562,11 +562,12 @@
       (fn closure-recur [& args]
         (loop [[head-func & tail-funcs] rev-funcs
                result (apply head-func args)]
-            (if (nil? head-func)
+            (if (nil? tail-funcs)
               result
-              (recur tail-funcs (head-func result)))))))
+              (recur tail-funcs ((first tail-funcs) result)))))))

 ((comp-> str - +) 1 2 3)
+((comp-> rest reverse) [1 2 3 4]) ; (3 2 1)

 ;; another option of implementing function composition [comp] is more concise:
 (defn comp->
@@ -588,3 +589,73 @@
 ;; using [reduce] and the "tail-funcs" remained and the initial accumulator -> reduce the result by
 ;; calling the rest funcs on that init-result.
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+;; TRICK to learn:
+;; Why on earth this application of [reverse] does NOT throw a compile exception?
+((#(fn [& args] (apply reverse args))) [1 2 3]) ; (3 2 1)
+;; while this throws:
+(apply reverse [1 2 3]) ;; let me tell you why:
+;; it's because the vector is converted as "& args" into another list having ONE element, hence inside looks like:
+(apply reverse '([1 2 3])) ; (3 2 1)
+
+
+;; The THREAD FIRST -> macro::
+;; The [->] macro threads an expression x through a variable number of forms.
+;; First, x is inserted as the second item in the first form, making a list of it if it is not a list already.
+;; Then the first form is inserted as the second item in the second form, making a list of that form if necessary.
+;; This process continues for all the forms. Using -> can sometimes make your code more readable.
+(-> [1 2 3]
+    (conj 4)) ; [1 2 3 4]
+
+((comp peek vec) (sort (rest (reverse [2 5 4 1 3 6])))) ; 5
+(-> [2 5 4 1 3 6] (reverse) (rest) (sort) ((comp peek vec))) ; 5
+
+
+;; [recur]
+;; Clojure only has 1 non-stack-consuming looping construct: recur.
+;; Either a function or a loop can be used as the recursion point.
+;; Either way, recur REBINDS the bindings of the recursion point to the values it is passed.
+;; Recur MUST be called from the TAIL-POSITION, and calling it elsewhere will result in an error.
+
+
+;; THREAD-LAST macro:
+;; The [->>] macro threads an expression x through a variable number of forms.
+;; First, x is inserted as the last item in the first form, making a list of it if it is not a list already.
+;; Then the first form is inserted as the last item in the second form, making a list of that form if necessary.
+;; This process continues for all the forms. Using ->> can sometimes make your code more readable.
+(->> [1 2 3]
+     (lazy-cat [0])) ; (0 1 2 3)
+
+(reduce + [1 23])
+
+;; taken this expression:
+(= (__ (map inc (take 3 (drop 2 [2 5 4 1 3 6]))))
+   (->> [2 5 4 1 3 6] (drop 2) (take 3) (map inc) (__))
+   11)
+;; fill the empty-space with a function:
+(= (apply + (map inc (take 3 (drop 2 [2 5 4 1 3 6]))))
+   (->> [2 5 4 1 3 6] (drop 2) (take 3) (map inc) (apply +) )
+   11) ; true
+
+(= ((partial apply +) (map inc (take 3 (drop 2 [2 5 4 1 3 6]))))
+   (->> [2 5 4 1 3 6] (drop 2) (take 3) (map inc) ((partial apply +)) ) ;; notice the 2 parans' needed to invoke the partial
+   11) ; true
+
+;; or:
+(= (reduce + (map inc (take 3 (drop 2 [2 5 4 1 3 6]))))
+   (->> [2 5 4 1 3 6] (drop 2) (take 3) (map inc) (reduce +))
+   11) ; true
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Write a function which, given a key and map, returns true iff the map contains
+;; an entry with that key and its value is nil.
+;; (true?  (__ :a {:a nil :b 2}))
+;; (false? (__ :b {:a nil :b 2}))
+(#(if (contains? %2 %) (nil? (get %2 %)) false) :c {:a nil :b 2})
+
+;; or translated inot a more readable version:
+(fn [k m]
+  (if (contains? m k)
+    (nil? (k m))
+    false))


* 4clojure:: some new functions implementations:  + group-by  + multiply-and-seq  + lexical closure demo

--- src/clojure_learning/4clojure-exercises.clj
+++ src/clojure_learning/4clojure-exercises.clj
@@ -1023,3 +1023,141 @@
 		(recur b a)
 		(first (filter #(= 0 (rem a %) (rem b %)) (iterate dec b)))))

+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Difficulty:	Easy
+;; Topics:	higher-order-functions math
+;; Lexical scope and first-class functions are two of the most basic building blocks of a
+;; functional language like Clojure. When you combine the two together,
+;; you get something very powerful called lexical closures.
+;; With these, you can exercise a great deal of control over the lifetime of your local bindings,
+;; saving their values for use later, long after the code you're running now has finished.
+;; write a function which returns a lexical-closure back and which computes x pow n.
+(defn pow
+  [power]
+    (fn [num] (reduce * (repeat power num))))
+
+((pow 2) 16)
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Write a function which multiplies two numbers and returns the result as a sequence of its digits.
+
+(require 'clojure.string)
+(defn mult-and-seq
+  [& nums]
+  (map #(. java.lang.Integer valueOf %)
+       (-> (apply * nums)
+            str
+           (clojure.string/split #""))))
+
+;; FOR SOME REASONS, THIS FUNCTION THROWS a number-format-exception on 4clojure...
+;; however on my station the results are compiled successfully:
+(mult-and-seq 20 3) ; (6 0)
+(mult-and-seq 1 1) ; (1)
+(mult-and-seq 99 9) ; 8 9 1
+
+
+;; work:
+(< 1/5 1) ; true
+(apply * '(1 2 3)) ; 6
+(. java.lang.Integer valueOf "2") ; 2
+
+
+;; so, here's a function that passes the tests...
+(defn mult-and-seq
+  [& nums]
+  (map #(- (int %) 48) ((comp vec str) (apply * nums))))
+
+;; here's the refactoring of this func:
+(defn mult-and-seq
+  [& nums]
+  (map #(- (int %) 48) (str (apply * nums))))
+
+;; we dropped the composition of [vec] + [str] functions, since the sequence abstraction
+;; [map] function knows how to iterate over a string-sequence, internally it does the same
+;; it calls: [seq] on the string...
+
+;; alin's solution would be using recursive funcs:
+(defn mult-and-seq
+  ([x y]
+     (mult-and-seq (apply * (list x y))))
+  ([product]
+     (if (zero? (int (/ product 10)))   ;; / 6 10 -> 0
+       [(mod product 10)]               ;; mod 6 10 -> 6
+       (conj (mult-and-seq (int (/ product 10)))  (mod product 10))))) ;; / 30 10 -> 3
+
+(mod 30 10) ; 0
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Easy
+;; Group a Sequence:: Special Restrictions: [group-by]
+;; Given a function f and a sequence s, write a function which returns a map.
+;; The keys should be the values OF f applied to each item in s.
+;; The value at each key should be a vector of corresponding items in the order they appear in s.
+;; In fact we're implementing the [group-by] function
+;; (= (__ #(> % 5) [1 3 6 8]) {false [1 3], true [6 8]})
+
+;; (= (__ count [[1] [1 2] [3] [1 2 3] [2 3]])
+;;    {1 [[1] [3]],  2 [[1 2] [2 3]],  3 [[1 2 3]]})
+
+(defn group-by-fun
+  [func coll]
+  (reduce
+     (fn [m k]
+       (if (contains? m (func k))       ;; contains: true | false applied func key
+         (assoc m (func k) (conj (get m (func k)) k))
+         (assoc m (func k) [k]) ))
+  {} coll))
+
+;; demo::
+(group-by-fun #(> % 5) [1 3 6 8]) ;; {false [1 3], true [6 8]})
+
+(contains? {:true [1 2]} :true) ; true
+(doc get) ;; get map key -> value
+
+;; and using the recursion implementation:
+(defn group-by-fun
+  [func coll]
+  (letfn [(add-to-map
+             [m k v]
+           (if (contains? m k)
+              (assoc m k (conj (get m k) v))
+              (assoc m k [v])))]
+  (loop [acc {}
+        [head & tail] coll]
+    (if (nil? head)
+      acc
+      (recur (add-to-map acc (func head) head) tail)))))
+
+(group-by-fun #(> % 5) [1 3 6 8]) ;; {false [1 3], true [6 8]})
+
+;; both functions can be refactored to drop the [if] conditional by using the default
+;; if a key within the map is not found:
+(defn group-by-fun
+  [func coll]
+  (reduce
+     (fn [m k]
+         (assoc m (func k) (conj (get m (func k) []) k)))
+  {} coll))
+
+;; [conj] puts on top of the stack an element k, while "get m k []" is saying
+;; get value corresponding to the key k from the map, and if not found -> get me an empty vector.
+;; where the [conj] will push
+
+;; while the recursive function looks more simplified:
+(defn group-by-fun
+  [func coll]
+  (letfn [(add-to-map
+             [m k v]
+              (assoc m k (conj (m k []) v)))]
+  (loop [acc {}
+        [head & tail] coll]
+    (if (nil? head)
+      acc
+      (recur (add-to-map acc (func head) head) tail)))))
+
+;; small refactor and the improvement is seen. the [get] core-function is a litlle verbose
+;; but as we know we can use: m k -> to get the corresponding value, idiomatic clojurist way :)
+;; yes the add-to-map func is just for readability -> clean code ;)
+


updated even more dependencies

updated even more dependencies

--- components/neo4j/project.clj
+++ components/neo4j/project.clj
@@ -4,8 +4,8 @@
             :description "A neo4j tesla-component"

             :dependencies [[gorillalabs.tesla/core :version]
-                           [com.taoensso/timbre "4.6.0"]
+                           [com.taoensso/timbre "4.10.0"]
                            [gorillalabs/neo4j-clj "0.3.1-SNAPSHOT"]
-                           [org.neo4j/neo4j-cypher "3.1.3"]
+                           [org.neo4j/neo4j-cypher "3.1.4"]
                            ])


Redo example with list instead of vectors.

--- Clojure/quadratic-formula/src/quadratic_formula/core.clj
+++ Clojure/quadratic-formula/src/quadratic_formula/core.clj
@@ -5,16 +5,14 @@
   [a b c]
   (let [descr (- (* b b) (* 4 a c))]
     (cond
-      (< descr 0) []
-      (= descr 0) [(/ (- b) (* 2 a))]
+      (< descr 0) (list)
+      (= descr 0) (list (/ (- b) (* 2 a)))
       :else (let [sq (Math/sqrt descr)]
-              [(/ (+ (- b) sq) (* 2 a))
-               (/ (- (- b) sq) (* 2 a))]))))
+              (list (/ (+ (- b) sq) (* 2 a))
+                    (/ (- (- b) sq) (* 2 a)))))))

 (defn -main
   [& args]
-  (println (quadratic-formula 3 -13 -10))
-
   (let [ans (quadratic-formula 1 0 1)]
     (println (count ans) "solutions"
              (if (pos? (count ans))


Remove unused resolver

Remove unused resolver

--- src-cljs/frontend/send.cljs
+++ src-cljs/frontend/send.cljs
@@ -295,19 +295,6 @@
    (fn [env ast]
      (:job/name env))

-   #{:job/build
-     :job/required-jobs}
-   (fn [{:keys [run/id job/name] :as env} ast]
-     (-> ((get-in env [:apis :get-workflow-status]) id)
-         (p/then
-          (fn [response]
-            (let [adapted (->> response
-                               adapt-to-run
-                               :run/jobs
-                               (filter #(= name (:job/name %)))
-                               first)]
-              (resolve/query ast adapted))))))
-
    :run/id
    (fn [env ast]
      (:run/id env))


make sure the transaction is updated

make sure the transaction is updated

--- test/clj_money/models/transactions_test.clj
+++ test/clj_money/models/transactions_test.clj
@@ -750,8 +750,8 @@
     (with-redefs [transactions/update-item-index-and-balance (partial fake-update-item-index-and-balance
                                                                       context
                                                                       update-calls)]
-      (transactions/update storage-spec updated)
-      (let [expected #{{:index 2
+      (let [result (transactions/update storage-spec updated)
+            expected #{{:index 2
                        :amount 101M
                        :balance 797M}
                       {:index 3
@@ -759,6 +759,8 @@
                        :balance 694M}} ; The first update that doesn't change a value stops the chain
                                                ; the 4th item should never be updated because the 4rd one did not change a value
             actual (get @update-calls (:id checking))]
+        (is (empty? (validation/error-messages result))
+            "The transaction is saved successfully")
         (testing "the expected transactions are updated"
           (when-not (= expected actual)
             (pprint {:expected expected


Refactor adding and deleting edges

Refactor adding and deleting edges

--- src/constraint/edit.cljs
+++ src/constraint/edit.cljs
@@ -31,25 +31,30 @@
 (defn next-key [key-num]
   (str edge-id (inc key-num)))

-(defn get-connected-edges [from to {:keys [edges]}]
-  (let [both-ways #{[from to] [to from]}]
-    (filter #(both-ways (butlast (second %))) edges)))
+(defn first-connected-edge [from to {:keys [edges]}]
+  (let [connected-either-way? #{[from to] [to from]}
+        get-edge-ends (comp butlast second)
+        connected? (comp connected-either-way? get-edge-ends)]
+    (first (filter connected? edges))))

-(defn connect-or-disconnect [from to world-state]
-  (let [connected-id (first (first (get-connected-edges from to world-state)))
+(defn update-edges [world-state how]
+  (update-in world-state [:edges] how))
+
+(defn add-or-delete-edge [from to world-state]
+  (let [connected-id (first (first-connected-edge from to world-state))
         next-to-largest-key (next-key (largest-key world-state))
-        new-edge [next-to-largest-key [from to :red]]]
-    (update-in world-state
-               [:edges]
-               (if (nil? connected-id)
-                 #(conj % new-edge)
-                 #(dissoc % connected-id)))))
+        new-edge [next-to-largest-key [from to :red]]
+        add-new-edge #(conj % new-edge)
+        delete-edge #(dissoc % connected-id)]
+    (if (nil? connected-id)
+      (update-edges world-state add-new-edge)
+      (update-edges world-state delete-edge))))

 (defn edit-vertex-or-connections [clicked-vertex world-state]
   (let [selected (:selected world-state)]
     (if (= selected clicked-vertex)
       (update-in world-state [:vertices selected 0] #(inc (mod % 2)))
-      (connect-or-disconnect selected clicked-vertex world-state)
+      (add-or-delete-edge selected clicked-vertex world-state)
       )))

 (defn handle-editing [clicked-what event world-state]


fix type query

fix type query

--- src/graphql_clj/type.clj
+++ src/graphql_clj/type.clj
@@ -62,7 +62,12 @@
               :fields {:name {:type :GraphQLString}
                        :kind {:type :GraphQLString}
                        :ofType {:type :GraphQLString}
-                       :description {:type :GraphQLString}}}
+                       :description {:type :GraphQLString}
+                       :fields {:type :GraphQLString}
+                       :inputFields {:type :GraphQLString}
+                       :interfaces {:type :GraphQLString}
+                       :enumValues {:type :GraphQLString}
+                       :possibleTypes {:type :GraphQLString}}}
    :TypeListType {:name "TypeList"
                   :kind :LIST
                   :innerType :TypeType


RR: Updates function doc

RR: Updates function doc

Signed-off-by: Roy Rutto <20baecd7b12dadcf751d1b66bb96feb328b61e19@gmail.com>

--- src/hatti/map/utils.cljs
+++ src/hatti/map/utils.cljs
@@ -313,19 +313,16 @@
       (.addLayer map layer id_string))))

 (defn generate-stops
-  "Generates a collection of  input value and one output value pairs is known
-   as stops. These stops are used by styling function to decide the style
-   output base on a defined a input vaue. This function genereates stops for
-    colour styling."
+  "Generates a collection of input - output value pairs known
+   as stops. These stops are used by get-styles function to decide the style
+   output based on an input vaue from the dataset. e.g. _id. By defauly this
+    function purely generates color stops."
   [selected-id selected-color]
   [[0 "#f30"]
    [selected-id selected-color]])

 (defn generate-size-stops
-  "Generates a collection of  input value and one output value pairs is known
-   as stops. These stops are used by styling function to decide the style
-   output base on a defined a input vaue. This function genereates stops for
-   circle-size styling."
+  "Generates cirlce size property stops base on values from dataset."
   [selected-id selected-color]
   [[0 4]
    [selected-id selected-color]])


Moved function docstrings to right position.

--- src/clj/elephantdb/service.clj
+++ src/clj/elephantdb/service.clj
@@ -65,8 +65,9 @@
                    (str (path local-dir domain))
                    (domain/host-shards (domains-info domain))))))

-(defn delete-deleted-domains [domains-info global-config local-config]
+(defn delete-deleted-domains
   "Deletes all domains from local filesystem that have been deleted from the global config."
+  [domains-info global-config local-config]
   (let [lfs (local-filesystem)
         local-dir (:local-dir local-config)
         local-path (.pathToFile lfs (path local-dir))]
@@ -92,9 +93,10 @@
         (log-message "Cleaning up local domain versions (only keeping latest version) for domain: " domain)
         (.cleanup local-vs 1)))))

-(defn sync-updated [global-config local-config token]
+(defn sync-updated
   "Only fetch domains from remote if a newer version is available.
 Keep the cached versions of any domains that haven't been updated"
+  [global-config local-config token]
   (log-message "Loading remote data if necessary, otherwise loading cached data")
   (let [fs (filesystem (:hdfs-conf local-config))
         domains-info (init-domain-info-map fs global-config)


Add error logging in cleanup-domains.

Add error logging in cleanup-domains.

--- src/clj/elephantdb/service.clj
+++ src/clj/elephantdb/service.clj
@@ -120,7 +120,9 @@

 (defn cleanup-domains [domains-info local-config]
   (doseq [domain (keys domains-info)]
-    (cleanup-domain domain domains-info local-config)))
+    (try
+      (cleanup-domain domain domains-info local-config)
+      (catch Throwable t (log-error t "Error when cleaning old versions of domain: " domain) (throw t)))))

 (defn sync-updated
   "Only fetch domains from remote if a newer version is available.


Update Google fonts link

Update Google fonts link

--- src/clj/salava/core/layout.clj
+++ src/clj/salava/core/layout.clj
@@ -124,7 +124,7 @@
        (apply include-css (css-list ctx))
        [:link {:type "text/css" :href "/css/custom.css" :rel "stylesheet" :media "screen"}]
        [:link {:type "text/css" :href "/css/print.css" :rel "stylesheet" :media "print"}]
-       [:link {:type "text/css", :href "https://fonts.googleapis.com/css?family=Halant:300,400,600,700|Dosis:300,400,600,700,800|Gochi+Hand|Coming+Soon|Oswald:400,300,700|Dancing+Script:400,700|Archivo+Black|Archivo+Narrow|Open+Sans:700,300,600,800,400|Open+Sans+Condensed:300,700|Cinzel:400,700&subset=latin,latin-ext", :rel "stylesheet"}]
+       [:link {:type "text/css", :href "https://fonts.googleapis.com/css?family=Halant:300,400,600,700|Dosis:300,400,600,700,800|Roboto|Gochi+Hand|Coming+Soon|Oswald:400,300,700|Dancing+Script:400,700|Archivo+Black|Archivo+Narrow|Open+Sans:700,300,600,800,400|Open+Sans+Condensed:300,700|Cinzel:400,700&subset=latin,latin-ext", :rel "stylesheet"}]
        [:link {:rel "shortcut icon" :href (:icon favicons) }]
        [:link {:rel "icon" :type "image/png" :href  (:png favicons)}]


Handle all scenario results using core.async channel

After this refactoring we get all scenario results into one channel which
we can read in a loop. The idea is that now it is easier to implement
buffering to file while looping through results.

--- src/clj_gatling/simulation.clj
+++ src/clj_gatling/simulation.clj
@@ -2,7 +2,7 @@
   (:require [clj-gatling.httpkit :as http]
             [clj-gatling.scenario-runners :refer :all]
             [clj-time.local :as local-time]
-            [clojure.core.async :as async :refer [go go-loop put! thread <!! alts! <! >!]]))
+            [clojure.core.async :as async :refer [go go-loop close! put! <!! alts! <! >!]]))

 (defn- now [] (System/currentTimeMillis))

@@ -76,17 +76,6 @@
         (recur))
     c))

-(defn run-scenario [timeout scenario]
-  (let [scenario-start (local-time/local-now)
-        response-chan (async/merge (map #(run-scenario-constantly scenario timeout %)
-                                        (range (:concurrency scenario))))]
-    (loop [responses []
-           handled-requests 0]
-      (if (continue-run? (:runner scenario) handled-requests scenario-start)
-        (let [result (response->result scenario (<!! response-chan))]
-          (recur (conj responses result) (+ handled-requests (count (:requests result)))))
-        responses))))
-
 (defn- print-scenario-info [scenario]
   (let [concurrency        (:concurrency scenario)
         number-of-requests (:number-of-requests scenario)]
@@ -94,9 +83,23 @@
              "with concurrency" concurrency
              "and" (runner-info (:runner scenario)))))

+(defn- run-scenario [timeout scenario]
+  (print-scenario-info scenario)
+  (let [scenario-start (local-time/local-now)
+        responses (async/merge (map #(run-scenario-constantly scenario timeout %)
+                                    (range (:concurrency scenario))))
+        results (async/chan)]
+    (go-loop [handled-requests 0]
+             (if (continue-run? (:runner scenario) handled-requests scenario-start)
+               (let [result (response->result scenario (<! responses))]
+                 (>! results result)
+                 (recur (+ handled-requests (count (:requests result)))))
+               (close! results)))
+    results))
+
 (defn run-scenarios [timeout scenarios]
-  (let [results (doall (map (fn [scenario]
-                              (print-scenario-info scenario)
-                              (thread (run-scenario timeout scenario)))
-                        scenarios))]
-    (mapcat <!! results)))
+  (let [c (async/merge (map (partial run-scenario timeout) scenarios))]
+    (loop [results []]
+      (if-let [result (<!! c)]
+        (recur (conj results result))
+        results))))


WIP another possible style

WIP another possible style

--- src/clj_money/web/accounts.clj
+++ src/clj_money/web/accounts.clj
@@ -175,29 +175,43 @@
           (transactions/items-by-account (env :db)
                                          (:id account)
                                          (pagination/prepare-options params)))]
-    (pagination/nav (assoc params
+    [:p
+    [:div.btn-group
+     [:a.btn.btn-default {:href "#"}
+      [:span.glyphicon.glyphicon-fast-backward {:aria-hidden true}]]
+     [:a.btn.btn-default {:href "#"}
+      [:span.glyphicon.glyphicon-step-backward {:aria-hidden true}]]
+     [:input {:type "text"}]
+     [:a.btn.btn-default {:href "#"}
+      [:span.glyphicon.glyphicon-step-backward {:aria-hidden true}]]
+     [:a.btn.btn-default {:href "#"}
+      [:span.glyphicon.glyphicon-fast-forward {:aria-hidden true}]]
+     ]]
+
+    #_(pagination/nav (assoc params
                            :url (-> (path "/accounts"
                                           (:id account)))
                            :total (transactions/count-items-by-account (env :db) (:id account))))
-    [:a.btn.btn-primary
-     {:href (-> (path "/entities"
-                      (:entity-id account)
-                      "transactions"
-                      "new")
-                (query {:redirect (url-encode (format "/accounts/%s" (:id account)))})
-                format-url)
-      :title "Click here to add a new transaction."}
-     "Add"]
-    " "
-    [:a.btn.btn-default
-     {:href (format "/accounts/%s/reconciliations/new" (:id account))
-      :title "Click here to reconcile this account."}
-     "Reconcile"]
-    " "
-    [:a.btn.btn-default
-     {:href (format "/entities/%s/accounts" (:entity-id account))
-      :title "Click here to return to the list of accounts."}
-     "Back"]))
+    [:p
+     [:a.btn.btn-primary
+      {:href (-> (path "/entities"
+                       (:entity-id account)
+                       "transactions"
+                       "new")
+                 (query {:redirect (url-encode (format "/accounts/%s" (:id account)))})
+                 format-url)
+       :title "Click here to add a new transaction."}
+      "Add"]
+     " "
+     [:a.btn.btn-default
+      {:href (format "/accounts/%s/reconciliations/new" (:id account))
+       :title "Click here to reconcile this account."}
+      "Reconcile"]
+     " "
+     [:a.btn.btn-default
+      {:href (format "/entities/%s/accounts" (:entity-id account))
+       :title "Click here to return to the list of accounts."}
+      "Back"]]))

 (defn- commodity-row
   [{:keys [style


Remove wrong-ns-form.

Remove wrong-ns-form.

--- src/clojournal/routes/home.clj
+++ src/clojournal/routes/home.clj
@@ -7,7 +7,7 @@
             [clj-time
              [core :as t]
              [coerce :as c]])
-  (import org.joda.time.DateTime))
+  (:import org.joda.time.DateTime))

 (defn home-page [page]
   (layout/render


deprecate add-javascript

deprecate add-javascript

--- src/clojupyter/misc/helper.clj
+++ src/clojupyter/misc/helper.clj
@@ -4,12 +4,16 @@
    ,,
    [clojupyter.misc.display		:as display]))

-(defn add-javascript
+(defn ^:deprecated add-javascript
   "add a single javascript to front-end, must be last form of cell input

   Example:
     (add-javascript \"https://cdnjs.cloudflare.com/ajax/libs/d3/4.12.2/d3.js\")
-  "
+
+  DEPRECATED. Jupyter no longer interprets `script` tags sent from
+  kernels and instead uses RequireJS to manage Javascript libraries.
+  See elsewhere for details about clojupyter's support for loading
+  third party Javascript libraries."
   [script-src]
   (display/hiccup-html [:script {:src script-src}]))


edges() -> graph()

edges() -> graph()

--- src/clojure/confgraph/core.clj
+++ src/clojure/confgraph/core.clj
@@ -12,21 +12,19 @@
 (def yaml       (Yaml. (ExtendedConstructor.)))
 (def extends    (fn [x] (.get (.load yaml (slurp (.getPath x))) "ddts_extends")))
 (def prototypes (map extends defs))
-(def raw-edges  (zipmap vertices prototypes))
+(def edges      (into {} (filter val (zipmap vertices prototypes))))

 (def rootpath
-  (memoize #(let [dst (raw-edges %)]
-              (if (nil? dst) {} (conj {% dst} (rootpath dst))))))
+  (memoize #(let [x (edges %)] (if x (conj {% x} (rootpath x)) {}))))

-(defn edges [prefix]
-  (let [e (filter #(re-matches (re-pattern (str prefix ".*")) (first %)) raw-edges)]
-    (into {} (for [[src dst] e] (rootpath src)))))
+(defn graph [prefix]
+  (let [g (DefaultDirectedGraph. DefaultEdge)
+        e (filter #(re-matches (re-pattern (str prefix ".*")) (first %)) edges)]
+    (doseq [v vertices] (. g (addVertex v)))
+    (doseq [[src dst] (into {} (for [[src dst] e] (rootpath src)))] (. g (addEdge src dst)))
+    g))

 (defn -main [& args]
-  (alter-var-root #'*read-eval* (constantly false))
   (if (> (count args) 1)
     (println "Supply at most a single filtering prefix.")
-    (let [edges (edges (first args)) graph (DefaultDirectedGraph. DefaultEdge)]
-      (doseq [v vertices] (. graph (addVertex v)))
-      (doseq [[src dst] edges] (. graph (addEdge src dst)))
-      (println (.toString (.edgeSet graph))))))
+    (println (.toString (graph (first args))))))


hierarchical layout

hierarchical layout

--- src/clojure/confgraph/core.clj
+++ src/clojure/confgraph/core.clj
@@ -1,6 +1,8 @@
 (ns confgraph.core
   (:gen-class)
   (:import
+   com.jgraph.layout.JGraphFacade
+   com.jgraph.layout.hierarchical.JGraphHierarchicalLayout
    [org.jgraph.graph DefaultGraphCell GraphConstants]
    [org.jgrapht ListenableGraph]
    [org.jgrapht.graph ListenableDirectedGraph]
@@ -34,7 +36,13 @@
     (println "Supply at most a single filtering prefix.")
     (let [g (graph (re-pattern (str (first args) ".*")))
           adapter (JGraphModelAdapter. g)
-          jgraph (JGraph. adapter)]
+          jgraph (JGraph. adapter)
+          facade (JGraphFacade. jgraph)
+          layout (JGraphHierarchicalLayout.)]
+      (.run layout facade)
+      (let [m (.createNestedMap facade true true)
+            cache (.getGraphLayoutCache jgraph)]
+        (.edit cache m))
       (doto (JFrame. "TITLE")
         (.setSize 800 600)
         (.setDefaultCloseOperation JFrame/EXIT_ON_CLOSE)


Inline edit works now.

Inline edit works now.

--- src/com/okl/tokenmgr/views.clj
+++ src/com/okl/tokenmgr/views.clj
@@ -259,6 +259,7 @@
     [:script {:type "text/javascript"}
      (str "
 var grid;
+var dv;

 function requiredFieldValidator(value) {
   if (value == null || value == undefined || !value.length) {
@@ -272,24 +273,29 @@
   {id: 'token', name: 'Token', field: 'name', width: 100, editor: Slick.Editors.Text, validator: requiredFieldValidator, sortable: true},
   {id: 'description', name: 'Description', field: 'description', width: 200, editor: Slick.Editors.Text},
   {id: 'environment', name: 'Environment', field: 'environment', width: 200, sortable: true, editor: Slick.Editors.Text},
-  {id: 'value', name: 'Value', field: 'value', width: 200, editor: Slick.Editors.Text}];
-
+  {id: 'value', name: 'Value', field: 'value', width: 200, editor: Slick.Editors.Text},
+  {id: 'source', name: 'Source', field: 'source', width: 400, sortable: true},
+  {id: 'delete', name: 'Delete', field: 'delete', width: 200, formatter: deleteButtonFormatter}];
+
+
+function deleteButtonFormatter(row, cell, value, columnDef, dataContext) {
+  var button = \"<input class='del' type='button' id='\" + dataContext.name + \"' />\";
+  return button;
+}

   var options = {
     editable: true,
-    enableAddRow: true,
+    enableAddRow: false,
     enableCellNavigation: true,
     autoEdit: false,
     autoHeight: true
    };

-
-
 var loadingIndicator = null;

 $(function () {

-var dv = Slick.Data.DataView();
+dv = Slick.Data.DataView();
 var gridSorter = function(columnField, isAsc, grid, gridData) {
     var sign = isAsc ? 1 : -1;
     var field = columnField
@@ -315,23 +321,9 @@

 grid.onAddNewRow.subscribe(function (e, args) {
   var item = args.item;
-  grid.invalidateRow(data.length);
-  data.push(item);
+  grid.invalidateRow(dv.length);
+  dv.addItem(item);
   grid.updateRowCount();
-  grid.render();
-});
-
-grid.onSort.subscribe(function(e, args) {
-  gridSorter(args.sortCol.field, args.sortAsc, grid, dv);
-});
-
-dv.onRowCountChanged.subscribe(function(e, args) {
-  grid.updateRowCount();
-  grid.render();
-});
-
-dv.onRowsChanged.subscribe(function (e, args) {
-  grid.invalidateRows(args.rows);
   grid.render();
 });

@@ -339,12 +331,58 @@
   url: '/api/tokens/" (url-encode app) "',
   type: 'GET',
   success: function(data) {
-    dv.setItems(data, 'name');
+    for (i = 0; i < data.length; i++) {
+      data[i]['id'] = data[i]['name'] + ':' + data[i]['environment'];
+    }
+    dv.setItems(data);
+  }});
+
+grid.onSort.subscribe(function(e, args) {
+  gridSorter(args.sortCol.field, args.sortAsc, grid, dv);
+});
+
+dv.onRowCountChanged.subscribe(function(e, args) {
+  grid.updateRowCount();
+  grid.render();
+});
+
+dv.onRowsChanged.subscribe(function (e, args) {
+  grid.invalidateRows(args.rows);
+  grid.render();
+});
+
+grid.onCellChange.subscribe(function (e, args) {
+  var row = dv.getItem(args.row);
+  var columns = grid.getColumns();
+  var data = {};
+  // need to skip the delete column on the right
+  for (i = 0; i < columns.length; i++) {
+    console.log(i);
+    if(columns[i]['editor']) {
+       property = columns[i]['field'];
+       data[property] = row[property];
+    }
+  }
+
+  data['path'] = '" app "';
+
+  $.ajax({
+  url: '/token',
+  type: 'PUT',
+  contentType: 'application/json; charset=UTF-8',
+  dataType: 'json',
+  data: JSON.stringify(data),
+  success: function(data) {
+    if(data.status != 'success') {
+      alert('Error adding token:\\n' + data.message);
+    }
+    document.location.reload(true);
   },
-  error: function(req, status, message) {
-    alert('Error loading data');
-  }
-});
-
-  })"
+  error: function(request, status, message) {
+    alert('Error adding token ' + data['name']);
+    document.location.reload(true);
+  }
+  });
+});
+})"
 )]]))


Clean up coordinator logic. Fix shutdown lifecycle issue.

--- src/onyx/peer/coordinator.clj
+++ src/onyx/peer/coordinator.clj
@@ -83,9 +83,6 @@
   (>!! (:group-ch state) [:send-to-outbox {:fn :complete-job :args {:job-id job-id}}])
   state)

-
-; WHEN all the inputs are completed? send one final "flush barrier". This will do a checkpoint, when everyone is on the min-epoch
-;; and everyone is completed, then we can complete
 (defn next-replica
   [{:keys [peer-config log job-id peer-id messenger curr-replica] :as state}
    barrier-period-ns
@@ -168,12 +165,10 @@
                        :epoch checkpointed-epoch}
           ;; get the next version of the zk node, so we can detect when there are other writers
           next-write-version (if write-coordinate?
-                            (write-coordinate write-version log tenancy-id job-id coordinates)
-                            write-version)
+                               (write-coordinate write-version log tenancy-id job-id coordinates)
+                               write-version)
           checkpoint? (first (shuffle [true #_false]))
           messenger (m/set-epoch! messenger (inc (m/epoch messenger)))]
-      ;(println "SETUP BARRIER OPTS WITL SEALING" (:sealing? state))
-      ;; all the inputs sealing
       (assoc state
              :checkpointing? checkpoint?
              :checkpoint-epoch (if checkpoint? (m/epoch messenger) (:checkpoint-epoch state))
@@ -194,6 +189,70 @@
         (assoc :write-version write-version)
         (assoc :last-heartbeat-time (System/nanoTime)))))

+(defn checkpointing? [state status]
+  (and ;; we've initiated a snapshot
+       (:checkpointing? state)
+       ;; none of the statuses are saying they're checkpointing
+       (or (:checkpointing? status)
+           ;; and they are all at least up to the checkpoint barrier
+           ;; which means that we are not getting a stale status
+           (< (:min-epoch status)
+               (:checkpoint-epoch state)))))
+
+(defn coordinator-iteration
+  [{:keys [messenger last-heartbeat-time next-barrier-time offering? completed? sealing? scheduled?
+           allocation-ch shutdown-ch peer-config] :as state}
+   coordinator-max-sleep-ns
+   barrier-period-ns
+   heartbeat-ns]
+  (let [_ (run! pub/poll-heartbeats! (m/publishers messenger))
+        status (merged-statuses messenger)]
+    ;(println "COORDINATOR STATUS" status (m/replica-version messenger) (m/epoch messenger) :sealing? (:sealing? state))
+    (cond (> (System/nanoTime) (+ last-heartbeat-time heartbeat-ns))
+          ;; Immediately offer heartbeats
+          (offer-heartbeats state)
+
+          offering?
+          ;; Continue offering barriers until success
+          (offer-barriers state)
+
+          completed?
+          (do
+           (LockSupport/parkNanos coordinator-max-sleep-ns)
+           state)
+
+          sealing?
+          (if (checkpointing? state status)
+            (do
+             (LockSupport/parkNanos coordinator-max-sleep-ns)
+             state)
+            (complete-job state))
+
+          (or (not= (m/replica-version messenger) (:replica-version status))
+              (not= (m/epoch messenger) (:min-epoch status)))
+          (do
+           (LockSupport/parkNanos coordinator-max-sleep-ns)
+           state)
+
+          (:drained? status)
+          ;; emit final completion barrier
+          (periodic-barrier (assoc state :sealing? true :scheduled? false))
+
+          (and scheduled? (> (System/nanoTime) next-barrier-time))
+          (periodic-barrier (assoc state :sealing? false :scheduled? false))
+
+          (and (not scheduled?)
+               (not (checkpointing? state status)))
+          (assoc state
+                 :next-barrier-time (+ (System/nanoTime) barrier-period-ns)
+                 :scheduled? true
+                 :checkpointing? false)
+
+          :else
+          (do
+           (LockSupport/parkNanos coordinator-max-sleep-ns)
+           state))))
+
 (defn start-coordinator!
   [{:keys [allocation-ch shutdown-ch peer-config] :as state}]
   (thread
@@ -202,74 +261,23 @@
           ;snapshot-every-n (arg-or-default :onyx.peer/coordinator-snapshot-every-n-barriers peer-config)
           coordinator-max-sleep-ns (ms->ns (arg-or-default :onyx.peer/coordinator-max-sleep-ms peer-config))
           barrier-period-ns (ms->ns (arg-or-default :onyx.peer/coordinator-barrier-period-ms peer-config))
-          heartbeat-ns (ms->ns (arg-or-default :onyx.peer/heartbeat-ms peer-config))]
-      (loop [{:keys [messenger] :as state} (initialise-state state)]
-        (if-let [scheduler-event (poll! shutdown-ch)]
-          (shutdown (assoc state :scheduler-event scheduler-event))
-          (if-let [new-replica (poll! allocation-ch)]
-            ;; Set up reallocation barriers. Will be sent on next recur through :offer-barriers
-            (recur (next-replica state barrier-period-ns new-replica))
-            (let [_ (run! pub/poll-heartbeats! (m/publishers messenger))
-                  status (merged-statuses messenger)]
-              ;(println "COORDINATOR STATUS" status (m/replica-version messenger) (m/epoch messenger) :sealing? (:sealing? state))
-              (cond (:offering? state)
-                    ;; Continue offering barriers until success
-                    (recur (offer-barriers state))
-
-                    (:completed? state)
-                    (do
-                     (LockSupport/parkNanos coordinator-max-sleep-ns)
-                     (recur state))
-
-                    (and (:sealing? state)
-                         (= (m/epoch messenger) (:min-epoch status)))
-                    (recur (complete-job state))
-
-                    (> (System/nanoTime) (+ (:last-heartbeat-time state) heartbeat-ns))
-                    ;; Immediately offer heartbeats
-                    (recur (offer-heartbeats state))
-
-                    (and (= (m/replica-version messenger) (:replica-version status))
-                         (= (m/epoch messenger) (:min-epoch status))
-                         (not (:scheduled? state))
-                         (or ;; either not checkpointing
-                             (not (:checkpointing? state))
-                             ;; or checkpoint is done
-                             (and (>= (:min-epoch status)
-                                      (:checkpoint-epoch state)))))
-                    ;; Checkpointing is complete. Schedule next checkpoint.
-                    ;; FIXME SHOULD WRITE OUT CHECKPOINT IN HERE IF IT WAS CHECKPOINTING
-                    ;(println "SCHEDULE NEXT BARRIER")
-                    (do
-                     ;(println "NEXT SCHEDULED " barrier-period-ns)
-                     (recur (assoc state
-                                  :next-barrier-time (+ (System/nanoTime) barrier-period-ns)
-                                  :scheduled? true
-                                  :checkpointing? false)))
-
-                    (and (= (m/replica-version messenger) (:replica-version status))
-                         (= (m/epoch messenger) (:min-epoch status))
-
-                         (not (:checkpointing? state))
-
-                         (or ;; next scheduled barrier
-                             (and (:scheduled? state) (> (System/nanoTime) (:next-barrier-time state)))
-                             ;; or we've drained and should send a final seal barrier immediately
-                             (:drained? status)))
-                    ;; Setup barriers, will be sent on next recur through :offer-barriers
-                    (recur (periodic-barrier (assoc state :sealing? (:drained? status) :scheduled? false)))
-
-                    :else
-                    (do
-                     (LockSupport/parkNanos coordinator-max-sleep-ns)
-                     (recur state))))))))
+          heartbeat-ns (ms->ns (arg-or-default :onyx.peer/heartbeat-ms peer-config))
+          result (loop [{:keys [messenger] :as state} (initialise-state state)]
+                   (if-let [scheduler-event (poll! shutdown-ch)]
+                     (do (shutdown (assoc state :scheduler-event scheduler-event))
+                         :shutdown)
+                     (if-let [new-replica (poll! allocation-ch)]
+                       ;; Set up reallocation barriers. Will be sent on next recur through :offer-barriers
+                       (recur (next-replica state barrier-period-ns new-replica))
+                       (recur (coordinator-iteration state
+                                                     coordinator-max-sleep-ns
+                                                     barrier-period-ns
+                                                     heartbeat-ns)))))]
+        (when-not (= result :shutdown)
+          (throw (Exception. "Coordinator not properly shutdown"))))
     (catch Throwable e
       (>!! (:group-ch state) [:restart-vpeer (:peer-id state)])
       (fatal e "Error in coordinator")))))
-
-
-;; Can check for completion status by making sure everyone is at least on the checkpoing epoch
-;; and everyone has checkpointing? false

 (defprotocol Coordinator
   (start [this])


Reuse our function

Reuse our function

--- test/github_changelog/conventional_test.clj
+++ test/github_changelog/conventional_test.clj
@@ -22,11 +22,8 @@
 (def jira-id "JIRA-1")
 (def jira-issue-url (str jira-url "browse/" jira-id))

-(def pull-gen
-  (s/gen ::github/pull {::github/title sut/title-gen}))
-
 (defn sample-pull [overrides]
-  (-> (rand-nth (gen/sample pull-gen))
+  (-> (spec/sample ::github/pull {::github/title sut/title-gen})
       (assoc-in [:base :repo :html_url] github-url)
       (merge overrides)))


Init the default nrepl in a future to shorten deploy time.

--- modules/core/src/main/clojure/immutant/runtime.clj
+++ modules/core/src/main/clojure/immutant/runtime.clj
@@ -94,7 +94,7 @@
    (log/warn "No :init fn, immutant.init namespace or :ring options found for"
              (util/app-name)
              "- no initialization will be performed"))
-  (repl/init-repl (registry/get :config)))
+  (future (repl/init-repl (registry/get :config))))

 (defn ^{:internal true} set-app-config
   "Takes the full application config and project map as data strings


Add construction function for RDF4j NotifyingRepositoryWrapper's

--- src/grafter/rdf/repository.clj
+++ src/grafter/rdf/repository.clj
@@ -34,7 +34,8 @@
            (org.eclipse.rdf4j.common.iteration CloseableIteration)
            (org.eclipse.rdf4j.sail.inferencer.fc ForwardChainingRDFSInferencer
                                            DirectTypeHierarchyInferencer
-                                           CustomGraphQueryInferencer)))
+                                           CustomGraphQueryInferencer)
+           (org.eclipse.rdf4j.repository.event.base NotifyingRepositoryWrapper)))

 (defprotocol ToConnection
   (->connection [repo] "Given a sesame repository return a connection to it.
@@ -164,6 +165,20 @@
      (doto (SPARQLRepository. (str query-url)
                               (str update-url))
        (.initialize))))
+
+(defn notifying-repo
+  "Wrap the given repository in an RDF4j NotifyingRepositoryWrapper.
+  Once wrapped you can capture events on the underlying repository.
+
+  Supports two arities:
+
+  - Takes just a repo to wrap.
+  - Takes a repo to wrap and a boolean indicating whether to report
+    deltas on operations."
+  ([^Repository repo]
+   (NotifyingRepositoryWrapper. repo))
+  ([repo report-deltas]
+   (NotifyingRepositoryWrapper. repo report-deltas)))

 (defn rdfs-inferencer
   "Returns a Sesame ForwardChainingRDFSInferencer using the rules from


renaming devcards.html to cards.html

renaming devcards.html to cards.html

--- src/leiningen/new/devcards.clj
+++ src/leiningen/new/devcards.clj
@@ -14,7 +14,7 @@
                     ""))
     (->files data
              ["project.clj" (render "project.clj" data)]
-             ["resources/public/devcards.html" (render "resources/index.html" data)]
+             ["resources/public/cards.html" (render "resources/index.html" data)]
              ["resources/public/index.html" (render "resources/app_index.html" data)]
              ["resources/public/css/{{sanitized}}_style.css" (render "style.css" data)]
              ["src/{{sanitized}}/core.cljs" (render "core.cljs" data)])))


types types types

types types types

--- src/leiningen/td_to_hiccup.clj
+++ src/leiningen/td_to_hiccup.clj
@@ -6,12 +6,18 @@

 (defalias html-label (t/HVec [Keyword (t/HMap :mandatory {:for String}) String]))
-(defalias html-form (t/HVec [Keyword (t/HMap :mandatory {:id String}) t/Any *]))
+(defalias html-form (t/HVec [Keyword (t/HMap :mandatory {:id String}
+                                             :optional {:required String}
+                                             :complete? false) t/Any *]))
 (defalias html-form-group (t/HVec [html-label html-form]))

-(t/ann wrap-with-vec-and-label [pt/et-column html-form -> html-form-group])
-(defn wrap-with-vec-and-label [col hicc-col]
-  [(let [n (name (first col))] [:label {:for n} n]) hicc-col])
+;(t/ann wrap-with-vec-and-label [pt/et-column html-form -> html-form-group])
+;(defn wrap-with-vec-and-label [col hicc-col]
+;  [(let [n (name (first col))] [:label {:for n} n]) hicc-col])
+
+(t/ann wrap-with-vec-and-label [html-form -> (t/HVec [html-label])])
+(defn wrap-with-vec-and-label [hicc-col]
+  [(let [n "staire"] [:label {:for n} n])])

 (t/ann merge-required [(t/HMap :complete? false) pt/et-column -> (t/HMap :complete? false)])
 (defn merge-required [m col]
@@ -19,20 +25,17 @@
     (merge m {:required "required"})
     m))

-(defalias t (t/HVec [Keyword (t/U Keyword (t/HVec [Keyword Number])) t/Any t/Any *]))
+(t/ann dt->hiccup [(t/HVec [Keyword (t/U Keyword (t/HVec [Keyword Number])) t/Any t/Any *]) -> html-form-group])
+(defmulti dt->hiccup (t/fn [col :- (t/HVec [Keyword (t/U Keyword (t/HVec [Keyword Number])) t/Any t/Any *])]
+                       (let [[_ s] col]
+                         (if (vector? s) (first s) s))))

-;(t/ann dt->hiccup [pt/et-column -> (t/HVec [Keyword (t/HMap :mandatory {:id String}) (t/Option String)])])
-;(HVec [Keyword (U Keyword (HVec [Keyword Number])) t/Any t/Any *])
-;(t/ann ^:no-check dt->hiccup [pt/et-column -> html-form-group])
-(t/ann dt->hiccup [t -> t/Any])
-(defmulti dt->hiccup (t/fn [col :- t] :- Keyword
-                       (if (seq? (second col))
-                         (first (second col))
-                         (second col))))
+(defmethod dt->hiccup :int [col]
+  (wrap-with-vec-and-label [:input.form-control {:id (name (first col))}])
+  ;(wrap-with-vec-and-label [:input.form-control (merge-required {:id (name (first col))} col)])
+  ;(wrap-with-vec-and-label col [:input.form-control (merge-required {:id (name (first col))} col)])
+  )

-;(defmethod dt->hiccup :int [col]
-;  (wrap-with-vec-and-label col [:input.form-control (merge-required {:id (name (first col))} col)]))
-;
 ;(defmethod dt->hiccup :varchar [col]
 ;  {:pre [(second (second col))]}
 ;  (wrap-with-vec-and-label


Update parser to throw Exception, instead of return error

--- src/graphql_clj/parser.clj
+++ src/graphql_clj/parser.clj
@@ -3,7 +3,7 @@
             [clojure.set :as set]
             [clojure.string :as str]
             [clojure.pprint :refer [pprint] :as pp])
-  (:import [graphql_clj Parser]))
+  (:import [graphql_clj Parser ParseException]))

 (defn- unescape
   "Unescapes a string's escaped values according to the graphql spec."
@@ -254,14 +254,51 @@
           (insta/add-line-and-column-info-to-metadata %)
           (insta/transform tfmap))))

-(def orig-parse-schema (build-parser rules :type-system-definitions))
-(def orig-parse-query-document (build-parser rules :query-document))
+(def orig-parse-schema-fn (build-parser rules :type-system-definitions))
+(def orig-parse-query-document-fn (build-parser rules :query-document))
+
+(defn- insta-failure->error
+  [message failure]
+  {:message "Failed parsing schema!"
+   :locations [{:line (:line failure)
+                :column (:column failure)
+                :index (:index failure)}]})
+
+(defn orig-parse-schema
+  [^String input]
+  (let [result (orig-parse-schema-fn input)]
+    (if (insta/failure? result)
+      (throw (ex-info "Failed parsing schema." {:errors [(insta-failure->error "Failed parsing schema." result)]}))
+      result)))
+
+(defn orig-parse-query-document
+  [^String input]
+  (let [result (orig-parse-query-document-fn input)]
+    (if (insta/failure? result)
+      (throw (ex-info "Failed parsing query document." {:errors [(insta-failure->error "Failed parsing query document." result)]}))
+      result)))
+
+(defn- parse-exception->error
+  [e]
+  (if e
+    (let [location (.location e)]
+      {:message (.getMessage e)
+       :locations [{:line (:line location)
+                    :column (:column location)
+                    :index (:index location)}]})))

 (defn parse-schema [^String input]
-  (.parseSchema (Parser. input)))
+  (try
+    (.parseSchema (Parser. input))
+    (catch ParseException e
+      (throw (ex-info "Failed parse schema." {:errors [(parse-exception->error e)]})))))

 (defn parse-query-document [^String input]
-  (.parseQueryDocument (Parser. input)))
+  (try
+    (.parseQueryDocument (Parser. input))
+    (catch ParseException e
+      (println "location:" (.location e))
+      (throw (ex-info "Failed parse query document." {:errors [(parse-exception->error e)]})))))

 (def ^:private example-schema
 "enum DogCommand { SIT, DOWN, HEEL }


remove the overlay hack

remove the overlay hack

--- src-cljs/frontend/components/overlay.cljs
+++ src-cljs/frontend/components/overlay.cljs
@@ -173,10 +173,7 @@
     om/IRender
     (render [_]
       (let [cast! (om/get-shared owner :cast!)
-            overlay-component (get overlay-components :doc-viewer
-                                   ;; Temporary hack until we have a way to trigger doc viewer
-                                   ;; (or (:overlay app) :info
-                                   )]
+            overlay-component (get overlay-components (or (:overlay app) :info))]
         (html
           [:div.app-overlay {:on-click #(cast! :overlay-closed)}
            [:div.app-overlay-background]


fix typo in migrate

fix typo in migrate

--- src/chat/server/migrate.clj
+++ src/chat/server/migrate.clj
@@ -38,7 +38,7 @@
   group and add all existing users and tags to that group"
   [group-name]
   (db/with-conn
-    (let [group (create-group! {:id (db/uuid) :name group-name})
+    (let [group (db/create-group! {:id (db/uuid) :name group-name})
           all-users (->> (d/q '[:find ?u :where [?u :user/id]] (d/db db/*conn*)) (map first))
           all-tags (->> (d/q '[:find ?t :where [?t :tag/id]] (d/db db/*conn*)) (map first))]
       (d/transact db/*conn* (mapv (fn [u] [:db/add [:group/id (group :id)] :group/user u]) all-users))


Fix a bug in normalize-bases.

Fix a bug in normalize-bases.

--- src/cljam/util/sam_util.clj
+++ src/cljam/util/sam_util.clj
@@ -350,12 +350,15 @@
       (conj (vec bases) (compressed-base->char-high (nth compressed-bases (+ (/ length 2) compressed-offset))))
       bases)))

-(defn normalize-bases [^bytes bases]
-  (map-indexed (fn [idx _]
-                 (aset bases idx ^byte (cstr/upper-case (nth bases idx)))
-                 (if (= (nth bases idx) \.)
-                   (aset bases idx (byte \N))))
-               bases)
+(defn normalize-bases
+  "Converts bases in given buffer to upper-case. Also converts '.' to 'N'.
+   Bases are represented as buffer of ASCII characters."
+  ^bytes [^bytes bases]
+  (dotimes [i (alength bases)]
+    (let [b (aget bases i)]
+      (cond
+        (= b (byte \.)) (aset-byte bases i (byte \N))
+        (<= (byte \a) b (byte \z)) (aset-byte bases i (- b 32))))) ;; Upper-case ASCII offset
   bases)

 ;;; fastq and phred


use rand-nth

use rand-nth

--- src/cljs/markov/markov.cljs
+++ src/cljs/markov/markov.cljs
@@ -27,7 +27,7 @@
   (let [data (text-to-markov (input))]
     (loop [ws (data "*START*")
            acc []]
-      (let [w (-> ws shuffle first)
+      (let [w (rand-nth ws)
             nws (data w)
             nacc (concat acc [w])]
         (if (= \. (last w))


Made gap in bar graph configurable

Made gap in bar graph configurable

--- src/cljs/om_sente/core.cljs
+++ src/cljs/om_sente/core.cljs
@@ -70,6 +70,7 @@
 (def graph-scale 3)
 (def graph-bar-width 30)
 (def graph-height 400)
+(def bar-gap 1)

 (defn animated-bar-graph
   "Component that displays the data (text) returned by the server after processing."
@@ -101,7 +102,7 @@
                                           [:rect {:fill (make-color (max v1 v2))
                                                   :width graph-bar-width
                                                   :height h
-                                                  :x (* (inc graph-bar-width) o)
+                                                  :x (* (+ bar-gap graph-bar-width) o)
                                                   :y (- graph-height h)}]))
                                       data
                                       t


fix line-counts

fix line-counts

--- src/clojure/line-counts.clj
+++ src/clojure/line-counts.clj
@@ -5,7 +5,9 @@
   (map
     #(list (.toString %) (count (read-lines %)))
     (remove #(.isDirectory %)
-      (file-seq (file-str "~/projects/FitNesseGit/src/fitnesse")))))
+      (concat
+        (file-seq (file-str "~/projects/FitNesseGit/src/fitnesse"))
+        (file-seq (file-str "~/projects/FitNesseGit/test/fitnesse"))))))

 (defn count-lines-that-end-with [file-counts suffix]
   (reduce +


Wrap BPF opcodes

Wrap BPF opcodes

--- src/clojure_pf/bpf/code.clj
+++ src/clojure_pf/bpf/code.clj
@@ -1,25 +1,26 @@
 (ns clojure-pf.bpf.code
   "BPF instruction codes and operations.")

-(def my-prog [:ld :abs :w
+; Utilities

-(def ^:private ^:const kind-table
+(def ^:private kind-table
   "Instruction kinds"
   {:ld    0x00    ; load to acc
    :ldx   0x01    ; load to idx
    :st    0x02    ; store acc
    :stx   0x03    ; store idx
    :alu   0x04    ; op between accumulator and source
+   :jmp   0x05    ; jump
    :ret   0x06    ; return
    :misc  0x07})  ; miscellaneous

-(def ^:private ^:const size-table
+(def ^:private size-table
   "Data size variants."
   {:w     0x00    ; word
    :h     0x08    ; halfword
    :b     0x10})  ; byte

-(def ^:private ^:const mode-table
+(def ^:private mode-table
   "Addressing modes."
   {:imm   0x00    ; constant
    :abs   0x20    ; data at fixed-offset
@@ -28,7 +29,7 @@
    :len   0x80    ; packet length
    :msh   0xa0})  ; IP header length

-(def ^:private ^:const operation-table
+(def ^:private operation-table
   "Arithmetic and jump instructions."
   {:add   0x00    ; acc <- acc + k
    :sub   0x10    ; acc <- acc - k
@@ -45,18 +46,18 @@
    :jge   0x30    ; jump-if-greater-or-equal
    :jset  0x40})  ; jump-if-set

-(def ^:private ^:const source-table
+(def ^:private source-table
   "Value modes."
   {:k     0x00    ; constant
    :x     0x08})  ; index register

-(def ^:private ^:const retval-table
+(def ^:private retval-table
   "Return value modes."
   {:k     0x00    ; constant
    :x     0x08    ; index register
    :a     0x10})  ; accumulator

-(def ^:private ^:const table
+(def ^:private table
   "All instruction constants."
   (merge kind-table
          size-table
@@ -65,27 +66,35 @@
          source-table
          retval-table))

-; Category checking
+(defn- compose [codes]
+  "Returns the sum of multiple BPF codes as an opcode."
+  (->> codes
+       (map (partial get table))
+       (reduce +)))

-(defn kind? [ins]
-  (contains? kind-table ins))
+(def ^:private opcodes
+  "Basic opcodes."
+  (map (comp compose second)
+       {:load         [:ld :imm]
+        :load-mem     [:ld :mem]

-(defn size? [ins]
-  (contains? size-table ins))
+        :load-8-abs   [:ld :b :abs]
+        :load-8-rel   [:ld :b :ind]
+        :load-16-abs  [:ld :h :abs]
+        :load-16-rel  [:ld :h :ind]
+        :load-32-abs  [:ld :w :abs]
+        :load-32-rel  [:ld :w :ind]

-(defn mode? [ins]
-  (contains? mode-table ins))
+        :store-acc    [:st]
+        :store-idx    [:stx]

-(defn op? [ins]
-  (contains? operation-table ins))
+        :jump-if-eq   [:jmp :jeq :k]

-(defn source? [ins]
-  (contains? source-table ins))
+        :return-acc   [:ret :a]
+        :return-k     [:ret :k]}))

-(defn retval? [ins]
-  (contains? retval-table ins))
+; Exports

-; Translation
-
-(defn to-code [ins]
-  (get table ins))
+(defn to-opcode [opcode]
+  "Returns the numeric value associated with a keyword denoting an opcode."
+  (get opcodes opcode))


Updated comments

Updated comments

--- src/conceptnet_clj/util.clj
+++ src/conceptnet_clj/util.clj
@@ -28,7 +28,7 @@
     (apply log src args)))

 (defn group-seq
-  "This is a lazy very of group-by. Instead of returning a map, it returns a
+  "This is a lazy version of group-by. Instead of returning a map, it returns a
   seq of [key [value]] pairs."
   [key-fn coll]
   (let [step (fn step [xs]


Reimplemented up-down-arrows

Reimplemented up-down-arrows

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

--- src/conexp/fca/contexts.clj
+++ src/conexp/fca/contexts.clj
@@ -313,7 +313,21 @@
 (defn up-down-arrows
   "Returns up-down-arrow relation of ctx."
   [ctx]
-  (intersection (up-arrows ctx) (down-arrows ctx)))
+  (let [objs   (objects ctx),
+        atts   (attributes ctx),
+        inz    (incidence ctx),
+        oprime (map-by-fn #(object-derivation ctx #{%}) objs),
+        aprime (map-by-fn #(attribute-derivation ctx #{%}) atts)]
+    (set-of [g m]
+            [g objs
+             m atts
+             :when (and (not (inz [g m]))
+                        (forall [h objs]
+                          (=> (proper-subset? (oprime g) (oprime h))
+                              (inz [h m])))
+                        (forall [n atts]
+                          (=> (proper-subset? (aprime m) (aprime n))
+                              (inz [g n]))))])))

 (defn reduce-clarified-context
   "Reduces context ctx assuming it is clarified."


Clarified comments on test 2-2

Clarified comments on test 2-2

--- test/workshop/jobs/challenge_2_2_test.clj
+++ test/workshop/jobs/challenge_2_2_test.clj
@@ -23,8 +23,8 @@
 ;; {:onyx/name :my-task-name
 ;;  :onyx/fn :my.ns/fn
 ;;  :onyx/type :function
-;;  :my/param "this is the argument"
-;;  :onyx/params [:my/param]}
+;;  :my/param "this is argument" ; actual value we'll pass for the argument identified by :my/param
+;;  :onyx/params [:my/param]}    ; vector of keywords to fill in as parameters
 ;;
 ;; Try it with:
 ;;


Update to newer ClojureScript

Update to newer ClojureScript

--- ClojureScript/replete/project.clj
+++ ClojureScript/replete/project.clj
@@ -1,6 +1,6 @@
 (defproject replete "0.1.0"
   :dependencies [[org.clojure/clojure "1.7.0"]
-                 [org.clojure/clojurescript "0.0-3426"]
+                 [org.clojure/clojurescript "0.0-3429"]
                  [org.clojure/tools.reader "0.10.0-SNAPSHOT" :exclusions [org.clojure/clojure]]
                  [com.cognitect/transit-cljs "0.8.220"]
                  [com.cognitect/transit-clj "0.8.275"]]


enable to toggle todo items

enable to toggle todo items

--- src/om_next_todolist/core.cljs
+++ src/om_next_todolist/core.cljs
@@ -8,11 +8,11 @@
 (def ENTER_KEY 13)

 (def app-state
-  (atom {:todos [{:id 1 :title "豚肉を買ってくる"}
-                 {:id 2 :title "たまねぎを買ってくる"}
-                 {:id 3 :title "にんじんを買ってくる"}
-                 {:id 4 :title "じゃがいもを買ってくる"}
-                 {:id 5 :title "カレーを作る"}]}))
+  (atom {:todos [{:id 1 :title "豚肉を買ってくる"       :completed true}
+                 {:id 2 :title "たまねぎを買ってくる"   :completed true}
+                 {:id 3 :title "にんじんを買ってくる"   :completed false}
+                 {:id 4 :title "じゃがいもを買ってくる" :completed false}
+                 {:id 5 :title "カレーを作る"           :completed false}]}))

 ;; -----------------------------------------------------------------------------
@@ -42,6 +42,22 @@
      (fn []
        (swap! state update :todos conj new-todo))}))

+(defn- id->index
+  [id todos]
+  (-> (for [[index todo] (map-indexed vector todos)
+            :when (= id (:id todo))]
+        index)
+      first))
+
+(defmethod mutate 'todo/toggle
+  [env key params]
+  (let [state (:state env)
+        id (:id params)
+        index (id->index id (:todos @state))]
+    {:action
+     (fn []
+       (swap! state update-in [:todos index :completed] not))}))
+

 ;; -----------------------------------------------------------------------------
 ;; Components
@@ -49,12 +65,17 @@
 (defui TodoItem
   static om/IQuery
   (query [this]
-    [:id :title])
+    [:id :title :completed])
   Object
   (render [this]
-    (let [props (om/props this)
-          title (:title props)]
-      (dom/li nil title))))
+    (let [{:keys [id title completed]} (om/props this)
+          class (if completed "completed" "")]
+      (dom/li nil
+        (dom/input #js {:type "checkbox"
+                        :className "toggle"
+                        :checked (and completed "checked")
+                        :onChange #(om/transact! this `[(todo/toggle {:id ~id})])})
+        (dom/span #js {:className class} title)))))

 (def todo-item (om/factory TodoItem))


Allow producer channel to pass a :crash signal to read-batch

If we do not allow for this, there is no way for a producer thread to
force the plugin to crash. This is a common issue in all plugins.

--- src/onyx/plugin/bookkeeper.clj
+++ src/onyx/plugin/bookkeeper.clj
@@ -63,9 +63,10 @@

 (defn close-read-ledgers-resources
   [{:keys [bookkeeper/producer-ch bookkeeper/commit-ch bookkeeper/read-ch bookkeeper/shutdown-ch] :as event} lifecycle]
+  ;; Before we waited for producer ch to return. We should probably still do so by checking the shutdown-ch
+  (close! shutdown-ch)
   (close! read-ch)
   (close! commit-ch)
-  (close! shutdown-ch)
   {})

 (defn set-starting-offset! [log task-map checkpoint-key start]
@@ -171,10 +172,11 @@
                         (let [exit (loop [last-acked (inc (:largest checkpointed))]
                                      (read-fn client ledger-id digest password read-ch deserializer-fn backoff-period last-acked max-id)
                                      :finished)]
-                          (if-not (= exit :shutdown)
+                          (if (= exit :finished)
                             (>!! read-ch (t/input (random-uuid) :done))))
                         (catch Exception e
-                          (fatal e))))]
+                          (>!! read-ch (t/input (random-uuid) :crash))
+                          (fatal "BookKeeper plugin: error reading." e))))]
     {:bookkeeper/read-ch read-ch
      :bookkeeper/shutdown-ch shutdown-ch
      :bookkeeper/commit-ch commit-ch
@@ -212,6 +214,9 @@
                            (keep (fn [_] (first (alts!! [read-ch timeout-ch] :priority true))))))]
       (doseq [m batch]
         (let [message (:message m)]
+          (when (= message :crash)
+            (throw (Exception. "Plugin crashed. Crash read.")))
+
           (when-not (= message :done)
             (swap! top-index max (:entry-id message))
             (swap! pending-indexes conj (:entry-id message))))


Use numeric indices so that we can more easily generate chords from scales.

--- src/overtunes/songs/at_all.clj
+++ src/overtunes/songs/at_all.clj
@@ -17,10 +17,12 @@
 (def note# (comp sampled-piano ground))
 (defn chord# [chord] (doseq [note (vals chord)] (note# note)))

-(def ionian {:i 0, :ii 2, :iii 4, :iv 5, :v 7, :vi 9, :vii 11, :viii 12})
-(def I (select-keys ionian [:i :iii :v]))
-(def II (select-keys ionian [:ii :iv :vi]))
-(def V (select-keys ionian [:v :vii :ii]))
+(def ionian (sorted-map 1 0, 2 2, 3 4, 4 5, 5 7, 6 9, 7 11, 8 12))
+
+(defn triad [scale root] (zipmap [5 3 1] (vals (select-keys scale [root (+ 2 root) (+ 4 root)] ))))
+(def I (triad ionian 1))
+(def II (triad ionian 2))
+(def V (triad ionian 5))

 (def progression [I {} II {} II V I V])

@@ -29,4 +31,4 @@
     (at (timing 0) (chord# (first chords)))
     (rythm-n-bass# (from timing 4) (rest chords))))

-; (rythm-n-bass# (bpm 130) (cycle progression))
+(rythm-n-bass# (bpm 130) (cycle progression))


new dns

new dns

--- src/otp_api_proxy/util.clj
+++ src/otp_api_proxy/util.clj
@@ -55,7 +55,7 @@

 (defn gtfs-api-stops-request []
   (let [test-api-url
-        (str "http://gtfs-api.groth-geodata.com/gtfs-api/"
+        (str "http://gtfs-api.trilliumtransit.com/gtfs-api/"
              (reduce str (interpose "/"
                                     [ "stops"
                                       "by-feed/anaheim-ca-us"
@@ -69,7 +69,7 @@

 (defn gtfs-api-routes-request []
   (let [test-api-url
-        (str "http://gtfs-api.groth-geodata.com/gtfs-api/"
+        (str "http://gtfs-api.trilliumtransit.com/gtfs-api/"
              (reduce str (interpose "/"
                                     [ "routes"
                                       "by-feed/anaheim-ca-us"
@@ -88,12 +88,12 @@
   { :early (remove-debug-info (:early route-span))
     :late  (remove-debug-info (:late  route-span)) }))

-;; "http://gtfs-api.groth-geodata.com/gtfs-api/route-span/day-in-la/2015-4-13/by-feed/anaheim-ca-us/route-id/1700"
+;; "http://gtfs-api.trilliumtransit.com/gtfs-api/route-span/day-in-la/2015-4-13/by-feed/anaheim-ca-us/route-id/1700"
 (defn gtfs-api-routes-span-request
   "route-id should be a text gtfs route_id. day-in-la is formatted YYYY-MM-DD."
   [route-id day-in-la]
   (let [test-api-url
-        (str "http://gtfs-api.groth-geodata.com/gtfs-api/route-span/"
+        (str "http://gtfs-api.trilliumtransit.com/gtfs-api/route-span/"
              (reduce str (interpose "/"
                                     [ "day-in-la" day-in-la
                                       "by-feed/anaheim-ca-us"
@@ -151,9 +151,9 @@
                              (str arg "=" (get params arg))
                              ""))
         otp-url
-        ; (str "http://anaheim-otp.groth-geodata.com/otp/routers/default/plan"
-        (str "http://anaheim-otp.groth-geodata.com/otp-0.18/routers/default/plan"
-        ;;(str "http://anaheim-otp.groth-geodata.com/anaheim-1.0/otp/routers/default/plan"
+        ; (str "http://anaheim-otp.trilliumtransit.com/otp/routers/default/plan"
+        (str "http://anaheim-otp-server.trilliumtransit.com/otp-0.18/routers/default/plan"
+        ;;(str "http://anaheim-otp.trilliumtransit.com/anaheim-1.0/otp/routers/default/plan"
              "?"
              ;; banned routes format is: agency_id '__' route_id
              ;; agency_id 248 is Anaheim, route id 1711 is route 20
@@ -179,7 +179,7 @@

 (defn simple-otp-request-live-2 []
   (let [test-otp-url
-        (str "http://anaheim-otp.groth-geodata.com/otp/routers/default/plan"
+        (str "http://anaheim-otp.trilliumtransit.com/otp/routers/default/plan"
              "?"
              (reduce str (interpose "&"
                                     [ "fromPlace=33.8046480634388,-117.915358543396"
@@ -198,7 +198,7 @@

 (defn simple-otp-request-live []
   (let [test-otp-url
-        (str "http://anaheim-otp.groth-geodata.com/otp/routers/default/plan"
+        (str "http://anaheim-otp.trilliumtransit.com/otp/routers/default/plan"
              "?"
              (reduce str (interpose "&"
                                     [ "fromPlace=33.8046480634388,-117.915358543396"


Fix bug in buffer when passing a float as the size param.

--- src/overtone/sc/buffer.clj
+++ src/overtone/sc/buffer.clj
@@ -52,10 +52,12 @@

 (defn buffer
   "Synchronously allocate a new zero filled buffer for storing audio
-  data with the specified size and num-channels."
+  data with the specified size and num-channels. Size will be
+  automatically floored and converted to a Long - i.e. 2.7 -> 2"
   ([size] (buffer size 1))
   ([size num-channels]
-     (let [id   (with-server-self-sync
+     (let [size (long size)
+           id   (with-server-self-sync
                   (fn [uid]
                     (alloc-id :audio-buffer
                               1


add ensure-buffer-active! similar to the node variant.

--- src/overtone/sc/buffer.clj
+++ src/overtone/sc/buffer.clj
@@ -7,6 +7,22 @@
         [overtone.sc server info]
         [overtone.helpers audio-file lib file]
         [overtone.sc.util :only [id-mapper]]))
+
+(defonce ^{:dynamic true} *inactive-buffer-modification-error* :exception)
+
+(defn- inactive-buffer-modification-error
+  "The default error behaviour triggered when a user attempts to work
+   with an inactive buffer"
+  [buf err-msg]
+  (condp = *inactive-buffer-modification-error*
+    :silent    nil ;;do nothing
+    :warning   (println "Warning - " err-msg buf " " (with-out-str (print buf)))
+    :exception (throw (Exception. (str "Error - " err-msg " " (with-out-str (print buf)))))
+    (throw
+     (IllegalArgumentException.
+      (str "Unexpected value for *inactive-buffer-modification-error*: "
+           *inactive-buffer-modification-error*
+           "Expected one of :silent, :warning, :exception.")))))

 (defrecord BufferInfo [id size n-channels rate n-samples rate-scale duration]
   to-sc-id*
@@ -158,6 +174,13 @@
   (and (buffer? b)
        (= :live @(:status b))))

+(defn ensure-buffer-active!
+  ([buf] (ensure-buffer-active! buf "Trying to work with an inactive buffer."))
+  ([buf err-msg]
+     (when (and (buffer? buf)
+                (not (buffer-live? b)))
+       (inactive-buffer-modification-error buf err-msg))))
+
 (defn buffer-free
   "Synchronously free an audio buffer and the memory it was consuming."
   [buf]


fix some anim loops

fix some anim loops

--- src/parinfer/vcr_data.cljs
+++ src/parinfer/vcr_data.cljs
@@ -1110,169 +1110,188 @@
   )

 (def indent-far
-  '{:loop-delay 1000
-    :timescale 2
-    :changes
-    [{:change
+  '{:changes
+    [{:selections ({:anchor {:line 1, :ch 0}, :head {:line 1, :ch 0}}),
+      :dt 0}
+     {:change
       {:from {:line 1, :ch 0},
        :to {:line 1, :ch 0},
        :text (" "),
        :origin "+input"},
-      :dt 0}
+      :dt 566}
      {:change
       {:from {:line 1, :ch 1},
        :to {:line 1, :ch 1},
        :text (" "),
        :origin "+input"},
-      :dt 186}
+      :dt 185}
      {:change
       {:from {:line 1, :ch 2},
        :to {:line 1, :ch 2},
        :text (" "),
        :origin "+input"},
-      :dt 799}
+      :dt 571}
      {:change
       {:from {:line 1, :ch 3},
        :to {:line 1, :ch 3},
        :text (" "),
        :origin "+input"},
-      :dt 212}
+      :dt 169}
      {:change
       {:from {:line 1, :ch 4},
        :to {:line 1, :ch 4},
        :text (" "),
        :origin "+input"},
-      :dt 204}
+      :dt 203}
      {:change
       {:from {:line 1, :ch 5},
        :to {:line 1, :ch 5},
        :text (" "),
        :origin "+input"},
-      :dt 236}
+      :dt 225}
      {:change
       {:from {:line 1, :ch 6},
        :to {:line 1, :ch 6},
        :text (" "),
        :origin "+input"},
-      :dt 754}
+      :dt 889}
      {:change
       {:from {:line 1, :ch 7},
        :to {:line 1, :ch 7},
        :text (" "),
        :origin "+input"},
-      :dt 213}
+      :dt 202}
      {:change
       {:from {:line 1, :ch 8},
        :to {:line 1, :ch 8},
        :text (" "),
        :origin "+input"},
-      :dt 248}
+      :dt 216}
      {:change
       {:from {:line 1, :ch 8},
        :to {:line 1, :ch 9},
        :text (""),
        :origin "+delete"},
-      :dt 1270}
+      :dt 799}
      {:change
       {:from {:line 1, :ch 7},
        :to {:line 1, :ch 8},
        :text (""),
        :origin "+delete"},
-      :dt 225}
+      :dt 188}
      {:change
       {:from {:line 1, :ch 6},
        :to {:line 1, :ch 7},
        :text (""),
        :origin "+delete"},
-      :dt 230}
+      :dt 211}
      {:change
       {:from {:line 1, :ch 5},
        :to {:line 1, :ch 6},
        :text (""),
        :origin "+delete"},
-      :dt 749}
+      :dt 636}
      {:change
       {:from {:line 1, :ch 4},
        :to {:line 1, :ch 5},
        :text (""),
        :origin "+delete"},
-      :dt 225}
+      :dt 188}
      {:change
       {:from {:line 1, :ch 3},
        :to {:line 1, :ch 4},
        :text (""),
        :origin "+delete"},
-      :dt 217}
+      :dt 191}
      {:change
       {:from {:line 1, :ch 2},
        :to {:line 1, :ch 3},
        :text (""),
        :origin "+delete"},
-      :dt 266}
+      :dt 213}
      {:change
       {:from {:line 1, :ch 1},
        :to {:line 1, :ch 2},
        :text (""),
        :origin "+delete"},
-      :dt 1006}
+      :dt 754}
 {:change
  {:from {:line 1, :ch 0},
   :to {:line 1, :ch 1},
   :text (""),
   :origin "+delete"},
- :dt 176}],
+ :dt 195}],
 :init-value "(let [m {:foo 1}])\n:bar 2",
-:last-time 1444141621667,
-:recording? false,
-})
+:last-time 1444670828840,
+:recording? false,
+:loop-delay 1000,
+:timescale 2})

 (def indent-multi
-  '{:timescale 2
-    :changes
-    [{:change
+  '{:changes
+    [{:selections ({:anchor {:line 0, :ch 0}, :head {:line 0, :ch 0}}),
+      :dt 0}
+     {:change
+      {:from {:line 0, :ch 0},
+       :to {:line 0, :ch 0},
+       :text
+       ("(defn component []"
+               "  (html)"
+               "  [:div {:style {:background \"#FFF\"}"
+               "         :color \"#000\"}]"
+               "  [:h1 \"title\"])"),
+       :origin "paste"},
+      :dt 592}
+     {:selections ({:anchor {:line 3, :ch 9}, :head {:line 3, :ch 9}}),
+      :dt 1014}
+     {:change
       {:from {:line 3, :ch 9},
        :to {:line 3, :ch 9},
        :text ("  "),
        :origin "+input"},
-      :dt 0}
+      :dt 443}
      {:change
       {:from {:line 3, :ch 11},
        :to {:line 3, :ch 11},
        :text ("  "),
        :origin "+input"},
-      :dt 236}
+      :dt 213}
      {:change
       {:from {:line 3, :ch 13},
        :to {:line 3, :ch 13},
        :text ("  "),
        :origin "+input"},
-      :dt 257}
+      :dt 238}
      {:change
       {:from {:line 3, :ch 15},
        :to {:line 3, :ch 15},
        :text ("  "),
        :origin "+input"},
-      :dt 362}
+      :dt 227}
      {:selections ({:anchor {:line 2, :ch 2}, :head {:line 2, :ch 2}}),
-      :dt 1022}
+      :dt 1395}
      {:selections ({:anchor {:line 2, :ch 2}, :head {:line 2, :ch 3}}),
-      :dt 202}
-     {:selections ({:anchor {:line 2, :ch 2}, :head {:line 2, :ch 5}}),
+      :dt 82}
+     {:selections ({:anchor {:line 2, :ch 2}, :head {:line 3, :ch 5}}),
+      :dt 21}
+     {:selections ({:anchor {:line 2, :ch 2}, :head {:line 3, :ch 6}}),
+      :dt 16}
+     {:selections ({:anchor {:line 2, :ch 2}, :head {:line 3, :ch 8}}),
       :dt 17}
-     {:selections ({:anchor {:line 2, :ch 2}, :head {:line 3, :ch 9}}),
-      :dt 46}
-     {:selections ({:anchor {:line 2, :ch 2}, :head {:line 4, :ch 12}}),
-      :dt 9}
+     {:selections ({:anchor {:line 2, :ch 2}, :head {:line 4, :ch 10}}),
+      :dt 19}
      {:selections ({:anchor {:line 2, :ch 2}, :head {:line 4, :ch 13}}),
-      :dt 15}
+      :dt 16}
+     {:selections ({:anchor {:line 2, :ch 2}, :head {:line 4, :ch 15}}),
+      :dt 17}
      {:selections ({:anchor {:line 2, :ch 2}, :head {:line 4, :ch 16}}),
-      :dt 37}
+      :dt 17}
      {:change
       {:from {:line 2, :ch 0},
        :to {:line 2, :ch 2},
        :text ("    "),
        :origin "+input"},
-      :dt 597}
+      :dt 390}
      {:change
       {:from {:line 3, :ch 0},
        :to {:line 3, :ch 17},
@@ -1284,65 +1303,79 @@
        :to {:line 4, :ch 2},
        :text ("    "),
        :origin "+input"},
-      :dt 5}
+      :dt 4}
      {:selections ({:anchor {:line 4, :ch 4}, :head {:line 4, :ch 4}}),
-      :dt 1485}
+      :dt 1144}
+     {:selections ({:anchor {:line 4, :ch 4}, :head {:line 4, :ch 4}}),
+      :dt 22}
      {:change
       {:from {:line 4, :ch 4},
        :to {:line 4, :ch 4},
        :text ("  "),
        :origin "+input"},
-      :dt 446}],
-    :init-value
-    "(defn component []\n  (html)\n  [:div {:style {:background \"#FFF\"}\n         :color \"#000\"}]\n  [:h1 \"title\"])",
-    :last-time 1444164401491,
-    :recording? false})
+      :dt 578}],
+    :init-value "",
+    :last-time 1444670969215,
+    :recording? false,
+    :timescale 2})

 (def line
   '{:timescale 2
     :changes
-    [{:change
+    [{:selections ({:anchor {:line 0, :ch 0}, :head {:line 0, :ch 0}}),
+      :dt 0}
+     {:change
+      {:from {:line 0, :ch 0},
+       :to {:line 0, :ch 0},
+       :text
+       ("(ns example.core"
+             "  (:require"
+             "    [clojure.string :refer [join]]"
+             "    [clojure.data :refer [diff]]))"),
+       :origin "paste"},
+      :dt 600}
+     {:change
       {:from {:line 3, :ch 34},
        :to {:line 3, :ch 34},
        :text ("" ""),
        :origin "+input"},
-      :dt 0}
+      :dt 1071}
      {:change
       {:from {:line 4, :ch 0},
        :to {:line 4, :ch 0},
        :text ("  "),
        :origin "+input"},
-      :dt 181}
+      :dt 406}
      {:change
       {:from {:line 4, :ch 2},
        :to {:line 4, :ch 2},
        :text ("  "),
        :origin "+input"},
-      :dt 238}
+      :dt 214}
      {:change
       {:from {:line 4, :ch 4},
        :to {:line 4, :ch 4},
        :text ("e"),
        :origin "+input"},
-      :dt 280}
+      :dt 360}
      {:change
       {:from {:line 4, :ch 5},
        :to {:line 4, :ch 5},
        :text ("x"),
        :origin "+input"},
-      :dt 214}
+      :dt 257}
      {:change
       {:from {:line 4, :ch 6},
        :to {:line 4, :ch 6},
        :text ("a"),
        :origin "+input"},
-      :dt 71}
+      :dt 70}
      {:change
       {:from {:line 4, :ch 7},
        :to {:line 4, :ch 7},
        :text ("m"),
        :origin "+input"},
-      :dt 75}
+      :dt 90}
      {:change
       {:from {:line 4, :ch 8},
        :to {:line 4, :ch 8},
@@ -1354,192 +1387,191 @@
        :to {:line 4, :ch 9},
        :text ("l"),
        :origin "+input"},
-      :dt 81}
+      :dt 89}
      {:change
       {:from {:line 4, :ch 10},
        :to {:line 4, :ch 10},
        :text ("e"),
        :origin "+input"},
-      :dt 61}
+      :dt 136}
      {:change
       {:from {:line 4, :ch 11},
        :to {:line 4, :ch 11},
        :text ("."),
        :origin "+input"},
-      :dt 129}
+      :dt 99}
      {:change
       {:from {:line 4, :ch 12},
        :to {:line 4, :ch 12},
        :text ("b"),
        :origin "+input"},
-      :dt 110}
+      :dt 103}
      {:change
       {:from {:line 4, :ch 13},
        :to {:line 4, :ch 13},
        :text ("a"),
        :origin "+input"},
-      :dt 147}
+      :dt 146}
      {:change
       {:from {:line 4, :ch 14},
        :to {:line 4, :ch 14},
        :text ("r"),
        :origin "+input"},
-      :dt 115}
+      :dt 101}
      {:change
       {:from {:line 4, :ch 15},
        :to {:line 4, :ch 15},
        :text ("" ""),
        :origin "+input"},
-      :dt 504}
-     {:change
-      {:from {:line 5, :ch 0},
-       :to {:line 5, :ch 0},
-       :text ("    "),
-       :origin "+input"},
-      :dt 7}
-     {:change
-      {:from {:line 5, :ch 4},
-       :to {:line 5, :ch 4},
-       :text ("e"),
-       :origin "+input"},
-      :dt 222}
+      :dt 371}
+{:change
+ {:from {:line 5, :ch 0},
+  :to {:line 5, :ch 0},
+  :text ("    "),
+  :origin "+input"},
+ :dt 7}
+{:change
+ {:from {:line 5, :ch 4},
+  :to {:line 5, :ch 4},
+  :text ("e"),
+  :origin "+input"},
+ :dt 232}
 {:change
  {:from {:line 5, :ch 5},
   :to {:line 5, :ch 5},
   :text ("x"),
   :origin "+input"},
- :dt 209}
+ :dt 214}
 {:change
  {:from {:line 5, :ch 6},
   :to {:line 5, :ch 6},
   :text ("a"),
   :origin "+input"},
- :dt 92}
+ :dt 76}
 {:change
  {:from {:line 5, :ch 7},
   :to {:line 5, :ch 7},
   :text ("m"),
   :origin "+input"},
- :dt 66}
+ :dt 102}
 {:change
  {:from {:line 5, :ch 8},
   :to {:line 5, :ch 8},
   :text ("p"),
   :origin "+input"},
- :dt 45}
+ :dt 39}
 {:change
  {:from {:line 5, :ch 9},
   :to {:line 5, :ch 9},
   :text ("l"),
   :origin "+input"},
- :dt 124}
+ :dt 90}
 {:change
  {:from {:line 5, :ch 10},
   :to {:line 5, :ch 10},
   :text ("e"),
   :origin "+input"},
- :dt 115}
+ :dt 110}
 {:change
  {:from {:line 5, :ch 11},
   :to {:line 5, :ch 11},
   :text ("."),
   :origin "+input"},
- :dt 156}
+ :dt 109}
 {:change
  {:from {:line 5, :ch 12},
   :to {:line 5, :ch 12},
   :text ("b"),
   :origin "+input"},
- :dt 201}
+ :dt 145}
 {:change
  {:from {:line 5, :ch 13},
   :to {:line 5, :ch 13},
   :text ("a"),
   :origin "+input"},
- :dt 147}
+ :dt 283}
 {:change
  {:from {:line 5, :ch 14},
   :to {:line 5, :ch 14},
   :text ("z"),
   :origin "+input"},
- :dt 194}
+ :dt 180}
 {:change
  {:from {:line 5, :ch 14},
   :to {:line 5, :ch 15},
   :text (""),
   :origin "+delete"},
- :dt 1315}
+ :dt 477}
 {:change
  {:from {:line 5, :ch 13},
   :to {:line 5, :ch 14},
   :text (""),
   :origin "+delete"},
- :dt 499}
+ :dt 495}
 {:change
  {:from {:line 5, :ch 12},
   :to {:line 5, :ch 13},
   :text (""),
   :origin "+delete"},
- :dt 84}
+ :dt 104}
 {:change
  {:from {:line 5, :ch 11},
   :to {:line 5, :ch 12},
   :text (""),
   :origin "+delete"},
- :dt 90}
+ :dt 65}
 {:change
  {:from {:line 5, :ch 10},
   :to {:line 5, :ch 11},
   :text (""),
   :origin "+delete"},
- :dt 83}
+ :dt 82}
 {:change
  {:from {:line 5, :ch 9},
   :to {:line 5, :ch 10},
   :text (""),
   :origin "+delete"},
- :dt 81}
+ :dt 90}
 {:change
  {:from {:line 5, :ch 8},
   :to {:line 5, :ch 9},
   :text (""),
   :origin "+delete"},
- :dt 83}
+ :dt 85}
 {:change
  {:from {:line 5, :ch 7},
   :to {:line 5, :ch 8},
   :text (""),
   :origin "+delete"},
- :dt 87}
+ :dt 79}
 {:change
  {:from {:line 5, :ch 6},
   :to {:line 5, :ch 7},
   :text (""),
   :origin "+delete"},
- :dt 80}
+ :dt 88}
 {:change
  {:from {:line 5, :ch 5},
   :to {:line 5, :ch 6},
   :text (""),
   :origin "+delete"},
- :dt 260}
+ :dt 300}
 {:change
  {:from {:line 5, :ch 4},
   :to {:line 5, :ch 5},
   :text (""),
   :origin "+delete"},
- :dt 181}
+ :dt 135}
 {:selections ({:anchor {:line 5, :ch 4}, :head {:line 4, :ch 4}}),
- :dt 754}
+ :dt 676}
 {:change
  {:from {:line 4, :ch 4},
   :to {:line 5, :ch 4},
   :text (""),
   :origin "+delete"},
- :dt 495}],
-:init-value
-"(ns example.core\n  (:require\n    [clojure.string :refer [join]]\n    [clojure.data :refer [diff]]))",
-:last-time 1444253174845,
+ :dt 507}],
+:init-value "",
+:last-time 1444670641434,
 :recording? false})

 (def comment-


Fix argument order

Fix argument order

--- src/play_clj/core_graphics.clj
+++ src/play_clj/core_graphics.clj
@@ -586,7 +586,7 @@
     (render-sorted! screen [\"walls\"] entities)
     (render-sorted! screen #(sort-by :y %) [\"walls\"] entities)"
   ([screen layer-names entities]
-    (render-sorted! sort-by-y screen layer-names entities))
+    (render-sorted! screen sort-by-y layer-names entities))
   ([{:keys [^BatchTiledMapRenderer renderer
             ^Camera camera
             update-fn!]


Fleshed out function for performing moderation updates on conversations

--- src/polismath/conversation.clj
+++ src/polismath/conversation.clj
@@ -380,14 +380,18 @@
       (dissoc :keep-votes))))

-;(defn mod-uddate
-  ;[conv mods]
-  ;(let [mod-out (->> mods
-                     ;(filter #{-1})
-                     ;(map :tid))]
-    ;(-> conv
-        ;(update-in :rating-mat
-                   ;(
+(defn mod-uddate
+  "Take a conversation record and a seq of moderation data and updates the conversation's mod-out attr"
+  [conv mods]
+  (let [mod-sep (fn [mod] (->> mods (filter #{mod}) (map :tid)))
+        mod-out (mod-sep -1)
+        mod-in  (mod-spec 1)]
+    (update-in conv
+               [:mod-out]
+               (plmb/fn->
+                 (set)
+                 (into mod-out)
+                 (clojure.set/difference mod-in)))))

 ;; Creating some overrides for how core.matrix instances are printed, so that we can read them back via our


Tiny optimization of tag- and prop-name parsing

--- src/reagent/impl/template.cljs
+++ src/reagent/impl/template.cljs
@@ -44,7 +44,19 @@

 ;;; Props conversion

-(def cached-prop-name (util/memoize-1 undash-prop-name))
+(def prop-name-cache #js{})
+
+(defn obj-get [o k]
+  (when (.hasOwnProperty o k)
+    (aget o k)))
+
+(defn cached-prop-name [x]
+  (if (or (string? x)
+          (not (implements? INamed x)))
+    x
+    (if-let [s (obj-get prop-name-cache (name x))]
+      s
+      (aset prop-name-cache (name x) (undash-prop-name x)))))

 (defn convert-prop-value [x]
   (cond (string? x) x
@@ -56,26 +68,26 @@
                             #js{} x)
         :else (to-js-val x)))

-(defn set-id-class [props [id class]]
-  (when (some? id)
+(defn set-id-class [props id-class]
+  (when-some [id (.' id-class :idName)]
     (let [pid (.' props :id)]
       (.! props :id (if (some? pid) pid id))))
-  (when (some? class)
+  (when-some [class (.' id-class :className)]
     (let [old (.' props :className)]
       (.! props :className (if (some? old)
                              (str class " " old)
                              class)))))

 (defn convert-props [props id-class]
-  (if (and (empty? props) (nil? id-class))
+  (if (and (empty? props) (not (.' id-class :hasIdClass)))
     nil
     (let [objprops
           (reduce-kv (fn [o k v]
-                       (let [pname (cached-prop-name k)]
-                         (aset o pname (convert-prop-value v)))
-                       o)
+                       (doto o
+                         (aset (cached-prop-name k)
+                               (convert-prop-value v))))
                      #js{} props)]
-      (when (some? id-class)
+      (when (.' id-class :hasIdClass)
         (set-id-class objprops id-class))
       objprops)))

@@ -148,8 +160,10 @@
         class' (when class
                  (string/replace class #"\." " "))]
     (assert tag (str "Unknown tag: '" hiccup-tag "'"))
-    [tag (when (or id class')
-           [id class'])]))
+    #js{:name tag
+        :hasIdClass (or (some? id) (some? class'))
+        :idName id
+        :className class'}))

 (defn fn-to-class [f]
   (assert (ifn? f) (str "Expected a function, not " (pr-str f)))
@@ -177,16 +191,24 @@
       (some->> key (.! jsprops :key)))
     (.' js/React createElement c jsprops)))

-(def cached-parse (util/memoize-1 parse-tag))
+
+(def tag-name-cache #js{})
+
+(defn cached-parse [x]
+  (if-let [s (obj-get tag-name-cache (name x))]
+    s
+    (aset tag-name-cache (name x) (parse-tag x))))
+

 (declare as-element)

 (defn native-element [tag argv]
   (when (hiccup-tag? tag)
-    (let [[comp id-class] (cached-parse tag)]
+    (let [parsed (cached-parse tag)
+          comp (.' parsed :name)]
       (let [props (nth argv 1 nil)
             hasprops (or (nil? props) (map? props))
-            jsprops (convert-props (if hasprops props) id-class)
+            jsprops (convert-props (if hasprops props) parsed)
             first-child (if hasprops 2 1)]
         (if (input-component? comp)
           (-> [reagent-input argv comp jsprops first-child]


qm exists

qm exists

--- src/proxmox/generators.clj
+++ src/proxmox/generators.clj
@@ -24,13 +24,18 @@
     (prox-get (<< "/nodes/proxmox/openvz/~{id}")) true
     (catch [:status 500] e false)))

+(defn qm-exists [id]
+  (try+
+    (prox-get (<< "/nodes/proxmox/qemu/~{id}")) true
+    (catch [:status 500] e false)))
+
 (defn try-gen
   "Attempts to generate an id"
   []
   (loop [i 5]
     (when (> i 0)
       (let [id (+ 100 (gen-ct-id))]
-        (if-not (ct-exists id)
+        (if-not (and (ct-exists id) (qm-exists id))
           id
           (recur (- i 1)))))))


Fix ns declaration.

Fix ns declaration.

--- test/open_company/integration/section/section_new.clj
+++ test/open_company/integration/section/section_new.clj
@@ -1,4 +1,4 @@
-  (ns open-company.integration.authorization.section-new-auth
+  (ns open-company.integration.authorization.section-new
   (:require [clojure.walk :refer (keywordize-keys)]
             [midje.sweet :refer :all]
             [cheshire.core :as json]


If listen returns a deref, so should unlisten, I think [IMMUTANT-337]

--- modules/messaging/src/main/clojure/immutant/messaging.clj
+++ modules/messaging/src/main/clojure/immutant/messaging.clj
@@ -305,8 +305,7 @@
       (.close group)
       (let [complete (promise)]
         (.remove group #(deliver complete %))
-        (when-not (= "removed" (deref complete 5000 nil))
-          (log/error "Failed to remove group" group))))))
+        (delay (deref complete 5000 "gone"))))))

 (defn stop
   "Destroy a message destination. Typically not necessary since it


Restructure input data and add coalition example

--- dev/user.clj
+++ dev/user.clj
@@ -17,44 +17,46 @@
                  :roof 20
                  :plumbing 10})

-(def sites [{:payoff 300
-             :name "Sporthalle"
+(def sites {:sporthalle
+            {:payoff 400
              :skills {:walls 3
                       :roof 6
                       :plumbing 1}
              :location [4 4]}
+
+            :schwimmhalle
             {:payoff 600
-             :name "Schwimmhalle"
              :skills {:walls 2
                       :roof 0
                       :plumbing 8}
              :location [3 1]}
+
+            :einfamilienhaus
             {:payoff 150
-             :name "Einfamilienhaus"
              :skills {:walls 5
                       :roof 5
                       :plumbing 5}
-             :location [7 1]}])
+             :location [7 1]}})

-(def agents [{:name "Maurer 1"
-              :skill :walls
-              :capacity 10
-              :location [1 5]}
-             {:name "Maurer 2"
-              :skill :walls
-              :capacity 7
-              :location [5 4]}
-             {:name "Dachdecker 1"
-              :skill :roof
-              :capacity 15
-              :location [0 2]}
-             {:name "Klempner 1"
-              :skill :plumbing
-              :capacity 8
-              :location [3 2]}
-             {:name "Klempner 2"
-              :skill :plumbing
-              :capacity 8
-              :location [8 2]}])
+(def agents {:maurer1     {:skill :walls
+                           :capacity 10
+                           :location [1 5]}
+             :maurer2     {:skill :walls
+                           :capacity 7
+                           :location [5 4]}
+             :dachdecker1 {:skill :roof
+                           :capacity 15
+                           :location [0 2]}
+             :klempner1   {:skill :plumbing
+                           :capacity 8
+                           :location [3 2]}
+             :klempner2   {:skill :plumbing
+                           :capacity 8
+                           :location [8 2]}})
+
+(def coalition {:site :sporthalle
+                :allocation {:walls {:maurer1 1 :maurer2 2}
+                             :roof {:dachdecker1 6}
+                             :plumbing {:klempner1 1}}})


refactor(jdt): code cleanup

refactor(jdt): code cleanup

--- ccw.core/src/clj/ccw/jdt.clj
+++ ccw.core/src/clj/ccw/jdt.clj
@@ -8,8 +8,6 @@
            [org.eclipse.jdt.launching JavaRuntime]
            [org.eclipse.core.resources IResource]
            [org.eclipse.core.runtime IPath]))
-
-(println "ccw.jdt load starts")

 ;; We do not directly reference org.eclipse.jdt.ui/PreferenceConstants
 ;; because depending on when the class is imported, its initialization may occur
@@ -145,5 +143,3 @@
         path
         (e/path (default-output-path java-project)))
       progress-monitor)))
-
-(println "ccw.jdt namespace loaded")


Allow passing :class nil explicitly

Allow passing :class nil explicitly

--- src/reagent/impl/util.cljs
+++ src/reagent/impl/util.cljs
@@ -147,8 +147,8 @@
            rst)))

 (defn- merge-class [p1 p2]
-  (if-let [names (class-names (:class p1) (:class p2))]
-    (assoc p2 :class names)
+  (if (or (contains? p1 :class) (contains? p2 :class))
+    (assoc p2 :class (class-names (:class p1) (:class p2)))
     p2))

 (defn- merge-style [p1 p2]


eliminate runtime apply calls

eliminate runtime apply calls

--- src/sablono/cljss_compiler.clj
+++ src/sablono/cljss_compiler.clj
@@ -5,9 +5,10 @@

 (defn- compile-class [class styles]
   (let [cls (str "css-" (hash styles))
-        gen-class `(apply cljss.core/css ~(builder/build-styles cls styles))]
+        gen-class `(cljss.core/css ~@(builder/build-styles cls styles))]
     (if (seq class)
-      `(apply str ~gen-class " " ~@(interpose " " class))
+      `(str ~gen-class " " ~@(->> (mapcat identity class)
+                                  (interpose " ")))
       gen-class)))

 (defn- normalize-attr [tag name type]


Tweaking copy around follow-up notification.

--- src/oc/email/content.clj
+++ src/oc/email/content.clj
@@ -68,7 +68,7 @@
 (def digest-title-daily "☕ Your %s morning digest")

 ;; Follow-up notification
-(def follow-up-subject-text "%s created a follow-up for you")
+(def follow-up-subject-text "%s requested you to follow up")

 (defn- preheader-spacer []
   (s/join (repeat 120 " ")))