add PTraining protocol

add PTraining protocol

--- src/cortex/protocols.clj
+++ src/cortex/protocols.clj
@@ -52,6 +52,12 @@
   (input-gradient [this]
     "Gets the computed input gradients for a module. Assumes the backward pass has been run."))

+(defprotocol PTraining
+  "Protocol for modules that can be trained input / output pairs."
+  (train [this input output]
+    "Trains the module to produce the given input / output. Accumulates gradients as necessary.
+     Intended for use with update-parameters after completion of a (mini-)batch."))
+
 (defprotocol PGradientOptimiser
   "A gradient optimiser is an abstraction for objects that update parameters based on gradient observations.
    Gradient optimisers typically contain relating to previous observations, momentum etc."


Refactor HTTP test helper

Refactor HTTP test helper

- Reorder parameters to be more consistent

--- test/time_tracker/test_helpers.clj
+++ test/time_tracker/test_helpers.clj
@@ -5,8 +5,8 @@

 (defn http-request
   ([method url google-id] (http-request method url google-id nil))
-  ([method url google-id body] (http-request method url google-id "Agent Smith" body))
-  ([method url google-id name body]
+  ([method url google-id body] (http-request method url google-id body "Agent Smith"))
+  ([method url google-id body name]
    (let [params       (merge {:url url
                               :method method
                               :headers (merge (auth.helpers/fake-login-headers google-id name)


fixing typo

fixing typo

fixes #273

--- sidecar/src/figwheel_sidecar/auto_builder.clj
+++ sidecar/src/figwheel_sidecar/auto_builder.clj
@@ -9,8 +9,8 @@
 (defn autobuild* [{:keys [builds figwheel-server]}]
   (system/start-figwheel!
    {:all-builds builds
-    :build-ids (mapv :id (config/narrow-builds* builds []))}
-    :figwheel-options figwheel-server))
+    :build-ids (mapv :id (config/narrow-builds* builds []))
+    :figwheel-options figwheel-server}))

 (defn autobuild-ids [{:keys [all-builds build-ids figwheel-server]}]
   (let [builds (config/narrow-builds* all-builds build-ids)


don't load repos unless authorized

don't load repos unless authorized

--- src-cljs/frontend/controllers/navigation.cljs
+++ src-cljs/frontend/controllers/navigation.cljs
@@ -7,6 +7,7 @@
             [frontend.api.path :as api-path]
             [frontend.favicon]
             [frontend.models.feature :as feature]
+            [frontend.models.user :as user]
             [frontend.models.build :as build-model]
             [frontend.pusher :as pusher]
             [frontend.state :as state]
@@ -249,26 +250,31 @@

 (defmethod navigated-to :add-projects
   [history-imp navigation-point args state]
-  (-> state
-      state-utils/clear-page-state
-      (assoc state/current-view navigation-point
-             state/navigation-data (assoc args :show-aside-menu? false))
-      ;; force a reload of repos.
-      (assoc-in state/repos-path [])
-      (assoc-in state/github-repos-loading-path true)
-      (assoc-in state/bitbucket-repos-loading-path true)
-      (assoc-in state/crumbs-path [{:type :add-projects}])
-      (assoc-in state/add-projects-selected-org-path nil)
-      (state-utils/reset-current-org)))
+  (let [current-user (get-in state state/user-path)]
+    (-> state
+        state-utils/clear-page-state
+        (assoc state/current-view navigation-point
+               state/navigation-data (assoc args :show-aside-menu? false))
+        ;; force a reload of repos.
+        (assoc-in state/repos-path [])
+        (assoc-in state/github-repos-loading-path (user/github-authorized? current-user))
+        (assoc-in state/bitbucket-repos-loading-path (and (user/bitbucket-authorized? current-user)
+                                                          (feature/enabled? :bitbucket)))
+        (assoc-in state/crumbs-path [{:type :add-projects}])
+        (assoc-in state/add-projects-selected-org-path nil)
+        (state-utils/reset-current-org))))

 (defmethod post-navigated-to! :add-projects
   [history-imp navigation-point _ previous-state current-state]
   (println "making api requests.")
-  (let [api-ch (get-in current-state [:comms :api])]
+  (let [api-ch (get-in current-state [:comms :api])
+        load-gh-repos? (get-in current-state state/github-repos-loading-path)
+        load-bb-repos? (get-in current-state state/bitbucket-repos-loading-path)]
     ;; load orgs, collaborators, and repos.
     (api/get-orgs api-ch :include-user? true)
-    (api/get-github-repos api-ch)
-    (when (feature/enabled? :bitbucket)
+    (when load-gh-repos?
+      (api/get-github-repos api-ch))
+    (when load-bb-repos?
       (api/get-bitbucket-repos api-ch)))
   (set-page-title! "Add projects"))


Fix link to load more threads.

Fix link to load more threads.

--- src/oc/storage/representations/activity.clj
+++ src/oc/storage/representations/activity.clj
@@ -27,13 +27,14 @@
   ([{slug :slug :as org}]
   (str "/orgs/" slug "/threads"))

-  ([{slug :slug :as org} {start :start following :following unfollowing :unfollowing}]
-  (let [follow-concat (if start "&" "?")]
-    (str (threads-url org) (when start (str "?start=" start))
-     (cond
-      following (str follow-concat "following=true")
-      unfollowing (str follow-concat "unfollowing=true")
-      :else "")))))
+  ([{slug :slug :as org} {start :start following :following unfollowing :unfollowing direction :direction}]
+  (let [follow-concat (if start "&" "?")
+        direction-concat (if (or start following unfollowing) "&" "?")]
+    (cond-> (threads-url org)
+     start (str "?start=" start)
+     following (str follow-concat "following=true")
+     unfollowing (str follow-concat "unfollowing=true")
+     direction (str direction-concat "direction=" (name direction))))))

 (defn- dismiss-all-url [org]
   (str (inbox-url "inbox" org) "/dismiss"))


Fix bug

Fix bug

--- src/expound/printer.cljc
+++ src/expound/printer.cljc
@@ -75,7 +75,7 @@
                (s/form sp))
              x)
            x)))
-     (s/form spec))))
+     spec)))

 (defn missing-key [form]
   #?(:cljs (let [[contains _arg key-keyword] form]


Removed method for default dispatch value.

--- src/fm/simrunner/app.clj
+++ src/fm/simrunner/app.clj
@@ -26,9 +26,6 @@

 (defmethod on-event :input-changed [app _ & args]
   (inp/dispatch (-> args first meta :id) app args))
-
-(defmethod on-event :default [app event-id & args]
-  (println (format "on-event{id: %s args: %s}" event-id args)))

 (defn- app [config view]
   {:config config


add persistent set

add persistent set

--- src/group_redis/core.clj
+++ src/group_redis/core.clj
@@ -18,6 +18,10 @@
     (clojure.string/join "/" [(members-path connector) member]))
   ([{:keys [group-name]}]
   (clojure.string/join ["/" (clojure.string/join "/" [group-name "members"])])))
+
+
+(defn persistent-path [{:keys [group-name]} & path]
+  (clojure.string/join ["/" (clojure.string/join "/" (flatten [group-name "persistent" path]))]))

 (defn empherals-path [{:keys [group-name]} & path]
   (clojure.string/join ["/" (clojure.string/join "/" (flatten [group-name "empherals" path]))]))
@@ -50,10 +54,23 @@
       (long (+ heart-beat-freq (/ heart-beat-freq 2))))

