Reformatted server.clj by zprint

Reformatted server.clj by zprint

--- src/zg/server.clj
+++ src/zg/server.clj
@@ -11,7 +11,7 @@
 ;

 (ns zg.server
-    "Server module with functions to accept requests and send response back to users via HTTP.")
+  "Server module with functions to accept requests and send response back to users via HTTP.")

 (require '[ring.util.response      :as http-response])
 (require '[clojure.data.json       :as json])
@@ -24,375 +24,502 @@
 (require '[zg.dictionary-interface :as dictionary-interface])

 (defn get-user-name
-    [request]
-    (let [params        (:params request)
-          cookies       (:cookies request)
-          new-user-name (get params "user-name")
-          old-user-name (get (get cookies "user-name") :value)
-          user-name     (or new-user-name old-user-name)]
-        (log/info "old user name" old-user-name)
-        (log/info "new user name" new-user-name)
-        (log/info "effective -> " user-name)
-        user-name))
+  [request]
+  (let [params        (:params request)
+        cookies       (:cookies request)
+        new-user-name (get params "user-name")
+        old-user-name (get (get cookies "user-name") :value)
+        user-name     (or new-user-name old-user-name)]
+    (log/info "old user name" old-user-name)
+    (log/info "new user name" new-user-name)
+    (log/info "effective -> " user-name)
+    user-name))

 (defn get-title
-    [request]
-    (-> (:configuration request)
-        :display
-        :app-name))
+  [request]
+  (-> (:configuration request)
+      :display
+      :app-name))

 (defn get-emender-page
-    [request]
-    (-> (:configuration request)
-        :display
-        :emender-page))
+  [request]
+  (-> (:configuration request)
+      :display
+      :emender-page))

 (defn get-url-prefix
-    [request]
-    (-> (:configuration request)
-        :server
-        :url-prefix))
+  [request]
+  (-> (:configuration request)
+      :server
+      :url-prefix))

 (defn finish-processing
-    [request search-results sources classes message title emender-page mode]
-    (let [params        (:params request)
-          cookies       (:cookies request)
-          word          (get params "word")
-          user-name     (get-user-name request)
-          url-prefix    (get-url-prefix request)]
-        (log/info "Incoming cookies: " cookies)
-        (log/info "Word to search: " word)
-        (log/trace "Search results: " search-results)
-        (if user-name
-            (-> (http-response/response (html-renderer/render-front-page word user-name search-results sources classes message url-prefix title emender-page mode))
-                (http-response/set-cookie :user-name user-name {:max-age 36000000})
-                (http-response/content-type "text/html"))
-            (-> (http-response/response (html-renderer/render-front-page word user-name search-results sources classes message url-prefix title emender-page mode))
-                (http-response/content-type "text/html")))))
+  [request search-results sources classes message title emender-page mode]
+  (let [params        (:params request)
+        cookies       (:cookies request)
+        word          (get params "word")
+        user-name     (get-user-name request)
+        url-prefix    (get-url-prefix request)]
+    (log/info "Incoming cookies: " cookies)
+    (log/info "Word to search: " word)
+    (log/trace "Search results: " search-results)
+    (if user-name
+      (-> (http-response/response
+            (html-renderer/render-front-page word
+                                             user-name
+                                             search-results
+                                             sources
+                                             classes
+                                             message
+                                             url-prefix
+                                             title
+                                             emender-page
+                                             mode))
+          (http-response/set-cookie :user-name user-name {:max-age 36000000})
+          (http-response/content-type "text/html"))
+      (-> (http-response/response
+            (html-renderer/render-front-page word
+                                             user-name
+                                             search-results
+                                             sources
+                                             classes
+                                             message
+                                             url-prefix
+                                             title
+                                             emender-page
+                                             mode))
+          (http-response/content-type "text/html")))))

 (defn process-front-page
-    "Function that prepares data for the front page."
-    [request title emender-page]
-    (let [params         (:params request)]
-        (finish-processing request nil nil nil nil title emender-page :whitelist)))
+  "Function that prepares data for the front page."
+  [request title emender-page]
+  (let [params (:params request)]
+    (finish-processing request nil nil nil nil title emender-page :whitelist)))

 (defn process-atomic-typos
-    "Function that prepares data for the Atomic typos front page."
-    [request title emender-page]
-    (let [params         (:params request)
-          word           (get params "word")
-          search-results (if (not (empty? word))
-                             (db-interface/read-words-for-pattern word :atomic-typos))]
-        (finish-processing request search-results nil nil nil title emender-page :atomic-typos)))
+  "Function that prepares data for the Atomic typos front page."
+  [request title emender-page]
+  (let [params         (:params request)
+        word           (get params "word")
+        search-results (if (not (empty? word))
+                         (db-interface/read-words-for-pattern word
+                                                              :atomic-typos))]
+    (finish-processing request
+                       search-results
+                       nil
+                       nil
+                       nil
+                       title
+                       emender-page
+                       :atomic-typos)))

 (defn sources->map
-    [sources]
-    (into '{}
+  [sources]
+  (into '{}
         (for [source sources] [(:id source) (:source source)])))

 (defn classes->map
-    [classes]
-    (into '{}
-        (for [class classes] [(:id class) (:class class)])))
+  [classes]
+  (into '{}
+    (for [class classes] [(:id class) (:class class)])))

 (defn process-glossary
-    "Function that prepares data for the Glossary front page."
-    [request title emender-page]
-    (let [params         (:params request)
-          word           (get params "word")
-          search-results (if (not (empty? word))
-                             (db-interface/read-words-for-pattern word :glossary))
-          classes        (db-interface/read-word-classes)
-          classes-map    (classes->map classes)
-          sources        (db-interface/read-sources)
-          sources-map    (sources->map sources)]
-        (finish-processing request search-results sources-map classes-map nil title emender-page :glossary)))
+  "Function that prepares data for the Glossary front page."
+  [request title emender-page]
+  (let [params         (:params request)
+        word           (get params "word")
+        search-results (if (not (empty? word))
+                         (db-interface/read-words-for-pattern word :glossary))
+        classes        (db-interface/read-word-classes)
+        classes-map    (classes->map classes)
+        sources        (db-interface/read-sources)
+        sources-map    (sources->map sources)]
+    (finish-processing request
+                       search-results
+                       sources-map
+                       classes-map
+                       nil
+                       title
+                       emender-page
+                       :glossary)))

 (defn add-word-message
-    [word proper-word]
-    (if (seq word)
-        (if proper-word
-            (str "The following word has been added into the dictionary: '" word "'. Thank you!")
-            (str "Word with improper characters can not be added to the dictionary, sorry"))
-        "No word has been added..."))
+  [word proper-word]
+  (if (seq word)
+    (if proper-word
+      (str "The following word has been added into the dictionary: '" word "'. Thank you!")
+      (str "Word with improper characters can not be added to the dictionary, sorry"))
+      "No word has been added..."))

 (defn add-words-message
-    [words]
-    (if (seq words)
-        (if (> (count words) 1)
-            (str "The following " (count words) " words have been added into the dictionary: '" (clojure.string/join "," words) "'. Thank you!")
-            (str "The following word has been added into the dictionary: '" (clojure.string/join "," words) "'. Thank you!"))
-        "No words have been added..."))
+  [words]
+  (if (seq words)
+    (if (> (count words) 1)
+      (str "The following " (count words) " words have been added into the dictionary: '" (clojure.string/join "," words) "'. Thank you!")
+      (str "The following word has been added into the dictionary: '" (clojure.string/join "," words) "'. Thank you!"))
+    "No words have been added..."))

 (defn split-words
-    [input]
-    (if input
-        (->> (clojure.string/split input #"[\s,\n]")
-             (filter seq))))
+  [input]
+  (if input
+    (->> (clojure.string/split input #"[\s,\n]")
+         (filter seq))))

 (defn read-string-parameter
-    [request parameter-name]
-    (if-let [parameter-value (-> (:params request) (get parameter-name))]
-            (clojure.string/trim parameter-value)))
+  [request parameter-name]
+  (if-let [parameter-value (-> (:params request)
+                               (get parameter-name))]
+    (clojure.string/trim parameter-value)))

 (defn read-boolean-parameter
-    [request parameter-name]
-    (if-let [parameter-value (-> (:params request) (get parameter-name))]
-            (= "true" (clojure.string/trim parameter-value))
-            false))
+  [request parameter-name]
+  (if-let [parameter-value (-> (:params request)
+                               (get parameter-name))]
+    (= "true" (clojure.string/trim parameter-value))
+    false))

 (defn read-integer-parameter
-    [request parameter-name]
-    (if-let [parameter-value (-> (:params request) (get parameter-name))]
-            (Integer/parseInt (clojure.string/trim parameter-value))))
+  [request parameter-name]
+  (if-let [parameter-value (-> (:params request)
+                               (get parameter-name))]
+    (Integer/parseInt (clojure.string/trim parameter-value))))

 (defn process-add-word
-    "Add word provided by user (together with its description) to the blacklist or into atomic typos."
-    [request title emender-page mode]
-    (clojure.pprint/pprint (:params request))
-    (if (= mode :glossary)
-        (let [word            (read-string-parameter request "new-word")
-              description     (read-string-parameter request "description")
-              correct-forms   (read-string-parameter request "correct-forms")
-              incorrect-forms (read-string-parameter request "incorrect-forms")
-              internal        (read-boolean-parameter request "internal")
-              copyright       (read-boolean-parameter request "copyright")
-              source          (read-integer-parameter request "source")
-              class           (read-string-parameter request "class")
-              use-it          (read-string-parameter request "use_it")
-              user-name       (get-user-name request)
-              message         (add-word-message word true)
-              classes         (db-interface/read-word-classes)
-              classes-map     (classes->map classes)
-              sources         (db-interface/read-sources)
-              sources-map     (sources->map sources)]
-              (if (seq word)
-                  (dictionary-interface/store-word word description class use-it internal copyright source correct-forms incorrect-forms user-name :glossary))
-            (finish-processing request nil sources-map classes-map message title emender-page :glossary))
-        (let [word         (read-string-parameter request "new-word")
-              description  (read-string-parameter request "description")
-              correct-form (read-string-parameter request "correct-word")
-              word-class   (read-string-parameter request "class")
-              internal     (read-string-parameter request "internal")
-              copyright    (read-string-parameter request "copyright")
-              source       (read-string-parameter request "source")
-              proper-word  (dictionary-interface/proper-word-for-blacklist? word)
-              user-name    (get-user-name request)
-              message      (add-word-message word proper-word)
-              sources      (db-interface/read-sources)]
-              (if (and proper-word (seq word))
-                  (dictionary-interface/store-word word correct-form description user-name mode))
-            (finish-processing request nil sources nil message title emender-page mode))))
+  "Add word provided by user (together with its description) to the blacklist or into atomic typos."
+  [request title emender-page mode]
+  (clojure.pprint/pprint (:params request))
+  (if (= mode :glossary)
+    (let [word            (read-string-parameter request "new-word")
+          description     (read-string-parameter request "description")
+          correct-forms   (read-string-parameter request "correct-forms")
+          incorrect-forms (read-string-parameter request "incorrect-forms")
+          internal        (read-boolean-parameter request "internal")
+          copyright       (read-boolean-parameter request "copyright")
+          source          (read-integer-parameter request "source")
+          class           (read-string-parameter request "class")
+          use-it          (read-string-parameter request "use_it")
+          user-name       (get-user-name request)
+          message         (add-word-message word true)
+          classes         (db-interface/read-word-classes)
+          classes-map     (classes->map classes)
+          sources         (db-interface/read-sources)
+          sources-map     (sources->map sources)]
+      (if (seq word)
+        (dictionary-interface/store-word word
+                                         description
+                                         class
+                                         use-it
+                                         internal
+                                         copyright
+                                         source
+                                         correct-forms
+                                         incorrect-forms
+                                         user-name
+                                         :glossary))
+      (finish-processing request
+                         nil
+                         sources-map
+                         classes-map
+                         message
+                         title
+                         emender-page
+                         :glossary))
+    (let [word         (read-string-parameter request "new-word")
+          description  (read-string-parameter request "description")
+          correct-form (read-string-parameter request "correct-word")
+          word-class   (read-string-parameter request "class")
+          internal     (read-string-parameter request "internal")
+          copyright    (read-string-parameter request "copyright")
+          source       (read-string-parameter request "source")
+          proper-word  (dictionary-interface/proper-word-for-blacklist? word)
+          user-name    (get-user-name request)
+          message      (add-word-message word proper-word)
+          sources      (db-interface/read-sources)]
+      (if (and proper-word (seq word))
+        (dictionary-interface/store-word word
+                                         correct-form
+                                         description
+                                         user-name
+                                         mode))
+      (finish-processing request
+                         nil
+                         sources
+                         nil
+                         message
+                         title
+                         emender-page
+                         mode))))

 (defn process-add-words
-    [request title emender-page mode]
-    (let [input        (-> (:params request) (get "new-words"))
-          words        (split-words input)
-          proper-words (filter dictionary-interface/proper-word-for-whitelist? words)
-          user-name    (get-user-name request)
-          message      (add-words-message proper-words)]
-          (if (seq proper-words)
-              (dictionary-interface/store-words proper-words user-name mode))
-        (finish-processing request nil nil nil message title emender-page mode)))
+  [request title emender-page mode]
+  (let [input        (-> (:params request) (get "new-words"))
+        words        (split-words input)
+        proper-words (filter dictionary-interface/proper-word-for-whitelist? words)
+        user-name    (get-user-name request)
+        message      (add-words-message proper-words)]
+    (if (seq proper-words)
+      (dictionary-interface/store-words proper-words user-name mode))
+    (finish-processing request nil nil nil message title emender-page mode)))

 (defn perform-operation
-    [request mode]
-    (let [to-delete   (-> (:params request) (get "delete"))
-          to-undelete (-> (:params request) (get "undelete"))]
-          (log/info "to delete" to-delete)
-          (log/info "to undelete" to-undelete)
-          (if to-delete
-              (db-interface/delete-word to-delete mode))
-          (if to-undelete
-              (db-interface/undelete-word to-undelete mode))))
+  [request mode]
+  (let [to-delete   (-> (:params request)
+                        (get "delete"))
+        to-undelete (-> (:params request)
+                        (get "undelete"))]
+    (log/info "to delete" to-delete)
+    (log/info "to undelete" to-undelete)
+    (if to-delete
+      (db-interface/delete-word to-delete mode))
+    (if to-undelete
+      (db-interface/undelete-word to-undelete mode))))

 (defn process-whitelist
-    "Function that prepares data for the whitelist front page."
-    [request title emender-page]
-    ; perform the operation selected by user on the web UI (delete, undelete etc.)
-    (perform-operation request :whitelist)
-    (let [params         (:params request)
-          word           (get params "word")
-          search-results (if (not (empty? word))
-                             (db-interface/read-words-for-pattern word :whitelist))]
-        (finish-processing request search-results nil nil nil title emender-page :whitelist)))
+  "Function that prepares data for the whitelist front page."
+  [request title emender-page]
+  ; perform the operation selected by user on the web UI (delete, undelete etc.)
+  (perform-operation request :whitelist)
+  (let [params         (:params request)
+        word           (get params "word")
+        search-results (if (not (empty? word))
+                         (db-interface/read-words-for-pattern word :whitelist))]
+    (finish-processing request
+                       search-results
+                       nil
+                       nil
+                       nil
+                       title
+                       emender-page
+                       :whitelist)))

 (defn process-blacklist
-    "Function that prepares data for the blacklist front page."
-    [request title emender-page]
-    ; perform the operation selected by user on the web UI (delete, undelete etc.)
-    (perform-operation request :blacklist)
-    (let [params         (:params request)
-          word           (get params "word")
-          search-results (if (not (empty? word))
-                             (db-interface/read-words-for-pattern word :blacklist))]
-        (finish-processing request search-results nil nil nil title emender-page :blacklist)))
+  "Function that prepares data for the blacklist front page."
+  [request title emender-page]
+  ; perform the operation selected by user on the web UI (delete, undelete etc.)
+  (perform-operation request :blacklist)
+  (let [params         (:params request)
+        word           (get params "word")
+        search-results (if (not (empty? word))
+                         (db-interface/read-words-for-pattern word :blacklist))]
+    (finish-processing request
+                       search-results
+                       nil
+                       nil
+                       nil
+                       title
+                       emender-page
+                       :blacklist)))

 (defn process-all-words
-    "Read all words from the selected dictionary and display them to user on generated page."
-    [request title emender-page mode]
-    (perform-operation request mode)
-    (let [search-results (db-interface/read-all-words mode)
-          classes        (db-interface/read-word-classes)
-          classes-map    (classes->map classes)
-          sources        (db-interface/read-sources)
-          sources-map    (sources->map sources)]
-        (finish-processing request search-results sources-map classes-map nil title emender-page mode)))
+  "Read all words from the selected dictionary and display them to user on generated page."
+  [request title emender-page mode]
+  (perform-operation request mode)
+  (let [search-results (db-interface/read-all-words mode)
+        classes        (db-interface/read-word-classes)
+        classes-map    (classes->map classes)
+        sources        (db-interface/read-sources)
+        sources-map    (sources->map sources)]
+    (finish-processing request
+                       search-results
+                       sources-map
+                       classes-map
+                       nil
+                       title
+                       emender-page
+                       mode)))

 (defn process-deleted-words
-    "Read all deleted words from the selected dictionary and display them to user on generated page."
-    [request title emender-page mode]
-    (perform-operation request mode)
-    (let [search-results (db-interface/read-deleted-words mode)
-          classes        (db-interface/read-word-classes)
-          classes-map    (classes->map classes)
-          sources        (db-interface/read-sources)
-          sources-map    (sources->map sources)]
-        (finish-processing request search-results sources-map classes-map nil title emender-page mode)))
+  "Read all deleted words from the selected dictionary and display them to user on generated page."
+  [request title emender-page mode]
+  (perform-operation request mode)
+  (let [search-results (db-interface/read-deleted-words mode)
+        classes        (db-interface/read-word-classes)
+        classes-map    (classes->map classes)
+        sources        (db-interface/read-sources)
+        sources-map    (sources->map sources)]
+    (finish-processing request
+                       search-results
+                       sources-map
+                       classes-map
+                       nil
+                       title
+                       emender-page
+                       mode)))

 (defn process-active-words
-    "Read all nondeleted words from the selected dictionary and display them to user on generated page."
-    [request title emender-page mode]
-    (perform-operation request mode)
-    (let [search-results (db-interface/read-active-words mode)
-          classes        (db-interface/read-word-classes)
-          classes-map    (classes->map classes)
-          sources        (db-interface/read-sources)
-          sources-map    (sources->map sources)]
-        (finish-processing request search-results sources-map classes-map nil title emender-page mode)))
+  "Read all nondeleted words from the selected dictionary and display them to user on generated page."
+  [request title emender-page mode]
+  (perform-operation request mode)
+  (let [search-results (db-interface/read-active-words mode)
+        classes        (db-interface/read-word-classes)
+        classes-map    (classes->map classes)
+        sources        (db-interface/read-sources)
+        sources-map    (sources->map sources)]
+    (finish-processing request
+                       search-results
+                       sources-map
+                       classes-map
+                       nil
+                       title
+                       emender-page
+                       mode)))

 (defn read-changes-statistic
-    []
-    (db-interface/read-changes-statistic))
+  []
+  (db-interface/read-changes-statistic))

 (defn read-changes
-    []
-    (db-interface/read-changes))
+  []
+  (db-interface/read-changes))

 (defn read-changes-for-user
-    [user-name]
-    (db-interface/read-changes-for-user user-name))
+  [user-name]
+  (db-interface/read-changes-for-user user-name))

 (defn process-user-list
-    [request title mode]
-    (let [changes-statistic (read-changes-statistic)
-          changes           (read-changes)
-          user-name         (get-user-name request)
-          url-prefix        (get-url-prefix request)]
-        (log/info "stat"    changes-statistic)
-        (log/info "changes" changes)
-        (if user-name
-            (-> (http-response/response (html-renderer/render-users user-name changes-statistic changes url-prefix title mode))
-                (http-response/set-cookie :user-name user-name {:max-age 36000000})
-                (http-response/content-type "text/html"))
-            (-> (http-response/response (html-renderer/render-users user-name changes-statistic changes url-prefix title mode))
-                (http-response/content-type "text/html")))))
+  [request title mode]
+  (let [changes-statistic (read-changes-statistic)
+        changes           (read-changes)
+        user-name         (get-user-name request)
+        url-prefix        (get-url-prefix request)]
+    (log/info "stat"    changes-statistic)
+    (log/info "changes" changes)
+    (if user-name
+      (-> (http-response/response (html-renderer/render-users user-name
+                                                              changes-statistic
+                                                              changes
+                                                              url-prefix
+                                                              title
+                                                              mode))
+          (http-response/set-cookie :user-name user-name {:max-age 36000000})
+          (http-response/content-type "text/html"))
+      (-> (http-response/response (html-renderer/render-users user-name
+                                                              changes-statistic
+                                                              changes
+                                                              url-prefix
+                                                              title
+                                                              mode))
+          (http-response/content-type "text/html")))))

 (defn process-user-info
-    [request title mode]
-    (let [params            (:params request)
-          selected-user     (get params "name")
-          changes           (read-changes-for-user selected-user)
-          user-name         (get-user-name request)
-          url-prefix        (get-url-prefix request)]
-        (if user-name
-            (-> (http-response/response (html-renderer/render-user-info selected-user changes url-prefix title mode))
-                (http-response/set-cookie :user-name user-name {:max-age 36000000})
-                (http-response/content-type "text/html"))
-            (-> (http-response/response (html-renderer/render-user-info selected-user changes url-prefix title mode))
-                (http-response/content-type "text/html")))))
+  [request title mode]
+  (let [params        (:params request)
+        selected-user (get params "name")
+        changes       (read-changes-for-user selected-user)
+        user-name     (get-user-name request)
+        url-prefix    (get-url-prefix request)]
+    (if user-name
+      (-> (http-response/response (html-renderer/render-user-info selected-user
+                                                                  changes
+                                                                  url-prefix
+                                                                  title
+                                                                  mode))
+          (http-response/set-cookie :user-name user-name {:max-age 36000000})
+          (http-response/content-type "text/html"))
+      (-> (http-response/response (html-renderer/render-user-info selected-user
+                                                                  changes
+                                                                  url-prefix
+                                                                  title
+                                                                  mode))
+          (http-response/content-type "text/html")))))
+

 (defn words->json
-    [words]
-    (json/write-str words))
+  [words]
+  (json/write-str words))

 (defn words->text
-    [words]
-    (->> (for [word words :when (= (:deleted word) 0)]
-         (clojure.string/join "\t" [(:word word) (:description word) (:user word) (:datetime word)
-                                    (:class_name word) (:source_name word) (:product word)
-                                    (:use word) (:correct_forms word) (:incorrect_forms word)
-                                    (:see_also word) (:internal word) (:verified word) (:copyrighted word)]))
-         (clojure.string/join "\n")))
+  [words]
+  (->>
+    (for [word words
+          :when (= (:deleted word) 0)]
+      (clojure.string/join
+        "\t"
+        [(:word word) (:description word) (:user word) (:datetime word)
+         (:class_name word) (:source_name word) (:product word)
+         (:use word) (:correct_forms word) (:incorrect_forms word)
+         (:see_also word) (:internal word) (:verified word) (:copyrighted word)]))
+    (clojure.string/join "\n")))

 (defn words->xml
-    [words]
-    (with-out-str
-        (xml/emit {:tag :whitelist :content (for [word words]
-                                             {:tag :word :attrs {
-                                                             :added-by        (:user word)
-                                                             :date-time       (:datetime word)
-                                                             :deleted         (:deleted word)
-                                                             :description     (:description word)
-                                                             :class           (:class_name word)
-                                                             :source          (:source word)
-                                                             :product         (:product word)
-                                                             :use             (:use word)
-                                                             :correct_forms   (:correct_forms word)
-                                                             :incorrect_forms (:incorrect_forms word)
-                                                             :see_also        (:see_also word)
-                                                             :internal        (:internal word)
-                                                             :verified        (:verified word)
-                                                             :copyrighted     (:copyrighted word)}
-                                                             :content      [(:word word)]})})))
+  [words]
+  (with-out-str
+    (xml/emit {:tag :whitelist,
+               :content (for [word words]
+                          {:tag :word,
+                           :attrs {:added-by        (:user word),
+                                   :date-time       (:datetime word),
+                                   :deleted         (:deleted word),
+                                   :description     (:description word),
+                                   :class           (:class_name word),
+                                   :source          (:source word),
+                                   :product         (:product word),
+                                   :use             (:use word),
+                                   :correct_forms   (:correct_forms word),
+                                   :incorrect_forms (:incorrect_forms word),
+                                   :see_also        (:see_also word),
+                                   :internal        (:internal word),
+                                   :verified        (:verified word),
+                                   :copyrighted     (:copyrighted word)},
+                           :content [(:word word)]})})))

 (defn words->edn
-    [words]
-    (with-out-str
-        (clojure.pprint/pprint words)))
+  [words]
+  (with-out-str
+    (clojure.pprint/pprint words)))

 (defn words->csv
-    [words]
-    (with-out-str
-        (csv/write-csv *out* words)))
+  [words]
+  (with-out-str
+    (csv/write-csv *out* words)))

 (defn words->vector
-    [words]
-    (for [word words]
-            (vals word)))
+  [words]
+  (for [word words]
+    (vals word)))

 (defn process-wordlist-json
-    [request dictionary-type]
-    (let [search-results (db-interface/read-all-words dictionary-type)
-          json-output    (words->json search-results)]
-        (-> (http-response/response json-output)
-            (http-response/content-type "application/json"))))
+  [request dictionary-type]
+  (let [search-results (db-interface/read-all-words dictionary-type)
+        json-output    (words->json search-results)]
+    (-> (http-response/response json-output)
+        (http-response/content-type "application/json"))))

 (defn process-wordlist-text
-    [request dictionary-type]
-    (let [search-results (db-interface/read-all-words dictionary-type)
-          text-output    (words->text search-results)]
-        (-> (http-response/response text-output)
-            (http-response/content-type "text/plain"))))
+  [request dictionary-type]
+  (let [search-results (db-interface/read-all-words dictionary-type)
+        text-output    (words->text search-results)]
+    (-> (http-response/response text-output)
+        (http-response/content-type "text/plain"))))

 (defn process-wordlist-xml
-    [request dictionary-type]
-    (let [search-results (db-interface/read-all-words dictionary-type)
-          xml-output     (words->xml search-results)]
-        (-> (http-response/response xml-output)
-            (http-response/content-type "text/xml"))))
+  [request dictionary-type]
+  (let [search-results (db-interface/read-all-words dictionary-type)
+        xml-output     (words->xml search-results)]
+    (-> (http-response/response xml-output)
+        (http-response/content-type "text/xml"))))

 (defn process-wordlist-edn
-    [request dictionary-type]
-    (let [search-results (db-interface/read-all-words dictionary-type)
-          edn-output     (words->edn search-results)]
-        (-> (http-response/response edn-output)
-            (http-response/content-type "application/edn"))))
+  [request dictionary-type]
+  (let [search-results (db-interface/read-all-words dictionary-type)
+        edn-output     (words->edn search-results)]
+    (-> (http-response/response edn-output)
+        (http-response/content-type "application/edn"))))

 (defn process-wordlist-csv
-    [request dictionary-type]
-    (let [search-results (db-interface/read-all-words dictionary-type)
-          words          (words->vector search-results)
-          csv-output     (words->csv words)]
-        (-> (http-response/response csv-output)
-            (http-response/content-type "text/csv; charset=utf-8"))))
+  [request dictionary-type]
+  (let [search-results (db-interface/read-all-words dictionary-type)
+        words          (words->vector search-results)
+        csv-output     (words->csv words)]
+    (-> (http-response/response csv-output)
+        (http-response/content-type "text/csv; charset=utf-8"))))

 (defn process-different-spelling-words
-    [request]
-    (let [search-results (db-interface/read-different-spelling-words)
-          json-output    (words->json search-results)]
-        (-> (http-response/response json-output)
-            (http-response/content-type "application/json"))))
+  [request]
+  (let [search-results (db-interface/read-different-spelling-words)
+        json-output    (words->json search-results)]
+    (-> (http-response/response json-output)
+        (http-response/content-type "application/json"))))

 ;defn process-delete-word
 ;   [request]
