Hotfix. verifier -> oauth_verifier

Hotfix. verifier -> oauth_verifier

--- src/word_keeper/frontend.clj
+++ src/word_keeper/frontend.clj
@@ -10,7 +10,7 @@
             {:twitter-auth-uri twitter-auth-uri})})

 (defn action-signin [req]
-  (let [user-data (authorize (-> req :params :verifier))]
+  (let [user-data (authorize (-> req :params :oauth_verifier))]
     {:status 200
      :headers {"Content-Type" "text/plain"}
      :body (str "Signed in as " (:screen_name user-data))}))


Fix message input view

Fix message input view

Former-commit-id: 0ef09b57e857d1e4c27b6eb00cf1d1ed8b002d33

--- src/status_im/chat/views/message_input.cljs
+++ src/status_im/chat/views/message_input.cljs
@@ -53,7 +53,7 @@
          [animated-view {:style (st/message-input-container message-input-offset)}
           input])})))

-(defview message-input []
+(defview message-input [input-options validator]
    [input-message [:get-chat-input-text]
     command [:get-chat-command]
     to-msg-id [:get-chat-command-to-msg-id]
@@ -110,7 +110,7 @@
         (when (and command (not response?))
           [command/command-icon command response?]))
       [message-input-container
-       [message-input]]
+       [message-input input-options validator]]
       ;; TODO emoticons: not implemented
       (when message-input?
         [plain-message/smile-button])


Update Transit deps

Update Transit deps

--- ClojureScript/replete/project.clj
+++ ClojureScript/replete/project.clj
@@ -1,8 +1,8 @@
 (defproject replete "0.1.0"
   :dependencies [[andare "0.7.0"]                           ; Update in script/build also
                  [cljsjs/parinfer "1.8.1-0"]
-                 [com.cognitect/transit-clj "0.8.275"]
-                 [com.cognitect/transit-cljs "0.8.220"]
+                 [com.cognitect/transit-clj "0.8.300"]
+                 [com.cognitect/transit-cljs "0.8.239"]
                  [fipp "0.6.8"]
                  [tailrecursion/cljson "1.0.7"]
                  [malabarba/lazy-map "1.1"]


s/disintigrator/disintegrator/

s/disintigrator/disintegrator/

--- src/overtone/sc/machinery/ugen/metadata/extras/distortion.clj
+++ src/overtone/sc/machinery/ugen/metadata/extras/distortion.clj
@@ -70,7 +70,7 @@
           smooth transitions between clean and lofi signals."}

-   {:name "Disintigrator"
+   {:name "Disintegrator"
     :summary "Port of ladspa disintigrator"
     :args [{:name "in"
             :doc "The input signal"}


fix nav background height if you scroll to bottom

--- frontend/components/landing_b.cljs
+++ frontend/components/landing_b.cljs
@@ -436,7 +436,7 @@
               epilog (om/get-node owner "home-epilog")
               cta-visible? (< (.-top (.getBoundingClientRect cta)) vh)
               epilog-visible? (< (.-top (.getBoundingClientRect epilog)) nav-height)
-              header-overlap-px (Math/abs (.-top (.getBoundingClientRect epilog)))
+              header-overlap-px (.-top (.getBoundingClientRect epilog))
               ;; normalize the overlap
               header-overlap-px (utils/inspect (min nav-height (max 0 header-overlap-px)))]
           (when-not (= cta-visible? @(om/get-state owner :cta-visible?))


Removing extraneous commented code

Removing extraneous commented code

--- src/jobless_clj/core.clj
+++ src/jobless_clj/core.clj
@@ -14,8 +14,6 @@
 (defmacro cv-items [& items]
   `(do ~@(for [n items] `(cv-item ~n))))

-
-
 (defmacro cv-group [group-type group-name]
   `(defn ~(symbol group-type) [& args#]
      (let [items# (map :entry (filter #(some? (:entry %1)) args#))]
@@ -26,15 +24,11 @@

 (cv-items "address" "bulletin" "company" "cv-name" "description" "email" "email"
           "end-date" "homepage" "location" "start-date" "technologies" "title")
+
 (cv-groups ["employment" "Employment"]
            ["education" "Education"]
            ["open-source" "Open Source Projects"]
            ["other-exp" "Other Experience"])
-;(cv-group "employment" "Employment")
-;(cv-group "education" "Education")
-;(cv-group "open-source" "Open Source")
-;(cv-group "other-exp" "Other Experience")
-

 (defn entry [& args]
   (let [bulletins (map :bulletin (filter #(some? (:bulletin %1)) args))


Return location in JSON and headers when creating resource.

--- src/kixi/hecuba/amon.clj
+++ src/kixi/hecuba/amon.clj
@@ -144,7 +144,7 @@
   :handle-created
   (fn [{id :programme-id {routes :modular.bidi/routes} :request}]
     (let [location (path-for routes (:programme @handlers) :programme-id id)]
-      (ring-response {:headers {"Location" location}}))))
+      (ring-response {:headers {"Location" location} :body (encode {:location location :status "OK" :version "4"})}))))

 (defresource programme [{:keys [commander querier]} handlers]
   :allowed-methods #{:get}
@@ -213,7 +213,7 @@
   :handle-created
   (fn [{id :project-id {routes :modular.bidi/routes} :request}]
     (let [location (path-for routes (:project @handlers) :project-id id)]
-      (ring-response {:headers {"Location" location}}))))
+      (ring-response {:headers {"Location" location} :body (encode {:location location :status "OK" :version "4"})}))))

 (defresource project [{:keys [commander querier]} handlers]
   :allowed-methods #{:get}
@@ -295,7 +295,7 @@
         (when-not location
           (throw (ex-info "No path resolved for Location header"
                           {:entity-id id})))
-        (ring-response {:headers {"Location" location}}))
+        (ring-response {:headers {"Location" location} :body (encode {:location location :status "OK" :version "4"})}))
       (ring-response {:status 422 :body "Provide valid projectId and propertyCode."}))))

 (defresource entity [{:keys [commander querier]} handlers]
@@ -418,7 +418,7 @@
         (when-not location (throw (ex-info "No path resolved for Location header"
                                            {:entity-id entity-id
                                             :device-id device-id})))
-        (ring-response {:headers {"Location" location}}))
+        (ring-response {:headers {"Location" location} :body (encode {:location location :status "OK" :version "4"})}))
       (ring-response {:status 422 :body "Provide valid entityId."}))))

 (defresource device [{:keys [commander querier]} handlers]


+begin +call +imagine +import +insist +learn +transfer +try

--- src/babel/english/lexicon.clj
+++ src/babel/english/lexicon.clj
@@ -121,6 +121,11 @@
     :synsem {:cat :verb
              :sem {:pred :to-be-missing}}}

+
+   "begin" {:synsem {:cat :verb
+                     :sem {:pred :begin}}
+            :english {:past "began"}}
+
    "bicycle" {:synsem {:cat :noun
                        :sem {:pred :bicycle
                              :place false}}}
@@ -156,6 +161,9 @@
                          :obj {:buyable true}}}
           :english {:past "bought"
                     :present {:3sing "buys"}}}
+
+   "call" {:synsem {:cat :verb
+                     :sem {:pred :call}}}

    "car" {:synsem {:cat :noun
                    :sem {:pred :car
@@ -489,11 +497,20 @@
                     :pred :io}
               :subcat '()}}]

+   "imagine" {:synsem {:cat :verb
+                     :sem {:pred :imagine}}}
+
+   "import" {:synsem {:cat :verb
+                :sem {:pred :import}}}
+
    "improve" {:synsem {:cat :verb
                 :sem {:pred :improve}}}

    "increase" {:synsem {:cat :verb
                         :sem {:pred :increase}}}
+
+   "insist" {:synsem {:cat :verb
+                      :sem {:pred :insist}}}

    "insure" {:synsem {:cat :verb
                       :sem {:pred :insure}}}
@@ -569,6 +586,9 @@

    "lie" {:synsem {:cat :verb
                 :sem {:pred :lie }}}
+
+             "learn" {:synsem {:cat :verb
+                     :sem {:pred :imparare}}}

    "listen to" {:synsem {:cat :verb
                          :sem {:pred :listen-to}}
@@ -952,6 +972,15 @@
                :synsem {:cat :verb
                         :sem {:pred :transfer}}}

+   "transfer" {:english {:past "transferred"
+                         :participle "transferring"}
+               :synsem {:cat :verb
+                        :sem {:pred :transfer}}}
+
+   "try" {:synsem {:cat :verb
+                   :sem {:pred :try}}
+          :english {:past "tried"}}
+
    "understand" {:english {:past "understood"}
                  :synsem {:cat :verb
                           :sem {:pred :understand}}}


"yo" should not specify a gender (just as "tú" does not)

--- src/babel/espanol/lexicon.clj
+++ src/babel/espanol/lexicon.clj
@@ -417,8 +417,7 @@
    {:synsem {:cat :noun
              :pronoun true
              :case :nom
-             :agr {:gender :fem
-                   :person :1st
+             :agr {:person :1st
                    :number :sing}
              :sem {:human true
                    :pred :I}


nicknaming actions to action

nicknaming actions to action

--- src/celestial/api/actions.clj
+++ src/celestial/api/actions.clj
@@ -34,20 +34,20 @@
         (let [ids (a/get-action-index :operates-on type)]
            (success (apply merge {} (map #(hash-map % (a/get-action %)) ids)))))

-  (GET- "/actions/:id" [^:int id] {:nickname "getActions" :summary "Get actions descriptor"}
+  (GET- "/actions/:id" [^:int id] {:nickname "getAction" :summary "Get action descriptor"}
         (success (a/get-action id))))

-(defroutes- actions {:path "/actions" :description "Adhoc actions managment"}
+(defroutes- actions {:path "/actions" :description "Adhoc action managment"}

-  (POST- "/actions" [& ^:action action] {:nickname "addActions" :summary "Adds an actions set"}
+  (POST- "/actions" [& ^:action action] {:nickname "addAction" :summary "Adds an actions set"}
     (wrap-errors (success {:msg "added action" :id (a/add-action action)})))

-  (PUT- "/actions/:id" [^:int id & ^:action action] {:nickname "updateActions" :summary "Update an actions set"}
+  (PUT- "/actions/:id" [^:int id & ^:action action] {:nickname "updateAction" :summary "Update an actions set"}
         (wrap-errors
           (a/update-action id action)
            (success {:msg "updated action" :id id})))

-  (DELETE- "/actions/:id" [^:int id] {:nickname "deleteActions" :summary "Deletes an action set"}
+  (DELETE- "/actions/:id" [^:int id] {:nickname "deleteAction" :summary "Deletes an action set"}
            (a/delete-action id)
            (success {:msg "Deleted action" :id id})))


doc of why seperation needed

doc of why seperation needed

--- src/celestial/persistency.clj
+++ src/celestial/persistency.clj
@@ -30,6 +30,7 @@
     (car/hset host :type t)))

 (defn hgetall [h]
+  "require since expect fails to mock otherwise"
    (wcar (car/hgetall h)))

 (defn host [h]


Regression fix

Regression fix

--- src/clj/salava/badge/main.clj
+++ src/clj/salava/badge/main.clj
@@ -1,7 +1,6 @@
 (ns salava.badge.main
   (:require [yesql.core :refer [defqueries]]
             [clojure.tools.logging :as log]
-            [clj-http.client :as http]
             [clojure.java.jdbc :as jdbc]
             [clojure.set :refer [rename-keys]]
             [clojure.string :refer [blank? split upper-case lower-case capitalize includes?]]
@@ -14,6 +13,7 @@
             [salava.social.db :as so]
             [clojure.tools.logging :as log]
             [salava.core.util :as u]
+            [salava.core.http :as http]
             [salava.badge.assertion :refer [fetch-json-data]]))

 (defqueries "sql/badge/main.sql")
@@ -296,7 +296,7 @@
       (let [assertion-url (select-badge-assertion-url {:id user-badge-id :user_id user-id} (into {:result-set-fn first :row-fn :assertion_url} (u/get-db ctx)))]
         (if (re-find (re-pattern obf-url) (str assertion-url))
           (try+
-            (http/get (str obf-url "/c/badge/passport_update") {:query-params {"badge" user-badge-id "user" user-id "url" site-url}})
+            (http/http-get (str obf-url "/c/badge/passport_update") {:query-params {"badge" user-badge-id "user" user-id "url" site-url}})
             (catch Object _
               (log/error "send-badge-info-to-obf: " _))))))))


Fixed match-method so that it always return true when route-method is nil.

Signed-off-by: James Reeves <9dadf8ecafa226c8f7c16002bdcb090267879343@weavejester.com>

--- src/compojure/http/routes.clj
+++ src/compojure/http/routes.clj
@@ -121,8 +121,7 @@
 (defn match-route-method
   "True if the method from the route matches the method from the request."
   [route-method request-method]
-  (or (nil? route-method)
-      (= route-method request-method)))
+  (= route-method request-method))

 (defn match-form-method
   "True if the route-method matches a posted forms _method parameter."
@@ -133,10 +132,11 @@
 (defn match-method
   "True if this request matches the route-method."
   [route-method request]
-  (let [request-method (request :request-method)]
-    (if-let [form-method (:_method (request :form-params))]
-      (match-form-method route-method form-method request-method)
-      (match-route-method route-method request-method))))
+  (or (nil? route-method)
+      (let [request-method (request :request-method)]
+        (if-let [form-method (:_method (request :form-params))]
+          (match-form-method route-method form-method request-method)
+          (match-route-method route-method request-method)))))

 (defn request-url
   "Return the complete URL for the request."


fix bug with positions

fix bug with positions

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

--- clojure/acq_engine.clj
+++ clojure/acq_engine.clj
@@ -95,9 +95,10 @@
       "ElapsedTime-ms"      "ElapsedTime-ms"
     )
     (assoc
-      "PositionIndex" 0
+      "PositionName" (get-in event [:position :label])
       "Channel" (get-in event [:channel :name])
       "PixelType" "GRAY8"
+      "ZPositionUm" (get event :slice)
     )))

 ;; acq-engine


Optimise retrieval of named streams

Optimise retrieval of named streams

--- src/photon/cassandra.clj
+++ src/photon/cassandra.clj
@@ -13,7 +13,7 @@

 #_(def kspace "photon")
 #_(def table "events")
-(def chunk-size 100)
+(def chunk-size 1000)

 (def charset (Charset/forName "UTF-8"))
 (def encoder (.newEncoder charset))
@@ -119,27 +119,38 @@
       (cql/use-keyspace conn kspace)
       (cql/select conn table (columns (-> ck distinct* (as "dv"))))))
   (db/lazy-events [this stream-name date]
-    (log/info "Retrieving events from" stream-name)
-    (map
-     cassandra->clj
-     (filter
-      (fn [ev]
-        (and
-         (or (= "__all__" stream-name)
-             (= :__all__ stream-name)
-             (= stream-name (:stream_name ev)))
-         (<= date (:server_timestamp ev))))
-      (let [conn (connection conn-string)]
-        (cql/use-keyspace conn kspace)
-        (cql/iterate-table conn table :local_id 1)))))
-  (db/lazy-events-page [this stream-name date page]))
+    (log/info "Retrieving events from" stream-name "from date" date)
+    (if (or (= "__all__" stream-name)
+            (= :__all__ stream-name))
+      (map
+       cassandra->clj
+       (filter
+        (fn [ev] (<= date (:server_timestamp ev)))
+        (let [conn (connection conn-string)]
+          (cql/use-keyspace conn kspace)
+          (cql/iterate-table conn table [] 1000))))
+      (db/lazy-events-page this stream-name date date)))
+  (db/lazy-events-page [this stream-name date page]
+    (let [conn (connection conn-string)]
+      (cql/use-keyspace conn kspace)
+      (let [res (cql/select conn table
+                            (where [[= :stream_name stream-name]
+                                    [> :server_timestamp page]])
+                            (order-by [:server_timestamp :asc])
+                            (limit chunk-size))
+            last-ts (:server_timestamp (last res))]
+        (if (empty? res)
+          []
+          (concat (map cassandra->clj res)
+                  (lazy-seq (db/lazy-events-page this stream-name
+                                                 date last-ts))))))))

 (defn create-keyspace [c]
   (let [conn (cc/connect ["127.0.0.1"])]
     (cql/create-keyspace conn "cassaforte_keyspace"
                          (with {:replication
                                 {:class "SimpleStrategy"
-                                 :replication_factor 1 }}))))
+                                 :replication_factor 1}}))))

 (defn drop-keyspace []
   (let [conn (cc/connect ["127.0.0.1"])]


Change twitter button text

Change twitter button text

--- src/pict_source/site.clj
+++ src/pict_source/site.clj
@@ -18,7 +18,7 @@
 (def twitter-share-button
   "<a href=\"https://twitter.com/share\" class=\"twitter-share-button\"
     data-url=\"http://pict.divshot.io\"
-    data-text=\"Check this out: open, multi language programmers dictionary\">
+    data-text=\"Check this out: #pict the open, multi language programmers dictionary\">
       Tweet
   </a>
   <script>


4Clojure - problem 115

4Clojure - problem 115

--- src/fourclojure/4_clojure.clj
+++ src/fourclojure/4_clojure.clj
@@ -41,4 +41,13 @@
      (loop [g (apply f args)]
        (if (ifn? g)
          (recur (g))
-         g))) triple 2))+         g))) triple 2))
+
+;problem 115 the balance of n
+((fn balance-n [x]
+   (letfn [(divide [s]
+             (let [len (count s) half (int (/ len 2))]
+               (if (even? len) (partition half s) [(take half s) (drop (inc half) s)])))
+           (sum [chs] (reduce + 0 (map #(Integer/parseInt (str %)) chs)))]
+     (let [sx (str x) [l r] (divide sx)]
+       (= (sum l) (sum r))))) 11)


Fix a bug after refactoring the templating.

--- src/posthere/results.clj
+++ src/posthere/results.clj
@@ -3,12 +3,12 @@
   (:require [net.cgrand.enlive-html :as enl :refer (content html-snippet deftemplate)]
             [ring.util.response :refer (response header)]
             [cheshire.core :refer (generate-string)]
-            [posthere.static-templating :as st :refer (partial-for)]))
+            [posthere.static-templating :as st :refer (partial-content)]))

 (deftemplate results-page st/layout [results uuid]

   ;; use Enlive to combine the layout and the page partial into a HTMl page
-  [:#page-partial-container] (content (html-snippet (partial-for "results")))
+  [:#page-partial-container] (content (html-snippet (partial-content "results")))

   ;; unhide the results div if we DO have some results
   [:#results] (if (not-empty results)


true, not "true"

true, not "true"

--- src/io/aviso/rook/swagger.clj
+++ src/io/aviso/rook/swagger.clj
@@ -59,25 +59,13 @@
                              conj {:name     path-id
                                    :type     :string        ; may add something later to refine this
                                    :in       :path
-                                   :required :true}))]
+                                   :required true}))]
     (reduce reducer swagger-object path-ids)))

 (defn reduce-schema-key
   "Simplifies a key from a schema reducing it to a keyword, and whether the key is required or optional."
   [schema-key]
-  (cond (s/optional-key? schema-key)
-        [(.k schema-key) false]
-
-        ;; This is the normal alternative to s/optional-key
-        (keyword? schema-key)
-        [schema-key true]
-
-        ;; This can happen in vector schemas, but is still legit in map schemas:
-        (s/required-key? schema-key)
-        [(.k schema-key) true]
-
-        :else
-        (throw (RuntimeException. (format "No idea what to do with query schema key %s." schema-key)))))
+  [(s/explicit-schema-key schema-key) (s/required-key? schema-key)])

 (defn- simple->swagger-schema
   "Converts a simple (non-object) Schema into an inline Swagger Schema, with keys :type and perhaps :format, etc."


Add a map? which considers java.util.Map, for keywordize-keys

--- src/runbld/util/data.clj
+++ src/runbld/util/data.clj
@@ -1,4 +1,10 @@
-(ns runbld.util.data)
+(ns runbld.util.data
+  (:refer-clojure :exclude [map?])
+  (:require [clojure.walk :refer [postwalk]]))
+
+(defn map? [x]
+  (or (instance? clojure.lang.IPersistentMap x)
+      (instance? java.util.Map x)))

 ;; http://dev.clojure.org/jira/browse/CLJ-1468
 (defn deep-merge
@@ -21,3 +27,10 @@
        (apply f maps)))
    maps))

+(defn keywordize-keys
+  "clojure.walk/keywordize-keys breaks when a map is actually a
+  j.u.LinkedHashMap, which is what happens with interop, in our case
+  Yaml#load()"
+  [m]
+  (with-redefs [clojure.core/map? map?]
+    (clojure.walk/keywordize-keys m)))


Implement symbol resolution in CLJS in a somewhat hacky way

--- src/spectrace/trace.cljc
+++ src/spectrace/trace.cljc
@@ -1,5 +1,6 @@
 (ns spectrace.trace
-  (:require [clojure.spec.alpha :as s]))
+  (:require [clojure.spec.alpha :as s]
+            #?(:cljs [cljs.compiler :as comp])))

 #_(do

@@ -210,18 +211,28 @@
     (succ (assoc state :spec pred) fail)
     (step-forward state succ fail)))

+(defn- method-of [multi-name key]
+  #?(:clj (let [maybe-multi (resolve multi-name)]
+            (when (and (var? maybe-multi)
+                       (instance? clojure.lang.MultiFn @maybe-multi))
+              (get-method @maybe-multi key)))
+     :cljs (let [maybe-multi (try
+                               ;; I'm not sure this is the right way
+                               ;; to resolve a symbol in CLJS
+                               (js/eval (str (comp/munge multi-name)))
+                               (catch js/Error _ nil))]
+             (when (instance? MultiFn maybe-multi)
+               (get-method maybe-multi key)))))
+
 (defmethod step* `s/multi-spec [{:keys [spec path] :as state} succ fail]
   (with-cont succ fail
     (let [[segment & path] path
-          multi-name (second spec)
-          maybe-multi (and (symbol? multi-name)
-                           (some-> multi-name resolve))]
-      (when (and (var? maybe-multi)
-                 (instance? clojure.lang.MultiFn @maybe-multi))
-        (let [method (get-method @maybe-multi segment)]
-          (assoc state
-                 :spec (method (:val state))
-                 :path path))))))
+          multi-name (second spec)]
+      (when-let [method (and (symbol? multi-name)
+                             (method-of multi-name segment))]
+        (assoc state
+               :spec (method (:val state))
+               :path path)))))

 (defn- step [{:keys [spec] :as state} succ fail]
   (if (or (set? spec) (symbol? spec) (keyword? spec))


Encore version check

Encore version check

--- src/taoensso/carmine.clj
+++ src/taoensso/carmine.clj
@@ -9,6 +9,18 @@
              (protocol    :as protocol)
              (connections :as conns)
              (commands    :as commands)]))
