zooming in and out

zooming in and out

git-svn-id: 03a8048b5ee8463be5048a3801110fb50f378627@9341 d0ab736e-dc22-4aeb-8dc9-08def0aa14fd

--- plugins/SlideExplorer2/src/slide_explorer/display.clj
+++ plugins/SlideExplorer2/src/slide_explorer/display.clj
@@ -193,8 +193,7 @@
                     x y nil)))))

 (defn paint-screen [canvas screen-state visible-tiles]
-  (let [g (.getGraphics canvas)
-        image @slide-explorer.image/image]
+  (let [g (.getGraphics canvas)]
     (doto g
       (.translate (:x @screen-state) (:y @screen-state))
       enable-anti-aliasing
@@ -253,6 +252,10 @@
                           (update-size)))))
   size-atom)

+(defn handle-zoom [window zoom-atom]
+  (bind-window-key window "ADD" #(swap! zoom-atom update-in [:zoom] inc))
+  (bind-window-key window "SUBTRACT" #(swap! zoom-atom update-in [:zoom] dec)))
+
 (defn display-follow [canvas reference]
   (add-watch reference "display"
     (fn [_ _ _ _]
@@ -270,23 +273,31 @@
     (.setBounds 10 10 500 500)))

 (defn show []
-  (let [screen-state (atom (sorted-map :x 0 :y 0 :z 0))
+  (let [screen-state (atom (sorted-map :x 0 :y 0 :z 0 :zoom 0))
         visible-tiles (agent {})
         canvas (main-canvas screen-state visible-tiles)
         frame (main-frame)]
     (def vt visible-tiles)
     (def ss screen-state)
+    (def f frame)
     (.add (.getContentPane frame) canvas)
     (setup-fullscreen frame)
     (handle-drags canvas screen-state)
     (handle-wheel canvas screen-state)
     (handle-resize canvas screen-state)
+    (handle-zoom frame screen-state)
     (display-follow canvas screen-state)
     (display-follow canvas visible-tiles)
-    canvas))
+    frame))
+

 (defn test-tile [nx ny]
   (add-to-visible-tiles vt [nx ny 0 0 0 0]))

+(defn test-tiles [nx ny]
+  (doseq [i (range nx) j (range ny)]
+    (Thread/sleep 1000)
+    (test-tile i j)))
+
 ;;;;;;;;


more specific TITLE on each page

more specific TITLE on each page

--- src/yablog/server.clj
+++ src/yablog/server.clj
@@ -42,18 +42,23 @@
 (defn stylify [hiccuper]
   (fn [req]
     (let [hic (hiccuper req)
+          title (:data-title
+                 (second
+                  (first (filter #(= (first %) :article)
+                                 (tree-seq vector? rest hic)))))
           conf (:conf req)]
       (hpage/html5
        [:head
         [:link {:href (conf/stylesheet conf)
                 :rel "stylesheet"}]
-        [:title (:title conf)]]
+        [:title title " - " (:title conf)]]
        (w/postwalk-replace
         (conf/replacements conf)
         [:body
          [:header
           [:a {:href "/"}
-           [:div {:class "title"} (:title conf)]]]
+           [:div {:class "title"}
+            title " - " (:title conf)]]]
          hic
          [:aside
           [:bio]
@@ -63,18 +68,20 @@
          ])))))

 (defn recent-entries [req]
-  (into [:article]
+  (into [:article {:data-title "Recent entries"}
         (map hic/hiccup-entry (page/recent-pages 5 (:pages req)))))

 (defn entries-for-month [req]
   (let [p (:route-params req)
         y (Integer. (:year p))
         m (Integer. (:month p))
-        next-month (time/plus (time/date-time y m) (time/months 1))
-        prev-month (time/minus (time/date-time y m) (time/months 1))]
+        start (time/date-time y m)
+        next-month (time/plus start (time/months 1))
+        prev-month (time/minus start (time/months 1))]
     ;; XXX would be neat if it included "older" and "newer" links
     (conj
-     (into [:article]
+     (into [:article
+            {:data-title (ftime/unparse (ftime/formatter "MMM yyyy") start)}]
            (map hic/hiccup-entry
                 (page/pages-in-month y m (:pages req))))
      [:div {:class "nav"}
@@ -85,11 +92,11 @@
        (ftime/unparse (ftime/formatter "MMM yyyy") next-month)   "⟫"]
       ])))

-
 (defn entry-by-y-m-slug [y m slug request]
   (let [p (page/find-page (Integer. y) (Integer. m)
                           slug (:pages request))]
-    [:article (hic/hiccup-entry p)]))
+    [:article {:data-title (page/title p)}
+     (hic/hiccup-entry p)]))

 (defn handle-rss [req]
   (let [recent (page/recent-pages 10 (:pages req))


WIP add comment to REPL about how to seed the API DB

--- ssclj/jar/project.clj
+++ ssclj/jar/project.clj
@@ -61,6 +61,8 @@
                   ;; This line is related to the SlipStream project:
                   "API Server: (require '[com.sixsq.slipstream.ssclj.app.server :as server])\n"
                   "            (def state (server/start 8201))\n"))
+                  "DB Seeding: (require '[com.sixsq.slipstream.ssclj.resources.seeds.event :as es])\n"
+                  "            (es/seed! 10 :bob)\n"))
                 }

   :profiles {


Refactor to use cond

Refactor to use cond

--- src/buildviz/junit_xml.clj
+++ src/buildviz/junit_xml.clj
@@ -26,13 +26,11 @@
     (Math/round (* 1000 (Float/parseFloat time)))))

 (defn- parse-status [testcase-elem]
-  (if (is-failure? testcase-elem)
-    :fail
-    (if (is-error? testcase-elem)
-      :error
-      (if (is-skipped? testcase-elem)
-        :skipped
-        :pass))))
+  (cond
+    (is-failure? testcase-elem) :fail
+    (is-error? testcase-elem) :error
+    (is-skipped? testcase-elem) :skipped
+    :else :pass))

 (defn- add-runtime [testcase testcase-elem]
   (if-let [runtime (parse-runtime testcase-elem)]


Use apply concat so sort can lazily realize the collection and not build intermediate ones.

--- project/analyze-data/src/analyze_data/tf_idf/core.clj
+++ project/analyze-data/src/analyze_data/tf_idf/core.clj
@@ -42,7 +42,7 @@
   corpus. The rest are sequences of tf-idf values of those terms, for each
   document in term-corpus."
   [term-corpus]
-  (let [all-terms (sort (distinct (reduce into term-corpus)))
+  (let [all-terms (sort (distinct (apply concat term-corpus)))
         tf-corpus (map normalized-term-frequency term-corpus)
         idf (inverse-document-frequency tf-corpus)
         tf-idf-values (map (partial tf-idf-document idf all-terms) tf-corpus)]


Only add coverpages to neu-im-sortiment

Only add coverpages to neu-im-sortiment

We might add some at a later stage to :grossdruck but the others either
do not have designed covers or don't need the all in one (and
accessible) approach (at least for now).

--- src/catalog/layout/fop.clj
+++ src/catalog/layout/fop.clj
@@ -640,7 +640,6 @@
       [:fo:root (style :font (root-attrs))
        (layout-master-set date)
        (declarations title (or description title))
-       (coverpage-recto title date)
        [:fo:page-sequence {:master-reference "main"
                            :initial-page-number "1"
                            :force-page-count "end-on-even"
@@ -655,8 +654,7 @@
           [:fo:flow {:flow-name "xsl-region-body"}
            (toc subitems [fmt] 2 {:heading? true})
            (realize-lazy-seqs
-            (mapcat #(genre-sexp (get subitems %) fmt % 1 {}) (keys subitems)))])]
-       (coverpage-verso date)])))
+            (mapcat #(genre-sexp (get subitems %) fmt % 1 {}) (keys subitems)))])]])))

 (defmethod document-sexp :hörbuch
   [items fmt editorial recommendations {:keys [description date]}]
@@ -664,7 +662,6 @@
     [:fo:root (style :font (root-attrs))
      (layout-master-set date)
      (declarations title (or description title))
-     (coverpage-recto title date)
      [:fo:page-sequence {:master-reference "main"
                          :initial-page-number "1"
                          :language "de"}
@@ -685,8 +682,7 @@
           (format "%s Nr. %s/%s" title
                   (layout/volume-number date) (layout/year date))]
          (toc subitems [] 3 {:path-to-numbers path-to-numbers :heading? true})
-         (mapcat #(format-sexp (get subitems %) % 1 {:path-to-numbers path-to-numbers :with-toc? false}) (keys subitems))])]
-     (coverpage-verso date)]))
+         (mapcat #(format-sexp (get subitems %) % 1 {:path-to-numbers path-to-numbers :with-toc? false}) (keys subitems))])]]))

 (defn- logo []
   [:fo:block {:space-before "100mm" :text-align "right"}
@@ -726,7 +722,6 @@
     [:fo:root (style :font (root-attrs))
      (layout-master-set date)
      (declarations title (or description title))
-     (coverpage-recto title date)
      [:fo:page-sequence {:master-reference "main"
                          :initial-page-number "1"
                          :language "de"}
@@ -739,8 +734,7 @@
                       "Filme mit Audiodeskription"]
                      date)
          (toc subitems [fmt] 1 {:heading? true})
-         (mapcat #(genre-sexp (get subitems %) fmt % 1 {:show-genre? false}) (keys subitems))])]
-     (coverpage-verso date)]))
+         (mapcat #(genre-sexp (get subitems %) fmt % 1 {:show-genre? false}) (keys subitems))])]]))

 (defmethod document-sexp :ludo
   [items fmt _ _ {:keys [description date]}]
@@ -748,7 +742,6 @@
     [:fo:root (style :font (root-attrs))
      (layout-master-set date)
      (declarations title (or description title))
-     (coverpage-recto title date)
      [:fo:page-sequence {:master-reference "main"
                          :initial-page-number "1"
                          :language "de"}
@@ -760,8 +753,7 @@
          (cover-page ["Spiele in der SBS"]
                      date)
          (toc subitems [fmt] 1 {:heading? true})
-         (mapcat #(genre-sexp (get subitems %) fmt % 1 {:show-genre? false}) (keys subitems))])]
-     (coverpage-verso date)]))
+         (mapcat #(genre-sexp (get subitems %) fmt % 1 {:show-genre? false}) (keys subitems))])]]))

 (defmethod document-sexp :taktilesbuch
   [items fmt _ _ {:keys [description date]}]
@@ -769,7 +761,6 @@
     [:fo:root (style :font (root-attrs))
      (layout-master-set date)
      (declarations title (or description title))
-     (coverpage-recto title date)
      [:fo:page-sequence {:master-reference "main"
                          :initial-page-number "1"
                          :language "de"}
@@ -780,8 +771,7 @@
         [:fo:flow {:flow-name "xsl-region-body"}
          (cover-page [title] date)
          (toc subitems [fmt] 1 {:heading? true})
-         (mapcat #(genre-sexp (get subitems %) fmt % 1 {}) (keys subitems))])]
-     (coverpage-verso date)]))
+         (mapcat #(genre-sexp (get subitems %) fmt % 1 {}) (keys subitems))])]]))

 (defmethod document-sexp :all-formats
   [items _ _ _ {:keys [description date]}]


Add the title of the book to the alt text

This seems like the worst of all possible solutions. The recommendation
of a PDF a11y expert seems to imply that the alt-text should be empty,
but at the same time some content was needed to pass the a11y check
using their tool PAC 2.0.

--- src/catalog/layout/fop.clj
+++ src/catalog/layout/fop.clj
@@ -94,7 +94,12 @@
             (string/replace record-id "/" "."))))

 (defn- link-to-online-catalog [record-id title]
-  (external-link (to-url record-id) title "Link zum Online-Katalog"))
+  ;; FIXME: The use of the alt-text isn't quite clear. Apparently when
+  ;; using Acrobat Reader with the standard settings the screen reader
+  ;; will just read the alt text and not read the title. So we add the
+  ;; title to the alt-text.
+  (external-link (to-url record-id) title
+                 (format "%s (Link zum Online-Katalog)" title)))

 (defn- block [& args]
   (cond


[#6042] [desktop] fix Caret position is changed when typing fast in input message field

--- src/status_im/ui/screens/desktop/main/chat/views.cljs
+++ src/status_im/ui/screens/desktop/main/chat/views.cljs
@@ -189,6 +189,17 @@
                     :current-public-key current-public-key)]))]]
        [connectivity/error-view]])))

+(views/defview send-button [inp-ref]
+  (views/letsubs [{:keys [input-text]} [:get-current-chat]]
+    (let [empty? (= "" input-text)]
+      [react/touchable-highlight {:style    styles/send-button
+                                  :on-press (fn []
+                                              (.clear @inp-ref)
+                                              (.focus @inp-ref)
+                                              (re-frame/dispatch [:chat.ui/send-current-message]))}
+       [react/view {:style (styles/send-icon empty?)}
+        [icons/icon :icons/arrow-left {:style (styles/send-icon-arrow empty?)}]]])))
+
 (views/defview chat-text-input [chat-id input-text]
   (views/letsubs [inp-ref (atom nil)]
     {:should-component-update
@@ -197,7 +208,7 @@
        (not= old-chat-id new-chat-id))}
     (let [component               (reagent/current-component)
           set-container-height-fn #(reagent/set-state component {:container-height %})
-          {:keys [container-height empty?] :or {empty? true}} (reagent/state component)]
+          {:keys [container-height]} (reagent/state component)]
       [react/view {:style (styles/chat-box container-height)}
        [react/text-input {:placeholder            (i18n/label :t/type-a-message)
                           :auto-focus             true
@@ -220,15 +231,8 @@
                           :on-change              (fn [e]
                                                     (let [native-event (.-nativeEvent e)
                                                           text         (.-text native-event)]
-                                                      (reagent/set-state component {:empty? (= "" text)})
                                                       (re-frame/dispatch [:chat.ui/set-chat-input-text text])))}]
-       [react/touchable-highlight {:style    styles/send-button
-                                   :on-press (fn []
-                                               (.clear @inp-ref)
-                                               (.focus @inp-ref)
-                                               (re-frame/dispatch [:chat.ui/send-current-message]))}
-        [react/view {:style (styles/send-icon empty?)}
-         [icons/icon :icons/arrow-left {:style (styles/send-icon-arrow empty?)}]]]])))
+       [send-button inp-ref]])))

 (views/defview chat-view []
   (views/letsubs [{:keys [input-text chat-id] :as current-chat} [:get-current-chat]]


removing references to code from docs

removing references to code from docs

--- libs/cloudlog/test/cloudlog/core_test.clj
+++ libs/cloudlog/test/cloudlog/core_test.clj
@@ -3,8 +3,6 @@
   (:use [cloudlog.core]))

 [[:chapter {:title "defrule: Rule Definition Macro" :tag "defrule"}]]
-"Definition:"
-[[:reference {:refer "cloudlog.core/defrule"}]]

 [[:section {:title "Simple Rules"}]]
 "`defrule` defines a Cloudlog rule.  Such a rule always starts with a **fact pattern**:
@@ -350,9 +348,6 @@
       => #{[1234 "World peace starts with a small Hello!"]
            [2345 "Foo goes into a Bar..."]})