@@ -408,78 +535,78 @@
 ;    ; not needed ATM

 (defn return-file
-    "Creates HTTP response containing content of specified file.
+  "Creates HTTP response containing content of specified file.
      Special value nil / HTTP response 404 is returned in case of any I/O error."
-    [^String file-name content-type]
-    (let [file (new java.io.File "www" file-name)]
-        (log/info "Returning file " (.getAbsolutePath file))
-        (if (.exists file)
-            (-> (http-response/response file)
-                (http-response/content-type content-type))
-            (log/error "return-file(): can not access file: " (.getName file)))))
+  [^String file-name content-type]
+  (let [file (new java.io.File "www" file-name)]
+    (log/info "Returning file " (.getAbsolutePath file))
+    (if (.exists file)
+      (-> (http-response/response file)
+          (http-response/content-type content-type))
+      (log/error "return-file(): can not access file: " (.getName file)))))

 (defn handler
-    "Handler that is called by Ring for all requests received from user(s)."
-    [request]
-    (log/info "request URI: " (request :uri))
-    (let [uri          (request :uri)
-          title        (get-title request)
-          emender-page (get-emender-page request)]
-        (condp = uri
-            "/favicon.ico"                (return-file "favicon.ico" "image/x-icon")
-            "/bootstrap.min.css"          (return-file "bootstrap.min.css" "text/css")
-            "/smearch.css"                (return-file "smearch.css" "text/css")
-            "/bootstrap.min.js"           (return-file "bootstrap.min.js" "application/javascript")
-            "/"                           (process-front-page    request title emender-page)
-            "/whitelist"                  (process-whitelist     request title emender-page)
-            "/blacklist"                  (process-blacklist     request title emender-page)
-            "/atomic-typos"               (process-atomic-typos  request title emender-page)
-            "/glossary"                   (process-glossary      request title emender-page)
-            "/all-words-in-whitelist"     (process-all-words     request title emender-page :whitelist)
-            "/all-words-in-blacklist"     (process-all-words     request title emender-page :blacklist)
-            "/all-words-in-atomic-typos"  (process-all-words     request title emender-page :atomic-typos)
-            "/all-words-in-glossary"      (process-all-words     request title emender-page :glossary)
-            "/active-words-in-whitelist"  (process-active-words  request title emender-page :whitelist)
-            "/active-words-in-blacklist"  (process-active-words  request title emender-page :blacklist)
-            "/active-words-in-atomic-typos"  (process-active-words     request title emender-page :atomic-typos)
-            "/active-words-in-glossary"      (process-active-words     request title emender-page :glossary)
-            "/deleted-words-in-whitelist"    (process-deleted-words request title emender-page :whitelist)
-            "/deleted-words-in-blacklist"    (process-deleted-words request title emender-page :blacklist)
-            "/deleted-words-in-atomic-typos" (process-deleted-words     request title emender-page :atomic-typos)
-            "/deleted-words-in-glossary"     (process-deleted-words     request title emender-page :glossary)
-            "/add-word-to-blacklist"    (process-add-word      request title emender-page :blacklist)
-            ;"/find-words"       (process-find-words    request)
-            "/add-words-to-whitelist"   (process-add-words   request title emender-page :whitelist)
-            "/add-word-to-atomic-typos" (process-add-word    request title emender-page :atomic-typos)
-            "/add-word-to-glossary"     (process-add-word    request title emender-page :glossary)
-            "/users-whitelist"        (process-user-list     request title :whitelist)
-            "/users-blacklist"        (process-user-list     request title :blacklist)
-            "/users-atomic-typos"     (process-user-list     request title :atomic-typos)
-            "/user-whitelist"         (process-user-info     request title :whitelist)
-            "/user-blacklist"         (process-user-info     request title :blacklist)
-            "/user-glossary"          (process-user-info     request title :glossary)
-            "/all-words/json"         (process-wordlist-json request nil)
-            "/all-words/text"         (process-wordlist-text request nil)
-            "/all-words/xml"          (process-wordlist-xml  request nil)
-            "/all-words/edn"          (process-wordlist-edn  request nil)
-            "/all-words/csv"          (process-wordlist-csv  request nil)
-            "/whitelist/json"         (process-wordlist-json request :whitelist)
-            "/whitelist/text"         (process-wordlist-text request :whitelist)
-            "/whitelist/xml"          (process-wordlist-xml  request :whitelist)
-            "/whitelist/edn"          (process-wordlist-edn  request :whitelist)
-            "/whitelist/csv"          (process-wordlist-csv  request :whitelist)
-            "/blacklist/json"         (process-wordlist-json request :blacklist)
-            "/blacklist/text"         (process-wordlist-text request :blacklist)
-            "/blacklist/xml"          (process-wordlist-xml  request :blacklist)
-            "/blacklist/edn"          (process-wordlist-edn  request :blacklist)
-            "/blacklist/csv"          (process-wordlist-csv  request :blacklist)
-            "/glossary/json"          (process-wordlist-json request :glossary)
-            "/glossary/text"          (process-wordlist-text request :glossary)
-            "/glossary/xml"           (process-wordlist-xml  request :glossary)
-            "/glossary/edn"           (process-wordlist-edn  request :glossary)
-            "/glossary/csv"           (process-wordlist-csv  request :glossary)
-            "/different-spelling-words/json" (process-different-spelling-words request)
-            ;"/delete-word"           (process-delete-word   request)
-            ;"/undelete-word"         (process-undelete-word request)
-            )))
-
+  "Handler that is called by Ring for all requests received from user(s)."
+  [request]
+  (log/info "request URI: " (request :uri))
+  (let [uri          (request :uri)
+        title        (get-title request)
+        emender-page (get-emender-page request)]
+    (condp = uri
+      "/favicon.ico"                (return-file "favicon.ico" "image/x-icon")
+      "/bootstrap.min.css"          (return-file "bootstrap.min.css" "text/css")
+      "/smearch.css"                (return-file "smearch.css" "text/css")
+      "/bootstrap.min.js"           (return-file "bootstrap.min.js" "application/javascript")
+      "/"                           (process-front-page    request title emender-page)
+      "/whitelist"                  (process-whitelist     request title emender-page)
+      "/blacklist"                  (process-blacklist     request title emender-page)
+      "/atomic-typos"               (process-atomic-typos  request title emender-page)
+      "/glossary"                   (process-glossary      request title emender-page)
+      "/all-words-in-whitelist"     (process-all-words     request title emender-page :whitelist)
+      "/all-words-in-blacklist"     (process-all-words     request title emender-page :blacklist)
+      "/all-words-in-atomic-typos"  (process-all-words     request title emender-page :atomic-typos)
+      "/all-words-in-glossary"      (process-all-words     request title emender-page :glossary)
+      "/active-words-in-whitelist"  (process-active-words  request title emender-page :whitelist)
+      "/active-words-in-blacklist"  (process-active-words  request title emender-page :blacklist)
+      "/active-words-in-atomic-typos"  (process-active-words     request title emender-page :atomic-typos)
+      "/active-words-in-glossary"      (process-active-words     request title emender-page :glossary)
+      "/deleted-words-in-whitelist"    (process-deleted-words request title emender-page :whitelist)
+      "/deleted-words-in-blacklist"    (process-deleted-words request title emender-page :blacklist)
+      "/deleted-words-in-atomic-typos" (process-deleted-words     request title emender-page :atomic-typos)
+      "/deleted-words-in-glossary"     (process-deleted-words     request title emender-page :glossary)
+      "/add-word-to-blacklist"    (process-add-word      request title emender-page :blacklist)
+      ;"/find-words"       (process-find-words    request)
+      "/add-words-to-whitelist"   (process-add-words   request title emender-page :whitelist)
+      "/add-word-to-atomic-typos" (process-add-word    request title emender-page :atomic-typos)
+      "/add-word-to-glossary"     (process-add-word    request title emender-page :glossary)
+      "/users-whitelist"        (process-user-list     request title :whitelist)
+      "/users-blacklist"        (process-user-list     request title :blacklist)
+      "/users-atomic-typos"     (process-user-list     request title :atomic-typos)
+      "/user-whitelist"         (process-user-info     request title :whitelist)
+      "/user-blacklist"         (process-user-info     request title :blacklist)
+      "/user-glossary"          (process-user-info     request title :glossary)
+      "/all-words/json"         (process-wordlist-json request nil)
+      "/all-words/text"         (process-wordlist-text request nil)
+      "/all-words/xml"          (process-wordlist-xml  request nil)
+      "/all-words/edn"          (process-wordlist-edn  request nil)
+      "/all-words/csv"          (process-wordlist-csv  request nil)
+      "/whitelist/json"         (process-wordlist-json request :whitelist)
+      "/whitelist/text"         (process-wordlist-text request :whitelist)
+      "/whitelist/xml"          (process-wordlist-xml  request :whitelist)
+      "/whitelist/edn"          (process-wordlist-edn  request :whitelist)
+      "/whitelist/csv"          (process-wordlist-csv  request :whitelist)
+      "/blacklist/json"         (process-wordlist-json request :blacklist)
+      "/blacklist/text"         (process-wordlist-text request :blacklist)
+      "/blacklist/xml"          (process-wordlist-xml  request :blacklist)
+      "/blacklist/edn"          (process-wordlist-edn  request :blacklist)
+      "/blacklist/csv"          (process-wordlist-csv  request :blacklist)
+      "/glossary/json"          (process-wordlist-json request :glossary)
+      "/glossary/text"          (process-wordlist-text request :glossary)
+      "/glossary/xml"           (process-wordlist-xml  request :glossary)
+      "/glossary/edn"           (process-wordlist-edn  request :glossary)
+      "/glossary/csv"           (process-wordlist-csv  request :glossary)
+      "/different-spelling-words/json" (process-different-spelling-words request)
+      ;"/delete-word"           (process-delete-word   request)
+      ;"/undelete-word"         (process-undelete-word request)
+    )))
+


