Updated ::path

Updated ::path

--- src/adventofcode1/twentyfour.clj
+++ src/adventofcode1/twentyfour.clj
@@ -84,7 +84,9 @@
 (s/def ::board-row (s/with-gen (s/and string? board-chars?) #(gen'/string-from-regex #"#([0-9.#]{10})#")))
 (s/def ::board (s/coll-of ::board-row)) ;; :count max-height)

-(s/def ::path (s/tuple (s/tuple integer? integer?)(s/tuple integer? integer?)))
+(s/def ::from (s/tuple integer? integer?))
+(s/def ::to   (s/tuple integer? integer?))
+(s/def ::path  (s/keys :req-un [::from ::to]))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;
@@ -141,23 +143,6 @@
                 (if (= \# (board-cell board (+ row r) (+ col c)))
                   0
                   1))))))
-
-
-;; (defn horizontal-paths
-;;   ([board]
-;;    (horizontal-paths [] 1 1 board))
-;;   ([found row col board]
-;;    ;; >= since last row is just ############
-;;    (if (>= row (board-height board))
-;;      found
-;;      (if (>= col (board-width board))
-;;        (recur found (inc row) 1 board)
-;;        (if (= \# (board-cell board row col))
-;;          (recur found row (inc col) board)
-;;          (let [neighbors (count-neighbors board row col)]
-;;            (match neighbors
-;;              0 (recur found row (inc col) board)
-;;              1 (assert false))))))))

 (s/fdef horizontal-paths
         :args (s/alt


Optimize cljs

Optimize cljs

--- src/discuss/views.cljs
+++ src/discuss/views.cljs
@@ -145,7 +145,7 @@
 (defn- show-selection
   "Shows selected text from website if available."
   []
-  (let [selection (if (lib/get-selection) (lib/get-selection) (:text (discuss.references.lib/get-selected-reference)))]
+  (let [selection (or (lib/get-selection) (:text (discuss.references.lib/get-selected-reference)))]
     (if (> (count selection) 1)
       (dom/div #js {:className "input-group"}
                (dom/span #js {:className "input-group-addon"}


Provide default Instrument type for testing.

--- src/isla/user.clj
+++ src/isla/user.clj
@@ -1,3 +1,9 @@
 (ns isla.user)

-(def types {})
+(defrecord Instrument [sound awesomeness])
+(def instrument-defaults ["" ""])
+
+(def types
+  {
+   "instrument" {:type isla.user.Instrument :defaults instrument-defaults}
+   })


Alternative export directory

Alternative export directory

--- src/jkpl/core.clj
+++ src/jkpl/core.clj
@@ -8,7 +8,7 @@
             [clojure.edn :as edn]
             [stasis.core :as stasis]))

-(def export-target-dir "target/website/")
+(def default-export-target-dir "target/website/")

 (defn- load-config []
   (edn/read-string (slurp "resources/config.edn")))
@@ -72,8 +72,10 @@
        assets/server
        wrap-content-type))

-(defn export []
-  (stasis/empty-directory! export-target-dir)
-  (assets/save export-target-dir)
-  (stasis/export-pages (site) export-target-dir))
+(defn export
+  ([directory]
+    (stasis/empty-directory! directory)
+    (assets/save directory)
+    (stasis/export-pages (site) directory))
+  ([] (export default-export-target-dir)))


Added direct copy setting to cluster startup.

--- src/clj/forma/hadoop/cluster.clj
+++ src/clj/forma/hadoop/cluster.clj
@@ -72,7 +72,7 @@
   "Raises file descriptor limits on all machines to the specified
   limit."
   [lim]
-  (let [command  #(join " " [hadoop-user % "nofile" 65000])
+  (let [command  #(join " " [hadoop-user % "nofile" lim])
         path "/etc/security/limits.conf"
         pam-lims "session required  pam_limits.so"]
     (exec-script/exec-script
@@ -91,7 +91,7 @@
    :price spot-price})

 (def cluster-profiles
-  {"large"           (mk-profile 4 3 0.50 "us-east-1/ami-08f40561" "m1.large")
+  {"large"           (mk-profile 4 2 0.50 "us-east-1/ami-08f40561" "m1.large")
    "high-memory"     (mk-profile 30 24 1.50 "us-east-1/ami-08f40561" "m2.4xlarge")
    "cluster-compute" (mk-profile 22 16 0.80 "us-east-1/ami-1cad5275" "cc1.4xlarge")})

@@ -136,8 +136,7 @@
                                              :mapred.job.reuse.jvm.num.tasks 20
                                              :mapred.map.tasks.speculative.execution false
                                              :mapred.reduce.tasks.speculative.execution false
-                                             :mapred.map.output.compression.codec "com.hadoop.compression.lzo.LzoCodec"
-                                             :mapred.output.compression.codec "org.apache.hadoop.io.compress.GzipCodec"
+                                             :mapred.output.direct.NativeS3FileSystem true
                                              :mapred.child.java.opts (str "-Djava.library.path="
                                                                           native-path
                                                                           " -Xms1024m -Xmx1024m")
@@ -184,7 +183,7 @@
                    :compute service
                    :environment env/remote-env)
      (lift-cluster cluster
-                   :phase (phase config-redd (raise-file-limits 90000))
+                   :phase (phase config-redd (raise-file-limits 100000))
                    :compute service
                    :environment env/remote-env)
      (start-cluster cluster
@@ -230,7 +229,6 @@
                         --instance-group master
                         --instance-type ~type
                         --instance-count 1
-                        --bid-price ~(:spot-price base-machine-spec)

                         --instance-group core
                         --instance-type ~type


change Gang Sign to a manually triggered effect

--- src/clj/game/cards-resources.clj
+++ src/clj/game/cards-resources.clj
@@ -166,9 +166,13 @@
                              (:agendapoints c) " agenda point" (when (> (:agendapoints c) 1) "s"))))}]}

    "Gang Sign"
-   {:events {:agenda-scored {:msg (msg "access " (get-in @state [:runner :hq-access]) " card from HQ")
-                             :effect (req (let [c (take (get-in @state [:runner :hq-access]) (shuffle (:hand corp)))]
-                                            (resolve-ability state :runner (choose-access c '(:hq)) card nil)))}}}
+   {:events {:agenda-scored {:effect (req (system-msg state :runner (str "can access cards in HQ by clicking on Gang Sign"))
+                                          (update! state side (assoc card :access-hq true)))}}
+    :abilities [{:req (req (:access-hq card))
+                 :msg (msg "access " (get-in @state [:runner :hq-access]) " card from HQ")
+                 :effect (req (let [c (take (get-in @state [:runner :hq-access]) (shuffle (:hand corp)))]
+                                (resolve-ability state :runner (choose-access c '(:hq)) card nil)
+                                (update! state side (dissoc (get-card state card) :access-hq))))}]}

    "Ghost Runner"
    {:data {:counter 3}


remove obsolete code

remove obsolete code

--- src/cljc/ow/starbuck/client.cljc
+++ src/cljc/ow/starbuck/client.cljc
@@ -18,22 +18,6 @@
          :ow.starbuck.routing/component '()
          :ow.starbuck.routing/transition-count 0
          :ow.starbuck.routing/max-transitions max-transitions))
-
-#_(defn process-message [router-ch msg]
-  (a/put! router-ch msg))
-
-#_(defn process-message-sync [router-ch components-pub listen-kw response-fn msg & {:keys [timeout]}]
-  (let [req-id (rand-int Integer/MAX_VALUE)
-        msg (assoc msg ::request-id req-id)
-        subch (a/chan)
-        ch (-> components-pub
-               (a/sub listen-kw subch)
-               (a/pub ::request-id)
-               (a/sub req-id (a/promise-chan)))]
-    (go (let [[res _] (a/alts! [ch (a/timeout (or timeout 10000))])]
-          (a/close! subch)
-          (when-not (nil? res)
-            (response-fn res))))))


fix time difference

fix time difference

--- src/cljs/bulldog/components.cljs
+++ src/cljs/bulldog/components.cljs
@@ -12,7 +12,7 @@
                 (.getTime date))
         minutes (js/Math.floor (/ diff (* 1000 60)))]
     (cond
-      (< 0 minutes 2) "now"
+      (< minutes 2) "now"
       (<= 2 minutes 60) (str minutes " minutes ago")
       :else
       (let [days (js/Math.floor (/ minutes (* 60 24)))]
@@ -59,7 +59,8 @@
           (let [sorted-articles (->> (:articles app)
                                      vec
                                      (sort-by :date >)
-                                     (take 7))]
+                                     (take 7)
+                                     (map #(assoc % :date-diff (time-diff (:date %)))))]
             (map article sorted-articles))]))))

 (defn post-view [app owner]


minor change

minor change

--- src/cljs/dbquery/db_console.cljs
+++ src/cljs/dbquery/db_console.cljs
@@ -127,8 +127,8 @@
         [c/button-group {:bsSize "small"}
          [c/button {:title "Execute" :on-click exec-sql}
           [:i.fa.fa-play]]
-         [c/button [:i.fa.fa-save]]
-         [c/button [:i.fa.fa-file-o]]]]
+         [c/button {:title "Save" :on-click save-sql} [:i.fa.fa-save]]
+         [c/button {:tittle "Clear" :on-click #()} [:i.fa.fa-file-o]]]]
        [:div.panel-body {:style {:padding "0px" :overflow "scroll" :height "calc(100% - 46px)"}}
         [code-mirror cm {:mode "text/x-sql"}]]])))


Add slider-atom component

Add slider-atom component

--- src/cljs/hacker_agent/debug.cljs
+++ src/cljs/hacker_agent/debug.cljs
@@ -74,3 +74,31 @@
       (swap! state-history conj @state))
     (recur)))

+(defn slider-atom [state history]
+  (let [pos (first (keep-indexed #(when (= %2 @state) %1)
+                                 (map second @history)))
+        [current-time current-state] (nth @history (int pos))]
+    [:div
+     [:p (t/time-ago current-time)]
+     [:input {:type "range" :value pos :max (dec (count @history))
+              :on-change #(let [new-val (-> % .-target .-value)
+                                [_ target-state] (nth @history (int new-val)
+                                                      [nil @state])]
+                            (reset! state target-state))}]
+     [:button {:type :button
+               :on-click #(let [prev-pos (dec pos)
+                                [_ target-state] (nth @history prev-pos
+                                                      [nil @state])]
+                            (when (>= prev-pos 0)
+                              (reset! state target-state)))}
+      "<"]
+     [:button {:type :button
+               :on-click #(let [next-pos (inc pos)
+                                [_ target-state] (nth @history next-pos
+                                                      [nil @state])]
+                            (when (< next-pos (count @history))
+                              (reset! state target-state)))}
+      ">"]
+     [:button {:type :button
+               :on-click #(reset! state (second (last @history)))}
+      "Reset"]]))


spec for ai scoring

spec for ai scoring

--- src/cljs/triboard/ai/scores.cljs
+++ src/cljs/triboard/ai/scores.cljs
@@ -70,4 +70,5 @@
     (-> delta
       (update (:looser conversion) - diff)
       (update (:winner conversion) + diff)
+      (dissoc :empty)
       )))


Update file grid after taking screenshot

--- src/clojure/nightmod/screens.clj
+++ src/clojure/nightmod/screens.clj
@@ -3,6 +3,7 @@
             [clojure.java.io :as io]
             [clojure.string :as string]
             [nightcode.editors :as editors]
+            [nightcode.file-browser :as file-browser]
             [nightcode.shortcuts :as shortcuts]
             [nightcode.ui :as ui]
             [nightcode.utils :as nc-utils]
@@ -157,7 +158,9 @@
   (->> (io/file @u/project-dir u/screenshot-file)
        .getCanonicalPath
        (files! :absolute)
-       screenshot!))
+       screenshot!)
+  (s/invoke-later
+    (file-browser/update-card!)))

 (defscreen main-screen
   :on-show


Add custom phrase separator regex.

Add custom phrase separator regex.

--- src/clucy/positions_searcher.clj
+++ src/clucy/positions_searcher.clj
@@ -37,6 +37,11 @@
   structure."
   false)