-(defn empheral-set [{:keys [conn state-ref] :as connector} path val]
-  (let [final-path (empherals-path connector path)]
+(defn persistent-set [{:keys [conn state-ref] :as connector} path]
+  (let [final-path (persistent-set connector path)]
+    (car/wcar conn (car/get final-path))))
+
+(defn persistent-get [{:keys [conn state-ref] :as connector} path val]
+  (let [final-path (persistent-set connector path)]
+    (car/wcar conn (car/set final-path val))))
+
+
+(defn empheral-set [{:keys [conn state-ref conf] :as connector} path val]
+  (let [final-path (empherals-path connector path)
+        {:keys [heart-beat-freq]} conf
+        expire (calc-ttl heart-beat-freq)]
     (dosync (alter state-ref (fn [state] (assoc state :empherals (into #{} (conj (:empherals state) {:path final-path :val val}))))))
-    (car/wcar conn (car/set final-path val))))
+    (car/wcar conn
+              (car/set final-path val)
+              (expire final-path expire))))

 (defn empheral-get [connector path ]
   (->> connector :state-ref deref :empherals (filter #(= (:path %) (empherals-path connector path) )) first :val))


bump chef-full revision for ohai 0.6.6

bump chef-full revision for ohai 0.6.6

--- config/projects/chef-full.clj
+++ config/projects/chef-full.clj
@@ -17,6 +17,6 @@
 ;; limitations under the License.
 ;;

-(project "chef-full" "0.10.4" "3"
+(project "chef-full" "0.10.4" "4"
          :build-order [ "prep" "help2man" "libtool" "autoconf" "automake" "gdbm" "zlib" "libiconv" "readline" "db" "ncurses"
                         "openssl" "libxml2" "libxslt" "ruby" "rsync" "chef" ])


apply info repackaginf to service info form

--- src/cljs/swarmpit/component/service/info.cljs
+++ src/cljs/swarmpit/component/service/info.cljs
@@ -3,13 +3,14 @@
             [material.icon :as icon]
             [swarmpit.url :refer [dispatch!]]
             [swarmpit.component.handler :as handler]
-            [swarmpit.component.service.form-ports :as ports]
-            [swarmpit.component.service.form-networks :as networks]
-            [swarmpit.component.service.form-mounts :as mounts]
-            [swarmpit.component.service.form-secrets :as secrets]
-            [swarmpit.component.service.form-variables :as variables]
-            [swarmpit.component.service.form-labels :as labels]
-            [swarmpit.component.service.form-deployment-placement :as placement]
+            [swarmpit.component.service.info.settings :as settings]
+            [swarmpit.component.service.info.ports :as ports]
+            [swarmpit.component.service.info.networks :as networks]
+            [swarmpit.component.service.info.mounts :as mounts]
+            [swarmpit.component.service.info.secrets :as secrets]
+            [swarmpit.component.service.info.variables :as variables]
+            [swarmpit.component.service.info.labels :as labels]
+            [swarmpit.component.service.info.deployment :as deployment]
             [swarmpit.component.task.list :as tasks]
             [swarmpit.component.message :as message]
             [swarmpit.routes :as routes]
@@ -37,117 +38,10 @@
                    (message/error
                      (str "Service removing failed. Reason: " (:error response))))}))

-(rum/defc form-settings < rum/static [service]
-  [:div.form-view-group
-   (comp/form-section "General settings")
-   (comp/form-item "ID" (:id service))
-   (comp/form-item "SERVICE NAME" (:serviceName service))
-   (comp/form-item "CREATED" (:createdAt service))
-   (comp/form-item "LAST UPDATE" (:updatedAt service))
-   (comp/form-item "IMAGE" (get-in service [:repository :image]))
-   (comp/form-item "IMAGE DIGEST" (get-in service [:repository :imageDigest]))
-   (comp/form-item "MODE" (:mode service))])
-
-(rum/defc form-ports < rum/static [ports]
-  (when (not-empty ports)
-    [:div.form-view-group
-     (comp/form-section "Ports")
-     (comp/list-table-auto ports/headers
-                           ports
-                           ports/render-item
-                           ports/render-item-keys
-                           nil)]))
-
-(rum/defc form-networks < rum/static [networks]
-  (when (not-empty networks)
-    [:div.form-view-group
-     (comp/form-section "Networks")
-     (comp/list-table-auto networks/headers
-                           networks
-                           networks/render-item
-                           networks/render-item-keys
-                           networks/onclick-handler)]))
-
-(rum/defc form-mounts < rum/static [mounts]
-  (when (not-empty mounts)
-    [:div.form-view-group
-     (comp/form-section "Mounts")
-     (comp/list-table-auto mounts/headers
-                           mounts
-                           mounts/render-item
-                           mounts/render-item-keys
-                           nil)]))
-
-(rum/defc form-secrets < rum/static [secrets]
-  (when (not-empty secrets)
-    [:div.form-view-group
-     (comp/form-section "Secrets")
-     (comp/list-table-auto secrets/headers
-                           secrets
-                           secrets/render-item
-                           secrets/render-item-keys
-                           secrets/onclick-handler)]))
-
-(rum/defc form-variables < rum/static [variables]
-  (when (not-empty variables)
-    [:div.form-view-group
-     (comp/form-section "Environment variables")
-     (comp/list-table-auto variables/headers
-                           variables
-                           variables/render-item
-                           variables/render-item-keys
-                           nil)]))
-
-(rum/defc form-labels < rum/static [labels]
-  (when (not-empty labels)
-    [:div.form-view-group
-     (comp/form-section "Labels")
-     (comp/list-table-auto labels/headers
-                           labels
-                           labels/render-item
-                           labels/render-item-keys
-                           nil)]))
-
-(rum/defc form-deployment < rum/static [deployment]
-  (let [autoredeloy (:autoredeploy deployment)
-        update-delay (get-in deployment [:update :delay])
-        update-parallelism (get-in deployment [:update :parallelism])
-        update-failure-action (get-in deployment [:update :failureAction])
-        rollback-delay (get-in deployment [:rollback :delay])
-        rollback-parallelism (get-in deployment [:rollback :parallelism])
-        rollback-failure-action (get-in deployment [:rollback :failureAction])
-        placement (:placement deployment)
-        restart-policy-condition (get-in deployment [:restartPolicy :condition])
-        restart-policy-delay (get-in deployment [:restartPolicy :delay])
-        restart-policy-attempts (get-in deployment [:restartPolicy :attempts])]
-    [:div.form-view-group
-     (comp/form-section "Deployment")
-     (comp/form-item "AUTOREDEPLOY" (if autoredeloy
-                                      "on"
-                                      "off"))
-     (comp/form-subsection "Restart Policy")
-     (comp/form-item "CONDITION" restart-policy-condition)
-     (comp/form-item "DELAY" (str restart-policy-delay "s"))
-     (comp/form-item "MAX ATTEMPTS" restart-policy-attempts)
-     (comp/form-subsection "Update Config")
-     (comp/form-item "PARALLELISM" update-parallelism)
-     (comp/form-item "DELAY" (str update-delay "s"))
-     (comp/form-item "ON FAILURE" update-failure-action)
-     (if (= "rollback" update-failure-action)
-       [:div
-        (comp/form-subsection "Rollback Config")
-        (comp/form-item "PARALLELISM" rollback-parallelism)
-        (comp/form-item "DELAY" (str rollback-delay "s"))
-        (comp/form-item "ON FAILURE" rollback-failure-action)])
-     (if (not-empty placement)
-       [:div
-        (comp/form-subsection "Placement")
-        (placement/form-view placement)])]))
-
 (rum/defc form-tasks < rum/static [tasks]
-  [:div.form-view-group
+  [:div.form-service-view-group.form-service-group-border
    (comp/form-section "Tasks")
-   (comp/list-table-auto tasks/headers
+   (comp/list-table-auto ["Name" "Service" "Image" "Node" "Status"]
                          (filter #(not (= "shutdown" (:state %))) tasks)
                          tasks/render-item
                          tasks/render-item-keys
@@ -180,13 +74,13 @@
          (comp/raised-button
            {:onTouchTap #(delete-service-handler id)
             :label      "Delete"}))]]
-     [:div.form-view
-      (form-settings service)
-      (form-ports ports)
-      (form-networks networks)
-      (form-mounts mounts)
-      (form-secrets secrets)
-      (form-variables variables)
-      (form-labels labels)
-      (form-deployment deployment)
+     [:div.form-service-view
+      (settings/form service)
+      (ports/form ports)
+      (networks/form networks)
+      (mounts/form mounts)
+      (secrets/form secrets)
+      (variables/form variables)
+      (labels/form labels)
+      (deployment/form deployment)
       (form-tasks tasks)]]))


Added get-providers function.

Added get-providers function.

--- src/cmr/system_int_test/utils/ingest_util.clj
+++ src/cmr/system_int_test/utils/ingest_util.clj
@@ -18,6 +18,13 @@
   (client/post (url/create-provider-url)
                {:body (format "{\"provider-id\": \"%s\"}" provider-id)
                 :content-type :json}))
+
+(defn get-providers
+  []
+  (-> (client/get (url/create-provider-url))
+      :body
+      (json/decode true)
+      :providers))

 (defn delete-provider
   "Delete the provider with the matching provider-id from the CMR metadata repo."


Rename session-id to auth-session-id

Rename session-id to auth-session-id

--- src/cylon/oauth/impl/authorization_server.clj
+++ src/cylon/oauth/impl/authorization_server.clj
@@ -19,7 +19,7 @@
    [cylon.session :refer (create-session! assoc-session! ->cookie get-session-value get-cookie-value get-session)]
    [ring.middleware.cookies :refer (wrap-cookies cookies-request cookies-response)]))

-(def SESSION-ID "session-id")
+(def SESSION-ID "auth-session-id")

 (defrecord AuthorizationServer [store scopes iss]

@@ -84,8 +84,9 @@
                  session (get-session (:session-store this) (get-cookie-value req SESSION-ID))

                  client-id (get session :client-id)
-                 scope (get session :scope)
-                 state (or (get session :state) "") ; to avoid a java.lang.NullPointerException on str/split
+                 scope (or (get session :scope) "") ; to avoid a java.lang.NullPointerException on str/split
+                 state (get session :state)
+
                  scopes (set (str/split scope #"[\s]+"))

                  ;; Lookup client


Upgrade karma to 5.1.0

Upgrade karma to 5.1.0

--- src/leiningen/new/re_frame/src/cljs/deps.cljs
+++ src/leiningen/new/re_frame/src/cljs/deps.cljs
@@ -1,5 +1,5 @@
 {:npm-dev-deps {"shadow-cljs"           "2.9.3"{{#test?}}
-                "karma"                 "4.4.1"
+                "karma"                 "5.1.0"
                 "karma-chrome-launcher" "3.1.0"
                 "karma-cljs-test"       "0.1.0"
                 "karma-junit-reporter"  "2.0.1"{{/test?}}}}


better indication of sleep mode

better indication of sleep mode

--- qmon.clj
+++ qmon.clj
@@ -70,6 +70,8 @@
   (try (:content (parse (java.io.StringBufferInputStream. (:out (sh "qstat" "-x")))))
        (catch Exception e)))

+(def waitmsg "\nLoading...")
+
 (defn xattr [j,k]
   (first (k j)))

@@ -111,11 +113,13 @@
   (let [t (xtime j :resources_used)] (if (nil? t) "-" t)))

 (let [user (myname)
-      ta (JTextArea. "\nLoading..." )
+      ta (JTextArea. waitmsg)
       sp (JScrollPane. ta)
       active (atom true)
       toggle (fn [x]
-               (.setBackground ta (if x (Color/DARK_GRAY) (Color/WHITE)))
+               (.setBackground ta (if x (Color/BLACK) (Color/WHITE)))
+               (.setForeground ta (if x (Color/WHITE) (Color/BLACK)))
+               (.setText ta (if x "\nPaused, click to resume..." waitmsg))
                (not x))]
   (do
     (doto ta


fixed error in photo path

fixed error in photo path

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

--- src/status_im/chat/views/message/message.cljs
+++ src/status_im/chat/views/message/message.cljs
@@ -245,7 +245,8 @@

 (defn- photo [from photo-path]
   [react/view
-   [react/image {:source (if (string/starts-with? photo-path "contacts://")
+   [react/image {:source (if (and (not (string/blank? photo-path))
+                                  (string/starts-with? photo-path "contacts://"))
                            (->> (string/replace photo-path #"contacts://" "")
                                 (keyword)
                                 (get resources/contacts))
@@ -285,10 +286,10 @@
      content]]
    (when last-outgoing?
      [react/view style/delivery-status
-     (if (or (= (keyword message-type) :group-user-message)
-             group-chat)
-       [group-message-delivery-status message]
-       [message-delivery-status message])])])
+      (if (or (= (keyword message-type) :group-user-message)
+              group-chat)
+        [group-message-delivery-status message]
+        [message-delivery-status message])])])

 (defn message-container-animation-logic [{:keys [to-value val callback]}]
   (fn [_]


Add tests for conforming and parsing parameterized queries

--- src/test/workflo/macros/specs/query_test.cljc
+++ src/test/workflo/macros/specs/query_test.cljc
@@ -338,3 +338,60 @@
     '[{:name a/b :type :property :alias c}
       {:name a/d :type :property :alias e}]
     '[a [b :as c d :as e]]))
+
+(deftest conforming-parameterization
+  (are [out in] (= out (q/conform in))
+    '[[:parameterization {:query [:property [:simple a]]
+                          :parameters {b c}}]]
+    '[(a {b c})]
+
+    '[[:parameterization {:query [:property [:simple a]]
+                          :parameters {b c d e}}]]
+    '[(a {b c d e})]
+
+    '[[:parameterization
+       {:query [:property [:join [:properties {[:simple a]
+                                               [[:property [:simple b]]
+                                                [:property [:simple c]]]}]]]
+        :parameters {d e f g}}]]
+    '[({a [b c]} {d e f g})]
+
+    '[[:parameterization {:query [:aliased-property {:property [:simple a]
+                                                     :as :as :alias b}]
+                          :parameters {c d e f}}]]
+    '[(a :as b {c d e f})]
+
+    '[[:parameterization
+       {:query [:aliased-property
+                {:property [:join [:properties {[:simple a]
+                                                [[:property [:simple b]]
+                                                 [:property [:simple c]]]}]]
+                 :as :as :alias d}]
+        :parameters {e f g h}}]]
+    '[({a [b c]} :as d {e f g h})]))
+
+(deftest parsing-parameterization
+  (are [out in] (= out (q/conform-and-parse in))
+    '[{:name a :type :property :parameters {b c}}]
+    '[(a {b c})]
+
+    '[{:name a :type :property :parameters {b c d e}}]
+    '[(a {b c d e})]
+
+    '[{:name a :type :join
+       :join-source {:name a :type :property}
+       :join-target [{:name b :type :property}
+                     {:name c :type :property}]
+       :parameters {d e f g}}]
+    '[({a [b c]} {d e f g})]
+
+    '[{:name a :type :property :alias b :parameters {c d e f}}]
+    '[(a :as b {c d e f})]
+
+    '[{:name a :type :join
+       :join-source {:name a :type :property}
+       :join-target [{:name b :type :property}
+                     {:name c :type :property}]
+       :alias d
+       :parameters {e f g h}}]
+    '[({a [b c]} :as d {e f g h})]))


Adding joda

Adding joda

--- apoya-app/project.clj
+++ apoya-app/project.clj
@@ -55,6 +55,7 @@
                  [org.apache.activemq/activemq-broker "5.9.0"]
                  [net.sf.ehcache/ehcache "2.7.4"]
                  [clojurewerkz/quartzite "1.1.0"]
+                 [clj-time "0.6.0"]
                  ;;Clojurescript libs
                  [shoreleave/shoreleave-remote "0.3.0"]
                  [shoreleave/shoreleave-pubsub "0.3.0"]


(SERVER-325) Add explanatory comment in test

This commit adds an explanatory comment about why we're
using `with-jruby-puppet` in a test, even though it looks
kind of unusual.

--- test/unit/puppetlabs/services/jruby/jruby_puppet_service_test.clj
+++ test/unit/puppetlabs/services/jruby/jruby_puppet_service_test.clj
@@ -105,7 +105,9 @@
           (is (instance? JRubyPuppet jruby-puppet))
           (is (= 0 (jruby-protocol/free-instance-count service))))
         (is (= 1 (jruby-protocol/free-instance-count service)))
-        ;; borrow and return one more time
+        ;; borrow and return one more time: we're using `with-jruby-puppet`
+        ;; here even though it looks a bit strange, because that is what this
+        ;; test is intended to cover.
         (with-jruby-puppet
           jruby-puppet
           service)


Minor improvements on icons.

Minor improvements on icons.


Focus management #38

Focus management #38

--- flatguicore/src/flatgui/focus.clj
+++ flatguicore/src/flatgui/focus.clj
@@ -343,8 +343,8 @@
                            (got-trigger))
                          ;; Just give chance further
                          :else
-                         (got-trigger)))
-        old-focus-state)
+                         (got-trigger))
+          old-focus-state))

       :else ; Neither event type - ignore
       old-focus-state)))


Add comment

Add comment

--- dev/src/yada/dev/external.clj
+++ dev/src/yada/dev/external.clj
@@ -1,3 +1,5 @@
+;; Copyright © 2015, JUXT LTD.
+
 (ns yada.dev.external
   (:require
    [bidi.bidi :refer (RouteProvider tag)]
@@ -16,7 +18,11 @@
         (for [[_ h] (:examples user-guide)]
           [(get-path h) (make-handler h)]))]]]))