+
+;;;; Encore version check
+
+(let [min-encore-version 1.21] ; Let's get folks on newer versions here
+  (if-let [assert! (ns-resolve 'taoensso.encore 'assert-min-encore-version)]
+    (assert! min-encore-version)
+    (throw
+      (ex-info
+        (format
+          "Insufficient com.taoensso/encore version (< %s). You may have a Leiningen dependency conflict (see http://goo.gl/qBbLvC for solution)."
+          min-encore-version)
+        {:min-version min-encore-version}))))

 ;;;; Connections


Add key naming suggestions to `make-keyfn`

--- src/taoensso/carmine.clj
+++ src/taoensso/carmine.clj
@@ -91,8 +91,13 @@
   "Returns a function that joins keywords and strings to form an idiomatic
   compound Redis key name.

-  (let [k (make-keyfn :prefix)]
-    (k :foo :bar \"baz\")) => \"prefix:foo:bar:baz\""
+  (let [k (make-keyfn :account)]
+    (k \"1j4nhg7\" :email-address)) => \"account:1j4nhg7:email-address\"
+
+  Recommended key naming style:
+    * \"category:subcategory:id:field\" basic form.
+    * Singular category names (\"account\" rather than \"accounts\").
+    * Dashes for long names (\"email-address\" rather than \"emailAddress\", etc.)."
   [& prefix-parts]
   (let [join-parts (fn [parts] (str/join ":" (map name (filter identity parts))))
         prefix     (when (seq prefix-parts) (str (join-parts prefix-parts) ":"))]


updated indentation.

updated indentation.

--- src/clj/forma/matrix/utils.clj
+++ src/clj/forma/matrix/utils.clj
@@ -64,10 +64,10 @@
               tup-seq tuples
               v (transient [])]
          (let [[pos val] (first tup-seq)]
-           (cond (halt? idx tup-seq)    (persistent! v)
+           (cond (halt? idx tup-seq) (persistent! v)
                  (when pos (= idx pos)) (recur (inc idx) (rest tup-seq) (conj! v val))
                  (when pos (> idx pos)) (recur (inc idx) (rest tup-seq) (conj! v placeholder))
-                 :else                  (recur (inc idx) tup-seq (conj! v placeholder))))))))
+                 :else (recur (inc idx) tup-seq (conj! v placeholder))))))))

 (defn idx->colrow
   "Takes an index within a row vector, and returns the appropriate
@@ -95,9 +95,10 @@
 ;; ## Multi-dimensional matrix operations

 (defn variance-matrix
-  "construct a variance-covariance matrix from a given matrix `X`. If the
-  value of the matrix multiplication yields an integer value, then we
-  vectorize.  This would be equivalent to the var function in incanter.stats."
+  "construct a variance-covariance matrix from a given matrix `X`. If
+  the value of the matrix multiplication yields an integer value, then
+  we vectorize.  This would be equivalent to the var function in
+  incanter.stats."
   [X]
   (let [product (i/mmult (i/trans X) X)]
     (i/solve (if (seq? product)


Added :expires option to session middleware.
(decorate my-routes (with-session {:type :memory, :expires 600}))

Signed-off-by: James Reeves <9dadf8ecafa226c8f7c16002bdcb090267879343@weavejester.com>

--- src/compojure/http/session.clj
+++ src/compojure/http/session.clj
@@ -110,6 +110,41 @@
 (defmethod destroy-session :cookie [session])

 ;; Session middleware
+(defn- in-seconds
+  "Returns the current time plus seconds as milliseconds."
+  [seconds]
+  (let [current-time (. System currentTimeMillis)]
+    (+ (* seconds 1000) current-time)))
+
+(defn- set-session-expires-at
+  "Updates the session :expires-at if this session has an
+   expires value, otherwise just retuns the session."
+  [session]
+  (if-let [expires (:expires *session-repo*)]
+    (assoc session :expires-at (in-seconds expires))
+    session))
+
+(defn- session-expired?
+  "True if this session's timestamp is in the past."
+  [session]
+  (if-let [expires-at (:expires-at session)]
+    (let [current-time (. System currentTimeMillis)]
+      (< expires-at current-time))
+    false))
+
+(defn- new-session
+  "Returns a new session.  Will set the expires timestamp if needed."
+  []
+  (if (contains? *session-repo* :expires)
+    (set-session-expires-at (create-session))
+    (create-session)))
+
+(defn- new-request-session
+  "Associates a new session with a request."
+  [request]
+  (assoc request
+    :session      (new-session)
+    :new-session? true))

 (defn- get-request-session
   "Retrieve the session using the 'session' cookie in the request."
@@ -121,11 +156,12 @@
   "Associate the session with the request."
   [request]
   (if-let [session (get-request-session request)]
-    (assoc request
-      :session session)
-    (assoc request
-      :session      (create-session)
-      :new-session? true)))
+    (if (session-expired? session)
+      (do
+        (destroy-session session)
+        (new-request-session request))
+      (assoc request :session (set-session-expires-at session)))
+    (new-request-session request)))

 (defn- assoc-request-flash
   "Associate the session flash with the request and remove it from the
@@ -153,6 +189,7 @@
              (nil? (response :session)))
         (destroy-session session)
         (or (:session response)
+            (contains? *session-repo* :expires)
             (:new-session? request)
             (not-empty (:flash request)))
         (write-session session)))
@@ -161,7 +198,7 @@
   "Wrap a handler in a session of the specified type. Session type defaults to
   :memory if not supplied."
   ([handler]
-    (with-session handler :memory))
+    (with-session handler {:type :memory}))
   ([handler session-repo]
     (fn [request]
       (binding [*session-repo* session-repo]


Fix universe used by demo show.

Fix universe used by demo show.

Whoops, this was left set to work without my DMX interface, and
contradicting the documentation.

--- MaxPackage/afterglow-max/java-classes/init.clj
+++ MaxPackage/afterglow-max/java-classes/init.clj
@@ -87,7 +87,7 @@
   '*show*)

 ;; Create the demo show as specified above, and set it as the default show.
-(use-demo-show :universe 0)
+(use-demo-show)

 ;; Create the standard Afterglow sample cues within the demo show cue grid.
 (examples/make-cues)


Minor fix on colorpalette.

Minor fix on colorpalette.

--- frontend/src/uxbox/main/ui/workspace/colorpalette.cljs
+++ frontend/src/uxbox/main/ui/workspace/colorpalette.cljs
@@ -77,11 +77,11 @@
               (st/emit! (dw/toggle-flag :colorpalette)))]
       [:div.color-palette
        [:div.color-palette-actions
-        [:select.input-select {:on-change select-collection}
+        [:select.input-select {:on-change select-collection
+                               :value (pr-str selected-coll)}
          (for [collection collections]
            [:option {:key (str (:id collection))
-                     :value (pr-str (:id collection))
-                     :selected (when (= collection selected-coll) "selected")}
+                     :value (pr-str (:id collection))}
             (:name collection)])]
         #_[:div.color-palette-buttons
            [:div.btn-palette.edit.current i/pencil]


CMR-1780: Changing indexer to use latest only flag when fetching collections to reduce memory usage on metadata db.

--- indexer-app/src/cmr/indexer/services/index_service.clj
+++ indexer-app/src/cmr/indexer/services/index_service.clj
@@ -59,11 +59,7 @@
   (acl-fetcher/refresh-acl-cache context)

   (doseq [provider-id provider-ids]
-    (let [collections (->> (meta-db/find-collections context {:provider-id provider-id})
-                           ;; Limit to the maximum revision of each concept
-                           (group-by :concept-id)
-                           vals
-                           (map #(last (sort-by :revision-id %))))]
+    (let [collections (meta-db/find-collections context {:provider-id provider-id :latest true})]
       (bulk-index context [collections]))))

 (deftracefn index-concept


Fixing syntax error for gecode-3.7.1

Fixing syntax error for gecode-3.7.1


Adding special rpath sauce

Adding special rpath sauce

--- config/software/db.clj
+++ config/software/db.clj
@@ -17,11 +17,23 @@
 ;; limitations under the License.
 ;;

-(software "db" :source "db-5.0.26.NC"
-               :build-subdir "build_unix"
-               :steps [{:env {
-                              "LDFLAGS" "-R/opt/opscode/embedded/lib -L/opt/opscode/embedded/lib -I/opt/opscode/embedded/include"
-                              "CFLAGS" "-L/opt/opscode/embedded/lib -I/opt/opscode/embedded/include"}
-                        :command "../dist/configure" :args ["--prefix=/opt/opscode/embedded"]}
-                       {:command "make"}
-                       {:command "make" :args ["install"]}])
+(let [env
+      (cond
+       (and (is-os? "darwin") (is-machine? "x86_64"))
+       { "CFLAGS" "-L/opt/opscode/embedded/lib -I/opt/opscode/embedded/include"
+         "LDFLAGS" "-R/opt/opscode/embedded/lib -L/opt/opscode/embedded/lib -I/opt/opscode/embedded/include"}
+       (is-os? "linux")
+       { "CFLAGS" "-L/opt/opscode/embedded/lib -I/opt/opscode/embedded/include"
+         "LDFLAGS" "-Wl,-rpath /opt/opscode/embedded/lib -L/opt/opscode/embedded/lib -I/opt/opscode/embedded/include"}
+       (is-os? "solaris2")
+       { "CFLAGS" "-L/opt/opscode/embedded/lib -I/opt/opscode/embedded/include"
+         "LDFLAGS" "-Wl,-rpath /opt/opscode/embedded/lib -L/opt/opscode/embedded/lib -I/opt/opscode/embedded/include"}
+       )
+      ]
+
+  (software "db" :source "db-5.0.26.NC"
+                 :build-subdir "build_unix"
+                 :steps [{:env env
+                          :command "../dist/configure" :args ["--prefix=/opt/opscode/embedded"]}
+                         {:command "make"}
+                         {:command "make" :args ["install"]}]))


GR - add host to api urls

GR - add host to api urls

--- src/d_cent/http_api.clj
+++ src/d_cent/http_api.clj
@@ -10,11 +10,11 @@
                    :body (json/generate-string object)}))

 (defn create-user-profile [user-profile]
-  (let [{:keys [body status]} (json-post "/api/v1/users" user-profile)]
+  (let [{:keys [body status]} (json-post (str utils/host-url "/api/v1/users") user-profile)]
     (cond (= status 201)   (json/parse-string body true)
           :else            api-failure)))

 (defn create-objective [objective]
-  (let [{:keys [body status]} (json-post "/api/v1/objectives" objective)]
+  (let [{:keys [body status]} (json-post (str utils/host-url "/api/v1/objectives") objective)]
     (cond (= status 201)   (json/parse-string body true)
           :else            api-failure)))


Deployment ids can also be strings.

Deployment ids can also be strings.

--- src/onyx/static/validation.clj
+++ src/onyx/static/validation.clj
@@ -140,10 +140,13 @@
                    :lifecycle/post
                    :lifecycle/doc]))))

+(def deployment-id-schema
+  (schema/either schema/Uuid schema/Str))
+
 (defn validate-env-config [env-config]
   (schema/validate
     {:zookeeper/address schema/Str
-     :onyx/id schema/Uuid
+     :onyx/id deployment-id-schema
      (schema/optional-key :zookeeper/server?) schema/Bool
      (schema/optional-key :zookeeper.server/port) schema/Int}
     (select-keys env-config
@@ -152,7 +155,7 @@
 (defn validate-peer-config [peer-config]
   (schema/validate
     {:zookeeper/address schema/Str
-     :onyx/id schema/Uuid
+     :onyx/id deployment-id-schema
      :onyx.peer/job-scheduler schema/Keyword
      :onyx.messaging/impl (schema/enum :aeron :netty :core.async :dummy-messenger)
      :onyx.messaging/bind-addr schema/Str


ensure the final state includes cached states that we skipped over


missing paren

missing paren


Use new hiccup-err more

Use new hiccup-err more

--- src/reagent/impl/template.cljs
+++ src/reagent/impl/template.cljs
@@ -244,8 +244,8 @@
                   jsprops)]
           (make-element argv comp p first-child))))))

