Break no-missing validator down into 2 queries

Each is far simpler & faster. One gets expected, the other actual, then
we just run `clojure.set/difference` on them.

--- src/vip/data_processor/validation/v5/util.clj
+++ src/vip/data_processor/validation/v5/util.clj
@@ -3,7 +3,8 @@
             [vip.data-processor.db.postgres :as postgres]
             [vip.data-processor.validation.xml.spec :as spec]
             [clojure.string :as str]
-            [clojure.tools.logging :as log]))
+            [clojure.tools.logging :as log]
+            [clojure.set :as set]))

 (defn two-import-ids
   "A common params-fn for build-xml-tree-value-query-validator that
@@ -69,27 +70,55 @@
     (for [p paths]
       (let [path-to-parent-components (-> p
                                           (str/split #"\.")
-                                          (concat (butlast xml-element-path)))
+                                          (concat (butlast xml-element-path))
+                                          vec)
             path-to-parent (str/join "." path-to-parent-components)
-            simple-path-nlevel (count path-to-parent-components)
-            path-nlevel (* 2 simple-path-nlevel)
-            path2-nlevel (inc path-nlevel)]
-        (build-xml-tree-value-query-validator
-         :errors schema-type :missing (->> element-path
-                                           (map name)
-                                           (str/join "-")
-                                           (str "missing-")
-                                           keyword)
-         "SELECT xtv.path
-          FROM (SELECT DISTINCT subltree(path, 0, CAST(? AS INT)) || ? AS path
-                FROM xml_tree_values WHERE results_id = ?
-                AND subltree(simple_path, 0, CAST(? AS INT)) = text2ltree(?)) xtv
-          LEFT JOIN (SELECT path FROM xml_tree_values WHERE results_id = ?) xtv2
-          ON xtv.path = subltree(xtv2.path, 0, CAST(? AS INT))
-          WHERE xtv2.path IS NULL"
-         (constantly [path-nlevel (last xml-element-path) import-id
-                      simple-path-nlevel path-to-parent import-id
-                      path2-nlevel]))))))
+            path-to-parent-nlevel (* 2 (count path-to-parent-components))
+            path-to-children (-> path-to-parent-components
+                                 (conj (last xml-element-path))
+                                 (->> (str/join ".")))]
+        (fn [ctx]
+          (log/info "Validating" :errors schema-type :missing)
+          (let [parents (->> (korma/exec-raw
+                              (:conn postgres/xml-tree-values)
+                              ["SELECT DISTINCT subltree(path, 0, CAST(? AS INT)) AS path
+                                FROM xml_tree_values
+                                WHERE results_id = ?
+                                AND simple_path <@ text2ltree(?)"
+                               [path-to-parent-nlevel import-id
+                                path-to-parent]]
+                              :results)
+                             (map (comp #(.getValue %) :path)))
+                children (->> (korma/exec-raw
+                               (:conn postgres/xml-tree-values)
+                               ["SELECT path AS child_path,
+                                        subltree(path, 0, CAST(? AS INT)) AS parent_path
+                                 FROM xml_tree_values
+                                 WHERE results_id = ?
+                                 AND simple_path <@ text2ltree(?)"
+                                [path-to-parent-nlevel import-id
+                                 path-to-children]]
+                               :results)
+                              (map (fn [r]
+                                     {:parent (-> r :parent_path .getValue)
+                                      :child (-> r :child_path .getValue)})))
+                expected-parent-set (set parents)
+                found-parent-set (->> children (map :parent) set)]
+            (if (= expected-parent-set found-parent-set)
+              ctx
+              (let [missing (set/difference expected-parent-set
+                                            found-parent-set)]
+                (reduce (fn [ctx path]
+                          (let [missing-path (str path "."
+                                                  (last xml-element-path))]
+                            (update-in ctx [:errors schema-type missing-path
+                                            :missing]
+                                       conj (->> element-path
+                                                 (map name)
+                                                 (str/join "-")
+                                                 (str "missing-")
+                                                 keyword))))
+                        ctx missing)))))))))

 (defn validate-no-missing-elements
   "Returns a fn that takes a validation `ctx` and runs 'no-missing' validators


Escape code in debug mode properly

Escape code in debug mode properly

--- src/webapp/framework/client/coreclient.clj
+++ src/webapp/framework/client/coreclient.clj
@@ -37,35 +37,17 @@
 )

