refactor

refactor

--- src/cljs/gc_api_browser/tabbed_request.cljs
+++ src/cljs/gc_api_browser/tabbed_request.cljs
@@ -39,9 +39,11 @@
                                   request-string)))

 (defn edit-body [cursor]
-  (let [validation-result (validate-request cursor)]
+  (let [validation-result (validate-request cursor)
+        class-name (str "flex-container tabbed-request__body"
+                        (when (not (:valid validation-result)) " error"))]
     (dom/div nil
-             (dom/pre #js {:className (str "flex-container tabbed-request__body" (when (not (:valid validation-result)) " error"))}
+             (dom/pre #js {:className class-name}
                       (om/build content-editable (:request cursor)))
              (when (seq (:errors validation-result))
                (dom/ul nil


Update core.clj

Update core.clj

Updating docs regarding the use of the legacy functions related to command-queue for OpenCL 1.2.

--- src/clojure/uncomplicate/clojurecl/core.clj
+++ src/clojure/uncomplicate/clojurecl/core.clj
@@ -1289,9 +1289,10 @@
   "Creates a host or device command queue on a specific device.

   ** If you need to support OpenCL 1.2 platforms, you MUST use the alternative
-  [[legacy/command-queue-1*]] function or or risk JVM crash. What is important is the
-  version of the platform, not the devices. This function is for platforms
-  (regardless of the devices) supporting OpenCL 2.0 and higher. **
+  [[legacy/command-queue-1*]] function. Otherwise, you will get an
+  UnsupportedOperationException erorr. What is important is the version of the
+  platform, not the devices. This function is for platforms (regardless of the
+  devices) supporting OpenCL 2.0 and higher. **

   Arguments are:

@@ -1328,9 +1329,10 @@
   "Creates a host or device command queue on a specific device.

   ** If you need to support OpenCL 1.2 platforms, you MUST use the alternative
-  [[legacy/command-queue-1*]] function or or risk JVM crash. What is important is the
-  version of the platform, not the devices. This function is for platforms
-  (regardless of the devices) supporting OpenCL 2.0 and higher. **
+  [[legacy/command-queue-1*]] function. Otherwise, you will get an
+  UnsupportedOperationException erorr. What is important is the version of the
+  platform, not the devices. This function is for platforms (regardless of the
+  devices) supporting OpenCL 2.0 and higher. **

   Arguments are:


Replace insert-values with a select query for postgresql <= 8.1

Returning support was not added until PostgreSQL 8.2. This code has instead
been modified to fake it for PostgreSQL 8.1 by doing an SQL query on the
data in question after inserting.

This concept is known as RETURNING and was added in 8.2 as documented
in E.24.1 of the 8.2 guide:

    http://www.postgresql.org/docs/8.2/static/release-8-2.html

Signed-off-by: Ken Barber <470bc578162732ac7f9d387d34c4af4ca6e1b6f7@bob.sh>

--- src/com/puppetlabs/puppetdb/scf/storage.clj
+++ src/com/puppetlabs/puppetdb/scf/storage.clj
@@ -206,9 +206,13 @@
          (string? catalog-version)
          ((some-fn nil? string?) transaction-uuid)]
    :post [(map? %)]}
-  (sql/insert-values :catalogs
-    [:hash :api_version :catalog_version :transaction_uuid]
-    [hash api-version catalog-version transaction-uuid]))
+  (let [return (sql/insert-values :catalogs
+                 [:hash :api_version :catalog_version :transaction_uuid]
+                 [hash api-version catalog-version transaction-uuid])]
+    ;; PostgreSQL <= 8.1 does not support RETURNING so we fake it
+    (if (and (sutils/postgres?) (not (sutils/pg-newer-than-8-1?)))
+      (first (query-to-vec ["SELECT * FROM catalogs WHERE hash = ?" hash]))
+      return)))

 (defn update-catalog-metadata!
   "Given some catalog metadata, update the db"


added missing require to production.clj

added missing require to production.clj

--- clojure/src/limelight/clojure/production.clj
+++ clojure/src/limelight/clojure/production.clj
@@ -11,7 +11,8 @@
     [limelight.clojure.util :only (read-src map-for-clojure)]
     [limelight.clojure.theater :only (new-theater)])
   (:require
-    [limelight.clojure.production-player]))
+    [limelight.clojure.production-player]
+    [limelight.clojure.prop-building]))

 (defn- prod-illuminate [production]
   (let [player-path (resource-path production "production.clj")


move play code into a function

move play code into a function

--- src/polismath/simulation.clj
+++ src/polismath/simulation.clj
@@ -97,7 +97,8 @@

-(let [
+(defn basic-test []
+  (let [
       a (time2 "conv-update  a  1000" (conv-update {:rating-mat (named-matrix)} (random-votes 600 10)))
       b (time2 "conv-update  b  5000" (conv-update {:rating-mat (named-matrix)} (random-votes 5000 10)))
       b2 (time2 "conv-update b2 5000*10+100*1" (conv-update b (random-votes 100 1)))
@@ -105,7 +106,7 @@
     ]
   (println (keys a))
   (println (keys b))
-  )
+  ))

                                         ;  (pprint (sorted-map-by #(< (:id %1) (:id %2)) (:base-clusters b)))
 ;  (pprint (group-by :id (:base-clusters b)))


Improve parameter working

Improve parameter working

--- src/re_demo/info_button.cljs
+++ src/re_demo/info_button.cljs
@@ -39,7 +39,8 @@
                                :children [[component-title "Notes"]
                                           [:span "A tiny information button, which is light grey and unobrusive. When pressed, displays a popup contining helpful information. "]
                                           [:span "Designed to be used with input fields, to explain the purpose of the field."]
-                                          [:span "Helper CSS classes are available to format the text in the popover:"]
+                                          [:span "The popup has a dark theme, and uses white text. CSS classes for the text are
+                                           available as follows:to format the text in the popover"]
                                           [:ul
                                            [:li [:span {:style {:font-weight "bold"}} "info-heading"] " - apply heading/title style"]
                                            [:li [:span {:style {:font-weight "bold"}} "info-subheading"] " - apply subheading style"]


Mostly working

Mostly working

--- src/revat_poc/references.clj
+++ src/revat_poc/references.clj
@@ -1,5 +1,6 @@
 (ns revat-poc.references
-  (:require [liberator.core :refer [defresource]]
+  (:require [clojure.string :as string]
+            [liberator.core :refer [defresource]]
             [liberator.representation :refer [ring-response]]
             [ring.util.response :as response]))

@@ -22,25 +23,45 @@
 (defn valid-url? [url-str]
   (try
     (java.net.URL. url-str)
-    (catch java.net.MalformedURLException e false)))
+    (catch java.net.MalformedURLException e false)
+    (catch NullPointerException e false)))
+
+
+(defn put-request? [ctx]
+  (= :put (-> ctx :request :request-method)))
+
+
+(defn trimsplit [s delimiter]
+  (map string/trim (.split s delimiter)))
+
+
+(defn parse-content-type [ctx]
+  ;; Content-Type looks like this:
+  ;;   message/external-body; access-type=URL; URL="http://www.foo.com/file"
+
+  (let [entry (get-in ctx [:request :headers "content-type"])
+        [content-type & param-list] (trimsplit entry ";")
+        param-map (reduce merge {}
+                          (map (fn [p] (let [[k v] (trimsplit p "=")]
+                                         {(-> k (.toLowerCase) keyword) v}))
+                               param-list))]
+    {:content-type (.toLowerCase content-type)
+     :params param-map}))
+
+
+(defn processable? [ctx]
+  (if (put-request? ctx)
+    (let [url (valid-url? (:url-string ctx))]
+      [url {:url url}])
+    true))

 (defn known-content-type? [ctx]
-  ;; parse wonky content-type pieces
-  ;; validate that shit
-  ;; attach to the ctx
-  (let [ctype (get-in ctx [:request :headers "content-type"])]
-    (println ctype)
-    true
-    )
-
-  )
-
-(defn malformed? [ctx]
-  (when (= :put (-> ctx :request :request-method))
-    (let [body (-> ctx :request :body slurp)
-          url (valid-url? body)]
-      [(not url) {:url url}])))
+  (if (put-request? ctx)
+    (let [{:keys [content-type params]} (parse-content-type ctx)]
+      [(= "message/external-body" content-type)
+       {:url-string (:url params)}])
+    true))

 (defn put! [ctx name]
@@ -52,14 +73,8 @@
   :allowed-methods [:put :get]
   :can-put-to-missing? true
   :known-content-type? known-content-type?
-  :malformed? malformed?
+  :processable? processable?
   :exists? (fn [ctx] (exists? ctx name))
   :handle-ok (fn [ctx] (handle-deref ctx name))
-  :handle-exception (fn [ctx] (println (:exception ctx)))
+  :handle-exception (fn [ctx] (.printStackTrace (:exception ctx)))
   :put! (fn [ctx] (put! ctx name)))
-
-
-;; http://tools.ietf.org/html/rfc1521#page-42
-;; message/external-body
-;; Content-type: message/external-body; access-type=URL;
-;;                  URL="http://www.foo.com/file"


:art:

:art:

--- src/robot_overlord/core.cljs
+++ src/robot_overlord/core.cljs
@@ -56,10 +56,11 @@
 ;; =====
 ;; STATE
 ;; =====
-(defonce app-state (atom {:logotype   (string->printable "Robot Overlord")
-                          :contact    (string->printable "Want to know more? Drop us a line!")
-                          :who-we-are (string->printable "Meet Our Minions")
-                          :what-we-do (string->printable "Robot Overlord is a holistic tech product & consultancy firm, focusing on leading-edge technologies, data science, and AI, to create joyful experiences")}))
+(defonce app-state
+  (atom {:logotype   (string->printable "Robot Overlord")
+         :contact    (string->printable "Want to know more? Drop us a line!")
+         :who-we-are (string->printable "Meet Our Minions")
+         :what-we-do (string->printable "Robot Overlord is a holistic tech product & consultancy firm, focusing on leading-edge technologies, data science, and AI, to create joyful experiences")}))

 ;; =======
 ;; DISPLAY


added organize systematically

added organize systematically

--- src/babel/english/lexicon-verbcoach.clj
+++ src/babel/english/lexicon-verbcoach.clj
@@ -1542,6 +1542,17 @@

    "organize" {:synsem {:cat :verb
                 :sem {:pred :organize}}}
+
+   "organize systematically"
+   {:synsem {:cat :verb
+             :sem {:activity true
+                   :discrete false
+                   :pred :organize-systematically}
+             :subcat {:2 '()}}
+     :english {:past "organized systematically"
+               :participle "organizing systematically"
+               :present {:3sing "organizes systematically"}}}
+
    "our"
    (map #(unify %
                 {:synsem {:cat :det


base64->str fix

base64->str fix

--- src/clj/salava/extra/factory/routes.clj
+++ src/clj/salava/extra/factory/routes.clj
@@ -4,7 +4,7 @@
             [schema.core :as s]
             [salava.core.layout :as layout]
             [clojure.string :refer [split]]
-            [buddy.core.codecs :refer [base64->str]]
+            [salava.core.util :refer [base64->str]]
             [salava.extra.factory.db :as f]))

 (defn wrap-basic-auth [handler ctx]


missing default

missing default

--- src/cljs/infinitelives/pixi/sprite.cljs
+++ src/cljs/infinitelives/pixi/sprite.cljs
@@ -23,6 +23,7 @@
                    xhandle 0.5 yhandle 0.5
                    scale *default-scale*
                    alpha 1
+                   visible true
                    rotation 0
                    tiling false}}]
   (let [s (if tiling
@@ -170,6 +171,7 @@
                     xhandle 0.5 yhandle 0.5
                     scale 1
                     alpha 1
+                    visible true
                     rotation 0}}]
   (let [container (js/PIXI.Container.)]
     (assert container "creation of container failed and returned nil")


Fix for delete badge modal

Fix for delete badge modal

--- src/cljs/salava/core/ui/badge_grid.cljs
+++ src/cljs/salava/core/ui/badge_grid.cljs
@@ -22,8 +22,8 @@
     (path-for (str "/obpv1/badge/" id))
     {:handler
      (fn []
-       (init-data state)
-       (navigate-to (str "/badge")))}))
+       #_(init-data state)
+       #_(navigate-to (str "/badge")))}))

 (defn delete-badge-modal [id state init-data]
   [:div#delete-modal
@@ -61,12 +61,12 @@
                                  (cond
                                    revoked [:div.icons
                                             [:div.lefticon [:i {:class "fa fa-ban"}] (t :badge/Revoked)]
-                                            [:a.righticon {:class "righticon revoked" :on-click (fn [] (m/modal! [delete-badge-modal id state init-data]
-                                                                                {:size :lg})) :title (t :badge/Delete)} [:i {:class "fa fa-trash"}]]]
+                                            [:a.righticon {:class "righticon revoked" :on-click #(do (.preventDefault %)(m/modal! [delete-badge-modal id state init-data]
+                                                                                {:size :lg :hidden (fn [] (init-data state))})) :title (t :badge/Delete)} [:i {:class "fa fa-trash"}]]]
                                    expired? [:div.icons
                                              [:div.lefticon [:i {:class "fa fa-history"}] (t :badge/Expired)]
-                                             [:a.righticon {:class "righticon expired" :on-click (fn [] (m/modal! [delete-badge-modal id state init-data]
-                                                                                {:size :lg})) :title (t :badge/Delete)} [:i {:class "fa fa-trash"}]]])
+                                             [:a.righticon {:class "righticon expired" :on-click #(do (.preventDefault %) (m/modal! [delete-badge-modal id state init-data]
+                                                                                {:size :lg :hidden (fn [] (init-data state))})) :title (t :badge/Delete)} [:i {:class "fa fa-trash"}]]])
                                  [:a {:href "#" :on-click #(do (.preventDefault %)(mo/open-modal [:badge :info] {:badge-id id} {:hide (fn [] (init-data state))}))}
                                   (if image_file
                                     [:div.media-left


removing configuration until zookeeper is available

--- src/clojure/src/leela/blackbox/main.clj
+++ src/clojure/src/leela/blackbox/main.clj
@@ -24,17 +24,11 @@
                                     :default "localhost"
                                     :assoc-fn seed-assoc-fn]
                                    ["--endpoint" "the address to bind to"
-                                    :default "tcp://*:9999"]
-                                   ["--queue-size" "maximum size of pending requests"
-                                    :default 64
-                                    :parse-fn #(Integer. %)]
-                                   ["--workers" "number of workers"
-                                    :default 32
-                                    :parse-fn #(Integer. %)])]
+                                    :default "tcp://*:9999"])]
     (when (:help options)
       (println banner)
       (java.lang.System/exit 0))

     (zserver/server-start (zserver/create-session (:seed options) (:keyspace options))
                           (ZMQ/context 1)
-                          options)))
+                          {:capabilities 64 :queue-size 32})))


