additional test

additional test

--- test/dalap/test/html.clj
+++ test/dalap/test/html.clj
@@ -16,7 +16,14 @@
   ([in out msg] `(is (= (to-html ~in) ~out) ~msg)))

 (deftest test-basic-types
+  (assert-html 1 "1" "to-html should work on non-container types")
+  (assert-html [1] "1" "should be the same as the non-container version")
+
   (assert-html basic-sample-data basic-sample-data-str)
+  (assert-html [[[basic-sample-data]]] basic-sample-data-str)
+  (assert-html (seq [[[basic-sample-data]]]) basic-sample-data-str)
+  (assert-html (list (list basic-sample-data)) basic-sample-data-str)
+  (assert-html (for [el basic-sample-data] el) basic-sample-data-str)

   (assert-html ["" :ti&tle "fo\"o"] ":ti&tlefo"o"
                "the keyword above should be HTML escaped"))


Testing : Fixing comment for existing defspec.

Now, the property-based test should run without error.

--Tom

--- test/hatch/slam_test.clj
+++ test/hatch/slam_test.clj
@@ -8,9 +8,10 @@
            [clojure.test.check.properties :as prop]
            [clojure.test.check.clojure-test :refer [ defspec]]))

+
+;;Testing the 'assumed truth' that the output of the slam function
+;;is in fact a valid keyword.
 (defspec slam-output-is-keyword
-  "Testing the 'assumed truth' that the output of the slam function
-   is in fact a valid keyword."
   100 ;; the number of iterations for test.check to test
   (prop/for-all [v (gen/vector gen/keyword 2)] ;;gen pairs of keywords
     (keyword? (h/slam (nth v 0) (nth v 1)))))


explicit close connection

explicit close connection

--- sources/src/clj/ru/jms/testingtool/mq.clj
+++ sources/src/clj/ru/jms/testingtool/mq.clj
@@ -4,19 +4,25 @@
            (java.io IOException))
   (:use ru.jms.testingtool.mq-init))

+(defn ^Connection get-connection [connection-info]
+  (try
+    (let [^QueueConnectionFactory qcf (create-qcf connection-info)
+          ^Connection q (if (clojure.string/blank? (:user connection-info))
+                          (.createConnection qcf)
+                          (.createConnection qcf (:user connection-info) (:password connection-info)))
+          _ (.start q)]
+      q)
+    (catch Exception e
+      (throw (IOException. e)))))
+
 (defn ^Session get-session
-  ([connection-info ack-mode]
+  ([^Connection c ack-mode]
    (try
-     (let [^QueueConnectionFactory qcf (create-qcf connection-info)
-           ^Connection q (if (clojure.string/blank? (:user connection-info))
-                           (.createConnection qcf)
-                           (.createConnection qcf (:user connection-info) (:password connection-info)))
-           _ (.start q)]
-       (.createSession q false ack-mode))
+       (.createSession c false ack-mode)
      (catch Exception e
        (throw (IOException. e)))))
-  ([connection-info]
-   (get-session connection-info Session/AUTO_ACKNOWLEDGE)))
+  ([^Connection c ]
+   (get-session c Session/AUTO_ACKNOWLEDGE)))

 (defn ^Queue get-queue [^Session s queue-info]
@@ -62,18 +68,18 @@
                                    )
     :else (throw (IOException. (str "Not supported message class!" (.getClass msg))))))

-(defn get-type[v]
+(defn get-type [v]
   (if (nil? v)
     :string
     (condp instance? v
-        String :string
-        Long :long
-        Integer :int
-        Short :short
-        Double :double
-        Float :float
-        Boolean :boolean
-        :string
+      String :string
+      Long :long
+      Integer :int
+      Short :short
+      Double :double
+      Float :float
+      Boolean :boolean
+      :string
       )))

 (defn convert-message [^Message msg]
@@ -130,17 +136,20 @@
        (take-while some?)))

 (defn consume-queue [connection-info queue-info]
-  (let [^Session s (get-session connection-info Session/CLIENT_ACKNOWLEDGE)
+  (let [^Connection c (get-connection connection-info)
+        ^Session s (get-session c Session/CLIENT_ACKNOWLEDGE)
         ^Queue q (get-queue s queue-info)
         ^MessageConsumer consumer (.createConsumer s q)
         messages (get-all consumer)
         converted-messages (doall (map convert-message messages))]
     (.close consumer)
     (.close s)
+    (.close c)
     (doall converted-messages)))

 (defn browse-queue [connection-info queue-info]
-  (let [^Session s (get-session connection-info)
+  (let [^Connection c (get-connection connection-info)
+        ^Session s (get-session c)
         ^Queue q (get-queue s queue-info)
         ^QueueBrowser browser (.createBrowser s q)
         ^Enumeration msgs-e (.getEnumeration browser)
@@ -150,6 +159,7 @@
                                     ))]
     (.close browser)
     (.close s)
+    (.close c)
     converted-messages))

 (defn browse-queue-messages [connection-info queue-info]
@@ -162,19 +172,25 @@
       (browse-queue connection-info queue-info))))

 (defn send-messages! [connection-info queue-info messages]
-  (let [^Session s (get-session connection-info)
+  (let [^Connection c (get-connection connection-info)
+        ^Session s (get-session c)
         ^Queue q (get-queue s queue-info)
         ^MessageProducer producer (.createProducer s q)]
     (doall (for [message messages
                  :let [mq-message (convert-message-to-mq s message)]]
              (.send producer mq-message)))
     (.close producer)
-    (.close s)))
+    (.close s)
+    (.close c)
+    ))

 (defn purge-queue! [connection-info queue-info]
-  (let [^Session s (get-session connection-info)
+  (let [^Connection c (get-connection connection-info)
+        ^Session s (get-session c)
         ^Queue q (get-queue s queue-info)
         ^MessageConsumer consumer (.createConsumer s q)]
     (doall (get-all consumer))
     (.close consumer)
-    (.close s)))+    (.close s)
+    (.close c)
+    ))


Revised queries for identifier single and paired-identifier sets

The queries now find subclasses of ccp:IAO_EXT_0000342 (identifier of a
biological entity). This way we can avoid creating biological entities
for PubMed articles, for example.

--- src/kabob/build/id_sets/id_set_triples.clj
+++ src/kabob/build/id_sets/id_set_triples.clj
@@ -126,7 +126,7 @@
     (println "timing count:")
     (let [query-body
           (str "where {
-                ?id_type rdfs:subClassOf* obo:IAO_0000578 .
+                ?id_type rdfs:subClassOf* ccp:IAO_EXT_0000342 .
   				?id rdf:type ?id_type .
                 MINUS { {?id2 skos:exactMatch ?id . }
                         UNION
@@ -225,9 +225,9 @@
 (defn combined-pairs-fn [kb]
   (let [query-pat `((?/id skos/exactMatch ?/id2)
                      (?/id rdf/type ?/id_type)
-                     (?/id_type [rdfs/subClassOf *] obo/IAO_0000578 ) ;centrally registered identifier
+                     (?/id_type [rdfs/subClassOf *] ccp/IAO_EXT_0000342 ) ; ccp:identifier of a biological entity
                      (?/id2 rdf/type ?/id_type2)
-                     (?/id_type2 [rdfs/subClassOf *] obo/IAO_0000578) ;centrally registered identifier
+                     (?/id_type2 [rdfs/subClassOf *] ccp/IAO_EXT_0000342) ; ccp:identifier of a biological entity
                      (!= ?/id  ?/id2))]
     (binding [*use-inference* false
               *work-queue-single-threaded* true]


Paginate inbox.

Paginate inbox.

--- src/oc/storage/api/activity.clj
+++ src/oc/storage/api/activity.clj
@@ -57,7 +57,8 @@
   [conn {start :start must-see :must-see} org board-by-uuids allowed-boards user-id]
   (let [total-inbox-count (entry-res/list-all-entries-for-inbox conn (:uuid org) user-id :desc (db-common/current-timestamp)
                            0 allowed-boards {:count true})
-        entries (entry-res/list-all-entries-for-inbox conn (:uuid org) user-id :desc start 0 allowed-boards)
+        entries (entry-res/list-all-entries-for-inbox conn (:uuid org) user-id :desc start config/default-activity-limit
+                 allowed-boards)
         activities {:next-count (count entries)
                     :total-count total-inbox-count}]
     ;; Give each activity its board name


Better document init-locals use.

Better document init-locals use.

--- src/onyx/information_model.cljc
+++ src/onyx/information_model.cljc
@@ -565,7 +565,7 @@
                                :type :function
                                :optional? true
                                :added "0.8.0"}
-            :aggregation/init-locals {:doc "Fn (window) to initialise local vars for use in other phases of the aggregation."
+            :aggregation/init-locals {:doc "Fn (window) to initialise local vars for use in other phases of the aggregation. Function should return a map that will be merged into the window map."
                                       :type :function
                                       :optional? false
                                       :added "0.11.0"}
@@ -600,7 +600,7 @@
                                  :type :function
                                  :optional? false
                                  :added "0.9.0"}
-            :trigger/init-locals {:doc "Fn (trigger) to initialise local vars for use in other phases of the trigger."
+            :trigger/init-locals {:doc "Fn (trigger) to initialise local vars for use in other phases of the trigger. Function should return a map that will be merged into the trigger map."
                                   :type :function
                                   :optional? false
                                   :added "0.9.0"}


Fix pprint to work with new calling options

* Except :value-fn which doesn't quite fit into pprint's
  calling model

--- src/main/clojure/clojure/data/json_new.clj
+++ src/main/clojure/clojure/data/json_new.clj
@@ -418,9 +418,7 @@
               *escape-slash* escape-slash
               *key-fn* key-fn
               *value-fn* value-fn]
-      (let [out-value (value-fn x)]
-        (when-not (= *value-fn* out-value)
-          (-write-json out-value (PrintWriter. writer)))))))
+      (-write-json x (PrintWriter. writer)))))

 (defn json-str
   "Converts x to a JSON-formatted string. Options are the same as
@@ -434,34 +432,38 @@

 ;; Based on code by Tom Faulhaber

-(defn- pprint-json-array [s escape-unicode]
+(defn- pprint-json-array [s]
   ((pprint/formatter-out "~<[~;~@{~w~^, ~:_~}~;]~:>") s))

-(defn- pprint-json-object [m escape-unicode]
+(defn- pprint-json-object [m]
   ((pprint/formatter-out "~<{~;~@{~<~w:~_~w~:>~^, ~_~}~;}~:>")
-   (for [[k v] m] [(as-str k) v])))
-
-(defn- pprint-json-generic [x escape-unicode]
+   (for [[k v] m] [(*key-fn* k) v])))
+
+(defn- pprint-json-generic [x]
   (if (.isArray (class x))
-    (pprint-json-array (seq x) escape-unicode)
-    (print (json-str x :escape-unicode escape-unicode))))
-
-(defn- pprint-json-dispatch [x escape-unicode]
+    (pprint-json-array (seq x))
+    ;; pprint proxies Writer, so we can't just wrap it
+    (print (with-out-str (-write-json x (PrintWriter. *out*))))))
+
+(defn- pprint-json-dispatch [x]
   (cond (nil? x) (print "null")
-        (instance? java.util.Map x) (pprint-json-object x escape-unicode)
-        (instance? java.util.Collection x) (pprint-json-array x escape-unicode)
-        (instance? clojure.lang.ISeq x) (pprint-json-array x escape-unicode)
-        :else (pprint-json-generic x escape-unicode)))
+        (instance? java.util.Map x) (pprint-json-object x)
+        (instance? java.util.Collection x) (pprint-json-array x)
+        (instance? clojure.lang.ISeq x) (pprint-json-array x)
+        :else (pprint-json-generic x)))

 (defn pprint-json
-  "Pretty-prints JSON representation of x to *out*.
-
-  Valid options are:
-    :escape-unicode false
-        to turn off \\uXXXX escapes of Unicode characters."
+  "Pretty-prints JSON representation of x to *out*. Options are the
+  same as for write-json except :value-fn, which is not supported."
   [x & options]
-  (let [{:keys [escape-unicode] :or {escape-unicode true}} options]
-    (pprint/write x :dispatch #(pprint-json-dispatch % escape-unicode))))
+  (let [{:keys [escape-unicode escape-slash key-fn]
+         :or {escape-unicode true
+              escape-slash true
+              key-fn default-write-key-fn}} options]
+    (binding [*escape-unicode* escape-unicode
+              *escape-slash* escape-slash
+              *key-fn* key-fn]
+      (pprint/write x :dispatch pprint-json-dispatch))))

 ;; Local Variables:
 ;; mode: clojure


Update fn docs to suggest using the readable ns

--- src/main/clojure/clojure/tools/logging.clj
+++ src/main/clojure/clojure/tools/logging.clj
@@ -81,7 +81,8 @@

 (defmacro logp
   "Logs a message using print style args. Can optionally take a throwable as its
-  second arg. See level-specific macros, e.g., debug."
+  second arg. See level-specific macros, e.g., debug.
+  Use the 'logging.readable' namespace to avoid wrapping args in pr-str."
   {:arglists '([level message & more] [level throwable message & more])}
   [level x & more]
   (if (or (instance? String x) (nil? more)) ; optimize for common case
@@ -95,7 +96,8 @@

 (defmacro logf
   "Logs a message using a format string and args. Can optionally take a
-  throwable as its second arg. See level-specific macros, e.g., debugf."
+  throwable as its second arg. See level-specific macros, e.g., debugf.
+  Use the 'logging.readable' namespace to avoid wrapping args in pr-str."
   {:arglists '([level fmt & fmt-args] [level throwable fmt & fmt-args])}
   [level x & more]
   (if (or (instance? String x) (nil? more)) ; optimize for common case
@@ -134,7 +136,8 @@

 (defmacro spyf
   "Evaluates expr and may write (format fmt result) to the log. Returns the
-  result of expr. Defaults to :debug log level."
+  result of expr. Defaults to :debug log level.
+  Use the 'logging.readable' namespace to avoid wrapping args in pr-str."
   ([fmt expr]
     `(spyf :debug ~fmt ~expr))
   ([level fmt expr]
@@ -211,73 +214,85 @@
 ;; level-specific macros

 (defmacro trace
-  "Trace level logging using print-style args."
+  "Trace level logging using print-style args.
+  Use the 'logging.readable' namespace to avoid wrapping args in pr-str."
   {:arglists '([message & more] [throwable message & more])}
   [& args]
   `(logp :trace ~@args))

 (defmacro debug
-  "Debug level logging using print-style args."
+  "Debug level logging using print-style args.
+  Use the 'logging.readable' namespace to avoid wrapping args in pr-str."
   {:arglists '([message & more] [throwable message & more])}
   [& args]
   `(logp :debug ~@args))

 (defmacro info
-  "Info level logging using print-style args."
+  "Info level logging using print-style args.
+  Use the 'logging.readable' namespace to avoid wrapping args in pr-str."
   {:arglists '([message & more] [throwable message & more])}
   [& args]
   `(logp :info ~@args))

 (defmacro warn
-  "Warn level logging using print-style args."
+  "Warn level logging using print-style args.
+  Use the 'logging.readable' namespace to avoid wrapping args in pr-str."
   {:arglists '([message & more] [throwable message & more])}
   [& args]
   `(logp :warn ~@args))

 (defmacro error
-  "Error level logging using print-style args."
+  "Error level logging using print-style args.
+  Use the 'logging.readable' namespace to avoid wrapping args in pr-str."
   {:arglists '([message & more] [throwable message & more])}
   [& args]
   `(logp :error ~@args))

 (defmacro fatal
-  "Fatal level logging using print-style args."
+  "Fatal level logging using print-style args.
+  Use the 'logging.readable' namespace to avoid wrapping args in pr-str."
   {:arglists '([message & more] [throwable message & more])}
   [& args]
   `(logp :fatal ~@args))

 (defmacro tracef
-  "Trace level logging using format."
+  "Trace level logging using format.
+  Use the 'logging.readable' namespace to avoid wrapping args in pr-str."
   {:arglists '([fmt & fmt-args] [throwable fmt & fmt-args])}
   [& args]
   `(logf :trace ~@args))

 (defmacro debugf
-  "Debug level logging using format."
+  "Debug level logging using format.
+  Use the 'logging.readable' namespace to avoid wrapping args in pr-str."
   {:arglists '([fmt & fmt-args] [throwable fmt & fmt-args])}
   [& args]
   `(logf :debug ~@args))

 (defmacro infof
-  "Info level logging using format."
+  "Info level logging using format.
+  Use the 'logging.readable' namespace to avoid wrapping args in pr-str."
   {:arglists '([fmt & fmt-args] [throwable fmt & fmt-args])}
   [& args]
   `(logf :info ~@args))

 (defmacro warnf
-  "Warn level logging using format."
+  "Warn level logging using format.
+  Use the 'logging.readable' namespace to avoid wrapping args in pr-str."
   {:arglists '([fmt & fmt-args] [throwable fmt & fmt-args])}
   [& args]
   `(logf :warn ~@args))

 (defmacro errorf
-  "Error level logging using format."
+  "Error level logging using format.
+  Use the 'logging.readable' namespace to avoid wrapping args in pr-str."
   {:arglists '([fmt & fmt-args] [throwable fmt & fmt-args])}
   [& args]
   `(logf :error ~@args))

 (defmacro fatalf
-  "Fatal level logging using format."
+  "Fatal level logging using format.
+  Use the 'logging.readable' namespace to avoid wrapping args in pr-str."
   {:arglists '([fmt & fmt-args] [throwable fmt & fmt-args])}
   [& args]
   `(logf :fatal ~@args))


insights: adjust charts for smaller block

--- src-cljs/frontend/components/insights.cljs
+++ src-cljs/frontend/components/insights.cljs
@@ -32,13 +32,13 @@

 (def svg-info
   {:width 425
-   :height 385
-   :top 30, :right 10, :bottom 10, :left 70})
+   :height 100
+   :top 30, :right 10, :bottom 10, :left 40})

 (def plot-info
   {:width (- (:width svg-info) (:left svg-info) (:right svg-info))
    :height (- (:height svg-info) (:top svg-info) (:bottom svg-info))
-   :max-bars 60
+   :max-bars 50
    :left-legend-items [{:classname "success"
                         :text "Passed"}
                        {:classname "failed"
@@ -135,7 +135,7 @@
                         (.domain #js[0 y-neg-max])
                         (.range #js[y-zero (:height plot-info)]))
         y-pos-floored-max (datetime/nice-floor-duration y-pos-max)
-        y-pos-tick-values (list y-pos-floored-max (/ y-pos-floored-max 2) 0)
+        y-pos-tick-values (list y-pos-floored-max 0)
         y-neg-tick-values [(datetime/nice-floor-duration y-neg-max)]
         y-pos-axis (-> (js/d3.svg.axis)
                        (.scale y-pos-scale)
@@ -154,7 +154,7 @@
         x-scale (-> (js/d3.scale.ordinal)
                     (.domain (clj->js
                               (concat (map :build_num builds) scale-filler)))
-                    (.rangeBands #js[0 (:width plot-info)] 0.5))
+                    (.rangeBands #js[0 (:width plot-info)] 0.4))
         plot (-> js/d3
                 (.select el)
                 (.select "svg g.plot-area"))


smoother, less cpu intensive animations

smoother, less cpu intensive animations

--- src-cljs/frontend/components/drawing.cljs
+++ src-cljs/frontend/components/drawing.cljs
@@ -12,6 +12,9 @@
                                                 (when f (f owner))
                                                 (tick-fn owner)))))

+(defn annotate-keyframes [tick-state & ticks]
+  (update-in tick-state [:keyframes] #(apply (fnil conj #{}) % ticks)))
+
 (defn clear-subscriber [tick-state tick]
   (add-tick tick-state tick (fn [owner]
                               ((om/get-shared owner :cast!)
@@ -22,23 +25,24 @@

 (defn move-mouse [tick-state {:keys [start-tick end-tick start-x end-x start-y end-y tool]
                               :or {tool :rect}}]
-  (reduce (fn [tick-state relative-tick]
-            (add-tick tick-state
-                      (+ start-tick relative-tick)
-                      (fn [owner]
-                        (let [ex (+ start-x (* relative-tick
-                                               (/ (- end-x start-x)
-                                                  (- end-tick start-tick))))
-                              ey (+ start-y (* relative-tick
-                                               (/ (- end-y start-y)
-                                                  (- end-tick start-tick))))]
-                          ((om/get-shared owner :cast!)
-                           :subscriber-updated {:client-id (ffirst state/subscriber-bot)
-                                                :fields {:mouse-position [ex ey]
-                                                         :show-mouse? true
-                                                         :tool tool}})))))
-          tick-state
-          (range 0 (inc (- end-tick start-tick)))))
+  (-> (reduce (fn [tick-state relative-tick]
+                (add-tick tick-state
+                          (+ start-tick relative-tick)
+                          (fn [owner]
+                            (let [ex (+ start-x (* relative-tick
+                                                   (/ (- end-x start-x)
+                                                      (- end-tick start-tick))))
+                                  ey (+ start-y (* relative-tick
+                                                   (/ (- end-y start-y)
+                                                      (- end-tick start-tick))))]
+                              ((om/get-shared owner :cast!)
+                               :subscriber-updated {:client-id (ffirst state/subscriber-bot)
+                                                    :fields {:mouse-position [ex ey]
+                                                             :show-mouse? true
+                                                             :tool tool}})))))
+              tick-state
+              (range 0 (inc (- end-tick start-tick))))
+    (annotate-keyframes end-tick)))

 (defn draw-shape [tick-state {:keys [start-tick end-tick start-x end-x
                                      start-y end-y type tool doc-id props]
@@ -83,7 +87,8 @@
                                         :fields {:mouse-position nil
                                                  :layers nil
                                                  :tool tool}})
-                  (d/transact! (om/get-shared owner :db) [base-layer] {:bot-layer true}))))))
+                  (d/transact! (om/get-shared owner :db) [base-layer] {:bot-layer true})))
+      (annotate-keyframes start-tick end-tick))))

 (def text-height 14)

@@ -131,7 +136,8 @@
                                         :fields {:mouse-position nil
                                                  :layers nil
                                                  :tool :text}})
-                  (d/transact! (om/get-shared owner :db) [base-layer] {:bot-layer true}))))))
+                  (d/transact! (om/get-shared owner :db) [base-layer] {:bot-layer true})))
+      (annotate-keyframes start-tick end-tick))))

 (defn signup-animation [document vw]
   (let [text "Sign in with Google"
@@ -190,13 +196,28 @@
                           :layer/signup-button true}})
       (clear-subscriber 201))))

-(defn run-animation* [owner tick-state max-tick current-tick]
-  (when (and (om/mounted? owner)
-             (>= max-tick current-tick))
-    (when-let [tick-fn (get-in tick-state [:ticks current-tick])]
-      (tick-fn owner))
-    (js/setTimeout #(run-animation* owner tick-state max-tick (inc current-tick))
-                   (:tick-ms tick-state))))
+(defn clear-ticks [tick-state ticks]
+  (update-in tick-state [:ticks] #(apply dissoc % ticks)))
+
+(defn middle-elem [v]
+  (if (seq v)
+    (nth v (quot (count v) 2))
+    nil))
+
+(defn run-animation* [owner start-ms current-ms tick-state min-tick max-tick]
+  (if (and (om/mounted? owner)
+           (seq (:ticks tick-state)))
+    (let [latest-tick (int (/ (- current-ms start-ms)
+                              (:tick-ms tick-state)))
+          tick-range (vec (range min-tick (inc latest-tick)))
+          ticks (-> (filter #(contains? (:keyframes tick-state) %) tick-range)
+                  set
+                  (conj (middle-elem tick-range)))]
+      (doseq [tick ticks]
+        (when-let [tick-fn (get-in tick-state [:ticks tick])]
+          (tick-fn owner)))
+      (utils/rAF (fn [timestamp]
+                   (run-animation* owner start-ms timestamp (clear-ticks tick-state tick-range) latest-tick max-tick))))))

 (defn run-animation
   "tick-state should be a map with keys :tick-ms, whose value is the number of ms between
@@ -211,7 +232,8 @@
   Unmount the component to stop the animation."
   [owner tick-state]
   (let [max-tick (apply max (keys (:ticks tick-state)))]
-    (run-animation* owner tick-state max-tick 0)))
+    (utils/rAF (fn [timestamp]
+                 (run-animation* owner timestamp timestamp tick-state 0 max-tick)))))

 (defn cleanup [owner]
   ((om/get-shared owner :cast!) :subscriber-updated {:client-id (ffirst state/subscriber-bot)


handling failed deletion of test index

handling failed deletion of test index

--- test/wb_es/core_test.clj
+++ test/wb_es/core_test.clj
@@ -19,7 +19,11 @@
   (do
     (let [index-url (format "%s/%s" es-base-url index-name)]
       (do
-        (http/delete index-url)
+        (try
+          (http/delete index-url)
+          (catch clojure.lang.ExceptionInfo e
+            (prn "failed to delete index.")
+            (prn e)))
         (http/put index-url {:headers {:content-type "application/json"}
                              :body (json/generate-string mappings/index-settings)})
         (mount/start)


Pushing more work in progress on peg thing game...


Hack in zoom - much refactoring (and some kind of visual cue for zoom box) needed

--- src/cljs/fractals_clojurescript/core.cljs
+++ src/cljs/fractals_clojurescript/core.cljs
@@ -4,66 +4,94 @@
 (enable-console-print!)

 ; TODO: allow changing of this dynamically..
-(def app-state (atom {:max-iterations 100
-                      :escape-radius  10000
-                      :dimensions {:x0 -3   :x1 1
-                                   :y0 -1.5 :y1 1.5}}))
+(def app-state (atom {:render-data
+                      {
+                       ;:max-iterations 100
+                       :escape-radius  10000
+                       :scale          350 ; How many pixels a distance of 1 in the complex plane takes up
+                       :x0             -3
+                       :y0             1.2}}))

 (def canvas (.getElementById js/document "app"))
+(def context (.getContext canvas "2d"))

-(aset canvas "width"(.-innerWidth js/window))
-(aset canvas "height"(.-innerHeight js/window))
+(defn render-mandelbrot!
+  [{:keys [scale x0 y0 escape-radius ] :as render-state}]

-(def width (.-width canvas))
-(def height (.-height canvas))
+  (println render-state)

-(def context (.getContext canvas "2d"))
+  (aset canvas "width"(.-innerWidth js/window))
+  (aset canvas "height"(.-innerHeight js/window))

-(def idata (.createImageData context width height))
-(def data (.-data idata))
+  (let [max-iterations        (int (* 10 (Math/log scale)))
+        start                 (.getTime (js/Date.))

-(defn dot!
-  "Colours the pixel at co-ordinates [x,y] in the color [r,g,b]"
-  [x y r g b]
-  (let [i (* 4 (+ x (* y width)))]
-    (aset data i r)
-    (aset data (+ i 1) g)
-    (aset data (+ i 2) b)
-    (aset data (+ i 3) 255)))
+        width                 (.-width canvas)
+        height                (.-height canvas)

-(println "WIDTH: " width)
-(println "HEIGHT: " height)
+        idata                 (.createImageData context width height)
+        data                  (.-data idata)

-(def start (.getTime (js/Date.)))
+        escape-radius-squared (* escape-radius escape-radius)]

-(let [x0                    (get-in @app-state [:dimensions :x0])
-      x1                    (get-in @app-state [:dimensions :x1])
-      x-size                (- x1 x0)
+    (forloop
+     [(x 0) (< x width)  (inc x)]
+     (forloop
+      [(y 0) (< y height) (inc y)]

-      y0                    (get-in @app-state [:dimensions :y0])
-      y1                    (get-in @app-state [:dimensions :y1])
-      y-size                (- y1 y0)

-      escape-radius         (:escape-radius @app-state)
-      escape-radius-squared (* escape-radius escape-radius)
-      max-iterations        (:max-iterations @app-state)]
+      (let [real       (+ (/ x scale) x0)
+            imaginary  (- (/ y scale) y0)
+            iterations (js/iteration_count escape-radius-squared max-iterations real imaginary)
+            intensity  (* 255 (/ iterations max-iterations))

-  (forloop
-   [(x 0) (< x width)  (inc x)]
-   (forloop
-    [(y 0) (< y height) (inc y)]
+            i (* 4 (+ x (* y width)))]

-    (let [real       (+ (* x-size (/ x width)) x0)
-          imaginary  (+ (* y-size (/ y height)) y0)
-          iterations (js/iteration_count escape-radius-squared max-iterations real imaginary)
-          intensity  (* 255 (/ iterations max-iterations))]
+        (aset data i intensity)
+        (aset data (+ i 1) intensity)
+        (aset data (+ i 2) intensity)
+        (aset data (+ i 3) 255))))

-      (dot! x y intensity intensity intensity)))))
+    (.putImageData context idata 0 0)

-(.putImageData context idata 0 0)
+    (.log js/console "Done in: " (int (* 1000 (/ (* height width)  (- (.getTime (js/Date.)) start)))) "px/s")))

-(.log js/console "Done in: " (int (* 1000 (/ (* height width)  (- (.getTime (js/Date.)) start)))) "px/s")
+(render-mandelbrot! (:render-data @app-state))
+
+(set! (.-onresize js/window) (fn [] (render-mandelbrot! (:render-data @app-state))))
+
+(add-watch app-state :state-changed
+           (fn [_ _ old-state new-state]
+             (when-not (= (:render-data old-state)
+                          (:render-data new-state))
+               (render-mandelbrot! (:render-data new-state)))))
+
+(set! (.-onmousedown canvas) (fn [e] (swap! app-state assoc :mousedown e)))
+
+(set! (.-onmouseup canvas) (fn [e]
+                             (when-let [mousedown (get @app-state :mousedown)]
+                               (let [scale     (get-in @app-state [:render-data :scale])
+
+                                     old-x0    (get-in @app-state [:render-data :x0])
+                                     old-y0    (get-in @app-state [:render-data :y0])
+                                     start-x   (aget mousedown "pageX")
+                                     start-y   (aget mousedown "pageY")
+                                     finish-x  (aget e "pageX")
+                                     finish-y  (aget e "pageY")
+
+                                     width     (aget canvas "width")
+
+                                     new-x0    (+ old-x0 (/ start-x scale))
+                                     new-y0    (- old-y0 (/ start-y scale))
+                                     new-scale (/ width (/ (- finish-x start-x) scale))]
+
+                                 (swap! app-state
+                                        (fn [x]
+                                          (-> x
+                                              (assoc-in [:render-data :x0] new-x0)
+                                              (assoc-in [:render-data :y0] new-y0)
+                                              (assoc-in [:render-data :scale] new-scale))))))))

 (defn on-js-reload []
   ;; optionally touch your app-state to force rerendering depending on


Cosmetic changes.

Cosmetic changes.

--- src/cmr/search/services/query_service.clj
+++ src/cmr/search/services/query_service.clj
@@ -96,11 +96,6 @@
        (simplify-query context)
        (execute-query context)))

-(defn append-result-format
-  "Append result-format to params and return them"
-  [result-format params]
-  (assoc params :result-format result-format))
-
 (deftracefn find-concepts-by-parameters
   "Executes a search for concepts using the given parameters. The concepts will be returned with
   concept id and native provider id."


adding a viewbox and rectangle

adding a viewbox and rectangle

--- cartagena-web/src/cartagena_web/core.cljs
+++ cartagena-web/src/cartagena_web/core.cljs
@@ -7,17 +7,23 @@

 ;; define your app data so that it doesn't get over-written on reload

-(defonce app-state (atom {:text "Hello world!"}))
+(defonce app-state (atom nil))

-(defn hello-world []
-  [:h1 (:text @app-state)])
+(defn main-view []
+  [:center
+   [:h1 "CARTAGENA"
+    [:div
+     [:svg
+      {:view-box "0 0 1000 800"
+       :width 1000
+       :height 800}
+      [:rect {:x 0 :y 0 :width 1000 :height 800 :stroke "black" :fill "none"}]]]]])

-(reagent/render-component [hello-world]
-                          (. js/document (getElementById "app")))
+(defn ^:export main []
+  (when-let [app (. js/document (getElementById "app"))]
+    (reagent/render-component [main-view] app)))

+(main)

 (defn on-js-reload []
-  ;; optionally touch your app-state to force rerendering depending on
-  ;; your application
-  ;; (swap! app-state update-in [:__figwheel_counter] inc)
-)
+  (main))


Some optimizations for TITANIC

Some optimizations for TITANIC

- less access of set-weight in titanic-closure
- titanic-generate closer to paper version (but not yet the same)

our bottleneck now seems to be the simple implementation of supports.

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

--- src/conexp/contrib/algorithms/titanic.clj
+++ src/conexp/contrib/algorithms/titanic.clj
@@ -38,36 +38,39 @@
                  max-weight)))

 (defn- titanic-closure
-  "Computes the closure of X by the weights of its subsets."
-  ;; keys sorted by their weights (ascending)
-  ;; X is a key set
+  "Computes the closure of X by the weights of its subsets. The
+  following restrictions apply:
+
+    - keys is the sequence of already computed key sets and is orderd
+      by weights ascending,
+    - X is a member of keys.
+  "
   [X base-set keys candidates]
-  (loop [Y (apply union X (map #(closure (disj X %)) X)),
-         elements (difference base-set Y)]
-    (if-not (empty? elements)
-      (let [m        (first elements),
-            X-weight (set-weight X)
-            add?     (if-let [s (set-weight (conj X m))]
-                       (= s X-weight)
-                       (not (first (for [K keys,
-                                         :while (not= (get set-weight K) X-weight)
-                                         :when (and (contains? K m)
-                                                    (subset? (disj K m) X))]
-                                     K))))]
-        (recur (if add? (conj Y m) Y)
-               (rest elements)))
-      Y)))
+  (let [X-weight (set-weight X),
+        keys     (map #(vector % (set-weight %)) keys)]
+    (loop [Y        (apply union X (map #(closure (disj X %)) X)),
+           elements (difference base-set Y)]
+      (if-not (empty? elements)
+        (let [m    (first elements),
+              add? (if-let [s (set-weight (conj X m))]
+                     (= s X-weight)
+                     (not (first (for [[K weight] keys,
+                                       :while (not= weight X-weight)
+                                       :when (and (contains? K m)
+                                                  (subset? (disj K m) X))]
+                                   K))))]
+          (recur (if add? (conj Y m) Y)
+                 (rest elements)))
+        Y))))

 (defn- titanic-generate
-  "Generates the next candidate set from the given key-set and sets
-  subset-weight accordingly."
-  [key-set]
-  (set-of both [A key-set,
-                B key-set,
-                :let [both (union A B)]
-                :when (and (= (inc (count A)) (count both)) ;one more
-                           (forall [x both]                 ;both is candidate
-                             (contains? key-set (disj both x))))]))
+  "Computes the next candidate set."
+  [base-set key-set]
+  (set-of next [A key-set,
+                m (difference base-set A),
+                :let [next (conj A m)]
+                :when (forall [x A]
+                        (contains? key-set (disj next x)))]))

 (defn titanic
   "Implements the titanic algorithm. weigh must return for a
@@ -78,7 +81,7 @@
   [base-set weigh max-weight weight-minimum]
   (binding [closure       {},
             set-weight    (weigh [#{}]),
-            subset-weight (memoize (partial subset-weight max-weight)),
+            subset-weight (partial subset-weight max-weight),
             minimum       weight-minimum]

     (loop [key-set    #{#{}},
@@ -92,7 +95,7 @@
                                                 (get set-weight X))])]
         (if-not (empty? next-key-set)
           (recur next-key-set
-                 (titanic-generate next-key-set)
+                 (titanic-generate base-set next-key-set)
                  (sort (fn [a b]
                          (= (get set-weight a)
                             (weight-minimum [(get set-weight a) (get set-weight b)])))


fixed bug where sweep was not coded into ident merge

--- src/untangled/client/impl/application.cljc
+++ src/untangled/client/impl/application.cljc
@@ -217,6 +217,8 @@
                                    :normalize  true
                                    :remotes    remotes
                                    :pathopt    pathopt
+                                   :merge-ident (fn [reconciler app-state ident props]
+                                                  (update-in app-state ident (comp sweep-one merge) props))
                                    :merge-tree (fn [target source]
                                                  (merge-handler mutation-merge target source))
                                    :parser     parser


Add atom to the demo

Add atom to the demo

--- dev/datafrisk/demo.cljs
+++ dev/datafrisk/demo.cljs
@@ -11,12 +11,13 @@

 (defn mount-root []
   (let [data {:animals '({:animal "Monkey", :age 2}
-                         {:animal "Giraffe", :age 4}
-                         {:animal "Zebra" :age 3})
+                          {:animal "Giraffe", :age 4}
+                          {:animal "Zebra" :age 3})
               :some-string "a"
               :vector-with-map [1 2 3 3 {:a "a" :b "b"}]
               :a-set #{1 2 3}
               :a-map {:x "x" :y "y" :z [1 2 3 4]}
+              :atom (atom {:x "x" :y "y" :z [1 2 3 4]})
               :a-seq (seq [1 2])
               :an-object (clj->js {:a "a"})
               :this-is-a-very-long-keyword :g}]


Improve demo

Improve demo

--- dev/datafrisk/demo.cljs
+++ dev/datafrisk/demo.cljs
@@ -4,24 +4,34 @@

 (enable-console-print!)

+(defn Animals [data]
+  [:div "Awesome animals"
+   [:ul
+    (map-indexed (fn [i {:keys [animal age]}] ^{:key i} [:li (str animal ", " age " years old")]) (:animals data))]])
+
 ;; Needed in order to keep track of the state in the data frisk shell
 (def some-atom (r/atom {:data-frisk {:visible? true}}))

 (defn mount-root []
-  (r/render
-    [d/DataFriskShell
-     some-atom
-     ;; List of arguments you want to visualize
-     {:data {:some-string "a"
-             :vector-with-map [1 2 3 3 {:a "a" :b "b"}]
-             :a-set #{1 2 3}
-             :a-map {:x "x" :y "y" :z [1 2 3 4]}
-             :a-list '(1 2 3)
-             :a-seq (seq [1 2])
-             :an-object (clj->js {:a "a"})
-             :this-is-a-very-long-keyword :g}}
-     {:a :b :c :d}]
-    (js/document.getElementById "app")))
+  (let [data {:animals '({:animal "Monkey", :age 2}
+                         {:animal "Giraffe", :age 4}
+                         {:animal "Zebra" :age 3})
+              :some-string "a"
+              :vector-with-map [1 2 3 3 {:a "a" :b "b"}]
+              :a-set #{1 2 3}
+              :a-map {:x "x" :y "y" :z [1 2 3 4]}
+              :a-seq (seq [1 2])
+              :an-object (clj->js {:a "a"})
+              :this-is-a-very-long-keyword :g}]
+
+    (r/render
+      [:div
+       [Animals data]
+       [d/DataFriskShell
+        some-atom
+        ;; List of arguments you want to visualize
+        data]]
+      (js/document.getElementById "app"))))

 (defn ^:export main []
   (mount-root))


refactored main function

refactored main function

--- cljx/plongeur-cljs/src/plongeur/core.cljs
+++ cljx/plongeur-cljs/src/plongeur/core.cljs
@@ -4,7 +4,6 @@
             [plongeur.intent :as i]
             [plongeur.model  :as m]
             [plongeur.view   :as v]
-            [plongeur.sigma-driver :as sig]
             [kierros.quiescent-dom-driver :as dom]
             [kierros.sente-client-driver :as ws]
             [kierros.local-storage-driver :as st]
@@ -16,36 +15,37 @@

 (defn plongeur-client-main
   "Main function cfr. Cycle.js architecture."
-  [{dom-event-chan       :DOM
-    sigma-event-chan     :SIGMA
-    saved-state-chan     :STORAGE
-    server-response-chan :WEB}]
-  (let [sigma-chan         (chan 10)
+  [{dom-event-chan    :DOM
+    saved-state-chan  :STORAGE
+    web-response-chan :WEB}]
+  (let [intent-chans           (i/intents)

-        intent-chans       (-> (i/intents)
-                               (assoc :sigma-ctrl sigma-chan)) ;; a sign that sigma operation are intents as well...
+        _ (pipe web-response-chan (:handle-response intent-chans))
+        _ (pipe dom-event-chan    (:handle-dom-event intent-chans))

-        states-chan        (m/model saved-state-chan intent-chans)
-        states-mult        (mult states-chan)
+        states-chan            (m/model saved-state-chan intent-chans)
+        states-mult            (mult states-chan)

-        pickle-states-chan (->> (map #(dissoc % :transient))
-                                (chan 10)
-                                (tap states-mult))
+        pickle-states-chan     (->> (chan 10)
+                                    (tap states-mult))

-        view-states-chan   (->> (chan 10)
-                                (tap states-mult))
+        view-states-chan       (->> (chan 10)
+                                    (tap states-mult))

-        request-chan       (chan 10)
+        post-request-chan      (chan 10)

-        views-chan         (v/view view-states-chan intent-chans)]
+        cmd-chans              (assoc intent-chans
+                                 :post-request post-request-chan
+                                 :update-graph )
+
+        views-chan             (v/view view-states-chan cmd-chans)]
     {:DOM     views-chan
-     :SIGMA   sigma-chan
      :STORAGE pickle-states-chan
-     :WEB     request-chan}))
+     :WEB     post-request-chan}))

 (defn launch-client []
   (cycle/run plongeur-client-main
              {:DOM     (dom/make-dom-driver "plongeur-app")
-              ;; :WEB     (ws/make-sente-client-driver "/chsk" {:host "localhost:8090"})
-              :SIGMA   (sig/make-sigma-driver)
+              :WEB     (ws/make-sente-client-driver {:path "/chsk"
+                                                     :host "localhost:8090"} :dummy)
               :STORAGE (st/make-storage-driver "plongeur" m/default-state)}))


arithmetic.clj: more work on matrix diagonalisation.

--- clojure/org/gavrog/clojure/arithmetic.clj
+++ clojure/org/gavrog/clojure/arithmetic.clj
@@ -29,3 +29,44 @@
       (stuff! (for [i rows] [[i j1] (+ (* (M [i j1]) f11) (* (M [i j2]) f12))]))
       (stuff! (for [i rows] [[i j2] (+ (* (M [i j1]) f21) (* (M [i j2]) f22))]))
       persistent!)))
+
+(defn- smallest [xs]
+  (when (seq xs)
+    (reduce (fn [a b] (if (neg? (compare a b)) a b)) (first xs) (rest xs))))
+
+(defn- clear-col [M rows cols]
+  (let [i0 (first rows)
+        j0 (first cols)]
+    (reduce (fn [M i]
+              (let [a (M [i0 j0]) b (M [i j0])]
+                (cond (and (not (zero? a)) (zero? (mod b a)))
+                      (combine-rows M cols i0 i 1 0 (- (quot b a)) 1)
+
+                      (not (zero? b))
+                      (let [[_ [f11 f12 f21 f22]] (gcdex a b)]
+                        (combine-rows M cols i0 i f11 f12 f21 f22))
+
+                      :else
+                      M)))
+            (rest rows))))
+
+(defn- clear-row [M rows cols])
+
+(defn- eliminate [M rows cols]
+  (let [M (clear-col M rows cols)
+        [M dirty] (clear-row M rows cols)]
+    (if dirty
+      (recur M rows cols)
+      M)))
+
+(defn diagonalized [M rows cols]
+  (if (or (empty? rows) (empty? cols))
+    M
+    (let [i0 (first rows)
+          j0 (first cols)
+          [_ ip jp] (smallest (for [i rows, j cols
+                                    :when (not (zero? (M [i j])))]
+                                [i j]))
+          M (combine-rows M cols i0 ip 0 1 1 0)
+          M (combine-cols M rows j0 jp 0 (sign (M [ip jp])) 1 0)]
+      (recur (eliminate M rows cols) (rest rows) (rest cols)))))


remove dead code

remove dead code

--- src/main/clojure/clojure/tools/reader.clj
+++ src/main/clojure/clojure/tools/reader.clj
@@ -59,9 +59,7 @@
   (if-let [ch (read-char rdr)]
     (if-let [dm (dispatch-macros ch)]
       (dm rdr ch opts pending-forms)
-      (if-let [obj (read-tagged (doto rdr (unread ch)) ch opts pending-forms)] ;; ctor reader is implemented as a tagged literal
-        obj
-        (reader-error rdr "No dispatch macro for " ch)))
+      (read-tagged (doto rdr (unread ch)) ch opts pending-forms)) ;; ctor reader is implemented as a tagged literal
     (reader-error rdr "EOF while reading character")))

 (defn- read-unmatched-delimiter


:source-map for :release

:source-map for :release

--- Clojure-Websockets/MainApp/project.clj
+++ Clojure-Websockets/MainApp/project.clj
@@ -54,9 +54,11 @@
                        {:id "release"
                         :source-paths ["src/cljs"]
                         :compiler {:output-to "resources/public/js/build/birdwatch-opt.js"
+                                   :output-dir "resources/public/js/build/out"
                                    :optimizations :advanced
                                    :cache-analysis true
-                                   :externs ["externs/misc.js"]}}
+                                   :externs ["externs/misc.js"]
+                                   :source-map "resources/public/js/build/birdwatch-opt.js.map"}}
                        {:id "test"
                         :source-paths ["src/cljs" "test/cljs"]
                         :compiler {:output-to "test-out/birdwatch.js"


Fix number of tests for filter-children.

--- evermind.core/test/evermind/domain/core_test.clj
+++ evermind.core/test/evermind/domain/core_test.clj
@@ -28,7 +28,7 @@

 (deftest test-filter-children
-         (is (tu/check 'evermind.domain.core/filter-children)))
+         (is (tu/check 'evermind.domain.core/filter-children {::clojure.spec.test.check/opts {:num-tests 10}})))

 (deftest test-create-mindmap


firefox for clj webdriver

firefox for clj webdriver

--- resources/leiningen/new/closp/project.clj
+++ resources/leiningen/new/closp/project.clj
@@ -105,9 +105,15 @@
                                       [joplin.lein "0.2.11"]]

                        :dependencies [[org.bouncycastle/bcprov-jdk15on "1.52"]
+
+                                      ; need to exclude all that stuff to make latest firefox working
                                       [clj-webdriver "0.6.1"
-                                       :exclusions [org.seleniumhq.selenium/selenium-server]]
+                                       :exclusions
+                                       [org.seleniumhq.selenium/selenium-server
+                                        org.seleniumhq.selenium/selenium-java
+                                        org.seleniumhq.selenium/selenium-remote-driver]]
                                       [org.seleniumhq.selenium/selenium-server "2.46.0"]
+
                                       [ring-mock "0.1.5"]
                                       [ring/ring-devel "1.4.0"]
                                       [pjstadig/humane-test-output "0.7.0"]


Update MemoryBlobStore.

Update MemoryBlobStore.

--- src/vault/blob/store/memory.clj
+++ src/vault/blob/store/memory.clj
@@ -10,31 +10,35 @@

   BlobStore

-  (-list [this opts]
+  (enumerate [this opts]
     (blob/select-ids opts (keys @store)))

-  (-stat [this id]
+  (stat [this id]
     (when-let [blob (@store id)]
       {:size (.limit ^java.nio.ByteBuffer (:content blob))
        :stored-at (:since blob)}))

-  (-open [this id]
+  (open [this id]
     (when-let [blob (@store id)]
       (byte-streams/to-input-stream (:content blob))))

-  (-store! [this blob]
+  (store! [this blob]
     (let [id (:id blob)]
       (when-not (@store id)
         (swap! store assoc id (assoc blob :since (java.util.Date.))))))

-  (-remove! [this id]
+  (delete! [this id]
     (when (@store id)
       (swap! store dissoc id)
-      true)))
+      true))
+
+
+  (destroy!! [this]
+    (swap! store empty)))

 (defn memory-store


Fix canonicalizeation bug

Fix canonicalizeation bug

--- src/angelic/search/implicit/dash_astar.clj
+++ src/angelic/search/implicit/dash_astar.clj
@@ -116,7 +116,8 @@

 (def *out-count* (atom 1))

-(defn underived? [sp] (identical? sp (ts-sp (sp-ts sp))))
+(defn canonicalize [sp] (ts-sp (sp-ts sp)))
+(defn canonical? [sp] (identical? sp (ts-sp (sp-ts sp))))

 (traits/deftrait simple-subproblem
   [nm inp-set wrapped-ts eval!-fn ri-fn]
@@ -139,7 +140,7 @@
     (assert (nil? @out-set-atom))
     (reset! out-set-atom o)
     (summaries/summary-changed-local! s)
-    (when (underived? s)
+    (when (canonical? s)
       (summaries/summary-changed! (sp-ts s)))
     (doseq [w output-watchers] (w s))
     (doseq [c (get-children s), w (doall (seq child-watchers))] (w s c)))
@@ -152,7 +153,7 @@
     (util/assert-is (and (not (identical? s c)) (get-output-set c)))
     (.add child-list c)
     (summaries/summary-changed-local! s)
-    (when (underived? s)
+    (when (canonical? s)
       (summaries/connect! (sp-ts s) (sp-ts c))
       (when (get-output-set s) (summaries/summary-changed! (sp-ts s)))) ;; TODO: remove this overhead from atomic.
     (when (get-output-set s) (doseq [w (doall (seq child-watchers))] (swap! *out-count* inc) (w s c))))
@@ -182,7 +183,7 @@

 (defn- add-sp-child! [sp child-sp up?]
 ;  (println sp child-sp) (Thread/sleep 100)
-  (when (underived? sp)
+  (when (canonical? sp)
     (summaries/connect-subsumed! (sp-ts sp) (sp-ts child-sp))
     ;; TODO: propagate!
     )
@@ -309,8 +310,8 @@
        (connect-and-watch! ss left-sp
          (fn left-output [left-sp]
            (summaries/summary-changed-local! ss)
-           (when (connect-and-watch-ts! ss @right-sp
-                   (fn [right-sp] (set-output-set! ret (get-output-set! right-sp))))
+           (when (connect-and-watch-ts! ss @right-sp ;; TODO: too eager/
+                   (fn [right-sp] (summaries/summary-changed-local! ss) (set-output-set! ret (get-output-set! right-sp))))
              (summaries/summary-changed! ret)))
          (fn left-child [left-sp left-child]
            (summaries/summary-changed-local! ss)
@@ -352,7 +353,7 @@
        s
        (if (= :Atomic (first (sp-name inner-sp)))
          (let [ret (get-subproblem (sp-name s) ni)]
-           (add-subsuming-sp! ret inner-sp)
+           (add-subsuming-sp! (canonicalize ret) inner-sp)
            ret)
          (make-output-collecting-subproblem (refine-input inner-sp ni)))))))


fix map arguments

fix map arguments

--- src/atom_finder/questions/atom_context.clj
+++ src/atom_finder/questions/atom_context.clj
@@ -39,7 +39,7 @@
 (defn csv-atom-context [edn-file csv-file]
   (->> edn-file
        read-lines
-       (map (map-values #(if (keyword? %) (name %) %)))
+       (map (partial map-values #(if (keyword? %) (name %) %)))
        (maps-to-csv csv-file)
        ))


Added comments into dictionary_interface.clj

--- src/zg/dictionary_interface.clj
+++ src/zg/dictionary_interface.clj
@@ -18,14 +18,17 @@
 (require '[zg.db-interface         :as db-interface])

 (defn proper-word-for-blacklist?
+  "Check if the input string is a proper word to be blacklisted."
   [word]
   (re-matches #"[A-Za-z0-9.'\-\s_/]+" word))

 (defn proper-word-for-whitelist?
+  "Check if the input string is a proper word to be whitelisted"
   [word]
   (re-matches #"[A-Za-z0-9.'\-\s_]+" word))

 (defn process-use-it
+  "Input string should contain just 'Yes' or 'No' answer taken from database."
   [use-it]
   (condp = use-it
       "Yes" 1
@@ -33,22 +36,23 @@
             2))

 (defn process-class
+  "Put a proper class ID to input word class."
   [class]
   (condp = (.toLowerCase class)
-    "N/A" nil
-    "n/a" nil
-    "verb" 1
-    "noun" 2
-    "adverb" 3
-    "adjective" 4
-    "pronoun" 5
-    "conjunction" 6
-    "preposition" 7
-    "interjection" 8
-    "article" 9
-    "numeral" 10
-    "determiner" 11
-    "exclamation" 12))
+    "N/A"           nil
+    "n/a"           nil
+    "verb"          1
+    "noun"          2
+    "adverb"        3
+    "adjective"     4
+    "pronoun"       5
+    "conjunction"   6
+    "preposition"   7
+    "interjection"  8
+    "article"       9
+    "numeral"      10
+    "determiner"   11
+    "exclamation"  12))

 (defn store-word
   "Store one word into the dictionary."


function to generate random angle vector, calculation isn't producing perfect results


Fix comment syntax

Fix comment syntax

--- src/braid/core/client/ui/views/thread.cljs
+++ src/braid/core/client/ui/views/thread.cljs
@@ -19,8 +19,8 @@
 (def max-file-size (* 10 1024 1024))

 (defn messages-view [thread-id]
-  ; Closing over thread-id, but the only time a thread's id changes is the new
-  ; thread box, which doesn't have messages anyway
+  ;; Closing over thread-id, but the only time a thread's id changes is the new
+  ;; thread box, which doesn't have messages anyway
   (let [messages (subscribe [:messages-for-thread thread-id])

         last-open-at (subscribe [:thread-last-open-at thread-id])


sorting out jstat api for distributions (correct)

--- statspop/src/statspop/core.cljs
+++ statspop/src/statspop/core.cljs
@@ -14,6 +14,12 @@

 (defn test-jstat [arr]
   (str (js/jStat.dimensions (js/jStat arr))))
+
+(defn test-jstat-distri-api []
+  (str "calling cdf function: "
+       (js/jStat.chisquare.cdf 14.067 7) ; test statistic -> p-value
+       " calling inverse function: "
+       (js/jStat.chisquare.inv .95 7))) ; p-value -> test-statistic

 (defcard-rg test-card
   "testing devcards"
@@ -42,6 +48,7 @@
   [:div
    [:h2 "Welcome to Reagent"]
    [:p (test-jstat [[1 2] [3 4] [5 6]])]
+   [:p (test-jstat-distri-api)]
   ;; [:p [:button {:on-click #(switch-line-chart line-datom)} "switch charts"]]
    ;; [line-component line-datom]
    [:p [:button {:on-click #(reset! c/chart-datom c/test-data-1)} "load data 1"]]


Add conditionality to on-click event

Add conditionality to on-click event

--- src-cljs/frontend/components/pieces/page_header.cljs
+++ src-cljs/frontend/components/pieces/page_header.cljs
@@ -19,7 +19,8 @@
             [:li
              [:a {:href path
                   :title name
-                  :on-click #((om/get-shared owner :track-event) {:event-type track-event-type})}
+                  :on-click (when track-event-type
+                              #((om/get-shared owner :track-event) {:event-type track-event-type}))}
                  name " "]]))))))

 (defmulti crumb
@@ -122,7 +123,7 @@
   :actions - (optional) A component (or collection of components) which will be
              placed on the right of the header. This is where page-wide actions are
              placed."
-  [{:keys [crumbs actions]}]
+  [{:keys [crumbs actions]} owner]
   (reify
     om/IDisplayName (display-name [_] "User Header")
     om/IRender


cleanup

cleanup


Changed run command to load script in unique namespace named (gensym "script"), e.g. "script4177"


removed port

removed port


Refactor and add some comments.

Refactor and add some comments.


Remove redundant examples.

Remove redundant examples.


spec facts

spec facts

--- test/celestial/features/gce.clj
+++ test/celestial/features/gce.clj
@@ -1,7 +1,7 @@
 (ns celestial.features.gce
   (:require
     [celestial.model :refer (vconstruct)]
-    [celestial.fixtures.core :refer (with-conf) :as f]
+    [celestial.fixtures.core :refer (with-conf with-admin) :as f]
     [celestial.fixtures.data :refer (redis-type local-conf redis-gce)]
     [celestial.fixtures.populate :refer (populate-system)]
     [celestial.integration.workflows.common :refer (spec)]
@@ -15,7 +15,13 @@
   (let [machine-type "zones/europe-west1-d/machineTypes/n1-standard-1"
         source-image "projects/ubuntu-os-cloud/global/images/ubuntu-1404-trusty-v20151113"
         {:keys [machine gce]} redis-gce]
-    (fact "legal gce system" :gce
+
+    (fact "legal instance spec" :gce
+      (:spec (vconstruct (assoc redis-gce :system-id 1))) =>
+         (contains {:system-id 1 })
+      (provided (build-compute "") => nil))
+
+    (fact "legal instance gce" :gce
       (:gce (vconstruct redis-gce)) =>
          (contains {
            :name "red1"
@@ -25,16 +31,16 @@
               :type "PERSISTENT" :boot true
             }]
           })
-      (provided (build-compute "") => nil))))
+     (provided (build-compute "") => nil))))

-#_(with-admin
+(with-admin
   (with-conf local-conf
-    (with-state-changes [(before :facts (populate-system redis-type redis-freenas))]
-      (fact "freenas creation workflows" :integration :gce :workflow
+    (with-state-changes [(before :facts (populate-system redis-type redis-gce))]
+      (fact "compute creation workflows" :integration :gce :workflow
           (wf/create (spec)) => nil
-          (wf/create (spec)) => (throws ExceptionInfo  (is-type? :celestial.workflows/machine-exists))
-          (wf/stop (spec)) => nil
-          (wf/create (spec)) => (throws ExceptionInfo  (is-type? :celestial.workflows/machine-exists))
-          (wf/destroy (spec)) => nil
+          ;; (wf/create (spec)) => (throws ExceptionInfo  (is-type? :celestial.workflows/machine-exists))
+          ;; (wf/stop (spec)) => nil
+          ;; (wf/create (spec)) => (throws ExceptionInfo  (is-type? :celestial.workflows/machine-exists))
+          ;; (wf/destroy (spec)) => nil
       ))))


doseq

doseq

--- test/clojure/yaw/scene_test.clj
+++ test/clojure/yaw/scene_test.clj
@@ -44,15 +44,14 @@
 (defn -rotating-cube
   []
   (let [univ (w/start-universe!)]
-    (for [y (range 90)]
-      (do
-        (sut/display-diff
-         univ
-         (sut/diff (:data @univ)
-                   (sut/item-map [:scene [:item :test/box
-                                          {:mesh :mesh/box :pos [0 0 -5]
-                                           :rot [0 y 0]}]])))
-        (Thread/sleep 30)))))
+    (doseq [y (range 90)]
+      (sut/display-diff
+       univ
+       (sut/diff (:data @univ)
+                 (sut/item-map [:scene [:item :test/box
+                                        {:mesh :mesh/box :pos [0 0 -5]
+                                         :rot [0 y 0]}]])))
+      (Thread/sleep 30))))

 (defn -ambient-light
   []


This test should take longer.

This test should take longer.

--- test/http/async/client/test.clj
+++ test/http/async/client/test.clj
@@ -251,7 +251,7 @@
       (is (true? @finished))))
   (testing "execution time"
     (let [finished (promise)
-          req (prepare-request :get "http://localhost:8123/")
+          req (prepare-request :get "http://localhost:8123/body")
           start (System/currentTimeMillis)
           resp (execute-request *client* req
                                 :completed (fn [_]


whitespace

whitespace

--- src-cljs/flatride/frontend.cljs
+++ src-cljs/flatride/frontend.cljs
@@ -87,10 +87,10 @@
   (set! *mapInstance* (window/google.maps.Map. (sel1 :#div-map-canvas) (map-config-obj latlng)))
     (.geocode geocoder (js-obj "latLng" latlng) fill-from-field)))

-(defn get-position-error []
+(defn get-position-error [c]
   "Handler Error in case of geolocation failure"
-   (set! *mapInstance* (window/google.maps.Map. (sel1 :#div-map-canvas)
-        (js-obj
+   (set! *mapInstance* (window/google.maps.Map. (sel1 :#div-map-canvas)
+        (js-obj
           "zoom" 14
           "mapTypeId" window/google.maps.MapTypeId.ROADMAP
           "disableDefaultUI" true


Update bide to 1.0.6

Update bide to 1.0.6

--- frontend/project.clj
+++ frontend/project.clj
@@ -27,7 +27,7 @@
                  [funcool/lentes "1.2.0"]
                  [funcool/beicon "2.5.0"]
                  [funcool/cuerdas "2.0.1"]
-                 [funcool/bide "1.0.5"]]
+                 [funcool/bide "1.0.6"]]
   :plugins [[lein-ancient "0.6.10"]]
   :clean-targets ^{:protect false} ["resources/public/js" "target"]
   )


Remove whitespace.

Remove whitespace.

--- test/uxbox/tests/test_users.clj
+++ test/uxbox/tests/test_users.clj
@@ -46,7 +46,6 @@
           (t/is (= (:email data) "user222@uxbox.io"))
           (t/is (not (contains? data :password))))))))

-
 (t/deftest test-http-update-profile-photo
   (with-open [conn (up/get-conn)]
     (let [user (th/create-user conn 1)]


Fixed comment.

Fixed comment.

--- src/clj_formal_specifications_app/spec.clj
+++ src/clj_formal_specifications_app/spec.clj
@@ -2,7 +2,7 @@

 (defn get-ns-name
   "If the given string starts with the ns macro call, returns the first
-  parameter given to it, which is the name of the namespace."
+  parameter given to it, which should be the name of the namespace."
   [s]
   (re-find #"(?<=\(ns\s)[a-zA-Z0-9\.-]+(?=[\s\(\)])" s))


NGM issues IV '11 and V '11.

NGM issues IV '11 and V '11.

--- src/clojure/kamituel/ngm_toc/data/ngm.cljc
+++ src/clojure/kamituel/ngm_toc/data/ngm.cljc
@@ -1580,4 +1580,53 @@
                 :description "Niezwykły pejzaż na ścianie pokoju można namalować przez małą dziurkę."}
                {:title "Superdrzewa"
                 :description "Sekwoje rozmiarów kosmicznych rakiet tworzą prawdziwą katedrę natury."
-                :places [{:country "USA" :region "Kalifornia" :coords [39.00 -123.65]}]}]}])
+                :places [{:country "USA" :region "Kalifornia" :coords [39.00 -123.65]}]}]}
+   {:year 2011 :month 5 :vol 140
+    :articles [{:title "Wywiad"
+                :description "Wywiad z dendrologiem Jackiem Oleksynem – o tym, jak drzewa ze sobą rozmawiają i dlaczego ekonomiczne teorie najlepiej testować na roślinach."}
+               {:title "Papiestwo"
+                :description "Święci i szubrawcy, asceci i hedoniści, mistycy i ludzie władzy. Galeria ludzkich typów wśród blisko trzech setek papieży jest wyjątkowo barwna, podobnie jak historia instytucji, której przewodzili.
+"}
+               {:title "Piękno destrukcji"
+                :description "Czy można zachwycić się wyrobiskiem, rzeką szlamu, hałdami odpadów? Okazuje się, że widziane z powietrza zyskują paradoksalnie estetyczny wymiar.
+"
+                :places [{:country "Polska" :city "Konin" :tags ["Odkrywka Gosławice"] :coords [52.28 18.26]}
+                         {:country "Polska" :city "Krokowa" :tags ["Bielawskie Błota"] :coords [54.80 18.22]}
+                         {:country "Polska" :city "Turawa" :tags ["Jezioro Turawskie"] :coords [50.72 18.12]}
+                         {:country "Polska" :city "Bełchatów" :coords [51.240108 19.256276]}
+                         {:country "Polska" :city "Police" :coords [53.575214 14.551096]}
+                         {:country "Polska" :city "Polkowice" :coords [51.513276 16.209036]}]}
+               {:title "Mrówki prządki"
+                :description "Uwierzycie, że wszystkie ziemskie mrówki ważą tyle co ludzie? Albo że organizują swoje społeczności, posługując się chemiczno-migowym „językiem”? Tak, mrówki potrafią dać do myślenia.
+"}
+               {:title "Jane Goodall"
+                :description "To ona odkryła, że szympansy nie są wegetarianami, ale organizują polowania. Że potrafią być okrutne
+i podłe. Że przypominają nas dużo bardziej, niż moglibyśmy przypuszczać. Rewolucja w prymatologii to jej wyłączna zasługa.
+"
+                :places [{:country "Tanzania" :region "Park Narodowy Gombe" :coords [-4.67 29.63]}]}
+               {:title "Żywy towar"
+                :description "Pantery śnieżne, tygrysy, ginące ptaki i gady. Rzadkie okazy dzikich zwierząt mogą kosztować nawet 100 tys. dolarów. Nic dziwnego, że taka kryjąca się w lesie fortuna kusi."}
+               {:title "Wielka Rafa Koralowa"
+                :description "Australijski szelf zdobi gigantyczna, ciągnąca się przez 2300 km, oszałamiająca żywa konstrukcja. Zmiany klimatu sprawiły, że rafa walczy dziś o przetrwanie. I nie wystarczy kibicować. Musimy jej pomóc."
+                :places [{:country "Australia" :region "Wielka Rafa Koralowa" :coords [-19.34 148.63]}]}]}
+   {:year 2011 :month 4 :vol 139
+    :articles [{:title "Wywiad"
+                :description "Wywiad z etnologiem Robertem Andrzejem Dulem – o tym, jak chronić to, co ulotne, czyli niematerialne dziedzictwo człowieka z listy UNESCO."}
+               {:title "Inkowie"
+                :description "Ci Rzymianie Andów swoje górskie imperium stworzyli dzięki budowie dróg i geniuszowi organizacyjnemu. Mocarstwa, jakiego nie widział kontynent, nie byłoby jednak bez korzystnych zmian klimatu."
+                :places [{:country "Peru" :city "Cuzco" :coords [-13.53 -71.95]}]}
+               {:title "Polskie żaby"
+                :description "Wydają się stworzeniami najpospolitszymi z możliwych. Tymczasem niektóre ich cechy naprawdę potrafią zaskoczyć. "
+                :places [{:country "Polska"}]}
+               {:title "Nyiragongo"
+                :description "Milionowe miasto Goma leży u stóp aktywnego wulkanu, w rejonie pełnym plujących lawą szczelin, obok jeziora absorbującego toksyczne gazy. Życie w takim sąsiedztwie podnosi poziom adrenaliny."
+                :places [{:country "Demokratyczna Republika Konga" :city "Goma" :coords [-1.527546 29.249660]}]}
+               {:title "Krym"
+                :description "Półwysep wdzierający się w Morze Czarne z powodu swej tragicznej historii ma kłopoty z tożsamością. Na ile jest tatarski, na ile ukraiński, na ile rosyjski? Dziedzictwo Związku Radzieckiego nie daje tu o sobie zapomnieć."
+                :places [{:country "Ukraina" :region "Krym" :coords [45.3 34.4]}]}
+               {:title "Walenie"
+                :description "Wielkie morskie ssaki wywodzą się od... zwierząt kopytnych, które wchodziły do wody coraz dalej i dalej, aż straciły kontakt z lądem. Świetnie zachowane dowody
+ich ewolucji odkopywane są dzisiaj w pustynnej egipskiej dolinie."}
+               {:title "Złoty czworokąt"
+                :description "Gigantyczny drogowy projekt łączący największe miasta dał Indiom rozwój i zmniejszenie nierówności. W przeludnionym kraju, w którym ziemia jest na wagę złota, oznaczał też jednak wiele krzywd i konfliktów."
+                :places [{:country "Indie"}]}]}])


fix for neighborhood line swarm

fix for neighborhood line swarm

--- src/brevis/example/swarm/neighborhood_line_swarm.clj
+++ src/brevis/example/swarm/neighborhood_line_swarm.clj
@@ -1,6 +1,6 @@
 (ns brevis.example.swarm.neighborhood-line-swarm
   (:use [brevis.physics collision core space utils]
-        [brevis.shape cone]
+        [brevis.shape cone box]
         [brevis core osd vector camera utils random]
         [brevis.graphics core basic-3D visual-overlays]))

@@ -167,7 +167,7 @@
   (set-dt 1)
   (set-neighborhood-radius 100)
   (default-display-text)
-  (add-object (move (make-floor 500 500) (vec3 0 (- boundary) 0)))
+  #_(add-object (move (make-floor 500 500) (vec3 0 (- boundary) 0)))
   (dotimes [_ num-birds]
     (add-object (random-bird))))


debugger: highlight the whole signal chain on hover

--- examples/_common/middleware/devtools.cljs
+++ examples/_common/middleware/devtools.cljs
@@ -280,10 +280,35 @@
                  (reconcile [::app-action (:id unknown-signal-event) action]))))))

 ;;;;;;;;;;;;;;;;;;;;;;;; View model
+(defn -signal-parent-ids
+  "Returns a set containing: id of parent, parent of parent, etc. "
+  [signal-events id]
+  (let [id->parent-id (atom {})
+        result (atom #{})]
+    (doseq [{:keys [id parent-id]} signal-events]
+      (swap! id->parent-id assoc id parent-id))
+
+    (loop [child-id id]
+      (if-let [parent-id (@id->parent-id child-id)]
+        (do
+          (swap! result conj parent-id)
+          (recur parent-id))
+
+        @result))))
+
 (defn -view-model
   [model]
-  (mvsa/track-keys (reaction (::debugger @model))
-                   [:initial-model :persist? :visible? :toggle-visibility-shortcut :signal-events :action-events :highlighted-signal-id]))
+  (let [debugger (reaction (::debugger @model))
+        signal-events (reaction (-> @debugger :signal-events))
+        highlighted-signal-id (reaction (-> @debugger :highlighted-signal-id))
+        highlighted-signal-ids (reaction (into #{@highlighted-signal-id}
+                                               (-signal-parent-ids @signal-events @highlighted-signal-id)))]
+    (-> (mvsa/track-keys debugger
+                         [:initial-model :persist? :visible? :toggle-visibility-shortcut :action-events])
+        (assoc :signal-events (reaction
+                                ; mapv instead of map is essential, without it referenced reactions will be recalculated several times
+                                (mapv #(assoc % :highlighted? (contains? @highlighted-signal-ids (:id %)))
+                                      @signal-events))))))

 ;;;;;;;;;;;;;;;;;;;;;;;; View
 (def -menu-button-style {:margin        "5px 3px"
@@ -362,28 +387,30 @@
          "model"])])])

 (defn -signal-view
-  [{:keys [id parent-id signal] :as _signal-event} highlighted? dispatch]
+  [{:keys [id parent-id signal highlighted?] :as _signal-event} dispatch]
   [:div {:style         {:margin-top       8
                          :padding-left     4
                          :cursor           "pointer"
-                         :background-color (if highlighted? "rgb(50, 150, 60)" "rgb(60, 70, 80)")}
+                         :background-color (if highlighted? "rgb(55, 130, 70)" "rgb(60, 70, 80)")}
          :title         "Click to enable/disable all actions dispatched from this signal"
          :on-click      #(dispatch [::on-toggle-signal id])
-         :on-mouse-over #(dispatch [::on-highlight-signal parent-id])
+         :on-mouse-over #(dispatch [::on-highlight-signal id])
          :on-mouse-out  #(dispatch [::on-highlight-signal nil])}
-   (when (not (nil? parent-id)) "△ ")
+   (when parent-id
+     [:span {:title "Signal was dispatched from another signal"} "↳ "])
+
    (if (coll? signal)
      [:span (pr-str (first signal)) " " (clojure.string/join " " (map pr-str (rest signal)))]
      (pr-str signal))])

 (defn -signals-view
-  [signal-events action-events highlighted-signal-id dispatch]
+  [signal-events action-events dispatch]
   [:div
    (doall
      (for [signal-event signal-events]
        ^{:key (:id signal-event)}
        [:div
-        [-signal-view signal-event (= (:id signal-event) highlighted-signal-id) dispatch]
+        [-signal-view signal-event dispatch]
         [-actions-view action-events (:id signal-event) dispatch]]))])

 (defn -initial-model-view
@@ -424,7 +451,7 @@
         body))

 (defn -view
-  [{:keys [visible? toggle-visibility-shortcut persist? initial-model signal-events action-events :highlighted-signal-id]}
+  [{:keys [visible? toggle-visibility-shortcut persist? initial-model signal-events action-events]}
    dispatch]
   [-overlay
    [-resizable-div {:style {:display          (if @visible? "block" "none") ; using CSS instead of React in order to persist resized frame on toggling visibility
@@ -451,7 +478,7 @@
      [:hr]
      [-initial-model-view @initial-model]
      [:hr]
-     [-signals-view @signal-events @action-events @highlighted-signal-id dispatch]]]])
+     [-signals-view @signal-events @action-events dispatch]]]])

 ;;;;;;;;;;;;;;;;;;;;;;;; Middleware
 (defn -wrap-load-from-storage


github url

github url

--- src/atom_finder/util/github_util.clj
+++ src/atom_finder/util/github_util.clj
@@ -34,7 +34,7 @@

 (defn github-url
   ([author proj rev-str file line]
-   (str "https://github.com/" author "/" proj "/" rev-str "/" file "#L" line))
+   (str "https://github.com/" author "/" proj "/blob/" rev-str "/" file "#L" line))
   ([found-atom]
    (let [[proj file] (->> found-atom filename relativize-filename (re-find #"([^/]+)/(.*)") rest)
          line (start-line found-atom)


Removed subtitles.

Removed subtitles.

--- src/clj/mx/roads/forgotten/blog/web/content/data.clj
+++ src/clj/mx/roads/forgotten/blog/web/content/data.clj
@@ -18,24 +18,22 @@
   [req]
   (merge
     (base req)
-    {:active "about"
-     :subtitle " :: About"}))
+    {:active "about"}))

 (defn credits
   [req]
   (merge
     (base req)
-    {:active "credits"
-     :subtitle " :: Credits"}))
+    {:active "credits"}))

 (defn starter
   [req]
   (merge
     (base req)
-    {:subtitle " :: Starter Page"}))
+    {}))

 (defn post
   [req]
   (merge
     (base req)
-    {:subtitle " :: Blog Post"}))
+    {}))


Fix ns formatting, remove unusued require

--- src/braid/core/server/api/github.clj
+++ src/braid/core/server/api/github.clj
@@ -3,12 +3,11 @@
     [clojure.data.json :as json]
     [clojure.string :as string]
     [org.httpkit.client :as http]
-    [braid.core.server.cache :as cache]
     [braid.core.server.conf :refer [config]]
     [braid.core.server.crypto :as crypto]
     [braid.core.server.util :refer [map->query-str ->transit transit->form]])
   (:import
-    org.apache.commons.codec.binary.Base64))
+    (org.apache.commons.codec.binary Base64)))

 (defn redirect-uri
   "This is a function instead of a var because we need to access config, which


First half of painted-squares works

First half of painted-squares works

1. Added tests
2. Fixed bugs
3. Cleaned up style -- marking constants is not done in Clojure because
everything is constant by default.

--- src/chapter5/painted-squares.cljs
+++ src/chapter5/painted-squares.cljs
@@ -1,13 +1,23 @@
 (ns chapter5.painted-squares
   (:refer chapter3.match :only [match match-state atom?])
   (:refer clojure.test :only [with-test is run-tests]))
-(def pattern
+                                        ; type Piece = [Symbol]
+                                        ; type Orientation = Int
+                                        ; type Placement = (Symbol, Orientation)
+                                        ; type State = [Placement]
+                                        ; type Patterns = Map Symbol Piece
+(def pattern ; pattern :: Patterns
   '{p1 [st ha gr st]
     p2 [bx st ha bx]
     p3 [st ha bx gr]
     p4 [gr gr ha bx]})
-(def ^:dynamic *box-width* 2)
-(def ^:dynamic *box-length* 2) ; not actually used
+(def box-width 2)
+(def box-length 2) ; not actually used
+(def south 0)
+(def east 1)
+(def north 2)
+(def west 3)
+
 (with-test
   (defn rotate-list [l n]
     (let [offset (- (count l) n)]
@@ -18,26 +28,56 @@
   (is (= [1 2 3] (rotate-list [1 2 3] 3)))
   (is (= [1 2 3] (rotate-list [1 2 3] 4))) ; should probably wrap around instead
 )
-(defn orient [piece orientation]
-  (rotate-list (pattern piece) (dec orientation)))
-(defn sides-ok [new-piece orientation current-state]
-  (if (empty? current-state)
-    true
-    (let [trial (orient new-piece orientation)
+(with-test
+  (defn orient [[piece orientation]]
+    "This is pretty much only needed because of map lookup for the piece's symbol.
+Note that orientation is 1-based on the book, but 0-based here."
+    (rotate-list (pattern piece) orientation))
+  (is (= '[st ha gr st] (orient '(p1 0))))
+  (is (= '[st st ha gr] (orient '(p1 1)))))
+(with-test
+  (defn match-north [trial state]
+    "(nth state (dec box-width)) looks like exactly one row up"
+    (= (trial north)
+       ((orient (nth state (dec box-width))) south)))
+  (is (match-north '[-- -- st --] '((-- 2) (p1 0))))
+  (is (match-north '[-- -- gr --] '((-- 2) (p1 2))))
+  (is (not (match-north '[-- -- st --] '((-- 2) (p1 2))))))
+(with-test
+  (defn match-west [trial state]
+    (= (trial west)
+       ((orient (first state)) east)))
+  (is (match-west '[st st st st] '((p1 1))))
+  (is (match-west '[ha ha ha ha] '((p1 0))))
+  (is (not (match-west '[st st st st] '((p1 0) (-- 2) (-- 3)))))
+  (is (not (match-west '[ha ha ha ha] '((p1 1)))))
+  (is (match-west '[-- -- -- st] '((p1 1))))
+  (is (match-west '[-- -- -- ha] '((p1 0))))
+)
+(with-test
+  (defn sides-ok [placement current-state]
+    (let [trial (orient placement)
           len (count current-state)]
       (cond
-        (= 0 (rem len *box-width*)) (return (match-north trial current-state))
-        (< len *box-width*) (return (match-west trial current-state))
-        :else (return (and (match-north trial current-state)
-                           (match-west trial current-state)))))))
-(defn match-north [trial state]
-  (= (trial 2) ;north side
-     ((orient (state (dec *box-width*))) 0)))
-(defn match-west [trial state]
-  (= (trial 3) ; west side of rotated new piece
-     ((orient (first state)) 2)))
-
-
+                                        ;  So he's checking whether we're currently in the (1) leftmost column (2) first row (3) other.
+                                        ; there are really only four cases in this setup, but this method will extend to any size at all.
+        ; first entry -- no check needed
+        (= 0 len) true
+        ; first column -- check to the north (but not west)
+        (= 0 (rem len box-width)) (match-north trial current-state)
+        ; first row -- check to the west (but not north)
+        (< len box-width) (match-west trial current-state)
+        ; others -- check both north and west
+        :else (and (match-north trial current-state)
+                   (match-west trial current-state)))))
+  (is (sides-ok '(p1 0) '()))
+  (is (sides-ok '(p2 1) '()))
+  (is (sides-ok '(p1 0) '((-- 0) (p3 1))))
+  (is (sides-ok '(p1 0) '((-- 0) (p4 0))))
+  (is (sides-ok '(p1 0) '((p3 1))))
+  (is (sides-ok '(p1 0) '((p2 0))))
+  (is (sides-ok '(p1 0) '((p2 0) (p4 0) (-- 0))))
+)
 (defn main []
   (loop [pieces '#{p1 p2 p3 p4}]
     'p1))


add quotes

add quotes

--- src/babel/francais/workbook.clj
+++ src/babel/francais/workbook.clj
@@ -196,7 +196,7 @@
       [:div.hints
        [:h3 "Try:"]
        [:div "(expr X)"]
-       [:div "(parse 'je parle')"]
+       [:div "(parse \"je parle\")"]

        ]


Backloggery: use https everywhere

Backloggery: use https everywhere

--- src/bltool/data/backloggery.clj
+++ src/bltool/data/backloggery.clj
@@ -54,10 +54,10 @@
                   "console" "" "rating" "" "status" "" "unplayed" "" "own" "" "search" ""
                   "comments" "" "region" "" "region_u" "0" "wish" "" "alpha" ""}
         params (conj defaults params)
-        response (http/get "http://backloggery.com/ajax_moregames.php"
+        response (http/get "https://backloggery.com/ajax_moregames.php"
                            {:cookies cookies
                             :query-params params
-                            :headers {"referer" (str "http://backloggery.com/games.php?user=" user)}})]
+                            :headers {"referer" (str "https://backloggery.com/games.php?user=" user)}})]
     (-> response :body java.io.StringReader. html/parse)))

 (defn- bl-get-compilation
@@ -68,10 +68,10 @@
                   "console" "" "rating" "" "status" "" "unplayed" "" "own" "" "search" ""
                   "comments" "" "region" "" "wish" "" "alpha" ""}
         params (conj defaults params)
-        response (http/get "http://backloggery.com/ajax_expandcomp.php"
+        response (http/get "https://backloggery.com/ajax_expandcomp.php"
                            {:cookies cookies
                             :query-params params
-                            :headers {"referer" (str "http://backloggery.com/games.php?user=" user)}})]
+                            :headers {"referer" (str "https://backloggery.com/games.php?user=" user)}})]
     (-> response :body java.io.StringReader. html/parse)))

 (defn- bl-extract-params [body]
@@ -186,7 +186,7 @@
         body (map (fn [[k v]] {:name k :content v}) params)]
     (printf "Adding %s game '%s' to backloggery:" (:progress game) (:name game))
     (let [response (http/post
-                     "http://backloggery.com/newgame.php"
+                     "https://backloggery.com/newgame.php"
                      {:cookies cookies
                       ;:debug true :debug-body true
                       :query-params {"user" user}
@@ -221,7 +221,7 @@
         params {"user" user "delete2" "Stealth Delete"}
         body (map (fn [[k v]] {:name k :content v}) params)]
     (printf "Deleting '%s' from backloggery:" (:name game))
-    (let [response (http/post "http://backloggery.com/update.php"
+    (let [response (http/post "https://backloggery.com/update.php"
                               {:cookies cookies
                                ;:debug true :debug-body true
                                :query-params {"user" user "gameid" (:id game)}
@@ -254,7 +254,7 @@

 ;     if game._details then return game end

-;     local body = assert(request(self, { user = self.user, gameid = game.id }, "GET", "http://backloggery.com/update.php"))
+;     local body = assert(request(self, { user = self.user, gameid = game.id }, "GET", "https://backloggery.com/update.php"))

 ;     local function set(key, value)
 ;         if not game[key] then
@@ -308,7 +308,7 @@
 ;     game.submit2 = "Stealth Save"

 ;     -- create request
-;     local r,e = request(self, game, "POST", "http://backloggery.com/update.php?user="..self.user.."&gameid="..game.id)
+;     local r,e = request(self, game, "POST", "https://backloggery.com/update.php?user="..self.user.."&gameid="..game.id)

 ;     -- update internal structures
 ;     self:games()[game.id] = game


Got instaparse working.  Stupid newline characters....

--- src/clj/dicey_web/pcgreader.clj
+++ src/clj/dicey_web/pcgreader.clj
@@ -191,13 +191,6 @@
 ; Values containing | are maps
 ; Value maps are keyed by everything before the first |

-(def testfile "/home/ryan/pcgen6001/characters/Rajralin.pcg")
-
-;(file-lines testfile)
-
-(def testfilestr (apply str (interleave (file-lines testfile) (repeat "\n")))
-  )
-
 (def charfile-parser
   (insta/parser
    "
@@ -205,34 +198,33 @@

    <kvsep> = <':'>
    <kvdelim> = <'|'>
-
-   <word> = #'[^:\\|\\[\\]]+'
-   key = word
-   val = word?
+   <linesep> = <'\n'>
+   <liststart> = <'['>
+   <listend> = <']'>
+
+   <word> = #'[^:|\\[\\]\\n]+'
+   <key> = word
+   <val> = word | ''

    kv = key kvsep val
    listkv = key kvsep listval

-   listval = <'['> (kv | kvdelim)+  <']'>
+   listval = liststart (kv | kvdelim)+ listend
    mapval = key (kvdelim (kv | listkv))+ kvdelim?

-   line = key kvsep (val | mapval | listval) <'\n'>
+   <numval> = #'\\d+'
+   numlist = numval (kvsep numval)+
+
+   line = key kvsep (val | mapval | listval | numlist) linesep
    "
    )
   )

 (def parsetransform
   {
-   :key str
-   :val str
+   :line (fn [k & v] {(keyword (.toLowerCase k)) v})
+   :kv (fn [k & v] {(keyword (.toLowerCase k)) v})
+   :listval list
+   :mapval (fn [k & v] {(keyword k) v})
    }
   )
-
-(insta/transform parsetransform (charfile-parser testfilestr)
-                 )
-
-;(def char-file
-;  (parse-lines (file-lines testfile))
-;  )
-
-;((:ability char-file) "FEAT")


Fixes incorrect `can-pay?` use.

Fixes incorrect `can-pay?` use.

--- src/clj/game/core-abilities.clj
+++ src/clj/game/core-abilities.clj
@@ -129,7 +129,7 @@
   "Shows a 'Yes/No' prompt and resolves the given ability if Yes is chosen."
   [state side card msg ability targets]
   (show-prompt state side card msg ["Yes" "No"] #(let [yes-ability (:yes-ability ability)]
-                                                  (if (and (= % "Yes") yes-ability (can-pay? state side (:cost yes-ability)))
+                                                  (if (and (= % "Yes") yes-ability (can-pay? state side (:title card) (:cost yes-ability)))
                                                     (resolve-ability state side yes-ability card targets)
                                                     (when-let [no-ability (:no-ability ability)]
                                                       (resolve-ability state side no-ability card targets))))))
@@ -291,4 +291,4 @@
   [state card trace]
   (show-wait-prompt state :runner (str "Corp to initiate a trace from " (:title card)) {:priority 2})
   (show-prompt state :corp card "Boost trace strength?" :credit
-               #(init-trace state :corp card trace %) {:priority 2}))+               #(init-trace state :corp card trace %) {:priority 2}))


Check if leftmost form is a vec, fixes regression

--- src/clj/todomvc/tuple_rule.cljc
+++ src/clj/todomvc/tuple_rule.cljc
@@ -79,18 +79,19 @@

 (defn parse-with-fact-expression [expr]
   (let [fact-expression (take 2 expr)
-         expression (drop 2 expr)]
-   (conj (lazy-seq (parse-as-tuple expression))
-         (second fact-expression)
-         (first fact-expression))))
+        expression      (drop 2 expr)]
+    (conj (lazy-seq (parse-as-tuple expression))
+      (second fact-expression)
+      (first fact-expression))))

 (defn rewrite-lhs [exprs]
   (mapv (fn main-one [expr]
-          (let [leftmost (first expr)
-                op (keyword? (dsl/ops leftmost))
+          (let [leftmost        (first expr)
+                op              (keyword? (dsl/ops leftmost))
                 fact-expression (and (not (keyword? leftmost))
-                                     (is-binding? leftmost))]
+                                  (not (vector? leftmost))
+                                  (is-binding? leftmost))]
             (cond
               op expr
               fact-expression (parse-with-fact-expression expr)
@@ -115,10 +116,10 @@
      [name & body]
      (if (com/compiling-cljs?)
        `(clara.macros/defrule ~name ~@body)
-       (let [doc        (if (string? (first body)) (first body) nil)
-             body       (if doc (rest body) body)
-             properties (if (map? (first body)) (first body) nil)
-             definition (if properties (rest body) body)
+       (let [doc             (if (string? (first body)) (first body) nil)
+             body            (if doc (rest body) body)
+             properties      (if (map? (first body)) (first body) nil)
+             definition      (if properties (rest body) body)
              {:keys [lhs rhs]} (dsl/split-lhs-rhs definition)
              lhs-detuplified (rewrite-lhs lhs)]
          ;(println "LHS in" lhs)
@@ -136,6 +137,7 @@
 ;LHS ([:todo/title [[e a v]] (= ?e e)] [:exists [:todo/done]])
 (rewrite-lhs '([[?e :todo/title _]] [:exists [:todo/done]]))

+;TODO. Test these also. SHould work and be equivalent since b0c3f1c082dde6019675cc24a5a0120ce9c544ac
 (macroexpand
   '(def-tuple-rule my-tuple-rule
      "Docstring!!"


Extract the code that allows to add a task in a card

--- src/cljs/clojure_rest/core.cljs
+++ src/cljs/clojure_rest/core.cljs
@@ -136,17 +136,24 @@
    :backgroundColor (-> card :category category->color)
   })

+(defn render-add-list
+  "Render the text field allowing to add new tasks to a card"
+  [card-id]
+  [:input.checklist--add-task
+   {:type "text"
+    :placeholder "Type then hit Enter to add a task"
+    :on-key-press (fn [e]
+                    (when (= "Enter" (.-key e))
+                      (add-task-to! card-id (.. e -target -value))
+                      (set! (.. e -target -value) "")
+                  ))
+    }])
+
 (defn render-card
   []
   (let [show-details (r/atom false)
         toggle-details #(swap! show-details not)
-        title-style #(if % :div.card__title--is-open :div.card__title)
-        add-task (fn [card-id e]
-                   (when (= "Enter" (.-key e))
-                     (add-task-to! card-id (.. e -target -value))
-                     (set! (.. e -target -value) "")
-                   ))
-        ]
+        title-style #(if % :div.card__title--is-open :div.card__title)]
     (fn [card]
       [:div.card
        [:div {:style (card-side-color card)}]
@@ -155,10 +162,7 @@
          [:div.card__details
           (:description card)
           [render-tasks (:tasks card)]
-          [:input.checklist--add-task
-           {:type "text"
-            :placeholder "Type then hit Enter to add a task"
-            :on-key-press #(add-task (:card-id card) %)}]
+          [render-add-list (:card-id card)]
          ])
        ])
     ))


Adds 2 more spaceships and does some clean up


Moar kvar

Moar kvar

--- src/cljs/mokkameister/core.cljs
+++ src/cljs/mokkameister/core.cljs
@@ -3,7 +3,8 @@
   (:require [mokkameister.random :refer [rand-nth-weighted]]
             [reagent.core :as reagent :refer [atom]]
             [ajax.core :refer [GET POST]]
-            [cljs.core.async :as async :refer [timeout <!]]))
+            [cljs.core.async :as async :refer [timeout <!]]
+            [clojure.string :as string :refer [join]]))

 (enable-console-print!)

@@ -80,8 +81,9 @@

 (defn- chart-title []
   (let [brew (rand-nth-weighted {"Brygg" 8, "Mikrodosar" 2, "Kaffidoktorar" 1})
+        per (rand-nth-weighted {"per" 2, "kvar" 1})
         month (rand-nth-weighted {"månad" 8, "monade" 2, "månefase" 1, "nymåne" 1})]
-    (str brew " per " month)))
+    (join " " [brew per month])))

 (defn chart-panel []
   (let [title (chart-title)


Reduce timeout to 1.5s

Reduce timeout to 1.5s

--- src/cljs/tackytoe/app/game.cljs
+++ src/cljs/tackytoe/app/game.cljs
@@ -41,7 +41,7 @@
                (valid-move? board idx))
       (play-move state idx)
       (js/setTimeout #(play-move state (ai (:board @state) (:mark @state)))
-                     (rand-int 2000)))))
+                     (rand-int 1500)))))

 (defn turn?
@@ -71,9 +71,8 @@

 ;; Use this markup to render results -->
-
-;; [:div.result
-;;  [:h2.result__label "Rajini Won"]
-;;  [:div.result__winner {:data-player "rajini"}]
-;;  [:h1.result__text "Mind It!!"]
-;;  [:a.result__home {:href "/"}]]
+  ;; [:div.result
+  ;;  [:h2.result__label "Rajini Won"]
+  ;;  [:div.result__winner {:data-player "rajini"}]
+  ;;  [:h1.result__text "Mind It!!"]
+  ;;  [:a.result__home {:href "/"}]]


[n.t.repl] Don't crash if CIDER is absent

--- src/clojure/neko/tools/repl.clj
+++ src/clojure/neko/tools/repl.clj
@@ -2,7 +2,8 @@
   (:require neko.log)
   (:import android.content.Context
            java.util.concurrent.atomic.AtomicLong
-           java.util.concurrent.ThreadFactory))
+           java.util.concurrent.ThreadFactory
+           java.io.FileNotFoundException))

 (def cider-middleware
   "A vector containing all CIDER middleware."
@@ -18,6 +19,11 @@
     cider.nrepl.middleware.test/wrap-test
     cider.nrepl.middleware.trace/wrap-trace
     cider.nrepl.middleware.undef/wrap-undef])
+
+(defn cider-available? []
+  (try (require 'cider.nrepl.version)
+       true
+       (catch FileNotFoundException e false)))

 (defn android-thread-factory
   "Returns a new ThreadFactory with increased stack size. It is used to
@@ -71,8 +77,10 @@
   (when (or (not (:neko.init/release-build *compiler-options*))
             (:neko.init/start-nrepl-server *compiler-options*))
     (let [build-port (:neko.init/nrepl-port *compiler-options*)
-          mware (list `quote (or (:neko.init/nrepl-middleware *compiler-options*)
-                                 cider-middleware))]
+          mware (when (cider-available?)
+                  (list `quote
+                        (or (:neko.init/nrepl-middleware *compiler-options*)
+                            cider-middleware)))]
       `(let [port# (or ~port ~build-port 9999)]
          (apply start-repl ~mware :port port# ~other-args)
          (neko.log/i "Nrepl started at port" port#)))))


improve Invasion of Privacy message

improve Invasion of Privacy message

--- src/clj/game/cards-operations.clj
+++ src/clj/game/cards-operations.clj
@@ -106,7 +106,7 @@
                       card targets))}

    "Invasion of Privacy"
-   {:trace {:base 2 :msg (msg "reveal the Runner's Grip")
+   {:trace {:base 2 :msg (msg "reveal the Runner's Grip and trash up to " (- target (second targets)) " resources or events")
             :effect (req (doseq [c (:hand runner)]
                            (move state side c :play-area)))
             :unsuccessful {:msg "take 1 bad publicity" :effect (effect (gain :corp :bad-publicity 1))}}}
@@ -318,4 +318,4 @@
                       card nil)))}

    "Witness Tampering"
-   {:effect (effect (lose :bad-publicity 2))}})+   {:effect (effect (lose :bad-publicity 2))}})


More concise cursor forward/back

More concise cursor forward/back

--- src/cljs/asciinema_player/vt.cljs
+++ src/cljs/asciinema_player/vt.cljs
@@ -212,14 +212,12 @@

 (defn execute-cuf [{{x :x} :cursor :keys [width] :as vt}]
   (let [n (get-param vt 0 1)
-        new-x (+ x n)
-        new-x (if (< new-x width) new-x (dec width))]
+        new-x (min (+ x n) (dec width))]
     (assoc-in vt [:cursor :x] new-x)))

 (defn execute-cub [{{x :x} :cursor :keys [width] :as vt}]
   (let [n (get-param vt 0 1)
-        new-x (- x n)
-        new-x (if (>= new-x 0) new-x 0)]
+        new-x (max (- x n) 0)]
     (assoc-in vt [:cursor :x] new-x)))

 (defn execute-cnl [vt]


Show arrow for directions

Show arrow for directions

--- src/cljs/battle_console/game.cljs
+++ src/cljs/battle_console/game.cljs
@@ -100,6 +100,22 @@
     "p2" "warning"
     nil ""))

+(defn- direction-to-arrow
+  "Converts a direction to an arrow"
+  [element]
+  (condp = (get element "direction")
+    "south" "↓"
+    "north" "↑"
+    "east" "→"
+    "west" "←"
+    nil ""))
+
+(defn- display-unit
+  "Displays the unit of the given element"
+  [element]
+  (when element)
+    (str (get element "unit") " " (direction-to-arrow element)))
+
 (defn- render-board-cell
   "Renders a board's cell"
   [game x y]
@@ -108,7 +124,7 @@
         css (get-element-css game element)]
     (dom/td #js {:className css}
       (dom/p #js {:className "boardCoords"} coordCode)
-      (dom/p #js {:className "boardUnit"} (or (get element "unit") "-"))
+      (dom/p #js {:className "boardUnit"} (or (display-unit element) "-"))
       (dom/p #js {:className "boardQuantity"} (or (get element "quantity") 0)))))

 (defn- render-board
@@ -177,8 +193,7 @@
         updated-game (assoc current-game "board" (or (get data "p2-focused-board") (get data "board")))]
     (state/set-state :game-data updated-game)
     (state/set-state :current-actions new-actions)
-    (state/set-state :processing-action nil)
-    ))
+    (state/set-state :processing-action nil)))

 (defn- error-loading-action
   "Error loading action"


Fixed regression in dom.cljs.

Fixed regression in dom.cljs.

--- src/cljs/clojure/browser/dom.cljs
+++ src/cljs/clojure/browser/dom.cljs
@@ -1,8 +1,8 @@
 (ns clojure.browser.dom
-  (:require [goog.dom :as dom]))
+  (:require [goog.dom :as gdom]))

 (defn append [parent & children]
-  (apply dom/append parent children)
+  (apply gdom/append parent children)
   parent)

 (defprotocol DOMBuilder
@@ -14,15 +14,14 @@
 (defn log-obj [obj]
   (.log js/console obj))

-(declare element)
 (extend-protocol DOMBuilder

   string
   (-element
     ([this]
        (log "string (-element " this ")")
-       (cond (keyword? this) (dom/createElement  (name this))
-             :else           (dom/createTextNode (name s))))
+       (cond (keyword? this) (gdom/createElement  (name this))
+             :else           (gdom/createTextNode (name this))))

     ([this attrs-or-children]
        (log "string (-element " this " " attrs-or-children ")")
@@ -46,11 +45,11 @@
                          nil)]
          (log-obj str-attrs)
          (if (seq children)
-           (apply dom/createDom
+           (apply gdom/createDom
                   (name this)
                   str-attrs
                   (map -element children))
-           (dom/createDom (name this)
+           (gdom/createDom (name this)
                           str-attrs)))))

   Vector
@@ -83,19 +82,14 @@
 (defn remove-children
   "Remove all children from the element with the passed id."
   [id]
-  (let [parent (dom/getElement (name id))]
-    (do (dom/removeChildren parent))))
+  (let [parent (gdom/getElement (name id))]
+    (do (gdom/removeChildren parent))))

 (defn get-element [id]
-  (dom/getElement (name id)))
+  (gdom/getElement (name id)))

 (defn html [s]
-  (dom/htmlToDocumentFragment s))
-
-(defn element-arg? [x]
-  (or (keyword? x)
-      (map? x)
-      (string? x)))
+  (gdom/htmlToDocumentFragment s))

 (defn insert-at [parent child index]
-  (dom/insertChildAt parent child index))
+  (gdom/insertChildAt parent child index))


responses

responses

--- src/com/narkisr/celestial/api.clj
+++ src/com/narkisr/celestial/api.clj
@@ -8,13 +8,18 @@
 (defroutes app-routes
   (context "/provision" []
            (defroutes provision-routes
-             (POST "/" {body :body}
-                   (let [{:keys [provision]} body] (puppetize provision)))))
+             (POST "/" [provision]
+                   (debug "provisioning" provision)
+                   (puppetize provision)
+                   "Provision done"
+                   )))
   (context "/system" []
            (defroutes system-routes
              (POST "/:hypervisor" [hypervisor system]
                   (debug "setting up system" system "on" hypervisor)
-                  (reload system hypervisor))))
+                  (reload system hypervisor)
+                   "System reloaded"
+                   )))
   (route/not-found "Not Found"))

 (def app


refresh token if needed when subscribing to webhook

--- src/chat/server/extensions/asana.clj
+++ src/chat/server/extensions/asana.clj
@@ -85,11 +85,17 @@
 ;; Webhooks
 (defn register-webhook
   [extension-id resource-id]
-  (let [ext (db/with-conn (db/extension-by-id extension-id))]
-    (http/post (str api-url "/webhooks")
-               {:oauth-token (:token ext)
-                :form-params {"resource" resource-id
-                              "target" (str webhook-uri "/" (:id ext))}})))
+  (let [ext (db/with-conn (db/extension-by-id extension-id))
+        resp @(http/post (str api-url "/webhooks")
+                         {:oauth-token (:token ext)
+                          :form-params {"resource" resource-id
+                                        "target" (str webhook-uri "/" (:id ext))}})]
+    (if (<= 200 (:status resp) 299)
+      resp
+      (do (timbre/warnf "token expired")
+          (if (refresh-token extension-id)
+            (register-webhook extension-id resource-id)
+            (timbre/warnf "Failed to refresh token"))))))

 (defmethod handle-webhook :asana
   [extension event-req]


Fix pinned edited messages in communities

Signed-off-by: Brian Sztamfater <760e7dab2836853c63805033e514668301fa9c47@status.im>

--- src/status_im/ui/screens/chat/sheets.cljs
+++ src/status_im/ui/screens/chat/sheets.cljs
@@ -87,7 +87,9 @@
        :subtitle            (i18n/label :t/view-details)
        :chevron             true
        :accessibility-label :view-community-channel-details
-       :on-press            #(hide-sheet-and-dispatch [:navigate-to :community-channel-details {:chat-id chat-id}])}]
+       :on-press            #(do
+                               (hide-sheet-and-dispatch [:navigate-to :community-channel-details {:chat-id chat-id}])
+                               (re-frame/dispatch [::models.pin-message/load-pin-messages chat-id]))}]
      [quo/list-item
       {:theme               :accent
        :title               (i18n/label :t/mark-all-read)