-"Definition:"
-[[:reference {:refer "cloudlog.core/defclause"}]]
-
 [[:file {:src "libs/cloudlog/test/cloudlog/core_test_sim.clj"}]]
 [[:file {:src "libs/cloudlog/test/cloudlog/core_test_facttable.clj"}]]


page in app-state sometimes needs id

page in app-state sometimes needs id

--- src/chat/client/store.cljs
+++ src/chat/client/store.cljs
@@ -36,6 +36,7 @@
    :tags {s/Uuid app-schema/Tag}
    :groups {s/Uuid app-schema/Group}
    :page {:type s/Keyword
+          (s/optional-key :id) s/Uuid
           (s/optional-key :thread-ids) [s/Uuid]
           (s/optional-key :search-query) s/Str}
    :session (s/maybe {:user-id s/Uuid})


set bg colour the way react wants

set bg colour the way react wants

--- src/chat/client/views.cljs
+++ src/chat/client/views.cljs
@@ -27,7 +27,7 @@
         (apply dom/div #js {:className "tags"}
           (map (fn [tag]
                  (dom/div #js {:className "tag"
-                               :style #js {:background-color (helpers/tag->color tag)}}
+                               :style #js {:backgroundColor (helpers/tag->color tag)}}
                    (tag :name))) tags))))))

 (defn thread-view [thread owner]


fix message transform fns

fix message transform fns

--- src/braid/ui/views/message.cljs
+++ src/braid/ui/views/message.cljs
@@ -151,14 +151,16 @@

 (def extract-code-blocks
   (make-delimited-processor {:delimiter "```"
-                             :result-fn (partial [:code.prettyprint.multiline-code.lang-clj])}))
+                             :result-fn (fn [body]
+                                          [:code.prettyprint.multiline-code.lang-clj body])}))
 (def extract-code-inline
   (make-delimited-processor {:delimiter "`"
-                             :result-fn (partial [:code.prettyprint.inline-code.lang-clj])}))
+                             :result-fn (fn [body]
+                                          [:code.prettyprint.inline-code.lang-clj body])}))

 (def extract-emphasized
   (make-delimited-processor {:delimiter "*"
-                             :result-fn (partial [:strong.starred])}))
+                             :result-fn (fn [body] [:strong.starred body])}))

 (defn extract-urls


Add missing gen-class directive

Add missing gen-class directive

--- src/clj/cglossa/server.clj
+++ src/clj/cglossa/server.clj
@@ -12,7 +12,8 @@
             [ring.handler.dump :refer [handle-dump]]
             [prone.middleware :refer [wrap-exceptions]]
             [environ.core :refer [env]]
-            [org.httpkit.server :refer [run-server]]))
+            [org.httpkit.server :refer [run-server]])
+  (:gen-class))

 (deftemplate page
   (io/resource "index.html") [] [:body] (if is-dev? inject-devmode-html identity))


improvements to Whirlpool, Draco/Shinobi trace label additions

--- src/clj/game/cards-ice.clj
+++ src/clj/game/cards-ice.clj
@@ -184,7 +184,7 @@
    {:prompt "How many power counters?" :choices :credit :msg (msg "add " target " power counters")
     :effect (effect (set-prop card :counter target))
     :strength-bonus (req (or (:counter card) 0))
-    :abilities [{:label "Trace 2"
+    :abilities [{:label "Trace 2 - Give the Runner 1 tag and end the run"
                  :trace {:base 2 :msg "give the Runner 1 tag and end the run"
                          :effect (effect (tag-runner :runner 1) (end-run))}}]}

@@ -595,7 +595,7 @@
                  :trace {:base 1 :msg "do 1 net damage" :effect (effect (damage :net 1 {:card card}))}}
                 {:label "Trace 2 - Do 2 net damage"
                  :trace {:base 2 :msg "do 2 net damage" :effect (effect (damage :net 2 {:card card}))}}
-                {:label "Trace 3 - Do 3 net damage"
+                {:label "Trace 3 - Do 3 net damage and end the run"
                  :trace {:base 3 :msg "do 3 net damage and end the run"
                          :effect (effect (damage :net 3 {:card card}) (end-run))}}]}

@@ -739,7 +739,13 @@

    "Whirlpool"
    {:abilities [{:msg "prevent the Runner from jacking out"
-                 :effect (effect (trash card) (prevent-jack-out))}]}
+                 :effect (req (when (and (is-remote? (second (:zone card)))
+                                         (> (count (concat (:ices (card->server state card))
+                                                           (:content (card->server state card)))) 1))
+                                (prevent-jack-out state side))
+                              (trash state side card)
+                              (when (:run @state)
+                                (swap! state update-in [:run] #(assoc % :position (dec (:position run))))))}]}

    "Woodcutter"
    {:advanceable :while-rezzed


Start server with some actual data

Start server with some actual data

--- src/clj/skytwit/server.clj
+++ src/clj/skytwit/server.clj
@@ -165,6 +165,7 @@
 (defn start-ws-server
   [creds]
   (let [state (atom {})]
+    (start-listening-on-user! creds "gaverhae" state)
     (go-loop
       []
       (let [{[t b] :event} (<! ch-chsk)]


something

something

--- src/cljs/russyll/text.cljs
+++ src/cljs/russyll/text.cljs
@@ -46,7 +46,8 @@

 (defn text-by-model [t s m]
   (map
-    #(let [map-models (s % %)] (if (vector? map-models) (map-models m) map-models))
+    #(let [map-models (s % %)]
+      (if (vector? map-models) (map-models m) map-models))
     t))

 (defn update-map-r [d i s n]


WIP - Travail sur le bot en clojure pour CSB

--- clojure/codingame/competition/coders-strike-back/src/coders_strike_back/core.clj
+++ clojure/codingame/competition/coders-strike-back/src/coders_strike_back/core.clj
@@ -35,11 +35,12 @@
   (cond
     (> (Math/abs next-checkpoint-angle) 90) "0"
     (and (< next-checkpoint-distance 1000) (> (Math/abs next-checkpoint-angle) 30)) "0"
-    (< next-checkpoint-distance 600) "0"
-    (< 601 next-checkpoint-distance 800) "20"
-    (< 801 next-checkpoint-distance 1000) "40"
-    ;(< 1001 next-checkpoint-distance 1200) "60"
-    ;(< 1201 next-checkpoint-distance 1400) "80"
+    (and (< next-checkpoint-distance 1200) (> (Math/abs next-checkpoint-angle) 30)) "20"
+    (and (< next-checkpoint-distance 1500) (> (Math/abs next-checkpoint-angle) 30)) "40"
+    ;(< next-checkpoint-distance 799) "0"
+    ;(< 800 next-checkpoint-distance 1000) "20"
+    ;(< 1001 next-checkpoint-distance 1200) "40"
+    ;(< 1201 next-checkpoint-distance 1400) "60"
     ;(and (< next-checkpoint-distance 1200) (> (Math/abs next-checkpoint-angle) 45)) "0"
     ;(and (< next-checkpoint-distance 1500) (> (Math/abs next-checkpoint-angle) 60)) "50"
     ;(< next-checkpoint-distance 1000) "0"
@@ -56,7 +57,7 @@
 (defn compute-action [next-checkpoint-x next-checkpoint-y next-checkpoint-distance next-checkpoint-angle x y opponent-x opponent-y boost-used? game-loop-counter]
   (cond
     (and (not @boost-used?) (> @game-loop-counter 3) (< (Math/abs next-checkpoint-angle) 10) (> next-checkpoint-distance 4000)) (do (reset! boost-used? true) "BOOST")
-    (and (= @last-shield-usage 0) (> @game-loop-counter 10) (> @max-shield-usage 0) (< (distance opponent-x opponent-y x y) 650)) (do (reset! last-shield-usage 3) (swap! max-shield-usage dec-atom) "SHIELD")
+    (and (= @last-shield-usage 0) (> @game-loop-counter 10) (> @max-shield-usage 0) (< (distance opponent-x opponent-y x y) 1000)) (do (reset! last-shield-usage 3) (swap! max-shield-usage dec-atom) "SHIELD")
     true (compute-boost next-checkpoint-distance next-checkpoint-angle)))


Reload apps

Reload apps

--- src/clj/apoya/services/apps.clj
+++ src/clj/apoya/services/apps.clj
@@ -31,15 +31,18 @@
       (fs/create-dir container path)
       (with-open [is (.getInputStream jar-file entry)]
         (log/info container path)
-        (fs/put-any-blob container path is)))
+        (fs/put-any-blob container path is)))))
+
+(defn reload-entry [jar-file entry]
+  (let [parts (s/split (.getName entry) #"/")
+        [container & parts] parts
+        path (s/join "/" parts)]
     (if (and (= "classpath" container)
              (.endsWith path ".clj"))
       (let [nspace (-> path
                        (s/replace #".clj$" "")
                        (s/replace #"/" ".")
                        (symbol))]
-        (log/info "Removing namespace" nspace)
-        (remove-ns nspace)
         (log/info "Restoring namespace" nspace)
         (with-open [is (.getInputStream jar-file entry)]
           (eval (slurp is)))))))
@@ -55,9 +58,21 @@
         (catch Exception e
           (log/fatal e "Cannot load entry" full-path))))))

+(defn refresh-classpath [path]
+  (let [apps-path (:apps-path (cfg/apoya-config))
+        full-path (str apps-path "/" path)
+        file (-> full-path (io/file) (JarFile.))
+        file-entries (enumeration-seq (.entries file))]
+    (doseq [entry file-entries]
+      (try
+        (reload-entry file entry)
+        (catch Exception e
+          (log/fatal e "Cannot load entry" full-path))))))
+
 (defn deploy [path]
   (let [containers ["classpath" "sites"]]
     (doseq [c containers]
       (bstore/clear-container fs/sites-base c))
     (copy-contents path)
+    (refresh-classpath path)
     true))


implement Capstone

implement Capstone

--- src/clj/game/cards-hardware.clj
+++ src/clj/game/cards-hardware.clj
@@ -58,6 +58,26 @@
                                (gain state :runner :memory bonus :max-hand-size bonus))))))
       :leave-play (req (remove-watch state (keyword (str "brainchip" (:cid card))))
                        (lose state :runner :memory (runner-points @state) :max-hand-size (runner-points @state)))})