+(def ^{:dynamic true}
+  *phrase-separator-regex*
+  "Used to determine phrases in dictionary and separate words in phrase."
+  " ")
+
 (defn stemming-text [^String text
                      & {:keys [format] :or {format #{}}}]
   "Convert words from text into stemmed form according to *analyzer*."
@@ -75,7 +80,7 @@
                    (doall
                     (map #(stemming-word %)
                          phrase-words)))
-                 (map #(.split % "[ -]") dict-phrases-set))))
+                 (map #(.split % *phrase-separator-regex*) dict-phrases-set))))

 (defn get-positions [^TermsEnum te & {:keys [get-term
                                              get-freq
@@ -206,12 +211,12 @@

   When *with-stemmed* is true, the iteratior item is the following:
   [stemmed-word [start-offset end-offset]]"
-  (let [phrases (into #{} (filter #(or (.contains % " ")
-                                       (.contains % "-")) dict))
+  (let [phrase-sep-pattern (re-pattern *phrase-separator-regex*)
+        phrases (into #{} (filter #(re-find phrase-sep-pattern %)
+                                  dict))
         words (clojure.set/difference dict phrases)
-        search-words (clojure.set/union (stemming-dict words) words)
-        search-phrases (clojure.set/union (stemming-phrases phrases)
-                                          (map #(.split % "[ -]") phrases))
+        search-words (stemming-dict words)
+        search-phrases (stemming-phrases phrases)
         br-words (map #(BytesRef. %) search-words)
         br-phrases (map (fn [phrase] (map #(BytesRef. %) phrase)) search-phrases)
         iwords (into #{} br-words)
@@ -223,7 +228,10 @@
                          result (filter
                                  #(not (nil? %))
                                  (concat
+                                  ;; --------------------
+                                  ;; Single words
                                   (if (< terms-lenght (* dict-lenght 5))
+                                    ;; Iterate through passed text index
                                     (map (fn [[wd ; BytesRef word
                                                ps ; Positions [[beg end]... ]
                                                ]]
@@ -235,6 +243,7 @@
                                                       ps))
                                                ps)))
                                          (term-iter))
+                                    ;; Iterate through dictionary words
                                     (map (fn [br-word word]
                                            (if (.seekExact te br-word)
                                              (if with-stemmed
@@ -243,6 +252,8 @@
                                                     (get-positions te))
                                                (get-positions te))))
                                          br-words search-words))
+                                  ;; --------------------
+                                  ;; Phrases
                                   (map (fn [br-phrase phrase]
                                          (if with-stemmed
                                            (let [phrase-str


Added metadata db function to retrieve expired collection concept ids.

--- src/cmr/transmit/metadata_db.clj
+++ src/cmr/transmit/metadata_db.clj
@@ -147,6 +147,24 @@
         (format "Collection search failed. status: %s body: %s"
                 status body)))))

+(defn get-expired-collection-concept-ids
+  "Searches metadata db for collections in a provider that have expired and returns their concept ids."
+  [context provider-id]
+  (let [conn (config/context->app-connection context :metadata-db)
+        request-url (str (conn/root-url conn) "/concepts/search/expired-collections")
+        response (client/get request-url {:accept :json
+                                          :query-params {:provider provider-id}
+                                          :headers (ch/context->http-headers context)
+                                          :throw-exceptions false
+                                          :connection-manager (conn/conn-mgr conn)})
+        {:keys [status body]} response]
+    (case status
+      200 (cheshire/decode body true)
+      ;; default
+      (errors/internal-error!
+        (format "Collection search failed. status: %s body: %s"
+                status body)))))
+
 (defn get-providers
   "Returns the list of provider ids configured in the metadata db"
   [context]


Allow :all hooks to be set.

Allow :all hooks to be set.

--- src/leiningen/core.clj
+++ src/leiningen/core.clj
@@ -88,7 +88,7 @@

 (defn run-task [task args]
   (load-hooks task)
-  ((join-hooks (@hooks (symbol task)))
+  ((join-hooks (concat (@hooks (symbol task)) (@hooks :all)))
    #(apply (resolve-task task) args)))

 (defn ns->path [n]


spaces

spaces

--- src/lights/my_show.clj
+++ src/lights/my_show.clj
@@ -192,16 +192,12 @@
     (do
       (show/add-midi-control-to-var-mapping
         "USB Uno MIDI Interface" 9 0 :audio-drums :min -10 :max 50)
-
       (show/add-midi-control-to-var-mapping
         "USB Uno MIDI Interface" 9 1 :audio-bass :max 50)
-
       (show/add-midi-control-to-var-mapping
         "USB Uno MIDI Interface" 9 2 :audio-solo :max 50)
-
       (show/add-midi-control-to-var-mapping
         "USB Uno MIDI Interface" 9 3 :audio-voice :min -120 :max 50)
-
       (show/add-midi-control-to-var-mapping
         "USB Uno MIDI Interface" 9 4 :audio-percussion :max 50)
     )
@@ -211,16 +207,12 @@
     (do
       (show/add-midi-control-to-var-mapping
         "Komplete Audio 6" 9 0 :audio-drums :min -10 :max 50)
-
       (show/add-midi-control-to-var-mapping
         "Komplete Audio 6" 9 1 :audio-bass :max 50)
-
       (show/add-midi-control-to-var-mapping
         "Komplete Audio 6" 9 2 :audio-solo :max 50)
-
       (show/add-midi-control-to-var-mapping
         "Komplete Audio 6" 9 3 :audio-voice :min -120 :max 50)
-
       (show/add-midi-control-to-var-mapping
         "Komplete Audio 6" 9 4 :audio-percussion :max 50)
     )


Link incised in default footer.

Link incised in default footer.

Linking just the incise part looks weird.

--- src/incise/layouts/impl/base.clj
+++ src/incise/layouts/impl/base.clj
@@ -25,7 +25,7 @@
   [:footer
    [:p
     "This website was "
-    (link-to "https://github.com/RyanMcG/incise" "incise") "d."]])
+    (link-to "https://github.com/RyanMcG/incise" "incised") \.]])

 (defn- attempt-link-to-asset
   "Return nil if the asset is not found othewise return a url for the asset."


Rename hyde/r to hyde/render-tag

Rename hyde/r to hyde/render-tag

--- src/palletops/hyde.clj
+++ src/palletops/hyde.clj
@@ -93,19 +93,20 @@

 (defmulti render class)
+
 (comment
   "Example of a tag"
   (defrecord Link [url])
   (defmethod render Link [l]
     (format "http://%s" (:url l))))

-(defn r [tag-reader-map s]
+(defn render-tag [tag-reader-map s]
   (let [form (clojure.edn/read-string {:readers tag-reader-map} s)]
     (when form (render form))))

 (defn render-content [tag-reader-map s]
   (let [splices (splice-all s)]
-    (glue splices (partial r tag-reader-map))))
+    (glue splices (partial render-tag tag-reader-map))))

 ;;; JEKYLL


Control playback from the UI, except the playback is very slow now

--- src/pianola/webui.cljs
+++ src/pianola/webui.cljs
@@ -6,38 +6,38 @@
             [reagent.core :as r]
             [pianola.core :refer [automate-music]]))

-(defonce context (synth/audio-context))
-
 (defn ping [{:keys [pitch]}]
   (synth/connect->
    (synth/square pitch)
    (synth/percussive 0.01 0.4)
    (synth/gain 0.1)))

-(defn play! [audiocontext notes]
-  (let [phrase (take 1 notes)
-        remainder (drop 1 notes)
-        start (:time (first phrase))
-        phrase-duration (* 1000 (- (duration phrase)
-                                   start))]
-    (if (seq? remainder)
-      (js/setTimeout #(play! audiocontext remainder) phrase-duration))
-    (doseq [{:keys [time duration] :as note} phrase]
-      (let [at (- (+ time (synth/current-time audiocontext))
-                  start)
-            synth-instance (-> note
-                               (update :pitch temperament/equal)
-                               (dissoc :time)
-                               ping)
-            connected-instance (synth/connect synth-instance synth/destination)]
-        (connected-instance audiocontext at duration)))))
+;; (defonce context (synth/audio-context))

-(defn play-tune [tune]
-  (->>
-   tune
-   (tempo (bpm 50))
-   (where :pitch (comp scale/C scale/major))
-   (play! context)))
+;; (defn play! [audiocontext notes]
+;;   (let [phrase (take 1 notes)
+;;         remainder (drop 1 notes)
+;;         start (:time (first phrase))
+;;         phrase-duration (* 1000 (- (duration phrase)
+;;                                    start))]
+;;     (if (seq? remainder)
+;;       (js/setTimeout #(play! audiocontext remainder) phrase-duration))
+;;     (doseq [{:keys [time duration] :as note} phrase]
+;;       (let [at (- (+ time (synth/current-time audiocontext))
+;;                   start)
+;;             synth-instance (-> note
+;;                                (update :pitch temperament/equal)
+;;                                (dissoc :time)
+;;                                ping)
+;;             connected-instance (synth/connect synth-instance synth/destination)]
+;;         (connected-instance audiocontext at duration)))))
+
+;; (defn play-tune [tune]
+;;   (->>
+;;    tune
+;;    (tempo (bpm 50))
+;;    (where :pitch (comp scale/C scale/major))
+;;    (play! context)))

 ;; (play-tune (automate-music [[0.25 0.125 0.5 0.25 0.125 0.5 0.5]
 ;;                             [1 2 0 4 5 6 3]]
@@ -48,14 +48,55 @@
 ;;  (phrase [0.25 0.125 0.25 0.125 0.5 0.25 0.25 0.25]
 ;;          [2 1 2 1 2 3 4 5]))

+(defonce initial-automaton
+  [[0.25 0.125 0.5 0.25 0.125 0.5 0.5]
+   [1 2 0 4 5 6 3]])
+
+(defonce initial-seed
+  [[0.25 0.125 0.25 0.125 0.5 0.25 0.25 0.25]
+   [2 1 2 1 2 3 4 5]])
+
+(defonce initial-tempo
+  50)
+
+(defonce initial-scale
+  (comp scale/C scale/major))
+
 (defonce app-state
-  (r/atom {:tempo 50
-           :scale (comp scale/C scale/major)
+  (r/atom {:context (synth/audio-context)
+           :tempo initial-tempo
+           :scale initial-scale
            :playing false
-           :automaton [[0.25 0.125 0.5 0.25 0.125 0.5 0.5]
-                       [1 2 0 4 5 6 3]]
-           :seed [[0.25 0.125 0.25 0.125 0.5 0.25 0.25 0.25]
-                  [2 1 2 1 2 3 4 5]]}))
+           :automaton initial-automaton
+           :seed initial-seed
+           :music (->>
+                   (automate-music initial-automaton initial-seed)
+                   (tempo (bpm initial-tempo))
+                   (where :pitch initial-scale))}))
+
+(defn play-next! [notes]
+  (let [{:keys [context playing]} @app-state
+        {:keys [time duration] :as note} (first notes)
+        remainder (rest notes)
+        at (+ time (synth/current-time context))
+        synth-instance (-> note
+                           (update :pitch temperament/equal)
+                           (dissoc :time)
+                           ping)
+        connected-instance (synth/connect synth-instance synth/destination)]
+    (if (and (seq? remainder)
+             playing)
+      (js/setTimeout #(play-next! remainder) (* 1000 duration)))
+    (connected-instance context at duration)))
+
+(defmulti toggle-playback identity)
+
+(defmethod toggle-playback true [_]
+  (swap! app-state assoc :playing true)
+  (play-next! (:music @app-state)))
+
+(defmethod toggle-playback false [_]
+  (swap! app-state assoc :playing false))

 (defn slider [param value min max]
   [:input {:type "range" :value value :min min :max max
@@ -63,10 +104,10 @@
            :on-change (fn [e]
                         (swap! app-state assoc param (.-target.value e)))}])

-(defn toggle-playback []
+(defn playback-toggle []
   (let [playing (:playing @app-state)]
     [:button {:on-click (fn [e]
-                          (swap! app-state assoc :playing (not playing)))}
+                          (toggle-playback (not playing)))}
      (if playing
        "Stop"
        "Start")]))
@@ -77,7 +118,7 @@
      [:h1 "Pianola"]
      [slider :tempo tempo 20 160]
      [:p (str tempo " BPM")]
-     [toggle-playback]]))
+     [playback-toggle]]))

 (defn reload []
   (println "reloading")


Make calls! more reliable

Make calls! more reliable

--- src/play_clj/utils.clj
+++ src/play_clj/utils.clj
@@ -56,17 +56,18 @@
   [a]
   (Array. true (into-array a) 1 (count a)))

+(defn create-method-call
+  [[k v]]
+  (flatten (list (key->method k) (try (eval v)
+                                   (catch Exception _ v)))))
+
 (defmacro call!
   [obj k & args]
   `(~(key->method k) ~obj ~@args))

-(defn calls!*
-  [[k v]]
-  (flatten (list (key->method k) (eval v))))
-
 (defmacro calls!
   [obj & {:keys [] :as args}]
-  `(doto ~obj ~@(map calls!* args)))
+  `(doto ~obj ~@(map create-method-call args)))

 (defmulti create-entity class)


Make paragraphs wider because we're using 15px. Chnage the way line is added to a title.

--- src/re_demo/utils.cljs
+++ src/re_demo/utils.cljs
@@ -5,16 +5,17 @@
 (defn panel-title
   "Title shown at the top of each Tab Panel"
   [panel-name style]
-  [title
-   :label         panel-name
-   :level         :level1
-   :underline?    true
-   :margin-top    "1px"
-   :margin-bottom "0px"
-   :style         style])
+  [v-box
+   :children [ [title
+                :label         panel-name
+                :level         :level1
+                :margin-top    "3px"
+                ;:underline?    true
+                :style         style]
+               [line]]])

 (defn component-title
-  "A title for a component like [something ... ]"
+  "A title for a component like [some-name ... ]"
   [component-name style]
   [title
    :label component-name
@@ -95,5 +96,6 @@
 (defn paragraphs
   [& children]
   [v-box
-   :width    "400px"
+   :width    "450px"
+   :style   {:font-size "15px"}
    :children children])


Further improvements to API docstrings

Further improvements to API docstrings

--- src/re_frame/core.cljc
+++ src/re_frame/core.cljc
@@ -19,16 +19,17 @@

 ;; -- dispatch ----------------------------------------------------------------
+
 (defn dispatch
-  "Queue `event` for processing by re-frame's event handling machinery.
-
-  `event` is a vector and the first element is typically a keyword which
-  identifies the kind of event.
-
-  The event will be added to the end of a FIFO processing queue. So,
-  event handling does not happen immediately. It will likely happen
-  'very soon', bit not now. And if the queue already contains events,
-  they will be processed first.
+  "Queue `event` for processing (handling).
+
+  `event` is a vector and the first element is typically a keyword
+  which identifies the kind of event.
+
+  The event will be added to a FIFO processing queue, so event
+  handling does not happen immediately. It will happen 'very soon'
+  bit not now. And if the queue already contains events, they
+  will be processed first.

   Usage:

@@ -38,17 +39,19 @@
   (router/dispatch event))

 (defn dispatch-sync
-  "Synchronously (immediately) process `event`. It does not queue the event
-  for handling later as `dispatch` does.
+  "Synchronously (immediately) process `event`. It does **not** queue
+  the event for handling later as `dispatch` does.

   `event `is a vector and the first element is typically a keyword
   which identifies the kind of event.

-  Generally, don't use this and, instead, use `dispatch`. It is an error
-  to use `dispatch-sync` within an event handler because you can't immediately
-  process an new event when one is already part way through being processed.
-
-  Useful when any delay in processing will be a problem:
+  Generally, avoid using this function, and instead, use `dispatch`. It
+  is an error to use `dispatch-sync` within an event handler because
+  you can't immediately process an new event when one is already
+  part way through being processed.
+
+  Can be useful in a narrow set of cases where any delay in
+  processing is a problem:

     1. the `:on-change` handler of a text field where we are expecting fast typing
     2. when initialising your app - see 'main' in examples/todomvc/src/core.cljs
@@ -64,39 +67,49 @@

 ;; -- subscriptions -----------------------------------------------------------
 (defn reg-sub
-  "For a given `query-id`, register two functions: a `computation` function and an `input signals` function.
-
-  During program execution, a call to `subscribe`, such as `(subscribe [:sub-id 3 \"blue\"])`,
-  will create a new `:sub-id` node in the Signal Graph. And, at that time, re-frame
-  needs to know how to create the node.   By calling `reg-sub`, you are registering
-  'the template' or 'the mechanism' by which nodes in the Signal Graph can be created.
-
-  Repeating: calling `reg-sub` does not create a node. It only creates the template
-  from which nodes can be created later, when they are bought into existence via use of
-  `subscribe` in a `View Function`.
-
-  `reg-sub` arguments are:
+  "A call to `reg-sub` associates two functions with a `query-id`.
+
+  These two functions combine to provide the 'mechanism' for creating a node
+  in the Signal Graph, for the specified `query-id`.

-  - a `query-id` (typically a namespaced keyword)
-  - a function which returns the inputs required by this kind of node (which can be supplied in one of three ways)
-  - a function which computes the value of this kind of node
-
-  The `computation function` is always the last argument supplied and it is expected to have the signature:
-    `(input-values, query-vector) -> a-value`
-
-  When `computation function` is called, the `query-vector` argument will be the vector supplied to the
-  the `subscribe` which caused the node to be created. So, if the call was `(subscribe [:sub-id 3 \"blue\"])`,
-  then the `query-vector` supplied to the computaton function will be `[:sub-id 3 \"blue\"]`.
-
-  The arguments supplied between the `query-id` and the `computation-function` can vary in 3 ways,
-  but whatever is there defines the `input signals` part of the template, controlling what input
- values \"flow into\" the `computation function` gets when it is called.
-
-  `reg-sub` can be called in one of three ways, because there are three ways to define the input signals part.
-  But note, the 2nd method, in which a `signals function` is explicitly supplied, is the most canonical and instructive. The other
-  two are really just sugary variations.
-
-  First, No input signal fucntion given:
+  The three arguments are:
+
+  - `query-id` - typically a namespaced keyword (later used in subscribe)
+  - optionally, an `input signals` function which returns the input data
+    flows required by this kind of node.
+  - a `computation function` which computes the value of the node (from the input data flows)
+
+  Later, during app execution, a call to `(subscribe [:sub-id 3 :blue])`,
+  will trigger the need for a new Signal Graph node (for the query `[:sub-id 3 :blue]`).
+  And that means creating a new `:sub-id` node. To do that the two functions
+  associated with `:sub-id` are looked up and used.
+
+  Just to repeat:  calling `reg-sub` does not immediately create a node. It only registers
+  'the mechanism' (the two functions) by which nodes can be created later, when a node is
+  bought into existence by the use of `subscribe` in a `View Function`.
+
+  The `computation function` is expected to take two arguments:
+
+    - `input-values` - the values which flow into this node
+    - `query-vector` - the vector given to `subscribe`
+
+  and it returns a computed value (which then becomes the output of the node)
+
+  When `computation function` is called, the 2nd `query-vector` argument will be that
+  vector supplied to the `subscribe`. So, if the call was `(subscribe [:sub-id 3 :blue])`,
+  then the `query-vector` supplied to the computaton function will be `[:sub-id 3 :blue]`.
+
+  The argument(s) supplied between `query-id` and the `computation-function`
+  can vary in 3 ways, but whatever is there defines the `input signals` part
+  of `the mechanism`, specifying what input values \"flow into\" the
+  `computation function` (as the 1st argument) when it is called.
+
+  `reg-sub` can be called in one of three ways, because there are three ways
+  to define the input signals part. But note, the 2nd method, in which a
+  `signals function` is explicitly supplied, is the most canonical and
+  instructive. The other two are really just sugary variations.
+
+  First variation - no input signal function given:

       (reg-sub
         :query-id
@@ -107,7 +120,7 @@
      is given as the 1st argument when `a-computation-fn` is called.

-  Second, A signal function is explicitly supplied:
+  Second variation - a signal function is explicitly supplied:

       (reg-sub
         :query-id
@@ -162,7 +175,7 @@
         (fn [_ _]  re-frame/app-db)   ;; <--- explicit signal-fn
         a-computation-fn)             ;; has signature:  (fn [db query-vec]  ... ret-value)

-  Third, Syntax Sugar
+  Third variation - syntax Sugar

       (reg-sub
         :a-b-sub
@@ -213,7 +226,8 @@
       (subscribe [:items {:colour \"blue\"  :size :small}])

   Note: for any given call to `subscribe` there must have been a previous call
-  to `reg-sub`, registering the query handler (function) for the `query-id` given.
+  to `reg-sub`, registering the query handler (functions) associated with
+  `query-id`.

   #### Hint

@@ -352,12 +366,13 @@

   Second - Later, add an interceptor to an -fx event handler, using `inject-cofx`:

-      (re-frame.core/reg-event-fx        ;; we are registering an event handler
-         :event-id
-         [ ... (inject-cofx :datetime) ... ]    ;; <-- create an injecting interceptor
-         (fn event-handler
-           [coeffect event]
-           ... in here can access (:now coeffect) to obtain current datetime ... )))
+      (re-frame.core/reg-event-fx            ;; when registering an event handler
+        :event-id
+        [ ... (inject-cofx :datetime) ... ]  ;; <-- create an injecting interceptor
+        (fn event-handler
+          [coeffect event]
+            ;;... in here can access (:now coeffect) to obtain current datetime ...
+          )))

   ##### Background

@@ -582,7 +597,7 @@
   (or the `:coeffect` value of `:db` if no `:db` effect is returned) and the event.
   Its return value is ignored, so `f` can only side-effect.

-  An examples of use can be seen in /examples/todomvc/events.cljs:
+  An example of use can be seen in the re-frame github repo in `/examples/todomvc/events.cljs`:

      - `f` runs schema validation (reporting any errors found).
      - `f` writes to localstorage."
@@ -611,12 +626,12 @@
            ...))

-    If you put this Interceptor on handlers which might change paths :a or :b,
-    it will:
-
-     - call `f` each time the value at path [:a] or [:b] changes
-     - call `f` with the values extracted from [:a] [:b]
-     - assoc the return value from `f` into the path  [:c]
+  If you put this Interceptor on handlers which might change paths `:a` or `:b`,
+  it will:
+
+    - call `f` each time the value at path `[:a]` or `[:b]` changes
+    - call `f` with the values extracted from `[:a]` `[:b]`
+    - assoc the return value from `f` into the path  `[:c]`
   "
   [f out-path & in-paths]
   (apply std-interceptors/on-changes (into [f out-path] in-paths)))
@@ -626,7 +641,7 @@
   "Registers the given `interceptor` as a global interceptor. Global interceptors are
    included in the processing chain of every event.

-   When you register an event handler you have the option of supplying an
+   When you register an event handler, you have the option of supplying an
    interceptor chain. Any global interceptors you register are effectively
    prepending to this chain.

@@ -637,9 +652,11 @@
 (defn clear-global-interceptor ;; think unreg-global-interceptor
   "Unregisters (removes) global interceptors.

-   When called with no arguments, it unregisters all global interceptors. When given
+   When called with no arguments, it unregisters all global interceptors.
+
+   When given
    one argument, assumed to be the `id` of a currently registered global
-   interceptor, it unregisters the associated interceptor."
+   interceptor, it removes the associated interceptor."
   ([]
    (settings/clear-global-interceptors))
   ([id]
@@ -665,7 +682,7 @@
          :after  (fn [context]                         ;; you normally want to change :effects
                    (let [db (get-effect context :db)]  ;; (get-in context [:effects :db])
                      (assoc-effect context :http-ajax {...}])))))
-   "
+  "
   [& {:as m :keys [id before after]}]
   (utils/apply-kw interceptor/->interceptor m))


Call the appropriate add-post-event-callback. For #118.

--- src/re_frame/core.cljs
+++ src/re_frame/core.cljs
@@ -38,7 +38,7 @@

 (defn add-post-event-callback
   [f]
-  (add-post-event-callback re-frame.router/event-queue  f))
+  (router/add-post-event-callback re-frame.router/event-queue f))

 ;; --  Logging -----
 ;; re-frame uses the logging functions: warn, log, error, group and groupEnd


Swap arg order in _try-run

Swap arg order in _try-run

--- src/reagent/ratom.cljs
+++ src/reagent/ratom.cljs
@@ -2,7 +2,7 @@
   (:refer-clojure :exclude [atom])
   (:require-macros [reagent.ratom :refer [with-let]])
   (:require [reagent.impl.util :as util]
-            [reagent.debug :refer-macros [dbg log warn dev?]]))
+            [reagent.debug :refer-macros [dbg log warn error dev?]]))

 (declare ^:dynamic *ratom-context*)
 (defonce cached-reactions {})
@@ -364,7 +364,7 @@
         (doseq [w watching :while (== dirtyness maybe-dirty)]
           (when (and (instance? Reaction w)
                      (not (-check-clean w)))
-            (._try-run this w)))
+            (._try-run w this)))
         (set! auto-run ar))
       (when (== dirtyness maybe-dirty)
         (set! dirtyness clean)))
@@ -397,17 +397,17 @@
     nil)

   Object
-  (_try-run [_ parent]
+  (_try-run [this other]
     (try
-      (if-some [ar (.-auto-run parent)]
-        (ar parent)
-        (run parent))
+      (if-some [ar auto-run]
+        (ar this)
+        (run this))
       (catch :default e
         ;; Just log error: it will most likely pop up again at deref time.
-        (when-not silent
-          (js/console.error "Error in reaction:" e))
-        (set! (.-dirtyness parent) dirty)
-        (set! dirtyness dirty))))
+        (when-not silent (error "Error in reaction:" e))
+        (set! dirtyness dirty)
+        (set! (.-dirtyness other) dirty)))
+    nil)

   IRunnable
   (run [this]


CMR-6755 Updates commons-validator

CMR-6755 Updates commons-validator

--- umm-spec-lib/project.clj
+++ umm-spec-lib/project.clj
@@ -6,7 +6,7 @@
                [org.clojure/clojure]
                [org.clojure/tools.reader]]
   :dependencies [[commons-io "2.6"]
-                 [commons-validator/commons-validator "1.5.1"]
+                 [commons-validator/commons-validator "1.7"]
                  [digest "1.4.8"]
                  [nasa-cmr/cmr-common-app-lib "0.1.0-SNAPSHOT"]
                  [nasa-cmr/cmr-common-lib "0.1.1-SNAPSHOT"]


fix metrics name in kv store (#955)

fix metrics name in kv store (#955)

--- waiter/src/waiter/kv.clj
+++ waiter/src/waiter/kv.clj
@@ -144,7 +144,7 @@
     (validate-zk-key key)
     (meters/mark! (metrics/waiter-meter "core" "kv-zk" "store"))
     (timers/start-stop-time!
-      (metrics/waiter-timer "core" "kv-zk" "retrieve")
+      (metrics/waiter-timer "core" "kv-zk" "store")
       (let [path (key->zk-path base-path key)]
         (log/debug "(zk) STORE" path "=>" (hashcode value))
         (curator/write-path curator-client path value


generate-source-map must ensure that the output dir exists

--- src/main/shadow/build/output.clj
+++ src/main/shadow/build/output.clj
@@ -165,8 +165,9 @@
                         (assoc "sources" [resource-name])
                         )]

-                (json/write-str source-map-v3 :escape-slash false)
-                ))]
+                (json/write-str source-map-v3 :escape-slash false)))]
+
+      (io/make-parents src-map-file)
       (spit src-map-file source-map-json)

       sm-text)))