-(defn new-external-resources [& {:as opts}]
+(defn new-external-resources
+  "External resources are those that run on a different port, such that
+  they are considered to be from a different origin, from a CORS
+  perspective. This allows testing of CORS functionality."
+  [& {:as opts}]
   (->
    (->> opts
         (merge {})


evil def

evil def

--- user.clj
+++ user.clj
@@ -38,6 +38,9 @@
 ;TODO: macroize so it can sit in front of a call like apply
 (defn spy "Simple print debugging" [arg]
   (doto arg prn))
+
+(defn eval-def "Can def inside a namespace" [qnsp qdef]
+  (binding [*ns* (find-ns qnsp)] (eval qdef)))

 (defn doc-dir "Prints docs for a given namespace" [nsname]
   (let [resolved (map #(ns-resolve (the-ns nsname) %) (clojure.repl/dir-fn nsname))]


CMR-192: Fixed search port.

CMR-192: Fixed search port.

--- test/cmr/system_int_test/utils/url_helper.clj
+++ test/cmr/system_int_test/utils/url_helper.clj
@@ -22,7 +22,7 @@

 (def indexer-port (config-value :indexer-port 3004))

-(def search-port (config-value :search-port 3000))
+(def search-port (config-value :search-port 3003))

 (def elastic_root (format "http://localhost:%s" elastic-port))


Remove blue from buttons

Remove blue from buttons

--- src/airhead_frontend/components.cljs
+++ src/airhead_frontend/components.cljs
@@ -38,11 +38,11 @@

           (when-let [audio @audio-ref]
             (if (.-paused audio)
-              [:button.pure-button.pure-button-primary
+              [:button.pure-button
                {:on-click #(.play audio)}
                [:i.fa.fa-play]
                [:span "Play"]]
-              [:button.pure-button.pure-button-primary.pure-button-active
+              [:button.pure-button
                {:on-click #(.pause audio)}
                [:i.fa.fa-pause]
                [:span "Pause"]]))
@@ -50,10 +50,10 @@
           (when-let [audio @audio-ref]
             (if (.-muted audio)
               [:button.pure-button.pure-button-active
-               {:on-click (fn [] (set! (.-muted audio) false))}
+               {:on-click #(set! (.-muted audio) false)}
                [:i.fa.fa-volume-off]]
               [:button.pure-button
-               {:on-click (fn [] (set! (.-muted audio) true))}
+               {:on-click #(set! (.-muted audio) true)}
                [:i.fa.fa-volume-up]]))

@@ -79,8 +79,8 @@

        [:form.pure-form
         {:ref #(reset! form-ref %)}
-        [:input.pure-input-3-4 {:type "file" :name "track"}]
-        [:input.pure-button.pure-button-primary.pure-input-1-4
+        [:input.pure-input-2-3 {:type "file" :name "track"}]
+        [:input.pure-button.pure-input-1-3
          {:type "button" :value "Upload"
           :on-click #(when-let [form @form-ref] (req/upload! form))}]
         [progress-bar]]


adding default dev env

adding default dev env

--- test/celestial/fixtures.clj
+++ test/celestial/fixtures.clj
@@ -47,10 +47,10 @@
   "Using fixture/celestial.edn conf file"
   [f & body]
   (if (symbol? f)
-    `(with-redefs [celestial.config/config ~f]
+    `(with-redefs [celestial.config/config ~f celestial.model/env :dev]
        ~@body
        )
-    `(with-redefs [celestial.config/config celestial.fixtures/local-prox]
+    `(with-redefs [celestial.config/config celestial.fixtures/local-prox celestial.model/env :dev ]
        ~@(conj body f)
        )))


make test/kinds.clj run without fails or errors

--- test/clojure/test/kinds.clj
+++ test/clojure/test/kinds.clj
@@ -89,10 +89,10 @@

 (deftest ^:keychain improper
   (testing "keychain literals 20"
-    (let [e1 (ds/entity-map! [:Foo])]
-      (log/trace "e1" (type e1) (.getMessage e1)))
+    (let [e1 (ds/entity-map! [:Foo] {})]
+      ;; (log/trace "e1" (type e1) (.getMessage e1)))
     ;; (let [e1 (ds/entity-map [:Foo/Bar :Baz] {})]
     ;;   (log/trace "e1" (ds/print e1)))
     ;; (let [e1 (ds/entity-map [:Foo/Bar :Baz/Buz :X] {:a 1 :b 2})]
     ;;   (log/trace "e1" (ds/print e1)))
-      ))
+      )))


filter out unexpected keystrokes

filter out unexpected keystrokes

--- src/ez_snake/core.cljs
+++ src/ez_snake/core.cljs
@@ -65,9 +65,10 @@

 (let [key-codes { 37 :west 38 :north 39 :east 40 :south }
       keystrokes (listen (chan) (key-handler js/document) "key")]
-  (go (while true
+  (go (while true
         (let [event (<! keystrokes)]
           ;(.log js/console event)
-          (turn! (key-codes (.-keyCode event)))))))
+          (when-let [new-dir (key-codes (.-keyCode event))]
+            (turn! new-dir))))))

 (. js/console (log "Hello world!"))


Implement -list-platforms

Implement -list-platforms

--- src/grimoire/api/web/read.clj
+++ src/grimoire/api/web/read.clj
@@ -77,6 +77,9 @@
 (defmethod api/-list-namespaces ::web/Config [config version-thing]
   (do-thing-req config "namespaces" t/->Ns version-thing))

+(defmethod api/-list-platforms ::web/Config [config version-thing]
+  (do-thing-req config "platforms" t/->Platform version-thing))
+
 (defmethod api/-list-defs ::web/Config [config namespace-thing]
   (do-thing-req config "all" t/->Def namespace-thing))


refactoring index calls

refactoring index calls

--- src/help_me_im_dumb/index.clj
+++ src/help_me_im_dumb/index.clj
@@ -4,6 +4,16 @@

 (def DICTIONARY-FILENAME "resources/dictionary.txt")
 (def POSTINGS-LIST-FILENAME "resources/postings.txt")
+
+(declare token-seq-from-file create-sorted-term-postings-mapping write-term-postings-mapping-to-files)
+
+(defn create-indicies
+  "Main function for creating indicies.
+   Reads in datafile, tokenizes, sorts, and writes to files"
+  [jsonfile]
+  (->> (token-seq-from-file jsonfile)
+       create-sorted-term-postings-mapping
+       write-term-postings-mapping-to-files))

 (defn get-tokens-from-doc
   "Takes reddit doc from json data"
@@ -53,6 +63,10 @@
    id-token-pairs))

 (defn write-term-postings-mapping-to-files
+  "Writes term and postings list to index files
+
+  Dictionary file: term\tdocument_frequency
+  Postings list file: term\tpost1;post2;"
   [term-postings-mapping]
   (with-open [dictionary-file (io/writer DICTIONARY-FILENAME)
               postings-list-file (io/writer POSTINGS-LIST-FILENAME)]
@@ -62,10 +76,4 @@
       (.write postings-list-file
               (str term "\t" (clojure.string/join ";" postings) "\n")))))

-(defn create-indicies
-  "Main function for creating indicies.
-   Reads in datafile, tokenizes, sorts, and writes to files"
-  [jsonfile]
-  (->> (token-seq-from-file jsonfile)
-       create-sorted-term-postings-mapping
-       write-term-postings-mapping-to-files))
+


Get check-plan from explicit namespace

Get check-plan from explicit namespace

--- test/icecap/schema_test.clj
+++ test/icecap/schema_test.clj
@@ -12,19 +12,19 @@
       simple-https-step
       #{simple-http-step simple-https-step}))
   (testing "empty plans don't validate"
-    (are [example reason] (= (check-plan example)
+    (are [example reason] (= (is/check-plan example)
                              reason)
       [] '(not ("collection of two or more plans" []))
       #{} '(not ("collection of two or more plans" #{}))))
   (testing "plans with one step in them don't validate"
-    (are [example reason] (= (check-plan example)
+    (are [example reason] (= (is/check-plan example)
                              reason)
       [simple-http-step] '(not ("collection of two or more plans"
                                 a-clojure.lang.PersistentVector))
       #{simple-http-step} '(not ("collection of two or more plans"
                                  a-clojure.lang.PersistentHashSet))))
   (testing "plans with empty steps in them don't validate"
-    (are [example reason] (= (check-plan example)
+    (are [example reason] (= (is/check-plan example)
                              reason)
       [#{} simple-http-step] ['(not ("collection of two or more plans" #{}))
                               nil]))


Don't close over arg in pills views

Don't close over arg in pills views

Since we're using the new re-frame with deduped subs, we don't need to
use the `(defn v [arg] (let [a (subscribe ..)] (fn [arg] ...)))`
pattern anymore, dispensing with the inner `fn`. Removing these inner
fns now fixes issues where old values would be closed over incorrectly.

--- src/braid/client/ui/views/pills.cljs
+++ src/braid/client/ui/views/pills.cljs
@@ -9,58 +9,54 @@
 (defn subscribe-button-view
   [tag-id]
   (let [user-subscribed-to-tag? (subscribe [:user-subscribed-to-tag? tag-id])]
-    (fn [tag-id]
-      (if @user-subscribed-to-tag?
-        [:a.button {:on-click
-                    (fn [_]
-                      (dispatch [:unsubscribe-from-tag tag-id]))}
-         "Unsubscribe"]
-        [:a.button {:on-click
-                    (fn [_]
-                      (dispatch [:subscribe-to-tag {:tag-id tag-id}]))}
-         "Subscribe"]))))
+    (if @user-subscribed-to-tag?
+      [:a.button {:on-click
+                  (fn [_]
+                    (dispatch [:unsubscribe-from-tag tag-id]))}
+       "Unsubscribe"]
+      [:a.button {:on-click
+                  (fn [_]
+                    (dispatch [:subscribe-to-tag {:tag-id tag-id}]))}
+       "Subscribe"])))

 (defn tag-pill
   [tag-id]
   (let [tag (subscribe [:tag tag-id])
-        user-subscribed-to-tag? (subscribe [:user-subscribed-to-tag? tag-id])]
-    (fn [tag-id]
-      (let [color (id->color tag-id)]
-        [:span.pill {:class (if @user-subscribed-to-tag? "on" "off")
-                     :tabIndex -1
-                     :style {:background-color color
-                             :color color
-                             :border-color color}}
-         [:div.name "#" (@tag :name)]]))))
+        user-subscribed-to-tag? (subscribe [:user-subscribed-to-tag? tag-id])
+        color (id->color tag-id)]
+    [:span.pill {:class (if @user-subscribed-to-tag? "on" "off")
+                 :tabIndex -1
+                 :style {:background-color color
+                         :color color
+                         :border-color color}}
+     [:div.name "#" (@tag :name)]]))

 (defn search-button-view [query]
   (let [open-group-id (subscribe [:open-group-id])]
-    (fn [query]
-      [:a.search
-       {:href (routes/search-page-path {:group-id @open-group-id
-                                        :query query})}
-       "Search"])))
+    [:a.search
+     {:href (routes/search-page-path {:group-id @open-group-id
+                                      :query query})}
+     "Search"]))

 (defn tag-card-view
   [tag-id]
   (let [tag (subscribe [:tag tag-id])
         user-subscribed-to-tag? (subscribe [:user-subscribed-to-tag? tag-id])]
-    (fn [tag-id]
-      [:div.card
-       [:div.header {:style {:background-color (id->color tag-id)}}
-        [tag-pill tag-id]
-        [:div.subscribers.count
-         {:title (str (@tag :subscribers-count) " Subscribers")}
-         (@tag :subscribers-count)]
-        [:div.threads.count
-         {:title (str (@tag :threads-count) " Conversations")}
-         (@tag :threads-count)]]
-       [:div.info
-        [:div.description
-         (or (@tag :description) "If I had a description, it would be here.")]]
-       [:div.actions
-        [search-button-view (str "#" (@tag :name))]
-        [subscribe-button-view tag-id]]])))
+    [:div.card
+     [:div.header {:style {:background-color (id->color tag-id)}}
+      [tag-pill tag-id]
+      [:div.subscribers.count
+       {:title (str (@tag :subscribers-count) " Subscribers")}
+       (@tag :subscribers-count)]
+      [:div.threads.count
+       {:title (str (@tag :threads-count) " Conversations")}
+       (@tag :threads-count)]]
+     [:div.info
+      [:div.description
+       (or (@tag :description) "If I had a description, it would be here.")]]
+     [:div.actions
+      [search-button-view (str "#" (@tag :name))]
+      [subscribe-button-view tag-id]]]))

 (defn tag-pill-view
   [tag-id]
@@ -71,14 +67,13 @@
 (defn user-pill
   [user-id]
   (let [user (subscribe [:user user-id])]
-    (fn [user-id]
-      (let [color (id->color user-id)]
-        [:span.pill {:class (str (case (@user :status) :online "on" "off"))
-                     :tabIndex -1
-                     :style {:background-color color
-                             :color color
-                             :border-color color}}
-         [:span.name (str "@" (@user :nickname))]]))))
+    (let [color (id->color user-id)]
+      [:span.pill {:class (str (case (@user :status) :online "on" "off"))
+                   :tabIndex -1
+                   :style {:background-color color
+                           :color color
+                           :border-color color}}
+       [:span.name (str "@" (@user :nickname))]])))

 (defn user-card-view
   [user-id]
@@ -86,33 +81,32 @@
         open-group-id (subscribe [:open-group-id])
         admin? (subscribe [:user-is-group-admin? user-id] [open-group-id])
         viewer-admin? (subscribe [:current-user-is-group-admin?] [open-group-id])]
-    (fn [user-id]
-      [:div.card
-       [:div.header {:style {:background-color (id->color user-id)}}
-        [user-pill user-id]
-        [:div.status
-         (@user :status)
-         ; [:div "time since last online"]
-         ]
-        [:div.badges
-         (when @admin?
-           [:div.admin {:title "admin"}])]
-        [:img.avatar {:src (@user :avatar)}]]
-       [:div.info
-        [:div.local-time (helpers/format-date (js/Date.))]
-        ; [:div.since "member since]
-        [:div.description
-         "If I had a profile, it would be here"]]
-       [:div.actions
-        ; [:a.pm "PM"]
-        ; [:a.mute "Mute"]
-        [search-button-view (str "@" (@user :nickname))]
-        (when (and @viewer-admin? (not @admin?))
-          ; TODO: make this not ugly
-          [:button.make-admin
-           {:on-click (fn [_] (dispatch [:make-admin {:group-id @open-group-id
-                                                      :user-id user-id}]))}
-           "Make Admin"])]])))
+    [:div.card
+     [:div.header {:style {:background-color (id->color user-id)}}
+      [user-pill user-id]
+      [:div.status
+       (@user :status)
+                                        ; [:div "time since last online"]
+       ]
+      [:div.badges
+       (when @admin?
+         [:div.admin {:title "admin"}])]
+      [:img.avatar {:src (@user :avatar)}]]
+     [:div.info
+      [:div.local-time (helpers/format-date (js/Date.))]
+                                        ; [:div.since "member since]
+      [:div.description
+       "If I had a profile, it would be here"]]
+     [:div.actions
+                                        ; [:a.pm "PM"]
+                                        ; [:a.mute "Mute"]
+      [search-button-view (str "@" (@user :nickname))]
+      (when (and @viewer-admin? (not @admin?))
+                                        ; TODO: make this not ugly
+        [:button.make-admin
+         {:on-click (fn [_] (dispatch [:make-admin {:group-id @open-group-id
+                                                   :user-id user-id}]))}
+         "Make Admin"])]]))

 (defn user-pill-view
   [user-id]


Attempt to make a fisheye, but no good

Attempt to make a fisheye, but no good

Things are solid in "safe zone" but immediately zoom to edge of frame
after leaving it.

--- src/graphito/core.cljs
+++ src/graphito/core.cljs
@@ -22,9 +22,18 @@

 (def world-width 1280)
 (def world-height 800)
+
 (def update-interval-ms 15)
+
 (def swipe-damping-factor 1)
 (def min-slide-speed-sq 16)
+
+(def safe-zone-size 0.2)
+(def max-radius 32)
+(def min-radius 2)
+(def min-size-distance 2000)
+(def edge-buffer (+ min-radius 3))
+

 ;; SVG setup

@@ -49,7 +58,38 @@
     (add-background! svg width height)
     svg))

+
+;; Math
+
+(def sqrt (.-sqrt js/Math))
+(def tan (.-tan js/Math))
+(def atan (.-atan js/Math))
+(def pi (.-PI js/Math))
+(def pi2 (/ pi 2))
+
+(defn dist-sq [x y]
+  (+ (* x x) (* y y)))
+
+(def dist (comp sqrt dist-sq))
+
+(defn vector-with-length [l x y]
+  (let [factor (/ l (dist x y))]
+    [(* factor x) (* factor y)]))
+
+
 ;; D3 magic
+
+(defn project-displacement [d safe-distance max-distance]
+  (let [project-positive-displacement
+        (fn [d]
+          (if (< d safe-distance)
+            d
+            (+ safe-distance
+               (* (/ (- max-distance safe-distance) pi2)
+                  (atan (- d safe-distance))))))]
+    (if (pos? d)
+      (project-positive-displacement d)
+      (- (project-positive-displacement (- d))))))

 (defn view-position
   "Given the actual position of a node (in world coordinates), return the
@@ -57,9 +97,21 @@
   [state x y]
   (let [{:keys [view-width view-height camera-x camera-y]} state
         view-center-x (/ view-width 2)
-        view-center-y (/ view-height 2)]
-    {:x (+ view-center-x (- x camera-x))
-     :y (+ view-center-y (- y camera-y))}))
+        view-center-y (/ view-height 2)
+        safe-distance-x (* safe-zone-size view-center-x)
+        safe-distance-y (* safe-zone-size view-center-y)
+        max-distance-x (- view-center-x edge-buffer)
+        max-distance-y (- view-center-y edge-buffer)
+        true-x-displacement (- x camera-x)
+        true-y-displacement (- y camera-y)
+        projected-x-displacement (project-displacement true-x-displacement
+                                                       safe-distance-x
+                                                       max-distance-x)
+        projected-y-displacement (project-displacement true-y-displacement
+                                                       safe-distance-y
+                                                       max-distance-y)]
+    {:x (+ view-center-x projected-x-displacement)
+     :y (+ view-center-y projected-y-displacement)}))

 (defn view-radius [state x y] 32)