+
+   "Capstone"
+   {:abilities [{:req (req (> (count (:hand runner)) 0))
+                 :cost [:click 1]
+                 :effect (req (let [handsize (count (:hand runner))]
+                                (resolve-ability state side
+                                  {:prompt "Choose any number of cards to trash from your Grip"
+                                   :choices {:max handsize :req #(and (= (:side %) "Runner") (= (:zone %) [:hand]))}
+                                   :effect (req (let [trashed (count targets)
+                                                      remaining (- handsize trashed)]
+                                                  (doseq [c targets]
+                                                    (when (not (empty? (filter #(= (:title c) (:title %))
+                                                                               (all-installed state :runner))))
+                                                      (draw state side)))
+                                                  (trash-cards state side targets)
+                                                  (system-msg state side
+                                                    (str "spends [Click] to use Capstone to trash "
+                                                      (join ", " (map :title targets)) " and draw "
+                                                      (- (count (get-in @state [:runner :hand])) remaining) " cards"))))}
+                                 card nil)))}]}

    "Chop Bot 3000"
    {:abilities [{:msg (msg "trash " (:title target))


create config when not exists

create config when not exists

--- src/clj/iwaswhere_web/store.clj
+++ src/clj/iwaswhere_web/store.clj
@@ -44,6 +44,7 @@
     (try (edn/read-string (slurp conf-path))
          (catch Exception ex
            (do (log/warn "No config found -> copying from default.")
+               (fs/mkdirs f/data-path)
                (spit conf-path (with-out-str (pp/pprint default)))
                default)))))


put es-api and poll-interval in app-state

--- src/cljs/searchbot/widgets.cljs
+++ src/cljs/searchbot/widgets.cljs
@@ -7,13 +7,6 @@
             [cljs.core.async :refer [put! <! >! chan timeout]]
             [searchbot.charts :refer [es-chart]]
             ))
-
-
-(defn es-url [purpose]
-  (case purpose
-    :count "/es/stats_avc_30d/avc/_count"
-    :agg "/es/stats_avc_1d/avc/_search"
-    "/es"))

 (def poll-interval 30000)

@@ -26,28 +19,26 @@
         (recur (split-at 3 remainder) (concat result (list \,) group))))))

-(defn es-count []
+(defn es-count [api-url]
   (let [c (chan)]
-    (go (let [{{docCount :count} :body} (<! (http/get (es-url :count)))]
+    (go (let [{{docCount :count} :body} (<! (http/get api-url))]
           (>! c docCount)))
     c))

-(defn es-agg [url post-body]
+(defn es-agg [api-url post-body]
   (let [c (chan)]
-    (go (let [{agg :body} (<! (http/post url {:json-params
-                                              (-> post-body
-                                                  (assoc :search_type "count")
-;;                                                   (assoc :preference "_primary")
-                                                  )}))]
+    (go (let [{agg :body} (<! (http/post api-url
+                                         {:json-params
+                                          (-> post-body (assoc :search_type "count"))}))]
           (>! c agg)))
     c))

 (defcomponent header [app owner opts]
   (will-mount [_]
               (go (while true
-                    (let [docCount (<! (es-count))]
+                    (let [docCount (<! (es-count (-> app :es-api :count)))]
                       (om/update! app [:es-count] docCount))
-                    (<! (timeout poll-interval)))))
+                    (<! (timeout (or (-> app :poll-interval) poll-interval))))))
   (render [_]
           (html [:h3 (:header-text app) " with " (-> app :es-count str commify) " raw data in ES"])))

@@ -72,9 +63,7 @@
   (render [_]
           (html
            [:pre {:style {:font-size "8pt"}}
-            [:code.json (.stringify js/JSON (clj->js opts) nil 4)]]
-           ))
-  )
+            [:code.json (.stringify js/JSON (clj->js opts) nil 4)]])))

 (defcomponent agg-table [app owner opts]
   (render [this] (html [:.card.blue-grey.darken-1
@@ -121,7 +110,7 @@
   (will-mount [_]
               (go (while true
                     (let [agg-key (-> opts :agg-key keyword)
-                          agg-resp (<! (es-agg (or (:url opts) (es-url :agg))
+                          agg-resp (<! (es-agg (or (:url opts) (-> app :es-api :agg))
                                                (merge (:body opts)
                                                        {:query
                                                         {:filtered
@@ -130,25 +119,15 @@
 ;;                       (.log js/console (pr-str agg-key))
 ;;                       (.log js/console (pr-str agg-resp))
                       (om/update! app [:agg agg-key] agg-resp))
-                    (<! (timeout poll-interval)))))
+                    (<! (timeout (or (-> app :poll-interval) poll-interval))))))
   (render [_] (html [:.hide "Aggregator:" (-> opts :agg-key)])))

 ;;;;;;;;;;;;;;;;;;
 ;; meta components

-(defn fetch-meta [url]
-  (let [c (chan)]
-    (go (let [{body :body} (<! (http/get url))]
-          (>! c body)))
-    c))
-
 (defcomponent aggregators [app owner opts]
-;;   (will-mount [_]
-;;               (go (while true
-;;                     (let [{_aggs :aggregators} (<! (fetch-meta "/_aggregators"))]
-;;                       (om/update! app [:aggregators] _aggs))
-;;                     (<! (timeout poll-interval)))))
-  (render [_] (html [:div (for [agg (:aggregators app)] (om/build aggregator app {:opts agg}))])))
+  (render [_] (html [:div (for [agg (:aggregators app)]
+                            (om/build aggregator app {:opts agg}))])))

 (defn- get-component
   [widget-type]
@@ -181,16 +160,17 @@
            )])

 (defcomponent widgets [app owner opts]
-;;   (will-mount [_]
-;;               (go (while true
-;;                     (let [{_widgets :widgets} (<! (fetch-meta "/_widgets"))]
-;;                       (om/update! app [:widgets] _widgets))
-;;                     (<! (timeout poll-interval)))))
   (render [_] (html [:div (for [row (:widgets app)] (build-row app row))])))

 ;;;;;;;;;;;;;;;;
+
+(defn fetch-meta [url]
+  (let [c (chan)]
+    (go (let [{body :body} (<! (http/get url))]
+          (>! c body)))
+    c))

 (defn init-app-state
   [state]


Change home breadcrumb to an icon instead of text

--- src/cljs/todogo_cljs/views.cljs
+++ src/cljs/todogo_cljs/views.cljs
@@ -21,7 +21,7 @@
        [:div {:class "container"}
         [:div {:class "col-12 "}
          [:ul {:class "breadcrumb"}
-          [:li [:span "Home"]]]]
+          [:li [:span [:span {:class "fa fa-lg fa-home"}]]]]]
         [:div {:class "col-lg-4 col-md-4"}
          (c/create-todo-list-form @todo-list-title)
          (c/todo-lists @lists)]]
@@ -40,7 +40,7 @@
        [:div {:class "container"}
         [:div {:class "col-12 "}
          [:ul {:class "breadcrumb"}
-          [:li [:a {:href "#/"} "Home"]]
+          [:li [:a {:href "#/"} [:span {:class "fa fa-lg fa-home"}]]]
           [:li [:span (:title @todo-list)]]]]
         [:div {:class "col-lg-4 col-md-4 hidden-sm hidden-xs"}
          (c/create-todo-list-form @todo-list-title)
@@ -66,7 +66,7 @@
        [:div {:class "container"}
         [:div {:class "col-12 "}
          [:ul {:class "breadcrumb"}
-          [:li [:a {:href "#/"} "Home"]]
+          [:li [:a {:href "#/"} [:span {:class "fa fa-lg fa-home"}]]]
           [:li [:a {:href (str "#/lists/" (:id @todo-list))} (:title @todo-list)]]
           [:li [:span (:title @todo)]]]]
         [:div {:class "col-lg-4 col-md-4 hidden-sm hidden-xs"}


Added functions to allowed response types

--- src/compojure/http/response.clj
+++ src/compojure/http/response.clj
@@ -12,6 +12,7 @@

 (ns compojure.http.response
   (:use clojure.contrib.def)
+  (:import clojure.lang.IFn)
   (:import clojure.lang.IPersistentVector)
   (:import java.util.Map)
   (:import clojure.lang.ISeq)
@@ -20,19 +21,31 @@
   (:import java.net.URL)
   (:import clojure.lang.Keyword))

-(defn- merge-body
+(defn merge-bodies
+  "Merge the bodies of two responses together."
   [to from]
-  (if (and (string? to) (string? from))
-    (str to from)
-    (or to from)))
+  (if-let [from-body (:body from)]
+    (assoc to :body
+      (if (and (string? (:body to)) (string? from-body))
+        (str (:body to) from-body)
+        from-body))
+    to))
+
+(defn- merge-headers
+  "Merge headers from two responses together."
+  [to from]
+  (merge to (select-keys from [:headers])))

 (defn merge-response
   "Intelligently merge two response maps together."
   [to from]
-  (-> to
-    (merge from)
-    (assoc :headers (merge (:headers to) (:headers from)))
-    (assoc :body    (merge-body (:body to) (:body from)))))
+  (cond
+    (map? from)
+      (-> to (merge-headers from)
+             (merge-bodies from)
+             (merge (dissoc from :headers :body)))
+    (ifn? from)
+      (from to)))

 (defmulti response-from class)

@@ -73,6 +86,15 @@
   (if (not= kw :next)
     (response-from (str kw))))

+(defmethod response-from IFn
+  [func]
+  func)
+
+;; Don't treat keywords, maps or vectors as functions
+(prefer-method response-from Keyword IFn)
+(prefer-method response-from Map IFn)
+(prefer-method response-from IPersistentVector IFn)
+
 (defmethod response-from nil
   [_]
   {})
@@ -85,4 +107,4 @@
   "Create a new response map from a Clojure object, x."
   [x]
   (if-let [response (response-from x)]
-    (merge default-response response)))
+    (merge-response default-response response)))


Ensure `reactor/systems` is correctly alter-var-root’ed

--- src/containium/reactor.clj
+++ src/containium/reactor.clj
@@ -15,7 +15,7 @@

 ;;; Globals for REPL access. A necessary evil.

-(defonce systems nil)
+(defonce ^:redef systems nil)


Added typepatterns-matches/2

Added typepatterns-matches/2

--- damp.ekeko.aspectj.plugin/src/damp/ekeko/aspectj/assumptions.clj
+++ damp.ekeko.aspectj.plugin/src/damp/ekeko/aspectj/assumptions.clj
@@ -344,6 +344,25 @@
                                  (typepatterns-typepatterns|matched ?tail ?newsofar ?matched)]
                                 [(typepatterns-typepatterns|matched ?tail ?sofar ?matched)]))])))