add Chinese and French version of days and months

--- src/om_next_datascript_localisation_demo/datascript/initial.cljs
+++ src/om_next_datascript_localisation_demo/datascript/initial.cljs
@@ -118,7 +118,7 @@

     {:db/id -402
       :localised/locale -100020
-      :value "应用现用语言为"}
+      :value "现用语言为"}

     {:db/id -403
       :localised/locale -100030
@@ -174,11 +174,11 @@

     {:db/id -702
       :localised/locale -100020
-      :value "Today's date is (cn)"}
+      :value "今天的日期是"}

     {:db/id -703
       :localised/locale -100030
-      :value "Today's date is (fr)"}
+      :value "La date de aujourd'hui est"}

     {:db/id -700
       :string/ident :date/today
@@ -194,11 +194,12 @@
       :value "Sunday"}
     {:db/id -1002
       :localised/locale -100020
-      :value "周一"}
+      :value "周日"}
     {:db/id -1003
       :localised/locale -100030
-      :value "Lundi"}
+      :value "Dimanche"}
     {:db/id -1000
+      :string/ident :date/day-0
       :date/day 0
       :value "Sunday"
       :localised [-1001 -1002 -1003]}
@@ -214,6 +215,7 @@
       :localised/locale -100030
       :value "Lundi"}
     {:db/id -1010
+      :string/ident :date/day-1
       :date/day 1
       :value "Monday"
       :localised [-1011 -1012 -1013]}
