Pretty up long strings

Pretty up long strings

--- frontend/components/integrations.cljs
+++ frontend/components/integrations.cljs
@@ -170,14 +170,34 @@
                     ]]]])))))

 (def integration-data
-  {:heroku {:hero {:header [:span "Deploy to " [:img {:src (utils/cdn-path "img/outer/integrations/heroku-icon.svg") :alt "Heroku" :style {:vertical-align "-35%"}}] " from CircleCI"]
+  {:heroku {:hero {:header [:span
+                            "Deploy to "
+                            [:img {:src (utils/cdn-path "img/outer/integrations/heroku-icon.svg")
+                                   :alt "Heroku"
+                                   :style {:vertical-align "-35%"}}]
+                            " from CircleCI"]
                    :text "Experience a simple, modern continuous delivery workflow now."}
             :bullets [{:title "Test before you deploy. Always."
-                       :text [:span "Heroku revolutionized the way developers think about deployment. Being able to deploy with a simple "
-                              [:code "git push heroku master"] " is an amazing thing. But setting up a proper continuous delivery workflow means automating every step of the process. With CircleCI whenever you push a commit to master, it will go through a complete continuous delivery pipeline. All of your tests will run with our blazing fast parallelism, and" [:em " only if they pass, "] "your code will be pushed to Heroku automatically."]
+                       :text [:span
+                              "Heroku revolutionized the way developers think about deployment. "
+                              "Being able to deploy with a simple "
+                              [:code "git push heroku master"]
+                              " is an amazing thing. But setting up a proper continuous delivery "
+                              "workflow means automating every step of the process. With CircleCI "
+                              "whenever you push a commit to master, it will go through a complete "
+                              "continuous delivery pipeline. All of your tests will run with our "
+                              "blazing fast parallelism, and" [:em " only if they pass, "]
+                              "your code will be pushed to Heroku automatically."]
                        :graphic [:img {:src (stefon/data-uri "/img/status-logos/success.svg")}]}
                       {:title "Dead Simple Configuration"
-                       :text "The deployment of your application is configured through just a few lines of YAML that are kept safe in your source code. All you need to do to deploy to Heroku from CircleCI is configure your Heroku credentials in our UI, add a simple config file like this one into your project, and make a push. You can also easily deploy different branches to different Heroku apps (e.g. one for staging and one for production)."
+                       :text [:span
+                              "The deployment of your application is configured through just a "
+                              "few lines of YAML that are kept safe in your source code. All "
+                              "you need to do to deploy to Heroku from CircleCI is configure your "
+                              "Heroku credentials in our UI, add a simple config file like this "
+                              "one into your project, and make a push. You can also easily deploy "
+                              "different branches to different Heroku apps (e.g. one for staging "
+                              "and one for production)."]
                        :graphic [:div.console
                                  [:pre
                                   "deployment:\n"
@@ -186,24 +206,73 @@
                                   "      heroku:\n"
                                   "        appname: " [:span.value "my-app"]]]}
                       {:title "Watch how to get started in minutes"
-                       :text [:span "This video shows step-by-step how to configure CircleCI to test your application and deploy to Heroku, and how CircleCI keeps defects from getting into production. "
-                    "See our docs for a " [:a {:href "/docs/continuous-deployment-with-heroku#part-2-multiple-environments"} "followup video"] " showing how to setup a more robust continuous delivery pipeline with staging and prod environments."]
+                       :text [:span
+                              "This video shows step-by-step how to configure CircleCI to test "
+                              "your application and deploy to Heroku, and how CircleCI keeps "
+                              "defects from getting into production. "
+                              "See our docs for a "
+                              [:a {:href (str "/docs/continuous-deployment-with-heroku#part-2-multiple-environments")}
+                               "followup video"]
+                              " showing how to setup a more robust continuous delivery pipeline "
+                              "with staging and prod environments."]
                        :graphic [:div {:dangerouslySetInnerHTML {:__html "<iframe src='//www.youtube.com/embed/Hfs_1yuWDf4?rel=0&showinfo=0' width='300' height='200' frameborder='0' allowfullscreen></iframe>"}}]}]
             :bottom-header "Ready for world-class continuous delivery?"
-            :secondary-cta [:span "Or see our " [:a {:href "/docs/continuous-deployment-with-heroku"} "docs on deploying to Heroku."]]}
-   :saucelabs {:hero {:header [:span "Test with " [:img {:src (utils/cdn-path "/img/outer/integrations/sauce.png") :alt "Sauce Labs" :style {:width "300px"}}] " on CircleCI"]
+            :secondary-cta [:span
+                            "Or see our "
+                            [:a {:href "/docs/continuous-deployment-with-heroku"}
+                             "docs on deploying to Heroku."]]}
+   :saucelabs {:hero {:header [:span
+                               "Test with "
+                               [:img {:src (utils/cdn-path "/img/outer/integrations/sauce.png")
+                                      :alt "Sauce Labs" :style {:width "300px"}}]
+                               " on CircleCI"]
                       :text "Test against hundreds of mobile and desktop browsers."}
                :bullets [{:title "Selenium WebDriver"
-                          :text "Sauce Labs supports automated browser tests using Selenium WebDriver, a widely-adopted browser driving standard. Selenium WebDriver provides a common API for programatically driving browsers implemented in several popular languages, including Java, Python, and Ruby. WebDriver can operate in two modes: local or remote. When run locally, your tests use the Selenium WebDriver library to communicate directly with a browser on the same machine. When run in remote mode, your tests interact with a Selenium Server, and it it is up to the server to drive the browsers. Sauce Labs essentially provides a Selenium Server as a service, with all kinds of browsers available to test. It has some extra goodies like videos of all test runs as well."
+                          :text [:span
+                                 "Sauce Labs supports automated browser tests using Selenium "
+                                 "WebDriver, a widely-adopted browser driving standard. Selenium "
+                                 "WebDriver provides a common API for programatically driving "
+                                 "browsers implemented in several popular languages, including "
+                                 "Java, Python, and Ruby. WebDriver can operate in two modes: "
+                                 "local or remote. When run locally, your tests use the Selenium "
+                                 "WebDriver library to communicate directly with a browser on the "
+                                 "same machine. When run in remote mode, your tests interact with "
+                                 "a Selenium Server, and it it is up to the server to drive the "
+                                 "browsers. Sauce Labs essentially provides a Selenium Server as a "
+                                 "service, with all kinds of browsers available to test. It has "
+                                 "some extra goodies like videos of all test runs as well."]
                           :graphic selenium-logo}
                          {:title "All the browsers and platforms you need"
-                          :text "Sauce Labs provides a huge variety of browsers and operating systems. You can choose between combinations of Firefox, Chrome, Safari, and Internet Explorer browsers and OSX, Windows, and Linux operating systems. You can also test against mobile Safari and Android browsers. Pick whatever browsers are important for you, whether you need to ensure critical functionality works on mobile devices or support old versions of IE. Because Selenium WebDriver provides a unified interface to talk to all of these browsers, you only need to write your browser tests once, and you can run them on as many browsers and platforms as you want."
+                          :text [:span
+                                 "Sauce Labs provides a huge variety of browsers and operating "
+                                 "systems. You can choose between combinations of Firefox, Chrome, "
+                                 "Safari, and Internet Explorer browsers and OSX, Windows, and "
+                                 "Linux operating systems. You can also test against mobile Safari "
+                                 "and Android browsers. Pick whatever browsers are important for "
+                                 "you, whether you need to ensure critical functionality works on "
+                                 "mobile devices or support old versions of IE. Because Selenium "
+                                 "WebDriver provides a unified interface to talk to all of these "
+                                 "browsers, you only need to write your browser tests once, and "
+                                 "you can run them on as many browsers and platforms as you want."]
                           :graphic [:div.browsers firefox-logo safari-logo  ie-logo chrome-logo]}
                          {:title "Test Continuously"
-                          :text "CircleCI automatically runs all your tests, against whatever browsers you choose, every time you commit code. You can configure your browser-based tests to run whenever a change is made, before every deployment, or on a certain branch. A Continuous Integration and Delivery workflow with CircleCI and Sauce Labs ensures that browser-specific bugs affecting critical functionality in your app never make it to production."
+                          :text [:span "CircleCI automatically runs all your tests, against "
+                                 "whatever browsers you choose, every time you commit code. You "
+                                 "can configure your browser-based tests to run whenever a change "
+                                 "is made, before every deployment, or on a certain branch. A "
+                                 "Continuous Integration and Delivery workflow with CircleCI and "
+                                 "Sauce Labs ensures that browser-specific bugs affecting critical "
+                                 "functionality in your app never make it to production."]
                           :graphic [:img {:src (utils/cdn-path "/img/outer/integrations/cycle-black.svg") :style {:width "250px" :height "250px"}}]}
                          {:title "No public test servers required"
-                          :text [:span "Sauce Labs operates browsers on a network separate from CircleCI build containers, but there needs to be a way for the browsers to access the web application you want to test. The easiest way to do this is to simply run your server during a CircleCI build and use Sauce Connect to setup a secure tunnel between Sauce Labs' browsers and your build containers on CircleCI. There is an in-depth example of this in " [:a {:href "/docs/browser-testing-with-sauce-labs"} "our docs."]]
+                          :text [:span "Sauce Labs operates browsers on a network separate from "
+                                 "CircleCI build containers, but there needs to be a way for the "
+                                 "browsers to access the web application you want to test. The "
+                                 "easiest way to do this is to simply run your server during a "
+                                 "CircleCI build and use Sauce Connect to setup a secure tunnel "
+                                 "between Sauce Labs' browsers and your build containers on "
+                                 "CircleCI. There is an in-depth example of this in "
+                                 [:a {:href "/docs/browser-testing-with-sauce-labs"} "our docs."]]
                           :graphic [:div.sauce-connect [:p "Sauce" [:br] "Connect"]]}]
                :bottom-header "Want to get rid of browser bugs?"
                :secondary-cta [:span "Or see our " [:a {:href "/docs/browser-testing-with-sauce-labs"} "docs on Sauce Labs."]]}})


:green_heart: :construction: Fix icons collections init

--- frontend/src/uxbox/library/icons.cljs
+++ frontend/src/uxbox/library/icons.cljs
@@ -23,7 +23,7 @@
             [uxbox.library.icons.material.toggle :as md-toggle]
             ))

-(def collections-list
+(def collections
   [{:name "Material design (actions)"
     :id #uuid "00000000-0000-0000-0000-100000000001"
     :created-at 1
@@ -99,6 +99,3 @@
     :created-at 15
     :type :builtin
     :icons md-toggle/+icons+}])
-
-(def collections
-  (index-by collections-list :id))


avoids race in kitchen starting up before nginx proxy (#665)

--- waiter/integration/waiter/basic_test.clj
+++ waiter/integration/waiter/basic_test.clj
@@ -377,7 +377,7 @@
 (deftest ^:parallel ^:integration-fast test-health-check-proto
   (testing-using-waiter-url
     ;; PORT2 is running kitchen without SSL enabled
-    (run-backend-proto-service-test waiter-url "h2" "http" 2 "https" "HTTP/2.0")))
+    (run-backend-proto-service-test waiter-url "h2" "https" 1 "https" "HTTP/2.0")))

 (deftest ^:parallel ^:integration-fast test-basic-unsupported-command-type
   (testing-using-waiter-url


fixes https://github.com/Deraen/less4clj/issues/10

--- lein-less4j/src/leiningen/less4j.clj
+++ lein-less4j/src/leiningen/less4j.clj
@@ -51,7 +51,7 @@
         main-files (vec (find-main-files source-paths))]
     (eval-in-project
       project'
-      `(let [f# (fn compile-less [& ~'_]
+      `(let [f# (fn ~'compile-less [& ~'_]
                   (doseq [[path# relative-path#] ~main-files]
                     (println (format "Compiling {less}... %s" relative-path#))
                     (let [result#


PLATFORM-2818: added missing thumb-verifier for type conversion

--- src/vignette/util/thumb_verifier.clj
+++ src/vignette/util/thumb_verifier.clj
@@ -127,6 +127,10 @@
   (let [window (requested-window-size requested)]
     (scale-width requested window)))

+(defn keep-dimensions
+  [requested original]
+  (requested-size original))
+
 (defn fitter
   "Creates a function that proportionally shrinks the given box,
   so that its 'a' (width or height) is not grater than that of the container"
@@ -181,6 +185,9 @@

 (def original-proportions-upto-original
   {:fn scale-and-fit-in-original :requires-original true})
+
+(def keep-original-dimensions
+  {:fn keep-dimensions :requires-original true})

 (def thumb-size-estimators {
   :fixed-aspect-ratio as-requested
@@ -196,6 +203,7 @@
   :window-crop-fixed as-requested
   :zoom-crop as-requested
   :zoom-crop-down requested-proportions-upto-original
+  :type-convert keep-original-dimensions
   })

 (defn estimate-thumb-size


Fix bench

Fix bench

--- benchmarks/caesium/crypto/secretbox_benchmark.clj
+++ benchmarks/caesium/crypto/secretbox_benchmark.clj
@@ -43,9 +43,7 @@
     (println "secretbox to-buf! with byte arrays")
     (println "these bufs already exist, so there is no allocation")
     (doseq [[size msg] (map (juxt identity randombytes) sizes)
-            f [s/secretbox-easy-to-indirect-byte-bufs-with-macros!
-               s/secretbox-easy-to-indirect-byte-bufs!
-               s/secretbox-easy-to-byte-bufs-nocast!
+            f [s/secretbox-easy-to-buf!
                s/secretbox-easy-refl!]]
       (println f (fmt-bytes size))
       (let [key (randombytes s/keybytes)


clarify TODO

clarify TODO

--- src/babel/index.cljc
+++ src/babel/index.cljc
@@ -5,6 +5,10 @@
    #?(:cljs [babel.logjs :as log])
    [dag_unify.core :refer [get-in unify]]))

+;; TODO: these first two functions "map-subset-by-path"
+;; and "map-subset-by-path2" are not descriptively named
+;; and could be combined into less code. Replace with more idiomatic and
+;; concise Clojure usage.
 (defn map-subset-by-path2 [vals-at-path lexemes path]
   (if (not (empty? vals-at-path))
     (let [val (first vals-at-path)]
@@ -18,9 +22,6 @@
                                   lexemes
                                   path)))))

-;; TODO: these functions "map-subset-by-path" are
-;; not descriptive. Replace with more idiomatic and
-;; concise Clojure usage.
 (defn map-subset-by-path [lexicon path]
   (map-subset-by-path2
    (vec (set (filter #(not (= :top %))


Fix docstring of timer fn.

Fix docstring of timer fn.

--- src/beicon/core.cljs
+++ src/beicon/core.cljs
@@ -188,7 +188,7 @@

 (defn timer
   "Returns an observable sequence that produces a value after
-  dueTime has elapsed and then after each period."
+  `ms` has elapsed and then after each period."
   ([ms]
    {:pre [(number? ms)]}
    (js/Rx.Observable.timer ms))


heroku deploy

heroku deploy

--- src/cai/outgoing.clj
+++ src/cai/outgoing.clj
@@ -25,6 +25,7 @@
     [{:action "typing_on"}
      {:message (templates/text-message clever_output)}]))

+
 (defn reply-to-image [sender-id image-url]
   (let [days (mod (reduce + (map #(int %) (seq image-url))) (* 3 365))
         date (time/minus (time/now) (time/days days))
@@ -40,6 +41,7 @@
        {:message (templates/image-message url)}
        {:message (templates/text-message url)})]))

+
 (defn reply-to-audio-or-video [sender-id url]
   (let [text (speech-api/stt url)
         cs-old (get-in @user-map [(keyword sender-id) :cs])


Can switch to and move the paddles.

Can switch to and move the paddles.


[Add] fun select-count

[Add] fun select-count

This is for to print out information about validation test.

--- src/clj_elm/core.clj
+++ src/clj_elm/core.clj
@@ -116,6 +116,11 @@
           (count)
           (#(/ % numd))))))

+(defn select-count
+  ([cond coll]
+   {:pre [(coll? coll)]}
+   (count (filter cond coll))))
+
 (defn _cross-validate
   ([dataset a b L]
    {:pre [(instance? DataSet dataset) (integer? a) (integer? b) (> b a)]}


[Fix] fun predict using *sign-reverse*

[Fix] fun predict using *sign-reverse*

if *sign-reverse* is true, predict use sign, else predict use reverse-sign.

--- src/clj_elm/core.clj
+++ src/clj_elm/core.clj
@@ -118,9 +118,12 @@
    (predict (:ass model) (:bs model) (:betas model) xs))
   ([ass bs betas xs]
    {:pre [(coll? ass) (coll? (first ass)) (coll? bs) (coll? betas) (coll? xs)]}
-   (-> (pmap #(* %1 (a-hidden-layer-output %2 %3 xs)) betas ass bs)
-       (c/sum)
-       (sign))))
+   (let [signf (if *sign-reverse*
+                 reverse-sign
+                 sign)]
+     (-> (pmap #(* %1 (a-hidden-layer-output %2 %3 xs)) betas ass bs)
+         (c/sum)
+         (signf)))))

 (defn update-exp [fn key exp]
   {:pre [(fn? fn) (keyword? key) (map? exp)]


Review comment: use :quoting :ansi parameter to honeysql/format.

--- src/datomish/db.cljc
+++ src/datomish/db.cljc
@@ -35,6 +35,13 @@
        (uncaughtException [_ thread ex]
          (println ex "Uncaught exception on" (.getName thread))))))

+;; Setting this to something else will make your output more readable,
+;; but not automatically safe for use.
+(def sql-quoting-style :ansi)
+
+(defn- sql-format [args]
+  (sql/format args :quoting :ansi))
+
 (defprotocol IClock
   (now
     [clock]
@@ -126,7 +133,7 @@
           {:select [:e :a :v :tx [1 :added]] ;; TODO: generalize columns.
            :from   [:all_datoms]
            :where  (cons :and (map #(vector := %1 %2) [:e :a :v] (take-while (comp not nil?) [e a v])))} ;; Must drop nils.
-          (sql/format)
+          (sql-format)

           (s/all-rows (:sqlite-connection db))
           (<?)
@@ -141,7 +148,7 @@
           {:select [:e :a :v :tx [1 :added]] ;; TODO: generalize columns.
            :from   [:all_datoms]
            :where  [:and [:= :a a] [:= :v v] [:= :index_avet 1]]}
-          (sql/format)
+          (sql-format)

           (s/all-rows (:sqlite-connection db))
           (<?)
@@ -365,7 +372,7 @@
     (go-pair
       (let [rows (<? (->>
                        {:select [:ident :entid] :from [:idents]}
-                       (sql/format)
+                       (sql-format)
                        (s/all-rows sqlite-connection)))]
         (into {} (map (fn [row] [(<-SQLite (:ident row)) (:entid row)])) rows)))))

@@ -387,7 +394,7 @@
       (->>
         (->>
           {:select [:ident :attr :value] :from [:schema]}
-          (sql/format)
+          (sql-format)
           (s/all-rows sqlite-connection))
         (<?)


Remove debug stmt

Remove debug stmt

--- src/derive/core.cljs
+++ src/derive/core.cljs
@@ -230,7 +230,6 @@
   "Only primitive values and clojure data stuctures are legal
    (must support value equality)"
   [val]
-  (println (str "validating " val))
   (or (string? val)
       (number? val)
       (symbol? val)


Fix query names

Fix query names

--- src/formlogic/db.clj
+++ src/formlogic/db.clj
@@ -37,7 +37,7 @@
                                            query-params)]
     (if-not assignment-progress
       ;; Create new progress.
-      (let [assignment-progress-id (insert-progress! query-params)]
+      (let [assignment-progress-id (insert-progress<! query-params)]
         (log/debug "User" (:email user)
                    "started progress of assignment" assignment-id)
         (unique-result find-progress-by-assignment-id query-params))
@@ -56,7 +56,7 @@
                                          {:row-fn unwrap-arrays
                                           :connection tx})]
     (if-not question-progress
-      (let [question-progress-id (insert-question-progress! query-params)]
+      (let [question-progress-id (insert-question-progress<! query-params)]
         ;; Create new progress.
         (log/debug "Created question progress for question" question-id
                    "for user" (:email user))


Fix for JOIN messages not always starting with the '#' channel prefix.

--- Turbot/src/turbot/core.clj
+++ Turbot/src/turbot/core.clj
@@ -17,6 +17,11 @@

 (def empty-state {})

+(defn fix-channel [c]
+    (if (and c (not (= \# (first c))))
+        (str \# c)
+        c))
+
 (defn on-any [allow-privmsg event state-ref]
     (let [{:keys [
         channel
@@ -33,27 +38,28 @@
             (doseq [[c {:keys [users]}] @state-ref]
                 (if (some #{nick} users)
                     (on-any allow-privmsg (assoc event :channel c) state-ref)))
-            (if (= (= doing "PRIVMSG") allow-privmsg)
-                (dosync
-                    (if-let [channel-obj ((@irc :channels) channel)] (ref-set state-ref
-                        (assoc @state-ref channel
-                            (assoc (@state-ref channel)
-                                :users (sort (map first (channel-obj :users)))
-                                :topic (channel-obj :topic)))))
-                    (if channel
-                        (ref-set state-ref (assoc-in @state-ref [channel :recentlines]
-                            (vec (take 1000
-                                (concat (:recentlines (@state-ref channel))
-                                    [(into {} (filter val {
-                                        :nick nick
-                                        :newnick new-nick
-                                        :doing doing
-                                        :message message
-                                        :target target
-                                        :reason reason
-                                        :isaction action?
-                                        :topic topic
-                                    }))])))))))))))
+                (if (= (= doing "PRIVMSG") allow-privmsg)
+                    (let [channel (fix-channel channel)]
+                        (dosync
+                            (if-let [channel-obj ((@irc :channels) channel)] (ref-set state-ref
+                                (assoc @state-ref channel
+                                    (assoc (@state-ref channel)
+                                        :users (sort (map first (channel-obj :users)))
+                                        :topic (channel-obj :topic)))))
+                            (if channel
+                                (ref-set state-ref (assoc-in @state-ref [channel :recentlines]
+                                    (vec (take 1000
+                                        (concat (:recentlines (@state-ref channel))
+                                            [(into {} (filter val {
+                                                :nick nick
+                                                :newnick new-nick
+                                                :doing doing
+                                                :message message
+                                                :target target
+                                                :reason reason
+                                                :isaction action?
+                                                :topic topic
+                                            }))]))))))))))))

 (defn web-handler [{uri :uri} state-ref]
     (condp = uri


fix cljsbuild config retriever from hanging if none found in project.clj

--- src-cljs/cuttle/exec.cljs
+++ src-cljs/cuttle/exec.cljs
@@ -88,7 +88,7 @@
         js-options (js-obj "cwd" path)
         callback (fn [error stdout stderr]
                    (let [project (read-string stdout)]
-                     (put! out-chan project)))]
+                     (put! out-chan (or project {}))))]
     (js-exec cmd js-options callback)
     out-chan))


tmp fix - seems to ensure that a DCL is used even when we are not at the repl

--- dada-swt/src/main/clojure/org/dada/swt/client.clj
+++ dada-swt/src/main/clojure/org/dada/swt/client.clj
@@ -16,6 +16,8 @@

 (defn -main [& args]

+  (.setContextClassLoader (Thread/currentThread) (clojure.lang.RT/makeClassLoader))
+
   (def ^SessionManager session-manager (.getBean #^BeanFactory (ClassPathXmlApplicationContext. "client.xml") "sessionManager"))

   (def ^Model *remote-metamodel*  (.find session-manager "MetaModel" "MetaModel"))


Simplify crypto ns interface and make uniform access to block and stream ciphers.

--- src/buddy/core/crypto.clj
+++ src/buddy/core/crypto.clj
@@ -48,121 +48,91 @@

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Private api: type declarations
+;; Cipher protocol declaration.
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 (defprotocol Cipher
-  (initialize! [obj params] "Initialize cipher"))
-
-(defprotocol BlockCipher
-  "Protocol that defines interface for all
-  supported block ciphers by `buddy`."
+  (initialize! [obj params] "Initialize cipher")
   (process-block! [obj input] "Encrypt/Decrypt a block of bytes."))

-(defprotocol StreamCipher
-  "Protocol that defines interface for all
-  supported stream ciphers by `buddy`."
-  (process-bytes! [obj input] "Encrypt/Decrypt a set of bytes."))
-
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Private api: internal implementation.
+;; Implementation details.
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

-(defn- make-block-cipher-params
-  "Generate CipherParameters instance from
-  clojure hash map."
-  [params]
-  (if (:iv params)
-    (let [keyparams (make-block-cipher-params (dissoc params :iv))]
-      (ParametersWithIV. keyparams (:iv params)))
-    (KeyParameter. (:key params))))
+(def ^{:private true
+       :doc "Check if op is a valid op keyword."
+       :static true}
+  valid-op? (comp boolean #{:encrypt :decrypt}))

 (defn- initialize-cipher!
-  [engine params]
-  (let [encrypt (case (:op params)
+  [engine {:keys [iv key op]}]
+  {:pre [(bytes? key)
+         (valid-op? op)]}
+  (let [params (if (nil? iv)
+                 (KeyParameter. key)
+                 (ParametersWithIV. (KeyParameter. key) iv))
+        encrypt (condp = op
                   :encrypt true
-                  :decrypt false
-                  true)
-        cipher-params (make-block-cipher-params (dissoc params :op))]
-    (.init engine encrypt cipher-params)))
+                  :decrypt false)]
+    (.init engine encrypt params)
+    engine))

-(defn- process-block-with-block-cipher!
+(defn- block-cipher-process!
   [engine input]
   (let [buffer (byte-array (.getBlockSize engine))]
     (.processBlock engine input 0 buffer 0)
     buffer))

-(defn- process-bytes-with-stream-cipher!
+(defn- stream-cipher-process!
   [engine input]
   (let [len    (count input)
         buffer (byte-array len)]
     (.processBytes engine input 0 len buffer 0)
     buffer))

-(extend-type CBCBlockCipher
-  Cipher
-  (initialize! [engine params]
-    (initialize-cipher! engine params))
-
-  BlockCipher
-  (process-block! [engine input]
-    (process-block-with-block-cipher! engine input)))
-
-(extend-type SICBlockCipher
-  Cipher
-  (initialize! [engine params]
-    (initialize-cipher! engine params))
-
-  BlockCipher
-  (process-block! [engine input]
-    (process-block-with-block-cipher! engine input)))
-
-(extend-type OFBBlockCipher
-  Cipher
-  (initialize! [engine params]
-    (initialize-cipher! engine params))
-
-  BlockCipher
-  (process-block! [engine input]
-    (process-block-with-block-cipher! engine input)))
-
-(extend-type ChaChaEngine
-  Cipher
-  (initialize! [engine params]
-    (initialize-cipher! engine params))
-
-  StreamCipher
-  (process-bytes! [engine input]
-    (process-bytes-with-stream-cipher! engine input)))
-
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Public Api: Low level
+;; Low level api.
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

-(defn- cipher-supported?
-  [^Keyword cipher]
-  (contains? *supported-block-ciphers* cipher))
+(defn- algorithm-supported?
+  [^Keyword type ^Keyword cipher]
+  (condp = type
+    :block (contains? *supported-block-ciphers* cipher)
+    :stream (contains? *supported-stream-ciphers* cipher)))

-(defn- stream-cipher-supported?
-  [^Keyword cipher]
-  (contains? *supported-stream-ciphers* cipher))
-
-(defn- ciphermode-supported?
+(defn- mode-supported?
   [^Keyword mode]
   (contains? *supported-modes* mode))

-(defn engine
+(defn block-cipher
   "Block cipher engine constructor."
-  [^Keyword cipher ^Keyword mode]
-  {:pre [(cipher-supported? cipher)
-         (ciphermode-supported? mode)]}
-  (let [modefactory   (mode *supported-modes*)
-        enginefactory (cipher *supported-block-ciphers*)]
-    (modefactory (enginefactory))))
+  [^Keyword alg ^Keyword mode]
+  {:pre [(algorithm-supported? :block alg)
+         (mode-supported? mode)]}
+  (let [modefactory (get *supported-modes* mode)
+        enginefactory (get *supported-block-ciphers* alg)
+        engine (modefactory (enginefactory))]
+    (reify Cipher
+      (initialize! [_ params]
+        (initialize-cipher! engine params))
+      (process-block! [_ input]
+        (block-cipher-process! engine input)))))

-(defn stream-engine
+(defn stream-cipher
   "Stream cipher engine constructor."
-  [^Keyword cipher]
-  {:pre [(stream-cipher-supported? cipher)]}
-  (let [enginefactory (cipher *supported-stream-ciphers*)]
-    (enginefactory)))
+  [^Keyword alg]
+  {:pre [(algorithm-supported? :stream alg)]}
+  (let [enginefactory (get *supported-stream-ciphers* alg)
+        engine (enginefactory)]
+    (reify Cipher
+      (initialize! [_ params]
+        (initialize-cipher! engine params))
+      (process-block! [_ input]
+        (stream-cipher-process! engine input)))))
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; High level api.
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+;; TODO


typo.

typo.

--- integration-tests/messaging/project.clj
+++ integration-tests/messaging/project.clj
@@ -17,4 +17,4 @@
   :dependencies [[org.immutant/messaging _]]
   :profiles {:default [:base :system :user :provided :dev :integs]
              :integs {:just-here "to remove a dumb warning"}}
-  :test-paths ["../../messaging/test"]))
+  :test-paths ["../../messaging/test"])


Extract the error table into a separate function

--- src/catalog/web/views.clj
+++ src/catalog/web/views.clj
@@ -190,6 +190,27 @@
                     (format "/%s/%s/%s/upload-confirm" year issue (name :all-formats))
                     errors)]])))

+(defn- error-table
+  [problems]
+  [:table#productions.table.table-striped
+   [:thead [:tr (map #(vec [:th %]) ["Record-id" "Title" "Field" "Value" "Error"])]]
+   [:tbody
+    (for [[errors {:keys [record-id title] :as item}] problems]
+      (if (map? errors)
+        (for [[k v] errors]
+          [:tr
+           [:td record-id]
+           [:td (h title)]
+           [:td k]
+           [:td (h (item k))]
+           [:td (str v)]])
+        [:tr
+         [:td record-id]
+         [:td (h title)]
+         [:td ]
+         [:td ]
+         [:td (pr-str errors)]]))]])
+
 (defn upload-confirm [request year issue fmt file]
   (let [{tempfile :tempfile} file
         path (.getPath tempfile)
@@ -203,24 +224,7 @@
          identity
          year issue
          [:h1 "Confirm Upload"]
-         [:table#productions.table.table-striped
-          [:thead [:tr (map #(vec [:th %]) ["Record-id" "Title" "Field" "Value" "Error"])]]
-          [:tbody
-           (for [[errors {:keys [record-id title] :as item}] problems]
-             (if (map? errors)
-               (for [[k v] errors]
-                 [:tr
-                  [:td record-id]
-                  [:td (h title)]
-                  [:td k]
-                  [:td (h (item k))]
-                  [:td (str v)]])
-               [:tr
-                [:td record-id]
-                [:td (h title)]
-                [:td ]
-                [:td ]
-                [:td (pr-str errors)]]))]]
+         (error-table problems)
          (form/form-to
           {:enctype "multipart/form-data"}
           [:post (format "/%s/%s/%s/upload" year issue (name fmt))]


now creates projects from json

now creates projects from json

--- src/cion_clojure/core.clj
+++ src/cion_clojure/core.clj
@@ -44,4 +44,5 @@
 				(do
 					(def projects (map :project (:projects (json/read-str (slurp (:file command-line-values)) :key-fn keyword))))
 					(def project-names (map :name projects))
-					(print project-names))))))+					(defn create-project-on-ci-server [project-name] (create-project project-name ci-server-url))
+					(map create-project-on-ci-server project-names))))))


Configure 1ms grace for regular async conn manager

This is to avoid long waiting when the connection manager
gets shut down from the callback.

--- src/clj_http/conn_mgr.clj
+++ src/clj_http/conn_mgr.clj
@@ -179,7 +179,11 @@

                              :else regular-strategy-registry)]
     (doto
-        (PoolingNHttpClientConnectionManager. (default-ioreactor) registry)
+        (PoolingNHttpClientConnectionManager. (-> (IOReactorConfig/custom)
+                                                  (.setShutdownGracePeriod 1)
+                                                  .build
+                                                  DefaultConnectingIOReactor.)
+                                              registry)
       (.setMaxTotal 1))))

 (definterface ReuseableAsyncConnectionManager)


Skip saving category/district fixtures to firebase

--- src/cljs/geoforms/db.cljs
+++ src/cljs/geoforms/db.cljs
@@ -353,13 +353,13 @@
    :alert-districts? true
    :comments         "better UX please. Thanks."}])

-(load-fixtures!
- categories-ref
- ["Shops" "Security" "Green" "Other..."])
-
-(load-fixtures!
- districts-ref
- ["Manhattan" "Brooklyn" "Queens" "Other districts"])
+;(load-fixtures!
+ ;categories-ref
+ ;["Shops" "Security" "Green" "Other..."])
+
+;(load-fixtures!
+ ;districts-ref
+ ;["Manhattan" "Brooklyn" "Queens" "Other districts"])

 (defn init-session []
   ;; TODO: to be more robust, should really handle failures here,


Add simple documentation

Add simple documentation

--- src/cljs/kulive/view.cljs
+++ src/cljs/kulive/view.cljs
@@ -28,21 +28,8 @@
                            nil)
            :placeholder "Course ID, Title, Professor, etc..."}]]]])))

-(defn course-component
-  "Individual course in search result list"
-  [course]
-  [:li [:a (kulive.model/course-hm->str course)]])
-
-(defn courses-component []
-  (let [courses (re-frame/subscribe [:courses-to-display])]
-    (fn []
-      [:div.row
-       [:div {:class "u-full-width"}
-        [:ul
-         (for [course @courses]
-           ^{:key (key course)} [course-component course])]]])))
-
 (defn course-row-component [course]
+  "Row with course info"
   (let [search-tokens (re-frame/subscribe [:search-tokens])]
     (fn []
       [:tr
@@ -54,6 +41,7 @@
        [:td (get-in (val course) [:kr :classification])]])))

 (defn courses-table-component []
+  "Table of course search results"
   (let [courses-to-display (re-frame/subscribe [:courses-to-display])]
     (fn []
       [:div [:table.u-full-width
@@ -73,6 +61,7 @@
                [:p.test "No classes to show"])]])))

 (defn my-courses-component []
+  "List of my selected courses"
   (let [my-courses (re-frame/subscribe [:my-courses])
         credit-sum (re-frame/subscribe [:sum-credits-in-my-courses])]
     (fn []
@@ -90,7 +79,6 @@
    [:div {:style {:margin-top "4%" :margin-bottom "5%"}}
     [:h2 "KU Live"]
     [search-component]
-    ;; [courses-component]
     [courses-table-component]
     [my-courses-component]
     [timetable-component]


Setup for handlers.

Setup for handlers.

--- src/cljs/org_ui/core.cljs
+++ src/cljs/org_ui/core.cljs
@@ -9,7 +9,8 @@

 (enable-console-print!)

-(defonce app-state (atom {}))
+(defonce app-state (atom {:title "Org UI"
+                          :data {}}))

 (defn uuid []
   (uuid-string (make-random-uuid)))
@@ -37,9 +38,9 @@
 (defn receive-msg! [server-ch]
   (go-loop []
     (let [{:keys [message]} (<! server-ch)
-          uuid (get message "in-response-to")
-          data (get message "data")]
-      (when-let [handler (get @requests uuid)]
+          message (clojure.walk/keywordize-keys message)
+          {:keys [in-response-to data]} message]
+      (when-let [handler (get @requests in-response-to)]
         (handler data)
         (swap! requests dissoc uuid))
       (recur))))
@@ -53,6 +54,21 @@
       (send-loop server-ch))))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Handler
+
+(defmulti handle-event
+  (fn [event msg app owner] event))
+
+(defmethod handle-event :list [_ msg app owner]
+  (om/update! app :data msg))
+
+(defmethod handle-event :default [_ msg app owner])
+
+(defn create-handler [event app owner]
+  (fn [msg]
+    (handle-event event msg app owner)))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Views

 (defn application [cursor owner]
@@ -60,13 +76,13 @@
     om/IWillMount
     (will-mount [_]
       (send-msg! {"id" (uuid)
-                  "command" "list"} println))
+                  "command" "list"} (create-handler :list cursor owner)))
     om/IRender
     (render [_]
       (html
        [:div.container
         [:div.page-header
-         [:h1 "Org UI"]]]))))
+         [:h1 (:title cursor)]]]))))

 (defn main []
   (setup-connection)


Cleanup comment.

Cleanup comment.

--- src/cljs/primes/core.cljs
+++ src/cljs/primes/core.cljs
@@ -21,8 +21,8 @@
 ;;; the numbers's prime factorization.
 ;;;
 ;;; So, 1 is at the origin, and higher powers of primes are further
-;;; aways from the origin. Expressed as vectors, some small numbers
-;;; look like:
+;;; aways from the origin. Expressed as vectors in this multi-dimensional
+;;; space, some small numbers look like:
 ;;;
 ;;;   2 - [1, 0, 0, 0, 0, ...]
 ;;;   3 - [0, 1, 0, 0, 0, ...]


Refactoring event code

Refactoring event code

Signed-off-by: Christian Romney <78cb0763aa1664e7dd86fd558ae466f67ab17826@pointslope.com>

--- src/cljs/trumpet/app.cljs
+++ src/cljs/trumpet/app.cljs
@@ -105,6 +105,17 @@
    :Abmaj [:Ab :Bb :C :Db :Eb :F :G :Ab]})

 ;; -- components --
+
+(defn- create-event-handler
+  "Accepts a state atom, a key and a function, and
+  returns a callback function that sets the given key
+  value in the state map after transforming the event
+  target value with the function."
+  [state k f]
+  (fn [event]
+    (let [value (.. event -target -value)]
+      (swap! state assoc k (f value)))))
+
 (defn key-name-select-option
   "A dropdown box option for a particular musical key"
   [state idx k]
@@ -118,7 +129,7 @@
    [:h1 "Concert Pitch"]
    [:select {:style {:font-size "1.2em"}
              :value (:current-key @state)
-             :onChange #(swap! state assoc :current-key (keyword (.. % -target -value)))}
+             :onChange (create-event-handler state :current-key keyword)}
     (doall
      (map-indexed (partial key-name-select-option state)
                   (sort (keys Bb-transpositions))))]])
@@ -136,7 +147,7 @@
    [:h1 "Octave"]
    [:select {:style {:font-size "1.2em"}
              :value (:octave @state)
-             :onChange #(swap! state assoc :octave (js/parseInt (.. % -target -value)))}
+             :onChange (create-event-handler state :octave js/parseInt)}
     (doall
      (map-indexed (partial octave-select-option state)
                   (range 0 9)))]])