-( macroexpand '(sql "SELECT * FROM test_table where name = ?" ["shopping"] ))
-
-
-(comment defmacro defn-html [name code]
-
-    `(do
-       (reset!
-            webapp.framework.client.coreclient/gui-html
-            (assoc (deref webapp.framework.client.coreclient/gui-html) ~name
-              ~(with-out-str (write `(quote
-                                     ~code)
-                                      :dispatch clojure.pprint/code-dispatch))
-            )
-        )
-
-       (webapp.framework.client.eventbus/undefine-action
-            ~message-arg
-         )
-
-       (webapp.framework.client.eventbus/receive-message-fn
-             ~message-arg
-             (fn [ ~(symbol "message") ] ~code ))
-
-    ))
+;( macroexpand '(sql "SELECT * FROM test_table where name = ?" ["shopping"] ))

+(defn- xml-str
+ "Like clojure.core/str but escapes < > and &."
+ [x]
+  (-> x str (.replace "&" "&") (.replace "<" "<") (.replace ">" ">")))

+;(xml-str "

")

 (defmacro defn-html [fname args & code]
@@ -73,11 +55,11 @@
         (reset!
             webapp.framework.client.coreclient/gui-html
             (assoc (deref webapp.framework.client.coreclient/gui-html) ~(str `~fname)
-              ~(with-out-str (write `'(
+              ~(xml-str (with-out-str   (write `'(
                                       (defn-html
                                         ~fname
                                         [ ~@args ]
-                                        ~code))
+                                        ~code)))
                                         :dispatch clojure.pprint/code-dispatch))
             )
         )


folder renaming updated in the document manager - fixes #2232

--- src/lt/objs/sidebar/workspace.cljs
+++ src/lt/objs/sidebar/workspace.cljs
@@ -9,6 +9,7 @@
             [lt.objs.popup :as popup]
             [lt.objs.sidebar :as sidebar]
             [lt.objs.dialogs :as dialogs]
+            [lt.objs.document :as document]
             [lt.objs.menu :as menu]
             [lt.util.dom :as dom]
             [lt.util.cljs :refer [->dottedkw]]
@@ -302,6 +303,12 @@
                               (object/merge! this {:path neue :realized? false})
                               (files/move! path neue)
                               (object/raise this :refresh!)
+                              (let [docs (get-in @document/manager [:files])
+                                    old-path (string/join [path files/separator])
+                                    affected (filter (fn [x] (.startsWith x old-path)) (keys docs))]
+                                (doseq [old-fpath affected]
+                                  (let [new-fpath (string/replace-first old-fpath path neue)]
+                                    (document/move-doc old-fpath new-fpath))))
                               (if root?
                                 (object/raise workspace/current-ws :rename! path neue)
                                 (object/raise workspace/current-ws :watched.rename path neue))


bump to 200 retries for import/export tests

--- test/puppetlabs/puppetdb/cli/import_export_roundtrip_test.clj
+++ test/puppetlabs/puppetdb/cli/import_export_roundtrip_test.clj
@@ -49,9 +49,9 @@
                            "--host" (:host svc-utils/*base-url*)
                            "--port" (str (:port svc-utils/*base-url*)))

-       @(tu/block-until-results 100 (first (get-catalogs example-certname)))
-       @(tu/block-until-results 100 (first (get-reports example-certname)))
-       @(tu/block-until-results 100 (first (get-factsets example-certname)))
+       @(tu/block-until-results 200 (first (get-catalogs example-certname)))
+       @(tu/block-until-results 200 (first (get-reports example-certname)))
+       @(tu/block-until-results 200 (first (get-factsets example-certname)))

        (is (= (tuc/munge-catalog example-catalog)
               (tuc/munge-catalog (get-catalogs example-certname))))
@@ -89,7 +89,7 @@
                              "--host" (:host svc-utils/*base-url*)
                              "--port" (str (:port svc-utils/*base-url*)))

-         @(tu/block-until-results 100 (first (get-factsets example-certname)))
+         @(tu/block-until-results 200 (first (get-factsets example-certname)))

          (is (empty? (get-catalogs example-certname)))
          (is (empty? (get-reports example-certname)))


Log number of VMs collected for a user.

Log number of VMs collected for a user.

--- jar-async/src/slipstream/async/collector.clj
+++ jar-async/src/slipstream/async/collector.clj
@@ -58,12 +58,15 @@
   (let [ch (chan 1)]
     (go
       (let [[v c] (alts! [ch (timeout timeout-collect)])]
-        (when (nil? v)
+        (if (nil? v)
           (log/log-error
             "Timeout collecting vms for user "
             (get-name user)
             " on cloud "
-            (.getConnectorInstanceName connector)))))
+            (.getConnectorInstanceName connector))
+          (log/log-info "Number of VMs collected for user " (get-name user)
+            " on cloud "
+            (.getConnectorInstanceName connector) ": " v))))
     (go (>! ch (Collector/collect user connector)))))

 (defn update-metric!


lein-release plugin: preparing 0.4.14 release

--- re_view/project.clj
+++ re_view/project.clj
@@ -1,4 +1,4 @@
-(defproject re-view "0.4.14-SNAPSHOT"
+(defproject re-view "0.4.14"
   :description "ClojureScript React Library"
   :url "https://www.github.com/braintripping/re-view/tree/master/re_view"
   :license {:name "Eclipse Public License"


CMR-3185: Fixing upddate of index alias by calling functions to get alias and index name.

--- indexer-app/src/cmr/indexer/data/elasticsearch.clj
+++ indexer-app/src/cmr/indexer/data/elasticsearch.clj
@@ -108,8 +108,8 @@
     (idx-set/update context expected-index-set)
     (info "Creating colleciton index alias.")
     (esi/create-index-alias (context->conn context)
-                            idx-set/collections-index
-                            idx-set/collections-index-alias)))
+                            (idx-set/collections-index)
+                            (idx-set/collections-index-alias))))

 (defn reset-es-store
   "Delete elasticsearch indexes and re-create them via index-set app. A nuclear option just for the development team."


migration to use sets throughout

migration to use sets throughout

--- iwaswhere-web/src/clj/iwaswhere_web/migrations.clj
+++ iwaswhere-web/src/clj/iwaswhere_web/migrations.clj
@@ -1,15 +1,14 @@
 (ns iwaswhere-web.migrations
   "This namespace is used for migrating entries to new versions."
-  (:require [iwaswhere-web.store :as s]
+  (:require [iwaswhere-web.files :as f]
             [clojure.pprint :as pp]))

 (defn add-tags-mentions
   "Parses entry for hastags and mentions."
   [entry]
   (when-let [text (:md entry)]
-    (let [
-          tags (into [] (re-seq #"(?m)(?!^)#[\w-]+" text))
-          mentions (into [] (re-seq #"@\w+" text))]
+    (let [tags (set (re-seq #"(?m)(?!^)#[\w-]+" text))
+          mentions (set (re-seq #"@\w+" text))]
       (merge entry
              {:tags     tags
               :mentions mentions}))))
@@ -19,7 +18,7 @@
   data directory into the component state."
   [conversion-fn]
   (let [files (file-seq (clojure.java.io/file "./data"))]
-    (doseq [f (s/filter-by-name files #"\d{13}.edn")]
+    (doseq [f (f/filter-by-name files #"\d{13}.edn")]
       (let [parsed (clojure.edn/read-string (slurp f))
             converted (conversion-fn parsed)
             filename (str "./data/" (:timestamp converted) ".edn")]


Revert "GR - Add global-id to all answers"

This reverts commit 5563cc2175dc52bb21af6ae4a7789a2dca189302.
Test to see if this fixes the build

--- src/objective8/storage/storage.clj
+++ src/objective8/storage/storage.clj
@@ -98,7 +98,6 @@
 (defn unmap-answer-with-votes [m]
   (assoc (mappings/json-type->map (:answer m))
          :_id (:_id m)
-         :global-id (:global_id m)
          :_created_at (mappings/sql-time->iso-time-string (:_created_at m))
          :username (:username m)
          :votes {:up (or (:up_votes m) 0) :down (or (:down_votes m) 0)}


web/scrape.clj: use report-progress when skipping files

--- src/org/altlaw/jobs/web/scrape.clj
+++ src/org/altlaw/jobs/web/scrape.clj
@@ -40,6 +40,7 @@
       (map handle-scraper-result
            (handler/run-scrapers download))
       (do (log/debug "Ignoring MIME type " type)
+          (h/report-progress)
           nil))))

 (def mapper-map (partial h/standard-map my-map))


start a project list component

start a project list component

--- src/zooniverse_live/core.cljs
+++ src/zooniverse_live/core.cljs
@@ -5,13 +5,32 @@

 (enable-console-print!)

+(defn project
+  "Om component for new project"
+  [[project {:keys [color name]}] owner]
+  (reify
+    om/IRender
+    (render [_]
+      (dom/li #js {:className project :style #js {:color color}} name))))
+
+(defn project-list
+  "Om component for new project-list"
+  [data owner]
+  (reify
+    om/IRender
+    (render [_]
+      (dom/div nil
+               (dom/h1 nil "Project List"
+                       (apply dom/ul nil
+                               (om/build-all project (:projects data))))))))
+
 (defn update-state
   [app]
   (fn [msg]
     (println (.-data msg))
     (let [msg (trim-newline (.-data msg))]
-      (when-not (= msg "Heartbeat")
-        (swap! app update-in [:classifiers] conj ((js->clj (.parse js/JSON msg)) "project"))))))
+      (when-not (some #{msg} ["Heartbeat" "String Start"])
+        (swap! app update-in [:classifiers] conj (js->clj (.parse js/JSON msg)))))))

 (defn connect-websocket
   [app]
@@ -19,7 +38,8 @@
     (set! (.-onmessage socket) (update-state app))
     socket))

-(def app-state (atom {:classifiers []}))
+(def app-state (atom {:classifiers [] :projects {:galaxy_zoo {:color "orange" :name "Galaxy Zoo"}
+                                                 :planet_hunter {:color "blue" :name "Planet Hunters"}}}))

 (defn classifier-view
   [classifier owner]
@@ -38,7 +58,7 @@
                (apply dom/ul nil
                       (om/build-all classifier-view  (:classifiers app)))))))

-(om/root classifiers-view app-state
+(om/root project-list app-state
          {:target (. js/document (getElementById "app"))})

 (connect-websocket app-state)


Optimize `aliases-by-frequencies`

Optimize `aliases-by-frequencies`

--- src/refactor_nrepl/ns/libspecs.clj
+++ src/refactor_nrepl/ns/libspecs.clj
@@ -17,16 +17,19 @@
        distinct))

 (defn- aliases-by-frequencies [libspecs]
-  (->> libspecs
-       (mapcat aliases) ; => [[str clojure.string] ...]
-       (sort-by (comp str second))
-       (group-by first) ; => {str [[str clojure.string] [str clojure.string]] ...}
-       (map (comp seq frequencies second)) ; => (([[set clojure.set] 4] [set set] 1) ...)
-       (map (partial sort-by second >)) ; by decreasing frequency
-       (map (partial map first)) ; drop frequencies
-       (map (fn [aliases] (list (ffirst aliases) (map second aliases))))
-       (mapcat identity)
-       (apply hash-map)))
+  (let [grouped (->> libspecs
+                     (mapcat aliases)  ; => [[str clojure.string] ...]
+                     (sort-by (comp str second))
+                     (group-by first) ; => {str [[str clojure.string] [str clojure.string]] ...}
+                     )]
+    (into {}
+          (comp (map (comp seq frequencies second)) ; => (([[set clojure.set] 4] [set set] 1) ...)
+                (map (partial sort-by second >)) ; by decreasing frequency
+                (map (partial map first))        ; drop frequencies
+                (map (fn [aliases]
+                       [(ffirst aliases),
+                        (mapv second aliases)])))
+          grouped)))

 (defn- get-cached-libspec [^File f lang]
   (when-let [[ts v] (get-in @cache [(.getAbsolutePath f) lang])]


More test coverage

More test coverage

--- jvm-runner/test/codewars/runner/java_test.clj
+++ jvm-runner/test/codewars/runner/java_test.clj
@@ -30,6 +30,19 @@
         :solution "public class Hello {public static void main() {System.out.print(\"Hellooo!\");}}"})
       (is (= "Hellooo!" (with-java-out-str (-main)))))))

+(deftest java-setup-code
+  (testing "-main can handle a java solution and setup code"
+    (with-in-str
+      (json/generate-string
+       {:language "java"
+        :setup "import java.lang.String;
+                public class Beatles {public static String sayHello() {
+                  return \"Hello, hello!\";}}"
+        :solution "public class HelloAgain {
+                     public static void main() {
+                         System.out.print(Beatles.sayHello());}}"})
+      (is (= "Hello, hello!" (with-java-out-str (-main)))))))
+
 (deftest java-test-fixture
   (testing "-main can handle a junit test"
     (with-in-str
@@ -51,3 +64,51 @@
         (is (.contains test-out-string "<DESCRIBE::>myTestFunction(TestFixture)"))
         (is (.contains test-out-string "test out"))
         (is (.contains test-out-string "<PASSED::>Test Passed<:LF:>"))))))
+
+(deftest java-sad-path
+  (testing "-main can handle a failing junit test"
+    (with-in-str
+      (json/generate-string
+       {:language "java"
+        :solution "public class Foo {
+                     public Foo(){}
+                     public int testthing(){return 3;}
+                     public static void main(String[] args){System.out.println(\"42\");}}"
+        :fixture "import static org.junit.Assert.assertEquals;
+                  import org.junit.Test;
+                  import org.junit.runners.JUnit4;
+                  public class TestForFailure {
+                    public TestForFailure(){}
+                    @Test public void sadPath(){
+                      Foo s = new Foo();
+                      assertEquals(\"Failed Message\", 5, s.testthing());
+                      System.out.println(\"Shouldn't get here\");}}"})
+      (let [test-out-string (with-java-out-str (-main))]
+        (is (.contains test-out-string "<DESCRIBE::>sadPath(TestForFailure)<:LF:>"))
+        (is (.contains test-out-string "<FAILED::>Failed Message expected:"))
+        (is (.contains test-out-string "<5> but was:<3>"))
+        (is (not (.contains test-out-string "Shouldn't get here")))
+        (is (not (.contains test-out-string "<PASSED::>Test Passed<:LF:>")))))))
+
+(deftest java-nine-yards
+  (testing "-main can setup, solution, and test fixture code for java"
+    (with-in-str
+      (json/generate-string
+       {:language "java"
+        :setup "public class Setupp { public static int three() {return 3;}}"
+        :solution "public class Sollution {
+                   public Sollution(){}
+                   public int testthingy(){return Setupp.three();}}",
+        :fixture "import static org.junit.Assert.assertEquals;
+                  import org.junit.Test;
+                  import org.junit.runners.JUnit4;
+                  public class NineYards {
+                     public NineYards(){}
+                     @Test public void solutionAndSetupAndFixture(){
+                         Sollution s = new Sollution();
+                         assertEquals(\"wow\", 3, s.testthingy());
+                         System.out.println(\"test out\");}}"})
+      (let [test-out-string (with-java-out-str (-main))]
+        (is (.contains test-out-string "<DESCRIBE::>solutionAndSetupAndFixture(NineYards)<:LF:>"))
+        (is (.contains test-out-string "test out"))
+        (is (.contains test-out-string "<PASSED::>Test Passed<:LF:>"))))))


remove old unit tests that were accidentally included in merge from master.

--- test/metabase/driver/query_processor_test.clj
+++ test/metabase/driver/query_processor_test.clj
@@ -456,40 +456,6 @@
        rows (format-rows-by [int ->bool str] :format-nil-values)))

-(defn- ->bool [x] ; SQLite returns 0/1 for false/true;
-  (condp = x      ; Redshift returns nil/true.
-    0   false     ; convert to false/true and restore sanity.
-    1   true
-    nil false
-    x))
-
-;;; filter = true
-(datasets/expect-with-all-engines
-  [[1 true "Tempest"]
-   [2 true "Bullit"]]
-  (Q dataset places-cam-likes
-     aggregate rows of places
-     filter = liked true, order id+
-     return rows (format-rows-by [int ->bool str] :format-nil-values)))
-
-;;; filter != false
-(datasets/expect-with-all-engines
-  [[1 true "Tempest"]
-   [2 true "Bullit"]]
-  (Q dataset places-cam-likes
-     aggregate rows of places
-     filter != liked false, order id+
-     return rows (format-rows-by [int ->bool str] :format-nil-values)))
-
-;;; filter != true
-(datasets/expect-with-all-engines
-  [[3 false "The Dentist"]]
-  (Q dataset places-cam-likes
-     aggregate rows of places
-     filter != liked true, order id+
-     return rows (format-rows-by [int ->bool str] :format-nil-values)))
-
-
 ;; ### FILTER -- "BETWEEN", single subclause (neither "AND" nor "OR")
 (datasets/expect-with-all-engines
   [[21 "PizzaHacker"    58 37.7441 -122.421 2]


PCP-147 Add testing to accept-message-for-delivery

Here we add a basic unit test for accept-message-for-delivery.

To enable this we have to refactor our make-test-broker helper to make a
broker state with a real set of metrics, as we are now excercising the time!
macro which needs a real timer object.

--- test/unit/puppetlabs/pcp/broker/core_test.clj
+++ test/unit/puppetlabs/pcp/broker/core_test.clj
@@ -1,5 +1,6 @@
 (ns puppetlabs.pcp.broker.core-test
   (:require [clojure.test :refer :all]
+            [metrics.core]
             [puppetlabs.pcp.broker.core :refer :all]
             [puppetlabs.pcp.broker.capsule :as capsule]
             [puppetlabs.pcp.broker.connection :as connection]
@@ -10,19 +11,22 @@
 (s/defn ^:always-validate make-test-broker :- Broker
   "Return a minimal clean broker state"
   []
-  {:activemq-broker    "JMSOMGBBQ"
-   :accept-consumers   2
-   :delivery-consumers 2
-   :activemq-consumers (atom [])
-   :record-client      (constantly true)
-   :find-clients       (constantly true)
-   :authorization-check (constantly true)
-   :uri-map            (atom {})
-   :connections        (atom {})
-   :metrics-registry   ""
-   :metrics            {}
-   :transitions        {}
-   :broker-cn          "broker.example.com"})
+  (let [broker {:activemq-broker    "JMSOMGBBQ"
+                :accept-consumers   2
+                :delivery-consumers 2
+                :activemq-consumers (atom [])
+                :record-client      (constantly true)
+                :find-clients       (constantly true)
+                :authorization-check (constantly true)
+                :uri-map            (atom {})
+                :connections        (atom {})
+                :metrics-registry   metrics.core/default-registry
+                :metrics            {}
+                :transitions        {}
+                :broker-cn          "broker.example.com"}
+        metrics (build-and-register-metrics broker)
+        broker (assoc broker :metrics metrics)]
+    broker))

 (deftest get-broker-cn-test
   (testing "It returns the correct cn"
@@ -120,6 +124,17 @@
     (is (= true (authorized? yes-broker capsule)))
     (is (= false (authorized? no-broker capsule)))))

+(deftest accept-message-for-delivery-test
+  (let [broker (make-test-broker)
+        capsule (capsule/wrap (message/make-message))
+        queued (atom [])]
+    (with-redefs [puppetlabs.pcp.broker.activemq/queue-message (fn [queue capsule] (swap! queued conj {:queue queue
+                                                                                :capsule capsule}))
+                  puppetlabs.pcp.broker.core/authorized? (constantly true)]
+      (accept-message-for-delivery broker capsule)
+      (is (= 1 (count @queued)))
+      (is (= accept-queue (:queue (first @queued)))))))
+
 (deftest process-expired-message-test
   (with-redefs [accept-message-for-delivery (fn [broker response] response)]
     (testing "It will create and send a ttl expired message"


Added functionality for creating new templates.

--- src/cake/tasks/new.clj
+++ src/cake/tasks/new.clj
@@ -35,29 +35,33 @@
           (doseq [f (filter #(.isFile %) files)]
             (spit f (.replace (slurp f) "+project+" project))))))))

-(defn create-default-template []
-  (log "Creating template directory: ~/.cake/templates/default")
-  (ant Mkdir {:dir default-template-dir})
-  (ant Mkdir {:dir (file default-template-dir "src" "+project+")})
-  (spit (file default-template-dir "src" "+project+" "core.clj") "(ns +project+.core)")
+(defn create-template [template]
+  (log (str "Creating template directory: ~/.cake/templates/" (last (.split (str template) "/"))))
+  (ant Mkdir {:dir template})
+  (ant Mkdir {:dir (file template "src" "+project+")})
+  (spit (file template "src" "+project+" "core.clj") "(ns +project+.core)")
   (log "Created template file: src/+project+/core.clj")
-  (ant Mkdir {:dir (file default-template-dir "test")})
-  (spit (file default-template-dir "project.clj") default-template)
+  (ant Mkdir {:dir (file template "test")})
+  (spit (file template "project.clj") default-template)
   (log "Created template file: project.clj")
-  (spit (file default-template-dir ".gitignore")
+  (spit (file template ".gitignore")
         (apply str (interleave [".cake" "pom.xml" "*.jar" "*.war" "lib" "classes" "build" "+project+"] (repeat "\n"))))
   (log "Created template file: .gitignore")
-  (extract-resource "LICENSE" default-template-dir)
+  (extract-resource "LICENSE" template)
   (log "Created template LICENSE file (Eclipse Public License)"))

 (deftask new
   "Create scaffolding for a new project."
   "You can put project templates in ~/.cake/templates. Each template is a directory with a default
    template. You can specify which template to use for your project when you call this task. If
-   you don't specify which template to use, ~/.cake/templates will be used. It will be created if
+   you don't specify which template to use, ~/.cake/templates/default will be used. It will be created if
    it does not already exist.
-   Examples: cake new aproj, cake new mytemplate aproj"
+   New project based on the default template:  cake new aproj
+   New project based on a specified template:  cake new mytemplate aproj
+   New template based on the default template: cake new template mytemplate"
   {[one two] :new}
   (when-not (.exists default-template-dir)
-    (create-default-template))
-  (apply template-new (or (and two [two one]) [one "default"])))
+    (create-template default-template-dir))
+  (if (and two (= one "template"))
+    (create-template (file template-dir two))
+    (apply template-new (or (and two [two one]) [one "default"]))))


Test multi-get after sq-based mutate-entry.

--- src/cbfg/test/kvs.cljs
+++ src/cbfg/test/kvs.cljs
@@ -179,202 +179,222 @@
                                      :changes [(cbfg.kvs/mutate-entry
                                                 {:key :a :val :A})]}]
                              (aput tkvs cmd-ch m6)
-                             (and
-                              (let [res6 (atake tkvs res-ch6)]
-                                (and (:sq res6)
-                                     (e n res6
-                                        (dissoc (merge m6 {:partial :ok :key :a
-                                                           :sq (:sq res6)})
-                                                :changes)
-                                        nil)
-                                     (e n (atake tkvs res-ch6)
-                                        (dissoc (merge m6 {:status :ok})
-                                                :changes)
-                                        (atake tkvs res-ch6))
-                                     (let [res-ch7 (achan tkvs)
-                                           m7 {:opaque @n
-                                               :res-ch res-ch7
-                                               :op :multi-get
-                                               :kvs-ident (:kvs-ident open)
-                                               :keys [:a]}]
-                                       (aput tkvs cmd-ch m7)
-                                       (and
-                                        (let [res7 (atake tkvs res-ch7)]
-                                          (e n res7
-                                             (dissoc (merge m7 {:partial :ok
-                                                                :key :a
-                                                                :entry {:key :a :val :A
-                                                                        :sq (:sq res6)}})
-                                                     :keys)
-                                             nil)
-                                          (e n (atake tkvs res-ch7)
-                                             (dissoc (merge m7 {:status :ok})
-                                                     :keys)
-                                             (atake tkvs res-ch7)))))
-                                     (let [res-ch7 (achan tkvs)
-                                           m7 {:opaque @n
-                                               :res-ch res-ch7
-                                               :op :multi-get
-                                               :kvs-ident (:kvs-ident open)
-                                               :keys [:a :a :a]}]
-                                       (aput tkvs cmd-ch m7)
-                                       (and
-                                        (e n (atake tkvs res-ch7)
-                                           (dissoc (merge m7 {:partial :ok
-                                                              :key :a
-                                                              :entry {:key :a :val :A
-                                                                      :sq (:sq res6)}})
-                                                   :keys)
-                                           nil)
-                                        (e n (atake tkvs res-ch7)
-                                           (dissoc (merge m7 {:partial :ok
-                                                              :key :a
-                                                              :entry {:key :a :val :A
-                                                                      :sq (:sq res6)}})
-                                                   :keys)
-                                           nil)
-                                        (e n (atake tkvs res-ch7)
-                                           (dissoc (merge m7 {:partial :ok
-                                                              :key :a
-                                                              :entry {:key :a :val :A
-                                                                      :sq (:sq res6)}})
-                                                   :keys)
-                                           nil)
-                                        (e n (atake tkvs res-ch7)
-                                           (dissoc (merge m7 {:status :ok})
-                                                   :keys)
-                                           (atake tkvs res-ch7))))
-                                     (let [res-ch7bs (achan tkvs)
-                                           m7bs {:opaque @n
-                                                 :res-ch res-ch7bs
-                                                 :op :multi-change
-                                                 :kvs-ident (:kvs-ident open)
-                                                 :changes [(cbfg.kvs/mutate-entry
-                                                            {:key :a
-                                                             :val :will-be-rejected
-                                                             :sq :some-wrong-sq})]}]
-                                       (aput tkvs cmd-ch m7bs)
-                                       (let [res7bs (atake tkvs res-ch7bs)]
-                                         (and
-                                          (e n res7bs
-                                             (dissoc (merge m7bs
-                                                            {:partial :mismatch
-                                                             :partial-info [:wrong-sq
-                                                                            :some-wrong-sq]
-                                                             :key :a})
-                                                     :changes)
-                                             nil)
-                                          (e n (atake tkvs res-ch7bs)
-                                             (dissoc (merge m7bs {:status :ok})
-                                                     :changes)
-                                             (atake tkvs res-ch7bs)))))
-                                     (let [res-ch7c (achan tkvs)
-                                           m7c {:opaque @n
-                                                :res-ch res-ch7c
+                             (let [res6 (atake tkvs res-ch6)]
+                               (and (:sq res6)
+                                    (e n res6
+                                       (dissoc (merge m6 {:partial :ok :key :a
+                                                          :sq (:sq res6)})
+                                               :changes)
+                                       nil)
+                                    (e n (atake tkvs res-ch6)
+                                       (dissoc (merge m6 {:status :ok})
+                                               :changes)
+                                       (atake tkvs res-ch6))
+                                    (let [res-ch7 (achan tkvs)
+                                          m7 {:opaque @n
+                                              :res-ch res-ch7
+                                              :op :multi-get
+                                              :kvs-ident (:kvs-ident open)
+                                              :keys [:a]}]
+                                      (aput tkvs cmd-ch m7)
+                                      (let [res7 (atake tkvs res-ch7)]
+                                        (and
+                                         (e n res7
+                                            (dissoc (merge m7 {:partial :ok
+                                                               :key :a
+                                                               :entry {:key :a :val :A
+                                                                       :sq (:sq res6)}})
+                                                    :keys)
+                                            nil)
+                                         (e n (atake tkvs res-ch7)
+                                            (dissoc (merge m7 {:status :ok})
+                                                    :keys)
+                                            (atake tkvs res-ch7)))))
+                                    (let [res-ch7 (achan tkvs)
+                                          m7 {:opaque @n
+                                              :res-ch res-ch7
+                                              :op :multi-get
+                                              :kvs-ident (:kvs-ident open)
+                                              :keys [:a :a :a]}]
+                                      (aput tkvs cmd-ch m7)
+                                      (and
+                                       (e n (atake tkvs res-ch7)
+                                          (dissoc (merge m7 {:partial :ok
+                                                             :key :a
+                                                             :entry {:key :a :val :A
+                                                                     :sq (:sq res6)}})
+                                                  :keys)
+                                          nil)
+                                       (e n (atake tkvs res-ch7)
+                                          (dissoc (merge m7 {:partial :ok
+                                                             :key :a
+                                                             :entry {:key :a :val :A
+                                                                     :sq (:sq res6)}})
+                                                  :keys)
+                                          nil)
+                                       (e n (atake tkvs res-ch7)
+                                          (dissoc (merge m7 {:partial :ok
+                                                             :key :a
+                                                             :entry {:key :a :val :A
+                                                                     :sq (:sq res6)}})
+                                                  :keys)
+                                          nil)
+                                       (e n (atake tkvs res-ch7)
+                                          (dissoc (merge m7 {:status :ok})
+                                                  :keys)
+                                          (atake tkvs res-ch7))))
+                                    (let [res-ch7bs (achan tkvs)
+                                          m7bs {:opaque @n
+                                                :res-ch res-ch7bs
                                                 :op :multi-change
                                                 :kvs-ident (:kvs-ident open)
                                                 :changes [(cbfg.kvs/mutate-entry
                                                            {:key :a
-                                                            :val :AA
-                                                            :sq (:sq res6)})]}]
-                                       (aput tkvs cmd-ch m7c)
-                                       (let [res7c (atake tkvs res-ch7c)]
-                                         (and
-                                          (:sq res7c)
-                                          (e n res7c
-                                             (dissoc (merge m7c
-                                                            {:partial :ok
-                                                             :key :a
-                                                             :sq (:sq res7c)})
-                                                     :changes)
-                                             nil)
-                                          (e n (atake tkvs res-ch7c)
-                                             (dissoc (merge m7c {:status :ok})
-                                                     :changes)
-                                             (atake tkvs res-ch7c)))))
-                                     ))))
-                           (let [res-ch8 (achan tkvs)
-                                 m8 {:opaque @n
-                                     :res-ch res-ch8
-                                     :op :multi-get
-                                     :kvs-ident (:kvs-ident open)
-                                     :keys [:does-not-exist :not-there]}]
-                             (aput tkvs cmd-ch m8)
-                             (and
-                              (e n (atake tkvs res-ch8)
-                                 (dissoc (merge m8 {:partial :not-found
-                                                    :key :does-not-exist})
-                                         :keys)
-                                 nil)
-                              (e n (atake tkvs res-ch8)
-                                 (dissoc (merge m8 {:partial :not-found
-                                                    :key :not-there})
-                                         :keys)
-                                 nil)
-                              (e n (atake tkvs res-ch8)
-                                 (dissoc (merge m8 {:status :ok})
-                                         :keys)
-                                 (atake tkvs res-ch8))))
-                           (let [res-ch9 (achan tkvs)
-                                 m9 {:opaque @n
-                                     :res-ch res-ch9
-                                     :op :multi-change
-                                     :kvs-ident (:kvs-ident open)
-                                     :changes [(cbfg.kvs/mutate-entry {:key :a :deleted true
-                                                                       :sq :not-a-sq-match})]}]
-                             (aput tkvs cmd-ch m9)
-                             (let [res9 (atake tkvs res-ch9)]
-                               (and (e n res9
-                                       (dissoc (merge m9 {:partial :mismatch
-                                                          :partial-info [:wrong-sq
-                                                                         :not-a-sq-match]
-                                                          :key :a})
-                                               :changes)
+                                                            :val :will-be-rejected
+                                                            :sq :some-wrong-sq})]}]
+                                      (aput tkvs cmd-ch m7bs)
+                                      (let [res7bs (atake tkvs res-ch7bs)]
+                                        (and
+                                         (e n res7bs
+                                            (dissoc (merge m7bs
+                                                           {:partial :mismatch
+                                                            :partial-info [:wrong-sq
+                                                                           :some-wrong-sq]
+                                                            :key :a})
+                                                    :changes)
+                                            nil)
+                                         (e n (atake tkvs res-ch7bs)
+                                            (dissoc (merge m7bs {:status :ok})
+                                                    :changes)
+                                            (atake tkvs res-ch7bs)))))
+                                    (let [res-ch7c (achan tkvs)
+                                          m7c {:opaque @n
+                                               :res-ch res-ch7c
+                                               :op :multi-change
+                                               :kvs-ident (:kvs-ident open)
+                                               :changes [(cbfg.kvs/mutate-entry
+                                                          {:key :a
+                                                           :val :AA
+                                                           :sq (:sq res6)})]}]
+                                      (aput tkvs cmd-ch m7c)
+                                      (let [res7c (atake tkvs res-ch7c)]
+                                        (and
+                                         (:sq res7c)
+                                         (e n res7c
+                                            (dissoc (merge m7c
+                                                           {:partial :ok
+                                                            :key :a
+                                                            :sq (:sq res7c)})
+                                                    :changes)
+                                            nil)
+                                         (e n (atake tkvs res-ch7c)
+                                            (dissoc (merge m7c {:status :ok})
+                                                    :changes)
+                                            (atake tkvs res-ch7c))
+                                         (let [res-ch7g (achan tkvs)
+                                               m7g {:opaque @n
+                                                    :res-ch res-ch7g
+                                                    :op :multi-get
+                                                    :kvs-ident (:kvs-ident open)
+                                                    :keys [:a]}]
+                                           (aput tkvs cmd-ch m7g)
+                                           (let [res7g (atake tkvs res-ch7g)]
+                                             (and
+                                              (e n res7g
+                                                 (dissoc (merge m7g {:partial :ok
+                                                                     :key :a
+                                                                     :entry {:key :a :val :AA
+                                                                             :sq (:sq res7c)}})
+                                                         :keys)
+                                                 nil)
+                                              (e n (atake tkvs res-ch7g)
+                                                 (dissoc (merge m7g {:status :ok})
+                                                         :keys)
+                                                 (atake tkvs res-ch7g)))))
+                                         )))
+                                    )))
+                      (let [res-ch8 (achan tkvs)
+                            m8 {:opaque @n
+                                :res-ch res-ch8
+                                :op :multi-get
+                                :kvs-ident (:kvs-ident open)
+                                :keys [:does-not-exist :not-there]}]
+                        (aput tkvs cmd-ch m8)
+                        (and
+                         (e n (atake tkvs res-ch8)
+                            (dissoc (merge m8 {:partial :not-found
+                                               :key :does-not-exist})
+                                    :keys)
+                            nil)
+                         (e n (atake tkvs res-ch8)
+                            (dissoc (merge m8 {:partial :not-found
+                                               :key :not-there})
+                                    :keys)
+                            nil)
+                         (e n (atake tkvs res-ch8)
+                            (dissoc (merge m8 {:status :ok})
+                                    :keys)
+                            (atake tkvs res-ch8))))
+                      (let [res-ch9 (achan tkvs)
+                            m9 {:opaque @n
+                                :res-ch res-ch9
+                                :op :multi-change
+                                :kvs-ident (:kvs-ident open)
+                                :changes [(cbfg.kvs/mutate-entry {:key :a :deleted true
+                                                                  :sq :not-a-sq-match})]}]
+                        (aput tkvs cmd-ch m9)
+                        (let [res9 (atake tkvs res-ch9)]
+                          (and (e n res9
+                                  (dissoc (merge m9 {:partial :mismatch
+                                                     :partial-info [:wrong-sq
+                                                                    :not-a-sq-match]
+                                                     :key :a})
+                                          :changes)
+                                  nil)
+                               (e n (atake tkvs res-ch9)
+                                  (dissoc (merge m9 {:status :ok})
+                                          :changes)
+                                  (atake tkvs res-ch9)))))
+                      (let [res-ch9 (achan tkvs)
+                            m9 {:opaque @n
+                                :res-ch res-ch9
+                                :op :multi-change
+                                :kvs-ident (:kvs-ident open)
+                                :changes [(cbfg.kvs/mutate-entry {:key :a
+                                                                  :deleted true})]}]
+                        (aput tkvs cmd-ch m9)
+                        (let [res9 (atake tkvs res-ch9)]
+                          (and (:sq res9)
+                               (e n res9
+                                  (dissoc (merge m9 {:partial :ok :key :a
+                                                     :sq (:sq res9)})
+                                          :changes)
+                                  nil)
+                               (e n (atake tkvs res-ch9)
+                                  (dissoc (merge m9 {:status :ok})
+                                          :changes)
+                                  (atake tkvs res-ch9))
+                               (let [res-ch9a (achan tkvs)
+                                     m9a {:opaque @n
+                                          :res-ch res-ch9a
+                                          :op :multi-get
+                                          :kvs-ident (:kvs-ident open)
+                                          :keys [:a]}]
+                                 (aput tkvs cmd-ch m9a)
+                                 (let [res9a (atake tkvs res-ch9a)]
+                                   (and
+                                    (e n res9a
+                                       (dissoc (merge m9a {:partial :not-found
+                                                           :key :a})
+                                               :keys)
                                        nil)
-                                    (e n (atake tkvs res-ch9)
-                                       (dissoc (merge m9 {:status :ok})
-                                               :changes)
-                                       (atake tkvs res-ch9)))))
-                           (let [res-ch9 (achan tkvs)
-                                 m9 {:opaque @n
-                                     :res-ch res-ch9
-                                     :op :multi-change
-                                     :kvs-ident (:kvs-ident open)
-                                     :changes [(cbfg.kvs/mutate-entry {:key :a
-                                                                       :deleted true})]}]
-                             (aput tkvs cmd-ch m9)
-                             (let [res9 (atake tkvs res-ch9)]
-                               (and (:sq res9)
-                                    (e n res9
-                                       (dissoc (merge m9 {:partial :ok :key :a
-                                                          :sq (:sq res9)})
-                                               :changes)
-                                       nil)
-                                    (e n (atake tkvs res-ch9)
-                                       (dissoc (merge m9 {:status :ok})
-                                               :changes)
-                                       (atake tkvs res-ch9))
-                                    (let [res-ch9a (achan tkvs)
-                                          m9a {:opaque @n
-                                               :res-ch res-ch9a
-                                               :op :multi-get
-                                               :kvs-ident (:kvs-ident open)
-                                               :keys [:a]}]
-                                      (aput tkvs cmd-ch m9a)
-                                      (let [res9a (atake tkvs res-ch9a)]
-                                        (and
-                                         (e n res9a
-                                            (dissoc (merge m9a {:partial :not-found
-                                                                :key :a})
-                                                    :keys)
-                                            nil)
-                                         (e n (atake tkvs res-ch9a)
-                                            (dissoc (merge m9a {:status :ok})
-                                                    :keys)
-                                            (atake tkvs res-ch9a))))))))
-                           ))))
-           "pass"
-           (str "FAIL: on test-lane #" @n)))))
+                                    (e n (atake tkvs res-ch9a)
+                                       (dissoc (merge m9a {:status :ok})
+                                               :keys)
+                                       (atake tkvs res-ch9a))))))))
+                      ))))
+         "pass"
+         (str "FAIL: on test-lane #" @n)))))

 (defn test [actx opaque]
   (act test actx


Tracking servers in assoc.

Tracking servers in assoc.

--- src/cbfg/world/t1.cljs
+++ src/cbfg/world/t1.cljs
@@ -65,9 +65,9 @@

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

-(def curr-world (atom nil)) ; { :world => world-actx
-                            ;   :net-listen-ch => ch
-                            ;   :net-connect-ch => ch }
+(def curr-world (atom {})) ; { :world => world-actx
+                           ;   :net-listen-ch => ch
+                           ;   :net-connect-ch => ch }

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

@@ -189,7 +189,9 @@
                   :gen-id gen-id})]
         (reset! curr-world {:world world
                             :net-listen-ch (achan-buf world 10)
-                            :net-connect-ch (achan-buf world 10)})
+                            :net-connect-ch (achan-buf world 10)
+                            :servers {}
+                            :clients {}})
         (process-events vis event-delay event-ch step-ch render-ch)
         (make-net world
                   (:net-listen-ch @curr-world)
@@ -198,6 +200,7 @@
               prog-js (str "with (cbfg.world.t1) {" prog "}")
               prog-res (try (js/eval prog-js) (catch js/Object ex ex))]
           (println :prog-res prog-res)
+          (println :curr-world @curr-world)
           (<! prog-ch)
           (close! event-ch)
           (recur (inc num-worlds)))))))
@@ -215,11 +218,11 @@
         done (atom false)]
     (act server-init world
          (doseq [port ports]
-           (println :kv-server name port)
            (when-let [listen-result-ch (achan server-init)]
              (aput server-init (:net-listen-ch @curr-world) [name port listen-result-ch])
              (when-let [[accept-ch close-accept-ch] (atake server-init listen-result-ch)]
-               (cbfg.world.net/server-accept-loop world accept-ch close-accept-ch))))
+               (cbfg.world.net/server-accept-loop world accept-ch close-accept-ch)
+               (swap! curr-world #(update-in % [:servers name] conj port)))))
          (reset! done true))
     (wait-done done)))


Started make-t2-cmd-handlers.

Started make-t2-cmd-handlers.

--- src/cbfg/world/t2.cljs
+++ src/cbfg/world/t2.cljs
@@ -4,14 +4,15 @@
                                    wait-done addr-override-xy]]
             [cbfg.world.base]))

-(def cmd-handlers
+(defn make-t2-cmd-handlers [st]
   {"add"   (fn [c] (assoc c :rq #(cbfg.world.base/example-add % c)))
    "sub"   (fn [c] (assoc c :rq #(cbfg.world.base/example-sub % c)))
    "count" (fn [c] (assoc c :rq #(cbfg.world.base/example-count % c)))
    "close-lane" (fn [c] (assoc c :op :close-lane))})

 (defn world-vis-init [el-prefix init-event-delay]
-  (cbfg.world.t1/world-vis-init-t "cbfg.world.t2" cmd-handlers el-prefix
+  (cbfg.world.t1/world-vis-init-t "cbfg.world.t2"
+                                  (make-t2-cmd-handlers nil) el-prefix
                                   cbfg.world.t1/ev-msg init-event-delay))

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


Add agents back into data load to load multiple files at once

--- src/cfpb/qu/loader.clj
+++ src/cfpb/qu/loader.clj
@@ -199,12 +199,20 @@
                       (map
                        (fn [row]
                          (into {} (remove (fn [[k v]] (nil? v)) row)))
-                       data))]
-    (doseq [file sources]
-      (load-csv-file
-       (str dir "/" file)
-       collection
-       (comp remove-nils transform-keys add-concepts cast-data)))))
+                       data))
+        transform-fn (comp remove-nils transform-keys add-concepts cast-data)
+        agent-error-handler (fn [agent exception]
+                              (log/error "Error in table loading agent"
+                                         (.getMessage exception)))
+        agents (map (fn [source]
+                      (agent source
+                             :error-mode :continue
+                             :error-handler agent-error-handler))
+                    sources)]
+    (doseq [agent agents]
+      (send-off agent (fn [file]
+                        (load-csv-file (str dir "/" file) collection transform-fn))))
+    (apply await agents)))

 (defmulti load-slice
   (fn [slice _ definition]


Manually arranged versions of map that look better

--- devcards/frontend/devcards/map.cljs
+++ devcards/frontend/devcards/map.cljs
@@ -213,7 +213,7 @@
     (html
      [:div {:style {:overflow "auto"}}
       [:svg {:width "2000"
-             :height "500"}
+             :height "300"}
        (for [[x things] (map-indexed vector things-in-columns)]
          (for [[y thing] (map-indexed vector things)]
            (when thing
@@ -269,7 +269,16 @@
     (html
      [:div
       (show-columns columns)
-      (map-svg columns (g/edges g))])))
+      (map-svg columns (g/edges g))
+      (map-svg (-> columns
+                   vec
+                   (assoc 2 ["cljsbuild_test" "cljsbuild_whitespace" "cljsbuild_production" "clojure_test"]))
+               (g/edges g))
+      (map-svg (-> columns
+                   vec
+                   (assoc 2 ["cljsbuild_whitespace" "cljsbuild_production" "cljsbuild_test" "clojure_test"])
+                   (assoc 3 ["precompile_assets" "cljs_test"]))
+               (g/edges g))])))

 (defcard arrow
   (html


Move shutdown-agents into -main

Move shutdown-agents into -main

Consumers of REPLy-as-lib will now need to (shutdown-agents) themselves.

refs technomancy/leiningen#1288

--- src/clj/reply/main.clj
+++ src/clj/reply/main.clj
@@ -64,8 +64,7 @@
                                                        (slurp ~body))
                             :else (clojure.repl/pst e#)))))
                '(catch Throwable t# (clojure.repl/pst t#))])
-    (finally (say-goodbye)
-             (shutdown-agents))))
+    (finally (say-goodbye))))

 (defn launch-nrepl [options]
   "Launches the nREPL version of REPL-y, with options already parsed out. The
@@ -98,5 +97,6 @@
               (println (.getMessage e))
               (parse-args ["--help"])))]
     (if (:help options)
-      (do (println banner) (shutdown-agents))
-      (launch options))))
+      (println banner)
+      (launch options))
+    (shutdown-agents)))


Use stack analysis and add code listing

Use stack analysis and add code listing

--- src/cljakstab/core.clj
+++ src/cljakstab/core.clj
@@ -1,11 +1,14 @@
 (ns cljakstab.core
-  (:require [clojure.string :as string])
+  (:require [clojure.string :as string]
+            [clojure.walk   :as walk])
   (:import (org.jakstab Main Options Program AnalysisManager)
            (org.jakstab.ssl Architecture)
            (org.jakstab.loader DefaultHarness)
            (org.jakstab.analysis ControlFlowReconstruction)
            java.security.Permission
            java.io.File))
+
+(def ^:private global-loaded-binary nil)

 (defn init-options
   "Jakstab stores options in singleton Options class"
@@ -33,7 +36,7 @@
          ~@exprs)
        (finally (System/setSecurityManager old-mgr#)))))

-(defn find-jumps
+(defn load-binary
   "find unresolved jumps in specified binary"
   [binary-file]
   (init-options {:mainFile binary-file})
@@ -41,11 +44,15 @@
    (let [arch (Architecture. (.getValue Options/sslFilename))
          program (Program/createProgram arch)
          file (.getAbsoluteFile (File. binary-file))]
+     (-> "--cpa xs" ; s - call stack analysis
+         (string/split #" ")
+         into-array
+         Options/parseOptions)
      (.loadMainModule program file)
      (.installHarness program (DefaultHarness.))
      (let [cfr (ControlFlowReconstruction. program)]
        (.run cfr)
-       {:cfr cfr :program program}))))
+       (def ^:private global-loaded-binary {:cfr cfr :program program})))))

 (defn- get-statement
   [program location]
@@ -110,16 +117,55 @@
    reverse
    (map
     (fn [[lbl jumps]]
-      (println lbl (.getStatement program lbl) (show-jumps jumps))))
+      (if (zero? (.getIndex lbl))
+        (let [address (.getAddress lbl)
+              instruction (.getInstruction program address)]
+          (-> program
+              (.getInstructionString address instruction)
+              println)))
+      (println
+       (str
+        lbl
+        " "
+        (.getStatement program lbl))
+       (show-jumps jumps))))
    dorun)
   nil)

-(defn show-program
-  [binary-file]
-  (let [program (-> binary-file
-                    find-jumps
-                    :program)]
-    (-> program
-        get-cfg
-        cfg-to-stmt-map
-        (show-stmt-map program))))
+(defn with-loaded
+  [fun & args]
+  (if global-loaded-binary
+    (apply fun global-loaded-binary args)
+    :code-not-loaded))
+
+(defn list-code
+  ([] (with-loaded list-code))
+  ([loaded]
+    (let [program (:program loaded)]
+      (-> program
+          get-cfg
+          cfg-to-stmt-map
+          (show-stmt-map program)))))
+
+(defn show-state
+  ([state-num] (with-loaded show-state state-num))
+  ([loaded state-num]))
+
+(defmacro show-symbols
+  [& forms]
+  `(show-symbols-fn '~forms))
+
+(defn get-symbols-map
+  [loaded]
+  {1 666})
+
+(defn show-symbols-fn
+  ([forms] (with-loaded show-symbols-fn forms))
+  ([loaded forms]
+     (let [symbols (get-symbols-map loaded)]
+       (walk/walk
+        #(if (symbol? %1)
+           (get symbols %1 %1)
+           %1)
+        identity
+        forms))))


Fix clojurescript test warning

Fix clojurescript test warning

Caused by implicitly using a private var.

--- src/test/clojure/clojure/test/check/test.cljc
+++ src/test/clojure/clojure/test/check/test.cljc
@@ -155,7 +155,8 @@
     (deftest multiply-test-check-and-goog
       (testing "For goog.math.Long's test.check multiply is the same as goog.math.Long.multiply"
         (is (:result
-              (tc/quick-check 1000 (prop/for-all* [gen/gen-raw-long gen/gen-raw-long] multiply-check)))))))
+             (let [grl @#'gen/gen-raw-long]
+               (tc/quick-check 1000 (prop/for-all* [grl grl] multiply-check))))))))
 ;; Count and concat work as expected
 ;; ---------------------------------------------------------------------------


use rmr also for worker/pids

use rmr also for worker/pids

--- storm-core/src/clj/backtype/storm/daemon/supervisor.clj
+++ storm-core/src/clj/backtype/storm/daemon/supervisor.clj
@@ -243,7 +243,7 @@
           (do
             (rmr (worker-heartbeats-root conf id))
             ;; this avoids a race condition with worker or subprocess writing pid around same time
-            (rmpath (worker-pids-root conf id))
+            (rmr (worker-pids-root conf id))
             (rmr (worker-root conf id))))
         (remove-worker-user! conf id)
         (remove-dead-worker id)


Fix the test case to request the response as application/edn

--- manual/code/example/spec/integration_spec.clj
+++ manual/code/example/spec/integration_spec.clj
@@ -7,9 +7,10 @@
 (describe "integration"
   (with-all server (server/start-server 8080))

-  (it "can start the server"
-      (should-not-be-nil @server))
+  ;; Force the server to start up
+  (before-all @server)

+  ;; And shut it down at the very end
   (after-all
     ;; start-server returns a function to stop the server, invoke it after all characteristics
     ;; have executed.
@@ -17,7 +18,8 @@

   (it "can get current counters"

-      (let [response (client/get "http://localhost:8080/counters")]
+      (let [response (client/get "http://localhost:8080/counters"
+                                 {:accept :edn})]
         (->> response
             :body
             read-string


* benchmark/cljs/benchmark_runner.cljs: add reduce + benchmark

--- benchmark/cljs/benchmark_runner.cljs
+++ benchmark/cljs/benchmark_runner.cljs
@@ -25,4 +25,8 @@
 (simple-benchmark [coll [1 2 3]] (next coll) 1000000)
 (println)

+(println ";;; seq ops")
+(simple-benchmark [coll (range 500000)] (reduce + coll) 1)
+(println)
+
 (println "\n")


remove extra benchmark bits

remove extra benchmark bits

--- benchmark/cljs/benchmark_runner.cljs
+++ benchmark/cljs/benchmark_runner.cljs
@@ -312,16 +312,8 @@
 (println ";; reducers")
 (simple-benchmark [xs (into [] (range 1000000))] (r/reduce + (r/map inc (r/map inc (r/map inc xs)))) 1)

-(dotimes [_ 10]
-  (let [xs (into [] (range 1000000))]
-    (time (r/reduce + (r/map inc (r/map inc (r/map inc xs)))))))
-
 (println ";; transducers")
 (simple-benchmark [xs (into [] (range 1000000))] (transduce (comp (map inc) (map inc) (map inc)) + 0 xs) 1)
-
-(dotimes [_ 10]
-  (let [xs (into [] (range 1000000))]
-    (time (transduce (comp (map inc) (map inc) (map inc)) + 0 xs))))

 (println "\n")


Updating to Clojure 1.2.1.

Updating to Clojure 1.2.1.

--- Spraff/project.clj
+++ Spraff/project.clj
@@ -2,7 +2,7 @@
 (defproject spraff "1.0.0-SNAPSHOT"
     :description "IRC bot."
     :dependencies [
-        [org.clojure/clojure "1.2.0"]
+        [org.clojure/clojure "1.2.1"]
         [irclj "0.4.1-SNAPSHOT"]
         ]
     :dev-dependencies [


Configure Java compiler class path correctly

- This wasn't being done properly before. The compiler class needed to
  be configured via the -cp option. We use the new "boot.class.path"
  system property and pass that as the -cp option to javac.

Example usage:

1. In a new directory create a "src" subdirectory.

2. Create a "src/Main.java" file with the following contents:

    import clojure.java.api.Clojure;
    import clojure.lang.IFn;
    public class Main {
      public static void main(String [] args) {
        IFn cloj = Clojure.var("clojure.core", "clojure-version");
        System.out.printf("Using Clojure version %s.\n", cloj.invoke());
      }
    }

3. Then build an uberjar:

    $ boot -d org.clojure/clojure:1.6.0 -s src javac uber jar -m Main

4. You can then run the program:

    $ java -jar target/project.jar

5. You should see something like "Using Clojure version 1.6.0." printed.

--- boot/core/src/boot/task/built_in.clj
+++ boot/core/src/boot/task/built_in.clj
@@ -377,7 +377,9 @@
             diag-coll (DiagnosticCollector.)
             compiler  (ToolProvider/getSystemJavaCompiler)
             file-mgr  (.getStandardFileManager compiler diag-coll nil nil)
-            opts      (->> ["-d" (.getPath tgt)] (into-array String) Arrays/asList)
+            opts      (->> ["-d"  (.getPath tgt)
+                            "-cp" (System/getProperty "boot.class.path")]
+                           (into-array String) Arrays/asList)
             handler   {Diagnostic$Kind/ERROR util/fail
                        Diagnostic$Kind/WARNING util/warn
                        Diagnostic$Kind/MANDATORY_WARNING util/warn}


Refactor println to use .log on js/console

--- src/core.cljs
+++ src/core.cljs
@@ -22,4 +22,4 @@
 (defn nnext [x] (next (next x)))

 (defmacro println [& args]
-    `(js/console.log (str ~@args))+    `(.log js/console ((str ~@args)))


releasing 0.1.12

releasing 0.1.12

--- build.boot
+++ build.boot
@@ -1,4 +1,4 @@
-(def +version+ "0.1.12-SNAPSHOT")
+(def +version+ "0.1.12")

 (set-env!
   :source-paths #{"src"}


BufferedImage rendering

BufferedImage rendering

--- src/wireframes/renderer/bitmap.clj
+++ src/wireframes/renderer/bitmap.clj
@@ -1,4 +1,66 @@
 (ns wireframes.renderer.bitmap
+  (:refer-clojure :exclude [identity concat])
+  (:use [wireframes.transform]
+        [wireframes.shape])
   (:import [java.awt.image BufferedImage]
            [java.awt.geom AffineTransform GeneralPath]
-           [java.awt Color Graphics2D RenderingHints BasicStroke GraphicsEnvironment]))
+           [java.awt Color Graphics2D RenderingHints BasicStroke GraphicsEnvironment]
+           [javax.imageio ImageIO]))
+
+(defn- draw-shape [^Graphics2D g2d transform shape]
+  (let [points (mapv (comp perspective (partial transform-point transform)) (:points shape))
+        path (GeneralPath.)]
+    (doseq [[idx1 idx2] (:lines shape)
+            :let [[ax ay] (points idx1)
+                  [bx by] (points idx2)]]
+      (doto path
+        (.moveTo ax ay)
+        (.lineTo bx by)))
+    (.draw g2d path)))
+
+(defn create-image [w h]
+  (if (GraphicsEnvironment/isHeadless)
+    (BufferedImage. w h BufferedImage/TYPE_INT_RGB)
+    (.createCompatibleImage
+       (.getDefaultConfiguration
+         (.getDefaultScreenDevice
+           (GraphicsEnvironment/getLocalGraphicsEnvironment)))
+       w h)))
+
+(defn ->img [transform shape [w h]]
+  (let [img (create-image w h)
+        g2d (.createGraphics img)
+        scale (min (quot w 2) (quot h 2))]
+    (doto g2d
+      (.setBackground Color/WHITE)
+      (.clearRect 0 0 w h)
+      (.setColor Color/BLACK)
+      (.translate (quot w 2) (quot h 2))
+      (.scale scale scale)
+      (.setStroke (BasicStroke. (/ 1.0 (quot w 2))))
+      (.setRenderingHint RenderingHints/KEY_ANTIALIASING RenderingHints/VALUE_ANTIALIAS_ON)
+      (.setRenderingHint RenderingHints/KEY_RENDERING RenderingHints/VALUE_RENDER_QUALITY))
+    (draw-shape g2d transform shape)
+    (.dispose g2d)
+    img))
+
+(defn write-png [image filename]
+  (ImageIO/write image "png" (clojure.java.io/file filename)))
+
+(comment
+
+  (def angle (degrees->radians 65))
+
+  (write-png
+    (->img
+      (concat
+        (rotate angle)
+        (transpose-axes :y :z)
+        (rotate (/ angle 1.618))
+        (transpose-axes :y :z)
+        (translate 0 0 6))
+      (make-torus 1 3 60 60)
+      [400 400])
+    "tourus-65.png")
+)
+


ChannelSpec to map

ChannelSpec to map

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

--- clojure/acq_engine.clj
+++ clojure/acq_engine.clj
@@ -6,7 +6,8 @@
            [org.micromanager.acquisition AcquisitionWrapperEngine]
            [org.micromanager.acquisition.engine SequenceSettings]
            [org.micromanager.navigation MultiStagePosition]
-           [java.util.prefs Preferences]))
+           [java.util.prefs Preferences]
+           [org.micromanager.utils ChannelSpec))

 ;; java interop
 (defn data-object-to-map [obj]
@@ -29,6 +30,34 @@
 (defn set-stage-position
   ([stage-dev z] (. mmc setPosition z))
   ([stage-dev x y] (. mmc setXYPosition x y)))
+
+(defn get-default-devices []
+  {:camera          (. mmc getCameraDevice)
+   :shutter         (. mmc getShutterDevice)
+   :focus           (. mmc getFocusDevice)
+   :xy-stage        (. mmc getXYStageDevice)
+   :autofocus       (. mmc getAutoFocusDevice)
+   :image-processor (. mmc getImageProcessorDevice)})
+
+(defn get-config [group config]
+  (let [data (. mmc getConfigData group config)
+        n (.size data)
+        props (map #(.getSetting data %) (range n))]
+    (for [prop props]
+      [(.getDeviceLabel prop)
+       (.getPropertyName prop)
+       (.getPropertyValue prop)])))
+
+(defn ChannelSpec-to-map [^ChannelSpec chan]
+  (-> chan (data-object-to-map)
+    (rekey
+      :config_                 :name
+      :exposure_               :exposure
+      :doZStack_               :use-z-stack
+      :skipFactorFrame_        :skip-frames
+      :useChannel_             :use-channel
+    )
+    (assoc :properties (get-config (. mmc getChannelGroup) (.config_ chan)))))

 ; engine

@@ -109,7 +138,7 @@
   (let [acq-seq (generate-acq-sequence settings)]
      (def acq-sequence acq-seq)
      (println acq-seq)))
-
+
 (defn convert-settings [^SequenceSettings settings]
   (-> settings
     (data-object-to-map)


Add dev endpoint: GET /spec/sample/:spec-ns

Example: http://t1.lumen.local:3000/spec/sample/:akvo.lumen.lib.aggregation/dataset

--- backend/dev/src/dev/endpoints.clj
+++ backend/dev/src/dev/endpoints.clj
@@ -3,10 +3,10 @@
             [clojure.java.io :as io]
             [clojure.spec.alpha :as s]
             [cognitect.transit :as transit]
+            [akvo.lumen.specs :as lumen.s]
             [ring.util.response :refer [response]]
             [integrant.core :as ig])
-  (:import [java.io ByteArrayInputStream ByteArrayOutputStream])
-)
+  (:import [java.io ByteArrayInputStream ByteArrayOutputStream]))
 ;; working in adapt https://github.com/akvo/akvo-lumen/blob/310bd7cbc3221bf889ad592f2d9e91a572f06c00/backend/dev/src/akvo/lumen/local_server.clj
 ;; use edn middleware instead of json middleware

@@ -16,12 +16,25 @@
    :ns (keyword spec)
    :spec (s/describe spec)})

+
+
 (defn routes [opts]
-  ["/describe" ["/:spec-ns/:spec-id" ["" {:get {:parameters {:path-params {:spec-ns string?
-                                                                           :spec-id string?}}
-                                                :handler (fn [{{:keys [spec-ns spec-id]} :path-params}]
-                                                           (let [spec (keyword (str (apply str (next (seq spec-ns))) "/" spec-id))]
-                                                             (response (describe-spec-response spec))))}}]]])
+  (let [params {:parameters {:path-params {:spec-ns string?
+                                           :spec-id string?}}}
+        read-spec (fn [{:keys [spec-ns spec-id]}]
+                    (keyword (str (apply str (next (seq spec-ns))) "/" spec-id)))
+        ]
+
+    [["/sample"
+       ["/:spec-ns/:spec-id"
+        ["" {:get (merge params
+                         {:handler (fn [{params :path-params}]
+                                     (response (lumen.s/sample (read-spec params))))})}]]]
+     ["/describe"
+       ["/:spec-ns/:spec-id"
+        ["" {:get (merge params
+                         {:handler (fn [{params :path-params}]
+                                     (response (describe-spec-response (read-spec params))))})}]]]]))

 (defmethod ig/init-key :dev.endpoints/spec  [_ opts]
   (routes opts))


Ammendment from 3.1.x rollup

Ammendment from 3.1.x rollup

Signed-off-by: Ken Barber <470bc578162732ac7f9d387d34c4af4ca6e1b6f7@bob.sh>

--- test/puppetlabs/puppetdb/scf/storage_test.clj
+++ test/puppetlabs/puppetdb/scf/storage_test.clj
@@ -19,7 +19,6 @@
             [puppetlabs.puppetdb.examples.reports :refer [reports]]
             [puppetlabs.puppetdb.testutils.reports :refer :all]
             [puppetlabs.puppetdb.testutils.events :refer :all]
-            [puppetlabs.puppetdb.query.reports :refer [is-latest-report?]]
             [puppetlabs.puppetdb.random :as random]
             [puppetlabs.puppetdb.scf.storage :refer :all]
             [clojure.test :refer :all]


(PE-5640) Fix test

(PE-5640) Fix test

Fix test of redirect to non-proxied path, as it was passing
erroneously.

--- test/puppetlabs/ring_middleware/core_test.clj
+++ test/puppetlabs/ring_middleware/core_test.clj
@@ -238,8 +238,8 @@
           (is (= (:body response) "Non-proxied path")))
         (let [response (http-get "http://localhost:10000/different")]
           (is (= (:status response) 404)))
-        (let [response (http-get "http://localhost:10000/hello/different-path"
-                                 {:follow-redirects false
-                                  :as :text})]
-          (is (= (:status response 200)))
-          (is (= (:body response "Non-proxied path"))))))))
+        (let [response (http-get "http://localhost:10000/hello-proxy/different-path"
+                                 {:follow-redirects false
+                                  :as :text})]
+          (is (= (:status response) 200))
+          (is (= (:body response) "Non-proxied path")))))))


