Update content.cljs

Update content.cljs

removed "observed" from survival rate in table headers

--- src/prais2/content.cljs
+++ src/prais2/content.cljs
@@ -26,7 +26,7 @@
                   "The number of operations where the child  died within 30 days of their operation, from any cause")
          (Header. "Number of Survivors"         false       true    85   50
                   "The number of operations where the child survived at least 30 days after their operation")
-         (Header. "Observed Survival Rate %"    false      true     86   50
+         (Header. "Survival Rate %"    false      true     86   50
                   "The percentage of operations where the child survived at least 30 days after their operation. Some hospitals specialise in certain conditions, meaning that some hospitals tend to operate on children with a lower chance of survival. It would be unfair to then expect all hospitals to have the same survival rates each year")
          (Header. "Outer Low"                   false      false   130   50
                   "A dot within the right hand dark blue band means that there is some evidence that chances of survival in the hospital were higher than predicted")
@@ -36,7 +36,7 @@
                   "A dot within the right hand dark blue band means that there is some evidence that chances of survival in the hospital were higher than predicted")
          (Header. "Outer High"                  false      false   130   50
                   nil)
-         (Header. "Observed survival with predicted range"  false      false   0   100
+         (Header. "Survival with predicted range"  false      false   0   100
                   nil)
          ))


adding type hints & switching to recur where possible

--- org/babel/quadtree.clj
+++ org/babel/quadtree.clj
@@ -40,7 +40,7 @@
   [this p path]
   (if (:children this)
     (let [[c i] (make-child-for-point this p false)]
-      (add-point* c p (conj path [this i])))
+      (recur c p (conj path [this i])))
     (let [data (:data this)]
       (if data
         (if (m/delta= data p)
@@ -58,7 +58,7 @@
   (if (:children this)
     (let [[c i] (child-for-point this p)]
       (if c
-        (delete-point* c p (conj path [this i]))
+        (recur c p (conj path [this i]))
         (or (ffirst path) this)))
     (if (m/delta= p (:data this))
       (if (seq path)
@@ -71,7 +71,7 @@
 (def ^{:const true :private true} qt-children [nil nil nil nil])
 (def ^{:const true :private true} ot-children [nil nil nil nil nil nil nil nil])

-(defrecord QuadtreeNode [x y w h children data]
+(defrecord QuadtreeNode [^double x ^double y ^double w ^double h children data]
   TreeOps
   (child-index-for-point [this [px py]]
     (if (< px (+ x w))
@@ -88,7 +88,7 @@
               cy (if (pos? (bit-and idx 2)) (+ y h) y)]
           [(QuadtreeNode. cx cy (* 0.5 w) (* 0.5 h) nil (if add? p)) idx]))))
   (node-bounds [this]
-    (thi.ng.geom.types.Rect. (g/vec2 x y) (* w 2) (* h 2)))
+    (thi.ng.geom.types.Rect. (g/vec2 x y) (* w 2.0) (* h 2.0)))
   (split-node [this]
     (assoc this :children qt-children :data nil))
   (add-point
@@ -102,7 +102,7 @@
       (delete-point* this p [])
       this)))

-(defrecord OctreeNode [x y z w h d children data]
+(defrecord OctreeNode [^double x ^double y ^double z ^double w ^double h ^double d children data]
   TreeOps
   (child-index-for-point [this [px py pz]]
     (+ (if (< pz (+ z d)) 0 4)
@@ -121,7 +121,7 @@
               cz (if (pos? (bit-and idx 4)) (+ z d) z)]
           [(OctreeNode. cx cy cz (* 0.5 w) (* 0.5 h) (* 0.5 d) nil (if add? p)) idx]))))
   (node-bounds [this]
-    (thi.ng.geom.types.AABB. (g/vec3 x y z) (g/vec3 (* w 2) (* h 2) (* d 2))))
+    (thi.ng.geom.types.AABB. (g/vec3 x y z) (g/vec3 (* w 2.0) (* h 2.0) (* d 2.0))))
   (split-node [this]
     (assoc this :children ot-children :data nil))
   (add-point
@@ -170,7 +170,7 @@
 (def o (time (reduce add-point (octree 0 0 0 100 100 100) [[55 10 25] [25 10 55] [55 11 25]])))

-(let [points [[55 10] [25 10] [55 11] [52 11]]
+(let [points [[55 10] [55 11] [52 11] [25 10]]
       q (reduce add-point (quadtree 0 0 100 100) points)]
   (pprint q)
   (reduce


Fix bug where an absent audio media type is not correctly detected

In short: `(contains? :audio)` vs `(:audio)`

This commit also cleans up the `feed-item` function a bit.

Change-Id: Ib67261bf3d8ff0c2ed5f5b37eaf8265e8b3e56f0

--- src/qcast/feed/feed.clj
+++ src/qcast/feed/feed.clj
@@ -12,24 +12,23 @@
   ([n] (cons (str "Slide " n) (lazy-seq (slides (inc n))))))

 (defn- feed-item [media-type p]
-  (let [link (:link p)]
-    (remove nil?
-      [(rss/title (:title p))
-       (rss/link link)
-       (rss/description (:summary p))
-       ;;(rss/author (string/join ", " (:authors p)))
-       (rss/author "info@infoq.com (InfoQ)")
-       (rss/pub-date (:publish-date p))
-       (rss/guid link)
-       (when (contains? p media-type) (apply rss/enclosure (media-type p)))
-       (apply rss/categories (:keywords p))
-       ;;(itunes/author (string/join ", " (:authors p)))
-       (itunes/author "info@infoq.com")
-       (itunes/summary (:summary p))
-       ;;(itunes/image (:poster p))
-       (itunes/image (first (:slides p)))
-       (itunes/duration (:length p))
-       (apply psc/chapters (map vector (:times p) (slides) (:slides p)))])))
+  (when-let [media (media-type p)]
+    [(rss/title (:title p))
+     (rss/link (:link p))
+     (rss/description (:summary p))
+     ;;(rss/author (string/join ", " (:authors p)))
+     (rss/author "info@infoq.com (InfoQ)")
+     (rss/pub-date (:publish-date p))
+     (rss/guid (:link p))
+     (apply rss/enclosure media)
+     (apply rss/categories (:keywords p))
+     ;;(itunes/author (string/join ", " (:authors p)))
+     (itunes/author "info@infoq.com")
+     (itunes/summary (:summary p))
+     ;;(itunes/image (:poster p))
+     (itunes/image (first (:slides p)))
+     (itunes/duration (:length p))
+     (apply psc/chapters (map vector (:times p) (slides) (:slides p)))]))

 (defn- feed-channel [change-date]
   (let [base-url "https://www.infoq.com"
@@ -69,4 +68,4 @@
         change-date (or (:publish-date (first entries)) 0)
         channel (feed-channel change-date)
         extensions [:atom :itunes :simple-chapters]]
-    (rss/feed channel items extensions)))
+    (rss/feed channel (remove nil? items) extensions)))


Missed rename

Missed rename

--- src/cljs/go.clj
+++ src/cljs/go.clj
@@ -67,7 +67,7 @@
         (println gofmt))))

 (defn emit-go*
-  ([cljs] (emit* false cljs))
+  ([cljs] (emit-go* false cljs))
   ([debug? cljs]
      (let [ast (cljs->ast cljs)
            go (ast->go ast)


Plausible sketch/placeholder for timeout-handler.

--- src/rewindable/ago.cljs
+++ src/rewindable/ago.cljs
@@ -38,6 +38,7 @@
            :smas-new {} ; Same as :smas, but for new, not yet run goroutines.
            :logical-ms 0      ; Logical time/msecs, which is always updated
            :physical-ms (now) ; at the same time as physical-ms time snapshot.
+           :timeouts (sorted-map) ; Keyed by logical-ms => '(timeout-ch ...).
            })))

 (defn seqv+ [ago-world-now]
@@ -106,11 +107,14 @@

 ; --------------------------------------------------------

-(defn ago-chan-buf [ago-world buf]
-  (channels/ManyToManyChannel.
-   (fifo-buffer ago-world (str (.-buf-id buf) "-takes") -1) 0
-   (fifo-buffer ago-world (str (.-buf-id buf) "-puts") -1) 0
-   buf false))
+(defn ago-chan-buf [ago-world buf & default-buf-id]
+  (let [buf-id (if buf
+                 (.-buf-id buf)
+                 (or (first default-buf-id) "unknown"))]
+    (channels/ManyToManyChannel.
+     (fifo-buffer ago-world (str buf-id "-takes") -1) 0
+     (fifo-buffer ago-world (str buf-id "-puts") -1) 0
+     buf false)))

 (defn ago-chan
   "Creates a channel with an optional buffer. If buf-or-n is a
@@ -291,9 +295,41 @@
                   (assoc :seqv (conj (:seqv ss) branch-id 0))
                   (assoc :bufs (:bufs ss))
                   (assoc :smas recycled-smas)
-                  (assoc :smas-new recycled-smasN)))
+                  (assoc :smas-new recycled-smasN)
+                  (assoc :physical-ms (now))))
       (doseq [[sma-old ss-buf] reborn-smas]
         (ago-revive-state-machine ago-world sma-old ss-buf))
       (doseq [[sma-old ss-buf] reborn-smasN]
         (ago-revive-state-machine ago-world sma-old ss-buf))
       ago-world))
+
+; --------------------------------------------------------
+
+(def curr-js-timeout-id (atom nil)) ; Value is nil or js-timeout-id.
+
+(defn timeout-handler [ago-world]
+  (swap! curr-js-timeout-id (fn [x]
+                              (when x (js/cancelTimeout x))
+                              nil))
+  (let [logical-ms (:logical-ms @ago-world)
+        timeouts2 (loop [timeouts (:timeouts @ago-world)]
+                    (if-let [[soonest-ms chs] (first timeouts)]
+                      (if (<= soonest-ms logical-ms)
+                        (do :fire-any-still-active-chs
+                            (recur (dissoc timeouts soonest-ms)))
+                        timeouts)))]
+    (when-let [[soonest-ms chs] (first timeouts2)]
+      (reset! curr-js-timeout-id
+              (js/setTimeout #(timeout-handler ago-world)
+                             (- soonest-ms logical-ms))))
+    (swap! ago-world #(assoc % :timeouts timeouts2))))
+
+(defn ago-timeout [ago-world delay-ms] ; Logical milliseconds from now.
+  (let [timeout-at (+ delay-ms (:logical-ms @ago-world))
+        timeout-ch (ago-chan-buf ago-world nil (str "timeout-" ((:gen-id @ago-world))))]
+    (swap! ago-world
+           #(update-in % [:timeouts]
+                       (fn [m] (assoc m timeout-at
+                                      (conj (get-in % [:timeouts timeout-at])
+                                            timeout-ch)))))
+    (timeout-handler ago-world)))


Additional feedback

Additional feedback

--- src/hangman.clj
+++ src/hangman.clj
@@ -2,7 +2,7 @@
   (:refer-clojure :exclude [])
   (:require [clojure.pprint :as pp])
   (:require [hangman.util  :as util])
-  (:use     [hangman.util :only [returning returning-bind indexed]])
+  (:use     [hangman.util :only [returning-bind]])
   (:use     [hangman.words])
   (:use     [hangman.game])
   (:use     [hangman.strategy])
@@ -16,20 +16,21 @@
      (println "Initializing...")
      (ensure-word-db +default-corpus-file+)
      (println "Playing.")
-     (apply +
-       (repeatedly iter
-         #(.currentScore
-            (loop [game     (new-game (random-word @word-db) 5)
-                   strategy (make-strategy strategy-name game)]
-                (if-not (= :keep-guessing (.gameStatus game))
-                  game
-                  (let [x (.nextGuess strategy game)]
-                    (prn game)
-                    (prn x)
-                    (.makeGuess x game)
-                    (prn game)
-                    (prn)
-                    (recur game (.updateStrategy strategy game x))))))))))
+     (returning-bind
+       [score (apply +
+                (repeatedly iter
+                  #(.currentScore
+                     (loop [game     (new-game (random-word @word-db) 5)
+                            strategy (make-strategy strategy-name game)]
+                       (prn game)
+                       (if-not (= :keep-guessing (.gameStatus game))
+                         game
+                         (let [x (.nextGuess strategy game)]
+                           (prn x)
+                           (.makeGuess x game)
+                           (recur game
+                             (.updateStrategy strategy game x))))))))]
+       (println "Final Score: " score))))


Syntax sugar; Added/Edited radio-list functions