+(defn
+  typepatterns-matches
+  ([?typepatterns ?matches]
+    (l/all
+      (v+ ?typepatterns)
+      (typepatterns-matches ?typepatterns [] ?matches)))
+  ([?typepatterns ?sofar ?matches]
+    (l/conda [(succeeds (empty? ?typepatterns))
+              (equals ?sofar (into [] (into #{} ?matches)))]
+             [(l/fresh [?head ?tail ?match ?newsofar ?additional]
+                       (equals ?head (first ?typepatterns))
+                       (equals ?tail (rest ?typepatterns))
+                       (findall ?match (type-type|pattern ?match ?head) ?additional)
+                       (equals ?newsofar (concat ?sofar ?additional))
+                       (typepatterns-typepatterns|matched ?tail ?newsofar ?matches))])))
+
+
+
+
 ;;Johan, I think this is what you were looking for, but I don't have the AJ code to test
 (defn
   oneOfViolation


Quote set clauses correctly

Quote set clauses correctly

--- src/aurora/compiler/datalog.clj
+++ src/aurora/compiler/datalog.clj
@@ -39,6 +39,7 @@
     -s `(list '~'-s '~(nth clause 1) (fn ~(nth clause 1) ~(nth clause 2)))
     ? `(list '~'? '~(nth clause 1) (fn ~(nth clause 1) ~(nth clause 2)))
     = `(list '~'= '~(nth clause 1)'~(nth clause 2) (fn ~(nth clause 2) ~(nth clause 3)))
+    set `(list '~'set '~(nth clause 1) '~(nth clause 2) ~@(map quote-clause (nthnext clause 3)))
     `'~clause))

 (defmacro rule [& clauses]


rename function: model-with-lexicon -> model-with-vocab-items

--- src/babel/italiano/grammar.cljc
+++ src/babel/italiano/grammar.cljc
@@ -776,8 +776,8 @@
                                  spec
                                  0 depth)}))})))

-(defn model-with-lexicon [input-lexicon filter-lexicon-fn model]
-  (let [input-lexicon (vocab-entry-to-lexeme input-lexicon)
+(defn model-with-vocab-items [vocab-items filter-lexicon-fn model]
+  (let [input-lexicon (map vocab-entry-to-lexeme vocab-items)
         synthetic-noun (edn2lexicon input-lexicon)
         new-lexicon (merge-with concat
                                 synthetic-noun


disable "essere" <_,[:cat :intensifier]>

--- src/babel/italiano/lexicon.cljc
+++ src/babel/italiano/lexicon.cljc
@@ -1068,29 +1068,29 @@

            ;; essere: intensifier
            ;; this is for e.g "essere più alto di quelle donne belle (to be taller than those beautiful women)"
-           (let [gender (atom :top)
-                 number (atom :top)
-                 subject (atom {:agr {:gender gender
-                                     :number number}
-                               :cat :noun})
-                 comp-pred (atom :top)
-                 comp-sem (atom
-                           {:activity false
-                            :pred comp-pred
-                            :discrete false})]
-             (unify
-              verb-subjective
-              essere-common
-              {:notes "essere-intensifer"
-               :synsem {:cat :verb
-                        :subcat {:1 subject
-                                 :2 {:cat :intensifier
-                                     :sem comp-sem
-                                     :subcat {:1 subject
-                                              :2 '()}}}
-                        :sem {:pred comp-pred
-                              :intensified true
-                              :obj comp-sem}}}))
+;           (let [gender (atom :top)
+;                 number (atom :top)
+;                 subject (atom {:agr {:gender gender
+;                                     :number number}
+;                               :cat :noun})
+;                 comp-pred (atom :top)
+;                 comp-sem (atom
+;                           {:activity false
+;                            :pred comp-pred
+;                            :discrete false})]
+;             (unify
+;              verb-subjective
+;              essere-common
+;              {:notes "essere-intensifer"
+;               :synsem {:cat :verb
+;                        :subcat {:1 subject
+;                                 :2 {:cat :intensifier
+;                                     :sem comp-sem
+;                                     :subcat {:1 subject
+;                                              :2 '()}}}
+;                        :sem {:pred comp-pred
+;                              :intensified true
+;                              :obj comp-sem}}}))

            (unify essere-common
                    verb-aux


Comment out flaky pipeline test for now.

--- integration-tests/apps/messaging/in_container/src/in_container/pipeline.clj
+++ integration-tests/apps/messaging/in_container/src/in_container/pipeline.clj
@@ -16,9 +16,10 @@
 (defn dollarizer [s]
   (.replace s "S" "$"))

-(defn sleeper [x]
-  (Thread/sleep 500)
-  x)
+(defn make-sleeper [ms]
+  (fn [x]
+    (Thread/sleep ms)
+    x))

 (deftest it-should-work
   (let [result-queue (random-queue)
@@ -44,12 +45,12 @@
     (msg/publish pl "gravybiscuit")
     (is (= "GRAVXBINipseyHu$$leCUIT" (msg/receive result-queue)))))

-(deftest it-should-work-with-concurrency
+#_(deftest it-should-work-with-concurrency
   (let [result-queue (random-queue)
         pl (pl/pipeline
             "concurrency"
             dollarizer
-            (pl/step sleeper :concurrency 10)
+            (pl/step (make-sleeper 500) :concurrency 10)
             :result-destination result-queue)]
     (dotimes [n 10]
       (msg/publish pl "hamboneS"))


Remove logging statement

Remove logging statement

--- src/cider_ci/repository/web.clj
+++ src/cider_ci/repository/web.clj
@@ -87,7 +87,6 @@
 ;##### project configuration ##################################################

 (defn get-project-configuration [request]
-  (logging/info request)
   (-> (try
         (when-let [content (project-configuration/build-project-configuration
                              (-> request :params :id))]


commiting before rebase

commiting before rebase

--- src/name_bazaar/ui/db.cljs
+++ src/name_bazaar/ui/db.cljs
@@ -24,8 +24,8 @@
 (def default-db
   (merge
     district0x.ui.db/default-db
-    ;development-config
-    production-config
+    development-config
+    ;production-config
     {:active-page (d0x-ui-utils/match-current-location constants/routes)
      :smart-contracts smart-contracts
      :now (t/now)
@@ -105,4 +105,4 @@

      :saved-searches {:offerings-search {}}
      :watched-names {:ens/records {} :order '()}
-     :infinite-list {:expanded-items {}}}))+     :infinite-list {:expanded-items {}}}))


better server msg functions

better server msg functions

--- src/net_ns/server/core.clj
+++ src/net_ns/server/core.clj
@@ -7,12 +7,23 @@
   "reg{options, :ns {nspublics}}: code-block")

 (defn parse-msg
-  ""
+  "parse a message, splitting it into its canonical three parts: type, options, function
+  Arguments:
+    msg - a string, the message sent to the nameserver
+  Returns:
+     - a vector of strings, [msg-type, options, f] ^net-ns-msg"
   [msg]
+  {:pre [(instance? java.lang.String msg)]}
   (let [type-pos (.indexOf msg "{")
         pos (.lastIndexOf msg ":")
         msg-type (subs msg 0 type-pos)
         options (cljs/trim (subs msg type-pos pos))
         f (cljs/trim (subs msg (inc pos)))]
-    [msg-type options f]))
+    (with-meta [msg-type options f] {:net-ns-msg true}))

+(defn msg-as-map
+  ""
+  [msg-vec]
+  {:pre [((meta msg-vec) :net-ns-msg)]}
+  (zipmap [:msg-type :options :f] msg-vec))
+


add id-sk and id-sk-origin to student2perf-asmt validation

--- src/oarlock/validation.clj
+++ src/oarlock/validation.clj
@@ -16,9 +16,11 @@
                :comps                    [s/Str]
                :credit-value-numerator   s/Int
                :credit-value-denominator s/Int}
-   :student2perf-asmt {:user  s/Str
-                       :task  s/Str
-                       :grade s/Bool}})
+   :student2perf-asmt {:id-sk           s/Str
+                       :id-sk-origin    s/Str
+                       :user            s/Str
+                       :task            s/Str
+                       :grade           s/Bool}})

 (defn validator
   [entity-type data]


Readability refactor for error codes

Readability refactor for error codes

--- plugin/src/leiningen/doo.clj
+++ plugin/src/leiningen/doo.clj
@@ -155,8 +155,9 @@
                   (doo.core/run-script js-env# ~compiler ~doo-opts)))))
          `(do (cljs.build.api/build
                 (apply cljs.build.api/inputs ~source-paths) ~compiler)
-              (let [rs# (map #(do (doo.core/print-env %)
-                                  (doo.core/run-script % ~compiler ~doo-opts))
-                             ~js-envs)
-                    exit-code# (if (some (comp not zero? :exit) rs#) 1 0)]
-                (System/exit exit-code#))))))))
+              (let [ok# (->> ~js-envs
+                          (map (fn [e#]
+                                 (doo.core/print-env e#)
+                                 (doo.core/run-script e# ~compiler ~doo-opts)))
+                          (every? (comp zero? :exit)))]
+                (System/exit (if ok# 0 1)))))))))


Restore help string for 'lein doo'

Restore help string for 'lein doo'

--- plugin/src/leiningen/doo.clj
+++ plugin/src/leiningen/doo.clj
@@ -189,10 +189,11 @@
   - watch-mode: either auto (default) or once\n

 All arguments are optional provided there is a corresponding default
-under :doo in the project.clj.")
+under :doo in the project.clj.\n")

 (defn ^{:doc help-string}
   doo
+  ([project] (lmain/info help-string))
   ([project & args]
    ;; FIX: execute in a try catch like the one in run-local-project
    (let [{:keys [watch-mode] :as cli} (args->cli args)


Reverse shell output

Reverse shell output

--- src/ui/core.cljs
+++ src/ui/core.cljs
@@ -1,7 +1,9 @@
 (ns ui.core
   (:require [figwheel.client :as fw :include-macros true]
             [reagent.core :as reagent :refer [atom]]
-            [clojure.string :as string]))
+            [clojure.string :as string :refer [split-lines]]))
+
+(defn join-lines [v] (string/join "\n" v))

 (enable-console-print!)

@@ -15,15 +17,16 @@

 (defonce proc (js/require "child_process"))

-(defn prepend-to-out [out]
-  (swap! shell-result (fn [v] (str out v))))
+(defn append-to-out [out]
+  (swap! shell-result str out))

 (defn run-process []
   (let [[cmd & args] (string/split @command #"\s")
         p (.spawn proc cmd (clj->js args))]
-    (.on p "error" prepend-to-out)
-    (.on (.-stderr p) "data" prepend-to-out)
-    (.on (.-stdout p) "data" prepend-to-out))
+    (.on p "error" (comp append-to-out
+                         #(str % "\n")))
+    (.on (.-stderr p) "data" append-to-out)
+    (.on (.-stdout p) "data" append-to-out))
   (reset! command ""))

 (defn root-component []
@@ -54,7 +57,7 @@
                             (.-value (.-target e))))
        :value @command
        :placeholder "type in shell command"}]]]
-   [:pre @shell-result]])
+   [:pre (join-lines (take 100 (reverse (split-lines @shell-result))))]])

 (reagent/render
   [root-component]


add more tests

add more tests

--- test/cljam/t_core.clj
+++ test/cljam/t_core.clj
@@ -56,10 +56,14 @@
         (slurp-bam-for-test temp-bam) =future=> test-sam-sorted-by-qname
         ))

-(with-state-changes [(before :facts (prepare-cache!))
+(with-state-changes [(before :facts (do (prepare-cache!)
+                                        (io/copy (io/file test-sorted-bam-file)
+                                                 (io/file temp-bam))))
                      (after  :facts (clean-cache!))]
   (fact "about index"
-        "TODO" =future=> nil))
+        (with-out-file temp-out (core/index [temp-bam])) => anything
+        (.exists (io/file (str temp-bam ".bai"))) => truthy
+        ))

 (with-state-changes [(before :facts (prepare-cache!))
                      (after  :facts (clean-cache!))]
@@ -68,12 +72,17 @@
         (slurp temp-out) => (slurp "test/resources/t_core.pileup")
         ))

-(with-state-changes [(before :facts (prepare-cache!))
+(with-state-changes [(before :facts (do (prepare-cache!)
+                                        (io/copy (io/file test-fa-file)
+                                                 (io/file temp-out))))
                      (after  :facts (clean-cache!))]
   (fact "about faidx"
-        "TODO" =future=> nil))
+        (with-out-file temp-out (core/faidx [temp-out])) => anything
+        (.exists (io/file (str temp-out ".fai"))) => truthy))

 (with-state-changes [(before :facts (prepare-cache!))
                      (after  :facts (clean-cache!))]
-  (fact "about dict"
-        "TODO" =future=> nil))
+  (let [temp-dict (str temp-dir "/out.dict")]
+    (fact "about dict"
+          (with-out-file temp-out (core/dict [test-fa-file temp-dict])) =future=> anything
+          (.exists (io/file temp-dict)) =future=> truthy)))


Fix file:////, file://///

Fix file:////, file://///

--- test/uio/test_uio.clj
+++ test/uio/test_uio.clj
@@ -1,6 +1,8 @@
 (ns uio.test-uio
   (:require [uio.uio :refer :all]
-            [uio.impl :refer [url->ext+s->s intercalate-with-dirs ensure-has-no-trailing-slash]]
+            [uio.impl :refer [ensure-has-no-trailing-slash
+                              intercalate-with-dirs
+                              url->ext+s->s]]
             [midje.sweet :refer :all])
   (:import (java.util.zip GZIPOutputStream)
            (org.apache.commons.compress.compressors CompressorStreamFactory)))
@@ -11,6 +13,13 @@
   (port          "foo://user@host:8080/some-dir/file.txt?arg=value") => 8080
   (path          "foo://user@host:8080/some-dir/file.txt?arg=value") => "/some-dir/file.txt"
   (path-no-slash "foo://user@host:8080/some-dir/file.txt?arg=value") => "some-dir/file.txt"
+
+  (normalize     "file:///")                                         => "file:///"
+  (normalize     "file:////")                                        => "file:///"
+  (normalize     "file://///")                                       => "file:///"
+  (normalize     "file://host/path/to")                              => "file://host/path/to"
+  (normalize     "file://host/path/to/")                             => "file://host/path/to/"
+  (normalize     "file://host/path/to//")                            => "file://host/path/to/"

   (ensure-has-no-trailing-slash "test")                              => "test"
   (ensure-has-no-trailing-slash "test/")                             => "test"
@@ -105,3 +114,5 @@
                                                          {:url "456/456/3.txt"}
                                                          {:url "456/5.txt"}
                                                          {:url "789.txt"}])
+
+(facts "Normalize works")


JGroups discovery support.

JGroups discovery support.

--- src/onyx/queue/hornetq.clj
+++ src/onyx/queue/hornetq.clj
@@ -10,6 +10,7 @@
              [org.hornetq.api.core HornetQNonExistentQueueException]
              [org.hornetq.api.core DiscoveryGroupConfiguration]
              [org.hornetq.api.core UDPBroadcastGroupConfiguration]
+             [org.hornetq.api.core JGroupsBroadcastGroupConfiguration]
              [org.hornetq.api.core.client HornetQClient]
              [org.hornetq.api.core.client ClientRequestor]
              [org.hornetq.api.core.management ManagementHelper]
@@ -35,7 +36,10 @@
     (HornetQClient/createServerLocatorWithHA gdc)))

 (defmethod connect-to-locator :jgroups
-  [event])
+  [{:keys [hornetq.jgroups/file hornetq.jgroups/channel-name]}]
+  (let [jgroups (JGroupsBroadcastGroupConfiguration. file channel-name)
+        gdc (DiscoveryGroupConfiguration. cluster-name refresh-timeout discovery-timeout jgroups)]
+    (HornetQClient/createServerLocatorWithHA gdc)))

 (defrecord HornetQClusteredConnection [opts]
   component/Lifecycle


Add clojure.tools.namespace to user deps.

--- .lein/profiles.clj
+++ .lein/profiles.clj
@@ -1,5 +1,6 @@
 {:user {:dependencies [[clj-stacktrace "0.2.5"]
                        [org.clojure/tools.trace "0.7.5"]
+                       [org.clojure/tools.namespace "0.2.3"]
                        [redl "0.1.0"]
                        [spyscope "0.1.3"]
                        [slamhound "1.3.3"]]
@@ -14,6 +15,7 @@
         :repl-options {:timeout 120000}
         :injections [(require '[redl core complete])
                      (require 'spyscope.core)
+                     (require 'clojure.tools.namespace)
                      (let [orig (ns-resolve (doto 'clojure.stacktrace require)
                                             'print-cause-trace)
                            new (ns-resolve (doto 'clj-stacktrace.repl require)


Update to ClojureScript 1.9.562

Update to ClojureScript 1.9.562

--- ClojureScript/replete/project.clj
+++ ClojureScript/replete/project.clj
@@ -7,7 +7,7 @@
                  [tailrecursion/cljson "1.0.7"]
                  [malabarba/lazy-map "1.1"]
                  [org.clojure/clojure "1.8.0"]
-                 [org.clojure/clojurescript "1.9.542"]
+                 [org.clojure/clojurescript "1.9.562"]
                  [org.clojure/test.check "0.9.1-SNAPSHOT"]] ; Clone and build test.check master (ref'd in script/build)
   :clean-targets ["out" "target"]
   :plugins [[lein-cljsbuild "1.1.5"]]


Updating mixer usage of adjustment-popup

--- src/overtone/gui/mixer.clj
+++ src/overtone/gui/mixer.clj
@@ -31,8 +31,8 @@
                                (button :text "M"
                                        :listen [:action mute-toggle]))
         solo-btn (border-panel :center (button :text "S"))]
-    (adjustment-popup-for volume-slider "Volume:")
-    (adjustment-popup-for pan-dial "Pan:")
+    (adjustment-popup :widget volume-slider :label "Volume:")
+    (adjustment-popup :widget pan-dial :label "Pan:")
     (bind/bind volume-slider
                (bind/transform (fn [v] (/ v 100.0)))
                (bind/b-do [v] (inst-volume ins v)))


That needs to be assoc-in not update-in

That needs to be assoc-in not update-in

--- src/oxcart/passes/defs.clj
+++ src/oxcart/passes/defs.clj
@@ -100,11 +100,11 @@
   [{:keys [modules] :as ast} options]
   (reduce
    (fn [ast module]
-     (update-in ast [module]
-                (-> module
-                    (locate-defs-in-module     options)
-                    (locate-publics-in-module  options)
-                    (locate-privates-in-module options)
-                    (locate-consts-in-module   options)
-                    (locate-dynamics-in-module options))))
+     (assoc-in ast [module]
+               (-> (get ast module)
+                   (locate-defs-in-module options)
+                   (locate-publics-in-module  options)
+                   (locate-privates-in-module options)
+                   (locate-consts-in-module   options)
+                   (locate-dynamics-in-module options))))
    ast modules))


Update serverbound

Update serverbound

--- src/packet_definitions.clj
+++ src/packet_definitions.clj
@@ -38,14 +38,17 @@
       :id 1
       :fields [{:name "transaction_id" :type "i32" :read "varint" :getter "Get the transaction ID"}
                {:name "location" :type "(i32, i32, i32)" :read "position" :getter "Get the X/Y/Z coords position"}]}
-    {:name "ChatMessage"
+     {:name "SetDifficulty"
       :id 2
+      :fields [{:name "new_difficulty" :type "u8" :getter "Get the new difficulty"}]}
+     {:name "ChatMessage"
+      :id 3
       :fields [{:name "message" :type "String" :getter "Get the chat message (not json)"}]}
      {:name "ClientStatus"
-      :id 3
+      :id 4
       :fields [{:name "action" :type "i32" :read "varint" :getter "Get the action ID varint enum"}]}
      {:name "ClientSettings"
-      :id 4
+      :id 5
       :fields [{:name "locale" :type "String" :getter "Get the client's locale"}
                {:name "view_distance" :type "u8" :getter "Get the client's view distance in chunks"}
                {:name "chat_mode" :type "i32" :read "varint" :getter "Get the client's chat mode as varint enum"}
@@ -53,20 +56,20 @@
                {:name "displayed_skin_parts" :type "u8" :getter "Get the displayed skin parts as a raw bit mask"}
                {:name "main_hand" :type "i32" :read "varint" :getter "Get the player's main hand as a varint enum"}]}
      {:name "TabComplete"
-      :id 5
+      :id 6
       :fields [{:name "transaction_id" :type "i32" :read "varint" :getter "Get the transaction ID"}
                {:name "text" :type "String" :getter "Get the text behind the cursor"}]}
      {:name "ConfirmTransaction"
-      :id 6
+      :id 7
       :fields [{:name "window_id" :type "u8" :getter "Get the window id"}
                {:name "id" :type "i16" :getter "Get the action number"}
                {:name "accepted" :type "bool" :getter "Get whether the action was accepted"}]}
      {:name "EnchantItem"
-      :id 7
+      :id 8
       :fields [{:name "window_id" :type "u8" :getter "Get the window id"}
                {:name "enchantment" :type "i8" :getter "Get the position of the chosen enchantment"}]}
      {:name "ClickWindow"
-      :id 8
+      :id 9
       :fields [{:name "window_id" :type "u8" :getter "Get the window id"}
                {:name "slot_id" :type "i16" :getter "Get the clicked slot number"}
                {:name "button" :type "i8" :getter "Get the button clicked byte enum"}
@@ -74,40 +77,40 @@
                {:name "mode" :type "i32" :read "varint" :getter "Get the action/mode"}
                {:name "slot" :type "Vec<u8>" :read "bytearray" :getter "Get the raw unprocessed slot data"}]}
      {:name "CloseWindow"
-      :id 9
+      :id 10
       :fields [{:name "window_id" :type "u8" :getter "Get the window id"}]}
      {:name "PluginMessage"
-      :id 10
+      :id 11
       :fields [{:name "channel" :type "String" :getter "Get the channel"}
                {:name "data" :type "Vec<u8>" :read "bytearray" :getter "Get the data"}]}
      {:name "EditBook"
-      :id 11
+      :id 12
       :fields [{:name "data" :type "Vec<u8>" :read "bytearray_to_end" :getter "Get the raw data contained in this packet. The first field in the packet is NBT slot data, and therefore we cannot parse the remaining data without parsing the NBT."}]}
      {:name "QueryEntityNBT"
-      :id 12
+      :id 13
       :fields [{:name "transaction_id" :type "i32" :read "varint" :getter "Get the transaction ID"}
                {:name "entity_id" :type "i32" :read "varint" :getter "Get the entity ID"}]}
      {:name "UseEntity"
-      :id 13
+      :id 14
       :automatic-serialize false
       :fields [{:name "target" :type "i32" :read "varint" :getter "Get the target eid"}
                {:name "action" :type "i32" :read "varint" :getter "Get the action type varint enum"}
                {:name "location" :type "Option<(f32, f32, f32)>" :getter "Get the target location (if any)"}
                {:name "hand" :type "Option<i32>" :getter "Get the hand used as a varint enum (if any)"}]}
      {:name "KeepAlive"
-      :id 14
+      :id 15
       :fields [{:name "id" :type "i64" :getter "Get the keep alive ID"}]}
-      {:name "Player"
-      :id 15
-      :fields [{:name "on_ground" :type "bool" :getter "Get whether on the ground"}]}
+     {:name "LockDifficulty"
+      :id 16
+      :fields [{:name "locked" :type "bool" :getter "Get whether or not the difficulty is locked"}]}
      {:name "PlayerPosition"
-      :id 16
+      :id 17
       :fields [{:name "x" :type "f64" :getter "Get the X coordinate"}
                {:name "y" :type "f64" :getter "Get the Y coordinate (feet)"}
                {:name "z" :type "f64" :getter "Get the Z coordinate"}
                {:name "on_ground" :type "bool" :getter "Get whether on the ground"}]}
      {:name "PlayerPositionAndLook"
-      :id 17
+      :id 18
       :fields [{:name "x" :type "f64" :getter "Get the X coordinate"}
                {:name "y" :type "f64" :getter "Get the Y coordinate"}
                {:name "z" :type "f64" :getter "Get the Z coordinate"}
@@ -115,91 +118,100 @@
                {:name "pitch" :type "f32" :getter "Get the pitch"}
                {:name "on_ground" :type "bool" :getter "Get whether on the ground"}]}
      {:name "PlayerLook"
-      :id 18
+      :id 19
       :fields [{:name "yaw" :type "f32" :getter "Get the yaw"}
                {:name "pitch" :type "f32" :getter "Get the pitch"}
                {:name "on_ground" :type "bool" :getter "Get whether on the ground"}]}
+     {:name "Player"
+      :id 20
+      :fields [{:name "on_ground" :type "bool" :getter "Get whether on the ground"}]}
      {:name "VehicleMove"
-      :id 19
+      :id 21
       :fields [{:name "x" :type "f64" :getter "Get the (absolute) X coordinate"}
                {:name "y" :type "f64" :getter "Get the (absolute) Y coordinate"}
                {:name "z" :type "f64" :getter "Get the (absolute) Z coordinate"}
                {:name "yaw" :type "f32" :getter "Get the (absolute) yaw"}
                {:name "pitch" :type "f32" :getter "Get the (absolute) pitch"}]}
      {:name "SteerBoat"
-      :id 20
+      :id 22
       :fields [{:name "right" :type "bool" :getter "Get whether the right paddle is turning"}
                {:name "left" :type "bool" :getter "Get whether the left paddle is turning"}]}
      {:name "PickItem"
-      :id 21
+      :id 23
       :fields [{:name "slot_to_use" :type "i32" :read "varint" :getter "Get the slot to use"}]}
      {:name "CraftRecipeRequest"
-      :id 22
+      :id 24
       :fields [{:name "window_id" :type "u8" :getter "Get the window ID"}
                {:name "recipe" :type "i32" :getter "Get the recipe ID" :read "varint"}
                {:name "make_all" :type "bool" :getter "Get if shift was down when the item was clicked"}]}
      {:name "PlayerAbilities"
-      :id 23
+      :id 25
       :fields [{:name "flags" :type "u8" :getter "Get the raw player abilities bit mask"}
                {:name "flying_speed" :type "f32" :getter "Get the player's flying speed"}
                {:name "walking_speed" :type "f32" :getter "Get the player's walking speed"}]}
      {:name "PlayerDigging"
-      :id 24
+      :id 26
       :fields [{:name "status" :type "i32" :read "varint" :getter "Get the status as a raw varint enum"}
                {:name "location" :type "(i32, i32, i32)" :read "position" :getter "Get the location of the block"}
                {:name "face" :type "u8" :getter "Get the face of the block being hit as a raw byte enum"}]}
 {:name "EntityAction"
- :id 25
+ :id 27
  :fields [{:name "entity_id" :type "i32" :read "varint" :getter "Get the player's eid"}
           {:name "action" :type "i32" :read "varint" :getter "Get the action as a raw varint enum"}
           {:name "jump_boost" :type "i32" :read "varint" :getter "Get the jump boost, used if the player is riding a horse"}]}
 {:name "SteerVehicle"
- :id 26
+ :id 28
  :fields [{:name "sideways" :type "f32" :getter "Get the sideways movement, positiev is to the left of the player"}
           {:name "forward" :type "f32" :getter "Get the forward movement"}
           {:name "flags" :type "u8" :getter "Get the raw flags byte enum"}]}
 {:name "RecipeBookData"
-:id 27
+:id 29
 :automatic-serialize false
 :fields [{:name "displayed_recipe" :type "Option<String>" :getter "Get the displayed recipe if packet is type 0"}
          {:name "recipe_book_states" :type "Option<(bool, bool, bool, bool)>" :getter "Get whether crafting recipe book is open, crafting recipe filter is active, smelting recipe book is open, and smelting recipe filter is active if packet is type 1."}]}
 {:name "NameItem"
- :id 28
+ :id 30
  :fields [{:name "name" :type "String" :getter "Get the new name of the item"}]}
 {:name "ResourcePackStatus"
- :id 29
+ :id 31
  :fields [{:name "result" :type "i32" :read "varint" :getter "Get the result as a raw varint enum"}]}
 {:name "AdvancementTab"
- :id 30
+ :id 32
  :automatic-serialize false
  :fields [{:name "tab_id" :type "Option<String>" :getter "Get Some(Tab ID) if the action was to open a tab, and None else"}]}
 {:name "SelectTrade"
- :id 31
+ :id 33
  :fields [{:name "selected_slot" :type "i32" :read "varint" :getter "Get the selected slot in the players inventory."}]}
 {:name "SetBeaconEffect"
- :id 32
+ :id 34
  :fields [{:name "primary_effect" :type "i32" :read "varint" :getter "Get the potion ID of the primary effect."}
           {:name "secondary_effect" :type "i32" :read "varint" :getter "Get the potion ID of the secondary effect."}]}
 {:name "HeldItemChange"
- :id 33
+ :id 35
  :fields [{:name "slot" :type "i16" :getter "Get the slot the player has selected"}]}
 {:name "UpdateCommandBlock"
- :id 34
+ :id 36
  :fields [{:name "location" :type "(i32, i32, i32)" :read "position" :getter "Get the position"}
           {:name "command" :type "String" :getter "Get the new string"}
 	  {:name "mode" :type "i32" :read "varint" :getter "Get the mode (enum)"}
 	  {:name "flags" :type "u8" :getter "Get the bitarray of flags"}]}
 {:name "UpdateCommandBlockMinecart"
- :id 35
+ :id 37
  :fields [{:name "id" :type "i32" :read "varint" :getter "Get the entity ID"}
           {:name "command" :type "String" :getter "Get the new string"}
 	  {:name "track_output" :type "bool" :getter "Get whether to store the output of the previous command"}]}
 {:name "CreativeInventoryAction"
- :id 36
+ :id 38
  :fields [{:name "slot_id" :type "i16" :getter "Get the inventory slot number"}
           {:name "slot" :type "Vec<u8>" :read "bytearray" :getter "Get the raw unprocessed slot data"}]}
+{:name "UpdateJigsawBlock"
+ :id 39
+ :fields [{:name "location" :type "(i32, i32, i32)" :getter "Get the block entity location" :read "position"}
+         {:name "attachment_type" :type "String" :getter "Get the attachment type identifier"}
+         {:name "target_pool" :type "String" :getter "Get the target pool identifier"}
+         {:name "final_state" :type "String"}]}
 {:name "UpdateStructureBlock"
- :id 37
+ :id 40
  :fields [{:name "location" :type "(i32, i32, i32)" :read "position" :getter "Get the block entity position"}
           {:name "action" :type "i32" :read "varint" :getter "Get the action (enum)"}
 	  {:name "mode" :type "i32" :read "varint" :getter "Get the mode (enum)"}
@@ -217,28 +229,29 @@
 	  {:name "seed" :type "i64" :read "varlong" :getter "Get the seed"}
 	  {:name "flags" :type "u8" :getter "Get the flags bitarray"}]}
 {:name "UpdateSign"
- :id 38
+ :id 41
  :fields [{:name "location" :type "(i32, i32, i32)" :read "position" :getter "Get the block coordinates"}
           {:name "line1" :type "String" :getter "Get line 1"}
           {:name "line2" :type "String" :getter "Get line 2"}
           {:name "line3" :type "String" :getter "Get line 3"}
           {:name "line4" :type "String" :getter "Get line 4"}]}
 {:name "Animation"
- :id 39
+ :id 42
  :fields [{:name "hand" :type "i32" :read "varint" :getter "Get which arm was used as a raw varint enum"}]}
 {:name "Spectate"
- :id 40
+ :id 43
  :fields [{:name "target" :type "u128" :getter "Get the uuid of the selected target"}]}
 {:name "PlayerBlockPlacement"
- :id 41
- :fields [{:name "location" :type "(i32, i32, i32)" :read "position" :getter "Get the location of the placed block"}
+ :id 44
+ :fields [{:name "hand" :type "i32" :read "varint" :getter "Get the hand from which the block was placed as a raw varint enum"}
+          {:name "location" :type "(i32, i32, i32)" :read "position" :getter "Get the location of the placed block"}
           {:name "face" :type "i32" :read "varint" :getter "Get the face of the block as a raw varint enum"}
-          {:name "hand" :type "i32" :read "varint" :getter "Get the hand from which the block was placed as a raw varint enum"}
           {:name "x" :type "f32" :getter "Get the X position of the crosshair on the block"}
           {:name "y" :type "f32" :getter "Get the Y position of the crosshair on the block"}
-          {:name "z" :type "f32" :getter "Get the Z position of the crosshair on the block"}]}
+          {:name "z" :type "f32" :getter "Get the Z position of the crosshair on the block"}
+          {:name "inside_block" :type "bool" :getter "True when the player's head is inside of a block"}]}
 {:name "UseItem"
- :id 42
+ :id 45
  :fields [{:name "hand" :type "i32" :read "varint" :getter "Get which hand contained the used item as a raw varint enum"}]}]}
 :clientbound
 {"Handshake" []


accurancy signature: sample-spieltage instead of samplesize

--- src/paulkrake/crossval.clj
+++ src/paulkrake/crossval.clj
@@ -125,21 +125,22 @@
           olb (optimal-lookback s2 t2 lookback metric-fn metric-merge-fn)]
       (g/predict-result s t olb))))

-(defn accurancy [samplesize lookback metric-merge-fn metric-fn]
+(defn accurancy [sample-spieltage lookback metric-merge-fn metric-fn]
   (let [pf (predict-fn-factory lookback metric-merge-fn metric-fn)]
-    (as-> (dc/sample-of-spieltage 1617 8 958 samplesize) x
+    (as-> sample-spieltage x
       (map (fn [st]
              (let [[s t] st
                    p (measure (dc/spieltag s t) (pf s t) metric-kickerpoints )]
                p)) x)
       (apply + x)
-      (double (/ x samplesize)))))
+      (double (/ x (count sample-spieltage))))))

 (comment
   (def accurancy-evaluation
-    (for [l (range 1 10)
-          mf [metric-kickerpoints metric-distance]
-          mvf [+ median]]
-      [[l mf mvf] (accurancy 50 l mvf mf )]))
+    (let [sample (dc/sample-of-spieltage 1415 34 900 200)]
+      (for [l (range 1 10)
+            mf [metric-kickerpoints metric-distance]
+            mvf [+ median]]
+        [[l mf mvf] (accurancy sample l mvf mf )])))
 )


Remove unnecessary let.

Remove unnecessary let.

--- src/podload/downloader.clj
+++ src/podload/downloader.clj
@@ -51,17 +51,17 @@
    brutally removes any tags (because mp3agic was puking on NotSupportedExceptions),
    copies infile to outfile, and adds the album tag to it"
   [infile outfile album-name]
-  (let [f (Mp3File.  infile)]
+  (let [f (Mp3File.  infile)
+        t (ID3v24Tag.)]
     (when (.hasId3v1Tag f)
       (.removeId3v1Tag f))
     (when (.hasId3v2Tag f)
       (.removeId3v2Tag f))
     (when (.hasCustomTag f)
       (.removeCustomTag f))
-    (let [t (ID3v24Tag.)]
-      (.setId3v2Tag f t)
-      (.setAlbum t album-name)
-      (.save f outfile))))
+    (.setId3v2Tag f t)
+    (.setAlbum t album-name)
+    (.save f outfile)))

 (defn do-everything!


Alia: Set a 5 seconds reconnection policy by default

--- systems/cassandra-alia/src/containium/systems/cassandra/alia.clj
+++ systems/cassandra-alia/src/containium/systems/cassandra/alia.clj
@@ -5,6 +5,7 @@
 (ns containium.systems.cassandra.alia
   "The Alia 2 implementation of the Cassandra system."
   (:require [qbits.alia :as alia]
+            [qbits.alia.policy.reconnection :refer (constant-reconnection-policy)]
             [containium.systems :refer (require-system Startable Stoppable)]
             [containium.systems.config :as config :refer (Config)]
             [containium.systems.cassandra :refer (Cassandra cql-statements)]
@@ -84,6 +85,10 @@
   (reify Startable
     (start [_ systems]
       (let [config (config/get-config (require-system Config systems) config-key)
+            config (if-not (:reconnection-policy config)
+                     (assoc config :reconnection-policy (constant-reconnection-policy 5))
+                    ;else
+                     config)
             logger (require-system SystemLogger systems)
             _ (info logger "Starting Alia 2 system, using config:" config)
             cluster (alia/cluster config)


more output to find the flakyness

more output to find the flakyness

--- backend/test/lambdaui/api_integration_test.clj
+++ backend/test/lambdaui/api_integration_test.clj
@@ -34,7 +34,11 @@
                                  steps (:steps build-details)
                                  first-substep (comp first :steps)]

+                             (println "build-details: ")
                              (clojure.pprint/pprint build-details)
+                             (println "(first-substep (first-substep build-details))")
+                             (clojure.pprint/pprint (first-substep (first-substep build-details)))
+
                              (is (= 1 (count steps)))
                              (is (= [:stepId :name :state :startTime :endTime :type :steps :trigger]
                                     (keys (first-substep (first-substep build-details)))))))))))


CMR-1700: Removed newline

CMR-1700: Removed newline

--- bootstrap-app/src/cmr/bootstrap/api/routes.clj
+++ bootstrap-app/src/cmr/bootstrap/api/routes.clj
@@ -154,7 +154,6 @@
         (POST "/" {:keys [request-context params]}
           (bootstrap-virtual-products request-context params)))