Cleanup :yum:

Cleanup :yum:

--- src/metabase/query_processor.clj
+++ src/metabase/query_processor.clj
@@ -571,8 +571,9 @@
                                             :query-hash  (hash query)
                                             :query-type (if (mbql-query? query) "MBQL" "native")})]
     (try
-      (query-complete query-execution (u/prog1 (process-query query)
-                                        (assert-valid-query-result <>)))
+      (let [result (process-query query)]
+        (assert-valid-query-result result)
+        (query-complete query-execution result))
       (catch Throwable e
         (log/error (u/format-color 'red "Query failure: %s" (.getMessage e)))
         (query-fail query-execution (.getMessage e))))))


Wait until batch is closed to ack.

Wait until batch is closed to ack.

--- src/onyx/peer/task_lifecycle.clj
+++ src/onyx/peer/task_lifecycle.clj
@@ -313,7 +313,7 @@
     (taoensso.timbre/trace (format "[%s / %s] Closed batch plugin resources"
                                    (:onyx.core/id rets)
                                    (:onyx.core/lifecycle-id rets)))
-    rets))
+    (merge event rets)))

 (defn launch-aux-threads!
   [{:keys [release-ch retry-ch] :as messenger} {:keys [onyx.core/pipeline
@@ -430,8 +430,8 @@
              (build-new-segments egress-ids task->group-by-fn flow-conditions)
              (write-batch pipeline)
              (flow-retry-segments replica state messenger monitoring)
-             (ack-segments task-map replica state messenger monitoring)
-             (close-batch-resources)))
+             (close-batch-resources)
+             (ack-segments task-map replica state messenger monitoring)))
       (catch Throwable e
         (ex-f e)))))


