Additional session creation entry points

--- src/uruk/core.clj
+++ src/uruk/core.clj
@@ -6,16 +6,16 @@
             [clojure.data.xml :as xml]
             [slingshot.slingshot :as sling])
   (:import [java.util.logging Logger]
+           java.net.URI
            [com.marklogic.xcc
             Session$TransactionMode
-            RequestOptions
+            RequestOptions SecurityOptions
             ContentCreateOptions ContentPermission ContentCapability
-            ContentSourceFactory ContentFactory
+            ContentSource ContentSourceFactory ContentFactory
             DocumentFormat DocumentRepairLevel
-            ValueFactory]
+            ValueFactory Version]
            [com.marklogic.xcc.types ValueType]
-           [com.marklogic.xcc Version]
-           java.net.URI))
+           [com.marklogic.xcc.spi ConnectionProvider]))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;; Enumerations and classes.
@@ -235,10 +235,76 @@
 ;;;; Session management
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

+
+
+(defn security-options
+  "TODO"
+  ([ssl-context] (security-options ssl-context nil))
+  ([ssl-context {:keys [protocols cipher-suites]}]
+   (let [sec-opts (SecurityOptions. ssl-context)]
+     (when (seq protocols)
+       (.setEnabledProtocols sec-opts (into-array String protocols)))
+     (when (seq cipher-suites)
+       (.setEnabledCipherSuites sec-opts (into-array String cipher-suites)))
+     sec-opts)))
+
+
+(defn uri-content-source
+  "TODO"
+  ([uri] (uri-content-source uri nil))
+  ;; Return a ContentSource object that will serve as the source of
+  ;; connections to the server specified by the given URI.
+  ([uri security-opts]
+   ;; TODO enforce or construct SecurityOptions for security-opts
+   (ContentSourceFactory/newContentSource (if (instance? URI uri)
+                                            uri (URI. uri))
+                                          security-opts)))
+
+(defn hosted-content-source
+  "TODO"
+  ([host port]
+   ;; Return a ContentSource object that will serve as the source of
+   ;; connections to the server on the given host and port, with no
+   ;; default login credentials.
+   (ContentSourceFactory/newContentSource host port))
+  ([host port user password]
+   (hosted-content-source host port user password nil nil))
+  ([host port user password content-base]
+   (hosted-content-source host port user password content-base nil))
+
+  ;; Return a ContentSource object that will serve as the source of
+  ;; connections to the server on the given host and port, with login
+  ;; credentials of the given user and password.
+  ([host port user password content-base security-opts]
+   ;; TODO enforce or construct SecurityOptions for security-opts
+   (ContentSourceFactory/newContentSource host port
+                                          user password
+                                          content-base
+                                          security-opts)))
+
+(defn managed-content-source
+  "TODO"
+  [cxn-provider user password content-base]
+  ;; Return a ContentSource object that will use the provided
+  ;; ConnectionProvider instance to obtain server connections, with the
+  ;; given default login credentials and contentbase values.
+  ;; XXX advanced
+  (when-not (instance? ConnectionProvider cxn-provider)
+    (throw (IllegalArgumentException. "Content Source cxn-provider must be a ConnectionProvider")))
+  (ContentSourceFactory/newContentSource cxn-provider
+                                         user password
+                                         content-base))
+
+
+
+
 (defn- create-session*
-  "Creates session, given map of database info."
-  [{:keys [uri user password content-base]}]
-  (let [cs (ContentSourceFactory/newContentSource (URI. uri))]
+  "Creates session, given map of database info. If complex connection
+  options are necessary, pass in a preconfigured content source."
+  [{:keys [uri user password content-base]} & [content-source]]
+  (let [cs (if (instance? ContentSource content-source)
+             content-source
+             (ContentSourceFactory/newContentSource (URI. uri)))]
     (cond
       (and (nil? content-base)
            (or (nil? user)
@@ -257,6 +323,7 @@
            (seq content-base)) (.newSession cs user password content-base))))

 (defn create-session
+  ;; TODO document content-source parameter
   "Create a Session for querying and transacting with. Parameter
   `db-info` describing database connection information must
   include :uri key, and may optionally include connection information
@@ -271,12 +338,23 @@
   https://docs.marklogic.com/javadoc/xcc/com/marklogic/xcc/Session.html
   for valid options. (Note that request options are distinct from
   session options, though *default* request options can be set for the
-  session.)"
+  session.)
+
+  If optional `content-source` is passed, the Session is created from
+  the given ContentSource rather than creating one from the database info URI."
   ([db-info]
    (create-session* db-info))
   ([db-info {:keys [default-request-options logger user-object
                     transaction-mode transaction-timeout]}]
-   (let [session (create-session* db-info)]
+   (create-session db-info
+                   nil
+                   {:default-request-options default-request-options
+                    :logger logger :user-object user-object
+                    :transaction-mode transaction-mode
+                    :transaction-timeout transaction-timeout}))
+  ([db-info content-source {:keys [default-request-options logger user-object
+                                   transaction-mode transaction-timeout]}]
+   (let [session (create-session* db-info content-source)]
      (when (map? default-request-options)
        (.setDefaultRequestOptions session (request-options default-request-options)))
      (when (instance? Logger logger)
@@ -290,12 +368,36 @@
        (.setTransactionTimeout session transaction-timeout))
      session)))

+;; TODO require privilege
+;; (defn session-cb-metadata
+;;   "TODO"
+;;   [session]
+;;   (let [cbmd (.getContentbaseMetaData session)]
+;;     {:session (.getSession cbmd) ;; XXX unnecessary...right?
+;;      :user (.getUser cbmd)
+;;      :cb-id (.getContentBaseId cbmd)
+;;      :cb-name (.getContentBaseName cbmd)
+;;      :driver-major-version (.getDriverMajorVersion cbmd)
+;;      :driver-minor-version (.getDriverMinorVersion cbmd)
+;;      :driver-patch-version (.getDriverPatchVersion cbmd)
+;;      :driver-version (.getDriverVersionString cbmd)
+;;      ;; :server-major-version (.getServerMajorVersion cbmd)
+;;      ;; :server-minor-version (.getServerMinorVersion cbmd)
+;;      ;; :server-patch-version (.getServerPatchVersion cbmd)
+;;      ;; :server-version (.getServerVersionString cbmd)
+;;      ;; :forest-ids (seq (.getForestIds cbmd))
+;;      ;; :forest-maps (.getForestMap cbmd)
+;;      ;; :forest-names (seq (.getForestNames cbmd))
+;;      }
+;;     ))
+
 (defn session-options
   "Returns a map describing all options on the given Session object."
   [session]
   {:default-request-options (.getDefaultRequestOptions session)
    :effective-request-options (.getEffectiveRequestOptions session)
    :logger (.getLogger session)
+   ;; :contentbase-metadata (session-cb-metadata session) TODO
    :xaresource (.getXAResource session)
    :user-object (.getUserObject session)
    :transaction-timeout (.getTransactionTimeout session)


removed obsolete import from views.clj

removed obsolete import from views.clj

--- src/vix/views.clj
+++ src/vix/views.clj
@@ -14,8 +14,7 @@
 ;; limitations under the License.

 (ns vix.views
-  (:require [clojure.zip :as zip]
-            [net.cgrand.enlive-html :as html]
+  (:require [net.cgrand.enlive-html :as html]
             [clj-time.core :as time-core]
             [clj-time.format :as time-format]
             [vix.util :as util]


New endpoint: userlist for atomic-typos

New endpoint: userlist for atomic-typos

--- src/zg/server.clj
+++ src/zg/server.clj
@@ -354,6 +354,7 @@
             "/add-word-to-atomic-typos" (process-add-word     request title emender-page :atomic-typos)
             "/users-whitelist"        (process-user-list     request title :whitelist)
             "/users-blacklist"        (process-user-list     request title :blacklist)
+            "/users-atomic-typos"     (process-user-list     request title :atomic-typos)
             "/user-whitelist"         (process-user-info     request title :whitelist)
             "/user-blacklist"         (process-user-info     request title :blacklist)
             "/all-words/json"         (process-wordlist-json request nil)


[#38] Use concat version that uses lazy-seq

--- priv/clojure/core.clj
+++ priv/clojure/core.clj
@@ -669,7 +669,7 @@
   (throw "unimplemented")
   #_(instance? clojure.lang.IChunkedSeq s))

-#_(defn concat
+(defn concat
     "Returns a lazy seq representing the concatenation of the elements in the supplied colls."
     {:added "1.0"
      :static true}
@@ -690,19 +690,6 @@
                       (when zs
                         (cat (first zs) (next zs)))))))]
        (cat (concat x y) zs))))
-
-(def concat
-  (fn*
-   ([] (list))
-   ([x] (apply list x))
-   ([x y]
-    (if (seq x)
-      (cons (first (seq x)) (concat (rest (seq x)) y))
-      y))
-   ([x y & zs]
-    (if (seq zs)
-      (apply concat (concat x y) (first zs) (next zs))
-      (concat x y)))))

 ;;;;;;;;;;;;;;;;at this point all the support for syntax-quote exists;;;;;;;;;;;;;;;;;;;;;;
 (defmacro delay


fix oligo indexing

fix oligo indexing

--- src/wb_es/datomic/data/oligo.clj
+++ src/wb_es/datomic/data/oligo.clj
@@ -6,7 +6,8 @@

 (deftype Oligo [entity]
   data-util/Document
-  (metadata [this] (assoc (data-util/default-metadata entity) :_type "pcr-oligo"))
+  (metadata [this] (data-util/default-metadata entity))
   (data [this]
-    {:wbid (:oligo/id entity)
+    {:page_type "pcr-oligo"
+     :wbid (:oligo/id entity)
      :label (:oligo/id entity)}))


paper author

paper author

--- src/wb_es/datomic/data/paper.clj
+++ src/wb_es/datomic/data/paper.clj
@@ -6,9 +6,9 @@
   (let [author (:paper.author/author author-holder)
         person (first (:affiliation/person author-holder))]
     (if person
-      (-> (obj/pack-obj person)
+      (-> (data-util/pack-obj person)
           (assoc :label (:author/id author)))
-      (obj/pack-obj author))))
+      (data-util/pack-obj author))))

 (deftype Paper [entity]
   data-util/Document


Added first 'advanced' query

Added first 'advanced' query

--- src/wishlistd/models/queries.clj
+++ src/wishlistd/models/queries.clj
@@ -78,4 +78,8 @@
 ;       ["select last_value+1 as last_value from wishlist_id_seq"]
 ;       (generate-code (:last_value (first (into [] results)))))))

-;; ADVANCED STUFF+;; ADVANCED STUFF
+
+(defn create-wishlist-with-wishes []
+  (let [wishlist (insert-wishlist {:title "Default"})]
+    (assoc wishlist :wishes (get-wishes-for-wishlist wishlist))))


Refactored add-definition to take several definitions

--- closure-rewriter/closure-rewriter.clj
+++ closure-rewriter/closure-rewriter.clj
@@ -13,9 +13,9 @@
      (match state
             (TransformState definitions _) definitions))

-(def add-definition (state definition)
+(def add-definitions (state new-definitions)
      (match state
-            (TransformState definitions counter) (TransformState (Cons definition definitions) counter)))
+            (TransformState definitions counter) (TransformState (concat new-definitions definitions) counter)))

 (def fun-string ()
      (Cons 102 (Cons 117 (Cons 110 Empty))))