-
       ;; Add routes for managing jobs.
       (common-routes/job-api-routes)


Fix scale transform

Fix scale transform

--- renderer/src/renderer/engine/shaders.cljs
+++ renderer/src/renderer/engine/shaders.cljs
@@ -197,8 +197,8 @@
   }

   void main() {
-      fpos = ((position.xyz - offset) * xyzScale);
-      vec4 wpos = modelMatrix * vec4(fpos, 1.0);
+      fpos = (position.xyz - offset);
+      vec4 wpos = (modelMatrix * vec4(fpos, 1.0)) * vec4(xyzScale, 1.0);

       vec4 mvPosition = modelViewMatrix * wpos;
       gl_Position = projectionMatrix * mvPosition;


fix chat color

fix chat color

--- src-cljs/frontend/controllers/controls.cljs
+++ src-cljs/frontend/controllers/controls.cljs
@@ -695,7 +695,7 @@
 (defmethod post-control-event! :chat-submitted
   [browser-state message _ previous-state current-state]
   (let [db (:db current-state)
-        client-uuid (:client-uuid previous-state)
+        client-uuid (str (:client-uuid previous-state))
         color (get-in previous-state [:subscribers client-uuid :color])]
     (d/transact! db [{:chat/body (get-in previous-state [:chat :body])
                       :chat/color color


screen option to set browser window dimension

--- src/sparkledriver/core.clj
+++ src/sparkledriver/core.clj
@@ -25,6 +25,8 @@
    ;; store copies of media and attachments in a temporary folder
    :save-attachments  [true #(.saveAttachments %1 %2)]
    :save-media?       [true #(.saveMedia %1 %2)]
+   ;; set browser screen dimentions - 1000x600 is the JBrowserdriver default
+   :screen            [[1000 600] #(.screen (org.openqa.selenium.Dimension. %1) %2)]
    ;; be accepting of weird SSL certs
    :ssl-policy        ["compatible" #(.ssl %1 %2)]
    :timezone          [com.machinepublishers.jbrowserdriver.Timezone/AMERICA_NEWYORK #(.timezone %1 %2)]


logging and whitespace

logging and whitespace

--- src/babel/francais/morphology.cljc
+++ src/babel/francais/morphology.cljc
@@ -44,28 +44,33 @@
   "Conjugate an infinitive into a surface form by taking the first
    element of replace-patterns where the element's :u unifies successfully with
    unify-with."
-  (first
-   (take 1
-         (remove #(nil? %)
-                 (map
-                  (fn [replace-pattern]
-                    (let [from (nth (:g replace-pattern) 0)
-                          to (nth (:g replace-pattern) 1)
-                          unify-against (if (:u replace-pattern)
-                                          (:u replace-pattern)
-                                          :top)]
-                      (if (and from to
-                               (re-matches from infinitive)
-                               (not (fail? (unifyc unify-against
-                                                   unify-with))))
-                        (do
-                          (log/debug (str "matched infinitive: " infinitive))
-                          (log/debug (str "from: " from))
-                          (log/debug (str "to: " to))
-                          (log/debug (str "input spec: " (strip-refs unify-with)))
-                          (log/debug (str "pattern spec:"  (strip-refs unify-against)))
-                          (string/replace infinitive from to)))))
-                  replace-patterns)))))
+  (let [result
+        (take 1
+              (remove #(nil? %)
+                      (map
+                       (fn [replace-pattern]
+                         (let [from (nth (:g replace-pattern) 0)
+                               to (nth (:g replace-pattern) 1)
+                               unify-against (if (:u replace-pattern)
+                                               (:u replace-pattern)
+                                               :top)]
+                            (if (and from to
+                                     (re-matches from infinitive)
+                                     (not (fail? (unifyc unify-against
+                                                         unify-with))))
+                              (do
+                                (log/debug (str "matched infinitive: " infinitive))
+                                (log/debug (str "from: " from))
+                                (log/debug (str "to: " to))
+                                (log/debug (str "input spec: " (strip-refs unify-with)))
+                                (log/debug (str "pattern spec:"  (strip-refs unify-against)))
+                                (string/replace infinitive from to)))))
+                        replace-patterns)))]
+    (if (empty? result)
+      (throw (Exception. (str "nothing found to match infinitive: " infinitive " ; "
+                              " unify-with: " unify-with ".")))
+
+      (first result))))

 ;; TODO: separate part-of-speech -related functionality (e.g. the word is a verb) from
 ;; compositional functionality (e.g. the word has an :a and :b, so combine by concatenation, etc)
@@ -77,7 +82,7 @@
           (if (string? result)
             (trim result)
             result))
-
+
         ;; je + aime = j'aime
         (and (not (nil? b))
              (not (nil? (get-string b)))
@@ -91,7 +96,10 @@
         ;; (elle) la + est (amuseé) = (elle) l'est (amuseé)
         (and (not (nil? b))
              (let [a (get-string word)
-                   b (get-string b)]
+                   b-str (get-string b)
+                   debug (if (nil? b-str)
+                           (throw (Exception. (str "get-string=nil for b: " (strip-refs b)))))
+                   b b-str]
                (and (re-find #"^(la|le|me|se|te)$" a) ;;
                     (re-find #"^[aeéiou]" b))))
         (let [a (get-string word)]
@@ -109,7 +117,7 @@

         (nil? word)
         nil
-
+
         (seq? word)
         (map (string/join " " #(get-string %))
              word)
@@ -127,38 +135,38 @@
           (log/debug (str "word's :a french is a string? " (get-in word '(:a :français)) " => " (string? (get-in word '(:a :français)))))

           (cond
-           (= word :top) ".."
-
-           (ref? word)
-           (get-string @word)
-
-           ;; TODO: this is a special case that should be handled below instead
-           ;; of forcing every input to go through this check.
-           (= word {:initial false})
-           ".."
-           (= word {:initial true})
-           ".."
-
-           (and (string? (get-in word '(:a)))
-                (string? (get-in word '(:b))))
-           (get-string (get-in word '(:a))
-                       (get-in word '(:b)))
-
-           (and (string? (get-in word '(:a)))
-                (map? (get-in word '(:b))))
-           (get-string (get-in word '(:a))
-                       (get-in word '(:b)))
-
-           (and (map? (get-in word '(:a)))
-                (map? (get-in word '(:b))))
-           (get-string
-            (get-in word '(:a))
-            (get-in word '(:b)))
-
-           ;; TODO: this rule is pre-empting all of the following rules
-           ;; that look in :a and :b. Either remove those following rules
-           ;; if they are redundant and not needed, or move this general rule
-           ;; below the following rules.
+            (= word :top) ".."
+
+            (ref? word)
+            (get-string @word)
+
+            ;; TODO: this is a special case that should be handled below instead
+            ;; of forcing every input to go through this check.
+            (= word {:initial false})
+            ".."
+            (= word {:initial true})
+            ".."
+
+            (and (string? (get-in word '(:a)))
+                 (string? (get-in word '(:b))))
+            (get-string (get-in word '(:a))
+                        (get-in word '(:b)))
+
+            (and (string? (get-in word '(:a)))
+                 (map? (get-in word '(:b))))
+            (get-string (get-in word '(:a))
+                        (get-in word '(:b)))
+
+            (and (map? (get-in word '(:a)))
+                 (map? (get-in word '(:b))))
+            (get-string
+             (get-in word '(:a))
+             (get-in word '(:b)))
+
+            ;; TODO: this rule is pre-empting all of the following rules
+            ;; that look in :a and :b. Either remove those following rules
+            ;; if they are redundant and not needed, or move this general rule
+            ;; below the following rules.
            (and (not (= :none (get-in word '(:a) :none)))
                 (not (= :none (get-in word '(:b) :none))))
            (get-string (get-in word '(:a))
@@ -173,7 +181,7 @@
            (str (string/trim (get-in word '(:a :français)))
                 " "
                 (string/trim (get-in word '(:b :français))))
-
+
            (and
             (string? (get-in word '(:a)))
             (string? (get-in word '(:b :français)))
@@ -183,7 +191,7 @@
            (str (string/trim (get-in word '(:a)))
                 " "
                 (string/trim (get-in word '(:b :français))))
-
+
            (and
             (string? (get-in word '(:a :français)))
             (get-in word '(:a :français))
@@ -216,12 +224,12 @@
                                       true
                                       (get-in word [:français]))]
                  (conjugate infinitive word))))
-
+
            (and
             (= (get-in word '(:infl)) :imperfect)
             (string? (get-in word '(:français))))
            (verbs/imperfect word)
-
+
            (= (get-in word '(:infl)) :past-p)
            (cond (get-in word [:past-participle])
                  (get-in word [:past-participle])


Very good set-based dispatch now

Very good set-based dispatch now

--- src/bluebell/utils/setdispatch.clj
+++ src/bluebell/utils/setdispatch.clj
@@ -3,7 +3,8 @@
             [clojure.spec.alpha :as spec]
             [bluebell.utils.core :as utils]
             [bluebell.utils.specutils :as sutils]
-            [clojure.set :as cljset])
+            [clojure.set :as cljset]
+            [bluebell.utils.pareto :as pareto])
   (:refer-clojure :exclude [complement any?]))

@@ -73,87 +74,6 @@
 (defn match-error-map [arity alts]
   {:arity arity
    :alternatives (sort-by :generality (clean-alts alts))})
-
-(defn resolve-fn-call [system dispatch-state args]
-  (let [arity (count args)
-        alternatives (map (fn [[k alt]]
-                            (merge alt ((:match-fn alt)
-                                        system
-                                        (:feature-extractor dispatch-state)
-                                        args)))
-                          (get-in dispatch-state [:dispatch-map arity]))
-        matching-alternatives (sort-by :generality (filter :satisfied? alternatives))]
-
-    (println "The alternatives are ")
-    (clojure.pprint/pprint matching-alternatives)
-
-    (cond
-      (empty? matching-alternatives) (throw (ex-info "No matching set-fn for this arity."
-                                                     (match-error-map
-                                                      arity
-                                                      alternatives)))
-      (= (:generality (first matching-alternatives))
-         (:generality (second matching-alternatives))) (throw
-                                                        (ex-info
-                                                         "Ambiguous set-based dispatch"
-                                                         (match-error-map
-                                                          arity
-                                                          matching-alternatives)))
-      :default (apply (-> matching-alternatives
-                          first
-                          :fn)
-                      args))))
-
-(defn dispatch-root [system dispatch-state]
-  (fn [& args]
-    (let [system (mark-called system)]
-      (if (empty? args)
-        dispatch-state
-        (resolve-fn-call system
-                         (deref dispatch-state)
-                         args)))))
-
-(defn initialize-dispatch-state [feature-extractor]
-  {:dispatch-map {}
-   :feature-extractor feature-extractor})
-
-(defn forward-set-fn [f]
-  (fn [& args]
-    (let [[system & rest-args] args]
-      (swap! system (fn [set-registry]
-                      (check-not-used set-registry)
-                      (apply f `(~set-registry ~@rest-args)))))))
-
-(defn add-method [state-atom arity method]
-  (swap! state-atom
-         (fn [state]
-           (update-in state [:dispatch-map arity]
-                      #(conj (or % {}) [(:args method) method])))))
-
-(def memoized-evaluate-query (memoize ss/evaluate-query))
-
-(defn evaluate-arg-match [system common-feature-extractor arg-spec arg]
-  (let [fe (or (:feature-extractor arg-spec)
-               common-feature-extractor)
-        element (fe arg)
-
-        _ (utils/data-assert (ss/element? system element)
-                             "Not an element"
-                             {:x element
-                              :elements (ss/all-elements system)})
-
-        raw-query (:query arg-spec)
-        query (ss/normalize-query raw-query)
-
-        ;; TODO: This can be cached
-        elements (memoized-evaluate-query system query)
-
-        ;; NOTE: A a query can be satisfied even if the elements returned by
-        ;; evaluate-query is empty.
-        satisfied? (ss/satisfies-query? system query element)
-
-        generality (count elements)]
-    (utils/map-of element satisfied? generality raw-query elements)))

 (defn compare-sets
   "Encode the relationship between two sets:
@@ -180,6 +100,94 @@
     (and (not (some nil? comparisons))
          (every? #(<= % 0) comparisons)
          (some (partial = -1) comparisons))))
+
+(defn alt-set-vector [alt]
+  (mapv :elements (:args alt)))
+
+(def memoized-set-vectors-dominate? (memoize set-vectors-dominate?))
+
+(defn alt-dominates? [a b]
+  (memoized-set-vectors-dominate? (alt-set-vector a)
+                                  (alt-set-vector b)))
+
+(defn resolve-fn-call [system dispatch-state args]
+  (let [arity (count args)
+        alternatives (map (fn [[k alt]]
+                            (merge alt ((:match-fn alt)
+                                        system
+                                        (:feature-extractor dispatch-state)
+                                        args)))
+                          (get-in dispatch-state [:dispatch-map arity]))
+        matching-alternatives (filter :satisfied? alternatives)
+        frontier (pareto/elements (reduce pareto/insert
+                                          (pareto/frontier alt-dominates?)
+                                          matching-alternatives))]
+    (cond
+      (empty? frontier) (throw (ex-info "No matching set-fn for this arity."
+                                        (match-error-map
+                                         arity
+                                         alternatives)))
+      (< 1 (count frontier)) (throw
+                                                        (ex-info
+                                                         "Ambiguous set-based dispatch"
+                                                         (match-error-map
+                                                          arity
+                                                          matching-alternatives)))
+      :default (apply (-> frontier
+                          first
+                          :fn)
+                      args))))
+
+(defn dispatch-root [system dispatch-state]
+  (fn [& args]
+    (let [system (mark-called system)]
+      (if (empty? args)
+        dispatch-state
+        (resolve-fn-call system
+                         (deref dispatch-state)
+                         args)))))
+
+(defn initialize-dispatch-state [feature-extractor]
+  {:dispatch-map {}
+   :feature-extractor feature-extractor})
+
+(defn forward-set-fn [f]
+  (fn [& args]
+    (let [[system & rest-args] args]
+      (swap! system (fn [set-registry]
+                      (check-not-used set-registry)
+                      (apply f `(~set-registry ~@rest-args)))))))
+
+(defn add-method [state-atom arity method]
+  (swap! state-atom
+         (fn [state]
+           (update-in state [:dispatch-map arity]
+                      #(conj (or % {}) [(:args method) method])))))
+
+(def memoized-evaluate-query (memoize ss/evaluate-query))
+
+(defn evaluate-arg-match [system common-feature-extractor arg-spec arg]
+  (let [fe (or (:feature-extractor arg-spec)
+               common-feature-extractor)
+        element (fe arg)
+
+        _ (utils/data-assert (ss/element? system element)
+                             "Not an element"
+                             {:x element
+                              :elements (ss/all-elements system)})
+
+        raw-query (:query arg-spec)
+        query (ss/normalize-query raw-query)
+
+        ;; TODO: This can be cached
+        elements (memoized-evaluate-query system query)
+
+        ;; NOTE: A a query can be satisfied even if the elements returned by
+        ;; evaluate-query is empty.
+        satisfied? (ss/satisfies-query? system query element)
+
+        generality (count elements)]
+    (utils/map-of element satisfied? generality raw-query elements)))

 (defn make-match-fn [meta arg-specs]
   (fn [system common-feature-extractor args]


Worked on getting some other stuff working.

--- src/petulant_life/rendering.clj
+++ src/petulant_life/rendering.clj
@@ -39,7 +39,7 @@

 ; Generating the vertices for a rectangle. Despite it being a rectangle, it
 ; requires 6 points to be rendered using using a VAO.
-(defn generateVerts [x y w h]
+(defn generateRectangle [x y w h]
   [[x y 0]
    [x (+ y h) 0]
    [(+ x w) (+ y h) 0]
@@ -47,10 +47,41 @@
    [(+ x w) (+ y h) 0]
    [(+ x w) y 0]])

+; Generating a number of rectangles.
+(defn generateRectangles [rects]
+  nil)
+
+; Loading all of the lines from a file.
+(defn loadFile [path]
+  (try
+    (let [sb (java.lang.StringBuilder)
+          rd (java.io.BufferedReader (java.io.FileReader path))]
+      (loop []
+          (let [line (.readLine rd)]
+            (if (== line nil)
+              (do (.close rd)
+                  sb)
+              (do (.append sb (.append sb line) "\n")
+                  (recur))))))
+    (catch Exception e (throw e))))
+
+; Loading a specific type of shader at a given path.
+(defn loadShader [path type]
+  (try
+    (let [content (loadFile path)
+          sid     (GL20/glCreateShader type)]
+      (do (GL20/glShaderSource sid content)
+          (GL20/glCompileShader sid)
+          sid))
+    (catch Exception e (.exit System 1)))) ; So very unsafe.
+
 ; Loading a shader. It loads all possible extensions for the shader. If there is
 ; a .vert, it'll load it. If there's a .frag, it'll load it, etc.
 (defn loadShaderProgram [path]
+  (use 'clojure.java.io)
   nil)
+
+; LOAD A SHADER :)

 ; Drawing based on the information contained in a VAO with a given shader.
 (defn drawVAO [shader vao vct]
@@ -62,4 +93,8 @@

 ; Drawing a single rectangle using a shader.
 (defn drawRectangle [x y w h shader]
-  (withVAO (generateVerts x y w h) (partial drawVAO shader)))
+  (withVAO (generateRectangle x y w h) (partial drawVAO shader)))
+
+; Drawing a number of rectangles using a shader.
+(defn drawRectangles [rects shader]
+  (withVAO (generateRectangles rects) (partial drawVAO shader)))


add a hack to bypass queriac's arg parsing

--- src/semtag_web/client/main.cljs
+++ src/semtag_web/client/main.cljs
@@ -1,6 +1,7 @@
 (ns semtag-web.client.main
   (:require [semtag-web.client.view :refer [generate-table path-to] :as view]
             [semtag-web.client.util :refer [log log-clj return-key-pressed] :as util]
+            clojure.string
             [jayq.core :refer [$ bind inner] :as jq]))

 ;; possible util fns
@@ -174,7 +175,8 @@
   (home)
   (.click ($ :#add_url_button))
   (if-let [input (util/param-value "input")]
-    (do
+    ; remove hack when not using cmd service that overrides ':'
+    (let [input (-> (clojure.string/replace input #"\.\." ":"))]
       (.text ($ :#add_url_text) (.decodeURI js/window input))
       (.click ($ :#add_url_button)))
     (alert "No input given.")))


Style table and add last field for DSDEEPB-976

--- src/cljs/org/broadinstitute/firecloud_ui/page/workspace/method_config_editor.cljs
+++ src/cljs/org/broadinstitute/firecloud_ui/page/workspace/method_config_editor.cljs
@@ -137,7 +137,7 @@
                                           (swap! state assoc :blocker nil)
                                           (if success?
                                             (swap! state assoc :submitting? true
-                                              :entity-types (cons "Select Entity Type..." (utils/parse-json-string (.-responseText xhr))))
+                                              :entity-types (cons "Select..." (utils/parse-json-string (.-responseText xhr))))
                                             (js/alert (str "Error: " (.-statusText xhr)))))
                                :canned-response {:responseText (utils/->json-string ["Sample" "Participant"])
                                                  :status 200 :delay-ms (rand-int 2000)}})))}
@@ -159,11 +159,11 @@
        [:div {:style {:position "absolute" :top 4 :right 4}}
         [comps/Button {:icon :x :onClick #(swap! state assoc :submitting? false)}]]
        [:div {:style {:padding "22px 48px 40px" :backgroundColor (:background-gray style/colors)}}
-        (style/create-form-label "Filter by Entity Type")
+        (style/create-form-label "Select Entity Type")
         (style/create-select
           {:style {:width "50%" :minWidth 50 :maxWidth 200} :ref "filter"
            :onChange #(let [value (-> (@refs "filter") .getDOMNode .-value)]
-                       (when-not (= value "Select Entity Type...")
+                       (when-not (= value "Select...")
                          (utils/ajax-orch
                            (paths/list-all-entities-path workspace value)
                            {:on-done
@@ -180,15 +180,19 @@
         (style/create-form-label "Select Entity")
         (if (zero? (count (:entities @state)))
           (style/create-message-well "No entities to display.")
-          [table/Table
-           {:columns [{:header "Entity Type" :starting-width 100}
-                      {:header "Entity Name" :starting-width 100}
-                      {:header "Attributes" :starting-width 400}]
-            :data (map (fn [m]
-                         [(m "entityType")
-                          (m "name")
-                          (m "attributes")])
-                    (:entities @state))}])]])}])
+          [:div {:style {:backgroundColor "#fff" :border (str "1px solid " (:line-gray style/colors))
+                         :padding "1em" :marginBottom "0.5em"}}
+           [table/Table
+            {:columns [{:header "Entity Type" :starting-width 100}
+                       {:header "Entity Name" :starting-width 100}
+                       {:header "Attributes" :starting-width 400}]
+             :data (map (fn [m]
+                          [(m "entityType")
+                           (m "name")
+                           (m "attributes")])
+                     (:entities @state))}]])
+        (style/create-form-label "Define Expression")
+        (style/create-text-field {})]])}])

 (defn- render-main-display [state refs config editing?]
   [:div {:style {:marginLeft 330}}


Remove dead code (received? _)

Remove dead code (received? _)

--- src/clj/momentum/core/deferred.clj
+++ src/clj/momentum/core/deferred.clj
@@ -9,13 +9,10 @@
     Receiver]))

 (defprotocol DeferredValue
-  (received? [_])
   (receive   [_ success error]))

 (extend-protocol DeferredValue
   AsyncVal
-  (received? [val]
-    (.isRealized val))
   (receive [val success error]
     (doto val
       (.receive
@@ -24,8 +21,6 @@
          (error   [_ err] (error err))))))

   AsyncSeq
-  (received? [seq]
-    (.isRealized seq))
   (receive [seq success error]
     (doto seq
       (.receive
@@ -34,8 +29,6 @@
          (error   [_ err] (error err))))))

   Pipeline
-  (received? [pipeline]
-    (.isRealized pipeline))
   (receive [val success error]
     (doto val
       (.receive
@@ -44,13 +37,11 @@
          (error   [_ err] (error err))))))

   Object
-  (received? [o] true)
   (receive [o success _]
     (success o)
     o)

   nil
-  (received? [_] true)
   (receive [_ success _]
     (success nil)
     nil))


refactor for readability

refactor for readability

--- src/clj_money/web/transactions.clj
+++ src/clj_money/web/transactions.clj
@@ -67,19 +67,20 @@
   ([req] (index req {}))
   ([{{entity-id :entity-id :as params} :params} options]
    (with-transactions-layout "Transactions" entity-id options
-     (let [criteria (apply-scope {:entity-id entity-id} :transaction)]
+     (let [criteria (apply-scope {:entity-id entity-id} :transaction)
+           transactions (transactions/search
+                          (env :db)
+                          criteria
+                          (merge {:limit 100
+                                  :sort [[:transaction-date :desc]]} ; TODO Need to get :limit and :per-page in sync
+                                 (pagination/prepare-options params)))]
        (html
          [:table.table.table-striped
           [:tr
            [:th.col-sm-2 "Date"]
            [:th.col-sm-8 "Description"]
            [:th.col-sm-2 " "]]
-          (map transaction-row
-               (transactions/search (env :db)
-                                    criteria
-                                    (merge {:limit 100
-                                            :sort [[:transaction-date :desc]]} ; TODO Need to get :limit and :per-page in sync
-                                           (pagination/prepare-options params))))]
+          (map transaction-row transactions)]
          (pagination/nav (assoc params
                                 :url (-> (path "/entities" entity-id "transactions"))
                                 :total (transactions/record-count (env :db) criteria)))))


Added create concepts route.

Added create concepts route.

--- src/cmr/metadata_db/api/routes.clj
+++ src/cmr/metadata_db/api/routes.clj
@@ -19,6 +19,10 @@
                   {:status 200
                    :headers {"Content-Type" "text/plain"}
                    :body "foo"}))
+    (context "/concepts" []
+             (POST "/" {body :body}
+                   {:status 201
+                    :body body}))
     (route/not-found "Not Found")))

 (defn- exception-handler


minor

minor

--- ssclj/jar/src/com/sixsq/slipstream/ssclj/util/log.clj
+++ ssclj/jar/src/com/sixsq/slipstream/ssclj/util/log.clj
@@ -32,13 +32,3 @@
                      (ring-resp/status 400))]
     (log/warn msg)
     (throw (ex-info msg response))))
-
-(defn log->
-  [o m]
-  (log/info "---->>>>" m)
-  (let [out (java.io.StringWriter.)]
-    (clojure.pprint/pprint o out)
-    (log/info (.toString out)))
-  (log/info m "---->>>>")
-  o)
-


Bring back rounded corner for thread border

--- src/braid/core/client/ui/styles/thread.cljs
+++ src/braid/core/client/ui/styles/thread.cljs
@@ -147,7 +147,8 @@
    [:&.focused
     [:>.card
      [:>.border
-     (mixins/card-border "5px")]]]
+      (mixins/card-border "5px")
+      {:border-radius [[vars/border-radius 0 0 0]]}]]]

    [:>.card
     mixins/flex