clean up

clean up

--- src/polismath/conversation.clj
+++ src/polismath/conversation.clj
@@ -146,142 +146,3 @@
        (> n-ptpts 1500)   large-conv-update
        :else             small-conv-update)
           {:conv conv :votes votes :opts opts})))
-
-
-(defn conv-update2 [conv votes]
-  (let [
-        opts'   (merge {:n-comps 2
-                          :pca-iters 10
-                          :base-iters 10
-                          :base-k 50
-                          :group-iters 10
-                          :group-k 3}
-                    (:opts conv))
-
-        rating-mat (update-nmat
-                    (:rating-mat conv)
-                    (map #(map % [:pid :tid :vote]) votes))
-
-        ;swap nils for zeros -
-        ; most things need the 0s, but repness needs the nils
-        mat-w-zeros (map (fn [row] (map #(if (nil? %) 0 %) row))
-                 (:matrix rating-mat))
-
-        pca (wrapped-pca mat-w-zeros (:n-comps opts')
-                           :start-vectors (get-in conv [:pca :comps])
-                           :iters (:pca-iters opts'))
-
-        proj (pca-project mat-w-zeros pca)
-
-
-        base-clusters
-          (sort-by :id
-            (kmeans (assoc rating-mat :matrix proj)
-                (:base-k opts')
-                :last-clusters (:base-clusters conv)
-                :cluster-iters (:base-iters opts')))
-
-        group-k (choose-group-k base-clusters)
-
-        group-clusters
-         (sort-by :id
-          (kmeans
-            (xy-clusters-to-nmat2 base-clusters)
-            group-k
-            :last-clusters (:group-clusters conv)
-            :cluster-iters (:group-iters opts')))
-
-        repness
-           (sort-by :id
-             (if (> (count group-clusters) 1)
-               (conv-repness
-                rating-mat
-                group-clusters
-                base-clusters)))
-
-        bid-to-pid
-          (map :members(sort-by :id (:base-clusters base-clusters)))
-
-        ]
-    {
-         :opts opts'
-         :rating-mat rating-mat
-         :mat mat-w-zeros
-         :pca pca
-         :proj proj
-         :base-clusters base-clusters
-         :bid-to-pid bid-to-pid
-         :group-clusters group-clusters
-         :repness repness
-         }))
-
-
-
-
-(def conv-update-graph-ok
-  "Base of all conversation updates; handles default update opts and does named matrix updating"
-  {:opts'       (plmb/fnk [opts]
-                  "Merge in opts with the following defaults"
-                  (merge {:n-comps 2
-                          :pca-iters 10
-                          :base-iters 10
-                          :base-k 50
-                          :group-iters 10}
-                    opts))
-   :rating-mat  (plmb/fnk [conv votes]
-                  (update-nmat (:rating-mat conv)
-                               (map #(map % [:pid :tid :vote]) votes)))
-   :mat   (plmb/fnk [rating-mat]
-              "swap nils for zeros - most things need the 0s, but repness needs the nils"
-              (map (fn [row] (map #(if (nil? %) 0 %) row))
-                (:matrix rating-mat)))
-    :pca   (plmb/fnk [conv mat opts']
-              (wrapped-pca mat (:n-comps opts')
-                           :start-vectors (get-in conv [:pca :comps])
-                           :iters (:pca-iters opts')))
-    :proj  (plmb/fnk [mat pca]
-                     (pca-project mat pca))
-
-   :base-clusters
-          (plmb/fnk [conv rating-mat proj opts']
-           (sort-by :id
-            (kmeans (assoc rating-mat :matrix proj)
-                (:base-k opts')
-                :last-clusters (:base-clusters conv)
-                :cluster-iters (:base-iters opts'))))
-
-    :group-clusters
-        (plmb/fnk [conv rating-mat base-clusters opts']
-          (sort-by :id
-          (kmeans
-            (xy-clusters-to-nmat2 base-clusters)
-            (choose-group-k base-clusters)
-            :last-clusters (:group-clusters conv)
-            :cluster-iters (:group-iters opts'))))
-
-    :repness
-          (plmb/fnk [rating-mat group-clusters base-clusters]
-            (sort-by :id
-             (if (> (count group-clusters) 1)
-               (conv-repness
-                rating-mat
-                group-clusters
-                base-clusters))))
-
-   :bid-to-pid
-           (plmb/fnk [base-clusters]
-             (map :members(sort-by :id (:base-clusters base-clusters))))
-
-   })
-
-
-(def conv-update-ok (graph/eager-compile conv-update-graph-ok))
-
-
-(defn conv-update3 [conv votes & {:keys [med-cutoff large-cutoff]
-                                 :or {med-cutoff 100 large-cutoff 1000}
-                                 :as opts}]
-  (let [ptpts   (:row (:rating-mat conv))
-        n-ptpts (count (distinct (into ptpts (map :pid votes))))]
-    (conv-update-ok
-          {:conv conv :votes votes :opts opts})))


create an ajax helper where the controls handler can get the data

--- frontend/utils/ajax.cljs
+++ frontend/utils/ajax.cljs
@@ -56,3 +56,21 @@
                                                (put! channel [message :failed (assoc % :context context)]))
                              :finally #(binding [frontend.async/*uuid* uuid]
                                          (put! channel [message :finished context]))}))))
+
+(defn managed-ajax [method url & {:keys [params keywords?]
+                                  :or {keywords? true}}]
+  (let [channel (chan)]
+    (clj-ajax/ajax-request url method
+                       (clj-ajax/transform-opts
+                        {:format (merge (clj-ajax/json-request-format)
+                                        (json-response-format {:keywords? keywords? :url url :method method}))
+                         :response-format :json
+                         :keywords? keywords?
+                         :params params
+                         :headers (merge {:Accept "application/json"}
+                                         (when (re-find #"^/" url)
+                                           {:X-CSRFToken (utils/csrf-token)}))
+                         :handler #(put! channel (assoc % :status :success))
+                         :error-handler #(put! channel (assoc % :status :failed))
+                         :finally #(close! channel)}))
+    channel))


Cleanup filter fns

Cleanup filter fns

--- frontend/utils/docs.cljs
+++ frontend/utils/docs.cljs
@@ -63,23 +63,23 @@
           [:li [:code (if-let [name (:name version)] name version)]])]))

 (defn replace-variables [html]
-  (let [re (js/RegExp. "{{\\s*([^\\s]*)\\s*(?:\\|\\s*([\\w-]*)\\s*)?}}" "g")]
-    (.replace html re (fn [s m1 m2]
-                        (let [[name & path] (string/split m1 #"\.")
-                              var (case name
-                                    "versions" (aget js/window "CI" "Versions")
-                                    "api_data" (aget js/window "circle_api_data"))
-                              val (apply aget var path)
-                              filter (case m2
-                                       "code-list" code-list-filter
-                                       "api-endpoint" api-endpoint-filter
-                                       identity)]
-                          (filter (js->clj val :keywordize-keys true)))))))
+  (string/replace html #"\{\{\s*([^\s]*)\s*(?:\|\s*([\w-]*)\s*)?\}\}"
+                  (fn [s m1 m2]
+                    (let [[name & path] (string/split m1 #"\.")
+                          var (case name
+                                "versions" (aget js/window "CI" "Versions")
+                                "api_data" (aget js/window "circle_api_data"))
+                          val (apply aget var path)
+                          filter (case m2
+                                   "code-list" code-list-filter
+                                   "api-endpoint" api-endpoint-filter
+                                   identity)]
+                      (filter (utils/js->clj-kw val))))))

 (defn replace-asset-paths [html]
-  (let [re (js/RegExp. "\\(asset:/(/.*?)\\)" "g")]
-    (.replace html re (fn [s match]
-                        (str "(" (stefon/asset-path match) ")")))))
+  (string/replace html #"\(asset:/(/.*?)\)"
+                  (fn [s match]
+                    (str "(" (stefon/asset-path match) ")"))))

 (defn render-markdown [input]
   (when input


add a few pauses to make the animation feel more natural

--- src-cljs/frontend/components/drawing.cljs
+++ src-cljs/frontend/components/drawing.cljs
@@ -157,9 +157,8 @@
     nil))

 (defn run-animation* [owner start-ms current-ms tick-state min-tick max-tick]
-  (if-not (and (om/mounted? owner)
-               (seq (:ticks tick-state)))
-    nil;(js/console.profileEnd)
+  (when (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)))
@@ -252,13 +251,15 @@
       (dom/span #js {:className "hidden"}))))

 (defn add-shape [tick-state tick-count props]
-  (draw-shape tick-state (merge (let [start-tick (inc (apply max (conj (keys (:ticks tick-state)) -1)))]
+  (draw-shape tick-state (merge (let [pause (+ 3 (inc (rand-int 5)))
+                                      start-tick (+ pause (apply max (conj (keys (:ticks tick-state)) -1)))]
                                   {:start-tick start-tick
                                    :end-tick (+ start-tick (int (* 1.5 tick-count)))})
                                 props)))

 (defn add-mouse-transition [tick-state tick-count previous-shape next-shape]
-  (move-mouse tick-state (let [start-tick (inc (apply max (conj (keys (:ticks tick-state)) -1)))]
+  (move-mouse tick-state (let [pause (+ 6 (inc (rand-int 4)))
+                               start-tick (+ pause (apply max (conj (keys (:ticks tick-state)) -1)))]
                            {:start-tick start-tick
                             :end-tick (+ start-tick (int (* 1.5 tick-count)))
                             :start-x (:end-x previous-shape)
@@ -400,15 +401,15 @@
       (add-shape 50 menu-bar)
       (add-mouse-transition 25 menu-bar close-button)
       (add-shape 10 close-button)
-      (add-mouse-transition 10 close-button minimize-button)
+      (add-mouse-transition 12 close-button minimize-button)
       (add-shape 10 minimize-button)
-      (add-mouse-transition 10 minimize-button expand-button)
+      (add-mouse-transition 8 minimize-button expand-button)
       (add-shape 10 expand-button)
       (add-mouse-transition 30 expand-button search-box)
       (add-shape 30  search-box)
       (add-mouse-transition 20 search-box submit-button)
       (add-shape 30 submit-button)
-      (add-mouse-transition 1 submit-button lucky-button)
+      (add-mouse-transition 12 submit-button lucky-button)
       (add-shape 30 lucky-button)
       (add-mouse-transition 20 lucky-button footer-1)
       (add-shape 20 footer-1)


Copy tweaks

Copy tweaks

--- src-cljs/frontend/components/stories.cljs
+++ src-cljs/frontend/components/stories.cljs
@@ -194,7 +194,7 @@
       [:p "LearnZillion is building the world's first free digital curriculum, developed by veteran teachers from K-12 schools. Their app consists of custom content management for their curriculum lessons, and, like any complex application, it has grown to require a number of data stores, queues and more."]
       [:p "In addition to Rails, LearnZillion uses Postgres, Redis, Memcached, and Resque on the backend, and RSpec for unit tests. They use Knockout for their frontend. Browser tests use Selenium, Capybara, and Cucumber."]
       [:h2 "Life Before CircleCI"]
-      [:p "LearnZillion's CI process consisted of a laptop under a desk running TeamCity, and they were constantly dealing with environment and OS issues. Additionally, the functional QA test process was entirely manual and time consuming. Releases were done every 2-4 weeks by the engineer on-call. “At that interval, the engineer deploying code couldn’t have known all the intricacies of what was being deployed,” said Ian Lotinsky, VP of Engineering at LearnZillion. “It was downright dangerous.” Deployments were often done late at night to reduce the impact of unexpected issues too. “We needed to move to continuous delivery.”"]]]
+      [:p "LearnZillion's CI process consisted of a laptop under a desk running TeamCity, and they were constantly dealing with environment and OS issues. Additionally, the functional QA test process was entirely manual and time consuming. Releases were done every 2-4 weeks by the engineer on-call. “At that interval, the engineer deploying code couldn’t have known all the intricacies of what was being deployed,” said Ian Lotinsky, CTO of Engineering at LearnZillion. “It was downright dangerous.” Deployments were often done late at night to reduce the impact of unexpected issues too. “We needed to move to continuous delivery.”"]]]
     [:div.outer-section.outer-section-condensed
      common/language-background
      [:section.container
@@ -202,9 +202,9 @@
        [:div.col-xs-6.col-xs-offset-3
         (features/testimonial {:company-name "LearnZillion"
                                :company-short "learnzillion"
-                               :customer-quote "CircleCI is great because blah, blah, blah..."
+                               :customer-quote "CircleCI makes our products better by allowing us to spend more energy testing them and less time managing a home-grown testing infrastructure."
                                :employee-name "Ian Lotinsky"
-                               :employee-title "VP Engineering"
+                               :employee-title "CTO"
                                :image-src (utils/cdn-path "/img/outer/customers/customer-learnzillion.png")
                                :read-the-story? false})]]]]
     [:div.outer-section
@@ -237,11 +237,12 @@
        "There are a number of different teams within Sony that depend on CircleCI for CI and CD, but this will be a deep-dive on one project developed at Sony Japan that provides shared services such as authentication and user management for a variety of web applications, such as "
        [:a {:href "https://playmemoriesonline.com/"}
         "PlayMemories"]
-       ", the cross-platform, cloud-based photo sharing service. The project is called Next Generation Core, or NG-Core for short, and it is made up of [Docker](link)-based microservices written in"
+       ", the cross-platform, cloud-based photo sharing service. The project is called Next Generation Core, or NG-Core for short, and it is made up of "
+       [:a {:href "https://www.docker.com/"} "Docker"] "-based microservices written in "
        [:a {:href "https://golang.org/"}
-        "Go"]]
+        "Go"] "."]
       [:h2 "The Old Way"]
-      [:p "While the new NG-Core team, led by Yoshiyuki Mineo, was able to start their project from scratch using some very modern tools, older projects in the organization had used a very different software development process. They were million-line Java monoliths that could take up to 4 days to deploy to production app servers based on instructions written in a spreadsheet and handed off to an operations team."]]]
+      [:p "While the new NG-Core team, led by Yoshiyuki Mineo, started the project from scratch using some very modern tools, older projects in the organization had used a very different software development process. They were million-line Java monoliths that could take up to 4 days to deploy to production app servers based on instructions written in a spreadsheet and handed off to an operations team."]]]
     [:div.outer-section.outer-section-condensed
      common/language-background
      [:section.container
@@ -250,7 +251,7 @@
         (features/testimonial {:company-name "Sony"
                                :company-short "learnzillion"
                                :customer-quote "Our old deployment process involved a spreadsheet of instructions and people to run them and took days. The new process has been fully automated from the start with CircleCI and Docker and takes only ~20 minutes."
-                               :employee-name "Tomoki Kobayakawa"
+                               :employee-name "Tomoaki Kobayakawa"
                                :employee-title "Deputy General Manager"
                                :image? false
                                :read-the-story? false})]]]]


fix watch not recovering from errors

fix watch not recovering from errors

fixes #105

--- src/main/shadow/build/data.clj
+++ src/main/shadow/build/data.clj
@@ -192,7 +192,7 @@
 (defn remove-source-by-id [state resource-id]
   (let [rc (get-in state [:sources resource-id])]
     (if-not rc
-      rc
+      state
       (-> state
           (remove-provides rc)
           (update :output dissoc resource-id)


io/file doesn't work on resources inside an uberjar

use io/input-stream instead and close it in the finally clause

--- src/mdr2/schema_validation.clj
+++ src/mdr2/schema_validation.clj
@@ -21,15 +21,17 @@
         ;; claims that smil files are valid against the vubis bulk
         ;; import schema.
         factory "com.thaiopensource.relaxng.jaxp.XMLSyntaxSchemaFactory"
+        schema-stream (io/input-stream (io/resource schema))
         validator (.newValidator
                    (.newSchema
                     (SchemaFactory/newInstance language factory nil)
-                    (StreamSource. (io/file (io/resource schema)))))]
+                    (StreamSource. schema-stream)))]
     (try
       (.validate validator (StreamSource. file))
       []
       (catch SAXException e
-        [(.getMessage e)]))))
+        [(.getMessage e)])
+      (finally (.close schema-stream)))))

 (defn valid?
   "Check if a `file` is valid against given `schema`"


more helpfull failuer message for assert-json

--- ring/src/ring/test_helpers.clj
+++ ring/src/ring/test_helpers.clj
@@ -57,6 +57,7 @@
   "Assert that the json encoded in a response body corresponds to a given
   hash/array data strucutre."
   [expected-data actual-body]
-  (assert-truth (= expected-data (json/decode-from-str actual-body))
-    (format "Expecting JSON parsing to %s, but got %s"
-      (prn-str expected-data) (prn-str actual-body))))
+  (let [actual-data (json/decode-from-str actual-body)]
+    (assert-truth (= expected-data actual-data)
+      (format "Expecting JSON parsing to %s, but got %s"
+        (prn-str expected-data) (prn-str actual-data)))))


use updated board information if changed during a publish.

--- src/oc/storage/api/entries.clj
+++ src/oc/storage/api/entries.clj
@@ -73,7 +73,9 @@
           merged-entry (merge existing-entry (entry-res/ignore-props props))
           updated-entry (update merged-entry :attachments #(entry-res/timestamp-attachments %))]
       (if (lib-schema/valid? common-res/Entry updated-entry)
-        {:existing-entry existing-entry :updated-entry updated-entry}
+        {:existing-entry existing-entry
+         :existing-board new-board
+         :updated-entry updated-entry}
         [false, {:updated-entry updated-entry}])) ; invalid update

     true)) ; no existing entry, so this will fail existence check later
@@ -366,7 +368,8 @@
                                org-uuid (:uuid org)
                                entry (or (:existing-entry ctx)
                                          (entry-res/get-entry conn entry-uuid))
-                               board (board-res/get-board conn (:board-uuid entry))
+                               board (or (:existing-board ctx)
+                                         (board-res/get-board conn (:board-uuid entry)))
                                _matches? (and (= org-uuid (:org-uuid entry))
                                               (= org-uuid (:org-uuid board))
                                               (= :draft (keyword (:status entry))))] ; sanity check


Ah, actually forgot to remove call to «redraw-scene»

in do-{nodes,lines}, sorry for that.

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

--- src/conexp/contrib/draw/scene_layouts.clj
+++ src/conexp/contrib/draw/scene_layouts.clj
@@ -37,8 +37,7 @@
   [[node scene] & body]
   `(do-swing
      (doseq [~node (filter node? (get-diagram-from-scene ~scene))]
-       ~@body)
-     (redraw-scene ~scene)))
+       ~@body)))

 (defmacro do-lines
   "Do whatever with every connection on the scene. Does not redraw the
@@ -46,8 +45,7 @@
   [[line scene] & body]
   `(do-swing
      (doseq [~line (filter connection? (get-diagram-from-scene ~scene))]
-       ~@body)
-     (redraw-scene ~scene)))
+       ~@body)))

 ;;; manipulate layout of scene

@@ -82,20 +80,18 @@
   "Updates layout according to new layout. The underlying lattice must
   not be changed."
   [^GScene scene layout]
-  (do-swing
-   (let [pos (positions layout)]
-     (do-nodes [node scene]
-       (let [[x y] (pos (get-name node))]
-         (move-node-unchecked-to node x y))))))
+  (let [pos (positions layout)]
+    (do-nodes [node scene]
+      (let [[x y] (pos (get-name node))]
+        (move-node-unchecked-to node x y)))))

 (defn set-layout-of-scene
   "Sets given layout as current layout of scene."
   [^GScene scene layout]
-  (do-swing
-   (doto scene
-     (.removeAll)
-     (add-nodes-with-connections (positions layout) (connections layout) (annotation layout))
-     (add-data-to-scene :layout layout))))
+  (doto scene
+    (.removeAll)
+    (add-nodes-with-connections (positions layout) (connections layout) (annotation layout))
+    (add-data-to-scene :layout layout)))

 ;;; draw nodes with coordinates and connections on a scene


refactor pivot to look more like union and lose union between ccount and pivot

--- src/main/clojure/org/dada/demo/whales.clj
+++ src/main/clojure/org/dada/demo/whales.clj
@@ -312,28 +312,21 @@
 (defn pivot [[#^Model src-metamodel #^Metadata src-metadata #^Collection extra-keys] pivot-key pivot-values value-key]
   (let [pivot-name (str ".pivot(" value-key "/" pivot-key")")
 	pivot-metadata (pivot-metadata src-metadata extra-keys pivot-values value-key)
+	tgt-model (PivotModel.
+		   (str (name (gensym "PIVOT")) pivot-name)
+		   src-metadata
+		   (fn [old new] new)
+		   value-key
+		   pivot-values
+		   pivot-metadata)
 	tgt-metamodel (meta-view
 		       pivot-key
 		       src-metamodel
 		       (fn [tgt-metamodel src-model & extra-values]
-			   ;; we'll need to build the metadata here
-			   (let [tgt-model
-				 (PivotModel.
-				  (str (name (gensym "PIVOT")) pivot-name)
-				  src-metadata
-				  (fn [old new] new)
-				  value-key
-				  pivot-values
-				  pivot-metadata)
-				 ]
-			     ;;(println "PIVOT"  extra-keys pivot-key pivot-values value-key extra-values)
-			     (insert *metamodel* tgt-model)
-			     (insert tgt-metamodel [tgt-model])
-			     (connect src-model tgt-model)
-			     )))]
+			   (connect src-model tgt-model)))]
+    (insert *metamodel* tgt-model)
+    (insert tgt-metamodel [tgt-model])
     [tgt-metamodel src-metadata extra-keys]))
-
-;;CHECK IN, THEN FIGURE OUT HOW A PIVOT DIFFERS FROM A UNION - COMPARE PIVOT AND UNION FNS - i THINK PIVOT IS DOING TO MUCH WORK...

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

@@ -361,14 +354,12 @@
        :type
        nil
        #(pivot
-	 (union
 	  (ccount
 	   (split
 	    %
 	    :time
 	    (fn [time] (list (or (.lower years time) time)))
 	    ))
-	  )
 	 :time
 	 years
 	 (keyword (count-value-key nil)))


util/hadoop.clj: remember to bind *reporter* in byteswritable-map

--- src/org/altlaw/util/hadoop.clj
+++ src/org/altlaw/util/hadoop.clj
@@ -102,10 +102,11 @@
         value (.get wvalue)
         size (.getSize wvalue)]
     (log/debug "Map input: " key " => <" size " bytes>")
-    (doseq [[key value] (map-fn key value size)]
-      (log/debug "Map OUTPUT: " key " => "(log/logstr value))
-      (.collect output (Text. (pr-str key))
-                (Text. (pr-str value))))))
+    (binding [*reporter* reporter]
+      (doseq [[key value] (map-fn key value size)]
+        (log/debug "Map OUTPUT: " key " => "(log/logstr value))
+        (.collect output (Text. (pr-str key))
+                  (Text. (pr-str value)))))))

 (defn standard-reduce [reduce-fn this wkey wvalues-iter output reporter]
   (let [key (read-string (str wkey))


accomodate cljs-3196 repl change

accomodate cljs-3196 repl change

--- sidecar/src/figwheel_sidecar/repl.clj
+++ sidecar/src/figwheel_sidecar/repl.clj
@@ -169,7 +169,7 @@
        (cemerick.piggieback/cljs-repl
         :repl-env figwheel-repl-env
         :special-fns (or (:special-fns opts) cljs.repl/default-special-fns))
-       (cljs.repl/repl* figwheel-repl-env opts)))))
+       (cljs.repl/repl* figwheel-repl-env (assoc opts :compiler-env (:compiler-env build)))))))

 (defn namify [arg]
   (if (seq? arg)


added code to parse default values for include tags

--- src/selmer/template_parser.clj
+++ src/selmer/template_parser.clj
@@ -100,7 +100,17 @@
         (.append ^StringBuilder buf block-tag)
         (consume-block rdr buf blocks)))))