--- src/hyjinks.clj
+++ src/hyjinks.clj
@@ -94,15 +94,13 @@

 (def child-item? (complement (some-fn attrs-or-map? css? nil? empty?)))

-(defn assoc-attrs [t & key-vals]
-	(assoc t :attrs (merge (:attrs t) (apply hash-map key-vals))))
-
-(defn assoc-css [t & key-vals]
-	(assoc t :css (merge (:css t) (apply hash-map key-vals))))
-
-(defn attrs [& key-vals] (merge empty-attrs (apply hash-map key-vals)))
-
-(defn css [& key-vals] (merge empty-css (apply hash-map key-vals)))
+(defn assoc-attrs [t & {:as key-vals}] (update-in t [:attrs] (merge key-vals)))
+
+(defn assoc-css [t & {:as key-vals}] (update-in t [:css] (merge key-vals)))
+
+(defn attrs [& {:as key-vals}] (merge empty-attrs key-vals))
+
+(defn css [& {:as key-vals}] (merge empty-css key-vals))

 (defn tag [tag-name & stuff]
 	(let [attrs (apply merge empty-attrs (filter attrs-or-map? stuff))
@@ -143,6 +141,8 @@

 (defn page-meta [prop value] (tag "meta" {:name prop :content value}))

+(defn radio [param value] (input {:name param :id value :value value :type "radio"}))
+
 ;; Higher-order "tags"

 (defn comp-tag [t u] (fn [& items] (t (map u (flatten items)))))
@@ -153,10 +153,11 @@

 (def row-cells (comp-tag tr td))

-(defn table-rows [& rows] (table (map #(row-cells (flatten %)) rows)))
-
-(defn radio-list [param & opts]
-	(mapcat (fn [[t v]] [(label v {:for t}) (input {:id v :value v :name param :type "radio"})]) opts))
+(defn table-rows [& rows] (table (map (comp row-cells flatten) rows)))
+
+(defn radio-list [param & opts] (mapcat (fn [[text value]] [(radio param value) (label text {:for value})]) (partition 2 opts)))
+
+(defn vertical-radio-list [param & opts] (apply table-rows (partition 2 (apply radio-list param opts))))

 ;; CSS Units

@@ -223,8 +224,7 @@

 (defdecorator transition-property [x] (:transition-property x :-moz-transition-property x :-webkit-transition-property x :-o-transition-property x))

-; linear-gradient
-(defdecorator gradient [d c1 c2] (
+(defdecorator background-gradient [d c1 c2] (
 	:background-color c1
 	:background-image (linear-gradient d c1 c2)
 	:background-image (-webkit-linear-gradient d c1 c2)))


spelling

spelling

--- src/text_stream/edits.clj
+++ src/text_stream/edits.clj
@@ -1,5 +1,5 @@
 (ns text-stream.edits
-  (:require [hiccup.utils :refer escape-html]))
+  (:require [hiccup.util :refer escape-html]))

 (defn consolidate
   "Takes a seq of edits and composes them into a single function. Applies from


Change default number of items to fetch for the history to 15.

--- src/uxbox/data/pages.cljs
+++ src/uxbox/data/pages.cljs
@@ -185,7 +185,7 @@
             (on-failure [e]
               (uum/error (tr "errors.fetch-page-history"))
               (rx/empty))]
-      (->> (rp/do :fetch/page-history {:page id})
+      (->> (rp/do :fetch/page-history {:page id :max 15})
            (rx/map on-success)
            (rx/catch on-failure))))


explain what the github permission is about

--- src-cljs/frontend/components/overlay.cljs
+++ src-cljs/frontend/components/overlay.cljs
@@ -627,10 +627,11 @@
                                                     (do (d/transact! db [(:permission res)] {:server-update true})
                                                         (om/set-state! owner :error nil))
                                                     (om/set-state! owner :error (:error-msg res)))
-                                                  (om/set-state! owner :error "The request timed out"))))}
+                                                  (om/set-state! owner :error "The request timed out"))))
+                                :title "This will create a read-only API token that will allow GitHub to fetch the image. After you create the token, we'll generate the markdown you can use on GitHub."}
            (if (om/get-state owner :sending?)
              "Creating..."
-             "Create read-only image token")]
+             "Create read-only permission")]
           (when (om/get-state owner :error)
             [:div.image-token-form-error (om/get-state owner :error)])])))))


Added existence check for video dirs

Added existence check for video dirs

--- src/video_server/main.clj
+++ src/video_server/main.clj
@@ -157,14 +157,15 @@
     [(make-folders dirs url) options]))

 (defn process-args
-  "Processes the arguments looking for a settings file or folders to
-  serve. The settings file may override options provided on the
+  "Processes the arguments looking for a settings file and/or folders
+  to serve. The settings file may override options provided on the
   command line and provide folder-specific options."
   [args options url]
   (let [file (io/file (or (first args) "settings.edn"))
         dirs (if (and file (.exists file))
                (or (next args) (list (default-folder)))
-               (if (seq args) args (list (default-folder))))]
+               (if (seq args) args (list (default-folder))))
+        dirs (filter #(.exists (io/file %)) dirs)]
     (process-settings file dirs options url)))

 (defn start
@@ -174,12 +175,14 @@
         size (-> options :size str keyword)
         url (host-url (:port options))
         [folders options] (process-args args options url)]
+    (when-not (seq folders)
+      (exit 2 (str "Specified video folder(s) were not found: " (str/join ", " args))))
     (start-processing (:encode options) (:fetch options) fmt size)
     (start-watcher folders)
     (try (let [server (start-server url (:port options) (app url folders) folders)]
            (start-discovery url discovery-port (:name options))
            server)
-         (catch Exception e (exit 2 (str "Cannot start server: " (.getMessage e)))))))
+         (catch Exception e (exit 4 (str "Cannot start server: " (.getMessage e)))))))

 (defn -main
   "Parses the command line options and starts the video server."
@@ -190,6 +193,6 @@
       (:help options) (exit 0 (usage summary))
       errors (exit 1 (str/join \newline errors)))
     (set-log-level (:log-level options))
-    (when-not (installed?) (exit 2 "ffmpeg not found on path."))
+    (when-not (installed?) (exit 3 "ffmpeg not found on path."))
     (.join (start arguments options))))


Renaming ns alias

Renaming ns alias

--- src/yetibot/core/init.clj
+++ src/yetibot/core/init.clj
@@ -4,7 +4,7 @@
     [yetibot.core.config :as config]
     [yetibot.core.db :as db]
     [taoensso.timbre :refer [info warn]]
-    [yetibot.core.logging :as log]
+    [yetibot.core.logging :as logging]
     [yetibot.core.loader :refer [load-commands-and-observers]]
     [yetibot.core.handler :refer [handle-unparsed-expr]]
     [yetibot.core.logo :refer [logo]]
@@ -25,7 +25,7 @@
 (defn -main [& args]
   (welcome-message)
   (db/start)
-  (log/start)
+  (logging/start)
   (report-ex #(cf/start) "Campfire")
   (report-ex #(irc/start) "IRC")
   (report-ex #(slack/start) "Slack")


Allow board size selection

Allow board size selection

Sets initial dimension but not responsible for it on each render loop

--- src/tile_game/grid.cljs
+++ src/tile_game/grid.cljs
@@ -11,7 +11,21 @@
           "#0000C0" "#3030FF" "#800080" "#FF00FF"]))

 (defonce app-state
-  (r/atom {:board (b/create-board 5)}))
+  (r/atom {:board (b/create-board 4)
+           :size 4}))
+
+(defn board-size-slider [size]
+  [:div
+   [:button
+    {:on-click (fn [e] (swap! app-state assoc :board (b/create-board size)))}
+    "New Game"]
+   [:button
+    {:on-click (fn [e] (swap! app-state assoc :board (b/create-board size :shuffle)))}
+    "Shuffle"]
+   [:label (str "Board size: " size)]
+   [:input {:type "range" :style {:width "25%"}
+            :value size :min 2 :max 8
+            :on-change (fn [e] (swap! app-state assoc :size (.-target.value e)))}]])

 (defn render-tile [[x y] tile]
   (if-not (zero? tile)
@@ -24,13 +38,14 @@
         (str tile)]])))

 (defn tile-grid []
-  (let [{:keys [board]} @app-state
+  (let [{:keys [board size]} @app-state
         dim (b/dimension board)]
     [:center
      [:h1 "Tile Grid"]
      [:svg {:view-box (str "0 0 " dim " " dim) :width 800 :height 800}
       (for [x (range dim) y (range dim)]
         (let [tile (nth board (+ (* y dim) x))]
-          (render-tile [x y] tile)))]]))
+          (render-tile [x y] tile)))]
+     (board-size-slider size)]))

 (r/render-component [tile-grid] (. js/document (getElementById "grid")))


Update param name to match front end

Update param name to match front end

--- src/clj/collect_earth_online/db/plots.clj
+++ src/clj/collect_earth_online/db/plots.clj
@@ -71,7 +71,7 @@
         project-id      (tc/val->int (:projectId params))
         visible-id      (tc/val->int (:visibleId params))
         user-id         (:userId params -1)
-        admin-mode?     (and (tc/val->bool (:adminMode params))
+        admin-mode?     (and (tc/val->bool (:inAdminMode params))
                              (is-proj-admin? user-id project-id nil))
         proj-plots      (case navigation-mode
                           "unanalyzed" (call-sql "select_unanalyzed_plots" project-id user-id admin-mode?)


Fix hpass terms link

Fix hpass terms link

--- src/cljs/salava/extra/hpass/ui/block.cljs
+++ src/cljs/salava/extra/hpass/ui/block.cljs
@@ -29,7 +29,7 @@
      [:a {:class "bottom-link" :href "mailto:info@hpass.org" }
       "info@hpass.org"]
      " | "
-     [:a {:class "bottom-link" :href "/terms" }
+     [:a {:class "bottom-link" :href "https://hpass.org/privacy-policy-2/" :target "_blank" }
       "Privacy Policy and Terms of Use"]

      ]]])


Adds proper padded formatting

Adds proper padded formatting

--- src/wordsmith/core.cljs
+++ src/wordsmith/core.cljs
@@ -4,7 +4,9 @@
             [om.dom :as dom :include-macros true]
             [wordsmith.persistence :as p]
             [wordsmith.editor :as e]
-            [cljs.core.async :refer [put! chan <!]]))
+            [cljs.core.async :refer [put! chan <!]]
+            [goog.string :as gstring]
+            [goog.string.format]))

 (enable-console-print!)

@@ -64,7 +66,10 @@
 ;; Save button

 (defn get-time [date]
-  (str (.getHours date) ":" (.getMinutes date) ":" (.getSeconds date)))
+  (let [hours (.getHours date)
+        minutes (.getMinutes date)
+        seconds (.getSeconds date)]
+    (gstring/format "%02d:%02d:%02d" hours minutes seconds)))

 (defn button-click [app]
   (put! (:channel @app) [:save nil]))


Refactors hot key listener function

Refactors hot key listener function

--- src/wordsmith/core.cljs
+++ src/wordsmith/core.cljs
@@ -223,11 +223,11 @@
     :change (change-document app params)
     :new    (new-document app)))

