Fixed system stop if Neo4j not started

Fixed system stop if Neo4j not started

--- src/webapp/server/fns.clj
+++ src/webapp/server/fns.clj
@@ -10,7 +10,11 @@
   (:require [clojurewerkz.neocons.rest.cypher :as cy])
 )

-(nr/connect! "http://localhost:7474/db/data/")
+( try
+     (nr/connect! "http://localhost:7474/db/data/")
+         (catch Exception e (str "caught exception: " (.getMessage e))))
+
+

 (defentity test_table)
@@ -69,4 +73,3 @@
           )})

-(get-from-neo nil)


Use agreed upon trial copy

Use agreed upon trial copy

--- src-cljs/frontend/components/org_settings.cljs
+++ src-cljs/frontend/components/org_settings.cljs
@@ -413,8 +413,8 @@
               (when (and trial-starts-here? (not (pm/osx? plan)))
                 (let [template "osx-trial"
                       plan-type :osx]
-                  [:div.start-trial
-                   (forms/managed-button
+                  [:div.start-trial "OR" [:br]
+                  (forms/managed-button
                      [:a
                       {:data-success-text "Success!"
                        :data-loading-text "Starting..."
@@ -422,10 +422,10 @@
                        :on-click #(raise! owner [:activate-plan-trial {:plan-type plan-type
                                                                        :template template
                                                                        :org (:org plan)}])}
-                      "Start a 2-week, free trial."])]))]]
+                      "start a 2-week, free trial"])]))]]
             (cond
               trial-starts-here?
-              [:div.bottom "Free Trial Starts Here"]
+              [:div.bottom "FREE TRIAL STARTS HERE"]

               trial-expired?
               [:div.bottom "Trial has Ended - Choose a Plan"]


Add support for Windows

Add support for Windows

- Tested with Windows 10, Google Chrome 61

--- src/clj_chrome_devtools/automation/fixture.clj
+++ src/clj_chrome_devtools/automation/fixture.clj
@@ -13,11 +13,21 @@
    "google-chrome-stable"
    "google-chrome"
    "chromium-browser"
-   "chromium"])
+   "chromium"
+   "chrome.exe"])
+
+(defn- is-windows? []
+  (str/starts-with? (System/getenv "os") "Windows"))

 (defn binary-path [candidate]
-  ;; PENDING: what about Windows? PR welcome
-  (let [{:keys [exit out]} (sh/sh "which" candidate)]
+  (let [{:keys [exit out]}
+        (if (is-windows?)
+          ;; Note: usually this is the default location
+          ;; "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe"
+          ;; "C:/Program Files (x86)/Google/Chrome Beta/Application/chrome.exe"
+          (sh/sh "where.exe" candidate)
+          ;; Assume Linux/MacOS
+          (sh/sh "which" candidate))]
     (when (= exit 0)
       (str/trim-newline out))))


Add generic "testing" macro

Add generic "testing" macro

--- src/main/clojure/com/stuartsierra/lazytest.clj
+++ src/main/clojure/com/stuartsierra/lazytest.clj
@@ -266,6 +266,69 @@
   `(def ~name (suite ~name ~@decl)))

+(defmacro given [& decl]
+  (let [name (if (symbol? (first decl)) (first decl) (gensym "testing"))
+        named? (symbol? (first decl))
+        decl (if (symbol? (first decl)) (next decl) decl)
+        doc  (if (string? (first decl)) (first decl) nil)
+        decl (if (string? (first decl)) (next decl) decl)
+        bindings (first decl)
+        assertions (next decl)
+        metadata {:name name, :ns *ns*, :file *file*, :line @Compiler/LINE}]
+    (assert (vector? bindings))
+    (assert (even? (count bindings)))
+    (let  [locals (vec (map first (partition 2 bindings)))
+           contexts (vec (map second (partition 2 bindings)))
+           children (loop [r [], as assertions]
+                      (if (seq as)
+                        (if (string? (first as))
+                          (recur (conj r `(with-meta (fn ~locals ~(second as))
+                                            {:doc ~(first as),
+                                             :form '~(second as),
+                                             :file *file*,
+                                             :line @Compiler/LINE}))
+                                 (nnext as))
+                          (recur (conj r `(with-meta (fn ~locals ~(first as))
+                                            {:form '~(first as),
+                                             :file *file*,
+                                             :line @Compiler/LINE}))
+                                 (next as)))
+                        r))]
+      `(let [tc# (TestCase ~contexts ~(vec children) '~metadata nil)]
+         (when ~named? (intern *ns* '~name tc#))
+         tc#))))
+
+(defmacro testing [& decl]
+  (let [name (if (symbol? (first decl)) (first decl) (gensym "testing"))
+        named? (symbol? (first decl))
+        decl (if (symbol? (first decl)) (next decl) decl)
+        doc  (if (string? (first decl)) (first decl) nil)
+        decl (if (string? (first decl)) (next decl) decl)
+        [opt val] (if (keyword? (first decl))
+                    [(first decl) (second decl)] [nil nil])
+        decl (if (keyword? (first decl)) (nnext decl) decl)
+        metadata {:doc doc, :name name, :ns *ns*,
+                  :file *file*, :line @Compiler/LINE}
+        locals (if (= opt :given)
+                 (vec (map first (partition 2 val))) [])
+        contexts (cond (= opt :given) (vec (map second (partition 2 val)))
+                       (= opt :using) val
+                       (nil? opt) [])
+        children (loop [r [], cs decl]
+                   (if (seq cs)
+                     (let [it (first cs)]
+                       (if (and (list? it)
+                                (symbol? (first it))
+                                (= #'testing (resolve (first it))))
+                         (recur (conj r it) (next cs))
+                         (recur (conj r `(fn ~locals ~it)) (next cs))))
+                     r))]
+    (assert (vector? contexts))
+    `(let [tc# (TestCase ~contexts ~children '~metadata nil)]
+       (when ~named? (intern *ns* '~name tc#))
+       tc#)))
+
+
 ;;; TEST RESULT HANDLING

 (defn assertion-result?


Rewrote runSimulation (renamed to runExperiment) and writeResults

--- src/research_clojure/eChild/runSimulation.clj
+++ src/research_clojure/eChild/runSimulation.clj
@@ -8,13 +8,10 @@

 (defn writeResults
-  "Writes the results of doesChildLearnGrammar to output file"
-  [lines]
-  (let [parameterList (get lines 2)
-        convergedList (get lines 3)]
-
-      (with-open [out-file (io/writer "out.csv" :append true)]
-            (csv/write-csv out-file [[(get lines 0) (get lines 1) (get parameterList 0) (get convergedList 0) (get parameterList 1) (get convergedList 1) (get parameterList 2) (get convergedList 2) (get parameterList 3) (get convergedList 3) (get parameterList 4) (get convergedList 4) (get parameterList 5) (get convergedList 5) (get parameterList 6) (get convergedList 6) (get parameterList 7) (get convergedList 7) (get parameterList 8) (get convergedList 8) (get parameterList 9) (get convergedList 9) (get parameterList 10) (get convergedList 10) (get parameterList 11) (get convergedList 11) (get parameterList 12) (get convergedList 12)]]))))
+  "Writes the results of each learner to an output file"
+  [results]
+  (println results)
+  (spit "out.csv" results))

 (defn updateTimeCourseVector
@@ -27,10 +24,10 @@
   (let [i (atom 0)
         countArr (atom [])]
     (while (< @i 13)
-      (if (not= (get oldGrammar @i) (get currGrammar @i))
-        (reset! countArr (conj @countArr sentenceCount))
-        (reset! countArr (conj @countArr (get (get timeCourseVector 1) @i))))
-      (swap! i inc))
+        (if (not= (get oldGrammar @i) (get currGrammar @i))
+          (reset! countArr (conj @countArr sentenceCount))
+          (reset! countArr (conj @countArr (get (get timeCourseVector 1) @i))))
+        (swap! i inc))
     (assoc timeCourseVector 1 @countArr)))

@@ -58,15 +55,32 @@
         [@grammar @grammarLearned (get @timeCourseVector 0) (get @timeCourseVector 1)]))

+(defn handle-request [sentences max_sentences]
+      (let [result (future (fn [] (doesChildLearnGrammar sentences max_sentences)))]
+        ; Do something else
+        (writeResults @result)))
+
+
+(defmacro enqueue
+   ([q concurrent-promise-name concurrent serialized]
+    `(let [~concurrent-promise-name (promise)]
+      (future (deliver ~concurrent-promise-name ~concurrent))
+       (deref ~q)
+      ~serialized
+      ~concurrent-promise-name))
+   ([concurrent-promise-name concurrent serialized]
+   `(enqueue (future) ~concurrent-promise-name ~concurrent ~serialized)))
+
+
 (defn runSimulation
   "max_eChildren number of eChildren will process
   max_sentences number of sentences."
   [sentences max_eChildren max_sentences]
   (io/delete-file "out.csv" :silently true)
+  (loop [i 0 results []]
+    (if (< i max_eChildren)
+      (recur (inc i) (conj results (doesChildLearnGrammar sentences max_sentences)))
+      (writeResults results))))

-  (let [counter (atom 0)]
-    (while (< @counter max_eChildren)
-      (println "eChild #" (+ @counter 1))
-      (writeResults (doesChildLearnGrammar sentences max_sentences))
-      (swap! counter inc))))
-
+;(handle-request sentences max_sentences)
+;(-> (enqueue grammar (doesChildLearnGrammar sentences max_sentences) (writeResults @grammar)))


STORM-727: nimbus_auth_test should not use default nimbus port.

--- storm-core/test/clj/backtype/storm/security/auth/nimbus_auth_test.clj
+++ storm-core/test/clj/backtype/storm/security/auth/nimbus_auth_test.clj
@@ -57,121 +57,126 @@
       (.stop nimbus-server#)))

 (deftest Simple-authentication-test
-  (with-test-cluster [6627 nil nil "backtype.storm.security.auth.SimpleTransportPlugin"]
-    (let [storm-conf (merge (read-storm-config)
-                            {STORM-THRIFT-TRANSPORT-PLUGIN "backtype.storm.security.auth.SimpleTransportPlugin"
-                             STORM-NIMBUS-RETRY-TIMES 0})
-          client (NimbusClient. storm-conf "localhost" 6627 nimbus-timeout)
-          nimbus_client (.getClient client)]
-      (testing "(Positive authorization) Simple protocol w/o authentication/authorization enforcement"
-               (is (thrown-cause? NotAliveException
-                            (.activate nimbus_client "topo-name"))))
-      (.close client))))
+  (let [port (available-port)]
+    (with-test-cluster [port nil nil "backtype.storm.security.auth.SimpleTransportPlugin"]
+      (let [storm-conf (merge (read-storm-config)
+                              {STORM-THRIFT-TRANSPORT-PLUGIN "backtype.storm.security.auth.SimpleTransportPlugin"
+                               STORM-NIMBUS-RETRY-TIMES 0})
+            client (NimbusClient. storm-conf "localhost" port nimbus-timeout)
+            nimbus_client (.getClient client)]
+        (testing "(Positive authorization) Simple protocol w/o authentication/authorization enforcement"
+                 (is (thrown-cause? NotAliveException
+                              (.activate nimbus_client "topo-name"))))
+        (.close client)))))

-(deftest test-noop-authorization-w-simple-transport
-  (with-test-cluster [6628 nil
-                "backtype.storm.security.auth.authorizer.NoopAuthorizer"
-                "backtype.storm.security.auth.SimpleTransportPlugin"]
-    (let [storm-conf (merge (read-storm-config)
-                             {STORM-THRIFT-TRANSPORT-PLUGIN "backtype.storm.security.auth.SimpleTransportPlugin"
-                              STORM-NIMBUS-RETRY-TIMES 0})
-          client (NimbusClient. storm-conf "localhost" 6628 nimbus-timeout)
-          nimbus_client (.getClient client)]
-      (testing "(Positive authorization) Authorization plugin should accept client request"
-               (is (thrown-cause? NotAliveException
-                            (.activate nimbus_client "topo-name"))))
-      (.close client))))
+(deftest test-noop-authorization-w-simple-transport
+  (let [port (available-port)]
+    (with-test-cluster [port nil
+                  "backtype.storm.security.auth.authorizer.NoopAuthorizer"
+                  "backtype.storm.security.auth.SimpleTransportPlugin"]
+      (let [storm-conf (merge (read-storm-config)
+                               {STORM-THRIFT-TRANSPORT-PLUGIN "backtype.storm.security.auth.SimpleTransportPlugin"
+                                STORM-NIMBUS-RETRY-TIMES 0})
+            client (NimbusClient. storm-conf "localhost" port nimbus-timeout)
+            nimbus_client (.getClient client)]
+        (testing "(Positive authorization) Authorization plugin should accept client request"
+                 (is (thrown-cause? NotAliveException
+                              (.activate nimbus_client "topo-name"))))
+        (.close client)))))

-(deftest test-deny-authorization-w-simple-transport
-  (with-test-cluster [6629 nil
-                "backtype.storm.security.auth.authorizer.DenyAuthorizer"
-                "backtype.storm.security.auth.SimpleTransportPlugin"]
-    (let [storm-conf (merge (read-storm-config)
-                             {STORM-THRIFT-TRANSPORT-PLUGIN "backtype.storm.security.auth.SimpleTransportPlugin"
-                             Config/NIMBUS_HOST "localhost"
-                             Config/NIMBUS_THRIFT_PORT 6629
-                             STORM-NIMBUS-RETRY-TIMES 0})
-          client (NimbusClient/getConfiguredClient storm-conf)
-          nimbus_client (.getClient client)
-          topologyInitialStatus (TopologyInitialStatus/findByValue 2)
-          submitOptions (SubmitOptions. topologyInitialStatus)]
-      (is (thrown-cause? AuthorizationException (.submitTopology nimbus_client  "topo-name" nil nil nil)))
-      (is (thrown-cause? AuthorizationException (.submitTopologyWithOpts nimbus_client  "topo-name" nil nil nil submitOptions)))
-      (is (thrown-cause? AuthorizationException (.beginFileUpload nimbus_client)))
-      (is (thrown-cause? AuthorizationException (.uploadChunk nimbus_client nil nil)))
-      (is (thrown-cause? AuthorizationException (.finishFileUpload nimbus_client nil)))
-      (is (thrown-cause? AuthorizationException (.beginFileDownload nimbus_client nil)))
-      (is (thrown-cause? AuthorizationException (.downloadChunk nimbus_client nil)))
-      (is (thrown-cause? AuthorizationException (.getNimbusConf nimbus_client)))
-      (is (thrown-cause? AuthorizationException (.getClusterInfo nimbus_client)))
-      (stubbing [nimbus/check-storm-active! nil
-                 nimbus/try-read-storm-conf-from-name {}]
-        (is (thrown-cause? AuthorizationException (.killTopology nimbus_client "topo-name")))
-        (is (thrown-cause? AuthorizationException (.killTopologyWithOpts nimbus_client "topo-name" (KillOptions.))))
-        (is (thrown-cause? AuthorizationException (.activate nimbus_client "topo-name")))
-        (is (thrown-cause? AuthorizationException (.deactivate nimbus_client "topo-name")))
-        (is (thrown-cause? AuthorizationException (.rebalance nimbus_client "topo-name" nil)))
-      )
-      (stubbing [nimbus/try-read-storm-conf {}]
-        (is (thrown-cause? AuthorizationException (.getTopologyConf nimbus_client "topo-ID")))
-        (is (thrown-cause? AuthorizationException (.getTopology nimbus_client "topo-ID")))
-        (is (thrown-cause? AuthorizationException (.getUserTopology nimbus_client "topo-ID")))
-        (is (thrown-cause? AuthorizationException (.getTopologyInfo nimbus_client "topo-ID"))))
-      (.close client))))
+(deftest test-deny-authorization-w-simple-transport
+  (let [port (available-port)]
+    (with-test-cluster [port nil
+                  "backtype.storm.security.auth.authorizer.DenyAuthorizer"
+                  "backtype.storm.security.auth.SimpleTransportPlugin"]
+      (let [storm-conf (merge (read-storm-config)
+                               {STORM-THRIFT-TRANSPORT-PLUGIN "backtype.storm.security.auth.SimpleTransportPlugin"
+                               Config/NIMBUS_HOST "localhost"
+                               Config/NIMBUS_THRIFT_PORT port
+                               STORM-NIMBUS-RETRY-TIMES 0})
+            client (NimbusClient/getConfiguredClient storm-conf)
+            nimbus_client (.getClient client)
+            topologyInitialStatus (TopologyInitialStatus/findByValue 2)
+            submitOptions (SubmitOptions. topologyInitialStatus)]
+        (is (thrown-cause? AuthorizationException (.submitTopology nimbus_client  "topo-name" nil nil nil)))
+        (is (thrown-cause? AuthorizationException (.submitTopologyWithOpts nimbus_client  "topo-name" nil nil nil submitOptions)))
+        (is (thrown-cause? AuthorizationException (.beginFileUpload nimbus_client)))
+        (is (thrown-cause? AuthorizationException (.uploadChunk nimbus_client nil nil)))
+        (is (thrown-cause? AuthorizationException (.finishFileUpload nimbus_client nil)))
+        (is (thrown-cause? AuthorizationException (.beginFileDownload nimbus_client nil)))
+        (is (thrown-cause? AuthorizationException (.downloadChunk nimbus_client nil)))
+        (is (thrown-cause? AuthorizationException (.getNimbusConf nimbus_client)))
+        (is (thrown-cause? AuthorizationException (.getClusterInfo nimbus_client)))
+        (stubbing [nimbus/check-storm-active! nil
+                   nimbus/try-read-storm-conf-from-name {}]
+          (is (thrown-cause? AuthorizationException (.killTopology nimbus_client "topo-name")))
+          (is (thrown-cause? AuthorizationException (.killTopologyWithOpts nimbus_client "topo-name" (KillOptions.))))
+          (is (thrown-cause? AuthorizationException (.activate nimbus_client "topo-name")))
+          (is (thrown-cause? AuthorizationException (.deactivate nimbus_client "topo-name")))
+          (is (thrown-cause? AuthorizationException (.rebalance nimbus_client "topo-name" nil)))
+        )
+        (stubbing [nimbus/try-read-storm-conf {}]
+          (is (thrown-cause? AuthorizationException (.getTopologyConf nimbus_client "topo-ID")))
+          (is (thrown-cause? AuthorizationException (.getTopology nimbus_client "topo-ID")))
+          (is (thrown-cause? AuthorizationException (.getUserTopology nimbus_client "topo-ID")))
+          (is (thrown-cause? AuthorizationException (.getTopologyInfo nimbus_client "topo-ID"))))
+        (.close client)))))

-(deftest test-noop-authorization-w-sasl-digest
-  (with-test-cluster [6630
-                "test/clj/backtype/storm/security/auth/jaas_digest.conf"
-                "backtype.storm.security.auth.authorizer.NoopAuthorizer"
-                "backtype.storm.security.auth.digest.DigestSaslTransportPlugin"]
-    (let [storm-conf (merge (read-storm-config)
-                            {STORM-THRIFT-TRANSPORT-PLUGIN "backtype.storm.security.auth.digest.DigestSaslTransportPlugin"
-                             "java.security.auth.login.config" "test/clj/backtype/storm/security/auth/jaas_digest.conf"
-                             Config/NIMBUS_HOST "localhost"
-                             Config/NIMBUS_THRIFT_PORT 6630
-                             STORM-NIMBUS-RETRY-TIMES 0})
-          client (NimbusClient/getConfiguredClient storm-conf)
-          nimbus_client (.getClient client)]
-      (testing "(Positive authorization) Authorization plugin should accept client request"
-               (is (thrown-cause? NotAliveException
-                            (.activate nimbus_client "topo-name"))))
-      (.close client))))
+(deftest test-noop-authorization-w-sasl-digest
+  (let [port (available-port)]
+    (with-test-cluster [port
+                  "test/clj/backtype/storm/security/auth/jaas_digest.conf"
+                  "backtype.storm.security.auth.authorizer.NoopAuthorizer"
+                  "backtype.storm.security.auth.digest.DigestSaslTransportPlugin"]
+      (let [storm-conf (merge (read-storm-config)
+                              {STORM-THRIFT-TRANSPORT-PLUGIN "backtype.storm.security.auth.digest.DigestSaslTransportPlugin"
+                               "java.security.auth.login.config" "test/clj/backtype/storm/security/auth/jaas_digest.conf"
+                               Config/NIMBUS_HOST "localhost"
+                               Config/NIMBUS_THRIFT_PORT port
+                               STORM-NIMBUS-RETRY-TIMES 0})
+            client (NimbusClient/getConfiguredClient storm-conf)
+            nimbus_client (.getClient client)]
+        (testing "(Positive authorization) Authorization plugin should accept client request"
+                 (is (thrown-cause? NotAliveException
+                              (.activate nimbus_client "topo-name"))))
+        (.close client)))))

-(deftest test-deny-authorization-w-sasl-digest
-  (with-test-cluster [6631
-                "test/clj/backtype/storm/security/auth/jaas_digest.conf"
-                "backtype.storm.security.auth.authorizer.DenyAuthorizer"
-                "backtype.storm.security.auth.digest.DigestSaslTransportPlugin"]
-    (let [storm-conf (merge (read-storm-config)
-                            {STORM-THRIFT-TRANSPORT-PLUGIN "backtype.storm.security.auth.digest.DigestSaslTransportPlugin"
-                             "java.security.auth.login.config" "test/clj/backtype/storm/security/auth/jaas_digest.conf"
-                             Config/NIMBUS_HOST "localhost"
-                             Config/NIMBUS_THRIFT_PORT 6631
-                             STORM-NIMBUS-RETRY-TIMES 0})
-          client (NimbusClient/getConfiguredClient storm-conf)
-          nimbus_client (.getClient client)
-          topologyInitialStatus (TopologyInitialStatus/findByValue 2)
-          submitOptions (SubmitOptions. topologyInitialStatus)]
-      (is (thrown-cause? AuthorizationException (.submitTopology nimbus_client  "topo-name" nil nil nil)))
-      (is (thrown-cause? AuthorizationException (.submitTopologyWithOpts nimbus_client  "topo-name" nil nil nil submitOptions)))
-      (is (thrown-cause? AuthorizationException (.beginFileUpload nimbus_client)))
-      (is (thrown-cause? AuthorizationException (.uploadChunk nimbus_client nil nil)))
-      (is (thrown-cause? AuthorizationException (.finishFileUpload nimbus_client nil)))
-      (is (thrown-cause? AuthorizationException (.beginFileDownload nimbus_client nil)))
-      (is (thrown-cause? AuthorizationException (.downloadChunk nimbus_client nil)))
-      (is (thrown-cause? AuthorizationException (.getNimbusConf nimbus_client)))
-      (is (thrown-cause? AuthorizationException (.getClusterInfo nimbus_client)))
-      (stubbing [nimbus/check-storm-active! nil
-                 nimbus/try-read-storm-conf-from-name {}]
-        (is (thrown-cause? AuthorizationException (.killTopology nimbus_client "topo-name")))
-        (is (thrown-cause? AuthorizationException (.killTopologyWithOpts nimbus_client "topo-name" (KillOptions.))))
-        (is (thrown-cause? AuthorizationException (.activate nimbus_client "topo-name")))
-        (is (thrown-cause? AuthorizationException (.deactivate nimbus_client "topo-name")))
-        (is (thrown-cause? AuthorizationException (.rebalance nimbus_client "topo-name" nil))))
-      (stubbing [nimbus/try-read-storm-conf {}]
-        (is (thrown-cause? AuthorizationException (.getTopologyConf nimbus_client "topo-ID")))
-        (is (thrown-cause? AuthorizationException (.getTopology nimbus_client "topo-ID")))
-        (is (thrown-cause? AuthorizationException (.getUserTopology nimbus_client "topo-ID")))
-        (is (thrown-cause? AuthorizationException (.getTopologyInfo nimbus_client "topo-ID"))))
-      (.close client))))
+(deftest test-deny-authorization-w-sasl-digest
+  (let [port (available-port)]
+    (with-test-cluster [port
+                  "test/clj/backtype/storm/security/auth/jaas_digest.conf"
+                  "backtype.storm.security.auth.authorizer.DenyAuthorizer"
+                  "backtype.storm.security.auth.digest.DigestSaslTransportPlugin"]
+      (let [storm-conf (merge (read-storm-config)
+                              {STORM-THRIFT-TRANSPORT-PLUGIN "backtype.storm.security.auth.digest.DigestSaslTransportPlugin"
+                               "java.security.auth.login.config" "test/clj/backtype/storm/security/auth/jaas_digest.conf"
+                               Config/NIMBUS_HOST "localhost"
+                               Config/NIMBUS_THRIFT_PORT port
+                               STORM-NIMBUS-RETRY-TIMES 0})
+            client (NimbusClient/getConfiguredClient storm-conf)
+            nimbus_client (.getClient client)
+            topologyInitialStatus (TopologyInitialStatus/findByValue 2)
+            submitOptions (SubmitOptions. topologyInitialStatus)]
+        (is (thrown-cause? AuthorizationException (.submitTopology nimbus_client  "topo-name" nil nil nil)))
+        (is (thrown-cause? AuthorizationException (.submitTopologyWithOpts nimbus_client  "topo-name" nil nil nil submitOptions)))
+        (is (thrown-cause? AuthorizationException (.beginFileUpload nimbus_client)))
+        (is (thrown-cause? AuthorizationException (.uploadChunk nimbus_client nil nil)))
+        (is (thrown-cause? AuthorizationException (.finishFileUpload nimbus_client nil)))
+        (is (thrown-cause? AuthorizationException (.beginFileDownload nimbus_client nil)))
+        (is (thrown-cause? AuthorizationException (.downloadChunk nimbus_client nil)))
+        (is (thrown-cause? AuthorizationException (.getNimbusConf nimbus_client)))
+        (is (thrown-cause? AuthorizationException (.getClusterInfo nimbus_client)))
+        (stubbing [nimbus/check-storm-active! nil
+                   nimbus/try-read-storm-conf-from-name {}]
+          (is (thrown-cause? AuthorizationException (.killTopology nimbus_client "topo-name")))
+          (is (thrown-cause? AuthorizationException (.killTopologyWithOpts nimbus_client "topo-name" (KillOptions.))))
+          (is (thrown-cause? AuthorizationException (.activate nimbus_client "topo-name")))
+          (is (thrown-cause? AuthorizationException (.deactivate nimbus_client "topo-name")))
+          (is (thrown-cause? AuthorizationException (.rebalance nimbus_client "topo-name" nil))))
+        (stubbing [nimbus/try-read-storm-conf {}]
+          (is (thrown-cause? AuthorizationException (.getTopologyConf nimbus_client "topo-ID")))
+          (is (thrown-cause? AuthorizationException (.getTopology nimbus_client "topo-ID")))
+          (is (thrown-cause? AuthorizationException (.getUserTopology nimbus_client "topo-ID")))
+          (is (thrown-cause? AuthorizationException (.getTopologyInfo nimbus_client "topo-ID"))))
+        (.close client)))))


Made changes to collection generation in processing level id search test

--- test/cmr/system_int_test/search/collection_identifier_search_test.clj
+++ test/cmr/system_int_test/search/collection_identifier_search_test.clj
@@ -201,20 +201,11 @@

 ;; Create 2 collection sets of which only 1 set has processing-level-id
 (deftest processing-level-search-test
-  (let [[c1-p1 c2-p1 c3-p1 c4-p1] (for [p ["PROV1"]
-                                        n (range 1 5)]
-                                    (d/ingest p (dc/collection
-                                                  {:short-name (str "S" n)
-                                                   :version-id (str "V" n)
-                                                   :entry-title (str "ET" n)})))
+  (let [[c1-p1 c2-p1 c3-p1 c4-p1] (for [n (range 1 5)]
+                                    (d/ingest "PROV1" (dc/collection {})))
         ;; include preocessing level id
-        [c1-p2 c2-p2 c3-p2 c4-p2] (for [p ["PROV2"]
-                                        n (range 1 5)]
-                                    (d/ingest p (dc/collection
-                                                  {:short-name (str "S" n)
-                                                   :version-id (str "V" n)
-                                                   :entry-title (str "ET" n)
-                                                   :processing-level-id (str n "B")})))
+        [c1-p2 c2-p2 c3-p2 c4-p2] (for [n (range 1 5)]
+                                    (d/ingest "PROV2" (dc/collection {:processing-level-id (str n "B")})))
         all-prov2-colls [c1-p2 c2-p2 c3-p2 c4-p2]]
     (index/flush-elastic-index)
     (testing "processing level search"


make sure slash is present by default

make sure slash is present by default

--- src/adzerk/boot_reload/server.clj
+++ src/adzerk/boot_reload/server.clj
@@ -22,7 +22,7 @@
      (if (= "file:" protocol)
        (.getCanonicalPath (io/file target-path rel-path))
        (str
-        (if cljs-asset-path (str cljs-asset-path "/") "")
+        cljs-asset-path "/"
         (string/replace rel-path
                         (re-pattern (str "^" (string/replace (or asset-path "") #"^/" "") "/"))
                         ""))))))


Fix schema-spec retag

Fix schema-spec retag

--- src/spec/cljc/mikron/compiler/core_specs.cljc
+++ src/spec/cljc/mikron/compiler/core_specs.cljc
@@ -29,6 +29,16 @@
     (schema/derive-all schema/hierarchy
                        :simple-schema
                        [:number :char :boolean :nil :ignored :binary :string :keyword :symbol :any]))
+
+  (defn leaf-children
+    "Returns the leaf children of the given tag in the hierarchy, or the tag if it has no leaf children."
+    [hierarchy tag]
+    (let [children (descendants hierarchy tag)]
+      (if (empty? children)
+        [tag]
+        (filter (fn [tag']
+                  (empty? (descendants hierarchy tag')))
+                children))))

   (defmulti schema-spec
     "Returns a spec for a schema definition."
@@ -72,8 +82,14 @@
     some?)

   (s/def ::schema
-    (s/and #(empty? (descendants hierarchy %))
-           (s/multi-spec schema-spec raw-schema-name)))
+    (s/and (s/multi-spec schema-spec (fn [schema tag]
+                                       (if (= :custom tag)
+                                         schema
+                                         (let [tag' (rand-nth (leaf-children hierarchy tag))]
+                                           (if (= :simple-schema tag)
+                                             tag'
+                                             (into [tag'] (rest schema)))))))
+           #(empty? (descendants hierarchy %))))

   (s/def ::paths
     (s/and (s/or :tuple       (s/map-of nat-int? ::paths)


Pull out caching of batches into `cache-batch`

This fixes compilation under Datomic Ions which seems to have a bit more on the
stack than usual when compiling.


comment code

comment code

--- src/atom_finder/location_dump.clj
+++ src/atom_finder/location_dump.clj
@@ -54,9 +54,9 @@
 ;(->> "/Users/dgopstein/opt/src/gcc/contrib/paranoia.cc" location-dump-atoms-and-non-atoms (map prn))

 (defn now [] (java.util.Date.))
-(->> (now) println)
+'(->> (now) println)

-(->> gcc-path
+'(->> gcc-path
      (pmap-dir-files location-dump-atoms-and-non-atoms)
      (mapcat (partial map #(update % :node write-node)))
      (map #(merge %1 (if (:path %1) {:depth (count (:path %1))} {})))
@@ -95,7 +95,7 @@
         next-line-counts
       ))))

-(->> location-dump-data
+'(->> location-dump-data
      (take 50)
      (partition-by first)
      (map (fn [lst] [(first (first lst)) (map rest lst)]))


fix timeout when scraping bulbs

fix timeout when scraping bulbs

--- src/bonews_rest/scraper/bulbs.clj
+++ src/bonews_rest/scraper/bulbs.clj
@@ -5,7 +5,7 @@

 (def link-href [[:a (html/attr? :href)]])

-(defn get-bulbs-clickable?
+(defn bulbs-clickable?
   []
   (web/click (web/find-element {:css "input.bo_knows_bulbs_view_votes"}))
   (web/visible? "div.bo_knows_bulbs_voters"))
@@ -13,7 +13,7 @@
 (defn get-page-source
   [reply-url]
   (web/to reply-url)
-  (web/wait-until #(get-bulbs-clickable?))
+  (web/wait-until #(bulbs-clickable?))
   (utils/parse-page-source (web/page-source)))

 (defn get-username


Fixed typo

Fixed typo

--- src/clj/forma/hadoop/jobs/api.clj
+++ src/clj/forma/hadoop/jobs/api.clj
@@ -56,4 +56,4 @@
                            :sink-template "%s/%s"
                            :templatefields template-fields
                            :outfields out-fields)]
-    (?- sink (prob-series->csv-api est-map src static-src))))
+    (?- sink (prob-series->tsv-api est-map src static-src))))


Roll back duplicate records change - updated docs to include info about existing deduplication

--- src/clj/forma/hadoop/jobs/cdm.clj
+++ src/clj/forma/hadoop/jobs/cdm.clj
@@ -69,11 +69,13 @@
     The threshold number for valid detections (0-100, integer).
     `tres` - The input temporal resolution (string).  `tres-out` - The
     output temporal resolution (string).  `zoom` - The map zoom
-    level (integer).
+    level (integer). `min-period` ensures there are no duplicate records
+    due to resampling pixels to CDM.

   Example usage:
     (forma->cdm (hfs-seqfile \"/home/dan/Dropbox/local/output\")
                 (hfs-seqfile \"/tmp/forma/data/gadm-path\")
+                -9999.0
                 17
                 \"16\"
                 \"32\"
@@ -94,5 +96,5 @@
         (min-period ?rp :> ?p)
         (r/modis->latlon ?sres ?modh ?modv ?s ?l :> ?lat ?lon)
         (latlon-valid? ?lat ?lon)
-        (latlon->tile ?lat ?lon zoom :> ?x ?y ?z)
-        (:distinct true))))
+        (latlon->tile ?lat ?lon zoom :> ?x ?y ?z))))
+


Footer formatting tweak

Footer formatting tweak

--- src/clj/zetawar/views/common.cljc
+++ src/clj/zetawar/views/common.cljc
@@ -101,7 +101,7 @@
   [:div.container
    [:div#footer
     [:p
-     "Build "
+     "Build: "
      (if (not-empty site/build)
        [:a {:href (str "/builds/" site/build)} site/build]
        "DEV")]


reduce redundancy

reduce redundancy

--- src/cljs/apollo/client/pages.cljs
+++ src/cljs/apollo/client/pages.cljs
@@ -11,7 +11,6 @@
             [apollo.client.player :as player]
             [apollo.client.state :as state]
             [cljs.core.async :refer [<! put! chan]]))
-

 (defn left-column [data owner]
   (reify
@@ -32,8 +31,11 @@
             (om/build player/view-now-playing data)
             (om/build player/view-playlists data))])))))

-(defn browse-page [data owner]
-  (let [active-artist (:active-artist data)
+(defn view-browse [data owner]
+  (reify
+    om/IRender
+    (render [this]
+      (let [active-artist (:active-artist data)
         active-nav (:active-nav data)
         artists (:artists data)
         artist-count (count artists)
@@ -54,7 +56,4 @@
            (and (not (nil? active-artist)) (nil? active-album))
            (albums/album-list-partial active-artist albums)
            (not (nil? active-album))
-           (albums/album-detail active-artist active-album))]]]])))
-
-(defn view-browse [data owner]
-  (om/component (browse-page data owner)))
+           (albums/album-detail active-artist active-album))]]]])))))


Cleanup API.

Cleanup API.

--- src/cljs/clojure/browser/net.cljs
+++ src/cljs/clojure/browser/net.cljs
@@ -26,12 +26,13 @@
           (js->clj goog.net.EventType)))))

 (defprotocol IConnection
+  (connect [this] [this opt1])
   (transmit
-    [this uri]
-    [this uri method]
-    [this uri method content]
-    [this uri method content headers]
-    [this uri method content headers timeout])
+    [this opt]
+    [this opt opt2]
+    [this opt opt2 opt3]
+    [this opt opt2 opt3 opt4]
+    [this opt opt2 opt3 opt4 opt5])
   (close [this]))

 (extend-type goog.net.XhrIo
@@ -68,25 +69,26 @@
             v])
          (js->clj gxpc-config-fields))))

+(defn xhr-connection
+  "Returns a connection"
+  []
+  (goog.net.XhrIo.))
+
 (defprotocol CrossPageChannel
-  (register-service [this type fn] [this type fn encode-json?])
-
-  (connect [this fn])
-
-  (send-xpc [this type payload]))
+  (register-service [this type fn] [this type fn encode-json?]))

 (extend-type goog.net.xpc.CrossPageChannel

   CrossPageChannel
   (register-service [this type fn]
-    (listen-parent this type fn false))
+    (register-service this type fn false))
   (register-service [this type fn encode-json?]
-    (.registerService parent (name type) fn encode-json?))
+    (.registerService this (name type) fn encode-json?))

+  IConnection
   (connect [this fn]
     (.connect this fn))
-
-  (send-xpc [this type payload]
+  (transmit [this type payload]
     (.send this (name type) payload)))

 (defn cross-page-channel
@@ -99,8 +101,3 @@
                     (assoc (apply hash-map config)
                       :peer_uri
                       url)))))
-
-(defn xhr-connection
-  "Returns a connection"
-  []
-  (goog.net.XhrIo.))


Deleted the hello world code.

Deleted the hello world code.

--- src/cljs/lov_typeahead/hello.cljs
+++ src/cljs/lov_typeahead/hello.cljs
@@ -1,6 +0,0 @@
-(ns lov-typeahead.hello)
-
-(defn foo
-  "I don't do a whole lot."
-  [x]
-  (println x "Hello, World!"))


Fix bug: solved dialog appears when open new empty puzzle.

--- src/cljs/nonojure/puzzleview.cljs
+++ src/cljs/nonojure/puzzleview.cljs
@@ -337,14 +337,14 @@
       (dommy/toggle-class! el "num-clicked"))))

 (defn apply-progress [progress state]
-  (when-let [progress (progress (get-in state [:puzzle :id]))]
-   (let [state (if (= (keyword (:status progress)) :solved) (assoc state :solved? true) state)]
-     (if-let [saved-board (or (:auto progress) (:solution progress))]
-       (let [width (count (first saved-board))
-             height (count saved-board)]
-         (update-cells-region-style! [0 0] [(dec width) (dec height)] (fn [x y] (get-in saved-board [y x])))
-         (assoc state :board saved-board))
-       state))))
+  (let [progress (progress (get-in state [:puzzle :id]))
+        state (if (= (keyword (:status progress)) :solved) (assoc state :solved? true) state)]
+    (if-let [saved-board (or (:auto progress) (:solution progress))]
+      (let [width (count (first saved-board))
+            height (count saved-board)]
+        (update-cells-region-style! [0 0] [(dec width) (dec height)] (fn [x y] (get-in saved-board [y x])))
+        (assoc state :board saved-board))
+      state)))

 (defn add-handlers [event-chan root]
   (let [add-event (fn [event-type] #(put! event-chan [event-type %]))


small fix

small fix

--- src/cljs/salava/user/ui/data.cljs
+++ src/cljs/salava/user/ui/data.cljs
@@ -13,7 +13,7 @@
             [salava.user.ui.profile :as profile]
             [salava.core.ui.modal :as mo]
             [salava.core.i18n :refer [t translate-text]]
-            [clojure.string :refer [capitalize lower-case upper-case]]))
+            [clojure.string :refer [capitalize lower-case upper-case blank?]]))

 (defn export-data-to-pdf [state]
   (let [user-id (:user-id @state)]
@@ -63,8 +63,10 @@
            [:div.row
             [:div.col-xs-12 [:b (t :user/UserID)": "] id]
             [:div.col-xs-12 [:b (str (t :user/Role) ": ")] (if (= "user" role) (t :social/User) (t :admin/Admin))]
-            [:div.col-xs-12 [:b (str (t :user/Firstname)": ")] (capitalize first_name)]
-            [:div.col-xs-12 {:style {:margin-bottom "20px"}} [:b (str (t :user/Lastname)": ")] (capitalize last_name)]
+            (when-not (blank? first_name)
+              [:div.col-xs-12 [:b (str (t :user/Firstname)": ")] (capitalize first_name)])
+            (when-not (blank? last_name)
+              [:div.col-xs-12 {:style {:margin-bottom "20px"}} [:b (str (t :user/Lastname)": ")] (capitalize last_name)])
             (if (not-empty about)
               [:div
                [:div.col-xs-12 [:b (t :user/Aboutme) ":"]]
@@ -94,12 +96,13 @@
                                  (= "blog" field) (hyperlink value)
                                  :else (t value))]]))]]])