-(defn hiccup-err [v msg]
-  (str msg (pr-str v) (comp/comp-name)))
+(defn hiccup-err [v & msg]
+  (str (apply str msg) (pr-str v) (comp/comp-name)))

 (defn vec-to-elem [v]
   (assert (pos? (count v)) (hiccup-err v "Hiccup form should not be empty: "))
@@ -300,15 +300,13 @@
     a))

 (defn expand-seq-check [x]
-  (let [ctx #js {}
+  (let [ctx #js{}
         [res derefed] (ratom/check-derefs #(expand-seq-dev x ctx))]
     (when derefed
-      (warn "Reactive deref not supported in lazy seq, "
-            "it should be wrapped in doall"
-            (comp/comp-name) ". Value:\n" (pr-str x)))
+      (warn (hiccup-err x "Reactive deref not supported in lazy seq, "
+                        "it should be wrapped in doall: ")))
     (when (.' ctx :no-key)
-      (warn "Every element in a seq should have a unique "
-            ":key" (comp/comp-name) ". Value: " (pr-str x)))
+      (warn (hiccup-err x "Every element in a seq should have a unique :key: ")))
     res))

 (defn make-element [argv comp jsprops first-child]


CMR-1699 Cleans up :require expressions.

--- system-int-test/test/cmr/system_int_test/bootstrap/virtual_products_test.clj
+++ system-int-test/test/cmr/system_int_test/bootstrap/virtual_products_test.clj
@@ -1,20 +1,14 @@
 (ns cmr.system-int-test.bootstrap.virtual-products-test
   (:require [clojure.test :refer :all]
-            [cmr.bootstrap.test.catalog-rest :as cat-rest]
-            [cmr.common.concepts :as concepts]
-            [cmr.common.mime-types :as mime-types]
-            [cmr.oracle.connection :as oracle]
             [cmr.system-int-test.data2.collection :as dc]
             [cmr.system-int-test.data2.core :as d]
             [cmr.system-int-test.data2.granule :as dg]
-            [cmr.system-int-test.system :as s]
             [cmr.system-int-test.utils.bootstrap-util :as bootstrap]
             [cmr.system-int-test.utils.dev-system-util :as dev-sys-util :refer [eval-in-dev-sys]]
             [cmr.system-int-test.utils.index-util :as index]
             [cmr.system-int-test.utils.ingest-util :as ingest]
             [cmr.system-int-test.utils.search-util :as search]
             [cmr.system-int-test.utils.virtual-product-util :as vp]
-            [cmr.umm.core :as umm]
             [cmr.virtual-product.config :as vp-config]))

 ;; test procedure:


Finally figured out how to use :import.

Finally figured out how to use :import.

--- src/tutorial/notepad/core.cljs
+++ src/tutorial/notepad/core.cljs
@@ -1,6 +1,6 @@
 (ns ^:figwheel-always tutorial.notepad.core
-    (:require [goog.dom :as dom]
-              [goog.ui.Zippy]))
+    (:require [goog.dom :as dom])
+    (:import [goog.ui Zippy]))

 (enable-console-print!)

@@ -20,7 +20,7 @@
         new-note-dom (dom/createDom "div" nil
                                     header-element content-element)]
     (dom/appendChild (.-parent note) new-note-dom)
-    (goog.ui.Zippy. header-element content-element)))
+    (Zippy. header-element content-element)))

 ;;"Main" function for page.