Added ruby, rt, rp, source, track, samp and page-meta

--- src/shared/hyjinks/core.cljc
+++ src/shared/hyjinks/core.cljc
@@ -268,12 +268,12 @@

 (deftags h1 h2 h3 h4 h5 h6 (hr void-element) (br void-element))
 (deftags ul ol li dl dt dd)
-(deftags b i u s del ins small sup sub code kbd dfn em strong)
+(deftags b i u s del ins small sup sub code kbd dfn em strong ruby rt rp)
 (deftags pre q blockquote cite mark)
 (deftags a (img void-element))
 (deftags (embed void-element) (object void-element) (param void-element))
-(deftags iframe audio video canvas)
-(deftags p span div textarea output)
+(deftags iframe audio video (source void-element) (track void-element) canvas)
+(deftags p span div textarea output samp)
 (deftags table thead tbody tfoot th tr td caption colgroup (col void-element))
 (deftags address article header footer main section aside nav)
 (deftags figure figcaption legend)
@@ -309,6 +309,10 @@
   "Sets the page's favicon to the given URL."
   ([type url] (link {:rel "shortcut icon" :type type :href url}))
   ([url] (link {:rel "shortcut icon" :href url})))
+
+(def page-meta
+  "Creates a <meta> tag. Is also a void element."
+  (tag "meta" void-element))

 (defn- split-child-items [contents]
   ((juxt filter remove) child-item? (flatten contents)))


comment io.

comment io.

--- clojure/src/main/resources/clojure/java/io.clj
+++ clojure/src/main/resources/clojure/java/io.clj
@@ -21,27 +21,27 @@
                     CharArrayReader Closeable)
     (java.net URI URL MalformedURLException Socket URLDecoder URLEncoder)))

-(def
+#_(def
   ^{:doc "Type object for a Java primitive byte array."
     :private true
     }
   byte-array-type (class (make-array Byte/TYPE 0)))

-(def
+#_(def
   ^{:doc "Type object for a Java primitive char array."
     :private true}
   char-array-type (class (make-array Character/TYPE 0)))

-(defprotocol ^{:added "1.2"} Coercions
+#_(defprotocol ^{:added "1.2"} Coercions
   "Coerce between various 'resource-namish' things."
   (^{:tag java.io.File, :added "1.2"} as-file [x] "Coerce argument to a file.")
   (^{:tag java.net.URL, :added "1.2"} as-url [x] "Coerce argument to a URL."))

-(defn- escaped-utf8-urlstring->str [s]
+#_(defn- escaped-utf8-urlstring->str [s]
   (-> (clojure.string/replace s "+" (URLEncoder/encode "+" "UTF-8"))
     (URLDecoder/decode "UTF-8")))

-(extend-protocol Coercions
+#_(extend-protocol Coercions
   nil
   (as-file [_] nil)
   (as-url [_] nil)
@@ -66,7 +66,7 @@
   (as-url [u] (.toURL u))
   (as-file [u] (as-file (as-url u))))

-(defprotocol ^{:added "1.2"} IOFactory
+#_(defprotocol ^{:added "1.2"} IOFactory
   "Factory functions that create ready-to-use, buffered versions of
    the various Java I/O stream types, on top of anything that can
    be unequivocally converted to the requested kind of stream.
@@ -83,7 +83,7 @@
   (^{:added "1.2"} make-input-stream [x opts] "Creates a BufferedInputStream. See also IOFactory docs.")
   (^{:added "1.2"} make-output-stream [x opts] "Creates a BufferedOutputStream. See also IOFactory docs."))

-(defn ^Reader reader
+#_(defn ^Reader reader
   "Attempts to coerce its argument into an open java.io.Reader.
    Default implementations always return a java.io.BufferedReader.

@@ -101,7 +101,7 @@
   [x & opts]
   (make-reader x (when opts (apply hash-map opts))))

-(defn ^Writer writer
+#_(defn ^Writer writer
   "Attempts to coerce its argument into an open java.io.Writer.
    Default implementations always return a java.io.BufferedWriter.

@@ -118,7 +118,7 @@
   [x & opts]
   (make-writer x (when opts (apply hash-map opts))))

-(defn ^InputStream input-stream
+#_(defn ^InputStream input-stream
   "Attempts to coerce its argument into an open java.io.InputStream.
    Default implementations always return a java.io.BufferedInputStream.

@@ -135,7 +135,7 @@
   [x & opts]
   (make-input-stream x (when opts (apply hash-map opts))))

-(defn ^OutputStream output-stream
+#_(defn ^OutputStream output-stream
   "Attempts to coerce its argument into an open java.io.OutputStream.
    Default implementations always return a java.io.BufferedOutputStream.

@@ -152,16 +152,16 @@
   [x & opts]
   (make-output-stream x (when opts (apply hash-map opts))))

-(defn- ^Boolean append? [opts]
+#_(defn- ^Boolean append? [opts]
   (boolean (:append opts)))

-(defn- ^String encoding [opts]
+#_(defn- ^String encoding [opts]
   (or (:encoding opts) "UTF-8"))

-(defn- buffer-size [opts]
+#_(defn- buffer-size [opts]
   (or (:buffer-size opts) 1024))

-(def default-streams-impl
+#_(def default-streams-impl
   {:make-reader (fn [x opts] (make-reader (make-input-stream x opts) opts))
    :make-writer (fn [x opts] (make-writer (make-output-stream x opts) opts))
    :make-input-stream (fn [x opts]
@@ -171,65 +171,65 @@
                          (throw (IllegalArgumentException.
                                   (str "Cannot open <" (pr-str x) "> as an OutputStream."))))})

-(defn- inputstream->reader
+#_(defn- inputstream->reader
   [^InputStream is opts]
   (make-reader (InputStreamReader. is (encoding opts)) opts))

-(defn- outputstream->writer
+#_(defn- outputstream->writer
   [^OutputStream os opts]
   (make-writer (OutputStreamWriter. os (encoding opts)) opts))

-(extend BufferedInputStream
+#_(extend BufferedInputStream
   IOFactory
   (assoc default-streams-impl
     :make-input-stream (fn [x opts] x)
     :make-reader inputstream->reader))

-(extend InputStream
+#_(extend InputStream
   IOFactory
   (assoc default-streams-impl
     :make-input-stream (fn [x opts] (BufferedInputStream. x))
     :make-reader inputstream->reader))

-(extend Reader
+#_(extend Reader
   IOFactory
   (assoc default-streams-impl
     :make-reader (fn [x opts] (BufferedReader. x))))

-(extend BufferedReader
+#_(extend BufferedReader
   IOFactory
   (assoc default-streams-impl
     :make-reader (fn [x opts] x)))

-(extend Writer
+#_(extend Writer
   IOFactory
   (assoc default-streams-impl
     :make-writer (fn [x opts] (BufferedWriter. x))))

-(extend BufferedWriter
+#_(extend BufferedWriter
   IOFactory
   (assoc default-streams-impl
     :make-writer (fn [x opts] x)))

-(extend OutputStream
+#_(extend OutputStream
   IOFactory
   (assoc default-streams-impl
     :make-output-stream (fn [x opts] (BufferedOutputStream. x))
     :make-writer outputstream->writer))

-(extend BufferedOutputStream
+#_(extend BufferedOutputStream
   IOFactory
   (assoc default-streams-impl
     :make-output-stream (fn [x opts] x)
     :make-writer outputstream->writer))

-(extend File
+#_(extend File
   IOFactory
   (assoc default-streams-impl
     :make-input-stream (fn [^File x opts] (make-input-stream (FileInputStream. x) opts))
     :make-output-stream (fn [^File x opts] (make-output-stream (FileOutputStream. x (append? opts)) opts))))

-(extend URL
+#_(extend URL
   IOFactory
   (assoc default-streams-impl
     :make-input-stream (fn [^URL x opts]
@@ -242,13 +242,13 @@
                             (make-output-stream (as-file x) opts)
                             (throw (IllegalArgumentException. (str "Can not write to non-file URL <" x ">")))))))

-(extend URI
+#_(extend URI
   IOFactory
   (assoc default-streams-impl
     :make-input-stream (fn [^URI x opts] (make-input-stream (.toURL x) opts))
     :make-output-stream (fn [^URI x opts] (make-output-stream (.toURL x) opts))))

-(extend String
+#_(extend String
   IOFactory
   (assoc default-streams-impl
     :make-input-stream (fn [^String x opts]
@@ -262,34 +262,34 @@
                             (catch MalformedURLException err
                               (make-output-stream (File. x) opts))))))

-(extend Socket
+#_(extend Socket
   IOFactory
   (assoc default-streams-impl
     :make-input-stream (fn [^Socket x opts] (make-input-stream (.getInputStream x) opts))
     :make-output-stream (fn [^Socket x opts] (make-output-stream (.getOutputStream x) opts))))

-(extend byte-array-type
+#_(extend byte-array-type
   IOFactory
   (assoc default-streams-impl
     :make-input-stream (fn [x opts] (make-input-stream (ByteArrayInputStream. x) opts))))

-(extend char-array-type
+#_(extend char-array-type
   IOFactory
   (assoc default-streams-impl
     :make-reader (fn [x opts] (make-reader (CharArrayReader. x) opts))))