-(defn listen
+(defn listen-to-hotkeys
   "Listens to KEYDOWN events using goog.events and checks for Ctrl+S or
    Cmd+S. When identified, sends a :save command on app channel."
-  [el type app]
-  (events/listen el type
+  [app]
+  (events/listen js/document EventType/KEYDOWN
     #(when
        (and (or (.-metaKey %) (.-ctrlKey %))
             (= 83 (.-keyCode %)))
@@ -246,13 +246,13 @@
       "Fetches document titles and starts the asynchronous command event
        dispatch loop which handles all major app state changing events.
        Also attaches a KEYDOWN event listener to the page, for hot keys."
+      (listen-to-hotkeys app)
       (om/update! app :titles (p/get-all-titles))
       (let [channel (:channel app)]
         (go-loop []
           (let [[command params] (<! channel)]
             (dispatch command params app)
-            (recur))))
-      (listen js/document EventType/KEYDOWN app))
+            (recur)))))
     om/IRender
     (render [_]
       "Renders the app components in a container."


spec review

spec review

--- src/com/wsscode/pathom/diplomat/http.cljc
+++ src/com/wsscode/pathom/diplomat/http.cljc
@@ -3,14 +3,41 @@

 (s/def ::encode-type (s/with-gen keyword? #(s/gen #{::transit+json ::edn ::json})))

-(s/def ::url string?)
+(s/def ::url (s/or :string string? :uri uri?))
+
 (s/def ::method #{::get ::head ::post ::put ::patch ::delete ::connect ::options})
-(s/def ::headers (s/map-of string? string?))
+
+;; HTTP driver should always normalize the header name from HTTP-Case to :lower-case-keyword.
+;; HTTP1.1 use HTTP-Case, HTTP2 use lower-case. Always normalize it a good aproach used by
+;; pedestal and many others.
+;; A header can be sent multiple times. So it should be a coll-of values.
+;; Multiple values are supported both in java.net.http(req/res) and js/fetch(res).
+(s/def ::headers (s/map-of keyword? (s/coll-of string?)))
+
+;; content-type will generate a header on request. it can be overwriten by passing a explicit content-type
+;; key on headers map. The driver will use this to convert ::form-params into ::body
+;; If absent, the driver should use ::body with no transformation
+;; If it's a raw string, it will generate the header, but the driver should use raw ::body
 (s/def ::content-type (s/or :pre-defined ::encode-type :raw string?))
+
+;; accept will generate a header on request.  it can be overwriten by passing a explicit accept
+;; key on headers map. The driver will use this to convert the response from server into ::body
+;; If it's a raw string, it will generate the header.
+;; If absent or a raw string, the driver can (or not) use the content-type from response-header to convert.
 (s/def ::accept (s/or :pre-defined ::encode-type :raw string?))
+
+;; some from ::accept, but do not generate header
 (s/def ::as ::encode-type)
+
+;; Used to generate ::body basead on ::content-type on request.
+;; Usualy a clojure data-structure
 (s/def ::form-params any?)
+
+;; enable/disable tracing
 (s/def ::debug? boolean?)
+
+;; On request, usually string, bytes, buffer or a writer.
+;; On response, should be a clojure data-structure.
 (s/def ::body any?)

 (s/def ::request (s/keys :req [::url]
@@ -23,8 +50,9 @@
                                ::debug?
                                ::body]))

-(s/def ::response (s/keys :req [::headers]
-                          :opt [::body]))
+(s/def ::response (s/keys :req [::status]
+                          :opt [::headers
+                                ::body]))

 (s/def ::driver fn?)

@@ -37,8 +65,8 @@
    (driver (merge request {::url url} config))))

 (s/fdef request
-  :args (s/cat :req ::request)
-  :ret ::response)
+        :args (s/cat :req ::request)
+        :ret ::response)

 (defn request-method [{::keys [method form-params]}]
   (or (some-> method name)


Scheduler code for hard tag placement.

Scheduler code for hard tag placement.

--- src/onyx/scheduling/common_job_scheduler.clj
+++ src/onyx/scheduling/common_job_scheduler.clj
@@ -1,6 +1,6 @@
 (ns onyx.scheduling.common-job-scheduler
   (:require [clojure.core.async :refer [chan go >! <! close! >!!]]
-            [clojure.set :refer [union difference map-invert]]
+            [clojure.set :refer [union difference subset?]]
             [clojure.data :refer [diff]]
             [com.stuartsierra.component :as component]
             [onyx.log.commands.common :as common]
@@ -8,7 +8,7 @@
             [onyx.scheduling.common-task-scheduler :as cts]
             [onyx.scheduling.acker-scheduler :refer [choose-ackers]])
   (:import [org.btrplace.model Model DefaultModel]
-           [org.btrplace.model.constraint Running RunningCapacity Quarantine Fence]
+           [org.btrplace.model.constraint Running RunningCapacity Quarantine Fence Among]
            [org.btrplace.scheduler.choco DefaultChocoScheduler DefaultParameters]))

 (defn job-upper-bound [replica job]
@@ -306,6 +306,39 @@
            task-seq))
        0))