@@ -34,7 +34,7 @@

 (def transform-single-anonymous-function (children state)
      (Pair (construct-new-symbol state)
-           (add-definition (inc-counter state) (rewrite-as-definition children state))))
+           (add-definitions (inc-counter state) (Cons (rewrite-as-definition children state) Empty))))

 (def transform-anonymous-functions (ast state)
      (match ast


reformats descriptor.clj (#329)

reformats descriptor.clj (#329)

--- waiter/src/waiter/descriptor.clj
+++ waiter/src/waiter/descriptor.clj
@@ -57,28 +57,28 @@
   [handler request->descriptor-fn start-new-service-fn fallback-state-atom]
   (fn [request]
     (tl/try-let [request-descriptor (request->descriptor-fn request)]
-       (let [{:keys [descriptor latest-descriptor]} request-descriptor
-             fallback-service-id (:service-id descriptor)
-             latest-service-id (:service-id latest-descriptor)
-             handler (middleware/wrap-merge handler {:descriptor descriptor :latest-service-id latest-service-id})]
-         (when (not= latest-service-id fallback-service-id)
-           (counters/inc! (metrics/service-counter latest-service-id "request-counts" "fallback" "source"))
-           (counters/inc! (metrics/service-counter fallback-service-id "request-counts" "fallback" "target"))
-           (when-not (service-exists? @fallback-state-atom latest-service-id)
-             (log/info "starting" latest-service-id "before causing request to fallback to" fallback-service-id)
-             (start-new-service-fn latest-descriptor)))
-         (handler request))
-       (catch Exception e
-         (if (missing-run-as-user? e)
-           (let [{:keys [query-string uri]} request
-                 location (str "/waiter-consent" uri (when (not (str/blank? query-string)) (str "?" query-string)))]
-             (counters/inc! (metrics/waiter-counter "auto-run-as-requester" "redirect"))
-             (meters/mark! (metrics/waiter-meter "auto-run-as-requester" "redirect"))
-             {:headers {"location" location} :status 303})
-           (do
-             ; For consistency with historical data, count errors looking up the descriptor as a "process error"
-             (meters/mark! (metrics/waiter-meter "core" "process-errors"))
-             (utils/exception->response e request)))))))
+      (let [{:keys [descriptor latest-descriptor]} request-descriptor
+            fallback-service-id (:service-id descriptor)
+            latest-service-id (:service-id latest-descriptor)
+            handler (middleware/wrap-merge handler {:descriptor descriptor :latest-service-id latest-service-id})]
+        (when (not= latest-service-id fallback-service-id)
+          (counters/inc! (metrics/service-counter latest-service-id "request-counts" "fallback" "source"))
+          (counters/inc! (metrics/service-counter fallback-service-id "request-counts" "fallback" "target"))
+          (when-not (service-exists? @fallback-state-atom latest-service-id)
+            (log/info "starting" latest-service-id "before causing request to fallback to" fallback-service-id)
+            (start-new-service-fn latest-descriptor)))
+        (handler request))
+      (catch Exception e
+        (if (missing-run-as-user? e)
+          (let [{:keys [query-string uri]} request
+                location (str "/waiter-consent" uri (when (not (str/blank? query-string)) (str "?" query-string)))]
+            (counters/inc! (metrics/waiter-counter "auto-run-as-requester" "redirect"))
+            (meters/mark! (metrics/waiter-meter "auto-run-as-requester" "redirect"))
+            {:headers {"location" location} :status 303})
+          (do
+            ; For consistency with historical data, count errors looking up the descriptor as a "process error"
+            (meters/mark! (metrics/waiter-meter "core" "process-errors"))
+            (utils/exception->response e request)))))))

 (defn fallback-maintainer
   "Long running daemon process that listens for scheduler state updates and triggers changes in the
@@ -202,7 +202,7 @@
     (-> (headers/split-headers (:headers request))
         (sd/merge-service-description-sources kv-store waiter-hostnames service-description-defaults token-defaults)
         (sd/merge-service-description-and-id kv-store service-id-prefix current-request-user metric-group-mappings
-                                          service-description-builder assoc-run-as-user-approved?)
+                                             service-description-builder assoc-run-as-user-approved?)
         (sd/merge-suspended kv-store))))

 (defn descriptor->previous-descriptor


send more info with each event

send more info with each event

--- src-cljs/frontend/analytics.cljs
+++ src-cljs/frontend/analytics.cljs
@@ -1,5 +1,6 @@
 (ns frontend.analytics
   (:require [frontend.analytics.mixpanel :as mixpanel]
+            [frontend.state :as state]
             [frontend.utils :as utils :include-macros true]))

@@ -33,6 +34,10 @@
                           :camera-nudged-down
                           :camera-nudged-up})

-(defn track-control [event]
+(defn track-control [event state]
   (when-not (contains? controls-blacklist event)
-    (mixpanel/track (str event))))
+    (mixpanel/track (str event) (merge
+                                 (dissoc (get-in state state/browser-settings-path) :document-settings)
+                                 (when (:document/id state)
+                                   {:doc-id (:document/id state)
+                                    :subscriber-count (count (:subscribers state))})))))


fix typo in test

fix typo in test

--- test/chat/test/server/search.clj
+++ test/chat/test/server/search.clj
@@ -94,5 +94,5 @@
     (testing "can search by tag name"
       (is (= [thread-1-id thread-2-id]
              (search/search-threads-as (user-1 :id) ["#tag1" group-1-id])))
-      (is (= {thread-2-id}
+      (is (= [thread-2-id]
              (search/search-threads-as (user-1 :id) ["#tag3 world" group-1-id]))))))


Add incompat test

Add incompat test

--- test/dependable/resolve_test.clj
+++ test/dependable/resolve_test.clj
@@ -730,3 +730,17 @@
             :present-packages {"c" package-c}
             :conflicts {"e" [nil]}))))))