Allow the dire-hooks to be disabled at compile time, as with all the other timbre calls.

--- src/onyx/peer/task_lifecycle.clj
+++ src/onyx/peer/task_lifecycle.clj
@@ -2,7 +2,7 @@
     (:require [clojure.core.async :refer [alts!! <!! >!! <! >! timeout chan close! thread go dropping-buffer]]
               [com.stuartsierra.component :as component]
               [dire.core :as dire]
-              [taoensso.timbre :refer [info warn trace fatal] :as timbre]
+              [taoensso.timbre :refer [info warn trace fatal level-compile-time] :as timbre]
               [rotating-seq.core :as rsc]
               [onyx.log.commands.common :as common]
               [onyx.log.entry :as entry]
@@ -538,27 +538,29 @@
                        :replica replica :seal-resp-ch seal-ch :completion-ch completion-ch
                        :opts opts :task-kill-ch task-kill-ch}))

-(dire/with-post-hook! #'munge-start-lifecycle
-  (fn [{:keys [onyx.core/id onyx.core/lifecycle-id onyx.core/start-lifecycle?] :as event}]
-    (when-not start-lifecycle?
-      (timbre/info (format "[%s / %s] Lifecycle chose not to start the task yet. Backing off and retrying..." id lifecycle-id)))))
-
-(dire/with-post-hook! #'inject-batch-resources
+(when (or (nil? level-compile-time) (= level-compile-time :info) (= level-compile-time :trace))
+  (dire/with-post-hook! #'munge-start-lifecycle
+    (fn [{:keys [onyx.core/id onyx.core/lifecycle-id onyx.core/start-lifecycle?] :as event}]
+      (when-not start-lifecycle?
+        (timbre/info (format "[%s / %s] Lifecycle chose not to start the task yet. Backing off and retrying..." id lifecycle-id))))))
+
+(when (or (nil? level-compile-time) (= level-compile-time :trace))
+  (dire/with-post-hook! #'inject-batch-resources
+    (fn [{:keys [onyx.core/id onyx.core/lifecycle-id]}]
+      (taoensso.timbre/trace (format "[%s / %s] Started a new batch" id lifecycle-id)))))
+
+(when (or (nil? level-compile-time) (= level-compile-time :trace))
+  (dire/with-post-hook! #'apply-fn
+  (fn [{:keys [onyx.core/id onyx.core/results onyx.core/lifecycle-id]}]
+    (taoensso.timbre/trace (format "[%s / %s] Applied fn to %s segments" id lifecycle-id (count results))))))
+
+(when (or (nil? level-compile-time) (= level-compile-time :trace))
+  (= level-compile-time :trace)
+  (dire/with-post-hook! #'write-batch
+  (fn [{:keys [onyx.core/id onyx.core/lifecycle-id onyx.core/results]}]
+    (taoensso.timbre/trace (format "[%s / %s] Wrote %s segments" id lifecycle-id (count results))))))
+
+(when (or (nil? level-compile-time) (= level-compile-time :trace))
+  (dire/with-post-hook! #'close-batch-resources
   (fn [{:keys [onyx.core/id onyx.core/lifecycle-id]}]
-    (taoensso.timbre/trace (format "[%s / %s] Started a new batch" id lifecycle-id))))
-
-(dire/with-post-hook! #'read-batch
-  (fn [{:keys [onyx.core/id onyx.core/batch onyx.core/lifecycle-id]}]
-    (taoensso.timbre/trace (format "[%s / %s] Read %s segments" id lifecycle-id (count batch)))))
-
-(dire/with-post-hook! #'apply-fn
-  (fn [{:keys [onyx.core/id onyx.core/results onyx.core/lifecycle-id]}]
-    (taoensso.timbre/trace (format "[%s / %s] Applied fn to %s segments" id lifecycle-id (count results)))))
-
-(dire/with-post-hook! #'write-batch
-  (fn [{:keys [onyx.core/id onyx.core/lifecycle-id onyx.core/results]}]
-    (taoensso.timbre/trace (format "[%s / %s] Wrote %s segments" id lifecycle-id (count results)))))
-
-(dire/with-post-hook! #'close-batch-resources
-  (fn [{:keys [onyx.core/id onyx.core/lifecycle-id]}]
-    (taoensso.timbre/trace (format "[%s / %s] Closed batch plugin resources" id lifecycle-id))))
+    (taoensso.timbre/trace (format "[%s / %s] Closed batch plugin resources" id lifecycle-id)))))


handler.clj: Now get the results from toolserver directly.

--- src/wlmmap/handler.clj
+++ src/wlmmap/handler.clj
@@ -1,5 +1,8 @@
 (ns wlmmap.handler
-  (:require [noir.util.middleware :as middleware]
+  (:require [clojure.data.json :as json]
+            [clojure.string]
+            [ring.util.codec :as r]
+            [noir.util.middleware :as middleware]
             [compojure.core :as compojure :refer (GET POST defroutes)]
             (compojure [handler :as handler]
                        [route :as route])
@@ -15,24 +18,76 @@
   []
   (str "Destroy"))

+(defn- build-tsreq [params]
+  (if (empty? params)
+    (str "http://toolserver.org/~erfgoed/api/api.php?action=search&format=json&srlang=fr&srcountry=fr&limit=1000")
+    (str "http://toolserver.org/~erfgoed/api/api.php?action=search&format=json&"
+         "limit=" (or (:limit params) 1000)
+         (if (:srlang params) (str "&srlang=" (:srlang params)))
+         (if (= (:srwithimage params) "1")
+           "&srwithimage=1&srwithoutimage=0"
+           "&srwithimage=0&srwithoutimage=1")
+         "&srcountry=" (or (:srcountry params) "fr"))))
+
+(defn- build-js [monuments]
+  (let [init
+        ""
+        fmt-string
+        "var a%slegend = \"%s\";
+        var a%smarker = L.marker(new L.LatLng(%s, %s), { title: a%slegend });
+        a%smarker.bindPopup(a%slegend);
+        markers.addLayer(a%smarker);\n"]
+    (str init
+         (clojure.string/join
+          "\n"
+          (for [m monuments]
+            (if (and (:lat m) (:lon m))
+              (format fmt-string (:id m)
+                      (str (clojure.string/replace (:name m) #"[\n\r]" "")
+                           "
"
+                           ""(:image m)"
")
+                      (:id m) (:lat m) (:lon m) (:id m) (:id m) (:id m) (:id m)))))
+         end)))
+
 (defn- index [params]
   (h/html5
-   (h/include-css "/css/generic.css")
-   (h/include-css "/css/MarkerCluster.Default.css")
-   (h/include-css "/css/MarkerCluster.Default.ie.css")
-   (h/include-css "/css/MarkerCluster.css")
-   (h/include-css "http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.css")
-   (h/include-js "http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.js")
-   (if (= (:lang params) "fr")
-     (h/include-js "/js/fr_fr_noimg.js")
-     (h/include-js "/js/mon.js"))
-   (h/include-js "/js/leaflet.markercluster.js")
-   ;; [:h1 "WLM Map (work in progress)"]
+   (h/include-css "/css/generic.css"
+                  "/css/MarkerCluster.Default.css"
+                  "/css/MarkerCluster.Default.ie.css"
+                  "/css/MarkerCluster.css"
+                  "http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.css")
+   (h/include-js "http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.js"
+                 "/js/leaflet.markercluster.js")
+   [:form {:method "POST" :action "/" :class "main"}
+    "With images:"
+    [:input {:type "hidden" :name "srwithimage" :value "0"}]
+    [:input (if (= (:srwithimage params) "1")
+              {:type "checkbox" :name "srwithimage" :value "1" :checked "checked"}
+              {:type "checkbox" :name "srwithimage" :value "1"})]
+    " "
+    "Max:" [:input {:type "text-area" :name "limit" :value (:limit params)}]
+    " "
+    "Wikipedia (2 letters):" [:input {:type "text-area" :name "srcountry" :value (:srcountry params)}]
+    [:input {:type "submit" :value "Go"}]]
+
    [:div {:id "map"}]
-   (h/include-js "/js/map.js")))
+   (build-js (seq
+              (:monuments
+               (json/read-str (slurp (build-tsreq params))
+                              :key-fn keyword))))))

 (defroutes app-routes
   (GET "/" {params :params} (index params))
+  (POST "/" {params :params} (index params))
   (route/resources "/")
   (route/not-found "Not found"))


Comment about upload consumers

Comment about upload consumers

--- src/yada/multipart.clj
+++ src/yada/multipart.clj
@@ -584,6 +584,7 @@
         boundary (get-in content-type [:parameters "boundary"])
         request-buffer-size CHUNK-SIZE ; as Aleph default, TODO: derive this
         window-size (* 4 request-buffer-size)
+        ;; TODO: No options now, create alternative way of changing the part consumer
         part-consumer (get-in ctx [:handler :options :part-consumer] (->DefaultPartConsumer))]
     (cond
       (not boundary) (throw (ex-info "No boundary parameter in multipart" {:status 400}))


Fix test - schema expects password-bytes now

--- test/onyx/plugin/output_test.clj
+++ test/onyx/plugin/output_test.clj
@@ -64,7 +64,7 @@
                   :onyx/type :output
                   :onyx/medium :bookkeeper
                   :bookkeeper/serializer-fn :onyx.compression.nippy/compress
-                  :bookkeeper/password password
+                  :bookkeeper/password-bytes password
                   :bookkeeper/ensemble-size 3
                   :bookkeeper/quorum-size 3
                   :bookkeeper/zookeeper-addr zk-addr


adding reflexive test

adding reflexive test

--- test/babel/test/fr.clj
+++ test/babel/test/fr.clj
@@ -5,7 +5,9 @@
             [babel.forest :as forest]
             [babel.francais.grammar :refer [small]]
             [babel.francais.morphology :refer [fo]]
-            [babel.over :refer [over]]
+            [babel.francais.writer :refer [expression]]
+            [babel.over :as over]
+            [babel.workbook.fr :refer [over rules]]
             [clojure.string :as string]
             [clojure.test :refer :all]
             [clojure.tools.logging :as log]
@@ -160,4 +162,15 @@
     (is (not (nil? result)))
     (is (= (fo result) "nous sommes allées"))))

+(deftest reflexive
+  (let [result (over (vals rules)
+                     "je"
+                     (over (get rules :vp-pronoun-nonphrasal)
+                           "me" "se amuser"))]
+    (is (= (fo (first result))
+           "je m'amuse"))))

+(deftest have-fun-sentence
+  (let [result (expression {:synsem {:sem {:pred :have-fun}}})]
+    (is (= (get-in result [:synsem :sem :pred]) :have-fun))))
+


Documented weighted kmeans testing code a bit more thoroughly

--- test/cluster_tests.clj
+++ test/cluster_tests.clj
@@ -177,22 +177,26 @@
     (is (kmeans nmat 3 :last-clusters last-clusters))))