Life sucks. Then you die.

Life sucks. Then you die.

--- test/behaviors/t_protocols.clj
+++ test/behaviors/t_protocols.clj
@@ -4,7 +4,7 @@
   (:use [midje sweet test-util]
         [midje.open-protocols]
         behaviors.t-protocols-support)
-  (:import behaviors.t-protocols-support.OutsideNSFakeableRecord))
+  (:import behaviors.t_protocols_support.OutsideNSFakeableRecord))

 (fact "Imported record functions can be faked when called from outside"
   (let [rec (OutsideNSFakeableRecord. 1 3)]


Add invoke-test and make TestCases callable as fns.

--- lazytest.clj
+++ lazytest.clj
@@ -20,12 +20,23 @@
 (defprotocol Testable
   (run-tests [x] "Runs tests defined for the Namespace, Var, or TestCase."))

+(defprotocol TestInvokable
+  (invoke-test [t states active]
+               "(private) Executes the TestCase or Assertion."))
+
+(extend-class clojure.lang.Fn TestInvokable
+              (invoke-test [f states active] (apply f states)))

 ;;; DATATYPES

+(declare run-test-case)
+
 (deftype Context [parents before after])

-(deftype TestCase [contexts children])
+(deftype TestCase [contexts children] :as this
+  clojure.lang.IFn (invoke [] (run-test-case this))
+  TestInvokable (invoke-test [states active]
+                             (run-test-case this active)))

 (deftype Assertion [locals form])

@@ -141,9 +152,7 @@
       (let [merged (reduce open-context active (:contexts t))
             states (map merged (:contexts t))
             ;; Prevent chunking for truly lazy execution:
-            results (unchunked-map (fn [c] (if (fn? c)
-                                             (apply c states)
-                                             (run-test-case c merged)))
+            results (unchunked-map #(invoke-test % states merged)
                                    (:children t))]
         ;; Force non-lazy execution to handle shutdown properly:
         (when (some has-after? (:contexts t))


Add tests for go fn.

Add tests for go fn.

--- test/isla/test/story.clj
+++ test/isla/test/story.clj
@@ -58,3 +58,29 @@
         story (init-story story-str)]
     (is (= (run-command story "look at myself")
            summary))))
+
+;; go
+
+(deftest test-moving-between-rooms
+  (let [story-str (str "palace is a room
+                        garden is a room
+                        palace exit is garden
+                        my room is palace")
+        story (init-story story-str)
+        result (run-command story "go into garden")]
+    (is (re-find #"You are in the garden" (:out result)))
+    (is (:name (:room (:player (:sto result)))) "garden")))
+
+(deftest test-trying-to-move-to-unconnected-room
+  (let [story-str (str "palace is a room\ngarden is a room\nmy room is palace")
+        story (init-story story-str)
+        result (run-command story "go into garden")]
+    (is (re-find #"You cannot go into the garden" (:out result)))
+    (is (= story (:sto result)))))
+
+(deftest test-trying-to-move-to-non-existent-room
+  (let [story-str (str "palace is a room\nmy room is palace")
+        story (init-story story-str)
+        result (run-command story "go into garden")]
+    (is (re-find #"You cannot go into the garden" (:out result)))
+    (is (= story (:sto result)))))


add active users

add active users

--- src-cljs/frontend/components/plan.cljs
+++ src-cljs/frontend/components/plan.cljs
@@ -67,8 +67,7 @@
          (if (nil? active-users)
            [:div.loading {:key "loading"} "Loading"]
            [:div.content {:key "history"}
-            (if (< 0 (count history))
-
+            (if (seq history)
               (for [{:keys [cust instant added?]} (reverse history)]
                 [:div.access-card.make {:key (str instant cust)}
                  [:div.access-avatar
@@ -80,10 +79,38 @@
                   [:span.access-status
                    (str "Was marked as" (if added? " active " " inactive ") (format-access-date instant) ".")]]])

-              [:div.menu-empty.content
+              [:div.menu-empty.content {:key "empty"}
                [:p.make (common/icon :activity)]
-               [:p.make "We haven't seen any activity on your team yet. "]
+               [:p.make "We haven't seen any activity on your team yet. It's refreshed every 8 hours."]
                [:a.make.feature-link {:on-click #(cast! :team-settings-opened) :role "button"} "Add a teammate."]])]))))))
+
+(defn active-custs [{:keys [plan team-uuid]} owner]
+  (reify
+    om/IRender
+    (render [_]
+      (let [{:keys [cast! team-db]} (om/get-shared owner)
+            active (:plan/active-custs plan)]
+        (html
+         [:div.menu-view
+          (if (seq active)
+            [:div.content {:key "active"}
+             [:div.content.make
+              (str (count active) " active user" (when (< 1 (count active)) "s") " on your plan")]
+             (for [email (sort active)]
+               [:div.access-card.make {:key email}
+                [:div.access-avatar
+                 [:img.access-avatar-img
+                  {:src (utils/gravatar-url email)}]]
+                [:div.access-details
+                 [:span {:title email}
+                  email]
+                 [:span.access-status
+                  ""]]])]
+            [:div.content {:key "empty"}
+             [:div.menu-empty.content
+              [:p.make (common/icon :activity)]
+              [:p.make "We haven't seen any activity on your team yet. It's refreshed every 8 hours."]
+              [:a.make.feature-link {:on-click #(cast! :team-settings-opened) :role "button"} "Add a teammate."]]])])))))

 (defn format-stripe-cents
   "Formats Stripe's currency values into ordinary dollar format
@@ -245,6 +272,35 @@
             [:div.content.make
              "Your discount expires on " (datetime/month-day (:discount/end plan)) "."])])))))

+(defn open-menu-props [cast! submenu]
+  {:on-click #(cast! :plan-submenu-opened {:submenu submenu})
+   :on-touch-end #(do (cast! :plan-submenu-opened {:submenu submenu})
+                      (.preventDefault %))})
+
+(defn activity-summary [{:keys [plan team-uuid]} owner]
+  (reify
+    om/IRender
+    (render [_]
+      (let [cast! (om/get-shared owner :cast!)]
+        (html
+         (case (count (:plan/active-custs plan))
+           0 [:span
+              [:a (merge {:role "button"}
+                         (open-menu-props cast! :active))
+               "No users"]
+              " are active on your team, yet."]
+           1 [:span
+              [:a (merge {:role "button"}
+                         (open-menu-props cast! :active))
+               "One user"]
+              " is active on your team."]
+           [:span
+            [:a (merge {:role "button"}
+                       (open-menu-props cast! :active))
+             (str (count (:plan/active-custs plan)) " users")]
+
+            " are active on your team."]))))))
+
 (defn paid-summary [{:keys [plan team-uuid]} owner]
   (reify
     om/IRender
@@ -262,10 +318,7 @@
             " for " (format-stripe-cents (plan-model/cost plan)) "."]])
         [:div.content.make
          [:p
-          (case (count (:plan/active-custs plan))
-            0 "No users are active on your team, yet."
-            1 "One user is active on your team."
-            (str (count (:plan/active-custs plan)) " users are active on your team."))
+          (om/build activity-summary {:plan plan :team-uuid team-uuid})
           " Your plan renews monthly. "
           ;; discount
           (when-let [coupon (:discount/coupon plan)]
@@ -289,10 +342,7 @@
            [:h4 "Your free trial has expired."]])
         [:div.content.make
          [:p
-          (case (count (:plan/active-custs plan))
-            0 "No users are active on your team, yet."
-            1 "One user is active on your team."
-            (str (count (:plan/active-custs plan)) " users are active on your team."))
+          (om/build activity-summary {:plan plan :team-uuid team-uuid})
           " Your plan will cost " (format-stripe-cents (plan-model/cost plan)) "/mo. "
           ;; discount
           (when-let [coupon (:discount/coupon plan)]
@@ -308,10 +358,7 @@
     om/IRender
     (render [_]
       (let [{:keys [cast! db]} (om/get-shared owner)
-            open-menu-props (fn [submenu]
-                              {:on-click #(cast! :plan-submenu-opened {:submenu submenu})
-                               :on-touch-end #(do (cast! :plan-submenu-opened {:submenu submenu})
-                                                  (.preventDefault %))})]
+            ]
         (html
          [:div.menu-view
           [:div.divider.make]
@@ -324,20 +371,20 @@
              (common/icon :credit)
              [:span "Add payment"]]
             (list
-             [:a.vein.make (open-menu-props :info)
+             [:a.vein.make (open-menu-props cast! :info)
               (common/icon :info)
               [:span "Information"]]
-             [:a.vein.make (open-menu-props :payment)
+             [:a.vein.make (open-menu-props cast! :payment)
               (common/icon :credit)
               [:span "Payment"]]
-             [:a.vein.make (open-menu-props :invoices)
+             [:a.vein.make (open-menu-props cast! :invoices)
               (common/icon :docs)
               [:span "Invoices"]]
-             [:a.vein.make (open-menu-props :activity)
+             [:a.vein.make (open-menu-props cast! :activity)
               (common/icon :activity)
               [:span "Activity"]]
              (when (plan-model/active-discount? plan)
-               [:a.vein.make (open-menu-props :discount)
+               [:a.vein.make (open-menu-props cast! :discount)
                 (common/icon :heart)
                 [:span "Discount"]])
              (when (neg? (:plan/account-balance plan))
@@ -350,6 +397,7 @@
    :payment payment
    :invoices invoices
    :activity activity
+   :active active-custs
    :discount discount})

 (defn plan-menu* [{:keys [plan-id team-uuid submenu]} owner]


CIRCLE-2580 Add total projects return count to :vcs-activity-fetched event (#1619)

* Add total projects return count to :vcs-activity-fetched event

* cr

--- src-cljs/frontend/controllers/api.cljs
+++ src-cljs/frontend/controllers/api.cljs
@@ -1166,7 +1166,8 @@
                       :current-state current-state
                       :properties {:status status
                                    :total-building-projects-count (total-projects-count true)
-                                   :total-not-building-projects-count (total-projects-count false)}})))
+                                   :total-not-building-projects-count (total-projects-count false)
+                                   :total-projects-count (count resp)}})))

 (defmethod post-api-event! [:vcs-activity :failed]
   [_ _ status {:keys [status-code resp]} _ current-state]


Development versions should be snapshots

--- metrics-clojure-core/project.clj
+++ metrics-clojure-core/project.clj
@@ -1,4 +1,4 @@
-(defproject metrics-clojure "0.9.2"
+(defproject metrics-clojure "0.10.0-SNAPSHOT"
   :description "A Clojure façade for Coda Hale's metrics library."
   :dependencies [[org.clojure/clojure "[1.2.1,1.4.0]"]
                  [com.yammer.metrics/metrics-core "2.0.1"]]


formatting

formatting

--- chesire-cat/src/chesire_cat/handler.clj
+++ chesire-cat/src/chesire_cat/handler.clj
@@ -3,10 +3,8 @@
             [compojure.route :as route]
             [ring.middleware.defaults :refer [wrap-defaults site-defaults]]
             [cheshire.core :refer :all :as json]
-
             [ring.middleware.json :as ring-json]
-            [ring.util.response :as rr]
-))
+            [ring.util.response :as rr]))

 (defroutes app-routes
   (GET "/" [] "Hello World!!!")
@@ -20,15 +18,12 @@
        )
   (GET "/json2" []
        (rr/response {:first "Brad" :last "Lucas"}))
-  (route/not-found "Not Found")
-)
+  (route/not-found "Not Found"))

 ;; see project.clj :ring :handler
 (def app
-;;  (wrap-defaults app-routes site-defaults)
+  ;;  (wrap-defaults app-routes site-defaults)
   (-> app-routes
       (ring-json/wrap-json-response)
       (wrap-defaults site-defaults)))

-(defn foo []
-  "foo")


[clojure-package] improve docstrings in `image.clj` (#14307)

--- contrib/clojure-package/src/org/apache/clojure_mxnet/image.clj
+++ contrib/clojure-package/src/org/apache/clojure_mxnet/image.clj
@@ -16,6 +16,7 @@
 ;;

 (ns org.apache.clojure-mxnet.image
+  "Image API of Clojure package."
   (:require [t6.from-scala.core :refer [$ $$] :as $]
             [org.apache.clojure-mxnet.dtype :as dtype]
             [org.apache.clojure-mxnet.ndarray :as ndarray]
@@ -37,7 +38,18 @@
   (s/keys :opt-un [::color-flag ::to-rgb ::output]))

 (defn decode-image
-  "Decodes an image from an input stream"
+  "Decodes an image from an input stream with OpenCV
+    `input-stream`: `InputStream` - Contains the binary encoded image
+    `color-flag`: 0 or 1 - Convert decoded image to grayscale (0) or color (1)
+    `to-rgb`: boolean - Whether to convert decoded image to mxnet's default RGB
+            format (instead of opencv's default BGR)
+    `output`: nil or `NDArray`
+    returns: `NDArray` with dtype uint8
+
+  Ex:
+    (decode-image input-stream)
+    (decode-image input-stream {:color-flag 1})
+    (decode-image input-stream {:color-flag 0 :output nd})"
   ([input-stream {:keys [color-flag to-rgb output]
                   :or {color-flag COLOR to-rgb true output nil}
                   :as opts}]
@@ -54,7 +66,19 @@
   (s/or :none nil? :some ::to-rgb))

 (defn read-image
-  "Reads an image file and returns an ndarray"
+  "Reads an image file and returns an ndarray with OpenCV. It returns image in
+   RGB by default instead of OpenCV's default BGR.
+    `filename`: string - Name of the image file to be loaded
+    `color-flag`: 0 or 1 - Convert decoded image to grayscale (0) or color (1)
+    `to-rgb`: boolean - Whether to convert decoded image to mxnet's default RGB
+            format (instead of opencv's default BGR)
+    `output`: nil or `NDArray`
+    returns: `NDArray` with dtype uint8
+
+   Ex:
+     (read-image \"cat.jpg\")
+     (read-image \"cat.jpg\" {:color-flag 0})
+     (read-image \"cat.jpg\" {:color-flag 1 :output nd})"
   ([filename {:keys [color-flag to-rgb output]
               :or {color-flag nil to-rgb nil output nil}
               :as opts}]
@@ -74,7 +98,17 @@
 (s/def ::optional-int (s/or :none nil? :some int?))

 (defn resize-image
-  "Resizes the image array to (width, height)"
+  "Resizes the image array to (width, height)
+   `input`: `NDArray` - source image in NDArray
+   `w`: int - Width of resized image
+   `h`: int - Height of resized image
+   `interpolation`: Interpolation method. Default is INTER_LINEAR
+   `ouput`: nil or `NDArray`
+   returns: `NDArray`
+
+   Ex:
+     (resize-image nd-img 300 300)
+     (resize-image nd-img 28 28 {:output nd})"
   ([input w h {:keys [interpolation output]
                :or {interpolation nil output nil}
                :as opts}]
@@ -88,7 +122,21 @@
    (resize-image input w h {})))

 (defn apply-border
-  "Pad image border"
+  "Pad image border with OpenCV.
+   `input`: `NDArray` - source image in NDArray
+   `top`: int - Top margin
+   `bottom`: int - Bottom margin
+   `left`: int - Left margin
+   `right`: int - Right margin
+   `fill-type`: nil or Filling type - Default BORDER_CONSTANT
+   `value`: nil or double - Deprecated, use `values` instead
+   `values`: Fill with value(RGB or gray), up to 4 channels
+   `output`: nil or `NDArray`
+   returns: `NDArray`
+
+   Ex:
+     (apply-border img-nd 1 1 1 1)
+     (apply-border img-nd 3 3 0 0)"
   ([input top bottom left right
     {:keys [fill-type value values output]
      :or {fill-type nil value nil values nil output nil}
@@ -109,7 +157,17 @@
    (apply-border input top bottom left right {})))

 (defn fixed-crop
-  "Return a fixed crop of the image"
+  "Return a fixed crop of the image.
+   `input`: `NDArray` - Source image in NDArray
+   `x0`: int - Starting x point
+   `y0`: int - Starting y point
+   `w`: int - Width of the image
+   `h`: int - Height of the image
+   returns: cropped `NDArray`
+
+   Ex:
+     (fixed-crop nd-img 0 0 28 28)
+     (fixed-crop nd-img 10 0 100 300)"
   [input x0 y0 w h]
   (util/validate! ::ndarray input "Invalid input array")
   (util/validate! ::int x0 "Invalid starting x coordinate")
@@ -119,7 +177,9 @@
   (Image/fixedCrop input x0 y0 w h))

 (defn rgb-array?
-  "Returns whether the ndarray is in the RGB format"
+  "Returns whether the ndarray is in the RGB format
+   `input`: `NDArray` - Source image in NDArray
+   returns: boolean"
   [input]
   (util/validate! ::ndarray input "Invalid input array")
   (let [shape (ndarray/shape-vec input)]
@@ -133,7 +193,9 @@
   (s/and ::ndarray ::all-bytes ::rgb-array))

 (defn to-image
-  "Convert a NDArray image in RGB format to a real image"
+  "Convert a NDArray image in RGB format to a real image.
+   `input`: `NDArray` - Source image in NDArray
+   returns: `BufferedImage`"
   [input]
   (util/validate! ::to-image-ndarray input "Invalid input array")
   (Image/toImage input))


CMR-4263: Rewrite migration to not rely on source code functions to determine provider specific services table and sequence names.

--- metadata-db-app/src/migrations/054_remove_provider_services_tables.clj
+++ metadata-db-app/src/migrations/054_remove_provider_services_tables.clj
@@ -1,23 +1,35 @@
 (ns migrations.054-remove-provider-services-tables
   (:require
-    [cmr.metadata-db.data.oracle.concept-tables :as ct]
     [config.mdb-migrate-helper :as h]
     [config.migrate-config :as config]))
+
+(defn- get-services-table-name
+  "Returns a provider specific services table-name. Needed in this migration because the
+  concept-tables function which does the same has a different behavior after this migration
+  was initially written."
+  [provider]
+  (format "%s_SERVICES" provider))
+
+(defn- get-services-sequence-name
+  "Returns a provider specific services sequence name."
+  [provider]
+  (format "%s_SERVICES_SEQ" provider))

 (defn up
   "Migrates the database up to version 54."
   []
   (println "migrations.054-remove-provider-services-tables up...")
-  (doseq [provider (h/get-regular-providers)
-          :let [t (ct/get-table-name provider :service)
-                sequence-name (str t "_seq")]]
-    (h/sql (format "drop table %s" t))
-    (h/sql (format "drop sequence %s" sequence-name)))
-  (h/sql "drop table small_prov_services")
-  (h/sql "drop sequence small_prov_services_seq"))
+  (doseq [provider (conj (map :provider-id (h/get-regular-providers)) "SMALL_PROV")
+          :let [table-name (get-services-table-name provider)
+                sequence-name (get-services-sequence-name provider)]]
+    (h/sql (format "drop table %s" table-name))
+    (h/sql (format "drop sequence %s" sequence-name))))

-(def create-service-sql
-  "CREATE TABLE small_prov_services (
+(defn- create-service-table-for-provider-sql
+  "Returns the SQL to create a service table for a provider."
+  [provider]
+  (format
+   "CREATE TABLE %s_SERVICES (
     id NUMBER,
     concept_id VARCHAR(255) NOT NULL,
     native_id VARCHAR(1030) NOT NULL,
@@ -31,23 +43,22 @@
     delete_time TIMESTAMP WITH TIME ZONE,
     user_id VARCHAR(30) NULL,
     provider_id VARCHAR(255) NOT NULL,
-    CONSTRAINT small_prov_services_pk PRIMARY KEY (id),
-    CONSTRAINT small_prov_services_con_rev
+    CONSTRAINT %s_services_pk PRIMARY KEY (id),
+    CONSTRAINT %s_services_con_rev
       UNIQUE (provider_id, native_id, revision_id)
-      USING INDEX (create unique index small_prov_services_ucr_i
-                          ON small_prov_services(provider_id, native_id, revision_id)),
-    CONSTRAINT small_prov_services_cid_rev
+      USING INDEX (create unique index %s_services_ucr_i
+                          ON %s_services(provider_id, native_id, revision_id)),
+    CONSTRAINT %s_services_cid_rev
       UNIQUE (concept_id, revision_id)
-      USING INDEX (create unique index small_prov_services_cri
-                          ON small_prov_services(concept_id, revision_id)))")
-
+      USING INDEX (create unique index %s_services_cri
+                          ON %s_services(concept_id, revision_id)))"
+   provider provider provider provider provider provider provider provider))

 (defn down
   "Migrates the database down from version 54."
   []
   (println "migrations.054-remove-provider-services-tables down...")
-  (doseq [provider (h/get-regular-providers)]
-    (ct/create-concept-table (config/db) provider :service)
-    (ct/create-concept-table-id-sequence (config/db) provider :service))
-  (h/sql create-service-sql)
-  (h/sql "CREATE SEQUENCE small_prov_services_seq"))
+  (doseq [provider (conj (map :provider-id (h/get-regular-providers)) "SMALL_PROV")
+          :let [sequence-name (get-services-sequence-name provider)]]
+    (h/sql (create-service-table-for-provider-sql provider))
+    (h/sql (format "create sequence %s" sequence-name))))


Older Narayana depends on older HornetQ

Older Narayana depends on older HornetQ

--- transactions/project.clj
+++ transactions/project.clj
@@ -22,7 +22,7 @@
   :jvm-opts ["-Dhornetq.data.dir=target/hornetq-data"]

   :profiles {:dev
-             {:dependencies [[org.immutant/messaging _]
+             {:dependencies [[org.immutant/messaging _ :exclusions [org.hornetq/hornetq-journal org.hornetq/hornetq-commons]]
                              [org.immutant/caching _ :exclusions [org.jboss.spec.javax.transaction/jboss-transaction-api_1.1_spec]]
                              [org.clojure/java.jdbc _]
                              [com.h2database/h2 _]]}})


updating example

updating example

--- example/project.clj
+++ example/project.clj
@@ -37,7 +37,7 @@
                                     :output-dir "resources/public/js/out"
                                     :source-map true
                                     :source-map-timestamp true
-                                    :recompile-dependents false
+                                    ;; :recompile-dependents true
                                     :cache-analysis true
                                     :optimizations :none}}
                        { :id "example-admin"
@@ -60,7 +60,7 @@
              :css-dirs ["resources/public/css"]
              :open-file-command "emacsclient"
              ;; Start an nREPL server into the running fighweel process
-             ;; :nrepl-port 7888
+             :nrepl-port 7888
              ;; to disable the repl
              ;; :repl false
              ;; to specify a server logfile


repo badge panel

repo badge panel

--- cloc-webapp/src-cljs/dash/dash.cljs
+++ cloc-webapp/src-cljs/dash/dash.cljs
@@ -64,6 +64,20 @@
                                  (if-let [registered (get-in [:repos current-index :registered] state)]
                                    (assoc-in state [:repos current-index :registered] (assoc registered :lang body))
                                    state))))))))
+
+(defn repo-badge-panel [state owner]
+  (reify
+    om/IRender
+    (render [this]
+      (dom/div nil
+        (dom/select
+          #js {:onChange (fn []
+                           (this-as this
+                             (let [opt-value (aget (.-options this) (.-selectedIndex this) "value")]
+                               (aset (om/get-node owner "badge-link") "value" opt-value))))}
+          (dom/option #js {:value (:svg_badge_url state)} "SVG badge")
+          (dom/option #js {:value (:png_badge_url state)} "PNG badge"))
+        (dom/textarea #js {:ref "badge-link"})))))

 ;; {:auth - :repo -}
 (defn repo-config-panel [state owner]


util.clj: lexicographical comparison function take an primitive comparison function as arguments.

--- clojure/org/gavrog/clojure/util.clj
+++ clojure/org/gavrog/clojure/util.clj
@@ -17,19 +17,23 @@
    previous result."
   (reductions #(%2 %1) x (cycle coll)))

-(defn compare-lexicographically [xs ys]
-  "Compares two sequences lexicographically via compare. Elements of
-   the first sequence must implements Comparable."
-  (cond (empty? xs) (if (empty? ys) 0 -1)
-        (empty? ys) 1
-        :else (let [d (compare (first xs) (first ys))]
-                (if (not= 0 d)
-                  d
-                  (recur (rest xs) (rest ys))))))
+(defn compare-lexicographically
+  ([cmp xs ys]
+    "Compares two sequences lexicographically via the given function cmp."
+    (cond (empty? xs) (if (empty? ys) 0 -1)
+          (empty? ys) 1
+          :else (let [d (cmp (first xs) (first ys))]
+                  (if (not= 0 d)
+                    d
+                    (recur cmp (rest xs) (rest ys))))))
+  ([xs ys]
+    "Compares two sequences lexicographically via compare. Elements of
+     the first sequence must implements Comparable."
+    (compare-lexicographically compare xs ys)))

 (defn lexicographically-smallest
   "Returns the lexicographically smallest sequence, via compare."
-  ([xs] xs)
-  ([xs ys] (if (neg? (compare-lexicographically xs ys)) xs ys))
-  ([xs ys & more] (reduce lexicographically-smallest
-                          (lexicographically-smallest xs ys) more)))
+  ([cmp xs] xs)
+  ([cmp xs ys] (if (neg? (compare-lexicographically cmp xs ys)) xs ys))
+  ([cmp xs ys & more] (reduce (partial lexicographically-smallest cmp)
+                          (lexicographically-smallest cmp xs ys) more)))


Implement rich text field #46; fitVideo look vector command

--- src/flatgui/samples/forms/richtext.clj
+++ src/flatgui/samples/forms/richtext.clj
@@ -46,6 +46,9 @@
     (and (= (get-reason) [:image->]) (get-property [:image->] :pressed))
     (textrich/rendition-input-data-evolver component old-rendition {:type :image :data "http://flatgui.org/resources/icon.png" :size {:w 0.5 :h 0.5}})

+    (and (= (get-reason) [:video->]) (get-property [:video->] :pressed))
+    (textrich/rendition-input-data-evolver component old-rendition {:type :video :data "imagesrv/text/SampleVideo_360x240_2mb.mp4" :size {:w 0.5 :h 0.5}})
+
     :else
     (textrich/rendition-evolver component)))

@@ -67,6 +70,11 @@
        :clip-size (m/defpoint 0.375 0.375)
        :text "I"})

+    (fg/defcomponent button/button :video->
+      {:position-matrix (m/translation 1.5 0.5)
+       :clip-size (m/defpoint 0.375 0.375)
+       :text "V"})
+
     (fg/defcomponent
       textrich/textrich
       :text


added progress indicator to editor save button

--- cljs/src/views/editor.cljs
+++ cljs/src/views/editor.cljs
@@ -81,7 +81,9 @@
   (if (re-matches #"[/\-a-zA-Z0-9\.]+" slug) false true))

 (defn link-label-has-invalid-chars? [label]
-  (if (re-matches #"[/\-a-zA-Z0-9\.?!]+" label) false true))
+  (if (re-matches #"[\u0080-\uffffa-zA-Z0-9.?! -]+" label)
+    false
+    true))

 (defn html-with-clean-image-uris [html]
   (let [get-num-sub-paths (fn [s] (when (string? s)
@@ -397,6 +399,13 @@
                        (get-related-images
                         (dom/getElement "related-images-container")))}))

+
+(defn handle-successful-save []
+  (let [save-button-el (dom/getElement "save-document")]
+    ;; TODO: display status message
+    (set! (.-innerHTML save-button-el) "Save")
+    (set! (.-disabled save-button-el) false)))
+
 (defn save-new-document-xhr-callback [e]
   (let [xhr (.-target e)]
     (if (= (.getStatus xhr e) 201)
@@ -406,7 +415,8 @@
                                           ("feed" json)
                                           "/edit"
                                           ("slug" json))
-                                     (str "Edit \"" ("title" json) "\"")))
+                                     (str "Edit \"" ("title" json) "\""))
+        (handle-successful-save))
       (ui/display-error (dom/getElement "status-message")
                         could-not-create-document-err))))

@@ -428,7 +438,7 @@
 (defn save-existing-document-xhr-callback [e]
   (let [xhr (.-target e)]
     (if (= (. xhr (getStatus)) 200)
-      nil ; TODO: display status message
+      (handle-successful-save)
       (ui/display-error (dom/getElement "status-message")
                         could-not-save-document-err))))

@@ -711,9 +721,6 @@
                                (.-target evt)))
                              evt))))

-(defn menu-container-el? [el]
-  (= (.-id el) "menu-container"))
-
 (defn make-menu-builder-sortable [feeds documents]
   (let [menu-container-el (dom/getElement "menu-container")]
     (ui/to-sortable-tree (dom/getElement menu-container-el)
@@ -723,20 +730,17 @@
                            documents))))

 (defn menu-item-dialog-callback [feeds documents parent-el e]
-  (if (= "ok" (.-key e))
-    (let [nested (classes/has parent-el "new-node")
-          new-link-details (menu-item-link-details-from-dialog!)
-          menu-container-el (dom/getElement "menu-container")
-          active-el (or parent-el menu-container-el)]
-      (validate-link-label! (:label new-link-details))
-      (if (classes/has (dom/getElement "add-link-status") "error")
-        (do
-          (. e (preventDefault))
-          (when-not (menu-container-el? active-el)
-            (dom/removeNode active-el)))
-        (do
-          (classes/remove parent-el "new-node")
+  (. e (preventDefault))
+
+  (let [active-el (or parent-el menu-container-el)]
+    (if (= "ok" (.-key e))
+      (let [nested (classes/has parent-el "new-node")
+            new-link-details (menu-item-link-details-from-dialog!)
+            menu-container-el (dom/getElement "menu-container")]
+        (validate-link-label! (:label new-link-details))
+        (when-not (classes/has (dom/getElement "add-link-status") "error")
           (let [dummy-el (dom/createElement "ul")]
+            (classes/remove parent-el "new-node")
             (set! (.-innerHTML dummy-el)
                   (ui/render-template-as-string tpl/menu-item-li
                                                 new-link-details))
@@ -748,11 +752,12 @@
              (get-links-from-ul menu-container-el)
              feeds
              documents)
-            (ui/remove-dialog)))))
-    (do
-      (when (classes/has parent-el "new-node")
-        (dom/removeNode parent-el))
-      (ui/remove-dialog))))
+            (ui/remove-dialog))))
+      (do
+        (when (and (not (pos? (count (util/get-children active-el))))
+                   (not (= (.-id active-el) "menu-container")))
+          (dom/removeNode active-el))
+        (ui/remove-dialog)))))

 (defn update-related-pages [related-pages]
   (when (not-empty related-pages)
@@ -1163,9 +1168,13 @@
                        (:language feed)
                        (:name feed)))))))]

-         (events/listen (dom/getElement "save-document")
-                        "click"
-                        #(validate-title-and-get-save-fn)))
+         (let [save-button-el (dom/getElement "save-document")]
+           (events/listen save-button-el
+                          "click"
+                          (fn [e]
+                            (set! (.-innerHTML save-button-el) "Saving...")
+                            (set! (.-disabled save-button-el) true)
+                            (validate-title-and-get-save-fn)))))

        (cond
         (= mode :image)


Clarify the logged message

Clarify the logged message

It looks like an exit code but it's unclear where it originated.

--- src/clj/runbld/notifications/email.clj
+++ src/clj/runbld/notifications/email.clj
@@ -111,21 +111,25 @@
   (let [rcpts (split-addr (-> opts :email :to))]
     ((opts :logger) "MAILING:" (str/join ", "
                                          (map obfuscate-addr rcpts)))
-    ((opts :logger)
-     (with-out-str
-       (clojure.pprint/pprint
-        (send* (opts :email)
-               (-> opts :email :from)
-               rcpts
-               (-> ctx :email :subject)
-               (render (-> opts :email :template-txt) ctx)
-               (when (and (-> opts :email :template-html)
-                          (not (-> opts :email :text-only)))
-                 (render (-> opts :email :template-html) ctx))
-               (concat
-                (map attach-failure (:failures ctx))
-                (when-let [a (attach-log (:id ctx) (-> ctx :log :lines))]
-                  [a]))))))))
+    (let [out (with-out-str
+                (clojure.pprint/pprint
+                 (send* (opts :email)
+                        (-> opts :email :from)
+                        rcpts
+                        (-> ctx :email :subject)
+                        (render (-> opts :email :template-txt) ctx)
+                        (when (and (-> opts :email :template-html)
+                                   (not (-> opts :email :text-only)))
+                          (render (-> opts :email :template-html) ctx))
+                        (concat
+                         (map attach-failure (:failures ctx))
+                         (when-let [a (attach-log
+                                       (:id ctx) (-> ctx :log :lines))]
+                           [a])))))
+          msg (if (.contains out "SUCCESS")
+                "Mail sent.  Output: "
+                "Mail failed to send.  Output: ")]
+      ((opts :logger) (str msg out)))))

 (s/defn make-context :- EmailCtx
   [opts build failures]


use mobile resposive layout!

use mobile resposive layout!

--- src/cljs/deliverit_dashboard/core.cljs
+++ src/cljs/deliverit_dashboard/core.cljs
@@ -1,12 +1,12 @@
 (ns deliverit-dashboard.core
   (:require [dashboard-clj.core :as d]
-            [dashboard-clj.layouts.grid-layout :as grid]
+            [dashboard-clj.layouts.grid-layout-responsive :as grid]
             [dashboard-clj.widgets.simple-text :as s]
             [dashboard-clj.widgets.github-repo-stats]
             [re-frame.core :as rf]))

-(def dashboard {:layout :grid-layout
-                :layout-opts { :rowHeight 500 :cols 6}
+(def dashboard {:layout :responsive-grid-layout
+                :layout-opts {:cols {:lg 6 :md 4 :sm 2 :xs 1 :xxs 1}}
                 :widgets [
                           {
                            :type :github-repo-stats
@@ -15,7 +15,9 @@
                            :repo-name "Dashboard (Clojure)"
                            :title "commits"
                            :text "commit history"
-                           :layout-opts {:position {:x 0 :y 0  :h 1 :w 2 }}
+                           :layout-opts {:position {:lg {:x 0 :y 0  :h 3 :w 2 :static true }
+                                                    :md {:x 0 :y 0 :h 3 :w 2}
+                                                    :sm {:x 0 :y 0 :h 3 :w 2 :static true}}}
                            :style {:background-image "linear-gradient(120deg, #b8ce9a, #08701a)"
                                    :background-color "#b8ce9a"
                                    :font-family "Times New Roman, Times, serif"
@@ -26,7 +28,9 @@
                            :data-source :onemdm-library
                            :repo-name  "One MDM"
                            :text "commit history"
-                           :layout-opts {:position {:x 2 :y 0  :h 1 :w 2 }}
+                           :layout-opts {:position {:lg {:x 2 :y 0  :h 3 :w 2 }
+                                                    :md {:x 2 :y 0 :h 3 :w 2}
+                                                    :sm {:x 0 :y 0 :h 3 :w 2 :static true}}}
                            :style {:background-image "linear-gradient(120deg, #155799, #159957)"
                                    :background-color "#ffffff"
                                    :font-family "Times New Roman, Times, serif"
@@ -37,7 +41,9 @@
                            :data-source :multunus-website
                            :repo-name  "Multunus Website"
                            :text "history"
-                           :layout-opts {:position {:x 4 :y 0  :h 1 :w 2 }}
+                           :layout-opts {:position {:lg {:x 4 :y 0  :h 3 :w 2 }
+                                                    :md {:x 0 :y 3 :h 3 :w 2}
+                                                    :sm {:x 0 :y 0 :h 3 :w 2 :static true}}}
                            :style {:background-image "linear-gradient(120deg, #f4164d, #7f1010)"
                                    :font-family "Times New Roman, Times, serif"
                                    :font-size "20"}}]})


Add unbind-sync! for unbinding synced atom paths

--- src/cljs/hacker_agent/hacker-base.cljs
+++ src/cljs/hacker_agent/hacker-base.cljs
@@ -90,6 +90,13 @@
          (recur)))
      data)))

+(defn unbind-sync!
+  [data path]
+  (let [identifier (cons data path)]
+    (when-let [close-chan (get-in @channels identifier)]
+      (put! close-chan :close))
+    (swap! data update-in path dissoc :item)))
+
 (defn init-item-sync!
   "Given vector PATH and atom DATA, create callbacks on channel
   created from item ID to update PATH in DATA.  Returns a channel that


constrain with scale, and with offset and scale

--- src/cljs/infinitelives/utils/line.cljs
+++ src/cljs/infinitelives/utils/line.cljs
@@ -443,3 +443,18 @@
   (vec2/add
    offset
    (constrain opts (vec2/sub oldpos offset) (vec2/sub newpos offset))))
+
+(defn constrain-scale [scale opts old-pos new-pos]
+  (vec2/scale (constrain opts
+                         (vec2/scale old-pos (/ 1 scale))
+                         (vec2/scale new-pos (/ 1 scale)))
+              scale))
+
+(defn constrain-offset-scale [offset scale opts old-pos new-pos]
+  (vec2/add
+   offset
+   (vec2/scale
+    (constrain opts
+               (vec2/scale (vec2/sub old-pos offset) (/ 1 scale))
+               (vec2/scale (vec2/sub new-pos offset) (/ 1 scale)))
+    scale)))


remove console print

remove console print

--- src/cljs/salava/badge/ui/settings.cljs
+++ src/cljs/salava/badge/ui/settings.cljs
@@ -297,7 +297,6 @@
                      show_evidence (if (pos? @(cursor state [:badge-settings :show_evidence])) true false)]
                  (if (and (blank? properties) (not added-by-user?))
                    (evidence/toggle-show-evidence! id data state init-data show_evidence))
-                 (prn properties)
                  (conj r
                        (when-not (blank? url)
                          [:div.panel.panel-default


Add mising function on impl/contect that is previously removed from helpers.

--- src/clojure/catacumba/impl/context.clj
+++ src/clojure/catacumba/impl/context.clj
@@ -41,9 +41,7 @@
            ratpack.registry.Registry
            java.util.Optional))

-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Types
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; --- Types

 (defrecord DefaultContext [])
 (defrecord ContextData [payload])
@@ -53,9 +51,19 @@
 (alter-meta! #'->ContextData assoc :private true)
 (alter-meta! #'map->ContextData assoc :private true)

-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Public Api
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; --- Helpers
+
+(defn- assoc-conj!
+  {:internal true :no-doc true}
+  [map key val]
+  (assoc! map key
+          (if-let [cur (get map key)]
+            (if (vector? cur)
+              (conj cur val)
+              [cur val])
+            val)))
+
+;; --- Public Api

 (defn context
   "A catacumba context constructor."
@@ -149,7 +157,7 @@
     (persistent!
      (reduce (fn [acc key]
                (let [values (.getAll params key)]
-                 (reduce #(hp/assoc-conj! %1 (keyword key) %2) acc values)))
+                 (reduce #(assoc-conj! %1 (keyword key) %2) acc values)))
              (transient {})
              (.keySet params)))))

@@ -178,7 +186,7 @@
                      key (if keywordize
                            (keyword (.toLowerCase key))
                            (.toLowerCase key))]
-                 (reduce #(hp/assoc-conj! %1 key %2) acc values)))
+                 (reduce #(assoc-conj! %1 key %2) acc values)))
              (transient {})
              (.keySet headers))))

@@ -273,12 +281,12 @@
         result (transient {})]
     (reduce (fn [acc key]
               (let [values (.getAll files key)]
-                (reduce #(hp/assoc-conj! %1 (keyword key) %2) acc values)))
+                (reduce #(assoc-conj! %1 (keyword key) %2) acc values)))
             result
             (.keySet files))
     (reduce (fn [acc key]
               (let [values (.getAll form key)]
-                (reduce #(hp/assoc-conj! %1 (keyword key) %2) acc values)))
+                (reduce #(assoc-conj! %1 (keyword key) %2) acc values)))
             result
             (.keySet form))
       (persistent! result)))


omit Asphalt-map variant from perf benchmarks as we dropped map format support

--- perf/asphalt/test/perf.clj
+++ perf/asphalt/test/perf.clj
@@ -18,7 +18,7 @@
     [asphalt.type      :as t]))

-(use-fixtures :once (c/make-bench-wrapper ["clojure.java.jdbc" "Asphalt-SQL" "Asphalt-template" "Asphalt-map"]
+(use-fixtures :once (c/make-bench-wrapper ["clojure.java.jdbc" "Asphalt-SQL" "Asphalt-template"]
                       {:chart-title "Clojure.java.jdbc vs Asphalt"
                        :chart-filename (format "bench-clj-%s.png" c/clojure-version-str)}))

@@ -50,13 +50,6 @@
 (def ^String s-delete (:sql t-delete))
 (def ^String s-select (:sql t-select))

-(def m-insert {:sql s-insert
-               :param-keys [:name :salary :dept]
-               :param-types (apply vector-of :byte (:param-types t-insert))})
-(def m-delete {:sql s-delete})
-(def m-select {:sql s-select
-               :result-types (apply vector-of :byte (:result-types t-select))})
-

 (deftest bench-insert-delete
   (testing "Insert and delete"
@@ -75,10 +68,7 @@
              (a/update conn s-delete nil))
            (do
              (a/update conn t-insert data)
-             (a/update conn t-delete nil))
-           (do
-             (a/update conn m-insert data)
-             (a/update conn m-delete nil))))))))
+             (a/update conn t-delete nil))))))))

 (deftest bench-select
@@ -94,13 +84,11 @@
           (c/compare-perf "select-row"
             (jdbc/query db-con [s-select])
             (a/query a/fetch-rows conn s-select nil)
-            (a/query a/fetch-rows conn t-select nil)
-            (a/query a/fetch-rows conn m-select nil))))
+            (a/query a/fetch-rows conn t-select nil))))
       ;; bench c.j.j `:as-arrays? true` with asphalt
       (jdbc/with-db-connection [db-con db-spec]
         (i/with-connection [conn u/orig-ds]
           (c/compare-perf "select-row-as-arrays"
             (jdbc/query db-con [s-select] {:as-arrays? true})
             (a/query a/fetch-rows conn s-select nil)
-            (a/query a/fetch-rows conn t-select nil)
-            (a/query a/fetch-rows conn m-select nil)))))))
+            (a/query a/fetch-rows conn t-select nil)))))))


