Adding kumite test to unit tests, seems to be working fine

--- jvm-runner/test/codewars/runners/java_test.clj
+++ jvm-runner/test/codewars/runners/java_test.clj
@@ -3,6 +3,7 @@
             [codewars.core :refer [-main] :as core]
             [codewars.test.utils :refer :all]
             [cheshire.core :as json]))
+

 (deftest java-basic
   (testing "-main can handle a very basic java solution and fixture"
@@ -20,6 +21,7 @@
        {:language "java"
         :solution "public class FooFighters {public static int main() {return 1;}}"})
       (is (= 1 (-main))))))
+

 (deftest java-solution-print
   (testing "-main can handle a java solution that prints to standard out"
@@ -127,3 +129,22 @@
         (is (.contains test-out-string "<DESCRIBE::>solutionAndSetupAndFixture(NineYards)<:LF:>"))
         (is (.contains test-out-string "test out"))
         (is (.contains test-out-string "<PASSED::>Test Passed<:LF:>"))))))
+
+(deftest codewars-kumite-test
+  (testing "Can handle a simple static export"
+    (with-in-str
+      (json/generate-string
+       {:language "java"
+        :solution "public class Java {
+                     public static int multiply(int x, int y) { return x * y; } }"
+        :fixture "import org.junit.*;
+
+                  public class JavaTest{
+                    @Test
+                    public final void testMultiply() {
+                      Assert.assertEquals(\"The two values should multiply together\", 50, Java.multiply(10, 5));
+                    }
+                  }"})
+      (let [test-out-string (with-java-out-str (-main))]
+        (is (.contains test-out-string "<DESCRIBE::>testMultiply(JavaTest)<:LF:>"))
+        (is (.contains test-out-string "<PASSED::>Test Passed<:LF:>"))))))


Add favorite endpoint to frontend

Add favorite endpoint to frontend

--- tutorial.moan/src/tutorial/moan/frontend/main.cljs
+++ tutorial.moan/src/tutorial/moan/frontend/main.cljs
@@ -6,6 +6,8 @@
     [cljs.reader :refer [read-string]]))

 (defonce state (atom {:page {:name :home}}))
+
+(declare fetch-global-page)

 (defn update-tweet
   [tweets id f & args]
@@ -40,10 +42,11 @@
                      "tweet__action--active")
             :onClick (fn [e]
                        (.preventDefault e)
-                       (swap! state
-                              update :tweets
-                              update-tweet (:id tweet)
-                              update :favorite? not))}
+                       (->
+                         (js/fetch (str "/" (:id tweet) "/favorite")
+                                   #js {:method "POST"})
+                         (.then (fn [_]
+                                  (fetch-global-page)))))}
            [:span.star.tweet__action-icon]
            "Favorite"]]]))))

@@ -96,6 +99,10 @@
                                         (if (= page (:page state))
                                           (assoc-in state [:page :data] x)
                                           state)))))))
+
+(defn fetch-global-page
+  []
+  (fetch-page (-> @state :page)))

 (defn nav-link
   [opts & children]


Fix mails with attachments

Fix mails with attachments

--- systems/mail/src/containium/systems/mail.clj
+++ systems/mail/src/containium/systems/mail.clj
@@ -121,7 +121,7 @@
                          (cons :related html-contents)]
                         (cons :related html-contents))
         contents (if (seq attachment-contents)
-                   [:mixed body-contents attachments]
+                   [:mixed body-contents attachment-contents]
                    body-contents)]
     (send-message mail-system from to subject contents
                   (merge (when cc {:cc cc})


Fix ClojureScript version

Fix ClojureScript version

--- src/clojure/leiningen/new/web_clojurescript/project.clj
+++ src/clojure/leiningen/new/web_clojurescript/project.clj
@@ -1,7 +1,7 @@
 (defproject {{name}} "0.0.1-SNAPSHOT"
   :description "FIXME: write this!"
   :dependencies [[org.clojure/clojure "1.6.0"]
-                 [org.clojure/clojurescript "0.0-3213"]
+                 [org.clojure/clojurescript "0.0-3126"]
                  [ring "1.3.2"]]
   :hooks [leiningen.cljsbuild]
   :source-paths ["src/clj"]


Improve :subscription-name docs [IMMUTANT-526]

--- messaging/src/immutant/messaging.clj
+++ messaging/src/immutant/messaging.clj
@@ -47,9 +47,12 @@

    Options that apply to both local and remote contexts are [default]:

-   * :subscription-name - identifies the context for use with a durable topic subscriber [nil]
-   * :xa?               - if true, returns an XA context for use in a distributed transaction [false]
-   * :mode              - one of: :auto-ack, :client-ack, :transacted. Ignored if :xa? is true. [:auto-ack]
+   * :subscription-name - identifies the context for use with a durable topic
+                          subscriber (see [[subscribe]]) [nil]
+   * :xa?               - if true, returns an XA context for use in a
+                          distributed transaction [false]
+   * :mode              - one of: :auto-ack, :client-ack, :transacted. Ignored
+                          if :xa? is true. [:auto-ack]

    Options that apply to only remote contexts are [default]:

@@ -292,9 +295,12 @@
 (defn subscribe
   "Sets up a durable subscription to `topic`, and registers a listener with `f`.

-   `subscription-name` is used to identify the subscription, allowing
-   you to stop the listener and resubscribe with the same name in the
-   future without losing messages sent in the interim.
+   `subscription-name` is used to identify the subscription, allowing you to
+   stop the listener and resubscribe with the same name in the future without
+   losing messages sent in the interim. If no :context is provided, the
+   subscription name is used to identify the internally-created context as
+   well. If a :context is provided, it's subscription-name need not match the
+   one passed here.

    If a :selector is provided, then only messages having
    metadata/properties matching that expression may be received.


Move jira config modals into their own fns

--- src-cljs/frontend/components/project_settings.cljs
+++ src-cljs/frontend/components/project_settings.cljs
@@ -1580,6 +1580,41 @@
            [:legend "AWS keys for " (vcs-url/project-name (:vcs_url project))]
            (om/build aws-keys-form project-data)]])))))

+(defn jira-connect-modal
+  [{:keys [project close-fn jira-input-path track-fn]} owner]
+  (let [inputs (inputs/get-inputs-from-app-state owner)
+        token (or (get-in inputs [:jira :circle_token])
+                  (get-in project [:jira :circle_token]))
+        project-id (project-model/id project)
+        jira-input-path (conj state/inputs-path :jira :circle_token)]
+    (modal/modal-dialog
+     {:title "Add a JIRA token"
+      :body (html
+             [:div
+              [:p "Configure JIRA to create issues from CircleCI’s build page."]
+              (form/form {}
+                         (om/build form/text-field
+                                   {:label "Token"
+                                    :require true
+                                    :value token
+                                    :on-change #(utils/edit-input owner
+                                                                  jira-input-path
+                                                                  %)}))])
+      :actions [(button/button {:on-click close-fn} "Cancel")
+                (button/managed-button
+                 {:failed-text "Failed"
+                  :success-text "Saved"
+                  :loading-text "Saving..."
+                  :kind :primary
+                  :on-click (fn [_]
+                              (raise! owner
+                                      [:saved-project-settings {:project-id project-id
+                                                                :merge-paths [[:jira]]
+                                                                :on-success close-fn}])
+                              (track-fn :save-clicked))}
+                 "Save")]
+      :close-fn close-fn})))
+
 (defmulti jira-integration (fn [project-data _]
                              (if (or (config/enterprise?)
                                      (get-in project-data [:project :jira :username]))
@@ -1594,9 +1629,6 @@
     om/IRenderState
     (render-state [_ {:keys [show-modal?]}]
       (let [project (:project project-data)
-            inputs (inputs/get-inputs-from-app-state owner)
-            token (or (get-in inputs [:jira :circle_token])
-                      (get-in project [:jira :circle_token]))
             project-id (project-model/id project)
             jira-input-path (conj state/inputs-path :jira :circle_token)
             track-event (fn [event-type component]
@@ -1620,38 +1652,14 @@
               [:p
                "Install the CircleCI JIRA add-on from the Atlassian Marketplace and add the token here."]
               (when show-modal?
-                (letfn [(close-modal! []
-                          (om/set-state! owner :show-modal? false))
-                        (close-fn [_]
-                          (close-modal!)
-                          (track-event :cancel-clicked "jira-credentials-modal"))]
-                  (modal/modal-dialog
-                   {:title "Add a JIRA token"
-                    :body (html
-                           [:div
-                            [:p "Configure JIRA to create issues from CircleCI’s build page."]
-                            (form/form {}
-                                       (om/build form/text-field
-                                                 {:label "Token"
-                                                  :require true
-                                                  :value token
-                                                  :on-change #(utils/edit-input owner
-                                                                                jira-input-path
-                                                                                %)}))])
-                    :actions [(button/button {:on-click close-fn} "Cancel")
-                              (button/managed-button
-                               {:failed-text "Failed"
-                                :success-text "Saved"
-                                :loading-text "Saving..."
-                                :kind :primary
-                                :on-click (fn [_]
-                                            (raise! owner
-                                                    [:saved-project-settings {:project-id project-id
-                                                                              :merge-paths [[:jira]]
-                                                                              :on-success close-modal!}])
-                                            (track-event :save-clicked "jira-credentials-modal"))}
-                               "Save")]
-                    :close-fn close-fn})))
+                (letfn [(close-fn [_]
+                          (om/set-state! owner :show-modal? false)
+                          (track-event :cancel-clicked))]
+                  (jira-connect-modal {:project project
+                                       :close-fn close-fn
+                                       :track-fn track-event
+                                       :jira-input-path jira-input-path}
+                                      owner)))
               (when-let [credentials (:jira project)]
                 (letfn [(linkify [url]
                           (html
@@ -1678,6 +1686,43 @@
                                                                    (raise! owner [:saved-project-settings {:project-id project-id
                                                                                :merge-paths [jira-input-path]}]))}))}]})))]))]])))))