-
+; Reproducible random generator for weighted kmeans test; if this gets used anywhere else, need to move
+; to a closure
 (def rand-gen
   (java.util.Random. 1234))

-(defn random-vec
+(defn random-vec*
+  "Reproducible random vector"
   [n]
   (for [_ (range n)]
     (.nextFloat rand-gen)))

 (defn rand-int*
+  "Reproducible random integer"
   [n]
   (.nextInt rand-gen n))

 (defn dup-matrix-from-weights
+  "Take a matrix and weights, and produce a new matrix with duplicate rows according to `weights` integers."
   [mat weights]
   (reduce
     (fn [duped-mat [weight row]]
@@ -201,6 +205,7 @@
     (map vector weights mat)))

 (defn dup-rownames-from-weights
+  "Create a new rownames vector with names duplicated according to weights, as with dup-matrix-from-weights."
   [rownames weights]
   (reduce
     (fn [duped-rownames [weight rowname]]
@@ -211,6 +216,9 @@
     (map vector weights rownames)))

 (defn setify-members
+  "Given a clustering, creates a set of member sets. This makes it easy to compare clusters for equality.
+  Optional `:trans` keyword args lets you perform a transformation to the member names included in member
+  sets."
   [clsts & {:keys [trans] :or {trans identity}}]
   (->> clsts
        (map
@@ -220,27 +228,33 @@
            (set)))
        (set)))

-(defn print-mat [names mat]
+(defn print-mat
+  "Helper for looking at matrices"
+  [names mat]
   (doseq [[n r] (map vector names mat)]
     (println n ":" r)))

 (deftest weighted-kmeans
-  (doseq [_ (range 1)]
-    (let [n-uniq       20
-          n-dups-max   5
-          n-cmnts      3
-          uniq-positions   (for [_ (range n-uniq)] (random-vec n-cmnts))
-          ptpt-names       (for [i (range n-uniq)] (str "p" i))
-          weights          (for [_ (range n-uniq)] (inc (rand-int* n-dups-max)))
-          duped-positions  (dup-matrix-from-weights uniq-positions weights)
-          duped-names      (dup-rownames-from-weights ptpt-names weights)
-          duped-data       (named-matrix duped-names [:x :y :z] duped-positions)
-          deduped-data     (named-matrix ptpt-names [:x :y :z] uniq-positions)
-          weighted-clsts   (kmeans deduped-data 3 :weights weights)
-          unweighted-clsts (kmeans deduped-data 3)
-          duped-clsts      (kmeans duped-data 3)]
-      (is (= (setify-members weighted-clsts)
-             (setify-members duped-clsts :trans first))))))
-
-
+  (testing (str "Should give the same result as regular kmeans where rows have been duplicated according to a set "
+             "of integer weights")
+    (doseq [_ (range 1)]
+      (let [n-uniq       20
+            n-dups-max   5
+            n-cmnts      3
+            ; First create the base matrix, and a random set of integer weights
+            uniq-positions   (for [_ (range n-uniq)] (random-vec* n-cmnts))
+            ptpt-names       (for [i (range n-uniq)] (str "p" i))
+            weights          (for [_ (range n-uniq)] (inc (rand-int* n-dups-max)))
+            ; Use the weights to create
+            duped-positions  (dup-matrix-from-weights uniq-positions weights)
+            duped-names      (dup-rownames-from-weights ptpt-names weights)
+            duped-data       (named-matrix duped-names [:x :y :z] duped-positions)
+            deduped-data     (named-matrix ptpt-names [:x :y :z] uniq-positions)
+            weighted-clsts   (kmeans deduped-data 3 :weights weights)
+            unweighted-clsts (kmeans deduped-data 3)
+            duped-clsts      (kmeans duped-data 3)]
+        (is (= (setify-members weighted-clsts)
+               (setify-members duped-clsts :trans first)))))))
+
+


Clean up -h help documentation

Clean up -h help documentation

Signed-off-by: Gregory Haskins <640d9fe47775e6723f0355b7315e38f7d98d3539@gmail.com>

--- src/obcc/core.clj
+++ src/obcc/core.clj
@@ -50,7 +50,7 @@
     :handler cleancmd/run
     :options common-path-options}

-   {:name "package" :desc "Package the chaincode for deployment"
+   {:name "package" :desc "Package the chaincode into a CCA file for deployment"
     :handler packagecmd/run
     :options (option-merge [["-o" "--output NAME" "path to the output destination"]]
                            common-path-options)}
@@ -83,6 +83,7 @@
                "Actions:"
                (map (fn [[_ {:keys [name desc]}]] (str "  " name " -> " desc)) subcommands)
                ""
+               "(run \"obcc <action> -h\" for action specific help)"
                ]))

 (defn subcommand-usage [subcommand options-summary]


updating indexes

updating indexes

--- src/ophion/db.clj
+++ src/ophion/db.clj
@@ -148,7 +148,12 @@
    [{:id String}
     {:gid String}
     {:type String}
+    {:refseq String}
+    {:accession String}
     {:name String}
+    {:tag String}
+    {:term String}
+    {:pmid String}
     {:symbol String}
     {:gender String}
     {:featureId String}


ah the "beauty" of running in the same repl session

--- src/runtime/q.clj
+++ src/runtime/q.clj
@@ -387,6 +387,9 @@
   (is (isnot false "msg3") "msg4")
   )

+
+(def ^:private rte java.lang.RuntimeException)
+(def ^:private rte2 (newInstanceOfClass rte "12"))

 (deftest test_getAsClass
@@ -463,8 +466,6 @@
   )

-(def ^:private rte java.lang.RuntimeException)
-(def ^:private rte2 (newInstanceOfClass rte "12"))

 (deftest test_thro1
   (isthrown? java.lang.RuntimeException (thro rte))


fixes to the build process

fixes to the build process

--- jar-prslib/build.boot
+++ jar-prslib/build.boot
@@ -8,6 +8,7 @@
     (str nexus-url repo-type "-" edition "-rhel7")))

 (set-env!
+  :jar-name "SlipStreamServerPRSlib-jar"
   :project 'com.sixsq.slipstream/SlipStreamServerPRSlib-jar
   :version +version+
   :license {"Apache 2.0" "http://www.apache.org/licenses/LICENSE-2.0.txt"}
@@ -62,7 +63,8 @@
          (comp
            (pom)
            (aot :all true)
-           (jar)))
+           (uber)
+           (jar :file (str (get-env :jar-name) "-" (get-env :version) ".jar"))))

 (deftask mvn-test
          "run all tests of project"
@@ -94,7 +96,7 @@
          []
          (comp
            (build)
-           (install)
+           (install :pom "pom.xml")
            (target)))

 (deftask mvn-deploy


Endpoint for 'glossary' dictionary

Endpoint for 'glossary' dictionary

--- src/zg/server.clj
+++ src/zg/server.clj
@@ -91,9 +91,8 @@
     (let [params         (:params request)
           word           (get params "word")
           search-results (if (not (empty? word))
-                             (db-interface/read-words-for-pattern word :blacklist))
-          sources        (db-interface/read-sources)]
-        (finish-processing request search-results sources nil title emender-page :blacklist)))
+                             (db-interface/read-words-for-pattern word :blacklist))]
+        (finish-processing request search-results nil nil title emender-page :blacklist)))

 (defn process-atomic-typos
     "Function that prepares data for the Atomic typos front page."
@@ -101,9 +100,18 @@
     (let [params         (:params request)
           word           (get params "word")
           search-results (if (not (empty? word))
-                             (db-interface/read-words-for-pattern word :atomic-typos))
+                             (db-interface/read-words-for-pattern word :atomic-typos))]
+        (finish-processing request search-results nil nil title emender-page :atomic-typos)))
+
+(defn process-glossary
+    "Function that prepares data for the Glossary front page."
+    [request title emender-page]
+    (let [params         (:params request)
+          word           (get params "word")
+          search-results (if (not (empty? word))
+                             (db-interface/read-words-for-pattern word :universal))
           sources        (db-interface/read-sources)]
-        (finish-processing request search-results sources nil title emender-page :atomic-typos)))
+        (finish-processing request search-results sources nil title emender-page :universal)))

 (defn add-word-message
     [word proper-word]
@@ -350,6 +358,7 @@
             "/whitelist"                  (process-whitelist     request title emender-page)
             "/blacklist"                  (process-blacklist     request title emender-page)
             "/atomic-typos"               (process-atomic-typos  request title emender-page)
+            "/glossary"                   (process-glossary      request title emender-page)
             "/all-words-in-whitelist"     (process-all-words     request title emender-page :whitelist)
             "/all-words-in-blacklist"     (process-all-words     request title emender-page :blacklist)
             "/all-words-in-atomic-typos"  (process-all-words     request title emender-page :atomic-typos)


CMR-5386 Adds assert and wait to rebalanacing index in bulk-delete test

--- system-int-test/test/cmr/system_int_test/bootstrap/bulk_index/delete_test.clj
+++ system-int-test/test/cmr/system_int_test/bootstrap/bulk_index/delete_test.clj
@@ -30,7 +30,12 @@
                                             {:grant-all-ingest? true
                                              :grant-all-search? true
                                              :grant-all-access-control? false})
