Implement typed thing->prior-versions

Implement typed thing->prior-versions

This implementation of thing->prior-versions entirely skirts the usage
of string reading/parsing that the prior implementation relied on.
Not to say this version is perfect, it still has to manually clobber the
::t/url key since that's a silent undocumented cache used by
t/thing->name but it's far better to have this pattern matching updating
based implementation that's provably correct than some janky string
formatting shit

--- src/grimoire/api.clj
+++ src/grimoire/api.clj
@@ -12,6 +12,7 @@
             [grimoire.util :as util]
             [grimoire.either :as e]
             [detritus.variants :as v]
+            [clojure.core.match :refer [match]]
             [version-clj.core :as semver]))

 (defn dispatch
@@ -256,26 +257,55 @@

   [config thing]
   {:pre [(t/versioned? thing)
-         (not (:handle thing))]}
-  (let [thing    (t/ensure-thing thing)
-        currentv (t/thing->version thing)               ; version handle
-        current  (-> currentv :name util/normalize-version)
-        added    (-> (read-meta config thing)
-                     e/result
-                     (get :added "0.0.0")
-                     util/normalize-version)
-        unv-path (t/thing->relative-path t/version thing)
-        versions (e/result (list-versions config (:parent currentv)))]
-    (e/succeed
-     (for [v     versions
-           :when (<= 0 (semver/version-compare (:name v) added))
-           :when (>= 0 (semver/version-compare (:name v) current))]
-       ;; FIXME: this could be a direct constructor given an
-       ;; appropriate vehicle for doing so since the type is directed
-       ;; and single but may not generally make sense if this is not
-       ;; the case.
-       (t/path->thing (str (t/thing->path v) "/" unv-path))))))
-
+         (not (t/leaf? thing))]}
+  (match thing
+    ;; Case of a Version
+    ;;
+    ;; (list all the versions using the API)
+    ;;----------------------------------------
+    ([::t/version {:name n :parent artifact}] :seq)
+    ,,(list-versions config artifact)
+
+    ;; Case of a Platform or Ns
+    ;;
+    ;; (return yourself re-rooted on each of the new parents)
+    ;;----------------------------------------
+    ([(:or ::t/platform
+           ::t/namespace)
+      {:name n :parent p}] :seq)
+    ,,(let [?versions (thing->prior-versions config p)]
+        (if (e/succeed? ?versions)
+          (e/succeed
+           (for [v (e/result ?versions)]
+             (-> thing
+                 (assoc :parent v)
+                 (dissoc ::t/url))))
+          ?versions))
+
+    ;; Case of a Def
+    ;;
+    ;; (filter out only the older versions)
+    ;;----------------------------------------
+    ([::t/def {:name n :parent parent}] :seq)
+    (let [currentv  (t/thing->version thing)               ; version handle
+          current   (-> currentv :name util/normalize-version)
+          added     (-> (read-meta config thing)
+                        e/result
+                        (get :added "0.0.0")
+                        util/normalize-version)
+          ?versions (thing->prior-versions config parent)]
+      (if (e/succeed? ?versions)
+        (e/succeed
+         (for [other-p (e/result ?versions)
+               :let    [version-thing (t/thing->version other-p)
+                        version-str   (t/thing->name version-thing)]
+               :when (<= 0 (semver/version-compare version-str added))
+               :when (>= 0 (semver/version-compare version-str current))]
+           (-> thing
+               (assoc :parent other-p)
+               (dissoc ::t/url))))
+        ?versions))))
+
 (defn read-notes
   "Succeeds with a result Seq[Version, string], being the zip of list-notes with
   read-note for each listed note.


good enough ui

good enough ui

--- src/tango/cljs/runtime/core.cljs
+++ src/tango/cljs/runtime/core.cljs
@@ -770,12 +770,11 @@
                         (dom/span #js {:className "glyphicon glyphicon-edit"}))))

         (dom/div #js {:className "panel-body"}
-          ;(dom/div #js {:className "container"})
           (dom/div #js {:className "form"}
             (dom/div #js {:className "form-group"}
               (dom/label #js {:className "col-sm-2 control-label"} "Adjudicators")
               (dom/div #js {:className "col-sm-10"}
-                (map #(dom/button #js {:className "col-sm-6 btn btn-default"}
+                (map #(dom/button #js {:className "col-lg-3 col-md-4 col-xs-6 btn btn-default"}
                                   (str (:adjudicator/number %) " - " (:adjudicator/name %)))
                      (sort-by :adjudicator/number adjudicators))))))))))

@@ -785,7 +784,8 @@
     (dom/div #js {:className "container-fluid"}
       (dom/h2 {:className "sub-header"} "Adjudicator Panels")
       (apply dom/div nil
-             (map #((om/factory AdjudicatorPanelsRow {:keyfn :adjudicator-panel/id}) %) panels)))))
+             (map #((om/factory AdjudicatorPanelsRow {:keyfn :adjudicator-panel/id}) %)
+                  (sort-by :adjudicator-panel/name panels))))))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; MainComponent


Remove unnecessary threading

Remove unnecessary threading

--- template/src/leiningen/new/play_clj.clj
+++ template/src/leiningen/new/play_clj.clj
@@ -83,25 +83,25 @@
                 (lein-droid-render "SplashActivity.java" data)]
                ; android libgdx.so
                ["android/libs/armeabi/libgdx.so"
-                (-> (io/resource "armeabi/libgdx.so") io/input-stream)]
+                (io/input-stream (io/resource "armeabi/libgdx.so"))]
                ["android/libs/armeabi-v7a/libgdx.so"
-                (-> (io/resource "armeabi-v7a/libgdx.so") io/input-stream)]
+                (io/input-stream (io/resource "armeabi-v7a/libgdx.so"))]
                ["android/libs/x86/libgdx.so"
-                (-> (io/resource "x86/libgdx.so") io/input-stream)]
+                (io/input-stream (io/resource "x86/libgdx.so"))]
                ; android libgdx-box2d.so
                ["android/libs/armeabi/libgdx-box2d.so"
-                (-> (io/resource "armeabi/libgdx-box2d.so") io/input-stream)]
+                (io/input-stream (io/resource "armeabi/libgdx-box2d.so"))]
                ["android/libs/armeabi-v7a/libgdx-box2d.so"
-                (-> (io/resource "armeabi-v7a/libgdx-box2d.so") io/input-stream)]
+                (io/input-stream (io/resource "armeabi-v7a/libgdx-box2d.so"))]
                ["android/libs/x86/libgdx-box2d.so"
-                (-> (io/resource "x86/libgdx-box2d.so") io/input-stream)]
+                (io/input-stream (io/resource "x86/libgdx-box2d.so"))]
                ; android libgdx-bullet.so
                ["android/libs/armeabi/libgdx-bullet.so"
-                (-> (io/resource "armeabi/libgdx-bullet.so") io/input-stream)]
+                (io/input-stream (io/resource "armeabi/libgdx-bullet.so"))]
                ["android/libs/armeabi-v7a/libgdx-bullet.so"
-                (-> (io/resource "armeabi-v7a/libgdx-bullet.so") io/input-stream)]
+                (io/input-stream (io/resource "armeabi-v7a/libgdx-bullet.so"))]
                ["android/libs/x86/libgdx-bullet.so"
-                (-> (io/resource "x86/libgdx-bullet.so") io/input-stream)]
+                (io/input-stream (io/resource "x86/libgdx-bullet.so"))]
                ; ios
                ["ios/project.clj" (render "ios-project.clj" data)]
                ["ios/Info.plist.xml" (render "Info.plist.xml" data)]
@@ -110,12 +110,12 @@
                 (render "IOSLauncher.java" data)]
                ; ios libObjectAL.a and libgdx.a
                ["ios/libs/libObjectAL.a"
-                (-> (io/resource "ios/libObjectAL.a") io/input-stream)]
+                (io/input-stream (io/resource "ios/libObjectAL.a"))]
                ["ios/libs/libgdx.a"
-                (-> (io/resource "ios/libgdx.a") io/input-stream)]
+                (io/input-stream (io/resource "ios/libgdx.a"))]
                ; ios libgdx-box2d.a
                ["ios/libs/libgdx-box2d.a"
-                (-> (io/resource "ios/libgdx-box2d.a") io/input-stream)]
+                (io/input-stream (io/resource "ios/libgdx-box2d.a"))]
                ; ios libgdx-bullet.a
                ["ios/libs/libgdx-bullet.a"
-                (-> (io/resource "ios/libgdx-bullet.a") io/input-stream)])))
+                (io/input-stream (io/resource "ios/libgdx-bullet.a"))])))


added a test "listening on port 80".

added a test "listening on port 80".