-(defn read-template [template blocks]
+
+
+(defn set-default-value [tag-str defaults]
+  (let [tag-name (-> tag-str
+                   (clojure.string/replace #"\{\{\s*" "")
+                   (clojure.string/replace #"\s*\}\}" ""))]
+    (if-let [value (get defaults tag-name)]
+      (str "{{" tag-name "|default:\"" value "\"}}")
+      tag-str)))
+
+(defn read-template [template blocks & defaults]
   (let [buf (StringBuilder.)
         [parent blocks]
         (with-open [rdr (reader (resource-path template))]
@@ -113,6 +123,10 @@
               (open-tag? ch rdr)
               (let [tag-str (read-tag-content rdr)]
                 (cond
+                  (and defaults
+                       (re-matches #"\{\{\s*.*\s*\}\}" tag-str))
+                  (set-default-value tag-str defaults)
+
                   ;;if the template extends another it's not the root
                   ;;this template is allowed to only contain blocks
                   (re-matches #"\{\%\s*extends.*" tag-str)
@@ -141,7 +155,7 @@
               (do
                 (if (nil? parent) (.append buf ch))
                 (recur blocks (read-char rdr) parent)))))]
-    (if parent (recur parent blocks) (.toString buf))))
+    (if parent (recur parent blocks defaults) (.toString buf))))

 (defn preprocess-template [template]
   (-> (read-template template {}) insert-includes))


avoid reflection in tiled-map-layer, for speed

--- src/play_clj/core_graphics.clj
+++ src/play_clj/core_graphics.clj
@@ -121,7 +121,7 @@
         (-> ^BatchTiledMapRenderer (u/get-obj screen :renderer)
             .getMap
             .getLayers
-            (.get layer)))))
+            (.get (str layer))))))

 (defmacro tiled-map-layer
   "Returns a [TiledMapTileLayer](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/maps/tiled/TiledMapTileLayer.html)


made name editing of app name a bit nicer

Styled the editing and added the application icon on the left

--- idecode/myappshare/mainapp.cljs
+++ idecode/myappshare/mainapp.cljs
@@ -106,44 +106,48 @@
   {:on-mount
    (do  (go
           (if  (read-ui app [:app-id])
-              (let [x (remote  !getfilecontents  {:id (read-ui app [:app-id]) })]
-
-                (js/createEditor)
-                (js/populateEditor (get x :value))
-                ;(reeval (read-ui app [:app-id]))
-                ;(js/populateEditor (str "Loaded: " (read-ui app [:app-id])))
-
-                ))))}
+            (let [x (remote  !getfilecontents  {:id (read-ui app [:app-id]) })]
+
+              (js/createEditor)
+              (js/populateEditor (get x :value))
+              ;(reeval (read-ui app [:app-id]))
+              ;(js/populateEditor (str "Loaded: " (read-ui app [:app-id])))
+
+              ))))}

   (div {}
-       (realtime select id, application_name from appshare_applications where id = ? {:params [(read-ui app [:app-id])]}
-                 (cond
-                   (and (= (read-ui app [:submode]) "editappname") (= (<-- :id ) (read-ui app [:app-id])))
-                   (input-field {:style {:marginBottom "20px" :color "black"} :placeholder  (str (<-- :application_name))}
-                                app
-                                (fn [new-name]
-                                  (let [id (read-ui app [:app-id])]
-                                    (go
-                                      (sql "update  appshare_applications
-                                           set application_name = ?
-                                           where id = ?"
-                                           [new-name id ]  )
-                                      ;(js/alert (str new-name ":" id))
-                                      (write-ui app [:submode] nil)
-                                      ))))
-
-
-                   ; if we select a different app
-                   :else
-                   (do
-                     (div {:onClick     #(go  (write-ui app [:submode] "editappname")
-                                              (write-ui app [:app-id] (<-- :id))
-                                              )
-
-                           :style {:display "inline-block" :fontFamily "Ubuntu" :fontWeight "700" :fontSize "1.3em" ::marginTop "0.7em"}}
-                          (str (<-- :application_name)))))
-       )
+       (realtime select   id, application_name, application_glyph   from appshare_applications where id = ? {:params [(read-ui app [:app-id])]}
+                 (div {:style {:marginLeft "20px" :padding "5px"}}
+                      (let [glyphicon (if (<-- :application_glyph)  (<-- :application_glyph) "glyphicon-align-left")]
+                        (span {:className (str "glyphicon " glyphicon)
+                               :aria-hidden "true"} ""))
+                      (cond
+                        (and (= (read-ui app [:submode]) "editappname") (= (<-- :id ) (read-ui app [:app-id])))
+                        (input-field {:style {:marginLeft "20px" :color "black"} :placeholder  (str (<-- :application_name))}
+                                     app
+                                     (fn [new-name]
+                                       (let [id (read-ui app [:app-id])]
+                                         (go
+                                           (sql "update  appshare_applications
+                                                set application_name = ?
+                                                where id = ?"
+                                                [new-name id ]  )
+                                           ;(js/alert (str new-name ":" id))
+                                           (write-ui app [:submode] nil)
+                                           ))))
+
+
+                        ; show the name of the app
+                        :else
+                        (do
+                          (div {:onClick     #(go  (write-ui app [:submode] "editappname")
+                                                   (write-ui app [:app-id] (<-- :id))
+                                                   )
+
+                                :style {:display "inline-block" :fontFamily "Ubuntu" :fontWeight "700" :fontSize "1.3em"  :marginLeft "20px"}}
+                               (str (<-- :application_name)))))
+                      ))
        (textarea {:id "cm" :style {:display "inline-block" :width "100%" :height "800"}} "TEXT EDITOR")))