@@ -151,8 +162,7 @@
 (defn note-cell
   [state idx note]
   ^{:key (str "note-" idx)}
-  [:th {:onClick (fn [e]
-                   (sound/play (sound/octave note (:octave @state))))
+  [:th {:onClick #(sound/play (sound/octave note (:octave @state)))
         :style {:text-align "center"
                 :font-weight "bold"
                 :padding "4px"


removing xml dependency

removing xml dependency

--- src/co/nclk/flax/core.clj
+++ src/co/nclk/flax/core.clj
@@ -5,7 +5,6 @@
             [cheshire.generate :refer [add-encoder encode-str]]
             [clojure.pprint :refer [pprint]]
             [clojure.tools.logging :refer [log]]
-            [clojure.data.xml :as xml]
             [co.nclk.flax.node :refer [invoke destroy node-manager]]
             [co.nclk.flax.data :refer [resolve-module resolve-program]]
             [stencil.parser :refer [parse]]


Save memory by not accumulating input into a string

--- src/io/sarnowski/swagger1st/parser.clj
+++ src/io/sarnowski/swagger1st/parser.clj
@@ -1,5 +1,6 @@
 (ns io.sarnowski.swagger1st.parser
   (:require [clojure.string :as string]
+            [clojure.java.io :as java.io]
             [cheshire.core :as json]
             [cheshire.generate :refer [add-encoder]]
             [clojure.tools.logging :as log]
@@ -88,10 +89,9 @@
         content-type (string/trim content-type)
         allowed-content-types (set (get request-definition "consumes"))
         ; TODO make this configurable
-        supported-content-types {json-content-type? (fn [body] (let [slurped-body (slurp body)
-                                                                     keywordize? (get parameter-definition "x-swagger1st-keywordize" true)
-                                                                     json-body (json/parse-string slurped-body keywordize?)]
-                                                                     json-body))}]
+        supported-content-types {json-content-type? (fn [body]
+                                                      (let [keywordize? (get parameter-definition "x-swagger1st-keywordize" true)]
+                                                        (json/parse-stream (java.io/reader body) keywordize?)))}]

     (if (allowed-content-types content-type)                ; TODO could be checked on initialization of ring handler chain
       (if-let [deserialize-fn (second (first (filter (fn [[pattern _]] (re-matches pattern content-type)) supported-content-types)))]


making the core.async deep consistent with figwheel

--- src/leiningen/new/figwheel/project.clj
+++ src/leiningen/new/figwheel/project.clj
@@ -6,7 +6,7 @@

   :dependencies [[org.clojure/clojure "1.7.0"]
                  [org.clojure/clojurescript "1.7.170"]
-                 [org.clojure/core.async "0.2.374"]{{#om?}}
+                 [org.clojure/core.async "0.2.371"]{{#om?}}
                  [sablono "0.3.6"]
                  [org.omcljs/om "0.9.0"]{{/om?}}{{#reagent?}}
                  [reagent "0.5.0"]{{/reagent?}}]


[#163] Parallelize check_perms calls

[#163] Parallelize check_perms calls

--- api/src/clojure/org/akvo/flow_api/boundary/survey.clj
+++ api/src/clojure/org/akvo/flow_api/boundary/survey.clj
@@ -36,7 +36,7 @@
   "Given a list of surveys, returns the ones that the user has access to"
   [remote-api user-email surveys]
   (let [instances (into #{} (map :instance-id surveys))
-        mapping-fn (if (> (count instances) 2) pmap map)]
+        mapping-fn (if (> (count instances) 1) pmap map)]
     (survey/keep-allowed-to-see
       surveys
       (mapping-fn (fn [instance]


Chnged headline

Chnged headline

--- src/webapp/client/views/main_view.cljs
+++ src/webapp/client/views/main_view.cljs
@@ -30,7 +30,7 @@
 (defn-html homepage-html []
   (el :div {} [
         (header-text "Clojure on Coils" )
-        (body-text "Java/Clojure web development without the pain")
+        (body-text "The synchronous client side web framework")
 ]))

 (defn-html what-html []


Switch to storing adapter uuid in history

--- src/yetibot/core/observers/history.clj
+++ src/yetibot/core/observers/history.clj
@@ -7,8 +7,8 @@
 (defn history-observer
   [event-info]
   (trace "history obs" event-info)
-  (let [{:keys [adapter room]} (:chat-source event-info)]
-    (h/add {:chat-source-adapter adapter
+  (let [{:keys [adapter room uuid]} (:chat-source event-info)]
+    (h/add {:chat-source-adapter uuid
             :chat-source-room room
             :user-id (-> event-info :user :id str)
             :user-name (-> event-info :user :mention-name str)


fix image resize bug

fix image resize bug

--- iwaswhere-web/src/clj/iwaswhere_web/img_route.clj
+++ iwaswhere-web/src/clj/iwaswhere_web/img_route.clj
@@ -15,7 +15,7 @@
     (let [filename (str f/data-path "/images/" filename)
           file (io/file filename)
           exif (i/extract-exif file)
-          orientation (get exif "Orientation")
+          orientation (get exif "Orientation" "")
           rotate-fn (cond (s/includes? orientation "(Rotate 90 CW)")
                           (rotate-270-counter-clockwise-fn)
                           (s/includes? orientation "(Rotate 180)")


fix failing docker http timeout test

fix failing docker http timeout test

--- test/clj/swarmpit/docker/http_test.clj
+++ test/clj/swarmpit/docker/http_test.clj
@@ -3,8 +3,7 @@
   (:require [clojure.test :refer :all]
             [swarmpit.test :refer :all]
             [swarmpit.docker.http :refer :all])
-  (:import (clojure.lang ExceptionInfo)
-           (java.util.concurrent TimeoutException)))
+  (:import (clojure.lang ExceptionInfo)))

 (use-fixtures :once dind-socket-fixture)

@@ -38,7 +37,7 @@

   (testing "timeout"
     (is (thrown?
-          TimeoutException
+          ExceptionInfo #"Docker error: Request timeout"
           (with-redefs [swarmpit.docker.http/timeout 0]
             (get "/services")))))


Add a test for long strings round-tripping through node-sqlite3. Fixes #65.

--- test/datomish/promise_sqlite_test.cljs
+++ test/datomish/promise_sqlite_test.cljs
@@ -55,3 +55,32 @@
           (is (= rows [{:b 2}])))
         (finally
           (<? (s/close db)))))))
+
+(deftest-async test-long-strings
+  ;; Make a string that's nicely over the 32K limit in node-sqlite3/#668.
+  (let [s (str "be" (apply str (repeat 330000 "la")) "st")]
+    (with-tempfile [t (tempfile)]
+      (let [db (<? (ps/open (.-name t)))]
+        (try
+          (<? (s/execute! db ["CREATE TABLE strs (x INTEGER, a TEXT)"]))
+          (<? (s/execute! db ["INSERT INTO strs VALUES (42, ?)" s]))
+
+          ;; Test retrieval via binding comparison.
+          (is (= (<? (s/all-rows db ["SELECT x FROM strs WHERE a = ?" s]))
+                 [{:x 42}]))
+
+          ;; Test computation.
+          (is (= (<? (s/all-rows db ["SELECT length(a) AS yvr FROM strs"]))
+                 [{:yvr 660004}]))
+          (is (= (<? (s/all-rows db ["SELECT length(?) AS yvr FROM strs" s]))
+                 [{:yvr 660004}]))
+
+          ;; Test round-tripping.
+          (is (= (<? (s/all-rows db ["SELECT x, a FROM strs"]))
+                 [{:x 42, :a s}]))
+          (is (= (<? (s/all-rows db ["SELECT ? AS yyz FROM strs" s]))
+                 [{:yyz s}]))
+
+          (finally
+            (<? (s/close db))))
+        ))))


Test how create-job handles NPE

Test how create-job handles NPE

--- test/emender_jenkins/rest_api_test.clj
+++ test/emender_jenkins/rest_api_test.clj
@@ -535,3 +535,17 @@
                                                            :headers {"Content-Type" "application/json"}
                                                            :body "{\"status\":\"error\",\"jobName\":\"test-Test_Product-1.0-Test_Book-en-US\",\"command\":\"create_job\",\"message\":\"The name of job is wrong\"}"})))))

+(deftest test-create-job-NPE
+    "Check the function emender-jenkins.rest-api/create-job."
+    (testing "the function emender-jenkins.rest-api/create-job."
+        (with-redefs [jenkins-api/create-job (fn [jenkins-url jenkins-auth include-jenkins-reply? job-name git-repo branch credentials-id metadata-directory metadata]
+                                                 (jenkins-api/ok-response-structure job-name "create_job" include-jenkins-reply? "created"))
+                      jenkins-api/start-job  (fn [jenkins-url jenkins-auth include-jenkins-reply? job-name]
+                                                 (jenkins-api/ok-response-structure job-name "build" include-jenkins-reply? "added to queue"))
+                      read-request-body      (fn [request] nil)
+                      reload-job-list        (fn [response request] response)
+                      send-response          (fn [response request] response)]
+                      (is (= (create-job default-request) {:status  400
+                                                           :headers {"Content-Type" "application/json"}
+                                                           :body "{\"status\":\"error\",\"command\":\"create_job\",\"message\":\"invalid or missing input\"}"})))))
+


Update Jetty to 9.4.22.v20191022

Update Jetty to 9.4.22.v20191022

--- ring-jetty-adapter/project.clj
+++ ring-jetty-adapter/project.clj
@@ -7,7 +7,7 @@
   :dependencies [[org.clojure/clojure "1.7.0"]
                  [ring/ring-core "1.7.1"]
                  [ring/ring-servlet "1.7.1"]
-                 [org.eclipse.jetty/jetty-server "9.4.19.v20190610"]]
+                 [org.eclipse.jetty/jetty-server "9.4.22.v20191022"]]
   :aliases {"test-all" ["with-profile" "default:+1.8:+1.9" "test"]}
   :profiles
   {:dev {:dependencies [[clj-http "2.2.0"]]


CMR-1385: Tweaking comments on the single thread lookup cache.

--- common-lib/src/cmr/common/cache/single_thread_lookup_cache.clj
+++ common-lib/src/cmr/common/cache/single_thread_lookup_cache.clj
@@ -1,7 +1,7 @@
 (ns cmr.common.cache.single-thread-lookup-cache
-  "The single thread lookup cache is a cache that will only execute the lookup function passed
-  when retrieving a value on a single thread. It should be used when the lookup function is very
-  expensive and you want to minimize the number of times it's called.
+  "Defines a cache that serializes all calls to execute the lookup function on a single thread. It
+  should be used when the lookup function is very expensive and you want to minimize the number of
+  times it's called.

   When the value is already is cached the request for a value is very fast. When the value is not
   cached a request is queued to fetch the value. A separate thread processes these requests off a
@@ -27,6 +27,8 @@
     ;; Attempt to read messages from the lookup request channel until it's closed.
     (u/while-let
       [{:keys [key lookup-fn response-channel]} (<!! lookup-request-channel)]
+      ;; Get the requested value and put it back on the response channel.
+      ;; The delegate will determine if calling the lookup function is necessary.
       (>!! response-channel (c/get-value delegate-cache key lookup-fn)))))

@@ -35,11 +37,11 @@
    ;; The underlying cache this will delegate to.
    delegate-cache

-   ;; A core.async channel. Each message will contain a map with the :lookup-fn, :key, and :response-channel
+   ;; A core.async channel containing requests to lookup a value that was initially missed on the
+   ;; cache. Each message will contain a map with the :lookup-fn, :key, and :response-channel
    lookup-request-channel

-   ;; The single thread channel per cache instance that will listen for messages on the
-   ;; lookup-request-channel.
+   ;; The channel returned when creating the single thread processes messages off the lookup-request-channel.
    lookup-process-thread-channel
    ]


fix bug in convert-clj-domain-spec when :persistence-opts isn't there

--- elephantdb-cascalog/src/clj/elephantdb/cascalog/conf.clj
+++ elephantdb-cascalog/src/clj/elephantdb/cascalog/conf.clj
@@ -13,10 +13,11 @@
 (defn convert-clj-domain-spec
   [{:keys [coordinator shard-scheme num-shards persistence-options]}]
   {:pre [(and coordinator shard-scheme num-shards)]}
-  (when persistence-options
+  (if persistence-options
     (let [args (DomainSpec$Args.)]
       (set! (.persistenceOptions args) (HashMap. persistence-options))
-      (DomainSpec. coordinator shard-scheme num-shards args))))
+      (DomainSpec. coordinator shard-scheme num-shards args))
+    (DomainSpec. coordinator shard-scheme num-shards)))

 (defn read-domain-spec
   "A domain spec is stored with shards in the VersionedStore. Look to


(SERVER-294) restore test to match agent behavior

The agent still sends "binary" as the accept header.

--- test/integration/puppetlabs/services/jruby/request_handler_test.clj
+++ test/integration/puppetlabs/services/jruby/request_handler_test.clj
@@ -66,7 +66,7 @@
                options                 (merge ssl-request-options
                                               {:body (ByteArrayInputStream.
                                                        raw-byte-arr)
-                                               :headers {"accept" "application/octet-stream"
+                                               :headers {"accept" "binary"
                                                          "content-type" "application/octet-stream"}})
                response (http-client/put (str "https://localhost:8140/"
                                               "puppet/v3/file_bucket_file/md5/"


added test to changed atom-schema

added test to changed atom-schema

--- test/org/domaindrivenarchitecture/pallet/crate/managed_ide_test.clj
+++ test/org/domaindrivenarchitecture/pallet/crate/managed_ide_test.clj
@@ -21,15 +21,32 @@
     [schema.core :as s]
     [org.domaindrivenarchitecture.pallet.crate.managed-ide :as sut]))

+(def basic-config
+  {:project-config {:test-location ["test-repo"]}
+   :ide-user :some-user}
+  )
+(def basic-atom-config
+   {:atom
+    {:settings (hash-set :install-aws-workaround)
+     :plugins ["proto-repl"]}}
+  )
+(def wrong-atom-config
+   {:atom
+    {:settings (hash-set :install-aws-workaround)
+     :plugins [:proto-repl]}}
+  )
+
 (deftest test-schema
-  (testing
-    "test the ide schema"
-    (is (s/validate sut/DdaIdeConfig {:ide-user :some-user}))
+  (testing
+    "test the ide schema"
+    (is (s/validate sut/DdaIdeConfig basic-config))
+    (is (s/validate sut/DdaIdeConfig (merge basic-config basic-atom-config)))
+    (is (thrown? Exception (s/validate sut/DdaIdeConfig (merge basic-config wrong-atom-config))))
     (is (thrown? Exception (s/validate sut/DdaIdeConfig {:unsuported-key :unsupported-value})))
     ))

 (deftest plan-def
-  (testing
-    "test plan-def"
+  (testing
+    "test plan-def"
     (is sut/with-dda-ide)
-    ))+    ))


generating seats

generating seats

--- src-cljs/kmc_booking/core.cljs
+++ src-cljs/kmc_booking/core.cljs
@@ -64,7 +64,15 @@
 						(map #(vector :div.row_num %) (range 1 14))])

 				[:div#left_side_house.side_house
-					(into [:div] (map #(vector :div.col_num %) (reverse (range 37 40))))
+					(let [xs (reverse (range 37 40))
+					      ys (range 1 14)]
+						(concat
+							(into [:div] (map #(vector :div.col_num %) xs))
+							(map (fn[[y x]] (vector :div.seat {:x x :y y} (pr-str [x y])))
+								(for [y ys x xs] [y x])
+								)
+							)
+						)
 				]
 				[:div#left_house.house
 					(into [:div] (map #(vector :div.col_num %) (reverse (range 20 37))))


hashtag and mention count in stats

hashtag and mention count in stats

--- iwaswhere-web/src/cljs/iwaswhere_web/ui/journal.cljs
+++ iwaswhere-web/src/cljs/iwaswhere_web/ui/journal.cljs
@@ -35,7 +35,7 @@
            [:span.show-more-btn [:span.fa.fa-plus-square] " show more"]]))
       (when-let [stats (:stats store-snapshot)]
         [:div (:entry-count stats) " entries, " (:node-count stats) " nodes, " (:edge-count stats) " edges, "
-         (count (:hashtags store-snapshot)) " hashtags, " (count (:mentions store-snapshot)) " people"])
+         (count (:hashtags cfg)) " hashtags, " (count (:mentions cfg)) " people"])
       [p/pomodoro-stats-view filtered-entries]
       (when-let [ms (:duration-ms store-snapshot)]
         [:div.stats (str "Query completed in " ms "ms")])]


Document api/list-artifacts

Document api/list-artifacts

--- src/grimoire/api.clj
+++ src/grimoire/api.clj
@@ -19,9 +19,10 @@
   dispatch)

 (defmulti list-artifacts
-  "Returns a sequence of Thing[:artifact] representing all Maven
-  artifacts in the queried datastore that belong to the specified
-  Thing[:group]."
+  "Succeeds yielding a sequence of Thing[:artifact] representing all Maven
+  artifacts in the queried datastore that belong to the specified Group. Will
+  Succeed with an empty result if there are no known artifacts. Fails if the
+  group is unknown or if another exception is encountered."

   {:arglists '[[config group-thing]]}
   dispatch)


Remove attempted sanitization

Remove attempted sanitization

--- src/grimoire/api.clj
+++ src/grimoire/api.clj
@@ -202,8 +202,9 @@

 (defn write-meta
   "Writes a map, being documentation data, into the datastore as specified by
-  config at the def denoted by thing. The expectation of this operation is that
-  you just take (meta the-var) and slam it right into write-meta
+  config at the def denoted by thing. Note that non-readable structures such as
+  Namespaces must be stringified or removed by users. This function provides no
+  sanitization.

   Expected keys:
   - :ns       -> string naming the namespace, namespace itself, or a symbol
@@ -224,30 +225,8 @@
   [config thing data]
   (let [thing  (ensure-thing thing)
         _      (assert thing)
-        _      (assert (isa? :def thing))
         handle (thing->meta-handle config thing)
-        _      (assert handle)
-        data   (-> data
-                   (update :ns  (fn [x]
-                                  (cond (instance? clojure.lang.Namespace x)
-                                        ,,(name (ns-name x))
-                                        (string? x)
-                                        ,,x
-                                        (symbol? x)
-                                        ,,(name x)
-                                        :else
-                                        ,,(throw
-                                           (Exception.
-                                            (str "Don't know how to stringify " x))))))
-                   (update :name (fn [x]
-                                   (cond (symbol? x)
-                                         ,,(name x)
-                                         (string? x)
-                                         ,,x
-                                         :else
-                                         ,,(throw
-                                            (Exception.
-                                             (str "Don't know how to stringify " x)))))))]
+        _      (assert handle)]
     (spit handle (pr-str data))
     nil))


some cleanup

some cleanup

--- src/holston/core.clj
+++ src/holston/core.clj
@@ -24,22 +24,14 @@
   ;; Auth stuff
   (GET "/auth/login" {params :query-params}
        (friend/authenticated (ring.util.response/redirect (str "/index.html#" (params "path")))))
+  (friend/logout (ANY "/auth/logout" request (ring.util.response/redirect "/")))

   ;; Dummy stuff which "tests" now authorization, to be removed
   (GET "/authlink" request
        (friend/authorize #{::user} "Authorized page."))
-  (GET "/authlink2" request
-       (friend/authorize #{::user} "Authorized page 2."))
   (GET "/admin" request
        (friend/authorize #{::admin} "Only admins can see this page."))

-  ;; Authentication stuff
-  (GET "/logged-in" request
-       (println "logged-in stuff" (str (:cemerick.friend/identity (:session request))))
-       (str (:cemerick.friend/identity (:session request))))
-  (GET "/dlogin" request
-       (friend/authenticated "Dummy login page"))
-  (friend/logout (ANY "/logout" request (ring.util.response/redirect "/")))

   (files "/")
   (compojure.route/not-found "404 not found"))


ignore private defn's and defmacro's

ignore private defn's and defmacro's

--- scripts/cljs-api-parser/src/core.clj
+++ scripts/cljs-api-parser/src/core.clj
@@ -202,10 +202,12 @@
 (defmulti parse-form*
   (fn [form]
     (cond
-      (= 'defn (first form))
+      (and (= 'defn (first form))
+           (not (:private (meta (second form)))))
       "defn"

-      (= 'defmacro (first form))
+      (and (= 'defmacro (first form))
+           (not (:private (meta (second form)))))
       "defmacro"

       (and (= 'def (first form))


Simplified definition of reports.core/app since we currently do not need to thread in any middleware.

--- reports/src/reports/core.clj
+++ reports/src/reports/core.clj
@@ -34,5 +34,4 @@
   (quartzite-scheduler/initialize)
   (quartzite-scheduler/start))

-(def app
-  (-> (handler/api endpoints)))
+(def app (handler/api endpoints))


delaney.clj: (invariant) only tests connectedness in un-anchored version

--- clojure/org/gavrog/clojure/delaney.clj
+++ clojure/org/gavrog/clojure/delaney.clj
@@ -3,7 +3,7 @@
   (:use (clojure test)
         (org.gavrog.clojure partition)
         (org.gavrog.clojure util))
-  (:import (org.gavrog.joss.dsyms.basic DelaneySymbol DSMorphism)
+  (:import (org.gavrog.joss.dsyms.basic DelaneySymbol)
            (java.io Writer)))

 (defprotocol IDSymbol
@@ -144,15 +144,13 @@

 (defn invariant
   ([ds D]
-    (let [idcs (indices ds), t (traversal ds idcs [D])]
-      (do
-        (assert (>= 1 (count (for [[_ i _] t :when (= :root i)] true)))
-                "Symbol must be connected")
-        (protocol ds idcs t))))
+    (let [idcs (indices ds)]
+      (protocol ds idcs (traversal ds idcs [D]))))
   ([ds]
     (when (pos? (size ds))
-      (reduce lexicographically-smallest
-              (for [D (elements ds)] (invariant ds D))))))
+      (do (assert (connected? ds) "Symbol must be connected")
+        (reduce lexicographically-smallest
+                (for [D (elements ds)] (invariant ds D)))))))

 (defn walk [ds D & idxs]
   "Returns the result of applying the D-symbol operators on ds with the


throw on var not found

throw on var not found

--- src/main/clojure/clojure/tools/analyzer/passes/js/validate.clj
+++ src/main/clojure/clojure/tools/analyzer/passes/js/validate.clj
@@ -13,6 +13,12 @@

 (defmulti -validate :op)
 (defmethod -validate :default [ast] ast)
+
+(defmethod -validate :maybe-class [{:keys [class env] :as ast}]
+  (throw (ex-info (str "Cannot resolve: " class)
+                  (merge {:sym class
+                          :ast prewalk ast cleanup}
+                         (source-info env)))) )

 (defn validate-tag [t {:keys [env] :as ast}]
   (let [tag (ast t)]


Fixed padding in transaction list. #1880

--- src/status_im/ui/screens/wallet/transactions/styles.cljs
+++ src/status_im/ui/screens/wallet/transactions/styles.cljs
@@ -54,6 +54,8 @@
 (defstyle amount-time
   {:flex-direction  :row
    :justify-content :space-between
+   :padding-right   22
+   :padding-left    17
    :ios             {:padding-top 13}
    :android         {:padding-top 14}})

@@ -71,6 +73,8 @@

 (def address-row
   {:flex-direction :row
+   :padding-right  22
+   :padding-left   17
    :padding-top    4})

 (def address-item


make it keep the Selector and chane it in place

--- src/merlion/core.clj
+++ src/merlion/core.clj
@@ -92,6 +92,15 @@
               :c2
               :write)))))

+(defn poll-selector [bo timeout]
+  (if-not (zero? (.select bo timeout))
+    (let [ready (.selectedKeys bo)
+          v (doall (map (fn [k]
+                          {:channel (.channel k)
+                           :ops (.readyOps k)})
+                        ready))]
+      (.clear ready)
+      v)))

 (defn poll-channels [poll-set timeout]
   (with-open [bo (reduce (fn [s [channel & ops]]
@@ -99,13 +108,8 @@
                            s)
                          (Selector/open)
                          poll-set)]
-    (if-not (zero? (.select bo timeout))
-      (let [ready (.selectedKeys bo)]
-        (doall ; have to force evaluation of this before closing selector
-         (map (fn [k]
-                {:channel (.channel k)
-                 :ops (.readyOps k)})
-              ready))))))
+    (doall ; have to force evaluation of this before closing selector
+     (poll-selector bo timeout))))

 (deftest poll-test
   (testing "timeout"
@@ -140,8 +144,23 @@
       (doto s1
         (.configureBlocking false)))))

+(defn new-selector [channel ops]
+  (let [s (Selector/open)]
+    (.register channel s (poll-ops-mask ops))
+    s))
+
+(defn update-selector-for-writing [selector w]
+  (when-not (:eof? w)
+    (let [c (:to-channel w)]
+      (run! #(or (= c (.channel %)) (.cancel %)) (.keys selector))
+      (.register c selector (poll-ops-mask [:write]))
+    selector)))
+
+
 (defn backend [serversocket host port finished-ch]
-  (let [bytebuffer (ByteBuffer/allocate 8192)]
+  (let [bytebuffer (ByteBuffer/allocate 8192)
+        selector (new-selector serversocket [:accept])
+        write-selector (Selector/open)]
     (loop [pending-write false
            downstreams-for-upstreams {}]
       ;; BACKPRESSURE - we do things in a very specific order.  This is
@@ -156,13 +175,11 @@
             upstreams (set (keys downstreams-for-upstreams))
             upstreams-for-downstreams
             (set/map-invert downstreams-for-upstreams)
-            poll-set
-            (if pending-write
-              [[(:to-channel pending-write) :write]]
-              (concat (map #(vector % :read ) downstreams)
-                      (map #(vector % :read ) upstreams)
-                      [[serversocket :accept]]))]
-        (let [ready (poll-channels poll-set 1000)
+            sel (or
+                 (and pending-write
+                      (update-selector-for-writing write-selector pending-write))
+                 selector)]
+        (let [ready (poll-selector sel 10000)
               ready-channels (set (map :channel ready))
               readable-ds
               (first (filter (fn [s]
@@ -185,11 +202,12 @@
             (and pending-write (:eof? pending-write))
             (let [fch (:from-channel pending-write)
                   tch (:to-channel pending-write)]
-              (.close fch)
-              (.close tch)
+              (.close fch)              ;this also causes removal of these
+              (.close tch)              ;channels from the selector
               (recur nil (dissoc downstreams-for-upstreams fch tch)))

-            ;; First deal with any unwritten buffer to/from the downstream.  We do not
+            ;; First deal with any unwritten buffer to/from the
+            ;; downstream.  We do not
             ;; get past this point until the in-flight buffer is disposed of

             pending-write
@@ -222,21 +240,18 @@
             ;; Note this may block in connect(), I haven't decided if that's
             ;; bad or not
             (get ready-channels serversocket)
-            (let [sock (accept-connection serversocket)]
-              (recur nil
-                     (if sock
-                       (assoc downstreams-for-upstreams
-                              sock
-                              (doto (SocketChannel/open)
-                                (.connect (InetSocketAddress. host port))
-                                (.configureBlocking false)))
-                       downstreams-for-upstreams)))
+            (if-let [sock (accept-connection serversocket)]
+              (let [ds (doto (SocketChannel/open)
+                         (.connect (InetSocketAddress. host port))
+                         (.configureBlocking false))
+                    mask (poll-ops-mask [:read])]
+                (.register sock selector mask)
+                (.register ds selector mask)
+                (recur nil (assoc downstreams-for-upstreams sock ds)))
+              (recur nil downstreams-for-upstreams))
+
             :default
-            (do
-              (println "timeout")
-              (recur pending-write downstreams-for-upstreams))
-
-
+            (recur pending-write downstreams-for-upstreams)
             ))))))

@@ -257,7 +272,7 @@
   (let [existing (keys backends)
         wanted (keys (:backends config))
         unwanted (set/difference (set existing) (set wanted))]
-    (println ["unwanted " unwanted])
+;    (println ["unwanted " unwanted])
     (run! close! (map #(:chan (get backends %)) unwanted))
     (reduce (fn [m [n v]]
               (let [a (parse-address (:listen-address v))]


Pulled in CSS from cljspages css dir as well as pages css dir (might not need to merge that soon after all)

--- src/omhome/ssgen.clj
+++ src/omhome/ssgen.clj
@@ -13,7 +13,9 @@
             [optimus.strategies :refer [serve-live-assets]]))

 (defn get-assets []
-  (assets/load-assets "pages" [#".*"]))
+  (concat
+    (assets/load-assets "pages" [#".*"])
+    (assets/load-assets "cljspages/css" [#".*"])))

 (defn layout-page [req page]
   (html5


threadsafe index

threadsafe index

--- src/ontrail/core.clj
+++ src/ontrail/core.clj
@@ -70,7 +70,7 @@

   (GET "/rest/v1/sports" [] (json-response (get-distinct-sports {})))

-  (GET "/rest/v1/parse-time/:time" [time]
+  (GET "/rest/v1/parse-time/:time" [time] ;; XXX throws
        (let [duration (to-human-time (parse-duration time))]
          (if (= "" duration)
            (json-response {:message "invalid-duration"} 400)


Make interop namespace load other namespaces lazily

This avoids AOT compilation of complete dependency tree (including
clojure.core, tools.reader...) which causes problems with projects which
use other versions of these libraries.

Fixes #339

--- src/onyx/interop.clj
+++ src/onyx/interop.clj
@@ -2,16 +2,17 @@
   (:gen-class :name onyx.interop
               :methods [^:static [write_batch [clojure.lang.IPersistentMap] clojure.lang.IPersistentMap]
                         ^:static [read_batch [clojure.lang.IPersistentMap] clojure.lang.IPersistentMap]])
-  (:require [onyx.peer.function :refer [write-batch read-batch]]
-            [onyx.peer.pipeline-extensions :refer [PipelineInput Pipeline]]))
+  (:require [onyx.peer.pipeline-extensions :refer [PipelineInput Pipeline]]))

 (defn -write_batch
   [event]
-  (write-batch event))
+  (require 'onyx.peer.function)
+  ((resolve 'onyx.peer.function/write-batch) event))

 (defn -read_batch
   [event]
-  (read-batch event))
+  (require 'onyx.peer.function)
+  ((resolve 'onyx.peer.function/read-batch) event))

 (gen-interface
   :name onyx.IPipelineInput


enhanced :paredit-split-sexp

enhanced :paredit-split-sexp

--- src/paredit/core.clj
+++ src/paredit/core.clj
@@ -541,9 +541,9 @@
                  "(hel|lo)" "(hel)| (lo)",
                  "[hello |world]" "[hello]| [world]",
                  "{hello brave |new world}" "{hello brave}| {new world}",
-                 ;"{|}" "{|}"
-                 ;"(foo|)" "(foo|)"
-                 ;"(|foo)" "(|foo)"
+                 "{|}" "{}| {}"
+                 "(foo|)" "(foo)| ()"
+                 "({|})" "({}| {})"
                  }]
       #_["M-J"    :paredit-join-sexps
                 {"(hello)| (world)" "(hello| world)",
@@ -1003,26 +1003,29 @@
         (let [[l r] (normalized-selection rloc offset length)
               parent (cond
                        (= (str \") (loc-tag l)) l ; stay at the same level, and let the code take the correct open/close puncts, e.g. \" \"
-                       :else (if-let [nl (zip/up (parse-node l))] nl l))
+                       :else (if-let [nl (zip/up l)] nl l))
               open-punct (loc-tag parent)
-              close-punct (*brackets* open-punct)
-              replace-text (str close-punct " " open-punct)
-              [replace-offset
-               replace-length] (if (and
-                                     (not= (str \space) (loc-tag l))
-                                     (or
-                                       (= (str \") (loc-tag l))
-                                       (not (and
-                                              (sel-match-normalized? offset length [l r])
-                                              (= offset (start-offset (parse-node l)))))))
-                                 [offset 0]
-                                 (let [start (or (some #(when-not (= (str \space) (loc-tag %)) (end-offset %)) (previous-leaves l)) offset)
-                                       end (or (some #(when-not (= (str \space) (loc-tag %)) (start-offset %)) (next-leaves l)) 0)]
-                                   [start (- end start)]))
-                               new-offset (+ replace-offset (.length close-punct))]
-          (-> t (assoc-in [:text] (str-replace text replace-offset replace-length replace-text))
-            (assoc-in [:offset] new-offset)
-            (update-in [:modifs] conj {:offset replace-offset :length replace-length :text replace-text})))
+              _ (spy open-punct)
+              close-punct (*brackets* open-punct)]
+          (if-not close-punct
+            t
+            (let [replace-text (str close-punct " " open-punct)
+                  [replace-offset
+                   replace-length] (if (and
+                                         (not= (str \space) (loc-tag l))
+                                         (or
+                                           (= (str \") (loc-tag l))
+                                           (not (and
+                                                  (sel-match-normalized? offset length [l r])
+                                                  (= offset (start-offset (parse-node l)))))))
+                                     [offset 0]
+                                     (let [start (or (some #(when-not (= (str \space) (loc-tag %)) (end-offset %)) (previous-leaves l)) offset)
+                                           end (or (some #(when-not (= (str \space) (loc-tag %)) (start-offset %)) (next-leaves l)) 0)]
+                                       [start (- end start)]))
+                                   new-offset (+ replace-offset (.length close-punct))]
+              (-> t (assoc-in [:text] (str-replace text replace-offset replace-length replace-text))
+                (assoc-in [:offset] new-offset)
+                (update-in [:modifs] conj {:offset replace-offset :length replace-length :text replace-text})))))
         t))))

 (defn wrap-with-balanced


Tweak doc formatting

Tweak doc formatting

--- src/app/cljs/one/repmax/mongohq.cljs
+++ src/app/cljs/one/repmax/mongohq.cljs
@@ -151,20 +151,20 @@
   "Issues a request to the given URL to find documents.

    Optional keyword argments:
-   * :skip         Used for pagination in MongoHQ. Indicates the number of documents to
-                   'skip' over when determining which documents to return from a query.
-                   Defaults to 0.
-   * :limit        The maximum number of documents to return in this request.
-                   Defaults to 100 (i.e., the maximum limit supported by MongoHQ).
-   * previous-docs A sequence of documents produced by previous calls to this same
-                   function. Since we may need to call MongoHQ multiple times to 'paginate'
-                   through the list of documents, we can pass the results from previous calls
-                   to subsequent calls. After the final request to MongoHQ, all results are
-                   combined and passed to the on-success function.
-                   Defaults to an empty Vector.
-   * on-success    The function that will be invoked upon successful completion of the
-                   request. The function must accept a single argument: a sequence of
-                   documents.
+   * :skip          Used for pagination in MongoHQ. Indicates the number of documents to
+                    'skip' over when determining which documents to return from a query.
+                    Defaults to 0.
+   * :limit         The maximum number of documents to return in this request.
+                    Defaults to 100 (i.e., the maximum limit supported by MongoHQ).
+   * :previous-docs A sequence of documents produced by previous calls to this same
+                    function. Since we may need to call MongoHQ multiple times to 'paginate'
+                    through the list of documents, we can pass the results from previous calls
+                    to subsequent calls. After the final request to MongoHQ, all results are
+                    combined and passed to the on-success function.
+                    Defaults to an empty Vector.
+   * :on-success    The function that will be invoked upon successful completion of the
+                    request. The function must accept a single argument: a sequence of
+                    documents.
   "
   [api-key url & {:keys [skip limit previous-docs on-success]
                   :or   {skip 0


faster time diff with unchecked-subtract

--- src/preflex/util.clj
+++ src/preflex/util.clj
@@ -38,7 +38,7 @@
   (^long []
     (System/currentTimeMillis))
   (^long [^long start-millis]
-    (- (System/currentTimeMillis) start-millis)))
+    (unchecked-subtract (System/currentTimeMillis) start-millis)))

 (defn now-nanos
@@ -46,7 +46,7 @@
   (^long []
     (System/nanoTime))
   (^long [^long start-nanos]
-    (- (System/nanoTime) start-nanos)))
+    (unchecked-subtract (System/nanoTime) start-nanos)))

 (defn now-iso-8601


[VERY TEMP COMMIT] Draggable `stop` evt handler

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

--- src/cljs/cljs_nusmods/timetable.cljs
+++ src/cljs/cljs_nusmods/timetable.cljs
@@ -462,6 +462,14 @@
        :moduleCode moduleCode, :lessonType lessonType, :lessonGroup lessonLabel,
        :divElem $divElem})))

+(def ^{:doc     "Sequence of `TimetableLessonInfo` objects augmented with the
+                 `:divElem`, `:moduleCode`, `:lessonType`, `:lessonGroup` keys.
+                 These are 'fake' lessons created when a selected lesson is
+                 being dragged by the user, in order for him/her to switch to
+                 a different lesson group for that lesson type."
+       :private true}
+  Lessons-Created-By-Draggable nil)
+
 ; Forward declaration
 (declare add-module-lesson-group)

@@ -487,7 +495,49 @@
             (map (fn [[lessonGroup _]]
                    (add-module-lesson-group moduleCode lessonType lessonGroup
                                             bgColorCssClass false))
-                 unselectedLessonGroupsMap))])))
+                 unselectedLessonGroupsMap))]
+      (set! Lessons-Created-By-Draggable augmentedTTLessonInfoSeq))))
+
+; TODO: Account for a user dropping the draggable lesson onto a different lesson
+;       from the one selected.
+(defn- lesson-draggable-stop-evt-handler-maker
+  "Returns a function used as the `stop` event handler for a draggable lesson."
+  []
+  (fn [evt ui]
+    (let [$divElemSeq (map #(:divElem %1) Lessons-Created-By-Draggable)
+
+          daysAndRowsAffected
+          (reduce (fn [dayVec ttLessonInfo]
+                    (update-in dayVec [(:day ttLessonInfo)]
+                               (fn [rowSet]
+                                 (conj rowSet (:rowNum ttLessonInfo)))))
+                  [#{} #{} #{} #{} #{}]
+                  Lessons-Created-By-Draggable)
+
+          ; This should not be placed here.
+          ; We should only remove such rows after we update the `Timetable`
+          ; global
+          emptyRowsToRemove
+          (map (fn [[day rowSet]]
+                 (let [ttDay (get-timetable-day day)]
+                   [day,
+                    (sort > (filter (fn [rowNum]
+                                      (and (> rowNum 1)
+                                           (zero? (count (nth ttDay rowNum)))))
+                                    rowSet))]))
+               (map vector (range (count daysAndRowsAffected))
+                    daysAndRowsAffected))]
+      (doseq [augTTLessonInfo Lessons-Created-By-Draggable]
+        (timetable-remove-lesson (:day augTTLessonInfo)
+                                 (:rowNum augTTLessonInfo)
+                                 (dissoc augTTLessonInfo :divElem :day
+                                         :rowNum)))
+      (doseq [$divElem $divElemSeq]
+        (.remove $divElem))
+      (doseq [[day rowsToRemove]]
+        (s)
+        )
+      )))

 ; TODO: Make lesson type with only a single lessongroup non-draggable
 (defn- make-added-lessons-draggable
@@ -503,7 +553,8 @@
                         "revert" (fn [] true)
                         "start"  (lesson-draggable-start-evt-handler-maker
                                    moduleCode lessonType lessonLabel
-                                   bgColorCssClass)))))
+                                   bgColorCssClass)
+                        "stop"   (lesson-draggable-stop-evt-handler-maker)))))

 (defn- add-module-lesson-group
   "Adds a lesson group of a module to the timetable.


Chat, kick, ban functions to write to the server. Not integrated into the UI yet.

--- src/clojure/uk/org/il2ssd/server.clj
+++ src/clojure/uk/org/il2ssd/server.clj
@@ -136,6 +136,38 @@
    provided in the second argument."
   [setting value]
   (write-socket (str "difficulty " setting " " value)))
+
+(defn chat
+  ([typekey message]
+   (let [oper (condp = typekey
+                :all " ALL")]
+     (write-socket (str "chat " message oper))))
+  ([typekey name message]
+   (let [oper (condp = typekey
+                :name " TO "
+                :number " TO# ")]
+     (write-socket (str "chat " message oper name)))))
+
+(defn kick
+  [typekey value]
+  (let [oper (condp = typekey
+               :name "kick "
+               :number "kick# ")]
+    (write-socket (str oper value))))
+
+(defn ban
+  ([opkey]
+   (let [oper (condp = opkey
+                :clear "CLEAR")]
+     (write-socket (str "ban " oper))))
+  ([opkey typekey value]
+   (let [oper (condp = opkey
+                :add "ADD "
+                :rem "REM ")
+         type (condp = typekey
+                :name "NAME "
+                :ip "IP ")]
+     (write-socket (str "ban " oper type value)))))

 (defn connect
   "### connect


Observers should see relevant version of aggregate

Observers now always get the aggregate version as it was after the
triggering events were committed.

--- src/rill/handler.clj
+++ src/rill/handler.clj
@@ -1,6 +1,6 @@
 (ns rill.handler
   (:require [clojure.tools.logging :as log]
-            [rill.aggregate :as aggregate]
+            [rill.aggregate :as aggregate :refer [update-aggregate]]
             [rill.event-store :as store]
             [rill.repository :refer [retrieve-aggregate-and-version retrieve-aggregate]]
             [rill.event-stream :as stream :refer [any-stream-version]]
@@ -42,19 +42,19 @@
 (declare notify-observers)

 (defn notify-observer
-  [event-store event observer-id handler-fn]
+  [event-store event observer-id handler-fn primary]
   (let [observer (retrieve-aggregate event-store observer-id)
-        primary (retrieve-aggregate event-store (message/primary-aggregate-id event))
         rest-aggregates (map #(retrieve-aggregate event-store %) (aggregate/aggregate-ids event))
         triggered-events (seq (apply handler-fn observer event primary rest-aggregates))]
     (when (and triggered-events
                (commit-events event-store observer-id any-stream-version triggered-events))
-      (concat triggered-events (mapcat (partial notify-observers event-store) triggered-events)))))
+      (let [new-observer (update-aggregate observer (filter #(= observer-id (message/primary-aggregate-id %)) triggered-events))]
+        (concat triggered-events (mapcat (partial notify-observers event-store new-observer) triggered-events))))))

 (defn notify-observers
-  [event-store event]
+  [event-store event primary]
   (mapcat (fn [[observer-id handler-fn]]
-            (notify-observer event-store event observer-id handler-fn))
+            (notify-observer event-store event observer-id handler-fn primary))
           (message/observers event)))

 (defn try-command
@@ -66,7 +66,9 @@
       (let [[status events :as response] (apply aggregate/handle-command primary-aggregate command rest-aggregates)]
         (case status
           :ok (if (commit-events event-store id version events)
-                (let [triggered (mapcat (partial notify-observers event-store) events)]
+                ;; TODO: Ensure observers see primary aggregate as it was before/after triggering event
+                (let [new-primary (update-aggregate primary-aggregate (filter #(= (message/primary-aggregate-id %) id) events))
+                      triggered (mapcat (partial notify-observers event-store new-primary) events)]
                   [:ok events (+ version (count events)) triggered])
                 [:conflict])
           :rejected response)))))


remove link to font file from pg head

remove link to font file from pg head

--- src/server/html.cljs
+++ src/server/html.cljs
@@ -11,7 +11,6 @@
 	  [:meta {:http-equiv "X-UA-Compatible" :content "IE=edge"}]
 	  [:title page-title]
 	  [:meta {:name "viewport" :content "width=device-width"}]
-	  [:link {:href "css/VT323.woff" :rel "stylesheet" :type"text/css"}]
 	  [:link {:rel "stylesheet" :href "css/t3tr0s.css"}]]
 	"<body>")


Componentize category and list views

Componentize category and list views

--- frontend/components/documentation.cljs
+++ frontend/components/documentation.cljs
@@ -53,6 +53,14 @@
                     :type "submit"}
            [:i.fa.fa-search]]])))))

+(defrender article-list [data]
+  (html
+   (doc-utils/render-haml-template "article_list" data)))
+
+(defrender docs-categories [data]
+  (html
+   (doc-utils/render-haml-template "categories" data)))
+
 (defrender front-page [app owner]
   (let [query-results (get-in app state/docs-articles-results-path)
         query (get-in app state/docs-articles-results-query-path)
@@ -74,10 +82,10 @@
        [:h4 "Having problems? Check these sections"]
        [:ul.articles.span4
         [:h4 "Getting started"]
-        (doc-utils/render-haml-template "article_list" {:article (:gettingstarted docs) :slug true})]
+        (om/build article-list {:article (:gettingstarted docs) :slug true})]
        [:ul.articles.span4
         [:h4 "Troubleshooting"]
-        (doc-utils/render-haml-template "article_list" {:article (:troubleshooting docs) :slug true})]]])))
+        (om/build article-list {:article (:troubleshooting docs) :slug true})]]])))

 (defn add-link-targets [node]
   (doseq [heading (sel node
@@ -111,7 +119,7 @@
        [:div
         (doc-utils/render-haml-template "docs_title" {:article doc})
         (if (:category doc)
-          (doc-utils/render-haml-template "article_list" (assoc doc :article doc))
+          (om/build article-list (assoc doc :article doc))
           (doc-utils/render-haml-template (:slug doc) (assoc doc :article doc)))]))))

 (defrender documentation [app owner opts]
@@ -125,7 +133,7 @@
       [:div.container.content
        [:div.row
         [:aside.span3
-         (doc-utils/render-haml-template "categories" {:categories categories})]
+         (om/build docs-categories {:categories categories})]
         [:div.offset1.span8
          (when subpage
            (om/build docs-search app))


Handle initial state when there are no previous traces

(reduce conj existing ...) was returning a seq instead of a vector for
the first received traces, because it was existing was nil instead of
the empty vector.

--- src/day8/re_frame/trace/events.cljs
+++ src/day8/re_frame/trace/events.cljs
@@ -485,22 +485,23 @@
 (rf/reg-event-db
   :epochs/receive-new-traces
   (fn [db [_ new-traces]]
-    (when-let [new-traces (->> (filter log-trace? new-traces)
-                               (sort-by :id))]
+    (if-let [new-traces (->> (filter log-trace? new-traces)
+                             (sort-by :id))]
       (let [number-of-epochs-to-retain (get-in db [:settings :number-of-epochs])
             events-to-ignore           (->> (get-in db [:settings :ignored-events]) vals (map :event-id) set)
-            existing-traces            (get-in db [:traces :all-traces])
-            new-traces                 (reduce conj existing-traces new-traces)
-            matches                    (:matches (metam/parse-traces new-traces))
+            previous-traces            (get-in db [:traces :all-traces] [])
+            all-traces                 (reduce conj previous-traces new-traces)
+            matches                    (:matches (metam/parse-traces all-traces))
             matches                    (remove (fn [match]
                                                  (let [event (get-in (metam/matched-event match) [:tags :event])]
                                                    (contains? events-to-ignore (first event)))) matches)
             retained-epochs            (take-last number-of-epochs-to-retain matches)
             first-id-to-retain         (:id (ffirst retained-epochs))
-            new-traces                 (into [] (drop-while #(< (:id %) first-id-to-retain)) new-traces)]
-        (rf/dispatch [:traces/update-traces new-traces])
-        (rf/dispatch [:epochs/update-epochs {:matches retained-epochs}])))
-    db))
+            retained-traces            (into [] (drop-while #(< (:id %) first-id-to-retain)) all-traces)]
+        (rf/dispatch [:epochs/update-epochs {:matches retained-epochs}])
+        (assoc-in db [:traces :all-traces] retained-traces))
+      ;; Else
+      db)))

 (rf/reg-event-db
   :epochs/update-epochs
@@ -544,12 +545,6 @@
     (re-frame.trace/reset-tracing!)
     (dissoc db :epochs :traces)))

-(rf/reg-event-db
-  :traces/update-traces
-  [(rf/path [:traces :all-traces])]
-  (fn [_ [_ traces]]
-    traces))
-
 ;;

 (rf/reg-event-db


Update api docs

Update api docs

--- modules/cache/src/main/clojure/immutant/cache.clj
+++ modules/cache/src/main/clojure/immutant/cache.clj
@@ -180,43 +180,56 @@
    core.cache/CacheProtocol. A name is the only required argument. If
    a cache by that name already exists, it will be restarted and all
    its non-durable entries lost. Use lookup to obtain a reference to
-   an existing cache. The following options are supported:
-
-   The following options are supported [default]:
+   an existing cache.
+
+   The following groups of options are supported, each listed with its
+   [default] value. A negative value for any numeric option means
+   \"unlimited\".
+
+   Eviction - Turned off by default, :max-entries may be set to
+   mitigate the risk of memory exhaustion. When :persist is also
+   enabled, evicted entries are written to disk, so that the entries
+   in the file store are a superset of those in RAM, transparently
+   reloaded upon request. If :persist is true, cache entries will
+   persist in the current directory. Override this by setting :persist
+   to a string naming the desired directory.
+
+     :max-entries The maximum number of entries allowed in the cache [-1]
+     :eviction    How entries are evicted when :max-entries is exceeded [:lirs]
+                    :lru, :lirs, or :unordered
+     :persist     Durability. If non-nil, data persists across server
+                    restarts in a file store; a string value names the
+                    directory [nil]
+
+   Expiration - The lifespan-oriented options (:ttl :idle :units)
+   become the default options for the functions of the Mutable
+   protocol. Any options passed to those functions override these. See
+   the Mutable protocol's doc for more info.
+
+     :ttl         The max time the entry will live before expiry [-1]
+     :idle        The time after which an entry will expire if not accessed [-1]
+     :units       The units for the values of :ttl and :idle [:seconds]
+
+   Replication - The replication mode defaults to :distributed when
+   clustered. When not clustered, the value of :mode is ignored, and
+   the cache will be :local. Setting :sync to false may yield a slight
+   performance increase at the risk of potential cache inconsistency.
+
      :mode        Replication mode [:distributed or :local]
                     :local, :invalidated, :distributed, or :replicated
      :sync        Whether replication occurs synchronously [true]
+
+   Transactions - Caches are transactional, by default.
+
      :tx          Whether the cache is transactional [true]
-     :persist     Durability. If non-nil, data persists across server
-                    restarts in a file store; a string value names the
-                    directory [nil]
-     :seed        A map of initial entries [nil]
      :locking     Transactional locking schemes [nil]
                     :optimisitic or :pessimistic
+
+   Miscellaneous:
      :encoding    :edn :fressian :json or :none [:edn]
-     :max-entries The maximum number of entries allowed in the cache [-1]
-     :eviction    How entries are evicted when :max-entries is exceeded [:lirs]
-                    :lru, :lirs, or :unordered
-     :ttl         The max time the entry will live before expiry [-1]
-     :idle        The time after which an entry will expire if not accessed [-1]
-     :units       The units for the values of :ttl and :idle [:seconds]
-     :config      An Infinispan Configuration instance that takes precedence
-                    over other possibly conflicting options [nil]
-
-   The replication mode defaults to :distributed when clustered. When
-   not clustered, the value of :mode is ignored, and the cache will
-   be :local.
-
-   If :persist is true, cache entries will persist in the current
-   directory. Override this by setting :persist to a string naming the
-   desired directory.
-
-   A negative value for any numeric option means \"unlimited\".
-
-   The lifespan-oriented options (:ttl :idle :units) become the
-   default options for the functions of the Mutable protocol. But any
-   options passed to those functions take precedence over these. See
-   the Mutable doc for more info."
+     :seed        A map of initial entries [nil]
+     :config      An Infinispan Configuration instance will take precedence
+                    over other possibly conflicting options [nil]"
   [name & {:keys [seed config] :as options}]
   (let [options (u/validate-options create options)]
     (cc/seed


A tip from the Tobinator!

A tip from the Tobinator!

--- modules/cache/src/main/clojure/immutant/cache.clj
+++ modules/cache/src/main/clojure/immutant/cache.clj
@@ -91,9 +91,8 @@
     (.setClassLoader config (.getContextClassLoader (Thread/currentThread)))
     (.setCacheMode config mode)
     (.defineConfiguration clustered-manager name config)
-    (let [cache (.getCache clustered-manager name)]
-      (.start cache)
-      cache)))
+    (doto (.getCache clustered-manager name)
+      (.start))))

 (defn local-cache
   ([] (InfinispanCache. (.getCache local-manager)))


More clean up and explicitification [IMMUTANT-103]

--- modules/cache/src/main/clojure/immutant/cache.clj
+++ modules/cache/src/main/clojure/immutant/cache.clj
@@ -19,7 +19,7 @@
   "Infinispan-backed implementations of core.cache and core.memoize
    protocols supporting multiple replication options and more."
   (:use [immutant.cache.core]
-        [immutant.codecs])
+        [immutant.codecs :only [encode decode]])
   (:require [clojure.core.cache :as cc]
             [clojure.core.memoize :as cm])
   (:import [clojure.core.memoize PluggableMemoization]))


When sending the :route-changed command, send route data without the vector wrap

--- src/keechma/controller_manager.cljs
+++ src/keechma/controller_manager.cljs
@@ -66,7 +66,7 @@
       :restart (restart-controller app-db-snapshot controller (running name) config)
       :stop (stop-controller app-db-snapshot (running name) config)
       :route-changed (do
-                       (send-command-to (running name) :route-changed [(:route-params config)])
+                       (send-command-to (running name) :route-changed (:route-params config))
                        app-db-snapshot))))

 (defn ^:private make-controller-change-applier [controllers controllers-params controllers-actions config]


fix broken RegExp for CLJS

fix broken RegExp for CLJS

--- src/main/clojure/cljs/compiler.cljc
+++ src/main/clojure/cljs/compiler.cljc
@@ -85,7 +85,8 @@
              munged-name
              (symbol (str munged-name "__$" depth))))))
      ;; String munging
-     (let [ss (string/replace (str s) #"\/(.)" ".$1") ; Division is special
+     (let [ss (string/replace (str s)
+                #?(:clj #"\/(.)" :cljs (js/RegExp. "\\/(.)")) ".$1") ; Division is special
            ss (apply str
                 (map #(if (reserved %) (str % "$") %)
                   (string/split ss #"(?<=\.)|(?=\.)")))