--- integration/org/domaindrivenarchitecture/pallet/serverstate/run_on_pallet_node.clj
+++ integration/org/domaindrivenarchitecture/pallet/serverstate/run_on_pallet_node.clj
@@ -47,10 +47,10 @@
   (println "Testing if user pallet exists.")
   (= 1 (count (filter #(= (first %) "pallet") user-list))))

-(defn test-palletport-listening
+(defn test-pallet-listening-on-port-80
   "Tests if ports are listened."
-  [port-list]
-  (= 1 (count (filter #(= (first %) "pallet") user-list))))
+  [netstat-output-from-resource]
+  (= 1 (count (filter #(= (first %) "80") user-list))))

 (defmethod dda-crate/dda-test facility [dda-crate config]


added atomic

added atomic

--- src/karras/sugar.clj
+++ src/karras/sugar.clj
@@ -93,6 +93,8 @@
     {:$addToSet {field {:$each (cons value values)}}}
     {:$addToSet {field value}}))

+(def atomic {:$atomic true})
+
 (defn matched "" [array-name & [field]]
   (str (name array-name) ".$" (when field (str "." (name field)))))


Addressed review comments.

Addressed review comments.

--- umm-spec-lib/src/cmr/umm_spec/umm_to_xml_mappings/iso19115_2.clj
+++ umm-spec-lib/src/cmr/umm_spec/umm_to_xml_mappings/iso19115_2.clj
@@ -132,8 +132,6 @@
       [:gmi:type
        (char-string (:Technique instrument))]
       [:gmi:description {:gco:nilReason "missing"}]
-      ;; TODO this:
-      ;; [:gmi:mountedOn {:xlink:href (unique-id-ref-from "..")}]
       [:eos:otherPropertyType
        [:gco:RecordType {:xlink:href "http://earthdata.nasa.gov/metadata/schema/eos/1.0/eos.xsd#xpointer(//element[@name='AdditionalAttributes'])"}
         "Echo Additional Attributes"]]
@@ -145,7 +143,7 @@
   [platforms]
   (for [platform platforms]
     [:gmi:platform
-     [:eos:EOS_Platform ;; TODO {:id unique-id}
+     [:eos:EOS_Platform
       [:gmi:identifier
        [:gmd:MD_Identifier
         [:gmd:code


Update client.cljs

Update client.cljs

--- src/meta/client.cljs
+++ src/meta/client.cljs
@@ -2,54 +2,58 @@
   (:refer-clojure :exclude [find get update remove])
   (:require ["socket.io-client" :as io]
             ["jquery" :as jquery]
-            ["@feathersjs/client" :as client]
             [goog.object :as obj]
-            [feathers.client :as feathers]
-            [feathers.client.services :as svc]
-            [meta.promise :as prom]))
+            [feathers.client :as client]
+            [feathers.client.services :as svc]))

 ;; Feathers Client ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (def app client)

 (defn with-jquery [app uri]
-  (feathers/jquery app uri (jquery)))
+  (client/jquery app uri (jquery)))

 (defn with-socketio [app & [uri opts]]
-  (feathers/socketio app (io uri opts)))
+  (client/socketio app (io uri opts)))

 (defn with-authentication
   ([app]
    (with-authentication app (obj/get js/window "localStorage")))
   ([app storage]
-   (feathers/authentication app #js{:storage storage})))
+   (client/authentication app #js{:storage storage})))
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 ;; Client Auth API ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (defn login! [app strategy & [opts]]
-  (feathers/authenticate app
+  (client/authenticate app
     (clj->js (merge opts {:strategy strategy}))))

 (defn logout! [app]
-  (feathers/logout app))
+  (client/logout app))

 (defn auth! [app]
-  (feathers/reauthenticate app))
+  (client/reauthenticate app))
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 ;; Client Service API ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-(def service feathers/service)
+(def service client/service)

-(def find    svc/find)
+(defn find [service & [params]]
+  (client/find service (clj->js params)))

-(def get     svc/get)
+(defn get [service id & [params]]
+  (client/get service id (clj->js params)))

-(def create  svc/create)
+(defn create [service data & [params]]
+  (client/create service (clj->js data) (clj->js params)))

-(def update  svc/update)
+(defn update [service id data & [params]]
+  (client/update service id (clj->js data) (clj->js params)))

-(def patch   svc/patch)
+(defn patch [service id data & [params]]
+  (client/patch service id (clj->js data) (clj->js params)))

-(def remove  svc/remove)
+(defn remove [service id & [params]]
+  (client/remove service id (clj->js params)))
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 ;; Client Event API ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


identicons instead of monsters

identicons instead of monsters

--- src/ontrail/user.clj
+++ src/ontrail/user.clj
@@ -12,7 +12,7 @@
         email (.toLowerCase (get user :email))
         gravatar-md5-hash (md5 email)]
     (if gravatar?
-      (str "http://www.gravatar.com/avatar/" gravatar-md5-hash "?d=monsterid")
+      (str "http://www.gravatar.com/avatar/" gravatar-md5-hash "?d=identicon&r=x")
       "/img/default-avatar.png")))

 (defn as-user [user]


Remove doubled up case of onyx.peer.metrics/lifecycles schema.

--- src/onyx/schema.cljc
+++ src/onyx/schema.cljc
@@ -665,7 +665,6 @@
    (s/optional-key :onyx.peer/subscriber-liveness-timeout-ms) PosInt
    (s/optional-key :onyx.peer.metrics/lifecycles) [LifecycleState]
    (s/optional-key :onyx.peer/storage) Storage
-   (s/optional-key :onyx.peer.metrics/lifecycles) [s/Keyword]
    (s/optional-key :onyx.peer/storage.timeout) s/Int
    (s/optional-key :onyx.peer/storage.s3.auth-type) (s/enum :provider-chain :config)
    (s/optional-key :onyx.peer/storage.s3.auth.access-key) s/Str


Set up for 16x tx from ora-test-1/argus_mart -> pg-test-1/argus_mart

--- src/pg_demo/core.clj
+++ src/pg_demo/core.clj
@@ -15,7 +15,7 @@

 (def tx-chunk-size      10000)
 (def pg-threadpool
-  (cp/threadpool        4))
+  (cp/threadpool        16))
 (def src-is-oracle      false)
 (def dest-is-oracle     false)
 (def large-db           false)


Small tweak to rererender conditions for much lower idle overhead

--- src/player/core.cljs
+++ src/player/core.cljs
@@ -673,9 +673,10 @@

 (defn rererender [target]
   (let [w @world]
+    ; slightly weird checks here instead of equality to improve idle performance/overhead
     (when (or (not= (:entry-time (current-config w))
                     (:entry-time (current-config last-world)))
-              (not= @world last-world))
+              (not= (dissoc @world :seen-configs :configs) (dissoc last-world :seen-configs :configs)))
       (set! last-world @world)
       (js/React.render (world-widget world nil) target)))
   (.requestAnimationFrame js/window #(rererender target)))


fix method name in event handler impl

fix method name in event handler impl

--- src/preflex/task.clj
+++ src/preflex/task.clj
@@ -34,21 +34,24 @@
 (defn make-event-handler
   "Make a preflex.instrument.EventHandler instance from given options:
   :before    (fn [])
-  :on-return (fn [] [result])
+  :on-return (fn [])
+  :on-result (fn [result])
   :on-throw  (fn [thrown])
   :after     (fn [])"
   [{:keys [before
            on-return
+           on-result
            on-throw
            after]
     :or {before    i/nop
          on-return i/nop
+         on-result i/nop
          on-throw  i/nop
          after     i/nop}}]
   (reify EventHandler
     (before   [_]        (before))
     (onReturn [_]        (on-return))
-    (onReturn [_ result] (on-return result))
+    (onResult [_ result] (on-result result))
     (onThrow  [_ thrown] (on-throw thrown))
     (after    [_]        (after))))


correct use of list? to account for lazy seqs

--- src/re_frame/fx.cljs
+++ src/re_frame/fx.cljs
@@ -41,8 +41,8 @@
   "There are cases where eitherone event is to be dipatch "
   [effect]
   (cond
-    (list? effect)   (dorun (map dispatch effect))
     (vector? effect) (dispatch effect)
+    (seq? effect)    (dorun (map dispatch effect))
     :else (console :error "re-frame: expected :dispatch effect to be a list or vector, but got: " effect)))

 ;; Example:
@@ -88,14 +88,14 @@
     (fn [val]
       (cond
         (map? val) (process-one-entry val)
-        (list? val) (doall (map process-one-entry val)))     ;; XXX add else
+        (seq? val) (doall (map process-one-entry val)))     ;; XXX add else
       )))

 (register
   :deregister-event-handler
   (fn [val]
-    (if (list? val)
+    (if (sequential? val)
       (doall (map re-frame.events/clear-handler! val))
       (re-frame.events/clear-handler! val))))


Do not record events if *results* is nil. (#974)

--- src/riemann/test.clj
+++ src/riemann/test.clj
@@ -36,9 +36,9 @@
   [name child]
   (fn stream [event]
     ; Record event
-    (-> *results*
-        (get name)
-        (swap! conj event))
+    (some-> *results*
+            (get name)
+            (swap! conj event))

     ; Forward downstream
     (child event)))


fixed download request bug

fixed download request bug

--- src/server/core.cljs
+++ src/server/core.cljs
@@ -35,6 +35,7 @@
       (println "New file request!")
       (.incr rooms/redis-client (str "file-request:" (.-id socket))
         (fn [err reply]
+          (println (.toString reply))
           (.publish redis-publish-client "file-download-request" (.-id socket))))))
   (.on socket "disconnect" (fn []
     (.get rooms/redis-client (string/join ["users:" (.-id socket)])
@@ -84,15 +85,16 @@
         (fn [err reply]
           (.get rooms/redis-client (str "file-request:" message)
             (fn [err r]
-              (.lindex rooms/redis-client (str (.toString reply) ":music") (- 1 (.toString r))
+              (.lindex rooms/redis-client (str (.toString reply) ":music") (- (.toString r) 1)
                 (fn [err reply]
-                  (let [client-id message
-                        client-socket (aget (.-connected (.-sockets io)) client-id)
-                        stream (.createStream socketio-stream)
-                        absolute-file-path (.toString reply)
-                        read-stream (.createReadStream fs absolute-file-path)]
-                    (.emit (socketio-stream client-socket) "file-to-client" stream)
-                    (.pipe read-stream stream)))))))))))
+                  (if-not (nil? reply)
+                    (let [client-id message
+                          client-socket (aget (.-connected (.-sockets io)) client-id)
+                          stream (.createStream socketio-stream)
+                          absolute-file-path (.toString reply)
+                          read-stream (.createReadStream fs absolute-file-path)]
+                      (.emit (socketio-stream client-socket) "file-to-client" stream)
+                      (.pipe read-stream stream))))))))))))

 ; TODO: probably dont even need this subscription anymore...
 (.subscribe redis-subscribe-client "file-upload")


Added function for updating a user's intercom attributes

--- src/polismath/intercom.clj
+++ src/polismath/intercom.clj
@@ -11,6 +11,12 @@
             [polismath.poller :as poll]))