-(extend Object
+#_(extend Object
   IOFactory
   default-streams-impl)

-(defmulti
+#_(defmulti
   ^{:doc "Internal helper for copy"
     :private true
     :arglists '([input output opts])}
   do-copy
   (fn [input output opts] [(type input) (type output)]))

-(defmethod do-copy [InputStream OutputStream] [^InputStream input ^OutputStream output opts]
+#_(defmethod do-copy [InputStream OutputStream] [^InputStream input ^OutputStream output opts]
   (let [buffer (make-array Byte/TYPE (buffer-size opts))]
     (loop []
       (let [size (.read input buffer)]
@@ -297,7 +297,7 @@
           (do (.write output buffer 0 size)
             (recur)))))))

-(defmethod do-copy [InputStream Writer] [^InputStream input ^Writer output opts]
+#_(defmethod do-copy [InputStream Writer] [^InputStream input ^Writer output opts]
   (let [^"[C" buffer (make-array Character/TYPE (buffer-size opts))
         in (InputStreamReader. input (encoding opts))]
     (loop []
@@ -306,11 +306,11 @@
           (do (.write output buffer 0 size)
             (recur)))))))

-(defmethod do-copy [InputStream File] [^InputStream input ^File output opts]
+#_(defmethod do-copy [InputStream File] [^InputStream input ^File output opts]
   (with-open [out (FileOutputStream. output)]
     (do-copy input out opts)))

-(defmethod do-copy [Reader OutputStream] [^Reader input ^OutputStream output opts]
+#_(defmethod do-copy [Reader OutputStream] [^Reader input ^OutputStream output opts]
   (let [^"[C" buffer (make-array Character/TYPE (buffer-size opts))
         out (OutputStreamWriter. output (encoding opts))]
     (loop []
@@ -321,7 +321,7 @@
             (recur))
           (.flush out))))))

-(defmethod do-copy [Reader Writer] [^Reader input ^Writer output opts]
+#_(defmethod do-copy [Reader Writer] [^Reader input ^Writer output opts]
   (let [^"[C" buffer (make-array Character/TYPE (buffer-size opts))]
     (loop []
       (let [size (.read input buffer)]
@@ -329,19 +329,19 @@
           (do (.write output buffer 0 size)
             (recur)))))))

-(defmethod do-copy [Reader File] [^Reader input ^File output opts]
+#_(defmethod do-copy [Reader File] [^Reader input ^File output opts]
   (with-open [out (FileOutputStream. output)]
     (do-copy input out opts)))

-(defmethod do-copy [File OutputStream] [^File input ^OutputStream output opts]
+#_(defmethod do-copy [File OutputStream] [^File input ^OutputStream output opts]
   (with-open [in (FileInputStream. input)]
     (do-copy in output opts)))

-(defmethod do-copy [File Writer] [^File input ^Writer output opts]
+#_(defmethod do-copy [File Writer] [^File input ^Writer output opts]
   (with-open [in (FileInputStream. input)]
     (do-copy in output opts)))

-(defmethod do-copy [File File] [^File input ^File output opts]
+#_(defmethod do-copy [File File] [^File input ^File output opts]
   (with-open [in (-> input FileInputStream. .getChannel)
               out (-> output FileOutputStream. .getChannel)]
     (let [sz (.size in)]
@@ -351,34 +351,34 @@
           (when (< pos sz)
             (recur pos)))))))

-(defmethod do-copy [String OutputStream] [^String input ^OutputStream output opts]
+#_(defmethod do-copy [String OutputStream] [^String input ^OutputStream output opts]
   (do-copy (StringReader. input) output opts))

-(defmethod do-copy [String Writer] [^String input ^Writer output opts]
+#_(defmethod do-copy [String Writer] [^String input ^Writer output opts]
   (do-copy (StringReader. input) output opts))

-(defmethod do-copy [String File] [^String input ^File output opts]
+#_(defmethod do-copy [String File] [^String input ^File output opts]
   (do-copy (StringReader. input) output opts))

-(defmethod do-copy [char-array-type OutputStream] [input ^OutputStream output opts]
+#_(defmethod do-copy [char-array-type OutputStream] [input ^OutputStream output opts]
   (do-copy (CharArrayReader. input) output opts))

-(defmethod do-copy [char-array-type Writer] [input ^Writer output opts]
+#_(defmethod do-copy [char-array-type Writer] [input ^Writer output opts]
   (do-copy (CharArrayReader. input) output opts))

-(defmethod do-copy [char-array-type File] [input ^File output opts]
+#_(defmethod do-copy [char-array-type File] [input ^File output opts]
   (do-copy (CharArrayReader. input) output opts))

-(defmethod do-copy [byte-array-type OutputStream] [^"[B" input ^OutputStream output opts]
+#_(defmethod do-copy [byte-array-type OutputStream] [^"[B" input ^OutputStream output opts]
   (do-copy (ByteArrayInputStream. input) output opts))

-(defmethod do-copy [byte-array-type Writer] [^"[B" input ^Writer output opts]
+#_(defmethod do-copy [byte-array-type Writer] [^"[B" input ^Writer output opts]
   (do-copy (ByteArrayInputStream. input) output opts))

-(defmethod do-copy [byte-array-type File] [^"[B" input ^Writer output opts]
+#_(defmethod do-copy [byte-array-type File] [^"[B" input ^Writer output opts]
   (do-copy (ByteArrayInputStream. input) output opts))

-(defn copy
+#_(defn copy
   "Copies input to output.  Returns nil or throws IOException.
   Input may be an InputStream, Reader, File, byte[], or String.
   Output may be an OutputStream, Writer, or File.
@@ -395,7 +395,7 @@
   [input output & opts]
   (do-copy input output (when opts (apply hash-map opts))))

-(defn ^String as-relative-path
+#_(defn ^String as-relative-path
   "Take an as-file-able thing and return a string if it is
    a relative path, else IllegalArgumentException."
   {:added "1.2"}
@@ -405,7 +405,7 @@
       (throw (IllegalArgumentException. (str f " is not a relative path")))
       (.getPath f))))

-(defn ^File file
+#_(defn ^File file
   "Returns a java.io.File, passing each arg to as-file.  Multiple-arg
    versions treat the first argument as parent and subsequent args as
    children relative to the parent."
@@ -417,7 +417,7 @@
   ([parent child & more]
     (reduce file (file parent child) more)))

-(defn delete-file
+#_(defn delete-file
   "Delete file f. Raise an exception if it fails unless silently is true."
   {:added "1.2"}
   [f & [silently]]
@@ -425,7 +425,7 @@
     silently
     (throw (java.io.IOException. (str "Couldn't delete " f)))))

-(defn make-parents
+#_(defn make-parents
   "Given the same arg(s) as for file, creates all parent directories of
    the file they represent."
   {:added "1.2"}
@@ -433,7 +433,7 @@
   (when-let [parent (.getParentFile ^File (apply file f more))]
     (.mkdirs parent)))

-(defn ^URL resource
+#_(defn ^URL resource
   "Returns the URL for a named resource. Use the context class loader
    if no loader is specified."
   {:added "1.2"}


fix test after rename

fix test after rename

--- test/bløggr/posts_test.clj
+++ test/bløggr/posts_test.clj
@@ -19,8 +19,8 @@
 (def blogdate (t/from-time-zone (t/date-time 2007 8 28 1 59 36)
                                 (t/time-zone-for-offset 0)))

-(fact "filename-body-map turns a post into title => body map"
-  (filename-body-map {:header {:slug "really-cool-post" :date blogdate} :body "post body"}) =>
+(fact "post->path-map turns a post into title => body map"
+  (post->path-map {:header {:slug "really-cool-post" :date blogdate} :body "post body"}) =>
   {"/2007/08/28/really-cool-post/index.html" "post body"})

 (fact "parse-post extracts header from blog post"


Add test for empty stack

Add test for empty stack

--- test/cortex/wiring_test.clj
+++ test/cortex/wiring_test.clj
@@ -7,7 +7,12 @@
     (is (= 2 (output (calc m 1))))))

 (deftest test-stack-module
+  ;; simple 2-layer stack
   (let [m (function-module inc)
         st (stack-module [m m])]
-    (is (= 3 (output (calc st 1))))))
+    (is (= 3 (output (calc st 1)))))
+
+  ;; empty stack
+  (let [st (stack-module [])]
+    (is (= 1 (output (calc st 1))))))


fix: bug in transitive-types test

fix: bug in transitive-types test

--- test/deepfns/core_test.cljc
+++ test/deepfns/core_test.cljc
@@ -378,9 +378,9 @@
     [:foo [:bar {:fizz :buzz}]]
     {:foo 1 :bar 2 :buzz 3}

-    [:foo  2 [:bar {:fizz :baz}]]
+    [1 2 [3]]
+    [:foo 2 [:bar {:fizz :baz}]]
     {:foo 1 :bar 3}
-    {:foo 1 :bar 2 :buzz 3}

     {:foo {:bar 1} :fizz 2 :buzz [3 "foo"]}
     {:foo {:bar :1} :fizz :2 :buzz [:3 "foo"]}


send utc instance literal for chat time

send utc instance literal for chat time

--- src/wombats/sockets/game.clj
+++ src/wombats/sockets/game.clj
@@ -4,7 +4,6 @@
             [clojure.core.async :refer [put! <! timeout]]
             [clojure.edn :as edn]
             [clj-time.core :as t]
-            [clj-time.local :as l]
             [clj-time.periodic :as p]
             [chime :refer [chime-at]]
             [io.pedestal.http.jetty.websockets :as ws]
@@ -212,7 +211,9 @@
       (let [formatted-message {:username github-username
                                :message message
                                :color (get-player-color game-id chan-id)
-                               :timestamp (str (l/local-now))}]
+                               :timestamp (->> (t/now)
+                                               (format "#inst \"%s\"")
+                                               (read-string))}]
         (broadcast-to-viewers game-id
                               (m/chat-message game-id formatted-message))))))


Double check that current user exists

Double check that current user exists