+(deftest
+  ^:resolve-basic incompatibility
+  (testing "The wind in the willows"
+    (let [spec #(< (:version %) 5)]
+    (is
+     (= [:incompatible "a" spec]
+    (resolve-dependencies
+     [[(present "a" 5 spec)]]
+     (map-query {})
+     :present-package {"a" (->package
+                            "a"
+                            5
+                            "a_loc5"
+                            nil)}))))))


Refactor Go.cd syncing

Refactor Go.cd syncing

--- scripts/gosync.clj
+++ scripts/gosync.clj
@@ -10,11 +10,14 @@

 (def server-url (second *command-line-args*))

-(defn build-for [pipeline {stage :name id :id}]
-  (let [buildUrl (format "%s/jobStatus.json?pipelineName=%s&stageName=%s&jobId=%s" server-url pipeline stage id)
-        buildResp (client/get buildUrl)
-        build (j/parse-string (:body buildResp))
-        buildInfo (get (first build) "building_info")
+(defn absolute-url [relativeUrl]
+  (clojure.string/join [server-url relativeUrl]))
+
+(defn get-url [relativeUrl]
+  (client/get (absolute-url relativeUrl)))
+
+(defn parse-build-info [jsonResp]
+  (let [buildInfo (get (first jsonResp) "building_info")
         buildStartTime (tc/to-long (tf/parse (get buildInfo "build_building_date")))
         buildEndTime (tc/to-long (tf/parse (get buildInfo "build_completed_date")))
         result (get buildInfo "result")
@@ -23,44 +26,50 @@
      :end buildEndTime
      :outcome outcome}))

-(defn build-info [job]
-  {:name (get job "name")
-   :id (get job "id")})
+(defn build-for [pipeline {{stageName :stageName jobId :jobId} :job}]
+  (let [buildUrl (format "/jobStatus.json?pipelineName=%s&stageName=%s&jobId=%s" pipeline stageName jobId)
+        buildResp (get-url buildUrl)
+        build (j/parse-string (:body buildResp))]
+    (parse-build-info build)))

-(defn builds-for-stage [pipelineName pipelineNo stage]
+(defn job-info [job]
+  {:stageName (get job "name")
+   :jobId (get job "id")})
+
+(defn jobs-for-stage [pipelineName pipelineNo stage]
   (let [jobs (get stage "jobs")
         stageName (get stage "name")]
     (for
         [job jobs
-         :let [jobName (get job "name")
-               build (build-info job)
-               buildName (format "%s %s %s" pipelineName stageName jobName)]]
-      [buildName pipelineNo build])))
+         :let [jobName (get job "name")]]
+      {:fullName (format "%s %s %s" pipelineName stageName jobName)
+       :run pipelineNo
+       :job (job-info job)})))

-(defn builds-for-pipeline [pipelineRun]
+(defn jobs-for-pipeline [pipelineRun]
   (let [stages (get pipelineRun "stages")
         stagesWithJobs (filter #(not (empty? (get % "jobs"))) stages)
         pipelineName (get pipelineRun "name")
         pipelineNo (get pipelineRun "label")]
     (apply concat
-           (map (partial builds-for-stage
+           (map (partial jobs-for-stage
                          pipelineName
                          pipelineNo)
                 stagesWithJobs))))

 (defn history-for [pipeline]
-  (let [historyUrl (format "%s/api/pipelines/%s/history" server-url pipeline)
-        historyResp (client/get historyUrl)
+  (let [historyUrl (format "/api/pipelines/%s/history" pipeline)
+        historyResp (get-url historyUrl)
         history (j/parse-string (:body historyResp))
         pipelineInfos (get history "pipelines")]
-    (apply concat (map builds-for-pipeline pipelineInfos))))
+    (apply concat (map jobs-for-pipeline pipelineInfos))))

 (defn full-history-for [pipeline]
-  (map (fn [[buildName buildNo build]] [buildName buildNo (build-for pipeline build)])
+  (map #(assoc % :build (build-for pipeline %))
        (history-for pipeline)))

 (defn send-to-go [builds]
-  (doseq [[jobName buildNo build] builds]
+  (doseq [{jobName :fullName buildNo :run build :build} builds]
     (println jobName buildNo build)
     (client/put (format "http://localhost:3000/builds/%s/%s" jobName buildNo)
                 {:content-type :json


Minor spelling correction.

Minor spelling correction.

--- test/lambdajam/jobs/test_1_0.clj
+++ test/lambdajam/jobs/test_1_0.clj
@@ -34,7 +34,7 @@
 ;;         v
 ;;    write-segments
 ;;
-;; The representation of a workflow in a Clojure vector of vectors.
+;; The representation of a workflow is a Clojure vector of vectors.
 ;; The inner vectors contain two elements: source, and destination, respectively.

 (def input


Fix doc.

Fix doc.

--- test/lambdajam/jobs/test_5_3.clj
+++ test/lambdajam/jobs/test_5_3.clj
@@ -20,8 +20,8 @@
 ;; Keep in mind that exceptions cannot be serialized. You can transform
 ;; an exception to a new segment and send it to subsequent tasks by using
 ;; the :flow/post-transform key in the flow condition entry. Map this key
-;; to a keyword that represents a function. This function takes two args -
-;; the event map, and the exception object. This function must return a
+;; to a keyword that represents a function. This function takes three args -
+;; the event map, the segment, and the exception object. This function must return a
 ;; new segment.
 ;;
 ;; There is one more caveat. Flow conditions with :flow/thrown-exception?


[#429] Fix flaky server-status tests

[#429] Fix flaky server-status tests

Resolve possible race w/ stop call starting before http/get call.

--- test/org/httpkit/server_test.clj
+++ test/org/httpkit/server_test.clj
@@ -439,9 +439,11 @@
   (let [server (run-server (slow-request-handler 500) {:port 3474 :legacy-return-value? false})
         resp_  (future (try (http/get "http://localhost:3474") (catch Exception e {:status "fail"})))]

+    (deref resp_ 100 nil) ; Ensure http/get has started
+
     (is (= (server-status server) :running))
     (let [f_ (future (server-stop! server {:timeout 1000}))]
-      (Thread/sleep 100)
+      (deref f_ 100 nil) ; Ensure stop call has started
       (is (= (server-status server) :stopping))
       (is (= (deref @f_ 1000 false) true)))


specify that present-tense specifically should be generated

--- src/babel/english/benchmark.cljc
+++ src/babel/english/benchmark.cljc
@@ -54,7 +54,9 @@
   (let [do-this-many (Integer. do-this-many)]
     (benchmark {:modified false
                 :synsem {:cat :verb
-                         :sem {:pred :be-called}}}
+                         :sem {:pred :be-called
+                               :tense :present
+                               :aspect :progressive}}}
                medium
                do-this-many)))


Added handling of value in action command

--- src/clj/funstructor/commands.clj
+++ src/clj/funstructor/commands.clj
@@ -122,8 +122,9 @@
         player-id (gs/player-for-channel (gs/current-global-state) channel)
         card-idx (get-in command [:data :card-idx])
         target (get-in command [:data :target])
+        value (get-in command [:data :value])
         funstr-idx (get-in command [:data :funstruct-idx])]
-    (gs/update-global-state gs/update-game game-id f/use-card player-id card-idx funstr-idx)
+    (gs/update-global-state gs/update-game game-id f/use-card player-id card-idx funstr-idx value)
     (send-game-updates game-id)))

 (defmethod handle-command "end-turn" [command channel]


hellhound.tasks.core improved to contains info/warn/error functions


Fix typo

Fix typo


Adding the ability to load the root level things, too

--- src/com/okl/tokenmgr/handler.clj
+++ src/com/okl/tokenmgr/handler.clj
@@ -59,9 +59,11 @@
            :body {:status "failure" :message (.getMessage e)}}))))
   (GET "/api/tokens/:app" [app]
     (denormalize-tokens (get-tokens (url-decode app))))
+  (GET "/testing/appication" []
+    (dynamic-page "/"))
   (GET "/testing/appication/:app" [app]
-    (dynamic-page app (denormalize-tokens (get-tokens app))))
-  (route/resources "/")
+    (dynamic-page app))
+  (route/resources "")
   (route/not-found "Not Found"))


Make make-completion-item a multimethod

Make make-completion-item a multimethod


Bugfix on large data sets

Bugfix on large data sets

Mongo's map-reduce will reduce a large dataset multiple times, so the
reduce function must be idempotent (in the fn programming sense of the
term)

--- src/cfpb/qu/data/aggregation.clj
+++ src/cfpb/qu/data/aggregation.clj
@@ -16,10 +16,7 @@
                (return (.apply (aget Math "max") nil vals))))
    :avg (js* (fn [ary field]
                (var vals (.map ary (fn [obj] (return (aget obj field)))))
-               (var len (aget ary "length"))
-               (if (= len 0)
-                 (return nil)
-                 (return (/ (.sum Array vals) len)))))
+               (return (.avg Array vals))))
    :median (js* (fn [ary field]
                   (var median (fn [array]
                                 (var array (.sort array))
@@ -44,9 +41,9 @@
      (generate-map-fn group-fields agg-fields identity))
   ([group-fields agg-fields zip-fn]
      (let [create-map-obj (fn [fields]
-                            (reduce (fn [acc field]
-                                      (let [from-field (name (zip-fn field))]
-                                        (merge acc {field (js* (aget this (clj from-field)))})))
+                            (reduce (fn [acc [out-field in-field]]
+                                      (let [from-field (name (zip-fn in-field))]
+                                        (merge acc {out-field (js* (aget this (clj from-field)))})))
                                     {} fields))
            map-id (create-map-obj group-fields)
            map-val (create-map-obj agg-fields)]
@@ -54,10 +51,10 @@

 (defn- generate-reduce-fn
   [aggregations]
-  (let [reduce-obj (reduce (fn [acc [to-field [agg from-field]]]
+  (let [reduce-obj (reduce (fn [acc [out-field [agg in-field]]]
                              (merge acc
-                                    {(name to-field)
-                                     (js* ((aget aggs (clj agg)) values (clj from-field)))}))
+                                    {(name out-field)
+                                     (js* ((aget aggs (clj agg)) values (clj (name out-field))))}))
                            {} aggregations)]
     (js* (fn [key values]
            (var aggs (clj agg-fns))
@@ -90,10 +87,14 @@
                     (convert-keys name))
                 {})
         agg-fields (->> aggregations
-                        (map (comp second second))
-                        (remove nil?))
+                        (map (juxt first (comp second second)))
+                        (remove #(nil? (second %)))
+                        (into {}))

-        map-fn (generate-map-fn group agg-fields field-zip-fn)
+        map-fn (generate-map-fn
+                (zipmap group group)
+                agg-fields
+                field-zip-fn)
         reduce-fn (generate-reduce-fn aggregations)]
     (array-map :mapReduce (name from)
                :map map-fn


remove obsolete assertions from The Supplier test

--- src/clj/test/cards-resources.clj
+++ src/clj/test/cards-resources.clj
@@ -144,10 +144,8 @@
     (play-from-hand state :runner "The Supplier")
     (let [ts (get-in @state [:runner :rig :resource 0])]
       (card-ability state :runner ts 0)
-      (is (= 2 (count (get-in @state [:runner :prompt 0 :choices]))) "Only resources and hardware in The Supplier prompt")
       (prompt-select :runner (find-card "Plascrete Carapace" (:hand (get-runner))))
       (card-ability state :runner ts 0)
-      (is (= 1 (count (get-in @state [:runner :prompt 0 :choices]))))
       (prompt-select :runner (find-card "Utopia Shard" (:hand (get-runner))))
       (is (= 2 (count (:hosted (refresh ts)))) "The Supplier is hosting 2 cards")
       (core/end-turn state :runner nil)


Fixed errors.

Fixed errors.

--- src/cljs/clj_mini_apps/pong.cljs
+++ src/cljs/clj_mini_apps/pong.cljs
@@ -36,7 +36,6 @@
   (let [deg (rand-nth (concat (range 135 225)
                               (range 0 45)
                               (range 315 359)))]
-    (log (str deg \- (apply str (take 4 (str (q/radians deg))))))
     {:player {:x 59 :y 250}
      :cpu    {:x 1040 :y 250}
      :ball   {:x 550 :y 250
@@ -62,12 +61,12 @@
   (let [half-height (/ paddle-height 2)
         cpu-y (:y (:cpu state))]
     (if (> (:y (state :ball)) cpu-y)
-      (if (>= (+ half-height cpu-y) speed) 490)
+      (if (>= (+ half-height cpu-y speed) 490)
               (assoc-in state [:cpu :y] (- 489.5 half-height))
               (update-in state [:cpu :y] + speed))
       (if (<= (- cpu-y half-height speed) 9)
               (assoc-in state [:cpu :y] (+ half-height 8.5))
-              (update-in state [:cpu :y] - speed))))
+              (update-in state [:cpu :y] - speed)))))

 (defn start-game
   [state]


Disentangle the validation of the hyphenation pattern

--- src/cljs/hyphen_keeper/core.cljs
+++ src/cljs/hyphen_keeper/core.cljs
@@ -74,14 +74,33 @@
      :value @val
      :on-change #(reset! val (-> % .-target .-value))}]])

+(defn- hyphenation-valid? [s]
+  (and (not (string/blank? s))
+       (re-find #"\S-\S" s)))
+
 (defn hyphenation-field [val]
-  [:div.form-group
+  [:div
+   {:class (if (or (string/blank? @val)
+                   (hyphenation-valid? @val))
+             "form-group" "form-group has-error")}
    [:label.sr-only {:for "hyphenationInput"} "Hyphenation"]
    [:input.form-control
     {:type "text"
      :placeholder "Hyphenation"
      :value @val
      :on-change #(reset! val (-> % .-target .-value))}]])
+
+(defn- hyphenation-add-button
+  [word hyphenation]
+  [:button.btn.btn-default
+   {:on-click #(when (and @word (hyphenation-valid? @hyphenation))
+                 (add-hyphenation-pattern! {:word @word :hyphenation @hyphenation :spelling @spelling})
+                 (reset! word "")
+                 (reset! hyphenation ""))
+    :disabled (when (or (string/blank? @word)
+                        (not (hyphenation-valid? @hyphenation)))
+                "disabled")}
+   "Add"])

 (defn new-hyphenation []
   (let [word (reagent/atom "")
@@ -90,15 +109,7 @@
       [:div.form-inline
        [word-field word]
        [hyphenation-field hyphenation]
-       [:button.btn.btn-default
-        {:on-click #(when (and @word @hyphenation)
-                      (add-hyphenation-pattern! {:word @word :hyphenation @hyphenation :spelling @spelling})
-                      (reset! word "")
-                      (reset! hyphenation ""))
-         :disabled (when (or (string/blank? @word)
-                             (string/blank? @hyphenation))
-                     "disabled")}
-        "Add"]])))
+       [hyphenation-add-button word hyphenation]])))

 (defn hyphenation-filter [search]
   [:input.form-control


Consume events in event-bus/root> to unblock component branches (mult + tap).

--- src/cljs/idealist/event_bus.cljs
+++ src/cljs/idealist/event_bus.cljs
@@ -45,7 +45,7 @@
                                         (async/close! branch)))
         (async/go-loop []
                        (let [[event ch] (async/alts! [branch (async/timeout 5000)])]
-                         (println (om/id this) "got " event)
+                         #_(println (om/id this) "got " event)
                          (if event
                            (do
                              (got-event c event)
@@ -109,9 +109,15 @@
 (defn root>
   "Use this instead of om.core/root to add support for event bus functionality.

-  The arity 4 version lets you specify the channel if you also want to handle events outside of component hierarchy."
+  The arity 4 version lets you specify the channel if you also want to handle events outside of component hierarchy.
+  IMPORTANT: If you pass your own event bus channel, you **MUST** consume events."
   ([f value options]
-    (root> f value options (async/chan 1)))
+    (let [event-bus (async/chan 1)]
+      (root> f value options event-bus)
+      ;; Consume events to make sure async/mult delivers to all taps.
+      (async/go-loop []
+                     (let [x (<! event-bus)]
+                       (when x (recur))))))
   ([f value options event-bus]
     (om/root f value
              (merge options {:descriptor (make-descriptor {:componentWillMount


Finish quit handler code

Finish quit handler code

--- src/clojure/nightcode/window.clj
+++ src/clojure/nightcode/window.clj
@@ -43,7 +43,8 @@
               (Proxy/newProxyInstance (.getClassLoader quit-class)
                                       (into-array Class [quit-class])
                                       (reify InvocationHandler
-                                        (invoke [this proxy method args]))))))
+                                        (invoke [this proxy method args]
+                                          (confirm-exit-app!)))))))
   ; create and add the listener
   (.addWindowListener window
     (proxy [WindowAdapter] []


Fix words-distance-in-phrase usage.

Fix words-distance-in-phrase usage.

--- src/clucy/positions_searcher.clj
+++ src/clucy/positions_searcher.clj
@@ -213,7 +213,7 @@
                         ;; If phrase is a double word e.g. "green green" -
                         ;; we find the same word
                         (not (>= (-> pp last first) (first tp)))
-                        (<= delta *chars-distance-in-phrase*))))
+                        (<= delta (+ 1 *words-distance-in-phrase*)))))
                    this-position))]
              (if next-pos
                (recur (next pps) (cons (conj pp next-pos) result))


Docstring typo

Docstring typo

--- src/io/aviso/rook/dispatcher.clj
+++ src/io/aviso/rook/dispatcher.clj
@@ -467,7 +467,7 @@
    - emit-fn (eval):

      Called with the output of build-handler-fn. When using
-     build-handler-fns that return Clojure forms, Passing in
+     build-handler-fns that return Clojure forms, passing in
      pprint-code instead of eval is useful for debugging purposes."
   ([dispatch-table]
      (compile-dispatch-table


Added dummy endpoint for echo-rest availability.

--- src/cmr/mock_echo/api/tokens.clj
+++ src/cmr/mock_echo/api/tokens.clj
@@ -11,15 +11,15 @@

 (def token-keys
   #{
-   ;; Fields provided during login
-   :username
-   :client_id
-   :password
-   :user_ip_address
+    ;; Fields provided during login
+    :username
+    :client_id
+    :password
+    :user_ip_address

-   ;; A list of group guids the user belongs to.
-   :group_guids
- })
+    ;; A list of group guids the user belongs to.
+    :group_guids
+    })

 (defn login
   [context body]
@@ -90,5 +90,6 @@
           (ah/status-ok (get-current-sids context token-id)))
         (GET "/token_info" {context :request-context headers :headers }
           (ah/require-sys-admin-token headers)
-          (ah/status-ok (get-token-info context token-id)))))))
-
+          (ah/status-ok (get-token-info context token-id)))))
+    (GET "/availability" {context :request-context}
+      {:status 200})))


[EC] [000000] rm environs from dotenv.core

--- src/com/rentpath/dotenv/core.clj
+++ src/com/rentpath/dotenv/core.clj
@@ -5,10 +5,9 @@
 (ns ^{:author "Jack Morrill"
       :doc "Load environment variable definitions from .env{.environment}, .env.local files into the JVM System Properties."}
       com.rentpath.dotenv.core
-      (:require [clojure.java.io :as io      ]
-                [clojure.string  :as string  ]
-                [com.rentpath.environs.core :as environs :refer :all]
-                [me.raynes.fs    :as fs      ]))
+      (:require [clojure.java.io :as io    ]
+                [clojure.string  :as string]
+                [me.raynes.fs    :as fs    ]))

 (def ^{:doc "An environment variable that specifies which environment we're running in."}
   +dot-env-var+


Update exception and warning nodes to use maps

--- src/adzerk/boot_reload/display.cljs
+++ src/adzerk/boot_reload/display.cljs
@@ -56,23 +56,14 @@
                        :bottom "-100px"]}]
     {:style (apply concat (map s types))}))

-(defn parse-warning [warning]
-  (let [segs           (map string/trim (string/split warning #"at line"))
-        [line-no file] (string/split (second segs) #" " 2)
-        warning        {:warning-txt (first segs)
-                        :line-number line-no
-                        :file        file}]
-    warning))
+(defn exception-node [{:keys [message line file]}]
+  (mk-node :div nil message))

-(defn exception-node [ex]
-  (mk-node :div nil ex))
-
-(defn warning-node [warning]
-  (let [w (parse-warning warning)]
-    (mk-node :div nil
-             [(mk-node :span (style :mr10) (:warning-txt w))
-              (mk-node :span (style :mr10) (str "at line " (:line-number w)))
-              (mk-node :span (style :mr10) (:file w))])))
+(defn warning-node [{:keys [message line file]}]
+  (mk-node :div nil
+           [(mk-node :span (style :mr10) message)
+            (mk-node :span (style :mr10) (str "at line " line))
+            (mk-node :span (style :mr10) file)]))

 (defn warnings-node [warnings]
   (mk-node :div nil (map warning-node warnings)))


Remove completed TODO.

Remove completed TODO.

--- src/afterglow/fixtures/blizzard.clj
+++ src/afterglow/fixtures/blizzard.clj
@@ -223,8 +223,6 @@
   {:channels [(chan/color (+ 2 (* 3 index)) :red) (chan/color (+ 3 (* 3 index)) :green) (chan/color (+ 4 (* 3 index)) :blue)]
    :x (get ws-head-offsets index)})

-;; TODO: Document origin and default hanging orientation
-
 (defn weather-system
   "[Weather
   System](http://www.blizzardlighting.com/index.php?option=com_k2&view=item&layout=item&id=173&Itemid=152)


Pokemon.

Pokemon.


Build ImmutableRangeSet with unionOf

Build ImmutableRangeSet with unionOf

--- src/atom_finder/util/FnRangeSet.clj
+++ src/atom_finder/util/FnRangeSet.clj
@@ -32,13 +32,7 @@
   "Take multiple disjoint ranges and construct a function which
     determines whether a number is included in any of the ranges"
   [range-constructor ranges]; :- [[(s/one s/Int "min") (s/one s/Int "max")]]]
-  ;; First construct a mutable TreeRangeSet which will merge overlapping ranges
-  ;; (this causes an exception in ImmutableRangeSet), and then convert it to
-  ;; an ImmutableRangeSet after all overlapping ranges have been resolved
-  (let [range-set (doto (TreeRangeSet/create) (.addAll (map range-constructor ranges)))]
-    (.build
-     (doto (ImmutableRangeSet/builder)
-       (.addAll range-set)))))
+  (ImmutableRangeSet/unionOf (map range-constructor ranges)))

 (defn range-set-co [ranges] (make-ifn (range-set-constructor (fn [[a b]] (Range/closedOpen a b)) ranges)))
 (defn range-set-cc [ranges] (make-ifn (range-set-constructor (fn [[a b]] (Range/closed a b)) ranges)))


