Organize protocol impls by type with extend-type instead of by protocol. Add boolean pr-str support to the test harness. Refs #22

--- src/cljs/cljs/core.cljs
+++ src/cljs/cljs/core.cljs
@@ -628,9 +628,6 @@

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; equality ;;;;;;;;;;;;;;

-(extend-protocol IEquiv
-  goog.global.Date ; treat dates as values
-  (-equiv [o other] (identical? (str o) (str other))))

 (defn = [x y]
   (if (satisfies? IEquiv x)
@@ -719,161 +716,6 @@
     (when (< i (-count prim))
       (cons (-nth prim i) (prim-seq prim (inc i))))))

-(extend-protocol ISeqable
-  string
-  (-seq [string] (prim-seq string 0))
-
-  array
-  (-seq [array] (array-seq array 0)))
-
-(deftype List [meta first rest count]
-  IWithMeta
-  (-with-meta [coll meta] (List. meta first rest count))
-
-  IMeta
-  (-meta [coll] meta)
-
-  ISeq
-  (-first [coll] first)
-  (-rest [coll] (if (nil? rest) (EmptyList. meta) rest))
-
-  IStack
-  (-peek [coll] first)
-  (-pop [coll] (-rest coll))
-
-  ICollection
-  (-conj [coll o] (List. meta o coll (inc count)))
-
-  IEmptyableCollection
-  (-iempty [coll] coll)
-
-  ISequential
-  IEquiv
-  (-equiv [coll other] (equiv-sequential coll other))
-
-  IHash
-  (-hash [coll] (hash-coll coll))
-
-  ISeqable
-  (-seq [coll] coll)
-
-  ICounted
-  (-count [coll] count)
-
-  IPrintable
-  (-pr-seq [coll opts] (pr-sequential pr-seq "(" " " ")" opts coll)))
-
-(deftype EmptyList [meta]
-  IWithMeta
-  (-with-meta [coll meta] (EmptyList. meta))
-
-  IMeta
-  (-meta [coll] meta)
-
-  ISeq
-  (-first [coll] nil)
-  (-rest [coll] nil)
-
-  IStack
-  (-peek [coll] nil)
-  (-pop [coll] #_(throw "Can't pop empty list"))
-
-  ICollection
-  (-conj [coll o] (List. meta o nil 1))
-
-  IEmptyableCollection
-  (-iempty [coll] coll)
-
-  ISequential
-  IEquiv
-  (-equiv [coll other] (equiv-sequential coll other))
-
-  IHash
-  (-hash [coll] (hash-coll coll))
-
-  ISeqable
-  (-seq [coll] nil)
-
-  ICounted
-  (-count [coll] 0)
-
-  IPrintable
-  (-pr-seq [coll opts] (list "()")))
-
-(set! cljs.core.List/EMPTY (EmptyList. nil))
-
-(defn list [& items]
-  (reduce conj () (reverse items)))
-
-(deftype Cons [meta first rest]
-  IWithMeta
-  (-with-meta [coll meta] (Cons. meta first rest))
-
-  IMeta
-  (-meta [coll] meta)
-
-  ISeq
-  (-first [coll] first)
-  (-rest [coll] (if (nil? rest) () rest))
-
-  ICollection
-  (-conj [coll o] (Cons. nil o coll))
-
-  IEmptyableCollection
-  (-iempty [coll] (EmptyList. nil))
-
-  ISequential
-  IEquiv
-  (-equiv [coll other] (equiv-sequential coll other))
-
-  IHash
-  (-hash [coll] (hash-coll coll))
-
-  ISeqable
-  (-seq [coll] coll)
-
-  IPrintable
-  (-pr-seq [coll opts] (pr-sequential pr-seq "(" " " ")" opts coll)))
-
-(extend-protocol ICounted
-  string
-  (-count [s] (.length s))
-
-  array
-  (-count [a] (.length a)))
-
-(extend-protocol IIndexed
-  string
-  (-nth
-    ([string n]
-       (if (< n (-count string)) (.charAt string n)))
-    ([string n not-found]
-       (if (< n (-count string)) (.charAt string n)
-           not-found)))
-
-  array
-  (-nth
-    ([array n]
-       (if (< n (-count array)) (aget array n)))
-    ([array n not_found]
-       (if (< n (-count array)) (aget array n)
-           not_found))))
-
-(extend-protocol ILookup
-  string
-  (-lookup
-    ([string k]
-       (-nth string k))
-    ([string k not_found]
-       (-nth string k not_found)))
-
-  array
-  (-lookup
-    ([array k]
-       (-nth array k))
-    ([array k not-found]
-       (-nth array k not-found))))
-
 (defn- ci-reduce
   "Accepts any collection which satisfies the ICount and IIndexed protocols and
 reduces them without incurring seq initialization"
@@ -883,19 +725,210 @@
            (recur (f val (-nth cicoll n)) (inc n))
            val))))