@@ -104,19 +156,6 @@
   (swap-state! current-state #(-> %
                                   (update :camera-x + dx)
                                   (update :camera-y + dy))))
-
-;; Math
-
-(def sqrt (.-sqrt js/Math))
-
-(defn dist-sq [x y]
-  (+ (* x x) (* y y)))
-
-(def dist (comp sqrt dist-sq))
-
-(defn vector-with-length [l x y]
-  (let [factor (/ l (dist x y))]
-    [(* factor x) (* factor y)]))

 ;; Layout


Cleanup some code

Cleanup some code

--- src/lein_jslint/core.clj
+++ src/lein_jslint/core.clj
@@ -8,6 +8,7 @@
             [org.satta.glob :as glob]
             [clojure.java.io :as io]
             [clojure.string :as string]))
+

 ; Internal API: Common

@@ -22,8 +23,13 @@
     (spit content)
     (.deleteOnExit)))

-(defn joine [& data]
-  (string/join "\r\n" data))
+(defn- error [ex]
+  (println
+   (string/join "\r\n"
+                (str "Can't execute JSLint: " (.getMessage ex))
+                "Something is wrong:"
+                " - installation: npm install jslint -g"
+                " - configuration: https://github.com/vbauer/lein-jslint")))

 ; Internal API: Configuration
@@ -85,9 +91,5 @@
         (npm/with-json-file file content project
                             (apply invoke project sources))))
     (catch Throwable t
-      (println
-       (joine (str "Can't execute JSLint: " (.getMessage t))
-              "Something is wrong:"
-              " - installation: npm install jslint -g"
-              " - configuration: https://github.com/vbauer/lein-jslint"))
+      (error t)
       (main/abort))))


Fix reflection warning.

Fix reflection warning.

--- src/leiningen/fregec.clj
+++ src/leiningen/fregec.clj
@@ -45,9 +45,9 @@
 (defn- additional-fregec-args
   "Given command line arguments, convert to Frege compiler arguments."
   [args]
-  (map (fn [arg] (if (.startsWith arg ":")
-                   (str "-" (subs arg 1))
-                   arg)) args))
+  (map (fn [^String arg] (if (.startsWith arg ":")
+                           (str "-" (subs arg 1))
+                           arg)) args))

 (defn fregec
   "Compile Frege source files in :frege-source-paths to :compile-path


Add tests of dijkstra-path

Add tests of dijkstra-path

--- test/jungerer/algo_test.clj
+++ test/jungerer/algo_test.clj
@@ -6,6 +6,26 @@
   (:import [edu.uci.ics.jung.algorithms.scoring
             BarycenterScorer BetweennessCentrality ClosenessCentrality
             DegreeScorer EigenvectorCentrality HITS HITS$Scores PageRank]))
+
+(deftest dijkstra-path-test
+  (let [graph (g/directed-graph test-edges)]
+    (g/add-node! graph 5)
+    (testing "for directed graph"
+      (is (dijkstra-path graph 1 3) [1 2 3])
+      (is (dijkstra-path graph 4 3) [4 2 3])
+      (is (dijkstra-path graph 4 1) [])
+      (is (dijkstra-path graph 1 1) [1])
+      (is (dijkstra-path graph 1 5) [])
+      (is (thrown? IllegalArgumentException (dijkstra-path graph 1 100)))))
+  (let [graph (g/undirected-graph test-edges)]
+    (g/add-node! graph 5)
+    (testing "for undirected graph"
+      (is (dijkstra-path graph 1 3) [1 2 3])
+      (is (dijkstra-path graph 4 3) [4 2 3])
+      (is (dijkstra-path graph 4 1) [4 2 1])
+      (is (dijkstra-path graph 1 1) [1])
+      (is (dijkstra-path graph 1 5) [])
+      (is (thrown? IllegalArgumentException (dijkstra-path graph 1 100))))))

 (deftest barycenter-scorer-test
   (let [graph (g/directed-graph test-edges)]


Doubled max points

Doubled max points

--- src/clojush/problems/software/last_index_of_zero.clj
+++ src/clojush/problems/software/last_index_of_zero.clj
@@ -148,7 +148,7 @@
 (def argmap
   {:error-function (last-index-of-zero-error-function last-index-of-zero-data-domains)
    :atom-generators last-index-of-zero-atom-generators
-   :max-points 600
+   :max-points 1200
    :max-genome-size-in-initial-program 150
    :evalpush-limit 600
    :population-size 1000


scrollTo top on :init to prevent inadvertent scroll due to hash (workaround)

--- src/app/cljs/one/sample/view.cljs
+++ src/app/cljs/one/sample/view.cljs
@@ -25,7 +25,7 @@
         (append! (:workspace snippets)))))

 (defmethod render :init [_]
-  (comment))
+  (. js/window (scrollTo 0 0)))

 (defn- deactivate! [id-or-node-or-nodes]
   (remove-class! (if (string? id-or-node-or-nodes)


Logging-dependency

Logging-dependency

--- mtg-pairings-wer/project.clj
+++ mtg-pairings-wer/project.clj
@@ -6,6 +6,7 @@
                  [seesaw "1.4.4"]
                  [watchtower "0.1.1"]
                  [http-kit "2.1.18"]
+                 [org.clojure/tools.logging "0.3.1"]
                  [org.clojure/tools.reader "1.0.0-alpha3"]
                  [cheshire "5.5.0"]
                  [clj-time "0.11.0"]]


add the other slf4j bridges

add the other slf4j bridges

--- elephantdb-server/project.clj
+++ elephantdb-server/project.clj
@@ -3,6 +3,8 @@
   :source-paths ["src/clj"]
   :jvm-opts ["-Xmx768m" "-server" "-Djava.net.preferIPv4Stack=true" "-XX:+UseCompressedOops"]
   :dependencies [[ch.qos.logback/logback-classic "1.0.11"]
+                 [org.slf4j/jul-to-slf4j "1.7.4"]
+                 [org.slf4j/jcl-over-slf4j "1.7.4"]
                  [org.slf4j/log4j-over-slf4j "1.7.4"]
                  [com.yammer.metrics/metrics-graphite "2.2.0"]
                  [com.yammer.metrics/metrics-ganglia "2.2.0"]


comments

comments

Signed-off-by: Gregg Reynolds <d0f77bc71a9867acdcb4f62f012b858edad79160@norc.org>

--- src/clj/migae/datastore/impl/map.clj
+++ src/clj/migae/datastore/impl/map.clj
@@ -59,7 +59,8 @@
   ;; (log/debug "    keys" keys)
   ;; (log/debug "    schema" schema)
   (log/debug "    data" data)
-  (log/debug "schemata: " (sch/dump-schemata))
+  ;; (log/debug "schemata: " (sch/dump-schemata))
+  ;; FIXME: schema stuff
   (let [ps (sch/schema type)
         v (try (s/validator ps)
                (catch Exception x (log/debug "bad schema: " (.getMessage x))))


Migrations, connection fix

Migrations, connection fix

--- src/clj/salava/social/migrations.clj
+++ src/clj/salava/social/migrations.clj
@@ -6,6 +6,6 @@
 (defqueries "sql/social/queries.sql")

 (defn social-edit-column-endorsement-up [config]
- (modify-social-event-table-endorsement! {} (get-db (:conn config))))
+  (modify-social-event-table-endorsement! {} {:connection (:conn config)}))

 (defn social-edit-column-endorsement-down [config])


[REFACTOR] Rename some bindings

[REFACTOR] Rename some bindings

Signed-off-by: Pang Yan Han <22594c345857f664c61cd411f607c4d40a9d4af9@gmail.com>

--- src/cljs/cljs_nusmods/timetable.cljs
+++ src/cljs/cljs_nusmods/timetable.cljs
@@ -1491,17 +1491,18 @@
   [urlHash]
   (let [moduleUrlHashArray                (.split urlHash "&")

-        modUrlHashRegex
+        ; for modules with lessons
+        modWithLessonRegex
         #"^([A-Z]+\d{4}[A-Z]*)_(DL|L|LAB|PL|PT|R|SEM|ST|T|T2|T3)=([A-Z0-9]+)$"

         ; Sequence of non-nil match arrays
-        matchArraySeq
+        modWithLessonMatchArray
         (filter (fn [matchArray] (not (nil? matchArray)))
-                (map (fn [modUrlHash] (.exec modUrlHashRegex modUrlHash))
+                (map (fn [modUrlHash] (.exec modWithLessonRegex modUrlHash))
                      moduleUrlHashArray))

         ; Sequence of existing lesson groups
-        moduleInfoExistent
+        modWithLessonExistent
         (filter
           #(module-has-lesson-group? (:moduleCode %1) (:lessonType %1)
                                      (:lessonGroup %1))
@@ -1511,7 +1512,7 @@
                   :lessonType  (Lesson-Type-Short-To-Long-Form
                                  (nth matchArray 2))
                   :lessonGroup (nth matchArray 3)})
-               matchArraySeq))
+               modWithLessonMatchArray))

         ; Module code to CSS class for lesson div background color
         moduleToColorsMap
@@ -1520,15 +1521,15 @@
             (assoc m2cMap moduleCode (get-next-lesson-bg-color-css-class)))
           {}
           (distinct (map (fn [modInfo] (:moduleCode modInfo))
-                         moduleInfoExistent)))
+                         modWithLessonExistent)))

         moduleInfoFinal