Implementation of REST call jobs_in_queue

--- src/emender_jenkins/rest_api.clj
+++ src/emender_jenkins/rest_api.clj
@@ -447,3 +447,49 @@
         (-> (http-response/response output)
             (http-response/content-type mime-type))))

+(defn get-running-jobs
+    [request]
+)
+
+(defn get-currently-building-jobs
+    [request]
+)
+
+(defn get-job-name-from-queue-info
+    "Read job name from the structure about one item in Jenkins build queue."
+    [job-info]
+    (-> job-info (get "task") (get "name")))
+
+(defn jobs-in-queue-url
+    "Construct URL used to read all jobs that are put into Jenkins build queue."
+    [request]
+    (let [jenkins-url   (config/get-jenkins-url request)
+          job-list-part (config/get-in-queue-url request)]
+          (str jenkins-url job-list-part)))
+
+(defn read-queue-info
+    "Read info about queue via Jenkins REST API."
+    [url]
+    (try
+        (-> (jenkins-api/get-command url)
+            json/read-str
+            (get "items"))
+        (catch Exception e
+            (log/error (.getMessage e))
+            nil)))
+
+(defn get-jobs-in-queue
+    [request]
+    (let [url   (jobs-in-queue-url request)
+          items (read-queue-info url)]
+          (if items
+              (let [job-names (map get-job-name-from-queue-info items)
+                    queue-pos (range 1 (count items))
+                    output
+                    (for [[q-pos job-name] (zipmap queue-pos job-names)]
+                       {"queuePos" q-pos
+                        "jobName"  job-name})]
+                        (send-response output request))
+              (-> (create-bad-request-response "jobs_in_queue" "Can not read Jenkins queue")
+                  (send-error-response request :internal-server-error)))))
+


refactored get thread data

refactored get thread data

--- src/bonews_rest/scraper/threads.clj
+++ src/bonews_rest/scraper/threads.clj
@@ -54,11 +54,11 @@

 (defn get-reply-post-time
   [cols]
-  (-> cols
-      last
-      (:content)
-      first
-      (t/local-date-time custom-formatter)))
+  @(->  cols
+        last
+        (:content)
+        first
+        (t/local-date-time custom-formatter)))

 (defn get-thread-id
   [reply-url]
@@ -67,82 +67,71 @@
       second
       (Integer/parseInt)))

-(defn get-reply-ids
+(defn consolidate-users
+  [user bulbs]
+  (if (some? (:users bulbs))
+    (into `(~user) (:users bulbs))
+    `(~user)))
+
+(defn get-data-helper
   [rows]
   (for [row rows
-    :let [cols        (utils/get-cols  row)
-          reply-url   (get-reply-url   cols)
-          replies     (get-reply-id    reply-url)]]
-    replies))
-
-(defn get-thread-data
-  [rows thread-id]
-  {
-    :id       thread-id
-    :replies  (get-reply-ids rows)
-  }
-)
-
-(defn get-replies-data
-  [rows]
-  (for [row rows
-    :let [cols       (utils/get-cols      row)
-          reply-url  (get-reply-url       cols)
-          user-url   (utils/get-user-url  cols)]]
-    {
-      :id         (get-reply-id          reply-url)
-      :title      (get-reply-title       cols)
-      ; :body       (br/get-reply-data    reply-url)
-      :bulbs      (bulbs/get-data        reply-url)
-      :url        reply-url
-      :post-time  @(get-reply-post-time  cols)
-      :user       (utils/get-user-id     user-url)
-    }))
-
-(defn get-users-data
-  [rows]
-  (for [row rows
-    :let [cols       (utils/get-cols      row)
-          reply-url  (get-reply-url       cols)
-          user-url   (utils/get-user-url  cols)]]
-    {
-      :id    (utils/get-user-id   user-url)
-      :name  (utils/get-username  cols)
-      :url   user-url
-    }))
+    :let [cols         (utils/get-cols        row)
+          reply-url    (get-reply-url         cols)
+          reply-id     (get-reply-id          reply-url)
+          reply-title  (get-reply-title       cols)
+          post-time    (get-reply-post-time   cols)
+          bulbs        (bulbs/get-data        reply-url)
+          user-url     (utils/get-user-url    cols)
+          user-id      (utils/get-user-id     user-url)
+          username     (utils/get-username    cols)
+          reply        {
+            :id         reply-id
+            :title      reply-title
+            :url        reply-url
+            :post-time  post-time
+            :user       user-id
+          }
+          user         {
+            :id         user-id
+            :name       username
+            :url        user-url
+          }
+          users        (consolidate-users user bulbs)]]
+    [reply users]))

 (defn collate-users
-  [rows replies]
-  (-> (for [reply replies
-        :let [users (:users (:bulbs reply))]
-        :when (contains? (:bulbs reply) :users)]
-        users)
-      (conj (get-users-data rows))
-      flatten
-      distinct))
-
-(defn get-data-by-ids
-  [subforum-id thread-id]
-  (let [url    (get-thread-url     subforum-id thread-id)
-        table  (get-replies-table  url)
-        rows   (utils/get-rows     table)]
-    {
-      :thread   (get-thread-data   rows thread-id)
-      :replies  (get-replies-data  rows)
-      :users    (get-users-data    rows)
-    }))
+  [tdata]
+  (distinct (reduce into '() (map second tdata))))

 (defn get-data-by-url
   [url]
-  (let [table       (get-replies-table  url)
-        rows        (utils/get-rows     table)
-        thread-id   (get-thread-id      url)
-        replies     (get-replies-data   rows)]
+  (let [table      (get-replies-table  url)
+        rows       (utils/get-rows     table)
+        thread-id  (get-thread-id      url)
+        tdata      (get-data-helper    rows)
+        replies    (map first          tdata)
+        users      (collate-users      tdata)]
+        ; users      (map last           tdata)]
     {
-      :thread   (get-thread-data   rows thread-id)
-      :replies  replies
-      :users    (collate-users     rows replies)
+      :thread {
+        :id       thread-id
+        :replies  (map :id replies)
+      }
+      :replies replies
+      :users   users
     }))
+
+; (defn get-data-by-ids
+;   [subforum-id thread-id]
+;   (let [url    (get-thread-url     subforum-id thread-id)
+;         table  (get-replies-table  url)
+;         rows   (utils/get-rows     table)]
+;     {
+;       :thread   (get-thread-data   rows thread-id)
+;       :replies  (get-replies-data  rows)
+;       :users    (get-users-data    rows)
+;     }))

 (defn rm-users-from-bulb
   [reply]
@@ -160,6 +149,8 @@

 (defn get-data
   ([url]
-    (clean-data (get-data-by-url url)))
+    ; (clean-data (get-data-by-url url)))
+    (get-data-by-url url))
   ([subforum-id thread-id]
-    (get-data-by-ids subforum-id thread-id)))+    nil))
+    ; (get-data-by-ids subforum-id thread-id)))


replaced broken update-in function

replaced broken update-in function