-(extend-protocol IReduce
-  string
+(extend-type goog.global.Date
+  IEquiv
+  (-equiv [o other] (identical? (str o) (str other))))
+
+(extend-type boolean
+  IPrintable
+  (-pr-seq [bool opts] (list (str bool))))
+
+(extend-type number
+  IHash
+  (-hash [o] o)
+
+  IPrintable
+  (-pr-seq [n opts] (list (str n))))
+
+(extend-type string
+  IHash
+  (-hash [o] (goog.string/hashCode o))
+
+  ISeqable
+  (-seq [string] (prim-seq string 0))
+
+  ICounted
+  (-count [s] (.length s))
+
+  IIndexed
+  (-nth
+    ([string n]
+       (if (< n (-count string)) (.charAt string n)))
+    ([string n not-found]
+       (if (< n (-count string)) (.charAt string n)
+           not-found)))
+
+  ILookup
+  (-lookup
+    ([string k]
+       (-nth string k))
+    ([string k not_found]
+       (-nth string k not_found)))
+
+  IReduce
   (-reduce
     ([string f]
        (ci-reduce string f (-nth string 0) 1))
     ([string f start]
        (ci-reduce string f start 0)))
-  array
+
+  IPrintable
+  (-pr-seq [obj opts]
+    (cond
+     (keyword? obj)
+     (list (str ":"
+                (when-let [nspc (namespace obj)]
+                  (str nspc "/"))
+                (name obj)))
+     (symbol? obj)
+     (list (str (when-let [nspc (namespace obj)]
+                  (str nspc "/"))
+                (name obj)))
+     (get opts :readably)
+     (list (goog.string.quote obj))
+     :else (list obj))))
+
+(extend-type array
+  ISeqable
+  (-seq [array] (array-seq array 0))
+
+  ICounted
+  (-count [a] (.length a))
+
+  IIndexed
+  (-nth
+    ([array n]
+       if (< n (-count array)) (aget array n))
+    ([array n not_found]
+       (if (< n (-count array)) (aget array n)
+           not_found)))
+
+  ILookup
+  (-lookup
+    ([array k]
+       (-nth array k))
+    ([array k not-found]
+       (-nth array k not-found)))
+
+  IReduce
   (-reduce
     ([array f]
        (ci-reduce array f (-nth array 0) 1))
     ([array f start]
-       (ci-reduce array f start 0))))
+       (ci-reduce array f start 0)))
+
+  IPrintable
+  (-pr-seq [a opts]
+    (pr-sequential pr-seq "#<Array [" ", " "]>" opts a)))
+
+(deftype List [meta first rest count]
+  IWithMeta
+  (-with-meta [coll meta] (List. meta first rest count))
+
+  IMeta
+  (-meta [coll] meta)
+
+  ISeq
+  (-first [coll] first)
+  (-rest [coll] (if (nil? rest) (EmptyList. meta) rest))
+
+  IStack
+  (-peek [coll] first)
+  (-pop [coll] (-rest coll))
+
+  ICollection
+  (-conj [coll o] (List. meta o coll (inc count)))
+
+  IEmptyableCollection
+  (-iempty [coll] coll)
+
+  ISequential
+  IEquiv
+  (-equiv [coll other] (equiv-sequential coll other))
+
+  IHash
+  (-hash [coll] (hash-coll coll))
+
+  ISeqable
+  (-seq [coll] coll)
+
+  ICounted
+  (-count [coll] count)
+
+  IPrintable
+  (-pr-seq [coll opts] (pr-sequential pr-seq "(" " " ")" opts coll)))
+
+(deftype EmptyList [meta]
+  IWithMeta
+  (-with-meta [coll meta] (EmptyList. meta))
+
+  IMeta
+  (-meta [coll] meta)
+
+  ISeq
+  (-first [coll] nil)
+  (-rest [coll] nil)
+
+  IStack
+  (-peek [coll] nil)
+  (-pop [coll] #_(throw "Can't pop empty list"))
+
+  ICollection
+  (-conj [coll o] (List. meta o nil 1))
+
+  IEmptyableCollection
+  (-iempty [coll] coll)
+
+  ISequential
+  IEquiv
+  (-equiv [coll other] (equiv-sequential coll other))
+
+  IHash
+  (-hash [coll] (hash-coll coll))
+
+  ISeqable
+  (-seq [coll] nil)
+
+  ICounted
+  (-count [coll] 0)
+
+  IPrintable
+  (-pr-seq [coll opts] (list "()")))
+
+(set! cljs.core.List/EMPTY (EmptyList. nil))
+
+(defn list [& items]
+  (reduce conj () (reverse items)))
+
+(deftype Cons [meta first rest]
+  IWithMeta
+  (-with-meta [coll meta] (Cons. meta first rest))
+
+  IMeta
+  (-meta [coll] meta)
+
+  ISeq
+  (-first [coll] first)
+  (-rest [coll] (if (nil? rest) () rest))
+
+  ICollection
+  (-conj [coll o] (Cons. nil o coll))
+
+  IEmptyableCollection
+  (-iempty [coll] (EmptyList. nil))
+
+  ISequential
+  IEquiv
+  (-equiv [coll other] (equiv-sequential coll other))
+
+  IHash
+  (-hash [coll] (hash-coll coll))
+
+  ISeqable
+  (-seq [coll] coll)
+
+  IPrintable
+  (-pr-seq [coll opts] (pr-sequential pr-seq "(" " " ")" opts coll)))

 (defn cons
   "Returns a new seq where x is the first element and seq is the rest."
@@ -1084,10 +1117,6 @@

 (defn vector [& args] (vec args))

-(extend-protocol IHash
-  string (-hash [o] (goog.string/hashCode o))
-  goog.global.Number (-hash [o] o))
-
 (defn hash [o]
   (if o
     (-hash o)
@@ -1642,26 +1671,6 @@
             (interpose [sep] (map #(print-one % opts) coll)))
           [end]))

-(extend-protocol IPrintable
-  goog.global.Boolean (-pr-seq [bool opts] (list (str bool)))
-  goog.global.Number (-pr-seq [n opts] (list (str n)))
-  string (-pr-seq [obj opts]
-                        (cond
-                          (keyword? obj)
-                            (list (str ":"
-                                       (when-let [nspc (namespace obj)]
-                                         (str nspc "/"))
-                                       (name obj)))
-                          (symbol? obj)
-                            (list (str (when-let [nspc (namespace obj)]
-                                         (str nspc "/"))
-                                       (name obj)))
-                          (get opts :readably)
-                            (list (goog.string.quote obj))
-                          :else (list obj)))
-  array (-pr-seq [a opts]
-                      (pr-sequential pr-seq "#<Array [" ", " "]>" opts a)))
-
 ; This should be different in different runtime envorionments. For example
 ; when in the browser, could use console.debug instead of print.
 (defn string-print [x]
@@ -1765,8 +1774,8 @@
   (assert (= (hash-map :foo 5)
              (assoc (cljs.core.ObjMap. nil (array) (js-obj)) :foo 5)))

-  (assert (= "[1 {:a 2, :b 42} #<Array [3, 4]>]"
-             (pr-str [1 {:a 2 :b 42} (array 3 4)])))
+  (assert (= "[1 true {:a 2, :b 42} #<Array [3, 4]>]"
+             (pr-str [1 true {:a 2 :b 42} (array 3 4)])))
   (assert (= "symbol\"'string"
              (pr-str (str 'symbol \" \' "string"))))
   (assert (not (= "one" "two")))


implements show-workout in om

implements show-workout in om

--- src/cljs/moon/core.cljs
+++ src/cljs/moon/core.cljs
@@ -15,70 +15,70 @@
     (:import goog.History))

 (defonce app-state (atom {:workout [
-              {:title "Double armed dead hang on front three fingers open handed"
-               :holds [5]
-               :duration 6
-               :rest 120
-               :repeat 3
-               }
-              {:title "Double armed dead hang on middle two fingers open handed"
-               :holds [5]
-               :duration 6
-               :rest 90
-               :repeat 2
-               }
-              {:title "Hang open handed on three fingers on one arm, decrease resistance as required until hang can be completed."
-               :holds [2,5]
-               :duration 6
-               :rest 60
-               :repeat 6
-               }
-              {:title "Rest"
-               :duration 0
-               :rest 300
-               :repeat 1
-               }
-              {:title "Double armed hang on full crimp position, on a first joint edge"
-               :holds [1,5]
-               :duration 6
-               :rest 90
-               :repeat 3
-               }
-              {:title "Double armed hang on full crimp, this time slightly smaller than the last set, i.e., _ of the the finger tip."
-               :holds [3,4]
-               :duration 6
-               :rest 90
-               :repeat 3
-               }
-              {:title "Single arm hang on 1st joint edge, decrease resistance if required until hang can be completed."
-               :holds [1, 4, 5]
-               :duration 6
-               :rest 60
-               :repeat 6
-               }
-              {:title "Rest"
-               :duration 0
-               :rest 300
-               :repeat 1
-               }
-              {:title "Single arm lock off at 90 degrees"
-               :holds [1, 5]
-               :duration 8
-               :rest 120
-               :repeat 6
-               }
-              {:title "Two one armed pull ups"
-               :holds [1, 5]
-               :rest 120
-               :repeat 4
-               }
-              {:title "Front levers"
-               :holds [1]
-               :duration 8
-               :rest 120
-               :repeat 3
-               }
-              ]}))
+                                    {:title "Double armed dead hang on front three fingers open handed"
+                                     :holds [5]
+                                     :duration 6
+                                     :rest 120
+                                     :repeat 3
+                                     }
+                                    {:title "Double armed dead hang on middle two fingers open handed"
+                                     :holds [5]
+                                     :duration 6
+                                     :rest 90
+                                     :repeat 2
+                                     }
+                                    {:title "Hang open handed on three fingers on one arm, decrease resistance as required until hang can be completed."
+                                     :holds [2,5]
+                                     :duration 6
+                                     :rest 60
+                                     :repeat 6
+                                     }
+                                    {:title "Rest"
+                                     :duration 0
+                                     :rest 300
+                                     :repeat 1
+                                     }
+                                    {:title "Double armed hang on full crimp position, on a first joint edge"
+                                     :holds [1,5]
+                                     :duration 6
+                                     :rest 90
+                                     :repeat 3
+                                     }
+                                    {:title "Double armed hang on full crimp, this time slightly smaller than the last set, i.e., _ of the the finger tip."
+                                     :holds [3,4]
+                                     :duration 6
+                                     :rest 90
+                                     :repeat 3
+                                     }
+                                    {:title "Single arm hang on 1st joint edge, decrease resistance if required until hang can be completed."
+                                     :holds [1, 4, 5]
+                                     :duration 6
+                                     :rest 60
+                                     :repeat 6
+                                     }
+                                    {:title "Rest"
+                                     :duration 0
+                                     :rest 300
+                                     :repeat 1
+                                     }
+                                    {:title "Single arm lock off at 90 degrees"
+                                     :holds [1, 5]
+                                     :duration 8
+                                     :rest 120
+                                     :repeat 6
+                                     }
+                                    {:title "Two one armed pull ups"
+                                     :holds [1, 5]
+                                     :rest 120
+                                     :repeat 4
+                                     }
+                                    {:title "Front levers"
+                                     :holds [1]
+                                     :duration 8
+                                     :rest 120
+                                     :repeat 3
+                                     }
+                                    ]}))

@@ -96,7 +96,7 @@

 (defn set-html [[keyword val]]
   (set-html! (by-id (str keyword)) (format keyword val)))
-
+
 (defmulti play :state)

 (defmethod play :almost [_]
@@ -123,22 +123,7 @@
     (set-html! (by-id ":remaining") (->minutes remaining))
     (set-html! (by-id ":type") (string/capitalize (name activity)))
     (dorun (map set-html (dissoc (assoc excercise :total total) :id :activity)))))
-
-(defn create-td [parent workout key]
-  (let [td (. js/document createElement "td")]
-    (. parent appendChild td)
-    (set-html! td (format key (get workout key)))))
-
-(defn create-row [parent workout]
-  (let [tr (. js/document createElement "tr")]
-    (set! (. tr -id) (str "workout-"(:id workout)))
-    (. parent appendChild tr)
-   (dorun (map (partial create-td tr workout ) [:title :holds :duration :rest :repeat]))))
-
-(defn to-html [workout]
-  (let [table (by-id "total")]
-    (dorun (map (partial create-row table) workout))))
-
+
 (defn wall-clock []
   (let [output (chan)]
     (go-loop []
@@ -195,51 +180,72 @@
   (do-workout))

 #_(defroute  "/workout" []
-  (.log js/console "starting workout")
-  (start-workout))
+    (.log js/console "starting workout")
+    (start-workout))

 (defn show-root []
   (let [go-chan (listen (by-id "ok") "click")]
-    (to-html (swap! app-state update-in [:workout] add-id ))
+    (swap! app-state update-in [:workout] add-id )
     (go (<! go-chan) (start-workout))))

 #_(defroute "/" []
-  (.log js/console "showing root")
-  (show-root))
-
-
-;; Quick and dirty history configuration.
+    (.log js/console "showing root")
+    (show-root))
+

 (defn main []
   (show-root)
   (swap! app-state assoc :running-workout false)
   (swap! app-state assoc :total-duration 0)
   #_(let [h (History.)]
-    (goog.events/listen h EventType/NAVIGATE #(secretary/dispatch! (.-token %)))
-    (doto h (.setEnabled true)
-          (.setToken "/"))))
+      (goog.events/listen h EventType/NAVIGATE #(secretary/dispatch! (.-token %)))
+      (doto h (.setEnabled true)
+            (.setToken "/"))))

 (defcomponent om-show-moon-board [data owner]
-  (render-state [_ _]
-                (dom/div {:class "row"}
-                         (dom/div {:class "col-sm-12"}
-                                  (dom/img {:class "img-rounded"
-                                            :src "FingerboardNumbered1.jpg"})))))
-
+  (render [_]
+          (dom/div {:class "row"}
+                   (dom/div {:class "col-sm-12"}
+                            (dom/img {:class "img-rounded"
+                                      :src "FingerboardNumbered1.jpg"})))))
+
+(defcomponent om-show-workout-detail [{:keys [id title holds duration rest repeat]} owner]
+  (render [_]
+          (dom/tr {:id (str "workout-" id)}
+                  (dom/td title)
+                  (dom/td (string/join ", " holds))
+                  (dom/td (->minutes duration))
+                  (dom/td (->minutes rest))
+                  (dom/td repeat))))
+
+(defcomponent om-show-total-workout [data owner]
+  (render [_]
+          (.log js/console (pr-str data))
+          (dom/table {:class "table table-striped"}
+                     (dom/tbody
+                      (dom/tr
+                       (dom/th "Description")
+                       (dom/th "Holds")
+                       (dom/th "Duration")
+                       (dom/th "Rest")
+                       (dom/th "Sets"))
+                     (map ->om-show-workout-detail data)))))
+
 (defcomponent om-show-workout [data owner]
-  (will-mount [_]
-              (om/set-state! owner :n (:init data)))
-  (render-state [this {:keys [n]}]
-                (->om-show-moon-board {})))
-
-;;(dom/span (str "Count: " n))
-;;(dom/button
-;;        {:on-click #(om/set-state! owner :n (inc n))}
-;;        "+")
-;;      (dom/button
-;;        {:on-click #(om/set-state! owner :n (dec n))}
-;;        "-"))))
+  (render [_]
+          (when-not (:running-workout data)
+            (dom/div
+             (->om-show-moon-board {})
+             (dom/div {:class "row heading"}
+                      (dom/div {:class "col-sm-12"}
+                               (dom/h1 "Total workout")))
+             (dom/div {:class "row"}
+                      (dom/div {:class "col-sm-12"}
+                               (dom/button {:class "btn block btn-block primary btn-primary"
+                                            :id "ok"}
+                                           "Go!")))
+             (->om-show-total-workout (:workout data))))))

 (om/root om-show-workout app-state
          {:target (by-id "app")})
-
+


Add cljs.quil.core/image support.

Add cljs.quil.core/image support.

--- src/cljx/quil/core.cljx
+++ src/cljx/quil/core.cljx
@@ -1934,7 +1934,7 @@
   [col]
   (.hue (current-graphics) (int col)))