+(defn unconstrained-tasks [replica jobs]
+  (mapcat
+   (fn [job]
+     (filter
+      (fn [task]
+        (not (seq (get-in replica [:required-tags job task]))))
+      (get-in replica [:tasks job])))
+   jobs))
+
+(defn constrainted-tasks-for-peer [replica jobs peer-tags]
+  (mapcat
+   (fn [job]
+     (filter
+      (fn [task]
+        (let [tags (get-in replica [:required-tags job task])]
+          (and (seq tags)
+               (subset? (into #{} tags)
+                        (into #{} peer-tags)))))
+      (get-in replica [:tasks job])))
+   jobs))
+
+(defn task-tagged-constraints [replica peers peer->vm task->node jobs]
+  (let [utasks (unconstrained-tasks replica jobs)]
+    (map
+     (fn [peer]
+       (let [peer-tags (get-in replica [:peer-tags peer])
+             ctasks (constrainted-tasks-for-peer replica jobs peer-tags)]
+         (Among.
+          [(peer->vm peer)]
+          [(map task->node ctasks)
+           (map task->node utasks)])))
+     (filter #(seq (get-in replica [:peer-tags %])) peers))))
+
 (defn btr-place-scheduling [replica jobs job-utilization capacities]
   (if (seq jobs)
     (let [model (DefaultModel.)
@@ -325,6 +358,7 @@
             (reduce
              into
              [(capacity-constraints replica job-utilization task-seq task->node capacities)
+              (task-tagged-constraints replica (:peers replica) peer->vm task->node jobs)
               (peer-running-constraints peer->vm)
               (grouping-task-constraints replica task-seq task->node peer->vm)
               (mapcat #(cts/task-constraints replica jobs (get capacities % 0) peer->vm task->node no-op-node %) jobs)


Fix eid skew and ensure default email

Fix eid skew and ensure default email

--- src/aerobio/actions.clj
+++ src/aerobio/actions.clj
@@ -52,12 +52,20 @@
   (fn[cmd & args] (keyword cmd)))

+(defn get-mail-recipient
+  [user]
+  (let [recipient (pams/get-params [:email (keyword user)])]
+    (if recipient
+      recipient
+      (pams/get-params [:email :default]))))
+
+
 (defmethod action :run
   [_ eid params get-toolinfo template]
-  (let [{:keys [user cmd action rep compfile eid]} params
+  (let [{:keys [user cmd action rep compfile]} params
         rep (if rep :rep nil)
         exp (cmn/get-exp-info eid :exp)
-        user (pams/get-params [:email (keyword user)])]
+        user (get-mail-recipient user)]
     (cmn/launch-action
      eid user
      get-toolinfo template
@@ -65,18 +73,47 @@
      :rep rep
      :compfile compfile)))

+
+;;; phase-0b remove Fastqs, Out, Samples, Stats
+;;; phase-0c remove Out, Samples, Stats
+;;; phase-1  remove Out
+;;; phase-2  Keep Out*Bams, remove all other Out*/
+;;; phase-2b remove Aggrs <-- Only tnseq
+;;;
+#_(->> (cmn/exp-ids) (map #(cmn/get-exp-info % :out)))
+#_(->> (cmn/exp-ids) (map #(cmn/get-exp-info % :aggrs)))
+#_(->> (cmn/exp-ids) (map #(cmn/get-exp-info % :samples)))
+#_(->> (cmn/exp-ids) (map #(cmn/get-exp-info % :stats)))
+(defmethod action :rerun
+  [_ eid params get-toolinfo template]
+  (let [{:keys [user cmd action rep compfile]} params
+        rep (if rep :rep nil)
+        outdir (cmn/get-exp-info eid :out)
+
+        exp (cmn/get-exp-info eid :exp)
+        user (get-mail-recipient user)]
+
+    (cmn/launch-action
+     eid user
+     get-toolinfo template
+     :action action
+     :rep rep
+     :compfile compfile)))
+
+
 (defmethod action :compare
   [_ eid params get-toolinfo template]
   (let [exp (cmn/get-exp-info eid :exp)
-        {:keys [user cmd action rep compfile eid]} params
+        {:keys [user cmd action rep compfile]} params
         recipient (pams/get-params [:email (keyword user)])]
     (cmn/run-comparison
      exp eid recipient compfile get-toolinfo template)))

+
 (defmethod action :aggregate
   [_ eid params get-toolinfo template]
   (let [exp (cmn/get-exp-info eid :exp)
-        {:keys [user cmd action rep compfile eid]} params
+        {:keys [user cmd action rep compfile]} params
         recipient (pams/get-params [:email (keyword user)])]
     (htts/run-aggregation
      eid recipient compfile get-toolinfo template)))


restructure data

restructure data

--- src/dodgeball/core.cljs
+++ src/dodgeball/core.cljs
@@ -5,37 +5,49 @@
 (enable-console-print!)

-(defonce app-state (atom {:balls [1 0 1 0 1 0 1 0 1]}))
+(defonce app-state (atom
+                    {:team1 [{:x 0, :y 0, :has-ball false}
+                             {:x 2, :y 0, :has-ball false}
+                             {:x 4, :y 0, :has-ball false}
+                             {:x 6, :y 0, :has-ball false}
+                             {:x 8, :y 0, :has-ball false}]
+                     :team2 [{:x 0, :y 8, :has-ball false}
+                             {:x 2, :y 8, :has-ball false}
+                             {:x 4, :y 8, :has-ball false}
+                             {:x 6, :y 8, :has-ball false}
+                             {:x 8, :y 8, :has-ball false}]
+                     :loose-balls [{:x 0, :y 4}
+                                   {:x 2, :y 4}
+                                   {:x 4, :y 4}
+                                   {:x 6, :y 4}
+                                   {:x 8, :y 4}]}))
+
+(def board-width 9)
+(def board-height 9)
+(def bench-size 4)

 (defn bench []
   (dom/table nil
     (dom/tr nil
-      (vec (for [n (range 0 4)]
+      (vec (for [n (range 0 bench-size)]
        (dom/td nil))))))

 (defn cell-view [n owner]
   (om/component (dom/td nil n)))

-(defn row-view [data owner]
-  (om/component
-    (apply dom/tr nil
-      (om/build-all cell-view data))))

 (defn board [data]
  (dom/div #js {:className "container"}
  (bench)
  (dom/table nil
-    (vec (for [y (range 0 9)]
-      (if (= y 5)
-        (om/build row-view (:balls data))
-
-        (dom/tr
-          #js {:className
-            (cond
-              (or (= y 3) (= y 6)) "middle-top")}
-          (vec (for [x (range 0 9)]
-            (dom/td nil y))))))))
+    (vec (for [y (range 0 board-height)]
+      (dom/tr
+        #js {:className
+          (cond
+            (or (= y 3) (= y 6)) "middle-top")}
+        (vec (for [x (range 0 board-width)]
+          (om/build cell-view y)))))))
   (bench)))


switch to nondeterministic generation

switch to nondeterministic generation

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -13,22 +13,19 @@
 ;; TODO: should also be possible to override per-language.
 (def ^:const max-total-depth 2)

-;; TODO support setting max-generated-complements to :unlimited
-(def ^:const max-generated-complements 20000)
-
 ;; use map or pmap.
 (def ^:const mapfn map)

 ;; deterministic generation:
-(def ^:const shufflefn (fn [x] x))
+;;(def ^:const shufflefn (fn [x] x))

 ;; nondeterministic generation
-;;(def ^:const shufflefn shuffle)
-
+(def ^:const shufflefn shuffle)
+
+;;(def ^:const randomize-lexemes-before-phrases
+;;  false)
 (def ^:const randomize-lexemes-before-phrases
-  false)
-;;(def ^:const randomize-lexemes-before-phrases
-;;  true)
+  true)

 (def ^:const error-if-no-complements false)

@@ -46,7 +43,7 @@

 (defn generate-all [spec model & [depth max-depth]]
   (let [depth (or depth 0)
-        truncate true
+        truncate false
         max-depth (or max-depth max-total-depth)]
     (log/debug (str "generate-all:" depth "/" max-depth ":         " (strip-refs spec)))
     (->>


+(log/debug)s

+(log/debug)s

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -108,7 +108,7 @@
           (when (= false (get-in spec [:head :phrasal] false))
             (lazy-mapcat
              (fn [parent]
-               (log/info (str "parent: " (:rule parent) " over lexical heads."))
+               (log/debug (str "parent: " (:rule parent) " over lexical heads."))
                (let [lexicon (or (:lexicon (:generate language-model)) (:lexicon language-model))
                      subset (if-let [index-fn (:index-fn language-model)]
                               (index-fn (get-in parent [:head] :top))
@@ -130,14 +130,15 @@
           (if (and (< total-depth max-total-depth)
                    (= true (get-in spec [:head :phrasal] true)))
             (lazy-mapcat (fn [parent]
+                           (log/debug (str "parent: " (:rule parent) " over phrasal heads."))
                            (over/overh
                             parent
                             (lightning-bolts language-model (get-in parent [:head])
                                              (+ 1 depth) (+ 1 total-depth)
                                              :max-total-depth max-total-depth)))
-                         (filter #(= true
-                                     (get-in % [:head :phrasal] true))
-                                 parents)))]
+                           (filter #(= true
+                                       (get-in % [:head :phrasal] true))
+                                   parents)))]
       (filter
        (fn [bolt]
          (any-possible-complement?


+TODOs

+TODOs

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -69,6 +69,7 @@
      (map (fn [each-bolt-and-comps]
             (let [paths-to-comps (keys each-bolt-and-comps)
                   vals (vals each-bolt-and-comps)]
+              ;; TODO: further flatten this into the overall ->> pipeline
               (map (fn [each-path-through-trellis]
                      (zipmap paths-to-comps each-path-through-trellis))
                    (apply combo/cartesian-product vals)))))
@@ -80,6 +81,7 @@
             (let [bolt (get bolt-and-comps [])
                   paths-and-comps (dissoc bolt-and-comps [])
                   paths-to-comps (keys paths-and-comps)]
+              ;; TODO: further flatten this into the overall ->> pipeline
               (reduce (fn [a b]
                         (let [result
                               (cond (or (= :fail a)
@@ -88,6 +90,7 @@
                           (log-unification-result a b result model)
                           result))
                       (cons bolt
+                            ;; TODO: further flatten this into the overall ->> pipeline
                             (map (fn [path-to-comp]
                                    (let [complement (get paths-and-comps path-to-comp)]
                                      (assoc-in bolt path-to-comp complement)))


turn off expensive logging

turn off expensive logging

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -128,8 +128,11 @@
   [bolt path model depth max-depth]
   (let [spec (get-in bolt path)
         log-message-prefix
-        (str "comp-path-to-complements:" depth "/" max-depth ":"
-             ((:morph-ps model) bolt) "@" path ":spec:" spec)
+        (if expensive-logging
+          (str "comp-path-to-complements:" depth "/" max-depth ":"
+               ((:morph-ps model) bolt) "@" path ":spec:" spec)
+          (str "comp-path-to-complements:" depth "/" max-depth ":"
+               spec "@path: " path))
         debug (log/debug (str log-message-prefix ": start."))
         lexemes (shufflefn (get-lexemes model spec))
         bolts-at (if (< depth max-depth)


s/info/trace/

s/info/trace/

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -54,21 +54,23 @@
                     (get-bolts-for model spec
                                    depth))]
       (if (not (empty? bolts))
-        (lazy-cat
-         (let [bolt (first bolts)]
-           (or
-            (and (= false (get-in bolt [:phrasal] true))
-                 ;; This is not a bolt but rather simply a lexical head,
-                 ;; so just return a list with this lexical head:
-                 [bolt])
-            ;; ..otherwise it's a phrase, so return the lazy
-            ;; sequence of adding all possible complements at every possible
-            ;; position at the bolt.
-            (add-comps-to-bolt bolt model
-                               (comp-paths depth))))
-         (gen spec model depth
-               (rest bolts)
-               at-path))
+        (do
+          (log/trace (str "gen@" depth "; found bolts with spec=" (dag_unify.core/strip-refs spec)))
+          (lazy-cat
+           (let [bolt (first bolts)]
+             (or
+              (and (= false (get-in bolt [:phrasal] true))
+                   ;; This is not a bolt but rather simply a lexical head,
+                   ;; so just return a list with this lexical head:
+                   [bolt])
+              ;; ..otherwise it's a phrase, so return the lazy
+              ;; sequence of adding all possible complements at every possible
+              ;; position at the bolt.
+              (add-comps-to-bolt bolt model
+                                 (reverse (comp-paths depth)))))
+           (gen spec model depth
+                (rest bolts)
+                at-path)))
         (if (not (= false (get-in spec [:phrasal] true)))
           (gen spec model (+ 1 depth) nil at-path))))))


Add function to create latency metrics

Add function to create latency metrics

--- src/beehive/metrics.clj
+++ src/beehive/metrics.clj
@@ -14,7 +14,9 @@

 (ns beehive.metrics
   (:require [beehive.utils :as utils])
-  (:import (net.uncontended.precipice.metrics ActionMetrics DefaultActionMetrics)))
+  (:import (net.uncontended.precipice.metrics ActionMetrics
+                                              DefaultActionMetrics
+                                              IntervalLatencyMetrics)))

 (set! *warn-on-reflection* true)

@@ -28,10 +30,13 @@
 (defn snapshot [metrics duration time-unit]
   (.snapshot ^ActionMetrics metrics duration (utils/->time-unit time-unit)))

-(defn default-metrics
+(defn action-metrics
   ([{:keys [slots-to-track resolution time-unit]}]
-    (default-metrics slots-to-track resolution time-unit))
+    (action-metrics slots-to-track resolution time-unit))
   ([slots-to-track resolution time-unit]
    (DefaultActionMetrics. slots-to-track
                           resolution
-                          (utils/->time-unit time-unit))))+                          (utils/->time-unit time-unit))))
+
+(defn latency-metrics [highest-trackable-value significant-digits]
+  (IntervalLatencyMetrics. (long highest-trackable-value) (long significant-digits)))


Optional addr-attrs-fn for render-net-html.

--- src/cbfg/world/net.cljs
+++ src/cbfg/world/net.cljs
@@ -92,7 +92,7 @@
               true
               (conj out (render-msg curr-msg "msg-enter" "")))))))

-(defn render-net-html [net-state prev-addrs]
+(defn render-net-html [net-state prev-addrs & {:keys [addr-attrs-fn]}]
   (let [addrs (atom {})
         coords (atom {})] ; Index positions.
     (doseq [[[addr port] accept-chs] (:listens net-state)]
@@ -142,8 +142,10 @@
           h ["
"
              (mapv (fn [[addr addr-v]]
-                     (let [[addr-x addr-y] (calc-xy addr)]
-                       ["
"
+                     (let [[addr-x addr-y] (calc-xy addr)
+                           addr-attrs (or (and addr-attrs-fn (addr-attrs-fn addr)) "")]
+                       ["
"
                         "" addr ""
                         (mapv (fn [[[accept-addr accept-port] accept-addr-port-v]]
                                 ["
"


Add delay to metrics prefix; remove prefix from setup

--- src/cfpb/qu/metrics.clj
+++ src/cfpb/qu/metrics.clj
@@ -3,11 +3,10 @@
   (:require
     [clj-statsd :as sd]))

-(def prefix (atom ""))
+(def prefix (delay (str "qu." (.getHostName (java.net.InetAddress/getLocalHost)) ".")))

 (defn setup
   [host port]
-  (swap! prefix str "qu." (.getHostName (java.net.InetAddress/getLocalHost)) ".")
   (sd/setup host port))

 (defn prefix-metric


Move to scala 2.9.2

Move to scala 2.9.2

--- storm-kafka/project.clj
+++ storm-kafka/project.clj
@@ -1,14 +1,14 @@
-(defproject storm/storm-kafka "0.7.3-dynamic-SNAPSHOT"
+(defproject storm/storm-kafka "0.7.3-scala292-dynamic-SNAPSHOT"
   :source-path "src/clj"
   :java-source-path "src/jvm"
   :javac-options {:debug "true" :fork "true"}
-  :repositories {"releases" "http://artifactory.local.twitter.com/libs-releases-local"
-                 "snapshots" "http://artifactory.local.twitter.com/libs-snapshots-local"
-                 "artifactory" "http://artifactory.local.twitter.com/repo"}
-  :dependencies [[storm/kafka "0.7.0-incubating"
+  ;;:repositories {"releases" "http://artifactory.local.twitter.com/libs-releases-local"
+  ;;               "snapshots" "http://artifactory.local.twitter.com/libs-snapshots-local"
+  ;;               "artifactory" "http://artifactory.local.twitter.com/repo"}
+  :dependencies [[com.twitter/kafka_2.9.2 "0.7.0"
                    :exclusions [org.apache.zookeeper/zookeeper
                                 log4j/log4j]]]
-  :dev-dependencies [[storm "0.7.2"]
+  :dev-dependencies [[storm "0.8.0-SNAPSHOT"]
                      [org.clojure/clojure "1.4.0"]]
   :jvm-opts ["-Djava.library.path=/usr/local/lib:/opt/local/lib:/usr/lib"]
 )


Emphasize the laziness in the test

Emphasize the laziness in the test

--- integration-tests/src/test/clojure/immutant/integs/messaging.clj
+++ integration-tests/src/test/clojure/immutant/integs/messaging.clj
@@ -51,5 +51,6 @@
   (is (= "FOO" (receive ham-queue :timeout 60000))))

 (deftest lazy-message-seq
-  (doseq [i (range 4)] (publish ham-queue i))
-  (is (= '(0 1 2 3) (take 4 (message-seq ham-queue)))))+  (let [messages (message-seq ham-queue)]
+    (doseq [i (range 4)] (publish ham-queue i))
+    (is (= '(0 1 2 3) (take 4 messages)))))


Define goog and react.

Define goog and react.

--- src/clj/sally/views.clj
+++ src/clj/sally/views.clj
@@ -1,11 +1,17 @@
 (ns sally.views
-  (:require (hiccup [page :as page])
+  (:require (hiccup [page :as page]
+                    [core :refer [html]]
+                    [element :refer [javascript-tag]])
             [environ.core :refer (env)]))

+(def in-dev? (= :dev (env :stage :dev)))
+
 (defn layout [& content]
-  (env :stage :dev)
   (page/html5
     [:head
+     (page/include-css "/boots/css/bootstrap.min.css"
+                       "/boots/css/font-awesome.min.css"
+                       "/boots/css/local.css")
      (page/include-js "/boots/js/jquery-1.10.2.min.js"
                       "/boots/js/bootstrap.min.js")]
     [:body {:class (str "is-" (name (env :stage :dev)))}
@@ -26,10 +32,11 @@
         [:ul.nav.navbar-nav.navbar-right.navbar-user
          [:li [:a {:href "/something"} "Anything"]]]]]
       [:div#page-wrapper content]]
-     (page/include-css "/boots/css/bootstrap.min.css"
-                       "/boots/css/font-awesome.min.css"
-                       "/boots/css/local.css")
-     (page/include-js "/app.js")]))
+
+     (if in-dev? (page/include-js "/out/goog/base.js"
+                                  "/react/react.js"))
+     (page/include-js "/app.js")
+     (if in-dev? (javascript-tag "goog.require('sally.core')"))]))

 (defn root-page [request]
   (layout


Remove debug print

Remove debug print

--- src/clj/shale/redis.clj
+++ src/clj/shale/redis.clj
@@ -233,7 +233,6 @@
                                        car/hgetall
                                        (wcar redis-conn)
                                        (apply hash-map))})]
-                (println "redis/models" model-schema id "=" sets lists maps)
                 (->> (concat sets lists maps)
                      (list* base)
                      (reduce merge)


CLJS-291: use inode-lookup instead of inode-find, support only 1 arity

NB. implementations inode-find which take not-found are left intact,
either to be used in a find implementation which returns the actual
key held by the map or to be removed in a separate patch.

--- src/cljs/cljs/core.cljs
+++ src/cljs/cljs/core.cljs
@@ -4081,16 +4081,16 @@
                 (BitmapIndexedNode. nil (bit-xor bitmap bit) (remove-pair arr idx))
                 :else inode)))))

-  (inode-find [inode shift hash key]
+  (inode-lookup [inode shift hash key not-found]
     (let [bit (bitpos hash shift)]
       (if (zero? (bit-and bitmap bit))
-        nil
+        not-found
         (let [idx         (bitmap-indexed-node-index bitmap bit)
               key-or-nil  (aget arr (* 2 idx))
               val-or-node (aget arr (inc (* 2 idx)))]
-          (cond (nil? key-or-nil) (.inode-find val-or-node (+ shift 5) hash key)
-                (= key key-or-nil)          [key-or-nil val-or-node]
-                :else nil)))))
+          (cond (nil? key-or-nil)  (.inode-lookup val-or-node (+ shift 5) hash key not-found)
+                (= key key-or-nil) val-or-node
+                :else not-found)))))

   (inode-find [inode shift hash key not-found]
     (let [bit (bitpos hash shift)]
@@ -4257,12 +4257,12 @@
             (ArrayNode. nil cnt (clone-and-set arr idx n))))
         inode)))

-  (inode-find [inode shift hash key]
+  (inode-lookup [inode shift hash key not-found]
     (let [idx  (mask hash shift)
           node (aget arr idx)]
       (if-not (nil? node)
-        (.inode-find node (+ shift 5) hash key)
-        nil)))
+        (.inode-lookup node (+ shift 5) hash key not-found)
+        not-found)))

   (inode-find [inode shift hash key not-found]
     (let [idx  (mask hash shift)
@@ -4360,11 +4360,11 @@
             (== cnt 1)  nil
             :else (HashCollisionNode. nil collision-hash (dec cnt) (remove-pair arr (quot idx 2))))))

-  (inode-find [inode shift hash key]
+  (inode-lookup [inode shift hash key not-found]
     (let [idx (hash-collision-node-find-index arr cnt key)]
-      (cond (< idx 0)              nil
-            (= key (aget arr idx)) [(aget arr idx) (aget arr (inc idx))]
-            :else                  nil)))
+      (cond (< idx 0)              not-found
+            (= key (aget arr idx)) (aget arr (inc idx))
+            :else                  not-found)))

   (inode-find [inode shift hash key not-found]
     (let [idx (hash-collision-node-find-index arr cnt key)]
@@ -4608,7 +4608,7 @@
                         nil-val
                         not-found)
           (nil? root) not-found
-          :else       (nth (.inode-find root 0 (hash k) k (array nil not-found)) 1)))
+          :else       (.inode-lookup root 0 (hash k) k not-found)))

   IAssociative
   (-assoc [coll k v]
@@ -4628,7 +4628,7 @@
   (-contains-key? [coll k]
     (cond (nil? k)    has-nil?
           (nil? root) false
-          :else       (not (identical? (.inode-find root 0 (hash k) k lookup-sentinel)
+          :else       (not (identical? (.inode-lookup root 0 (hash k) k lookup-sentinel)
                                        lookup-sentinel))))

   IMap
@@ -4753,7 +4753,7 @@
         nil-val)
       (if (nil? root)
         nil
-        (nth (.inode-find root 0 (hash k) k) 1))))
+        (.inode-lookup root 0 (hash k) k))))

   (-lookup [tcoll k not-found]
     (if (nil? k)
@@ -4762,7 +4762,7 @@
         not-found)
       (if (nil? root)
         not-found
-        (nth (.inode-find root 0 (hash k) k (array nil not-found)) 1))))
+        (.inode-lookup root 0 (hash k) k not-found))))

   ITransientCollection
   (-conj! [tcoll val] (.conj! tcoll val))


have an option to self-host pusher as well

--- src/frontend/stefon.clj
+++ src/frontend/stefon.clj
@@ -1,7 +1,9 @@
 (ns frontend.stefon)

 (def hosted-scripts [{:path "js/hosted/intercom2.js"
-                      :url "https://widget.intercom.io/widget/vnk4oztr"}])
+                      :url "https://widget.intercom.io/widget/vnk4oztr"}
+                     {:path "js/hosted/pusher.min.js"
+                      :url "https://js.pusher.com/2.2/pusher.min.js"}])

 (def asset-roots ["resources/assets"])


* src/cljs/cljs/core.cljs: t -> ~{t}

* src/cljs/cljs/core.cljs: t -> ~{t}

--- src/cljs/cljs/core.cljs
+++ src/cljs/cljs/core.cljs
@@ -609,7 +609,7 @@
   (js* "(void 0 === ~{x})"))

 (defn instance? [t o]
-  (js* "((~{o} instanceof ~{t}) || (~{o}.constructor === t))"))
+  (js* "((~{o} instanceof ~{t}) || (~{o}.constructor === ~{t}))"))

 (defn seq?
   "Return true if s satisfies ISeq"


add RangeIterator

add RangeIterator

--- src/cljs/cljs/core.cljs
+++ src/cljs/cljs/core.cljs
@@ -7499,6 +7499,17 @@
        (take-while (mk-bound-fn sc start-test start-key)
                    (if ((mk-bound-fn sc end-test end-key) e) s (next s))))))

+(deftype RangeIterator [^:mutable i end step]
+  Object
+  (hasNext [_]
+    (if (pos? step)
+      (< i end)
+      (> i end)))
+  (next [_]
+    (let [ret i]
+      (set! i (+ i step))
+      ret)))
+
 (deftype Range [meta start end step ^:mutable __hash]
   Object
   (toString [coll]
@@ -7530,6 +7541,10 @@
     (if-not (nil? (-seq rng))
       (Range. meta (+ start step) end step nil)
       ()))
+
+  IIterable
+  (-iterator [_]
+    (RangeIterator. start end step))

   INext
   (-next [rng]


Fixes #4

Fixes #4

--- src/cljs/klang/core.clj
+++ src/cljs/klang/core.clj
@@ -88,7 +88,8 @@
                           (config-map-from-file)
                           (config-map-from-configurer)
                           (config-map-from-props))]
-           (prn "Klang.core logging config: " cfg)
+           (print "// klang.core logging config: ")
+           (prn cfg)
            cfg))

 (defn- ns-match?


Add support for pixels functions.

Add support for pixels functions.

--- src/cljx/quil/core.cljx
+++ src/cljx/quil/core.cljx
@@ -732,7 +732,6 @@
   ([val] (PApplet/binary (int val)))
   ([val num-digits] (PApplet/binary (int val) (int num-digits))))

-#+clj
 (defn
   ^{:requires-bindings true
     :processing-name "blend()"
@@ -1648,7 +1647,6 @@
   ([r g b] (fill-float r g b))
   ([r g b a] (fill-float r g b a)))

-#+clj
 (defn
   ^{:requires-bindings true
     :processing-name "filter()"
@@ -2318,7 +2316,6 @@
   #+clj (PApplet/map (float val) (float low1) (float high1) (float low2) (float high2))
   #+cljs (.map (current-applet) val low1 high1 low2 high2))

-#+clj
 (defn
   ^{:requires-bindings false
     :processing-name "PImage.mask()"
@@ -4291,7 +4288,6 @@
   [hex-str]
   (PApplet/unhex (str hex-str)))

-#+clj
 (defn
   ^{:requires-bindings true
     :processing-name "updatePixels()"


experiments with instruments

experiments with instruments

--- src/main/clojure/mikera/spectral/core.clj
+++ src/main/clojure/mikera/spectral/core.clj
@@ -1,4 +1,36 @@
 (ns mikera.spectral.core
   (:use [overtone core]))

- (definst foo [] (saw 220))+ (definst foo [] (saw 220))
+
+ (definst trem [freq 440 depth 10 rate 6 length 3]
+    (* 0.3
+       (line:kr 0 1 length FREE)
+       (saw (+ freq (* depth (sin-osc:kr rate))))))
+
+  (definst bar [freq 440 depth 10 rate 6 length 10]
+    (* 2.0
+       (sin-osc:kr rate)
+       (line:kr 1 1 length FREE)
+       (sound-in)))
+
+  (definst oksaw [note 60 velocity 100 gate 1 bass-presence 0]
+  (let [freq (midicps note)
+        amp 0.33
+        snd (sin-osc freq)
+        env (env-gen (adsr 0 0.6 0.9 0.9) gate :action FREE)
+        del (* (/ 1 (* 2 freq)) (+ 0.25 (* 0.25 (sin-osc 1))))
+        dfreq1 (* freq (Math/pow 2 (/ 40 1000)))
+        dfreq2 (* freq (Math/pow 2 (/ 22 1000)))
+        cutoff-env (env-gen (adsr 0.25 1 1 2) gate)
+        snd (lpf
+              (+
+                (* bass-presence amp (sin-osc (/ freq 2)))
+                (*  amp (saw freq))
+                (delay-l (* amp (saw dfreq1)) 1 (/ del 2))
+                (delay-l (* amp (saw dfreq2)) 1 (/ del 3)))
+              (* 16000 cutoff-env))
+        snd (b-low-shelf snd 80 1 10)
+        snd (b-peak-eq snd 800 1 0)
+        snd (b-hi-shelf snd 2000 1 5)]
+      (* env snd)))


Fixed issue #16: Clouseau should display a message when new description is added or updated.

--- src/clouseau/server.clj
+++ src/clouseau/server.clj
@@ -109,14 +109,24 @@
     [package]
     (and package (not (empty? package))))

+(defn show-info-about-update
+    [package]
+    [:div
+        [:div {:class "label label-warning"} (str "Description for the package '" package "' has been updated, thank you!")]
+        [:br]
+        [:br]])
+
 (defn html-renderer
-    [products package package-descriptions ccs-description products-per-descriptions products-without-descriptions]
+    [products package package-descriptions ccs-description products-per-descriptions products-without-descriptions new-description]
     (page/xhtml
         (render-html-header package)
         [:body
             [:div {:class "container"}
                 (render-navigation-bar-section package)

+                (if new-description
+                    (show-info-about-update package))
+
                 (if (package? package)
                     (form/form-to [:post "/"]
                         [:div {:class "label label-primary"} "Description provided by CCS"]
@@ -128,21 +138,22 @@
                         [:br]
                         [:br]
                     ))
-
+
                 (if (package? package)
                     (for [products-per-description products-per-descriptions]
                         [:div
                             (for [product (second products-per-description)]
                                 [:div {:class "label label-primary" :style "margin-right:3px"} product])
                             (render-description (first products-per-description))]
-                    )
-                )
+                    ))
+
                 (if (and (package? package) products-without-descriptions)
                     [:div
                     (for [product products-without-descriptions]
                         [:div {:class "label label-primary" :style "margin-right:3px"} product])
                         [:div {:class "alert alert-danger"} "Not found"]]
                     )
+
                 (render-footer)
             ] ; </div class="container">
         ] ; </body>
@@ -206,7 +217,7 @@
           products-without-descriptions (get-products-without-descriptions products/products package-descriptions)
           products-with-descriptions    (get-products-with-descriptions products/products package-descriptions)
           products-per-description      (get-products-per-description package-descriptions products-with-descriptions)]
-        (-> (http-response/response (html-renderer products/products package package-descriptions ccs-description products-per-description products-without-descriptions))
+        (-> (http-response/response (html-renderer products/products package package-descriptions ccs-description products-per-description products-without-descriptions new-description))
             (http-response/content-type "text/html"))))

 (defn perform-normal-processing


fix race condition between schedule-recurring and cancel-timer

--- src/clj/backtype/storm/timer.clj
+++ src/clj/backtype/storm/timer.clj
@@ -54,8 +54,8 @@
   (when-not @(:active timer)
     (throw (IllegalStateException. "Timer is not active"))))

-(defn schedule [timer delay-secs afn]
-  (check-active! timer)
+(defnk schedule [timer delay-secs afn :check-active true]
+  (when check-active (check-active! timer))
   (let [id (uuid)
         ^PriorityQueue queue (:queue timer)]
     (locking (:lock timer)
@@ -67,8 +67,9 @@
             delay-secs
             (fn this []
               (afn)
-              (schedule timer recur-secs this)
-              )))
+              (schedule timer recur-secs this))
+            :check-active false ; this avoids a race condition with cancel-timer
+            ))

 (defn cancel-timer [timer]
   (check-active! timer)


add github-user message to indicate if the user is registered or not

--- src/clj/hsm/controllers/user.clj
+++ src/clj/hsm/controllers/user.clj
@@ -102,6 +102,9 @@
                   [:div.col-lg-3
                     (left-menu host platform (str "/user2/" id))]
                   [:div.col-lg-9
+                  [:div.alert.alert-info
+                    [:p (format "The following user is not a member of the %s community.
+                          Below data is part of publicly available Github API." platform)]]
                     [:div.row
                       [:div.col-lg-4
                         (user-part id user admin? c-star c-follow c-followers)


Confirm "finish session"

Confirm "finish session"

--- src/cljs/movement/generator.cljs
+++ src/cljs/movement/generator.cljs
@@ -289,14 +289,27 @@
                      [:p (str c)]])]])))

 (defn finish-session-component []
-  [:h3.pure-g
-   [:a.pure-u.log-button
-    {:on-click #(POST "store-session"
-                      {:params        {:session (session/get :movement-session)
-                                       :user    (session/get :user)}
-                       :handler       (fn [response] (get-stored-sessions))
-                       :error-handler (fn [response] (print response))})}
-    "Finish movement session"]])
+  (let [finish-button-clicked? (atom false)
+        session-stored-successfully? (atom false)]
+    (fn []
+      [:div
+       (if @session-stored-successfully?
+         [:h3.pure-g
+          [:div.pure-u {:style {:color "green"}} "Session stored successfully!"]]
+         [:h3.pure-g
+          (if @finish-button-clicked?
+            [:a.pure-u.log-button
+             {:on-click #(POST "store-session"
+                               {:params        {:session (session/get :movement-session)
+                                                :user    (session/get :user)}
+                                :handler       (fn [response] (do
+                                                                (reset! session-stored-successfully? true)
+                                                                (get-stored-sessions)))
+                                :error-handler (fn [response] (print response))})}
+             "Confirm Finish Session"]
+            [:a.pure-u.log-button
+             {:on-click #(reset! finish-button-clicked? true)}
+             "Finish Movement Session"])])])))

 (defn generator-component []
   (let []
@@ -312,5 +325,5 @@
              (for [p (:parts session)]
                ^{:key p} [part-component p]))
            [comment-component (:comment session)]
-           (finish-session-component)]
+           [finish-session-component]]
           [blank-state-component])]])))