+(def intercom-http-params
+  {:accept :json
+   :basic-auth ["nb5hla8s" (env/env :intercom-api-key)]
+   :content-type :json})
+
+
 (defn get-intercom-users
   "Get the list of users from intercom (don't want to create intercom users for users that haven't
   actually signed up"
@@ -18,9 +24,7 @@
   (let [return-data
           (->
             (or page "https://api.intercom.io/users")
-            (client/get
-              {:accept :json
-               :basic-auth ["nb5hla8s" (env/env :intercom-api-key)]})
+            (client/get intercom-http-params)
             :body
             (ch/parse-string)
             (->>
@@ -80,6 +84,15 @@
       (ko/where {:email [in emails]}))))

+(defn update-intercom-user
+  [params]
+  (->>
+    params
+    (ch/generate-string)
+    (assoc intercom-http-params :body)
+    (client/post "https://api.intercom.io/users")))
+
+
 (defn -main
   []
   (let [db-spec      (poll/heroku-db-spec (env/env :database-url))


Removed redundant imports

Removed redundant imports

--- src/stravinski/streamer.clj
+++ src/stravinski/streamer.clj
@@ -2,17 +2,14 @@
   (:use
    [twitter.oauth]
    [twitter.callbacks]
-   [twitter.api.restful]
    [twitter.callbacks.handlers]
    [twitter.api.streaming]
    [clojure.java.io :as io])
   (:require
    [cheshire.core]
    [clojure.string]
-   [clojure.data.json :as json]
    [http.async.client :as ac])
   (:import
-   (java.io OutputStream)
    (java.util Properties)
    (twitter.callbacks.protocols AsyncStreamingCallback)))

@@ -59,7 +56,7 @@
 (defn response-success-process [payload]
   (send stream-processor-agent conj (str payload)))

-(defn watcher-fn [w key agent-ref old-state new-state]
+(defn watcher-fn [f key agent-ref old-state new-state]
   (let [matcher-fn (fn [el] (re-find (re-matcher #"\r\n" el)))]
     (if (not (nil? (matcher-fn (str (last new-state)))))
       (try
@@ -67,29 +64,22 @@
         (let [json-str (cheshire.core/parse-string (clojure.string/join new-state) true)]
           (if (and (:text json-str )
                    ( not (:delete json-str) ))
-            (.write w (clojure.string/join new-state);; (:text json-str)
-                    )))
+            (f json-str)))
         (catch Exception e (str "Exception:" (.getMessage e)))))))

 (defn attach-stream []
   (let [resp-promise (promise)
-        w (writer "map.txt")
         cb (AsyncStreamingCallback.
             (fn [_resp payload]
-              (send stream-processor-agent conj (str payload))
-              )
-            (fn [_resp]
-              (.close w)
-              )
-            (fn [_resp ex]
-              (.close w)
-              (.printStackTrace ex)))]
+              (send stream-processor-agent conj (str payload)))
+            (fn [_resp])
+            (fn [_resp ex] (.printStackTrace ex)))]

     (if (agent-error stream-processor-agent)
       (restart-agent stream-processor-agent (create-empty-queue)))

     (agent-watch stream-processor-agent
-                 (partial watcher-fn w)
+                 (partial watcher-fn #((.write *out* (str  %))))
                  :processor)
     (statuses-sample
      ;; :params {:track "storm,bad weather,good weather,rain,sun,sunny,snow,freezing"}


finds pinged and trend not installed machines

--- src/trend_compliance/core.clj
+++ src/trend_compliance/core.clj
@@ -4,18 +4,27 @@
             [clojure.string :as str])
   (:gen-class))

+(defn trend-installed?
+  "check to see if the device has trend"
+  [item]
+  (if (re-matches #"(?i)not installed" (get item :off-scan-status)) true false))
+
+(defn ping-successful?
+  "check to see if the device ping was successful"
+  [item]
+  (if (re-matches #".*(?i)ping successful" (get item :ping)) true false))
+
 (defn windows?
   "check to see if the device is windows os"
   [item]
   (if (re-matches #"(?i)windows*" (get item :platform)) true false))
-    ;; (when (re-matches #"(?i)windows*" (get item :platform))))
-      ;; {:windows-os true
-      ;;  :item item}))

-(defn create-windows-list
-  "create a list of windows machines with corresponding attributes"
-  [windows-map]
-  (filter windows? windows-map))
+(defn create-final-list
+  "create a list of windows machines with successful ping"
+  [item]
+  (let [windows-machines (filter windows? item)
+        ping-successful-list (filter ping-successful? windows-machines)]
+  (filter trend-installed? ping-successful-list)))

 (defn create-data-map
   "parse the list of lists returned from read-csv"
@@ -51,6 +60,4 @@
     (let [file-name (read-line)
           csv-data (read-csv file-name)
           data-map (map create-data-map csv-data)]
-          ;; windows-map (map windows? data-map)
-          ;; win-list '()]
-          (create-windows-list data-map)))
+    (create-final-list data-map)))


Switched metadata file extension to .json

--- src/video_server/metadata.clj
+++ src/video_server/metadata.clj
@@ -44,7 +44,7 @@
 (defn- metadata-file
   "Returns the File for the video metadata."
   [folder video]
-  (io/file (:file folder) (str (:title video) ".info")))
+  (io/file (:file folder) (str (:title video) ".json")))

 (defn read-metadata
   "Reads the stored metadata for the video."


fixed specification and behavior to accept symbols for strings

--- src/untangled_spec/core.clj
+++ src/untangled_spec/core.clj
@@ -31,7 +31,7 @@

 (s/def ::specification
   (s/cat
-    :name string?
+    :name (s/or :string string? :symbol symbol?)
     :opts (s/* keyword?)
     :body (s/* ::us/any)))


Download sources jar for dependencies

Download sources jar for dependencies

--- ccw.core/src/clj/ccw/leiningen/classpath_container.clj
+++ ccw.core/src/clj/ccw/leiningen/classpath_container.clj
@@ -68,8 +68,8 @@

 (defn- library-entry
   "Wrapper for the ccw.leiningen.util/library-entry function"
-  [{:keys [path native-path]}]
-  (let [params {:path path}
+  [{:keys [path native-path source-attachment-path]}]
+  (let [params {:path path :source-attachment-path source-attachment-path}
         params (if native-path
                      (update-in params [:extra-attributes]
                                 assoc jdt/native-library (jdt/native-library-path native-path))
@@ -82,6 +82,44 @@
   [project-dependencies]
   (let [entry-list (map library-entry project-dependencies)]
     (make-leiningen-classpath-container entry-list)))
+
+;; copied from ubersource
+(defn- find-transitive-deps
+  [deps repositories]
+  (->> (aether/resolve-dependencies
+        :coordinates deps
+        :repositories repositories)
+      keys
+      set))
+
+;; copied from ubersource
+(defn- resolve-artifact
+  [dep repositories]
+  (->> (find-transitive-deps [dep] repositories)
+      (filter #(= % dep))
+      first))
+
+;; copied from ubersource
+(defn- try-resolve-sources-artifact!
+  [dep repositories]
+  (try
+    (resolve-artifact (concat dep [:classifier "sources"]) repositories)
+    (catch DependencyResolutionException ex
+      nil)))
+
+(defn- artifacts-entry
+  [dep repositories]
+  (let [main (resolve-artifact dep repositories)
+        source (try-resolve-sources-artifact! dep repositories)]
+    (if source [(-> main meta :file)
+                (-> source meta :file)]
+               nil)))
+
+(defn get-source-map
+  "I don't do a lot."
+  [{:keys [repositories dependencies] :as project} & args]
+  (let [dep (find-transitive-deps dependencies repositories)]
+    (into {} (remove nil? (map #(artifacts-entry % repositories) dep)))))

 (defn resolve-dependencies
   "ADAPTED FROM LEININGEN-CORE resolve-dependencies.
@@ -108,22 +146,27 @@
                  (map #(.getAbsolutePath %) ~'dependencies))))]
     (map #(File. ^String %) deps-paths)))

-(defn ser-dep [path native-path]
-  {:path (.getAbsolutePath (io/as-file path))
-   :native-path (.getAbsolutePath (io/as-file native-path))})
+(defn ser-dep [path native-path source-attachment-path]
+  (let [s {:path (.getAbsolutePath (io/as-file path))
+           :native-path (.getAbsolutePath (io/as-file native-path))}]
+    (if source-attachment-path
+      (assoc s :source-attachment-path (.getAbsolutePath (io/as-file source-attachment-path)))
+      s)))

 (defn get-project-dependencies
   "Return the dependencies sorted alphabetically via their file name.
    Throws Aether exceptions if a problem occured"
   [project-name lein-project]
   (let [dependencies (resolve-dependencies project-name :dependencies lein-project)
-        default-native-platform-path (u/lein-native-platform-path lein-project)]
+        default-native-platform-path (u/lein-native-platform-path lein-project)
+        srcmap (get-source-map lein-project)]
     ;(println "default-native-platform-path:" default-native-platform-path)
     (->> dependencies
       (filter #(re-find #"\.(jar|zip)$" (.getName ^File %)))
       (sort-by #(.getName ^File %))
       (map #(ser-dep %
                      default-native-platform-path
+                     (get srcmap %)
                      #_(or #_(u/lein-native-dependency-path lein-project %) ;; TODO make this work :-(
                          default-native-platform-path))))))

@@ -174,7 +217,8 @@
 (defn deser-dep [dep-map]
   (-> dep-map
     (update-in [:path] #(File. ^String %))
-    (update-in [:native-path] #(File. ^String %))))
+    (update-in [:native-path] #(File. ^String %))
+    (update-in [:source-attachment-path] #(when % (File. ^String %)))))

 (defn load-project-dependencies
   "Retrieve from disk (from the Plugin state directory), the deps for the project.


resolved conflicts with the parent repository for pull request compatibility

--- storm-core/src/clj/backtype/storm/daemon/supervisor.clj
+++ storm-core/src/clj/backtype/storm/daemon/supervisor.clj
@@ -507,12 +507,11 @@
                                                  (:my-hostname supervisor)
                                                  (:assignment-id supervisor)
                                                  (keys @(:curr-assignment supervisor))
-                                                 ;; used ports
+                                                  ;; used ports
                                                  (.getMetadata isupervisor)
                                                  (conf SUPERVISOR-SCHEDULER-META)
                                                  ((:uptime supervisor))
-						 ((:version supervisor))))]
-
+                                                 (:version supervisor))))]
     (heartbeat-fn)

     ;; should synchronize supervisor so it doesn't launch anything after being down (optimization)


Equality rule changes in Clojure 1.3 for floating point number comparisons.

--- examples/one_bar_sequencer.clj
+++ examples/one_bar_sequencer.clj
@@ -25,7 +25,7 @@
     (for [k (keys bar)]
       (let [beat (Math/floor k)
             offset (- k beat)]
-           (if (= 0 (mod (- tick beat) 4))
+           (if (== 0 (mod (- tick beat) 4))
                (let [instruments (bar k)]
                     (dorun
                       (for [instrument instruments]


refactor to use  .. interop macro

refactor to use  .. interop macro

--- examples/src/famous_examples/core.cljs
+++ examples/src/famous_examples/core.cljs
@@ -6,18 +6,18 @@

 ;; translated from https://github.com/Famous/global-seed/blob/master/src/main.js

-(defonce ImageSurface (.-ImageSurface (.-surfaces js/famous)))
-(defonce Modifier     (.-Modifier(.-core js/famous)))
-(defonce Transform    (.-Transform (.-core js/famous)))
+(defonce ImageSurface (.. js/famous -surfaces -ImageSurface))
+(defonce Modifier     (.. js/famous -core -Modifier))
+(defonce Transform    (.. js/famous -core -Transform))

 (defonce logo
   (ImageSurface.
     (clj->js {"size" [200,200]
-              "content" "http://code.famo.us/assets/famous_logo.png"
+              "content" "https://pbs.twimg.com/profile_images/559761425766158336/Uq5W8iWA.jpeg"
               "classes" ["double-sided"]})))

-(defonce initialTime (.now js/Date))
+(defonce initialTime (.. js/Date now))

 (defonce center-spin-modifier
@@ -27,6 +27,7 @@
              "transform" (fn[] (.rotateY Transform (* .002 (- (.now js/Date) initialTime))))})))

-(let [Engine         (.-Engine (.-core js/famous))
-      mainContext    (.createContext Engine)]
-  (.add (.add mainContext center-spin-modifier) logo))
+(let [Engine         (.. js/famous -core -Engine)
+      mainContext    (.. Engine createContext)]
+  (.. mainContext (add center-spin-modifier) (add logo)))
+


Add createbookmarks post method

Add createbookmarks post method

--- src_cljs/bookmarks/corecljs.cljs
+++ src_cljs/bookmarks/corecljs.cljs
@@ -5,13 +5,17 @@
             [goog.net.XhrIo :as xhr]
             [reagent.core :as r]
             [bookmarks.helpers :as he]
-            [bookmarks.createbookmarks :as cb])
-  (:import goog.History))
+            [bookmarks.createbookmarks :as cb]
+            [cognitect.transit :as t]
+            [goog.structs :as structs])
+  (:import goog.History)
+  )

 (defn url-format [url title]
   [:a {:href url :class "btn btn-primary"} title])

+(def w (t/writer :json-verbose))

 (defn getdata [res]
   (.getResponseJson (.-target res)))
@@ -19,6 +23,14 @@
 (defn http-get [url callback]
   (xhr/send url callback))

+(defn http-post [url callback data]
+  (xhr/send url callback "POST" data  (structs/Map. (clj->js {:Content-Type "application/json"}))))
+
+(defn auto-complete
+  [name  data]
+  (when-not (empty? name)
+    (let [pattern (js/RegExp. (str ".* " name ".*|" name ".*") "i")]
+      (not-empty (set (keep #(re-matches pattern %) data))))))

 (defn search [event]
   (let [stext (.-value (.getElementById js/document "sText"))
@@ -37,7 +49,8 @@
      [:div.col-sm-2 [:input.form-control {:id "sText" :type "text"
                                           :placeholder "search by title"}]]
      [:input {:type "button" :value "Search"
-              :class "btn btn-primary" :on-click search}]]]
+              :class "btn btn-primary" :on-click search}]
+     (url-format "http://localhost:8090/#/bookmark" "Add")]]
    [:table {:class "table table-striped table-bordered"}
     [:thead
      [:tr
@@ -51,6 +64,53 @@
         [:td (he/url-format (.-url bm) (.-title bm))]
         [:td (.-description bm)]])]]])

+(defn row [label input]
+  [:div.row
+   [:div.col-md-2 [:label label]]
+   [:div.col-md-5 input]])
+(defn radio [label name value]
+  [:div.radio
+   [:label
+    [:input {:field :radio :name name :value value}]
+    label]])
+
+(defn input [label type id]
+  (row label [:input.form-control {:type type :id id}]))
+
+
+(defn bookmark-template []
+  [:div.form-group
+   [:div (input "Title" "text" "title")]
+   [:div  (input "URL" "text" "url")]
+   [:div (input "Tags" "text" "tags")]
+   [:div  (input "Description" "textarea" "desc")]])
+
+(defn getinputvalue[id]
+(.-value (.getElementById js/document id)))
+
+(defn get-bookmark-formdata []
+  { :title (getinputvalue "title")
+    :url (getinputvalue "url")
+    :description (getinputvalue "desc")})
+
+
+
+(defn save [event]
+  (let [onres (fn[data] (set! (.-location js/window) "http://localhost:8090"))]
+    (http-post "http://localhost:8090/bookmark"
+               onres  (JSON/stringify (clj->js (get-bookmark-formdata))))))
+
+(defn page [body]
+  (fn []
+    [:div
+     [:div.padding]
+     [:div.page-header [:h1 "Book Marks"]]
+     [bookmark-template]
+     [:input {:type "button" :value "Save"
+              :class "btn btn-primary" :on-click save}]
+     [:div.padding]
+     [:div.page-footer [:h6 "Copyright ©2015 A TechnoIdentity Creations — All Rights Reserved."]]
+     ]))

 (defroute home-path "/" []
   (let [onres (fn [json]
@@ -58,11 +118,11 @@
                           (.-body js/document)))]
     (http-get "http://localhost:8090/bookmarks" onres)))

-(defroute bookmark-path "/addbookmark" []
-  (r/render [cb/page](.-body js/document)))
+(defroute bookmark-path "/bookmark" []
+  (r/render [page](.-body js/document)))

 (defroute "*" []
-  (js/alert "
Not Found
"))
+  (js/alert "
Not Found Page
"))

 (defn main


Add gaussian fitting

Add gaussian fitting

--- src/clj/clojurewerkz/statistiker/fitting.clj
+++ src/clj/clojurewerkz/statistiker/fitting.clj
@@ -13,3 +13,19 @@
 (defn gaussian-function
   [norm mean sigma]
   (Gaussian. norm mean sigma))
+
+(defn fit
+  "Extract x and y from dataset, and compose an approximated, fitted dataset from interpolated points, taking
+   `steps` points."
+  [dss x y steps]
+  (let [prepared          (map (fn [i] [(get i x)
+                                       (get i y)]) dss)
+        min-x             (reduce min (map (fn [i] (get i x)) dss))
+        max-x             (reduce max (map (fn [i] (get i x)) dss))
+        step              (/ (- max-x min-x) steps)
+        [norm mean sigma] (gaussian-fitting prepared)
+        f                 (gaussian-function norm mean sigma)]
+    (mapv
+     (fn [x-val]
+       {x x-val y (.value f (double x-val))})
+     (take steps (iterate #(+ % step) min-x)))))


Move button creation into a separate function

--- src/cljs/mdr2/productions/in_production.cljs
+++ src/cljs/mdr2/productions/in_production.cljs
@@ -181,29 +181,34 @@
         [:span.icon {:aria-hidden true}
          [:i.material-icons "upload_file"]]]]]]))

+(defn- tooltip-button [{:keys [tooltip icon] :as opts}]
+  [:a.button.has-tooltip-arrow
+   (merge
+    {:data-tooltip (tr [tooltip])
+     :aria-label (tr [tooltip])}
+    (dissoc opts :tooltip :icon))
+   [:span.icon.is-small {:aria-hidden true}
+    [:i.material-icons icon]]])
+
 (defn buttons [{:keys [uuid id state] :as production}]
   (let [roles @(rf/subscribe [::auth/user-roles])]
     [:div.buttons.has-addons
      ;; show the download button while the production hasn't been recorded
      (when (#{"new" "structured"} state)
-       [:a.button.has-tooltip-arrow
+       (tooltip-button
         {:href (str "/api/productions/" id "/xml")
          :download (str id ".xml")
-         :data-tooltip (tr [:download-structure])
-         :aria-label (tr [:download-structure])}
-        [:span.icon.is-small {:aria-hidden true}
-         [:i.material-icons "file_download"]]])
+         :tooltip :download-structure
+         :icon "file_download"}))
      ;; show the upload button if the production hasn't been recorded
      ;; and the user is authorized
      (when (and (seq (set/intersection #{:it :etext} roles))
                 (#{"new" "structured"} state))
-       [:a.button.has-tooltip-arrow
+       (tooltip-button
         {:href (str "#/productions/" id "/upload")
          :on-click (fn [e] (rf/dispatch [::production/set-current production]))
-         :data-tooltip (tr [:upload-structure])
-         :aria-label (tr [:upload-structure])}
-        [:span.icon.is-small {:aria-hidden true}
-         [:i.material-icons "file_upload"]]])
+         :tooltip :upload-structure
+         :icon "file_upload"}))
      ;; show the "Recorded" button if the next state is "recorded",
      ;; the user is authorized, and the production has been imported
      ;; from the libary, i.e. is not handled via ABACUS or the
@@ -214,33 +219,28 @@
                 (or (:library_number production) (> (:revision production) 0)))
        (if @(rf/subscribe [::notifications/button-loading? uuid :recorded])
          [:button.button.is-loading]
-         [:button.button.has-tooltip-arrow
+         (tooltip-button
           {:on-click (fn [e] (rf/dispatch [::recorded-production uuid]))
-           :data-tooltip (tr [:mark-recorded])
-           :aria-label (tr [:mark-recorded])}
-          [:span.icon.is-small {:aria-hidden true}
-           [:i.material-icons "check_circle"]]]))
+           :tooltip :mark-recorded
+           :icon "check_circle"})))
      ;; show the "Split" button if the next state is "split" and the user is
      ;; authorized
      (when (and (seq (set/intersection #{:it :admin} roles))
                 (#{"pending-split"} state))
          (if @(rf/subscribe [::notifications/button-loading? uuid :split])
            [:button.button.is-loading]
-           [:button.button.has-tooltip-arrow
+           (tooltip-button
             {:on-click (fn [e] (rf/dispatch [::split-production uuid]))
-           :data-tooltip (tr [:split])
-           :aria-label (tr [:split])}
-            [:span.icon.is-small {:aria-hidden true}
-             [:i.material-icons "call_split"]]]))
+             :tooltip :mark-split
+             :icon "call_split"})))
      (when (seq (set/intersection #{:it} roles))
        (if @(rf/subscribe [::notifications/button-loading? uuid :delete])
          [:button.button.is-danger.is-loading]
-         [:button.button.is-danger.has-tooltip-arrow
+         (tooltip-button
           {:on-click (fn [e] (rf/dispatch [::delete-production uuid]))
-           :data-tooltip (tr [:delete])
-           :aria-label (tr [:delete])}
-          [:span.icon.is-small {:aria-hidden true}
-           [:i.material-icons "delete"]]]))]))
+           :class "is-danger"
+           :tooltip :delete
+           :icon "delete"})))]))

 (defn production-link [{:keys [id title] :as production}]
   [:a {:href (str "#/productions/" id)


Remove commented out code

Remove commented out code

--- src/cljs/my_money/app/controller/config.cljs
+++ src/cljs/my_money/app/controller/config.cljs
@@ -22,21 +22,7 @@
                 :params           (if starting-amount-changed?
                                     config
                                     (dissoc config :starting-amount))
-                :on-error         c/->ErrorHandler})
-      #_(POST "/save-config"
-            {:params (if starting-amount-changed?
-                       config
-                       (dissoc config :starting-amount))
-             :handler #(e! (->ConfigSaved))}))
-    #_(tuck/action! (fn [e!]
-                    (let [starting-amount-changed? (not= (* (:starting-amount config) 100)
-                                                         (:starting-amount app))]
-                      (POST "/save-config"
-                            {:params (if starting-amount-changed?
-                                       config
-                                       (dissoc config :starting-amount))
-                             :handler #(e! (->ConfigSaved))}))))
-    #_(nc/set-in-progress app true))
+                :on-error         c/->ErrorHandler})))

   ConfigSaved
   (process-event [_ app]


Rewrite config updating to use tuck effect

--- src/cljs/my_money/app/controller/config.cljs
+++ src/cljs/my_money/app/controller/config.cljs
@@ -1,20 +1,34 @@
 (ns my-money.app.controller.config
-  (:require [ajax.core :refer [POST]]
-            [my-money.ajax :as ajax]
+  (:require [my-money.ajax :as ajax]
             [tuck.core :as tuck]
             [my-money.app.controller.navigation :as nc]
             [my-money.app.controller.common :as c]
             [my-money.routes :as routes]))

 (defrecord SaveConfig [config])
-(defrecord ConfigSaved [])
+(defrecord ConfigSaved [body])
 (defrecord RetrieveConfig [])
 (defrecord SetConfig [config])

 (extend-protocol tuck/Event
   SaveConfig
   (process-event [{config :config} app]
-    (tuck/action! (fn [e!]
+    (let [starting-amount-changed? (not= (* (:starting-amount config) 100)
+                                         (:starting-amount app))]
+      (tuck/fx (nc/set-in-progress app true)
+               {:tuck.effect/type ::ajax/post
+                :url              "/save-config"
+                :on-success       ->ConfigSaved
+                :params           (if starting-amount-changed?
+                                    config
+                                    (dissoc config :starting-amount))
+                :on-error         c/->ErrorHandler})
+      #_(POST "/save-config"
+            {:params (if starting-amount-changed?
+                       config
+                       (dissoc config :starting-amount))
+             :handler #(e! (->ConfigSaved))}))
+    #_(tuck/action! (fn [e!]
                     (let [starting-amount-changed? (not= (* (:starting-amount config) 100)
                                                          (:starting-amount app))]
                       (POST "/save-config"
@@ -22,7 +36,7 @@
                                        config
                                        (dissoc config :starting-amount))
                              :handler #(e! (->ConfigSaved))}))))
-    (nc/set-in-progress app true))
+    #_(nc/set-in-progress app true))

   ConfigSaved
   (process-event [_ app]


Change cursors-lengths to just cursors

Change cursors-lengths to just cursors

--- src/main/cljs/lean_map/core.cljs
+++ src/main/cljs/lean_map/core.cljs
@@ -487,7 +487,7 @@
   ITransientMap
   (-dissoc! [tcoll key] (.without! tcoll key)))

-(deftype NodeSeq [meta arr lvl nodes cursors-lengths data-idx data-len ^:mutable __hash]
+(deftype NodeSeq [meta arr lvl nodes cursors data-idx data-len ^:mutable __hash]
   Object
   (toString [coll]
     (pr-str* coll))
@@ -498,7 +498,7 @@
   (-meta [coll] meta)

   IWithMeta
-  (-with-meta [coll meta] (NodeSeq. meta arr lvl nodes cursors-lengths data-idx data-len __hash))
+  (-with-meta [coll meta] (NodeSeq. meta arr lvl nodes cursors data-idx data-len __hash))

   ICollection
   (-conj [coll o] (cons o coll))
@@ -512,7 +512,7 @@
     [(aget arr (* data-idx 2)) (aget arr (inc (* data-idx 2)))])

   (-rest [coll]
-    (create-inode-seq arr lvl nodes cursors-lengths data-idx data-len))
+    (create-inode-seq arr lvl nodes cursors data-idx data-len))

   ISeqable
   (-seq [this] this)
@@ -527,25 +527,25 @@
   (-reduce [coll f] (seq-reduce f coll))
   (-reduce [coll f start] (seq-reduce f start coll)))

-(defn- create-inode-seq [arr lvl nodes cursors-lengths data-idx data-len]
+(defn- create-inode-seq [arr lvl nodes cursors data-idx data-len]
   (if (< (inc data-idx) data-len)
-    (NodeSeq. nil arr lvl nodes cursors-lengths (inc data-idx) data-len nil)
+    (NodeSeq. nil arr lvl nodes cursors (inc data-idx) data-len nil)
     (let [nodes     (aclone nodes)
-          cursors-lengths (aclone cursors-lengths)]
+          cursors (aclone cursors)]
       (loop [lvl lvl]
         (when (>= lvl 0)
-          (let [node-idx (aget cursors-lengths lvl)]
+          (let [node-idx (aget cursors lvl)]
             (if (zero? node-idx)
               (recur (dec lvl))
               (let [node (.get-node (aget nodes lvl) node-idx)
                     has-nodes ^boolean (.has-nodes? node)
                     new-lvl (if has-nodes (inc lvl) lvl)]
-                (aset cursors-lengths lvl (dec node-idx))
+                (aset cursors lvl (dec node-idx))
                 (when has-nodes
                   (aset nodes new-lvl node)
-                  (aset cursors-lengths new-lvl (.node-arity node)))
+                  (aset cursors new-lvl (.node-arity node)))
                 (if ^boolean (.has-data? node)
-                  (NodeSeq. nil (.get-array node) new-lvl nodes cursors-lengths 0 (.data-arity node) nil)
+                  (NodeSeq. nil (.get-array node) new-lvl nodes cursors 0 (.data-arity node) nil)
                   (recur (inc lvl)))))))))))

 (extend-protocol IPrintWithWriter


[#248] Comment stacktrace

[#248] Comment stacktrace

--- api/src/clojure/org/akvo/flow_api/middleware/anomaly.clj
+++ api/src/clojure/org/akvo/flow_api/middleware/anomaly.clj
@@ -1,7 +1,7 @@
 (ns org.akvo.flow-api.middleware.anomaly
   (:require [org.akvo.flow-api.endpoint.anomaly :as anomaly]
             [org.akvo.flow-api.anomaly :as an]
-            [clojure.tools.logging :as log]
+            #_[clojure.tools.logging :as log]
             [clojure.stacktrace :as stacktrace])
   (:import [clojure.lang ExceptionInfo]))

@@ -25,5 +25,5 @@
       (handler request)
       (catch Throwable e
         (stacktrace/print-stack-trace e)
-        (log/error e (str "Error:" (.getMessage e)))
+        #_(log/error e (str "Error:" (.getMessage e)))
         (translate-exception e)))))


CMR-6161 moved processing into let

CMR-6161 moved processing into let

--- search-app/src/cmr/search/services/autocomplete_service.clj
+++ search-app/src/cmr/search/services/autocomplete_service.clj
@@ -25,7 +25,7 @@
                      :offset (:offset opts)
                      :condition condition
                      :result-fields [:type :value]})
-         results   (qe/execute-query context query)]
-     (let [hits  (:hits results)
-           items (:items results)]
-       {:hits hits :items items}))))
+         results   (qe/execute-query context query)
+         hits (:hits results)
+         items (:items results)]
+       {:hits hits :items items})))


Add comment

Add comment

--- src/yada/service.clj
+++ src/yada/service.clj
@@ -1,4 +1,7 @@
 ;; Copyright © 2015, JUXT LTD.
+
+;; TODO No longer just service options, so either rename to options (or
+;; similar) or fold into core.

 (ns yada.service
   (:require [clojure.core.async.impl.protocols :as aip]


allow symlinks outside of project root for dev server

fixes #584

--- sidecar/src/figwheel_sidecar/components/figwheel_server.clj
+++ sidecar/src/figwheel_sidecar/components/figwheel_server.clj
@@ -155,7 +155,8 @@
 (defn handle-index [handler root]
   (fn [request]
     (if (= [:get "/"] ((juxt :request-method :uri) request))
-      (if-let [resp (some-> (resource-response "index.html" {:root (or root "public")})
+      (if-let [resp (some-> (resource-response "index.html" {:root (or root "public")
+                                                             :allow-symlinks? true})
                             (response/content-type "text/html; charset=utf-8"))]
         resp
         (handler request))
@@ -168,7 +169,8 @@
                           response))]
     (fn [{:keys [request-method uri] :as request}]
       (if (= :get request-method)
-        (if-let [resp (some-> (resource-response uri {:root (or root "public")})
+        (if-let [resp (some-> (resource-response uri {:root (or root "public")
+                                                      :allow-symlinks? true})
                               (add-mime-type uri))]
           resp
           (handler request))


upgrade all

upgrade all

--- clients/clojure/project.clj
+++ clients/clojure/project.clj
@@ -1,16 +1,16 @@
 (defproject extremecarpaccio "0.1.0-SNAPSHOT"
-            :description "Dumbed down Clojure example code for Extreme Carpaccio kata"
-            :url "https://github.com/dlresende/extreme-carpaccio"
-            :min-lein-version "2.0.0"
-            :dependencies [[org.clojure/clojure "1.6.0"]
-                           [compojure "1.3.1"]
-                           [ring "1.3.2"]
-                           [ring/ring-mock "0.2.0"]
-                           [ring-middleware-format "0.4.0"]]
-            :plugins [[lein-ring "0.8.13"]]
-            :ring {:handler extremecarpaccio.core/my-app}
-            :profiles {:dev {:dependencies [[midje "1.7.0"]]}
-                       :midje {}})
+  :description "Dumbed down Clojure example code for Extreme Carpaccio kata"
+  :url "https://github.com/dlresende/extreme-carpaccio"
+  :min-lein-version "2.0.0"
+  :dependencies [[org.clojure/clojure "1.10.0"]
+                 [compojure "1.6.1"]
+                 [ring "1.8.0"]
+                 [ring/ring-mock "0.4.0"]
+                 [ring-middleware-format "0.7.4"]]
+  :plugins [[lein-ring "0.12.5"]
+            [lein-midje "3.2.2"]]
+  :ring {:handler extremecarpaccio.core/my-app}
+  :profiles {:dev {:dependencies [[midje "1.9.9"]]}})


bin to map

bin to map

--- stuf/src/sandbox/4clojure.clj
+++ stuf/src/sandbox/4clojure.clj
@@ -931,4 +931,7 @@

 ;;
-#(Integer/toString % 2)
+(defn b->m [b]
+  (let [l (count (Integer/toString (apply max b) 2))
+        frm (str "~" l ",'0B")]
+    (map #(clojure.pprint/cl-format nil frm %) b)))


153 sqr function

153 sqr function

--- stuf/src/sandbox/4clojure.clj
+++ stuf/src/sandbox/4clojure.clj
@@ -1332,8 +1332,13 @@
          (superpos)
          (map vec))))

-(defn sqrs [h w]
+(defn sqrs-coords [h w]
   (for [y (range h) l1 (range 2 (- (inc h) y))
         x (range w) l2 (range 2 (- (inc w) x))
         :when (= l1 l2)] [y x l1]))

+(defn sqr [[y x side] area]
+  (let [sub-area (for [dy (range side) dx (range side)]
+                   (get-in area [(+ y dy) (+ x dx)]))]
+    (->> (partition side sub-area)
+         (mapv vec))))


rotate square

rotate square

--- stuf/src/sandbox/4clojure.clj
+++ stuf/src/sandbox/4clojure.clj
@@ -1087,14 +1087,15 @@
        (recur (quot num base) base (cons (mod num base) res)))))

 (defn f
-  ([xs num] (take num (f xs
-                        (cycle [[-1 0] [0 1] [1 0] [0 -1]])
-                        #{})))
+  ([xs size]
+   (->> (f xs (cycle [[-1 0] [0 1] [1 0] [0 -1]]) #{})
+        (map (fn [[y x]] [(- (+ y x) 1) (+ (- x y) size)]))
+        (take (* size size))))
   ([xy ops history]
-  (lazy-seq
-   (let [nxy (map + xy (first ops))
-         nnxy (map + xy (second ops))]
-     (if (history nnxy)
-       (cons xy (f nxy ops (conj history xy)))
-       (cons xy (f nnxy (rest ops) (conj history xy))))))))
-
+   (lazy-seq
+    (let [nxy (map + xy (first ops))
+          nnxy (map + xy (second ops))]
+      (if (history nnxy)
+        (cons xy (f nxy ops (conj history xy)))
+        (cons xy (f nnxy (rest ops) (conj history xy))))))))
+


use alan's better regex for defrecord/deftypes

--- dev/bake/clj_stacktrace.clj
+++ dev/bake/clj_stacktrace.clj
@@ -31,7 +31,7 @@
 (defn- clojure-ns
   "Returns the clojure namespace name implied by the bytecode class name."
   [class-name]
-  (re-gsub #"_" "-" (re-get #"([^$]+)\$" class-name 1)))
+  (re-gsub #"_" "-" (re-get #"([^$]+(?=\$)|.+(?=\.))" class-name 1)))

 ; drop everything before and including the first $
 ; drop everything after and including and the second $


Fix NPE.

Fix NPE.

--- src/onyx/log/commands/common.clj
+++ src/onyx/log/commands/common.clj
@@ -124,7 +124,7 @@
    (fn [task]
      (let [allocated (get-in replica [:allocations job task])
            n-allocated (if (seq allocated) (count allocated) 0)]
-       (< n-allocated (get-in replica [:task-saturation job task]))))
+       (< n-allocated (or (get-in replica [:task-saturation job task]) Double/POSITIVE_INFINITY))))
    tasks))

 (defn jobs-with-available-tasks [replica jobs]


Anon function is more readable

Anon function is more readable

--- src/onyx/peer/task_lifecycle.clj
+++ src/onyx/peer/task_lifecycle.clj
@@ -378,8 +378,8 @@
                     (when-not seen?
                       (inc-count! fused-ack)
                       (->> windows
-                           (map (partial assign-window segment window-state))
-                           doall
+                           (map (fn [w] (assign-window segment window-state w)))
+                           (doall)
                            (cons unique-id) ;; store the id at the head of the log entry
                            (state-extensions/store-log-entry state-log event ack-fn))
                       (doseq [t triggers]


Improve readability

Improve readability

--- src/onyx/peer/task_lifecycle.clj
+++ src/onyx/peer/task_lifecycle.clj
@@ -158,11 +158,9 @@
                                 retries (:retries accumulated)
                                 ret (add-from-leaves segments retries event result egress-ids
                                                      task->group-by-fn flow-conditions)
-                                new-ack (->Ack (:id root) (:completion-id root) (:ack-val ret) nil)]
-                            (->Results (:tree results)
-                                       (conj! (:acks accumulated) new-ack)
-                                       (:segments ret)
-                                       (:retries ret))))
+                                new-ack (->Ack (:id root) (:completion-id root) (:ack-val ret) nil)
+                                acks (conj! (:acks accumulated) new-ack)]
+                            (->Results (:tree results) acks (:segments ret) (:retries ret))))
                         results
                         (:tree results))]
     (assoc event :onyx.core/results (persistent-results! results))))


Revert "TNS-38: ignore dependency on self"

This reverts commit 6b19f942802f3b35059bb4acfa4791ef1717b8a9.

The commit being reverted here doesn't really solve the problem, just
masks it.

:require-macros is a special case; it crosses the boundary between two
"platforms," Clojure and ClojureScript. As such, it breaks many of the
assumptions on which the current design of tools.namespace is based, in
particular the assumption that there is a one-to-one correspondance
between files and namespaces.

Until some future design in which tools.namespace can understand the
structure of mixed-language projects, I think it makes more sense to
keep each "platform" completely separate, by ignoring
:require-macros (and :use-macros) altogether.

--- src/main/clojure/clojure/tools/namespace/parse.cljc
+++ src/main/clojure/clojure/tools/namespace/parse.cljc
@@ -123,9 +123,6 @@
 (defn deps-from-ns-decl
   "Given an (ns...) declaration form (unevaluated), returns a set of
   symbols naming the dependencies of that namespace.  Handles :use and
-  :require clauses but not :load. Ignores a namespace depending on
-  itself, for example a .cljs file with :require-macros on the .clj
-  file of the same namespace."
+  :require clauses but not :load."
   [decl]
-  (disj (set (mapcat deps-from-ns-form decl))
-        (name-from-ns-decl decl)))
+  (set (mapcat deps-from-ns-form decl)))


Revert "[PDOK-1952] the version column was stored

as a uuid, this results in getdescriptiontype error."
-> let's fix it in geoserver postgres views

This reverts commit 3f0f1ba5dae3589e57316d576c8357357bcc0eb1.

--- src/main/clojure/pdok/featured/geoserver.clj
+++ src/main/clojure/pdok/featured/geoserver.clj
@@ -39,12 +39,12 @@

       (pg/create-table db dataset table
                 [:gid "serial" :primary :key]
-                [:_id "text"]
-                [:_version "text"]
+                [:_id "varchar(100)"]
+                [:_version "uuid"]
                 [:_geometry_point "geometry"]
                 [:_geometry_line "geometry"]
                 [:_geometry_polygon "geometry"]
-                [:_geo_group "text"])
+                [:_geo_group "varchar (20)"])

       (pg/create-index db dataset table "_id")
       (pg/add-geo-constraints db dataset table :_geometry_point ndims srid)


feat: check-existence-on-delete

feat: check-existence-on-delete

TEMPORARY defaults to false, for BGT

--- src/main/clojure/pdok/featured/processor.clj
+++ src/main/clojure/pdok/featured/processor.clj
@@ -108,7 +108,8 @@
           #{:delete}
           (cond->> feature
             true (apply-all-features-validation persistence processor)
-            true (apply-non-new-feature-requires-existing-stream-validation persistence)
+            (:check-existence-on-delete processor)
+            (apply-non-new-feature-requires-existing-stream-validation persistence)
             (:check-validity-on-delete processor)
             (apply-non-new-feature-current-validity-validation persistence))
           feature
@@ -437,6 +438,7 @@
          batch-size (or (config/env :processor-batch-size) 10000)]
      (merge {:dataset dataset
              :check-validity-on-delete true
+             :check-existence-on-delete false
              :disable-validation false
              :persistence initialized-persistence
              :projectors initialized-projectors


Added aliases.

Added aliases.

--- src/plugboard/core/plugboard.clj
+++ src/plugboard/core/plugboard.clj
@@ -213,11 +213,57 @@
 ;; ------------------------ Useful aliases

 (def START :B13)
+
+;; These are aliases. Note that there are no aliases for the pairs
+;; :M7/:N5 and :O14/:P3 since these are duplicates.
+
+;; TODO: Perhaps we need a plugin-API to ensure these functions are plugged
+;; in at the appropriate points.
+
+(def authorized? :B8)
+(def known-method? :B12)
+(def request-entity-too-large? :B4)
+(def unknown-content-type? :B5)
+(def unknown-or-unsupported-content-asterisk-header? :B6)
+(def forbidden? :B7)
+(def authorized? :B8)
+(def malformed? :B9)
+(def uri-too-long? :B11)
+(def known-method? :B12)
+(def available? :B13)
+(def accept-exists? :C3)
+(def acceptable-media-type-available? :C4)
+(def accept-language-exists? :D4)
+(def acceptable-language-available? :D5)
+(def accept-charset-exists? :E5)
+(def acceptable-charset-available :E6)
+(def accept-encoding-exists? :F6)
+(def acceptable-encoding-available? :F7)
 (def resource-exists? :G7)
-(def authorized? :B8)
+(def if-match-exists? :G8)
+(def it-match-asterisk-exists? :G9)
+(def etag-in-if-match? :G11)
+(def if-match-asterisk-exists? :H7)
+(def if-unmodified-since-exists? :H10)
+(def if-unmodified-since-is-valid-date? :H11)
+(def last-modified-greater-than-if-unmodified-since? :H12)
+(def server-desires-that-the-request-be-applied-to-a-different-URI? :I4)
+(def if-none-match? :I12)
+(def if-none-match-asterisk? :I13)
 (def resource-moved-permanently? :K5)
 (def resource-previously-existed? :K7)
+(def etag-in-if-none-match? :K13)
+(def resource-moved-temporarily? :L5)
+(def if-modified-since-exists? :L13)
+(def if-modified-since-is-valid-date? :L14)
+(def if-modified-since-greater-than-now? :L15)
+(def last-modified-greater-than-if-modified-since? :L17)
+(def delete-enacted? :M20)
 (def redirect? :N11)
+(def multiple-representations? :O18)
+(def response-includes-an-entity? :O20)
+(def new-resource? :P11)
+

 ;; ------------------------ Construction


more tiff progress

more tiff progress

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

--- plugins/OMETiff/src/org/micromanager/ometiff/core.clj
+++ plugins/OMETiff/src/org/micromanager/ometiff/core.clj
@@ -1,6 +1,34 @@
 (ns org.micromanager.ometiff.core
-  (:import [java.io RandomAccessFile]
+  (:import [java.io FileOutputStream RandomAccessFile]
            [java.nio.channels FileChannel$MapMode]))
+
+;; Memory-mapped files
+
+(defn open-mmap [file size]
+  (let [f (RandomAccessFile. file "rwd")
+        rwChannel (.getChannel f)
+        bb (.map rwChannel FileChannel$MapMode/READ_WRITE 0 size)
+        sb  nil ;(.asShortBuffer dbb)
+        ]
+    {:file f :rwChannel rwChannel :byte-buf bb :short-buf sb}))
+
+(defn write-seq [mmap byte-vals]
+  (.put (:byte-buf mmap) (byte-array (map byte byte-vals))))
+
+(defn write-bytes [mmap bytes]
+  (.put (:byte-buf mmap) bytes))
+
+(defn get-pos [mmap]
+  (.position (:byte-buf mmap)))
+
+(defn close-mmap [mmap]
+  (let [chan (:rwChannel mmap)]
+    (doto chan
+      (.truncate (get-pos mmap))
+      .close)
+    (.close (:file mmap))))
+
+;; tiff composing

 (defn create-header
   "Creates a big-endian tiff image file header."
@@ -91,54 +119,19 @@
         (rational-value pixel-size-cm)
         ))))

+;; tiff parsing

-;; Memory-mapped files
+(defn get-val [bytes]
+  (loop [b bytes val 0]
+    (let [first-byte (first b)
+          first-byte (if (neg? first-byte) (+ 0x100 first-byte) first-byte)
+          new-val (+ (* 0x100 val) first-byte)]
+      (if (next b)
+        (recur (next b) new-val)
+        new-val))))

-(defn open-mmap [file size]
-  (let [f (RandomAccessFile. file "rwd")
-        rwChannel (.getChannel f)
-        dbb (.map rwChannel FileChannel$MapMode/READ_WRITE 0 size)
-        dsb (.asShortBuffer dbb)]
-    {:file f :rwChannel rwChannel :byte-buf dbb :short-buf dsb}))
-
-(defn write-seq [mmap byte-vals]
-  (.put (:byte-buf mmap) (byte-array (map byte byte-vals))))
+;; tiff writing

-(defn write-bytes [mmap bytes]
-  (.put (:byte-buf mmap) bytes))
-
-(defn get-pos [mmap]
-  (.position (:byte-buf mmap)))
-
-(defn close-mmap [mmap]
-  (let [chan (:rwChannel mmap)]
-    (doto chan
-      (.truncate (get-pos mmap))
-      .close)
-    (.close (:file mmap))))
-
-; (.position dbb) <-- gets cursor pos
-; (.position dbb 10) <-- sets cursor pos
-; (.get dbb q) <-- read array
-
-;; testing
-
-;;;; image generation
-
-(defn rand-byte []
-  (byte (- (rand-int 256) 128)))
-
-(defn rand-bytes [n]
-  (let [array (byte-array n)]
-    (doseq [i (range n)]
-      (aset-byte array i (rand-byte)))
-    array))
-
-(defn rand-byte-image [w h nchannels]
-  (rand-bytes (* w h nchannels )))
-
-;; write minimal one-page tiff
-
 (defn write-one-page-tiff [name pix w h]
   (let [mmap (open-mmap name 1000000000)]
     (write-seq mmap
@@ -164,8 +157,28 @@
        ; (println "pos:" (get-pos mmap))
         ))
     (close-mmap mmap)))
-
-(defn big-test []
-  (let [img (rand-byte-image 2560 4320 1)]
-    (time (write-multi-page-tiff "test.tif" img 2560 4320 100))))

+; (.position dbb) <-- gets cursor pos
+; (.position dbb 10) <-- sets cursor pos
+; (.get dbb q) <-- read array
+
+;; testing
+
+;;;; image generation
+
+(defn rand-byte []
+  (byte (- (rand-int 256) 128)))
+
+(defn rand-bytes [n]
+  (let [array (byte-array n)]
+    (doseq [i (range n)]
+      (aset-byte array i (rand-byte)))
+    array))
+
+(defn rand-byte-image [w h nchannels]
+  (rand-bytes (* w h nchannels )))
+
+(defn big-test [name]
+  (let [img (rand-byte-image 1024 1024 1)]
+    (time (write-multi-page-tiff name img 1024 1024 1000))))
+


Catch ClassNotFoundError and give a nicer message

--- src/radicalzephyr/boot_junit.clj
+++ src/radicalzephyr/boot_junit.clj
@@ -46,10 +46,14 @@
             all-class-names (map path->class-name java-files)]
         (when-not (seq class-files)
           (util/warn "No .class files found in `output-files`, did you forget to run `javac`?\n"))
-        (if-let [result (pod/with-eval-in worker-pod
-                          (run-tests-in-classes '~all-class-names
-                                                :classes ~class-names
-                                                :packages ~packages))]
+        (if-let [result (try
+                          (pod/with-eval-in worker-pod
+                           (run-tests-in-classes '~all-class-names
+                                                 :classes ~class-names
+                                                 :packages ~packages))
+                          (catch ClassNotFoundException e
+                            (util/warn "Could not load class: %s...\n" (.getMessage e))
+                            {:failures 1}))]
           (when (> (:failures result) 0)
             (throw (ex-info "Some tests failed or errored" {})))
           (util/warn "Nothing was tested.")))


Explain.

Explain.

--- test/lambdajam/jobs/test_1_3.clj
+++ test/lambdajam/jobs/test_1_3.clj
@@ -39,6 +39,10 @@

 (def k-expected-output (concat a-input b-input))

+;; Notice that all the elements from input C are expected three times.
+;; This is because task C connects to E, which connects to G, H, and I.
+;; All the segments from E are sent to G, H, and I, and ultimately merged
+;; back together in L.
 (def l-expected-output
   (concat a-input b-input c-input c-input c-input))


GAWB-1897: removing unnecessary let statement

--- src/cljs/main/broadfcui/page/method_repo/create_method.cljs
+++ src/cljs/main/broadfcui/page/method_repo/create_method.cljs
@@ -99,7 +99,6 @@
    (fn [{:keys [props state refs]}]
      (let [[namespace name & fails] (input/get-and-validate refs "namespace" "name")
            [synopsis documentation] (common/get-text refs "synopsis" "documentation")
-           type "Workflow"
            wdl (react/call :call-method (@refs "wdl-editor") "getValue")
            fails (or fails (when (clojure.string/blank? wdl) ["Please enter the WDL payload"]))]
        (swap! state assoc :validation-errors fails)
@@ -112,7 +111,7 @@
                      :synopsis synopsis
                      :documentation documentation
                      :payload wdl
-                     :entityType type}
+                     :entityType "Workflow"}
            :headers utils/content-type=json
            :on-done
            (fn [{:keys [success? get-parsed-response]}]


Fix libs versions on examples/node-example/project.clj (#532)

* Fix libs versions on examples/node-example/project.clj

* Fix libs versions on examples/node-example/project.clj 0.5.9

--- examples/node-example/project.clj
+++ examples/node-example/project.clj
@@ -9,7 +9,7 @@
   :dependencies [[org.clojure/clojure "1.9.0-alpha14"]
                  [org.clojure/clojurescript "1.9.229"]]

-  :plugins [[lein-figwheel "0.5.10-SNAPSHOT"]]
+  :plugins [[lein-figwheel "0.5.9"]]

   :source-paths ["src"]

@@ -28,7 +28,7 @@
                            ;; !!! need to set the target to :nodejs !!!
                            :target :nodejs}}]}

-  :profiles {:dev {:dependencies [[figwheel-sidecar "0.5.10-SNAPSHOT"]
+  :profiles {:dev {:dependencies [[figwheel-sidecar "0.5.9"]
                                   [com.cemerick/piggieback "0.2.1"]]
                    :repl-options {:nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]}}}
 )


Switch from 'mysql-test' to 'master'

Switch from 'mysql-test' to 'master'

--- clj_record/test/main.clj
+++ clj_record/test/main.clj
@@ -11,7 +11,7 @@
 (defmethod get-id-key-spec "postgresql" [db-spec name]
   [:id "SERIAL UNIQUE PRIMARY KEY"])
 (defmethod get-id-key-spec "mysql" [db-spec name]
-  [:id :serial :unique])
+  [:id "SERIAL UNIQUE PRIMARY KEY"])

 (defn drop-tables []
   (try


Tests for the main function and show help function

--- test/clj_mrazik/core_test.clj
+++ test/clj_mrazik/core_test.clj
@@ -11,8 +11,9 @@
 ;

 (ns clj-mrazik.core-test
-  (:require [clojure.test :refer :all]
-            [clj-mrazik.core :refer :all]))
+  (:require [clojure.test        :refer :all]
+            [clj-mrazik.core     :refer :all]
+            [clj-mrazik.importer :refer :all]))

 ;
 ; Common functions used by tests.
@@ -90,9 +91,32 @@
         (is (callable? 'clj-mrazik.core/show-help))))

+(deftest test-run-app-existence
+    "Check that the clj-mrazik.core/run-app definition exists."
+    (testing "if the clj-mrazik.core/run-app definition exists."
+        (is (callable? 'clj-mrazik.core/run-app))))
+
 (deftest test--main-existence
     "Check that the clj-mrazik.core/-main definition exists."
     (testing "if the clj-mrazik.core/-main definition exists."
         (is (callable? 'clj-mrazik.core/-main))))

+(deftest test-show-help
+    "Check the function show-help"
+    (testing "the function show-help"
+       ; use mock instead of println function
+        (with-redefs [println (fn [string] string)]
+            (is (= "help"         (show-help "help")))
+            (is (= "line1\nline2" (show-help "line1\nline2"))))))
+
+(deftest test-run-app
+    "Check the function run-app"
+    (testing "the function run-app"
+        (with-redefs [show-help   (fn [summary] :help)
+                      import-data (fn [import?] :import)
+                      start-bot   (fn [] :start-bot)]
+            (is (= :help      (run-app "summary" true false)))
+            (is (= :import    (run-app "summary" false true)))
+            (is (= :start-bot (run-app "summary" false false))))))
+


Small readability improvement.

Small readability improvement.

--- src/onyx/scheduling/common_job_scheduler.clj
+++ src/onyx/scheduling/common_job_scheduler.clj
@@ -114,7 +114,7 @@
    (fn [result job]
      (let [peers (apply concat (vals (get-in result [:allocations job])))
            pct (or (get-in result [:acker-percentage job]) 10)
-           n (int (Math/ceil (* (* 0.01 pct) (count peers))))
+           n (int (Math/ceil (* 0.01 pct (count peers))))
            candidates (choose-acker-candidates result peers)]
        (assoc-in result [:ackers job] (vec (take n candidates)))))
    replica


CMR-4745: Log the client-id in the line where we log query performance.

--- search-app/src/cmr/search/services/query_service.clj
+++ search-app/src/cmr/search/services/query_service.clj
@@ -203,8 +203,8 @@
                                        (common-search/find-concepts
                                          context concept-type query))
         total-took (+ query-creation-time find-concepts-time)]
-    (info (format "Found %d %ss in %d ms in format %s with params %s."
-                  (:hits results) (name concept-type) total-took
+    (info (format "Found %d %ss in %d ms from client %s in format %s with params %s."
+                  (:hits results) (name concept-type) total-took (:client-id context)
                   (rfh/printable-result-format (:result-format query)) (pr-str params)))
     (assoc results :took total-took)))

@@ -222,8 +222,8 @@
                                                                     concept-type
                                                                     query))
         total-took (+ query-creation-time find-concepts-time)]
-    (info (format "Found %d %ss in %d ms in format %s with JSON Query %s and query params %s."
-                  (:hits results) (name concept-type) total-took
+    (info (format "Found %d %ss in %d ms from client %s in format %s with JSON Query %s and query params %s."
+                  (:hits results) (name concept-type) total-took (:client-id context)
                   (rfh/printable-result-format (:result-format query)) json-query (pr-str params)))
     (assoc results :took total-took)))

@@ -241,8 +241,8 @@
                                                                     concept-type
                                                                     query))
         total-took (+ query-creation-time find-concepts-time)]
-    (info (format "Found %d %ss in %d ms in format %s with aql: %s."
-                  (:hits results) (name concept-type) total-took
+    (info (format "Found %d %ss in %d ms from client %s in format %s with aql: %s."
+                  (:hits results) (name concept-type) total-took (:client-id context)
                   (rfh/printable-result-format (:result-format query)) aql))
     (assoc results :took total-took)))

@@ -440,11 +440,9 @@
                      (qm/query {:concept-type :collection
                                 :result-format result-format})
                      (assoc results :took total-took))]
-
-    (info (format "Found %d deleted collections in %d ms in format %s with params %s."
-                  (:hits results) total-took
+    (info (format "Found %d deleted collections in %d ms from client %s in format %s with params %s."
+                  (:hits results) total-took (:client-id context)
                   (rfh/printable-result-format result-format) (pr-str params)))
-
     {:results results-str
      :hits (:hits results)
      :result-format result-format}))
@@ -464,7 +462,6 @@
                         :filter {:and {:filters filters}}}}
      :fields [:concept-id :revision-date :provider-id
               :granule-ur :parent-collection-id]}))
-

 (defn get-deleted-granules
   "Executes elasticsearch searches to find collections that are deleted from a given revision-date.
@@ -486,8 +483,8 @@
         results {:hits hits :items items :took total-took}
         ;; construct the response results string
         results-str (json/generate-string (:items results))]
-    (info (format "Found %d deleted granules in %d ms in format %s with params %s."
-                  (:hits results) total-took
+    (info (format "Found %d deleted granules in %d ms from client %s in format %s with params %s."
+                  (:hits results) total-took (:client-id context)
                   (rfh/printable-result-format result-format) (pr-str params)))
     {:results results-str
      :hits (:hits results)


md5 should sum the contents of files

md5 should sum the contents of files

--- tasks/leiningen/fatdeb.clj
+++ tasks/leiningen/fatdeb.clj
@@ -136,7 +136,7 @@
                            "all" ".deb")
         deb-file (file (:root project) "target" deb-file-name)]
     (write (str deb-file ".md5")
-           (str (md5 deb-file) " " deb-file-name))))
+           (str (md5 (slurp deb-file)) " " deb-file-name))))

 (defn fatdeb
   ([project]


fix tests

fix tests

--- test/clj_pg/coerce_test.clj
+++ test/clj_pg/coerce_test.clj
@@ -42,7 +42,7 @@
   (testing "arrays"
     (with-open [conn (jdbc/get-connection db)]
       (is (= (type (sut/to-pg-array conn [1 2 3]))
-             org.postgresql.jdbc4.Jdbc4Array))
+             org.postgresql.jdbc.PgArray))

       (is (= (type (sut/to-pg-array conn ["a" "b"] "varchar"))
-             org.postgresql.jdbc4.Jdbc4Array)))))
+             org.postgresql.jdbc.PgArray)))))


wrap grid rtl

wrap grid rtl

--- src/cljs/salava/extra/application/ui/application.cljs
+++ src/cljs/salava/extra/application/ui/application.cljs
@@ -30,7 +30,7 @@
     text))

 (defn fetch-badge-adverts [state]
-  (let [{:keys [user-id country-selected name recipient-name issuer-name order tags show-followed-only]} @state]
+  (let [{:keys [user-id country-selected name recipient-name issuer-name order tags show-followed-only]} @state]
     (ajax/GET
      (path-for (str "/obpv1/application/"))
      {:params  {:country  (trim country-selected)
@@ -92,7 +92,7 @@
   (swap! state assoc :value #{}
          :tags ())
   (ajax/GET
-   (path-for "/obpv1/application/autocomplete")
+   (path-for "/obpv1/application/autocomplete")
    {:params {:country  (trim country)}
     :handler (fn [data]
                (let [{:keys [tags names]} data]
@@ -106,7 +106,7 @@
   (if tags
     (s/split tags #",")))

-(defn modal-content [data state]
+(defn modal-content [data state]
   (let [{:keys [image_file name info issuer_content_name tags  issuer_content_name issuer_content_url issuer_contact issuer_image description criteria_url]} data
         tags (tag-parser tags)
         country (:country-selected @state)]
@@ -120,7 +120,7 @@
           [:h1.uppercase-header name]
           [:div.badge-stats
            (bh/issuer-label-image-link issuer_content_name issuer_content_url "" issuer_contact issuer_image)
-           [:div
+           [:div
             description]
            (if-not (blank? criteria_url)
              [:div {:class "badge-info"}
@@ -135,7 +135,7 @@
                    (for [tag tags]
                      [:a {:href         "#"
                           :id           "tag"
-                          :on-click     #(do
+                          :on-click     #(do
                                            (swap! state assoc :advanced-search true)
                                            (set-to-autocomplete state tag))
                           :data-dismiss "modal"}
@@ -143,7 +143,7 @@

 (defn badge-content-modal-render [data state]
-
+
   (let [data-atom (atom data) ]
     (fn []
       [:div {:id "badge-content"}
@@ -151,7 +151,7 @@
         [:div.row
          [:div.col-md-12
           [:div {:class "text-right"}
-
+
            [:button {:type         "button"
                      :class        "close"
                      :data-dismiss "modal"
@@ -345,9 +345,9 @@
 (defn gallery-grid [state]
   (let [badges (:applications @state)
         tags (:tags @state)]
-    [:div
+    [:div
      [:h3 (str-cat tags)]
-     (into [:div {:class "row"
+     (into [:div {:class "row wrap-grid"
                   :id    "grid"}]
            (for [element-data badges]
              (badge-grid-element element-data state)))]))


(SERVER-2576) Pass cipher valid for tls 1[.1] in tests

--- test/unit/puppetlabs/puppetserver/ruby/http_client_test.clj
+++ test/unit/puppetlabs/puppetserver/ruby/http_client_test.clj
@@ -270,7 +270,7 @@
               (is (instance? ProtocolException (.getCause e))))))))))

   (testing "Can connect via TLSv1 by default"
-    (with-webserver-with-protocols ["TLSv1"] nil
+    (with-webserver-with-protocols ["TLSv1"] ["TLS_RSA_WITH_AES_128_CBC_SHA"]
       (with-scripting-container sc
         (with-http-client sc 10080 {:use-ssl true}
           (.runScriptlet sc "$response = $c.get('/', {})")
@@ -278,7 +278,7 @@
           (is (= "hi" (.runScriptlet sc "$response.body")))))))

   (testing "Can connect via TLSv1.1 by default"
-    (with-webserver-with-protocols ["TLSv1.1"] nil
+    (with-webserver-with-protocols ["TLSv1.1"] ["TLS_RSA_WITH_AES_128_CBC_SHA"]
       (with-scripting-container sc
         (with-http-client sc 10080 {:use-ssl true}
           (.runScriptlet sc "$response = $c.get('/', {})")
@@ -295,7 +295,7 @@

 (deftest https-sslv3
   (logutils/with-test-logging
-    (with-webserver-with-protocols ["SSLv3"] nil
+    (with-webserver-with-protocols ["SSLv3"] ["TLS_RSA_WITH_AES_128_CBC_SHA"]
       (testing "Cannot connect via SSLv3 by default"
         (with-scripting-container sc
           (with-http-client sc 10080 {:use-ssl true}


Hide chat icon for group chat

Hide chat icon for group chat

Former-commit-id: 35937c72a05136243d8f2abc8db2c56e82689f3b

--- src/syng_im/components/chat.cljs
+++ src/syng_im/components/chat.cljs
@@ -134,12 +134,12 @@
                        :fontSize   12
                        :fontFamily font}}
          "Active a minute ago"])]
-     [view {:style {:position "absolute"
-                    :top      10
-                    :right    66}}
-      [chat-photo {}]
-      (when (not group?)
-        [contact-online {:online true}])]]))
+     (when (not group?)
+       [view {:style {:position "absolute"
+                      :top      10
+                      :right    66}}
+        [chat-photo {}]
+        [contact-online {:online true}]])]))

 (defn chat [{:keys [navigator]}]
   (let [messages (subscribe [:get-chat-messages])


added docs

added docs

--- cljx/plongeur-clj/dev/user.clj
+++ cljx/plongeur-clj/dev/user.clj
@@ -1,3 +1,10 @@
-(defn dev []
+(defn dev
+  "Usage:
+
+  1. project folder terminal: `lein dive`
+  2. connect nREPL to port 8666 (see project.clj)
+  3. evaluate this namespace in the repl
+  4. evaluate: `(dev)` in the repl"
+  []
   (require 'dev)
   (in-ns 'dev))


CMR-4398: Updated test.

CMR-4398: Updated test.

--- system-int-test/test/cmr/system_int_test/bootstrap/bulk_index/variables_test.clj
+++ system-int-test/test/cmr/system_int_test/bootstrap/bulk_index/variables_test.clj
@@ -53,45 +53,45 @@
 (deftest bulk-index-variables
   (testing "Bulk index variables for multiple providers, explicitly"
     (s/only-with-real-database
-      ;; Disable message publishing so items are not indexed.
-      (core/disable-automatic-indexing)
-      ;; The following are saved, but not indexed due to the above call
-      (variable/ingest-variable-with-attrs {:provider-id "PROV1"} {} 1)
-      (variable/ingest-variable-with-attrs {:provider-id "PROV1"} {} 2)
-      (variable/ingest-variable-with-attrs {:provider-id "PROV2"} {} 3)
-      (variable/ingest-variable-with-attrs {:provider-id "PROV2"} {} 4)
-      (variable/ingest-variable-with-attrs {:provider-id "PROV3"} {} 5)
-      (variable/ingest-variable-with-attrs {:provider-id "PROV3"} {} 6)
-      (is (= 0 (:hits (variable/search {}))))
-      (bootstrap/bulk-index-variables "PROV1")
-      (bootstrap/bulk-index-variables "PROV2")
-      (bootstrap/bulk-index-variables "PROV3")
-      (index/wait-until-indexed)
-      (testing "Variable concepts are indexed."
-        (let [{:keys [hits items]} (variable/search {})]
-          (is (= 6 hits))
-          (is (= 6 (count items)))))
-      ;; Re-enable message publishing.
-      (core/reenable-automatic-indexing))))
+     ;; Disable message publishing so items are not indexed.
+     (core/disable-automatic-indexing)
+     ;; The following are saved, but not indexed due to the above call
+     (variable/ingest-variable-with-attrs {:provider-id "PROV1"} {} 1)
+     (variable/ingest-variable-with-attrs {:provider-id "PROV1"} {} 2)
+     (variable/ingest-variable-with-attrs {:provider-id "PROV2"} {} 3)
+     (variable/ingest-variable-with-attrs {:provider-id "PROV2"} {} 4)
+     (variable/ingest-variable-with-attrs {:provider-id "PROV3"} {} 5)
+     (variable/ingest-variable-with-attrs {:provider-id "PROV3"} {} 6)
+     (is (= 0 (:hits (variable/search {}))))
+     (bootstrap/bulk-index-variables "PROV1")
+     (bootstrap/bulk-index-variables "PROV2")
+     (bootstrap/bulk-index-variables "PROV3")
+     (index/wait-until-indexed)
+     (testing "Variable concepts are indexed."
+       (let [{:keys [hits items]} (variable/search {})]
+         (is (= 6 hits))
+         (is (= 6 (count items)))))
+     ;; Re-enable message publishing.
+     (core/reenable-automatic-indexing))))

 (deftest bulk-index-all-variables
   (testing "Bulk index variables for multiple providers, implicitly"
     (s/only-with-real-database
-      ;; Disable message publishing so items are not indexed.
-      (core/disable-automatic-indexing)
-      ;; The following are saved, but not indexed due to the above call
-      (variable/ingest-variable-with-attrs {:provider-id "PROV1"} {} 1)
-      (variable/ingest-variable-with-attrs {:provider-id "PROV2"} {} 2)
-      (variable/ingest-variable-with-attrs {:provider-id "PROV3"} {} 3)
-      (is (= 0 (:hits (variable/search {}))))
-      (bootstrap/bulk-index-variables)
-      (index/wait-until-indexed)
-      (testing "Variable concepts are indexed."
-        (let [{:keys [hits items]} (variable/search {})]
-          (is (= 3 hits))
-          (is (= 3 (count items)))))
-      ;; Re-enable message publishing.
-      (core/reenable-automatic-indexing))))
+     ;; Disable message publishing so items are not indexed.
+     (core/disable-automatic-indexing)
+     ;; The following are saved, but not indexed due to the above call
+     (variable/ingest-variable-with-attrs {:provider-id "PROV1"} {} 1)
+     (variable/ingest-variable-with-attrs {:provider-id "PROV2"} {} 2)
+     (variable/ingest-variable-with-attrs {:provider-id "PROV3"} {} 3)
+     (is (= 0 (:hits (variable/search {}))))
+     (bootstrap/bulk-index-variables)
+     (index/wait-until-indexed)
+     (testing "Variable concepts are indexed."
+       (let [{:keys [hits items]} (variable/search {})]
+         (is (= 3 hits))
+         (is (= 3 (count items)))))
+     ;; Re-enable message publishing.
+     (core/reenable-automatic-indexing))))

 (deftest bulk-index-variable-revisions
   (testing "Bulk index variables index all revisions index as well"
@@ -136,9 +136,8 @@
        (bootstrap/bulk-index-variables "PROV1")
        (index/wait-until-indexed)

-       ;; CMR-4398 does not index variables under a provider correctly, enable the following verification once CMR-4398 is fixed.
        ;; After bulk indexing a provider, search found all variable revisions of that provider
-       #_(variable/assert-variable-references-match
+       (variable/assert-variable-references-match
         [var1-1 var1-2-tombstone var1-3]
         (search/find-refs :variable {:all-revisions true}))


removed some design spike stuff

removed some design spike stuff

--- test/simple_symbolic_regression_clojure/gp_test.clj
+++ test/simple_symbolic_regression_clojure/gp_test.clj
@@ -177,15 +177,3 @@
   ))

-;; exploratory
-
-(def population
-  (atom (into #{}
-    (repeatedly 10
-      #(make-individual (random-script ['(rand-int 100) '(rand) '(rand-int 1000) '(rand-int 10) :+ :- :* :÷ :x] 10) nil))
-    )))
-
-; (def x-plus-6-rubrics
-;   (repeatedly 20 #(let [x (rand-int 100)] (Rubric. {:x x} (+ 6 x)))))
-
-; (println x-plus-6-rubrics)


Note that the stack trace is expected.

Note that the stack trace is expected.

--- test/circle/backend/build/test_run_build.clj
+++ test/circle/backend/build/test_run_build.clj
@@ -53,7 +53,7 @@
 (fact "throwing an exception generates an infrastructure_fail"
   (let [build (minimal-build
                :actions [(action :name "fail"
-                                 :act-fn (fn [build] (throw (Exception.))))])]
+                                 :act-fn (fn [build] (throw (Exception. "testing: expected exception"))))])]
     (try
       (run-build build)
       (catch Exception e))


add referer header to context for bad request paths

--- src/vignette/http/middleware.clj
+++ src/vignette/http/middleware.clj
@@ -1,7 +1,7 @@
 (ns vignette.http.middleware
   (:require [environ.core :refer [env]]
             [compojure.response :refer [render]]
-            [ring.util.response :refer [response status charset header]]
+            [ring.util.response :refer [response status charset header get-header]]
             [slingshot.slingshot :refer [try+ throw+]]
             [vignette.util.image-response :refer :all]
             [wikia.common.logger :as log]
@@ -57,6 +57,7 @@
   []
   (fn [request]
     (perf/publish {:bad-request-path-count 1})
-    (log/warn "bad-request-path" {:path (:uri request)})
+    (log/warn "bad-request-path" (cond-> {:path (:uri request)}
+                                         (get-header request "referer") (assoc :referer (get-header request "referer"))))
     (-> (render "Unrecognized request path!\nSee https://github.com/Wikia/vignette for documentation.\n" request)
         (status 404))))


Updated parameter for consistency

Updated parameter for consistency

--- src/wishlistd/views/wishlist.clj
+++ src/wishlistd/views/wishlist.clj
@@ -14,5 +14,5 @@
     (response/json wishlist)))

 (defn get-wishlist-json [code]
-  (let [wishlist (get-wishlist-with-wishes {:code code})]
+  (let [wishlist (get-wishlist-with-wishes code)]
     (response/json wishlist)))


Added conversion code (temporary until 305 is resolved)

--- src/wombats/sockets/messages.clj
+++ src/wombats/sockets/messages.clj
@@ -70,15 +70,15 @@
 (defn- filter-winners
   [sorted-stats]
   (reduce (fn [winners player]
-               (if (empty? winners)
-                 (conj winners player)
-                 (if (= (-> winners
-                            (first)
-                            (get-in [:stats :stats/score]))
-                        (get-in player [:stats :stats/score]))
-                   (conj winners player)
-                   winners)))
-             [] sorted-stats))
+            (if (empty? winners)
+              (conj winners player)
+              (if (= (-> winners
+                         (first)
+                         (get-in [:stats :stats/score]))
+                     (get-in player [:stats :stats/score]))
+                (conj winners player)
+                winners)))
+          [] sorted-stats))

 (defn- sort-by-stats
   [players]
@@ -108,17 +108,24 @@
   "Pulls out relevant info from game-state and sends it in join-game"
   [{:keys [game-config] :as game-state}]

-  (get-message :game-info
-               {:game/id (:game/id game-config)
-                :game/start-time (get-start-time game-state)
-                :game/round-number (get-round-number game-state)
-                :game/max-players (:game/max-players game-config)
-                :game/player-count (count (:players game-state))
-                :game/name (:game/name game-config)
-                :game/status (:game/status game-config)
-                :game/winner (get-game-winner game-state)
-                :game/stats (vec (get-player-stats game-state))
-                :game/is-private (:game/is-private game-config)}))
+  ;; TODO: #305 Once game-state is more compatible
+  ;;       w/ game we won't need this conversion.
+  (let [players (map (fn [[_ v]]
+                       {:player/user {:user/github-username
+                                      (get-in v [:user :user/github-username])}})
+                     (:players game-state))]
+
+    (get-message :game-info
+                 {:game/id (:game/id game-config)
+                  :game/start-time (get-start-time game-state)
+                  :game/round-number (get-round-number game-state)
+                  :game/max-players (:game/max-players game-config)
+                  :game/players players
+                  :game/name (:game/name game-config)
+                  :game/status (:game/status game-config)
+                  :game/winner (get-game-winner game-state)
+                  :game/stats (vec (get-player-stats game-state))
+                  :game/is-private (:game/is-private game-config)})))

 (defn handshake-message
   [chan-id]


Add explicit Path Style access for S3Client (required for minio)

--- cimi-resources/src/com/sixsq/slipstream/ssclj/resources/external_object/utils.clj
+++ cimi-resources/src/com/sixsq/slipstream/ssclj/resources/external_object/utils.clj
@@ -56,9 +56,9 @@
         credentials (AWSStaticCredentialsProvider. (BasicAWSCredentials. key secret))]
     (-> (AmazonS3ClientBuilder/standard)
         (.withEndpointConfiguration endpoint)
+        (.withPathStyleAccessEnabled true)
         (.withCredentials credentials)
         .build)))
-

 (defn generate-url
   [obj-store-conf bucket obj-name verb & [{:keys [ttl content-type]}]]


raise a more understandable error

raise a more understandable error

--- src/clj/clj_money/models/storage/sql_storage.clj
+++ src/clj/clj_money/models/storage/sql_storage.clj
@@ -140,6 +140,9 @@
   (s/keys :req-un [::entity-id] :opt-un [::transaction-date]))
 (defmethod transaction-criteria :id [_]
   (s/keys :req-un [::id ::transaction-date]))
+(defmethod transaction-criteria :default [c]
+  (throw (RuntimeException. (str "The criteria must contain either :lot-id, :entity-id, or :id. " (prn-str c)))))
+
 (s/def
   ::transaction-criteria
   (s/multi-spec transaction-criteria transaction-criteria-key))


registry text

registry text

--- src/cljs/swarmpit/component/registry/create.cljs
+++ src/cljs/swarmpit/component/registry/create.cljs
@@ -160,16 +160,16 @@
              (step-item
                0
                true
-               registry-type-text
+               (comp/typography {:variant "body2"} registry-type-text)
                (registry-type-form registry))
              (step-item
                1
                valid?
-               (registry-text registry)
+               (comp/typography {:variant "body2"} (registry-text registry))
                (registry-form registry route))
              (step-item
                2
                true
-               registry-publish-text
+               (comp/typography {:variant "body2"} registry-publish-text)
                (registry-publish-form public)
                processing?))]]]))))


Add unless macro examples (7.1.2)

Add unless macro examples (7.1.2)

--- src/clojure/clojure_walkthrough/cjia/ch07_xx.clj
+++ src/clojure/clojure_walkthrough/cjia/ch07_xx.clj
@@ -16,3 +16,53 @@
         (list 'ref-set r v)))

 (sync-set a-ref 1) ;; 1
+
+;; 7.1.2: the unless example
+
+; we want to write the reverse of (if test then else)
+(defn exhibits-oddity? [x]
+  (if (odd? x)
+    (str x " is very odd!")))
+
+(exhibits-oddity? 3) ; "3 is very odd!"
+(exhibits-oddity? 2) ; nil
+
+; we want to be able to implement unless like in ruby
+;; (defn exhibits-oddity? [x]
+;;   (unless (odd? x)
+;;           (str x "is very odd!")))
+; this will not work as we don't have `unless` in Clojure
+; but we can implement this using macros
+
+(defn unless [test then]
+  (if (not test)
+    then))
+
+(exhibits-oddity? 10) ; nil?
+(unless (exhibits-oddity? 10) (println "it is really odd!"))
+
+(defn exhibits-oddity? [x]
+  (unless (even? x)
+          (println "Rather odd")))
+
+(exhibits-oddity? 11) ;; REPL: "Rather odd!" and return nil
+
+(exhibits-oddity? 10) ;; nil
+
+;; The unless macro
+
+(defmacro unless [test then]
+  (list 'if (list 'not test)
+        then))
+
+(defn exhibits-oddity? [x]
+  (unless (even? x)
+          (println "Very odd, indeed!")))
+
+(exhibits-oddity? 10) ; nil
+(exhibits-oddity? 11) ; REPL: "Very odd, indeed!" then return
+
+(macroexpand '(unless (even? x) (println "Very odd, indeed!"))) ;; (if (not (even? x)) (println "Very odd, indeed!"))
+
+;; Other useful functions are
+; `macroexpand-1`, `macroexpand-all` from `clojure.walk`


Aligned with oauth2-ms branch in Cylon

Aligned with oauth2-ms branch in Cylon

--- modules/bootstrap/src/modular/bootstrap/cylon/user_forms.clj
+++ modules/bootstrap/src/modular/bootstrap/cylon/user_forms.clj
@@ -5,8 +5,10 @@
    [com.stuartsierra.component :as component]
    [clojure.tools.logging :refer :all]
    [modular.bootstrap :refer (ContentBoilerplate wrap-content-in-boilerplate)]
+   [modular.bidi :refer (path-for)]
    [cylon.impl.authentication :refer (LoginFormRenderer)]
-   [cylon.impl.signup :refer (SignupFormRenderer EmailVerifiedRenderer ResetPasswordRenderer WelcomeRenderer)]
+   [cylon.signup.protocols :refer (SignupFormRenderer EmailVerifiedRenderer ResetPasswordRenderer WelcomeRenderer)]
+   [cylon.totp :as totp]
    [hiccup.core :refer (html h)]
    [garden.core :refer (css)]
    [garden.units :refer (pt em px)]
@@ -22,6 +24,7 @@
                    :margin "40px auto"}
     [:.form-signin-heading :.checkbox {:margin-bottom (px 10)}]
     [:.checkbox [:font-weight :normal]]
+    [:p.note {:font-size "70%"}]
     [:.form-control {:position :relative
                      :height :auto
                      :box-sizing :border-box
@@ -40,7 +43,7 @@
     (wrap-content-in-boilerplate bp req content)
     content))

-(defrecord BootstrapUserFormRenderer [login-prompt signup-prompt reset-pw-prompt]
+(defrecord BootstrapUserFormRenderer [login-prompt signup-prompt reset-pw-prompt totp-appname]
   LoginFormRenderer
   (render-login-form
     [this req model]
@@ -79,6 +82,12 @@

         [:button.btn.btn-lg.btn-primary.btn-block {:type "submit"} "Sign in"]

+        [:p]
+
+        [:div
+         (when-let [signup-uri (-> model :form :signup-uri)]
+           [:p.note  "Don't have an account? " [:a {:href signup-uri} "Sign up"]])]
+
         #_[:p]
         #_[:a {:href "#"} "Reset password"]
         ]])))
@@ -123,17 +132,24 @@
      (html
       [:div
        [:style (styles)]
-       (-> model :message)
-       [:form.form-signin {:role :form
-                           :method (-> model :form :method)
-                           :style "border: 1px dotted #555"
-                           :action (-> model :form :action)}
-
-
-        [:button.btn.btn-lg.btn-primary.btn-block {:type "submit"} "continue"]
-
-        ]])))
-
+       [:div
+        [:p (:name model) ", thank you for signing up. Your user-id is "
+         [:tt (:cylon/subject-identifier model)]]
+
+        (when-let [totp-secret (:totp-secret model)]
+          [:div
+           [:p "Please scan this image into your 2-factor authentication app"]
+           [:img {:src (totp/qr-code
+                        (format "%s@%s" (:cylon/subject-identifier model)
+                                totp-appname)
+                        totp-secret)}]
+           [:p "Alternatively, type in this secret into your authenticator application: "
+            [:code totp-secret]]])
+        [:p "We have sent you an email containing a personal verification code. Please check your email and click on the verification link contained in the email."]
+        [:div
+         [:p "Model..."]
+         [:pre (h (pr-str model))]]
+        [:p "Now proceed to " (path-for req :devices)]]])))

   EmailVerifiedRenderer
   (render-email-verified [this req model]
@@ -173,13 +189,11 @@

         [:button.btn.btn-lg.btn-primary.btn-block {:type "submit"} "Reset Pw"]

-        ]]))
-    )
-
-  )
+        ]]))))

 (def new-bootstrap-user-form-renderer-schema
   {(s/optional-key :boilerplate) (s/protocol ContentBoilerplate)
+   (s/optional-key :totp-appname) s/Str
    :login-prompt s/Str
    :signup-prompt s/Str
    :reset-pw-prompt s/Str})
@@ -189,7 +203,8 @@
    (->> opts
         (merge {:login-prompt "Please sign in&#8230"
                 :signup-prompt "Please sign up&#8230"
-                :reset-pw-prompt "Reset your password&#8230"})
+                :reset-pw-prompt "Reset your password&#8230"
+                :totp-appname "cylon"})
         (s/validate new-bootstrap-user-form-renderer-schema)
         map->BootstrapUserFormRenderer)
    [:boilerplate]))