All auxiliary functions are there. However, generating next string is extremely inefficient (too big gaps which consume too much time)

--- src/adventofcode/solutions.clj
+++ src/adventofcode/solutions.clj
@@ -304,16 +304,54 @@
 ;day 11
 ;just building blocks
 ;string into number
-(let [init (BigInteger. (clojure.string/join (map #(format "%03d" %) (map int "vzbxkghb"))))
-      ok? (fn [num]
-            (map #(s->int (apply str %)) (partition 3 (.toString num))))]
-  (ok? (.add init BigInteger/ONE)))
-
-;looking for increasing subsequence
-((fn [input]
-   (reduce #(let [prev (first %)
-                  lnum (last prev)]
-             (if (> %2 lnum)
-               (conj (rest %) (conj prev %2))
-               (conj % [%2]))) [[(first input)]] (rest input)))  '(118 122 98 120 107 103 104 105))
-
+(defn- no-iol? [ch-seq]
+  (not-any? #(#{105 108 111} %) ch-seq))
+
+(defn- s->big-int
+  "Simply transforms string into big integer consisting of concatenated character codes"
+  [s]
+  (BigInteger. (clojure.string/join (map #(format "%03d" %) (map int s)))))
+
+(defn- big-int->ch-seq
+  "Simply transforms big-int into sequence of 3 digit numbers"
+  [num]
+  (map #(s->int (apply str %)) (partition 3 (str num))))
+
+(defn- ch-seq->str
+  "Char sequence (ch here is 8bit int actually)"
+  [chs]
+  (apply str (map char chs)))
+
+(defn- has-distinct-pairs?
+  "Determines if sequence contains two distinct pairs (pairs consist of different chars)"
+  [xs]
+  (let [[one two] (filter #(= 2 (count %)) (partition-by identity xs))]
+    (and one two (not= (first one) (first two)))))
+
+(defn- has-inc-of-three?
+  "Determines if provided input sequence containes increasing straight of at least three letters"
+  [xs]
+  (some
+    #(>= (count %) 3)
+    (reduce #(let [prev (first %)
+                   lnum (last prev)]
+              (if (> %2 lnum)
+                (conj (rest %) (conj prev %2))
+                (conj % [%2]))) [[(first xs)]] (rest xs))))
+
+(defn- all-letters? [chs]
+  (every? #(and (>= % 97) (<= % 122)) chs))
+
+(defn day11 [input]
+  (reduce #(let [ch-seq (big-int->ch-seq %2)]
+            (when (all-letters? ch-seq)
+              (println (ch-seq->str ch-seq))
+              (if (and
+                    (has-inc-of-three? ch-seq)
+                    (no-iol? ch-seq)
+                    (has-distinct-pairs? ch-seq))
+                (reduced (ch-seq->str ch-seq)))))
+          (iterate #(.add % BigInteger/ONE) (s->big-int input))))
+
+
+


nicer buttons on a-z

nicer buttons on a-z

--- src/checkmate/views/overview.clj
+++ src/checkmate/views/overview.clj
@@ -14,10 +14,9 @@
            [:div.col-md-4
             [:strong (elm/link-to (str "/show/" (:_id i)) (:name i))]]
            [:div.col-md-8
-            [:small
-             (elm/link-to (str "/edit/" (:_id i)) "Edit")
-             " | "
-             [:a {:href "#" :onclick (format "checkmate.views.overview.try_delete_list('%s', '%s');" (:_id i) (:name i))} "Delete"]]]])])]))
+            [:div.btn-group
+             [:a {:class "btn btn-default btn-xs" :href (str "/edit/" (:_id i))} [:span.glyphicon.glyphicon-edit] "Edit"]
+             [:a {:class "btn btn-default btn-xs":href "#" :onclick (format "checkmate.views.overview.try_delete_list('%s', '%s');" (:_id i) (:name i))} [:span.glyphicon.glyphicon-trash] "Delete"]]]])])]))

 (defn render [lists]
   (let [grouped (group-by (comp first string/upper-case :name) lists)]


Wrap root-component with header

Wrap root-component with header

--- src/cljs/event_planner/core.cljs
+++ src/cljs/event_planner/core.cljs
@@ -34,14 +34,42 @@
 (def pages {:index index-page
             :events events-page})

+(defn header-component []
+    [:nav {:class "navbar navbar-default navbar-static-top"
+          :role "navigation"}
+      [:div.container
+        [:div.navbar-header
+        [:button {:type "button"
+                  :class "navbar-toggle collapsed"
+                  :data-toggle "collapse"
+                  :data-target "#navbar"
+                  :aria-expanded "false"}
+          [:span.sr-only "Toggle navigation"]
+          [:span.icon-bar]
+          [:span.icon-bar]
+          [:span.icon-bar]]
+          [:a.navbar-brand {:href "#"} "Schedule-Omatic 9000"]]
+      [:div {:class "collapse navbar-collapse"
+             :id "navbar"}
+        [:ui.nav.navbar-nav.navbar-right
+          [:li [:a {:href "#"} "Home"]]
+          [:li [:a {:href "#"}"About Us"]]
+          [:li [:a {:href "#"} "Login"]]
+          ]]]])
+
 (defn root-component []
   (let [current-page (subscribe [:current-page])
         page-component (pages (first current-page) index-page)]
     ;return page + args in current-page
     (into [page-component] (rest current-page))))

+(defn wrapper-component []
+  [:div
+   [header-component]
+   [root-component]])
+
 (defn render []
-  (r/render-component [root-component]
+  (r/render-component [wrapper-component]
                       (js/document.getElementById "app")))

 (defn ^:export main


add a few more classes

add a few more classes

--- src/cljs/just_married/views.cljs
+++ src/cljs/just_married/views.cljs
@@ -32,9 +32,11 @@
 (defn story
   []
   [:div {:id "story" :class "section"}
-   [:div "Andrea Crotti & Enrica Verrucci"]
-   [:div [:a {:href "#find-us"} (-> settings/PLACES :parco :name)]]
-   [:div "27th May, 2018"]
+   [:div {:class "names"} "Andrea Crotti & Enrica Verrucci"]
+   [:div {:class "find-us"}
+    [:a {:href "#find-us"} (-> settings/PLACES :parco :name)]]
+
+   [:div {:class "date"} "27th May, 2018"]
    [:div {:id "countdown"} (countdown/countdown-component)]])

 (defn find-us


Support async on `p/entity`

Support async on `p/entity`

--- src/com/wsscode/pathom/core.cljc
+++ src/com/wsscode/pathom/core.cljc
@@ -185,7 +185,8 @@
      (if (atom? e) (deref e) e)))
   ([{:keys [parser] :as env} attributes]
    (let [e (entity env)]
-     (merge e (elide-not-found (parser env (filterv (-> e keys set complement) attributes)))))))
+     (let-chan [res (parser env (filterv (-> e keys set complement) attributes))]
+       (merge e (elide-not-found res))))))

 (s/fdef entity
   :args (s/cat :env ::env :attributes (s/? (s/coll-of ::attribute)))


renamed some stuff

renamed some stuff

--- cljx/plongeur-cljs/src/plongeur/system.cljs
+++ cljx/plongeur-cljs/src/plongeur/system.cljs
@@ -2,10 +2,8 @@
   (:require [cljs.core.async :refer [close!]]
             [plongeur.core :refer [launch-plongeur]]))

-(defn run-app [] (launch-plongeur))
-
-(defonce sys-atom (-> (run-app) (atom)))
+(defonce app (-> (launch-plongeur) (atom)))

 (defn on-js-reload []
-  (prn "reloading")
-  (swap! sys-atom (fn [shutdown-fn] (shutdown-fn) (run-app))))+  (prn "reloading app")
+  (swap! app (fn [shutdown-fn] (shutdown-fn) (launch-plongeur))))


Removed multipart code

Removed multipart code

--- src/compojure/http/multipart.clj
+++ src/compojure/http/multipart.clj
@@ -1,82 +0,0 @@
-;; Copyright (c) James Reeves. All rights reserved.
-;; The use and distribution terms for this software are covered by the Eclipse
-;; Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) which
-;; can be found in the file epl-v10.html at the root of this distribution. By
-;; using this software in any fashion, you are agreeing to be bound by the
-;; terms of this license. You must not remove this notice, or any other, from
-;; this software.
-
-(ns compojure.http.multipart
-  "Add multipart form handling to Compojure. Relies on the Apache Commons
-   FileUpload library."
-  (:use clojure.contrib.def)
-  (:use compojure.map-utils)
-  (:import org.apache.commons.fileupload.FileUpload)
-  (:import org.apache.commons.fileupload.RequestContext)
-  (:import org.apache.commons.fileupload.disk.DiskFileItemFactory)
-  (:import org.apache.commons.fileupload.disk.DiskFileItem))
-
-(defn multipart-form?
-  "Does a request have a multipart form?"
-  [request]
-  (if-let [content-type (:content-type request)]
-    (.startsWith content-type "multipart/form-data")))
-
-(defvar- file-upload
-  (FileUpload.
-    (doto (DiskFileItemFactory.)
-      (.setSizeThreshold -1)
-      (.setFileCleaningTracker nil)))
-  "Uploader class to save multipart form values to temporary files.")
-
-(defn- request-context
-  "Create a RequestContext object from a request map."
-  [request]
-  (proxy [RequestContext] []
-    (getContentType []       (:content-type request))
-    (getContentLength []     (:content-length request))
-    (getCharacterEncoding [] (:character-encoding request))
-    (getInputStream []       (:body request))))
-
-(defn- file-map
-  "Create a file map from a DiskFileItem."
-  [#^DiskFileItem item]
-  {:disk-file-item item
-   :filename       (.getName item)
-   :size           (.getSize item)
-   :content-type   (.getContentType item)
-   :tempfile       (.getStoreLocation item)})
-
-(defn parse-multipart-params
-  "Parse a map of multipart parameters from the request."
-  [request]
-  (reduce
-    (fn [param-map, #^DiskFileItem item]
-      (assoc-vec param-map
-        (keyword (.getFieldName item))
-        (if (.isFormField item)
-          (if (zero? (.getSize item))
-            ""
-            (.getString item))
-          (file-map item))))
-    {}
-    (.parseRequest
-       file-upload
-       (request-context request))))
-
-(defn get-multipart-params
-  "Retrieve multipart params from the request."
-  [request]
-  (if (multipart-form? request)
-    (parse-multipart-params request)
-    {}))
-
-(defn with-multipart
-  "Decorate a Ring handler with multipart parameters."
-  [handler]
-  (fn [request]
-    (let [params  (get-multipart-params request)
-          request (-> request
-                    (assoc :multipart-params params)
-                    (assoc :params (merge (request :params) params)))]
-      (handler request))))


refactor noun phrases' internal structure for more general :mod :first/:rest treatment

--- src/babel/english/grammar.cljc
+++ src/babel/english/grammar.cljc
@@ -11,7 +11,7 @@
    [babel.parse :as parse]
    [babel.ug :as ug
     :refer [apply-default-if
-            comp-specs-head head-semantics
+            head-semantics
             head-principle root-is-comp
             root-is-head root-is-head-root
             subcat-1-principle subcat-1-1-principle
@@ -151,6 +151,28 @@
                :agr agr
                :b head-english}
      :first :comp}))