-        (get-module-info-from-url-hash-module-info moduleInfoExistent)
+        (get-module-info-from-url-hash-module-info modWithLessonExistent)

         moduleCodes
         (distinct (map #(:moduleCode %1) moduleInfoFinal))]

-    (.log js/console (str "moduleInfoExistent = " (.stringify js/JSON (clj->js moduleInfoExistent))))
+    (.log js/console (str "modWithLessonExistent = " (.stringify js/JSON (clj->js modWithLessonExistent))))
     (.log js/console (str "moduleInfoFinal = " (.stringify js/JSON (clj->js moduleInfoFinal))))

     (doseq [moduleCode moduleCodes]


comments

comments

--- src/cljs/triboard/ai/strategies.cljs
+++ src/cljs/triboard/ai/strategies.cljs
@@ -21,6 +21,7 @@
       )))

 (defn optimize-own-score-ai
+  "Create an AI strategy to optmize its own score: good late game play"
   [player]
   (reify minimax/AIStrategy
     (eval-turn [this turn] (eval-next-score-of this turn [player]))
@@ -28,6 +29,7 @@
     ))

 (defn optmize-ai-scores-ai
+  "Create an AI strategy to optmize the AI scores: good cheat when the player wins"
   []
   (reify minimax/AIStrategy
     (eval-turn [this turn] (eval-next-score-of this turn [:red :green]))
@@ -35,6 +37,7 @@
     ))

 (defn optimize-own-choices-ai
+  "Create an AI strategy to optmize the AI choices: avoid being trapped with no moves left"
   [player]
   (reify minimax/AIStrategy
     (eval-turn [_ turn]


[#3083] Refactor: Extract logic to be used in update process

--- backend/src/akvo/lumen/lib/import/data_groups.clj
+++ backend/src/akvo/lumen/lib/import/data_groups.clj
@@ -78,15 +78,19 @@
                                                                :type type})
                                                             columns)})))))

+(defn adapt-columns [importer-columns]
+  (let [columns (map (fn [c] (-> c
+                                 (update :groupName (fn [groupName] (or groupName "main")))
+                                 (update :groupId (fn [groupId] (or groupId "main")))))
+                     importer-columns)]
+    (let [group-ids (distinct (map :groupId columns))]
+      {:group-table-names (reduce #(assoc % %2 (util/gen-table-name "ds")) {} group-ids)
+       :columns columns})))
+
 (defn execute [conn job-execution-id data-source-id dataset-id claims spec import-config]
   (with-open [importer (common/datagroups-importer (get spec "source") (assoc import-config :environment (env/all conn)))]
-    (let [rows               (p/records importer)
-          columns            (map (fn [c] (-> c
-                                              (update :groupName (fn [groupName] (or groupName "main")))
-                                              (update :groupId (fn [groupId] (or groupId "main")))))
-                                  (p/columns importer))
-          group-table-names  (let [group-ids (distinct (map :groupId columns))]
-                               (reduce #(assoc % %2 (util/gen-table-name "ds")) {} group-ids))]
+    (let [rows                                (p/records importer)
+          {:keys [columns group-table-names]} (adapt-columns (p/columns importer))]
       (doseq [[groupId cols] (group-by :groupId columns)]
         (postgres/create-dataset-table conn (get group-table-names groupId) cols))
       (doseq [response (take common/rows-limit rows)]


CMR-687: Added error message for OR option.

--- src/cmr/common/services/messages.clj
+++ src/cmr/common/services/messages.clj
@@ -51,4 +51,9 @@
 (defn invalid-exclude-param-msg
   "Creates a message saying supplied parameter(s) are not in exclude params set."
   [params-set]
-  (format "Parameter(s) [%s] can not be used with exclude." (str/join ", " (map name params-set))))+  (format "Parameter(s) [%s] can not be used with exclude." (str/join ", " (map name params-set))))
+
+(defn invalid-or-opt-setting-msg
+  "Creates a message saying which parameter is not allowed to use the 'or' option."
+  [param]
+  (format "'or' option is not valid for parameter [%s]" param))


scaffolding on scan

scaffolding on scan

--- src/hbase_clj/core.clj
+++ src/hbase_clj/core.clj
@@ -87,12 +87,51 @@
                (get-deleter id attrs)))))

 (defn scan
-  [{:keys [start-id end-id
-           eager? with-versions? max-versions
-           attrs cache-size small?]}]
-  (let [^Scan scanner (Scan.)]
+  [{:keys [start-id stop-id
+           cache-size small?
+           max-versions time-range
+           attrs eager? with-versions?]}]
+  (let [{:keys [id-type families]} *schema*
+        ^Scan scanner (Scan.)
+        addcolumn
+        (fn [f c]
+          (.addColumn
+            scanner
+            (encode :keyword f)
+            (encode (get-in families [f c]
+                            (get-in families [f :--ktype]))
+                    c)))]

-    ))
+    (if start-id
+      (.setStartRow scanner (encode id-type start-id)))
+
+    (if stop-id
+      (.setStopRow scanner (encode id-type stop-id)))
+
+    (if time-range
+      (.setTimeRange
+        scanner
+        (long (first  time-range))
+        (long (second time-range))))
+
+    (if cache-size
+      (.setCaching scanner cache-size))
+
+    (if max-versions
+      (.setMaxVersions scanner max-versions))
+
+    (doseq [d attrs]
+      (if (coll? d)
+        (let [[f c] d]
+          (if (coll? c)
+            (doseq [c c] (addcolumn f c))
+            (addcolumn f c)))
+        (.addFamily scanner
+                    (encode :keyword d))))
+
+    (let [^ResultScanner res (.getScanner *table* scanner)]
+      ;;TODO: return scan result
+      )))

 (defn- get-putter
   [id attr-map]


Add reference to asciidoc.css in project generation.

--- src/leiningen/new/cryogen.clj
+++ src/leiningen/new/cryogen.clj
@@ -23,6 +23,7 @@
                ["project.clj" (render "project.clj")]
                ;;static resources
                ["resources/templates/css/screen.css" (render "css/screen.css")]
+               ["resources/templates/css/asciidoc.css" (render "css/asciidoc.css")]
                ["resources/templates/js/highlight.pack.js" (render "js/highlight.pack.js")]
                ;;HTML templates
                ["resources/templates/html/layouts/archives.html" (render "html/layouts/archives.html")]
@@ -45,6 +46,5 @@
                ;;config
                ["resources/templates/config.edn" (render "config.edn")]
                ;;namespaces
-
                ["src/cryogen/core.clj" (render "src/cryogen/core.clj")]
                ["src/cryogen/server.clj" (render "src/cryogen/server.clj")]))))


Init lein-less plugin when +less option is used

--- src/leiningen/new/reagent.clj
+++ src/leiningen/new/reagent.clj
@@ -22,6 +22,13 @@
 (defn valid-opts? [opts]
   (every? #(some #{%} ["+cljx" "+test" "+less"]) opts))

+(defn less? [opts]
+  (some #{"+less"} opts))
+
+(def less-plugin "lein-less \"1.7.2\"")
+
+(def less-source-paths "\"resources/public/less\"")
+
 (defn test? [opts]
   (some #{"+test"} opts))

@@ -44,7 +51,8 @@
 (defn project-plugins [opts]
   (cond-> []
     (cljx? opts) (conj cljx-plugin)
-    (test? opts) (conj test-plugin)))
+    (test? opts) (conj test-plugin)
+    (less? opts) (conj less-plugin)))

 (defn project-nrepl-middleware [opts]
   (cond-> []


remove unneeded (copy)

remove unneeded (copy)

--- src/babel/english/morphology.cljc
+++ src/babel/english/morphology.cljc
@@ -895,7 +895,7 @@
                                                         :person :3rd}}}}}]))))))))

 (defn exception-generator
-  "lexicon is a map where each key is a root form string mapped to a set of lexical entries for that root form.
+  "_lexicon_ is a map where each key is a root form (a string) mapped to a set of lexical entries (maps) for that root form.
   For each such lexical entry, generate all possible exceptions, where the exception-generation rules are given below as 'path-and-merge-fn' tuples."
   [lexicon]
   (->>
@@ -920,8 +920,7 @@
                                                       :fail
                                                       (= lexeme :top)
                                                       :top
-                                                      true
-                                                      (copy lexeme)) ;; TODO: don't need to (copy)
+                                                      true lexeme)
                                          debug (if (string? (get-in lexeme path :none))
                                                  (do (log/trace (str "lexeme:" (strip-refs lexeme)))
                                                      (log/trace (str "merge-fn: " (strip-refs (merge-fn lexeme))))))


minor

minor

--- pp-cljs-client/src-cljs/pp_client/html.cljs
+++ pp-cljs-client/src-cljs/pp_client/html.cljs
@@ -155,9 +155,9 @@
           [:span.err-ttl-0867b "FORMAT ERROR"]
             [:div.msg-6f5ee (:msg new-state)]
             (when (some? (:line new-state))
-              [:div.line-b55e8 (str "LINE: " (:line new-state))])
+              [:div.line-b55e8 (str "line: " (:line new-state))])
             (when (some? (:column new-state))
-              [:div.col-67be9 (str "COLUMN: " (:column new-state))])])]))
+              [:div.col-67be9 (str "column: " (:column new-state))])])]))

 (quiescent/defcomponent LeftBody [new-state]
   (sablono/html


minors

minors

--- src/jarkeeper/core.clj
+++ src/jarkeeper/core.clj
@@ -52,7 +52,6 @@
        (log/info result)
        result))

-
 (defn- repo-redirect [{:keys [params]}]
   (log/info params)
   (resp/redirect (str "/" (:repo-url params))))


if translating from Italian, don't show subject's gender unless it's a past perfect sentence

--- src/babel/english/morphology.cljc
+++ src/babel/english/morphology.cljc
@@ -4,36 +4,34 @@
             [clojure.string :as string :refer [join replace trim]]
             #?(:clj [clojure.tools.logging :as log])
             #?(:cljs [babel.logjs :as log])
-            [dag_unify.core :refer [copy fail? get-in ref? strip-refs unifyc]]))
+            [dag_unify.core :refer [copy dissoc-paths fail? get-in ref? strip-refs unifyc]]))

 (declare get-string)
 (declare plural-en)