@@ -161,7 +165,7 @@
        (div {:style {:display "inline-block" :fontFamily "Ubuntu" :fontSize "1em"}}
                "Build an app in 5 minutes")
   (div {:style {:marginLeft "25px"}}
-       (realtime select id, application_name from appshare_applications order by id {}
+       (realtime select id, application_name, application_glyph from appshare_applications order by id {}
                (div nil

@@ -193,8 +197,9 @@

                       ; if we select a different app
                       :else
-                      (do
-                        (span {:className "glyphicon glyphicon-align-left" :aria-hidden "true"}
+                      (let [glyphicon (if (<-- :application_glyph)  (<-- :application_glyph) "glyphicon-align-left")]
+                        (span {:className (str "glyphicon " glyphicon)
+                               :aria-hidden "true"}
                               (span {:onClick     #(go  (write-ui app [:mode] "view")
                                                        ;(write-ui app [:submode] "editappname")
                                                        (write-ui app [:app-id] (<-- :id))


Ste - Making resource return test data xml


Added confirm to conexp.gui.util

Added confirm to conexp.gui.util

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

--- src/conexp/gui/util.clj
+++ src/conexp/gui/util.clj
@@ -10,7 +10,7 @@
   (:import [javax.swing JFrame JMenuBar JMenu JMenuItem Box JToolBar JPanel
 	                JButton ImageIcon JSeparator JTabbedPane JSplitPane
 	                JLabel JTextArea JScrollPane SwingUtilities BorderFactory
-	                AbstractButton SwingConstants JFileChooser]
+	                AbstractButton SwingConstants JFileChooser JOptionPane]
 	   [javax.swing.filechooser FileNameExtensionFilter]
 	   [javax.imageio ImageIO]
 	   [java.awt GridLayout BorderLayout Dimension Image Font Color
@@ -65,6 +65,11 @@
   [res]
   (let [cl (.getContextClassLoader (Thread/currentThread))]
     (.getResource cl res)))
+
+(defn confirm
+  "Opens a message dialog asking for confirmation."
+  [frame message]
+  (JOptionPane/showConfirmDialog frame message))

 ;;; Menus
@@ -336,6 +341,9 @@
   [frame & filters]
   (let [#^JFileChooser fc (apply make-file-chooser frame filters)]
     (when (= (.showSaveDialog fc frame) JFileChooser/APPROVE_OPTION)
+      ;; ask again if answer is no
+      ;; return file if answer is yes
+      ;; return nil if answer is cancel
       (.getSelectedFile fc))))

 ;;;


Modified to correspond that the font file extend was upper case.

--- src/tames/operations/fonts.clj
+++ src/tames/operations/fonts.clj
@@ -21,28 +21,35 @@
                                  (map (fn [file] (. file getAbsolutePath))
                                       (vec files))))
                              font-dir-paths)
-        ttf-font-paths  (filter #(or (. %1 endsWith ".ttf")
-                                     (. %1 endsWith ".otf"))
+        ttf-font-paths  (filter #(let [lastIndex (. %1 lastIndexOf ".")
+                                       ext       (if (< lastIndex 0)
+                                                     nil
+                                                     (.. %1 (substring lastIndex) (toLowerCase)))]
+                                     (or (= ext ".otf")
+                                         (= ext ".ttf")))
                                 (flatten font-file-paths))]
-    ;(pprint/pprint ttf-font-paths)
     (vec ttf-font-paths)))

+(defn get-ttf-font-info
+  [font-path]
+  (let [font       (Font/createFont Font/TRUETYPE_FONT (File. font-path))
+        font-name  (. font getName)
+        font-value { "name"   font-name
+                     "face"   (. font getFontName (Locale/JAPANESE))
+                     "family" (. font getFamily (Locale/JAPANESE))
+                     "path"   font-path}]
+    font-value))
+
 (defn get-ttf-font-map
   [ttf-font-paths]
   (loop [font-map   {}
          font-paths ttf-font-paths]
     (if (= (count font-paths) 0)
         font-map
-        (let [font-path  (font-paths 0)
-              rest-paths (subvec font-paths 1)
-              font       (Font/createFont Font/TRUETYPE_FONT (File. font-path))
-              font-name  (. font getName)
-                         font-value { "name"   font-name
-                                      "face"   (. font getFontName (Locale/JAPANESE))
-                                      "family" (. font getFamily (Locale/JAPANESE))
-                                      "path"   font-path}]
-          (recur (assoc font-map font-name font-value) rest-paths)))))
-
+        (let [rest-paths (subvec font-paths 1)
+              font-path  (font-paths 0)
+              font-value (get-ttf-font-info font-path)]
+          (recur (assoc font-map (font-value "name") font-value) rest-paths)))))

 ;(def ttf-font-map (get-ttf-font-map (get-ttf-font-file-paths)))
 (def ttf-font-map (ref nil))