+
+;; TODO: promote this version of comp-specs-head
+;; to ug.
+(def comp-specs-head
+  (unify-check
+   ug/comp-specs-head
+   (let [mod (atom :top)]
+     {:synsem {:sem {:mod mod}}
+      :head {:synsem {:mod mod}}})))
+
+(def head-mod
+  (unify-check
+   (let [head-mod (atom :top)]
+     {:synsem {:mod {:rest head-mod}}
+      :head {:synsem {:mod head-mod}}})))
+
+(def comp-mod
+  (unify-check
+   head-mod
+   (let [comp-sem (atom :top)]
+     {:synsem {:mod {:first comp-sem}}
+      :comp {:synsem {:sem comp-sem}}})))

 ;; -- BEGIN SCHEMA DEFINITIONS
 (def c10
@@ -286,32 +308,21 @@
    ;; but:
    ;;   [nbar-obj [nbar ]] is allowed.
    (unify-check c11-comp-subcat-1
-                (let [head-constraint (atom :top)
-                      adj-sem (atom {:prop head-constraint})
-                      head-mod (atom :top)]
+                cons-mod
+                (let [head-constraint (atom :top)]
                   {:rule "nbar"
                    :bar-level :low
-                   :synsem {:mod {:first adj-sem
-                                  :rest head-mod}}
-                   :comp {:synsem {:cat :adjective
-                                   :sem adj-sem}}
+                   :comp {:synsem {:cat :adjective}}
                    :head {:bar-level :low
                           :synsem {:cat :noun
-                                   :sem {:prop head-constraint}
-                                   :mod head-mod}}}))
+                                   :sem {:prop head-constraint}}}}))
    ;; noun-phrase -> det nbar
    (unify-check c10
                 comp-specs-head
-                (let [number-agreement (atom :top)
-                      mod (atom :top)]
-                  {:rule "noun-phrase"
-                   :aliases (list "np")
-                   :synsem {:agr {:number number-agreement}
-                            :reflexive false
-                            :cat :noun
-                            :sem {:mod mod
-                                  :number number-agreement}}
-                   :head {:synsem {:mod mod}}}))
+                {:rule "noun-phrase"
+                 :aliases (list "np")
+                 :synsem {:reflexive false
+                          :cat :noun}})

    (let [sem (atom :top)
          agr (atom :top)
@@ -356,10 +367,10 @@
      :example "(the) [nbar dog [s-obj you see]]"}
     head-first
     head-principle
+    head-mod
     (let [mod-subj (atom :top)
           mod-pred (atom :top)
           mod-prop (atom :top)
-          head-mod (atom :top)
           mod-aspect (atom :top)
           mod-tense (atom :top)
           head-subcat (atom {:1 {:cat :det}
@@ -372,8 +383,7 @@
                               :tense mod-tense
                               :aspect mod-aspect
                               :obj :modified
-                              :pred mod-pred}
-                      :rest head-mod}
+                              :pred mod-pred}}
                 :subcat head-subcat}
        :comp {:phrasal true
               :synsem {:slash true
@@ -387,8 +397,7 @@
                              :tense mod-tense}}}
        :head {:rule "nbar"
               :synsem {:cat :noun
-                       :subcat head-subcat
-                       :mod head-mod}}}))
+                       :subcat head-subcat}}}))
    (unify-check c10
                 unmodified
                 root-is-head
@@ -428,6 +437,7 @@
                           :subcat {:2 {:top :top}
                                    :3 []}}})

+   ;; TODO: should be :mod :first, not just :mod.
    ;; "has seen a dog" : complement is semantic object.
    (let [obj-mod (atom :top)
          obj (atom {:mod obj-mod})]
@@ -442,6 +452,7 @@
                             :slash false
                             :cat :verb}}))

+   ;; TODO: should be :mod :first, not just :mod.
    ;; "[h turn ] [c off]"
    (let [iobj-mod (atom :top)]
      (unify-check h32


remove unused stuff

remove unused stuff

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -1763,7 +1763,6 @@
    "that" [;; "that" as in "she thinks that .."
            {:synsem {:cat :comp
                      :comp-type :that
-                     :sem {:pred :that}
                      :subcat {:1 {:cat :verb
                                   :subcat '()}
                               :2 '()}}}


+modal "have to"

+modal "have to"

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -839,12 +839,21 @@
                      :sem {:pred :guess}}}

    ;; TODO: add auxiliary sense of "have"
-   "have" {:synsem {:cat :verb
-                    :sem {:activity false
-                          :discrete false
-                          :pred :have}}
-           :english {:present {:3sing "has"}
-                     :past "had"}}
+   "have" [;; possessive
+           {:synsem {:cat :verb
+                     :subcat {:2 {:cat :noun}}
+                     :sem {:activity false
+                           :discrete false
+                           :pred :have}}
+            :english {:present {:3sing "has"}
+                      :past "had"}}
+
+           ;; modal: "have to + VP"
+           {:synsem {:cat :verb
+                     :sem {:pred :have-to}}
+            :english {:present {:3sing "has"}
+                      :past "had"}
+            :modal-with :infinitive}]

    "have dinner" {:synsem {:cat :verb
                            :sem {:pred :have-dinner}
@@ -870,17 +879,6 @@
                            :past "had lunch"
                            :participle "having lunch"}}

-   "have to" {:synsem {:cat :verb
-                       :sem {:pred :have-to}}
-              :english {:present {:1sing "have to"
-                                  :2sing "have to"
-                                  :3sing "has to"
-                                  :1plur "have to"
-                                  :2plur "have to"
-                                  :3plur "have to"}
-                        :future "have to"
-                        :participle "having to"
-                        :past "had to"}}
    "he" {:synsem {:cat :noun
                   :pronoun true
                   :case :nom


[base] Have cqrs ws-handler log at warn level (instead of debug)

--- src/braid/base/server/cqrs.clj
+++ src/braid/base/server/cqrs.clj
@@ -15,7 +15,7 @@
                   :user-id user-id))
       (?reply-fn :braid/ok)
       (catch Exception e
-        (timbre/debug "Command Error:" e)
+        (timbre/warn "Command Error:" e)
         (?reply-fn {:cqrs/error {:message (.getMessage e)
                                  :data (ex-data e)}})))
     ;; returning {} here, b/c our socket-message-handlers


provide some sane defaults to http-connect! for interactive use

--- src/brainbot/nozzle/manage.clj
+++ src/brainbot/nozzle/manage.clj
@@ -114,9 +114,14 @@
       (future (manage-filesystem rmq-settings rmq-prefix fs)))))

 (defn http-connect!
-  [{:keys [api-endpoint username password]}]
-  (logging/info "using rabbitmq api-endpoint" api-endpoint "as user" username)
-  (rmqapi/connect! api-endpoint username password))
+  "initialize langohr.http by calling its connect! method"
+  ([] (http-connect! {}))
+  ([{:keys [api-endpoint username password]
+      :or {api-endpoint "http://localhost:55672"
+           username "guest"
+           password "guest"}}]
+     (logging/info "using rabbitmq api-endpoint" api-endpoint "as user" username)
+     (rmqapi/connect! api-endpoint username password)))

 (def runner
   (reify


Band-aid on seaches for `*`

Band-aid on seaches for `*`

--- src/clj/clojuredocs/search.clj
+++ src/clj/clojuredocs/search.clj
@@ -176,20 +176,30 @@

 (defn drop-leading-stars [q]
   (when q
-    (if (.startsWith q "*")
-      (->> (str/replace q #"\**" "")
-           (apply str))
-      q)))
+    (let [stripped (if (.startsWith q "*")
+                     (->> (str/replace q #"\**" "")
+                          (apply str))
+                     q)]
+      (when-not (empty? stripped)
+        stripped))))
+
+(defn escape-query [q]
+  (when-not (empty? q)
+    (org.apache.lucene.queryparser.classic.QueryParser/escape q)))

 (defn format-query [q]
-  (-> q
-      drop-leading-stars
-      str/trim
-      lucene-escape
-      (str "*")))
+  (some-> q
+    str/trim
+    drop-leading-stars
+    lucene-escape
+    (str "*")))

 (defn query [q]
-  (when-not (empty? q)
-    (->> (clucy/search search-index (format-query q) 1000 :default-field "keywords")
-         (map #(assoc % :edit-distance (levenshtein-distance (str (:name %)) q)))
-         (sort-by :edit-distance))))
+  (cond
+    (= "*" q) [(lookup "clojure.core/*")]
+
+    :else
+    (when-let [q (format-query q)]
+      (->> (clucy/search search-index q 1000 :default-field "keywords")
+           (map #(assoc % :edit-distance (levenshtein-distance (str (:name %)) q)))
+           (sort-by :edit-distance)))))


turn syntax highlighting on for Source/Examples/Meta, off otherwise

--- src/clj_ns_browser/browser.clj
+++ src/clj_ns_browser/browser.clj
@@ -954,6 +954,16 @@
             (and (var? val)(coll? @val))))))
       (b/notify-soon)
       (b/property (id :inspect-btn) :enabled?))