+(defn jira-basic-modal
+  [{:keys [project close-fn track-fn jira-input-path]} owner]
+  (let [project-id (project-model/id project)
+        inputs (inputs/get-inputs-from-app-state owner)
+        credentials (or (:jira inputs)
+                        (:jira project))]
+    (modal/modal-dialog
+           {:title "Add JIRA credentials"
+            :body (html
+                   [:div
+                    [:p "Configure JIRA to create issues from CircleCI’s build page."]
+                    (form/form {}
+                               (om/build form/text-field {:label "JIRA username"
+                                                          :value (:username credentials)
+                                                          :on-change #(utils/edit-input owner (jira-input-path :username) %)})
+                               (om/build form/text-field {:label "JIRA password"
+                                                          :password? true
+                                                          :value (:password credentials)
+                                                          :on-change #(utils/edit-input owner (jira-input-path :password) %)})
+                               (om/build form/text-field {:label "JIRA base hostname"
+                                                          :value (:base_url credentials)
+                                                          :on-change #(utils/edit-input owner (jira-input-path :base_url) %)}))])
+            :actions [(button/button {:on-click close-fn} "Cancel")
+                      (button/managed-button
+                       {:failed-text "Failed"
+                        :success-text "Saved"
+                        :loading-text "Saving..."
+                        :kind :primary
+                        :on-click (fn [_]
+                                    (raise! owner
+                                            [:saved-project-settings {:project-id project-id
+                                                                      :merge-paths [[:jira]]
+                                                                      :on-success close-fn}])
+                                    (track-fn :save-clicked))}
+                       "Save")]
+            :close-fn close-fn})))
+
 (defmethod jira-integration :basic [project-data owner]
   (reify
     om/IInitState
@@ -1687,8 +1732,6 @@
     (render-state [_ {:keys [show-modal?]}]
       (let [project (:project project-data)
             inputs (inputs/get-inputs-from-app-state owner)
-            credentials (or (:jira inputs)
-                            (:jira project))
             project-id (project-model/id project)
             jira-input-path (fn [& args] (apply conj state/inputs-path :jira args))
             track-event (fn [event-type component]
@@ -1712,41 +1755,14 @@
               [:p
                "Configure JIRA to create issues from CircleCI's build page."]
               (when show-modal?
-                (letfn [(close-modal! []
-                          (om/set-state! owner :show-modal? false))
-                        (close-fn [_]
-                          (close-modal!)
-                          (track-event :cancel-clicked "jira-credentials-modal"))]
-                  (modal/modal-dialog
-                   {:title "Add a JIRA token"
-                    :body (html
-                           [:div
-                            [:p "Configure JIRA to create issues from CircleCI’s build page."]
-                            (form/form {}
-                                       (om/build form/text-field {:label "JIRA username"
-                                                                  :value (:username credentials)
-                                                                  :on-change #(utils/edit-input owner (jira-input-path :username) %)})
-                                       (om/build form/text-field {:label "JIRA password"
-                                                                  :password? true
-                                                                  :value (:password credentials)
-                                                                  :on-change #(utils/edit-input owner (jira-input-path :password) %)})
-                                       (om/build form/text-field {:label "JIRA base hostname"
-                                                                  :value (:base_url credentials)
-                                                                  :on-change #(utils/edit-input owner (jira-input-path :base_url) %)}))])
-                    :actions [(button/button {:on-click close-fn} "Cancel")
-                              (button/managed-button
-                               {:failed-text "Failed"
-                                :success-text "Saved"
-                                :loading-text "Saving..."
-                                :kind :primary
-                                :on-click (fn [_]
-                                            (raise! owner
-                                                    [:saved-project-settings {:project-id project-id
-                                                                              :merge-paths [[:jira]]
-                                                                              :on-success close-modal!}])
-                                            (track-event :save-clicked "jira-credentials-modal"))}
-                               "Save")]
-                    :close-fn close-fn})))
+                (letfn [(close-fn [_]
+                          (om/set-state! owner :show-modal? false)
+                          (track-event :cancel-clicked))]
+                  (jira-basic-modal {:project project
+                                     :close-fn close-fn
+                                     :track-fn track-event
+                                     :jira-input-path jira-input-path}
+                                    owner)))
               (when-let [credentials (:jira project)]
                 (letfn [(linkify [url]
                           (html


add some test

add some test

--- test/me/shenfeng/http/server/server_test.clj
+++ test/me/shenfeng/http/server/server_test.clj
@@ -68,6 +68,10 @@
 (defasync test-async-just-body [req] cb
   (cb "just-body"))

+(defwshandler ws-handler [req] con
+  (receive con (fn [msg]
+                 (write con msg))))
+
 (defonce tmp-server (atom nil))

 (defn -main [& args]
@@ -98,6 +102,7 @@
                      {:status  200
                       :body async-body}))
   (GET "/async2" [] test-async)
+  (GET "/ws" [] ws-handler)
   (GET "/just-body" [] test-async-just-body))

 (use-fixtures :once (fn [f]
@@ -155,3 +160,12 @@
     (is (= (:status resp) 200))
     (is (:headers resp))
     (is (= (:body resp) "just-body"))))
+
+;; (deftest test-ws
+;;   (let [resp (http/get "http://localhost:4347/ws"
+;;                        {:headers {"Sec-WebSocket-Key" "x3JJHMbDL1EzLkh9GBhXDw=="
+;;                                   "Upgrade" "websocket"
+;;                                   "Connection" "Upgrade"}})]
+;;     (is (= (:status resp) 101))
+;;     (is (:headers resp))
+;;     (is (= (:body resp) nil))))


Fix indentation

Fix indentation

--- test/puppetlabs/services/jruby/testutils.clj
+++ test/puppetlabs/services/jruby/testutils.clj
@@ -52,7 +52,7 @@
   ([] (jruby-puppet-tk-config-with-prod-env 1))
   ([size]
    (jruby-puppet-tk-config [{:environment "production"
-                          :size        size}])))
+                             :size        size}])))

 (defn jruby-puppet-config-with-prod-test-env


Cleanup

Cleanup

--- src/clojure/clojurewerkz/cassaforte/new_query_api.clj
+++ src/clojure/clojurewerkz/cassaforte/new_query_api.clj
@@ -448,9 +448,3 @@
     (generic-batch (QueryBuilder/unloggedBatch
                     (make-array RegularStatement 0))
                    statements)))
-
-;; Batch batch(RegularStatement... statements)
-;; Batch unloggedBatch(RegularStatement... statements)
-;; String quote(String columnName)
-;;
-;;


SER-753 add placeholder test

SER-753 add placeholder test

--- test/vignette/storage/static_assets_test.clj
+++ test/vignette/storage/static_assets_test.clj
@@ -33,3 +33,13 @@
          ..response.. =contains=> {:headers {}})
        (filename
          (sa/->AsyncResponseStoredObject ..response..)) => nil)
+
+(facts :static-assets :get-blocked-placeholder
+       (get-original
+         (sa/create-static-image-storage --static-asset-get--) {:uuid ..uuid.. :blocked-placeholder ..placeholder-id..}) => ..placeholder..
+       (provided
+         (--static-asset-get-- ..uuid..) => ..static-asset-url..
+         (http/get ..static-asset-url.. {:as :stream}) => (future {:status 451})
+         (--static-asset-get-- ..placeholder-id..) => ..placeholder-url..
+         (http/get ..placeholder-url.. {:as :stream}) => (future {:status 200})
+         (sa/->AsyncResponseStoredObject {:status 200}) => ..placeholder..))


CMR-3877 Adds basic code to skip adding ACL conditions in collection search when using a system token

--- search-app/src/cmr/search/services/acls/collection_acls.clj
+++ search-app/src/cmr/search/services/acls/collection_acls.clj
@@ -6,14 +6,18 @@
    [cmr.common-app.services.search.query-model :as qm]
    [cmr.common.util :as util]
    [cmr.search.services.acl-service :as acl-service]
+   [cmr.transmit.config :as tc]
    [cmr.umm-spec.acl-matchers :as umm-matchers]))

 (defmethod qe/add-acl-conditions-to-query :collection
   [context query]
-  (let [group-ids (map #(if (keyword? %) (name %) %)
-                   (util/lazy-get context :sids))
-        acl-cond (qm/string-conditions :permitted-group-ids group-ids true)]
-    (update-in query [:condition] #(gc/and-conds [acl-cond %]))))
+  ;; return unmodified query if the context has a system token
+  (if (tc/echo-system-token? context)
+    query
+    (let [group-ids (map #(if (keyword? %) (name %) %)
+                         (util/lazy-get context :sids))
+          acl-cond (qm/string-conditions :permitted-group-ids group-ids true)]
+      (update-in query [:condition] #(gc/and-conds [acl-cond %])))))

 (defmethod acl-service/acls-match-concept? :collection


Wrong formula for difference in y point in collision detection

--- src/cljs/chocolatier/engine/systems/collision.cljs
+++ src/cljs/chocolatier/engine/systems/collision.cljs
@@ -19,7 +19,7 @@
    points is less than the sum of the radii."
   [x1 y1 r1 x2 y2 r2]
   ;; (debug "Comparing circle" x1 y1 r1 "to" x2 y2 r2)
-  (<= (+ (exp (- x2 x1) 2) (exp (- y1 y2) 2))
+  (<= (+ (exp (- x2 x1) 2) (exp (- y2 y1) 2))
       (exp (+ r1 r2) 2)))

 (defn entity-collision?


Fixed typo in the link example.

Fixed typo in the link example.

--- src/cljs/reagent_toolbox_docs/components/link.cljs
+++ src/cljs/reagent_toolbox_docs/components/link.cljs
@@ -11,7 +11,7 @@
      [:p "The link is a very simple component that acts mostly as a wrapper for the HTML anchor. It's not included in "
       "Material Design Specification but we provide it as an easy way to create links with icons and counters."]
      [ui/display-and-eval-code "
-(defn link-text []
+(defn link-test []
   (fn []
     [:div
      [reagent-toolbox.core/link {:active true
@@ -25,8 +25,7 @@
      [reagent-toolbox.core/link {:href  \"/link\"
                                  :label \"Explore\"
                                  :icon  \"explore\"}]]))
-[link-text]"]
-
+[link-test]"]
      [:p "If you want to provide a theme via context, the component key is " [:code "RTLink"] "."]
      [:section
       [:h2 "Properties"]


Forgot a change.

Forgot a change.

--- EkekoAspectJ/src/damp/ekeko/aspectj/weaverworld.clj
+++ EkekoAspectJ/src/damp/ekeko/aspectj/weaverworld.clj
@@ -777,9 +777,6 @@
       (aspect-dominates-aspect ?dominator ?subordinate [])))
   ([?dominator ?subordinate ?explored-subs]
     (fresh [?sub]
-           (aspect ?dominator)
-           (aspect ?sub)
-           (fails (contains ?explored-subs ?sub))
            (conde
              [(aspect-dominates-aspect-explicitly+ ?dominator ?sub)]
              [(aspect-dominates-aspect-implicitly+ ?dominator ?sub)])


Created def'n for puppet extensions OIDs

--- src/clj/puppetlabs/master/certificate_authority.clj
+++ src/clj/puppetlabs/master/certificate_authority.clj
@@ -61,6 +61,10 @@
   "OID which indicates that a certificate can be used as an SSL client
   certificate."
   "1.3.6.1.5.5.7.3.2")
+
+(def puppet-oid-arc
+  "The parent OID for all Puppet Labs specific X.509 certificate extensions."
+  "1.3.6.1.4.1.34380.1")

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Internal
@@ -460,11 +464,12 @@
   "Given a list of X.509 extensions, remove all extensions that are considered
   unsafe to sign to a certificate. Currently only Puppet extensions are
   considered safe, all others are removed."
+  ;; TODO: (PE-3864) Figure out what is supposed to happen when an extension
+  ;;                 cannot be copied from the CSR to the certificate.
   [ext-list]
   {:pre [(utils/extension-list? ext-list)]}
   (letfn [(puppet-oid? [{oid :oid}]
-                       ;; TODO: Define this somewhere
-            (utils/subtree-of? "1.3.6.1.4.1.34380.1" oid))]
+            (utils/subtree-of? puppet-oid-arc oid))]
     (filter puppet-oid? ext-list)))

 (defn create-agent-extensions


persistence.clj cleanup

persistence.clj cleanup

--- src/main/clojure/com/xebia/visualreview/persistence.clj
+++ src/main/clojure/com/xebia/visualreview/persistence.clj
@@ -37,10 +37,14 @@
   [{h2-id h2-generated-key id :id}]
   (or h2-id id))

-(defn- insert-single! [conn table row-map & {:keys [entities] :or {entities ent-fn} :as opts}]
-  (extract-generated-id (first (apply j/insert! conn table row-map :entities entities opts))))
-(defn- update! [conn table set-map where-clause & {:keys [entities] :or {entities ent-fn} :as opts}]
-  (apply j/update! conn table set-map where-clause :entities entities opts))
+(defn- insert-single! [conn table row-map & opts]
+  (extract-generated-id (first (apply j/insert! conn table row-map :entities ent-fn opts))))
+(defn- update! [conn table set-map where-clause & opts]
+  (apply j/update! conn table set-map where-clause :entities ent-fn opts))
+(defn- query [conn sql-and-params & opts]
+  (apply j/query conn sql-and-params :identifiers ident-fn opts))
+(defn- query-single [& args]
+  (first (apply query args)))

 (defn- format-dates [run-row]
   (-> run-row
@@ -52,37 +56,29 @@
   ([conn project-name suite-name]
     (get-suite-by-name conn project-name suite-name identity))
   ([conn project-name suite-name row-fn]
-    (first (j/query conn
-             ["SELECT suite.* FROM suite JOIN project ON project_id = project.id WHERE project.name = ? AND suite.name = ?" project-name suite-name]
-             :row-fn row-fn
-             :identifiers ident-fn))))
+    (query-single conn
+      ["SELECT suite.* FROM suite JOIN project ON project_id = project.id WHERE project.name = ? AND suite.name = ?" project-name suite-name]
+      :row-fn row-fn)))

 (defn get-suite-by-id
   ([conn project-id suite-id]
     (get-suite-by-id conn project-id suite-id identity))
   ([conn project-id suite-id row-fn]
-    (first (j/query conn
-             ["SELECT suite.* FROM suite JOIN project ON suite.project_id = project.id WHERE suite.id = ? AND project.id = ?" suite-id project-id]
-             :row-fn row-fn
-             :identifiers ident-fn))))
+    (query-single conn
+      ["SELECT suite.* FROM suite JOIN project ON suite.project_id = project.id WHERE suite.id = ? AND project.id = ?" suite-id project-id]
+      :row-fn row-fn)))

 (defn get-project-by-name
   ([conn project-name]
     (get-project-by-name conn project-name identity))
   ([conn project-name row-fn]
-    (first (j/query conn
-             ["SELECT * FROM project WHERE name = ?" project-name]
-             :row-fn row-fn
-             :identifiers ident-fn))))
+    (query-single conn ["SELECT * FROM project WHERE name = ?" project-name] :row-fn row-fn)))

 (defn get-project-by-id
   ([conn project-id]
     (get-project-by-id conn project-id identity))
   ([conn project-id row-fn]
-    (first (j/query conn
-             ["SELECT project.* FROM project WHERE id = ?" project-id]
-             :row-fn row-fn
-             :identifiers ident-fn))))
+    (query-single conn ["SELECT project.* FROM project WHERE id = ?" project-id] :row-fn row-fn)))

 (defn create-suite-for-project!
   "Creates a new suite with an empty baseline for the given project. Returns the created suite's id."
@@ -94,22 +90,17 @@

 ;; Baseline
 (defn get-baseline-screenshot [conn suite-id screenshot-name {:keys [os browser resolution]}]
-  (first
-    (j/query conn
-      ["SELECT screenshot.* FROM screenshot
-       JOIN baseline_screenshot ON screenshot.id = baseline_screenshot.screenshot_id
-       JOIN baseline ON baseline_screenshot.baseline_id = baseline.id
-       JOIN suite ON baseline.suite_id = suite.id
-       WHERE suite.id = ? AND screenshot.screenshot_name = ?
-       AND screenshot.os = ? AND screenshot.resolution = ?
-       AND screenshot.browser = ?" suite-id screenshot-name os resolution browser]
-      :identifiers ident-fn)))
+  (query-single conn
+    ["SELECT screenshot.* FROM screenshot
+                 JOIN baseline_screenshot ON screenshot.id = baseline_screenshot.screenshot_id
+                 JOIN baseline ON baseline_screenshot.baseline_id = baseline.id
+                 JOIN suite ON baseline.suite_id = suite.id
+                 WHERE suite.id = ? AND screenshot.screenshot_name = ?
+                 AND screenshot.os = ? AND screenshot.resolution = ?
+                 AND screenshot.browser = ?" suite-id screenshot-name os resolution browser]))

 (defn get-baseline [conn suite-id]
-  (first
-    (j/query conn
-      ["SELECT * FROM baseline WHERE suite_id = ?" suite-id]
-      :identifiers ident-fn)))
+  (query-single conn ["SELECT * FROM baseline WHERE suite_id = ?" suite-id]))

 (defn create-baseline-screenshot!
   "Adds the given screenshot-id to the given baseline."
@@ -132,21 +123,20 @@

 (defn get-analysis
   [conn run-id]
-  (first
-    (j/query conn
-      ["SELECT analysis.*, project.id project_id, project.name project_name, suite.id suite_id, suite.name suite_name FROM analysis
-      JOIN run ON run.id = analysis.run_id
-      JOIN suite ON suite.id = run.suite_id
-      JOIN project ON project.id = suite.project_id
-      WHERE run_id = ?" run-id]
-      :row-fn format-dates
-      :identifiers ident-fn)))
+  (query-single conn
+    ["SELECT analysis.*, project.id project_id, project.name project_name, suite.id suite_id, suite.name suite_name
+     FROM analysis
+     JOIN run ON run.id = analysis.run_id
+     JOIN suite ON suite.id = run.suite_id
+     JOIN project ON project.id = suite.project_id
+     WHERE run_id = ?" run-id]
+    :row-fn format-dates))

 (defn get-full-analysis [conn run-id]
   (let [analysis (get-analysis conn run-id)
-        diffs (j/query conn
+        diffs (query conn
                 ["SELECT diff.*, diff_image.path,
-                sbefore.size before_size,
+                 sbefore.size before_size,
                  sbefore.resolution before_resolution,
                  sbefore.os before_os,
                  sbefore.browser before_browser,
@@ -160,13 +150,12 @@
                  safter.os after_os,
                  safter.screenshot_name after_name,
                  safter.path after_path FROM analysis
-    JOIN diff ON diff.analysis_id = analysis.id
-    JOIN diff_image ON diff.diff_image = diff_image.id
-    JOIN screenshot safter ON safter.id = diff.after
-    JOIN screenshot sbefore ON sbefore.id = diff.before
-    WHERE analysis.run_id = ?" run-id]
+                 JOIN diff ON diff.analysis_id = analysis.id
+                 JOIN diff_image ON diff.diff_image = diff_image.id
+                 JOIN screenshot safter ON safter.id = diff.after
+                 JOIN screenshot sbefore ON sbefore.id = diff.before
+                 WHERE analysis.run_id = ?" run-id]
                 :row-fn format-dates
-                :identifiers ident-fn
                 :result-set-fn vec)]
     {:analysis analysis :diffs diffs}))

@@ -186,14 +175,10 @@
                     :message (.getMessage e)})))))

 (defn get-screenshot-by-id [conn screenshot-id]
-  (first (j/query conn ["SELECT * FROM screenshot WHERE id = ?" screenshot-id]
-           :identifiers ident-fn
-           :result-set-fn vec)))
+  (query-single conn ["SELECT * FROM screenshot WHERE id = ?" screenshot-id] :result-set-fn vec))

 (defn get-screenshots [conn run-id]
-  (j/query conn ["SELECT * FROM screenshot WHERE run_id = ?" run-id]
-    :identifiers ident-fn
-    :result-set-fn vec))
+  (query conn ["SELECT * FROM screenshot WHERE run_id = ?" run-id] :result-set-fn vec))

 ;; Runs
 (defn create-run!
@@ -214,13 +199,11 @@
 (defn get-run
   "Returns the data for the given run-id"
   [conn run-id]
-  (first
-    (j/query conn
-      ["SELECT run.*, project.id project_id FROM run
-       JOIN suite ON run.suite_id = suite.id JOIN project ON suite.project_id = project.id
-       WHERE project.id = suite.project_id AND suite.id = run.suite_id AND run.id = ?" run-id]
-      :row-fn format-dates
-      :identifiers ident-fn)))
+  (query-single conn
+    ["SELECT run.*, project.id project_id FROM run
+          JOIN suite ON run.suite_id = suite.id JOIN project ON suite.project_id = project.id
+          WHERE project.id = suite.project_id AND suite.id = run.suite_id AND run.id = ?" run-id]
+    :row-fn format-dates))

 (def ^:private get-suite-runs-sql
   "SELECT run.* FROM run JOIN suite ON suite.id = run.suite_id
@@ -230,10 +213,9 @@
 (defn get-runs
   "Returns the list of runs for the given suite"
   [conn project-id suite-id]
-  (j/query conn [get-suite-runs-sql suite-id project-id]
-    :row-fn (comp #(assoc % :project-id project-id) format-dates)
-    :identifiers ident-fn
-    :result-set-fn vec))
+  (query conn [get-suite-runs-sql suite-id project-id]
+         :row-fn (comp #(assoc % :project-id project-id) format-dates)
+         :result-set-fn vec))

 ;; Suites
 (defn get-suite
@@ -242,21 +224,18 @@
   (when-let [suite (get-suite-by-id conn project-id suite-id #(dissoc % :project-id))]
     (assoc suite :runs (get-runs conn project-id suite-id)
                  :project (get-project-by-id conn project-id))))
+
 (def ^:private get-suites-sql "SELECT suite.id, suite.name FROM suite JOIN project ON project.id = suite.project_id WHERE project.id = ?")
 (defn get-suites
   "Returns the list of suites"
   [conn project-id]
-  (j/query conn [get-suites-sql project-id]
-    :identifiers ident-fn
-    :result-set-fn vec))
+  (query conn [get-suites-sql project-id] :result-set-fn vec))

 ;; Projects
 (defn get-projects
   "Retrieve the list of projects"
   [conn]
-  (j/query conn ["SELECT * FROM project"]
-    :identifiers ident-fn
-    :result-set-fn vec))
+  (query conn ["SELECT * FROM project"] :result-set-fn vec))

 (defn get-project
   "Returns the project with list of suites"
@@ -287,13 +266,11 @@
                                 :diff-image  diff-image-id})))

 (defn get-diff [conn run-id diff-id]
-  (first
-    (j/query conn
-      ["SELECT diff.* FROM diff
+  (query-single conn
+    ["SELECT diff.* FROM diff
       JOIN analysis ON analysis.id = diff.analysis_id
       JOIN run ON run.id = analysis.run_id
-      WHERE run.id = ? AND diff.id = ?" run-id diff-id]
-      :identifiers ident-fn)))
+      WHERE run.id = ? AND diff.id = ?" run-id diff-id]))

 (defn update-diff-status! [conn diff-id status]
   (update! conn :diff {:status status} ["id = ?" diff-id]))


Catch and warn when browse-url fails [IMMUTANT-511]

--- web/src/immutant/web/internal/wunderboss.clj
+++ web/src/immutant/web/internal/wunderboss.clj
@@ -66,10 +66,14 @@

 (defn ^:internal run-dmc* [run handler & options]
   (let [result (apply run (wrap-development handler) options)
-        options (u/kwargs-or-map->map options)]
-    (browse-url (format "http://%s:%s%s%s"
-                  (:host options (:host create-defaults))
-                  (http-port options)
-                  (context-path)
-                  (:path options (:path register-defaults))))
+        options (u/kwargs-or-map->map options)
+        url (format "http://%s:%s%s%s"
+              (:host options (:host create-defaults))
+              (http-port options)
+              (context-path)
+              (:path options (:path register-defaults)))]
+    (try
+      (browse-url url)
+      (catch Exception e
+        (u/warn (format "Failed to browse to %s in run-dmc: %s" url (.getMessage e)))))
     result))


timer counts up time spent on task

timer counts up time spent on task

--- src/clojure/com/example/gt/metime/main.clj
+++ src/clojure/com/example/gt/metime/main.clj
@@ -23,31 +23,37 @@

 (defn create-counter-class [text-time-view millis-in-future countdown-timer-interval]
   (proxy [CountDownTimer] [millis-in-future countdown-timer-interval]
+
     (onTick [millis-until-finished]
-      (on-ui
-        (config
-          text-time-view
-          :text
-          (str (format "%02d:%02d:%02d"
-                       (.toHours TimeUnit/MILLISECONDS millis-until-finished)
-                       (- (.toMinutes TimeUnit/MILLISECONDS millis-until-finished) (.toMinutes TimeUnit/HOURS (.toHours TimeUnit/MILLISECONDS millis-until-finished)))
-                       (- (.toSeconds TimeUnit/MILLISECONDS millis-until-finished) (.toSeconds TimeUnit/MINUTES (.toMinutes TimeUnit/MILLISECONDS millis-until-finished))))))
-        )
-      )
+      (let [millis-complete (- millis-in-future millis-until-finished)]
+        (on-ui
+          (config
+            text-time-view
+            :text
+            (str "spent: " (format "%02d:%02d:%02d"
+                                   (.toHours TimeUnit/MILLISECONDS millis-complete)
+                                   (- (.toMinutes TimeUnit/MILLISECONDS millis-complete) (.toMinutes TimeUnit/HOURS (.toHours TimeUnit/MILLISECONDS millis-complete)))
+                                   (- (.toSeconds TimeUnit/MILLISECONDS millis-complete) (.toSeconds TimeUnit/MINUTES (.toMinutes TimeUnit/MILLISECONDS millis-complete)))))))))
     (onFinish []
-      (on-ui config text-time-view :text "Completed."))))
-
-(defrecord Task [date name duration date-index])
+      (on-ui (config text-time-view :text "Completed.")))))

 (defn show-picker [activity picker picker-type]
   (. picker show (. activity getFragmentManager) picker-type))

 (def listing (atom (sorted-map)))

+(defrecord Task [date name duration date-index])
+
+(defn add-to-listing [event-name date-key time-key]
+  (swap! listing update-in [date-key] (fnil conj []) [event-name time-key]))
+
 (defn sorted-map-array-to-array-task [lst]
-  (mapcat identity (map (fn [sorted-map-data]
-                          (into [] (map-indexed (fn [i ele] (apply ->Task (concat [(first sorted-map-data)] ele [i]))) (second sorted-map-data))))
-                        lst)))
+  (mapcat
+    identity
+    (map
+      (fn [sorted-map-data]
+        (into [] (map-indexed (fn [i ele] (apply ->Task (concat [(first sorted-map-data)] ele [i]))) (second sorted-map-data))))
+      lst)))

 (defn make-date-adapter []
   (adapters/ref-adapter
@@ -59,26 +65,24 @@
                         :id-holder   true
                         :orientation :horizontal}
         [:text-view {:id ::event-tv}]
+        [:text-view {:id ::goal-tv}]
         [:text-view {:id ::time-tv}]
         [:button {:id   ::event-btn
-                  :text "start",
-                  ;:on-click
-                  }]
-        ]])
+                  :text "start"}]]])
     (fn [_ view _ task]
       (let [date-text-view (find-view view ::date-tv)
             event-linear-layout-view (find-view view ::event-ll)
             event-text-view (find-view event-linear-layout-view ::event-tv)
             event-timer-view (find-view event-linear-layout-view ::time-tv)
             event-button-view (find-view event-linear-layout-view ::event-btn)
-            timer (create-counter-class event-timer-view 180000 1000)]
+            timer (create-counter-class event-timer-view (* (:duration task) 60000) 1000)]

-        ;symptom of mutability
+        ;mutates the viz
         (config date-text-view :visibility (if (= (:date-index task) 0) View/VISIBLE View/GONE))
         (config date-text-view :text (str (:date task)))

         (config event-button-view :on-click (fn [_] (.start timer)))
-        (config event-text-view :text (str (:name task) " " (:duration task) " " (:date-index task)))))
+        (config event-text-view :text (str (:name task) " goal: " (:duration task) " "))))
     listing
     sorted-map-array-to-array-task))

@@ -113,9 +117,6 @@

 (defn update-ui [activity]
   (set-elmt-text activity ::name ""))
-
-(defn add-to-listing [event-name date-key time-key]
-  (swap! listing update-in [date-key] (fnil conj []) [event-name time-key]))

 (defn add-event [activity]
   (let [date-key (try


Find disappearing logs for server.initiate (WIP)

Well, I found them. With the assistance of a bunch of println debugging.

It looks as though the cookie comes back mangled, but bytes= can't tell
the difference. So we fail to open that box.

Or something along those lines.

I haven't dug into the root cause yet. This was all about figuring out
where the log messages went so I can start figuring out what they mean.

--- src/clojure/frereth_cp/server/initiate.clj
+++ src/clojure/frereth_cp/server/initiate.clj
@@ -201,6 +201,9 @@
 (defn verify-client-pk-in-vouch
   [initiate hidden-pk]
   (let [expected (bytes (::K/clnt-short-pk initiate))]
+    ;; This is disconcerting.
+    ;; The values I'm seeing here very obviously do not match.
+    ;; But apparently bytes= thinks they do.
     (log/debug "Cookie extraction succeeded. Q: Do the contents match?"
                "\nExpected:\n"
                (shared/bytes->string expected)
@@ -211,7 +214,7 @@
 (s/fdef extract-cookie
         :args (s/cat :cookie-cutter ::state/cookie-cutter
                      :initiate-packet ::K/initiate-packet-spec)
-        :ret ::templates/cookie-spec)
+        :ret (s/nilable ::templates/cookie-spec))
 (defn extract-cookie
   [{:keys [::state/minute-key
            ::state/last-minute-key]
@@ -268,27 +271,40 @@
     :as initiate}
    current-client]

-  (log/info "Opening the Crypto box we just received from the client")
-  (log/debug "The box we're opening is" (count vouch-wrapper) "bytes long")
-  (let [message-length (- (count vouch-wrapper) K/minimum-vouch-length)]
-    (let [{log-state ::log2/state
-           clear-text ::crypto/unboxed} (crypto/open-box log-state
-                                                         K/initiate-nonce-prefix
-                                                         outer-i-nonce
-                                                         vouch-wrapper
-                                                         (get-in current-client [::state/shared-secrets
-                                                                                ::state/client-short<->server-short]))]
-      (if clear-text
-        {::log/state (log2/info log-state
-                                ::open-client-crypto-box
-                                "Decomposing...")
-         ::K/initiate-client-vouch-wrapper (serial/decompose (assoc-in K/initiate-client-vouch-wrapper
-                                                                       [::K/message ::K/length]
-                                                                       message-length)
-                                                             clear-text)}
-        {::log/state (log2/warn log-state
-                                ::open-client-crypto-box
-                                "Opening client crypto vouch failed")}))))
+  (println "Mark: top of open-client-crypto-box")
+  (let [log-state (log2/info log-state
+                             ::open-client-crypto-box
+                             "Opening the Crypto box we just received from the client")
+        vouch-length (count vouch-wrapper)
+        log-state (log2/debug log-state
+                              ::open-client-crypto-box
+                              (str "The box we're opening is " vouch-length " bytes long"))
+        message-length (- vouch-length K/minimum-vouch-length)
+        {log-state ::log2/state
+         clear-text ::crypto/unboxed
+         :as unboxed} (try
+                        (crypto/open-box log-state
+                                         K/initiate-nonce-prefix
+                                         outer-i-nonce
+                                         vouch-wrapper
+                                         (get-in current-client [::state/shared-secrets
+                                                                 ::state/client-short<->server-short]))
+                        (catch Exception ex
+                          (println "Mark: Opening crypto-box failed")
+                          {::log2/state (log2/exception log-state ex
+                                                        ::open-client-crypto-box)}))]
+    (println (str "Mark: crypto-box open succeeded. unboxed: '" (dissoc unboxed ::log2/state) "'."))
+    (if clear-text
+      {::log2/state (log2/info log-state
+                               ::open-client-crypto-box
+                               "Decomposing...")
+       ::K/initiate-client-vouch-wrapper (serial/decompose (assoc-in K/initiate-client-vouch-wrapper
+                                                                     [::K/message ::K/length]
+                                                                     message-length)
+                                                           clear-text)}
+      {::log2/state (log2/warn log-state
+                               ::open-client-crypto-box
+                               "Opening client crypto vouch failed")})))

 (s/fdef validate-server-name
         :args (s/cat :state ::state/state
@@ -472,11 +488,11 @@
 (s/fdef do-handle
   :args (s/cat :state ::state/state
                :packet ::shared/network-packet)
-  :ret ::state/state)
+  :ret ::state/delta)
 (defn do-handle
   "Deal with an incoming initiate packet

-  Called for side-effects"
+  Called mostly for side-effects, but the return value matters."
   [{log-state ::log2/state
     :keys [::log2/logger]
     :as state}
@@ -488,6 +504,7 @@
                              "Handling incoming initiate packet"
                              packet)
         message (bytes message)]
+    (println "Mark: top of initiate/do-handle")
     (or
      (let [n (count message)
            state-delta (if (>= n (+ K/box-zero-bytes packet-header-length))
@@ -502,6 +519,7 @@
                                                 (- n packet-header-length))
                                initiate (serial/decompose-array tmplt message)
                                client-short-pk (bytes (::K/clnt-short-pk initiate))]
+                           (println "Mark: Check for re-initiate")
                            (if-not (possibly-re-initiate-existing-client-connection! state initiate)
                              (let [active-client (state/find-client state client-short-pk)]
                                (if-let [cookie (extract-cookie (::state/cookie-cutter state)
@@ -516,7 +534,6 @@
                                                                                client-short-pk
                                                                                server-short-sk)
                                        state (state/alter-client-state state active-client)]
-
                                    ;; Now we've verified that the Initiate packet came from a
                                    ;; client that has the secret key associated with the short-term
                                    ;; public key.
@@ -525,6 +542,7 @@
                                    ;; Now we're ready to tackle handling the main message body cryptobox.
                                    ;; This corresponds to line 373 in the reference implementation.
                                    (try
+                                     (println "Mark: trying to open the client's crypto box")
                                      (let [{log-state ::log2/state
                                             client-message-box ::K/initiate-client-vouch-wrapper} (open-client-crypto-box log-state
                                                                                initiate
@@ -539,6 +557,7 @@
                                                                     {::message-box-keys (keys client-message-box)
                                                                      ::client-public-long-key (b-t/->string client-long-pk)})]
                                            (try
+                                             (println "Mark: validating server name")
                                              (if (validate-server-name state client-message-box)
                                                ;; This takes us down to line 381
                                                (if (verify-client-public-key-triad state client-short-pk client-message-box)
@@ -566,7 +585,7 @@
                                                                              ex
                                                                              ::do-handle
                                                                              "Failure after decrypting inner client cryptobox")})))
-                                         (assoc state ::log/state log-state)))
+                                         (assoc state ::log2/state log-state)))
                                      (catch ExceptionInfo ex
                                        {::log2/state (log2/exception log-state
                                                                      ex
@@ -581,6 +600,6 @@
                          {::log2/state (log2/warn log-state
                                                   ::do-handle
                                                   (str "Truncated initiate packet. Only received " n " bytes"))})]
-       (into state state-delta))
+       state-delta)
      ;; If nothing's changing, just maintain status quo
-     state)))
+     {})))


Added another rewriting step when computing EL-gfp-lcs

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

--- src/conexp/contrib/dl/languages/EL_gfp.clj
+++ src/conexp/contrib/dl/languages/EL_gfp.clj
@@ -72,7 +72,7 @@
      (let [G_T_1 (tbox->description-graph tbox)
 	   G-x-G (graph-product G_T_1 G_T_1),
 	   T_2   (tbox-union tbox (description-graph->tbox G-x-G))]
-       (clarify-tbox [T_2, [A,B]])))
+       (clarify-tbox (tidy-up-tbox (clarify-tbox [T_2, [A,B]])))))
   ([tbox A B & more]
      (let [[new-tbox new-target] (EL-gfp-lcs tbox A B)]
        (apply EL-gfp-lcs (tbox-union tbox new-tbox) new-target more))))
@@ -101,8 +101,7 @@

 (define-msc EL-gfp
   [model objects]
-  (let [[tbox target] (reduce-tbox (apply EL-gfp-msc model objects)),
-	[tbox target] (clarify-tbox (tidy-up-tbox [tbox target]))]
+  (let [[tbox target] (reduce-tbox (apply EL-gfp-msc model objects))]
     (if (acyclic? tbox)
       (definition-expression (first (tbox-definitions tbox)))
       [tbox target])))


Event tab traces now correctly display RegExp results

--- src/day8/re_frame_10x/view/components.cljs
+++ src/day8/re_frame_10x/view/components.cljs
@@ -226,6 +226,7 @@
         (cond
           (and @expanded?
                (or (string? data)
+                   (instance? js/RegExp data)
                    (number? data)
                    (boolean? data)
                    (nil? data))) [:div {:style {:margin "10px 0"}} (prn-str data)]


make sure ph bot is in cust-data

make sure ph bot is in cust-data

--- src-cljs/frontend/state.cljs
+++ src-cljs/frontend/state.cljs
@@ -81,7 +81,8 @@
    :editing-eids    {:editing-eids #{}}
    ;; Info about contributors to the doc
    ;; Combines sessions with custs, which might turn out to be a bad idea
-   :cust-data {:uuid->cust {(:cust/uuid subscriber-bot) (select-keys subscriber-bot [:cust/uuid :cust/name :cust/color-name])}}
+   :cust-data {:uuid->cust {(:cust/uuid subscriber-bot) (select-keys subscriber-bot [:cust/uuid :cust/name :cust/color-name])
+                            (:cust/uuid product-hunt-bot) (select-keys product-hunt-bot [:cust/uuid :cust/name :cust/color-name])}}
    :show-landing? false
    :overlays []
    :frontend-id-state nil


Be a little more lax with time comparisons

On windows, the sleep actually lasts for 0.49... seconds on occasion.

--- caching/test/immutant/caching/core_memoize_test.clj
+++ caching/test/immutant/caching/core_memoize_test.clj
@@ -25,7 +25,7 @@
   (stop "test")
   (let [f (fn [] (Thread/sleep 500) "boo")
         m (memo f "test")]
-    (is (> (timeit (m)) 0.5))
+    (is (> (timeit (m)) 0.48))
     (is (< (timeit (m)) 0.5))
     (is (= (m) "boo"))))

@@ -42,5 +42,4 @@
         f1 (future (timeit (m 42)))]
     (Thread/sleep 500)
     (is (< (timeit (m 42)) 0.5))
-    (is (> @f1 0.5))))
-
+    (is (> @f1 0.48))))