-                     tags/grant-all-tag-fixture]))
+                      tags/grant-all-tag-fixture]))
+
+(defn assert-rebalance-status
+  [expected-counts collection]
+  (is (= (assoc expected-counts :status 200)
+         (bootstrap/get-rebalance-status (:concept-id collection)))))

 (deftest bulk-delete-by-concept-id
   (s/only-with-real-database
@@ -64,6 +69,9 @@
       ;; granules outside of 1_small_collections get deleted properly.
       (bootstrap/start-rebalance-collection coll2-id)
       (bootstrap/finalize-rebalance-collection coll2-id)
+      (index/wait-until-indexed)
+
+      (assert-rebalance-status {:small-collections 0 :separate-index 3} coll2)

       (bootstrap/bulk-delete-concepts "PROV1" :collection (map :concept-id [coll1]))
       (bootstrap/bulk-delete-concepts "PROV1" :granule (map :concept-id [gran1 gran3 gran4]))


require -> :require

require -> :require

--- exercises/armstrong-numbers/test/armstrong_numbers_test.clj
+++ exercises/armstrong-numbers/test/armstrong_numbers_test.clj
@@ -1,6 +1,6 @@
 (ns armstrong-numbers-test
-  (require [clojure.test :refer [deftest is testing]]
-           [armstrong-numbers :refer [armstrong?]]))
+  (:require [clojure.test :refer [deftest is testing]]
+            [armstrong-numbers :refer [armstrong?]]))

 (deftest armstrong-number-5
   (testing "Single digit numbers are Armstrong numbers"


Cleaned up showvideo.clj example.

Cleaned up showvideo.clj example.

--- examples/showvideo.clj
+++ examples/showvideo.clj
@@ -1,4 +1,6 @@
 (ns showvideo
+  "Example of decoding AR.Drone video with asynchronous display and
+  latency reduction."
   (:require [clojure.java.io :as io]
             [clojure.tools.logging :as log]
             [com.lemondronor.turboshrimp.h264j :as decode]
@@ -6,6 +8,7 @@
             [com.lemonodor.gflags :as gflags]
             [com.lemonodor.xio :as xio])
   (:import (java.awt Graphics)
+           (java.awt.image BufferedImage)
            (java.net Socket)
            (javax.swing JFrame JPanel))
   (:gen-class))
@@ -13,7 +16,7 @@

 (gflags/define-boolean "file"
   false
-  "Read an input file.")
+  "Read an input file instead of connecting to the drone.")

 (gflags/define-float "fps"
   30.0
@@ -24,39 +27,48 @@
   "Turns on latency reduction.")

-(defn display-frame [decoder ^JPanel view frame]
-  (let [^BufferedImage img (decoder frame)]
-    (when img
-      (.drawImage (.getGraphics view) img 0 0 view))))
+(defn display-image
+  "Renders an image to a view."
+  [^JPanel view ^BufferedImage image]
+  (.drawImage (.getGraphics view) image 0 0 view))

 (def drone-hostname "192.168.1.1")
 (def drone-video-port 5555)

-(defn drone-video-input-stream [hostname]
+(defn drone-video-input-stream
+  "Connects to a drone's video feed.  Returns an InputStream."
+  [hostname]
   (println "Connecting to drone at" hostname)
-  (.getInputStream (Socket. hostname drone-video-port)))
+  (let [is (.getInputStream (Socket. hostname drone-video-port))]
+    (println "Connected.")
+    is))

-(defn get-input-stream [args]
-  (println (gflags/flags))
+(defn get-input-stream
+  "Returns an InputStream of video data.
+
+   Depending on the command-line flags specified, either connects to a
+   drone or opens a file."
+  [args]
   (if (gflags/flags :file)
     (if (seq args)
       (io/input-stream (first args))
+      ;; If we weren't given a path, read from stdin.
       System/in)
     (drone-video-input-stream (if (seq args) (first args) drone-hostname))))

 (defn -main [& args]
-  (println args)
   (let [args (gflags/parse-flags (cons nil args))
         ^JFrame window (JFrame. "Drone video")
         ^JPanel view (JPanel.)
-        lrq (pave/make-frame-queue
-             :reduce-latency? (gflags/flags :reduce-latency))
+        frame-queue (pave/make-frame-queue
+                     :reduce-latency? (gflags/flags :reduce-latency))
         decoder (decode/decoder)
         is (get-input-stream args)
+        display-thread-done (promise)
         frame-count (atom 0)
         frame-delay (if (gflags/flags :file)
                       (/ 1000.0 (gflags/flags :fps))
@@ -64,23 +76,37 @@
     (.setBounds window 0 0 640 360)
     (.add (.getContentPane window) view)
     (.setVisible window true)
-    (.start
+    (.addShutdownHook
+     (Runtime/getRuntime)
      (Thread.
       (fn []
-        (let [frame (pave/pull-frame lrq 100)]
-          (if frame
-            (do
-              (swap! frame-count inc)
-              (display-frame decoder view frame)
-              (recur))
-            (println "Showed" @frame-count "frames, dropped"
-                     @(:num-dropped-frames lrq) "frames."))))))
+        (println "Showed" @frame-count "frames, dropped"
+                 @(:num-dropped-frames frame-queue) "frames."))))
+    ;; The rendering thread pulls frames from the queue, decodes them,
+    ;; and renders them.
+    (doto
+        (Thread.
+         (fn []
+           (let [frame (pave/pull-frame frame-queue 100)]
+             (if frame
+               (do
+                 (swap! frame-count inc)
+                 (->> frame
+                      decoder
+                      (display-image view))
+                 (recur))
+               (deliver display-thread-done true)))))
+      (.setDaemon true)
+      (.start))
+    ;; Decode PaVE frames from the input and push them onto the frame
+    ;; queue.
     (loop [frame (pave/read-frame is)]
       (if frame
         (do
-          (pave/queue-frame lrq frame)
+          (pave/queue-frame frame-queue frame)
           (when frame-delay
             (Thread/sleep frame-delay))
           (recur (pave/read-frame is)))
         (do
-          (Thread/sleep 100000))))))
+          @display-thread-done
+          (System/exit 0))))))


CMR-2112 Missing PR fix

CMR-2112 Missing PR fix

--- system-int-test/test/cmr/system_int_test/ingest/ops_collections_translation_test.clj
+++ system-int-test/test/cmr/system_int_test/ingest/ops_collections_translation_test.clj
@@ -183,17 +183,16 @@
   so they can be reported."
   [collection]
   (remove empty?
-          (flatten
-           (concat
-            [(:_errors collection)]
-            (for [key (keys collection)
-                  :let [coll (get collection key)]
-                  result (cond
-                           (map? coll) (extract-errors-from-collection coll)
-                           (coll? coll) (for [entry coll
-                                              :when (map? entry)]
-                                          (extract-errors-from-collection entry)))]
-               result)))))
+          (apply concat
+                 [(:_errors collection)]
+                 (for [key (keys collection)
+                       :let [coll (get collection key)]
+                       result (cond
+                                (map? coll) (extract-errors-from-collection coll)
+                                (coll? coll) (for [entry coll
+                                                   :when (map? entry)]
+                                               (extract-errors-from-collection entry)))]
+                   result))))

 (defn- reformat-error-message
   "For a 'string too long' error, just print out what string it is and the size so that
@@ -334,9 +333,9 @@
     (info "Finished OPS collections translation.")))

 (comment
-  ;; Translate and validate a specific collection by concept-id
-  (def record (get-collection "C1214598113-SCIOPS"))
-  (translate-and-validation-collection record)
-  (translate-record-to-umm record)
-  (:metadata-format record)
-  (:metadata record))
+ ;; Translate and validate a specific collection by concept-id
+ (def record (get-collection "C1214598113-SCIOPS"))
+ (translate-and-validation-collection record)
+ (translate-record-to-umm record)
+ (:metadata-format record)
+ (:metadata record))


tokenizer function: (toks2) should group together all lexical matches for first token as a list

--- src/babel/parse.cljc
+++ src/babel/parse.cljc
@@ -27,7 +27,7 @@
         (let [looked-up (lookup (str (first tokens) " " (second tokens)))]
           (if (not (empty? looked-up))
             ;; found a match by combining first two tokens.
-            (cons looked-up
+            (cons (list looked-up)
                   (toks2 (rest (rest tokens)) lexicon lookup))
             ;; else, no match: consider the first token as a standalone token and continue.
             (cons (lookup (first tokens))


use _id instead of id

use _id instead of id

--- src/boost_bin/db.clj
+++ src/boost_bin/db.clj
@@ -16,5 +16,5 @@
 	(let [{:keys [conn db]} (connect)
 				id (ObjectId.)]
 		(mc/insert-and-return db "datalogs"
-							 {:id id, :data (csv/as-vector-map (:tempfile data))})
-		{:id (.toString id)}))+							 {:_id id, :data (csv/as-vector-map (:tempfile data))})
+		{:_id (.toString id)}))


Add int16 and bool type spec implementation.

--- src/bytebuf/spec.clj
+++ src/bytebuf/spec.clj
@@ -110,8 +110,59 @@
 ;; Types implementation
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