-#+clj
+
 (defn
   ^{:requires-bindings true
     :processing-name "image()"
@@ -1956,9 +1956,13 @@
   Starting with release 0124, when using the default (JAVA2D)
   renderer, smooth will also improve image quality of resized
   images."
-  ([^PImage img x y] (.image (current-graphics) img (float x) (float y)))
-  ([^PImage img x y c d] (.image (current-graphics) img (float x) (float y)
-                                  (float c) (float d))))
+  (#+clj [^PImage img x y]
+   #+cljs [img x y]
+   (.image (current-graphics) img (float x) (float y)))
+
+  (#+clj [^PImage img x y c d]
+   #+cljs [img x y c d]
+   (.image (current-graphics) img (float x) (float y) (float c) (float d))))

 #+clj
 (defn


More efficient check for empty output task id list

--- storm-core/src/clj/backtype/storm/daemon/executor.clj
+++ storm-core/src/clj/backtype/storm/daemon/executor.clj
@@ -527,7 +527,7 @@
                                                                         overflow-buffer)
                                                            ))
                                          (if (and rooted?
-                                                  (seq out-ids)) ;; not empty
+                                                  (not (.isEmpty out-ids)))
                                            (do
                                              (.put pending root-id [task-id
                                                                     message-id


nimbus.clj/wait-for-desired-code-replication wrong reset for current-replication-count-jar in local mode

--- storm-core/src/clj/org/apache/storm/daemon/nimbus.clj
+++ storm-core/src/clj/org/apache/storm/daemon/nimbus.clj
@@ -518,9 +518,9 @@
           " total-wait-time " @total-wait-time)
         (swap! total-wait-time inc)
         (if (not (ConfigUtils/isLocalMode conf))
-          (reset! current-replication-count-conf  (get-blob-replication-count (ConfigUtils/masterStormConfKey storm-id) nimbus)))
+          (reset! current-replication-count-jar  (get-blob-replication-count (ConfigUtils/masterStormJarKey storm-id) nimbus)))
         (reset! current-replication-count-code  (get-blob-replication-count (ConfigUtils/masterStormCodeKey storm-id) nimbus))
-        (reset! current-replication-count-jar  (get-blob-replication-count (ConfigUtils/masterStormJarKey storm-id) nimbus))))
+        (reset! current-replication-count-conf  (get-blob-replication-count (ConfigUtils/masterStormConfKey storm-id) nimbus))))
     (if (and (< min-replication-count @current-replication-count-conf)
              (< min-replication-count @current-replication-count-code)
              (< min-replication-count @current-replication-count-jar))
@@ -1752,8 +1752,8 @@
         [this ^String file]
         (mark! nimbus:num-beginFileDownload-calls)
         (check-authorization! nimbus nil nil "fileDownload")
-        (let [is (BufferInputStream. (.getBlob (:blob-store nimbus) file nil)
-              ^Integer (Utils/getInt (conf STORM-BLOBSTORE-INPUTSTREAM-BUFFER-SIZE-BYTES)
+        (let [is (BufferInputStream. (.getBlob (:blob-store nimbus) file nil)
+              ^Integer (Utils/getInt (conf STORM-BLOBSTORE-INPUTSTREAM-BUFFER-SIZE-BYTES)
               (int 65536)))
               id (Utils/uuid)]
           (.put (:downloaders nimbus) id is)


Making it easier to adjust the number of notes in Reich example.

--- examples/piano_phase.clj
+++ examples/piano_phase.clj
@@ -14,6 +14,7 @@
           (sampled-piano (note n)))
       (apply-at t-next #'player [t-next speed notes]))))

+(def num-notes 1000)
 (do
-  (player (now) 338 (take 100 (cycle piece)))
-  (player (now) 328 (take 100 (cycle piece))))
+  (player (now) 338 (take num-notes (cycle piece)))
+  (player (now) 328 (take num-notes (cycle piece))))


render line chart without data correctly

- C3 interprets ["foo", null] as no-data, we are giving it ["foo"]

--- src-cljs/frontend/components/insights/project.cljs
+++ src-cljs/frontend/components/insights/project.cljs
@@ -41,8 +41,13 @@

 (defn build-time-line-chart [timing-data owner]
-  (let [columns [(cons "date" (map (comp time-format/parse :date) timing-data))
-                 (cons "Median Build Time" (map :median_build_time_millis timing-data))]]
+  (let [columns (if (empty? timing-data)
+                  [(cons "date" (if (empty? timing-data)
+                                  [nil]
+                                  (map (comp time-format/parse :date) timing-data)))
+                   (cons "Median Build Time" (if (empty? timing-data)
+                                               [nil]
+                                               (map :median_build_time_millis timing-data)))])]
    (reify
      om/IDidUpdate
      (did-update [_ _ _]


Smart cocoapods caching is no longer under active dev

--- src-cljs/frontend/components/project_settings.cljs
+++ src-cljs/frontend/components/project_settings.cljs
@@ -432,9 +432,8 @@
             (describe-flag {:flag :smart-cocoapods-caching
                            :title "Smart CocoaPods Caching"
                            :blurb [:p
-                                   "Enable aggressive caching of CocoaPods to remove the need to call the `pod install`
-                                   command on every build. This feature is under active development and might cause
-                                   spurious build failures from time to time."]})
+                                   "Enable caching of CocoaPods to remove the need to call the `pod install`
+                                   command on every build."]})

             ]]])))))


cleanup

cleanup

--- test/babel/test/en.cljc
+++ test/babel/test/en.cljc
@@ -586,38 +586,13 @@
     (is (not (empty? (get paths-to-lbs [:head :comp]))))
     (is (not (empty? (get paths-to-lbs [:comp]))))))

-(deftest benchmark []
+(deftest benchmark-test []
   (let [med (medium)
         to-run #(time (println (fo (generate
                                     {:synsem {:cat :verb, :sem {:pred :read
                                                                 :subj {:pred :woman}}
                                               :subcat '()}}))))]
     (is (= 50 (count (take 50 (repeatedly to-run)))))))
-
-(defn over-vals [key vals]
-  (map (fn [val]
-         {key val})
-       vals))
-
-(def as [{:a 1}{:a 2}])
-(def bs [{:b 4}{:b 5}])
-(def cs [{:c 6}{:c 7}{:c 8}])
-
-;; don't use: use combo/cartesian-product instead.
-;; how to use:
-;;(map flatten (cross-product [1 2 3][4 5 6 7][8 9 10]))
-;;(count (map flatten (apply cross-product (take 5 (repeatedly #(range 0 10))))))
-(defn cross-product [a b & more]
-  (if (not (empty? more))
-    (reduce
-     (fn [x y] (cross-product x y))
-     (concat (list a b) more))
-    (if (not (empty? a))
-      (concat
-       (map (fn [each-b]
-              [(first a) each-b])
-            b)
-       (cross-product (rest a) b)))))

 ;; usage: (show-mapping (mapping spec1))
 (defn show-mapping [mapping]


The first build of a new branch also sends a message

--- src-cljs/frontend/components/project_settings.cljs
+++ src-cljs/frontend/components/project_settings.cljs
@@ -522,7 +522,7 @@
                    :type "checkbox"}]
           [:span "Fixed/Failed Only"]
           [:i.fa.fa-question-circle {:id (str "fixed-failed-input-tooltip-hack-" id)
-                                     :title "Only send notifications for builds that fail or fix the tests. Otherwise, send a notification for every build."}]])))))
+                                     :title "Only send notifications for builds that fail or fix the tests and the first build on a new branch. Otherwise, send a notification for every build."}]])))))

 (defn chatroom-item [project-id settings owner
                      {:keys [service doc inputs show-fixed-failed? top-section-content settings-keys]}]


s/'()/[]/

s/'()/[]/

--- test/babel/test/fr.cljc
+++ test/babel/test/fr.cljc
@@ -198,7 +198,7 @@
                                 :conditional :regular}}))))

 (deftest generate-present-by-root-regular-1
-  (let [result (generate {:synsem {:subcat '()
+  (let [result (generate {:synsem {:subcat []
                                    :cat :verb
                                    :sem {:pred :top
                                          :subj {:pred :I}
@@ -210,7 +210,7 @@
     (is (= "je parle" (fo result)))))

 (deftest generate-present-by-semantics-regular-1
-  (let [result (generate {:synsem {:subcat '()
+  (let [result (generate {:synsem {:subcat []
                                    :cat :verb
                                    :sem {:pred :abandon
                                          :subj {:pred :I}
@@ -220,7 +220,7 @@
     (is (= "j'abandone" (fo result)))))

 (deftest generate-present-by-root-regular-2
-  (let [result (generate {:synsem {:subcat '()
+  (let [result (generate {:synsem {:subcat []
                                    :cat :verb
                                    :sem {:aspect :simple
                                          :tense :present}}
@@ -230,7 +230,7 @@
     (is (= "j'abandone" (fo result)))))

 (deftest generate-present-by-semantics-irregular-1
-  (let [result (generate {:synsem {:subcat '()
+  (let [result (generate {:synsem {:subcat []
                                    :cat :verb
                                    :sem {:pred :sleep
                                          :subj {:pred :I}
@@ -240,7 +240,7 @@
     (is (= "je dors" (fo result)))))

 (deftest generate-present-by-root-irregular-1
-  (let [result (generate {:synsem {:subcat '()
+  (let [result (generate {:synsem {:subcat []
                                    :cat :verb
                                    :sem {:aspect :simple
                                          :tense :present}}
@@ -250,7 +250,7 @@
     (is (= "je dors" (fo result)))))

 (deftest generate-present-by-root-with-boot-stem
-  (let [result (generate {:synsem {:subcat '()
+  (let [result (generate {:synsem {:subcat []
                                    :cat :verb
                                    :sem {:subj {:pred :noi}
                                          :tense :present
@@ -260,7 +260,7 @@
     (is (= "nous buvons" (fo result)))))

 (deftest generate-irregular-conditional
-  (let [result (generate {:synsem {:subcat '()
+  (let [result (generate {:synsem {:subcat []
                                    :sem {:subj {:pred :I}
                                          :tense :conditional}}
                           :root {:français {:français "aller"}}}
@@ -268,7 +268,7 @@
     (is (= "j'irais" (fo result)))))

 (deftest generate-regular-conditional
-  (let [result (generate {:synsem {:subcat '()
+  (let [result (generate {:synsem {:subcat []
                                    :cat :verb
                                    :sem {:subj {:pred :I}
                                          :tense :conditional}}
@@ -277,7 +277,7 @@
     (is (= "je dormirais" (fo result)))))

 (deftest generate-future-with-irregular-future-stem-1
-  (let [result (generate {:synsem {:subcat '()
+  (let [result (generate {:synsem {:subcat []
                                    :cat :verb
                                    :sem {:pred :call
                                          :subj {:pred :tu}
@@ -286,7 +286,7 @@
     (is (= "tu appelas" (fo result)))))

 (deftest generate-future-with-irregular-future-stem-2
-  (let [result (generate {:synsem {:subcat '()
+  (let [result (generate {:synsem {:subcat []
                                    :cat :verb
                                    :sem {:subj {:pred :tu}
                                          :tense :future}}
@@ -295,7 +295,7 @@
     (is (= "tu appelas" (fo result)))))

 (deftest generate-regular-conditional-reflexive
-  (let [result (generate {:synsem {:subcat '()
+  (let [result (generate {:synsem {:subcat []
                                    :cat :verb
                                    :sem {:subj {:pred :I}
                                          :tense :conditional}}
@@ -303,7 +303,7 @@
     (is (= "je m'amuserais" (fo result)))))

 (deftest generate-present-irregular-2
-  (let [result (generate {:synsem {:subcat '()
+  (let [result (generate {:synsem {:subcat []
                                    :cat :verb
                                    :sem {:pred :be
                                          :subj {:pred :I}
@@ -313,7 +313,7 @@
     (is (= "je suis" (fo result)))))

 (deftest generate-imparfait-regular-er
-  (let [result (generate {:synsem {:subcat '()
+  (let [result (generate {:synsem {:subcat []
                                    :cat :verb
                                    :sem {:pred :study
                                          :subj {:pred :I}
@@ -324,7 +324,7 @@
     (is (= "j'étudiais" (fo result)))))

 (deftest imparfait-insert-e-before-g
-  (let [result (generate {:synsem {:subcat '()
+  (let [result (generate {:synsem {:subcat []
                                    :cat :verb
                                    :sem {:subj {:pred :I}
                                          :tense :past
@@ -333,7 +333,7 @@
     (is (= "je mangeais" (fo result)))))

 (deftest imparfait-insert-cedilla-before-c
-  (let [result (generate {:synsem {:subcat '()
+  (let [result (generate {:synsem {:subcat []
                                    :cat :verb
                                    :sem {:subj {:pred :loro
                                                 :gender :fem}
@@ -343,7 +343,7 @@
     (is (= "elles commençaient" (fo result)))))

 (deftest generate-imparfait-regular-ir
-  (let [result (generate {:synsem {:subcat '()
+  (let [result (generate {:synsem {:subcat []
                                    :cat :verb
                                    :agr {:gender :masc}
                                    :sem {:pred :sleep
@@ -356,7 +356,7 @@
     (is (= "ils dormaient" (fo result)))))

 (deftest generate-imparfait-regular-re
-  (let [result (generate {:synsem {:subcat '()
+  (let [result (generate {:synsem {:subcat []
                                    :cat :verb
                                    :sem {:pred :sell
                                          :subj {:pred :voi}
@@ -367,7 +367,7 @@
     (is (= "vous vendiez" (fo result)))))

 (deftest generate-imparfait-finir
-  (let [result (generate {:synsem {:subcat '()
+  (let [result (generate {:synsem {:subcat []
                                    :cat :verb
                                    :sem {:subj {:pred :noi}
                                          :tense :past
@@ -377,7 +377,7 @@
     (is (= "nous finissions" (fo result)))))

 (deftest generate-imperfect-irregular-être
-  (let [result (generate {:synsem {:subcat '()
+  (let [result (generate {:synsem {:subcat []
                                    :cat :verb
                                    :infl :imperfect
                                    :sem {:pred :be
@@ -386,7 +386,7 @@
     (is (= "j'étais" (fo result)))))

 (deftest generate-imperfect-irregular-avoir
-  (let [result (generate/generate {:synsem {:subcat '()
+  (let [result (generate/generate {:synsem {:subcat []
                                             :cat :verb
                                             :infl :imperfect
                                             :sem {:pred :have
@@ -492,7 +492,7 @@

 (deftest generate-passe-compose
   (let [result (generate {:synsem {:cat :verb
-                                   :subcat '()
+                                   :subcat []
                                    :sem {:pred :go
                                          :subj {:pred :noi
                                                 :gender :fem}
@@ -502,7 +502,7 @@
     (is (= (fo result) "nous sommes allées"))))

 (deftest generate-passe-compose-essere-false
-  (let [result (generate {:synsem {:subcat '()
+  (let [result (generate {:synsem {:subcat []
                                    :sem {:subj {:pred :tu
                                                 :gender :fem}
                                          :aspect :perfect
@@ -515,7 +515,7 @@
   (is (not (empty? (get (:lexicon (small)) "pris"))))
   (is (= false (get-in (first (get (:lexicon (small)) "prendre"))
                        [:français :past-p :regular])))
-  (let [result (generate {:synsem {:subcat '()
+  (let [result (generate {:synsem {:subcat []
                                    :sem {:subj {:pred :noi}
                                          :aspect :perfect
                                          :tense :present}}
@@ -543,7 +543,7 @@
 (deftest generate-have-fun-sentence
   (let [result (generate
                 {:synsem {:cat :verb
-                          :subcat '()
+                          :subcat []
                           :sem {:pred :have-fun}}})]
     (is (= (get-in result [:synsem :sem :pred]) :have-fun))))

@@ -551,7 +551,7 @@
   (let [result
         (generate
          {:synsem {:cat :verb
-                   :subcat '()
+                   :subcat []
                    :sem {:subj {:pred :lei}
                          :pred :have-fun
                          :tense :present
@@ -562,7 +562,7 @@
   (let [result
         (generate
          {:synsem {:cat :verb
-                   :subcat '() :sem {:subj {:pred :lei}
+                   :subcat [] :sem {:subj {:pred :lei}
                                      :pred :have-fun
                                      :aspect :simple
                                      :tense :present}}})]
@@ -572,7 +572,7 @@
   (let [result
         (generate
          {:synsem {:cat :verb
-                   :subcat '()
+                   :subcat []
                    :sem {:pred :be-called
                          :aspect :simple
                          :tense :present
@@ -639,7 +639,7 @@
 (deftest have-fun
   (let [have-fun-expression
         (generate
-         {:synsem {:subcat '()
+         {:synsem {:subcat []
                    :cat :verb
                    :sem {:subj {:pred :lui}
                          :pred :have-fun
@@ -680,7 +680,7 @@
   ;; for now, the more general the spec, the longer it takes to generate.
   (log/info (str "speed-test-1"))
   (speed-test {:synsem {:cat :verb
-                        :subcat '()
+                        :subcat []
                         :sem {:pred :speak
                               :subj {:pred :noi}
                               :tense :past
@@ -688,36 +688,36 @@
 (deftest speed-test-2
   (log/info (str "speed-test-2"))
   (speed-test {:synsem {:cat :verb
-                        :subcat '()
+                        :subcat []
                         :sem {:pred :speak
                               :subj {:pred :noi}
                               :tense :conditional}}}))
 (deftest speed-test-3
   (log/info (str "speed-test-3"))
   (speed-test {:synsem {:cat :verb
-                        :subcat '()
+                        :subcat []
                         :sem {:pred :speak
                               :tense :conditional}}}))
 (deftest speed-test-4
   (log/info (str "speed-test-4"))
   (speed-test {:synsem {:cat :verb
-                        :subcat '()
+                        :subcat []
                         :sem {:pred :speak}}}))
 (deftest speed-test-5
   (log/info (str "speed-test-5"))
   (speed-test {:synsem {:cat :verb
-                        :subcat '()
+                        :subcat []
                         :sem {:tense :conditional}}}))
 (deftest speed-test-6
   (log/info (str "speed-test-6"))
   (speed-test {:synsem {:cat :verb
-                        :subcat '()
+                        :subcat []
                         :sem {:pred :speak
                               :subj {:pred :noi}
                               :tense :present
                               :aspect :perfect}}}))
 (def spec-7  {:synsem {:cat :verb
-                        :subcat '()
+                        :subcat []
                         :sem {:pred :speak
                               :tense :present
                               :aspect :perfect}}})
@@ -728,14 +728,14 @@
 (deftest speed-test-8
   (log/info (str "speed-test-8"))
   (speed-test {:synsem {:cat :verb
-                        :subcat '()
+                        :subcat []
                         :sem {:tense :present
                               :reflexive false
                               :aspect :perfect}}}))
 (deftest speed-test-9
   (log/info (str "speed-test-9"))
   (speed-test {:synsem {:cat :verb
-                        :subcat '()}}))
+                        :subcat []}}))

 (defn add-heads [rule & [spec]]
   (let [grammar (grammar/medium)]
@@ -770,7 +770,7 @@
   (map morph (add-comps rule)))

 (def spec-10
-  {:synsem {:subcat '()
+  {:synsem {:subcat []
             :cat :verb
             :sem {:tense :present
                   :reflexive true


fix test

fix test

--- test/babel/test/it.cljc
+++ test/babel/test/it.cljc
@@ -113,6 +113,7 @@
                            (take do-this-many expressions)))))))))

 (deftest roundtrip-small-grammar
+  (let [do-this-many 200]
     (is (empty?
          (filter #(not (nil? %))
                  (let [expressions
@@ -132,3 +133,4 @@
                                              [:synsem :sem])})
                              (log/info (str "parse OK:" (fo expr)))))
                          expressions)))))))
+


Changed file to function

Changed file to function

--- vendor/support.clj
+++ vendor/support.clj
@@ -28,10 +28,10 @@
   (doall (take-while identity
     (map re-find (repeat m)))))

-(defmacro file
+(defn file
   "Returns an instance of java.io.File."
-  [& args]
-  `(new java.io.File ~@args))
+  ([name]        (new java.io.File name))
+  ([parent name] (new java.io.File parent name)))

 (defn pipe-stream
   "Pipe the contents of an InputStream into an OutputStream."


(PDB-3938) Don't require memoize in population-test

--- test/puppetlabs/puppetdb/query/population_test.clj
+++ test/puppetlabs/puppetdb/query/population_test.clj
@@ -3,7 +3,6 @@
             [clojure.java.jdbc :as sql]
             [clojure.test :refer :all]
             [puppetlabs.puppetdb.jdbc :as jdbc]
-            [clojure.core.memoize :as mem]
             [puppetlabs.puppetdb.scf.storage :refer [deactivate-node!]]
             [puppetlabs.puppetdb.scf.storage-utils :as sutils :refer [to-jdbc-varchar-array]]
             [puppetlabs.puppetdb.testutils.db :refer [*db* with-test-db]]


update frequencies

update frequencies


Remove unnecessary code

Remove unnecessary code

--- src/braid/client/ui/styles/pages/channels.cljs
+++ src/braid/client/ui/styles/pages/channels.cljs
@@ -19,8 +19,7 @@
     [:.count
      {:margin-right (em 0.5)}
       [:&:after
-       {:font-family "fontawesome"
-        :margin-left (em 0.25)}]
+       {:margin-left (em 0.25)}]

       [:&.threads-count
        [:&:after


restore export-schema and get-hosts

restore export-schema and get-hosts

--- src/clojure/clojurewerkz/cassaforte/client.clj
+++ src/clojure/clojurewerkz/cassaforte/client.clj
@@ -1,26 +1,29 @@
 (ns clojurewerkz.cassaforte.client
   (:require [flatland.useful.ns :as uns]
-            [qbits.alia]))
+            [qbits.alia])
+  (:import [com.datastax.driver.core Host Session]))

 (uns/alias-ns 'qbits.alia)

-(comment
-  (defn get-hosts
-    "Returns all hosts for connected cluster"
-    [^Session client]
-    (map conv/to-map (-> client
-                         (.getCluster)
-                         (.getMetadata)
-                         (.getAllHosts))))
+(defn export-schema
+  "Exports schema as string"
+  [^Session client]
+  (-> client
+      (.getCluster)
+      (.getMetadata)
+      (.exportSchemaAsString)))

-  (defn export-schema
-    "Exports schema as string"
-    [^Session client]
-    (-> client
-        (.getCluster)
-        (.getMetadata)
-        (.exportSchemaAsString))))
-
+(defn get-hosts
+  "Returns all hosts for connected cluster"
+  [^Session client]
+  (map (fn [^Host host]
+         {:datacenter (.getDatacenter host)
+          :address    (.getHostAddress (.getAddress host))
+          :rack       (.getRack host)})
+       (-> client
+           (.getCluster)
+           (.getMetadata)
+           (.getAllHosts))))

 ;; defn get-replicas
 ;; defn get-cluster-name


Plugins in alphabetical order

Plugins in alphabetical order

--- home/.lein/profiles.clj
+++ home/.lein/profiles.clj
@@ -1,4 +1,4 @@
 {:user {:plugins [[cider/cider-nrepl "0.9.0-SNAPSHOT"]
-                  [lein-typed "0.3.5"]
+                  [jonase/eastwood "0.2.1"]
                   [lein-kibit "0.0.8"]
-                  [jonase/eastwood "0.2.1"]]}}
+                  [lein-typed "0.3.5"]]}}


Increased slightly the waiting time for the DB expiration and added a message

--- test/freecoin/journey/sign_in.clj
+++ test/freecoin/journey/sign_in.clj
@@ -174,8 +174,8 @@
                        (kc/check-page-is :email-confirmation [ks/email-confirmation-body]))

                    (pr/fetch (:password-recovery-store stores-m) email) => truthy
-
-                   (Thread/sleep 60000)
+                   (clojure.pprint/pprint "I am testing the DB expiration, this will last about a minute, please bear with me...")
+                   (Thread/sleep 70000)

                    (pr/fetch (:password-recovery-store stores-m) email) => falsey)))


minor

minor

--- cljs-cheatsheet/cljs_cheatsheet/html.cljs
+++ cljs-cheatsheet/cljs_cheatsheet/html.cljs
@@ -10,6 +10,7 @@

 (def clj-string "clojure.string")
 (def clj-set "clojure.set")
+(def inline-tooltip-style "margin-left: 2px; vertical-align: baseline;")

 ;;------------------------------------------------------------------------------
 ;; Helpers
@@ -118,7 +119,7 @@
           [:td.label-9e0b7 "Create"]
           [:td.body-885f4
             [:div.row-5dec8 "#(...) → (fn [args] (...))"
-              (tt-icon "function-shorthand")]
+              (tt-icon "function-shorthand" inline-tooltip-style)]
             (fn-link "fn")
             (fn-link "defn")
             (fn-link "defn-")
@@ -432,7 +433,7 @@
           [:td.body-885f4
             [:div.row-5dec8
               "(my-vec idx) → (" (inside-fn-link "nth") " my-vec idx)"
-              (tt-icon "vector-as-fn")]
+              (tt-icon "vector-as-fn" inline-tooltip-style)]
             (fn-link "get")
             (fn-link "peek")]]
         [:tr.odd-372e6
@@ -469,7 +470,7 @@
           [:td.body-885f4
             [:div.row-5dec8
               "(my-set itm) → (" (inside-fn-link "get") " my-set itm)"
-              (tt-icon "set-as-fn")]
+              (tt-icon "set-as-fn" inline-tooltip-style)]
             (fn-link "contains?")]]
         [:tr.odd-372e6
           [:td.label-9e0b7 "'Change'"]
@@ -512,7 +513,7 @@
           [:td.body-885f4
             [:div.row-5dec8
               "(:key my-map) → (" (inside-fn-link "get") " my-map :key)"
-              (tt-icon "keywords-as-fn")]
+              (tt-icon "keywords-as-fn" inline-tooltip-style)]
             (fn-link "get-in")
             (fn-link "contains?")
             (fn-link "find")
@@ -823,7 +824,8 @@
       "small function definition and is often used to pass closures from one "
       "scope to another."]
     [:p.info-2e4f9
-      [:code "#()"] " forms cannot be nested and it is idiomatic to keep them short."]
+      [:code "#()"] " forms cannot be nested and it is idiomatic to keep them "
+      "short."]
     [:table.exmpl-tbl-42d9f
       [:thead
         [:tr
@@ -901,7 +903,8 @@
   [:div#tooltip-vectors.tooltip-53dde {:style "display:none"}
     [:i.fa.fa-thumb-tack.pin-0ad63]
     [:p.info-2e4f9
-      "Vectors are collections of values that are indexed by sequential integers."]
+      "Vectors are collections of values that are indexed by sequential "
+      "integers."]
     [:p.info-2e4f9
       "Though similar, a JavaScript Array is not the same thing as a "
       "ClojureScript vector. "


GAWB-23: Add elipses to import button

GAWB-23: Add elipses to import button

--- src/cljs/org/broadinstitute/firecloud_ui/page/workspace/summary/attribute_editor.cljs
+++ src/cljs/org/broadinstitute/firecloud_ui/page/workspace/summary/attribute_editor.cljs
@@ -119,7 +119,7 @@
                  :target "_blank"}
              (str "Download Attributes")]
             (when writer?
-              [comps/Button {:text "Import Attributes"
+              [comps/Button {:text "Import Attributes..."
                              :style {:float "right" :marginTop -7}
                              :onClick #(modal/push-modal
                                         [modal/OKCancelForm


Version 0.3.0

Version 0.3.0

--- metlog-vault/project.clj
+++ metlog-vault/project.clj
@@ -1,4 +1,4 @@
-(defproject metlog-vault "0.3.0-SNAPSHOT"
+(defproject metlog-vault "0.3.0"
   :description "Repository for long term storage of series data."

   :license {:name "Eclipse Public License"


Ready to release modular.bidi 0.7.1

Ready to release modular.bidi 0.7.1

--- modules/bidi/project.clj
+++ modules/bidi/project.clj
@@ -1,12 +1,12 @@
 ;; Copyright © 2014 JUXT LTD.

-(defproject juxt.modular/bidi "0.7.1-SNAPSHOT"
+(defproject juxt.modular/bidi "0.7.1"
   :description "A modular extension that provides support for bidi routing"
   :url "https://github.com/juxt/modular/tree/master/modules/bidi"
   :license {:name "The MIT License"
             :url "http://opensource.org/licenses/MIT"}
   :dependencies [[com.stuartsierra/component "0.2.1"]
-                 [bidi "1.14.0-SNAPSHOT"]
+                 [bidi "1.14.0"]
                  [juxt.modular/ring "0.5.2"]
                  [prismatic/schema "0.2.1"]
                  [prismatic/plumbing "0.2.2"]]


CMR-5094: Added logging.

CMR-5094: Added logging.

--- indexer-app/src/cmr/indexer/services/index_service.clj
+++ indexer-app/src/cmr/indexer/services/index_service.clj
@@ -389,7 +389,9 @@
              concept-id
              revision-id
              elastic-version
-             elastic-options)))))))
+             elastic-options)
+            (info (format "Finished indexing concept %s, revision-id %s, all-revisions-index? %s"
+                          concept-id revision-id all-revisions-index?))))))))

 (defn- index-associated-collection
   "Index the associated collection concept of the given concept. This is used by indexing
@@ -480,8 +482,8 @@
   "Get the log string for concept-delete. Appends granules deleted if concept-type is collection"
   [concept-type context concept-id revision-id all-revisions-index?]
   (let [log-string (format "Deleting concept %s, revision-id %s, all-revisions-index? %s"
-                           concept-id
-                           revision-id
+                           concept-id
+                           revision-id
                            all-revisions-index?)]
     (if (= concept-type :collection)
       (format "%s. Removing %d granules."


Relations type-declaredinterface, type-declarationinterface+ and type-declaredsuper.

--- EkekoAspectJ/src/damp/ekeko/aspectj/weaverworld.clj
+++ EkekoAspectJ/src/damp/ekeko/aspectj/weaverworld.clj
@@ -554,6 +554,26 @@
   (all
     (member ?member)
     (member|ajsynthetic? ?member false)))
+
+(defn
+  type-declaredinterface
+  "Relation between a type and one of the interfaces it
+   declares to be implementing (for a class and aspect)
+   or extending (for an interface)."
+  [?type ?interface]
+  (all
+    (type ?type)
+    (contains (.getDeclaredInterfaces ?type) ?interface)))
+
+(defn
+  type-declaredinterface+
+  "Relation between a type and one of the ancestors in its declared interface hierarchy."
+  [?type ?ancestor]
+  (conde
+    [(type-declaredinterface ?type ?ancestor) ]
+    [(fresh [?inbetween]
+              (type-declaredinterface ?type ?inbetween)
+              (type-declaredinterface+ ?inbetween ?ancestor))]))

 (defn
   aspect-declaredinterface
@@ -561,7 +581,8 @@
   [?aspect ?interface]
   (all
     (aspect ?aspect)
-    (contains (.getDeclaredInterfaces ?aspect) ?interface)))
+    (type-declaredinterface ?aspect ?interface)))
+

 (defn
   aspect-declaredsuper
@@ -571,6 +592,15 @@
   (all
     (aspect ?aspect)
     (equals ?super (.getSuperclass ?aspect))))
+
+(defn
+  type-declaredsuper
+  "Relation between an aspect and its super class (including java.lang.Object for aspects
+   that do not declare a super aspect)."
+  [?type ?super]
+  (all
+    (type ?type)
+    (equals ?super (.getSuperclass ?type))))

 (defn
   aspect-declaredsuperaspect


Relations declare|parents, declare|soft. ... etc. Relation declare|parents-patterns/2. Next up: TypePattern relations.

--- EkekoAspectJ/src/damp/ekeko/aspectj/weaverworld.clj
+++ EkekoAspectJ/src/damp/ekeko/aspectj/weaverworld.clj
@@ -12,7 +12,7 @@
      (:import
        [org.eclipse.ajdt.core.model AJProjectModelFacade AJRelationshipType AJRelationshipManager]
        [org.aspectj.weaver.model AsmRelationshipProvider]
-       [org.aspectj.weaver.patterns Declare DeclarePrecedence]
+       [org.aspectj.weaver.patterns Declare DeclarePrecedence DeclareAnnotation DeclareErrorOrWarning DeclareParents DeclarePrecedence DeclareSoft DeclareTypeErrorOrWarning]
        [damp.ekeko EkekoModel]
        [damp.ekeko.aspectj AspectJProjectModel]
        [org.aspectj.weaver AdviceKind World ResolvedTypeMunger ConcreteTypeMunger ReferenceType UnresolvedType ResolvedType  Member]
@@ -1125,7 +1125,7 @@

 (defn
   aspect-declare
-  "Relation between an aspect and one of its aspect-specific declarations."
+  "Relation between an aspect and one of its declare declarations."
   [?aspect ?declare]
   (all
     (aspect ?aspect)
@@ -1134,7 +1134,7 @@

 (defn
   declare
-  "Relation of all aspect-specific declarations known to the weaver."
+  "Relation of all declare declarations known to the weaver."
   [?declare]
   (conda [(v+ ?declare)
           (succeeds (instance? Declare ?declare))]
@@ -1142,7 +1142,24 @@
           (fresh [?aspect]
                  (aspect-declare ?aspect ?declare))]))

-
+(defn
+  declare|parents
+  "Relation of all parents declare declarations."
+  [?declare]
+  (all
+    (declare ?declare)
+    (succeeds (instance? DeclareParents ?declare))))
+
+(defn
+  declare|annotation
+  "Relation of all annotation declare declarations."
+  [?declare]
+  (all
+    (declare ?declare)
+    (succeeds (instance? DeclareAnnotation ?declare))))
+
+
+;;TODO: should be renamed (but also its uses in the test cases) for consistency
 (defn
   declareprecedence
   "Relation of all precedence declarations."
@@ -1150,6 +1167,83 @@
   (all
     (declare ?declare)
     (succeeds (instance? DeclarePrecedence ?declare))))
+
+(def
+  declare|precedence
+  declareprecedence)
+
+
+(defn
+  declare|warning
+  "Relation of all warning declare declarations (pc expression)."
+  [?declare]
+  (all
+    (declare ?declare)
+    (succeeds (instance? DeclareErrorOrWarning ?declare))
+    (equals false (.isError ?declare))))
+
+
+(defn
+  declare|twarning
+  "Relation of all warning declare declarations (type pattern)."
+  [?declare]
+  (all
+    (declare ?declare)
+    (succeeds (instance? DeclareTypeErrorOrWarning ?declare))
+    (succeeds (.isError ?declare))))
+
+
+(defn
+  declare|error
+  "Relation of all error declare declarations (pc expression)"
+  [?declare]
+  (all
+    (declare ?declare)
+    (succeeds (instance? DeclareErrorOrWarning ?declare))
+    (succeeds (.isError ?declare))))
+
+(defn
+  declare|terror
+  "Relation of all warning declare declarations (type pattern)."
+  [?declare]
+  (declare ?declare)
+    (succeeds (instance? DeclareTypeErrorOrWarning ?declare))
+    (equals true (.isError ?declare)))
+
+
+
+(defn
+  declare|soft
+  "Relation of all soft declare declarations."
+  [?declare]
+  (all
+    (declare ?declare)
+    (succeeds (instance? DeclareSoft ?declare))))
+
+
+
+
+(defn
+  declare|parents-patterns
+  "Relation between a declare parents ?declare and its TypePatternList of declared ?parents."
+  [?declare ?parents]
+  (all
+    (declare|parents ?declare)
+    (equals ?parents (.getParents ?declare))))
+
+(comment
+(defn
+  declare|parents-pattern
+  "Relation between a declare parents ?declare and of its type patterns."
+  [?declare ?parent]
+  (fresh [?parents]
+         (declare|parents-patterns ?declare ?parents)
+         (contains ?parents ?parent)))
+)
+
+
+
+

 (defn


Projections and per-url connections work, albeit sketchily

--- src/databinder/core.clj
+++ src/databinder/core.clj
@@ -49,13 +49,17 @@

 (defn uuid [] (str "urn:uuid:" (java.util.UUID/randomUUID)))

-(def db (uris "http://logangilmour.com/data-binder#" :rank :root :binds :bindo  :haschild :projects))
+(def db (uris "http://logangilmour.com/data-binder#" :rank :root :binds :bindo  :haschild :contains :projects :path))

 (def funcs
   {:projector
-   {:resource (fn [uri binding meta vals]
-                (hic/html [:a {:href uri} vals]))
-    :value identity
+   {:resource (fn [uri binding active url meta vals]
+                (let [s (apply str vals)]
+                  (hic/html [:a {:href url :class (if active "active projector-binding" "projector-binding")
+                                 :data-binding binding
+                                 :data-uri uri} (if (re-matches #"^\s*$" s) "untitled" s)])))
+    :value (fn [parent uri binding meta val]
+             uri)
     :update nil
     :type :projector}
    :column8
@@ -247,20 +251,29 @@
   (iterator-seq (.listResourcesWithProperty model predicate resource)))

-(defn s-rec [binding model]
+(defn s-rec [binding model url-parts]

   (let [children (sort-by (fn [resource]
                             (let [p (.getProperty model resource (prop (:rank db)))]
                               (if p
                                 (.getString (.asLiteral (.getObject p)))
                                 "")))
-                          (relate-right model (prop (:haschild db)) binding))
+                          (concat
+                           (relate-right model (prop (:contains db)) binding)
+                           (relate-right model (prop (:haschild db)) binding)))
+
+        projector (first (relate-left model (prop (:projects db)) binding)) ;;TODO only works for container pointed at by projector for now.
+        path (and projector (first (relate-right model (prop (:path db)) projector)))

         bindable (bound-func binding model)

         type (:type bindable)

-        sub-calls (map (fn [child] (s-rec child model)) children) ;; make the next part of the tree
+        new-url-parts (if path
+                  (conj url-parts (.getString (.asLiteral path)))
+                  url-parts)
+
+        sub-calls (map (fn [child] (s-rec child model url-parts)) children) ;; make the next part of the tree
         meta-data (get-meta-data binding model)]

     (cond (= type :relator)
@@ -268,7 +281,7 @@
                 relation-getter (fn [data resource] (relator statement data resource))
                 child-func (:value bindable)
                 parent-func (:resource bindable)] ;; extraneous function getting]
-            (fn [data child resource]
+            (fn [data child resource url built-url]

               (let [related (if child   ;; get sub-resources (a single one if partial rendering)
                               (seq [child])
@@ -282,9 +295,53 @@
                              (parent-func
                               uri bind meta
                               (map (fn [val] (child-func
-                                             uri (:uri val) bind meta (:html val))) vals))))]
+                                             uri (:uri val) bind meta (:html val))) vals))))
+                    vals (map (fn [val] {:uri (first val) :html (second val)})
+                           (map vector
+                                (map #(.toString %) related) ;; TODO this is a little sketchy
+                                (if (empty? sub-calls)
+                                  (map literalize related)
+                                  (map seq (apply map vector (map (fn [sub-call]
+                                                                    (map
+                                                                     (fn [val]
+                                                                       (sub-call data nil val url built-url))
+                                                                     related))
+                                                                  sub-calls))))))]
+
                 (func (.getURI resource) ;; apply the bound function to the thing, the binding that points at the funtion, meta-data, and the finished children (should be ordered by now).
                       (.getURI binding)
+                      meta-data
+                      vals))))
+          (= type :projector)
+
+          (let [statement (get-bound binding model) ;; fuckery for binding
+                relation-getter (fn [data resource] (relator statement data resource))
+                child-func (:value bindable)
+                parent-func (:resource bindable)
+                mypath (.getString (.asLiteral (first (relate-right model (prop (:path db)) binding))))
+                ]
+            (fn [data child resource url built-url]
+
+              (let [related (if child   ;; get sub-resources (a single one if partial rendering)
+                              (seq [child])
+                              (relation-getter data resource))
+                    func (if child ;; get the bound function
+                           (fn [uri bind active url meta vals]
+                             (let [val (first vals)]
+                               (child-func
+                                uri (:uri val) bind meta (:html val))))
+                           (fn [uri bind active url meta vals]
+                             (parent-func
+                              uri bind active url meta
+                              (map (fn [val] (child-func
+                                             uri (:uri val) bind meta (:html val))) vals))))
+                    current (get (parse-uri url) mypath)
+                    active (= current (.getURI resource))
+                    myurl (str built-url mypath "/" (.getURI resource) "/")]
+                (func (.getURI resource) ;; apply the bound function to the thing, the binding that points at the funtion, meta-data, and the finished children (should be ordered by now).
+                      (.getURI binding)
+                      active
+                      myurl
                       meta-data
                       (map (fn [val] {:uri (first val) :html (second val)})
                            (map vector
@@ -293,48 +350,29 @@
                                   (map literalize related)
                                   (map seq (apply map vector (map (fn [sub-call]
                                                                     (map
-                                                                     (partial sub-call data nil)
-                                                                     related))
-                                                                  sub-calls))))))))))
-          (= type :projector)
-          (let [statement (get-bound binding model) ;; fuckery for binding
-                relation-getter (fn [data resource] (relator statement data resource))
-                child-func (:value bindable)
-                parent-func (:resource bindable)] ;; extraneous function getting]
-            (fn [data child resource]
-
-              (let [related (if child   ;; get sub-resources (a single one if partial rendering)
-                              (seq [child])
-                              (relation-getter data resource))
-                    func (if child ;; get the bound function
-                           (fn [uri bind meta vals]
-                             (let [val (first vals)]
-                               (child-func
-                                uri (:uri val) bind meta (:html val))))
-                           (fn [uri bind meta vals]
-                             (parent-func
-                              uri bind meta
-                              (map (fn [val] (child-func
-                                             uri (:uri val) bind meta (:html val))) vals))))]
-                (func (.getURI resource) ;; apply the bound function to the thing, the binding that points at the funtion, meta-data, and the finished children (should be ordered by now).
-                      (.getURI binding)
-                      meta-data
-                      (map (fn [val] {:uri (first val) :html (second val)})
-                           (map vector
-                                (map #(.toString %) related) ;; TODO this is a little sketchy
-                                (if (empty? sub-calls)
-                                  (map literalize related)
-                                  (map seq (apply map vector (map (fn [sub-call]
-                                                                    (map
-                                                                     (partial sub-call data nil)
+                                                                     (fn [val] (sub-call data nil val url built-url))
                                                                      related))
                                                                   sub-calls))))))))))
           (= type :container)
-          (fn [data child resource]
-            (let [func (:display bindable)]
-              (func
-                  meta-data
-                  (map (fn [sub-call] (sub-call data nil resource)) sub-calls)))))))
+          (fn [data child resource url built-url]
+            (let [func (:display bindable)
+                  ppath (and path (.getString (.asLiteral path)))
+                  p (get (parse-uri url) ppath)
+                  projected (if (and p (res p))
+                              (if (.containsResource data (res p))
+                                (res p)))
+                  ]
+
+              (if ppath
+                (if projected
+                  (func
+                   meta-data
+                   (map (fn [sub-call] (sub-call data nil projected url (str built-url ppath "/" (.getURI resource) "/"))) sub-calls))
+                  "")
+                (func
+                   meta-data
+                   (map (fn [sub-call] (sub-call data nil resource url built-url)) sub-calls))
+                ))))))

 (defn select [model subject predicate object]
   (iterator-seq (.listStatements (new SimpleSelector subject predicate object))))
@@ -359,22 +397,42 @@
                   :default
                   (conj accum val))) [] coll))

-(defn qb [binding model uri]
-
-    (let [children (relate-right model (prop (:haschild db)) binding)
-
-          bindable (bound-func binding model)
-
-          type (:type bindable)
-
-          subs (map (fn [child] (qb child model uri)) children)]
-
-      (cond (or (= type :relator) (= type :projector))
+(defn qb [binding model uri] ;; TODO come up with a nice URI aliasing thing
+  (let [children (concat
+                  (relate-right model (prop (:haschild db)) binding)
+                  (relate-right model (prop (:projects db)) binding))
+
+        projector (first (relate-left model (prop (:projects db)) binding))
+        ppath (and projector (first (relate-left model (prop (:path db)) projector)))
+
+        bindable (bound-func binding model)
+
+        type (:type bindable)
+        path (first (relate-right model (prop (:path db)) binding))
+        onpath (and path (get uri (.getString (.asLiteral path))))
+
+        subs
+        (if (= type :projector)
+          (if onpath
+            (map (fn [child] (qb child model uri)) children)
+            '())
+          (map (fn [child] (qb child model uri)) children))]
+
+    (cond (= type :relator)
+          (let [statement (get-bound binding model)
+
+                binder (.getURI (.getPredicate statement))
+                predicate (.asResource (.getObject statement))
+                reverse (= binder (db :binds))]
+            [{:pred (.getURI predicate) :rev reverse :type :relator} subs])
+
+          (= type :projector)
           (let [statement (get-bound binding model)
                 binder (.getURI (.getPredicate statement))
                 predicate (.asResource (.getObject statement))
                 reverse (= binder (db :binds))]
-            [{:pred (.getURI predicate) :rev reverse} subs])
+            [{:pred (.getURI predicate) :rev reverse :path onpath :type :projector} subs])
+
           (= type :container)
           subs
           )))
@@ -388,34 +446,45 @@
             root (.asResource (.getObject (.getProperty inf
                                                         (res (:root db))
                                                         (prop (:haschild db)))))
-        init (qb root inf nil)
-
-        numbered (loop [loc (zip/vector-zip (flatten-seq init))
+        init (qb root inf uri)
+
+        numbered (loop [loc (z/vector-zip (flatten-seq init))
                         uid 0]
-                   (println init)
+
       (cond (z/end? loc)
             (z/root loc)

             (map? (z/node loc))
-            (recur (-> loc (z/replace (assoc (z/node loc) :id uid)) z/next)
+            (recur (-> loc (z/replace (assoc (z/node loc) :id (str uid))) z/next)
                    (+ uid 1))
             :else
             (recur (z/next loc) uid)))]
-    numbered
+    (vec (concat [{:id "root"}] numbered))

     ))
+
+(defn parse-uri [uri]
+  (apply assoc {} (clojure.string/split uri #"/")))
+(defn q-map [[node & children]]
+  (let [results (apply merge {} (map q-map children))]
+    (if (:path node)
+      (assoc
+          results
+        (str "p" (:id node)) (:path node))
+      results)))
+
 (defn render-query [[node & children] opt]
   (apply str (map (fn [child]
                     (str
                      (if (:rev (first child))
-                       (str (if opt "OPTIONAL {?a" "?a")
+                       (str (if opt "OPTIONAL {?" "?")
                             (:id (first child)) " "
-                            "<"(:pred (first child)) "> ?a"
-                            (:id node) " .\n" )
-                       (str (if opt "OPTIONAL {?a" "?a")
-                            (:id node) " "
-                            "<"(:pred (first child)) "> ?a"
+                            "<"(:pred (first child)) "> ?"
+                            (if (:path node) "p" "") (:id node) " .\n" )
+                       (str (if opt "OPTIONAL {?" "?")
+                            (if (:path node) "p" "") (:id node) " "
+                            "<"(:pred (first child)) "> ?"
                             (:id (first child)) " .\n" ))
                      (render-query child true) (if opt " }\n" "\n")))
                   children)))
@@ -423,24 +492,26 @@
   (apply str (map (fn [child]
                     (str
                      (if (:rev (first child))
-                       (str "?a"
+                       (str "?"
                             (:id (first child)) " "
-                            "<"(:pred (first child)) "> ?a"
-                            (:id node) " .\n" )
-                       (str "?a"
-                            (:id node) " "
-                            "<"(:pred (first child)) "> ?a"
+                            "<"(:pred (first child)) "> ?"
+                            (if (:path node) "p" "") (:id node) " .\n" )
+                       (str "?"
+                            (if (:path node) "p" "") (:id node) " "
+                            "<"(:pred (first child)) "> ?"
                             (:id (first child)) " .\n" ))
                      (render-graph child) "\n"))
                   children)))

-
+(defn query-map [query]
+  (let [vals (q-map query)
+        qm (new QuerySolutionMap)]
+    (doall (map (fn [key] (.add qm (str key) (res (get vals key)))) (keys vals)))
+    qm))
 (defn build-query [inf uri]
-  (let [query  [{:id "root"} (qbuild inf uri)]]
-    (.execConstruct
-     (. QueryExecutionFactory sparqlService
-        "http://localhost:8000/sparql/"
-        (str "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+  (let [query  (qbuild inf (parse-uri uri))
+        qm (query-map query)
+        s (str "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
 PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
 PREFIX ont: <http://logangilmour.com/example-ontology#>

@@ -449,7 +520,16 @@
              "} WHERE {"
              (render-query query false)
              "}"
-             )))))
+             )]
+    (.add qm "root" (res "http://logangilmour.com/example-ontology#person"))  ;; TODO DIRTY DIRTY HACKS
+
+    (let [done (.toString (new ParameterizedSparqlString s qm))]
+      ;;(println (render-query query false) "\n\n\n" (render-graph query) "\n\n\n" done)
+      (.execConstruct
+       (. QueryExecutionFactory sparqlService
+          "http://localhost:8000/sparql/"
+          done
+          )))))

 (defn query-builder [command reversed]
   (cond (= (:type command) "update")
@@ -517,42 +597,26 @@
                                                         (res (:root db))
                                                         (prop (:haschild db)))))]

-        (fn [data resource] ((s-rec root inf) data nil resource))
+        (fn [data resource uri]
+          ((s-rec root inf []) data nil resource uri "/view/"))
         ))
   ([view-data binding]

       (let [inf (. ModelFactory createRDFSModel view-data)]

-        (s-rec binding inf)
+        (fn [data child resource uri] ((s-rec binding inf []) data child resource uri "/view/"))
         )))

-(defn editor [inf]
-  (fn [uri binding data]
-    (let [statement (get-bound binding inf)
-          func (:update (bound-func binding inf))
-          binder (.getURI (.getPredicate statement))
-          predicate (.asResource (.getObject statement))
+(defn syncer [inf]
+  (fn [command url]
+
+    (let [predicate (res (:predicate command))
           binders (get-all-bindings inf predicate)
           bindings (map #(.getSubject %) binders)
-          views (map (partial serializer inf) bindings)
-          pred (.getURI predicate)
-          resource (res uri) ;;TODO HERE make a serializer for each binding, then use them to populate action with html if this is an htmlable type thing. Consider moving to a pure update based strategy, as then we don't need javascript that's so complicated on the client side. We just regenerate any part of the view that's changed at any time. However, this means things like chat-rooms are not really viable.
-          reverse (= binder (db :binds))
-          ;;graph-store (. GraphStoreFactory create model)
-          command (func uri pred data)
-          update (query-builder command reverse)
-          ]
-
-
-      (println "!!!!!! " update " !!!!!!!!")
-      (doall (map (fn [up]
-               (client/post "http://localhost:8000/update/" {:form-params {:update up}})) update))
-      (comment (let [exec (. UpdateExecutionFactory createRemoteForm update "http://localhost:8000/update/")]
-          (println "\n\n\n\n" (.getContext exec) "\n\n\n\n")
-          (.execute exec)))
-
+          views (map (partial serializer inf) bindings)]

       (map (fn [binder]
+
              (let [binding (.getSubject binder)
                    reverse (= (.getURI (.getPredicate binder)) (db :binds))]

@@ -562,11 +626,12 @@
                 (assoc command
                   :value
                   ((serializer inf binding)
-                   (build-query (to-model example-view) nil)
+                   (build-query inf url)
                    (if (= (:type command) "update")
                      (plit (:value command))
                      (res (:value command)))
-                   (res (:uri command)))
+                   (res (:uri command))
+                   url)
                   :binding
                   (.toString binding))

@@ -580,6 +645,24 @@

       )))
+(defn editor [inf]
+  (fn [message]
+    (let [uri (:uri message)
+          binding (res (:binding message))
+          data (:data message)
+          statement (get-bound binding inf)
+          func (:update (bound-func binding inf))
+          binder (.getURI (.getPredicate statement))
+          predicate (.asResource (.getObject statement))
+          pred (.getURI predicate)
+          resource (res uri) ;;TODO HERE make a serializer for each binding, then use them to populate action with html if this is an htmlable type thing. Consider moving to a pure update based strategy, as then we don't need javascript that's so complicated on the client side. We just regenerate any part of the view that's changed at any time. However, this means things like chat-rooms are not really viable.
+          reverse (= binder (db :binds))
+          ;;graph-store (. GraphStoreFactory create model)
+          command (func uri pred data)
+          update (query-builder command reverse)]
+      (doall (map (fn [up]
+                    (client/post "http://localhost:8000/update/" {:form-params {:update up}})) update))
+      command)))

@@ -596,34 +679,35 @@
 ex:person-manager
   rdf:type data:row ;
   dc:title \"The Application\" ;
-  dc:description \"Here we are\" .
-
-ex:person-manager data:haschild ex:person-list-container, ex:person-container .
+  dc:description \"Here we are\" ;
+  data:haschild ex:person-list-container ;
+  data:contains ex:person-container .

 ex:person-list-container
   data:haschild ex:person-list ;
-  rdf:type data:column4 .
+  rdf:type data:column4 ;
+  data:rank 1 .

 ex:person-list
   rdf:type data:list ;
   data:binds rdf:type ;
   dc:title \"List of People\" ;
   dc:description \"A list of people contained within the application\" ;
-  data:haschild ex:person-projector ;
-  data:rank 1 .
+  data:haschild ex:person-projector .

 ex:person-projector
   rdf:type data:projector ;
+  data:path \"test\" ;
   data:bindo ont:name ;
   dc:title \"select\" ;
   dc:description \"choose a person\" ;
-  data:projects ex:person-container ;
-  data:rank 2 .
+  data:projects ex:person-container .

 ex:person-container
   rdf:type data:column8 ;
   dc:title \"Person\" ;
-  dc:description \"A person\" .
+  dc:description \"A person\" ;
+  data:rank 2 .

 ex:person-container data:haschild ex:person-name-container , ex:person-age , ex:pets-list ,  ex:person-deleter .

@@ -740,7 +824,7 @@
     [:head
      [:meta {:name "viewport" :content "width=device-width, initial-scale=1.0"}]

-     [:link {:href "css/bootstrap.min.css" :rel "stylesheet" :media "screen"}]
+     [:link {:href "/css/bootstrap.min.css" :rel "stylesheet" :media "screen"}]
      [:title "FIXME"]]
     [:body body
      [:script {:type "text/javascript" :src "/js/jquery.min.js"}]
@@ -761,23 +845,45 @@

 (def broadcast-channel (permanent-channel))
 (def edit (editor (to-model example-view)))
-
-(defn store [message]
-  (edit (:uri message) (res (:binding message)) (:data message)))
+(def syn (syncer (to-model example-view)))
+
+
+(def channels (atom {}))
+
+(defn register [ch url]
+  (siphon (map* edit (map* decode-json ch)) broadcast-channel)
+  (swap! channels (fn [old]
+
+                    (let [all (reduce (fn [accum key]
+                                        (if (closed? (get old key))
+                                          (do
+                                            (println "Getting rid of old connection for " key)
+                                           (dissoc old key))
+                                          old)) old (keys old))
+                          url-ch (or (get all url)
+                                     (let [new-ch (channel)]
+                                       (println "creating a channel for url " url)
+                                       (siphon (map* encode-json->string (map* (fn [message] (syn message url)) broadcast-channel)) new-ch)
+                                       new-ch))]
+                      (siphon url-ch ch) ;; listen on your url channel
+                      (doall (map (partial println "\nConnection: ") (keys all)))
+                      (assoc all url url-ch)
+                      ))))

 (defn chat-handler [ch handshake]
   (receive ch
            (fn [input]
-             ;;(let jc [(map* decode-json ch)])
-             (siphon (map* encode-json->string (map* store (map* decode-json ch))) broadcast-channel)
-             (siphon broadcast-channel ch)
+             (let [url (:* (:params handshake))]
+               (println "registering a connection to url " url)
+               ;;(let jc [(map* decode-json ch)])
+               (register ch url))
              )))

 (defroutes main-routes
-  (GET "/async/" [] (wrap-aleph-handler chat-handler))
-  (GET "/" []
-       (page ((serializer (to-model example-view)) (build-query (to-model example-view) nil) (res "http://logangilmour.com/example-ontology#person"))))
+  (GET "/async/*" [] (wrap-aleph-handler chat-handler))
+  (GET "/view/*" [*]
+       (page ((serializer (to-model example-view)) (build-query (to-model example-view) *) (res "http://logangilmour.com/example-ontology#person") *)))
   (route/resources "/")
   (route/not-found "Page not found"))


Cleanup of temp file

Cleanup of temp file


Cleanup monotron example a bit.  Mainly: * use moog-ff filter instead of hacking in my own attempt. * remove crufty iphone controller code.

--- src/overtone/examples/instruments/monotron.clj
+++ src/overtone/examples/instruments/monotron.clj
@@ -1,23 +1,25 @@
 (ns overtone.examples.instruments.monotron
   (:use overtone.live))

-;; Monotron Clone Attempt by Roger Allen.
-;;
-;; My first definst, so much could easily be wrong below...
+;; (use 'overtone.live)
+
+;; ======================================================================
+;; Monotron Clone by Roger Allen.
+;;   via some code in https://github.com/rogerallen/explore_overtone
 ;;
 ;; Source
 ;; http://korg.com/monotrons
 ;; http://korg.com/services/products/monotron/monotron_Block_diagram.jpg
-;; some inspiration
-;; http://www.soundonsound.com/sos/aug10/articles/korg-monotron.htm
-;; following patterns from
+;;
+;; Following patterns from
 ;; https://github.com/overtone/overtone/blob/master/src/overtone/inst/synth.clj
 ;;
-;; found filter discussion here
+;; Inspiration
+;; http://www.soundonsound.com/sos/aug10/articles/korg-monotron.htm
 ;; http://www.timstinchcombe.co.uk/index.php?pge=mono
-
 (defsynth monotron
-  "Korg Monotron from website diagram: http://korg.com/services/products/monotron/monotron_Block_diagram.jpg."
+  "Korg Monotron from website diagram:
+   http://korg.com/services/products/monotron/monotron_Block_diagram.jpg."
   [note     60            ; midi note value
    volume   0.7           ; gain of the output
    mod_pitch_not_cutoff 1 ; use 0 or 1 only to select LFO pitch or cutoff modification
@@ -25,120 +27,31 @@
    rate     4.0           ; frequency of the LFO
    int      1.0           ; intensity of the LFO
    cutoff   1000.0        ; cutoff frequency of the VCF
-   peak     0.5           ; VCF peak control (resonance)
-   gate     1.0]          ; another output gain?
+   peak     0.5]          ; VCF peak control (resonance)
   (let [note_freq       (midicps note)
         pitch_mod_coef  mod_pitch_not_cutoff
         cutoff_mod_coef (- 1 mod_pitch_not_cutoff)
         LFO             (* int (saw rate))
         VCO             (saw (+ note_freq pitch (* pitch_mod_coef LFO)))
         vcf_freq        (+ cutoff (* cutoff_mod_coef LFO) note_freq)
-        ;; from web vcf reciprocal of Q looks 1-ish
-        vcf_bpf_rq       1.0
-        ;; from web vcf looks like you should always have a large LPF component
-        ;; BPF should get added on top.  Seems like I should scale this to clamp
-        ;; the output, though.
-        vcf_lpf         (lpf VCO vcf_freq)
-        vcf_bpf         (bpf VCO vcf_freq vcf_bpf_rq)
-        VCF             (/ (+ vcf_lpf (* peak vcf_bpf)) (+ 1 peak))
+        VCF             (moog-ff VCO vcf_freq peak)
         ]
-    (out 0 (* gate volume VCF))))
+    (out 0 (* volume VCF))))

-;(comment
-
-;; create some instances of the synth
-(do
-  (def N0 (monotron 72 0.8 1 0.0 2.5 350.0 800.0 0.8 1.0))
-  (def N1 (monotron 76 0.8 1 0.0 2.5 350.0 800.0 0.8 1.0))
-  (def N2 (monotron 79 0.8 1 0.0 2.5 350.0 800.0 0.8 1.0)))
+;; ======================================================================
+;; create an instance of the synth
+(def N0 (monotron 40 0.8 1 0.0 2.5 350.0 800.0 3.0))

 ;; edit & C-x C-e on any these to play around
-(ctl monotron :note   70)
-(ctl N0 :note   60)
-(ctl N1 :note   64)
-(ctl N2 :note   (+ 30 7))
-(ctl monotron :volume 0.5)
-(ctl monotron :mod_pitch_not_cutoff 1)
-(ctl monotron :pitch  0.0)
-(ctl monotron :rate   0.5)
-(ctl monotron :int    500.0)
-(ctl monotron :cutoff 380.0)
-(ctl monotron :peak   0.0)
-(ctl monotron :gate   1.0)
+(ctl N0 :note   80)               ;; midi note value: 0 to 127
+(ctl N0 :volume 0.7)              ;; gain of the output: 0.0 to 1.0
+(ctl N0 :mod_pitch_not_cutoff 0)  ;; use 0 or 1 only to select LFO pitch or cutoff modification
+(ctl N0 :pitch  10.0)             ;; this + note is frequency of the VCO
+(ctl N0 :rate   1.5)              ;; frequency of the LFO
+(ctl N0 :int    800.0)           ;; intensity of the LFO
+(ctl N0 :cutoff 600.0)           ;; cutoff frequency of the VCF
+(ctl N0 :peak   0.5)              ;; VCF peak control (resonance) 0.0 to 4.0

-;; for when you're done
-(kill monotron)
+;; for when you're done.  kill all or just some of the notes
 (kill N0)
-(kill N1)
-(kill N2)

-;; major chord
-(defn maj-tri [note]
-  (ctl N0 :note   note)
-  (ctl N1 :note   (+ note 4))
-  (ctl N2 :note   (+ note 7)))
-
-(maj-tri 59)
-
-;; MIDI Control ==================================================
-;; hooking up to the iPad
-(def kb (midi-in "Control Session"))
-;; simple listener just for testing
-(defn midi-listener [event ts]
-  (println "listener: " event))
-
-;(midi-handle-events kb #'midi-listener)
-
-;; 'real' listener
-;; hook up Control to the ctl messages
-;; use monotron_control.js layout
-;; FIXME use konstants for controller #s to allow for switching.
-(defn midi-listener [event ts]
-  ;;(println "listener: " event)
-  (cond
-
-   ;; controller 0 is for PITCH
-   (and (== 176 (:cmd event)) (== 0 (:note event)))
-   (let [v (midi->hz ( / (:vel event) 1.0))]
-     (println "pitch" v)
-     (ctl monotron :cutoff v))
-
-   ;; controller 1 is for CUTOFF
-   (and (== 176 (:cmd event)) (== 1 (:note event)))
-   (let [v ( * 30 (:vel event))]
-     (println "cutoff" v)
-     (ctl monotron :cutoff v))
-
-   ;; controller 2 is for PEAK
-   (and (== 176 (:cmd event)) (== 2 (:note event)))
-   (let [v ( / (:vel event) 127.0)]
-     (println "peak" v)
-     (ctl monotron :peak v))
-
-   ;; controller 3 is for INT
-   (and (== 176 (:cmd event)) (== 3 (:note event)))
-   (let [v ( * 20 (:vel event))]
-     (println "int" v)
-     (ctl monotron :int v))
-
-   ;; controller 4 is for RATE
-   (and (== 176 (:cmd event)) (== 4 (:note event)))
-   (let [v ( * 0.25 (:vel event))]
-     (println "rate" v)
-     (ctl monotron :rate v))
-
-   ;; controller 5 is for NOTE.  Make it one octave
-   (and (== 176 (:cmd event)) (== 5 (:note event)))
-   (let [v (+ 50 (* 12 (/ (:vel event) 127.0)))]
-     (println "note" v)
-     (ctl monotron :note v))
-
-   ;; controller 7 is for VOLUME
-   (and (== 176 (:cmd event)) (== 7 (:note event)))
-   (let [v ( / (:vel event) 127.0)]
-     (println "volume" v)
-     (ctl monotron :volume v))
-
-   )
-  )
-  )


Improved with-result

Improved with-result

--- src/grimoire/either.clj
+++ src/grimoire/either.clj
@@ -101,14 +101,15 @@
   ([[binding form] left]
    `(let [res# ~form]
       (if (succeed? res#)
-        (let [~binding res#]
+        (let [~binding (result res#)]
           (try ~left
                (catch Exception e# (fail e#))))
         res#)))

   ([[binding form] left right]
    {:pre [(symbol? binding)]}
-   `(let [~binding ~form]
-      (try (if (succeed? ~binding)
-             ~left ~right)
+   `(let [x# ~form]
+      (try (if (succeed? x#)
+             (let [~binding (result x#)] ~left)
+             (let [~binding (message x#)] ~right))
            (catch Exception e# (fail e#))))))


Mihir | fixing tests

Mihir | fixing tests

--- test/aggregatequeryservice/runqueries_test.clj
+++ test/aggregatequeryservice/runqueries_test.clj
@@ -4,63 +4,63 @@
   (:use [midje.sweet])
   (:require [aggregatequeryservice.runqueries :refer :all :as aqs]
             [aggregatequeryservice.utils :refer :all :as utils]
-            [clojure-test-datasetup.core :as ds])
+            [clojure-test-datasetup.core :as ds]))

-  (def db-spec {:datasource (doto (new SQLiteConnectionPoolDataSource)
-                              (.setUrl "jdbc:sqlite:db/test.db"))})
+(def db-spec {:datasource (doto (new SQLiteConnectionPoolDataSource)
+                            (.setUrl "jdbc:sqlite:db/test.db"))})

-  (defn test-config-mapping
-        ([]
-          (utils/read-config "resources/sample_config.json"))
-        ([config-file]
-          (utils/read-config config-file)))
+(defn test-config-mapping
+  ([]
+    (utils/read-config "resources/sample_config.json"))
+  ([config-file]
+    (utils/read-config config-file)))

-  (facts "Reading Config File"
-         (fact "Throws exception if file not found"
-               (test-config-mapping "doesn'texist") => (throws FileNotFoundException))
+(facts "Reading Config File"
+       (fact "Throws exception if file not found"
+             (test-config-mapping "doesn'texist") => (throws FileNotFoundException))

-         (fact "If file valid, read and convert to hash-map"
-               (test-config-mapping) => [{:queryGroupname "Query Group 1" :queries [{:queryName "Query 1", :query "select * from something;"}
-                                                                                {:queryName "Query 2", :query "select * from something_else;"}]}
-                                         {:queryGroupname "Query Group 2", :queries [{:queryName "Query 1", :query "select * from one_more_thing;"}
-                                                                                {:queryName "Query 2", :query "select * from another_thing;"}]}]))
+       (fact "If file valid, read and convert to hash-map"
+             (test-config-mapping) => [{:queryGroupname "Query Group 1" :queries [{:queryName "Query 1", :query "select * from something;"}
+                                                                                {:queryName "Query 2", :query "select * from something_else;"}]}
+                                       {:queryGroupname "Query Group 2", :queries [{:queryName "Query 1", :query "select * from one_more_thing;"}
+                                                                                {:queryName "Query 2", :query "select * from another_thing;"}]}]))

-  (facts "Create self sufficient query object"
-         (fact "Add query group name to query object"
-               (aqs/get-queries (first (test-config-mapping)))
-               =>
-               (list {:queryGroupname "Query Group 1" :query "select * from something;" :queryName "Query 1"}
-                     {:queryGroupname "Query Group 1" :queryName "Query 2", :query "select * from something_else;"})))
+(facts "Create self sufficient query object"
+       (fact "Add query group name to query object"
+             (aqs/get-queries (first (test-config-mapping)))
+             =>
+             (list {:queryGroupname "Query Group 1" :query "select * from something;" :queryName "Query 1"}
+                   {:queryGroupname "Query Group 1" :queryName "Query 2", :query "select * from something_else;"})))

-  (facts "Render a list of queries with appropriate parameters"
-         (fact "Render queries with appropriate params"
-               (aqs/render-queries
-                 (hash-map :endDate "renderedEndDate" :startDate "renderedStartDate")
-                 (list {:queryGroupname "Query Group 1" :query "select * from something where endDate < :endDate:;" :queryName "Query 1"}
-                       {:queryGroupname "Query Group 1" :queryName "Query 2", :query "select * from something_else where startDate > :startDate:;"}))
-               =>
-               (list {:queryGroupname "Query Group 1" :query "select * from something where endDate < renderedEndDate;" :queryName "Query 1"}
-                     {:queryGroupname "Query Group 1" :queryName "Query 2", :query "select * from something_else where startDate > renderedStartDate;"})))
+(facts "Render a list of queries with appropriate parameters"
+       (fact "Render queries with appropriate params"
+             (aqs/render-queries
+               (hash-map :endDate "renderedEndDate" :startDate "renderedStartDate")
+               (list {:queryGroupname "Query Group 1" :query "select * from something where endDate < :endDate:;" :queryName "Query 1"}
+                     {:queryGroupname "Query Group 1" :queryName "Query 2", :query "select * from something_else where startDate > :startDate:;"}))
+             =>
+             (list {:queryGroupname "Query Group 1" :query "select * from something where endDate < renderedEndDate;" :queryName "Query 1"}
+                   {:queryGroupname "Query Group 1" :queryName "Query 2", :query "select * from something_else where startDate > renderedStartDate;"})))

-  (facts "Render a single Query"
-         (fact "Render query with appropriate params"
-               (aqs/render-query (hash-map :renderThis "rdThis" :renderThat "rdThat" :replaceThis "rpThis" :replaceThat "rpThat")
-                                 {:query "select :renderThis: from :renderThat: and :replaceThis: and :replaceThat:;"})
-               =>
-               {:query "select rdThis from rdThat and rpThis and rpThat;"}))
+(facts "Render a single Query"
+       (fact "Render query with appropriate params"
+             (aqs/render-query (hash-map :renderThis "rdThis" :renderThat "rdThat" :replaceThis "rpThis" :replaceThat "rpThat")
+                               {:query "select :renderThis: from :renderThat: and :replaceThis: and :replaceThat:;"})
+             =>
+             {:query "select rdThis from rdThat and rpThis and rpThat;"}))

-  (facts "End to end integration test"
-         (with-state-changes [(before :facts (dorun (ds/setup-dataset "resources/test-dataset.json" db-spec)))
-                              (after :facts (ds/tear-down-dataset "resources/test-dataset.json" db-spec))]
-                             (fact "Read JSON and fire queries and return back the result set"
-                                   (aqs/run-queries-and-get-results "resources/sample_config.json" (get db-spec :datasource) (hash-map))
-                                   =>
-                                   '({:result         ({:name "Some Name", :id 1} {:id 15, :name "Some First Name"}),
-                                      :queryGroupname "Query Group 1", :queryName "Query 1", :query "select * from something;"}
-                                      {:result         ({:name "Some Other Name", :id 2}),
-                                       :queryGroupname "Query Group 1", :queryName "Query 2", :query "select * from something_else;"}
-                                      {:result         ({:name "One More Name", :id 6}),
-                                       :queryGroupname "Query Group 2", :queryName "Query 1", :query "select * from one_more_thing;"}
-                                      {:result         ({:name "Another Name", :id 4}),
-                                       :queryGroupname "Query Group 2", :queryName "Query 2", :query "select * from another_thing;"}))))+(facts "End to end integration test"
+       (with-state-changes [(before :facts (dorun (ds/setup-dataset "resources/test-dataset.json" db-spec)))
+                            (after :facts (ds/tear-down-dataset "resources/test-dataset.json" db-spec))]
+                           (fact "Read JSON and fire queries and return back the result set"
+                                 (aqs/run-queries-and-get-results "resources/sample_config.json" (get db-spec :datasource) (hash-map))
+                                 =>
+                                 '({:result         ({:name "Some Name", :id 1} {:id 15, :name "Some First Name"}),
+                                    :queryGroupname "Query Group 1", :queryName "Query 1", :query "select * from something;"}
+                                    {:result         ({:name "Some Other Name", :id 2}),
+                                     :queryGroupname "Query Group 1", :queryName "Query 2", :query "select * from something_else;"}
+                                    {:result         ({:name "One More Name", :id 6}),
+                                     :queryGroupname "Query Group 2", :queryName "Query 1", :query "select * from one_more_thing;"}
+                                    {:result         ({:name "Another Name", :id 4}),
+                                     :queryGroupname "Query Group 2", :queryName "Query 2", :query "select * from another_thing;"}))))