-(defn fo [input & {:keys [show-notes]
-                   :or {show-notes true}}]
-  (cond
-
-   (= input :fail)
-   (str input)
-
-   (string? input)
-   input
-
-   (and (map? input)
-        (map? (get-in input [:english])))
-   (get-string (get-in input [:english])
-               :show-notes show-notes)
-
-   (or (seq? input)
-       (vector? input))
-   (str "(" (string/join " , "
-                         (remove #(= % "")
-                                 (map #(let [f (fo %)] (if (= f "") "" (str "" f "")))
-                                      input)))
-        ")")
-
-   true
-   ""))
+(defn fo [input & {:keys [from-language show-notes]
+                   :or {from-language nil
+                        show-notes true}}]
+  (let [input (if (or (not (= "it" from-language))
+                      (not (= "fr" from-language))
+                      (not (= :past (get-in input [:synsem :sem :tense])))
+                      (not (= :perfect (get-in input [:synsem :sem :aspect]))))
+                (dissoc-paths input [[:comp :english :note]
+                                     [:english :a :note]])
+                input)]
+    (cond
+      (= input :fail)
+      (str input)
+
+      (string? input)
+      input
+
+      (and (map? input)
+           (map? (get-in input [:english])))
+      (get-string (get-in input [:english])
+                  :show-notes show-notes)
+      true
+      "")))

 (defn exception [error-string]
   #?(:clj


add new test

add new test

--- src/babel/italiano/benchmark.cljc
+++ src/babel/italiano/benchmark.cljc
@@ -48,3 +48,38 @@
                (repeatedly
                 #(println (with-out-str
                             (time (mapcat :parses (parse expr)))))))))
+
+;; lein run -m babel.italiano.benchmark/gen-mark 10
+(defn gen-mark [do-this-many]
+  (let [do-this-many (Integer. do-this-many)
+        timings
+        (->>
+         (take do-this-many
+               (repeatedly
+                #(with-out-str (time (fo (generate {:synsem {:subcat '()
+                                                             :essere true
+                                                             :sem {:pred :be-called
+                                                                   :tense :present
+                                                                   :subj :top
+                                                                   :iobj :top}}}
+                                                   :model small))))))
+         (map #(string/replace % #".*time:\s*([0-9.]+).*" "$1"))
+         (map string/trim)
+         (map #(Double. %))
+         ;; remove first run time - it's an outlier because of startup
+         ;; and language model-loading.
+         (#(if (> (count %) 1) (rest %) %))
+         (sort))]
+    (let [result
+          {:mean (/ (reduce + timings) (count timings))
+           :median (nth timings (int (Math/floor (/ (count timings) 2))))
+           :.75 (nth timings (int (Math/floor (* (count timings) 0.75))))
+           :.95 (nth timings (int (Math/floor (* (count timings) 0.95))))
+           :times timings
+           }]
+      (println result)
+      result)))
+
+
+
+


Write test summary to disk, then read it in test task.

IIIIIIIIIIIIIIIIIIIIIIIIIIICK. Ant's subclassloaderisms are nasty!