+(defn bool
+  "Create a boolean data type."
+  ([] (bool nil))
+  ([default]
+   (reify
+     ISpecType
+     (tag [_] :static)
+
+     IReadableSpec
+     (read [_ buff pos]
+       (let [readed (buffer/read-byte buff pos)]
+         [1 (condp = readed
+              (byte 0) false
+              (byte 1) true
+              nil)]))
+
+     IWritableSpec
+     (write [_ buff pos value]
+       (let [value (condp = value
+                     true (byte 1)
+                     false (byte 0)
+                     (byte -1))]
+         (buffer/write-byte buff pos value)
+         1))
+
+     IStaticSize
+     (size [_] 1))))
+
+(defn int16
+  "Create a int16 data type."
+  ([] (int16 0))
+  ([default]
+   (reify
+     ISpecType
+     (tag [_] :static)
+
+     IReadableSpec
+     (read [_ buff pos]
+       [(Short/BYTES)
+        (buffer/read-short buff pos)])
+
+     IWritableSpec
+     (write [_ buff pos value]
+       (let [value (or value default)]
+         (buffer/write-short buff pos value)
+         (Short/BYTES)))
+
+     IStaticSize
+     (size [_]
+       (Short/BYTES)))))
+
 (defn int32
-  "Create a int32 indexed data type."
+  "Create a int32 data type."
   ([] (int32 0))
   ([default]
    (reify
@@ -134,7 +185,7 @@
        (Integer/BYTES)))))

 (defn int64
-  "Create a int64 indexed data type."
+  "Create a int64 data type."
   ([] (int64 0))
   ([default]
    (reify


remove bad require

remove bad require

--- src/clj/dog/auth.clj
+++ src/clj/dog/auth.clj
@@ -1,6 +1,5 @@
 (ns dog.auth
   (:require [dog.dynamite :as d]
-            [dog.config :as c]
             [cemerick.friend.credentials :as creds]
             [clojure.java.jdbc :as jdbc]
             [clj-time.core :as time]


Use clojure.math for rounding

Use clojure.math for rounding

--- src/clj/mdr2/dtb.clj
+++ src/clj/mdr2/dtb.clj
@@ -4,6 +4,7 @@
   (:require [clojure.java.io :refer [file]]
             [clojure.string :as s]
             [clojure.tools.logging :as log]
+            [clojure.math :as math]
             [pantomime.mime :refer [mime-type-of]]
             [mdr2.production.path :as path]
             [clojure.xml :as xml]
@@ -127,7 +128,7 @@
      (map file-audio-length)
      (reduce +)
      (* 1000)
-     Math/round)))
+     math/round)))

 (defn- file-audio-channels
   "Return the number of audio channels for a given audio `file`"
@@ -169,7 +170,7 @@
   [dtb]
   (let [files (get-files dtb)
         bytes (->> files (map #(.length %)) (reduce +))]
-    (-> bytes (/ 1024) Math/round)))
+    (-> bytes (/ 1024) math/round)))

 (defn depth
   "Return the depth of a given DAISY Talking Book.


unlock in wrong place

unlock in wrong place

--- src/clj/neb/cell.clj
+++ src/clj/neb/cell.clj
@@ -45,14 +45,15 @@
      ~trunk ~hash
      (let [write-lock# (.getCellWriteLock ~trunk)
            exec# (fn []
-                   (.lock (.readLock write-lock#))
                    (try
+                     (.lock (.readLock write-lock#))
                      (locking *cell-meta* ~@body)
-                     (catch Exception ex# (.unlock (.readLock write-lock#)))))
+                     (finally (.unlock (.readLock write-lock#)))))
            exec-retry# (fn []
-                         (.lock (.writeLock write-lock#))
-                         (defrag/scan-trunk-and-defragment ~trunk)
-                         (.unlock (.writeLock write-lock#))
+                         (try
+                           (.lock (.writeLock write-lock#))
+                           (defrag/scan-trunk-and-defragment ~trunk)
+                           (finally (.unlock (.writeLock write-lock#))))
                          (exec#))]
        (try
          (exec#)


[Add] fun update-exp-data

[Add] fun update-exp-data

for evaluation

--- src/clj_elm/core.clj
+++ src/clj_elm/core.clj
@@ -107,9 +107,17 @@
        (c/sum)
        (sign))))

+(defn update-exp-data [pred fact exp]
+  {:pre [(= (Math/abs pred) (Math/abs fact) 1)]}
+  (cond
+    (and (= pred 1) (= fact 1)) (assoc exp :TP (inc (:TP exp)))
+    (and (= pred 1) (= fact -1)) (assoc exp :FP (inc (:FP exp)))
+    (and (= pred -1) (= fact -1)) (assoc exp :TN (inc (:TN exp)))
+    (and (= pred -1) (= fact 1)) (assoc exp :FN (inc (:FN exp)))))
+
 (defn evaluation
-  ([results facts]
-   {:pre [(coll? results) (coll? facts)]}
+  ([results expdata facts]
+   {:pre [(coll? results) (coll? facts) (map? expdata)]}
    (let [numd (count results)]
      (->> (pmap #(= %1 %2) results facts)
           (filter true?)


Don't consider nil authorized ever.

Don't consider nil authorized ever.

--- src/clojars/auth.clj
+++ src/clojars/auth.clj
@@ -16,8 +16,9 @@
       {:username user :password password})))

 (defn authorized? [account group]
-  (let [names# (group-membernames group)]
-    (or (some #{account} names#) (empty? names#))))
+  (if account
+    (let [names (group-membernames group)]
+      (or (some #{account} names) (empty? names)))))

 (defmacro require-authorization [group & body]
   `(if (authorized? ~'account ~group)


Keyword searching is now faster, as n-grams are maintained in a sorted-set.

--- Spraff/src/spraff/core.clj
+++ Spraff/src/spraff/core.clj
@@ -24,7 +24,7 @@
 (def empty-state {
     :forwardtable {}
     :backwardtable {}
-    :n-grams []
+    :n-grams (sorted-set)
 })

@@ -77,8 +77,13 @@
             (reverse (take 500 (stream-of-shite (reverse seed) backward))))
         (take 500 (stream-of-shite seed forward))))

+(defn extend-vec [v e n] (vec (concat v (take (- n (count v)) (repeat e)))))
+(defn append-null [s] (join (concat (seq s) [(char 0)])))
+
 (defn generate-sentence [state keywords]
-    (println "keywords: " keywords "\n")
+    {
+        :pre [(or (empty? keywords) (sorted? (:n-grams state)))]
+    }
     (if (empty? keywords)
         (remove keyword? (map first
             (apply max-key #(count (filter true? (map second %)))
@@ -87,11 +92,13 @@
                     (:backwardtable state)
                     (:forwardtable state)))))))
         (let [filtered-grams
-                (remove
-                    (fn [s] (empty? (remove
-                        (fn [k] (empty? (filter #(.contains % k) (remove keyword? s))))
-                        keywords)))
-                    (:n-grams state))]
+                (apply concat
+                    (map
+                        (fn [k]
+                            (subseq (:n-grams state)
+                                >= (extend-vec [k] "" prefix-length)
+                                < (extend-vec [(append-null k)] "" prefix-length)))
+                        keywords))]
             (if (empty? filtered-grams)
                 (generate-sentence state [])
                 (generate-sentence
@@ -136,7 +143,7 @@
             :backwardtable
                 (update-table (:backwardtable state) (reverse words))
             :n-grams
-                (update-ngrams (:n-grams state) words))))
+                (update-ngrams (:n-grams state) (remove keyword? words)))))
 (defn log-sentence! [message]
     (with-open [out (writer corpus-file :append true)]
         (.write out (str message "\n"))))
@@ -215,10 +222,9 @@
     (update-state! message state-ref)
     (if (and (not (= nick (:name @irc))) (.contains message (:name @irc)))
         (send-message irc channel
-            (join " " (generate-sentence
+            (join (take 450 (join " " (generate-sentence
                 @state-ref
-                (let [keywords (set (remove #(.contains % (:name @irc)) (split-sentence-to-words message)))]
-                    (if (<= (count keywords) 3) keywords #{}))))))
+                (set (remove #(.contains % (:name @irc)) (split-sentence-to-words message)))))))))
     (if (.startsWith message "!burrito")
         (send-message irc channel
             (generate-burrito)))


Remove references to old widget

Remove references to old widget

--- frontend/intercom.cljs
+++ frontend/intercom.cljs
@@ -1,33 +1,12 @@
 (ns frontend.intercom
   (:require [frontend.utils :as utils :include-macros true]))

-(defn intercom-jquery []
-  (aget js/window "intercomJQuery"))
-
-(defn intercom-v1-new-message [jq message]
-  (.click (jq "#IntercomTab"))
-  (when-not (.is (jq "#IntercomNewMessageContainer") ":visible")
-    (.click (jq "[href=IntercomNewMessageContainer]")))
-  (when-not (.is (jq "#newMessageBody") ":visible")
-    (throw "didn't find intercom v1 widget"))
-  (.focus (jq "#newMessageBody"))
-  (when message
-    (.text (jq "#newMessageBody") (str message "\n\n"))))
-
-(defn intercom-v2-new-message []
-  (js/Intercom "show"))
-
 (defn raise-dialog [ch & [message]]
   (try
-    (let [jq (intercom-jquery)]
-      (intercom-v1-new-message jq message))
+    (js/Intercom "show")
     (catch :default e
-      (try
-        (intercom-v2-new-message)
-        (catch :default e
-          (utils/notify-error ch "Uh-oh, our Help system isn't available. Please email us instead, at sayhi@circleci.com")
-          (utils/merror e)))))
-  (utils/notify-error ch "Uh-oh, our Help system isn't available. Please email us instead, at sayhi@circleci.com"))
+      (utils/notify-error ch "Uh-oh, our Help system isn't available. Please email us instead, at sayhi@circleci.com")
+      (utils/merror e))))

 (defn user-link []
   (let [path (.. js/window -location -pathname)


just some comments

just some comments

--- src/done/handler.clj
+++ src/done/handler.clj
@@ -11,6 +11,7 @@
             [done.session :as session]
             ))

+; routes to create a session (login)
 (defroutes session-routes
   (POST "/" [email password]
         (let [credentials {:email email :password password}
@@ -30,6 +31,7 @@
            {:status 404 :body "Session not found"}
            (session/expand-session (session :value))))))

+; routes to create and delete 'dones'
 (defroutes dones-routes
   (POST "/" {{text :text} :params cookies :cookies}
         (let [session (cookies "session")]
@@ -51,6 +53,7 @@
                   "failure" {:status 500 :body "Error while deleting resource"}))))))

+; routes to create users
 (defroutes users-routes
   (GET "/:username" [username] (str "hello " username))


Add trace

Add trace


use correct icon for irc

use correct icon for irc

--- frontend/components/project_settings.cljs
+++ frontend/components/project_settings.cljs
@@ -559,7 +559,7 @@
                              :show-fixed-failed? false}

                             {:service "IRC"
-                             :icon "chat-i-flow"
+                             :icon "chat-i-irc"
                              :doc nil
                              :inputs [{:field :irc_server :placeholder "Hostname"}
                                       {:field :irc_channel :placeholder "Channel"}


Multivolume productions only need one rdf and one db entry

--- src/mdr2/archive.clj
+++ src/mdr2/archive.clj
@@ -87,12 +87,10 @@
 (defn- container-rdf-path
   "Return the path to the rdf file in the archive spool for a given
   `production` and `sektion`"
-  ([production sektion]
-   (container-rdf-path production sektion nil))
-  ([production sektion volume]
-   (let [path (container-id production sektion)
-         rdf-name (str (container-id production sektion volume) ".rdf")]
-     (.getPath (file spool-dir path rdf-name)))))
+  [production sektion]
+  (let [path (container-id production sektion)
+        rdf-name (str (container-id production sektion) ".rdf")]
+    (.getPath (file spool-dir path rdf-name))))

 (defn- add-to-db
   "Insert a `production` into the archive db for the given `sektion`.
@@ -100,14 +98,11 @@
   and concludes the archiving process from the point of view of the
   production system."
   [production sektion]
-  (let [volumes (inc (:volumes production))
-        entries (case sektion :master 2 :dist-master volumes)]
-    (doseq [volume (range 1 entries)]
-      (let [new-job
-            {:verzeichnis (container-id production sektion volume)
-             :sektion (case sektion :master "master" :dist-master "cdimage")}
-            job (merge default-job new-job)]
-        (jdbc/insert! db :container job)))))
+  (let [new-job
+        {:verzeichnis (container-id production sektion)
+         :sektion (case sektion :master "master" :dist-master "cdimage")}
+        job (merge default-job new-job)]
+    (jdbc/insert! db :container job)))

 (defn- copy-files
   "Copy a `production` to the archive spool dir for the given
@@ -132,9 +127,8 @@
   [production sektion]
   (let [rdf (rdf/rdf production)
         entries (case sektion :master 2 :dist-master (inc (:volumes production)))]
-    (doseq [volume (range 1 entries)]
-      (let [rdf-path (container-rdf-path production sektion volume)]
-        (spit rdf-path rdf)))))
+    (let [rdf-path (container-rdf-path production sektion)]
+      (spit rdf-path rdf))))

 (defn- archive-sektion
   "Archive a `production` for given `sektion`. For the :master sektion


More utility functions (and comments)

More utility functions (and comments)

--- src/modular/core.clj
+++ src/modular/core.clj
@@ -20,7 +20,22 @@
    [clojure.pprint :refer (pprint)]
    [com.stuartsierra.component :as component]))

-(defn add-index-dependencies [dependency-map system]
+(defn normalize
+  "component/using and system/using accept vectors as well as maps. This
+  makes it difficult to process (merge, extract, etc.) dependency
+  trees. Use this function to normalise so that only the map form is
+  used."
+  [m]
+  (reduce-kv
+   (fn [s k v]
+     (assoc s k
+            (if (vector? v)
+              (apply zipmap (repeat 2 v))
+              v)))
+   {} m))
+
+(defn add-index-dependencies
+  [dependency-map system]
   (reduce
    (fn [acc [p q]] (update-in acc [p] assoc q q))
    dependency-map
@@ -29,14 +44,15 @@
          [q impl] system :when (satisfies? prot impl)]
      [k q])))

-(defn normalize [m]
-  (reduce-kv
-   (fn [s k v]
-     (assoc s k
-            (if (vector? v)
-              (apply zipmap (repeat 2 v))
-              v)))
-   {} m))
+(defn autowire-dependencies-satisfying
+  "Return a dependency map between the given key (of the dependant) and
+  any components in the given system map that satisfy the given
+  protocol."
+  [system-map dependant-key proto]
+  (normalize {dependant-key (vec (keep (fn [[k v]] (when (satisfies? proto v) k)) (seq system-map)))}))

-(defn system-using [system dependency-map]
-  (component/system-using system (-> dependency-map normalize (add-index-dependencies system))))
+(defn system-using
+  "A pure convenience function for projects using add-index-dependencies
+  only. Most projects will call component/system-using directly."
+  [system-map dependency-map]
+  (component/system-using system-map (-> dependency-map normalize (add-index-dependencies system-map))))


[Issue-16] Add command to export a shelf.

--- src/myshelf/core.clj
+++ src/myshelf/core.clj
@@ -53,6 +53,15 @@
                (rank-books-on-shelf consumer access-token
                                     user-id "to-read"))))

+(defn export-shelf
+  [consumer access-token user-id shelf]
+  (let [books (get-all-books-on-shelf consumer access-token
+                                      user-id shelf)]
+    (->> books
+         (map #(assoc % :author (get-in % [:authors :author :name])))
+         (table [:title :author])
+         (spit (str "goodreads-export-" shelf ".table")))))
+
 (defn handle-socket-command
   [consumer access-token user-id ins outs]
   (binding [*in* (reader ins)
@@ -67,7 +76,11 @@
                   (= "add" cmd) (add-book-to-shelf consumer access-token
                                                    args "to-read")
                   (= "rank" cmd) (rank-to-read-books consumer access-token
-                                                     user-id))]
+                                                     user-id)
+                  (= "export" cmd) (export-shelf consumer
+                                                 access-token
+                                                 user-id
+                                                 args))]
         (println ret))
       (catch Exception ex
         (println "oh noes!" (.getMessage ex))))))


increased bottom margin of iframe

increased bottom margin of iframe

--- src/nn/views/css.clj
+++ src/nn/views/css.clj
@@ -97,7 +97,7 @@
                       [:body  {:background "white" :margin 0}
                        [:.bookend (conj {:background "#5978FF" } (size "100%" "25%"))]
                        ]
-                    [:.iframe {:margin-bottom "2px"}]
+                    [:.iframe {:margin-bottom "6px"}]
                       [:.overflow {:overflow-y "scroll"}]
                       [:.test ^:prefix {:transform "translateY(5em)"}]
                       [:.trans {:transition "all .1s ease-in-out"}]


oops, doesnt compile

oops, doesnt compile

--- src/ontrail/auth.clj
+++ src/ontrail/auth.clj
@@ -33,6 +33,6 @@
   (try
       (:username (user-from-token (:value (cookies "authToken"))))
       (catch Exception exception
-        (.error trace (str "Could not get user from cookie " exception))
+        (.trace logger (str "Could not get user from cookie " exception))
         "nobody")))


Whitespace

Whitespace


Fix notifying observers based on triggered events

--- src/rill/handler.clj
+++ src/rill/handler.clj
@@ -49,7 +49,7 @@
     (when (and triggered-events
                (commit-events event-store observer-id any-stream-version triggered-events))
       (let [new-observer (update-aggregate observer (filter #(= observer-id (message/primary-aggregate-id %)) triggered-events))]
-        (concat triggered-events (mapcat (partial notify-observers event-store new-observer) triggered-events))))))
+        (concat triggered-events (mapcat #(notify-observers event-store % new-observer) triggered-events))))))

 (defn notify-observers
   [event-store event primary]


replacing the home view with a jumbotron containing a register link

--- src-cljs/bitfondue/core.cljs
+++ src-cljs/bitfondue/core.cljs
@@ -130,7 +130,11 @@
    [footer]])

 (defn home-anonymous []
-  [layout [:h1 "Home"]])
+  [layout [:div.jumbotron
+           [:h1 "Save all the pages!"]
+           [:p.lead "Saving things without the hassle of tagging."]
+           [:p.lead
+            [:a.btn.btn-primary.btn-lg (nav-helper "/register") "Register"]]]])

 (defn home-authenticated []
   [layout [chunks]])


Pass the builder a file, not a URL.

Pass the builder a file, not a URL.

This shaves ~1ms off the parse time.

--- src/soy_clj/core.clj
+++ src/soy_clj/core.clj
@@ -23,7 +23,7 @@
 (defn- parse-uncached
   [files]
   (let [^SoyFileSet$Builder builder
-        (reduce #(.add ^SoyFileSet$Builder %1 (io/resource %2))
+        (reduce #(.add ^SoyFileSet$Builder %1 (io/file (io/resource %2)))
                 (SoyFileSet/builder) files)
         opts (SoyGeneralOptions.)]
     (.setStrictAutoescapingRequired opts true)


Embed role in game-func in main.clj

Embed role in game-func in main.clj


Fix incompatibility with some changes in catacumba 0.15.0


don't try to generate imperfect llamarse

--- src/babel/espanol/writer.clj
+++ src/babel/espanol/writer.clj
@@ -118,8 +118,12 @@
                                                                               (and (not (= (get-in spec [:synsem :sem :tense])
                                                                                :present))
                                                                                (not (= (get-in spec [:synsem :sem :aspect])
-                                                                                :progressive)))))
-                                                                         (log/info (str "ignoring exception(llamarse-is-only-singular): " e))
+                                                                                :progressive)))
+                                                                              (and (= (get-in spec [:synsem :sem :tense])
+                                                                                :past)
+                                                                                (= (get-in spec [:synsem :sem :aspect])
+                                                                                :progressive))))
+                                                                         (log/info (str "ignoring exception(llamarse-is-only-singular and present): " e))

                                                                          true
                                                                          (do


include the uid field when importing old data into the new database model

--- src/bitfondue/migrations.clj
+++ src/bitfondue/migrations.clj
@@ -40,7 +40,8 @@
   (doseq [item (parse-json-line-items "existing_data.json")]
     (let [c {:title (:title (:tab_info item))
              :url   (:url (:tab_info item))
-             :description_full (:text (:diffbot item))}]
+             :description_full (:text (:diffbot item))
+             :uid   (:uid item)}]
       (chunks/insert-chunk! c))))


add *default-max-length* dynamic variable

--- src/brainbot/nozzle/tika.clj
+++ src/brainbot/nozzle/tika.clj
@@ -6,7 +6,7 @@

 (def ^Tika ^{:private true} tika-obj (Tika.))
-
+(def ^{:dynamic true} *default-max-length* (.getMaxStringLength tika-obj))

 (defn- conv-metadata [^Metadata mdata]
   (let [names (.names mdata)]
@@ -24,4 +24,4 @@
   ([in max-length]
      (parse-istream (io/input-stream in) max-length))
   ([in]
-     (parse in 100000)))
+     (parse in *default-max-length*)))


Add some core functions.

Add some core functions.

--- src/cavm/query/functions.clj
+++ src/cavm/query/functions.clj
@@ -30,5 +30,12 @@
    '<= <=
    '- -
    '= ==
+   'map map
+   'get get
+   'assoc assoc
+   'cons cons
+   'car first
+   'cdr rest
+   'group-by group-by
    'mean meannan
    'apply apply}) ; XXX is this a security hole? Can the user pass in clojure symbols?


Increases test data size to 1000.

Increases test data size to 1000.

--- dev/user.clj
+++ dev/user.clj
@@ -56,7 +56,7 @@
                             (fn [] data/identities)))
        (range 1 (inc n))))

-(def d (data 100))
+(def d (data 1000))

 (defn memo-test
   "Test a range of fifo/threshold values in increments of 2." [data]


Refer block store constructors in repl.

Refer block store constructors in repl.

--- dev/user.clj
+++ dev/user.clj
@@ -7,8 +7,11 @@
       [data :as data]
       [store :as store])
     (blocks.store
+      [buffer :refer [buffer-block-store]]
+      [cache :refer [caching-block-store]]
+      [file :refer [file-block-store]]
       [memory :refer [memory-block-store]]
-      [file :refer [file-block-store]]
+      [replica :refer [replica-block-store]]
       [tests :as tests])
     [clojure.java.io :as io]
     [clojure.repl :refer :all]


Example color creation in dev/user.

Example color creation in dev/user.

--- dev/user.clj
+++ dev/user.clj
@@ -37,6 +37,15 @@
   "Initialize the wonderdome for local development."
   []
   (alter-var-root #'system component/start)
+  (display/set-colors!
+    (:display system)
+    (let [[r g b] [255 255 0]
+          argb (+ (bit-shift-left 255 24)
+                  (bit-shift-left r 16)
+                  (bit-shift-left g 8)
+                  b)
+          color (unchecked-int argb)]
+      (repeat 6 (repeat 240 color))))
   :started)


clean up :require, add utility fn to convert template html to hiccup for dommy deftemplate

--- dev/user.clj
+++ dev/user.clj
@@ -5,7 +5,11 @@
             [clojure.repl :refer :all]
             [clojure.test :as test]
             [clojure.tools.namespace.repl :refer (refresh refresh-all)]
-            [aspire.core :as aspire.core]))
+            [hickory.core :as hickory]
+            [aspire.core :as aspire.core]
+            ))
+
+;; N.B.: (ns cljs.user (:use [clojure.zip :only [insert-child]])) (see http://stackoverflow.com/questions/12879027/cannot-use-in-clojurescript-repl)

 (def system nil)

@@ -39,3 +43,11 @@
 (defn reset []
   (stop!)
   (refresh :after 'user/go))
+
+;; Utility fns
+;; -----------------------
+(defn html->hiccup [html]
+  (-> html
+      hickory/parse-fragment
+      (->> (map hickory/as-hiccup))))
+


set default logback level to INFO

set default logback level to INFO

--- dev/user.clj
+++ dev/user.clj
@@ -31,6 +31,7 @@
     (fn [s] (when s (component/stop s)))))

 (defn go []
+  (logback/set-level "ROOT" :info)
   (init)
   (start)
   :ready)


Jetty namespaces blacklisted on the logger

--- src/clj/hellhound/logger.clj
+++ src/clj/hellhound/logger.clj
@@ -93,10 +93,12 @@
     :enabled? true
     :output-fn formatter/default-dev-formatter
     :middleware [middlewares/exceptions]
+    :ns-blacklist [#"org.eclipse.*"]
     :appenders
     {:debug-appender {:enabled? true :min-level :debug :output-fn  :inherit
                       :fn (fn [data]
                             (let [{:keys [output_]} data
                                   formatted-output-str (force output_)]
                               (println formatted-output-str)))}}}))
+
 (init!)


premerge

premerge

--- src/clj/minijava/compile.clj
+++ src/clj/minijava/compile.clj
@@ -38,5 +38,7 @@
   (let [treemap   (apply-tree (parse program))
         canonmap  (map-method canon treemap)
         blocksmap (map-method basic-blocks canonmap)
-        tracemap  (map-method #(trace % nil) blocksmap)]
-    tracemap))
+        tracemap  (map-method #(trace % nil) blocksmap)
+ 				munchmap (map-method (fn [blocks] (map select blocks)) tracemap)
+	]
+    munchmap))


example hostname

example hostname

--- src/clj_kafka/example/zk.clj
+++ src/clj_kafka/example/zk.clj
@@ -2,9 +2,9 @@
   (:use [clj-kafka.core :only (with-resource)]
         [clj-kafka.consumer.zk :only (consumer shutdown messages)]))

-(def config {"zk.connect" "kafka.uswitchinternal.com:2181"
-             "autocommit.enable" "false"
-             "groupid" "group1"})
+(def config {"zk.connect" "localhost:2181"
+             "auto.commit.enable" "false"
+             "group.id" "group1"})

 (defn -main []
   (with-resource [c (consumer config)]


fix issue when response to ajax request isn't an object

--- src/cljs/netrunner/ajax.cljs
+++ src/cljs/netrunner/ajax.cljs
@@ -6,9 +6,10 @@

 (defn parse [event]
   (let [xhr (.-target event)
-        status (.getStatus xhr)
-        response (-> xhr .getResponseText JSON/parse (js->clj :keywordize-keys true))]
-    {:status status :json response}))
+        status (.getStatus xhr)]
+    (if (= status 200)
+      {:status status :json (-> xhr .getResponseText JSON/parse (js->clj :keywordize-keys true))}
+      {:status status})))

 (defn GET [url]
   (let [ch (chan)]


fix issue with notifcation

fix issue with notifcation

--- src/cljs/netrunner/chat.cljs
+++ src/cljs/netrunner/chat.cljs
@@ -4,7 +4,8 @@
             [sablono.core :as sab :include-macros true]
             [cljs.core.async :refer [chan put! <!] :as async]
             [netrunner.auth :refer [avatar authenticated] :as auth]
-            [netrunner.ajax :refer [GET]]))
+            [netrunner.ajax :refer [GET]]
+            [netrunner.main :as main]))

 (def app-state
   (atom {:channels {:general [] :america [] :europe [] :asia-pacific [] :francais []}}))
@@ -19,7 +20,7 @@
             ch (keyword (:channel msg))
             messages (get-in @app-state [:channels ch])]
         (swap! app-state assoc-in [:channels ch] (conj messages msg))
-        (when-not (and (.hasFocus js/document) (#{"/" "play"} (:active-page @app-state)))
+        (when-not (and (.hasFocus js/document) (#{["/"] ["/play"]} (:active-page @main/app-state)))
           (.play (.getElementById js/document "ting"))))))

 (defn send-msg [event channel owner]