+    ;;
+    ;; turn syntax-highlighting on/off - only on for Source
+    (b/bind
+      (b/selection (id :doc-cbx))
+      (b/transform (fn [o]
+        (when (= (.getName (type (id :doc-ta))) "org.fife.ui.rsyntaxtextarea.RSyntaxTextArea")
+          (if (or (= "Source" o) (= "Examples" o) (= "Meta" o))
+            (.setSyntaxEditingStyle (id :doc-ta) org.fife.ui.rsyntaxtextarea.SyntaxConstants/SYNTAX_STYLE_CLOJURE)
+;;             (.setSyntaxEditingStyle (id :doc-ta) org.fife.ui.rsyntaxtextarea.SyntaxConstants/SYNTAX_STYLE_CLOJURE))))))
+            (.setSyntaxEditingStyle (id :doc-ta) org.fife.ui.rsyntaxtextarea.SyntaxConstants/SYNTAX_STYLE_NONE))))))
     ;;
     ;; bring up browser with url
     (b/bind


fix app-icon loading for mac-os

fix app-icon loading for mac-os

--- src/clojure/nightcode/core.clj
+++ src/clojure/nightcode/core.clj
@@ -10,7 +10,8 @@
             [nightcode.ui :as ui]
             [nightcode.utils :as utils]
             [nightcode.window :as window]
-            [seesaw.core :as s])
+            [seesaw.core :as s]
+            [seesaw.icon :as i])
   (:gen-class))

 (defn create-window-content
@@ -80,9 +81,8 @@
 (def apple-set-icon-thunk
   `(do
      (import 'com.apple.eawt.Application)
-     (import 'javax.swing.ImageIcon)
      (-> (Application/getApplication)
-       (.setDockIconImage (.getImage (ImageIcon. "logo_splash.png"))))))
+       (.setDockIconImage (.getImage (i/icon "logo_splash.png"))))))

 (defn -main
   "Launches the main window."


Add wrapper for text-center

Add wrapper for text-center

--- src/discuss/utils/bootstrap.cljs
+++ src/discuss/utils/bootstrap.cljs
@@ -23,6 +23,8 @@
   "Create dom element of a bootstrap default small button."
   [fn & strs] (button fn "btn-default btn-sm" strs))

+
+;;;; Wrapper
 (defn panel-wrapper
   "Wrap content into bootstrap's panel class."
   [& content]
@@ -34,4 +36,10 @@
   "Wrap content into bootstrap callout."
   [& content]
   (dom/div #js {:className "bs-callout bs-callout-info"}
+           content))
+
+(defn center
+  "Use text-center to align text."
+  [& content]
+  (dom/div #js {:className "text-center"}
            content))


Moved sleep outside of transaction

Moved sleep outside of transaction

--- Code/DiningPhilosophers/src/main/clojure/dining.clj
+++ Code/DiningPhilosophers/src/main/clojure/dining.clj
@@ -42,12 +42,12 @@
           (handle-forks id :take)
           (alter rounds dec)
           (send-off logger debug id "ate      " @rounds)
-          (Thread/sleep 100)
           (handle-forks id :release))
         (do
-          (send-off logger debug id "thinks   " @rounds)
-          (Thread/sleep 100)))
-      (send-off *agent* behave id)))) ; Repeat above
+          (send-off logger debug id "thinks   " @rounds))
+        )))
+  (Thread/sleep 100)
+  (send-off *agent* behave id)) ; Repeat above

 (defn start []
   (doseq [i (range (count philosophers))]


Outlined implementation strategy for instantiation policies. Issue #3.

--- EkekoAspectJ/src/damp/ekeko/aspectj/weaverworld.clj
+++ EkekoAspectJ/src/damp/ekeko/aspectj/weaverworld.clj
@@ -1651,6 +1651,35 @@
            (fails (aspect-dominates-aspect-explicitly+ ?subordinate ?dominator)))))

+;; Aspect instantiation policies
+;; -----------------------------
+
+(comment
+
+;; This one returns PerClause instances of which the inAspect field is still null ..
+
+;; TODO: retrieve correctly instantiated ones through the right-hand-side of advice-raw .... and then link those
+;; back to their defining aspect (will have to eliminate duplicates)
+;; (damp.ekeko/ekeko [?policy]
+;;                      (fresh [?a ?p]
+;;                      (advice ?a)
+;;                      (equals ?p (.getPointcut ?a))
+;;                      (succeeds (instance? AndPointcut ?p))
+;;                      (equals ?policy (.getRight ?p))))
+
+
+(defn
+  aspect-policy
+  "Relation between an aspect and its instantiation policy (instance of PerClause).
+   Includes implicit policies (e.g., perSingleton and perFromSuper)."
+  [?aspect ?policy]
+  (all
+    (aspect ?aspect)
+    (equals ?policy (.getPerClause ?aspect))))
+
+)
+
+

 ;; Link between ProgramElement (weaverworld/element) and ResolvedType (weaverworld/type)


API call handlers: info-handler and unknown-call-handler

--- src/emender_service/rest_api.clj
+++ src/emender_service/rest_api.clj
@@ -15,3 +15,18 @@
 (require '[ring.util.response     :as http-response])
 (require '[clojure.data.json      :as json])

+(defn info-handler
+    [request hostname]
+    (let [response {:toasterNotifications [(str "info|Api response|Emender Service api v1 on
" hostname)]
+                    :configuration (:configuration request)}]
+        (-> (http-response/response (json/write-str response))
+            (http-response/content-type "application/json"))))
+
+(defn unknown-call-handler
+    [uri method]
+    (let [response {:error "Unknown API call"
+                    :uri uri
+                    :method method}]
+        (-> (http-response/response (json/write-str response))
+            (http-response/content-type "application/json"))))
+


Cleanup

Cleanup

--- modules/reitit-core/src/reitit/trie.cljc
+++ modules/reitit-core/src/reitit/trie.cljc
@@ -91,7 +91,7 @@

 (defn insert
   ([routes]
-    (insert nil routes))
+   (insert nil routes))
   ([node routes]
    (reduce
      (fn [acc [p d]]
@@ -110,10 +110,8 @@
       (Trie/linearMatcher matchers)
       (first matchers))))

-(defn pretty [{:keys [data children wilds catch-all]}]
-  (into
-    (if data [data] [])
-    (mapcat (fn [[p n]] [p (pretty n)]) (concat children wilds catch-all))))
+(defn pretty [matcher]
+  (-> matcher str read-string eval))

 (defn lookup [^Trie$Matcher matcher path]
   (if-let [match ^Trie$Match (Trie/lookup matcher ^String path)]
@@ -123,21 +121,66 @@
   (Trie/scanner compiled-tries))

 ;;
-;; matcher
-;;
-
-;;
 ;; spike
 ;;

-(-> nil
-    (insert "/:abba" 1)
-    (insert "/kikka" 2)
-    (insert "/kikka/kakka/kukka" 3)
-    (insert "/kikka/:kakka/kukka" 4)
-    (insert "/kikka/kuri/{user/doc}.html" 5)
-    (insert "/kikkare/*path" 6)
-    #_(pretty))
+(->
+  [["/v2/whoami" 1]
+   ["/v2/users/:user-id/datasets" 2]
+   ["/v2/public/projects/:project-id/datasets" 3]
+   ["/v1/public/topics/:topic" 4]
+   ["/v1/users/:user-id/orgs/:org-id" 5]
+   ["/v1/search/topics/:term" 6]
+   ["/v1/users/:user-id/invitations" 7]
+   ["/v1/users/:user-id/topics" 9]
+   ["/v1/users/:user-id/bookmarks/followers" 10]
+   ["/v2/datasets/:dataset-id" 11]
+   ["/v1/orgs/:org-id/usage-stats" 12]
+   ["/v1/orgs/:org-id/devices/:client-id" 13]
+   ["/v1/messages/user/:user-id" 14]
+   ["/v1/users/:user-id/devices" 15]
+   ["/v1/public/users/:user-id" 16]
+   ["/v1/orgs/:org-id/errors" 17]
+   ["/v1/public/orgs/:org-id" 18]
+   ["/v1/orgs/:org-id/invitations" 19]
+   ["/v1/users/:user-id/device-errors" 22]
+   ["/v2/login" 23]
+   ["/v1/users/:user-id/usage-stats" 24]
+   ["/v2/users/:user-id/devices" 25]
+   ["/v1/users/:user-id/claim-device/:client-id" 26]
+   ["/v2/public/projects/:project-id" 27]
+   ["/v2/public/datasets/:dataset-id" 28]
+   ["/v2/users/:user-id/topics/bulk" 29]
+   ["/v1/messages/device/:client-id" 30]
+   ["/v1/users/:user-id/owned-orgs" 31]
+   ["/v1/topics/:topic" 32]
+   ["/v1/users/:user-id/bookmark/:topic" 33]
+   ["/v1/orgs/:org-id/members/:user-id" 34]
+   ["/v1/users/:user-id/devices/:client-id" 35]
+   ["/v1/users/:user-id" 36]
+   ["/v1/orgs/:org-id/devices" 37]
+   ["/v1/orgs/:org-id/members" 38]
+   ["/v2/orgs/:org-id/topics" 40]
+   ["/v1/whoami" 41]
+   ["/v1/orgs/:org-id" 42]
+   ["/v1/users/:user-id/api-key" 43]
+   ["/v2/schemas" 44]
+   ["/v2/users/:user-id/topics" 45]
+   ["/v1/orgs/:org-id/confirm-membership/:token" 46]
+   ["/v2/topics/:topic" 47]
+   ["/v1/messages/topic/:topic" 48]
+   ["/v1/users/:user-id/devices/:client-id/reset-password" 49]
+   ["/v2/topics" 50]
+   ["/v1/login" 51]
+   ["/v1/users/:user-id/orgs" 52]
+   ["/v2/public/messages/dataset/:dataset-id" 53]
+   ["/v1/topics" 54]
+   ["/v1/orgs" 55]
+   ["/v1/users/:user-id/bookmarks" 56]
+   ["/v1/orgs/:org-id/topics" 57]]
+  (insert)
+  (compile)
+  (pretty))

 (-> nil
     (insert "/kikka" 2)
@@ -145,16 +188,4 @@
     (insert "/kikka/:kakka/kurkku" 4)
     (insert "/kikka/kuri/{user/doc}/html" 5)
     (compile)
-    (lookup "/kikka/kakka/kurkku"))
-
-;; =>
-
-["/"
- ["kikka" [2
-           "/" ["k" ["akka/kukka" [3]
-                     "uri/" [:user/doc [".html" [5]]]]
-                :kakka ["/kukka" [4]]]
-           "re/" [#{:path} [6]]]
-  :abba [1]]]
-
-
+    (pretty))


Account :rename-manifest-package when uninstalling

--- src/leiningen/droid/deploy.clj
+++ src/leiningen/droid/deploy.clj
@@ -65,8 +65,8 @@
 ;; why this subtask is full of low-level stuff.
 (defn install
   "Installs the APK on the only (or specified) device or emulator."
-  [{{:keys [out-apk-path manifest-path]} :android :as project}
-   & device-args]
+  [{{:keys [out-apk-path manifest-path rename-manifest-package]}
+    :android :as project} & device-args]
   (info "Installing APK...")
   (let [adb-bin (sdk-binary project :adb)
         _ (ensure-paths out-apk-path)
@@ -83,10 +83,12 @@
         :success (debug output)

         :inconsistent-certificates
-        (let [resp (prompt-user uninstall-prompt)]
+        (let [resp (prompt-user uninstall-prompt)
+              package-name (or rename-manifest-package
+                               (get-package-name manifest-path))]
           (if (.equalsIgnoreCase "y" resp)
             (do
-              (sh adb-bin device "uninstall" (get-package-name manifest-path))
+              (sh adb-bin device "uninstall" package-name)
               (sh adb-bin device "install" out-apk-path))
             (abort "Cannot proceed with installation.")))


Implement gate open/close trigger via a callback

--- src/main/audio_utils/gate.cljs
+++ src/main/audio_utils/gate.cljs
@@ -10,9 +10,10 @@
   (add-to-rms [this channel sample])
   (calculate-rms [this channel])
   (queue-in-buffer [this channel sample])
-  (dequeue-from-buffer [this channel]))
+  (dequeue-from-buffer [this channel])
+  (maybe-toggle-gate [this state]))

-(defrecord Gate [config next buffers rms-buffers samples-held]
+(defrecord Gate [config next buffers rms-buffers samples-held state]
   w/IWorkerAudioNode
   (connect [this destination]
     (reset! next destination))
@@ -41,12 +42,16 @@
       (if (>= (calculate-rms this channel) threshold)
         (do
           (>> samples-held 0)
+          (maybe-toggle-gate this :open)
           (dequeue-from-buffer this channel))
         (if (<= (<< samples-held) hold)
           (do
             (aswap! samples-held inc)
+            (maybe-toggle-gate this :open)
             input-sample)
-          0.0))))
+          (do
+            (maybe-toggle-gate this :closed)
+            0.0)))))

   (add-to-rms [this channel sample]
     (aswap! rms-buffers update channel
@@ -71,7 +76,13 @@
     (let [buffer ((<< buffers) channel)
           sample (peek buffer)]
       (pop buffer)
-      sample)))
+      sample))
+
+  (maybe-toggle-gate [this new-state]
+    (when (not= (<< state) new-state)
+      (>> state new-state)
+      (when (:trigger config)
+        ((:trigger config) new-state)))))

 (defn default-trigger
   [gate state])
@@ -100,4 +111,5 @@
                 :next         (atom nil)
                 :buffers      (aatom {})
                 :rms-buffers  (aatom {})
-                :samples-held (aatom 0)})))
+                :samples-held (aatom 0)
+                :state        (aatom :closed)})))


State.

State.

--- test/com/nomistech/clojure_the_language/c_400_state_and_concurrency/s_020_atoms.clj
+++ test/com/nomistech/clojure_the_language/c_400_state_and_concurrency/s_020_atoms.clj
@@ -57,55 +57,54 @@

 ;;;; Something about films:

-(def jaws-atom (atom {}))
-
-;; Set a value in the map (using `assoc`):
-
-(do (swap! jaws-atom assoc :title "Paws")
-    ;; does this: (assoc {} :title "Paws"}
-    (fact @jaws-atom => {:title "Paws"}))
-
-;; Whoops; we got the title wrong. Fix it (using `assoc`):
+(def jaws-atom (atom {:title "Paws"
+                      :director {:name "Karl Zwicky"
+                                 :n-movies-as-director 40}
+                      :n-likes 0}))
+
+;; Whoops; that's Paws, not Jaws.
+
+;; Fix the title (using `assoc`):

 (do (swap! jaws-atom assoc :title "Jaws")
-    ;; does this: (assoc {:title "Paws"} :title "Jaws")
-    (fact @jaws-atom => {:title "Jaws"}))
-
-;; Set up a nested map for the director (using `assoc-in`):
-
-(do (swap! jaws-atom assoc-in [:director :name] "Karl Zwicky")
+    ;; does this: (assoc <current-value> :title "Jaws")
+    (fact @jaws-atom => {:title "Jaws"
+                         :director {:name "Karl Zwicky"
+                                    :n-movies-as-director 40}
+                         :n-likes 0}))
+
+;; Fix the director (using `assoc-in`):
+
+(do (swap! jaws-atom assoc-in [:director :name] "Steven Spielberg")
     ;; does this:
-    ;;   (assoc-in {:title "Jaws"} [:director :name] "Karl Zwicky")
-    (fact @jaws-atom => {:title "Jaws"
-                         :director {:name "Karl Zwicky"}}))
-
-;; Whoops; we got the director wrong. Fix it (using `assoc-in`):
-
-(do (swap! jaws-atom assoc-in [:director :name] "Steven Spielberg")
-    (fact @jaws-atom => {:title "Jaws"
-                         :director {:name "Steven Spielberg"}}))
+    ;;   (assoc-in <current-value> [:director :name] "Steven Spielberg")
+    (fact @jaws-atom => {:title "Jaws"
+                         :director {:name "Steven Spielberg"
+                                    :n-movies-as-director 40}
+                         :n-likes 0}))

 ;; Add more detail to the director (using `assoc-in`):

 (do (swap! jaws-atom assoc-in [:director :date-of-birth] 1946)
     (fact @jaws-atom => {:title "Jaws"
                          :director {:name "Steven Spielberg"
-                                    :date-of-birth 1946}}))
+                                    :n-movies-as-director 40
+                                    :date-of-birth 1946}
+                         :n-likes 0}))

 ;; We can apply a function to part of a map in an atom (using `update`):

-(do (swap! jaws-atom assoc :n-likes 0)
-    (swap! jaws-atom update :n-likes + 2)
-    (fact @jaws-atom => {:title "Jaws"
-                         :director {:name "Steven Spielberg"
+(do (swap! jaws-atom update :n-likes + 2)
+    (fact @jaws-atom => {:title "Jaws"
+                         :director {:name "Steven Spielberg"
+                                    :n-movies-as-director 40
                                     :date-of-birth 1946}
                          :n-likes 2}))

 ;; We can apply a function to part of a nested map in an atom (using
 ;; `update-in`):

-(do (swap! jaws-atom assoc-in [:director :n-movies-as-director] 52)
-    (swap! jaws-atom update-in [:director :n-movies-as-director] + 3)
+(do (swap! jaws-atom update-in [:director :n-movies-as-director] + 15)
     (fact @jaws-atom => {:title "Jaws"
                          :director {:name "Steven Spielberg"
                                     :date-of-birth 1946


Update tests from feedback for middleware consolidation

--- test/puppetlabs/trapperkeeper/services/authorization/authorization_service_test.clj
+++ test/puppetlabs/trapperkeeper/services/authorization/authorization_service_test.clj
@@ -290,8 +290,7 @@
                   (update-in [:headers] assoc "x-client-cert" "NOCERTS"))
           {:keys [status body headers]} (app req)]
       (is (= status 400))
-      (is (re-matches #".*No certs found in PEM read from x-client-cert.*" body))
-      (is (re-matches #"text/plain.*" (headers "Content-Type"))))))
+      (is (= "No certs found in PEM read from x-client-cert" body)))))

 (deftest ^:integration query-params-test
   (let [app (build-ring-handler


sorting bug

sorting bug

--- src/checkmate/views/overview.clj
+++ src/checkmate/views/overview.clj
@@ -7,12 +7,12 @@
     [:div
      (for [[letter items] ordered]
        [:div
-        [:h4 (string/upper-case letter)]
+        [:h4 letter]
         (for [i items]
           [:div (elm/link-to (str "/show/" (:_id i)) (:name i))])])]))

 (defn render [lists]
-  (let [grouped (group-by (comp first :name) lists)]
+  (let [grouped (group-by (comp first string/upper-case :name) lists)]
     {:body [:div
             [:h3 "All checklists"]
             (render-group grouped)]}))


Prevent 404 on story publish.

Prevent 404 on story publish.

--- src/oc/storage/api/stories.clj
+++ src/oc/storage/api/stories.clj
@@ -304,7 +304,6 @@
   :can-post-to-missing? false
   :exists? (fn [ctx] (if-let* [_slugs? (and (slugify/valid-slug? org-slug)
                                             (slugify/valid-slug? board-slug))
-                               _drafts? (= board-slug (:slug board-res/default-drafts-storyboard))
                                org (or (:existing-org ctx)
                                        (org-res/get-org conn org-slug))
                                org-uuid (:uuid org)
@@ -313,7 +312,7 @@
                                board (board-res/get-board conn (:board-uuid story))
                                _matches? (and (= org-uuid (:org-uuid story))
                                               (= org-uuid (:org-uuid board))
-                                              (= :draft (keyword (:status story))))]
+                                              (= :draft (keyword (:status story))))] ; sanity check
                         {:existing-org org :existing-board board :existing-story story}
                         false))


Change logging for exceptions back.

Change logging for exceptions back.

--- src/onyx/coordinator/async.clj
+++ src/onyx/coordinator/async.clj
@@ -149,7 +149,8 @@
 (defn failure-ch-loop [failure-tail]
   (loop []
     (when-let [failure (<!! failure-tail)]
-      (info (:e failure) (format "%s failed" (:ch failure)))
+      (info (format "%s failed" (:ch failure)))
+      (.printStackTrace (:e failure))
       (recur))))

 (defn print-if-not-thread-death [e & _]


Fix function signatures.

Fix function signatures.

--- src/onyx/static/validation.clj
+++ src/onyx/static/validation.clj
@@ -71,7 +71,7 @@
     (try
       (schema/validate TaskMap entry)
       (catch Throwable t
-        (print-schema-errors! t)
+        (print-schema-errors! job t)
         (throw t)))))

 (defn validate-workflow-names [{:keys [workflow catalog]}]
@@ -137,12 +137,12 @@
   (validate-workflow-graph job)
   (validate-workflow-no-dupes job))

-(defn validate-lifecycles [lifecycles catalog]
+(defn validate-lifecycles [{:keys [lifecycles catalog] :as job}]
   (doseq [lifecycle lifecycles]
     (try
       (schema/validate Lifecycle lifecycle)
       (catch Throwable t
-        (print-schema-errors! t)
+        (print-schema-errors! job t)
         (throw t)))

     (when-not (or (= (:lifecycle/task lifecycle) :all)
@@ -215,7 +215,7 @@
   [job]
   (validate-job-schema job)
   (validate-catalog job)
-  (validate-lifecycles (:lifecycles job) (:catalog job))
+  (validate-lifecycles job)
   (validate-workflow job))

 (defn validate-flow-pred-all-kws [flow-schema]


Update select-editor-builder to match type-editor.

--- sonic-jam/src/sonic_jam/core.cljs
+++ sonic-jam/src/sonic_jam/core.cljs
@@ -306,47 +306,36 @@
 (defn select-editor-builder
   ([key options-ref]
    (fn [{:keys [cursor id set-state-ch]} owner]
-     (let [commit-fn (fn [{:keys [cursor id set-state-ch key value]}]
-                       (om/transact! cursor #(assoc % key value))
-                       (go (>! set-state-ch id)))
-           listen #(let [state (om/get-state owner)]
-                     (when-not (and (= :init (:state state))
-                                    (contains? cursor key)
-                                    (not (= "none" (get cursor key))))
-                       (let [select (Menu.)
-                             element (gdom/getElement (om/get-state owner :id))]
-                         (.decorate select element)
-                         (gevents/listenOnce select Component.EventType.ACTION
-                                             (fn [e] (let [value (.getValue e.target)]
-                                                       (om/update-state! owner (fn [s] (merge s {:state :init})))
-                                                       (commit-fn {:key key
-                                                                   :value value
-                                                                   :cursor cursor
-                                                                   :id id
-                                                                   :set-state-ch set-state-ch
-                                                                   :owner owner})))))))]
-       (reify
-         om/IInitState
-         (init-state [_]
-           {:state :init
-            :id (new-id)})
-         om/IDidMount
-         (did-mount [_] (listen))
-         om/IDidUpdate
-         (did-update [_ _ _] (listen))
-         om/IRenderState
-         (render-state [_ state]
-           (if (and (= :init (:state state))
-                    (contains? cursor key)
-                    (not (= "none" (get cursor key))))
-             (dom/span #js {:onClick #(om/update-state! owner (fn [s] (merge s {:state :selecting})))
-                            :style #js {:color (:link theme)}}
-                       (get cursor key))
-             (dom/div #js {:className "goog-flat-menu-button"}
-                      (str "Choose a " key)
-                      (apply dom/div #js  {:id (om/get-state owner :id)
-                                           :className "goog-menu"}
-                             (map #(dom/div #js {:className "goog-menuitem"} %) (om/observe owner (options-ref))))))))))))
+     (reify
+       om/IInitState
+       (init-state [_]
+         {:state :init
+          :id (new-id)})
+       om/IDidMount
+       (did-mount [_]
+         (let [node (om/get-node owner)
+               menu (PopupMenu.)
+               options (om/observe owner (options-ref))
+               click-fn (fn [value]
+                          (om/transact! cursor #(assoc % key value))
+                          (go (>! set-state-ch id)))]
+           (.attach menu node Corner.BOTTOM_START)
+           (doall (map #(.addItem menu (MenuItem. %)) options))
+           (.render menu)
+           (gevents/listen menu Component.EventType.ACTION
+                           (fn [e] (let [value (.getValue e.target)]
+                                     (om/update-state! owner (fn [s] (merge s {:state :init})))
+                                                                       (click-fn value))))))
+       om/IRenderState
+       (render-state [_ state]
+         (if (and (= :init (:state state))
+                  (contains? cursor key)
+                  (not (= "none" (get cursor key))))
+           (dom/span #js {:onClick #(om/update-state! owner (fn [s] (merge s {:state :selecting})))
+                          :style #js {:color (:link theme)}}
+                     (get cursor key))
+           (dom/div #js {:className "goog-flat-menu-button"}
+                    (str "Choose a " key))))))))

 (def grid-type-editor
   (select-editor-builder "grid-type" grid-types))


Subgrids by name or id technically works, but the UI blows up afterward.

--- sonic-jam/src/sonic_jam/core.cljs
+++ sonic-jam/src/sonic_jam/core.cljs
@@ -374,40 +374,49 @@
     copy-id))

 (defn type-editor [{:keys [cursor id set-state-ch]} owner]
-  (let [menu-id-map {"copy of bar" "prlimuhi"}
+  (let [menu-item-fn (fn [owner] (apply hash-map
+                                        (apply concat (map #(let [id (first %)
+                                                                  grid (second %)]
+                                                              (if (and (contains? % "name")
+                                                                       (not (= "" (get % "name"))))
+                                                                [(str "copy of " (get % "name") "(" (get % "id") ")") id]
+                                                                [(str "copy of " id) id]))
+                                                           (om/observe owner (grids))))))
         commit-fn (fn [{:keys [cursor id set-state-ch value owner]}]
-                    (cond
-                      (contains? menu-id-map value)
-                      (let [grid-id (get menu-id-map value)
-                            copy-id (deep-copy (om/observe owner (grids)) grid-id set-state-ch)]
+                    (let [menu-id-map (menu-item-fn owner)]
+                      (cond
+                        (contains? menu-id-map value)
+                        (let [grid-id (get menu-id-map value)
+                              copy-id (deep-copy (om/observe owner (grids)) grid-id set-state-ch)]
+                          (om/transact! cursor (fn [c] (assoc c
+                                                              "type" "grid"
+                                                              "synth-params" {}
+                                                              "sample-params" {}
+                                                              "grid-id" copy-id))))
+                        (= "new" value)
+                        (let [grid-id (new-id)
+                              grid {"name" ""
+                                    "id" grid-id
+                                    "bpc" "1"
+                                    "tracks" []}]
+                          (om/transact! cursor (fn [c] (assoc c
+                                                              "type" "grid"
+                                                              "synth-params" {}
+                                                              "sample-params" {}
+                                                              "grid-id" grid-id)))
+                          (om/transact! (om/observe owner (grids))
+                                        (fn [c] (assoc c (get grid "id") grid)))
+                          (go (>! set-state-ch grid-id)))
+                        (= "sample" value)
                         (om/transact! cursor (fn [c] (assoc c
-                                                            "type" "grid"
-                                                            "synth-params" {}
-                                                            "sample-params" {}
-                                                            "grid-id" copy-id))))
-                      (= "new" value)
-                      (let [grid-id (new-id)
-                            grid {"name" ""
-                                  "id" grid-id
-                                  "bpc" "1"
-                                  "tracks" []}]
+                                                            "type" value
+                                                            "sample-params" {})))
+                        (= "synth" value)
                         (om/transact! cursor (fn [c] (assoc c
-                                                            "type" "grid"
-                                                            "synth-params" {}
-                                                            "sample-params" {}
-                                                            "grid-id" grid-id)))
-                        (om/transact! (om/observe owner (grids))
-                                      (fn [c] (assoc c (get grid "id") grid)))
-                        (go (>! set-state-ch grid-id)))
-                      (= "sample" value)
-                      (om/transact! cursor (fn [c] (assoc c
-                                                          "type" value
-                                                          "sample-params" {})))
-                      (= "synth" value)
-                      (om/transact! cursor (fn [c] (assoc c
-                                                          "type" value
-                                                          "synth-params" {}))))
-                    (go (>! set-state-ch id)))
+                                                            "type" value
+                                                            "synth-params" {})))
+                        :else (print (str "Could not find: " value ". Was it renamed?")))
+                      (go (>! set-state-ch id))))
         listen #(let [state (om/get-state owner)]
                   (when-not (and (= :init (:state state))
                                  (contains? cursor "type")
@@ -447,10 +456,11 @@
                             (dom/div #js {:className "goog-menuitem"} "synth")
                             (dom/div #js {:className "goog-menuitem"} "sample")
                             (dom/div #js {:className "goog-submenu"} "grid"
-                                     (dom/div #js {:className "goog-menu"}
-                                              (dom/div #js {:className "goog-menuitem"} "new")
-                                              (dom/div #js {:className "goog-menuitem"} "copy of root")
-                                              (dom/div #js {:className "goog-menuitem"} "copy of bar"))))))))))
+                                     (apply dom/div #js {:className "goog-menu"}
+                                            (cons
+                                             (dom/div #js {:className "goog-menuitem"} "new")
+                                             (map #(dom/div #js {:className "goog-menuitem"} %)
+                                                  (keys (menu-item-fn owner)))))))))))))

 (defn fx-editor [{:keys [cursor id set-state-ch]} owner]
   (reify


correct route for transactions-api/create

--- src/clj/clj_money/web/server.clj
+++ src/clj/clj_money/web/server.clj
@@ -199,7 +199,7 @@

   (model-route GET "/api/transactions" transactions-api/index)
   (model-route GET "/api/transactions/:id" transactions-api/get-transaction)
-  (model-route POST "/api/transactions" transactions-api/create)
+  (model-route POST "/api/entities/:entity-id/transactions" transactions-api/create)
   (model-route PATCH "/api/transactions/:id" transactions-api/update)
   (model-route DELETE "/api/transactions/:id" transactions-api/delete)


implement get-entity via core.logic; adjust application specific records

--- src/clj/eventsourcing/custom.clj
+++ src/clj/eventsourcing/custom.clj
@@ -57,33 +57,23 @@

 (defn project-facts [facts]
   "Projects given facts to a given timestamp."
-  (let [facts* (volatile! {})
+  (let [;;;facts* (volatile! {})
         xf (fn [xf]
-             (fn
-               ([] (xf))
-               ([result] (xf result))
-               ([result [e a v t action :as input]]
-                (case action
-                  :add (case (get-in @facts* [e a])
-                         true result
-                         ::retracted (do (vswap! facts* #(update-in % [e] dissoc a))
-                                         result)
-                         nil (do (vswap! facts* #(assoc-in % [e a] true))
-                                 (xf result (take 4 input))))
-                  :retract (do (vswap! facts* #(assoc-in % [e a] ::retracted))
-                               result)))))]
+             (let [facts* (volatile! {})]
+               (fn
+                 ([] (xf))
+                 ([result] (xf result))
+                 ([result [e a v t action :as input]]
+                  (case action
+                    :add (case (get-in @facts* [e a])
+                           true result
+                           ::retracted (do (vswap! facts* #(update-in % [e] dissoc a))
+                                           result)
+                           nil (do (vswap! facts* #(assoc-in % [e a] true))
+                                   (xf result (take 4 input))))
+                    :retract (do (vswap! facts* #(assoc-in % [e a] ::retracted))
+                                 result))))))]
     (into [] xf facts)))
-
-(defn get-entity [eid]
-  "Retrieves entire entity."
-  (let [facts (-> (get-facts :where-criteria {:eid eid})
-                  project-facts)]
-    (reduce (fn [s [e a v t]]
-              (if-not (contains? s a)
-                (assoc s a v)
-                s))
-            {}
-            facts)))

 (defn- new-eid []
   #_(str (java.util.UUID/randomUUID))
@@ -161,27 +151,46 @@

 ;;;
+;;; GENERIC ENTITY-AWARE STUFF:
+;;;
+
+(defn get-entity [eid]
+  "Retrieves entire entity."
+  (let [db (get-logic-db)
+        efacts (lp/with-db db
+                 (l/run* [q]
+                   (l/fresh [e a v]
+                     (fact e a v (l/lvar))
+                     (l/== e eid)
+                     (l/== q [e a v (l/lvar)]))))]
+    (reduce (fn [s [e a v t]]
+              (assoc s a v))
+            {}
+            efacts)))
+
+
+;;;
 ;;; APPLICATION SPECIFIC STUFF
 ;;;

 (defrecord User [])
-(defrecord Booking [])
+(defrecord Comment [])

 (defmethod print-method User [v ^java.io.Writer w]
-  (print-method (into {} (dissoc v :bookings)) w))
-
-(defmethod print-method Booking [v ^java.io.Writer w]
+  (print-method (into {} (dissoc v :comments)) w))
+
+(defmethod print-method Comment [v ^java.io.Writer w]
   (print-method (into {} (dissoc v :users)) w))

 (declare get-user)
-(declare get-booking)
+(declare get-comment)

 (defn get-user [eid]
   (map->User (merge (get-entity eid)
-                    {:bookings (lazy-seq [(get-booking 2)])})))
-
-(defn get-booking [eid]
-  (map->Booking (get-entity eid)))
+                    {:comments (lazy-seq [(get-comment 3)])})))
+
+(defn get-comment [eid]
+  (map->Comment (get-entity eid)))

 #_(evdb/open)
@@ -202,6 +211,8 @@
       (l/== q [e2 a2 v2 t2])))
 #_(get-entity 1)

+#_(get-user 2)
+
 #_(lp/with-db (get-logic-db)
     (l/run* [q]
       (l/fresh [eu vu


Handle a (Failjure) failure in the repair service

--- src/clj/mdr2/routes/services.clj
+++ src/clj/mdr2/routes/services.clj
@@ -22,7 +22,8 @@
     [mdr2.production.spec :as prod.spec]
     [mdr2.pipeline1 :as pipeline]
     [mdr2.repair.core :as repair]
-    [mdr2.dtbook.validation :as validation]))
+    [mdr2.dtbook.validation :as validation]
+    [failjure.core :as fail]))

 (def default-limit 100)

@@ -152,10 +153,9 @@
                             (nil? p) (not-found)
                             (not= (:state p) "archived") (conflict {:status-text "Only archived productions can be repaired"})
                             :else (let [p (prod/repair! p)]
-                                    (if-not (nom/anomaly? p)
+                                    (if-not (fail/failed? p)
                                       (no-content)
-                                      (bad-request {:status-text
-                                                    (ex-message (:exception (nom/payload p)))}))))))}}]
+                                      (bad-request {:status-text (fail/message p)}))))))}}]

     ["/:id/xml"
      {:get {:summary "Get the DTBook XML structure for a production"


Dashboard, see if we need to redirect after login

--- src/clj/salava/social/routes.clj
+++ src/clj/salava/social/routes.clj
@@ -14,7 +14,19 @@
 (defn route-def [ctx]
   (routes
    (context "/social" []
-            (layout/main ctx "/")
+            (GET "/" []
+                 :no-doc true
+                 :summary ""
+                 :auth-rules access/signed
+                 :current-user current-user
+                 :flash-message flash-message
+                 (let [redirect-to (get-in req [:cookies "login_redirect" :value])
+                       new-cookie {:value nil :max-age 600 :http-only true :path "/"}]
+                   (if (and redirect-to (string/starts-with? redirect-to "/"))
+                     (-> (redirect (str (get-base-path ctx) redirect-to))
+                         (assoc-in [:cookies "login_redirect"] new-cookie))
+                     (layout/main-response ctx current-user flash-message nil))))
+
             (layout/main ctx "/connections")
             (layout/main ctx "/stream")
             (layout/main ctx "/stats"))


Add test for Salsette Slums

Add test for Salsette Slums

--- src/clj/test/cards-resources.clj
+++ src/clj/test/cards-resources.clj
@@ -694,6 +694,81 @@
     (take-credits state :runner)
     (is (= 3 (count (:hand (get-runner)))) "Drew no cards, at maximum")))

+(deftest salsette-slums
+  "Salsette Slums - Once per turn, when the trash cost of a card is paid, optionally remove from the game"
+  (do-game
+    (new-game (default-corp [(qty "Hostile Infrastructure" 1) (qty "Tech Startup" 1) (qty "Thomas Haas" 1)
+                             (qty "Hedge Fund" 3) (qty "Restructure" 3) (qty "The Root" 3) (qty "Mumba Temple" 3)])
+              (default-runner [(qty "Salsette Slums" 2) (qty "Sure Gamble" 2) (qty "Hyperdriver" 1)]))
+    ; Use Hostile Infrastructure to ensure on-trash effects don't fire.
+    (core/move state :corp (find-card "Hostile Infrastructure" (:deck (get-corp))) :hand)
+    (core/move state :corp (find-card "Tech Startup" (:deck (get-corp))) :hand)
+    (core/move state :corp (find-card "Thomas Haas" (:deck (get-corp))) :hand)
+    (play-from-hand state :corp "Tech Startup" "New remote")
+    (play-from-hand state :corp "Hostile Infrastructure" "New remote")
+    (play-from-hand state :corp "Thomas Haas" "New remote")
+    (take-credits state :corp)
+    ; Allows the main part of the test case to happen on one turn
+    (play-from-hand state :runner "Hyperdriver")
+    (take-credits state :runner)
+    (take-credits state :corp)
+    (card-ability state :runner (get-program state 0) 0)
+    (play-from-hand state :runner "Salsette Slums")
+    (play-from-hand state :runner "Salsette Slums")
+    ; Sanity check
+    (is (= 3 (:credit (get-runner))))
+    (let [ts1 (get-content state :remote1 0)
+          hostile2 (get-content state :remote2 0)
+          th3 (get-content state :remote3 0)
+          salsette1 (get-resource state 0)
+          salsette2 (get-resource state 1)]
+      (core/rez state :corp hostile2)
+      (run-empty-server state "Server 1")
+      (is (not (empty? (:prompt (get-runner)))) "Prompting to trash.")
+      (card-ability state :runner salsette1 0)
+      (is (empty? (:prompt (get-runner))) "All prompts done")
+      (is (= 2 (count (:hand (get-runner)))) "On-trash ability of other Hostile didn't fire")
+      (is (= (:cid ts1) (:cid (last (:rfg (get-corp))))) "Tech Startup was removed from game")
+      (is (= 2 (:credit (get-runner))) "Runner paid the trash cost.")
+      (is (not (:run @state)) "Run is over")
+      (run-empty-server state :remote2)
+      (is (not (empty? (:prompt (get-runner)))) "Prompting to trash")
+      ; Only able to use the ability once per turn
+      (card-ability state :runner salsette1 0)
+      (is (not (empty? (:prompt (get-runner)))) "Still prompting to trash")
+      (is (:run @state) "Run is still occurring")
+      ; Can't use the ability if you can't afford to trash
+      (card-ability state :runner salsette2 0)
+      (is (not (empty? (:prompt (get-runner)))) "Still prompting to trash")
+      (is (:run @state) "Run is still occurring")
+      (prompt-choice :runner "No")
+      ; Test the "oops I forgot" ability (runner feels bad that they forgot to use Slums when a Hostile is out)
+      (run-empty-server state :remote3)
+      (prompt-choice :runner "Yes")
+      ; Can only use that first Slums once
+      (card-ability state :runner salsette1 1)
+      (is (empty? (:prompt (get-runner))) "Not prompting the runner")
+      (is (not (= (:cid th3) (:cid (last (:rfg (get-corp)))))) "Card was not removed from the game")
+      (card-ability state :runner salsette2 1)
+      (is (not (empty? (:prompt (get-runner)))) "Prompting the runner to choose a card")
+      (prompt-select :runner (find-card "Thomas Haas" (:discard (get-corp))))
+      (is (= (:cid th3) (:cid (last (:rfg (get-corp))))) "Card was removed from the game")
+      (take-credits state :runner))
+    ; Set things up so we can trash the Hostile and then make sure we can't "oops I forgot on a later turn"
+    (take-credits state :corp)
+    (take-credits state :runner)
+    (take-credits state :corp)
+    (run-empty-server state :remote2)
+    (prompt-choice :runner "Yes")
+    (take-credits state :runner)
+    (take-credits state :corp)
+    (let [salsette1 (get-resource state 0)
+          hostile2 (get-content state :remote2 0)]
+      (card-ability state :runner salsette1 1)
+      (prompt-select :runner (find-card "Hostile Infrastructure" (:discard (get-corp))))
+      (is (not (= (:cid hostile2) (:cid (last (:rfg (get-corp)))))) "Did not remove card from game"))
+    ))
+
 (deftest security-testing
   "Security Testing - Ability"
   (do-game


Refactor world drawing out

Refactor world drawing out

--- src/cljs/caves_of_cljs/game.cljs
+++ src/cljs/caves_of_cljs/game.cljs
@@ -73,6 +73,15 @@
 ;; -------------------------
 ;; Render

+(defn draw-world [screen vrows vcols start-x start-y end-x end-y tiles]
+  (doseq [[vrow-idx mrow-idx] (map vector
+                                   (range 0 vrows)
+                                   (range start-y end-y))
+          :let [row-tiles (subvec (tiles mrow-idx) start-x end-x)]]
+    (doseq [vcol-idx (range vcols)
+            :let [{:keys [glyph color]} (row-tiles vcol-idx)]]
+      (.draw screen vcol-idx vrow-idx glyph))))
+
 (defmulti draw-ui
   (fn [ui game screen]
     (:kind ui)))
@@ -90,20 +99,16 @@
   (.drawText screen 0 1 "Press escape to exit, anything else to go."))

 (defmethod draw-ui :play [ui {{:keys [tiles]} :world :as game} screen]
-  (let [{:keys [cols rows]} screen-size
+  (let [world (:world game)
+        tiles (:tiles world)
+        {:keys [cols rows]} screen-size
         vcols cols
         vrows (dec rows)
         start-x 0
         start-y 0
         end-x (+ start-x vcols)
         end-y (+ start-y vrows)]
-    (doseq [[vrow-idx mrow-idx] (map vector
-                                     (range 0 vrows)
-                                     (range start-y end-y))
-            :let [row-tiles (subvec (tiles mrow-idx) start-x end-x)]]
-      (doseq [vcol-idx (range vcols)
-              :let [{:keys [glyph color]} (row-tiles vcol-idx)]]
-        (.draw screen vcol-idx vrow-idx glyph)))))
+    (draw-world screen vrows vcols start-x start-y end-x end-y tiles)))

 (defn draw-game [game screen]
   (.clear screen)


cleanup component tables

cleanup component tables

--- src/cljs/material/component.cljs
+++ src/cljs/material/component.cljs
@@ -466,8 +466,7 @@
         (fn [index header]
           (table-header-column
             {:key   (str "thc-" index)
-             :style (select-keys header [:width])
-             }
+             :style (select-keys header [:width])}
             (:name header))) headers))))

 (defn list-table-body
@@ -540,7 +539,7 @@
   [headers]
   (table-header
     {:key               "th"
-     :style             {:backgroundColor "rgb(245, 245, 245)"}
+     :style             {:border "none"}
      :displaySelectAll  false
      :adjustForCheckbox false}
     (table-row
@@ -552,7 +551,11 @@
           (table-header-column
             {:key   (str "thc-" index)
              :style {:height "30px"}}
-            (:name header))) headers))))
+            header)) headers)
+      (table-header-column
+        {:key   "thc"
+         :style {:height "30px"
+                 :width  "100%"}} ""))))

 (defn list-table-auto-body
   [items clickable? render-item-fn render-items-key]
@@ -563,15 +566,23 @@
     (map-indexed
       (fn [index item]
         (table-row
-          {:key       (str "tr-" (hash item))
-           :style     (when clickable? {:cursor "pointer"})
-           :rowNumber index}
+          {:key           (str "tr-" (hash item))
+           :style         (merge
+                            {:height "30px"}
+                            (when clickable? {:cursor "pointer"}))
+           :displayBorder false
+           :rowNumber     index}
           (->> (select-keys* item render-items-key)
                (map-indexed
                  (fn [coll-index coll]
                    (table-row-column
-                     {:key (str "trc-" index "-" coll-index)}
-                     (render-item-fn coll item))))))) items)))
+                     {:key   (str "trc-" index "-" coll-index)
+                      :style {:height "30px"}}
+                     (render-item-fn coll item)))))
+          (table-row-column
+            {:key   (str "trc-" index)
+             :style {:height "30px"
+                     :width  "100%"}} ""))) items)))

 (defn list-table-auto
   [headers items render-item-fn render-items-key onclick-handler-fn]
@@ -580,11 +591,7 @@
       (table
         {:key         "tbl"
          :fixedHeader false
-         :style       {:tableLayout  "auto"
-                       :width        "auto"
-                       :borderTop    "1px solid rgb(224, 228, 231)"
-                       :borderRight  "1px solid rgb(224, 228, 231)"
-                       :borderBottom "1px solid rgb(224, 228, 231)"}
+         :style       {:tableLayout "auto"}
          :selectable  false
          :onCellClick (fn [i]
                         (when (some? onclick-handler-fn)
@@ -596,79 +603,29 @@
                               render-item-fn
                               render-items-key)))))

-;; List selectable component
-
-(defn list-selecttable-header
+;; Form table component
+
+(defn form-table-header
   [headers]
   (table-header
     {:key               "th"
-     :displaySelectAll  true
-     :adjustForCheckbox true
-     :enableSelectAll   true
+     :displaySelectAll  false
+     :adjustForCheckbox false
      :style             {:border "none"}}
     (table-row
       {:key           "tr"
-       :displayBorder true}
+       :displayBorder false
+       :style         {:height "35px"}}
       (map-indexed
         (fn [index header]
           (table-header-column
-            {:key (str "thc-" index)}
-            header)) headers))))
-
-(defn list-selecttable-body
-  [items render-item-fn render-items-key]
-  (table-body
-    {:key                 "tb"
-     :showRowHover        true
-     :deselectOnClickaway true
-     :displayRowCheckbox  true}
-    (map-indexed
-      (fn [index item]
-        (table-row
-          {:key       (str "tr-" (hash item))
-           :style     {:cursor "pointer"}
-           :rowNumber index}
-          (->> (select-keys* item render-items-key)
-               (map #(table-row-column
-                       {:key (str "trc-" (:id item))}
-                       (render-item-fn % item)))))) items)))
-
-(defn list-selectable
-  [headers items render-item-fn render-items-key]
-  (mui
-    (table
-      {:key            "tbl"
-       :selectable     true
-       :onRowSelection nil}
-      (list-selecttable-header headers)
-      (list-selecttable-body items
-                             render-item-fn
-                             render-items-key))))
-
-;; Form table component
-
-(defn form-table-header
-  [headers]
-  (let [el-style {:height "35px"}]
-    (table-header
-      {:key               "th"
-       :displaySelectAll  false
-       :adjustForCheckbox false
-       :style             {:border "none"}}
-      (table-row
-        {:key           "tr"
-         :displayBorder false
-         :style         el-style}
-        (map-indexed
-          (fn [index header]
-            (table-header-column
-              {:key   (str "thc-" index)
-               :style (merge (select-keys header [:width])
-                             el-style)}
-              (:name header))) headers)
-        (table-header-column
-          {:key   "thc"
-           :style el-style} "")))))
+            {:key   (str "thc-" index)
+             :style (merge (select-keys header [:width])
+                           {:height "35px"})}
+            (:name header))) headers)
+      (table-header-column
+        {:key   "thc"
+         :style {:height "35px"}} ""))))

 (defn form-table-body
   [headers items data render-items-fn remove-item-fn]
@@ -717,56 +674,55 @@
 ;; Info table component

 (defn form-info-table-header [headers]
-  (let [el-style {:height "20px"}]
-    (table-header
-      {:key               "th"
-       :displaySelectAll  false
-       :adjustForCheckbox false
-       :style             {:border "none"}}
-      (table-row
-        {:key           "tr"
-         :displayBorder false
-         :style         el-style}
-        (map-indexed
-          (fn [index header]
-            (table-header-column
-              {:key   (str "thc-" index)
-               :style el-style}
-              (:name header))) headers)
-        (table-header-column
-          {:key   "thc"
-           :style el-style} "")))))
+  (table-header
+    {:key               "th"
+     :displaySelectAll  false
+     :adjustForCheckbox false
+     :style             {:border "none"}}
+    (table-row
+      {:key           "tr"
+       :displayBorder false
+       :style         {:height "20px"}}
+      (map-indexed
+        (fn [index header]
+          (table-header-column
+            {:key   (str "thc-" index)
+             :style {:height "20px"}}
+            (:name header))) headers)
+      (table-header-column
+        {:key   "thc"
+         :style {:height "20px"
+                 :width  "100%"}} ""))))

 (defn form-info-table-body [items render-item-fn render-items-key]
-  (let [el-style {:height "20px"}]
-    (table-body
-      {:key                "tb"
-       :showRowHover       true
-       :displayRowCheckbox false}
-      (map-indexed
-        (fn [index item]
-          (table-row
-            {:key           (str "tr-" index)
-             :rowNumber     index
-             :displayBorder false
-             :style         el-style}
-            (->> (select-keys* item render-items-key)
-                 (map-indexed
-                   (fn [coll-index coll]
-                     (table-row-column
-                       {:key   (str "trc-" index "-" coll-index)
-                        :style el-style}
-                       (render-item-fn coll item)))))
-            (table-header-column
-              {:key   (str "trc-" index)
-               :style el-style} ""))) items))))
+  (table-body
+    {:key                "tb"
+     :showRowHover       true
+     :displayRowCheckbox false}
+    (map-indexed
+      (fn [index item]
+        (table-row
+          {:key           (str "tr-" index)
+           :rowNumber     index
+           :displayBorder false
+           :style         {:height "20px"}}
+          (->> (select-keys* item render-items-key)
+               (map-indexed
+                 (fn [coll-index coll]
+                   (table-row-column
+                     {:key   (str "trc-" index "-" coll-index)
+                      :style {:height "20px"}}
+                     (render-item-fn coll item)))))
+          (table-header-column
+            {:key   (str "trc-" index)
+             :style {:height "20px"
+                     :width  "100%"}} ""))) items)))

 (defn form-info-table [headers items render-item-fn render-items-key]
   (mui
     (table
       {:key   "tbl"
-       :style {:tableLayout "auto"
-               :width       "auto"}}
+       :style {:tableLayout "auto"}}
       (form-info-table-header headers)
       (form-info-table-body items render-item-fn render-items-key))))

@@ -774,6 +730,5 @@
   (mui
     (table
       {:key   "tbl"
-       :style {:tableLayout "auto"
-               :width       "auto"}}
+       :style {:tableLayout "auto"}}
       (form-info-table-body items render-item-fn render-items-key))))


No need for direct access to play-clj.utils

--- src/clojure/nightmod/sandbox.clj
+++ src/clojure/nightmod/sandbox.clj
@@ -57,7 +57,8 @@
                                nightmod.repl
                                nightmod.sandbox
                                nightmod.screens
-                               nightmod.utils])
+                               nightmod.utils
+                               play-clj.utils])
    (jail-test/blanket "clojail")])

 (def context


Don’t both isolate and inject Postal!

Don’t both isolate and inject Postal!

--- src/containium/modules/boxes.clj
+++ src/containium/modules/boxes.clj
@@ -74,7 +74,6 @@
                                                                "|clojure.(java|xml|zip).*"
                                                                "|ring\\.middleware.*"
                                                                "|ring\\.util\\.codec.*"
-                                                               "|postal.*"
                                                                "|org\\.httpkit.*"
                                                                "|clj.time.*"))]
                                             (dosync (commute @#'clojure.core/*loaded-libs*


added cookie argument so crawler can use it

--- src/crawler/template_removal.clj
+++ src/crawler/template_removal.clj
@@ -7,19 +7,19 @@
 (def my-cs (cookies/cookie-store))

 (defn look-at
-  ([a-link]
-     (look-at a-link (set [])))
+  ([a-link cookie]
+     (look-at a-link cookie (set [])))

-  ([a-link blacklist]
-     (try (let [body  (-> a-link (client/get {:cookie-store my-cs}) :body)]
+  ([a-link cookie blacklist]
+     (try (let [body  (-> a-link (client/get {:cookie-store cookie}) :body)]
             (extractor/state-action body a-link blacklist))
           (catch Exception e nil))))

 (defn all-xpaths
-  ([page-src url]
-     (all-xpaths page-src url (set [])))
+  ([page-src url cookie]
+     (all-xpaths page-src url (set []) cookie))

-  ([page-src url blacklist]
+  ([page-src url blacklist cookie]
      (let [infos   (extractor/state-action page-src url blacklist)

            samples          (reduce
@@ -46,7 +46,7 @@
                                                     (map (fn [x]
                                                            (do
                                                              (Thread/sleep 2000)
-                                                             (look-at x))) l))
+                                                             (look-at x cookie (set [])))) l))

                                      action-space-map (into
                                                        {}


Added reduce-tree function.

Added reduce-tree function.

--- evermind.core/src/evermind/domain/core.cljc
+++ evermind.core/src/evermind/domain/core.cljc
@@ -28,6 +28,10 @@
                                     (first
                                       (gen/sample
                                         (s/gen (s/fspec :args (s/cat :node ::node) :ret boolean?)) 1))))))
+
+(s/def ::reduce-result (s/coll-of ::node :kind set? :into #{}))
+
+

 (defn generate-id
   ([] (str (uuid/make-random))))
@@ -122,6 +126,21 @@

+(defn reduce-tree
+  ([node pred]
+   (let [init (if (pred node) #{node} #{})]
+    (reduce
+      (fn [a n]
+        (cljset/union a (reduce-tree n pred)))
+      init
+      (-> node :children)))))
+
+(s/fdef reduce-tree
+        :args (s/cat :node ::node :pred ::node-pred)
+        :ret ::reduce-result)
+
+
+
 (defn create-mindmap
   ([] (create-node)))


logging groups now are always closed

logging groups now are always closed

--- examples/todomvc/src/app/middleware/logging.cljs
+++ examples/todomvc/src/app/middleware/logging.cljs
@@ -7,12 +7,15 @@
   ([spec prefix]
    {:pre [(:control spec) (:reconcile spec)]}
    (-> spec
-       (update :control helpers/before-do
-               (fn [_model signal _dispatch]
-                 (.group js/console (str prefix "signal =") (pr-str signal))))
-       (update :control helpers/after-do
-               (fn [_model _signal _dispatch]
-                 (.groupEnd js/console)))
+       (update :control (fn wrap-control [control]
+                          (fn logged-control [model signal dispatch]
+                            (try
+                              (.group js/console (str prefix "signal =") (pr-str signal))
+                              (control model signal dispatch)
+
+                              ; this clause guarantees that group is closed even in case of excpetion
+                              (finally
+                                (.groupEnd js/console))))))
        (update :reconcile helpers/before-do
                (fn [_model action]
                  (println (str prefix "  action =") (pr-str action)))))))


specify type of collection

specify type of collection

--- src/er_cassandra/model/types.clj
+++ src/er_cassandra/model/types.clj
@@ -19,7 +19,7 @@

 (s/defschema LookupTableSchema
   (merge TableSchema
-         {(s/optional-key :collection) s/Bool}))
+         {(s/optional-key :collection) (s/pred #{:list :set :map})}))

 (s/defschema ModelSchema
   {:primary-table TableSchema


STORM-1670 Fixed unit tests

STORM-1670 Fixed unit tests

--- storm-core/test/clj/org/apache/storm/versioned_store_test.clj
+++ storm-core/test/clj/org/apache/storm/versioned_store_test.clj
@@ -16,6 +16,8 @@
 (ns org.apache.storm.versioned-store-test
   (:use [clojure test])
   (:use [org.apache.storm testing])
+  (:import [java.io File])
+  (:import [org.apache.commons.io FileUtils])
   (:import [org.apache.storm.utils VersionedStore]))

 (defmacro defvstest [name [vs-sym] & body]
@@ -25,18 +27,25 @@
         ~@body
         ))))

+(defn writeToFile [^String file]
+  (FileUtils/writeStringToFile (File. file) (str "time:" (System/currentTimeMillis))))
+
 (defvstest test-empty-version [vs]
   (let [v (.createVersion vs)]
     (.succeedVersion vs v)
+    (writeToFile v)
     (is (= 1 (count (.getAllVersions vs))))
     (is (= v (.mostRecentVersionPath vs)))
     ))

 (defvstest test-multiple-versions [vs]
-  (.succeedVersion vs (.createVersion vs))
+  (let [v (.createVersion vs)]
+    (.succeedVersion vs v)
+    (writeToFile v))
   (Thread/sleep 100)
   (let [v (.createVersion vs)]
     (.succeedVersion vs v)
+    (writeToFile v)
     (is (= 2 (count (.getAllVersions vs))))
     (is (= v (.mostRecentVersionPath vs)))


clean up initial datascript db

clean up initial datascript db

--- src-cljs/frontend/datascript.cljs
+++ src-cljs/frontend/datascript.cljs
@@ -89,40 +89,19 @@
                         :layer/stroke-color "blue"
                         :layer/name         "Radiohead"
                         :entity/type        :layer}])
-    (d/transact! conn [{:layer/type         :rect
-                        :layer/start-x      -10
-                        :layer/start-y      -10
-                        :layer/end-x        10
-                        :layer/end-y        10
-                        :layer/fill         "red"
-                        :layer/stroke-width 2
-                        :layer/stroke-color "blue"
-                        :layer/name         "Lana del rey"
-                        :layer/opacity      0.5
-                        :entity/type        :layer}
-                       {:layer/type         :rect
-                        :layer/start-x      -10
-                        :layer/start-y      -10
-                        :layer/end-x        10
-                        :layer/end-y        10
-                        :layer/fill         "red"
-                        :layer/stroke-width 2
-                        :layer/stroke-color "blue"
-                        :layer/name         "Jim morrison!"
-                        :layer/opacity      1
-                        :entity/type        :layer}])
-    (print (d/q '[:find ?eid ?n ?sx ?sy ?ex ?ey
-                  :where
-                  [?eid :layer/type :rect]
-                  [?eid :layer/name ?n]
-                  [?eid :layer/start-x ?sx]
-                  [?eid :layer/start-y ?sy]
-                  [?eid :layer/end-x ?ex]
-                  [?eid :layer/end-y ?ey]]
-                @conn))
-    (print (d/q '[:find ?eid ?a ?v
-                  :where
-                  [?eid :entity/type :layer]
-                  [?eid ?a ?v]]
-                @conn))
-    (print (touch-all '[:find ?t :where [?t :layer/name]] @conn))))
+    (comment
+      (print (d/q '[:find ?eid ?n ?sx ?sy ?ex ?ey
+                    :where
+                    [?eid :layer/type :rect]
+                    [?eid :layer/name ?n]
+                    [?eid :layer/start-x ?sx]
+                    [?eid :layer/start-y ?sy]
+                    [?eid :layer/end-x ?ex]
+                    [?eid :layer/end-y ?ey]]
+                  @conn))
+      (print (d/q '[:find ?eid ?a ?v
+                    :where
+                    [?eid :entity/type :layer]
+                    [?eid ?a ?v]]
+                  @conn)))
+    conn))


Do not use ANSI colors when printing exceptions by default.

--- src/active/clojure/condition.cljc
+++ src/active/clojure/condition.cljc
@@ -21,6 +21,7 @@
                     [clojure.main :as main]))
   #?(:clj (:require [io.aviso.exception :as aviso-exception]
                     [io.aviso.columns :as aviso-columns]
+                    [io.aviso.ansi :as aviso-ansi]
                     [clojure.string :as string]))
   #?(:cljs (:require-macros [active.clojure.condition
                              :refer (define-condition-type assert condition raise guard throw-condition)]
@@ -530,6 +531,20 @@
     [type who message (concat stuff more-stuff)]))

 #?(:clj
+(alter-var-root
+ #'io.aviso.exception/*fonts*
+ (constantly
+  {:exception     aviso-ansi/reset-font
+   :reset         aviso-ansi/reset-font
+   :message       aviso-ansi/reset-font
+   :property      aviso-ansi/reset-font
+   :source        aviso-ansi/reset-font
+   :function-name aviso-ansi/reset-font
+   :clojure-frame aviso-ansi/reset-font
+   :java-frame    aviso-ansi/reset-font
+   :omitted-frame aviso-ansi/reset-font})))
+
+#?(:clj
 (defn- preformat-stack-frame
   [frame]
   (cond


rename any? to avoid conflict with clojure 1.9

--- src/clj/com/rpl/specter/impl.cljc
+++ src/clj/com/rpl/specter/impl.cljc
@@ -527,7 +527,7 @@
         (with-meta ret (meta structure))
         ret))))

-(defn any?
+(defn any-pred?
   "Accepts any number of predicates that take in one input and returns a new predicate that returns true if any of them are true"
   [& preds]
   (fn [obj]
@@ -544,18 +544,18 @@
           (eval `(let [~@lv] ~body)))))