Huzzah. The beast is slain, and its name was dependency hell

--- src/clojure/staircase/assets.clj
+++ src/clojure/staircase/assets.clj
@@ -1,6 +1,5 @@
 (ns staircase.assets
   (:import org.lesscss.LessCompiler
-           org.mozilla.classfile.ClassFileWriter
            [java.util Date])
   (:require [dieter.settings :as settings]
             [ring.util.time  :as ring-time]
@@ -14,9 +13,6 @@
 (def less-c (LessCompiler. ["--relative-urls"]))

 (defn less [f]
-  (let [pdm (.getProtectionDomain ClassFileWriter)
-        src (.getCodeSource pdm)]
-    (info "Rhino is loaded from" src))
   (.compile less-c f))

 (defn ext


Implement make-signed-proposal

Implement make-signed-proposal

--- src/clojure_fabric/grpc_core.clj
+++ src/clojure_fabric/grpc_core.clj
@@ -30,7 +30,7 @@
   (:import [org.hyperledger.fabric.protos.peer Chaincode$ChaincodeID Chaincode$ChaincodeSpec
             Chaincode$ChaincodeInput Chaincode$ChaincodeSpec$Type Chaincode$ChaincodeInvocationSpec
             ProposalPackage$ChaincodeHeaderExtension ProposalPackage$ChaincodeProposalPayload
-            ProposalPackage$Proposal]
+            ProposalPackage$Proposal ProposalPackage$SignedProposal]
            [org.hyperledger.fabric.protos.common Common$ChannelHeader Common$HeaderType
             Common$Header Common$SignatureHeader]
            [org.hyperledger.fabric.protos.msp Identities$SerializedIdentity]
@@ -210,3 +210,13 @@
        (make-chaincode-invocation-spec)
        (make-chaincode-proposal-payload)))

+(defn make-signed-proposal
+  [^ProposalPackage$Proposal proposal user-context crypto-suite]
+  (-> (ProposalPackage$SignedProposal/newBuilder)
+      (.setProposalBytes (.toByteString proposal))
+      (.setSignature (-> (.toByteArray proposal)
+                         #^bytes (crypto-suite/sign
+                                  (:private-key user-context)
+                                  {:algorithm (:key-algorithm crypto-suite)})
+                         (ByteString/copyFrom)))
+      (.build)))