(MAINT) add testutils bootstrap-services-with-config

All of the various `with-app*` macros in the tk bootstrap testutils
have a corresponding `bootstrap-services*` fn that can be used in
cases where a test needs more control over the lifecycle of the app,
except for `with-app-with-config`.  This commit simply adds a
`bootstrap-services-with-config` to achieve parity there.

--- test/puppetlabs/trapperkeeper/testutils/bootstrap.clj
+++ test/puppetlabs/trapperkeeper/testutils/bootstrap.clj
@@ -10,11 +10,15 @@
 (def empty-config "./target/empty.ini")
 (fs/touch empty-config)

+(defn bootstrap-services-with-config
+  [services config]
+  (internal/throw-app-error-if-exists!
+   (tk/boot-services-with-config services config)))
+
 (defmacro with-app-with-config
   [app services config & body]
   `(ks-testutils/with-no-jvm-shutdown-hooks
-     (let [~app (internal/throw-app-error-if-exists!
-                  (tk/boot-services-with-config ~services ~config))]
+     (let [~app (bootstrap-services-with-config ~services ~config)]
        (try
          ~@body
          (finally


Fix plugin dummy tests

Fix plugin dummy tests

--- plugin/test/lein_doo/core_test.cljs
+++ plugin/test/lein_doo/core_test.cljs
@@ -2,7 +2,7 @@
   (:require [cljs.test :refer-macros [async deftest is testing]]))

 (deftest sync-test
-  (is (= 2 1)))
+  (is (= 1 1)))

 ;; Only works in browsers because it uses setTimeout
 (deftest async-test
@@ -10,6 +10,6 @@
     (is (= 1 1))
     (let [a 1]
       (js/setTimeout (fn []
-                       (is (= a 2))
+                       (is (= a 1))
                        (done))
         500))))


attempted history test to no avail

attempted history test to no avail

--- pedestal-app/test/semtag_web/integration_test.clj
+++ pedestal-app/test/semtag_web/integration_test.clj
@@ -41,6 +41,14 @@
   (core/click (taxi/find-element {:tag :a :text text}))
   (Thread/sleep 500))

+;; TODO - revisit not being able to go forward - log count stays the same going forward
+#_(deftest history-works
+  (click "Tag Stats")
+  (is (.endsWith (taxi/current-url) "/semtag-web-test.html#/tag-stats"))
+  (back)
+  (is (.endsWith (taxi/current-url) "/semtag-web-test.html#/"))
+  (forward))
+
 (deftest urls-get-updated-correctly
   (is (.endsWith (taxi/current-url) "/semtag-web-test.html"))
   (click "Tag Stats")
@@ -68,8 +76,8 @@
   ;; To debug headless browser - inject in template
   "<script>
       var logs = [];
-      console.log = function(m) {
-        logs.push(m);
+      console.log = function(m1, m2) {
+        logs.push([m1, m2]);
       };
     </script>"
   (println "LOGS: ")


Add keys and optional-keys functions to entity spec utilities

These help in obtaining all required and optional keys for an
entity.

--- src/main/workflo/macros/entity/schema.cljc
+++ src/main/workflo/macros/entity/schema.cljc
@@ -1,4 +1,5 @@
 (ns workflo.macros.entity.schema
+  (:refer-clojure :exclude [keys])
   (:require [clojure.set :refer [intersection]]
             [clojure.spec :as s]
             [workflo.macros.entity :as e]
@@ -85,7 +86,7 @@

 (defn key-schemas
   [kspecs]
-  (zipmap (keys kspecs)
+  (zipmap (clojure.core/keys kspecs)
           (mapv value-spec-schema (vals kspecs))))

 (defn types-entity-spec-schema
@@ -146,26 +147,35 @@

 ;;;; Utilities

-(defn required-keys-spec-keys
+(defn keys-spec-keys
   [entity spec]
-  (val-after spec :req))
+  {:required (val-after spec :req)
+   :optional (val-after spec :opt)})

-(defn required-and-spec-keys
+(defn and-spec-keys
   [entity spec]
   (let [keys-spec (first (filter keys-spec? spec))]
     (when keys-spec
-      (required-keys-spec-keys entity keys-spec))))
+      (keys-spec-keys entity keys-spec))))

-(defn required-spec-keys
+(defn spec-keys
   [entity spec]
-  (cond
-    (type-spec? spec) []
-    (and-spec? spec)  (or (required-and-spec-keys entity spec) [])
-    (keys-spec? spec) (or (required-keys-spec-keys entity spec) [])))
+  (or (cond
+        (and-spec? spec)  (and-spec-keys entity spec)
+        (keys-spec? spec) (keys-spec-keys entity spec))
+      {:required [] :optional []}))

-(defn required-keys
+(defn keys
   [entity]
   (let [desc (cond-> (:spec entity)
                (not (type-spec? (:spec entity)))
                s/describe)]
-    (required-spec-keys entity desc)))
+    (spec-keys entity desc)))
+
+(defn required-keys
+  [entity]
+  (:required (keys entity)))
+
+(defn optional-keys
+  [entity]
+  (:optional (keys entity)))


remove duplicate 'student activity' section

--- src/babel/espanol/writer.clj
+++ src/babel/espanol/writer.clj
@@ -40,7 +40,7 @@
                 (filter (fn [lexeme]
                           (and
                            ;; how to only generate for a single infinitive (for testing/development):
-                           (= (get-in lexeme [:espanol :espanol]) "abandonar")
+                           ;;                           (= (get-in lexeme [:espanol :espanol]) "abandonar")
                            (= (get-in lexeme [:synsem :cat]) :verb)
                            (= (get-in lexeme [:synsem :infl]) :top)
                            (not (= :top (get-in lexeme [:synsem :sem :pred] :top)))))


Whitespace

Whitespace

--- src/philly_show_checker/server/scraper.clj
+++ src/philly_show_checker/server/scraper.clj
@@ -37,13 +37,13 @@
   []
   (let [s (-> (scheduler/initialize) scheduler/start)]
     (doseq [[job-name job-def] @jobs]
-      (let [job-key (format (str (name job-name) ".%s") 1)
-            job     (jobs/build (jobs/of-type job-def) (jobs/with-identity (jobs/key job-key)))
+      (let [job-key     (format (str (name job-name) ".%s") 1)
+            job         (jobs/build (jobs/of-type job-def) (jobs/with-identity (jobs/key job-key)))
             trigger-key (triggers/key (format "%s.%s" job-key "triggers.1"))
-            trigger (triggers/build (triggers/with-identity trigger-key)
-                                    (triggers/start-now)
-                                    (triggers/with-schedule
-                                      (interval/schedule (interval/with-interval-in-days 1))))]
+            trigger     (triggers/build (triggers/with-identity trigger-key)
+                                        (triggers/start-now)
+                                        (triggers/with-schedule
+                                          (interval/schedule (interval/with-interval-in-days 1))))]
         (println (format "scheduling job %s" job-key))
         (scheduler/delete-trigger s trigger-key)
         (scheduler/schedule s job trigger)))))


remove whitespace

remove whitespace

--- src/bzzz/index_directory.clj
+++ src/bzzz/index_directory.clj
@@ -206,7 +206,6 @@
             (try-close-manager-taxo manager taxo)
             (swap! name->smanager-taxo* dissoc index)))))))

-
 (defn shutdown []
   (locking name->smanager-taxo*
     (log/info "executing shutdown hook, current mapping: " @name->smanager-taxo*)


Fix some <<project-ns>> instead of <<name>>

--- resources/leiningen/new/lambone/common/build.boot
+++ resources/leiningen/new/lambone/common/build.boot
@@ -81,8 +81,8 @@
 (def backend-options
   {:repl {:init-ns 'dev
           :port 5055}
-   :jar {:main '<<name>>.core
-         :file "<<name>>-standalone.jar"}
+   :jar {:main '<<project-ns>>.core
+         :file "<<project-ns>>-standalone.jar"}
    :aot {:all true}})

 (def backend-dev-dependencies
@@ -105,7 +105,7 @@
 (defmethod boot/options [:backend :test]
   [selection]
   (merge backend-options
-         {:test {:namespaces #{'acu.system-test}}
+         {:test {:namespaces #{'<<project-ns>>.system-test}}
           :env {:dependencies backend-dev-dependencies
                 :middleware @@(resolve 'boot.repl/*default-middleware*)
                 :source-paths #{"src/backend" "test/backend" "env/dev/src"}
@@ -145,7 +145,7 @@
   {:env {:source-paths #{"src/frontend"}
          :asset-paths #{"assets"}
          :dependencies (vec (concat frontend-dev-deps frontend-deps))}
-   :reload {:on-jsload '<<name>>.app/init}
+   :reload {:on-jsload '<<project-ns>>.app/init}
    :cljs-repl {:nrepl-opts {:port 5088}}
    :test-cljs {:suite-ns '<<project-ns>>.suite}})


optimize terminal-val with fast-constantly

--- src/clj/com/rpl/specter.cljx
+++ src/clj/com/rpl/specter.cljx
@@ -226,7 +226,7 @@
    the collected values or the value at the location."
   [p terminal]
   [v]
-  (p (constantly v)))
+  (p (i/fast-constantly v)))

 (def
   ^{:doc "Navigate to every element of the collection. For maps navigates to


refine logic for getting all errors from a model

--- src/clj_money/validation.clj
+++ src/clj_money/validation.clj
@@ -94,6 +94,8 @@
   returns a map of all errors. If given a model and a key, returns the
   errors for the specified key from wihin the model."
   ([model]
-   (get model ::errors))
+   (->> (get model ::errors)
+        (mapcat second)
+        (into [])))
   ([model attr-key]
    (get-in model [::errors attr-key])))


start applying auth rules in web/prices

start applying auth rules in web/prices

--- src/clj_money/web/prices.clj
+++ src/clj_money/web/prices.clj
@@ -7,6 +7,9 @@
             [clj-money.util :refer [format-date format-number]]
             [clj-money.web.shared :refer :all]
             [clj-money.validation :as validation]
+            [clj-money.authorization :refer [authorize
+                                             tag-resource
+                                             apply-scope]]
             [clj-money.models.commodities :as commodities]
             [clj-money.models.prices :as prices]
             [clj-money.models.prices.api-client :as prices-api]))
@@ -86,18 +89,24 @@

 (defn fetch
   [{params :params}]
-  (let [commodity (commodities/find-by-id (env :db) (Integer. (:commodity-id params)))
+  (let [commodity (commodities/find-by-id (env :db) (:commodity-id params))
         price (prices-api/fetch commodity)
-        result (prices/create (env :db) {:commodity-id (:id commodity)
-                                         :price (:price price)
-                                         :trade-date (:trade-date price)})]
+        to-create (-> {:commodity-id (:id commodity)
+                       :price (:price price)
+                       :trade-date (:trade-date price)}
+                      (tag-resource :price)
+                      (authorize :create))
+        result (prices/create (env :db) to-create)]
     (if (validation/has-error? result)
       (new-price {:params params} result)
       (redirect (format "/commodities/%s/prices" (:commodity-id result))))))

 (defn fetch-all
   [{params :params}]
-  (->> (select-keys params [:entity-id])
+  (->> (-> params
+           (select-keys [:entity-id])
+           (assoc :type ["stock" "fund"])
+           (apply-scope :commodity))
        (commodities/search (env :db))
        (map #(-> %
                  prices-api/fetch


bugfix: dumb typos

bugfix: dumb typos

--- src/cljs/greffe/analyze.cljs
+++ src/cljs/greffe/analyze.cljs
@@ -11,8 +11,8 @@

 (defn attributes-text-editable? [node]
   (if (and
-        {:attrs node}
-        (> (count {:attrs node}) max-attr-count))
+        (:attrs node)
+        (> (count (:attrs node)) max-attr-count))
     false
     true))


Not change url when typing

Not change url when typing

--- src/cljs/subman/history.cljs
+++ src/cljs/subman/history.cljs
@@ -3,7 +3,8 @@
             [goog.events :as gevents]
             [goog.history.EventType :as history-event]
             [goog.string :as string]
-            [goog.history.Html5History :as history5]))
+            [goog.history.Html5History :as history5]
+            [jayq.util :refer [wait]]))

 (defn get-history
   "Get html5 history obj or fallback"
@@ -23,11 +24,12 @@
     (let [history (get-history)]
       (add-watch value :history
                  (fn [_ _ _ new-value]
-                   (.setToken history new-value)))
+                   (wait 500 #(when (= new-value @value)
+                                (.setToken history new-value)))))
       (gevents/listen history history-event/NAVIGATE
                       #(let [token (.-token %)]
                          (when-not (= token @value)
-                           (reset! value (.-token %)))))
+                           (reset! value token))))
       (->> (.getToken history)
            string/urlDecode
            (reset! value)))))


ideas

ideas

--- src/cljs/triboard/ai/ai.cljs
+++ src/cljs/triboard/ai/ai.cljs
@@ -53,6 +53,7 @@
 ;; -----------------------------------------

 ;; TODO - How to add the custom scoring? How to keep the game? (use keys)
+;; TODO - Sort by score and use alpha-beta min/max functions instead of standard min/max
 (defn leaf-score
   [ai game]
   (:scores (game/current-turn game)))


Fix scaling

Fix scaling

--- src/cljx/robinson/prism.cljx
+++ src/cljx/robinson/prism.cljx
@@ -50,7 +50,8 @@

 (defn scale [s f]
   (fn [[x y]]
-    (f [(* s x) (* s y)])))
+    (let [s (/ 1 s)]
+      (f [(* s x) (* s y)]))))

 (defn center [f]
   (fn [[x y]]


fix launching of app in dev

fix launching of app in dev

--- src/clojurelive_web/core.clj
+++ src/clojurelive_web/core.clj
@@ -12,6 +12,4 @@
     (web/run-dmc handler args)))

 (defn -main [& {:as args}]
-  (run-web handler/app
-           (merge {"host" (env :demo-web-host), "port" (env :demo-web-port)}
-                  args)))
+  (run-web handler/app args))


Badge adverts, added remote issuer tier and banner to schema

--- src/cljc/salava/extra/application/schemas.cljc
+++ src/cljc/salava/extra/application/schemas.cljc
@@ -28,7 +28,10 @@
 (s/defschema BadgeAdvertPublish (-> BadgeAdvert
                                     (dissoc :id :issuer_content_id :badge_content_id
                                             :criteria_content_id :ctime :mtime :deleted)
-                                    (assoc :badge s/Str :client s/Str)))
+                                    (assoc :badge  s/Str
+                                           :client s/Str
+                                           :remote_issuer_tier   s/Str
+                                           :remote_issuer_banner (s/maybe s/Str))))

 (s/defschema BadgeAdvertUnpublish {:remote_url       s/Str
                                    :remote_id        s/Str


added eng version of instructions for session 2

--- src/cljs/work_sessions/components/headers.cljs
+++ src/cljs/work_sessions/components/headers.cljs
@@ -12,6 +12,24 @@
    [:p
     "EN"]
    [:p
+    "You can join by the "
+    [:a {:href "/session-two-room"
+         :target "_blank"}
+     "link"]
+    "."]
+   [:p
+    (unescapeEntities "A number of participants in one session — up to 10 people.")]
+   [:p
+    "This is a digital union of non-material workers, the virtual space of multi-user processing, so try not to distract each other, you can watch someone doing her cognitive work."]
+   [:p
+    "You can be present with an image of you, you can also share your screen with your current work (On the left side of the screen, click Share screen – a button with a green computer). The sound stays on."]
+   [:p
+    "In this very session we are focusing on improving the infrastructure for work: clean the desktop, install a photoshop that has not been installed for a long time, add a plug-in that has always been lacking, clean e-mail to avoid paying for it, unsubscribe from mailouts that are so many that nothing can be found in the Inbox."]
+   [:p
+    (unescapeEntities "The session length is 1 hour, 13.30 — 14.30 Helsinki and Moscow time.")]
+   [:p
+    (unescapeEntities "The next session will be in a week — on 9 June, time stays the same.")]
+   [:p
     "Join a simultaneous work session from your computer by opening "
     [:a {:href "http://sws.eeefff.org/session-two-room"
          :target "_blank"}
@@ -36,21 +54,6 @@
          :target "_blank"}
      "Google Chrome"]
     " and join the call after installing Hangouts."]
-
-   [:p
-    "You can be present with an image of you, you can also share your screen with your current work. The sound stays on."]
-
-   [:p
-    "In this very session we are focusing on the things that we wanted to do for a long time, but haven’t got time for that, the things that are oppressing us: answering emails that we were escaping to answer, writing to a friend that is waiting, composing a text that is hanging on you, something that screws you up."]
-
-   [:p
-    "This is a digital union of non-material workers, the virtual space of multi-user processing, so try not to distract each other, you can watch someone doing her cognitive work."]
-
-   [:p
-    "The session length is 1 hour, 13.30 – 14.30 Helsinki and Moscow time."]
-
-   [:p
-    "The next session will be in a week – on 9 June, time stays the same."]
    ;;
    ;; RUSSIAN
    ;;


Cover everything update-related with tests

--- test/clojure/clojurewerkz/cassaforte/new_query_api_test.clj
+++ test/clojure/clojurewerkz/cassaforte/new_query_api_test.clj
@@ -263,4 +263,62 @@
                  )))

-  )
+  (is (= "UPDATE foo SET b=[3]+b,c=c+['a'],d=d+[1,2,3],e=e-[1];"
+         (update :foo
+                 (array-map :b (prepend 3)
+                            :c (append "a")
+                            :d (append-all [1 2 3])
+                            :e (discard 1)))))
+
+  (is (= "UPDATE foo SET b=b-[1,2,3],c=c+{1},d=d+{4,3,2};"
+         (update :foo
+                 (array-map :b (discard-all [1 2 3])
+                            :c (add-tail 1)
+                            :d (add-all-tail #{2 3 4})))))
+
+  (is (= "UPDATE foo SET b=b-{2,3,4},c['k']='v',d=d+{'x':3,'y':2};"
+         (update :foo
+                 (array-map :b (remove-all-tail (sorted-set 2 3 4))
+                            :c (put-value "k" "v")
+                            :d (put-values (array-map "x" 3
+                                                      "y" 2))))))
+
+  (is (= "UPDATE foo USING TTL 400;"
+         (update :foo
+                 {}
+                 (using {:ttl 400}))))
+
+
+  (is (= (str "UPDATE foo SET a=" (BigDecimal. 3.2) ",b=42 WHERE k=2;")
+         (update :foo
+                 (array-map :a (BigDecimal. 3.2)
+                            :b (BigInteger. "42"))
+                 (where {:k 2}))))
+
+  (is (= "UPDATE foo USING TIMESTAMP 42 SET b=[3,2,1]+b WHERE k=2 AND l='foo';"
+         (update :foo
+                 (array-map :b (prepend-all [3 2 1]))
+                 (where (array-map :k 2
+                                   :l "foo"))
+                 (using {:timestamp 42}))))
+
+  (is (thrown? IllegalArgumentException
+               (update :foo
+                       {}
+                       (using {:ttl -400}))))
+
+  (is (= "UPDATE foo SET x=4 WHERE k=0 IF x=1;"
+         (update :foo
+                 {:x 4}
+                 (where {:k 0})
+                 (only-if {:x 1}))))
+
+  (is (= "UPDATE foo SET x=4 WHERE k=0 IF foo='bar' AND moo>3 AND meh>4 AND baz IN (5,6,7);"
+         (update :foo
+                 {:x 4}
+                 (where {:k 0})
+                 (only-if [[:= :foo "bar"]
+                           [:> :moo 3]
+                           [:> :meh 4]
+                           [:in :baz [5 6 7]]
+                           ])))))


Add tests for sorted keys

Add tests for sorted keys

--- test/javascript_externs_generator/extern_test.cljs
+++ test/javascript_externs_generator/extern_test.cljs
@@ -72,3 +72,14 @@
                     "/**********************************************************************/\n")
         expected (str header "var TEST = {};\n" footer)]
     (is (= expected output))))
+
+(deftest sorted-keys
+  (let [js-string "var TEST = {zero: 0, apple: 0, octopus: 0};"
+        expected "var TEST = {\"apple\": {},\"octopus\": {},\"zero\": {}};"]
+    (compare! expected js-string)))
+
+(deftest sorted-prototype-keys
+  (let [js-string "var TEST = {testFunction: function(){}, another: function(){}}; TEST.testFunction.prototype.testPrototypeFunction = function(){}"
+        expected "var TEST = {\"another\": function(){},\"testFunction\": function(){}};TEST.testFunction.prototype = {\"testPrototypeFunction\": function(){}};"]
+    (compare! expected js-string)))
+


Updating sprint 33 demo and correcting spelling mistake.

--- search-app/src/cmr/search/services/query_execution/facets_results_feature.clj
+++ search-app/src/cmr/search/services/query_execution/facets_results_feature.clj
@@ -47,7 +47,7 @@
    :aggs (hierarchical-aggregation-builder field (field nested-fields-mappings))})

 (def ^:private flat-facet-aggregations
-  "This is the aggregations map that will be passed to elasticsearch to request facetted results
+  "This is the aggregations map that will be passed to elasticsearch to request faceted results
   from a collection search."
   {:archive-center (terms-facet :archive-center)
    :project (terms-facet :project-sn)
@@ -65,7 +65,7 @@
    :detailed-variable (terms-facet :detailed-variable)})

 (def ^:private hierarchical-facet-aggregations
-  "This is the aggregations map that will be passed to elasticsearch to request facetted results
+  "This is the aggregations map that will be passed to elasticsearch to request faceted results
   from a collection search."
   {:archive-center (terms-facet :archive-center)
    :project (terms-facet :project-sn)


creact keys

creact keys

--- src-cljs/frontend/components/canvas.cljs
+++ src-cljs/frontend/components/canvas.cljs
@@ -177,7 +177,7 @@
                                                                           :y y}))
                                 :key (str "edit-handle-" x "-" y)})))))))

-(defn layer-group [{:keys [layer tool selected? part-of-group? cast! db live?]} owner]
+(defn layer-group [{:keys [layer tool selected? part-of-group? live?]} owner]
   (reify
     om/IDisplayName (display-name [_] "Layer Group")
     om/IRender
@@ -404,24 +404,25 @@
     (render [_]
       (let [subscribers (cursors/observe-subscriber-mice owner)]
         (apply dom/g nil
-               (om/build-all cursor (dissoc subscribers client-id)))))))
+               (om/build-all cursor (dissoc subscribers client-id) {:key-fn first}))))))

 (defn single-subscriber-layers [[client-id data] owner]
   (reify
     om/IDisplayName (display-name [_] "Single Subscriber Layers")
     om/IRender
     (render [_]
-      (apply dom/g nil (mapv (fn [l] (svg-element (merge l {:layer/end-x (:layer/current-x l)
-                                                                :layer/end-y (:layer/current-y l)
-                                                                :strokeDasharray "5,5"
-                                                                :layer/fill "none"
-                                                                :style {:stroke (:color data)}
-                                                                :fillOpacity "0.5"
-                                                                :key (str (:db/id l) "-subscriber-layer-" client-id)}
-                                                             (when (= :layer.type/text (:layer/type l))
-                                                               {:layer/stroke "none"
-                                                                :style {:fill (:color data)}}))))
-                             (:layers data))))))
+      (apply dom/g nil
+             (mapv (fn [l] (svg-element (merge l {:layer/end-x (:layer/current-x l)
+                                                  :layer/end-y (:layer/current-y l)
+                                                  :strokeDasharray "5,5"
+                                                  :layer/fill "none"
+                                                  :style {:stroke (:color data)}
+                                                  :fillOpacity "0.5"
+                                                  :key (str (:db/id l) "-subscriber-layer-" client-id)}
+                                               (when (= :layer.type/text (:layer/type l))
+                                                 {:layer/stroke "none"
+                                                  :style {:fill (:color data)}}))))
+                   (:layers data))))))

 (defn subscribers-layers [_ owner]
   (reify
@@ -430,7 +431,7 @@
     (render [_]
       (let [subscribers (cursors/observe-subscriber-layers owner)]
         (apply dom/g nil
-               (om/build-all single-subscriber-layers subscribers))))))
+               (om/build-all single-subscriber-layers subscribers {:key-fn first}))))))

 (defn text-input [layer owner]
   (reify
@@ -788,13 +789,13 @@

                  (dom/g
                    #js {:transform (cameras/->svg-transform camera)}
-                   (om/build cursors {})
-
-                   (om/build svg-layers {:tool tool})
-
-                   (om/build subscribers-layers {})
-
-                   (om/build in-progress (select-keys app [:layer-properties-menu :mouse-down]))))))))
+                   (om/build cursors {} {:react-key "cursors"})
+
+                   (om/build svg-layers {:tool tool} {:react-key "svg-layers"})
+
+                   (om/build subscribers-layers {} {:react-key "subscribers-layers"})
+
+                   (om/build in-progress (select-keys app [:layer-properties-menu :mouse-down]) {:react-key "in-progress"})))))))

 (defn canvas [app owner]
   (reify


Improve performance of content type (~15x)

--- ring-core/src/ring/util/request.clj
+++ ring-core/src/ring/util/request.clj
@@ -17,8 +17,9 @@
   "Return the content-type of the request, or nil if no content-type is set."
   {:added "1.3"}
   [request]
-  (if-let [type (get-in request [:headers "content-type"])]
-    (second (re-find #"^(.*?)(?:;|$)" type))))
+  (if-let [type ^String (get (:headers request) "content-type")]
+    (let [i (.indexOf type ";")]
+      (if (neg? i) type (subs type 0 i)))))

 (defn content-length
   "Return the content-length of the request, or nil no content-length is set."


Add message about 'guest' login.

Add message about 'guest' login.

--- src/hackerati_interval_web_app/views/views.clj
+++ src/hackerati_interval_web_app/views/views.clj
@@ -135,7 +135,7 @@
 (defn index [username]
   (if (and username (db/exists? :username username))
     (logged-in username)
-    (logged-out nil)))
+    (logged-out "Welcome! If this is your first time here, please try logging in with username \"guest\" and no password.")))

 (defn login [username password]
   (let [message "Error: username/password invalid!"]


do not scroll input

do not scroll input

Signed-off-by: Andrey Shovkoplyas <b713972e59b8e606e23253c4a13e948139fea4d1@gmail.com>

--- src/status_im/ui/screens/chat/styles/input/input.cljs
+++ src/status_im/ui/screens/chat/styles/input/input.cljs
@@ -1,10 +1,8 @@
 (ns status-im.ui.screens.chat.styles.input.input
   (:require [status-im.ui.components.colors :as colors]
-            [status-im.ui.screens.chat.styles.message.message :refer [message-author-name]]
-            [status-im.utils.styles :as styles]))
+            [status-im.ui.screens.chat.styles.message.message :refer [message-author-name]]))

 (def min-input-height 36)
-(def padding-vertical 8)
 (def border-height 1)
 (def max-input-height (* 5 min-input-height))

@@ -40,9 +38,6 @@
          :height 18
          :include-font-padding false))

-(def reply-message-container
-  {:flex-direction :column-reverse})
-
 (def reply-message-to-container
   {:flex-direction  :row
    :height          18
@@ -50,12 +45,6 @@
    :padding-bottom  0
    :padding-right   8
    :justify-content :flex-start})
-
-(def reply-icon
-  {:width         20
-   :margin-top    1
-   :margin-bottom 1
-   :margin-right  0})

 (def cancel-reply-highlight
   {:align-self :flex-start
@@ -79,71 +68,9 @@
   {:flex-direction :row
    :align-items    :flex-end})

-(def input-animated
-  {:align-items    :flex-start
-   :flex-direction :row
-   :flex-grow      1
-   :min-height     min-input-height
-   :max-height     max-input-height})
-
 (def input-view
   {:flex               1
    :padding-top        12
    :padding-bottom     15
    :padding-horizontal 12
-   :min-height         min-input-height
    :max-height         max-input-height})
-
-(def invisible-input-text
-  {:position         :absolute
-   :left             0
-   :background-color :transparent
-   :color            :transparent})
-
-(styles/defn invisible-input-text-height [container-width]
-  {:width            container-width
-   :flex             1
-   :padding-top      5
-   :padding-bottom   5
-   :android          {:padding-top 3}
-   :position         :absolute
-   :left             0
-   :background-color :transparent
-   :color            :transparent})
-
-(styles/defn input-helper-view [left opacity]
-  {:opacity  opacity
-   :position :absolute
-   :height   min-input-height
-   :android  {:left (+ 4 left)}
-   :ios      {:left left}
-   :desktop  {:left left}})
-
-(styles/defn input-helper-text [left]
-  {:color               colors/gray
-   :text-align-vertical :center
-   :flex                1
-   :android             {:top -1}
-   :ios                 {:line-height min-input-height}
-   :desktop             {:line-height min-input-height}})
-
-(styles/defn seq-input-text [left container-width]
-  {:min-width           (- container-width left)
-   :position            :absolute
-   :text-align-vertical :center
-   :align-items         :center
-   :android             {:left   (+ 2 left)
-                         :height (+ 2 min-input-height)
-                         :top    0.5}
-   :ios                 {:line-height min-input-height
-                         :height      min-input-height
-                         :left        left}
-   :desktop             {:line-height min-input-height
-                         :height      min-input-height
-                         :left        left}})
-
-(def input-clear-container
-  {:width       24
-   :height      24
-   :margin-top  7
-   :align-items :center})


Only inject panel once

Only inject panel once

--- src/day8/re_frame/trace.cljs
+++ src/day8/re_frame/trace.cljs
@@ -251,7 +251,15 @@
                                         :subvis [subvis/render-subvis traces]
                                         [render-traces])]]]))})))

+(defn panel-div []
+  (let [id    "--re-frame-trace--"
+        panel (.getElementById js/document id)]
+    (if panel
+      panel
+      (let [new-panel (.createElement js/document "div")]
+        (.setAttribute new-panel "id" id)
+        (.appendChild (.-body js/document) new-panel)
+        new-panel))))
+
 (defn inject-devtools! []
-  (let [div (.createElement js/document "div")]
-    (.appendChild (.-body js/document) div)
-    (r/render [devtools] div)))
+  (r/render [devtools] (panel-div)))


Sort meta based on order it should be drawn.

--- src/cljs/wombats_web_client/components/arena.cljs
+++ src/cljs/wombats_web_client/components/arena.cljs
@@ -27,16 +27,32 @@
   [canvas-element x y width height]
   (draw-image canvas-element
               "arena_bg.png"
-              x
-              y
-              width
-              height))
+              x y width height))
+
+(defn- meta-value
+  "Gets a score for a meta type for sorting draw level"
+  [meta]
+  (case (:type meta)
+    :shot      1
+    :explosion 2
+    :smoke     3
+    0))
+
+(defn- sort-meta
+  "This sorts meta according to draw order"
+  [meta]
+  (sort #(let [val1 (meta-value %1)
+               val2 (meta-value %2)]
+           (cond
+             (< val1 val2) -1
+             (> val1 val2) 1
+             :else 0)) meta))

 (defn- draw-meta
   "Draws generic meta objects"
   [canvas-element contents meta x y width height]
   (doseq [{type :type
-           orientation :orientation} meta]
+           orientation :orientation} (sort-meta meta)]
     (case type
       :shot
       (draw-image canvas-element
@@ -69,7 +85,8 @@
                        :medium "2"
                        "1")
                      ".png")
-                x y width height)))
+                x y width height)
+    (draw-meta canvas-element contents meta x y width height)))

 (defn- draw-steel-barrier
   [canvas-element contents meta x y width height]
@@ -81,7 +98,8 @@
                        :medium "2"
                        "1")
                      ".png")
-                x y width height)))
+                x y width height)
+    (draw-meta canvas-element contents meta x y width height)))

 (defn- draw-food
   [canvas-element contents meta x y width height]
@@ -114,13 +132,10 @@
     ;; Always draw the base zakano
     (draw-image canvas-element
                 (str "zakano_" direction ".png")
-                x
-                y
-                width
-                height)
+                x y width height)

     ;; See if we need to add any meta to the zakano
-    (doseq [{type :type} meta]
+    (doseq [{type :type} (sort-meta meta)]

       (case type
         :shot
@@ -160,7 +175,7 @@
                 height)

     ;; See if we need to add any meta to the wombat
-    (doseq [{type :type} meta]
+    (doseq [{type :type} (sort-meta meta)]

       (case type
         :shot


Problem added - "Anagram Finder"

Problem added - "Anagram Finder"

--- src/foreclojure/data_set.clj
+++ src/foreclojure/data_set.clj
@@ -832,6 +832,7 @@
            :times-solved 0
            :description "A tic-tac-toe board is represented by a two dimensional vector. X is represented by :x, O is represented by :o, and empty is represented by :e.  A player wins by placing three Xs or three Os in a horizontal, vertical, or diagonal row.  Write a function which analyzes a tic-tac-toe board and returns :x if X has won, :o if O has won, and nil if neither player has won."
            :tags ["medium" "game"]
+	   :approved true
            :tests ["(= nil (__ [[:e :e :e]\n            [:e :e :e]\n            [:e :e :e]]))"
 		   "(= :x (__ [[:x :e :o]\n           [:x :e :e]\n           [:x :e :o]]))"
 		   "(= :o (__ [[:e :x :e]\n           [:o :o :o]\n           [:x :e :x]]))"
@@ -846,6 +847,7 @@
            :times-solved 0
            :description "Given a string of comma separated integers, write a function which returns a new comma separated string that only contains the numbers which are perfect squares."
            :tags ["medium"]
+	   :approved true
            :tests ["(= (__ \"4,5,6,7,8,9\") \"4,9\")"
 		   "(= (__ \"15,16,25,36,37\") \"16,25,36\")"]})

@@ -855,6 +857,7 @@
            :times-solved 0
            :description "Two numbers are coprime if their greatest common divisor equals 1.  Euler's totient function f(x) is defined as the number of positive integers less than x which are coprime to x.  The special case f(1) equals 1.  Write a function which calculates Euler's totient function."
            :tags ["medium"]
+	   :approved true
            :tests ["(= (__ 1) 1)"
 		   "(= (__ 10) (count '(1 3 7 9)) 4)"
 		   "(= (__ 40) 16)"
@@ -866,14 +869,38 @@
            :times-solved 0
            :description "The trampoline function takes a function f and a variable number of parameters.  Trampoline calls f with any parameters that were supplied.  If f returns a function, trampoline calls that function with no arguments.  This is repeated, until the return value is not a function, and then trampoline returns that non-function value.  This is useful for implementing mutually recursive algorithms in a way that won't consume the stack."
            :tags ["medium", "recursion"]
+	   :approved true
            :tests ["(= __\n   (letfn\n     [(foo [x y] #(bar (conj x y) y))\n      (bar [x y] (if (> (last x) 10)\n                   x\n                   #(foo x (+ 2 y))))]\n     (trampoline foo [] 1)))"]})

       (insert! :problems
           {:_id 77
+           :title "Anagram Finder"
+           :times-solved 0
+           :description "Write a function which finds all the anagrams in a vector of words.  A word x is an anagram of word y if all the letters in x can be rearranged in a different order to form y.  Your function should return a set of sets, where each sub-set is a group of words which are anagrams of each other.  Each sub-set should have at least two words.  Words without any anagrams should not be included in the result."
+           :tags ["medium"]
+	   :approved true
+           :tests ["(= (__ [\"meat\" \"mat\" \"team\" \"mate\" \"eat\"])\n   #{#{\"meat\" \"team\" \"mate\"}})"
+		   "(= (__ [\"veer\" \"lake\" \"item\" \"kale\" \"mite\" \"ever\"])\n   #{#{\"veer\" \"ever\"} #{\"lake\" \"kale\"} #{\"mite\" \"item\"}})"]})
+
+
+      (insert! :problems
+           {:_id 78
+            :title "Reimplement Trampoline"
+            :times-solved 0
+            :restricted ["trampoline"]
+            :description "Reimplement the function described in  \"Intro to Trampoline\"."
+            :approved true
+            :tags ["medium" "core-functions"]
+            :tests ["(= (letfn [(triple [x] #(sub-two (* 3 x)))\n          (sub-two [x] #(stop?(- x 2)))\n          (stop? [x] (if (> x 50) x #(triple x)))]\n    (__ triple 2))\n  82)"
+                    "(= (letfn [(my-even? [x] (if (zero? x) true #(my-odd? (dec x))))\n          (my-odd? [x] (if (zero? x) false #(my-even? (dec x))))]\n    (map (partial __ my-even?) (range 6)))\n  [true false true false true false])"]})
+
+      (insert! :problems
+          {:_id 79
            :title "Create an Equation"
            :times-solved 0
            :description "Write a function which takes three or more integers.  Using these integers, your function should generate clojure code representing an equation.  The following rules for the equation must be satisfied:\n\n    1. All integers must be used once and only once.\n    2. The order of the integers must be maintained when reading the equation left-to-right.\n    3. The only functions you may use are +, *, or =.\n    4. The equation must use the minimum number of parentheses.\n    5. If no satisfying equation exists, return nil."
            :tags ["hard", "code-generation"]
+	   :approved true
            :tests ["(= (__ 3 4 7) '(= (+ 3 4) 7))"
 		   "(= (__ 3 4 12) '(= (* 3 4) 12))"
 		   "(= (__ 3 4 14) nil)"
@@ -887,23 +914,13 @@

       (insert! :problems
-           {:_id 78
-            :title "Reimplement Trampoline"
-            :times-solved 0
-            :restricted ["trampoline"]
-            :description "Reimplement the function described in  \"Intro to Trampoline\"."
-            :approved true
-            :tags ["medium" "core-functions"]
-            :tests ["(= (letfn [(triple [x] #(sub-two (* 3 x)))\n          (sub-two [x] #(stop?(- x 2)))\n          (stop? [x] (if (> x 50) x #(triple x)))]\n    (__ triple 2))\n  82)"
-                    "(= (letfn [(my-even? [x] (if (zero? x) true #(my-odd? (dec x))))\n          (my-odd? [x] (if (zero? x) false #(my-even? (dec x))))]\n    (map (partial __ my-even?) (range 6)))\n  [true false true false true false])"]})
-
-      (insert! :problems
-           {:_id 79
+           {:_id 80
             :title "Power Set"
             :times-solved 0
             :description "A power set is the set of all subsets of a given set. Given a list, produce a set of sublists while preserving the order of elements."
             :approved true
             :tags ["hard" "seqs"]
+	    :approved true
             :tests ["(= (__ '(1 :a)) '#{(1 :a) (:a) () (1)})"
                     "(= (__ '()) '#{()})"
                     "(= (__ '(1 2 3)) '#{() (1) (2) (3) (1 2) (1 3) (2 3) (1 2 3)})"


add helmsman-context to navigator app def

--- src/galleon/applications.clj
+++ src/galleon/applications.clj
@@ -15,11 +15,12 @@
     :start-fn! nil
     :stop-fn! nil
     :helmsman-context "nil"
-    :helmsman-definition nil}
+    :helmsman-definition nil}
    {:app-name "Timber"
     :helmsman-definition timber/helmsman-assets}
    {:app-name "Navigator"
     :schema n-schema/schema
+    :helmsman-context "navigator"
     :helmsman-definition-db-conn true
     :helmsman-definition navigator/helmsman-def}
    {:app-name "Gangway"


add TODOs

add TODOs

--- src/babel/francais/morphology/verbs.cljc
+++ src/babel/francais/morphology/verbs.cljc
@@ -905,6 +905,7 @@
                        :agr agr}))})
        regular-patterns-source))

+;; TODO: unify irregular-patterns and irregular-conjugations.
 (def irregular-patterns
   [;; 1. past-tense exceptions
    {:path [:français :past-participle]
@@ -1233,6 +1234,7 @@
                    :agr {:number :plur
                          :person :2nd}}}])}])

+;; TODO: unify irregular-patterns (above) and irregular-conjugations.
 (def irregular-conjugations
   (concat
    [;; irregular conditional with :future-stem


+TODO

+TODO

--- src/babel/italiano/morphology/verbs.cljc
+++ src/babel/italiano/morphology/verbs.cljc
@@ -484,6 +484,8 @@
         infinitive (get-in word [:italiano])]
     (first (do-replace-on infinitive unifying-patterns))))

+;; TODO: rewrite this using pattern matching against
+;; babel.italiano.morphology/patterns.
 (defn conjugate [word]
   (let [infinitive (get-in word [:italiano])]
     (cond


Updating the paragraph text, instead of a popup.

--- 02-digital-clock/src/cljs/digital_clock/client.cljs
+++ 02-digital-clock/src/cljs/digital_clock/client.cljs
@@ -2,9 +2,9 @@
   (:require [clojure.browser.dom :as dom]
             [clojure.browser.event :as event]))

-(defn handle-click []
-  (js/alert (js/Date)))
-
 (def clock-paragraph (dom/get-element "digital-clock"))

+(defn handle-click []
+  (dom/set-text clock-paragraph (js/Date)))
+
 (event/listen clock-paragraph :click handle-click)


Forget to remove one reference to c.c.draw.util

Gah!

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

--- src/conexp/contrib/draw/nodes_and_connections.clj
+++ src/conexp/contrib/draw/nodes_and_connections.clj
@@ -8,7 +8,6 @@

 (ns conexp.contrib.draw.nodes-and-connections
   (:use [conexp.base :only (ns-doc,defvar-, defvar, round, union, difference)]
-	conexp.contrib.draw.util
 	conexp.contrib.draw.scenes)
   (:use	[clojure.contrib.core :only (-?>)])
   (:import [java.awt Color]


cleanup error text for structure validations

--- src/clj/backtype/storm/daemon/common.clj
+++ src/clj/backtype/storm/daemon/common.clj
@@ -134,16 +134,16 @@
               :let [source-component-id (.get_componentId global-stream-id)
                     source-stream-id    (.get_streamId global-stream-id)]]
         (if-not (contains? all-components source-component-id)
-          (throw (InvalidTopologyException. (str "Component: [" id "] subscribe from non-exists component [" source-component-id "]")))
+          (throw (InvalidTopologyException. (str "Component: [" id "] subscribes from non-existent component [" source-component-id "]")))
           (let [source-streams (-> all-components (get source-component-id) .get_common .get_streams)]
             (if-not (contains? source-streams source-stream-id)
-              (throw (InvalidTopologyException. (str "Component: [" id "] subscribe from non-exists stream: [" source-stream-id "] of component [" source-component-id "]")))
+              (throw (InvalidTopologyException. (str "Component: [" id "] subscribes from non-existent stream: [" source-stream-id "] of component [" source-component-id "]")))
               (if (= :fields (thrift/grouping-type grouping))
                 (let [grouping-fields (set (.get_fields grouping))
                       source-stream-fields (-> source-streams (get source-stream-id) .get_output_fields set)
                       diff-fields (set/difference grouping-fields source-stream-fields)]
                   (when-not (empty? diff-fields)
-                    (throw (InvalidTopologyException. (str "Component: [" id "] subscribe from stream: [" source-stream-id "] of component [" source-component-id "] with non-exists fields: " diff-fields)))))))))))))
+                    (throw (InvalidTopologyException. (str "Component: [" id "] subscribes from stream: [" source-stream-id "] of component [" source-component-id "] with non-existent fields: " diff-fields)))))))))))))

 (defn acker-inputs [^StormTopology topology]
   (let [bolt-ids (.. topology get_bolts keySet)


Replace most .btn styles with tailwind

Replace most .btn styles with tailwind

--- src/cljs/my_money/components/navbar.cljs
+++ src/cljs/my_money/components/navbar.cljs
@@ -11,8 +11,10 @@
   [:a.block.py-2.px-4 {:href "#/login"} "Login"])

 (defn logout-button [e! user]
-  [:a.btn.btn-outline-danger.btn-sm-ml-1
-   {:href "#"
+  [:a.btn-outline-danger.btn-sm-ml-1
+   ; TODO .btn transitions need to be replaced
+   {:class ["inline-block" "font-normal" "text-center" "align-middle" "select-none" "bg-transparent" "border-2" "border-solid" "text-base" "py-1.5" "px-3" "rounded"]
+    :href "#"
     :on-click #(e! (ac/->Logout))}
    [:i.fa.fa-user " " user " | log out"]])