-    (let [embeddable? (any? number?
-                            symbol?
-                            keyword?
-                            string?
-                            char?
-                            list?
-                            vector?
-                            set?
-                            #(and (map? %) (not (record? %)))
-                            nil?
-                            #(instance? clojure.lang.Cons %)
-                            #(instance? clojure.lang.LazySeq %))]
+    (let [embeddable? (any-pred? number?
+                                 symbol?
+                                 keyword?
+                                 string?
+                                 char?
+                                 list?
+                                 vector?
+                                 set?
+                                 #(and (map? %) (not (record? %)))
+                                 nil?
+                                 #(instance? clojure.lang.Cons %)
+                                 #(instance? clojure.lang.LazySeq %))]
       (defn eval+
         "Automatically extracts non-evalable stuff into a closure and then evals"
         [form]


error if pathed fn used where navigator expected

--- src/clj/com/rpl/specter/impl.cljx
+++ src/clj/com/rpl/specter/impl.cljx
@@ -1246,9 +1246,17 @@
       (instance? VarUse p)
       (let [v (:var p)
             vv (:val p)]
-        (cond (-> v meta :dynamic) (magic-fail! "Var " (:sym p) " is dynamic")
-              (valid-navigator? vv) vv
-              :else (magic-fail! "Var " (:sym p) " is not a navigator")
+        (cond (-> v meta :dynamic)
+              (magic-fail! "Var " (:sym p) " is dynamic")
+
+              (and (fn? vv) (-> v meta :pathedfn))
+              (throw-illegal "Cannot use pathed fn '" (:sym p) "' where navigator expected")
+
+              (valid-navigator? vv)
+              vv
+
+              :else
+              (magic-fail! "Var " (:sym p) " is not a navigator")
               ))

       (instance? SpecialFormUse p)


continued working on getting a vector of values out of whiz and whoopbang in analysis.clj

--- src/clj/forma/trends/analysis.clj
+++ src/clj/forma/trends/analysis.clj
@@ -111,12 +111,16 @@
 (def long-trend (partial long-trend-general [:coefs :t-tests]))

 (defn lengthening-ts
-  [base-ts start-index end-index]
-  (reverse
-   (into ()
-         (for [x (range start-index end-index)]
-           (take x base-ts)))))
+  [start-index end-index base-vec]
+  (for [x (range start-index (inc end-index))]
+    (subvec base-vec 0 x)))

 (defn whizbang
   [t-series start-period end-period & cofactors]
-  (apply long-trend (lengthening-ts start-period end-period)))
+  [t-series (apply vector cofactors)])
+
+
+
+;; (map long-trend
+;;        ((partial lengthening-ts start-period end-period)
+;;           [t-series cofactors]))


valid-creditcard?

valid-creditcard?

--- src/clojure/nossal/shop/spec.cljc
+++ src/clojure/nossal/shop/spec.cljc
@@ -2,6 +2,7 @@
   (:require [clojure.spec.alpha :as s]))

 (defn valid-luhn? [pan]
+  "https://en.wikipedia.org/wiki/Luhn_algorithm#Clojure"
   (letfn [(char->int [c] (- (int c) (int \0)))
           (mod-10? [n] (zero? (mod n 10)))
           (sum-luhn-pair [[m n]]
@@ -15,6 +16,8 @@
          (apply +)
          mod-10?)))

+(defn valid-creditcard? [number]
+  (and (= 16 (count number)) (valid-luhn? number)))

 (def email-regex #"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,63}$")
 (def phone-regex #"^(?:(?:\+|00)?(55)\s?)?(?:\(?([1-9][0-9])\)?\s?)?(?:((?:9\d|[2-9])\d{3})\-?(\d{4}))$")
@@ -92,7 +95,7 @@
                                 ::shipping-tracking
                                 ::address
                                 ::creation-time]))
-(s/def ::card-number (s/and string? valid-luhn?))
+(s/def ::card-number (s/and string? valid-creditcard?))
 (s/def ::creadit-card (s/keys :req [::card-number
                                     ::holder
                                     ::expiration-date


Deleted parallel-canonical-base

Deleted parallel-canonical-base

it's not really parallel anyway

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

--- src/conexp/contrib/algorithms.clj
+++ src/conexp/contrib/algorithms.clj
@@ -14,16 +14,6 @@

 ;;;

-(defn parallel-canonical-base
-  "Computes the canonical base of the context «ctx» in a parallel way, dividing the object
-  set in chunks of size at most «n» each"
-  [ctx n]
-  (apply cm/intersect-implicational-theories
-         (cm/attributes ctx)
-         (pmap (fn [objs]
-                 (cm/canonical-base (cm/make-context objs (cm/attributes ctx) (cm/incidence ctx))))
-               (partition-all n (cm/objects ctx)))))
-
 (cm/defalias linclosure conexp.contrib.algorithms.linclosure/close-under-implications)

 ;;;


:sparkles: Simplify shape deletion code.

--- frontend/src/uxbox/main/data/workspace.cljs
+++ frontend/src/uxbox/main/data/workspace.cljs
@@ -1344,17 +1344,6 @@
                   (reverse (map :id rchanges)))]
         (rx/of (commit-changes rchanges uchanges {:commit-local? true}))))))

-(defn- delete-frame
-  [id]
-  (ptk/reify ::delete-shapes
-    ptk/WatchEvent
-    (watch [_ state stream]
-      (let [page-id (::page-id state)
-            objects (get-in state [:workspace-data page-id :objects])
-            obj (get objects id)
-            ids (d/concat [] (:shapes obj) [(:id obj)])]
-        (rx/of (delete-shapes ids))))))
-
 (def delete-selected
   "Deselect all and remove all selected shapes."
   (ptk/reify ::delete-selected
@@ -1366,17 +1355,8 @@

             shapes (map lookup selected)
             shape? #(not= (:type %) :frame)]
-        (cond
-          (and (= (count shapes) 1)
-               (= (:type (first shapes)) :frame))
-          (rx/of (delete-frame (first selected)))
-
-          (and (pos? (count shapes))
-               (every? shape? shapes))
-          (rx/of (delete-shapes selected))
-
-          :else
-          (rx/empty))))))
+        (rx/of (delete-shapes selected))))))
+

 ;; --- Rename Shape