@@ -224,11 +226,12 @@
       :value "Tuesday"}
     {:db/id -1022
       :localised/locale -100020
-      :value "周一"}
+      :value "周二"}
     {:db/id -1023
       :localised/locale -100030
-      :value "Lundi"}
+      :value "Mardi"}
     {:db/id -1020
+      :string/ident :date/day-2
       :date/day 2
       :value "Tuesday"
       :localised [-1021 -1022 -1023]}
@@ -239,11 +242,12 @@
       :value "Wednesday"}
     {:db/id -1032
       :localised/locale -100020
-      :value "周一"}
+      :value "周三"}
     {:db/id -1033
       :localised/locale -100030
-      :value "Lundi"}
+      :value "Mercredi"}
     {:db/id -1030
+      :string/ident :date/day-3
       :date/day 3
       :value "Wednesday"
       :localised [-1031 -1032 -1033]}
@@ -254,11 +258,12 @@
       :value "Thursday"}
     {:db/id -1042
       :localised/locale -100020
-      :value "周一"}
+      :value "周四"}
     {:db/id -1043
       :localised/locale -100030
-      :value "Lundi"}
+      :value "Jeudi"}
     {:db/id -1040
+      :string/ident :date/day-4
       :date/day 4
       :value "Thursday"
       :localised [-1041 -1042 -1043]}
@@ -269,11 +274,12 @@
       :value "Friday"}
     {:db/id -1052
       :localised/locale -100020
-      :value "周一"}
+      :value "周五"}
     {:db/id -1053
       :localised/locale -100030
-      :value "Lundi"}
+      :value "Vendredi"}
     {:db/id -1050
+      :string/ident :date/day-5
       :date/day 5
       :value "Friday"
       :localised [-1051 -1052 -1053]}
@@ -284,11 +290,12 @@
       :value "Saturday"}
     {:db/id -1062
       :localised/locale -100020
-      :value "周一"}
+      :value "周六"}
     {:db/id -1063
       :localised/locale -100030
-      :value "Lundi"}
+      :value "Samedi"}
     {:db/id -1060
+      :string/ident :date/day-6
       :date/day 6
       :value "Saturday"
       :localised [-1061 -1062 -1063]}
@@ -306,6 +313,7 @@
       :localised/locale -100030
       :value "Janvier"}
     {:db/id -2000
+      :string/ident :date/month-00
       :date/month 0
       :value "January"
       :localised [-2001 -2002 -2003]}
@@ -319,8 +327,9 @@
       :value "2"}
     {:db/id -2013
       :localised/locale -100030
-      :value "Janvier"}
+      :value "Février"}
     {:db/id -2010
+      :string/ident :date/month-01
       :date/month 1
       :value "February"
       :localised [-2011 -2012 -2013]}