--- src/territory_bro/routes.clj
+++ src/territory_bro/routes.clj
@@ -81,7 +81,9 @@
                                :authenticated (not (nil? auth/*user*)))})))

 (defn- current-user-id [conn]
-  (::user/id (user/get-by-subject conn (:sub auth/*user*))))
+  (let [id (::user/id (user/get-by-subject conn (:sub auth/*user*)))]
+    (assert id)
+    id))

 (defn create-congregation [request]
   (auth/with-authenticated-user request


Fix typo in docstring: seperator -> separator

--- src/testdouble/cljs/csv.cljs
+++ src/testdouble/cljs/csv.cljs
@@ -27,9 +27,9 @@
 (defn write-csv
   "Writes data to String in CSV-format.
   Accepts the following options:
-  :separator - field seperator
+  :separator - field separator
                (default ,)
-  :newline   - line seperator
+  :newline   - line separator
                (accepts :lf or :cr+lf)
                (default :lf)
   :quote?    - wrap in quotes


Close apk file when getting version

Close apk file when getting version

--- src/video_server/android.clj
+++ src/video_server/android.clj
@@ -18,13 +18,14 @@
 (defn apk-version
   "Returns the version information for the specified apk file."
   [file]
-  (let [apk (-> file (ApkParser.) .getApkMeta)]
-    {:label (.getLabel apk)
-     :package-name (.getPackageName apk)
-     :version-code (.getVersionCode apk)
-     :version-name (.getVersionName apk)
-     :min-sdk-version (.getMinSdkVersion apk)
-     :filename (apk-filename)}))
+  (with-open [parser (ApkParser. file)]
+    (let [apk (.getApkMeta parser)]
+      {:label (.getLabel apk)
+       :package-name (.getPackageName apk)
+       :version-code (.getVersionCode apk)
+       :version-name (.getVersionName apk)
+       :min-sdk-version (.getMinSdkVersion apk)
+       :filename (apk-filename)})))

 (defn read-apk-version
   "Attemps to read the apk version from the resource found on the


Mapv uses transients under the hood

Mapv uses transients under the hood

--- src/wireframes/transform.clj
+++ src/wireframes/transform.clj
@@ -67,7 +67,7 @@
   (translate 0 0 0))

 (defn dot-product [as bs]
-  (reduce + (map * as bs)))
+  (reduce + (mapv * as bs)))

 (defn transform-point [matrix point]
   (mapv


CMR-1600: Removed unused function

CMR-1600: Removed unused function

--- search-app/src/cmr/search/services/parameters/parameter_validation.clj
+++ search-app/src/cmr/search/services/parameters/parameter_validation.clj
@@ -692,16 +692,6 @@
       (err/throw-service-errors :bad-request errors)))
   params)

-(defn validate-json-conditions
-  "Validates the query parameters passed in with an AQL or JSON search.
-  Throws exceptions to send to the user. Returns parameters if validation
-  was successful so it can be chained with other calls."
-  [concept-type params]
-  (let [errors (mapcat #(% concept-type params) standard-query-parameter-validations)]
-    (when (seq errors)
-      (err/throw-service-errors :bad-request errors)))
-  params)
-
 (defn validate-timeline-parameters
   "Validates the query parameters passed in with a timeline search.
   Throws exceptions to send to the user. Returns parameters if validation


correct transaction api routes

correct transaction api routes

--- src/clj/clj_money/web/server.clj
+++ src/clj/clj_money/web/server.clj
@@ -197,11 +197,11 @@
   (model-route PATCH "/api/accounts/:id" accounts-api/update)
   (model-route DELETE "/api/accounts/:id" accounts-api/delete)

-  (model-route GET "/api/transactions" transactions-api/index)
+  (model-route GET "/api/transactions/:entity-id" transactions-api/index)
   (model-route GET "/api/transactions/:transaction-date/:id" transactions-api/get-one)
   (model-route POST "/api/entities/:entity-id/transactions" transactions-api/create)
-  (model-route PATCH "/api/transactions/:id" transactions-api/update)
-  (model-route DELETE "/api/transactions/:id" transactions-api/delete)
+  (model-route PATCH "/api/transactions/:transaction-date/:id" transactions-api/update)
+  (model-route DELETE "/api/transactions/:transaction-date/:id" transactions-api/delete)

   (model-route GET "/api/transaction-items" transaction-items-api/index)


refine middleware logging

refine middleware logging

--- src/clj/clj_money/web/server.clj
+++ src/clj/clj_money/web/server.clj
@@ -240,10 +240,10 @@
     (fn [{:keys [request-method uri] :as request}]
       (if (test-fn request)
         (do
-          (log/debug "apply middleware " description request-method uri)
+          (log/debug "apply middleware " description " to " request-method " " route)
           ((wrapper-fn handler) request))
         (do
-          (log/debug "ignore middleware " description request-method uri)
+          (log/debug "ignore middleware " description " for " request-method " " route)
           (handler request))))))

 (defn-  wrap-routes


implementing sample reference from comments to users

--- src/clj/eventsourcing/custom.clj
+++ src/clj/eventsourcing/custom.clj
@@ -208,7 +208,8 @@
                     {:comments (lazy-seq (get-entities :comment/author eid))})))

 (defn get-comment [eid]
-  (map->Comment (get-entity eid)))
+  (let [e (get-entity eid)]
+    (map->Comment (merge e {:users (lazy-seq [(get-entity (:comment/author e))])}))))

 #_(evdb/open)


fix docker client error handling #140

fix docker client error handling
#140

--- src/clj/swarmpit/docker/http.clj
+++ src/clj/swarmpit/docker/http.clj
@@ -63,13 +63,18 @@
         (-> response :body (parse-string true))))
     (catch IOException exception
       (throw (let [error (.getMessage exception)]
-               (ex-info (str "Docker failure: " error) {:message error}))))
+               (ex-info (str "Docker failure: " error) {:status 500
+                                                        :body   {:error error}}))))
     (catch ExceptionInfo exception
       (throw (let [data (some-> exception (ex-data))
+                   status (:status data)
                    error (if (= "application/json" ((:headers data) "Content-Type"))
                            (parse-string (:body data) true)
-                           {:message (:reason-phrase data)})]
-               (ex-info (str "Docker error: " (:message error)) error))))))
+                           (:reason-phrase data))]
+               (ex-info
+                 (str "Docker error: " (:message error))
+                 {:status status
+                  :body   {:error error}}))))))

 (defn get
   ([uri] (get uri nil nil))


Improved paddle collis detection.

Improved paddle collis detection.

Added dx & dy to ball, picking starting values for them at random.
Could use better init dx dx values.

--- src/cljs/clj_mini_apps/pong.cljs
+++ src/cljs/clj_mini_apps/pong.cljs
@@ -15,8 +15,6 @@
 (def paddle-height 100)

 (def speed 7)
-
-(def ball-speed 2)

 (defn init-game []
   (do
@@ -36,8 +34,10 @@
     (q/ellipse 550 250 ball-size ball-size))

   {:player {:x 59 :y 250}
-   :computer {:x 1040 :y 250}
-   :ball {:x 550 :y 250}
+   :cpu    {:x 1040 :y 250}
+   :ball   {:x 550 :y 250
+            :dx (+ 1 (rand-nth (range 3)))
+            :dy (+ 1 (rand-nth (range 3)))}
    :is-running? false})

 (defn move-player-paddle
@@ -49,7 +49,7 @@
 (defn start-game
   [state]
   (do (jq/html ($ "#pong-status") ""))
-  (if (= 2 (count (:ball state)))
+  (if (not (#{:x-dir :y-dir} (keys (:ball state))))
     (as-> state state
       (assoc-in state [:ball :x-dir] (rand-nth [+ -]))
       (assoc-in state [:ball :y-dir] (rand-nth [+ -]))
@@ -60,8 +60,8 @@
   [state]
   (if (:is-running? state)
     (as-> state state
-      (update-in state [:ball :y] (:y-dir (:ball state)) ball-speed)
-      (update-in state [:ball :x] (:x-dir (:ball state)) ball-speed))
+      (update-in state [:ball :y] (:y-dir (:ball state)) (:dy (:ball state)))
+      (update-in state [:ball :x] (:x-dir (:ball state)) (:dx (:ball state))))
     state))

 (defn handle-input
@@ -75,7 +75,8 @@
     :r (init-game)
     state))

-(defn on-collision [state]
+(defn on-collision
+  [state]
   (let [ball-x (:x (:ball state))
         ball-y (:y (:ball state))
         top-wall (+ 9 7.5 2)
@@ -88,17 +89,17 @@
       (update-in state [:ball :y-dir] not-dir)

       ;;check w/ player paddle
-      (and (< ball-x (+ (:x (:player state))
-                        paddle-width))
-           (< ball-y (+ (:y (:player state))
-                        50))
-           (> ball-y (- (:y (:player state))
-                        50)))
+      (and (< ball-x (+ (:x (:player state)) paddle-width))
+           (> ball-x (- (:x (:player state)) paddle-width))
+           (< ball-y (+ (:y (:player state)) 50))
+           (> ball-y (- (:y (:player state)) 50)))
       (update-in state [:ball :x-dir] not-dir)

       ;;check w/ cpu paddle
-      (> ball-x (- (:x (:computer state))
-                   paddle-width))
+      (and (> ball-x (- (:x (:cpu state)) paddle-width))
+           (< ball-x (+ (:x (:cpu state)) paddle-width))
+           (< ball-y (+ (:y (:cpu state)) 50))
+           (> ball-y (- (:y (:cpu state)) 50)))
       (update-in state [:ball :x-dir] not-dir)

       :else state)))
@@ -115,8 +116,8 @@

   (q/rect ((state :player) :x)
           ((state :player) :y) paddle-width paddle-height)
-  (q/rect ((state :computer) :x)
-          ((state :computer) :y) paddle-width paddle-height)
+  (q/rect ((state :cpu) :x)
+          ((state :cpu) :y) paddle-width paddle-height)
   (q/ellipse ((state :ball) :x)
              ((state :ball) :y) ball-size ball-size))


connect missing mouse events to signal

connect missing mouse events to signal

--- src/cljs/cljs_morphic/event.cljs
+++ src/cljs/cljs_morphic/event.cljs
@@ -45,21 +45,29 @@
         (>! signals {:type :click-right :target-props props :args {:pos pos}})
         (>! signals {:type :click-left :target-props props :args {:pos pos}}))))))

-(defn extract-mouse-enter-handler [morph]
-  ; mouseEnter
-  )
+(defn extract-mouse-enter-handler [props]
+  (fn [e]
+    (.preventDefault e)
+    (go
+       (>! signals {:type :mouse-enter :target-props props :args {}}))))

-(defn extract-mouse-leave-handler [morph]
-  ; mouseLeave
-  )
+(defn extract-mouse-leave-handler [props]
+  (fn [e]
+    (.preventDefault e)
+    (go
+       (>! signals {:type :mouse-leave :target-props props :args {}}))))

 (defn extract-drag-enter-handler [morph]
-  ; mouseEnterDragging
-  )
+  (fn [e]
+    (.preventDefault e)
+    (go
+       (>! signals {:type :mouse-enter-dragging :target-props props :args {}}))))

 (defn extract-drag-leave-handler [morph]
-  ; mouseLeaveDragging
-  )
+  (fn [e]
+    (.preventDefault e)
+    (go
+       (>! signals {:type :mouse-leave-dragging :target-props props :args {}}))))

 (defn extract-mouse-move-handler [props]
   (fn [e]


fix bad variable reference in a macro

fix bad variable reference in a macro

--- support/src/figwheel/client/utils.clj
+++ support/src/figwheel/client/utils.clj
@@ -23,4 +23,4 @@
   [obj feature]
   `(try (and (cljs.core/exists? ~obj)
              (cljs.core/exists? (goog.object/get ~obj ~feature)))
-        (catch :default _ false)))
+        (catch :default e# false)))


Removing log line.

Removing log line.

--- src/com/okl/tokenmgr/handler.clj
+++ src/com/okl/tokenmgr/handler.clj
@@ -21,7 +21,6 @@
   (GET "/api/applications/" []
     (get-apps ""))
   (GET "/api/applications/:app" [app]
-    (log/info (str "app is " app))
     (get-apps app))
   (GET "/api/tokens/:app" [app]
     (denormalize-tokens (get-tokens (url-decode app))))


Make type-of-completion work with unbound Vars

--- src/de/kotka/vimclojure/util.clj
+++ src/de/kotka/vimclojure/util.clj
@@ -232,11 +232,14 @@
     (instance? clojure.lang.Namespace thing) "n"
     (class? thing)        "c"
     (:macro (meta thing)) "m"
-    :else                 (let [value (var-get thing)]
-                            (cond
-                              (instance? clojure.lang.MultiFn value) "f"
-                              (fn? value) "f"
-                              :else       "v"))))
+    :else                 (try
+                            (let [value (var-get thing)]
+                              (cond
+                                (instance? clojure.lang.MultiFn value) "f"
+                                (fn? value) "f"
+                                :else       "v"))
+                            (catch IllegalStateException _
+                              "v"))))

 (defn make-completion-item
   "Create a completion item for Vim's popup-menu."


bugfix

bugfix

--- src/descent/dependency_graph.clj
+++ src/descent/dependency_graph.clj
@@ -1,5 +1,5 @@
 (ns descent.dependency-graph
-  (use 'rhizome.viz))
+  (:use [rhizome.viz]))

 ;;;; Given a map of a project's dependencies, and versions, create a graph


Display all available arguments

Display all available arguments

--- src/discuss/references/main.cljs
+++ src/discuss/references/main.cljs
@@ -101,19 +101,18 @@
                                 :onClick   #(lib/change-view! :reference-create-with-ref)}
                            "Springe in die Diskussion")))))

-(defn usage-view
-  "A single item showing the usage of the currently selected reference."
+(defn argument-usage
+  ""
   [data]
   (reify om/IRender
     (render [_]
-      (let [issue (:issue data)
-            reference (:reference data)
-            argument (first (:arguments data))              ; TODO this should not be only the first one
-            author (:author data)]
+      (let [{:keys [issue argument author]} data]
         (bs/callout-info
-          (dom/strong nil (:text argument))
-          (dom/div nil "Reference:" (dom/br nil)
-                   (dom/i nil "\"" (:title reference) "\""))
+          (dom/div #js {:className "pull-right"}
+                   (bs/button-default-sm #(com/jump-to-argument (:slug issue) (:uid argument)) (vlib/fa-icon "fa-check") " Auswählen"))
+          (dom/a #js {:href    "javascript:void(0)"
+                      :onClick #(com/jump-to-argument (:slug issue) (:uid argument))}
+                 (dom/strong nil (:text argument)))
           (dom/div nil "Issue: " (:title issue))
           (dom/div nil "Autor: " (:nickname author)))))))

@@ -122,17 +121,9 @@
   [data]
   (reify om/IRender
     (render [_]
-      (let [issue (:issue data)
-            argument (first (:arguments data))
-            author (:author data)]
-        (bs/callout-info
-          (dom/div #js {:className "pull-right"}
-                   (bs/button-default-sm #(com/jump-to-argument (:slug issue) (:uid argument)) (vlib/fa-icon "fa-check") " Auswählen"))
-          (dom/a #js {:href    "javascript:void(0)"
-                      :onClick #(com/jump-to-argument (:slug issue) (:uid argument))}
-                 (dom/strong nil (:text argument)))         ; TODO this should not be only the first one
-          (dom/div nil "Issue: " (:title issue))
-          (dom/div nil "Autor: " (:nickname author)))))))
+      (let [{:keys [issue arguments author]} data]
+        (apply dom/div nil
+               (map #(om/build argument-usage {:issue issue, :argument %, :author author}) arguments))))))

 (defn usages-view
   "List with details showing the usages of the given reference."


Use island as starting level

Use island as starting level


Formatting

Formatting

--- examples/phonebook/src/phonebook/resources.clj
+++ examples/phonebook/src/phonebook/resources.clj
@@ -34,9 +34,10 @@
         (fn [ctx]
           (let [k (get-in ctx [:request :headers "Api-Key"])]
             (cond
-              (= k "masterkey") {:user "swagger-master" :roles #{:phonebook/write
-                                                                 :phonebook/delete}}
-              (= k "lesserkey") {:user "swagger-lesser" :roles #{:phonebook/write}}
+              (= k "masterkey") {:user "swagger-master"
+                                 :roles #{:phonebook/write :phonebook/delete}}
+              (= k "lesserkey") {:user "swagger-lesser"
+                                 :roles #{:phonebook/write}}
               k {})))}]

       :authorized-methods


Use default to use created-at as fallback of the on existing published-at.

--- src/oc/storage/db/common.clj
+++ src/oc/storage/db/common.clj
@@ -44,14 +44,14 @@
                                            left
                                            right)))
                                        (r/default (r/fn [_err]
-                                        {"created-at" (if (r/has-fields post-row "published-at")
-                                                        (r/get-field post-row "published-at")
-                                                        (r/get-field post-row "created-at"))}))
+                                        {"created-at" (r/default
+                                                       (r/get-field post-row "published-at")
+                                                       (r/get-field post-row "created-at"))}))
                                        (r/do (r/fn [interaction-row]
                                          (r/get-field interaction-row "created-at"))))}
-                {:last-activity-at (if (r/has-fields post-row "published-at")
-                                     (r/get-field post-row "published-at")
-                                     (r/get-field post-row "created-at"))})))
+                {:last-activity-at (r/default
+                                    (r/get-field post-row "published-at")
+                                    (r/get-field post-row "created-at"))})))
             (if (sequential? allowed-boards)
               ;; Filter out entries that don't belong
               (r/filter query (r/fn [post-row]


Two new tests: test-make-temporary-log-file-name-2 and test-remove-directory

--- test/clj_fileutils/fileutils_test.clj
+++ test/clj_fileutils/fileutils_test.clj
@@ -136,7 +136,7 @@
             (if tempdir
                 (remove-temporary-directory (.getPath tempdir))))))

-(deftest test-make-temporary-log-file-name
+(deftest test-make-temporary-log-file-name-1
     "Check the function clj-fileutils.fileutils/make-temporary-log-file-name."
     (testing "Check the function clj-fileutils.fileutils/make-temporary-log-file-name."
         (let [templog (make-temporary-log-file-name)]
@@ -146,3 +146,24 @@
             (if templog
                 (-> (new java.io.File templog) .delete)))))

+(deftest test-make-temporary-log-file-name-2
+    "Check the function clj-fileutils.fileutils/make-temporary-log-file-name."
+    (testing "Check the function clj-fileutils.fileutils/make-temporary-log-file-name."
+        (let [templog (make-temporary-log-file-name)]
+            (println "Temporary log file" templog)
+            (let [f (new java.io.File templog)]
+                (is (not (.isDirectory f)))
+                (is (.isFile f))
+                (if templog
+                    (.delete f))))))
+
+(deftest test-remove-directory
+    "Check the function clj-fileutils.fileutils/remove-directory."
+    (testing "Check the function clj-fileutils.fileutils/remove-directory."
+        (let [tempdir (make-temporary-directory)]
+            (println "Temporary directory to be deleted" tempdir)
+            (when (.isDirectory tempdir)
+                (is (.isDirectory tempdir))
+                (remove-directory tempdir)
+                (is (not (.isDirectory tempdir)))))))
+


make the different arities of envelope explicit

--- src/overtone/sc/envelope.clj
+++ src/overtone/sc/envelope.clj
@@ -100,15 +100,18 @@
    results with the the output transitioning to the release node."

   ;;See prAsArray in supercollider/SCClassLibrary/Common/Audio/Env.sc
-  [levels durations & [curve release-node loop-node]]
-  (let [curve (or curve :linear)
-        reln  (or release-node -99)
-        loopn (or loop-node -99)
-        shapes (shape->id curve)
-        curves (curve-value curve)]
-    (apply vector
-           (concat [(first levels) (count durations) reln loopn]
-                   (interleave (rest levels) durations shapes curves)))))
+  ([levels durations]
+     (envelope levels durations :linear))
+  ([levels durations curve]
+     (envelope levels durations curve -99))
+  ([levels durations curve release-node]
+     (envelope levels durations curve release-node -99))
+  ([levels durations curve release-node loop-node]
+     (let [shapes (shape->id curve)
+           curves (curve-value curve)]
+       (apply vector
+              (concat [(first levels) (count durations) release-node loop-node]
+                      (interleave (rest levels) durations shapes curves))))))

 (defunk triangle
   "Create a triangle envelope description array suitable for use with the


Fix regression. Don't wrap uncontrolled inputs (#150)

--- src/sablono/interpreter.cljc
+++ src/sablono/interpreter.cljc
@@ -64,22 +64,37 @@
 #?(:cljs (def wrapped-select (wrap-form-element "select" "value")))
 #?(:cljs (def wrapped-textarea (wrap-form-element "textarea" "value")))

-#?(:cljs
-   (defn defined? [x]
-     (and (not (nil? x))
-          (not (undefined? x)))))
+(defn ^boolean controlled-input?
+  "Returns true if `type` and `props` are used a controlled input,
+  otherwise false."
+  [type props]
+  #?(:cljs (and (object? props)
+                (case type
+                  "input"
+                  (or (exists? (.-checked props))
+                      (exists? (.-value props)))
+                  "select"
+                  (exists? (.-value props))
+                  "textarea"
+                  (exists? (.-value props))
+                  false))))

 #?(:cljs
-   (defn element-class [type props]
-     (case (name type)
-       "input"
-       (case (and (object? props) (.-type props))
-         "radio" wrapped-checked
-         "checkbox" wrapped-checked
-         wrapped-input)
-       "select" wrapped-select
-       "textarea" wrapped-textarea
-       (name type))))
+   (defn element-class
+     "Returns either `type` or a wrapped element for controlled
+     inputs."
+     [type props]
+     (if (controlled-input? type props)
+       (case type
+         "input"
+         (case (and (object? props) (.-type props))
+           "radio" wrapped-checked
+           "checkbox" wrapped-checked
+           wrapped-input)
+         "select" wrapped-select
+         "textarea" wrapped-textarea
+         type)
+       type)))

 #?(:cljs
    (defn create-element [type props & children]


Using with-altered-vars for EL_gfp_rewriting

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

--- src/conexp/contrib/dl/languages/EL_gfp_rewriting.clj
+++ src/conexp/contrib/dl/languages/EL_gfp_rewriting.clj
@@ -31,10 +31,9 @@
           (recur collected (rest left))
           (recur (conj (remove #(more-specific? next %) collected) next) (rest left)))))))

-(defn- ^{:dynamic true} more-specific?
+(defn- more-specific?
   "Returns true iff term-1 is more specific than term-2. When no tests succeeds
-  (fallback term-1 term-2) is called and its return value is then
-  returned."
+  (fallback term-1 term-2) is called and its value is returned."
   ([term-1 term-2]
      (more-specific? term-1 term-2 (constantly false)))
   ([term-1 term-2 fallback]
@@ -114,11 +113,16 @@
   (let [language              (expression-language expression),
         implication-closure   (memoize (clop-by-implications knowledge)),
         simple-more-specific? more-specific?]
-    (binding [more-specific? #(simple-more-specific?
-                               %1 %2
-                               (fn [term-1 term-2]
-                                 (contains? (implication-closure #{(make-dl-expression-nc language term-1)})
-                                            (make-dl-expression-nc language term-2))))]
+    (with-altered-vars [more-specific? (constantly
+                                        (fn spec?
+                                          ([t-1 t-2]
+                                             (simple-more-specific?
+                                              t-1
+                                              t-2
+                                              #(contains? (implication-closure #{(make-dl-expression-nc language %1)})
+                                                          (make-dl-expression-nc language %2))))
+                                          ([t-1 t-2 fallback]
+                                             (spec? t-1 t-2))))]
       (make-dl-expression-nc language (normalize-EL-gfp-term (expression-term expression))))))

 (defn abbreviate-subsumption


[#10418] Can login to account just via tap upon it from `Your keys` view

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

--- src/status_im/init/core.cljs
+++ src/status_im/init/core.cljs
@@ -35,9 +35,10 @@
 (fx/defn initialize-views
   {:events [::initialize-view]}
   [cofx {:keys [logout?]}]
-  (let [{{:multiaccounts/keys [multiaccounts] :as db} :db} cofx]
+  (let [{{:multiaccounts/keys [multiaccounts]} :db} cofx]
     (when (and (seq multiaccounts) (not logout?))
-      (let [{:keys [key-uid public-key photo-path name]} (first (#(sort-by :last-sign-in > %) (vals multiaccounts)))]
+      (let [{:keys [key-uid public-key photo-path name]}
+            (first (sort-by :timestamp > (vals multiaccounts)))]
         (multiaccounts.login/open-login cofx key-uid photo-path name public-key)))))

 (fx/defn initialize-multiaccounts


Update core.cljs

Update core.cljs

--- examples/simple/src/simple/core.cljs
+++ examples/simple/src/simple/core.cljs
@@ -70,7 +70,7 @@
    "Time color: "
    [:input {:type "text"
             :value @(rf/subscribe [:time-color])
-            :on-blur #(rf/dispatch [:time-color-change (-> % .-target .-value)])}]])  ;; <---
+            :on-change #(rf/dispatch [:time-color-change (-> % .-target .-value)])}]])  ;; <---

 (defn ui
   []


proper input

proper input

--- src/hackerrank/security/message_ciphertext_space.clj
+++ src/hackerrank/security/message_ciphertext_space.clj
@@ -40,7 +40,7 @@
     (def zipped (into {} (map hash-map before after)))

    (let [n (trim (read-line))]
-        (apply str (map zipped (seq "982")))))
+        (apply str (map zipped (seq n)))))

   ([input]
    (with-in-str input


Convert a `map` to a `for`

Convert a `map` to a `for`

--- src-cljs/frontend/components/account.cljs
+++ src-cljs/frontend/components/account.cljs
@@ -191,11 +191,8 @@
        [:div
         [:h4.beta-programs "Current Beta Features"]
         (card/collection
-         (map
-          (fn [program]
-            (card/titled {:title (:name program)}
-                         (:description program)))
-          available-betas))]))))
+         (for [{:keys [name description]} available-betas]
+          (card/titled {:title name} description)))]))))

 (defn set-beta-program-preference! [owner pref]
   (raise! owner [:preferences-updated {state/user-in-beta-key pref}]))


Swap title and label of email warning

Swap title and label of email warning

--- src-cljs/frontend/components/invites.cljs
+++ src-cljs/frontend/components/invites.cljs
@@ -35,9 +35,9 @@
                     :type "email"
                     :value email
                     :id (str login "-email")}]
-           [:label.no-email {:for (str login "-email") :title "Click to add an email address for this teammate."}
+           [:label.no-email {:for (str login "-email") :title "We could not retrieve this teammate's email address because it has been set as private."}
             [:i.fa.fa-exclamation-circle]
-            " Email not available"]]
+            " Click to add an email address."]]
           [:label.invite-select {:id (str login "-label")
                                  :for (str login "-checkbox")}
            [:input {:type "checkbox"


fix the avatar images for pending requests

--- src-cljs/frontend/components/overlay.cljs
+++ src-cljs/frontend/components/overlay.cljs
@@ -199,7 +199,7 @@
               "denied"
               "requesting")}
     [:div.access-avatar
-     [:img {:src (utils/gravatar-url (:access-request/cust entity))}]]
+     [:img.access-avatar-img {:src (utils/gravatar-url (:access-request/cust entity))}]]
     [:div.access-details
      [:span {:title (:access-request/cust entity)} (:access-request/cust entity)]
      [:span.access-status


Makes "killing cancelled task" log be INFO (#1632)

--- scheduler/src/cook/scheduler/scheduler.clj
+++ scheduler/src/cook/scheduler/scheduler.clj
@@ -1246,11 +1246,11 @@
     (fn cancelled-task-killer-event []
       (timers/time!
         killing-cancelled-tasks-duration
-        (doseq [task (killable-cancelled-tasks (d/db conn))]
-          (log/warn "killing cancelled task " (:instance/task-id task))
-          @(d/transact conn [[:db/add (:db/id task) :instance/reason
+        (doseq [{:keys [db/id instance/task-id] :as task} (killable-cancelled-tasks (d/db conn))]
+          (log/info "Killing cancelled task" task-id)
+          @(d/transact conn [[:db/add id :instance/reason
                               [:reason/name :reason-killed-by-user]]])
-          (cc/kill-task-if-possible (cook.task/task-ent->ComputeCluster task) (:instance/task-id task)))))
+          (cc/kill-task-if-possible (cook.task/task-ent->ComputeCluster task) task-id))))
     {:error-handler (fn [e]
                       (log/error e "Failed to kill cancelled tasks!"))}))


figwheel.main: fix regression on adding target classpath

--- figwheel-main/src/figwheel/main.cljc
+++ figwheel-main/src/figwheel/main.cljc
@@ -1205,7 +1205,7 @@
     (background-build cfg build)))

 (defn validate-fix-target-classpath! [{:keys [::config ::build options]}]
-  (when (#{nil :browser} (:target options))
+  (when (nil? (:target options)) ;; browsers need the target classpath to load files
     (when-not (contains? (:ring-stack-options config) :static)
       (when-let [output-to (:output-to options)]
         (when-not (.isAbsolute (io/file output-to))


flexipacker removed (premature optimization)

--- Clojure-Websockets/MainApp/src/clj/birdwatch/communicator/component.clj
+++ Clojure-Websockets/MainApp/src/clj/birdwatch/communicator/component.clj
@@ -9,13 +9,11 @@
    [com.stuartsierra.component :as component]
    [clojure.core.async :refer [chan]]))

-(def packer (sente-transit/get-flexi-packer :json)) ;; serialization format for client<->server comm
-
 (defrecord Communicator [channels chsk-router]
   component/Lifecycle
   (start [component] (log/info "Starting Communicator Component")
          (let [{:keys [ch-recv send-fn ajax-post-fn ajax-get-or-ws-handshake-fn connected-uids]}
-               (sente/make-channel-socket! sente-web-server-adapter {:packer packer :user-id-fn ws/user-id-fn})
+               (sente/make-channel-socket! sente-web-server-adapter {:user-id-fn ws/user-id-fn})
                event-handler (ws/make-handler (:query channels) (:tweet-missing channels) (:register-perc channels))
                chsk-router (sente/start-chsk-router! ch-recv event-handler)]
            (ws/run-users-count-loop send-fn connected-uids)


don't log use of getStageSequenceMaxLength

git-svn-id: 03a8048b5ee8463be5048a3801110fb50f378627@10654 d0ab736e-dc22-4aeb-8dc9-08def0aa14fd

--- acqEngine/src/org/micromanager/sequence_generator.clj
+++ acqEngine/src/org/micromanager/sequence_generator.clj
@@ -201,7 +201,7 @@
                 e2 :wait-time-ms (if (vector? interval)
                                    (nth interval (:frame-index e2))
                                    interval)))))
-
+
 (defn event-triggerable
   "Returns true if an event can be added to a burst."
   [burst event]
@@ -216,7 +216,7 @@
           (let [z-drive (. mmc getFocusDevice)]
             (and
               (. mmc isStageSequenceable z-drive)
-              (< n (core getStageSequenceMaxLength z-drive))
+              (< n (. mmc getStageSequenceMaxLength z-drive))
               (<= (Math/abs (- (e1 :slice) (e2 :slice))) MAX-Z-TRIGGER-DIST)
               (<= (e1 :slice-index) (e2 :slice-index))))))))


Fix CLJS tests

Fix CLJS tests

--- test/expound/alpha_test.cljc
+++ test/expound/alpha_test.cljc
@@ -1562,20 +1562,15 @@
 (defn my-div [x y]
   (assert (not (zero? (/ x y)))))

-(defmacro until-unsuccessful [form]
-  `(let [nil-or-failure# #(if (= "Success!\n" %)
-                            nil
-                            %)]
-     (or (nil-or-failure# ~form)
-         (nil-or-failure# ~form)
-         (nil-or-failure# ~form)
-         (nil-or-failure# ~form)
-         (nil-or-failure# ~form))
-     )
-
-
-
-  )
+(defn  until-unsuccessful [f]
+  (let [nil-or-failure #(if (= "Success!\n" %)
+                          nil
+                          %)]
+    (or (nil-or-failure (f))
+        (nil-or-failure (f))
+        (nil-or-failure (f))
+        (nil-or-failure (f))
+        (nil-or-failure (f)))))

 (deftest fspec-exception-test
   (testing "args that throw exception"
@@ -1604,7 +1599,9 @@

 -------------------------
 Detected 1 error\n")
-           (until-unsuccessful (expound/expound-str :fspec-test/div my-div))))
+
+           ;;
+           (until-unsuccessful #(expound/expound-str :fspec-test/div my-div))))

     (is (= (pf "-- Exception ----------------------

@@ -1632,7 +1629,7 @@

 -------------------------
 Detected 1 error\n")
-           (until-unsuccessful (expound/expound-str (s/coll-of :fspec-test/div) [my-div]))))))
+           (until-unsuccessful #(expound/expound-str (s/coll-of :fspec-test/div) [my-div]))))))

 (s/def :fspec-ret-test/my-int pos-int?)
 (s/def :fspec-ret-test/plus (s/fspec
@@ -1670,7 +1667,7 @@

 -------------------------
 Detected 1 error\n")
-           (until-unsuccessful (expound/expound-str :fspec-ret-test/plus my-plus))))
+           (until-unsuccessful #(expound/expound-str :fspec-ret-test/plus my-plus))))

     (is (= (pf "-- Function spec failed -----------

@@ -1700,7 +1697,7 @@

 -------------------------
 Detected 1 error\n")
-           (until-unsuccessful (expound/expound-str (s/coll-of :fspec-ret-test/plus) [my-plus]))))))
+           (until-unsuccessful #(expound/expound-str (s/coll-of :fspec-ret-test/plus) [my-plus]))))))

 (s/def :fspec-fn-test/minus (s/fspec
                              :args (s/cat :x int? :y int?)
@@ -1736,7 +1733,7 @@
    (< (:ret %) (-> % :args :x)))"
                   :cljs "(fn [%] (< (:ret %) (-> % :args :x)))"))
            (binding [s/*explain-out* (expound/custom-printer {:print-specs? false})]
-             (until-unsuccessful (s/explain-str :fspec-fn-test/minus my-minus)))))
+             (until-unsuccessful #(s/explain-str :fspec-fn-test/minus my-minus)))))

     (is (= (pf "-- Function spec failed -----------

@@ -1761,7 +1758,7 @@
    (< (:ret %) (-> % :args :x)))"
                   :cljs "(fn [%] (< (:ret %) (-> % :args :x)))"))
            (binding [s/*explain-out* (expound/custom-printer {:print-specs? false})]
-             (until-unsuccessful (s/explain-str (s/coll-of :fspec-fn-test/minus) [my-minus])))))))
+             (until-unsuccessful #(s/explain-str (s/coll-of :fspec-fn-test/minus) [my-minus])))))))

 (deftest ifn-fspec-test
   (testing "keyword ifn / ret failure"
@@ -1783,8 +1780,8 @@
 -------------------------
 Detected 1 error\n"
            (binding [s/*explain-out* (expound/custom-printer {:print-specs? false})]
-             (until-unsuccessful (s/explain-str (s/coll-of (s/fspec :args (s/cat :x int?) :ret int?))
-                                                [:foo])))))
+             (until-unsuccessful #(s/explain-str (s/coll-of (s/fspec :args (s/cat :x int?) :ret int?))
+                                                 [:foo])))))
     (testing "set ifn / ret failure"
       (is (= "-- Function spec failed -----------

@@ -1804,8 +1801,8 @@
 -------------------------
 Detected 1 error\n"
              (binding [s/*explain-out* (expound/custom-printer {:print-specs? false})]
-               (until-unsuccessful (s/explain-str (s/coll-of (s/fspec :args (s/cat :x int?) :ret int?))
-                                                  [#{}])))))))
+               (until-unsuccessful #(s/explain-str (s/coll-of (s/fspec :args (s/cat :x int?) :ret int?))
+                                                   [#{}])))))))
   #?(:clj
      (testing "vector ifn / exception failure"
        (is (= "-- Exception ----------------------
@@ -1826,5 +1823,5 @@
 -------------------------
 Detected 1 error\n"
               (binding [s/*explain-out* (expound/custom-printer {:print-specs? false})]
-                (until-unsuccessful (s/explain-str (s/coll-of (s/fspec :args (s/cat :x int?) :ret int?))
-                                                   [[]]))))))))
+                (until-unsuccessful #(s/explain-str (s/coll-of (s/fspec :args (s/cat :x int?) :ret int?))
+                                                    [[]]))))))))


DM+CM #47 - Clean up http api tests

DM+CM #47 - Clean up http api tests

--- test/objective8/api_test.clj
+++ test/objective8/api_test.clj
@@ -15,12 +15,6 @@

 (def the-stored-user (into the-user {:_id USER_ID}))

-(def profile-posts
-  {:successful {:status 201
-                :headers {"Content-Type" "application/json"}
-                :body (json/generate-string the-stored-user)}
-   :failure    {:status 500}})
-
 (def BEARER_NAME "bearer")
 (def BEARER_TOKEN "token")

@@ -35,11 +29,14 @@
              (api/create-user the-user) => the-stored-user
              (provided (api/post-request (contains "/api/v1/users")
                                          request-with-bearer-token)
-                       => (:successful profile-posts)))
+                       => {:status 201
+                           :headers {"Content-Type" "application/json"}
+                           :body (json/generate-string the-stored-user)}))

        (fact "returns api-failure when post fails"
              (api/create-user the-user) => api/api-failure
-             (provided (api/post-request anything anything) => (:failure profile-posts))))
+             (provided (api/post-request anything anything)
+                       => {:status 500})))

 ;OBJECTIVES
 (def OBJECTIVE_ID 234)
@@ -51,23 +48,19 @@
                     :username "my username"})

 (def the-stored-objective (into the-objective {:_id OBJECTIVE_ID}))
-(def objective-posts
-  {:successful {:status 201
-                :headers {"Content-Type" "application/json"}
-                :body (json/generate-string the-stored-objective)}
-   :failure    {:status 500}})

 (facts "about posting objectives"
        (fact "returns a stored objective when post succeeds"
              (api/create-objective the-objective) => the-stored-objective
              (provided (api/post-request (contains "/api/v1/objectives")
                                          request-with-bearer-token)
-                       => (:successful objective-posts)))
+                       => {:status 201
+                           :headers {"Content-Type" "application/json"}
+                           :body (json/generate-string the-stored-objective)}))

        (fact "returns api-failure when post fails"
-             (with-fake-http [(str host-url "/api/v1/objectives") (:failure objective-posts)]
-               (api/create-objective the-objective))
-             => api/api-failure))
+             (api/create-objective the-objective) => api/api-failure
+             (provided (api/post-request anything anything) => {:status 500})))

 (facts "about getting objectives"
        (fact "returns a stored objective when one exists with given id"
@@ -99,23 +92,19 @@
                   :username "my username"})

 (def the-stored-comment (into the-comment {:_id 1}))
-(def comment-response
-  {:successful {:status 201
-                :headers {"Content-Type" "application/json"}
-                :body (json/generate-string the-stored-comment)}
-   :failure    {:status 500}})

 (facts "about posting comments"
        (fact "returns a stored comment when post succeeds"
              (api/create-comment the-comment) => the-stored-comment
              (provided (api/post-request (contains "/api/v1/comments")
                                          request-with-bearer-token)
-                       => (:successful comment-response)))
+                       =>{:status 201
+                          :headers {"Content-Type" "application/json"}
+                          :body (json/generate-string the-stored-comment)}))

        (fact "returns api-failure when post fails"
-             (with-fake-http [(str host-url "/api/v1/comments") (:failure comment-response)]
-               (api/create-comment the-comment))
-             => api/api-failure))
+             (api/create-comment the-comment) => api/api-failure
+             (provided (api/post-request anything anything) => {:status 500})))

 (facts "about retrieving comments"
        (fact "returns a list of comments for an objective"


Fix typo in render-item(s).

Fix typo in render-item(s).

--- src/kixi/hecuba/api/datasets.clj
+++ src/kixi/hecuba/api/datasets.clj
@@ -155,7 +155,7 @@
 (defn index-handle-ok [store ctx]
   (db/with-session [session (:hecuba-session store)]
     (let [entity_id   (entity_id-from ctx)]
-      (util/render-items ctx (db/execute session (hayt/select :dataset (hayt/where [[= :entity_id entity_id]])))))))
+      (util/render-items (:request ctx) (db/execute session (hayt/select :dataset (hayt/where [[= :entity_id entity_id]])))))))

 (defn index-handle-created [ctx]
   (let [entity_id   (::entity_id ctx)
@@ -201,7 +201,7 @@

 (defn resource-handle-ok [ctx]
   (let [item (::item ctx)]
-    (util/render-item ctx item)))
+    (util/render-item (:request ctx) item)))

 (defresource resource [store]
   :allowed-methods       #{:get :post}


step-machine is now in place

step-machine is now in place

--- src/fpinscala/purely_functional_state.clj
+++ src/fpinscala/purely_functional_state.clj
@@ -372,12 +372,13 @@
 ;based on value

 ;here - I try to mimic get, set and modify of FPINS/6.6
-(def get-state (fn [s] (make-state s s)))
-(def set-state (fn [s] (make-state nil s)))
-(def modify-state (fn [s f]
-                    (for [v (get-state s)
-                          ns (set-state (f v))]
-                      ns)))
+(def get-state (fn [s] (make-state (:val s) (:val s))))
+(def set-state (fn [s] (make-state nil (:val s))))
+(def modify-state (fn [f]
+                    (fn [s]
+                      (let [ns (get-state s)]
+                        (set-state (f ns))))))
+;now when step-machine is in place - to re-think get, set and modify...

 ;here is step-machine function from Runar Bjarnasson's explanation of 6.1 on fpins google group
 ;it is using core.match as writing with if, cond etc would make it ridiculously complex
@@ -385,17 +386,23 @@
 (defn machine [locked candies coins]
   {:locked locked :candies candies :coins coins})

+;Hey Rastko, yes you! You need to read more carefully :)
+;well, it seems I'd need to know Scala a bit better.
+;In fpins solution Candy.update is function that produces function
+;to be more specific, for given input it produces function which accepts state (machine)
+;and produces function which matches given input and provided state
 (defn step-machine
   "inputs is sequence of either coins or turns, s is 'machine' in focus"
-  [i s]
-  (match [i s]
+  [i]
+  (fn [s]
+    (match [i s]
          [_ {:locked _ :candies 0 :coins _}] s
          [:coin {:locked false :candies _ :coins _}] s
          [:turn {:locked true :candies _ :coins _}] s
          [:coin {:locked true :candies candies :coins coins}]
          (machine false candies (inc coins))
          [:turn {:locked false :candies candies :coins coins}]
-         (machine true (dec candies) coins)))
-
-
-
+         (machine true (dec candies) coins))))
+
+
+


PDOK-1599: mustache-runner extended with extract-type

--- src/main/clojure/pdok/mustache_runner.clj
+++ src/main/clojure/pdok/mustache_runner.clj
@@ -6,11 +6,11 @@
   (with-open [w (clojure.java.io/writer (str dataset "-" feature-type "-" idx ".xml"))]
        (.write w feature)))

-(defn -main [feature-type feature-file & args]
+(defn -main [feature-type feature-file extract-type & args]
   (let [dataset "bgt"
         features (e/file-to-features feature-file dataset)
         template-dir (or (first args) "")
-        rendered-features (map second (e/features-for-extract dataset feature-type features template-dir))
+        rendered-features (map second (e/features-for-extract dataset feature-type extract-type features template-dir))
         num-features (count rendered-features)]
     (doseq [idx (take num-features (range num-features))]
      (write-file "bgt" feature-type (get (vec rendered-features) idx) idx))))


CMR-1118-3: Reset conifig to use in-memory db

--- dev-system/dev/user.clj
+++ dev-system/dev/user.clj
@@ -16,8 +16,8 @@

 (def system nil)

-;(def system-type :in-memory)
-(def system-type :external-dbs)
+(def system-type :in-memory)
+;(def system-type :external-dbs)

 (defn start


Split up schemas into a separate table

Split up schemas into a separate table

They did not belong in the app_schema table

--- src/webapp/framework/server/systemfns.clj
+++ src/webapp/framework/server/systemfns.clj
@@ -94,11 +94,13 @@

 (defn get-schema-name-for-session-id [data-session-id]
   (let [
-         app-schema-id     (:appshare_application_schema_id (sql-1 "select   appshare_application_schema_id   from   public.appshare_web_sessions    where   session_id = ?" [data-session-id]))
+         schema-id     (:fk_appshare_schema_id (sql-1 "select   fk_appshare_schema_id   from   public.appshare_web_sessions    where   session_id = ?" [data-session-id]))
+
+

          schema-name       (cond
-                             app-schema-id
-                             (:database_schema_name (sql-1 "select   database_schema_name   from   public.appshare_application_schemas  where  id = ?"  [app-schema-id]))
+                             schema-id
+                             (:database_schema_name (sql-1 "select   database_schema_name   from   public.appshare_schemas  where  id = ?"  [schema-id]))

                              :else
                              "public")
@@ -688,7 +690,7 @@
           (
           id                               serial NOT NULL,
           fk_appshare_user_id              integer,
-          appshare_application_schema_id   integer,
+          fk_appshare_schema_id            integer,
           session_id                       character varying,
           CONSTRAINT appshare_web_sessions_pkey PRIMARY KEY (id)
           );
@@ -700,7 +702,7 @@
           (
           id                               NUMBER GENERATED BY DEFAULT ON NULL AS IDENTITY,
           fk_appshare_user_id              NUMBER,
-          appshare_application_schema_id   NUMBER,
+          fk_appshare_schema_id            NUMBER,
           session_id                       VARCHAR2(200 BYTE),
           CONSTRAINT  APPSHARE_WEB_SESSIONS_PK PRIMARY KEY (ID)
           )")
@@ -893,8 +895,7 @@
           fk_appshare_application_id                       integer,
           fk_appshare_schema_id                            integer,
           application_environment                          character varying,
-          database_schema_name                             character varying,
-          CONSTRAINT appshare_applications_schemas_pkey    PRIMARY KEY (id)
+          CONSTRAINT appshare_application_schemas_pkey    PRIMARY KEY (id)
           );
           "

@@ -906,7 +907,6 @@
           fk_appshare_application_id                     NUMBER,
           fk_appshare_schema_id                          NUMBER,
           application_environment                        VARCHAR2(200 BYTE),
-          database_schema_name                           VARCHAR2(200 BYTE),
           CONSTRAINT  APPSHARE_APPLICATION_SCHEMAS_PK    PRIMARY KEY (ID)
           )")
         ]
@@ -935,7 +935,6 @@
           (
           id                                               serial NOT NULL,
           fk_appshare_publisher_id                         integer,
-          application_environment                          character varying,
           database_schema_name                             character varying,
           CONSTRAINT appshare_schemas_pkey    PRIMARY KEY (id)
           );
@@ -947,7 +946,6 @@
           (
           id                                             NUMBER GENERATED BY DEFAULT ON NULL AS IDENTITY,
           fk_appshare_publisher_id                       NUMBER,
-          application_environment                        VARCHAR2(200 BYTE),
           database_schema_name                           VARCHAR2(200 BYTE),
           CONSTRAINT  APPSHARE_SCHEMAS_PK    PRIMARY KEY (ID)
           )")
@@ -2143,23 +2141,23 @@

           content           (str (get content-records :ac) (get content-records :ac2))

-          app-schema-id     (:id (sql-1 "select  id  from  appshare_application_schemas  where  application_environment = 'DEV' and fk_appshare_application_id = ?"  [id]))
+          schema-id         (:fk_appshare_schema_id (sql-1 "select  fk_appshare_schema_id  from  appshare_application_schemas  where  application_environment = 'DEV' and fk_appshare_application_id = ?"  [id]))
           ]

       (do
         (clear-client-cache   app-session-id)

         (println (str "!getfilecontents        id: "        id))
-        (println (str "!getfilecontents  app-schema-id: "   app-schema-id))
+        (println (str "!getfilecontents  schema-id: "   schema-id))
         (println (str "" ))

         (cond
-          app-schema-id
-          (sql "update  appshare_web_sessions  set appshare_application_schema_id = ?  where  session_id = ?"  [app-schema-id   app-session-id])
+          schema-id
+          (sql "update  appshare_web_sessions  set fk_appshare_schema_id = ?  where  session_id = ?"  [schema-id   app-session-id])

           :else
           (do
-            (sql "update  appshare_web_sessions  set appshare_application_schema_id = NULL  where  session_id = ?"  [app-session-id])))
+            (sql "update  appshare_web_sessions  set fk_appshare_schema_id = NULL  where  session_id = ?"  [app-session-id])))

         {:value content}))


Add support for plusses

Add support for plusses


Let's the shutdown occur without needing the seal ch.

[ci skip]

--- src/onyx/peer/task_lifecycle.clj
+++ src/onyx/peer/task_lifecycle.clj
@@ -524,6 +524,7 @@
                  :log-prefix log-prefix
                  :task-information task-information
                  :task-kill-ch task-kill-ch
+                 :kill-ch kill-ch
                  :task-lifecycle-ch task-lifecycle-ch
                  :stream-observer (start-stream-observer! aeron-conn
                                                           (mc/bind-addr opts)
@@ -531,8 +532,7 @@
                                                           1
                                                           (backoff-strategy (arg-or-default :onyx.messaging.aeron/poll-idle-strategy opts))
                                                           pipeline-data
-                                                          task-id)
-)))
+                                                          task-id))))
       (catch Throwable e
         (handle-exception task-information log e restart-ch outbox-ch job-id)
         component)))
@@ -550,6 +550,7 @@
       (stop-window-state-thread! event)

       ;; Ensure task operations are finished before closing peer connections
+      (close! (:kill-ch component))
       (<!! (:task-lifecycle-ch component))
       (close! (:task-kill-ch component))


Grab ethnicity from api

Grab ethnicity from api


Refactor out the analysis pass in tree-shake

--- src/oxcart/passes/tree_shake.clj
+++ src/oxcart/passes/tree_shake.clj
@@ -85,6 +85,35 @@
     @new-ast))

+(defn analyze-var-dependencies
+  "λ Whole-AST → options → Whole-AST
+
+  Implements an analysis pass which creates the following annotations
+  in the supplied whole program AST.
+
+  `:dependency-map` {Var → #{Var}}, represents the vars directly
+  depended on by any given var for which source information exists in
+  the whole program AST.
+
+  `:reach-map` {Var → #{Var}}, represents the reach sets of every var
+  in the program AST for which source information exists.
+
+  options:
+    This function takes no options."
+  [{:keys [modules] :as whole-program-ast} options]
+  {:pre [(every? symbol? modules)
+         (every? (partial contains? ast) modules)]}
+  (let [dep-maps  (->>  (for [m     modules
+                              form  (:forms (get ast m))
+                              :when (pattern/def? form)]
+                          [(:var form) (reach-set form)])
+                        (into {}))
+        reach-map (global-reach-set dep-maps)]
+    (-> whole-program-ast
+        (assoc :dependency-map dep-maps
+               :reach-map      reach-map))))
+
+
 (defn tree-shake
   "λ Whole-AST → options → Whole-AST

@@ -94,7 +123,6 @@
   the program.

   options:
-
     :entry is a symbol, presumably a namespace qualified -main, which
     is the entry point of the prorgam. It is with respect to this
     function that all other defs in all loaded namespaces will be
@@ -103,14 +131,6 @@
   {:pre [(every? symbol? modules)
          (symbol? entry)
          (every? (partial contains? ast) modules)]}
-  (let [;; Compute the {Var → #{Var}} form of the whole program
-        symbol-sets (->>  (for [m     modules
-                                form  (:forms (get ast m))
-                                :when (pattern/def? form)]
-                            [(:var form) (reach-set form)])
-                          (into {})
-                          global-reach-set)
-
-        ;; The emit set is now trivially
-        emit-set (get symbol-sets (resolve entry))]
+  (let [ast      (analyze-var-dependencies ast options)
+        emit-set (get (:reach-map ast) (resolve entry))]
     (trim-with-emit-set ast emit-set)))


Fixed failing build. Removed machinehead deps.

--- ingestion-api/src/ingestion_api/mqtt/tcp.clj
+++ ingestion-api/src/ingestion_api/mqtt/tcp.clj
@@ -1,6 +1,5 @@
 (ns ingestion-api.mqtt.tcp
-  (:require [clojurewerkz.machine-head.client :as mh]
-            [manifold.stream :as s]
+  (:require [manifold.stream :as s]
             [manifold.deferred :as d]
             [ingestion-api.mqtt.domain.connack :as connack]
             [ingestion-api.mqtt.handler :as mqtt]


Stub out a function for displaying the jUnit results better

--- src/radicalzephyr/boot_junit.clj
+++ src/radicalzephyr/boot_junit.clj
@@ -2,6 +2,9 @@
   {:boot/export-tasks true}
   (:require '[[boot.core :as core]])
   (:import org.junit.runner.JUnitCore))
+
+(defn destructure-results [result]
+  {})

 (deftask junit
   "Run the jUnit test runner."
@@ -10,5 +13,6 @@
     (let [result (JUnitCore/runClasses
                   (into-array [#_ (magic goes here to find all test classes)]))]
       (when (> (.getFailureCount result) 0)
-        (throw (ex-info "There were some test failures." {:result result}))))
+        (throw (ex-info "There were some test failures."
+                        (destructure-results result)))))
     fileset))


CMR-3556: Removed duplicates from opendata references.

--- search-app/src/cmr/search/results_handlers/opendata_results_handler.clj
+++ search-app/src/cmr/search/results_handlers/opendata_results_handler.clj
@@ -234,7 +234,7 @@
                             :distribution (distribution related-urls)
                             :landingPage (landing-page related-urls)
                             :language  [LANGUAGE_CODE]
-                            :references (not-empty (map :url related-urls))
+                            :references (not-empty (distinct (map :url related-urls)))
                             :issued (not-empty insert-time)})))

 (defn- results->opendata


Update web server

Update web server

--- dev/web_server.clj
+++ dev/web_server.clj
@@ -6,11 +6,9 @@
   component/Lifecycle

   (start [_]
-    (println "Start figwheel server")
     (figwheel/start-figwheel!))

   (stop [_]
-    (println "Stop figwheel server")
     (figwheel/stop-figwheel!)))

 (defn new-dev-server []


statuses fro console chat

statuses fro console chat

Former-commit-id: 0ddc4608ee800fa38886b12069a88b60c30e3f45

--- src/status_im/chat/handlers.cljs
+++ src/status_im/chat/handlers.cljs
@@ -218,6 +218,11 @@
   (fn [db [_ {:keys [chat-id msg-id]}]]
     (set-message-shown db chat-id msg-id)))

+(defn default-delivery-status [chat-id]
+  (if (console? chat-id)
+    :seen
+    :pending))
+
 (defn prepare-message
   [{:keys [identity current-chat-id] :as db} _]
   (let [text (get-in db [:chats current-chat-id :input-text])
@@ -230,7 +235,7 @@
                    :to              current-chat-id
                    :from            identity
                    :content-type    text-content-type
-                   :delivery-status :pending
+                   :delivery-status (default-delivery-status current-chat-id)
                    :outgoing        true
                    :timestamp       (time/now-ms)})]
     (if command
@@ -246,6 +251,7 @@
      :to               chat-id
      :content          content
      :content-type     content-type-command
+     :delivery-status  (default-delivery-status chat-id)
      :outgoing         true
      :preview          preview-string
      :rendered-preview preview
@@ -588,9 +594,9 @@

 (register-handler :send-seen!
   (after (fn [_ [_ chat-id message-id]]
-           (when-not (= "console" chat-id))
+           (when-not (console? chat-id))
            (dispatch [:msg-seen chat-id message-id])))
   (u/side-effect!
     (fn [_ [_ chat-id message-id]]
-      (when-not (= "console" chat-id)
+      (when-not (console? chat-id)
         (api/send-seen chat-id message-id)))))


Fix #3: Using >= instead of > check for majority vote.

--- src/ranked_choice/voting.clj
+++ src/ranked_choice/voting.clj
@@ -64,7 +64,7 @@
                              (merge-with conj prev-results))
             most-votes (reduce max (vals round-results))
             last-place (first (apply min-key last round-results))]
-        (if (> most-votes votes-to-win)
+        (if (>= most-votes votes-to-win)
           new-results
           (recur (remove-candidate remaining-votes last-place) new-results))))))


use require for clojure sources, not import

--- ssclj/jar/src/main/clojure/com/sixsq/slipstream/ssclj/es/es_binding.clj
+++ ssclj/jar/src/main/clojure/com/sixsq/slipstream/ssclj/es/es_binding.clj
@@ -9,9 +9,9 @@
     [com.sixsq.slipstream.ssclj.es.es-util :as esu]
     [com.sixsq.slipstream.ssclj.es.acl :as acl]
     [com.sixsq.slipstream.ssclj.resources.common.debug-utils :as du]
-    [com.sixsq.slipstream.ssclj.resources.common.utils :as u])
-  (:import (com.sixsq.slipstream.ssclj.db.binding Binding)
-           (org.elasticsearch.index.engine DocumentAlreadyExistsException)
+    [com.sixsq.slipstream.ssclj.resources.common.utils :as u]
+    [com.sixsq.slipstream.ssclj.db.binding :refer [Binding]])
+  (:import (org.elasticsearch.index.engine DocumentAlreadyExistsException)
            (clojure.lang ExceptionInfo)))

 (def ^:const index-name "resources-index")


add transit to cljs

add transit to cljs

--- src/replikativ/platform.cljs
+++ src/replikativ/platform.cljs
@@ -1,6 +1,7 @@
 (ns replikativ.platform
   (:require [replikativ.platform-log :refer [debug info warn error]]
             [konserve.platform :refer [read-string-safe]]
+            [cognitect.transit :as transit]
             [goog.net.WebSocket]
             [goog.events :as events]
             [cljs.core.async :as async :refer (take! put! close! chan)])
@@ -11,13 +12,12 @@
   (js/Date.))

-;; TODO binary blobs
 (defn client-connect!
   "Connects to url. Puts [in out] channels on return channel when ready.
 Only supports websocket at the moment, but is supposed to dispatch on
 protocol of url. read-opts is ignored on cljs for now, use the
 platform-wide reader setup."
-  [url tag-table]
+  [url err-ch tag-table]
   (let [host (.getDomain (goog.Uri. url))
         channel (goog.net.WebSocket. false)
         in (chan)
@@ -26,32 +26,26 @@
     (info "CLIENT-CONNECT" url)
     (doto channel
       (events/listen goog.net.WebSocket.EventType.MESSAGE
-              (fn [evt]
-                (debug "receiving: " (-> evt .-message))
-                (put! in (with-meta (->> evt .-message (read-string-safe @tag-table))
-                           {:host host}))))
+                     (fn [evt]
+                       (debug "receiving: " (-> evt .-message))
+                       (let [reader (transit/reader :json)
+                             fr (js/FileReader.)]
+                         (set! (.-onload fr) #(transit/read reader (.-result fr)))
+                         (put! in (with-meta (.readAsText fr (.-message evt))
+                                    {:host host})))))
       (events/listen goog.net.WebSocket.EventType.CLOSED
-              (fn [evt] (close! in) (.close channel) (close! opener)))
+                     (fn [evt] (close! in) (.close channel) (close! opener)))
       (events/listen goog.net.WebSocket.EventType.OPENED
-              (fn [evt] (put! opener [in out]) (close! opener)))
+                     (fn [evt] (put! opener [in out]) (close! opener)))
       (events/listen goog.net.WebSocket.EventType.ERROR
-              (fn [evt] (error "ERROR:" evt) (close! opener)))
+                     (fn [evt] (error "ERROR:" evt) (close! opener)))
       (.open url))
-    ((fn sender [] (take! out
-                         (fn [m]
-                           (debug "sending: " m)
-                           (.send channel (str " " (pr-str m)))
-                           (sender)))))
+    (fn sender []
+      (take! out
+             (fn [m]
+               (when m
+                 (debug "sending: " m)
+                 (let [writer (transit/writer :json)]
+                   (.send channel (js/Blob. #js [(transit/write writer m)])))
+                 (sender)))))
     opener))
-
-
-(comment
-  (client-connect! "ws://127.0.0.1:9090"))
-
-
-;; fire up repl
-#_(do
-    (ns dev)
-    (def repl-env (reset! cemerick.austin.repls/browser-repl-env
-                         (cemerick.austin/repl-env)))
-    (cemerick.austin.repls/cljs-repl repl-env))


optional map destructuring

optional map destructuring

--- cljx/plongeur-clj/src/kierros/sente_server_driver.clj
+++ cljx/plongeur-clj/src/kierros/sente_server_driver.clj
@@ -27,7 +27,8 @@
 (defn make-sente-server-driver
   "Accepts an options map.
   Returns a websocket server driver powered by Sente and http-kit."
-  [{sente-options :sente http-kit-options :http-kit}]
+  [& [{sente-options    :sente
+       http-kit-options :http-kit}]]
   (fn [push-chan]
     (let [{:keys [ch-recv
                   send-fn