0.10.1


Split out async and sync.

Split out async and sync.

--- src/cmr/opendap/ous/variable.clj
+++ src/cmr/opendap/ous/variable.clj
@@ -208,6 +208,25 @@
          variable-ids)
     (str "page_size=" (count variable-ids)))))

+(defn async-get-metadata
+  "Given a 'params' data structure with a ':variables' key (which may or may
+  not have values) and a list of all collection variable-ids, return the
+  metadata for the passed variables, if defined, and for all associated
+  variables, if params does not contain any."
+  [search-endpoint user-token {variable-ids :variables}]
+  (if (seq variable-ids)
+    (let [url (str search-endpoint "/variables")
+          payload (build-query variable-ids)]
+      (log/debug "Variables query to CMR:" payload)
+      (request/async-post
+       url
+       (-> {}
+           (request/add-token-header user-token)
+           (request/add-accept "application/vnd.nasa.cmr.umm+json")
+           (request/add-payload payload))
+       response/json-handler))
+    (deliver (promise) [])))
+
 (defn extract-metadata
   [promise]
   (let [results @promise]
@@ -219,25 +238,9 @@
       (:items results))))

 (defn get-metadata
-  "Given a 'params' data structure with a ':variables' key (which may or may
-  not have values) and a list of all collection variable-ids, return the
-  metadata for the passed variables, if defined, and for all associated
-  variables, if params does not contain any."
-  [search-endpoint user-token {variable-ids :variables}]
-  (if (seq variable-ids)
-    (let [url (str search-endpoint "/variables")
-          payload (build-query variable-ids)
-          _ (log/debug "Variables query to CMR:" payload)
-          promise (request/async-post
-                   url
-                   (-> {}
-                       (request/add-token-header user-token)
-                       (request/add-accept "application/vnd.nasa.cmr.umm+json")
-                       (request/add-payload payload))
-                   response/json-handler)]
-      (log/debug "Variable ids used:" variable-ids)
-      (extract-metadata promise))
-    []))
+  [search-endpoint user-token variables]
+  (let [promise (async-get-metadata search-endpoint user-token variables)]
+    (extract-metadata promise)))

 (defn parse-dimensions
   [dim]


Add helper to generate random uuid

Add helper to generate random uuid

--- src/com/wsscode/pathom/misc.cljc
+++ src/com/wsscode/pathom/misc.cljc
@@ -1,4 +1,9 @@
-(ns com.wsscode.pathom.misc)
+(ns com.wsscode.pathom.misc
+  #?(:clj (:import (java.util UUID))))

 #?(:clj  (def INCLUDE_SPECS true)
    :cljs (goog-define INCLUDE_SPECS true))
+
+(defn pathom-random-uuid []
+  #?(:clj  (UUID/randomUUID)
+     :cljs (random-uuid)))


It's "AWS CodeDeploy" not "Amazon CodeDeploy"

--- frontend/components/project_settings.cljs
+++ frontend/components/project_settings.cljs
@@ -45,7 +45,7 @@
    [:li [:a {:href "#aws"} "AWS keys"]]
    [:li.side-title "Continuous Deployment"]
    [:li [:a {:href "#heroku"} "Heroku"]]
-   [:li [:a {:href "#aws-codedeploy"} "Amazon CodeDeploy"]]
+   [:li [:a {:href "#aws-codedeploy"} "AWS CodeDeploy"]]
    [:li [:a {:href "#deployment"} "Other Deployments"]]])

 (defn branch-names [project-data]


fixed yed

fixed yed

--- main/src/dda/pallet/dda_managed_ide/domain.clj
+++ main/src/dda/pallet/dda_managed_ide/domain.clj
@@ -107,7 +107,7 @@
                        :install-pgtools}
        :basics {:argo-uml {:version "0.34"}
                 :yed {:download-url
-                      "https://www.yworks.com/resources/yed/demo/yEd-3.19.zip"}}
+                      "https://www.yworks.com/resources/yed/demo/yEd-3.19.1.zip"}}
        :db {:dbvis {:version "10.0.16"}}}
       (when (contains? ide-platform :atom)
         {:atom (atom/atom-config vm-type contains-clojure? contains-devops?)})


Change site title

Change site title

--- template/index.html.clj
+++ template/index.html.clj
@@ -1,6 +1,6 @@
 ;; Define template options here
 ; @layout  default