@@ -334,8 +343,9 @@
       :value "3"}
     {:db/id -2023
       :localised/locale -100030
-      :value "Janvier"}
+      :value "Mars"}
     {:db/id -2020
+      :string/ident :date/month-02
       :date/month 2
       :value "March"
       :localised [-2021 -2022 -2023]}
@@ -349,8 +359,9 @@
       :value "4"}
     {:db/id -2033
       :localised/locale -100030
-      :value "Janvier"}
+      :value "Avril"}
     {:db/id -2030
+      :string/ident :date/month-03
       :date/month 3
       :value "April"
       :localised [-2031 -2032 -2033]}
@@ -364,8 +375,9 @@
       :value "5"}
     {:db/id -2043
       :localised/locale -100030
-      :value "Janvier"}
+      :value "Mai"}
     {:db/id -2040
+      :string/ident :date/month-04
       :date/month 4
       :value "May"
       :localised [-2041 -2042 -2043]}
@@ -379,8 +391,9 @@
       :value "6"}
     {:db/id -2053
       :localised/locale -100030
-      :value "Janvier"}
+      :value "Juin"}
     {:db/id -2050
+      :string/ident :date/month-05
       :date/month 5
       :value "June"
       :localised [-2051 -2052 -2053]}
@@ -394,8 +407,9 @@
       :value "7"}
     {:db/id -2063
       :localised/locale -100030
-      :value "Janvier"}
+      :value "Juillet"}
     {:db/id -2060
+      :string/ident :date/month-06
       :date/month 6
       :value "July"
       :localised [-2061 -2062 -2063]}
@@ -409,8 +423,9 @@
       :value "8"}
     {:db/id -2073
       :localised/locale -100030
-      :value "Janvier"}
+      :value "Août"}
     {:db/id -2070
+      :string/ident :date/month-07
       :date/month 7
       :value "August"
       :localised [-2071 -2072 -2073]}
@@ -424,8 +439,9 @@
       :value "9"}
     {:db/id -2083
       :localised/locale -100030
-      :value "Janvier"}
+      :value "Septembre"}
     {:db/id -2080
+      :string/ident :date/month-08
       :date/month 8
       :value "September"
       :localised [-2081 -2082 -2083]}
@@ -439,8 +455,9 @@
       :value "10"}
     {:db/id -2093
       :localised/locale -100030
-      :value "Janvier"}
+      :value "Octobre"}
     {:db/id -2090
+      :string/ident :date/month-09
       :date/month 9
       :value "October"
       :localised [-2091 -2092 -2093]}
@@ -454,8 +471,9 @@
       :value "11"}
     {:db/id -2103
       :localised/locale -100030
-      :value "Janvier"}
+      :value "Novembre"}
     {:db/id -2100
+      :string/ident :date/month-10
       :date/month 10
       :value "November"
       :localised [-2101 -2102 -2103]}
@@ -469,8 +487,9 @@
       :value "12"}
     {:db/id -2113
       :localised/locale -100030
-      :value "Janvier"}
+      :value "Décembre"}
     {:db/id -2110
+      :string/ident :date/month-11
       :date/month 11
       :value "December"
       :localised [-2111 -2112 -2113]}])


Update Alia system to disable keywordizing results by default again