refactor aggregate-select to use transducers

--- src/thi/ng/fabric/triples.cljc
+++ src/thi/ng/fabric/triples.cljc
@@ -82,12 +82,13 @@
        ;; FIXME delay
        (when (every? #(not= [nil] %) res)
          (->> res
-              (map #(disj % nil))
-              (set)
+              (into #{} (map #(disj % nil)))
               (sort-by count)
               (reduce set/intersection)
-              (map #(deref (f/vertex-for-id g %)))
-              (set)))))))
+              (into #{}
+               (comp (map #(f/vertex-for-id g %))
+                     (filter identity)
+                     (map deref)))))))))

 (defn qvar?
   "Returns true, if x is a qvar (a symbol prefixed with '?')"


10 min TTL

10 min TTL

--- src/uuuurrrrllll/cassandra.clj
+++ src/uuuurrrrllll/cassandra.clj
@@ -13,7 +13,7 @@

 (defn add-entry! [body]
   (let [short-url (gen-short-url 5)]
-    (insert table (assoc body :short_url short-url))
+    (insert table (assoc body :short_url short-url) (using :ttl 600))
     short-url))

 (defn add-text! [text]


Add new view

Add new view


Move impls to more reasonable places

Move impls to more reasonable places

--- src/desdemona/query.clj
+++ src/desdemona/query.clj
@@ -5,6 +5,26 @@
    [clojure.string :as s]
    [instaparse.core :as insta]
    [clojure.java.io :refer [resource]]))
+
+(defn free-sym
+  "Returns symbol, but marked as a free variable."
+  [sym]
+  (vary-meta sym assoc ::free true))
+
+(def ^:private free-sym?
+  "Check if an object has the free variable metadata annotation."
+  (every-pred symbol? (comp ::free meta)))
+
+(defn ^:private find-free-vars
+  "Finds all the free logic variables in a given logic query.
+
+  This takes advantage of the fact that function references for goal
+  functions/macros (conde, featurec...) will be fully qualified, but free
+  variables will be unadorned by a namespace."
+  [logic-query]
+  (->> (flatten logic-query)
+       (filter free-sym?)
+       (into #{})))

 (defn ^:private generate-logic-query
   "Expands a query and events to a core.logic program that executes
@@ -34,26 +54,6 @@
        (eval (generate-logic-query n-answers logic-query events))
        (finally
          (in-ns (ns-name old-ns)))))))