--- src/cljs/netrunner/cardbrowser.cljs
+++ src/cljs/netrunner/cardbrowser.cljs
@@ -81,7 +81,8 @@
   (let [$cardlist (js/$ ".card-list")
         height (- (.prop $cardlist "scrollHeight") (.innerHeight $cardlist))]
     (when (> (.scrollTop $cardlist) (- height 600))
-      (om/update-state! owner :page inc))))
+      ;; (om/update-state! owner :page inc)
+      (om/set-state! owner :page (inc (om/get-state owner :page))))))

 (defn card-browser [cursor owner]
   (reify


revoked or expired badge

revoked or expired badge

--- src/cljs/salava/badge/ui/modal.cljs
+++ src/cljs/salava/badge/ui/modal.cljs
@@ -145,17 +145,22 @@
 (defn badge-content [state]
   (let [{:keys [id badge_id  owner? visibility show_evidence rating issuer_image issued_on expires_on revoked issuer_content_id issuer_content_name issuer_content_url issuer_contact issuer_description first_name last_name description criteria_url criteria_content user-logged-in? congratulated? congratulations view_count evidence_url issued_by_obf verified_by_obf obf_url recipient_count assertion creator_content_id creator_name creator_image creator_url creator_email creator_description  qr_code owner message_count issuer-endorsements content endorsement_count endorsements]} @state
         expired? (bh/badge-expired? expires_on)
+        revoked (pos? revoked)
         show-recipient-name-atom (cursor state [:show_recipient_name])
         selected-language (cursor state [:content-language])
         {:keys [name description tags alignment criteria_content image_file image_file issuer_content_id issuer_content_name issuer_content_url issuer_contact issuer_image issuer_description criteria_url  creator_name creator_url creator_email creator_image creator_description message_count endorsement_count]} (content-setter @selected-language content)]
     [:div {:id "badge-info" :class "row flip"}
      [:div {:class "col-md-3"}
       [:div.badge-image
-      [:img {:src (str "/" image_file)}]]
+       [:img {:src (str "/" image_file)}]]
       [below-image-block state endorsement_count]]
      [:div {:class "col-md-9 badge-info view-tab"}
       [:div.row
        [:div {:class "col-md-12"}
+        (if revoked
+          [:div.revoked (t :badge/Revoked)])
+        (if expired?
+          [:div.expired [:label (t :badge/Expiredon) ": "] (date-from-unix-time (* 1000 expires_on))])
         [:h1.uppercase-header name]
         (if (< 1 (count (:content @state)))
           [:div.inline [:label (t :core/Languages)": "](content-language-selector selected-language (:content @state))])


Remove debug log message

Remove debug log message

--- src/cljs/salava/core/ui/helper.cljs
+++ src/cljs/salava/core/ui/helper.cljs
@@ -9,7 +9,7 @@
   (let [fun (fn [p]
               (try
                 (apply aget (concat [js/window "salava"] (str/split (h/plugin-str p) #"/") ["ui" nspace name]))
-                (catch js/Object _ (h/dump [p _]))))]
+                (catch js/Object _)))]
     (->> plugins
          (map fun)
          (filter #(not (nil? %))))))


simplify score spec

simplify score spec

--- src/cljs/triboard/logic/scores.cljs
+++ src/cljs/triboard/logic/scores.cljs
@@ -1,7 +1,6 @@
 (ns triboard.logic.scores
   (:require
     [cljs.spec :as s :include-macros true]
-    [cljs.spec.impl.gen :as gen]
     [triboard.logic.constants :as cst]
     [triboard.logic.move :as move]
     ))
@@ -12,15 +11,11 @@
 ;; -----------------------------------------

 (s/def ::pos-int (s/and integer? #(<= 0 %)))
-(s/def ::blue ::pos-int)
-(s/def ::red ::pos-int)
-(s/def ::green ::pos-int)
-(s/def ::scores (s/keys :req-un [::blue ::red ::green]))
+(s/def ::scores (s/map-of ::cst/player ::pos-int))

 (s/fdef update-scores
   :args (s/tuple ::scores ::move/conversion)
-  ;; :ret ::scores ;;TODO - There could be violation without more constraints on inputs
-  )
+  :ret (s/map-of ::cst/player integer?))                    ;; Hard to ensure more

 (def initial-scores
   {:blue cst/init-block-count
@@ -30,9 +25,8 @@
 (defn update-scores
   "Update the scoring based on the provided move"
   [scores move]
-  {:pre [(move/conversion? move)]}
   (let [delta (count (:taken move))]
     (-> scores
       (update (:winner move) + delta)
       (update (:looser move) - delta)
-      )))
+      (dissoc :empty))))


Bumps version to 1.56.3-SNAPSHOT

Bumps version to 1.56.3-SNAPSHOT

--- scheduler/project.clj
+++ scheduler/project.clj
@@ -13,7 +13,7 @@
 ;; See the License for the specific language governing permissions and
 ;; limitations under the License.
 ;;
-(defproject cook "1.56.2"
+(defproject cook "1.56.3-SNAPSHOT"
   :description "This launches jobs on a Mesos cluster with fair sharing and preemption"
   :license {:name "Apache License, Version 2.0"}
   :dependencies [[org.clojure/clojure "1.8.0"]


Snapshot version

Snapshot version

--- scheduler/project.clj
+++ scheduler/project.clj
@@ -13,7 +13,7 @@
 ;; See the License for the specific language governing permissions and
 ;; limitations under the License.
 ;;
-(defproject cook "1.29.0"
+(defproject cook "1.29.1-SNAPSHOT"
   :description "This launches jobs on a Mesos cluster with fair sharing and preemption"
   :license {:name "Apache License, Version 2.0"}
   :dependencies [[org.clojure/clojure "1.8.0"]


Bumps version to 1.38.1-SNAPSHOT

Bumps version to 1.38.1-SNAPSHOT

--- scheduler/project.clj
+++ scheduler/project.clj
@@ -13,7 +13,7 @@
 ;; See the License for the specific language governing permissions and
 ;; limitations under the License.
 ;;
-(defproject cook "1.38.0"
+(defproject cook "1.38.1-SNAPSHOT"
   :description "This launches jobs on a Mesos cluster with fair sharing and preemption"
   :license {:name "Apache License, Version 2.0"}
   :dependencies [[org.clojure/clojure "1.8.0"]


Update inline docs for catalog parsing

Update inline docs for catalog parsing

Slight reformatting of content; the marginalia docs talk about code-related
constructs, and we link to the spec when we're discussing wire-format
constructs.

Signed-off-by: Deepak Giridharagopal <d11186354d1ef01ca06ae37d7e23e827da13e85f@puppetlabs.com>

--- src/com/puppetlabs/cmdb/catalog.clj
+++ src/com/puppetlabs/cmdb/catalog.clj
@@ -1,10 +1,16 @@
 ;; ## Puppet catalog parsing
 ;;
-;; Puppet catalogs aren't really pre-configured for easy persistence
-;; and manipulation; while they contain complete records of all
-;; resources and edges, and most things are properly encoded as lists
-;; or maps, there are still a number of places where structure is
-;; absent or lacking:
+;; Functions that handle conversion of catalogs from wire format to
+;; internal Grayskull format.
+;;
+;; The wire format is described in detail in [the
+;; spec](../spec/catalog-wire-format.md).
+;;
+;; There are a number of transformations we apply to wire format
+;; catalogs during conversion to our internal format; while wire
+;; format catalogs contain complete records of all resources and
+;; edges, and most things are properly encoded as lists or maps, there
+;; are still a number of places where structure is absent or lacking:
 ;;
 ;; 1. Resource specifiers are represented as opaque strings, like
 ;;    `Class[Foobar]`, as opposed to something like
@@ -17,14 +23,15 @@
 ;;    operations that need to correlate against specific resources
 ;;    unneccesarily difficult
 ;;
-;; The functions in this namespace are designed to take a wire-format
-;; catalog and restructure it to fix the above problems and, in
-;; general, make catalogs more easily manipulatable by Clojure code.
+;; 4. Keys to all maps are strings (to conform with JSON), instead of
+;;    more convenient Clojure keywords
 ;;
 ;; ### Terminology
 ;;
-;; There are a few catalog-specific terms that we use throughout the
-;; codebase:
+;; Unless otherwise indicated, all terminology for catalog components
+;; matches terms listed in [the spec](../spec/catalog-wire-format.md).
+;;
+;; ### Transformed constructs
 ;;
 ;; ### Resource Specifier (resource-spec)
 ;;
@@ -48,10 +55,10 @@
 ;; * `:type` and `:title` are used to produce a `resource-spec` for
 ;;   this resource
 ;;
-;; ### Dependency Specification
-;;
-;; A representation of an "edge" in the catalog. All edges have the
-;; following form:
+;; ### Edge
+;;
+;; A representation of an "edge" (dependency or containment) in the
+;; catalog. All edges have the following form:
 ;;
 ;;     {:source       <resource spec>
 ;;      :target       <resource spec>
@@ -65,7 +72,7 @@
 ;; * `:before`
 ;; * `:subscription-of`
 ;;
-;; ### CMDB catalog
+;; ### Catalog
 ;;
 ;; A wire-format-neutral representation of a Puppet catalog. It is a
 ;; map with the following structure:


recursive definition for email address

recursive definition for email address

--- src/pc/email.clj
+++ src/pc/email.clj
@@ -20,7 +20,7 @@
   ([local-part]
    (format "%s@%s" local-part (profile/prod-domain)))
   ([fancy-name local-part]
-   (format "%s <%s@%s>" fancy-name local-part (profile/prod-domain))))
+   (format "%s <%s>" fancy-name (email-address local-part))))

 (defn emails-to-send [db eid]
   (set (map first


Add image files to copy parser.

Add image files to copy parser.

--- src/incise/parsers/impl/copy.clj
+++ src/incise/parsers/impl/copy.clj
@@ -16,4 +16,4 @@
       (copy input-file output-file)
       [output-file])))

-(pc/register [:copy :cname] parse)
+(pc/register [:copy :cname :jpeg :jpg :png] parse)


Remove non-useful comment

Remove non-useful comment

--- src/io/aviso/rook/dispatcher.clj
+++ src/io/aviso/rook/dispatcher.clj
@@ -20,9 +20,6 @@

    - such compound dispatch tables can be compiled using
      [[compile-dispatch-table]].
-
-  compile-dispatch-table takes several options; these are all
-  described in its docstring.

   The individual _resource handler functions_ (functions defined by a namespace
   and either conforming to the naming convention, or defining :route-spec metadata)


Remove unnecessary hook file.

Remove unnecessary hook file.

This was only used in 1.x, and we're dropping compatibility.

--- src/leiningen/hooks/difftest.clj
+++ src/leiningen/hooks/difftest.clj
@@ -1,21 +0,0 @@
-;; Copyright (c) Brenton Ashworth. All rights reserved.
-;; The use and distribution terms for this software are covered by the
-;; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
-;; which can be found in the file COPYING at the root of this distribution.
-;; By using this software in any fashion, you are agreeing to be bound by
-;; the terms of this license.
-;; You must not remove this notice, or any other, from this software.
-
-(ns leiningen.hooks.difftest
-  (:require leiningen.test)
-  (:use robert.hooke))
-
-(defn difftest-test-package-hook
-  "Ensure that form-for-testing-namespaces always uses 'difftest.core as the
-   test package."
-  [f & args]
-  `(do (require '~'difftest.core)
-       ~(apply f args)))
-
-(add-hook #'leiningen.test/form-for-testing-namespaces
-          difftest-test-package-hook)


Prefetch images for app that stars remotely

--- src/flatgui/samples/forms/image.clj
+++ src/flatgui/samples/forms/image.clj
@@ -13,8 +13,12 @@

 (def imagepanel (flatgui.app/defroot iw/root-panel))

+(def icon "http://flatgui.org/resources/icon.png")
+(def smile "http://flatgui.org/resources/smile_32x32.png")
+
 (def imagepanelweb
   (->
-    (assoc-in imagepanel [:children :hello :children :img-holder :regular-image-url] "http://flatgui.org/resources/icon.png")
-    (assoc-in [:children :hello :children :img-holder :image-url] "http://flatgui.org/resources/icon.png")
-    (assoc-in [:children :hello :children :img-holder :pressed-image-url] "http://flatgui.org/resources/smile_32x32.png")))+    (assoc-in imagepanel [:children :hello :children :img-holder :regular-image-url] icon)
+    (assoc-in [:children :hello :children :img-holder :image-url] icon)
+    (assoc-in [:children :hello :children :img-holder :pressed-image-url] smile)
+    (assoc-in [:children :hello :children :img-holder :_prefetch-res-uri-list] (list icon smile))))


moving to amazonica

moving to amazonica

--- src/aws/common.clj
+++ src/aws/common.clj
@@ -12,7 +12,7 @@
 (ns aws.common
   "Common functionality like connection settings"
   (:require
-    [aws.sdk.ec2 :as ec2]
+    [amazonica.aws.ec2 :as ec2]
     [celestial.model :refer (hypervisor)]
     ))

@@ -24,7 +24,8 @@
   `(~f (assoc (creds) :endpoint ~'endpoint) ~@args))

 (defn instance-desc [endpoint instance-id & ks]
-  (-> (with-ctx ec2/describe-instances (ec2/instance-id-filter instance-id))
+  (->
+    (with-ctx ec2/describe-instances {:instance-ids  [instance-id]})
       first :instances first (get-in ks)))

 (defn image-id [machine]


Update Clojure 1.7 test profile to 1.7.0-beta2

--- project.clj
+++ project.clj
@@ -18,4 +18,4 @@
                         [criterium "0.4.3"]
                         [javax.servlet/servlet-api "2.5"]]}
    :1.6 {:dependencies [[org.clojure/clojure "1.6.0"]]}
-   :1.7 {:dependencies [[org.clojure/clojure "1.7.0-alpha6"]]}})
+   :1.7 {:dependencies [[org.clojure/clojure "1.7.0-beta2"]]}})


Update version for 4.4.1 release

Update version for 4.4.1 release

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(def pdb-version "4.4.1-SNAPSHOT")
+(def pdb-version "4.4.1")
 (def puppetserver-version "2.7.2")
 (def clj-parent-version "0.6.0")


added lein-heira and criterium dependencies, for stress testing before release

--- project.clj
+++ project.clj
@@ -13,5 +13,11 @@
   :deploy-repositories [["releases" :clojars]
                         ["snapshots" :clojars]
                         ]
-  :profiles {:dev {:dependencies [[midje "1.8.3"]]
-                                  }})
+  :profiles {:dev {:dependencies [[midje "1.8.3"]]}}
+  :hiera  {:path "target/ns-hierarchy.png"
+           :vertical false
+           :show-external true
+           :cluster-depth 2
+           :trim-ns-prefix true
+           :ignore-ns #{}}
+           )


Version 0.18.1-SNAPSHOT

Version 0.18.1-SNAPSHOT

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject clojars-web "0.18.0"
+(defproject clojars-web "0.18.1-SNAPSHOT"
   :dependencies [[org.clojure/clojure "1.6.0"]
                  [org.clojure/tools.cli "0.2.1"]
                  [yeller-clojure-client "1.2.1"]


Update dependencies and exclusions.

Update dependencies and exclusions.

--- project.clj
+++ project.clj
@@ -18,13 +18,11 @@
   :dependencies [[org.clojure/clojure "1.5.1"]

                  ;; Routing library for Ring web application library
-                 [ring/ring-jetty-adapter "1.1.8"]
-                 ;; [TODO] Upgrade to compojure 1.1.6, to try to remove these exclusions:
-                 ;;   both needed because degel-clojure-utils uses midje 1.4.0 which uses newer
-                 [compojure "1.1.5" :exclusions [ring/ring-core org.clojure/tools.macro]]
-                 [shoreleave/shoreleave-remote-ring "0.3.0"]
-                 [shoreleave/shoreleave-remote "0.3.0"]
+                 [ring/ring-jetty-adapter "1.2.1" :exclusions [org.clojure/tools.reader]]

+                 [compojure "1.1.6" :exclusions [org.clojure/tools.macro org.clojure/tools.reader]]
+                 [shoreleave/shoreleave-remote-ring "0.3.0" :exclusions [org.clojure/tools.reader]]
+                 [shoreleave/shoreleave-remote "0.3.0" :exclusions [org.clojure/tools.reader]]

                  ;; HTML generation
                  [hiccup "1.0.4"]


new version

new version

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject day8.re-frame/http-fx "0.0.2"
+(defproject day8.re-frame/http-fx "0.0.3-SNAPSHOT"
   :description  "A re-frame effects handler for performing Ajax tasks"
   :url          "https://github.com/Day8/re-frame-http-fx.git"
   :license      {:name "MIT"}


Update dependencies

Update dependencies

--- project.clj
+++ project.clj
@@ -7,8 +7,8 @@
   :source-paths ["src/clj" "src/cljs"]

   :dependencies [[org.clojure/clojure "1.6.0"]
-                 [org.clojure/clojurescript "0.0-3123" :scope "provided"]
-                 [cljsjs/react "0.13.0-0"]
+                 [org.clojure/clojurescript "0.0-3126" :scope "provided"]
+                 [cljsjs/react "0.13.1-0"]
                  [ring "1.3.2"]
                  [ring/ring-defaults "0.1.4"]
                  [reagent "0.5.0"]


Project.clj hk

Project.clj hk

--- project.clj
+++ project.clj
@@ -45,12 +45,5 @@
    "deploy-lib" ["do" "deploy" "clojars," "install"]
    "start-dev"  ["with-profile" "+server-jvm" "repl" ":headless"]}

-  :repositories
-  {"sonatype"
-   {:url "http://oss.sonatype.org/content/repositories/releases"
-    :snapshots false
-    :releases {:checksum :fail}}
-   "sonatype-snapshots"
-   {:url "http://oss.sonatype.org/content/repositories/snapshots"
-    :snapshots true
-    :releases {:checksum :fail :update :always}}})
+  :repositories {"sonatype-oss-public"
+                 "https://oss.sonatype.org/content/groups/public/"})


Again typo in project.clj

Again typo in project.clj

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(efproject loudmoauth "0.1.2"
+(defproject loudmoauth "0.1.2"
   :description "A single user multi provider oauth2 client library."
   :url "http://github.com/blmstrm/loudmoauth"
   :license {:name "The MIT License (MIT)"


Bump version for development.

Bump version for development.

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject org.toomuchcode/clara-rules "0.13.0-RC1"
+(defproject org.toomuchcode/clara-rules "0.13.0-SNAPSHOT"
   :description "Clara Rules Engine"
   :url "https://github.com/rbrush/clara-rules"
   :license {:name "Eclipse Public License"


Indentation

Indentation

--- project.clj
+++ project.clj
@@ -5,5 +5,4 @@
             :url "http://www.eclipse.org/legal/epl-v10.html"}
   :dependencies [[org.clojure/clojure "1.8.0"]
                  [clj-kdtree "1.2.0" :exclusions [org.clojure/clojure]]
-                 [info.debatty/java-lsh "0.9"]
-                 ])
+                 [info.debatty/java-lsh "0.9"]])


upgrade 0.1.9.1

upgrade 0.1.9.1

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject tamaki "0.1.9.1-SNAPSHOT"
+(defproject tamaki "0.1.9.1"
   :description "Tamaki, a static site generator"
   :url "https://github.com/satokazuma/tamaki"
   :license {:name "The MIT License"


Revert 83e6ecd578dbce94087dbec071ffe54eed8f3b87 by adding back :plugins. #fhmp

--- project.clj
+++ project.clj
@@ -9,6 +9,8 @@
   :jvm-opts ["-XX:MaxPermSize=128M"
              "-XX:+UseConcMarkSweepGC"
              "-Xms1024M" "-Xmx1048M" "-server"]
+  :plugins [[lein-midje "1.0.8"]
+            [swank-clojure "1.4.0-SNAPSHOT"]]
   :dependencies [[org.clojure/clojure "1.4.0"]
                  [org.clojure/tools.cli "0.1.0"]
                  [org.clojure/tools.logging "0.2.3"]


Update dependencies

Update dependencies

--- project.clj
+++ project.clj
@@ -5,17 +5,17 @@
             :url  "https://opensource.org/licenses/MIT"}

   :dependencies [[org.clojure/clojure "1.9.0"]
-                 [org.clojure/clojurescript "1.10.339"]
+                 [org.clojure/clojurescript "1.10.439"]
                  [org.clojure/data.generators "0.1.2"]
                  [org.clojure/core.async "0.4.474"]
                  [com.stuartsierra/component "0.3.2"]
                  [aleph "0.4.6"]
-                 [ring "1.7.0"]
+                 [ring "1.7.1"]
                  [ragtime "0.7.2"]
                  [ring/ring-defaults "0.3.2"]
                  [bk/ring-gzip "0.3.0"]
                  [ring.middleware.logger "0.5.0"]
-                 [prone "1.6.0"]
+                 [prone "1.6.1"]
                  [compojure "1.6.1"]
                  [metosin/compojure-api "1.1.12"]
                  [prismatic/schema "1.1.9"]
@@ -24,8 +24,8 @@
                  [org.postgresql/postgresql "42.2.5"]
                  [environ "1.1.0"]
                  [hiccup "1.0.5"]
-                 [cheshire "5.8.0"]
-                 [funcool/cats "2.2.0"]
+                 [cheshire "5.8.1"]
+                 [funcool/cats "2.3.1"]
                  [ns-tracker "0.3.1"]
                  [bidi "2.1.4"]
                  [garden "1.3.6"]
@@ -96,15 +96,15 @@
   :doo {:build "test"}

   :profiles {:dev
-             {:dependencies [[figwheel "0.5.16"]
-                             [figwheel-sidecar "0.5.16"]
+             {:dependencies [[figwheel "0.5.17"]
+                             [figwheel-sidecar "0.5.17"]
                              [com.cemerick/piggieback "0.2.2"]
                              [org.clojure/tools.nrepl "0.2.13"]
                              [ring/ring-mock "0.3.2"]
-                             [midje "1.9.2"]]
+                             [midje "1.9.4"]]

               :plugins      [[lein-garden "0.2.8"]
-                             [lein-figwheel "0.5.16"]
+                             [lein-figwheel "0.5.17"]
                              [lein-doo "0.1.10"]
                              [lein-midje "3.2.1"]
                              [lein-auto "0.1.3"]]


(SERVER-1215) Fix inconsistent logback versions

When we introduced the dependency on logstash-logback-encoder,
we accidentally started bringing in a newer version of some
logback artifacts than those that are brought in by tk and tk-j9.

This commit temporarily makes all of the logback dependency
versions explicit in the puppet server project, so that we can
get a quick bugfix release out.

Longer term we probably want to move all of these to TK directly,
since that is the repo that really handles all of our logging
logic.

--- project.clj
+++ project.clj
@@ -22,6 +22,16 @@
                  [com.fasterxml.jackson.core/jackson-core "2.5.4"]
                  [org.clojure/tools.reader "1.0.0-alpha1"]
                  ;; end version conflict resolution dependencies
+
+                 ;; This is a temporary hack to work around
+                 ;; https://tickets.puppetlabs.com/browse/SERVER-1215
+                 ;; these lines should be removed once we have
+                 ;; a better fix in place
+                 [ch.qos.logback/logback-classic "1.1.3"]
+                 [ch.qos.logback/logback-access "1.1.3"]
+                 [ch.qos.logback/logback-core "1.1.3"]
+                 [org.slf4j/slf4j-api "1.7.13"]
+                 ;; end SERVER-1215 hack

                  [cheshire "5.3.1"]
                  [slingshot "0.10.3"]


update deps

update deps

--- project.clj
+++ project.clj
@@ -3,7 +3,7 @@
   :url "https://github.com/minhtuannguyen/cljocker"
   :license {:name "Eclipse Public License"
             :url  "http://www.eclipse.org/legal/epl-v10.html"}
-  :dependencies [[org.clojure/clojure "1.8.0"]]
+  :dependencies [[org.clojure/clojure "1.9.0"]]
   :target-path "target/%s"
   :test-selectors {:default (constantly true)
                    :unit    :unit
@@ -12,8 +12,8 @@
   :aliases {"test-refresh" ["do" ["cljfmt" "fix"] "test-refresh"]}
   :profiles {:uberjar {:aot :all}
              :test    {:resource-paths ["test-resources"]}
-             :dev     {:dependencies [[pjstadig/humane-test-output "0.8.0"]]
-                       :plugins      [[lein-cljfmt "0.5.3"]
-                                      [lein-cloverage "1.0.6"]
-                                      [jonase/eastwood "0.2.3"]
-                                      [lein-kibit "0.1.2"]]}})+             :dev     {:dependencies [[pjstadig/humane-test-output "0.8.3"]]
+                       :plugins      [[lein-cljfmt "0.5.7"]
+                                      [lein-cloverage "1.0.10"]
+                                      [jonase/eastwood "0.2.5"]
+                                      [lein-kibit "0.1.6"]]}})


Update dependencies.

Update dependencies.

--- project.clj
+++ project.clj
@@ -9,7 +9,7 @@
                  [org.clojure/data.json "0.2.6"]
                  [org.clojure/math.numeric-tower "0.0.4"]
                  [org.clojure/tools.nrepl "0.2.10"]
-                 [org.clojure/tools.cli "0.3.1"]
+                 [org.clojure/tools.cli "0.3.2"]
                  [cider/cider-nrepl "0.9.1"]
                  [java3d/vecmath "1.3.1"]
                  [java3d/j3d-core "1.3.1"]


Release version 0.7.3-beta8.

Release version 0.7.3-beta8.

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject org.onyxplatform/onyx-datomic "0.7.3-SNAPSHOT"
+(defproject org.onyxplatform/onyx-datomic "0.7.3-beta8"
   :description "Onyx plugin for Datomic"
   :url "https://github.com/MichaelDrogalis/onyx-datomic"
   :license {:name "Eclipse Public License"


move core.async to dev-deps (only used for cljs yet)

--- project.clj
+++ project.clj
@@ -14,7 +14,6 @@
                                               com.sun.jdmk/jmxtools
                                               com.sun.jmx/jmxri]]
                  [hiccup "1.0.4"]
-                 [org.clojure/core.async "0.1.0-SNAPSHOT"]
                  [org.clojure/math.combinatorics "0.0.4"]
                  [jayq "2.4.0"] ; advanced compiling: https://github.com/ibdknox/jayq#compiling
                  ]
@@ -51,7 +50,8 @@

              :dev {:ring {:stacktraces? true}
                    :source-paths ["dev"]
-                   :dependencies [[org.clojure/tools.namespace "0.2.4"]
+                   :dependencies [[org.clojure/core.async "0.1.0-SNAPSHOT"]
+                                  [org.clojure/tools.namespace "0.2.4"]
                                   [org.clojure/java.classpath "0.2.1"]
                                   [ring-mock "0.1.5"]
                                   [ring/ring-devel "1.2.0"]


Fix wrong dates in revision history :wrench:

--- src/metabase/models/revision.clj
+++ src/metabase/models/revision.clj
@@ -60,11 +60,14 @@

 (i/defentity Revision :revision)

+(defn- pre-insert [revision]
+  (assoc revision :timestamp (u/new-sql-timestamp)))
+
 (u/strict-extend (class Revision)
   i/IEntity
   (merge i/IEntityDefaults
          {:types      (constantly {:object :json, :message :clob})
-          :pre-insert (u/rpartial assoc :timestamp (u/new-sql-timestamp))
+          :pre-insert pre-insert
           :pre-update (fn [& _] (throw (Exception. "You cannot update a Revision!")))}))


add :devlog to support lein migae run task

--- src/leiningen/new/migae/project.clj
+++ src/leiningen/new/migae/project.clj
@@ -6,6 +6,7 @@
   :url "{{proj-url}}"

   :migae {:sdk "{{sdk}}"
+          :devlog "devserver.log" ;; for 'lein migae run' stdout/stderr
           :id "{{gae-app-id}}"
           ;; GAE version ID
           ;; using '-' prefix on version nbr forces user to customize


Log checkpoint messages as debug messages, not info.

--- src/onyx/peer/task_lifecycle.clj
+++ src/onyx/peer/task_lifecycle.clj
@@ -174,7 +174,7 @@
     (.set ^AtomicLong (:checkpoint-size monitoring) (alength checkpoint-bytes))
     (checkpoint/write-checkpoint storage tenancy-id job-id rv e task-id
                                  slot-id :input checkpoint-bytes)
-    (info "Checkpointed input" job-id rv e task-id slot-id :input)
+    (debug "Checkpointed input" job-id rv e task-id slot-id :input)
     (advance state)))

 (defn checkpoint-state [state]
@@ -193,7 +193,7 @@
     (.set ^AtomicLong (:checkpoint-size monitoring) (alength checkpoint-bytes))
     (checkpoint/write-checkpoint storage tenancy-id job-id rv e task-id
                                  slot-id :windows checkpoint-bytes)
-    (info "Checkpointed state" job-id rv e task-id slot-id :windows)
+    (debug "Checkpointed state" job-id rv e task-id slot-id :windows)
     (advance state)))

 (defn checkpoint-output [state]
@@ -212,7 +212,7 @@
     (.set ^AtomicLong (:checkpoint-size monitoring) (alength checkpoint-bytes))
     (checkpoint/write-checkpoint storage tenancy-id job-id rv e
                                  task-id slot-id :output checkpoint-bytes)
-    (info "Checkpointed output" job-id rv e task-id slot-id :output)
+    (debug "Checkpointed output" job-id rv e task-id slot-id :output)
     (advance state)))

 (defn completed? [state]


Unnecessary anonymous function is built

Unnecessary anonymous function is built

--- src/onyx/peer/task_lifecycle.clj
+++ src/onyx/peer/task_lifecycle.clj
@@ -298,7 +298,7 @@
                  (transient (t/vector))))))

 (defn curry-params [f params]
-  (reduce #(partial %1 %2) f params))
+  (reduce partial f params))

 (defn apply-fn [f bulk? event]
   (let [g (curry-params f (:onyx.core/params event))


Add back start param

Add back start param

Accidently removed with merge conflict

--- src/bolt/core.cljs
+++ src/bolt/core.cljs
@@ -135,7 +135,11 @@
 ;; Routing

 (defroute "/" []
-  (rum/mount (bolt-app) (.getElementById js/document "app")))
+  (rum/mount (bolt-app) (.getElementById js/document "app"))
+  (when (re-find #"start" js/window.location.search)
+    (speech/toggle-speech app-state
+                          #js {:target (.querySelector js/document "#mic")
+                               :preventDefault (fn [])})))

 ;; For browser commands
 (defroute "/to/:command" [command]


Add TODO's re: tempfiles.

Add TODO's re: tempfiles.

--- src/boot/jruby.clj
+++ src/boot/jruby.clj
@@ -34,6 +34,8 @@
    g gem       NAME:VERSION [[str str]] "gems to install before eval"
    p gem-path  PATH         [str]       "additional gem paths to use"]

+  ;; TODO: figure out what keys (if any) these should have
+  ;; TODO: replace with new tempfile mechanism when it is released
   (let [tgt (boot/mktgtdir!)
         src (boot/mksrcdir!)
         rsc (boot/mkrscdir!)


update log message

update log message

--- src/bzzz/index.clj
+++ src/bzzz/index.clj
@@ -146,7 +146,7 @@
              (.toString dir)
              " Got exception while close()ing the writer,and directory is still locked."
              " Unlocking it. "
-             "[ should never happen, there is a race between this IndexWriter/unlock and other process/thread index writer open ]"
+             "[ should never happen, there is a race between this IndexWriter/unlock and other process/thread IndexWriter/open ]"
              " Exception: " (ex-str e))))

 (defn safe-close-writer [^IndexWriter writer]


Fix typo

Fix typo

--- src-cljs/frontend/utils/docs.cljs
+++ src-cljs/frontend/utils/docs.cljs
@@ -141,7 +141,7 @@
     "common-problems#dont-run" "dont-run"
     "common-problems#git-bundle-install" "git-bundle-install"
     "common-problems#git-pip-install" "git-pip-install"
-    "common-problems#not-specified-commands" "not-specified-ruby-commands"
+    "common-problems#wrong-commands" "not-specified-ruby-commands"
     "common-problems#bundler-latest" "bundler-latest"
     "common-problems#capybara-timeout" "capybara-timeout"
     "common-problems#clojure-12" "clojure-12"


Roughly sketched out code

Roughly sketched out code

--- src/cljsv/core.clj
+++ src/cljsv/core.clj
@@ -1,6 +1,87 @@
-(ns cljsv.core)
+(ns cljsv.core
+  (:require [clojure.java.io :as io]))

-(defn foo
-  "I don't do a whole lot."
-  [x]
-  (println x "Hello, World!"))
+
+(defn- apply-kwargs
+  "Takes a function f, any number of regular args, and a final kw-args argument which will be
+  splatted in as a final argument"
+  [f & args]
+  (apply (apply partial f (butlast args)) (apply concat (last args))))
+
+
+; This is cause I don't have data.csv right now...
+(defn- raw-read-csv-string
+  [csv-str]
+  (-> csv-readable
+      clojure.string/split-lines
+      (map #(clojure.string % #","))))
+
+
+(defn- read-csv-row
+  "Translates a single row of values into a map of colname -> val, given colnames in header.
+  The cast-fn arg should be a vector of translation functions the same length as header and row,
+  and will be used to translate the raw string vals in row."
+  [header cast-fns row]
+  (into
+    {}
+    (map
+      (fn [rowname cast-fn v] [rowname (cast-fn v)])
+      header
+      cast-fns
+      row)))
+
+
+(defn ->int
+  "Convenience function for translating strings into integers"
+  [string]
+  (Integer/parseInt string))
+
+(defn ->float
+  "Convenience function for translating strings into floats"
+  [string]
+  (Float/parseFloat string))
+
+
+(defn read-csv-rows
+  "Given a lines-iter, produces a sequence of hash-maps of col -> val mappings, as specified by
+  a header in file (if specified; indices ow). Options
+    header: bool; consume the first row as a header?
+    comment-re: specify a regular expression to use for commenting out lines, or something falsey
+                if this isn't desired
+    remove-empty: also remove empty rows?
+    cast-fns: optionally cast the vals in the map by applying the corresponding function in
+              (cast-fns row-name) to the string val"
+  [lines-iter & {:keys [comment-re header remove-empty cast-fns]
+                 :or   {comment-re   #"^\#"
+                        header       true
+                        remove-empty true
+                        cast-fns     {}}
+                 :as opts}]
+  (let [non-cmnt-lines (remove #(or (when comment-re
+                                      (re-find comment-re %))
+                                    (when remove-empty
+                                      (re-find #"^\s*$" %)))
+                               lines-iter)
+        header (read-csv-row (first non-cmnt-lines))
+        non-cmnt-lines (rest non-cmnt-lines)]
+    (map
+      (partial header
+               (map #(or (cast-fns %) identity) header))
+      non-cmnt-lines)))
+
+
+(defn read-csv-file
+  [file-or-filename & opts]
+  "Read csv in from a filename or file handle. For details see the docstring for read-csv-rows"
+  (if (= (type file-or-filename) java.lang.string)
+    (with-open [f (io/reader filename)]
+      (apply-kwargs read-csv-file f opts))
+    (apply-kwargs read-csv-rows (line-seq f) opts)))
+
+
+(defn read-csv-str
+  "Read csv in from a csv string. For details see the docstring for read-csv-rows"
+  [csv-str & opts]
+  (apply-kwargs read-csv-rows (clojure.string/split-lines csv-str) opts))
+
+


added examples of where the workflow slows down

--- src/clj/forma/source/logistic.clj
+++ src/clj/forma/source/logistic.clj
@@ -1,6 +1,5 @@
 (ns forma.source.logistic
-  (:use [clojure.math.numeric-tower :only (sqrt floor abs expt)]
-        [clojure-csv.core])
+  (:use [clojure-csv.core])
   (:require [incanter.core :as i]))

 (def mys-data (let [file "/Users/danhammer/Desktop/testmys/allmys.txt"]
@@ -20,9 +19,15 @@
 (def X (map (partial cons 1) (take 235469 mys-features)))
 (def beta (repeat 23 0))

-(defn one-minus
-  [coll]
-  (map #(- 1 %) coll))
+(defn feature-vec
+  [n]
+  (map (partial cons 1)
+       (for [x (range n)]
+         (take 22 (repeatedly rand)))))
+
+(defn label-vec
+  [n]
+  (for [x (range n)] (if (> (rand) 0.5) 1 0)))

 (defn scaled-vector
   [scalar coll]
@@ -50,9 +55,7 @@
 (defn total-log-likelihood
   "returns the total log likelihood for a group of pixels; input
   labels and features for the group of pixels, aligned correctly so
-  that the first label and feature correspond to the first pixel.
-  Example:
-  (total-log-likelihood y X) => -69.31471805599459"
+  that the first label and feature correspond to the first pixel."
   [beta-seq labels features]
   (reduce + (map (partial log-likelihood beta-seq) labels features)))

@@ -63,7 +66,7 @@
        feature-seqs))

 (defn score-seq
-  "returns the scores for each parameter in the analysis"
+  "returns the scores for each parameter"
   [beta-seq labels features]
   (let [prob-seq (probability-calc beta-seq features)]
     (i/mmult (i/trans features) (map - labels prob-seq))))
@@ -95,7 +98,19 @@
       (if (zero? iter)
         beta
         (recur (let [inc-beta (beta-update beta labels features rdg-cons)]
-                 (println "")
-                 (println (flatten beta))
-                 map + beta inc-beta)
+                 (map + beta inc-beta))
                (dec iter))))))
+
+;; Ultimately, this is what we'd like to run:
+;; (logistic-beta-vector (label-vec 100000) (feature-vec 100000) 0.00000001)
+
+;; In the meantime, this is a problem ...
+;; (def X-rand (feature-vec 100000))
+;; (def y-rand (label-vec 100000))
+;; (time (total-log-likelihood beta y-rand X-rand))
+;; =>"Elapsed time: 3320.955 msecs"
+
+;; (def X-rand (feature-vec 100000))
+;; (def y-rand (label-vec 100000))
+;; (time (total-log-likelihood beta y-rand X-rand))
+;; ... takes way, way longer than 33200 msecs (10 x 3320 msecs)


Switch tri to saw

Switch tri to saw

--- src/overtone_workspace/grunbles.clj
+++ src/overtone_workspace/grunbles.clj
@@ -4,11 +4,11 @@
 ;; Inspired by an example in an early chapter of the SuperCollider book

 (definst grumble [speed 6 freq-mul 1]
-  (let [snd (mix (map #(* (lf-tri (* % freq-mul 100))
+  (let [snd (mix (map #(* (lf-saw (* % freq-mul 100))
                           (max 0 (+ (lf-noise1:kr speed)
                                     (env-gen (perc 20 100) :action FREE))))
                       [1 (/ 2 3) (/ 3 2) 2]))]
-    (pan2 snd (sin-osc:kr 1))))
+    (pan2 snd (sin-osc:kr 0.125))))

 ;;(stop)
 ;; (grumble)
@@ -19,7 +19,7 @@
 ;; (grumble :freq-mul 2)
 ;; (ctl grumble :speed 3000)

-(volume (/  20  127))
+(volume (/  8  127))

 (def metro (metronome 10))


More make-fuzzy-set

More make-fuzzy-set

and fuzzy-set as an alias for make-fuzzy-set.

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

--- src/conexp/contrib/fuzzy/sets.clj
+++ src/conexp/contrib/fuzzy/sets.clj
@@ -79,11 +79,14 @@
   "Constructs a fuzzy set from a given collection."
   clojure-type)

+(defmethod make-fuzzy-set :default
+  [thing]
+  (illegal-argument "Don't know how to create a fuzzy set from " thing "."))
+
 (defmethod make-fuzzy-set clojure-map
   [hashmap]
   (assert (forall [v (vals hashmap)]
-            (and (number? v)
-                 (<= 0 v 1))))
+            (and (number? v) (<= 0 v 1))))
   (Fuzzy-Set. (select-keys hashmap (remove #(zero? (hashmap %)) (keys hashmap)))))

 (defmethod make-fuzzy-set Fuzzy-Set
@@ -93,6 +96,17 @@
 (defmethod make-fuzzy-set clojure-set
   [set]
   (Fuzzy-Set. (map-by-fn (constantly 1) set)))
+
+(defmethod make-fuzzy-set clojure-coll
+  [coll]
+  (make-fuzzy-set (set coll)))
+
+(defmethod make-fuzzy-set clojure-vec
+  [vec]
+  (make-fuzzy-set (set vec)))
+
+(defalias fuzzy-set make-fuzzy-set
+  "Alias for make-fuzzy-set")

 (defn fuzzy-set-as-hashmap
   "Returns the hashmap corresponding to the given fuzzy set."


Set *e to the underlying exception

Set *e to the underlying exception

Currently, you get the top level Planck
exception, where *e should be set to the
one that the user is experiencing.

--- planck-cljs/src/planck/repl.cljs
+++ planck-cljs/src/planck/repl.cljs
@@ -668,6 +668,8 @@
     (re-matches #"^goog/.*" path) (do-load-goog name cb)
     :else (do-load-other name path macros cb)))

+(declare skip-cljsjs-eval-error)
+
 (defn- handle-error
   [e include-stacktrace? in-exit-context?]
   (let [cause                     (or (.-cause e) e)
@@ -676,7 +678,7 @@
       (print-error e include-stacktrace?))
     (if (and in-exit-context? (not is-planck-exit-exception?))
       (js/PLANCK_SET_EXIT_VALUE 1)
-      (set! *e e))))
+      (set! *e (skip-cljsjs-eval-error e)))))

 (defn- ^:export run-main
   [main-ns & args]


[CACHING] Only search lazyweb every 5 minutes

--- src/layzee/use_cases/lazy_web.clj
+++ src/layzee/use_cases/lazy_web.clj
@@ -33,20 +33,15 @@
 (def ^{:private true} no-retweets
      #(nil? (:retweeted_status %1)))

-(defn- result[adapters how-many]
-  (apply (:search-adapter-fn adapters) [{:count how-many :filter no-retweets}]))
+(defn- result[adapters how-many] (apply (:search-adapter-fn adapters) [{:count how-many :filter no-retweets}]))

-(defn- cached-result[adapters how-many]
-  ;;(let [ttl-in-seconds 5]
-  ;;  (memo/ttl result :ttl/threshold (* 1000 ttl-in-seconds)))
-  (result adapters how-many)
-  ) ;; http://clojure.github.io/core.memoize/
+(def ^{:private true} cached-result
+  (let [ttl-in-seconds (* 60 5)]
+    (memo/ttl result :ttl/threshold (* 1000 ttl-in-seconds)))) ;; http://clojure.github.io/core.memoize/

 (defn run[adapters]
   (let [how-many 100]
-
-    (let [result (memo/snapshot (cached-result adapters how-many))]
-
+    (let [result (apply cached-result [adapters how-many])]
       (println (format "Searched for <%s> <#lazyweb> mentions and found <%s> results (filtered)" how-many (count result)))

       (doseq [tweet result]


Current behavior with `deftest` is reasonable.

Facts within deftests are reported at load-time. That's reasonable because
there's really no longer a reason to wrap facts in deftests. Plain clojure.test
`is` statements are reported all together at the end.

--- src/midje/clojure_test_facade.clj
+++ src/midje/clojure_test_facade.clj
@@ -56,7 +56,6 @@
    affect the Midje fact counters but instead returns a map
    that can be used to produce a separate report."
   [namespaces]
-  (println "=================== Need to check if failing clojure.test and embedded fact output appear in the right section of the summary.")
   (with-isolated-counters
     (binding [ct/*test-out* (java.io.StringWriter.)]
       (let [ct-result (apply ct/run-tests namespaces)]


Fixed typo

Fixed typo

--- src/search/algorithms/base/step.clj
+++ src/search/algorithms/base/step.clj
@@ -8,7 +8,7 @@

 (def Breed (s/=> schemas/Individual [schemas/Individual]))
 (s/defn breed-> :- Step
-  "Creates a step function, fillin it with `population-size` new individuals
+  "Creates a step function, filling it with `population-size` new individuals
   generated by calling `breed` on the existing ones."
   [population-size :- s/Int
    breed :- Breed]


Fixed spelling error

Fixed spelling error

--- src/video_server/html/titles.clj
+++ src/video_server/html/titles.clj
@@ -55,7 +55,7 @@
   (site-template
     {:title "Videos@Home" :toolbar titles-toolbar}
     [:h2 "No Titles"]
-    [:p "No vidoes were found in the following folders:"]
+    [:p "No videos were found in the following folders:"]
     [:ul (for [dir dirs]
            [:li dir])]))


Start tracking gauges.

Start tracking gauges.

--- riemann.config.clj
+++ riemann.config.clj
@@ -73,7 +73,8 @@
                         (occurrences)
                         (meters)
                         (histograms)
-                        (timers))
+                        (timers)
+                        (gauges))
       ]
   (streams
     (with {:host "riemann" :service "raw-events-processed" :metric 1.0}


lose unused code

lose unused code


Make image retrieve endpoint public (without auth).

--- backend/src/uxbox/frontend.clj
+++ backend/src/uxbox/frontend.clj
@@ -81,6 +81,8 @@
         [:post "auth/recovery" #'users/request-recovery]
         [:put  "auth/recovery" #'users/recover-password]

+        [:get "library/images/:id" #'images/retrieve-image]
+
         [:get "projects-by-token/:token" #'projects/retrieve-project-by-share-token]

         ;; SVG Parse
@@ -111,7 +113,6 @@
         ;; Images
         [:put "library/images/copy" #'images/copy-image]
         [:delete "library/images/:id" #'images/delete-image]
-        [:get "library/images/:id" #'images/retrieve-image]
         [:put "library/images/:id" #'images/update-image]
         [:post "library/images" #'images/create-image]


minor stuff

minor stuff

--- src/clj/shadow/devtools/server/livetest.clj
+++ src/clj/shadow/devtools/server/livetest.clj
@@ -131,7 +131,9 @@
       {:status 500
        :body "Timeout waiting for server state."}
       (let [test-namespaces
-            (node/find-all-test-namespaces compiler-state)]
+            (->> (node/find-all-test-namespaces compiler-state)
+                 (remove #(= % 'shadow.devtools.test))
+                 (into []))]
         {:status 200
          :body
          (html5
@@ -252,9 +254,17 @@
         svc
         (start devtools)]

+    (println "==========================================")
+    (println "LIVETEST running at: http://localhost:4005")
+    (println "==========================================")
+
     (server/repl-output-proc devtools)
     (server/repl-input-loop! devtools)

     (stop svc)
     (server/stop devtools)
     ))
+
+
+(defn -main [& args]
+  (run))


Bugfix in move.

Bugfix in move.

--- src/wombats/game/decisions/move.clj
+++ src/wombats/game/decisions/move.clj
@@ -47,8 +47,10 @@
     decision-maker-contents))

 (defn- update-player-stats
-  [decision-maker-contents desired-space-contents]
-  (update-in [:game/players (:uuid decision-maker-contents) :player/stats]
+  [game-state decision-maker-contents desired-space-contents]
+  (update-in game-state [:game/players
+                         (:uuid decision-maker-contents)
+                         :player/stats]
              (fn [stats]
                (condp = (:type desired-space-contents)
                  :food (-> stats


spacing fixes in customer logos

spacing fixes in customer logos

--- frontend/components/shared.cljs
+++ frontend/components/shared.cljs
@@ -14,15 +14,15 @@
   [:div.customers-trust.row
    [:h4 [:span "Trusted By"]]
    [:div {:class company-size}
-    [:img {:title "Salesforce" :src (data-uri "/img/logos/salesforce.png")}]]
+    [:img {:title "Salesforce" :src (data-uri "/img/logos/salesforce.png")}] " "]
    [:div {:class company-size}
-    [:img {:title "Samsung" :src (data-uri "/img/logos/samsung.png")}]]
+    [:img {:title "Samsung" :src (data-uri "/img/logos/samsung.png")}] " "]
    [:div {:class company-size}
-    [:img {:title "Kickstarter" :src (data-uri "/img/logos/kickstarter.png")}]]
+    [:img {:title "Kickstarter" :src (data-uri "/img/logos/kickstarter.png")}] " "]
    [:div {:class company-size}
-    [:img {:title "Cisco", :src (data-uri "/img/logos/cisco.png")}]]
+    [:img {:title "Cisco", :src (data-uri "/img/logos/cisco.png")}] " "]
    [:div {:class company-size}
-    [:img {:title "Shopify" :src (data-uri "/img/logos/shopify.png")}]]
+    [:img {:title "Shopify" :src (data-uri "/img/logos/shopify.png")}] " "]
    [:span.stretch]])

 (defn home-button [{:keys [source]} controls-ch]


Liberal use of destructuring

Liberal use of destructuring

--- src/icecap/api.clj
+++ src/icecap/api.clj
@@ -12,11 +12,11 @@

 (defn create-cap
   "Creates a capability."
-  [plan {store :store kdf :kdf scheme :scheme}]
+  [plan {:keys [store kdf scheme]}]
   (let [error (spy (check-plan plan))]
     (if (nil? error)
       (let [cap (crypto/make-cap)
-            {index :index cap-key :cap-key} (crypto/derive kdf cap)
+            {:keys [index cap-key]} (crypto/derive kdf cap)
             encoded-plan (nippy/freeze plan)
             blob (crypto/encrypt scheme cap-key encoded-plan)
             ch (create! store index blob)]
@@ -25,8 +25,8 @@

 (defn execute-cap
   "Executes a capability."
-  [cap {store :store kdf :kdf scheme :scheme}]
-  (let [{index :index cap-key :cap-key} (crypto/derive kdf cap)
+  [cap {:keys [store kdf scheme]}]
+  (let [{:keys [index cap-key]} (crypto/derive kdf cap)
         blob (<!! (retrieve store index))
         encoded-plan (crypto/decrypt scheme cap-key blob)
         plan (spy (nippy/thaw encoded-plan))
@@ -35,7 +35,7 @@

 (defn revoke-cap
   "Revokes a capability."
-  [cap {store :store kdf :kdf}]
+  [cap {:keys [store kdf]}]
   (let [{index :index} (crypto/derive kdf cap)
         chan (delete! store index)]
     (async/into {} chan)))


Simplify map fn.

Simplify map fn.

--- src/isla/story.clj
+++ src/isla/story.clj
@@ -40,7 +40,7 @@
 (defrecord Story [player rooms]
   QueryableStory
   (items [this]
-    (concat (map (fn [x] (:items x)) rooms)))
+    (concat (map :items rooms)))

   Playable
   (go [this arguments-str]


modified help command to filter out functions with empty doc strings

--- src/mapfs/core.clj
+++ src/mapfs/core.clj
@@ -144,9 +144,7 @@
     (swap! FS_ROOT assoc-in (into @CURRENT_DIR [key-name]) value)
     (if (nil? existed)
       (str "Added value for " key-name)
-      (str "Updated value for key " key-name)))
-
-  )
+      (str "Updated value for key " key-name))))

 (defn rename
   "Rename file to path. Arguments should be [:src :key :path] [:dest :key :path]."
@@ -215,7 +213,8 @@
   []
   (let [publics (sort-by first (ns-publics 'mapfs.core))]
     (->>
-      (map (fn [[k v]] (str "  " k " - " (:doc (meta v)))) publics)
+      (filter #(:doc (meta (second %))) publics)
+      (map (fn [[k v]] (str "  " k " - " (:doc (meta v)))))
       (into ["Available commands:\n"])
       (str/join "\n" ))))


Add REST.

Add REST.

--- src/ombs/route.clj
+++ src/ombs/route.clj
@@ -12,10 +12,12 @@
     [ring.middleware.keyword-params :refer [wrap-keyword-params]]

     ;[ring.middleware.reload :refer [wrap-reload]] ; don't work
+    [cheshire.core :as json]

     [noir.session :refer [wrap-noir-session]]
     [noir.validation :refer [wrap-noir-validation]]
     [noir.response :refer [redirect]]
+    [ombs.dbold :refer [get-events]]

     ; request handlers. Prepare data, and call views.
     [ombs.handler.pages :as pages]
@@ -46,9 +48,12 @@
   (GET "/pay" {params :params} (pay params))
   (GET "/affirm" {{fid :fid} :params} (affirm fid))

+  (ANY "/api/pong" {params :params} (json/generate-string params))
+  (GET "/api/events" [_] (json/generate-string (get-events)))
+
   (resources "/") ;Should be after pages. Search all css, js, etc. in dir 'resources' in root of project
-
-  (not-found "Page not found") ) ; should be last, it overlap all below routes.
+  (not-found "Page not found")
+  ) ; should be last, it overlap all below routes.

 (def engine
   (-> main-routes


Poll: Add :tags.

Poll: Add :tags.

--- src/pepa/model.clj
+++ src/pepa/model.clj
@@ -433,7 +433,14 @@
                                   LEFT JOIN documents as d
                                     ON d.id = dt.document
                                   WHERE dt.state_seq > ?" seq-num])
-                   (mapv :id))})
+                   (mapv :id))
+   ;; Special case: Also send down used tags
+   :tags (->> (db/query db ["SELECT DISTINCT t.name
+                             FROM document_tags AS dt
+                             LEFT JOIN tags AS t
+                               ON t.id = dt.tag
+                             WHERE dt.state_seq > ?" seq-num])
+              (mapv :name))})

 (defmethod changed-entities* :pages [db _ seq-num]
   (let [pages (mapv :id (db/query db ["SELECT id FROM pages WHERE state_seq > ?" seq-num]))]


Use use'd vars

Use use'd vars

--- src/reply/core.clj
+++ src/reply/core.clj
@@ -1,5 +1,5 @@
 (ns reply.core
-  (:use [clojure.main :only [repl repl-read]]
+  (:use [clojure.main :only [repl repl-read repl-exception]]
         [clojure.repl :only [set-break-handler!]])
   (:require [reply.printing])
   (:import [reply JlineInputReader]
@@ -9,7 +9,7 @@

 (defn actual-read [input-reader request-prompt request-exit]
   (binding [*in* input-reader]
-    (clojure.main/repl-read request-prompt request-exit)))
+    (repl-read request-prompt request-exit)))

 (def main-thread (Thread/currentThread))

@@ -58,7 +58,7 @@
       (clear-jline-buffer)
       request-prompt)
     (catch RuntimeException e
-      (if (= InterruptedException (type (clojure.main/repl-exception e)))
+      (if (= InterruptedException (type (repl-exception e)))
         (do (clear-jline-buffer)
             request-prompt)
         (throw e)))))


Print less information on startup

Print less information on startup

--- src/tttclj/web.clj
+++ src/tttclj/web.clj
@@ -11,11 +11,10 @@
    :body "Hello HTTP via Compojure!"})

 (defn ws-handler [{:keys [ws-channel] :as req}]
-  (prn (:remote-addr req))
+  (prn (:async-channel req))
   (go-loop [i 10]
     (<! (timeout 1000))
     (>! ws-channel (str "Hello from server" i))
-    (prn req)
     (when (> i 0)
       (recur (dec i)))))

@@ -26,5 +25,5 @@
   (GET "/" [] index))

 (defn -main [& args]
-  (run-server app {:port 8080})
+  (run-server #'app {:port 8080})
   (println "Started server on http://localhost:8080"))