--- systems/cassandra-alia/src/containium/systems/cassandra/alia.clj
+++ systems/cassandra-alia/src/containium/systems/cassandra/alia.clj
@@ -24,7 +24,9 @@

 (defn- do-prepared*
   [{:keys [session]} statement opts values]
-  (let [args (merge {:consistency *consistency*, :keywordize? *keywordize*} opts {:values values})]
+  (let [args (merge {:consistency *consistency*, :string-keys? (not *keywordize*)}
+                    (when-let [keys? (:keywordize? opts)] {:string-keys? (not keys?)})
+                    opts {:values values})]
     (assert (:consistency opts) "Missing :consistency key and *consistency* not bound.")
     (alia/execute session statement args)))


fixing problem with “name” change and rejected null values in influxdb rc31/rc32

--- src/riemann/influxdb.clj
+++ src/riemann/influxdb.clj
@@ -34,6 +34,7 @@
   (let [ignored-fields (set/union special-fields tag-fields)]
     (-> event
         (->> (remove (comp ignored-fields key))
+             (remove #(nil? (val %)))
              (map #(vector (name (key %)) (val %)))
              (into {}))
         (assoc "value" (:metric event)))))
@@ -112,7 +113,7 @@
   and metric."
   [tag-fields event]
   (when (and (:time event) (:service event) (:metric event))
-    {"name" (:service event)
+    {"measurement" (:service event)
      "time" (unix-to-iso8601 (:time event))
      "tags" (event-tags tag-fields event)
      "fields" (event-fields tag-fields event)}))


Comment clarification

Comment clarification

--- 2-collectors/clojure-collector/src/snowplow/clojure_collector.clj
+++ 2-collectors/clojure-collector/src/snowplow/clojure_collector.clj
@@ -40,6 +40,6 @@
 ;; ; To run locally: `lein ring server`
 (def start-server (run-jetty #'app {:port 8081 :join? false}))

-;; ; To run without Leiningen (package with uberjar)
+;; ; To run locally without Leiningen (having packaged with `lein uberjar`)
 (defn -main [& args]
   (start-server))


Improve ->db-val coercion performance & error messages

--- src/taoensso/faraday.clj
+++ src/taoensso/faraday.clj
@@ -139,7 +139,6 @@
       (some->> (.getNS x) (map str->num) (into #{}))
       (some->> (.getBS x) (map bb->ba)   (into #{}))))

-(defn- set-of [pred s] (and (set? s) (seq s) (every? pred s)))
 (def ^:private ^:const ba-class (Class/forName "[B"))
 (defn- ba? [x] (instance? ba-class x))
 (defn- ba-buffer [^bytes ba] (ByteBuffer/wrap ba))
@@ -152,16 +151,26 @@
   "Returns an AttributeValue object for given Clojure value."
   ^AttributeValue [x]
   (cond
-   (string? x)          (if (.isEmpty ^String x)
-                          (throw (Exception. "\"\" is not a legal DynamoDB value!"))
-                          (doto (AttributeValue.) (.setS x)))
-   (simple-num? x)        (doto (AttributeValue.) (.setN (str x)))
-   (ba? x)                (doto (AttributeValue.) (.setB (ba-buffer x)))
-   (set-of string? x)     (doto (AttributeValue.) (.setSS x))
-   (set-of simple-num? x) (doto (AttributeValue.) (.setNS (map str x)))
-   (set-of ba? x)         (doto (AttributeValue.) (.setBS (map ba-buffer x)))
-   (set? x) (throw (Exception. "Sets must be non-empty & contain values of the same type!"))
-   :else    (throw (Exception. (str "Unknown value type: " (type x))))))
+   (string? x)
+   (if (.isEmpty ^String x)
+     (throw (Exception. "Invalid DynamoDB value: \"\""))
+     (doto (AttributeValue.) (.setS x)))
+
+   (simple-num? x) (doto (AttributeValue.) (.setN (str x)))
+   (ba? x)         (doto (AttributeValue.) (.setB (ba-buffer x)))
+
+   (set? x)
+   (if (empty? x)
+     (throw (Exception. "Invalid DynamoDB value: empty set"))
+     (cond
+      (every? string?     x) (doto (AttributeValue.) (.setSS x))
+      (every? simple-num? x) (doto (AttributeValue.) (.setNS (map str x)))
+      (every? ba?         x) (doto (AttributeValue.) (.setBS (map ba-buffer x)))
+      :else (throw (Exception. (str "Invalid DynamoDB value: set of invalid type"
+                                    " or more than one type")))))
+
+   :else (throw (Exception. (str "Unknown value type: " (type x) "."
+                                 " Wrap with `serialize`?")))))

 (comment (map clj-val->db-val ["foo" 10 3.14 (.getBytes "foo")
                                #{"a" "b" "c"} #{1 2 3.14} #{(.getBytes "foo")}]))


Docstring tweaks

Docstring tweaks

--- src/taoensso/faraday.clj
+++ src/taoensso/faraday.clj
@@ -4,10 +4,10 @@
        http://goo.gl/22QGA (DynamoDBv2 API)

   Definitions (with '=>' as 'implies'):
-    * item        => {<attribute> <value>}
-    * key         => hash OR range key => special attribute
-    * primary key => hash key WITH optional range key
-    * attribute   ≠> key (i.e. does not imply)"
+    * item        => {<attribute> <value>}.
+    * key         => hash OR range key => special attribute.
+    * primary key => hash key WITH optional range key.
+    * attribute   ≠> key (i.e. does not imply)."

   {:author "Peter Taoussanis"}
   (:require [clojure.string         :as str]
@@ -549,7 +549,8 @@
     :total-segments - total number of parallel scan segments.
     :segment        - calling worker's segment number (>=0, <=total-segments).

-  See also `scan-parallel` for automatic parallelization & segment control."
+  For automatic parallelization & segment control see `scan-parallel`.
+  For indexed item retrievel see `query`."
   [creds table
    & [{:keys [attr-conds last-prim-kvs return limit total-segments segment]
        :or   {return :all-attributes}}]]


Add floor/ceil/round functions to math utils ns.

--- src/uxbox/util/math.cljs
+++ src/uxbox/util/math.cljs
@@ -26,6 +26,24 @@
   [^number v]
   (- v))

+(defn floor
+  "Returns the largest integer less than or
+  equal to a given number."
+  [^number v]
+  (js/Math.floor v))
+
+(defn round
+  "Returns the value of a number rounded to
+  the nearest integer."
+  [^number v]
+  (js/Math.round v))
+
+(defn ceil
+  "Returns the smallest integer greater than
+  or equal to a given number."
+  [^number v]
+  (js/Math.ceil v))
+
 (defn radians
   "Converts degrees to radians."
   [^number degrees]


Simplify for-files a bit.

Simplify for-files a bit.

--- src/vault/store/file.clj
+++ src/vault/store/file.clj
@@ -49,16 +49,14 @@

 (defmacro ^:private for-files
   [[sym dir] expr]
-  (let [sym (vary-meta sym assoc :tag 'java.io.File)
-        dir (vary-meta dir assoc :tag 'java.io.File)]
-    `(let [files# (->> ~dir .listFiles sort)]
-       (for [~sym files#]
-         ~expr))))
+  `(let [files# (->> ~dir .listFiles sort)]
+     (for [~(vary-meta sym assoc :tag 'java.io.File) files#]
+       ~expr)))

 (defn- enumerate-files
   "Generates a lazy sequence of file blobs contained in a root directory."
-  [root]
+  [^java.io.File root]
   ; TODO: intelligently skip entries based on 'start'
   (flatten
     (for-files [algorithm-dir root]


GAWB-309: Build method config edit JSON from correct source of inputs/outputs

--- src/cljs/org/broadinstitute/firecloud_ui/page/workspace/method_configs/method_config_editor.cljs
+++ src/cljs/org/broadinstitute/firecloud_ui/page/workspace/method_configs/method_config_editor.cljs
@@ -30,11 +30,13 @@
 (defn- commit [state refs config props]
   (let [workspace-id (:workspace-id props)
         [name rootEntityType] (get-text refs "confname" "rootentitytype")
-        inputs (->> (keys (config "inputs"))
+        inputs (->> ((:inputs-outputs @state) "inputs")
+                 (map #(% "name"))
                  (map (juxt identity #(get-text refs (str "in_" %))))
                  (filter (fn [[k v]] (not (empty? v))))
                  (into {}))
-        outputs (->> (keys (config "outputs"))
+        outputs (->> ((:inputs-outputs @state) "outputs")
+                  (map #(% "name"))
                   (map (juxt identity #(get-text refs (str "out_" %))))
                   (filter (fn [[k v]] (not (empty? v))))
                   (into {}))


Refinement of colors, timing and sizing

Refinement of colors, timing and sizing

--- spectacles/src/spectacles/social_light.clj
+++ spectacles/src/spectacles/social_light.clj
@@ -5,36 +5,39 @@

 (defn setup []
   (q/color-mode :hsb)
+  (q/background 0)
+  (q/frame-rate 2)
+
   (let [wc (WordCram. (quil.applet/current-applet))]
     (-> wc
         ;;(.fromWebPage "https://twitter.com/WinCityMain")
         ;;(.fromTextString (into-array String ["Life In Lights Winchester"]))
         (.fromTextFile "resources/posts.txt")
-        (.withColors (int-array [(q/color 30) (q/color 110) (q/color (q/random 255) 240 200)]))
-        (.sizedByWeight 5 120)
+        (.withColors (int-array [(q/color 220) (q/color 140) (q/color (q/random 255) 240 200)]))
+        (.sizedByWeight 5 80)
         (.withFont"Copse")
-        (.angledBetween (float -1.6) (float 1.6))
-        (.drawAll))))
+        (.angledBetween (float -1.6) (float 1.6)))
+    {:wordcram wc})
+  )

-(defn update-state [state] {})
+(defn update-state [state] state)

-(defn draw-state [state] {})
+(defn draw-state [state]
+  (if (.hasMore (:wordcram state))
+    (.drawNext (:wordcram state)))
+  state)

 (q/defsketch spectacles
   :title "Social Light"
-  :size [1000 600]
+  :size [800 600]
   ; setup function called only once, during sketch initialization.
   :setup setup
   ; update-state is called on each iteration before draw-state.
   :update update-state
   :draw draw-state
   :features [:keep-on-top]
-  ; This sketch uses functional-mode middleware.
-  ; Check quil wiki for more info about middlewares and particularly
-  ; fun-mode.
   :middleware [m/fun-mode]
-  ;;  :features [:keep-on-top :present :no-start]
-;;  :features [:no-start]
+  :features [:keep-on-top :present :no-start]
   :bgcolor 0)


refactor show projec-insights logic

refactor show projec-insights logic

--- src-cljs/frontend/components/insights.cljs
+++ src-cljs/frontend/components/insights.cljs
@@ -291,11 +291,12 @@
             (om/build svg {:class "badge-icon"
                            :src (-> latest-build build/status-icon common/icon-path)})]
            [:span.project-name
-            (if (feature/enabled? :insights-dashboard)
-              (if show-insights? [:a {:href (routes/v1-insights-project {:org (:username project)
+            (if (and (feature/enabled? :insights-dashboard)
+                     show-insights?)
+              [:a {:href (routes/v1-insights-project {:org (:username project)
                                                       :repo (:reponame project)
                                                       :branch (:default_branch project)})}
-               (formatted-project-name project)] (formatted-project-name project))
+               (formatted-project-name project)]
               (formatted-project-name project))]
            [:div.github-icon
             [:a {:href (:vcs_url project)}


Remove ns from template

Remove ns from template

--- desktop/resources/barebones-2d/core.clj
+++ desktop/resources/barebones-2d/core.clj
@@ -1,7 +1,3 @@
-(ns nightmod.core
-  (:require [play-clj.core :refer :all]
-            [play-clj.ui :refer :all]))
-
 (defscreen main-screen
   :on-show
   (fn [screen entities]


Fix typo.

Fix typo.

--- src/afterglow/controllers/ableton_push.clj
+++ src/afterglow/controllers/ableton_push.clj
@@ -169,7 +169,7 @@

 (def color-button-colors
   "The control values and modes for a labeled button which changes
-  color. These are added to the monocrome states (except for off)
+  color. These are added to the monochrome states (except for off)
   to obtain the color and brightness/behavior."
   {:red 0 :amber 6 :yellow 12 :green 18})


Added some type conversion magic to entity saving and retrieval.

--- src/appengine_magic/services/datastore.clj
+++ src/appengine_magic/services/datastore.clj
@@ -25,6 +25,28 @@

 (defn- coerce-key-value-type [key-value]
   (if (integer? key-value) (long key-value) key-value))
+
+
+(defn- coerce-java-type [v]
+  (cond (instance? java.util.ArrayList v) (into [] v)
+        (instance? java.util.Map v) (into {} v)
+        (instance? java.util.Set v) (into #{} v)
+        :else v))
+
+
+(defn- coerce-clojure-type [v]
+  (let [to-java-hashmap (fn [m]
+                          (let [jhm (java.util.HashMap.)]
+                            (doseq [[k v] m] (.put jhm k v))
+                            jhm))
+        to-java-hashset (fn [s]
+                          (let [jhs (java.util.HashSet.)]
+                            (doseq [v s] (.add jhs v))
+                            jhs))]
+   (cond (instance? clojure.lang.APersistentMap v) (to-java-hashmap v) ; broken in GAE 1.3.7
+         (instance? clojure.lang.APersistentSet v) (to-java-hashset v) ; broken in GAE 1.3.7
+         (extends? EntityProtocol (class v)) (get-key-object v)
+         :else v)))

 (defprotocol EntityProtocol
@@ -76,7 +98,7 @@
                    (Entity. datastore-entity-name))]
     (doseq [[property-kw value] entity-record]
       (let [property-name (.substring (str property-kw) 1)]
-        (.setProperty entity property-name value)))
+        (.setProperty entity property-name (coerce-clojure-type value))))
     (.put (get-datastore-service) entity)))

@@ -90,14 +112,19 @@
                        (KeyFactory/createKey datastore-entity-name
                                              (coerce-key-value-type key-value)))
         entity (.get (get-datastore-service) key-object)
-        properties (into {} (.getProperties entity))
-        kw-keys-properties (reduce (fn [m [k v]] (assoc m (keyword k) v)) {} properties)
+        raw-properties (into {} (.getProperties entity))
+        properties (reduce (fn [m [k v]]
+                             (assoc m
+                               (keyword k)
+                               (coerce-java-type v)))
+                           {}
+                           raw-properties)
         ;; XXX: No good choice but to use eval here. No way to know the number
         ;; of arguments to the record constructor at compile-time, and no clean
         ;; way to access any custom constructor defined by defentity, since that
         ;; constructor would be in a different namespace.
-        entity-record (eval `(new ~entity-record-type ~@(repeat (count properties) nil)))]
-    (with-meta (merge entity-record kw-keys-properties) {:key (.getKey entity)})))
+        entity-record (eval `(new ~entity-record-type ~@(repeat (count raw-properties) nil)))]
+    (with-meta (merge entity-record properties) {:key (.getKey entity)})))

 (defmacro defentity [name properties &


lein-release plugin: preparing 0.4.4 release

--- re_view/project.clj
+++ re_view/project.clj
@@ -1,4 +1,4 @@
-(defproject re-view "0.4.4-SNAPSHOT"
+(defproject re-view "0.4.4"
   :description "ClojureScript React Library"
   :url "https://www.github.com/braintripping/re-view/tree/master/re_view"
   :license {:name "Eclipse Public License"


Pass uri-root config option into stefon.


Reimplement inmemmory session storage.

Reimplement inmemmory session storage.

--- src/clojure/catacumba/handlers/session.clj
+++ src/clojure/catacumba/handlers/session.clj
@@ -130,19 +130,33 @@
   []
   (let [internalstore (atom {})]
     (reify ISessionStorage
-      (read-session [_ key]
-        (p/promise (fn [deliver]
-                     (let [key (keyword key)]
-                       (deliver (get @internalstore key nil))))))
-
-      (write-session [_ key data]
-        (p/promise (fn [deliver]
-                     (let [key (keyword key)]
-                       (deliver (swap! internalstore assoc key data))))))
-      (delete-session [_ key]
-        (p/promise (fn [deliver]
-                     (let [key (keyword key)]
-                       (deliver (swap! internalstore dissoc key)))))))))
+      clojure.lang.IDeref
+      (deref [_]
+        @internalstore)
+
+      (-read [_ key]
+        (p/promise
+         (fn [deliver]
+           (if (nil? key)
+             (let [key (codecs/bytes->safebase64 (nonce/random-nonce 48))]
+               (deliver [key {}]))
+             (let [data (get @internalstore key nil)]
+               (if (nil? data)
+                 (let [key (codecs/bytes->safebase64 (nonce/random-nonce 48))]
+                   (deliver [key {}]))
+                 (deliver [key data])))))))
+
+      (-write [_ key data]
+        (p/promise
+         (fn [deliver]
+           (swap! internalstore assoc key data)
+           (deliver key))))
+
+      (-delete [_ key]
+        (p/promise
+         (fn [deliver]
+           (swap! internalstore dissoc key)
+           (deliver key)))))))

 (defn lookup-storage
   "A helper for create session storages with
@@ -153,7 +167,8 @@
     :inmemory (memory-storage)
     ;; :signed-cookie (cookie-storage)
     (if (not (satisfies? ISessionStorage storage))
-      (throw (IllegalArgumentException. "storage should satisfy ISessionStorage protocol."))
+      (throw (IllegalArgumentException.
+              "storage should satisfy ISessionStorage protocol."))
       storage)))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


ignore resource-api-test for now, but keep it around for future use

--- test/aspire/web_test.clj
+++ test/aspire/web_test.clj
@@ -8,7 +8,7 @@
 ;; defined in web.clj. The resulting vars are available for testing here.
 (use-fixtures :once web-test-config)

-(deftest resource-api-test
+#_(deftest resource-api-test
   (def keyed-headers
     (into {}
       (for [[k v] (:headers api-response)]


Ensures error from backend is resolved (#274)

--- waiter/src/waiter/process_request.clj
+++ waiter/src/waiter/process_request.clj
@@ -544,15 +544,17 @@
                                 {:keys [error] :as response} (:out timed-response)]
                             (statsd/histo! metric-group "backend_response" response-elapsed)
                             (-> (if error
-                                  (do
+                                  (let [error-response (handle-response-error error reservation-status-promise service-id request)]
+                                    ; must close `request-state-chan` after calling `handle-response-error`
+                                    ; which resolves the `reservation-status-promise`
                                     (async/close! request-state-chan)
-                                    (handle-response-error error reservation-status-promise service-id request))
+                                    error-response)
                                   (try
                                     (let [request-abort-callback (request-abort-callback-factory response)
                                           confirm-live-connection-with-abort (confirm-live-connection-factory request-abort-callback)]
                                       (process-backend-response-fn local-usage-agent instance-request-properties descriptor
-                                                                 instance request reason-map reservation-status-promise
-                                                                 confirm-live-connection-with-abort request-state-chan response))
+                                                                   instance request reason-map reservation-status-promise
+                                                                   confirm-live-connection-with-abort request-state-chan response))
                                     (catch Exception e
                                       (async/close! request-state-chan)
                                       (handle-process-exception e request))))


organize tests

organize tests

--- test/wb_es/core_test.clj
+++ test/wb_es/core_test.clj
@@ -54,58 +54,28 @@

 (deftest clone-type-test
   (let [db (d/db datomic-conn)]
-    (do
-      (index-datomic-entity (d/entity db [:clone/id "W02C12"]))
-      (testing "search by clone WBID"
-        (let [first-hit (->> (search "W02C12")
-                             :hits
-                             :hits
-                             (first))]
-          (is (= "W02C12" (get-in first-hit [:_source :wbid])))
-          (is (= "clone" (get-in first-hit [:_type])))))
-      (testing "autocomplete by clone WBID"
-        (let [hits (->> (autocomplete "W02C")
-                        :hits
-                        :hits)]
-          (is (some (fn [hit]
-                      (= "W02C12" (get-in hit [:_source :wbid])))
-                    hits)))
-        ))
+    (testing "clone type using W02C12 as example"
+      (do
+        (index-datomic-entity (d/entity db [:clone/id "W02C12"]))
+        (testing "search by clone WBID"
+          (let [first-hit (->> (search "W02C12")
+                               :hits
+                               :hits
+                               (first))]
+            (is (= "W02C12" (get-in first-hit [:_source :wbid])))
+            (is (= "clone" (get-in first-hit [:_type])))))
+        (testing "autocomplete by clone WBID"
+          (let [hits (->> (autocomplete "W02C")
+                          :hits
+                          :hits)]
+            (is (some (fn [hit]
+                        (= "W02C12" (get-in hit [:_source :wbid])))
+                      hits)))
+          )))
     ))

-(deftest transgene-type-test
-  (let [db (d/db datomic-conn)
-        transgenes-prefixed-syis1 (->> (d/datoms db :aevt :transgene/public-name)
-                                       (keep (fn [[e _ v]]
-                                               (if (re-matches #"syIs1.*" v)
-                                                 e)))
-                                       (map (partial d/entity db))
-                                       (shuffle))]
-    (do
-      (apply index-datomic-entity transgenes-prefixed-syis1)
-      (testing "autocompletion by transgene name"
-        (let [hits (-> (autocomplete "syIs1")
-                       (get-in [:hits :hits]))]
-          (testing "result appears in autocompletion"
-            (is (some (fn [hit]
-                        (= "syIs101"
-                           (get-in hit [:_source :label])))
-                      hits)))
-          (testing "result in right order"
-            (is (= "syIs1" (-> (first hits)
-                               (get-in [:_source :label])))))))
-      (testing "autocompletion by transgene name in lowercase"
-        (let [hits (-> (autocomplete "syis1")
-                       (get-in [:hits :hits]))]
-          (is (some (fn [hit]
-                      (= "syIs101"
-                         (get-in hit [:_source :label])))
-                    hits))))
-      ))
-  )
-
 (deftest disease-type-test
-  (testing "autocomplete by disease name using \"park\" as an example"
+  (testing "disease type using \"park\" as an example"
     (let [db (d/db datomic-conn)
           disease-parks (->> (d/datoms db :aevt :do-term/name)
                              (keep (fn [[e _ v]]
@@ -113,25 +83,62 @@
                                        e)))
                              (map (partial d/entity db))
                              (shuffle))]
-      (do
-        (apply index-datomic-entity disease-parks)
-        (let [hits (-> (autocomplete "park" {:size (count disease-parks)})
-                       (get-in [:hits :hits]))]
+      (testing "autocomplete by disease name"
+        (do
+          (apply index-datomic-entity disease-parks)
+          (let [hits (-> (autocomplete "park" {:size (count disease-parks)})
+                         (get-in [:hits :hits]))]

-          (testing "match Parkinson's disease"
-            (some (fn [hit]
-                    (= "Parkinson's disease"
-                       (get-in hit [:_source :label])))
-                  hits))
-          (testing "matching early-onset Parkinson disease"
-            (some (fn [hit]
-                    (= "early-onset Parkinson disease"
-                       (get-in hit [:_source :label])))
-                  hits))
-          (testing "X-linked dystonia-parkinsonism"
-            (some (fn [hit]
-                    (= "X-linked dystonia-parkinsonism"
-                       (get-in hit [:_source :label])))
-                  hits))
+            (testing "match Parkinson's disease"
+              (some (fn [hit]
+                      (= "Parkinson's disease"
+                         (get-in hit [:_source :label])))
+                    hits))
+            (testing "matching early-onset Parkinson disease"
+              (some (fn [hit]
+                      (= "early-onset Parkinson disease"
+                         (get-in hit [:_source :label])))
+                    hits))
+            (testing "X-linked dystonia-parkinsonism"
+              (some (fn [hit]
+                      (= "X-linked dystonia-parkinsonism"
+                         (get-in hit [:_source :label])))
+                    hits))

-          )))))
+            ))))
+    ))
+
+(deftest transgene-type-test
+  (testing "transgene using syis1 as example"
+    (let [db (d/db datomic-conn)
+          transgenes-prefixed-syis1 (->> (d/datoms db :aevt :transgene/public-name)
+                                         (keep (fn [[e _ v]]
+                                                 (if (re-matches #"syIs1.*" v)
+                                                   e)))
+                                         (map (partial d/entity db))
+                                         (shuffle))]
+
+      (testing "autocompletion by transgene name"
+        (do
+          (apply index-datomic-entity transgenes-prefixed-syis1))
+          (let [hits (-> (autocomplete "syIs1")
+                         (get-in [:hits :hits]))]
+            (testing "result appears in autocompletion"
+              (is (some (fn [hit]
+                          (= "syIs101"
+                             (get-in hit [:_source :label])))
+                        hits)))
+            (testing "result in right order"
+              (is (= "syIs1" (-> (first hits)
+                                 (get-in [:_source :label])))))))
+
+      (testing "autocompletion by transgene name in lowercase"
+        (do
+          (apply index-datomic-entity transgenes-prefixed-syis1)
+          (let [hits (-> (autocomplete "syis1")
+                         (get-in [:hits :hits]))]
+            (is (some (fn [hit]
+                        (= "syIs101"
+                           (get-in hit [:_source :label])))
+                      hits)))))
+      )))


Disable TRACE test (for now)

Disable TRACE test (for now)

--- test/yada/trace_test.clj
+++ test/yada/trace_test.clj
@@ -8,10 +8,12 @@
    [yada.yada :as yada]
    [juxt.iota :refer (given)]))

-(deftest trace-test []
+;; For now disable TRACE - need to think a better way of returning a d/success from the chain, prior to response formation
+
+#_(deftest trace-test []
   (testing "Normal operation"
     (let [resource "Hello World!"
-          handler (yada/resource resource)
+          handler (yada resource)
           request (merge (request :trace "/")
                          {:body (java.io.ByteArrayInputStream. (.getBytes "Hello World!"))})
           response @(handler request)]
@@ -20,8 +22,8 @@
         :body :? #(.endsWith % "Hello World!"))))

   ;; TODO: TRACE needs to be documented
-  (testing "TRACE disabled"
-    (let [handler (yada/resource "Hello World!" {:trace false})
+  #_(testing "TRACE disabled"
+    (let [handler (yada "Hello World!" {:trace false})
           request (request :trace "/")
           response @(handler request)]
       (given response


infix.clj implements prefix->infix

infix.clj implements prefix->infix


Refine error display when muon boot fails


Do not try to move the out directory to the working directory.

This remove-prefix-from-path fails when its prefix is passed in as second arg.

--- src/incise/deploy/workflows/git_branch.clj
+++ src/incise/deploy/workflows/git_branch.clj
@@ -127,6 +127,7 @@
       (setup-branch branch)
       (->> *out-dir*
            (file-seq)
+           (rest) ; Skip the out directory
            (map move-to-work-dir)
            (keep identity)
            (log-files)


Simplified demo# with reductions.

Simplified demo# with reductions.

--- src/overtunes/songs/canone_alla_quarta.clj
+++ src/overtunes/songs/canone_alla_quarta.clj
@@ -12,16 +12,16 @@
     (->> notes (map play-at#) dorun)))

 (defn demo# [pitches]
-  (let [note-length 300
-        start (now)
-        end (+ (* note-length (count pitches) start))
-        timing (range start end note-length)
-        notes (map vector timing pitches)]
+  (let [times (reductions + (cons (now) (repeat 300)))
+        notes (map vector times pitches)]
     (play# notes)
     notes))

 ;(piano# 50)
 ;(demo# (range 60 73))
+
+
+

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


Try and clarify the actual play function again.

--- src/overtunes/songs/canone_alla_quarta.clj
+++ src/overtunes/songs/canone_alla_quarta.clj
@@ -92,24 +92,22 @@

 (defn bpm [per-minute] #(-> % (/ per-minute) (* 60) (* 1000)))

-(def t 0)
-(def p 1)
-(defn map-in [m k f] (map #(update-in % [k] f) m))
-(defn transform [k f] #(map-in % k f))
-(defn add [offset] (partial + offset))
+(defn transform [k f]
+ (let [map-in (fn [m k f] (map #(update-in % [k] f) m))]
+   #(map-in % k f)))
+
+(defn shift [point]
+  (let [offset (fn [point1 point2] (vec (map + point1 point2)))]
+        (partial map (partial offset point))))

 (defn canone-alla-quarta# []
-  (let [in #(transform p %)
-        after #(transform t (add %))
-        from-now (after (now))
-        tempo #(transform t %)
-        mirror (transform p -)
-        transpose #(transform p (add %))
-        leader #(=> % (after 1/2) (in g-major) (tempo (bpm 120)) from-now)
-        follower #(=> % mirror (transpose -3) (after 3) leader)
-        bass #(=> % (transpose -7) (in g-major) (tempo (bpm 120)) from-now)]
-    (=> bassline bass play#)
-    (=> melody leader play#)
-    (=> melody follower play#)))
+  (let [[timing pitch] [0 1]
+        in-time (comp (shift [(now) 0]) (transform timing (bpm 90)))
+        in-key (transform pitch g-major)
+        play-now# (comp play# in-key in-time)]
+
+    (=> bassline (shift [0 -7]) play-now#)
+    (=> melody (shift [1/2 0]) play-now#)
+    (=> melody (transform pitch -) (shift [7/2 -3]) play-now#)))

 (canone-alla-quarta#)


Demo run with a scale.

Demo run with a scale.

--- src/overtunes/songs/canone_alla_quarta.clj
+++ src/overtunes/songs/canone_alla_quarta.clj
@@ -64,7 +64,7 @@
       [from]))

 ;(even-melody# (map g-major
-;            (run [0 3 1 3 -1 0])
+;            (run [0 7 0])
 ;            ))

 (defn accumulate [series] (reductions + (cons 0 series)))


[#12451] Fix copy icon in message actions

--- src/status_im/ui/screens/status/views.cljs
+++ src/status_im/ui/screens/status/views.cljs
@@ -78,7 +78,8 @@
 (defn on-long-press-fn [on-long-press content image]
   (on-long-press
    (when-not image
-     [{:on-press #(react/copy-to-clipboard
+     [{:id       :copy
+       :on-press #(react/copy-to-clipboard
                    (components.reply/get-quoted-text-with-mentions
                     (get content :parsed-text)))
        :label    (i18n/label :t/sharing-copy-to-clipboard)}])))


I guess this helps with the new agenda-section thing

--- org-mode/src/com/gfredericks/org_agenda.clj
+++ org-mode/src/com/gfredericks/org_agenda.clj
@@ -657,7 +657,7 @@
                                                               ;; move rep entries to the bottom for the future blocks, so that
                                                               ;; nonrepeating items stick out
                                                               (if (= date today) (constantly nil) :repeat?)
-                                                              relevant-date
+                                                              #(or (relevant-date %) today)
                                                               :file
                                                               :line-number)))
                           :calendar-events (->> calendar-events


rule head now generates appropriate subclasses for drug and target

the previous version of this rule referenced the parent bio-entities
for both the drug and target in the interaction restrictions previously
(which is incorrect).

--- kabob-build/src/main/resources/edu/ucdenver/ccp/kabob/build/rules/temp/drugbank/drugbank_rules.clj
+++ kabob-build/src/main/resources/edu/ucdenver/ccp/kabob/build/rules/temp/drugbank/drugbank_rules.clj
@@ -15,15 +15,23 @@
          (?/interaction rdfs/subClassOf obo/MI_0407) ;direct interaction
          (?/interaction rdfs/subClassOf obo/GO_0005488) ;binding

+         ;; create a subclass of the target that will participate in this
+         ;; particular binding
+         (?/target rdfs/subClassOf ?/target_bioentity)
+
           ;; link the binding event to the target participant (protein in this case)
          (?/r_target_participant rdf/type owl/Restriction)
          (?/r_target_participant owl/onProperty obo/RO_0000057) ; has_participant
-         (?/r_target_participant owl/someValuesFrom ?/target_bioentity)
+         (?/r_target_participant owl/someValuesFrom ?/target)
+
+         ;; create a subclass of the drug molecule that will participate
+         ;; in this particular binding
+         (?/drug rdfs/subClassOf ?/drug_bioentity)

           ;; link the binding event to the drug
          (?/r_drug_participant rdf/type owl/Restriction)
          (?/r_drug_participant owl/onProperty obo/RO_0000057) ; has_participant
-         (?/r_drug_participant owl/someValuesFrom ?/drug_bioentity)
+         (?/r_drug_participant owl/someValuesFrom ?/drug)

           ;; this binding realizes the drug_role that inheres_in the drug
          (?/r_realizes_drug_role rdf/type owl/Restriction)
@@ -35,7 +43,7 @@
          ;;   so that it can be realized by the restriction above
          (?/r_inheres rdf/type owl/Restriction)
          (?/r_inheres owl/onProperty obo/RO_0000052) ;inheres_in
-         (?/r_inheres owl/someValuesFrom ?/drug_bioentity)
+         (?/r_inheres owl/someValuesFrom ?/drug)

          (?/inheres rdfs/subClassOf obo/CHEBI_23888) ;drug (role)
          (?/inheres rdfs/subClassOf ?/r_inheres)
@@ -72,6 +80,10 @@

   :reify ([?/interaction {:ln (:sha-1 "interaction" ?/target_bioentity ?/drug_bioentity)
                           :ns "kbio" :prefix "I_"}]
+          [?/target {:ln (:sha-1 ?/target_bioentity ?/drug_bioentity)
+                    :ns "kbio" :prefix "T_"}]
+          [?/drug {:ln (:sha-1 ?/target_bioentity ?/drug_bioentity)
+                    :ns "kbio" :prefix "D_"}]
           [?/r_target_participant {:ln (:restriction)
                  :ns "kbio" :prefix "RESTR_"}]
           [?/r_drug_participant {:ln (:restriction)


[#2059] Upgrade raven-clj & cheshire deps

--- backend/project.clj
+++ backend/project.clj
@@ -10,7 +10,7 @@
                  [org.slf4j/log4j-over-slf4j "1.7.26" :exclusions [org.slf4j/slf4j-api]]
                  [org.slf4j/jcl-over-slf4j "1.7.26" :exclusions [org.slf4j/slf4j-api]]
                  [org.slf4j/jul-to-slf4j "1.7.26" :exclusions [org.slf4j/slf4j-api]]
-                 [cheshire "5.8.1" :exclusions [com.fasterxml.jackson.core/jackson-core]]
+                 [cheshire "5.9.0" :exclusions [com.fasterxml.jackson.core/jackson-core]]
                  [clj-http "3.10.0" :exclusions [org.apache.httpcomponents/httpcore org.apache.httpcomponents/httpclient org.apache.httpcomponents/httpmime commons-io/commons-io]]
                  [clj-time "0.15.1"]
                  [com.layerware/hugsql "0.4.9"]
@@ -41,7 +41,7 @@
                  [org.immutant/web "2.1.10" :exclusions [ch.qos.logback/logback-classic]]
                  [org.postgresql/postgresql "42.2.5"]
                  [ragtime "0.7.2"]
-                 [raven-clj "1.6.0-alpha3"]
+                 [raven-clj "1.6.0"]
                  [ring "1.7.1" :exclusions [ring/ring-core]]
                  [ring/ring-core "1.7.1" :exclusions [ring/ring-codec]]
                  [ring/ring-defaults "0.3.2"]


fixed union query interpretation of read-local in UC

--- src/untangled/client/impl/om_plumbing.cljs
+++ src/untangled/client/impl/om_plumbing.cljs
@@ -22,10 +22,13 @@
       (let [top-level-prop (nil? query)
             key (or (:ast key) dkey)
             by-ident? (om/ident? key)
+            union? (map? query)
             data (if by-ident? (get-in @state key) (get @state key))]
-        {:value (if top-level-prop
-                  data
-                  (om/db->tree query data @state))}))))
+        {:value
+         (cond
+           union? (get (om/db->tree [{dkey query}] @state @state) dkey)
+           top-level-prop data
+           :else (om/db->tree query data @state))}))))

 (defn write-entry-point [env k params]
   (try


Version 0.1.3

Version 0.1.3

--- metlog-agent/project.clj
+++ metlog-agent/project.clj
@@ -1,4 +1,4 @@
-(defproject metlog-agent "0.1.3-SNAPSHOT"
+(defproject metlog-agent "0.1.3"
   :description "Metlog agent - polls data sources for upload to vault."

   :license {:name "Eclipse Public License"


Upgrade to Clojure 1.7

Upgrade to Clojure 1.7

--- metlog-vault/project.clj
+++ metlog-vault/project.clj
@@ -10,7 +10,7 @@

   :source-paths ["src-server"]

-  :dependencies [[org.clojure/clojure "1.7.0-RC2"]
+  :dependencies [[org.clojure/clojure "1.7.0"]
                  [org.clojure/clojurescript "0.0-3308"]
                  [com.ksmpartners/sql-file "0.1.0"]
                  [ring/ring-jetty-adapter "1.3.2"]


formatting

formatting

--- test/clj/backtype/storm/testing4j_test.clj
+++ test/clj/backtype/storm/testing4j_test.clj
@@ -141,4 +141,3 @@
            (Testing/advanceClusterTime cluster (int 12))
            (it/assert-failed tracker 2)
            ))))))
-


Removed unused test file

Removed unused test file

--- test/clj/salava/user/registration_test.clj
+++ test/clj/salava/user/registration_test.clj
@@ -1,41 +0,0 @@
-(ns salava.user.registration-test
-  (:require [salava.user.db :as db]
-            [clojure.test :refer :all]
-            [salava.core.migrator :as migrator]
-            [salava.core.test-utils :as t]))
-
-(def test-user {:id 1 :role "user" :private false})
-
-(def registration-data
-  {
-   :email "test.registration@example.com"
-   :first_name "Testing"
-   :last_name "Registration"
-   :country "FI"
-   :language "fi"
-   :password "123456"
-   :password_verify "123456"
-   :token "registerationToken"
-   :accept_terms "accepted"
-    })
-
-(t/deftest-ctx main-test [ctx]
-
- #_ (testing "register user"
-    (let [connect (db/register-user ctx (:email registration-data) (:first_name registration-data) (:last_name registration-data) (:country registration-data) (:language registration-data) (:password registration-data) (:password-verify registration-data))]
-      (is (=  "success" (:status connect)))
-     (is (=  "" (:message connect)))
-     ))
- #_ (testing "register user again with same data"
-    (let [connect (db/register-user ctx (:email registration-data) (:first_name registration-data) (:last_name registration-data) (:country registration-data) (:language registration-data) (:password registration-data) (:password-verify registration-data))]
-      (is (=  "error" (:status connect)))
-     (is (=  "user/Enteredaddressisalready" (:message connect)))
-     ))
-  (testing "get current state of configs"
-    (let [{:keys [status body]} (t/test-api-request ctx :post "/obpv1/user/register" {:params registration-data})]
-      (is (= 200 status))
-;;         (is (= "success" status))
-      ))
-  )
-;(migrator/run-test-reset)
-(migrator/reset-seeds (migrator/test-config))


Display the welcome message on startup

Display the welcome message on startup

--- dev-src/clj/comic_reader/dev.clj
+++ dev-src/clj/comic_reader/dev.clj
@@ -38,3 +38,5 @@
   (require 'comic-reader.system)
   (if-let [stop-fn (find-var 'comic-reader.system/stop)]
     (stop-fn)))
+
+(welcome)