-
-(defn free-sym
-  "Returns symbol, but marked as a free variable."
-  [sym]
-  (vary-meta sym assoc ::free true))
-
-(def ^:private free-sym?
-  "Check if an object has the free variable metadata annotation."
-  (every-pred symbol? (comp ::free meta)))
-
-(defn ^:private find-free-vars
-  "Finds all the free logic variables in a given logic query.
-
-  This takes advantage of the fact that function references for goal
-  functions/macros (conde, featurec...) will be fully qualified, but free
-  variables will be unadorned by a namespace."
-  [logic-query]
-  (->> (flatten logic-query)
-       (filter free-sym?)
-       (into #{})))

 (defn ^:private dsl->logic
   "Given a DSL query, compile it to the underlying logic (miniKanren)


Make more tests pass

Make more tests pass

--- src/desdemona/query.clj
+++ src/desdemona/query.clj
@@ -61,7 +61,8 @@
   [dsl-query]
   (m/match [dsl-query]
     [((= ((attr lvar) :seq) value) :seq)]
-    `(l/featurec ~lvar {~attr ~value})
+    (let [lvar (free-sym lvar)]
+      `(l/featurec ~lvar {~attr ~value}))

     [((= value ((attr lvar) :seq)) :seq)]
     `(l/featurec ~lvar {~attr ~value})


Exclude `contains?` to avoid warnings

Exclude `contains?` to avoid warnings

--- src/extracter/files.clj
+++ src/extracter/files.clj
@@ -1,4 +1,5 @@
 (ns extracter.files
+  (:refer-clojure :exclude [contains?])
   (:require [clojure.java.io :as io]))

 (defn contains?


view-model is more explicit now by adding select-keys

--- src/frontend/todos.cljs
+++ src/frontend/todos.cljs
@@ -2,9 +2,7 @@
 (ns frontend.todos
   (:require [cljs.core.match :refer-macros [match]]
             [reagent.core :as r]
-            [com.rpl.specter :as s]
-            [goog.events]
-            [goog.history.EventType :as EventType]))
+            [com.rpl.specter :as s]))

 ;;;;;;;;;;;;;;;;;;;;;;;; Model
 (defn -init-todo
@@ -170,21 +168,22 @@
 ;;;;;;;;;;;;;;;;;;;;;;;; View model
 (defn view-model
   [model]
-  (assoc model
-    :todos (filter (case (:visibility model)
-                     :all (constantly true)
-                     :active (complement :completed?)
-                     :completed :completed?)
-                   (:todos model))
-    :has-todos? (-> (:todos model) count pos?)
-    :active-count (->> (:todos model)
-                       (filter (complement :completed?))
-                       count)
-    :has-completed-todos? (->> (:todos model)
-                               (filter :completed?)
-                               count
-                               pos?)
-    :all-completed? (every? :completed? (:todos model))))
+  (-> model
+      (select-keys [:field :visibility])
+      (assoc :todos (filter (case (:visibility model)
+                              :all (constantly true)
+                              :active (complement :completed?)
+                              :completed :completed?)
+                            (:todos model))
+             :has-todos? (-> (:todos model) count pos?)
+             :active-count (->> (:todos model)
+                                (filter (complement :completed?))
+                                count)
+             :has-completed-todos? (->> (:todos model)
+                                        (filter :completed?)
+                                        count
+                                        pos?)
+             :all-completed? (every? :completed? (:todos model)))))

 ;;;;;;;;;;;;;;;;;;;;;;;; View
 (defn -enter-key?
@@ -283,8 +282,8 @@
 ;;;;;;;;;;;;;;;;;;;;;;;; Spec
 (defn new-spec
   [history]
-  {:init           init
-   :view-model     view-model
-   :view           view
-   :control        (new-control history)
-   :reconcile      (new-reconcile history)})+  {:init       init
+   :view-model view-model
+   :view       view
+   :control    (new-control history)
+   :reconcile  (new-reconcile history)})


Move terms to reaction for prevent recalculation when click on translate

--- src/teach_by_friends/subs.cljs
+++ src/teach_by_friends/subs.cljs
@@ -40,9 +40,9 @@
   (fn [db _]
     (let [term-to-translate (reaction (get @db :term-to-translate))
           term-translate (reaction (get @db :term-translate))
-          sort-type (reaction (:sort-chapter @db))]
-      (reaction (->> (get @db :chapter)
-                     (chapter-word-list @sort-type)         ;todo: move this to reaction
+          sort-type (reaction (:sort-chapter @db))
+          terms (reaction (chapter-word-list @sort-type (get @db :chapter)))]
+      (reaction (->> @terms
                      (add-status-keys @term-to-translate @term-translate))))))

 (register-sub


remove wrap-reload middleware

remove wrap-reload middleware

Remove wrap-reload middleware as we intend to use the reloaded work-flow
which is incompatible with this middleware. More about reloaded
work-flow: http://thinkrelevance.com/blog/2013/06/04/clojure-workflow-reloaded

--- dev/user.clj
+++ dev/user.clj
@@ -1,6 +1,5 @@
 (ns user
   (:require [dashboard-clj.server]
-            [ring.middleware.reload :refer [wrap-reload]]
             [figwheel-sidecar.repl-api :as figwheel]))

 ;; Let Clojure warn you when it needs to reflect on types, or when it does math
@@ -8,8 +7,6 @@
 ;; degraded performance.
 (set! *warn-on-reflection* true)
 (set! *unchecked-math* :warn-on-boxed)
-(def http-handler
-  (wrap-reload #'dashboard-clj.server/http-handler))

 (defn run []
   (figwheel/start-figwheel!))


Removed new proj; might be causing buginess?

--- src/polismath/conversation.clj
+++ src/polismath/conversation.clj
@@ -180,11 +180,10 @@
                           :start-vectors (get-in conv [:pca :comps])
                           :iters (:pca-iters opts')))

-      :proj (plmb/fnk [rating-mat pca]
-              (sparsity-aware-project-ptpts (get-matrix rating-mat) pca))
-
-      :old-proj
-            (plmb/fnk [mat pca]
+      ;:proj (plmb/fnk [rating-mat pca]
+              ;(sparsity-aware-project-ptpts (get-matrix rating-mat) pca))
+
+      :proj (plmb/fnk [mat pca]
               (pca-project mat pca))

       :base-clusters


Revert "Turn footer off in inner"

Revert "Turn footer off in inner"

--- src-cljs/frontend/components/app.cljs
+++ src-cljs/frontend/components/app.cljs
@@ -1,46 +1,44 @@
 (ns frontend.components.app
-  (:require [ankha.core :as ankha]
-            [cljs.core.async :as async :refer [>! <! alts! chan sliding-buffer close!]]
-            [clojure.string :as string]
-            [frontend.api :as api]
+  (:require [cljs.core.async :as async :refer [>! <! alts! chan sliding-buffer close!]]
             [frontend.async :refer [raise!]]
+            [frontend.components.account :as account]
             [frontend.components.about :as about]
-            [frontend.components.account :as account]
-            [frontend.components.add-projects :as add-projects]
             [frontend.components.admin :as admin]
             [frontend.components.aside :as aside]
             [frontend.components.build :as build-com]
-            [frontend.components.changelog :as changelog]
-            [frontend.components.common :as common]
             [frontend.components.dashboard :as dashboard]
             [frontend.components.documentation :as docs]
+            [frontend.components.features :as features]
+            [frontend.components.mobile :as mobile]
+            [frontend.components.press :as press]
+            [frontend.components.add-projects :as add-projects]
+            [frontend.components.insights :as insights]
+            [frontend.components.invites :as invites]
+            [frontend.components.changelog :as changelog]
             [frontend.components.enterprise :as enterprise]
             [frontend.components.enterprise-landing :as enterprise-landing]
             [frontend.components.errors :as errors]
-            [frontend.components.features :as features]
             [frontend.components.footer :as footer]
             [frontend.components.header :as header]
-            [frontend.components.insights :as insights]
             [frontend.components.inspector :as inspector]
             [frontend.components.integrations :as integrations]
-            [frontend.components.invites :as invites]
             [frontend.components.jobs :as jobs]
             [frontend.components.key-queue :as keyq]
-            [frontend.components.landing :as landing]
-            [frontend.components.language-landing :as language-landing]
-            [frontend.components.mobile :as mobile]
-            [frontend.components.opt-in :as opt-in]
-            [frontend.components.org-settings :as org-settings]
             [frontend.components.placeholder :as placeholder]
-            [frontend.components.press :as press]
             [frontend.components.pricing :as pricing]
             [frontend.components.privacy :as privacy]
             [frontend.components.project-settings :as project-settings]
             [frontend.components.security :as security]
             [frontend.components.shared :as shared]
+            [frontend.components.stories :as stories]
+            [frontend.components.language-landing :as language-landing]
+            [frontend.components.landing :as landing]
+            [frontend.components.org-settings :as org-settings]
+            [frontend.components.opt-in :as opt-in]
+            [frontend.components.common :as common]
+            [frontend.components.top-nav :as top-nav]
             [frontend.components.signup :as signup]
-            [frontend.components.stories :as stories]
-            [frontend.components.top-nav :as top-nav]
+            [frontend.api :as api]
             [frontend.config :as config]
             [frontend.instrumentation :as instrumentation]
             [frontend.models.feature :as feature]
@@ -49,7 +47,8 @@
             [frontend.utils :as utils :include-macros true]
             [frontend.utils.seq :refer [dissoc-in]]
             [om.core :as om :include-macros true]
-            [om.dom :as dom :include-macros true])
+            [om.dom :as dom :include-macros true]
+            [ankha.core :as ankha])
   (:require-macros [frontend.utils :refer [html]]))

 (def keymap
@@ -127,17 +126,18 @@
               ;; simple optimzation for real-time updates when the build is running
               app-without-container-data (dissoc-in app state/container-data-path)
               dom-com (dominant-component app owner)
-              project (get-in app state/project-path)
-              inner? (get-in app state/inner?-path)]
+              show-header-and-footer? (not= :signup (:navigation-point app))
+              project (get-in app state/project-path)]
           (reset! keymap {["ctrl+s"] persist-state!
                           ["ctrl+r"] restore-state!})
           (html
-           [:div#app {:class (string/join " "
-                               (cond-> [(if inner? "inner" "outer")
-                                        (if (feature/enabled? :ui-v2) "ui-v2" "ui-v1")]
-                                 (not logged-in?) (conj "aside-nil")
-                                 ;; The following is meant for the landing ab test to hide old header/footer
-                                 (= :pricing (:navigation-point app)) (conj "pricing")))}
+           (let [inner? (get-in app state/inner?-path)]
+
+             [:div#app {:class (concat [(if inner? "inner" "outer")]
+                                       (when-not logged-in? ["aside-nil"])
+                                       (if (feature/enabled? :ui-v2) ["ui-v2"] ["ui-v1"])
+                                       ;; The following is meant for the landing ab test to hide old header/footer
+                                       (when (= :pricing (:navigation-point app)) ["pricing"]))}
               (om/build keyq/KeyboardHandler app-without-container-data
                         {:opts {:keymap keymap
                                 :error-ch (get-in app [:comms :errors])}})
@@ -173,16 +173,16 @@

                 [:div.main-body
                  (when (and (not (feature/enabled? :ui-v2))
-                            (not inner?))
+                            show-header-and-footer?)
                    (om/build header/header app-without-container-data))
                  (om/build dom-com app)

-                 (when (and (not inner?) (config/footer-enabled?))
+                 (when (and show-header-and-footer? (config/footer-enabled?))
                    [:footer.main-foot
                     (footer/footer)])]]

                 (when (and (config/help-tab-enabled?) (not logged-in?))
-                  (om/build shared/sticky-help-link app))]]))))))
+                  (om/build shared/sticky-help-link app))]])))))))

 (defn app [app owner opts]


[l.droid] Don't fail on project creation w/o sdk-path

--- src/leiningen/droid.clj
+++ src/leiningen/droid.clj
@@ -59,12 +59,14 @@
      (help #'droid))
   ([project & [cmd & args]]
      (init-hooks)
-     (when (and (nil? project) (not (#{"new" "help" "init"} cmd)))
-       (abort "Subtask" cmd "should be run from the project folder."))
-     (doto project
-       sdk-sanity-check
-       extract-aar-dependencies
-       (execute-subtask cmd args))))
+     (if project
+       (doto project
+         sdk-sanity-check
+         extract-aar-dependencies
+         (execute-subtask cmd args))
+       (if (#{"new" "help" "init"} cmd)
+         (execute-subtask cmd args)
+         (abort "Subtask" cmd "should be run from the project folder.")))))

 (defn execute-subtask
   "Executes a subtask defined by `name` on the given project."


showing sigma node

showing sigma node

--- cljx/plongeur-cljs/src/plongeur_cljs/view.cljs
+++ cljx/plongeur-cljs/src/plongeur_cljs/view.cljs
@@ -5,14 +5,18 @@
             [foreign.sigma])
   (:require-macros [cljs.core.async.macros :refer [go]]))

-(let [bla js/sigma]
-  (println bla))
-
 (defcomponent Sigma
-  ;:on-mount (fn [node state intent-chans]
-  ;            ;(let [s (js/)])
-  ;            :bla
-  ;            )
+  :on-mount (fn [node state intent-chans]
+              (let [s (js/sigma. "container")
+                    g (.-graph s)]
+                (println node)
+                (.addNode g (clj->js {:id "n1"
+                                      :label "hello"
+                                      :x 10
+                                      :y 10
+                                      :size 1
+                                      :color "#FF0"}))
+                (.refresh s)))
   [state intent-chans]
   (html [:div {:id "container"} "<<< sigma placeholder >>>"]))


-newlines

-newlines

--- test/hildebrand/test/core.cljc
+++ test/hildebrand/test/core.cljc
@@ -107,9 +107,6 @@
                 (catch #? (:clj ExceptionInfo :cljs js/Error) e
                        (-> e ex-data :type))))))))

-
-
-
 ;; long story
 #? (:clj
     (defmacro update-test [attrs-in updates attrs-out & [ctx]]


More index cleanup.

More index cleanup.

--- src/merkle_db/index.clj
+++ src/merkle_db/index.clj
@@ -59,44 +59,30 @@

 ;; ## Construction

-(defn- store-index!
-  "Recursively store index nodes from the given sequence of children. Loads
-  each child to calculate the aggregate first-key, last-key, and count
-  attributes. Returns persisted index node data."
-  [store height children]
-  (loop [record-count 0
-         new-children []
-         child-keys []
-         last-last-key nil
-         children children]
-    (if (seq children)
-      ; Load and update aggregate stats from next child.
-      (let [child (first children)
-            link-name (format "%03d" (count new-children))
-            data (if (mdag/link? child)
-                   (graph/get-link! store child)
-                   child)
-            target (cond
-                     (mdag/link? child) child
-                     (= 1 height) (meta child)
-                     :else (meta (store-index! store (dec height) (::children data))))
-            link (mdag/link link-name target)]
-        (recur (int (+ record-count (::record/count data)))
-               (conj new-children link)
-               (conj child-keys (::record/first-key data))
-               (::record/last-key data)
-               (next children)))
-      ; No more children, serialize node.
-      (->>
-        {:data/type data-type
-         ::height height
-         ::keys (vec (rest child-keys))
-         ::children new-children
-         ::record/count record-count
-         ::record/first-key (first child-keys)
-         ::record/last-key last-last-key}
-        (mdag/store-node! store nil)
-        (::node/data)))))
+(defn- numbered-child-links
+  "Write a vector of childen into numbered links."
+  [children]
+  (let [width (count (pr-str (dec (count children))))
+        fmt (str "%0" width "d")]
+    (into []
+          (map-indexed #(mdag/link (format fmt %1) %2))
+          children)))
+
+
+(defn- index-children
+  "Aggregates index node values from a sequence of child data. Returns the node
+  data map for the constructed index."
+  [height children]
+  (let [ckeys (into [] (map ::record/first-key) (rest children))
+        links (numbered-child-links children)
+        record-count (reduce + 0 (map ::record/count children))]
+    {:data/type data-type
+     ::height height
+     ::keys ckeys
+     ::children links
+     ::record/count record-count
+     ::record/first-key (::record/first-key (first children))
+     ::record/last-key (::record/last-key (last children))}))

 (defn from-partitions
@@ -110,7 +96,12 @@
       (let [index-groups (part/partition-limited
                            (::branching-factor params default-branching-factor)
                            layer)]
-        (recur (mapv (partial store-index! store height) index-groups)
+        (recur (mapv (fn store-index
+                       [children]
+                       (->> (index-children height children)
+                            (mdag/store-node! store nil)
+                            (::node/data)))
+                     index-groups)
                (inc height))))))

@@ -233,65 +224,80 @@

 ;; ## Update Functions

-(defn- numbered-child-links
-  "Write a vector of childen into numbered links."
-  [children]
-  (into []
-        (map-indexed #(mdag/link (format "%03d" %1) %2))
-        children))
-
-
-(defn- index-children
-  "Aggregates index node values from a sequence of child data."
-  [children]
-  (let [ckeys (into [] (map ::record/first-key) (rest children))
-        links (numbered-child-links children)
-        record-count (reduce + 0 (map ::record/count children))]
-    {::keys ckeys
-     ::children links
-     ::record/count record-count
-     ::record/first-key (::record/first-key (first children))
-     ::record/last-key (::record/last-key (last children))}))
-
+(declare update-index-node!)

 (defn- update-index-children!
   "Apply changes to a sequence of intermediate index nodes and redistribute the
   results to create a new sequence of valid indexes. Each input tuple should
-  have the form `[index changes]`, and `carry` may be a forward-carried index
-  subtree or partition that is **not** a direct descendant of the parent node.
-
-  Returns a sequence of updated and valid (but unpersisted) index nodes, or a
-  direct map of node data to carry forward."
-  [store params carry inputs]
-  ,,,)
-
-
-(defn- update-index-node
-  [store params carry [index changes]]
-  (if (seq changes)
-    (let [child-changes (map (juxt #(graph/get-link! store index (first %)) second)
-                             (assign-records index changes))
-          children (if (= 1 (::height index))
-                     ; Update children as partitions.
-                     (part/update-partitions! store params carry child-changes)
-                     ; Update child index nodes.
-                     (if (and (= data-type (:data/type carry))
-                              (= (dec (::height index)) (::height carry)))
-                       ; Adopt the carried index subtree by prepending it to the results.
-                       (update-index-children! store params nil (cons [carry nil] child-changes))
-                       ; No carry, or carry is not a direct child.
-                       (update-index-children! store params carry child-changes)))]
-      (if (sequential? children)
-        (if (= 1 (count children))
-          ; Orphaned child, return directly for carrying.
-          (first children)
-          ; Construct index node from partitions.
-          ; FIXME: needs to break into multiple nodes on overflow
-          [(merge index (index-children children))])
-        ; Carried node, return for further carrying.
-        children))
-    ; No changes, return unchanged node.
-    [index]))
+  have the form `[index changes]`, and `carry` may be a forward-carried result
+  vector.
+
+  Returns a tuple containing the resulting height and a sequence of updated and
+  valid (but unpersisted) index nodes at that height."
+  [store params height carry inputs]
+  (loop [outputs []
+         carry carry
+         inputs inputs]
+    (if (seq inputs)
+      ; Process next input node
+      (let [[child changes] (first inputs)
+            [rheight elements :as result]
+              (update-index-node! store params carry child changes)]
+        (cond
+          ; Result is empty.
+          (nil? result)
+            (recur outputs nil (next inputs))
+          ; Result elements are output-level nodes.
+          (= rheight height)
+            (recur (into outputs elements) nil (next inputs))
+          ; Result elements are a carry.
+          :else
+            (recur outputs result (next inputs))))
+
+      ; No more input nodes.
+      (if (seq outputs)
+        (let [outputs (if carry
+                        (if (zero? height)
+                          (part/carry-back store params outputs carry)
+                          ('carry-back store params outputs carry))
+                        outputs)]
+          (if (<= ('min-limit params) (count outputs))
+            ; Build one or more valid index nodes from the outputs.
+            [height (mapv index-children ('split-limited ('max-limit params) outputs))]
+            ; Not enough outputs to make a valid node - return for carrying.
+            [(dec height) outputs]))
+        ; No outputs, so return nil or direct carry.
+        carry))))
+
+
+(defn- update-index-node!
+  [store params carry index changes]
+  (if (and (nil? carry) (empty? changes))
+    ; No carry or changes to apply, pass-through node.
+    [(::height index) [index]]
+
+    ; Divide up changes and apply to children.
+    (let [child-inputs (map (fn [[child child-changes]]
+                              [(if (mdag/link? child)
+                                 (graph/get-link! store index child)
+                                 child)
+                               child-changes])
+                            (assign-records index changes))
+          child-height (dec (::height index))]
+      (cond
+        ; Update children as partitions.
+        (zero? child-height)
+          (part/update-partitions! store params carry child-inputs)
+        ; Adopt carried subnodes.
+        (and carry (= (first carry) child-height))
+          (update-index-children!
+            store params child-height
+            nil (concat (map vector (second carry)) child-inputs))
+        ; Carry forward into child updates.
+        :else
+          (update-index-children!
+            store params child-height
+            carry child-inputs)))))

 (defn update-tree
@@ -314,13 +320,14 @@

     ; Root is a partition node.
     (= part/data-type (:data/type root))
-      (some->>
-        (part/update-root! store params root changes)
-        (from-partitions store params))
+      (let [result (part/update-partitions! store params [[root changes]])]
+        (if (neg? (first result))
+          (part/from-records store params (second result))
+          (from-partitions store params (second result))))

     ; Root is an index node.
     (= data-type (:data/type root))
-      (letfn [(store!  ; TODO: very similar to `store-index!`
+      (letfn [(store! ; TODO: delay storage like this?
                 [node]
                 (if (mdag/link? node)
                   node
@@ -330,7 +337,8 @@
                        (assoc node ::children)
                        (mdag/store-node! store nil)
                        (::node/data))))]
-        (store! (update-index-node store params nil [root changes])))
+        ; TODO: handle vector return type
+        (store! (update-index-node! store params nil root changes)))

     :else
       (throw (ex-info (str "Unsupported index-tree node type: "


we no longer need to declare 'build-response' in qs.clj

--- src/metabase/api/qs.clj
+++ src/metabase/api/qs.clj
@@ -10,7 +10,7 @@
             [metabase.util :refer [contains-many? now-iso8601]]))

-(declare execute-query build-response)
+(declare execute-query)

 (defendpoint POST "/" [:as {{:keys [timezone database sql] :as body} :body}]


fix 404 status when serving a route that is handled by Angular

--- src/metabase/routes.clj
+++ src/metabase/routes.clj
@@ -4,7 +4,8 @@
             [ring.util.response :as resp]
             [metabase.api.routes :as api]))

-(letfn [(serve-index [_] (resp/file-response "frontend_client/index.html"))]
+(letfn [(serve-index [_] (-> (resp/file-response "frontend_client/index.html")
+                             (assoc :status 200)))]
   (defroutes routes
     (GET "/" [] serve-index)                            ; ^/$    -> index.html
     (context "/api" [] api/routes)                      ; ^/api/ -> API routes


Fix failing test

Fix failing test

--- test/buildviz/handler_test.clj
+++ test/buildviz/handler_test.clj
@@ -140,12 +140,12 @@
              (:status (get-request app "/builds/jobMissingABuild/2/testresults")))))

     (let [app (the-app)]
-      (some-test-results app "job" "1" "<?xml version=\"1.0\" encoding=\"UTF-8\"?><testsuite name=\"suite\"><testcase name=\"case\"></testcase></testsuite>")
+      (some-test-results app "job" "1" "<?xml version=\"1.0\" encoding=\"UTF-8\"?><testsuite name=\"suite\"><testcase name=\"case\" classname=\"the class\"></testcase></testsuite>")
       (is (= [{"name" "suite"
                "children" [{"name" "case"
+                            "classname" "the class"
                             "status" "pass"}]}]
-             (json-body (json-get-request app "/builds/job/1/testresults")))))
-    ))
+             (json-body (json-get-request app "/builds/job/1/testresults")))))))

 (deftest JobsSummary


get entity name in all cases (#802)

get entity name in all cases (#802)

--- src/cljs/main/broadfcui/page/workspace/data/tab.cljs
+++ src/cljs/main/broadfcui/page/workspace/data/tab.cljs
@@ -156,7 +156,7 @@
                  :value (str "Download '" selected-entity-type "' metadata")}]]))
    :-render-entity
    (fn [{:keys [props state this]} e]
-     (let [entity-name (:name e)
+     (let [entity-name (or (:name e) (:entityName e))
            entity-type (:entityType e)
            {:keys [workspace-id]} props
            update-parent-state (partial this :update-state)]


call other constructor to avoid arity clash

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

--- acqEngine/src/org/micromanager/acq_engine.clj
+++ acqEngine/src/org/micromanager/acq_engine.clj
@@ -664,7 +664,7 @@
 		summary-metadata (make-summary-metadata summary)
 		cache (doto (MMImageCache. (TaggedImageStorageRam. summary-metadata))
 						(.setSummaryMetadata summary-metadata))]
-		(doto (VirtualAcquisitionDisplay. cache nil)
+		(doto (VirtualAcquisitionDisplay. cache nil "Untitled")
                            (.promptToSave false)
                            (initialize-display-ranges))))


Update schema-test for both cursor types

--- test/om_tools/schema_test.cljs
+++ test/om_tools/schema_test.cljs
@@ -13,25 +13,32 @@
 (sm/defschema Item
   {:id s/Int :name s/Str})

+(sm/defschema ItemScores
+  {s/Int s/Num})
+
 (sm/defschema App
-  {:items [Item]})
+  {:items [Item]
+   :item-scores ItemScores})

 (sm/defschema ItemList
-  {:items (schema/cursor [Item])
+  {:items (schema/cursor [Item])      ;; om.core/IndexedCursor
+   :scores (schema/cursor ItemScores) ;; om.core/MapCursor
    :order s/Keyword})

-(defcomponent item-list [[:data items order] :- ItemList]
+(defcomponent item-list [[:data items scores order] :- ItemList]
   (render [_]
     (let [comp-fn (if (= order :asc) compare (comp - compare))]
       (dom/ul
-       (for [u (sort-by :name comp-fn items)]
-         (dom/li (:name u)))))))
+       (for [item (sort-by :name comp-fn items)]
+         (dom/li
+          (str (:name item) "-" (get scores (:id item)))))))))

-(defcomponent app [[:data items] :- App]
+(defcomponent app [[:data items item-scores] :- (schema/cursor App)]
   (render [_]
     (dom/div
      (om/build item-list
                {:items items
+                :scores item-scores
                 :order :asc}))))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -55,7 +62,8 @@
    app
    {:items [{:id 1 :name "Common Lisp"}
             {:id 2 :name "Clojure"}
-            {:id 3 :name "ClojureScript"}]}
+            {:id 3 :name "ClojureScript"}]
+    :item-scores {1 1.0, 2 1.0, 3 1.0}}
    {:target *container*})
   (is (not (clojure.string/blank? (.-innerHTML *container*)))))


Add tests for protocol-related stuff.

Add tests for protocol-related stuff.

Can't come up with a test that actually fails, but something in the
jiraph STM layer does fail.

--- test/useful/datatypes_test.clj
+++ test/useful/datatypes_test.clj
@@ -3,6 +3,20 @@

 (defrecord Test [a b c])
 (record-accessors Test)
+
+
+(defprotocol Inline
+  (foo [this]))
+(defprotocol Dynamic
+  (bar [this]))
+
+(defrecord Implementor [x]
+  Inline
+  (foo [this] "x"))
+
+(extend-type Implementor
+  Dynamic
+  (bar [this] "y"))

 (deftest test-record
   (let [init (Test. 1 2 3)
@@ -22,4 +36,8 @@
       (let [times-evaled (atom 0)
             r (Test. 1 2 3)]
         (assoc-record ^Test (do (swap! times-evaled inc) r) :a :x :b :y :c :z)
-        (is (= 1 @times-evaled))))))
+        (is (= 1 @times-evaled))))
+
+    (testing "Works with implemented protocols"
+      (let [r (Implementor. 1)]
+        (assoc-record r :x 5)))))


Fix auth tests.

Fix auth tests.

--- test/uxbox/tests/test_auth.clj
+++ test/uxbox/tests/test_auth.clj
@@ -70,17 +70,14 @@
         user (with-open [conn (up/get-conn)]
                (usa/create-user conn data))]
     (with-server {:handler (urt/app)}
-      (let [frame {:dest :auth/login
-                   :type :novelty
-                   :data {:username "user1"
-                          :password "user1"
-                          :scope "foobar"}}
-            response (th/send-frame (str +base-url "/api") frame)]
+      (let [data {:username "user1"
+                  :password "user1"
+                  :scope "foobar"}
+            uri (str +base-url "/api/auth/token")
+            [status data] (th/post uri data)]
         ;; (println "RESPONSE:" response)
-        (t/is (= (:type response) :response))
-        (t/is (contains? response :data))
-        (t/is (contains? (:data response) :token))))))
-
+        (t/is (= status 200))
+        (t/is (contains? data :token))))))

 (t/deftest test-http-failed-auth
   (let [data {:username "user1"
@@ -89,13 +86,12 @@
         user (with-open [conn (up/get-conn)]
                (usa/create-user conn data))]
     (with-server {:handler (urt/app)}
-      (let [frame {:dest :auth/login
-                   :type :novelty
-                   :data {:username "user1"
-                          :password "user2"
-                          :scope "foobar"}}
-            response (th/send-frame (str +base-url "/api") frame)]
-        ;; (println "RESPONSE:" response)
-        (t/is (= (:type response) :error))
-        (t/is (= (:message response) "Invalid credentials"))))))
+      (let [data {:username "user1"
+                  :password "user2"
+                  :scope "foobar"}
+            uri (str +base-url "/api/auth/token")
+            [status data] (th/post uri data)]
+        ;; (println "RESPONSE:" status data)
+        (t/is (= 400 status))
+        (t/is (= (:message data) "Invalid credentials"))))))


Testing question mark in pattern group searching because it's easy.

--- access-control-app/int_test/cmr/access_control/int_test/access_control_group_search_test.clj
+++ access-control-app/int_test/cmr/access_control/int_test/access_control_group_search_test.clj
@@ -107,7 +107,7 @@
         "Pattern - no match"
         [] {:name "*oup" "options[name][pattern]" true}
         "Pattern - matches"
-        all-groups {:name "Group*" "options[name][pattern]" true}
+        all-groups {:name "Gr?up*" "options[name][pattern]" true}

         "Multiple matches"
         [cmr-group1 prov1-group1 prov2-group1


Fix frequency in subject. Change from for digest.

--- src/oc/email/mailer.clj
+++ src/oc/email/mailer.clj
@@ -18,6 +18,9 @@
 (def default-reply-to (str "hello@" c/email-from-domain))
 (def default-from "Carrot")
 (def default-source (str default-from " <" default-reply-to ">"))
+
+(def digest-reply-to (str "digest@" c/email-from-domain))
+(def digest-source (str default-from " <" digest-reply-to ">"))

 (defn- email
   "Send an email."
@@ -125,13 +128,13 @@
         inline-file (str uuid-fragment ".inline.html")
         msg (keywordize-keys message)
         org-name (:org-name msg)
-        frequency (if (= (:digest-frequency msg) "daily") "Daily" "Weekly")]
+        frequency (if (= (keyword (:digest-frequency msg)) :daily) "Daily" "Weekly")]
     (try
       (spit html-file (content/digest-html msg)) ; create the email in a tmp file
       (inline-css html-file inline-file) ; inline the CSS
       ;; Email it to the recipient
       (email {:to (:email msg)
-              :source default-source
+              :source digest-source
               :from default-from
               :reply-to default-reply-to
               :subject (str org-name " " frequency " Digest")}


[#12011] Invisible messages in public and group chats if they were received while user was on another screen

Signed-off-by: Andrea Maria Piana <39e16ece3c2d27e1889178b15ddb376e524032f8@gmail.com>

--- src/status_im/chat/models.cljs
+++ src/status_im/chat/models.cljs
@@ -273,7 +273,8 @@
   {:events [:chat.ui/navigate-to-chat]}
   [{db :db :as cofx} chat-id]
   (fx/merge cofx
-            {:db (assoc db :current-chat-id chat-id)}
+            (close-chat)
+            #(assoc-in % [:db :current-chat-id] chat-id)
             (preload-chat-data chat-id)
             (navigation/navigate-to-cofx :chat-stack {:screen :chat})))


added test for mapcat

added test for mapcat

--- pigpen-cascading/src/test/clojure/pigpen/cascading_test.clj
+++ pigpen-cascading/src/test/clojure/pigpen/cascading_test.clj
@@ -107,4 +107,13 @@
     (is (= '(2 4 6) (read-output output1)))
     (is (= '(3 6 9) (read-output output2)))))

+(deftest test-mapcat
+  (write-input input1 [1 2 3])
+  (let [data (pigpen/load-clj input1)
+        cmd (->> data
+                 (pigpen/mapcat (fn [x] [x (* x 2)]))
+                 (pigpen/store-clj output1))]
+    (.complete (pigpen/generate-flow cmd))
+    (is (= '(1 2 2 4 3 6) (read-output output1)))))
+
 (run-tests 'pigpen.cascading-test)


Fix docker hard crash on debian

Fix docker hard crash on debian

--- src/replme/web/repl.clj
+++ src/replme/web/repl.clj
@@ -46,7 +46,7 @@

 (defn- stop-docker
   [client id]
-  (container/stop client id))
+  (container/remove client id :force true))

 (defn- out-msg
   [destination msg]
@@ -85,7 +85,8 @@
     (log/info "Closing Repl Connnection")
     (stop-docker client id)
     (http/close http-client)
-    (doseq [c chans] (close! c))))
+    (doseq [c chans] (close! c))
+    (log/info "Connection Closed!")))

 (defn- handle-out
   [channel out-chan]


allow # as a way to supply sharps. I don't know why this wasn't an option before, maybe I was assuming you couldn't use #'s on the bash CLI, but you totally can.

--- src/riffmuse/parser.clj
+++ src/riffmuse/parser.clj
@@ -11,10 +11,10 @@
          scale      = root | no-root

          root       = pitch <ows> r-scale?
-         <r-scale>  = (major | minor)
+         <r-scale>  = (major | minor)
                     | pentatonic
                     | (major | minor) <ows> pentatonic
-                    | pentatonic <ows> (major | minor)
+                    | pentatonic <ows> (major | minor)
                     | blues

          major      = #'(?i)maj(or)?'
@@ -23,7 +23,7 @@
          blues      = #'(?i)blues'
          pitch      = letter <ows> (sharp | flat | <natural>)?
          letter     = #'[A-Ga-g]'
-         sharp      = #'(?i)s(harp)?'
+         sharp      = #'(?i)s(harp)?|#'
          flat       = #'(?i)f(lat)?' | #'[Bb]'
          <natural>  = #'(?i)n(at(ural)?)?'

@@ -33,7 +33,7 @@

          <ows>     = #'[\\s-_]*'
          "))
-       (insta/transform
+       (insta/transform
          {:flat (constantly "-flat")
           :sharp (constantly "-sharp")
           :major (constantly :major)
@@ -49,12 +49,12 @@
           :pitch (fn ([letter]
                        {:pitch (keyword letter)})
                      ([letter accidental]
-                       {:pitch (keyword (str letter accidental))}))
+                       {:pitch (keyword (str letter accidental))}))
           :scale (fn [[type & attrs]]
                    (conj {:type type}
                          (if-let [pitch (:pitch (first attrs))]
                            (let [attrs (rest attrs)]
-                             {:pitch pitch
+                             {:pitch pitch
                               :scale (case (count attrs)
                                        0 :major
                                        1 (if (= (first attrs) :pentatonic)


remove unneeded style attribute from button

--- src/braid/client/ui/views/thread.cljs
+++ src/braid/client/ui/views/thread.cljs
@@ -229,9 +229,8 @@
                                   {:thread-id (thread :id)
                                    :group-id (thread :group-id)}))}]
               [:button {:on-click (fn [e]
-                                    (reset! permalink-open? false))
-                        :style {:cursor "pointer"}}
-               "Done"] ])
+                                    (reset! permalink-open? false))}
+               "Done"]])
            (when (not new?)
              [:div.controls
               (if @open?


Add point-transform and multiply functions.

--- src/uxbox/util/geom/point.cljs
+++ src/uxbox/util/geom/point.cljs
@@ -76,10 +76,19 @@
     (Point. (- (:x p) (:x other))
             (- (:y p) (:y other)))))

+
+(defn multiply
+  "Returns the subtraction of the supplied value to both
+  coordinates of the point as a new point."
+  [p other]
+  {:pre [(point? p)]}
+  (let [other (-point other)]
+    (Point. (* (:x p) (:x other))
+            (* (:y p) (:y other)))))
+
 (defn distance
   "Calculate the distance between two points."
   [p other]
-  {:pre [(point? p)]}
   (let [other (-point other)
         dx (- (:x p) (:x other))
         dy (- (:y p) (:y other))]
@@ -135,3 +144,13 @@
   (if (>= x 0)
     (if (>= y 0) 1 4)
     (if (>= y 0) 2 3)))
+
+(defn transform-point
+  [pt mx]
+  (let [other (-point other)]
+    (Point. (+ (* (:x pt) (:a mx))
+               (* (:y pt) (:c mx))
+               (:tx mx))
+            (+ (* (:x pt) (:b mx))
+               (* (:y pt) (:d mx))
+               (:ty mx)))))


Hot fix: auth-related

Hot fix: auth-related

--- backend/src/akvo/lumen/lib/auth.clj
+++ backend/src/akvo/lumen/lib/auth.clj
@@ -61,7 +61,7 @@
                                                              true))))
                                                       (mapv :id))]
                                {:auth-datasets auth-datasets})
-                             {:auth-datasets (mapv dss :id)})]
+                             {:auth-datasets (mapv :id dss)})]
         (handler (assoc request
                         :db-query-service
                         (new-dbqs (p/connection tenant-manager tenant)


Remove unused dynamic var

Remove unused dynamic var

--- src/clj/http/async/client/request.clj
+++ src/clj/http/async/client/request.clj
@@ -36,8 +36,6 @@
                     ByteArrayOutputStream)))

 (def ^:dynamic *user-agent* "http.async.client/0.5.2")
-
-(def ^:dynamic *CLIENT* nil)

 (def convert-method
   ^{:doc   "Converts clj method (:get, :put, . ..) to Async Client specific."}


Changed provider bulk indexing to index granules in a provider without using a collection id.

--- src/cmr/bootstrap/data/bulk_index.clj
+++ src/cmr/bootstrap/data/bulk_index.clj
@@ -41,10 +41,13 @@
   "Index the granule data for every collection for a given provider."
   [system provider-id]
   (info "Indexing granule data for provider" provider-id)
-  (doseq [collection-id (get-provider-collection-list system provider-id)]
-    (index-granules-for-collection system provider-id collection-id))
+  (let [db (get-in system [:metadata-db :db])
+        params {:concept-type :granule
+                :provider-id provider-id}
+        concept-batches (db/find-concepts-in-batches db params (:db-batch-size system))
+        num-granules (index/bulk-index {:system (:indexer system)} concept-batches)]
+        (info "Indexed" num-granules "granule(s) for provider" provider-id)))

-  (info "Indexing of granule data for provider" provider-id "completed."))

 (defn- index-provider-collections
   "Index all the collections concepts for a given provider."


Adding some tests for computing the canonical base with background knowledge

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

--- src/conexp/tests/fca/implications.clj
+++ src/conexp/tests/fca/implications.clj
@@ -173,11 +173,30 @@
   (are [ctx] (let [sb (stem-base ctx)]
                (is (minimal-implication-set? sb))
                (is (sound-implication-set? ctx sb))
-               (is (complete-implication-set? ctx sb)))
+               (is (complete-implication-set? ctx sb))
+               (is (let [premises (map premise sb)]
+                     (forall [X premises]
+                       (forall [Y premises]
+                         (=> (proper-subset? Y X)
+                             (proper-subset? (adprime ctx Y) X)))))))
     contexts/test-ctx-01,
     contexts/test-ctx-04
     contexts/test-ctx-07,
     contexts/test-ctx-08))
+
+(deftest test-stem-base-with-background-knowledge
+  ;; make sure implications with empty premise are handled correctly
+  (is (let [ctx (make-context-from-matrix 5 5
+                                          [0 0 1 0 1
+                                           0 1 1 0 0
+                                           0 0 1 0 1
+                                           0 0 1 1 1
+                                           0 0 1 0 1]),
+            bgk #{(impl ==> 2)}]
+        (= (canonical-base ctx bgk)
+           #{(impl 0 2 ==> 1 3 4)
+             (impl 2 3 ==> 4)
+             (impl 1 2 4 ==> 0 3)}))))

 (deftest test-pseudo-intents
   (with-testing-data [ctx (random-contexts 10 20)]


Fix crash on switching to Ropsten (dev mode)

--- src/status_im/subs.cljs
+++ src/status_im/subs.cljs
@@ -939,9 +939,10 @@
 (defn- get-balance-total-value [balance prices currency token->decimals]
   (reduce-kv (fn [acc symbol value]
                (if-let [price (get-in prices [symbol currency :price])]
-                 (+ acc (-> (money/internal->formatted value symbol (token->decimals symbol))
-                            (money/crypto->fiat price)
-                            .toNumber))
+                 (+ acc (or (some-> (money/internal->formatted value symbol (token->decimals symbol))
+                                    (money/crypto->fiat price)
+                                    .toNumber)
+                            0))
                  acc)) 0 balance))

 (re-frame/reg-sub
@@ -1630,4 +1631,4 @@
  :<- [:chats/active-chats]
  :<- [:search/filter]
  (fn [[chats search-filter]]
-   (apply-filter search-filter chats extract-chat-attributes)))+   (apply-filter search-filter chats extract-chat-attributes)))


Added whitelist and added docstring to in

--- src/trammel/factors.clj
+++ src/trammel/factors.clj
@@ -1,5 +1,6 @@
 (ns trammel.factors
-  "Provides some common argument checkers and factorings.")
+  "Provides some common argument checkers and factorings."
+  (:require [clojure.set :as set]))

 ;; # constraint functions and multimethods

@@ -8,7 +9,24 @@
 (def all-negative? #(and (apply all-numbers? %&) (every? (complement pos?) %&)))
 (defn anything [& _] true)

-(defn in [e & args] (some #{e} (mapcat #(if (vector? %)
-                                          (apply range %)
-                                          [%])
-                                       args)))
+(defn in
+  "Takes an item and determines if it falls in the listed args.  This can be
+   used most effectively for numbers since any numbers in a vector represent
+   a range of values determined by the same arguments as given to `range`."
+  [e & args]
+  (some #{e}
+        (mapcat #(if (vector? %)
+                   (apply range %)
+                   [%])
+                args)))
+
+(def truthy #(when % true))
+(def falsey #(not (truthy %)))
+
+(defn whitelist
+  "Takes a thing with keys (i.e. maps or sets) and checks if it contains only
+   the keys listed in the given whitelist."
+  [wl things]
+  (set/subset? (set (keys things))
+               (set wl)))
+


Add main implementation for import/export functionality.

--- src/uxbox/portation.clj
+++ src/uxbox/portation.clj
@@ -40,20 +40,24 @@
         results (sc/fetch conn sql)]
     (run! #(t/write! writer {::type ::page-history ::payload %}) results)))

+(defn- write-data
+  [path id]
+  (with-open [ostream (io/output-stream path)
+              zstream (snappy/output-stream ostream)
+              conn (db/connection)]
+    (let [writer (t/writer zstream {:type :msgpack})]
+      (sc/atomic conn
+        (write-project conn writer id)
+        (write-pages conn writer id)
+        (write-pages-history conn writer id)))))
+
 (defn export
   "Given an id, returns a path to a temporal file with the exported
   bundle of the specified project."
   [id]
   (let [path (tmpfile/create)]
-    (with-open [ostream (io/output-stream path)
-                zstream (snappy/output-stream ostream)
-                conn (db/connection)]
-      (let [writer (t/writer zstream {:type :msgpack})]
-        (sc/atomic conn
-          (write-project conn writer id)
-          (write-pages conn writer id)
-          (write-pages-history conn writer id)
-          path)))))
+    (write-data path id)
+    path))

 ;; --- Import


fix REPL interfering with hot-reload cycle

hot-reload is only supposed to reload files actually part of the
build. not files added dynamically via the REPL. the filtering
however used all namespaces present in the compiler state which
was incorrect.

fixes #905

--- src/main/shadow/cljs/devtools/server/worker/impl.clj
+++ src/main/shadow/cljs/devtools/server/worker/impl.clj
@@ -386,7 +386,11 @@
                      :namespaces-modified #{}
                      :macros-modified #{}
                      :last-build-resources none-code-resources
-                     :last-build-provides (-> build-state :sym->id keys set)
+                     :last-build-provides
+                     (->> build-sources
+                          (map #(data/get-source-by-id build-state %))
+                          (map :provides)
+                          (reduce set/union #{}))
                      :last-build-sources build-sources
                      :last-build-macros build-macros))))
       (catch Exception e


added keys to resource chips

added keys to resource chips

--- src/cljs/swarmpit/component/stack/info.cljs
+++ src/cljs/swarmpit/component/stack/info.cljs
@@ -163,6 +163,7 @@
   [name count]
   (when (< 0 count)
     (comp/chip {:style  {:marginBottom "10px"}
+                :key    name
                 :avatar (comp/avatar {} count)
                 :label  (inflect/pluralize-noun count name)})))


:bug: Fix wrong reference to config

:bug: Fix wrong reference to config

--- backend/src/uxbox/services/users.clj
+++ backend/src/uxbox/services/users.clj
@@ -187,7 +187,7 @@
 (defmethod core/novelty :register-profile
   [params]
   (s/assert ::register params)
-  (if (= (:registration-enabled config) true)
+  (if (= (:registration-enabled cfg/config) true)
     (with-open [conn (db/connection)]
       (sc/apply-atomic conn register-user params))
     (ex/raise :type :validation


benchmark m3-hash-unencoded-chars

benchmark m3-hash-unencoded-chars

--- benchmark/cljs/benchmark_runner.cljs
+++ benchmark/cljs/benchmark_runner.cljs
@@ -208,6 +208,7 @@
              [:q 16] [:r 17] [:s 18] [:t 19] [:u 20] [:v 21] [:w 22] [:x 23]
              [:y 24] [:z 25] [:a0 26] [:b0 27] [:c0 28] [:d0 29] [:e0 30] [:f0 31]]))
 (simple-benchmark [key :f0] (hash key) 1000000)
+(simple-benchmark [key "f0"] (m3-hash-unencoded-chars key) 1000000)
 (simple-benchmark [key :unsynchronized-mutable] (hash key) 1000000)
 (def hash-coll-test
   (loop [i 0 r []]


added :_initialization hint for component. It may be needed fot tricky GUIs like panel that adds new components onto itself on mouse click. Full init cycle on the first addition may result in adding duplicated component because of component-adding evolver called during init

--- src/flatgui/widgets/componentbase.clj
+++ src/flatgui/widgets/componentbase.clj
@@ -200,7 +200,8 @@
                                               (= original-target-id-path target-id-path) reason))
              target-component (assoc pre-target-component
                                 :target-id-path-index (dec (count target-id-path))
-                                :evolve-reason-provider evolve-reason-provider)
+                                :evolve-reason-provider evolve-reason-provider
+                                :_initialization initialization)
              ps-count (count properties-to-evolve)]
         (loop [ pi 0
                 tgt target-component
@@ -348,11 +349,6 @@
 (defn evolve-by-dependencies [original-container container original-target-id-path target-id-path reason properties-to-evolve debug-shift initialization issuer]
     (let [ ;[GOOD DEBUG OUTPUT] _ (if (not= [:text :selection] properties-to-evolve) (println (debug-prefix debug-shift) ">>> entered evolve-by-dependencies function " target-id-path " for properties " properties-to-evolve))
            k (fgc/get-access-key target-id-path)
-           evolved-properties-key (fgc/conjv k :evolved-properties)
-          ;already-evolved (get-in (:aux-container container) evolved-properties-key)
-           ;
-           ;@todo If current reason in not a vector (which meands depencency), take only evolvers dependent on current reason
-           ;
            remaining-to-evolve (if properties-to-evolve
                                  properties-to-evolve
                                  (if initialization


Add some minimal boilerplate for -main arg handling

--- resources/leiningen/new/lambone/common/src/backend/core.clj
+++ resources/leiningen/new/lambone/common/src/backend/core.clj
@@ -3,6 +3,7 @@
   (:require [mount.core :as mount]
             [clojure.tools.logging :as log]
             [clojure.tools.cli :as cli]
+            [clojure.string :as string]
             [robert.hooke :as hooke]
             [<<project-ns>>.system :as system]
             [<<project-ns>>.logging :as logging])
@@ -27,13 +28,37 @@
   (.addShutdownHook (Runtime/getRuntime) (Thread. #(system/stop)))
   (apply f args))

+(defn exit [status msg]
+  (.println *err* msg)
+  (System/exit status))
+
+(defn usage [options-summary]
+  (println (str "Options:\n" options-summary)))
+
+(defn error-msg [errors]
+  (str "The following errors occurred while parsing your command:\n\n"
+       (string/join "\n  " (cons "" errors))
+       "\n"))
+
 (def cli-options
   "Customize at will"
-  [#_["-p" "--port PORT" "Port number"
-      :parse-fn #(Integer/parseInt %)]])
+  [#_["-r" "--rollback" nil "Rollback database tables."
+      :id :rollback
+      :default false]
+   #_["-m" "--migrate" nil "Migrate database tables."
+      :id :migrate
+      :default false]
+   ["-h" "--help"]])

 (defn -main
   [& args]
   (hooke/add-hook #'<<project-ns>>.system/stop #'<<project-ns>>.core/main-stop)
   (hooke/add-hook #'<<project-ns>>.system/start #'<<project-ns>>.core/main-start)
-  (system/start (cli/parse-opts cli-options)))
+  (let [{:keys [options
+                arguments
+                errors
+                summary] :as args} (cli/parse-opts args cli-options)]
+    (cond
+      (:help options) (exit 0 (usage summary))
+      errors (exit 1 (error-msg errors))
+      true (system/start args))))


Add tests

Add tests

--- test/clojure/clojurewerkz/cassaforte/new_query_api_test.clj
+++ test/clojure/clojurewerkz/cassaforte/new_query_api_test.clj
@@ -364,4 +364,10 @@
          (delete :foo
                  (where {:k1 (? "key")}))))

+
+  (is (= "TRUNCATE a;"
+         (truncate :a)))
+
+  (is (= "TRUNCATE b.a;"
+         (truncate :a :b)))
   )


Moved core dependencies into cryogen-core

--- src/leiningen/new/cryogen/project.clj
+++ src/leiningen/new/cryogen/project.clj
@@ -4,21 +4,13 @@
             :license {:name "Eclipse Public License"
                       :url "http://www.eclipse.org/legal/epl-v10.html"}
             :dependencies [[org.clojure/clojure "1.6.0"]
-                           [hiccup "1.0.5"]
-                           [selmer "0.7.7"]
                            [markdown-clj "0.9.58"
                             :exclusions [com.keminglabs/cljx]]
                            [ring/ring-devel "1.3.2"]
                            [compojure "1.2.2"]
-                           [clj-text-decoration "0.0.3"]
-                           [io.aviso/pretty "0.1.13"]
                            [ring-server "0.3.1"]
-                           [clj-rss "0.1.9"]
-                           [me.raynes/fs "1.4.6"]
-                           [crouton "0.1.2"]
-                           [cheshire "5.3.1"]
                            [cryogen-core "0.1.0"]]
             :plugins [[lein-ring "0.8.13"]]
             :main cryogen.compiler
             :ring {:init cryogen.server/init
-                   :handler cryogen.server/handler})+                   :handler cryogen.server/handler})