-; @title   home
+; @title   Hello!

 ;; Your own function in template
 (defn page-header [[fs & rs]]


fixup wording

fixup wording

--- src/kmp_search/core.clj
+++ src/kmp_search/core.clj
@@ -10,7 +10,7 @@
     - finds a match within a buffer, or
     - exhausts a buffer without finding a match

-  - retrieve the result a search from the new context using the
+  - retrieve the search result from the new context using the
     match function. The result is either:

       - if a match was found, a Long containing the offset of the


Add protection for unexpected null value

--- src/ktra_indexer/db.clj
+++ src/ktra_indexer/db.clj
@@ -129,7 +129,8 @@
   if not found. Returns the track's ID (> 0) on success and -1 on error."
   [db-con track-json]
   (let [artist-id (get-or-insert-artist db-con (:artist track-json))]
-    (if (pos? artist-id)
+    (if (and (not (nil? artist-id))
+             (pos? artist-id))
       ;; Got a valid ID
       (try
         (let [track-name (s/trim (:track track-json))


Show avatar in tile

Show avatar in tile

--- android/src/clojure/net/nightweb/views.clj
+++ android/src/clojure/net/nightweb/views.clj
@@ -17,6 +17,8 @@
         [nightweb.torrents :only [is-connecting?]]))

 (set-classname! :scroll-view android.widget.ScrollView)
+(set-classname! :frame-layout android.widget.FrameLayout)
+(set-classname! :image-view android.widget.ImageView)

 (defn set-text-size
   ([view] (set-text-size view 20))
@@ -46,20 +48,14 @@
         (getView [position convert-view parent]
           (let [not-initialized (= convert-view nil)
                 bottom android.view.Gravity/BOTTOM
-                bold android.graphics.Typeface/DEFAULT_BOLD
                 tile-view (if not-initialized
-                            (if (get-in content [position :add-emphasis?])
-                              (make-ui context
-                                       [:linear-layout {:orientation 1}
-                                        [:text-view {:layout-weight 3
-                                                     :typeface bold}]
-                                        [:text-view {:layout-weight 1
-                                                     :gravity bottom}]])
-                              (make-ui context
-                                       [:linear-layout {:orientation 1}
-                                        [:text-view {:layout-weight 3}]
-                                        [:text-view {:layout-weight 1
-                                                     :gravity bottom}]]))
+                            (make-ui context
+                                     [:frame-layout {}
+                                      [:image-view {}]
+                                      [:linear-layout {:orientation 1}
+                                       [:text-view {:layout-weight 3}]
+                                       [:text-view {:layout-weight 1
+                                                    :gravity bottom}]]])
                             convert-view)
                 num-columns (.getNumColumns view)
                 width (.getWidth view)
@@ -69,21 +65,27 @@
                 layout-params (android.widget.AbsListView$LayoutParams.
                                                           tile-view-width
                                                           tile-view-width)]
-            (.setLayoutParams tile-view layout-params)
             (if not-initialized
               (let [black android.graphics.Color/BLACK
-                    border (get-resource :drawable :border)
                     item (get content position)
-                    text-top (.getChildAt tile-view 0)
-                    text-bottom (.getChildAt tile-view 1)]
+                    image-view (.getChildAt tile-view 0)
+                    linear-layout (.getChildAt tile-view 1)
+                    text-top (.getChildAt linear-layout 0)
+                    text-bottom (.getChildAt linear-layout 1)]
+                (if (get item :add-emphasis?)
+                  (.setTypeface text-top
+                                android.graphics.Typeface/DEFAULT_BOLD))
+                (.setImageBitmap image-view (get item :bitmap))
                 (.setPadding tile-view 5 5 5 5)
-                (.setBackgroundResource tile-view border)
-                (if-let [title (get-in content [position :title])]
+                (.setBackgroundResource tile-view
+                                        (get-resource :drawable :border))
+                (if-let [title (get item :title)]
                   (.setText text-top title)
-                  (.setText text-top (get-in content [position :body])))
-                (.setText text-bottom (get-in content [position :subtitle]))
+                  (.setText text-top (get item :body)))
+                (.setText text-bottom (get item :subtitle))
                 (.setShadowLayer text-top 10 0 0 black)
                 (.setShadowLayer text-bottom 10 0 0 black)))
+            (.setLayoutParams tile-view layout-params)
             tile-view))))
     (.setOnItemClickListener
       view
@@ -171,8 +173,7 @@
                      (onMeasure [width height]
                        (proxy-super onMeasure width width)))
         fill android.widget.LinearLayout$LayoutParams/FILL_PARENT
-        layout-params (android.widget.LinearLayout$LayoutParams. fill 0)
-        border (get-resource :drawable :border)]
+        layout-params (android.widget.LinearLayout$LayoutParams. fill 0)]
     (.setPadding linear-layout 10 10 10 10)
     (set-text-size text-name)
     (set-text-size text-body)
@@ -181,11 +182,11 @@
     (.setText text-name (get content :title))
     (.setText text-body (get content :body))
     (.setLayoutParams image-view layout-params)
-    (.setBackgroundResource image-view border)
+    (.setBackgroundResource image-view
+                            (get-resource :drawable :border))
     (.setScaleType image-view android.widget.ImageView$ScaleType/CENTER_CROP)
-    (if-let [image-bitmap (read-image-file (get content :userhash)
-                                           (get content :prevhash))]
-      (.setImageBitmap image-view image-bitmap))
+    (.setImageBitmap image-view (read-image-file (get content :userhash)
+                                                 (get content :prevhash)))
     (if (get content :is-me?)
       (.setOnClickListener image-view
                            (proxy [android.view.View$OnClickListener] []
@@ -203,6 +204,8 @@
             first-tiles [{:title (get-string :profile)
                           :add-emphasis? true
                           :content user
+                          :bitmap (read-image-file (get user :userhash)
+                                                   (get user :prevhash))
                           :type :custom-func
                           :func
                           (fn [context item]


add `execute-query` to the IDriver protocol.

--- src/metabase/driver.clj
+++ src/metabase/driver.clj
@@ -107,6 +107,22 @@

           Is this property required? Defaults to `false`.")

+  (execute-query ^Map [this, ^Map query]
+    "Execute a query against the database and return the results.
+
+     The query passed in will contain:
+
+         {:database ^DatabaseInstance
+          :native   {... driver specific query form ...}
+          :settings {:report-timezone \"US/Pacific\"
+                     :other-setting   \"and its value\"}}
+
+     Results should look like:
+
+         {:columns [\"id\", \"name\"]
+          :rows    [[1 \"Lucky Bird\"]
+                    [2 \"Rasta Can\"]]}")
+
   (features ^java.util.Set [this]
     "*OPTIONAL*. A set of keyword names of optional features supported by this driver, such as `:foreign-keys`. Valid features are:

@@ -127,7 +143,7 @@
     "*OPTIONAL*. Return a humanized (user-facing) version of an connection error message string.
      Generic error messages are provided in the constant `connection-error-messages`; return one of these whenever possible.")

-  (mbql->native [this, ^Map query]
+  (mbql->native ^Map [this, ^Map query]
     "Transpile an MBQL structured query into the appropriate native query form for the given driver.  For example, a
      driver like Postgres should build a valid SQL expression and return that.")

@@ -217,16 +233,18 @@

 (def IDriverDefaultsMixin
   "Default implementations of `IDriver` methods marked *OPTIONAL*."
-  {:analyze-table                     (constantly nil)
-   :date-interval                     (u/drop-first-arg u/relative-date)
-   :describe-table-fks                (constantly nil)
-   :features                          (constantly nil)
-   :humanize-connection-error-message (u/drop-first-arg identity)
-   :mbql->native                      #(throw (RuntimeException. "Driver has not implemented `mbql->native` function."))
-   :notify-database-updated           (constantly nil)
-   :process-query-in-context          (u/drop-first-arg identity)
-   :sync-in-context                   (fn [_ _ f] (f))
-   :table-rows-seq                    (constantly nil)})
+  (let [not-implemented #(throw (RuntimeException. "Driver has not implemented `mbql->native` function."))]
+    {:analyze-table                     (constantly nil)
+     :date-interval                     (u/drop-first-arg u/relative-date)
+     :describe-table-fks                (constantly nil)
+     :execute-query                     not-implemented
+     :features                          (constantly nil)
+     :humanize-connection-error-message (u/drop-first-arg identity)
+     :mbql->native                      not-implemented
+     :notify-database-updated           (constantly nil)
+     :process-query-in-context          (u/drop-first-arg identity)
+     :sync-in-context                   (fn [_ _ f] (f))
+     :table-rows-seq                    (constantly nil)}))

 ;;; ## CONFIG


all contents & cgs updated to 2015version

--- src/mljalfa/znet/cg.clj
+++ src/mljalfa/znet/cg.clj
@@ -77,7 +77,7 @@
         (do (spit (str "resources/" fname ".edn") res)
             (take 50 res))))))

-(defn classify
+(defn classify-based-on-video-access
   [fname]
   (let [raw (->> (slurp (str "resources/" fname ".edn"))
                  read-string)]
@@ -110,7 +110,81 @@
         (do (spit (str "resources/" fname ".edn") res)
             (take 20 res))))))

-(defn what?)
+(defn cg-sieve
+  "assigning parents to cg"
+  [fname]
+  (let [refs (into-array (vec (repeat 2000 [])))
+        raw (->> "resources/content-group-tree-path.edn"
+                 slurp read-string)]
+    (loop [[{:keys [ancestor descendant length]} & vs] raw]
+      (if ancestor
+        (do (->> {:id ancestor :level length}
+                 (conj (aget refs descendant))
+                 (aset refs descendant))
+            (recur vs))
+        (let [content (->> (into [] refs)
+                           (map-indexed #(hash-map :id %1
+                                                   :parents %2))
+                           (remove #(empty? (:parents %)))
+                           (into []))]
+          (do (spit (str "resources/" fname ".edn") content)
+              (take 20 content)))))))
+
+(def cg-from-file (->> "resources/content-group.edn"
+                       slurp read-string))
+
+(defn update-cg
+  "Update content-group from file"
+  []
+  (let [cgs (into-array (vec (repeat 2000 {})))]
+    (do (loop [[v & vs] cg-from-file]
+          (when v
+            (aset cgs (:id v) v)
+            (recur vs)))
+        (loop [[v & vs] (->> "resources/cg-parents.edn"
+                             slurp read-string)]
+          (when v
+            (aset cgs (:id v) (merge (aget cgs (:id v)) v))
+            (recur vs)))
+        (let [content (->> (into [] cgs)
+                           (remove empty?)
+                           (into []))]
+          (spit "resources/updated-cg.edn" content)
+          (take 20 content)))))
+
+(defn update-cg-in-db
+  "Update the content-group data in the db"
+  []
+  (loop [[v & vs] (->> "resources/updated-cg.edn" slurp read-string)]
+    (when v
+      (let [id (:id v)]
+        (if-let [from-db (cc/get-json cdb (:key (cbkey "content-group" id)))]
+          (cc/set-json cdb (keyword (:key (cbkey "content-group" id)))
+                       (merge from-db v))
+          (cc/set-json cdb (keyword (:key (cbkey "content-group" id)))
+                       (merge v {:ctype "content-group"
+                                 :contents []}))))
+      (println (:id v))
+      (recur vs))))
+
+(defn update-content-in-db
+  []
+  (let [raw (->> "resources/content.edn" slurp read-string)]
+    (loop [[v & vs] raw]
+      (when v
+        (let [id (:id v)]
+          (if-let [from-db (cc/get-json cdb (:key (cbkey "content" id)))]
+            (cc/get-json cdb (keyword (:key (cbkey "content" id)))
+                         (merge from-db v))
+            (cc/get-json cdb (keyword (:key (cbkey "content" id)))
+                         (merge v {:ctype "content"
+                                   :tutors []
+                                   :hits {}}))))
+        (println (:id v))
+        (recur vs)))))

+
+
+


Update unit tests to add clear command.

Update unit tests to add clear command.

--- test/cli4clj/test/cli.clj
+++ test/cli4clj/test/cli.clj
@@ -86,15 +86,21 @@
                                :fn-args "fn-args string"}}}
         test-cmd-input ["help"]
         out-string (cli-tests/test-cli-stdout #(cli/start-cli cli-opts) test-cmd-input)]
-    (test/is (= (str "add"
-                " -- Arguments: fn-args string" cli/*line-sep* cli/*line-sep* cli/*line-sep*
-                "help [? h]" cli/*line-sep*
-                "\tShow help." cli/*line-sep*
-                "\tDisplay a help text that lists all available commands including further detailed information about these commands." cli/*line-sep* cli/*line-sep*
-                "quit [q]" cli/*line-sep*
-                "\tQuit the CLI." cli/*line-sep*
-                "\tTerminate and close the command line interface.")
-           out-string))))
+    (test/is
+      (=
+        (str
+          "add"
+          " -- Arguments: fn-args string" cli/*line-sep* cli/*line-sep* cli/*line-sep*
+          "clear" cli/*line-sep*
+          "\tClear screen." cli/*line-sep*
+          "\tClears the screen and resets the user interface." cli/*line-sep* cli/*line-sep*
+          "help [? h]" cli/*line-sep*
+          "\tShow help." cli/*line-sep*
+          "\tDisplay a help text that lists all available commands including further detailed information about these commands." cli/*line-sep* cli/*line-sep*
+          "quit [q]" cli/*line-sep*
+          "\tQuit the CLI." cli/*line-sep*
+          "\tTerminate and close the command line interface.")
+        out-string))))

 (test/deftest allow-eval-cli-interaction-test
   (let [cli-opts {:allow-eval true}
@@ -243,7 +249,10 @@
   (let [cli-opts {:cmds {:print {:fn #(println %)}
                          :divide {:fn (fn [x y] (/ x y))}}}
         cli-fn (cli/embedded-cli-fn cli-opts)]
-    (test/is (= "divide\n\n\nhelp [? h]\n\tShow help.\n\tDisplay a help text that lists all available commands including further detailed information about these commands.\n\nprint\n\n\nquit [q]\n\tQuit the CLI.\n\tTerminate and close the command line interface." (cli-fn "help")))))
+    (test/is
+      (=
+        "clear\n\tClear screen.\n\tClears the screen and resets the user interface.\n\ndivide\n\n\nhelp [? h]\n\tShow help.\n\tDisplay a help text that lists all available commands including further detailed information about these commands.\n\nprint\n\n\nquit [q]\n\tQuit the CLI.\n\tTerminate and close the command line interface."
+        (cli-fn "help")))))


Handle 404s

Handle 404s

--- test/icecap/rest_test.clj
+++ test/icecap/rest_test.clj
@@ -32,6 +32,9 @@
 (deftest handler-tests
   (testing "root is handled"
     (is (some? (handler (mock/request :get "/")))))
+  (testing "random 404s are handled"
+    (let [{:keys status} (handler (mock/request :get "/bogus/xyzzy"))]
+      (is (= status 404))))
   (testing "creating cap with valid plan succeeds"
     (let-flow [req (create-cap-req {:type :succeed})
                {:keys [status headers]} (handler req)]


Make the test actually test

Make the test actually test

--- test/circle/backend/build/test_run_build.clj
+++ test/circle/backend/build/test_run_build.clj
@@ -57,10 +57,9 @@
                                  :act-fn (fn [build] (throw (Exception.))))])]
     (try
       (run-build build)
-      (catch Exception e)
-      (finally
-       (-> @build :infrastructure_fail) => true
-       (-> @build :action-results last :infrastructure_fail) => true))))
+      (catch Exception e))
+    (-> @build :infrastructure_fail) => true
+    (-> @build :action-results last :infrastructure_fail) => true))

 (fact "build of dummy project is successful"
   (-> "https://github.com/arohner/circle-dummy-project" (build-from-url) (run-build) (successful?)) => true)


Fixing problem with always re-created netty instance.

--- test/clojurewerkz/cassaforte/test_helper.clj
+++ test/clojurewerkz/cassaforte/test_helper.clj
@@ -16,7 +16,7 @@

 (defn initialize-cql
   [f]
-  (when (not (bound? (var thrift-client/*cassandra-client*)))
+  (when (not (bound? (var cql-client/*client*)))
     (cql-client/connect! "127.0.0.1")
     (with-thrift-exception-handling
       (cql/set-keyspace "cassaforte_test_1")))


use medium grammar only

use medium grammar only

--- test/babel/test/it.cljc
+++ test/babel/test/it.cljc
@@ -4,7 +4,7 @@
    [babel.directory :refer [models]]
    [babel.generate :as generate]
    [babel.italiano :as italiano :refer [analyze fo-ps generate medium morph
-                                        np-grammar parse preprocess small]]
+                                        np-grammar parse preprocess]]
    [babel.italiano.grammar :as grammar :refer [model]]
    [babel.italiano.morphology :as morph :refer [analyze-regular]]
    [babel.italiano.morphology.nouns :as nouns]
@@ -18,6 +18,9 @@
    [clojure.string :as string]
    [clojure.set :as set]
    [dag_unify.core :refer [copy fail? get-in strip-refs unify]]))
+
+(defn small []
+  (medium))

 (deftest analyze-1
   (let [singular (analyze "compito")


Update alfa.clj

Update alfa.clj

--- practice/alfa.clj
+++ practice/alfa.clj
@@ -34,6 +34,18 @@
       res
       (recur (dec i) (rest res)))))

+;;last
+(defn last' [col]
+  (if (<= (count col) 1)
+    (first col)
+    (last' (rest col))))

+(defn last'' [col]
+  (loop [i (count col)
+         res col]
+    (if (<= i 1)
+      (first res)
+      (recur (dec i) (rest res)))))
+
 ;; Reimplementing Clojure in pure recursion
 ;; last, butlast, keep, map, take, take-while, remove, drop, drop-while, distinct, range, for


Add failing for loop test

Add failing for loop test

--- test/jest/loop_test.clj
+++ test/jest/loop_test.clj
@@ -35,3 +35,12 @@
   (test-code
    "for (a: lst) lazy { println(a); };"
    ["(map (fn [ a ] (println a)) (seq lst))"]))
+
+
+;; TODO: Uncomment and fix
+;; (deftest for-loop-bug-1
+;;   (test-code
+;;    "val a = 10; for (b: a) {val z = 10; z;} a;"
+;;    ["(def a 10)"
+;;     "(doall (map (fn [b] (def z 10) z) (seq a)))"
+;;     "a"]))


don't need these specifications for desired expression to be generated

--- test/babel/test/en.cljc
+++ test/babel/test/en.cljc
@@ -270,10 +270,9 @@

 (deftest reflexive-furniture-sentence
   (let [expr (generate {:modified false
-                        :comp {:synsem {:agr {:person :3rd}}}
                         :synsem {:cat :verb
-                                 :sem {:aspect :progressive
-                                       :pred :in-front-of
+                                 :sem {:pred :in-front-of
+                                       :tense :present
                                        :reflexive true
                                        :subj {:pred :chair
                                               :mod '()


+(deftest go-upstairs)

+(deftest go-upstairs)

--- test/babel/test/en.cljc
+++ test/babel/test/en.cljc
@@ -143,6 +143,14 @@
   (is (not (empty? (parse "you all (♀) speak"))))
   (is (not (empty? (parse "you all (♂) speak")))))

+(deftest go-upstairs
+  (is (not (empty? (parse "I go upstairs"))))
+  (is (not (empty? (parse "you go upstairs"))))
+  (is (not (empty? (parse "she goes upstairs"))))
+  (is (not (empty? (parse "we go upstairs"))))
+  (is (not (empty? (parse "you all go upstairs"))))
+  (is (not (empty? (parse "they go upstairs")))))
+
 (deftest be-called
   (is (= 10
          (count


run this test only once and use :model small.

--- test/babel/test/it.cljc
+++ test/babel/test/it.cljc
@@ -317,14 +317,11 @@

 (deftest gestiscono
   (let [result
-        (take 10 (repeatedly #(generate {:modified false
-                                         :synsem {:sem {:subj {:pred :loro}
-                                                        :pred :manage
-                                                        :tense :present}}})))]
-    (count (map (fn [each]
-                  (is (= "loro gestiscono" (fo each))))
-                (map :surface
-                     result)))))
+        (generate {:synsem {:sem {:subj {:pred :loro}
+                                  :pred :manage
+                                  :tense :present}}}
+                  :model small)]
+    (is (= "loro gestiscono" (fo result)))))

 (deftest casa-generate
   (let [result (generate {:synsem {:cat :noun


Make queries point to an atom

Make queries point to an atom

Make queries point to an atom

--- src/webapp/framework/server/systemfns.clj
+++ src/webapp/framework/server/systemfns.clj
@@ -535,13 +535,20 @@
                                            )

         result-id-vector   (into [] (map :id results))
+
+        existing-query     (get @cached-queries   query)
         ]
     (do
       (println (str "    " query))
-      (swap! cached-queries assoc  query {
-                                          :records      result-id-vector
-                                          :count        record-count
-                                          }))))
+
+      (if (not existing-query)
+        (swap! cached-queries assoc  query (atom {})))
+
+      (let [the-query        (get @cached-queries   query)
+            ]
+        (swap! the-query assoc  :records      result-id-vector)
+        (swap! the-query assoc  :count        record-count)
+        ))))

@@ -575,13 +582,13 @@
                      (println (str "    " query))
                      (println (str "    "))
                      (println (str "    " "Before"))
-                     (println (str "    " (get @cached-queries query)))
+                     (println (str "    " @(get @cached-queries query)))

                      (update-query-in-cache  query)

                      (println (str "    "))
                      (println (str "    " "After"))
-                     (println (str "    " (get @cached-queries query)))
+                     (println (str "    " @(get @cached-queries query)))
                      (println (str "    "))
                      ))))))))

@@ -651,7 +658,7 @@
           (println (get @cached-queries  query-key))
           (println "-------------------------------")

-           (get @cached-queries  query-key)
+           @(get @cached-queries  query-key)
       )


added ns-level docstring

added ns-level docstring

--- src/crawler/structure_driven.clj
+++ src/crawler/structure_driven.clj
@@ -1,4 +1,8 @@
 (ns crawler.structure-driven
+  "An implementation of the structure driven crawler.
+   Requires an entry point and a target page.
+   The structure driven crawler fetches a navigation
+   pattern = XPath seq"
   (:require [crawler.rich-char-extractor :as rc-extractor]
             [crawler.similarity :as similarity]))


fix inverted test condition

fix inverted test condition

--- test/java_time_test.clj
+++ test/java_time_test.clj
@@ -1019,11 +1019,11 @@
                             (re-find #"^\d+")
                             Integer/parseInt)]
       (if (> java-version 11)
-        (testing "Java 13 and above treats AM as invalid"
+        (testing "Java 12 and above treats AM as invalid"
           (let [fmt (java-time/formatter "hh:mma" {:case :sensitive})]
             (is (= (j/local-time 0 34 0 0)
-                   (j/local-time fmt "12:34am")))
-            (is (thrown? Exception (j/local-time fmt "12:34AM")))))
+                   (j/local-time fmt "12:34AM")))
+            (is (thrown? Exception (j/local-time fmt "12:34am")))))

         (testing "Java 8 and 11 treats am as invalid"
           (let [fmt (java-time/formatter "hh:mma" {:case :sensitive})]


escape error messages

escape error messages

--- support/src/figwheel/client/heads_up.cljs
+++ support/src/figwheel/client/heads_up.cljs
@@ -2,7 +2,8 @@
   (:require
    [clojure.string :as string]
    [figwheel.client.socket :as socket]
-   [cljs.core.async :refer [put! chan <! map< close! timeout alts!] :as async])
+   [cljs.core.async :refer [put! chan <! map< close! timeout alts!] :as async]
+   [goog.string])
   (:require-macros
    [cljs.core.async.macros :refer [go go-loop]]))

@@ -131,23 +132,24 @@
        "\">" msg "
"))

 (defn format-line [msg]
-  (if-let [[f ln] (file-and-line-number msg)]
-    (file-selector-div f ln msg)
-    (str "
" msg "
")))
+  (let [msg (goog.string/htmlEscape msg)]
+    (if-let [[f ln] (file-and-line-number msg)]
+      (file-selector-div f ln msg)
+      (str "
" msg "
"))))

 (defn display-error [formatted-messages cause]
   (let [[file-name file-line file-column]
         (if cause
           [(:file cause) (:line cause) (:column cause)]
           (first (keep file-and-line-number formatted-messages)))
-        msg (apply str (map #(str "
" % "
") formatted-messages))]
+        msg (apply str (map #(str "
" (goog.string/htmlEscape %)  "
") formatted-messages))]
     (display-heads-up {:backgroundColor "rgba(255, 161, 161, 0.95)"}
                       (str (close-link) (heading "Compile Error")
                            (file-selector-div file-name (or file-line (and cause (:line cause)))
                                               (str msg
                                                    (if cause
                                                      (str "Error on file "
-                                                          (:file cause)
+                                                          (goog.string/htmlEscape (:file cause))
                                                           ", line "
                                                           (:line cause)
                                                           ", column " (:column cause))
@@ -155,7 +157,8 @@

 (defn display-system-warning [header msg]
   (display-heads-up {:backgroundColor "rgba(255, 220, 110, 0.95)" }
-                    (str (close-link) (heading header) (format-line msg))))
+                    (str (close-link) (heading header)
+                         (format-line msg))))

 (defn display-warning [msg]
   (display-system-warning "Compile Warning" msg))


CMR-2507 Add additional test for end-date-time

--- umm-lib/test/cmr/umm/test/start_end_date.clj
+++ umm-lib/test/cmr/umm/test/start_end_date.clj
@@ -36,9 +36,12 @@
   )

 (deftest end-date-test
-  (testing "range date times without ends-at-present-flag"
+  (testing "range date times with no end without ends-at-present-flag"
     (let [temporal (c/map->Temporal {:range-date-times [range1 range2 range3]})]
       (is (= nil (sed/end-date :collection temporal)))))
+  (testing "range date times with a definite end with no ends-at-present-flag"
+    (let [temporal (c/map->Temporal {:range-date-times [range1 range2]})]
+      (is (= dt4 (sed/end-date :collection temporal)))))
   (testing "range date times with ends-at-present-flag"
     (let [temporal (c/map->Temporal {:ends-at-present-flag true
                                      :range-date-times [range1 range2 range3]})]


Switch remaining exception to ex-info.

Switch remaining exception to ex-info.

--- src/multihash/core.cljc
+++ src/multihash/core.cljc
@@ -7,9 +7,7 @@
     [alphabase.hex :as hex]
     [clojure.string :as str])
   #?(:clj (:import
-            (java.io
-              InputStream
-              IOException)
+            java.io.InputStream
             java.nio.ByteBuffer
             java.security.MessageDigest)))

@@ -137,12 +135,13 @@
   [algorithm digest]
   (let [algo (get-algorithm algorithm)]
     (when-not (integer? (:code algo))
-      (throw (IllegalArgumentException.
+      (throw (ex-info
                (str "Argument " (pr-str algorithm) " does not "
-                    "represent a valid hash algorithm."))))
+                    "represent a valid hash algorithm.")
+               {:algorithm algorithm})))
     (let [digest (if (string? digest) digest (hex/encode digest))]
       (when-let [err (hex/validate digest)]
-        (throw (IllegalArgumentException. err)))
+        (throw (ex-info err {:digest digest})))
       (Multihash. (:code algo) digest nil))))

@@ -207,7 +206,7 @@

 (defn- read-stream-digest
   "Reads a byte digest array from an input stream. First reads a byte giving
-  the length of the digest data to read. Throws an IOException if the length is
+  the length of the digest data to read. Throws an ex-info if the length is
   invalid or there is an error reading from the stream."
   ^bytes
   [^InputStream input]


Fix straight-jacket tests by properly mocking airbrake.

--- test/circle/util/test_straight_jacket.clj
+++ test/circle/util/test_straight_jacket.clj
@@ -6,7 +6,7 @@
 (fact "straight-jacket catches exceptions"
   (straight-jacket (throw (Exception. "test"))) => nil
   (provided
-    (airbrake/airbrake) => nil
+    (airbrake/airbrake anything anything anything anything) => nil
     (circle.env/env) => :production))

@@ -29,5 +29,5 @@
 (fact "straight-jacket catches assertions"
   (straight-jacket (assert false)) => nil
   (provided
-    (airbrake/airbrake) => nil
+    (airbrake/airbrake anything anything anything anything) => nil
     (circle.env/env) => :production))


Testt.

Testt.

--- test/clj/hatnik/selenium/actions_test.clj
+++ test/clj/hatnik/selenium/actions_test.clj
@@ -52,7 +52,7 @@
       (assoc params
         :gh-pr-operations gh-pr-operations))))

-(deftest create-delete-test
+(defn create-delete-test []
   (let [driver (create-and-login)]
     (try
       (let [[project] (find-projects-on-page driver)]


Fix typo

Fix typo

--- src/forces_assemble/logs_api.clj
+++ src/forces_assemble/logs_api.clj
@@ -1,4 +1,4 @@
-(ns forces-assemble.logsy-api
+(ns forces-assemble.logs-api
   (:require [clojure.java.io :as io]
             [clojure.string :as cstr]
             [clojure.tools.logging :as log]


Move wrap function

Move wrap function

--- src/nightmod/public.clj
+++ src/nightmod/public.clj
@@ -5,17 +5,15 @@
             [nightmod.utils :as u]
             [play-clj.core :refer :all]))

-(defn ^:private wrap
-  [f args]
-  (try (apply f args)
-    (catch Exception e
-      (when (nil? @u/error) (reset! u/error e)))))
-
 (defn set-game-screen!
   [& screens]
-  (->> (set-screen-with-options! s/nightmod
+  (->> (fn [f args]
+         (try (apply f args)
+           (catch Exception e
+             (when (nil? @u/error) (reset! u/error e)))))
+       (set-screen-with-options! s/nightmod
                                  (conj (vec screens) s/overlay-screen)
-                                 :wrap wrap)
+                                 :wrap)
        (fn [])
        (app! :post-runnable)))