better error handling

better error handling

--- src-cljs/frontend/utils.clj
+++ src-cljs/frontend/utils.clj
@@ -28,11 +28,16 @@
   "wraps errors in a try/catch statement, logging issues to the console
    and optionally rethrowing them if configured to do so."
   [& action]
-  `(try ~@action
-        (catch :default e#
-          (merror e#)
-          (when (:rethrow-errors? initial-query-map)
-            (throw e#)))))
+  `(try
+     (try ~@action
+          (catch js/Error e#
+            (merror e#)
+            (when (:rethrow-errors? initial-query-map)
+              (throw e#))))
+     (catch :default e2#
+       (merror e2#)
+       (when (:rethrow-errors? initial-query-map)
+         (throw e2#)))))

 (defmacro defrender
   "Reifies an IRender component that only has a render function and


remove old comments

remove old comments

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

--- plugins/SlideExplorer2/src/slide_explorer/view.clj
+++ plugins/SlideExplorer2/src/slide_explorer/view.clj
@@ -118,9 +118,7 @@
 (defn paint-tiles [^Graphics2D g available-tiles screen-state [tile-width tile-height]]
   (let [pixel-rect (Rectangle. (- (screen-state :x)) (- (screen-state :y))
                                (screen-state :width) (screen-state :height))]
-    ;(println pixel-rect)
     (doseq [[nx ny] (tiles-in-pixel-rectangle pixel-rect [tile-width tile-height])]
-      ;(println nx ny)
       (when-let [proc (get-in available-tiles [(screen-state :zoom) {:nx nx :ny ny :nz (screen-state :z) :nt 0 :nc 0}])]
         (let [[x y] (tile-to-pixels [nx ny] [tile-width tile-height] 0)]
           (.drawImage g (.createImage proc) x y nil))))))


Add pdfkit

Add pdfkit

--- src/circle/backend/build/inference/gems_map.clj
+++ src/circle/backend/build/inference/gems_map.clj
@@ -4,7 +4,8 @@
   ;; this is a map of rubygems to the ubuntu packages necessary for this gem to install. Incomplete.
   {"memcached" #{"libmemcached-dev" "libsasl2-dev"}
    "cdamian-geoip_city" #{"libgeoip-dev"}
-   "capybara-webkit" #{"libqtwebkit-dev"}})
+   "capybara-webkit" #{"libqtwebkit-dev"}
+   "pdfkit "#{"wkhtmltopdf"}})

 (def blacklisted-gems
   ;; gems that should be removed from the user's gemfile when running


Rename key :sith-lord to :data

Rename key :sith-lord to :data

--- src/cljs/flux_challenge_reagent/sith_lords.cljs
+++ src/cljs/flux_challenge_reagent/sith_lords.cljs
@@ -7,7 +7,7 @@
 (defonce ^:private items (r/atom (vec (repeat 5 nil)) :validator vector?))

 (defn- homeworld-matches? [items current-planet]
-  (let [sith-lords-homeworlds (map #(get-in % [:sith-lord "homeworld"]) items)]
+  (let [sith-lords-homeworlds (map #(get-in % [:data "homeworld"]) items)]
      (not (empty? (filter #(= % current-planet) sith-lords-homeworlds)))))

 (defn frozen? []
@@ -15,11 +15,11 @@

 (defn any-misses? [rel]
   {:pre [(some #{rel} '("master" "apprentice"))]}
-  (let [loaded-sith-lords (filter some? (map :sith-lord @items))]
+  (let [loaded-sith-lords (filter some? (map :data @items))]
     (not (empty? (filter nil? (map #(get-in % [rel "id"]) loaded-sith-lords))))))

 (defn sith-lords []
-  (map :sith-lord @items))
+  (map :data @items))

 (defn- assoc-pending-sith-lord [items index id]
   (if (and (>= index 0) (< index (count items)) (nil? (get-in items [index :id])))
@@ -35,7 +35,7 @@

 (defn- start-request! [item]
   (if-let [id (:id item)]
-    (if (not (some item '(:sith-lord :request)))
+    (if (not (some item '(:data :request)))
       (let [url (str "http://localhost:3000/dark-jedis/" id)
             request (ajax/GET url :response-format :json :handler handle-sith-lord-response!)]
         (assoc item :request request))
@@ -51,7 +51,7 @@
   (let [sith-lord-id (get sith-lord "id")
         sith-lord-index (util/index-of (map :id items) sith-lord-id)]
     (-> items
-        (assoc sith-lord-index {:id (get sith-lord "id") :sith-lord sith-lord})
+        (assoc sith-lord-index {:id (get sith-lord "id") :data sith-lord})
         (assoc-pending-sith-lord (inc sith-lord-index) (get-in sith-lord ["apprentice" "id"]))
         (assoc-pending-sith-lord (dec sith-lord-index) (get-in sith-lord ["master" "id"])))))

@@ -62,12 +62,12 @@

 (defn- scroll-once! [items direction]
   (case direction
-    :up (let [first-sith-lord (-> items first :sith-lord)
+    :up (let [first-sith-lord (-> items first :data)
               master-id (get-in first-sith-lord ["master" "id"])
               master-item {:id master-id}]
           (abort-request! (peek items))
           (into [master-item] (pop items)))
-    :down (let [last-sith-lord (-> items last :sith-lord)
+    :down (let [last-sith-lord (-> items last :data)
                 apprentice-id (get-in last-sith-lord ["apprentice" "id"])
                 apprentice-item {:id apprentice-id}]
             (abort-request! (nth items 0))


change remote url to point to dev

change remote url to point to dev

--- src/cljs/wombats_web_client/constants/urls.cljs
+++ src/cljs/wombats_web_client/constants/urls.cljs
@@ -6,7 +6,7 @@
                            :config-panel "config"})

 ;; Remote Dev
-(def base-api-url "//qa.api.wombats.io")
+(def base-api-url "//dev.api.wombats.io")

 ;; Local Dev
 #_(def base-api-url "//localhost:8888")


scrollpanel - added configurable margin between content and scroll bars

--- flatguiwidgets/src/flatgui/widgets/scrollpanel.clj
+++ flatguiwidgets/src/flatgui/widgets/scrollpanel.clj
@@ -11,6 +11,8 @@
       :author "Denys Lebediev"}
   flatgui.widgets.scrollpanel
   (:require [flatgui.base :as fg]
+            [flatgui.util.decimal :as d]
+            [flatgui.awt :as awt]
             [flatgui.inputchannels.mouse :as mouse]
             [flatgui.util.matrix :as m]
             [flatgui.widgets.panel]
@@ -22,10 +24,15 @@

 (fg/defevolverfn scrollpanelcontent-clip-size-evolver :clip-size
-  (let [  v-scrollbar-w (m/x (get-property component [:v-scrollbar] :clip-size))
-          h-scrollbar-y (m/y (get-property component [:h-scrollbar] :clip-size))
-          scrollpanel-size (get-property component [] :clip-size)]
-     (m/point-op - scrollpanel-size (m/defpoint v-scrollbar-w h-scrollbar-y 0))))
+  (let [v-scrollbar-w (m/x (get-property component [:v-scrollbar] :clip-size))
+        h-scrollbar-y (m/y (get-property component [:h-scrollbar] :clip-size))
+        scrollpanel-size (get-property component [] :clip-size)
+        raw-size (m/point-op - scrollpanel-size (m/defpoint v-scrollbar-w h-scrollbar-y 0))]
+     (m/defpoint
+       (- (d/round-granular (m/x raw-size) (awt/px))
+          (if (pos? h-scrollbar-y) (get-property [:this] :btm-scrollbar-margin) 0))
+       (- (d/round-granular (m/y raw-size) (awt/px))
+          (if (pos? v-scrollbar-w) (get-property [:this] :right-scrollbar-margin) 0)))))

 (fg/defevolverfn scrollpanelcontent-viewport-matrix-evolver :viewport-matrix
   (let [reason ((:evolve-reason-provider component) (:id component))]
@@ -60,6 +67,8 @@
 (fg/defwidget "scrollpanelcontent"
   {:position-matrix (m/translation-matrix (flatgui.awt/px) (flatgui.awt/px) 0)
    :content-size (m/defpoint 14 12 0)
+   :btm-scrollbar-margin 0
+   :right-scrollbar-margin 0
    :wheel-rotation-step-y 1
    :evolvers {:clip-size scrollpanelcontent-clip-size-evolver
               :viewport-matrix scrollpanelcontent-viewport-matrix-evolver}}


temporarily remove download HTML

temporarily remove download HTML

--- frontend/src/uxbox/main/ui/workspace/download.cljs
+++ frontend/src/uxbox/main/ui/workspace/download.cljs
@@ -130,11 +130,12 @@
          [:span.title "Download project"]
          [:p.info "Download all pages as svg in a zip file."]
          [:a.btn-primary {:href "#" :on-click download-zip} "Download project"]]
-        [:div.content-col
-         [:span.icon i/file-html]
-         [:span.title "Download as HTML"]
-         [:p.info "Download your project as HTML files."]
-         [:a.btn-primary {:href "#" :on-click download-html} "Download HTML"]]]
+        ; [:div.content-col
+        ;  [:span.icon i/file-html]
+        ;  [:span.title "Download as HTML"]
+        ;  [:p.info "Download your project as HTML files."]
+        ;  [:a.btn-primary {:href "#" :on-click download-html} "Download HTML"]]
+         ]
        [:a.close {:href "#" :on-click on-close} i/close]])))

 (defmethod lbx/render-lightbox :download


Only bold INFO output, don't make white (fixes #197)

--- boot/pod/src/boot/util.clj
+++ boot/pod/src/boot/util.clj
@@ -45,7 +45,7 @@
       (flush))))

 (defn dbug [& more] (print* 2 ansi/bold-cyan   more))
-(defn info [& more] (print* 1 ansi/bold-white  more))
+(defn info [& more] (print* 1 ansi/bold        more))
 (defn warn [& more] (print* 1 ansi/bold-yellow more))
 (defn fail [& more] (print* 1 ansi/bold-red    more))


Use doubles for indexes

Use doubles for indexes

--- src/advent_2018/day_09.cljc
+++ src/advent_2018/day_09.cljc
@@ -3,15 +3,15 @@
 (defn create-game [players]
   {:players players
    :player  1
-   :index   1
+   :index   1.0
    :marble  1
-   :circle  (sorted-map 0 0 1 1)
+   :circle  (sorted-map 0.0 0 1.0 1)
    :scores  (zipmap (map inc (range players)) (repeat 0))})

 (defn place-index [circle index]
   (let [[lb ub] (keys (rest (concat (subseq circle >= index) (cycle circle))))]
     (if (< lb ub)
-      (/ (+ lb ub) 2)
+      (/ (+ lb ub) 2.0)
       (inc (ffirst (rseq circle))))))

 (defn counter-clockwise-index [circle index n]


comment out invalid tests

comment out invalid tests

--- test/cljs/cljs/core_test.cljs
+++ test/cljs/cljs/core_test.cljs
@@ -1418,10 +1418,11 @@
   (assert (false? (= fred nil)))
   (assert (false? (= nil fred)))

-  (def ethel (Person. "Ethel" "Mertz" {:married true} {:husband :fred}))
-  (assert (= (meta ethel) {:married true}))
-  (def ethel-too (Person. "Ethel" "Mertz" {:married true} {:husband :fred}))
-  (assert (= ethel ethel-too))
+  ;; invalid tests, cannot set meta and extmap directly - David
+  ;; (def ethel (Person. "Ethel" "Mertz" {:married true} {:husband :fred}))
+  ;; (assert (= (meta ethel) {:married true}))
+  ;; (def ethel-too (Person. "Ethel" "Mertz" {:married true} {:husband :fred}))
+  ;; (assert (= ethel ethel-too))

   (assert (= (map->Person {:firstname "Fred" :lastname "Mertz"}) fred))
   (assert (= (->Person "Fred" "Mertz") fred))


Use is = directly for better failure output in difftest.

--- test/clojars/test/unit/db.clj
+++ test/clojars/test/unit/db.clj
@@ -121,7 +121,7 @@
       (with-redefs [db/get-time (fn [] (java.sql.Timestamp. 1))]
         (is (db/add-jar "test-user" (assoc jarmap :version "2")))))
     (let [jars (db/jars-by-groupname name)]
-      (dorun (map #(is (submap %1 %2)) [result] jars))
+      (dorun (map #(is (= %1 (select-keys %2 (keys %1)))) [result] jars))
       (is (= 1 (count jars))))))

 (deftest jars-with-multiple-versions
@@ -179,7 +179,7 @@
           (with-redefs [db/get-time (fn [] (java.sql.Timestamp. 1))]
             (is (db/add-jar "test-user" (assoc jarmap :version "2")))))
     (let [jars (db/jars-by-username "test-user")]
-      (dorun (map #(is (submap %1 %2)) [result] jars))
+      (dorun (map #(is (= %1 (select-keys %2 (keys %1)))) [result] jars))
       (is (= 1 (count jars))))))

 (deftest jars-by-user-returns-all-jars-by-user
@@ -293,7 +293,7 @@
     (with-redefs [db/get-time (fn [] (java.sql.Timestamp. (long 7)))]
       (db/add-jar "test-user" (assoc jarmap :version "7"))
       (db/add-jar "test-user" (assoc jarmap :version "8")))
-    (dorun (map #(is (submap %1 %2))
+    (dorun (map #(is (= %1 (select-keys %2 (keys %1))))
                 [(assoc result :version "8")
                  (assoc result :jar_name "6")
                  (assoc result :jar_name "4")


Add the other order tests

Add the other order tests

--- test/desdemona/query_test.clj
+++ test/desdemona/query_test.clj
@@ -30,12 +30,22 @@
                  (fn-call "ip" "y")]]
          (#'q/infix-parser "ip(x) = ip(y)"))
       "equality between two fn calls")
-  (is (= [:expr [:eq
-                 (fn-call "ip" "x")
-                 (fn-call "ip" "y")
-                 [:ipv4-addr "10" "0" "0" "1"]]]
-         (#'q/infix-parser "ip(x) = ip(y) = 10.0.0.1"))
-      "equality between two fn calls & literal"))
+  (testing "equality between two fn calls & literal"
+    (is (= [:expr [:eq
+                   (fn-call "ip" "x")
+                   (fn-call "ip" "y")
+                   [:ipv4-addr "10" "0" "0" "1"]]]
+           (#'q/infix-parser "ip(x) = ip(y) = 10.0.0.1")))
+    (is (= [:expr [:eq
+                   (fn-call "ip" "x")
+                   [:ipv4-addr "10" "0" "0" "1"]
+                   (fn-call "ip" "y")]]
+           (#'q/infix-parser "ip(x) = 10.0.0.1 = ip(y)")))
+    (is (= [:expr [:eq
+                   [:ipv4-addr "10" "0" "0" "1"]
+                   (fn-call "ip" "x")
+                   (fn-call "ip" "y")]]
+           (#'q/infix-parser "10.0.0.1 = ip(x) = ip(y)")))))

 (deftest infix->dsl-tests
   (is (= '(= (:ip x) "10.0.0.1")


Revert "Add Parallelism Settings Link"

Revert "Add Parallelism Settings Link"

This reverts commit 55216004bf114464a480dc0afa0286011fa78f03.

--- src-cljs/frontend/components/insights/project.cljs
+++ src-cljs/frontend/components/insights/project.cljs
@@ -4,7 +4,6 @@
             [frontend.datetime :as datetime]
             [frontend.models.project :as project-model]
             [frontend.state :as state]
-            [frontend.routes :as routes]
             [om.core :as om :include-macros true]
             [cljs-time.core :as time]
             [cljs-time.format :as time-format]
@@ -92,7 +91,7 @@
   (let [projects (get-in state state/projects-path)
         plans (get-in state state/user-plans-path)
         navigation-data (:navigation-data state)
-        {:keys [branches parallel username reponame] :as project} (some->> projects
+        {:keys [branches parallel] :as project} (some->> projects
                                                          (filter #(and (= (:reponame %) (:repo navigation-data))
                                                                        (= (:username %) (:org navigation-data))))
                                                          first)
@@ -133,9 +132,7 @@
            [:dt "parallelism"]
            [:dd parallel
             [:button.btn.btn-xs.btn-default
-             [:a {:href (str (routes/v1-project-settings {:org username :repo reponame}) "#parallel-builds")}
-              [:i.material-icons "tune"]]
-             ]]]]]
+             [:i.material-icons "tune"]]]]]]
         [:div.card
          [:div.card-header
           [:h3 "Build Timing"]]


Apply clj-kondo linting to src.

Apply clj-kondo linting to src.

--- src/cli4clj/cli.clj
+++ src/cli4clj/cli.clj
@@ -35,7 +35,7 @@
 (defn cli-repl-print
   "The default repl print function of cli4clj only prints non-nil values."
   [arg]
-  (if (not (nil? arg))
+  (when (not (nil? arg))
     (prn arg)))

 (defn get-cmd-aliases
@@ -161,11 +161,11 @@
                   [(StringsCompleter. #^java.util.Collection (conj (mapv name (cmd-aliases k)) (name k)))
                    (proxy [Completer] []
                      (complete [buffer cursor #^java.util.List candidates]
-                       (if (not (nil? fn-args))
+                       (when (not (nil? fn-args))
                          (.add candidates (str "Arguments: " fn-args)))
-                       (if (not (nil? completion-hint))
+                       (when (not (nil? completion-hint))
                          (.add candidates (str completion-hint)))
-                       (if (not (and (not (nil? fn-args)) (not (nil? completion-hint))))
+                       (when (not (and (not (nil? fn-args)) (not (nil? completion-hint))))
                          (.add candidates ""))
                        0))])))
             v)))
@@ -184,7 +184,7 @@
     (print (str "\u001B[2J\u001B[1;" (- height alternate-height 2) "r"))
     (flush)
     (.setPrompt in-rdr adjusted-prompt-string)
-    (if entry-message
+    (when entry-message
       (print entry-message))))

 (defn create-jline-read-fn
@@ -193,7 +193,6 @@
    The input that is read is then forwarded to a repl read function that was created with create-repl-read-fn."
   [opts]
   (let [cmds (opts :cmds)
-        err-fn (opts :print-err)
         entry-message (opts :entry-message)
         prompt-string (opts :prompt-string)
         in-rdr (doto (ConsoleReader. nil *jline-input-stream* *jline-output-stream* nil)
@@ -214,7 +213,7 @@
                              history-file (jio/file history-file-name)]
                          (FileHistory. history-file))
                        nil)
-        _ (if (not (nil? file-history))
+        _ (when (not (nil? file-history))
             (.setHistory in-rdr file-history))
         arg-hint-completers (create-arg-hint-completers cmds)
         _ (doseq [compl arg-hint-completers]
@@ -246,7 +245,7 @@
           (print (str "\u001B[" (- current-height alternate-height 3) ";1H> " line))
           (print "\u001B[u")
           (flush))
-        (if (not (nil? file-history))
+        (when (not (nil? file-history))
           (.flush file-history))
         (cond
           (and (not (nil? line))
@@ -257,7 +256,7 @@

           (nil? line) request-exit

-          :default request-prompt)))))
+          :else request-prompt)))))

 (defn resolve-cmd-alias
   "This function is used to resolve the full command definition for a given command alias.
@@ -290,7 +289,7 @@
                 (get-in cmds [cmd :fn])
                 (rest arg)))
           (and allow-eval (list? arg)) (eval arg)
-          :default (err-fn (str "Invalid command: \"" arg "\". Please type \"help\" to get an overview of commands.") opts))
+          :else (err-fn (str "Invalid command: \"" arg "\". Please type \"help\" to get an overview of commands.") opts))
         (catch Exception e
           (err-fn e opts))))))

@@ -355,7 +354,7 @@
       (instance? Exception arg)
       ((:print-exception-trace opts))) (strace/print-cause-trace arg)
     (instance? Exception arg) (utils/println-err (.getMessage #^Exception arg))
-    :default (utils/println-err (str arg))))
+    :else (utils/println-err (str arg))))

 (def cli-default-options
   {:allow-eval false
@@ -406,7 +405,7 @@
                    (symbol? f) (utils/map-quote-vec (utils/get-defn-arglists (eval `(var ~f))))
                    (and (list? f)
                         (= 'fn (first f))) (:args (utils/get-fn-arglists f))
-                   :default nil)]
+                   :else nil)]
         (if (and
               (not (nil? args))
               (nil? (get-in m [:cmds k :fn-args])))
@@ -481,24 +480,23 @@
    Please note that the configuration options can also be defined in a global or local var.
    However, in order to lookup arguments defined in anonymous functions, the configuration options have to be defined directly in the macro call."
   [user-options]
-  (let []
-    `(let [~'__options (atom nil)
-           ~'__alt-scroll-wrtr (atom nil)]
-       (windows-workaround)
-       (reset! ~'__options (assoc
-                             (get-cli-opts (add-args-info-m ~user-options))
-                             :calling-ns ~*ns*))
-       (reset! ~'__alt-scroll-wrtr (alt-scroll-writer @~'__options))
-       (wrap-alt-scroll-writer
-         ~'__alt-scroll-wrtr
-         ~'__options
-         (main/repl
-           :eval ((@~'__options :eval-factory) @~'__options)
-           :print (@~'__options :print)
-           :prompt (@~'__options :prompt-fn)
-           :read (*read-factory* @~'__options)))
-       (when (@~'__options :alternate-scrolling)
-         (print (str "\u001b[r\u001b[" (-> (TerminalFactory/create) (.getHeight)) ";0H"))))))
+  `(let [~'__options (atom nil)
+         ~'__alt-scroll-wrtr (atom nil)]
+     (windows-workaround)
+     (reset! ~'__options (assoc
+                          (get-cli-opts (add-args-info-m ~user-options))
+                          :calling-ns ~*ns*))
+     (reset! ~'__alt-scroll-wrtr (alt-scroll-writer @~'__options))
+     (wrap-alt-scroll-writer
+      ~'__alt-scroll-wrtr
+      ~'__options
+      (main/repl
+       :eval ((@~'__options :eval-factory) @~'__options)
+       :print (@~'__options :print)
+       :prompt (@~'__options :prompt-fn)
+       :read (*read-factory* @~'__options)))
+     (when (@~'__options :alternate-scrolling)
+       (print (str "\u001b[r\u001b[" (-> (TerminalFactory/create) (.getHeight)) ";0H")))))

 (defn create-embedded-read-fn
   "This creates a read fn intended for use in the embedded CLI."


Microcosmetics

Microcosmetics

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

--- src/conexp/util.clj
+++ src/conexp/util.clj
@@ -507,10 +507,10 @@
   "Returns a hash map with the values of keys as keys and their values
   under function as values."
   [function keys]
-  (persistent! (reduce (fn [map k]
-                         (assoc! map k (function k)))
-                       (transient {})
-                       keys)))
+  (reduce! (fn [map k]
+             (assoc! map k (function k)))
+           {}
+           keys))

 (defmacro with-printed-result
   "Prints string followed by result, returning it."