:lipstick: Fix merge issues.

:lipstick: Fix merge issues.

--- frontend/src/uxbox/main/data/workspace.cljs
+++ frontend/src/uxbox/main/data/workspace.cljs
@@ -2268,10 +2268,8 @@
    "ctrl+shift+l" #(st/emit! (toggle-layout-flag :layers))
    "+" #(st/emit! increase-zoom)
    "-" #(st/emit! decrease-zoom)
-
    "ctrl+g" #(st/emit! (create-group))
    "ctrl+shift+g" #(st/emit! (remove-group))
-
    "shift+0" #(st/emit! zoom-to-50)
    "shift+1" #(st/emit! reset-zoom)
    "shift+2" #(st/emit! zoom-to-200)
@@ -2285,8 +2283,6 @@
    "ctrl+t" #(st/emit! (select-for-drawing :text))
    "ctrl+c" #(st/emit! copy-selected)
    "ctrl+v" #(st/emit! paste)
-   "ctrl+g" #(st/emit! (create-group))
-   ;; "ctrl+shift+g" #(st/emit! remove-group)
    "esc" #(st/emit! :interrupt deselect-all)
    "delete" #(st/emit! delete-selected)
    "ctrl+up" #(st/emit! (vertical-order-selected :up))


Remove unused imports from web