Make eastwood happy.

Make eastwood happy.

--- src/open_company/resources/company.clj
+++ src/open_company/resources/company.clj
@@ -40,7 +40,7 @@
   ([company] (sections-for company (keys common/ordered-sections) (section-list company) {}))

   ; no more categories
-  ([company categories :guard empty? sections section-matches] (assoc company :sections section-matches)) ; all done
+  ([company _categories :guard empty? _sections section-matches] (assoc company :sections section-matches)) ; all done

   ; section matches per category
   ([company categories sections section-matches]


emit-seq

emit-seq

--- proto-oct/src/proto_oct/core.clj
+++ proto-oct/src/proto_oct/core.clj
@@ -75,12 +75,12 @@
 (defemit :ifndef [m]
   (if (:else m)
     (str "#ifndef " (:cond m) \newline
-         (emit-code (:then m)) \newline
+         (emit-seq (:then m)) \newline
          "#else" \newline
-         (emit-code (:else m)) \newline
+         (emit-seq (:else m)) \newline
          "#endif")
     (str "#ifndef " (:cond m) \newline
-         (emit-code (:then m)) \newline
+         (emit-seq (:then m)) \newline
          "#endif")))

 (defn typedef [name alias]


Added bayes factor to the Multiple coins example.

--- test/clojure/uncomplicate/bayadera/examples/dbda/ch09/multiple_coins_test.clj
+++ test/clojure/uncomplicate/bayadera/examples/dbda/ch09/multiple_coins_test.clj
@@ -53,8 +53,14 @@
                      post (posterior post-model)
                      post-dist-5 (post (sv N0 z0 N1 z1 2 2 5))
                      post-sampler-5 (time (doto (sampler post-dist-5) (fit!)))
+                     post-sample-5 (dataset (sample post-sampler-5))
                      post-dist-75 (post (sv N0 z0 N1 z1 2 2 75))
-                     post-sampler-75 (time (doto (sampler post-dist-75) (fit!)))]
+                     post-sampler-75 (time (doto (sampler post-dist-75) (fit!)))
+                     post-sample-75 (dataset (sample post-sampler-75))]
+
+        (println "Bayes Factor p(D|k=5)/p(D|k=75) = "
+                 (/ (evidence post-dist-5 post-sample-5)
+                    (evidence post-dist-75 post-sample-75)))

         {:prior-5 (histogram! prior-sampler-5 75)
          :prior-75 (histogram! prior-sampler-75 75)