-            [:div.col-xs-12 [:b (t :user/Language)": "] (upper-case language)]
+            (when-not (blank? language) [:div.col-xs-12 [:b (t :user/Language)": "] (upper-case language)])
             [:div.col-xs-12 [:b (t :user/Country)": "] country]
             [:div.col-xs-12 [:b (str (t :user/Emailnotifications) ": ")]  (if (true? email_notifications) (t :core/Yes) (t :core/No)) #_(str email_notifications)]
             [:div.col-xs-12 [:b (str (t :user/Privateprofile) ": ")] (if (true? private) (t :core/Yes) (t :core/No))]
             [:div.col-xs-12 [:b (str (t :user/Activated) ": ")] (if (true? activated?) (t :core/Yes) (t :core/No))]
-            [:div.col-xs-12 {:style {:margin-bottom "20px"}} [:b (str (t :user/Profilevisibility) ": ")] (t (keyword (str "core/"(capitalize profile_visibility))))]]]]
+            (when-not (blank? profile_visibility)
+              [:div.col-xs-12 {:style {:margin-bottom "20px"}} [:b (str (t :user/Profilevisibility) ": ")] (t (keyword (str "core/"(capitalize profile_visibility))))])]]]

          [:div {:class "col-md-12 col-sm-9 col-xs-12"}
           [:h2 {:class "uppercase-header"} [:a {:href (path-for "/user/edit/email-addresses")} (str (if (empty? (rest email)) (t :user/Email) (t :user/Emailaddresses)))]]
@@ -219,7 +222,7 @@
                              [:td [:div (case (:type e)
                                           "page" (t :social/Emailpage)
                                           "badge" (t :social/Emailbadge)
-                                           "user" (lower-case (t :social/User))
+                                          "user" (lower-case (t :social/User))
                                           "admin" (lower-case (t :admin/Admin))
                                           "-")]]
                              [:td [:div (case (str (:verb e)(:type e))


lein profiles: bump deps

lein profiles: bump deps

--- lein_profiles.clj
+++ lein_profiles.clj
@@ -1,7 +1,7 @@
 {:user {:plugins [
-                  [lein-ring "0.8.10"]
+                  [lein-ring "0.8.11"]
                   [lein-ancient "0.5.5"]
-                  [jonase/eastwood "0.1.3"]
+                  [jonase/eastwood "0.1.4"]
                   [cider/cider-nrepl "0.7.0-SNAPSHOT"]
                   ]}}
 {:dev {:dependencies


(TK-31) Increase proxy request buffer size

Double the size of the request buffer on an HTTP Client. This
will fix the proxy issue that occurs when making a request
with an extremely large cookie like the one seen in TK-31.

--- src/puppetlabs/trapperkeeper/services/webserver/jetty9_core.clj
+++ src/puppetlabs/trapperkeeper/services/webserver/jetty9_core.clj
@@ -286,11 +286,13 @@
           (URI/create (.toString uri))))

       (newHttpClient []
-        (if custom-ssl-ctxt-factory
-          (HttpClient. custom-ssl-ctxt-factory)
-          (if-let [ssl-ctxt-factory (:ssl-context-factory @(:state webserver-context))]
-            (HttpClient. ssl-ctxt-factory)
-            (HttpClient.))))
+        (let [client (if custom-ssl-ctxt-factory
+                       (HttpClient. custom-ssl-ctxt-factory)
+                       (if-let [ssl-ctxt-factory (:ssl-context-factory @(:state webserver-context))]
+                         (HttpClient. ssl-ctxt-factory)
+                         (HttpClient.)))]
+          (.setRequestBufferSize client 8192)
+          client))

       (customizeProxyRequest [proxy-req req]
         (if-let [callback-fn (:callback-fn options)]


dat_contribution: get not neccesary

dat_contribution: get not neccesary

--- functions/src/wort/core.clj
+++ functions/src/wort/core.clj
@@ -11,7 +11,7 @@
 (defn get_words_from_key
   [payload key]
   (let [value (filter
-               #(> (count %) 0) (str/split (get payload key) #"[^\w]+"))]
+               #(> (count %) 0) (str/split (payload key) #"[^\w]+"))]
     (do
       (println value)
       value)))


string to int in snapshotId

string to int in snapshotId

--- src/cljs/org/broadinstitute/firecloud_ui/page/workspace/method_config_importer.cljs
+++ src/cljs/org/broadinstitute/firecloud_ui/page/workspace/method_config_importer.cljs
@@ -53,7 +53,7 @@
                             :headers {"Content-Type" "application/json"}
                             :payload {"configurationNamespace" selected-conf-namespace
                                       "configurationName" selected-conf-name
-                                      "configurationSnapshotId" (str selected-conf-snapshot-id)
+                                      "configurationSnapshotId" selected-conf-snapshot-id
                                       "destinationNamespace" dest-conf-namespace
                                       "destinationName" dest-conf-name}
                             :on-done (fn [{:keys [success? xhr]}]


cleanup; Updated element_visuals with icon-bar

--- src/visuals/untangled/ui/element_visuals.cljs
+++ src/visuals/untangled/ui/element_visuals.cljs
@@ -185,6 +185,26 @@
     (e/ui-icon {:size :xlarge} (icon :alarm))
     (e/ui-icon {:size :huge} (icon :alarm))))

+
+(defcard icon-bar-visual-regressions
+  (dom/div nil
+    (e/ui-icon-bar {}
+      (e/ui-icon-bar-item {:glyph :home :label "Home" :active true})
+      (e/ui-icon-bar-item {:glyph :description :label "Docs" :color :passive})
+      (e/ui-icon-bar-item {:glyph :feedback :label "Support"})
+      )
+    (e/ui-icon-bar {:shifting true}
+      (e/ui-icon-bar-item {:glyph :home :label "Home" :active true})
+      (e/ui-icon-bar-item {:glyph :description :label "Docs" :color :passive})
+      (e/ui-icon-bar-item {:glyph :feedback :label "Support"})
+      )
+    (dom/br nil)
+    (e/ui-icon-bar {:orientation :vertical}
+      (e/ui-icon-bar-item {:glyph :home :label "Home" :active true})
+      (e/ui-icon-bar-item {:glyph :description :label "Docs" :color :passive})
+      (e/ui-icon-bar-item {:glyph :feedback :label "Support"})
+      )))
+
 (defcard labels-visual-regressions
   (dom/div nil
     (for [color [:none :primary :accent]


~(defn parent-with-head): simplify

~(defn parent-with-head): simplify

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -60,10 +60,8 @@
   (grow (parent-with-head spec 0)))

 (defn grow
-  "recursively generate trees given
-   input trees. continue recursively
-   until no futher expansion is
-   possible."
+  "Recursively generate trees given input trees. continue recursively
+   until no futher expansion is possible."
   [trees]
   (if (not (empty? trees))
     ;; for each tree,
@@ -124,16 +122,15 @@
   "Return every possible tree of depth 1 from the given spec."
   [spec depth]
   ;; get all rules that match input _spec_:
-  (if (nil? spec) (throw (Exception. (str "nope: spec was nil."))))
-  (let [matching-rules
-        (->> grammar
-             (map #(unify % spec))
-             (filter #(not (= :fail %))))]
-    (->> matching-rules
-         ;; 2. try to add heads to each matching rule:
-         (parent-with-head-1 spec depth)
-         (filter #(not (= % :fail)))
-         (map #(u/assoc-in! % [::started?] true)))))
+  (if (nil? spec) (throw (Exception. (str "nope: spec was nil.")))
+      (->> grammar
+           (map #(unify % spec))
+           (filter #(not (= :fail %)))
+
+           ;; try to add heads to each matching rule:
+           (parent-with-head-1 spec depth)
+           (filter #(not (= % :fail)))
+           (map #(u/assoc-in! % [::started?] true)))))

 (defn parent-with-head-1 [spec depth parent-rules]
   (if (not (empty? parent-rules))


pass along max-total-depth in various functions

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -84,22 +84,22 @@
     (if truncate-children
       (->
        (lightning-bolts language-model spec 0 total-depth :max-total-depth max-total-depth)
-       (add-all-comps language-model total-depth true)
+       (add-all-comps language-model total-depth true max-total-depth)
        (truncate-expressions [[:head]]))
       (->
        (lightning-bolts language-model spec 0 total-depth :max-total-depth max-total-depth)
-       (add-all-comps language-model total-depth false)))))
-
-(defn add-all-comps [bolts language-model total-depth truncate-children]
+       (add-all-comps language-model total-depth false max-total-depth)))))
+
+(defn add-all-comps [bolts language-model total-depth truncate-children max-total-depth]
   (log/trace (str "add-all-comps with (empty? bolts): " (empty? bolts)))
   (lazy-mapcat
    (fn [bolt]
      (add-all-comps-with-paths [bolt] language-model total-depth
                                (find-comp-paths-in bolt [:head])
-                               truncate-children))
+                               truncate-children max-total-depth))
    bolts))

-(defn add-all-comps-with-paths [bolts language-model total-depth comp-paths truncate-children]
+(defn add-all-comps-with-paths [bolts language-model total-depth comp-paths truncate-children max-total-depth]
   (log/trace (str "add-all-comps-with-paths with (empty? bolts): "
                   (empty? bolts)))
   (if (not (empty? comp-paths))
@@ -117,7 +117,8 @@
        language-model
        total-depth
        (rest comp-paths)
-       truncate-children))
+       truncate-children
+       max-total-depth))
     bolts))

 (defn find-comp-paths-in [bolt path]
@@ -231,7 +232,7 @@
                                      (over/overh parent (mapfn copy (shuffle candidate-lexemes)))))))
                        parents)
           phrasal ;; 2. generate list of all phrases where the head child of each parent is itself a phrase.
-          (if (and (< depth max-total-depth)
+          (if (and (< total-depth max-total-depth)
                    (= true (get-in spec [:head :phrasal] true)))
             (lazy-mapcat (fn [parent]
                            (over/overh parent


use dag_unify/assoc-in! rather than dag_unify/assoc-in for performance

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -63,7 +63,7 @@
                      (cons bolt
                            (->> (keys bolt-and-comps)
                                 (map (fn [path]
-                                       (let [result (assoc-in bolt path (get bolt-and-comps path))]
+                                       (let [result (assoc-in! bolt path (get bolt-and-comps path))]
                                          (if (= true truncate)
                                            (dissoc-paths result [path])
                                            result))))))))))


Do not deprecate hash/sha1 and hash/md5

Do not deprecate hash/sha1 and hash/md5

SHA1 and MD5 algorithms are deprecated, but the functions are not: they
will be used for a long time for maintaining compatibility with obsolete
data formats and protocols (See #22)

--- src/buddy/core/hash.clj
+++ src/buddy/core/hash.clj
@@ -241,11 +241,9 @@
   (digest input :sha3-512))

 (defn sha1
-  {:deprecated true}
   [input]
   (digest input :sha1))

 (defn md5
-  {:deprecated true}
   [input]
   (digest input :md5))


Fix sys stats cookie being lost from UI requests

--- storm-core/src/clj/backtype/storm/ui/core.clj
+++ storm-core/src/clj/backtype/storm/ui/core.clj
@@ -803,7 +803,7 @@
         ))))

 (def app
-  (-> #'main-routes
+  (-> main-routes
       (wrap-reload '[backtype.storm.ui.core])
       catch-errors))


(maint) Cleanup imports

(maint) Cleanup imports

--- test/puppetlabs/trapperkeeper/services/authorization/authorization_service_test.clj
+++ test/puppetlabs/trapperkeeper/services/authorization/authorization_service_test.clj
@@ -9,8 +9,7 @@
     [puppetlabs.trapperkeeper.testutils.bootstrap :refer [with-app-with-config]]
     [puppetlabs.trapperkeeper.testutils.logging :refer [with-test-logging]]
     [ring.util.response :refer [response]]
-    [schema.test :as schema-test]
-    [puppetlabs.trapperkeeper.authorization.rules :as rules]))
+    [schema.test :as schema-test]))

 (use-fixtures :once schema-test/validate-schemas)


Update complex_numbers_test.clj (#458)

Update complex_numbers_test.clj (#458)

align test-cases with the sources so it's a more fluid workflow

--- exercises/practice/complex-numbers/test/complex_numbers_test.clj
+++ exercises/practice/complex-numbers/test/complex_numbers_test.clj
@@ -1,6 +1,80 @@
 (ns complex-numbers-test
   (:require [clojure.test :refer [deftest is testing]]
             [complex-numbers :as c]))
+
+;; Tests for Real Part
+(deftest real-of-purely-real-number
+  (testing "Real part of a purely real number"
+    (is (= (c/real [1 0])
+           1))))
+
+(deftest real-of-purely-imaginary-number
+  (testing "Real part of a purely imaginary number"
+    (is (= (c/real [0 1])
+           0))))
+
+(deftest real-of-real-and-imaginary-number
+  (testing "Real part of a number with real and imaginary part"
+    (is (= (c/real [1 2])
+           1))))
+
+;; Tests for Imaginary Part
+(deftest imaginary-of-purely-real-number
+  (testing "Imaginary part of a purely real number"
+    (is (= (c/imaginary [1 0])
+           0))))
+
+(deftest imaginary-of-purely-imaginary-number
+  (testing "Imaginary part of a purely imaginary number"
+    (is (= (c/imaginary [0 1])
+           1))))
+
+(deftest imaginary-of-real-and-imaginary-number
+  (testing "Imaginary part of a number with real and imaginary part"
+    (is (= (c/imaginary [1 2])
+           2))))
+
+;; Tests for Absolute Value
+(deftest absolute-of-positive-purely-real-number
+  (testing "Absolute value of a positive purely real number"
+    (is (= (c/abs [5 0])
+           5.0))))
+
+(deftest absolute-of-negative-purely-real-number
+  (testing "Absolute value of a negative purely real number"
+    (is (= (c/abs [-5 0])
+           5.0))))
+
+(deftest absolute-of-positive-purely-imaginary-number
+  (testing "Absolute value of a purely imaginary number with positive imaginary part"
+    (is (= (c/abs [0 5])
+           5.0))))
+
+(deftest absolute-of-negative-purely-imaginary-number
+  (testing "Absolute value of a purely imaginary number with negative imaginary part"
+    (is (= (c/abs [0 -5])
+           5.0))))
+
+(deftest absolute-of-real-and-imaginary-number
+  (testing "Absolute value of a number with real and imaginary part"
+    (is (= (c/abs [3 4])
+           5.0))))
+
+;; Tests for Conjugate
+(deftest conjugate-of-purely-real-number
+  (testing "Conjugate a purely real number"
+    (is (= (c/conjugate [5 0])
+           [5 0]))))
+
+(deftest conjugate-of-purely-imaginary-number
+  (testing "Conjugate a purely imaginary number"
+    (is (= (c/conjugate [0 5])
+           [0 -5]))))
+
+(deftest conjugate-of-real-and-imaginary-number
+  (testing "Conjugate a number with real and imaginary part"
+    (is (= (c/conjugate [1 1])
+           [1 -1]))))

 ;; Tests for Addition
 (deftest add-purely-real-numbers
@@ -65,77 +139,3 @@
   (testing "Divide numbers with real and imaginary part"
     (is (= (c/div [1 2] [3 4])
            [0.44 0.08]))))
-
-;; Tests for Absolute Value
-(deftest absolute-of-positive-purely-real-number
-  (testing "Absolute value of a positive purely real number"
-    (is (= (c/abs [5 0])
-           5.0))))
-
-(deftest absolute-of-negative-purely-real-number
-  (testing "Absolute value of a negative purely real number"
-    (is (= (c/abs [-5 0])
-           5.0))))
-
-(deftest absolute-of-positive-purely-imaginary-number
-  (testing "Absolute value of a purely imaginary number with positive imaginary part"
-    (is (= (c/abs [0 5])
-           5.0))))
-
-(deftest absolute-of-negative-purely-imaginary-number
-  (testing "Absolute value of a purely imaginary number with negative imaginary part"
-    (is (= (c/abs [0 -5])
-           5.0))))
-
-(deftest absolute-of-real-and-imaginary-number
-  (testing "Absolute value of a number with real and imaginary part"
-    (is (= (c/abs [3 4])
-           5.0))))
-
-;; Tests for Conjugate
-(deftest conjugate-of-purely-real-number
-  (testing "Conjugate a purely real number"
-    (is (= (c/conjugate [5 0])
-           [5 0]))))
-
-(deftest conjugate-of-purely-imaginary-number
-  (testing "Conjugate a purely imaginary number"
-    (is (= (c/conjugate [0 5])
-           [0 -5]))))
-
-(deftest conjugate-of-real-and-imaginary-number
-  (testing "Conjugate a number with real and imaginary part"
-    (is (= (c/conjugate [1 1])
-           [1 -1]))))
-
-;; Tests for Real Part
-(deftest real-of-purely-real-number
-  (testing "Real part of a purely real number"
-    (is (= (c/real [1 0])
-           1))))
-
-(deftest real-of-purely-imaginary-number
-  (testing "Real part of a purely imaginary number"
-    (is (= (c/real [0 1])
-           0))))
-
-(deftest real-of-real-and-imaginary-number
-  (testing "Real part of a number with real and imaginary part"
-    (is (= (c/real [1 2])
-           1))))
-
-;; Tests for Imaginary Part
-(deftest imaginary-of-purely-real-number
-  (testing "Imaginary part of a purely real number"
-    (is (= (c/imaginary [1 0])
-           0))))
-
-(deftest imaginary-of-purely-imaginary-number
-  (testing "Imaginary part of a purely imaginary number"
-    (is (= (c/imaginary [0 1])
-           1))))
-
-(deftest imaginary-of-real-and-imaginary-number
-  (testing "Imaginary part of a number with real and imaginary part"
-    (is (= (c/imaginary [1 2])
-           2))))


ignoring unknown keys

ignoring unknown keys

--- src/aws/provider.clj
+++ src/aws/provider.clj
@@ -80,8 +80,8 @@
 (defn set-hostname [spec endpoint instance-id user]
   "Uses a generic method of setting hostname in Linux"
   (let [hostname (get-in spec [:machine :hostname]) remote {:host (pub-dns endpoint instance-id) :user user}]
-    (execute (<< "echo kernel.hostname=~{hostname} | sudo tee -a /etc/sysctl.conf") remote )
-    (execute "sudo sysctl -p" remote)
+    (execute (<< "echo kernel.hostname = ~{hostname} | sudo tee -a /etc/sysctl.conf") remote )
+    (execute "sudo sysctl -e -p" remote)
     (ec2 create-tags [(instance-desc endpoint instance-id :id)] {:Name hostname})
     ))


(defn roots) needs a lexicon, not a language model

--- src/babel/latin.cljc
+++ src/babel/latin.cljc
@@ -106,8 +106,7 @@
        {:synsem {:sem {:subj {:pred (first (shuffle subjects))}}}})
    (or (and (get-in base-spec [:root])
             base-spec)
-       {:root (first (shuffle (roots model)))})))
-
+       {:root (first (shuffle (roots (:lexicon model))))})))

 (defn intersection [spec curriculum model]
   (cond false ;; TODO implement this stub and set to true


add great usage resource

add great usage resource

--- src/bolt/config.cljs
+++ src/bolt/config.cljs
@@ -23,6 +23,7 @@
     :twitter {:url "https://twitter.com/search?q=%s"}
     :urbandictionary {:alias "urban" :url "http://www.urbandictionary.com/define.php?term=%s"}
     :github-lucky {:alias "ghl" :url "http://tagaholic.me/github-lucky/?query=%s"}
+    :crossclj {:alias "cclj" :url "http://crossclj.info/search?q=%s"}

     ;; not used on phone
     :google-group {:alias "ggs" :url "http://groups.google.com/groups/dir?q=%s"}


Horizontally oriented acceleration and cleanup.

--- src/canvas/main.cljs
+++ src/canvas/main.cljs
@@ -43,11 +43,6 @@
 (defn by-id
   [id]
   (.getElementById js/document id))
-
-(defn attr!
-  [el attr val]
-  (aset el attr val)
-  el)

 (defn listen!
   [el type fn]
@@ -231,23 +226,15 @@

 (defn draw-phase!
   [state ctx]
-  ;;
-  ;; Always
   (.clearRect ctx 0 0 SCALE-W SCALE-H)
   (draw! (:background @state) ctx)
-  ;;
-  ;; While playing and game-over
   (when (contains? #{:playing :game-over} (:mode @state))
     (draw! (:score-2 @state) ctx)
     (draw! (:score-1 @state) ctx))
-  ;;
   (when (contains? #{:game-over} (:mode @state))
     (draw! (:game-over @state) ctx))
-  ;;
   (when (contains? #{:game-start} (:mode @state))
     (draw! (:game-start @state) ctx))
-  ;;
-  ;; While playing.
   (when (contains? #{:playing} (:mode @state))
     (draw! (:net @state) ctx)
     (draw! (:paddle-1 @state) ctx)
@@ -279,8 +266,9 @@
   (if (or (hit? ball paddle-1 :right)
           (hit? ball paddle-2 :left))
     (let [{:keys [vx vy]} ball
+          delta (rand-nth [0.3 0.5 0.7])
           vxf (if (< vx 0) dec inc)
-          vyf (if (< vy 0) dec inc)]
+          vyf (if (< vy 0) #(- % delta) #(+ % delta))]
       (assoc state :ball (assoc ball :vx (* -1 (vxf vx)) :vy (vyf vy))))
     state))

@@ -312,9 +300,6 @@
     (when (= (:mode @state) :playing)
       (swap! state #(-> % move-phase! collision-phase! score-phase!)))
     (draw-phase! state ctx))
-  ;; (set! (.-innerHTML (by-id "debug"))
-  ;;       (apply str (for [[k v] @state]
-  ;;                    (str k ": " (pr-str v) "<br/>"))))
   (.requestAnimationFrame js/window (partial animate-loop! state ctx)))

 ;;-----------------------------------------------------------------------------
@@ -324,10 +309,10 @@
 (defn resize!
   [state ctx]
   (let [w (- (.-innerWidth js/window) 40)
-        h (- (int (/ (* w 9) 16)) 40)]
-    (-> (by-id "canvas")
-        (attr! "width" w)
-        (attr! "height" h))
+        h (- (int (/ (* w 9) 16)) 40)
+        canvas (by-id "canvas")]
+    (aset canvas "width" w)
+    (aset canvas "height" h)
     (.scale ctx (/ w SCALE-W) (/ h SCALE-H))
     (draw-phase! state ctx)))

@@ -340,13 +325,11 @@
         (swap! state #(if (:pause? %)
                         (assoc % :pause? false)
                         (assoc % :mode :game-start)))
-        ;;
         (= :space event)
         (swap! state #(case (:mode %)
                         :game-start (merge % objects {:mode :playing})
                         :game-over (assoc % :mode :game-start)
                         (assoc % :pause? (not (:pause? %)))))
-        ;;
         :else
         (println "Unhandled event:" event))
       (recur))))
@@ -366,7 +349,7 @@

 (defn- paddle-grab!
   [state e]
-  (aset (.-style (by-id "canvas")) "cursor" "pointer")
+  (aset (.-style (by-id "canvas")) "cursor" "ns-resize")
   (let [x (.-clientX e)
         ww (/ (.-innerWidth js/window) 2)
         status (if (>= x ww) :paddle-2 :paddle-1)]
@@ -388,11 +371,11 @@
         ctx (.getContext canvas "2d")
         events (chan 1 key-stroke-stream)]
     (event-loop! state events)
-    (listen! js/window   "resize"  #(resize! state ctx))
-    (listen! js/document "keydown" #(put! events (.-keyCode %)))
+    (listen! js/window   "resize"    #(resize! state ctx))
+    (listen! js/document "keydown"   #(put! events (.-keyCode %)))
     (listen! canvas      "mousemove" #(paddle-move! state %))
     (listen! canvas      "mousedown" #(paddle-grab! state %))
-    (listen! canvas      "mouseup" #(paddle-release! state %))
+    (listen! canvas      "mouseup"   #(paddle-release! state %))
     (resize! state ctx)
     (animate-loop! state ctx)))


Add the correct order function

Add the correct order function

--- src/catalog/core.clj
+++ src/catalog/core.clj
@@ -48,7 +48,7 @@
 (defn hörfilme-all [in out]
   (-> in
    vubis/read-file
-   (vubis/order-and-group vubis/get-update-keys-hörfilm-ludo)
+   (vubis/order-and-group vubis/get-update-keys-hörfilm)
    (layout.fop/document :hörfilm nil nil)
    (layout.fop/generate-pdf! out)))


Extract frequencies and cents from real wav file. FAST

--- src/clojure/core.clj
+++ src/clojure/core.clj
@@ -96,18 +96,21 @@
   )

-(let [path               "test/fixtures/test.wav"  ;;             "test/fixtures/the_nature_of_sound.wav"
+(let [path                    "test/fixtures/test.wav"  ;;             "test/fixtures/the_nature_of_sound.wav"
       s                       (sample/read-sound path)
-      data   (sample/chunks s 48000)

-      data-slice (ffirst data)
-      data-size (count data-slice)
       MFCC_FREQ_BANDS (double 13)
       MFCC_FREQ_MIN (double 20)
       MFCC_FREQ_MAX (double 20000)
       MFCC_FREQ_BANDS 13
       SAMPLERATE 44100
+
+      data   (sample/chunks s SAMPLERATE)
+      data-slice (ffirst data)
+      data-size (count data-slice)
+
       block-size 512
+      half-block-size (/ 512 2)

       mel-filters  (xtract/create_filterbank  MFCC_FREQ_BANDS block-size)]

@@ -120,17 +123,47 @@
   ;; int freq_bands,
   ;; SWIGTYPE_p_p_double fft_tables)

-  (xtract/xtract_init_mfcc block-size
-                           SAMPLERATE
+  (xtract/xtract_init_mfcc (/ block-size 2)
+                           (/ SAMPLERATE 2)
                            xtract-equal-gain
                            MFCC_FREQ_MIN
                            MFCC_FREQ_MAX
                            MFCC_FREQ_BANDS
                            (xtract_mel_filter/.getFilters mel-filters))

-;;    public static xtract_mel_filter create_filterbank(int n_filters, int blocksize) {
+  (let [w    (xtract/xtract_init_window block-size xtract-hann)
+        subw (xtract/xtract_init_window half-block-size xtract-hann)
+        argv (make-double [(double SAMPLERATE)])
+        ]

+    ;;LEAKING ALL THE MEMORY
+    (xtract/xtract_init_wavelet_f0_state)

+    (doseq [s data]
+      (doseq [v s]
+        (let [ds (make-double (vec v))
+              r    (double-array [1])]
+          (xtract/xtract_wavelet_f0 ds block-size (xtract/doublea_to_voidp argv) r)
+          (let [f0 (first (vec r))]
+            (xtract/xtract_midicent nil 0 (xtract/doublea_to_voidp (make-double (vec r))) r)
+            (let [cents (first (vec r))]
+              (when (not= f0 0.0)
+                (println "f0   : " f0)
+                (println "cents: " (/ cents 100)))))
+          )))

-   (println data-slice)
-   )
+    (xtract/xtract_free_window w)
+    (xtract/xtract_free_window subw)
+    (xtract/destroy_filterbank mel-filters)
+    ))
+
+;;f0: 167.04545454545453
+;;f0: 196.875
+;;f0: 303.440366972477
+;;f0: 263.54581673306774
+;;f0: 263.44086021505376
+;;f0: 264.86486486486484
+;;f0: 266.0633484162896
+;;f0: 263.54581673306774
+;;f0: 263.2835820895522
+;;f0: 258.3984375


removed stale code

removed stale code

--- src/euler/prob58.clj
+++ src/euler/prob58.clj
@@ -5,15 +5,6 @@

 (defn count-primes [nums]
   (count (filter is-prime? nums)))
-
-(comment
-  (let [n (count nums)]
-    (loop [p 0 i 0]
-      (if (>= i n)
-        p
-        (if (is-prime? (nth nums i))
-          (recur (inc p) (inc i))
-          (recur p (inc i)))))))

 (defn D [^long n] ;; 4n^2 + 4n + 1 = (2n+1)^2
   (if (zero? n) 1
@@ -46,10 +37,6 @@
           d (D n)
           nprms (+ nprms (count-primes [a b c])) ; d is never prime
           ratio (double (/ nprms nums))]
-      ;; (if (or
-      ;;      (< n 10)
-      ;;      (zero? (mod n 300)))
-      ;;   (println n a b c d " [" nprms "/" nums "] " ratio))
       (if (and (> n 0)
                (< ratio threshold))
         (do


Fix one bug related to alpha and beta order

1. Fix the order of alpha and beta order in the output arrays
2. Add code reverse calculate the x y z from the alpha beta theta

--- src/calc_angle/core.clj
+++ src/calc_angle/core.clj
@@ -1,7 +1,7 @@
 (ns calc-angle.core
- (:require [clojure.string :as string]
-           [clojure.core.reducers :as r])
- (:gen-class))
+  (:require [clojure.string :as string]
+            [clojure.core.reducers :as r])
+  (:gen-class))

 (declare radian-to-degree)

@@ -38,50 +38,53 @@
   (int (+ ang 0.5)))

 (defn get-first-angle [ang]
-  (int (+ (map-angle first-angle-map ang) 0.5)))
+  (map-angle first-angle-map ang))

 (defn get-second-angle [ang]
-  (int (+ (map-angle second-angle-map ang) 0.5)))
+  (map-angle second-angle-map ang))

 (defn get-base-angle [ang]
-  (int (+ (map-angle base-angle-map ang) 0.5)))
+  (map-angle base-angle-map ang))

 (defn normalize-angle [ang]
- (loop [a ang]
-  (if (and (not (neg? a)) (< a (* 2 PI)))
-   a
-   (recur (+ a (if (neg? a) (* 2 PI) (* -2 PI)))))))
+  (loop [a ang]
+    (if (and (not (neg? a)) (< a (* 2 PI)))
+      a
+      (recur (+ a (if (neg? a) (* 2 PI) (* -2 PI)))))))

 (defn calc-cos-beta [r z]
- (let [z2 (* z z)
-       r2 (* r r)
-       a (/
-           (+ (- (* first-arm first-arm) (* second-arm second-arm)) z2 r2)
-           (* 2 first-arm))
-       sqrt (Math/sqrt
-           (-
-            (+ z2 r2)
-            (* a a)))]
-  (/ (- (* a r) (* z sqrt)) (+ z2 r2))))
+  (let [z2 (* z z)
+        r2 (* r r)
+        a (/
+            (+ (- (* first-arm first-arm) (* second-arm second-arm)) z2 r2)
+            (* 2 first-arm))
+        sqrt (Math/sqrt
+               (-
+                 (+ z2 r2)
+                 (* a a)))]
+    (/ (- (* a r) (* z sqrt)) (+ z2 r2))))

 (defn radian-to-degree [ang]
- (/ (* 180. ang) PI))
+  (/ (* 180. ang) PI))
+
+(defn degree-to-radian [ang]
+  (/ (* PI ang) 180.))

 (defn calc-alpha-beta [r z]
- (let [cos-beta (calc-cos-beta r z)
-       sin-beta (Math/sqrt (- 1 (* cos-beta cos-beta)))
-       cos-gamma (/ (- (* first-arm sin-beta) z) second-arm)]
-  (list (- (/ PI 2.) (Math/acos cos-gamma)) (Math/acos cos-beta))))
+  (let [cos-beta (calc-cos-beta r z)
+        sin-beta (Math/sqrt (- 1 (* cos-beta cos-beta)))
+        cos-gamma (/ (- (* first-arm sin-beta) z) second-arm)]
+    (list (- (/ PI 2.) (Math/acos cos-gamma)) (Math/acos cos-beta))))

 (defn display-alpha-beta [alpha beta]
- (println (str "first-arm*cos(beta)=" (* first-arm (Math/cos beta))))
- (println (str "second-arm*cos(alpha)=" (* second-arm (Math/cos alpha))))
- (println (str "first-arm*sin(beta)=" (* first-arm (Math/sin beta))))
- (println (str "second-arm*sin(alpha)=" (* second-arm (Math/sin alpha)))))
+  (println (str "first-arm*cos(beta)=" (* first-arm (Math/cos beta))))
+  (println (str "second-arm*cos(alpha)=" (* second-arm (Math/cos alpha))))
+  (println (str "first-arm*sin(beta)=" (* first-arm (Math/sin beta))))
+  (println (str "second-arm*sin(alpha)=" (* second-arm (Math/sin alpha)))))

 (defn calc-r-theta [x y]
- (let [r (Math/sqrt (+ (* x x) (* y y)))]
-  (list r (radian-to-degree (Math/asin (/ (- x) r))))))
+  (let [r (Math/sqrt (+ (* x x) (* y y)))]
+    (list r (radian-to-degree (Math/asin (/ (- x) r))))))

 ;;; Code used to calculate the map between servo angle and arm angle
 ;(def exper-data {40 {60 [13.7 11.1]   65 [13.95 9.95]  70 [13.84 8.35]  75 [13.75 6.7]   80 [13.65 5.25]  85 [13.55 4.1]}
@@ -130,12 +133,12 @@
                   (- (second pt2) (second pt1))))))

 (defn mix-pts [pt1 ratio1 pt2 ratio2]
- (list (+
-         (* ratio1 (first pt1))
-         (* ratio2 (first pt2)))
-       (+
-         (* ratio1 (second pt1))
-         (* ratio2 (second pt2)))))
+  (list (+
+          (* ratio1 (first pt1))
+          (* ratio2 (first pt2)))
+        (+
+          (* ratio1 (second pt1))
+          (* ratio2 (second pt2)))))

 (defn preprocess-stroke [stroke]
   (defn append-point [stroke-arr new-tail]
@@ -176,6 +179,14 @@
   (doseq [stroke strokes]
     (println (str "   " (doall stroke)))))

+(defn calc-xyz [alpha beta theta]
+  (let [alpha-rad (degree-to-radian alpha)
+        beta-rad  (degree-to-radian beta)
+        theta-rad (degree-to-radian theta)
+        r (+ (* (Math/cos beta-rad) first-arm) (* (Math/cos alpha-rad) second-arm))
+        y (+ (* (Math/sin beta-rad) first-arm) (* (Math/sin (- alpha-rad)) second-arm))]
+    (list (* r (Math/cos theta-rad)) y (* r (Math/sin (- theta-rad))))))
+
 (defn -main
   "main function"
   [& args]
@@ -190,12 +201,16 @@
           strokes-z (reduce concat strokes-gaps)
           r-theta-list (map #(apply calc-r-theta %) (map (fn [x] (take 2 x)) strokes-z))
           alpha-beta-radian-list (map #(calc-alpha-beta (first %1) %2) r-theta-list (map (fn [x] (last x)) strokes-z))
-          alpha-beta-degree-list (map (fn [[alpha beta]] (list (get-second-angle (radian-to-degree alpha)) (get-first-angle (radian-to-degree beta)))) alpha-beta-radian-list)]
+          alpha-beta-degree-list (map (fn [[alpha beta]] (list (get-second-angle (radian-to-degree alpha)) (get-first-angle (radian-to-degree beta)))) alpha-beta-radian-list)
+          reverse-xyz (map (fn [[alpha beta] [_ theta]] (calc-xyz alpha beta theta)) alpha-beta-degree-list r-theta-list)]
       (dump-strokes strokes "strokes")
       (dump-strokes gaps "gaps")
       (dump-strokes strokes1 "strokes after preprocess")
       (dump-strokes strokes-gaps "strokes gaps interleaved")
       (dump-strokes strokes-z "strokes-z")
+      (dump-strokes alpha-beta-degree-list "alpha beta degree list")
+      (dump-strokes r-theta-list "r theta list")
+      (dump-strokes reverse-xyz "reverse-xyz")
       (with-open [fin (clojure.java.io/reader "resources/machine_arm.ino")
                   fout (clojure.java.io/writer "target/machine_arm.ino")]
         (doseq [line (line-seq fin)]
@@ -204,12 +219,12 @@
           (when (= line "// Insert Arrays Here")
             (.write fout
                     (with-out-str
-                      (println (str "var betas = [" (string/join "," (map #(str (first %)) alpha-beta-degree-list)) "];"))
-                      (println (str "var alphas = [" (string/join "," (map #(str (second %)) alpha-beta-degree-list)) "];"))
+                      (println (str "var alphas = [" (string/join "," (map #(str (first %)) alpha-beta-degree-list)) "];"))
+                      (println (str "var betas = [" (string/join "," (map #(str (second %)) alpha-beta-degree-list)) "];"))
                       (println (str "var delta_thetas = [" (string/join "," (map #(str (get-base-angle (second %))) r-theta-list)) "];"))))
-                      ;(println (str "const int betas[] PROGMEM = {" (string/join "," (map #(str (first %)) alpha-beta-degree-list)) "};"))
-                      ;(println (str "const int alphas[] PROGMEM = {" (string/join "," (map #(str (second %)) alpha-beta-degree-list)) "};"))
-                      ;(println (str "const int delta_thetas[] PROGMEM = {" (string/join "," (map #(str (get-base-angle (second %))) r-theta-list)) "};"))))
+            ;(println (str "const int alphas[] PROGMEM = {" (string/join "," (map #(str (first %)) alpha-beta-degree-list)) "};"))
+            ;(println (str "const int betas[] PROGMEM = {" (string/join "," (map #(str (second %)) alpha-beta-degree-list)) "};"))
+            ;(println (str "const int delta_thetas[] PROGMEM = {" (string/join "," (map #(str (get-base-angle (second %))) r-theta-list)) "};"))))
             (.write fout "\n")))))))

 ;(defn -main1


Fix the spec of workflo.macros.query.om-next/property-query

--- src/main/workflo/macros/query/om_next.cljc
+++ src/main/workflo/macros/query/om_next.cljc
@@ -30,7 +30,7 @@
                     (second (:ret %)))))))

 (s/fdef property-query
-  :args (s/cat :prop ::parsed-query/property
+  :args (s/cat :prop ::parsed-query/typed-property
                :gen-type #{:clj :cljs :clj->cljs})
   :ret ::om-query/property
   :fn ::property-query-from-parsed-property)


workaround firefox negotiationneeded bug

https://bugzilla.mozilla.org/show_bug.cgi?id=1071643.

--- src-cljs/frontend/rtc.cljs
+++ src-cljs/frontend/rtc.cljs
@@ -152,13 +152,21 @@
 (defn conn-id [stream-id producer consumer]
   {:stream-id stream-id :consumer consumer :producer producer})

+(defn workaround-firefox-negotiation-bug
+  "Firefox won't fire negotiationneeded after adding a stream:
+   https://bugzilla.mozilla.org/show_bug.cgi?id=1071643.
+   Fixed, but not widely released"
+  [conn signal-fn]
+  (let [negotiation-timer (js/window.setTimeout #(handle-negotiation conn signal-fn) 10)]
+    (.addEventListener conn "negotiationneeded" #(js/window.clearTimeout negotiation-timer))))
+
 (defn setup-producer [{:keys [signal-fn stream producer consumer]}]
   (let [conn (new-peer-conn)
         id (conn-id (.-id stream) producer consumer)]
     (swap! conns assoc id {:conn conn :consumer consumer :producer producer :stream-id (.-id stream)})
     (setup-listeners conn id signal-fn)
-    (add-stream conn stream)
-    (handle-negotiation conn signal-fn)))
+    (workaround-firefox-negotiation-bug conn signal-fn)
+    (add-stream conn stream)))

 (defn get-or-create-peer-conn [signal-fn stream-id producer consumer]
   (let [id (conn-id stream-id producer consumer)


Another test for Indicator

Another test for Indicator

--- test/cia/handler_test.clj
+++ test/cia/handler_test.clj
@@ -227,7 +227,7 @@
                      :id
                      :timestamp)))

-      (testing "GET /cia/indicator"
+      (testing "GET /cia/indicator/:id"
         (let [response (get (str "cia/indicator/" (:id indicator)))
               indicator (:parsed-body response)]
           (is (= 200 (:status response)))
@@ -237,7 +237,13 @@
                   :type ["C2" "IP Watchlist"]}
                  (dissoc indicator
                          :id
-                         :timestamp))))))))
+                         :timestamp)))))
+
+      (testing "DELETE /cia/indicator/:id"
+        (let [response (delete (str "cia/indicator/" (:id indicator)))]
+          (is (= 204 (:status response)))
+          (let [response (get (str "cia/indicator/" (:id indicator)))]
+            (is (= 404 (:status responseg)))))))))

 (deftest test-judgement-routes
   (testing "POST /cia/judgement"


Sort subscriptions in a more pleasing manner

--- src/day8/re_frame/trace/subs.cljs
+++ src/day8/re_frame/trace/subs.cljs
@@ -411,17 +411,40 @@

-(defn sub-sort-val
+(defn sub-type-value
   [sub-type]
   (case sub-type
-    :created 1
-    :re-run 2
-    :destroyed 3
-    :not-run 4))
-
-(def subscription-comparator
-  (fn [x y]
-    (compare (sub-sort-val x) (sub-sort-val y))))
+    :sub/create 5
+    :sub/run 4
+    :sub/dispose 3
+    :sub/not-run 2
+    1))
+
+(defn accumulate-sub-value
+  "Calculate a sorting value for a series of subscription trace types."
+  ;; A reader might reasonably ask, "Why are we going to all this work here?"
+  ;; We calculate a custom value rather than just comparing two order vectors,
+  ;; because the default compare logic for comparing vectors is to sort shorter
+  ;; vectors above longer ones, whereas we want all CRR, CR, C orders to be
+  ;; sorted adjacent to each other, in that order.
+  ;;
+  ;; The first sub type in the order is worth (n * 10^3),
+  ;; then the next one (if it exists), is worth (n * 10^2), and so-on.
+  [order]
+  (loop [exp   3
+         total 0
+         order order]
+    (if-let [sub-type (first order)]
+      (recur (dec exp) (+ total (* (sub-type-value sub-type) (js/Math.pow 10 exp))) (rest order))
+      total)))
+
+(def accumulate-sub-value-memoized
+  (memoize accumulate-sub-value))
+
+(defn sub-sort-val [order-x order-y]
+  ;; Note x and y are reversed here so that the "highest" sub orders get sorted first.
+  (compare (accumulate-sub-value-memoized order-y)
+           (accumulate-sub-value-memoized order-x)))

 (defn sub-op-type->type [t]
   (case (:op-type t)
@@ -455,7 +478,7 @@
                                                          (assoc sub :previous-value (:previous-value state))
                                                          sub)]
                                       sub)))
-                      (sort-by :path))
+                      (sort-by :order sub-sort-val))
         ]
     #_(utils/spy "subx" subx)


Fix actual calling upddate methods

Fix actual calling upddate methods

--- src/clj/subman/core.clj
+++ src/clj/subman/core.clj
@@ -18,8 +18,8 @@
   (let [pool (at-at/mk-pool)]
     (at-at/every const/update-period
                  (fn [] (println "start update")
-                   filler/update-all
-                   models/update-total-count
+                   (filler/update-all)
+                   (models/update-total-count)
                    (println "update finished"))
                  pool)))


Refactor Vector to not need top-level vector-seq.  Refs #1

--- src/cljs/cljs/core.cljs
+++ src/cljs/cljs/core.cljs
@@ -762,11 +762,7 @@
            (. f apply f (to-array args))) ;; applyTo
          (. f apply f (to-array args))))))

-; should use: count, nth
-(defn- vector-seq [vector i]
-  (lazy-seq
-    (when (< i (-count vector))
-      (cons (-nth vector i) (vector-seq vector (inc i))))))
+;;; Vector

 (deftype Vector [meta array]
   IWithMeta
@@ -799,7 +795,12 @@
   ISeqable
   (-seq [coll]
     (when (> (.length array) 0)
-      (vector-seq coll 0)))
+      (let [vector-seq
+             (fn vector-seq [i]
+               (lazy-seq
+                 (when (< i (.length array))
+                   (cons (aget array i) (vector-seq (inc i))))))]
+        (vector-seq 0))))

   ICounted
   (-count [coll] (.length array))


`cljs.core.node-target` to generic `cljs.core.target` Closure define

--- src/cljs/cljs/core.cljs
+++ src/cljs/cljs/core.cljs
@@ -17,8 +17,8 @@

 (def *unchecked-if* false)

-(def ^{:jsdoc ["@define"]}
-  node-target false)
+(def ^{:jsdoc ["@define {string}"]}
+  target "default")

 (defonce
   ^{:doc "Each runtime environment provides a different way to print output.


Move call to `imagemagick-installed?` inside `compare-images`.

So that check is performed for both clj and cljs.

--- test/clj/quil/snippet.clj
+++ test/clj/quil/snippet.clj
@@ -37,14 +37,17 @@
   "Compares images at file paths `expected` and `actual` and produces another
   image at path `difference` which highlights any differences in the images.

-  Returns a number between `0` and `1` indicating a measure of the difference.
-  with `0` indicating the images are the same."
+  Returns a number between `0` and `1` indicating a measure of the difference,
+  with `0` indicating the images are the same, and `nil` if imagemagick not
+  installed."
   [expected actual difference]
   ;; use imagemagick compare executable for comparison
   ;; see https://imagemagick.org/script/compare.php
-  (let [{:keys [err]} (sh/sh "compare" "-metric" "mae" expected actual difference)
-        result        (second (re-find #"\((.*)\)" err))]
-    (Double/parseDouble result)))
+  (if (imagemagick-installed?)
+    (let [{:keys [err]} (sh/sh "compare" "-metric" "mae" expected actual difference)
+          result        (second (re-find #"\((.*)\)" err))]
+      (Double/parseDouble result))
+    (println "Imagemagick not detected. Please install it for automated image comparison to work.")))

 (defn- replace-suffix [file-name suffix]
   (string/replace file-name #"(\w+)\.(\w+)$" (str suffix ".$2")))
@@ -58,10 +61,11 @@
           difference (replace-suffix expected "difference")
           result     (compare-images expected actual difference)
           threshold  0.02]
-      (when (<= result threshold)
-        (io/delete-file (io/file actual))
-        (io/delete-file (io/file difference)))
-      (t/is (<= result threshold)))))
+      (when (number? result)
+        (when (<= result threshold)
+          (io/delete-file (io/file actual))
+          (io/delete-file (io/file difference)))
+        (t/is (<= result threshold))))))

 (defn run-snippet-as-test [{:keys [ns name opts setup body body-str mouse-clicked]}]
   (let [result (promise)
@@ -84,9 +88,7 @@
              (try
                (q/background 255)
                (body)
-               (if (imagemagick-installed?)
                  (assert-unchanged-snippet-output name)
-                 (println "Imagemagick not detected. Please install it for automated image comparison to work."))
                (catch Exception e
                  (println "Error" e)
                  (.printStackTrace e)
@@ -148,9 +150,10 @@
             (etaoin/refresh driver)
             (etaoin/screenshot-element driver {:tag :canvas} actual)
             (let [result (compare-images expected actual difference)]
-              (when (<= result threshold)
-                (io/delete-file (io/file actual))
-                (io/delete-file (io/file difference)))
-              (t/is (<= result threshold)
-                    (str "Image comparison for " name " not within acceptable threshold: " threshold)))))))
+              (when (number? result)
+                (when (<= result threshold)
+                  (io/delete-file (io/file actual))
+                  (io/delete-file (io/file difference)))
+                (t/is (<= result threshold)
+                      (str "Image comparison for " name " not within acceptable threshold: " threshold))))))))
     (etaoin/quit driver)))


don't do (merge) step

don't do (merge) step

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -67,11 +67,8 @@
      ;; trellis is a generated expression, with one complement for
      ;; each complement position.
      (mapcat (fn [{bolt :bolt comps :comps}]
-               (let [each-bolt-and-comps
-                     (merge {[] [bolt]}
-                            comps)
-                     keys (keys each-bolt-and-comps)
-                     vals (vals each-bolt-and-comps)]
+               (let [keys (cons [] (keys comps))
+                     vals (cons [bolt] (vals comps))]
                  ;; TODO: further flatten this into the overall ->> pipeline
                  (map (fn [each-path-through-trellis]
                         (zipmap keys each-path-through-trellis))


less logging

less logging

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -108,48 +108,26 @@
   (if (and (not (nil? bolt)))
     (let [comp-paths (find-comp-paths bolt)]
       (if (not (empty? comp-paths))
-        (let [debug (log/trace (str "comp-paths-to-bolts-map: start: "
-                                    ((:morph-ps model) bolt)
-                                    " with comp-paths: " (string/join ";" comp-paths)))
-              result
-              (zipmap
-               comp-paths
-               (map #(let [spec (get-in bolt %)
-                           debug (log/trace (str "comp-paths-to-bolts-map: "
-                                                 "finding bolts for path:" % " within bolt: " ((:morph-ps model) bolt)))
-                           lexemes (get-lexemes model spec)
-                           bolts-at (if (< depth max-depth)
-                                      (lightning-bolts
-                                       model
-                                       (get-in bolt %)
-                                       depth max-depth))
-                           lexemes-before-phrases
-                           (lexemes-before-phrases depth max-depth)]
-                       (log/trace (str "comp-paths-to-bolts-map:"
-                                       ((:morph-ps model) bolt) "@" % " -> "
-                                       (spec-info spec) " lexemes-before-phrases: "
-                                   lexemes-before-phrases))
-                       (if lexemes-before-phrases
-                         (concat lexemes bolts-at)
-                         (concat bolts-at lexemes)))
-                    comp-paths))]
-          (doall (map #(log/trace
-                        (str "comp-paths-to-bolt-map: for bolt: " (show-bolt bolt model) "@" % " returning:"
-                             (string/join "," (map (fn [bolt] (show-bolt bolt model))
-                                                   (get result %)))))
-                      (sort (keys result))))
-          result)))))
+        (zipmap
+         comp-paths
+         (map #(let [spec (get-in bolt %)
+                     lexemes (get-lexemes model spec)
+                     bolts-at (if (< depth max-depth)
+                                (lightning-bolts
+                                 model
+                                 (get-in bolt %)
+                                 depth max-depth))
+                     lexemes-before-phrases
+                     (lexemes-before-phrases depth max-depth)]
+                 (if lexemes-before-phrases
+                   (concat lexemes bolts-at)
+                   (concat bolts-at lexemes)))
+              comp-paths))))))

 (defn add-comps
   "given a bolt, return the lazy sequence of all bolts derived from this bolt after adding,
    at each supplied path in comp-paths, the bolts for that path."
   [bolt model comp-paths bolts-at-paths depth max-depth & [top-bolt path-from-top]]
-  (log/trace (str "add-comps:"
-                  " with depth: (" depth "/" max-depth ") and top-bolt:"
-                  ((:morph-ps model) top-bolt)
-                  (if (not (= bolt top-bolt))
-                    (str " /" path-from-top "/ "
-                         ((:morph-ps model) bolt)))))
   (let [top-bolt (or top-bolt bolt)]
     (if (empty? comp-paths)
       [bolt] ;; done: we've added all the comps to the bolt, so just return the bolt as a singleton vector.
@@ -161,43 +139,21 @@
               (let [path (first comp-paths)
                     bolts-at (first bolts-at-paths)]
                 (mapcat (fn [bolt-at]
-                          (log/debug (str "add-comps:" " adding bolt:"
-                                          ((:morph-ps model) bolt-at)
-                                          " for path:" path " to bolt:"
-                                          (show-bolt bolt model)
-                                          "; top-bolt:"
-                                          ((:morph-ps model) top-bolt)))
                           (if (= false (get-in bolt-at [:phrasal]))
-                            (let [result
-                                  [(assoc-in bolt path bolt-at)]]
-                              (log/debug (str "(assoc-in (lexical) " ((:morph-ps model) bolt) " " path " "
-                                              ((:morph-ps model) bolt-at) " => "
-                                              (string/join "," (map #((:morph-ps model) %)
-                                                                    result))))
-                              result)
+                            [(assoc-in bolt path bolt-at)]
                             (let [comps-map (comp-paths-to-bolts-map bolt-at model (+ 1 depth) max-depth)]
                               (when (not (some empty? (vals comps-map)))
-                                (let [comp-paths (sort (keys comps-map))
-                                      result
-                                      (add-comps bolt-at
-                                                 model
-                                                 comp-paths
-                                                 (map (fn [path]
-                                                        (get comps-map path))
-                                                      comp-paths)
-                                                 (+ 1 depth)
-                                                 max-depth
-                                                 top-bolt
-                                                 (str (if path-from-top (str path-from-top "/"))
-                                                      path))
-                                      results
-                                      (map #(assoc-in bolt path %)
-                                           result)]
-                                  (log/trace (str "(assoc-in (phrasal) " ((:morph-ps model) bolt) " " path " "
-                                                  ((:morph-ps model) bolt-at) " => "
-                                                  (string/join "," (map #((:morph-ps model) %)
-                                                                        results))))
-                                  results)))))
+                                (let [comp-paths (keys comps-map)]
+                                  (map #(assoc-in bolt path %)
+                                       (add-comps bolt-at
+                                                  model
+                                                  comp-paths
+                                                  (map (fn [path]
+                                                         (get comps-map path))
+                                                       comp-paths)
+                                                  (+ 1 depth)
+                                                  max-depth
+                                                  top-bolt)))))))
                         bolts-at))))))
 (defn generate2
   "Return all expressions matching spec _spec_ given the model _model_."


first crude pass at some echo handling

first crude pass at some echo handling

--- src/block_chain/net.clj
+++ src/block_chain/net.clj
@@ -1,21 +1,60 @@
 (ns block-chain.net
-  (:require [aleph.tcp :as tcp]
-            [manifold.stream :as s]
-            [clojure.core.async :as async]))
+  (:require #_[aleph.tcp :as tcp]
+            #_[manifold.stream :as s]
+            [clojure.java.io :as io]
+            [clojure.core.async :as async])
+  (:import  [java.net ServerSocket]))

-(defn echo-handler [s info]
-  (s/connect s s))
+;; (defn echo-handler [s info]
+;;   (s/connect s s))

-(defn server [port]
-  (tcp/start-server echo-handler {:port 10001}))
+;; (defn server [port]
+;;   (tcp/start-server echo-handler {:port 10001}))

-(defn client [host port]
-  @(tcp/client {:host host :port port}))
+;; (defn client [host port]
+;;   @(tcp/client {:host host :port port}))

-(defn listen [client handler]
-  (async/go
-    (loop [resp @(s/take! client)]
-      (println "got resp: " (apply handler resp))
-      (recur @(s/take! client)))
-    (println "stopping listen loop")))
+;; (defn listen [client handler]
+;;   (async/go
+;;     (loop [resp @(s/take! client)]
+;;       (println "got resp: " (apply handler resp))
+;;       (recur @(s/take! client)))
+;;     (println "stopping listen loop")))
+
+
+(defn gets
+  "Read a line of textual data from the given socket"
+  [reader]
+  (.readLine reader))
+
+(defn write-response
+  "Send the given string message out over the given socket"
+  [socket msg]
+  (let [writer (io/writer socket)]
+      (.write writer msg)
+      (.flush writer)))
+
+(defn serve [port handler]
+  (with-open [server-sock (ServerSocket. port)
+              socket (.accept server-sock)
+              stream (io/reader socket)]
+    (loop [lines []
+           next-line (gets stream)]
+      (if (empty? next-line)
+        (write-response socket (handler lines))
+        (recur (conj lines next-line)
+               (gets stream))))))
+
+
+(defn try-it []
+  (serve 8334 (fn [lines]
+                (println "handling lines: " lines)
+                (first lines))))
+
+;;echo handler:
+#_(serve 9000 (partial apply str))
+#_(let [msg-in (receive sock)
+          msg-out (handler msg-in)]
+      (write-response sock msg-out))
+


Fixed ciruclar dependency

Fixed ciruclar dependency

--- src/test/clojure/conexp/math/util_test.clj
+++ src/test/clojure/conexp/math/util_test.clj
@@ -6,7 +6,7 @@
 ;; the terms of this license.
 ;; You must not remove this notice, or any other, from this software.

-(ns conexp.math.util
+(ns conexp.math.util-test
   (:use conexp.math.util)
   (:use clojure.test))


example showing how the deps graph bit works

--- src/jsx_fun/core.clj
+++ src/jsx_fun/core.clj
@@ -1,4 +1,5 @@
 (ns jsx-fun.core
+  (:refer-clojure :exclude [compile])
   (:require [clojure.java.io :as io]
             [clojure.string :as string]
             [cljs.closure :as cl])
@@ -103,6 +104,16 @@
          (println [level error]
            (println error)))))))

+(defn compile
+  ([dir]
+   (compile dir "out"))
+  ([dir outdir]
+   (letfn [(dir? [^File x] (.isDirectory x))]
+     (doseq [file (remove dir? (file-seq (io/file dir)))]
+       (spit (io/file outdir (.getName file))
+         (transform-commonjs
+           (transform-jsx (slurp file))))))))
+
 ;(defn transform-commonjs
 ;  [filename src]
 ;  (let [^List externs '()
@@ -136,6 +147,8 @@
     (.getAbsolutePath (io/file "deps/closure-library/closure"))
     ["resources"])

+  (compile "resources")ompile
+
   ;; Parsing example
   ;; based on http://slieb.org/blog/parseJavaScriptWithGoogleClosure/
   (let [config       (ParserRunner/createConfig


Protocol support now runs the local mutation before the remote mutation, mimicking om's behavior

--- src/untangled/client/protocol_support.cljs
+++ src/untangled/client/protocol_support.cljs
@@ -39,6 +39,9 @@
           parse (partial parser {:state state})
           tempid-map (impl/allocate-tempids ui-tx)
           ui-tx (impl/rewrite-tempids ui-tx tempid-map)]
+
+      ;; remote parsing expects that local parsing has executed
+      (parse ui-tx)
       (assertions "Generates the expected server query"
         (-> (parse ui-tx :remote)
           plumbing/remove-loads-and-fallbacks


update tests to check for valid and invalid message

--- test/gangway/web_test.clj
+++ test/gangway/web_test.clj
@@ -7,10 +7,37 @@
             [gangway.util :as gw-util]
             [gangway.web :as gw-web]))

-(deftest remote-http-test
+(def invalid-message
+  (json/json-str
+   {:header {:operation :assert
+             :entity-id {:task-id 137}
+             :entity-type :task}
+    :payload {:entity {:id-sk-origin "vlacs"
+                       :name "Master the art of addition"
+                       :description "This is some sort of description"}}}))
+
+(def valid-message
+  (json/json-str
+   {:header {:operation :assert
+             :entity-id {:task-id 17}
+             :entity-type :task}
+    :payload {:entity {:id-sk-origin "vlacs"
+                       :name "Master the art of addition"
+                       :version "v3"
+                       :description "This is some sort of description"}}}))
+
+(deftest remote-http-test-malformed
   (let [result (http/post
                 (format "%s/gangway/in/showevidence" (immutant.util/app-uri))
-                {:body (json/json-str {:a "b"})
+                {:body invalid-message
                  :throw-exceptions false})]
-    (testing "malformed handler"
+    (testing "malformed request (missing a required field)"
       (is (= 400 (:status result))))))
+
+(deftest remote-http-test-success
+  (let [result (http/post
+                (format "%s/gangway/in/showevidence" (immutant.util/app-uri))
+                {:body valid-message
+                 :throw-exceptions false})]
+    (testing "successful request"
+      (is (= 201 (:status result))))))


Fix blake2 hashes.

Fix blake2 hashes.

--- src/buddy/core/hash.clj
+++ src/buddy/core/hash.clj
@@ -158,26 +158,26 @@
   SHA-1, SHA-2, and SHA-3, yet is at least as secure as the
   latest standard SHA-3."
   [input length]
-  (let [engine (Blake2b. nil length nil nil)]
+  (let [engine (Blake2bDigest. nil length nil nil)]
     (-digest input engine)))

 (defn blake2b-128
   "BLAKE2 cryptographic hash function with fixed output
   digest size to 128 bits."
   [input]
-  (blake2b input 128))
+  (blake2b input 16))

 (defn blake2b-256
   "BLAKE2 cryptographic hash function with fixed output
   digest size to 256 bits."
   [input]
-  (blake2b input 256))
+  (blake2b input 32))

 (defn blake2b-512
   "BLAKE2 cryptographic hash function with fixed output
   digest size to 512 bits."
   [input]
-  (blake2b input 512))
+  (blake2b input 64))

 (defn sha256
   [input]


Fix invalid throw in tests

Fix invalid throw in tests

--- test/shale/test/utils.clj
+++ test/shale/test/utils.clj
@@ -34,7 +34,7 @@
           (loop [tries 0]
             (if (local-port-available? port)
               (if (> tries 20)
-                (throw "Timed out waiting for Selenium to start." {:port port})
+                (throw (ex-info "Timed out waiting for Selenium to start." {:port port}))
                 (do
                   (Thread/sleep 100)
                   (recur (inc tries))))))


brand link to /az

brand link to /az

for a better mobile experience

--- src/checkmate/views.clj
+++ src/checkmate/views.clj
@@ -18,11 +18,12 @@
              [:span.icon-bar]
              [:span.icon-bar]
              [:span.icon-bar]]
-            [:a.navbar-brand {:href "/"} [:img {:src "/icon.png" :width 48 :height 20}]]]
+            [:a.navbar-brand {:href "/az"} [:img {:src "/icon.png" :width 48 :height 20}]]]
            [:div.collapse.navbar-collapse.navbar-ex1-collapse
             [:ul.nav.navbar-nav
              [:li [:a {:href "/az"} "A-Z"]]
-             [:li [:a {:href "/new"} "New Checklist"]]]
+             [:li [:a {:href "/new"} "New Checklist"]]
+             [:li [:a {:href "/"} "About"]]]
             [:p.navbar-text.pull-right "A ClojureCup entry by Benjamin Klüglein"]]]
           [:div.container body]]))