Remove unused imports from web

--- src/leiningen/new/cljskel/web.clj
+++ src/leiningen/new/cljskel/web.clj
@@ -1,14 +1,9 @@
 (ns {{name}}.web
     (:require [compojure.core :refer [defroutes context GET PUT POST DELETE]]
               [compojure.route :as route]
-              [compojure.handler :as handler]
               [ring.middleware.format-response :refer [wrap-json-response]]
               [ring.middleware.params :refer [wrap-params]]
               [ring.middleware.keyword-params :refer [wrap-keyword-params]]
-              [clojure.data.xml :refer [element emit-str]]
-              [clojure.string :refer [split]]
-              [clojure.tools.logging :refer [info warn error]]
-              [environ.core :refer [env]]
               [nokia.ring-utils.error :refer [wrap-error-handling error-response]]
               [nokia.ring-utils.metrics :refer [wrap-per-resource-metrics replace-outside-app
                                                 replace-guid replace-mongoid replace-number]]


Fixed col to dissoc all className conditions

--- src/main/untangled/ui/layout.cljc
+++ src/main/untangled/ui/layout.cljc
@@ -32,7 +32,7 @@
                     valign (str " u-" (name valign))
                     density (str " u-row--" (name density)))
         attrs     (-> props
-                    (dissoc :distribute-extra-columns)
+                    (dissoc :distribute-extra-columns :halign :valign :density)
                     (assoc :className classes)
                     clj->js)]
     (apply dom/div attrs children)))
@@ -61,7 +61,7 @@
                   lg-push (str " u-push--" lg-push "@lg")
                   xl-push (str " u-push--" xl-push "@xl"))
         attrs   (-> props
-                  (dissoc :width :sm-width :md-width :lg-width :xl-width :halign :valign :push)
+                  (dissoc :width :halign :valign :sm-width :md-width :lg-width :xl-width :push :sm-push :md-push :lg-push :xl-push)
                   (assoc :className classes)
                   clj->js)]
     (apply dom/div attrs children)))