--- src/leiningen/test.clj
+++ src/leiningen/test.clj
@@ -18,8 +18,9 @@
 (defn form-for-testing-namespaces
   "Return a form that when eval'd in the context of the project will test
 each namespace and print an overall summary."
-  ([namespaces] (form-for-testing-namespaces namespaces 'clojure.test))
-  ([namespaces test-package]
+  ([namespaces result-file]
+     (form-for-testing-namespaces namespaces 'clojure.test result-file))
+  ([namespaces test-package result-file]
      `(do
         (require '~test-package)
         (let [resolver# (fn [fname#]
@@ -39,8 +40,10 @@
            ((resolver# ~''report) summary#))
           (when-not (= "1.5" (System/getProperty "java.specification.version"))
             (shutdown-agents))
-          (when-not (zero? (+ (:error summary#) (:fail summary#)))
-            (System/exit 1))))))
+          (with-open [w# (-> (java.io.File. ~result-file)
+                             (java.io.FileOutputStream.)
+                             (java.io.OutputStreamWriter.))]
+            (.write w# (pr-str summary#)))))))

 (defn test
   "Run the project's tests. Accepts a list of namespaces for which to run all
@@ -48,7 +51,13 @@
   [project & namespaces]
   (let [namespaces (if (empty? namespaces)
                      (sort (find-namespaces-in-dir (file (:test-path project))))
-                     (map symbol namespaces))]
+                     (map symbol namespaces))
+        result (java.io.File/createTempFile "lein" "result")]
     (eval-in-project project
                      (with-version-guard
-                       (form-for-testing-namespaces namespaces)))))
+                       (form-for-testing-namespaces namespaces
+                                                    (.getAbsolutePath result))))
+    (let [summary (read-string (slurp (.getAbsolutePath result)))
+          success? (zero? (+ (:error summary) (:fail summary)))]
+      (.delete result)
+      (System/exit (if success? 0 1)))))


Incrementally read and add data from project.clj files

--- src/leiningen/voom.clj
+++ src/leiningen/voom.clj
@@ -446,6 +446,21 @@
       (when-not (= 128 (:exit (ex-data e)))
         (println "Ignoring error:" (pr-str e)))
       nil)))
+(defn robust-read-proj-blob
+  [gitdir blob-sha]
+  ;; Hack to work around crazy project.clj files
+  (binding [slurp (patch-fn slurp "{}")
+            load-file (patch-fn load-file {})]
+    (let [tmp-file (File/createTempFile ".project-" ".clj")]
+      (try
+        (spit tmp-file
+              (:out (git {:gitdir gitdir} "cat-file" "-p" (str blob-sha))))
+        (project/read (str tmp-file))
+        (catch Exception e
+          ;; It was really just a best effort anyway. Silently ignore.
+          nil)
+        (finally
+         (.delete tmp-file))))))

 (defn origin-branches
   [gitdir]
@@ -1100,6 +1115,38 @@
                      (r-commit-parent childer nparent)
                      (ancestoro nparent parenter))])))

+(defn sem-ver-parse [ver-str]
+  (let [vparts (re-matches #"(?:(\d+)\.)?(?:(\d+)\.)?(?:(\d+)-)?(.*)" ver-str)
+        [vqual & vnums] (reverse (filter identity (next vparts)))
+        [vmajor vminor vinc] (map #(if (and (string? %) (re-matches #"[0-9]*" %))
+                                     (Integer/parseInt %)
+                                     %) (reverse vnums))]
+    [vmajor vminor vinc vqual]))
+
+(defn add-r-projs
+  [gitdir db]
+  (pldb/with-db db
+    (let [proj-blobs (l/run* [blob-sha]
+                       (l/fresh [proj-dir-sha]
+                         (r-tree proj-dir-sha "project.clj" :blob blob-sha)))
+          read-blobs (l/run* [blob-sha]
+                       (l/fresh [proj-name vmajor vminor vinc vqual has-snaps?]
+                         (r-proj blob-sha proj-name
+                                 vmajor vminor vinc vqual has-snaps?)))
+          blobs-to-read (apply disj (set proj-blobs) read-blobs)]
+      (reduce
+       (fn [db blob-sha]
+         (if-let [proj (robust-read-proj-blob gitdir blob-sha)]
+           (let [proj-name (symbol (:group proj) (:name proj))
+                 has-snaps? (some #(.contains ^String % "-SNAPSHOT")
+                                  (map second (:dependencies proj)))
+                 [vmajor vminor vinc vqual] (sem-ver-parse (:version proj))]
+             (pldb/db-fact db r-proj blob-sha proj-name
+                           vmajor vminor vinc vqual has-snaps?))
+           db))
+       db
+       blobs-to-read))))
+
 (comment
   (def xdb1 (pldb/db [r-tree :a :b :c :d]))
   (pldb/with-db xdb1 (l/run* [a] (r-tree a :b :c :d)))
@@ -1108,9 +1155,10 @@
   (def xdb3 (rels->pldb [r-tree] (fress/read (fress/write (pldb-rels xdb1)))))
   (pldb/with-db xdb3 (l/run* [a] (r-tree a :b :c :d)))

-  (time (def db (apply pldb/db (git-logic-tuples "<git repo>"))))
-  (time (fress-spit-seq "tmp.frs" (pldb-rels db)))
-  (time (def db2
+  (time (def db (apply pldb/db (git-logic-tuples (io/file voom-repos "lein-voom")))))
+  (time (def db2 (add-r-projs (io/file voom-repos "lein-voom") db)))
+  (time (fress-spit-seq "tmp.frs" (pldb-rels db2)))
+  (time (def db3
           (rels->pldb [r-branch r-commit r-commit-parent r-tree r-proj]
                       (fress/read "tmp.frs" :handlers my-read-handlers))))
   (time (def x (fress/read "tmp.frs" :handlers my-read-handlers)))
@@ -1118,7 +1166,7 @@
   (time
    (let [fname "core.clj"]
      (doall
-      (pldb/with-db db
+      (pldb/with-db db3
         (l/run 10 [c-sha tree-path obj-sha]
                (l/fresh [tree-sha ctime p-sha p-ctime p-tree-sha p-obj-sha]
                         (r-commit c-sha ctime tree-sha)
@@ -1137,15 +1185,25 @@
                (ancestoro c p)
                (l/== q true))))))

-  (pldb/with-db db
+  (pldb/with-db db3
+    (l/run 10 [sha]
+     (l/fresh [obj-sha]
+       (r-tree sha "project.clj" :blob obj-sha))))
+
+  (pldb/with-db db3
     (l/run* [filename]
      (l/fresh [sha ftype]
-       (r-tree sha filename ftype (str->sha "7a317ed2bc19d4518d403f011a1f542b67e96ef")))))
-  (pldb/with-db db
+       (r-tree sha filename ftype (str->sha "7b3e68a8839aeb4")))))
+  (pldb/with-db db3
     (l/run 5 [dirname]
             (l/fresh [obj-sha proj-dir-sha otherdir]
                      (r-tree proj-dir-sha "project.clj" :blob obj-sha)
                      (r-tree otherdir dirname :tree proj-dir-sha))))
+  (pldb/with-db db3
+    (l/run 5 [q]
+           (l/fresh [a b c d e f g]
+                    (r-proj a b c d e f g)
+                    (l/== q [a b c d e f g]))))
   )

 (def my-write-handlers


cleanup

cleanup

--- src/main/shadow/build/npm.clj
+++ src/main/shadow/build/npm.clj
@@ -251,9 +251,11 @@
                            :package-dir package-dir})))

                entry-file))
+
+        ;; fallback for <package>/index.js without package.json
         (let [index (io/file package-dir "index.js")]
-        (when (and (.exists index) (.isFile index))
-          index)))))
+          (when (and (.exists index) (.isFile index))
+            index)))))

 (defn find-package-require* [npm modules-dir require]
   (or (when-let [file (test-file modules-dir require)]
@@ -267,16 +269,7 @@
           :else
           nil))

-      (test-file-exts npm modules-dir require)
-
-      ;; check if node_modules/<require>/package.json exists and follow :main
-      #_(when-let [package (find-package npm require)]
-          (find-package-main npm package))
-
-      ;; find node_modules/<require>/index.js
-      #_(let [^File file (io/file modules-dir require "index.js")]
-          (when (.exists file)
-            file))))
+      (test-file-exts npm modules-dir require)))

 (defn find-package-require
   [npm ^File require-from require]


fix REPL timing issue

fix REPL timing issue

node-repl could try to read files before they complete flusing

--- src/main/shadow/cljs/repl.clj
+++ src/main/shadow/cljs/repl.clj
@@ -235,7 +235,9 @@
                           (remove nil?)
                           (into [])))))]

-    (output/flush-sources state new-sources)
+    (doto state
+      (output/flush-sources new-sources)
+      (async/wait-for-pending-tasks!))

     (update-in state [:repl-state :repl-actions] conj action)
     ))
@@ -377,7 +379,9 @@
         {:type :repl/set-ns
          :ns ns}]

-    (output/flush-sources state dep-sources)
+    (doto state
+      (output/flush-sources dep-sources)
+      (async/wait-for-pending-tasks!))

     (-> state
         (assoc-in [:repl-state :current-ns] ns)


Fix saving files

Fix saving files

--- src/clojure/nightcode/editors.clj
+++ src/clojure/nightcode/editors.clj
@@ -22,19 +22,19 @@
          (s/select (get @editors path))
          first)))

-(defn get-selected-editor
+(defn get-selected-path
   []
   (-> (s/select @utils/ui-root [:#project-tree])
       .getSelectionPath
-      utils/tree-path-to-str
-      get-editor))
+      utils/tree-path-to-str))
+
+(defn get-selected-editor
+  []
+  (get-editor (get-selected-path)))

 (defn get-selected-editor-pane
   []
-  (->> (s/select @utils/ui-root [:#project-tree])
-       .getSelectionPath
-       utils/tree-path-to-str
-       (get @editors)))
+  (get @editors (get-selected-path)))

 (defn is-unsaved?
   [path]
@@ -55,7 +55,9 @@
 (defn save-file
   [e]
   (when-let [editor (get-selected-editor)]
-    (.save editor)
+    (with-open [w (java.io/writer (java.io/file (get-selected-path)))]
+      (.write editor w))
+    (.setDirty editor false)
     (s/request-focus! editor)
     (update-buttons (get-selected-editor-pane) editor)))

@@ -172,7 +174,7 @@
       (doto (TextPrompt. (utils/get-string :find)
                          (s/select text-group [:#find-field]))
         (.changeAlpha 0.5))
-      (.load text-area (FileLocation/create path) "UTF-8")
+      (.load text-area (FileLocation/create path) nil)
       (.discardAllEdits text-area)
       (.setAntiAliasingEnabled text-area true)
       (s/listen text-area


Go back to indent mode on paste

Go back to indent mode on paste

--- src/clojure/nightcode/editors.clj
+++ src/clojure/nightcode/editors.clj
@@ -427,7 +427,7 @@
               (and (or (.isControlDown e) (.isMetaDown e))
                 (contains? #{KeyEvent/VK_V KeyEvent/VK_X} (.getKeyCode e)))
               (->> (init-state text-area)
-                   (get-parinfer-state text-area console?)
+                   (get-parinfer-state text-area false)
                    (refresh-content! text-area)
                    (mwm/update-edit-history! edit-history))))
           (keyTyped [this e] nil)


Fixed up response bodies.

Fixed up response bodies.

--- src/cmr/opendap/http/response.clj
+++ src/cmr/opendap/http/response.clj
@@ -85,19 +85,19 @@

 (defn json
   [_request data]
-  (-> {:body (json/generate-string data)}
+  (-> {:body (json/generate-string (dissoc data :status))}
       (status-or-ok data)
       (response/content-type "application/json")))

 (defn text
   [_request data]
-  (-> {:body data}
+  (-> {:body (dissoc data :status)}
       (status-or-ok data)
       (response/content-type "text/plain")))

 (defn html
   [_request data]
-  (-> data
+  (-> {:body (dissoc data :status)}
       (status-or-ok data)
       (response/content-type "text/html")))


Fix hand delay

Fix hand delay

--- ros/angelic_planning/src/ros/robot_actions.clj
+++ ros/angelic_planning/src/ros/robot_actions.clj
@@ -199,7 +199,8 @@
       (loop []
 	(let [f #^java.util.concurrent.Future (future-call #(when (execute-robot-primitive nh action) true))]
 	  (while (and (not @a) (not (.isDone f))) (.spinOnce nh))
-	  (when @a
+	  (if @a
+	   (do
 	    (println "Pausing!")
 	    (preempt-base nh)
 	    (preempt-arm nh true)
@@ -214,7 +215,7 @@
 	    (while (not @a) (.spinOnce nh))
 	    (Thread/sleep 2000) (.spinOnce nh) (reset! a false)
 	    (recur))
-	  (when (not @f) (throw (Exception.))))))))
+	  (when (not @f) (throw (Exception.)))))))))

 (defn execute-robot-plan-robustly  [nh actions]
   (doseq [action actions]


adjust scheduler

adjust scheduler

--- src/ceres_collector/scheduler.clj
+++ src/ceres_collector/scheduler.clj
@@ -13,42 +13,42 @@
 (defjob HtmlsBackup [ctx]
   (let [path (get (qc/from-job-data ctx) "folder-path")]
       (info "Writing htmls backup...")
-    (db/backup-yesterday "athena" "htmls" path)))
+    (db/backup-yesterday "demeter" "htmls" path)))

 (defjob TweetBackup [ctx]
   (let [path (get (qc/from-job-data ctx) "folder-path")]
       (info "Writing tweets backup...")
-      (db/backup-yesterday "athena" "tweets" path)))
+      (db/backup-yesterday "demeter" "tweets" path)))

 (defjob ReactionsBackup [ctx]
   (let [path (get (qc/from-job-data ctx) "folder-path")]
       (info "Writing reactions backup...")
-    (db/backup-yesterday "athena" "reactions" path)))
+    (db/backup-yesterday "demeter" "reactions" path)))

 (defjob PubsBackup [ctx]
   (let [path (get (qc/from-job-data ctx) "folder-path")]
       (info "Writing publications backup...")
-    (db/backup-yesterday "athena" "publications" path)))
+    (db/backup-yesterday "demeter" "publications" path)))

 (defjob UrlsBackup [ctx]
   (let [path (get (qc/from-job-data ctx) "folder-path")]
       (info "Writing urls backup...")
-      (db/backup-yesterday "athena" "urls" path)))
+      (db/backup-yesterday "demeter" "urls" path)))

 (defjob UsersBackup [ctx]
   (let [path (get (qc/from-job-data ctx) "folder-path")]
       (info "Writing users backup...")
-    (db/backup-yesterday "athena" "users" path)))
+    (db/backup-yesterday "demeter" "users" path)))

 (defjob MentionsBackup [ctx]
   (let [path (get (qc/from-job-data ctx) "folder-path")]
       (info "Writing mentions backup...")
-      (db/backup-yesterday "athena" "mentions" path)))
+      (db/backup-yesterday "demeter" "mentions" path)))

 (defjob HashtagsBackup [ctx]
   (let [path (get (qc/from-job-data ctx) "folder-path")]
       (info "Writing hashtags backup...")
-      (db/backup-yesterday "athena" "hashtags" path)))
+      (db/backup-yesterday "demeter" "hashtags" path)))

 ;; --- Schedules ---


link to head docs

link to head docs

--- src/lights/my_show.clj
+++ src/lights/my_show.clj
@@ -35,6 +35,7 @@

 (defn head280
   "Head PHS 280"
+  ;; http://media.steinigke.de/documents_t/51838206-MANUAL-1.30-en-de_00054251.pdf
   []
   {:channels [(chan/tilt 1 :tilt)
               (chan/pan 2 :pan)


added missing declaration for union, in tilesets.

--- src/clj/forma/source/tilesets.clj
+++ src/clj/forma/source/tilesets.clj
@@ -1,5 +1,6 @@
 (ns forma.source.tilesets
-  (:use forma.source.modis))
+  (:use forma.source.modis
+        [clojure.set :only (union)]))

 (def
   ^{:doc "MODIS tiles for the selected countries, identified by their


Restore some missing opts to the repl-env

--- src/clj/weasel/repl/websocket.clj
+++ src/clj/weasel/repl/websocket.clj
@@ -32,7 +32,12 @@
 (defn repl-env
   "Returns a JS environment to pass to repl or piggieback"
   [& {:as opts}]
-  (let [opts (merge (WebsocketEnv.)
+  (let [ups-deps (cljsc/get-upstream-deps (java.lang.ClassLoader/getSystemClassLoader))
+        opts (merge {::env/compiler (env/default-compiler-env opts)
+                     :ups-libs (:libs ups-deps)
+                     :ups-foreign-libs (:foreign-libs ups-deps)}
+               opts)
+        opts (merge (WebsocketEnv.)
                {:ip "127.0.0.1"
                 :port 9001}
                opts)]


Add an fn for getting card data from server on add

--- src/cljs/decktouch/card-data.cljs
+++ src/cljs/decktouch/card-data.cljs
@@ -1,5 +1,8 @@
 (ns decktouch.card-data
-  (:require [reagent.core :as reagent :refer [atom]]))
+  (:require [reagent.core :as reagent :refer [atom]]
+            [ajax.core :refer [POST]]
+            [cljs.core.async :refer [chan >! <!]])
+  (:require-macros [cljs.core.async.macros :refer [go]]))

 (defn get-card-list-from-storage []
   "Get the list of cards from localStorage, or [] if it is empty"
@@ -11,5 +14,20 @@

 (def card-list (atom (get-card-list-from-storage)))

+(defn <lookup-card-data [card-name]
+  (let [c (chan)]
+    (POST "/data/card" {:handler #(go (>! c %))
+                        :params {:card-name card-name}
+                        :format :raw
+                        :error-handler (fn [{:keys [status status-text]}]
+                                         (.log js/console
+                                               (str "Error: " status " "
+                                                    status-text)))})
+    c))
+
 (defn add-card-to-list! [card-name]
-  (swap! card-list conj {:name card-name}))+  (do
+    (swap! card-list conj {:name card-name})
+    (go
+      (let [response (<! (<lookup-card-data card-name))]
+        (.log js/console response)))))


Activity edit mostly there

Activity edit mostly there

Committer: Oscar Marshall <01af343477e12cdcd63ce344f9b5b84795bdb80c@gmail.com>

--- src/cljs/elevent_client/core.cljs
+++ src/cljs/elevent_client/core.cljs
@@ -131,7 +131,7 @@
          (case operation
            :create (POST uri options)
            :read   (GET  uri options)
-           :update (check-id PUT)
+           :update (PUT uri options)
            :delete (check-id DELETE)
            :create-no-read (POST uri options)
            (POST (str uri "/" (name operation)) options)))))
@@ -198,9 +198,7 @@

 (defroute events-route
   "/events" []
-  (if (:token @session)
-    (reset! current-page [#'events-page])
-    (location.replace (events-explore-route))))
+  (reset! current-page [#'events-page]))

 (defroute event-add-route
   "/events/add" []
@@ -535,20 +533,26 @@
                          [:div])})))

 (defn calendar [options]
-  (r/create-class
-    {:component-did-mount #(.fullCalendar (js/jQuery (r/dom-node %))
-                                          (clj->js options))
-     :component-did-update #(.fullCalendar (js/jQuery (r/dom-node %))
-                                           (clj->js options))
-     :reagent-render (constantly [:div])}))
+  (let [options (atom {})]
+    (r/create-class
+      {:component-did-mount #(.fullCalendar (js/jQuery (r/dom-node %))
+                                            (clj->js @options))
+       :component-did-update #(.fullCalendar (js/jQuery (r/dom-node %))
+                                             (clj->js @options))
+       :reagent-render (fn [x]
+                         (reset! options x)
+                         [:div])})))

 (defn qr-code [options]
-  (r/create-class
-    {:component-did-mount #(.qrcode (js/jQuery (r/dom-node %))
-                                    (clj->js options))
-     :component-did-update #(.qrcode (js/jQuery (r/dom-node %))
-                                     (clj->js options))
-     :reagent-render (constantly [:div])}))
+  (let [options (atom {})]
+    (r/create-class
+      {:component-did-mount #(.qrcode (js/jQuery (r/dom-node %))
+                                      (clj->js @options))
+       :component-did-update #(.qrcode (js/jQuery (r/dom-node %))
+                                       (clj->js @options))
+       :reagent-render (fn [x]
+                         (reset! options x)
+                         [:div])})))

 ; action must be a function that takes a callback for the API call as a param
 (defn action-button [options text action & [alt-text]]
@@ -572,12 +576,11 @@
   [:nav.ui.fixed.menu
    [:a.logo.item {:href (home-route)}
     [:img {:src "images/logo-menu.png"}]]
-   (when (:token @session)
-     [:a.blue.item {:href (events-route)
-                    :class (when (re-find (re-pattern (events-route)) @location)
-                             "active")}
-      [:i.ticket.icon]
-      "Events"])
+   [:a.blue.item {:href (events-route)
+                  :class (when (re-find (re-pattern (events-route)) @location)
+                           "active")}
+    [:i.ticket.icon]
+    "Events"]
    [:a.blue.item {:href (organizations-route)
                   :class (when (re-find (re-pattern (organizations-route))
                                         @location)
@@ -875,6 +878,36 @@
       (clj->js (:payment-info @session))
       response-handler)))

+(defn activity-table-component [event-id]
+  (let [activities (doall (map #(into {} (d/entity @activities-db %))
+                               (d/q '[:find [?activity-id ...]
+                                      :in $ ?event-id
+                                      :where [?activity-id :EventId ?event-id]]
+                                    @activities-db
+                                    event-id)))]
+    [:table.ui.table
+     [:thead
+      [:tr
+       [:th "Start Time"]
+       [:th "End Time"]
+       [:th "Activity"]
+       [:th "Location"]
+       [:th "Actions"]]]
+     [:tbody
+      (for [activity activities]
+        ^{:key (:ActivityId activity)}
+        [:tr
+         [:td (let [start (from-string (:StartTime activity))]
+                (unparse datetime-formatter start))]
+         [:td (let [end   (from-string (:EndTime   activity))]
+                (unparse datetime-formatter end))]
+         [:td (:Name activity)]
+         [:td (:Location activity)]
+         [:td [:a.ui.tiny.labeled.icon.button
+               {:href (event-activity-edit-route activity)}
+               [:i.edit.icon]
+               "Edit"]]])]]))
+

 ;; Pages
 ;; =============================================================================
@@ -996,64 +1029,68 @@
                                           (d/entity @attendees-db attendee-id)
                                           nil))]
     (fn []
-      (let [attending-events
-            (doall (map (fn [[event-id attendee-id]]
-                          (merge
-                            (into {} (d/entity @events-db event-id))
-                            {:AttendeeId attendee-id}))
-                        (d/q '[:find ?event-id ?attendee-id
-                               :in $ ?user-id
-                               :where
-                               [?attendee-id :UserId  ?user-id]
-                               [?attendee-id :EventId ?event-id]]
-                             @attendees-db
-                             (get-in @session [:user :UserId]))))]
-        [:div.sixteen.wide.column
-         [:div.ui.top.attached.tabular.menu
-          [:a.active.item {:href (events-route)}
-           "Events"]
-          [:a.item {:href (events-explore-route)}
-           "Explore"]
-          [:a.item {:href (events-owned-route)}
-           "Owned"]
-          [:a.item {:href (event-add-route)}
-           "Add"]]
-         [:div.ui.bottom.attached.segment
-          [:div
-           [:div.ui.vertical.segment
-            [:h1.ui.header "Events You're Attending"]]
-           [:div.ui.vertical.segment
-            (if (seq attending-events)
-              [:div.ui.divided.items
-               (for [event attending-events]
-                 ^{:key (:EventId event)}
-                 [:div.item
-                  [:div.content
-                   [:a.header {:href (event-route event)}
-                    (:Name event)]
-                   [:div.meta
-                    [:strong "Date:"]
-                    (let [start (from-string (:StartDate event))
-                          end   (from-string (:EndDate   event))]
-                      (str (unparse datetime-formatter start)
-                           (when (after? end start)
-                             (str " to " (unparse datetime-formatter end)))))]
-                   [:div.meta
-                    [:strong "Venue:"]
-                    (:Venue event)]
-                   [:div.description
-                    (:Description event)]
-                   [:div.extra
-                    [:a.ui.right.floated.small.button {:href (event-schedule-route event)}
-                     "Your activities"
-                     [:i.right.chevron.icon]]
-                    [:a.ui.right.floated.small.button
-                     {:on-click #(leave-event (:AttendeeId event))}
-                     [:i.red.remove.icon]
-                     "Leave event"]]]])]
-              [:p "You aren't attending any events."])]]
-          [:div.ui.dimmer {:class (when (empty? @events) "active")}
-           [:div.ui.loader]]]]))))
+      (if (:token @session)
+        (let [attending-events
+              (doall (map (fn [[event-id attendee-id]]
+                            (merge
+                              (into {} (d/entity @events-db event-id))
+                              {:AttendeeId attendee-id}))
+                          (d/q '[:find ?event-id ?attendee-id
+                                 :in $ ?user-id
+                                 :where
+                                 [?attendee-id :UserId  ?user-id]
+                                 [?attendee-id :EventId ?event-id]]
+                               @attendees-db
+                               (get-in @session [:user :UserId]))))]
+          [:div.sixteen.wide.column
+           [:div.ui.top.attached.tabular.menu
+            [:a.active.item {:href (events-route)}
+             "Events"]
+            [:a.item {:href (events-explore-route)}
+             "Explore"]
+            [:a.item {:href (events-owned-route)}
+             "Owned"]
+            [:a.item {:href (event-add-route)}
+             "Add"]]
+           [:div.ui.bottom.attached.segment
+            [:div
+             [:div.ui.vertical.segment
+              [:h1.ui.header "Events You're Attending"]]
+             [:div.ui.vertical.segment
+              (if (seq attending-events)
+                [:div.ui.divided.items
+                 (for [event attending-events]
+                   ^{:key (:EventId event)}
+                   [:div.item
+                    [:div.content
+                     [:a.header {:href (event-route event)}
+                      (:Name event)]
+                     [:div.meta
+                      [:strong "Date:"]
+                      (let [start (from-string (:StartDate event))
+                            end   (from-string (:EndDate   event))]
+                        (str (unparse datetime-formatter start)
+                             (when (after? end start)
+                               (str " to " (unparse datetime-formatter end)))))]
+                     [:div.meta
+                      [:strong "Venue:"]
+                      (:Venue event)]
+                     [:div.description
+                      (:Description event)]
+                     [:div.extra
+                      [:a.ui.right.floated.small.button {:href (event-schedule-route event)}
+                       "Your activities"
+                       [:i.right.chevron.icon]]
+                      [:a.ui.right.floated.small.button
+                       {:on-click #(leave-event (:AttendeeId event))}
+                       [:i.red.remove.icon]
+                       "Leave event"]]]])]
+                [:p "You aren't attending any events."])]]
+            [:div.ui.dimmer {:class (when (empty? @events) "active")}
+             [:div.ui.loader]]]])
+        (do
+          (js/location.replace (events-explore-route))
+          [:div])))))

 (defn events-explore-page []
   (let [unattending-events
@@ -1155,7 +1192,8 @@
                [:div.description
                 (:Description event)]
                [:div.extra
-                [:a.ui.right.floated.small.button {:href nil}
+                [:a.ui.right.floated.small.button
+                 {:href (event-edit-route event)}
                  "Edit"
                  [:i.right.chevron.icon]]]]])]
           [:p "You don't own any events."])]]
@@ -1230,34 +1268,7 @@
         [:div.ui.vertical.segment
          [:h2.ui.header
           "Activities"]
-         [:table.ui.table
-          [:thead
-           [:tr
-            [:th "Start"]
-            [:th "End"]
-            [:th "Activity"]
-            [:th "Location"]]]
-          [:tbody
-           (for [activity activities]
-             ^{:key (:ActivityId activity)}
-             [:tr
-              [:td {:noWrap true}
-               (when activity
-                 (unparse datetime-formatter
-                          (from-string (:StartTime activity))))]
-              [:td {:noWrap true}
-               (when activity
-                 (unparse datetime-formatter
-                          (from-string (:EndTime activity))))]
-              [:td (:Name activity)]
-              [:td (:Location activity)]])]
-          [:tfoot
-           [:tr
-            [:th {:colSpan "4"}
-             [:a.ui.right.floated.small.labeled.icon.button
-              {:href (event-activity-add-route event)}
-              [:i.edit.icon]
-              "Edit"]]]]]]
+         [activity-table-component event-id]]
         [:div.ui.vertical.segment
          [:h2.ui.header
           "Attendees"
@@ -1426,24 +1437,29 @@
              (create-event @form)]]]]]))))

 (defn event-activity-edit-page [event-id & [activity-id]]
-  (let [form (atom {:EventId event-id})
+  (let [form (atom {:EventId event-id :EnrollmentCap ""})
+        reset-form!
+        (reset! form {:EventId event-id :EnrollmentCap ""})
         validator (validation-set (presence-of :Name)
                                   (presence-of :StartTime)
                                   (presence-of :EndTime)
                                   (format-of :EnrollmentCap :format #"^\d*$"
                                              :allow-blank true
-                                             :allow-nil true))
-        reset-form!
-        (fn []
-          (reset! form {:EventId event-id}))]
+                                             :allow-nil true))]
     (when activity-id
       (if-let [activity (seq (d/entity @activities-db activity-id))]
-        (reset! form (into {} activity))
+        (reset! form (let [activity (into {} activity)]
+                       (assoc activity
+                         :EnrollmentCap (str (:EnrollmentCap activity)))))
         (add-watch activities-db
                    :activity-edit
                    (fn [_ _ _ _]
-                     (reset! form (into {} (d/entity @activities-db
-                                                     activity-id)))
+                     (reset! form
+                             (let [activity (into {} (d/entity @activities-db
+                                                               activity-id))]
+                               (assoc activity
+                                 :EnrollmentCap
+                                 (str (:EnrollmentCap activity)))))
                      (remove-watch activities-db :activity-edit)))))
     (fn [event-id]
       (let [{:keys [Name Location EnrollmentCap StartTime EndTime Description]}
@@ -1461,8 +1477,7 @@
                                :in $ ?event-id
                                :where
                                [?e :EventId ?event-id]]
-                             @activities-db
-                             event-id)))
+                             @activities-db)))

             create-activity
             (fn [form]
@@ -1488,7 +1503,15 @@
             [:div.ui.vertical.segment
              [:h2.ui.header
               (if activity-id "Edit" "Add") " activity"]
-             [:form.ui.form
+             [:form.ui.form {:on-submit
+                             (fn [e]
+                               (when (empty? errors)
+                                 (.preventDefault e)
+                                 (activities-endpoint (if activity-id
+                                                        :update
+                                                        :create)
+                                                      @form
+                                                      #(reset-form!))))}
               [:div.one.field
                [:div.required.field {:class (when (and Name (:Name errors))
                                               "error")}
@@ -1524,28 +1547,12 @@
               [action-button
                {:class (str "primary" (when (seq errors) " disabled"))
                 :type :submit}
-               "Add"
+               (if activity-id "Edit" "Add")
                (create-activity @form)]]]
             [:div.ui.vertical.segment
              [:h2.ui.header
               "Activities"]
-             [:table.ui.table
-              [:thead
-               [:tr
-                [:th "Start Time"]
-                [:th "End Time"]
-                [:th "Activity"]
-                [:th "Location"]]]
-              [:tbody
-               (for [activity activities]
-                 ^{:key (:ActivityId activity)}
-                 [:tr
-                  [:td (let [start (from-string (:StartTime activity))]
-                         (unparse datetime-formatter start))]
-                  [:td (let [end   (from-string (:EndTime   activity))]
-                         (unparse datetime-formatter end))]
-                  [:td (:Name activity)]
-                  [:td (:Location activity)]])]]]]])))))
+             [activity-table-component event-id]]]])))))

 (defn event-attendees-page [event-id]
   (let [form (atom {:EventId event-id})]


Add :uberjar profile to work around Leiningen bug

--- src/clojure/nightcode/sandbox.clj
+++ src/clojure/nightcode/sandbox.clj
@@ -42,12 +42,14 @@
           m2 (get-path ".m2")
           tmp (get-path ".temp")
           jvm-opts (str "-Djava.io.tmpdir=" tmp)
-          content {:user {:local-repo m2
-                          :jvm-opts [jvm-opts]
-                          :gwt {:extraJvmArgs jvm-opts}}}]
+          profile {:local-repo m2
+                   :jvm-opts [jvm-opts]
+                   :gwt {:extraJvmArgs jvm-opts}}
+          profiles {:user profile
+                    :uberjar profile}]
       (doto (io/file profiles-clj)
         (-> .getParentFile .mkdir)
-        (spit (pr-str content))))))
+        (spit (pr-str profiles))))))

 ; objc


Sort variable sets to make tests consistent across platforms.

--- src/common/datomish/query/cc.cljc
+++ src/common/datomish/query/cc.cljc
@@ -62,7 +62,7 @@
            [source
             from              ; [[:datoms 'datoms123]]
             external-bindings ; {?var0 (sql/param :foobar)}
-            bindings          ; {?var1 :datoms123.v}
+            bindings          ; {?var1 [:datoms123.v]}
             known-types       ; {?var1 :db.type/integer}
             extracted-types   ; {?var2 :datoms123.value_type_tag}
             wheres            ; [[:= :datoms123.v 15]]
@@ -162,6 +162,8 @@
           bindings))

 ;; This is so we can link clauses to the outside world.
+;; Note that we sort the variable list to achieve consistent ordering between
+;; Clojure and ClojureScript, yielding sane tests.
 (defn- impose-external-bindings [cc]
   (if (empty? (:external-bindings cc))
     cc
@@ -177,7 +179,7 @@
               (assert external)
               (assert internal)
               [:= external internal]))
-          vars)))))
+          (sort vars))))))

 (defn expand-where-from-bindings
   "Take the bindings in the CC and contribute
@@ -187,7 +189,7 @@
   (impose-external-bindings
     (assoc cc :wheres
            ;; Note that the order of clauses here means that cross-pattern var bindings
-           ;; come last That's OK: the SQL engine considers these altogether.
+           ;; come last. That's OK: the SQL engine considers these altogether.
            (concat (:wheres cc)
                    (bindings->where (:bindings cc))))))