Completing port to actually rendering the components into a detached DOM node

--- web-client/test/test_burgerboard/huh.cljs
+++ web-client/test/test_burgerboard/huh.cljs
@@ -14,19 +14,43 @@
   (apply t/do-report args)
   )

+(defn component-name [component]
+  ;; component is a function; this isn't really standardized JS, but
+  ;; it works in most browsers anyway.
+  (.-name component)
+  )
+
+(defn -sub-component [data owner]
+  (reify
+    om/IRender
+    (render [this]
+      (dom/div #js {:className "huh-sub-component"})
+      )
+    )
+  )
+
 (defn -instrument [sub-component cursor m]
-  (dom/div #js {:data-huh-sub-component sub-component
-                :data-huh-cursor (.stringify js/JSON cursor)
-                :data-huh-m (.stringify js/JSON m)})
+  (om/build* -sub-component
+             {}
+             {:init-state
+              {:sub-component sub-component
+               :cursor cursor
+               :m m}
+              })
   )

 (defn decode-sub-component [sub-component]
-  {:sub-component (js/eval (str "("
-                                (.getAttribute sub-component
-                                               "data-huh-sub-component")
-                                ")"))
-   :cursor (.parse js/JSON (.getAttribute sub-component "data-huh-cursor"))
-   :m (.parse js/JSON (.getAttribute sub-component "data-huh-m"))}
+  (let [state (om/get-state sub-component)]
+    {
+     :sub-component (:sub-component state)
+     :cursor @(:cursor state)
+     :m (:m state)
+     }
+    )
+  )
+
+(defn sub-component? [component]
+  (= (.. component -props -className))
   )

 (defn test-predicates
@@ -63,16 +87,31 @@
   ([component state m]
      (let [built-c (built-component component state m)
            dom-el (js/document.createElement "div")]
-       (.getDOMNode (js/React.renderComponent built-c dom-el))
+       (js/React.renderComponent built-c dom-el)
      ))
   )

-(defn get-child [component child]
-  (aget (.-children component) child)
-  )
-
-(defn in [component & accessors]
-  (reduce get-child component accessors)
+(defn children-of [component]
+  (let [actual-component (or (.. component -_renderedComponent) component)
+        children (.. actual-component -props -children)]
+    (cond
+     (= (type children) js/Array)
+     (js->clj children)
+     (= js/undefined children)
+     []
+     :else
+     [children]
+     )
+    )
+  )
+
+(defn in [component selector]
+  (let [component-node (.getDOMNode component)]
+    (if (= selector "")
+      component-node
+      (.querySelector component-node selector)
+      )
+    )
   )

 (defn -extract-m [tests]
@@ -94,21 +133,20 @@
   )

 (defn tag-name [component]
-  (cond
-   (fn? (.-getDisplayName component)) (.getDisplayName component)
-   (not (nil? (.-tagName component))) (lower-case (.-tagName component))
-   :else (.-type (.-props component))
-    )
-  )
-
-(defn component-name [component]
-  (.-name component)                    ; This isn't standard JS, but
-                                        ; works enough places, for now
+  (let [display-name (and (fn? (.-getDisplayName component))
+                          (.getDisplayName component))]
+    (cond
+     display-name display-name
+     (not (nil? (.-tagName component))) (lower-case (.-tagName component))
+     :else (.-type (.-props component))
+     )
+    )
   )

 (defn tag [expected-tag & tests]
   (fn -tag-pred [component]
-    (let [actual (tag-name component)]
+    (let [component-node (.getDOMNode component)
+          actual (tag-name component-node)]
       (if-not (= expected-tag actual)
         {:msg "Tag does not match" :expected expected-tag :actual actual}
         (if (empty? tests)
@@ -121,10 +159,7 @@
   )

 (defn multiple-components? [component]
-  (or
-   (= (type component) js/Array)
-   (sequential? component)
-   )
+  (sequential? component)
   )

 (declare display-children)
@@ -132,12 +167,14 @@
 (defn display-child
   ([component]
      (cond
-      (not (nil? (.-tagName component)))
+      (sub-component? component) {:sub-component
+                                  (component-name
+                                   (om/get-state component :sub-component))}
+      (not (nil? (.-props component)))
       {
-       :tag (.-tagName component)
-       :children (display-children (g-array/toArray (.. component -children)))
+       :tag (tag-name component)
+       :children (display-children (children-of component))
        }
-      (fn? component) {:sub-component (component-name component)}
       (string? component) {:text component}
       (satisfies? IDeref component) {:cursor @component}
       :else {:unknown "unknown"}
@@ -154,21 +191,21 @@

 (defn containing [& tests]
   (fn -containing-pred [component]
-    (let [children (g-array/toArray (.. component -children))
-          test-count (count tests)]
-      (let [child-count (.-length children)]
-        (if (not= test-count child-count)
-          {:msg "Wrong number of child elements"
-           :expected test-count :actual child-count
-           :actual-children (display-children children)}
-          (if-let [failures
-                   (seq (filter (fn [result] (not= true result))
-                                (map (fn [pred child] (pred child))
-                                     tests children
-                                     )))]
-            failures
-            true
-            )
+    (let [children (children-of component)
+          test-count (count tests)
+          child-count (count children)]
+      (if (not= test-count child-count)
+        {:msg "Wrong number of child elements"
+         :expected test-count :actual child-count
+         :actual-children (display-children children)
+         }
+        (if-let [failures
+                 (seq (filter (fn [result] (not= true result))
+                              (map (fn [pred child] (pred child))
+                                   tests children
+                                   )))]
+          failures
+          true
           )
         )
       )
@@ -177,7 +214,8 @@

 (defn with-text [text]
   (fn -text-pred [component]
-    (let [actual-text (.-textContent component)]
+    (let [component (.getDOMNode component)
+          actual-text (.-textContent component)]
       (if (= text actual-text)
         true
         {:msg "Text does not match" :expected text :actual actual-text}
@@ -217,7 +255,8 @@

 (defn with-class [class-name]
   (fn -with-class-pred [component]
-    (let [actual (.. component -className)]
+    (let [component (.getDOMNode component)
+          actual (.. component -className)]
       (if (.contains (.. component -classList) class-name)
         true
         {:msg "Class name does not match" :expected class-name :actual actual}
@@ -228,7 +267,8 @@

 (defn with-attr [attr-name attr-value]
   (fn -with-attr-pred [component]
-    (let [actual-value (.getAttribute component attr-name)]
+    (let [component (.getDOMNode component)
+          actual-value (.getAttribute component attr-name)]
       (if (= attr-value actual-value)
         true
         {:msg "Attribute value does not match"
@@ -239,8 +279,8 @@
     )
   )

-(defn after-event [event-attr event-arg component callback]
+(defn after-event [event-attr event-arg dom-node callback]
   ((aget js/React.addons.TestUtils.Simulate (name event-attr))
-   component event-arg)
-  (callback component)
-  )
+   dom-node event-arg)
+  (callback dom-node)
+  )


report generation should not create new math_tick now

--- src/polismath/conv_man.clj
+++ src/polismath/conv_man.clj
@@ -269,14 +269,13 @@

 (defmethod react-to-messages :generate_report_data
   [conv-man conv _ messages]
-  (let [math-tick (postgres/inc-math-tick (:postgres conv-man) (:zid conv))
-        ;; ideally a new upload wouldn't be necessary if convergence had been reached; can optimize this later
-        updated-conv (conv-update conv-man conv [])]
+  (let [math-tick (or (:math-tick conv) (:math_tick conv))]
     (doseq [report-task messages]
       (try
-        (generate-report-data! conv-man updated-conv math-tick report-task)
-        (catch Exception e (log/error e (str "Unable to generate report " (pr-str report-task))))))
-    (assoc updated-conv :math-tick math-tick)))
+        (generate-report-data! conv-man conv math-tick report-task)
+        (catch Exception e (log/error e (str "Unable to generate report " (pr-str report-task)))))))
+  ;; explicitly return nil so we don't trigger an update
+  nil)

 ;; Error handling


avoiding confusion

avoiding confusion

--- src/proxmox/generators.clj
+++ src/proxmox/generators.clj
@@ -134,12 +134,12 @@
   (wcar
     (when ip
      (car/lua-script
-      "if redis.call('zrank', 'ips', _:ip) then
-        redis.call('zadd', 'ips', 0, _:ip)
-        return _:ip
+      "if redis.call('zrank', 'ips', _:rel-ip) then
+        redis.call('zadd', 'ips', 0, _:rel-ip)
+        return _:rel-ip
        end
        return nil "
-      {:ips "ips"} {:ip (ip-to-long ip)}))))
+      {:ips "ips"} {:rel-ip (ip-to-long ip)}))))

 (comment
   (release-ip "192.168.5.130")


remove the ios notification banner for enterprise customers

--- src-cljs/frontend/components/opt_in.cljs
+++ src-cljs/frontend/components/opt_in.cljs
@@ -2,6 +2,7 @@
   (:require [om.core :as om :include-macros true]
             [cljs-time.coerce :as t-coerce]
             [cljs-time.core :as t]
+            [frontend.config :as config]
             [frontend.async :refer [raise!]]
             [frontend.components.forms :refer [managed-button]])
   (:require-macros [frontend.utils :refer [html]]))
@@ -39,11 +40,12 @@
     om/IRender
     (render [_]
       (html
-       [:div.ui-v2-opt-in {}
-        [:div.ui-v2-opt-in-wrapper
-         [:div
-          "As a reminder, the iOS beta has ended as of Monday, November 30th. If you have not done so already, please confirm a plan to lock pricing in and ensure a smooth transition to the limited release "
-          [:a {:href "http://circleci.com/account/plans"} "here"]
-          ". Reach out to "
-          [:a {:href "mailto:sayhi@circleci.com"} "sayhi@circleci.com"]
-          " with any questions!"]]]))))
+        (when (not (config/enterprise?))
+          [:div.ui-v2-opt-in {}
+           [:div.ui-v2-opt-in-wrapper
+            [:div
+             "As a reminder, the iOS beta has ended as of Monday, November 30th. If you have not done so already, please confirm a plan to lock pricing in and ensure a smooth transition to the limited release "
+             [:a {:href "http://circleci.com/account/plans"} "here"]
+             ". Reach out to "
+             [:a {:href "mailto:sayhi@circleci.com"} "sayhi@circleci.com"]
+             " with any questions!"]]])))))


beginnings of reflexive support en español

--- src/babel/espanol/morphology/verbs.clj
+++ src/babel/espanol/morphology/verbs.clj
@@ -9,10 +9,14 @@
 (require '[clojure.tools.logging :as log])
 (require '[dag-unify.core :refer (copy dissoc-paths fail? get-in merge ref? strip-refs unifyc)])

+(defn reflexive-to-infinitive [reflexive-infinitive]
+  "e.g.: quedarse -> quedar"
+  (string/replace reflexive-infinitive #"se$" ""))
+
 (defn conditional [word  & [ {usted :usted
                               vosotros :vosotros
                               ustedes :ustedes}]]
-  (let [infinitive (get-in word '(:espanol))
+  (let [infinitive (reflexive-to-infinitive (get-in word '[:espanol]))
         ar-type (try (re-find #"ar$" infinitive)
                      (catch Exception e
                        (throw (Exception. (str "Can't regex-find on non-string: " infinitive " from word: " word)))))


fix bug with autocomplete chan

fix bug with autocomplete chan

--- src/chat/client/views/new_message.cljs
+++ src/chat/client/views/new_message.cljs
@@ -156,9 +156,9 @@
     om/IWillUpdate
     (will-update [_ next-props next-state]
       (let [next-text (next-state :text)
-            prev-text (om/get-render-state owner :text)]
-        (when (not= next-text prev-text)
-          (put! (om/get-state owner :autocomplete-chan) next-text))))
+              prev-text (om/get-render-state owner :text)]
+          (when (not= next-text prev-text)
+            (put! (next-state :autocomplete-chan) next-text))))
     om/IRenderState
     (render-state [_ {:keys [results text force-close? highlighted-result-index] :as state}]
       (let [constrain (fn [x a z] (Math/min z (Math/max a x)))
@@ -178,10 +178,12 @@
               (highlight-clear!))
             reset-state!
             (fn []
-              (om/set-state! owner
-                             {:text ""
-                              :force-close? false
-                              :highlighted-result-index -1}))
+              (om/update-state! owner
+                             (fn [s]
+                               (merge s
+                                      {:text ""
+                                       :force-close? false
+                                       :highlighted-result-index -1}))))
             send-message!
             (fn []
               (dispatch! :new-message {:thread-id (config :thread-id)


Add the ability to actions subsystem pass payload.

Signed-off-by: Andrey Antukh <8e6a32ae7580b30ec348e03f34a0953d9b475a56@niwi.nz>

--- src/uxbox/ui/core.cljs
+++ src/uxbox/ui/core.cljs
@@ -8,14 +8,22 @@
 (defonce actions-lock (atom :nothing))
 (defonce actions-s (rx/bus))

+;; TODO: implement that as multimethod for add specific validation
+;; layer for different kind of action payloads
+
 (defn acquire-action!
-  [type]
-  (when-let [result (compare-and-set! actions-lock :nothing type)]
-    ;; (println "acquire-action!" type)
-    (rx/push! actions-s type)))
+  ([type]
+   (acquire-action! type nil))
+  ([type payload]
+   (when-let [result (compare-and-set! actions-lock :nothing type)]
+     (rx/push! actions-s {:type type :payload payload}))))

 (defn release-action!
   [type]
   (when-let [result (compare-and-set! actions-lock type :nothing)]
-    ;; (println "release-action!" type)
-    (rx/push! actions-s :nothing)))
+    (rx/push! actions-s {:type :nothing})))
+
+(defn release-all-actions!
+  []
+  (reset! actions-lock :nothing)
+  (rx/push! actions-s {:type :nothing}))


Added Event Source wrapper

Added Event Source wrapper

--- src/cljs/funnel_front/lib/helpers.cljs
+++ src/cljs/funnel_front/lib/helpers.cljs
@@ -3,3 +3,8 @@
 ;; https://groups.google.com/forum/#!topic/clojure/ghHqHuXE0pY
 (defn clog! [to-print]
   (.log js/console (pr-str to-print)))
+
+(defn event-source [route callback]
+  (let [source (js/EventSource. route)]
+    (set! (.-onmessage source) callback)
+    source))


CMR-760: Changed code to use child element instead of attribute for 'inherited' in atom links.

--- src/cmr/search/results_handlers/atom_results_handler.clj
+++ src/cmr/search/results_handlers/atom_results_handler.clj
@@ -242,7 +242,9 @@
   [atom-link]
   (let [{:keys [href link-type title mime-type size inherited]} atom-link
         attribs (-> {}
-                    (add-attribs :inherited inherited)
+                    ;; TODO remove or uncomment the next line depending on whether or not
+                    ;; we want to keep the 'inherited' attribute (See CMR-637).
+                    ;(add-attribs :inherited inherited)
                     (add-attribs :length size)
                     (add-attribs :rel (link-type->link-type-uri (keyword link-type)))
                     (add-attribs :type mime-type)
@@ -254,7 +256,9 @@
 (defn- atom-link->xml-element
   "Convert an atom link to an XML element"
   [atom-link]
-  (x/element :link (atom-link->attribute-map atom-link)))
+  (x/element :link (atom-link->attribute-map atom-link)
+             (when (:inherited atom-link)
+               (x/element :inherited))))

 (defn- ocsd->attribute-map
   "Convert an oribt calculated spatial domain to attributes for an XML element"


Redraw embed map every 15 seconds

Redraw embed map every 15 seconds

--- src/cljs/salava/location/ui/embed.cljs
+++ src/cljs/salava/location/ui/embed.cljs
@@ -124,7 +124,9 @@

          (.addTo layer-group my-map)
          (.on my-map "moveend" redraw-map!)
-         (get-markers "badges" my-map layer-group (or (-> (:query-params @state) (dissoc :lat :long)) {}))))}))
+         (get-markers "badges" my-map layer-group (or (-> (:query-params @state) (dissoc :lat :long)) {}))
+         (.setInterval js/window #(memoize (redraw-map!)) 15000)))}))
+

 (defn input-button [name id textatom]
  (let [status (atom "")]


Add deps task to show the dependency tree, closes #2

--- resources/leiningen/new/lambone/common/build.boot
+++ resources/leiningen/new/lambone/common/build.boot
@@ -274,8 +274,18 @@
       <% if any backend %>:backend (test-backend)<% endif %>
       <% if any frontend %>:frontend (test-frontend)<% endif %><% if all backend frontend %>
       (comp (test-backend)
-            (test-frontend)))))
-<% endif %><% if not all backend frontend %>(test-backend))))<% endif %>
+            (test-frontend)))))<% endif %><% if not all backend frontend %>(test-backend))))<% endif %>
+
+(deftask deps
+  "Show the dependency tree
+
+  If no -f|--flavor is specified it will be read from BOOT_BUILD_FLAVOR.
+  If no -t|--type is specified the task will assume :prod."
+  [f flavor VAL kw   "The flavor"
+   t type   VAL kw   "The build type, either prod or dev"]
+  (let [type (or type :prod)
+        flavor (or flavor (keyword (get (env/env) "BOOT_BUILD_FLAVOR")))]
+    (boot/deps (boot/options [flavor type]))))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;  see dev/boot.clj for task customization  ;;


Added Beanstalk note

Added Beanstalk note

--- 2-collectors/clojure-collector/project.clj
+++ 2-collectors/clojure-collector/project.clj
@@ -14,7 +14,7 @@
 ;;;; License:   Apache License Version 2.0

 (defproject com.snowplowanalytics/clojure-collector "0.1.0"
-  :description "A SnowPlow event collector written in Clojure"
+  :description "A SnowPlow event collector written in Clojure. AWS Elastic Beanstalk compatible."
   :dependencies [[org.clojure/clojure "1.4.0"]
                  [compojure "1.1.3"]
                  [ring "1.1.6"]


Cleaning up startup code

Cleaning up startup code

Still a problem with closing the gui, though.

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

--- src/scripts/conexp-clj.clj
+++ src/scripts/conexp-clj.clj
@@ -17,31 +17,30 @@
                                   ["--gui"  "Start the graphical user interface"]
                                   ["--load" "Load a given script"]
                                   ["--help" "This help"])]
-  ;;
-  (when (contains? options :help)
+  (cond
+    ;;
+    (contains? options :help)
     (println doc)
-    (System/exit 0))
-  ;;
-  (when (contains? options :gui)
+    ;;
+    (contains? options :gui)
     (binding [conexp.contrib.gui.repl-utils/*main-frame*
               (conexp.contrib.gui/gui :default-close-operation :exit)]
       (reply/launch-standalone
        {:custom-eval '(do
                         (use 'conexp.main)
                         (use 'clojure.repl)
-                        (require '[conexp.contrib.gui.repl-utils :as gui]))})))
-  ;;
-  (when (contains? options :load)
-    (when (not (options :load))
-      (println "Error: --load requires a file to load")
-      (println doc)
-      (System/exit 1))
-    (load-file (options :load)))
-  ;;
-  (when-not (or (options :gui)
-                (options :load))
-    (reply/launch-standalone
-     {:custom-eval '(do (use 'conexp.main) (use 'clojure.repl))})))
+                        (require '[conexp.contrib.gui.repl-utils :as gui]))}))
+    ;;
+    (contains? options :load)
+    (do (when (not (options :load))
+          (println "Error: --load requires a file to load")
+          (println doc)
+          (System/exit 1))
+        (load-file (options :load)))
+    ;;
+    true
+    (do (reply/launch-standalone
+         {:custom-eval '(do (use 'conexp.main) (use 'clojure.repl))}))))

 (System/exit 0)


Messed up last change.

Messed up last change.

--- src/midje/parsing/1_to_explicit_form/parse_background.clj
+++ src/midje/parsing/1_to_explicit_form/parse_background.clj
@@ -29,15 +29,15 @@

 (defn separate-extractable-background-changers [fact-body-forms]
   (letfn [(definitely-extractable-form? [form]
-            (any? (partial first-named? form) ["prerequisite" "prerequisites"
-                                               "background"
-                                               "with-state-changes"]))
+            (any? (partial first-named? form) ["prerequisite" "prerequisites" "background"]))
+          (possibly-extractable-form? [form]
+            (any? (partial first-named? form) ["against-background" "with-state-changes"]))
           (has-wrapper-syntax? [form]
             (and (> (count form) 2)
                  (vector? (second form))))
           (extractable-background-changer? [form]
             (cond (definitely-extractable-form? form) true
-                  (not (first-named? form "against-background")) false
+                  (not (possibly-extractable-form? form)) false
                   (has-wrapper-syntax? form) false
                   :else true))]
     (let [[background-forms other-forms] (separate extractable-background-changer? fact-body-forms)


No longer specifying tiles, countries for DynamicTimeseries pails

--- src/clj/forma/hadoop/jobs/timeseries.clj
+++ src/clj/forma/hadoop/jobs/timeseries.clj
@@ -75,13 +75,10 @@

 (defmain DynamicTimeseries
   "TODO: Process a pattern, here"
-  [source-pail-path ts-pail-path s-res t-res datasets & countries]
+  [source-pail-path ts-pail-path s-res t-res datasets]
   {:pre [(vector? (read-string datasets))]}
-  (->> (for [dset  (read-string datasets)
-             [h v] (->> countries
-                        (map read-string)
-                        (apply tile-set))]
-         [dset (format "%s-%s" s-res t-res) (r/hv->tilestring h v)])
+  (->> (for [dset  (read-string datasets)]
+         [dset (format "%s-%s" s-res t-res)])
        (tseries-query source-pail-path)
        (pail/to-pail ts-pail-path)))


Ikke vis lenke i emojifisert kaffe er klar melding

--- src/clj/mokkameister/resources/slack.clj
+++ src/clj/mokkameister/resources/slack.clj
@@ -67,7 +67,7 @@
     (persist-brew! event)
     (pusher/push! "coffee" "coffee" now-msg)
     (slack/notify (str now-msg " - " mokkameister-link) :channel channel)
-    (slack/delayed-notify time-ms (str later-msg " - " mokkameister-link) :channel channel)))
+    (slack/delayed-notify time-ms later-msg :channel channel)))

 (defn parse-slack-coffee-event [{:keys [channel_id text user_name]}]
   (let [event {:channel    channel_id


use origin-event timestamp for time/timestamp

--- src/cljx/jamesmacaulay/zelkova/time.cljx
+++ src/cljx/jamesmacaulay/zelkova/time.cljx
@@ -59,13 +59,17 @@
   [ms]
   (z/input (t/now) [::every ms] (every-channel-fn ms)))

+(def ^:private timestamp-vector
+  (juxt (comp impl/timestamp impl/origin-event)
+        impl/value))
+
 (defn timestamp
   [sig]
   (impl/make-signal {:init [0 (impl/init sig)]
                      :sources [sig]
                      :msg-fn (fn [_ [msg]]
                                (when (impl/fresh? msg)
-                                 (impl/fresh [(t/now) (impl/value msg)])))}))
+                                 (impl/fresh (timestamp-vector msg))))}))

 #+cljs
 (defn delay


Fixing failing integration tests.

Fixing failing integration tests.

--- system-int-test/src/cmr/system_int_test/data2/granule.clj
+++ system-int-test/src/cmr/system_int_test/data2/granule.clj
@@ -33,7 +33,7 @@
 (defn sensor-ref
   "Return a sensor-ref based on sensor short-name"
   [sensor-sn]
-  (g/->SensorRef sensor-sn))
+  (g/map->SensorRef {:short-name sensor-sn}))

 (defn instrument-ref
   "Return an instrument-ref based on instrument attribs"


add codec 2 in test

add codec 2 in test

--- kafka-clj/test/kafka_clj/integration_v2_counts.clj
+++ kafka-clj/test/kafka_clj/integration_v2_counts.clj
@@ -37,7 +37,7 @@

 (with-state-changes
   [ (before :facts (do (reset! state-ref (startup-resources test-topic))
-                       (reset! client-ref (create-connector (get-in @state-ref [:kafka :brokers]) {:flush-on-write true}))
+                       (reset! client-ref (create-connector (get-in @state-ref [:kafka :brokers]) {:flush-on-write true :codec 2}))
                        (reset! node-ref (create-node!
                                           {:bootstrap-brokers (get-in @state-ref [:kafka :brokers])
                                            :redis-conf {:host "localhost"


fix tests

fix tests

--- test/metabase/driver/generic_sql/query_processor_test.clj
+++ test/metabase/driver/generic_sql/query_processor_test.clj
@@ -217,7 +217,8 @@
                                            (field->id :checkins :user_id)
                                            (field->id :checkins :id)]
                                   :order_by [[(field->id :checkins :venue_id) "ascending"]
-                                             [(field->id :checkins :user_id) "descending"]]}}))
+                                             [(field->id :checkins :user_id) "descending"]
+                                             [(field->id :checkins :id) "ascending"]]}}))

 ;; ## "FILTER" CLAUSE
 (expect {:status :completed,


Moved mustache spec URL back to the main repo, since they merged in the Clojure lambdas.

--- src/stencil/cake/tasks.clj
+++ src/stencil/cake/tasks.clj
@@ -5,7 +5,7 @@
         [bake.core :only [log]])
   (:import [org.apache.tools.ant.taskdefs Delete]))

-(def repo-url "https://github.com/davidsantiago/spec.git")
+(def repo-url "https://github.com/mustache/spec.git")
 (def spec-loc "test/spec")

 (defn spec-present?


Avoid clojure.lang.BigInt as literal to support 1.2.x

--- src/main/clojure/clojure/data/json.clj
+++ src/main/clojure/clojure/data/json.clj
@@ -366,10 +366,10 @@
 (extend java.math.BigInteger   JSONWriter {:-write write-bignum})
 (extend java.math.BigDecimal   JSONWriter {:-write write-bignum})
 ;; Attempt to support Clojure 1.2.x:
-(when (try (.. Thread currentThread getContextClassLoader
-               (loadClass "clojure.lang.BigInt"))
-           (catch ClassNotFoundException _ false))
-  (extend clojure.lang.BigInt    JSONWriter {:-write write-bignum}))
+(when-let [class (try (.. Thread currentThread getContextClassLoader
+                          (loadClass "clojure.lang.BigInt"))
+                      (catch ClassNotFoundException _ false))]
+  (extend class JSONWriter {:-write write-bignum}))

 ;; Symbols, Keywords, and Strings


Refactor direct scneario handling and add pmap version.


Fix main.

Fix main.


Rename all-items to items.

Rename all-items to items.


[scamp] add dropping of duplicate messages

--- modules/scamp/src/scamp/core.clj
+++ modules/scamp/src/scamp/core.clj
@@ -35,7 +35,8 @@
 (def NetworkedNodeSchema
   {:self NodeCoreSchema
    :upstream NodeNeighborsSchema
-   :downstream NodeNeighborsSchema})
+   :downstream NodeNeighborsSchema
+   :messages-seen {MessageEnvelopeIdSchema s/Int}})

 (def MessageTypeSchema
   (s/enum :forwarded-subscription))
@@ -74,6 +75,7 @@

 (def WorldConfigSchema
   {:connection-redundancy s/Int
+   :message-dup-drop-after s/Int
    :logging {s/Keyword s/Any}})

 (def WorldSchema
@@ -99,6 +101,7 @@
 (def default-config
   {;; :c :connection-redundancy
    :connection-redundancy 2 ;; Emperically determined by [1]
+   :message-dup-drop-after 10 ;; Empirically determined by [1]
    :logging (assoc timbre/*config*
                    :level :debug)
    }
@@ -147,12 +150,19 @@
    :post [(string? %)]}
   (:id node))

+(s/defn networked-node->node-contact-address :- NodeContactAddressSchema
+  [node :- NetworkedNodeSchema]
+  (-> node
+      :self
+      node->node-contact-address))
+
 (s/defn node-contact-address->node :- NetworkedNodeSchema
   "Take a node-contact-address, return a networked-node structure."
   [node-contact-address :- NodeContactAddressSchema]
   {:self {:id node-contact-address}
    :upstream #{}
-   :downstream #{}})
+   :downstream #{}
+   :messages-seen {}})

 (s/defn init-new-subscriber :- NetworkedNodeSchema
   "Take a 'subscriber-address for a new subscriber, and the
@@ -203,12 +213,14 @@
   (< (*rand*) cutoff))

 (s/defn forward-subscription :- [MessageEnvelopeSchema]
-  "Take a node's 'downstream map and a new 'subscription.
+  "Take a node's 'downstream map, a new 'subscription, and the
+  'envelope-id.

   Return a seq of message-envelopes that communicate the forwarded
   subscription."
   [downstream :- NodeNeighborsSchema
-   subscription :- SubscriptionSchema]
+   subscription :- SubscriptionSchema
+   envelope-id :- MessageEnvelopeIdSchema]
   {:post [(vector? %)]}
   (if (empty? downstream)
     []
@@ -216,7 +228,7 @@
       (rand-nth* (seq downstream))
       :forwarded-subscription
       subscription
-      (get-envelope-id)]]))
+      envelope-id]]))

 (defn handle-add-upstream
   "Take a node (?) and a new upstream 'id, and add the upstream node to this node's :upstream."
@@ -232,7 +244,8 @@
   Return a vector matching the CommUpdateSchema."
   [logging-config
    {:keys [downstream] :as node} :- NetworkedNodeSchema
-   subscriber-contact-address :- NodeContactAddressSchema]
+   subscriber-contact-address :- NodeContactAddressSchema
+   envelope-id :- MessageEnvelopeIdSchema]
   (timbre/log* logging-config :trace
                :handle-forwarded-subscription
                :node node
@@ -245,7 +258,8 @@
      [#_(handle-add-upstream id (:id node))]]

     (let [forwarded-subscription-messages (forward-subscription downstream
-                                                                subscriber-contact-address)]
+                                                                subscriber-contact-address
+                                                                envelope-id)]
       (when (empty? forwarded-subscription-messages)
         (throw (ex-info "Failed either to accept or forward subscription"
                         {:node node :subscriber-contact-address subscriber-contact-address})))
@@ -303,20 +317,38 @@
 (defn read-mail
   "Take a 'destination-node and a 'message.

-  Process the message for 'destination-node and return a tuple of:
-  [new-destination-node [new-message ...]]"
-  [logging-config destination-node [message-type message-body]]
+  Process the message for 'destination-node and return a vector
+  matching 'CommUpdateSchema.
+
+  If this envelope has been seen too many times by 'destination-node
+  (as configured by :message-dup-drop-after in 'config), then ignore
+  the message."
+  [{:keys [logging message-dup-drop-after] :as config}
+   destination-node :- NetworkedNodeSchema
+   [message-type message-body envelope-id]]
   {:post [(vector? %) (-> % first map?) (-> % second vector?)]}
-  (timbre/log* logging-config :trace
+  (timbre/log* logging :trace
                :read-mail
                :destination-node destination-node
                :message-type message-type
-               :message-body message-body)
-  (condp = message-type
-    :forwarded-subscription (handle-forwarded-subscription logging-config
-                                                           destination-node
-                                                           message-body)
-    (println :read-mail "Unknown message type (" message-type "): " message-body)))
+               :message-body message-body
+               :envelope-id envelope-id)
+  (let [destination-node (update-in destination-node [:messages-seen envelope-id] #(if % (inc %) 1))]
+    (if (< (get-in destination-node [:messages-seen envelope-id])
+           message-dup-drop-after)
+      (condp = message-type
+        :add-upstream (handle-add-upstream logging destination-node message-body)
+        :forwarded-subscription (handle-forwarded-subscription logging
+                                                               destination-node
+                                                               message-body
+                                                               envelope-id)
+        (println :read-mail "Unknown message type (" message-type "): " message-body))
+      (do
+        (timbre/log* logging :trace
+                     :read-mail-dropping-dup
+                     :destination-node destination-node
+                     :envelope-id envelope-id)
+        [destination-node []]))))

 (defn do-comm
   "Take 'world. Process one message. Return new 'world."


Generic primitive-kind--to--string mapping

Moreover the else-branches of:
  (if (= kind :axiom) "axiom" "primitive")
and:
  (if (= kind :axiom) "Axiom" "Lemma")
are dead, since there's just a single invocation of the handle-axiom from L206:
  (handle-defaxiom :axiom ax-name doc params body)


fix(swt): fix bad calls to swt/ui in ccw.repl.view-helpers

--- ccw.core/src/clj/ccw/repl/view_helpers.clj
+++ ccw.core/src/clj/ccw/repl/view_helpers.clj
@@ -57,25 +57,25 @@
 (defn log
   [^ccw.repl.REPLView repl-view ^StyledText log ^String s type]
   (ui-sync
-    (let [charcnt (.getCharCount log)
-          [log-style highlight-background] (get log-styles type [default-log-style nil])
+    #(let [charcnt (.getCharCount log)
+           [log-style highlight-background] (get log-styles type [default-log-style nil])
            linecnt (.getLineCount log)
            new-content (if (re-find #"(\n|\r)$" s) s (str s \newline))]
-      ; Add styles before adding text to the log panel
-      (when-not (= :skip log-style)
-        (let [style (log-style charcnt (.length new-content))]
-          (-> repl-view .logPanelStyleCache (.setStyleRange style))))
-      (.append log new-content)
-      (doto log
-        cursor-at-end
-        .showSelection)
-      (when highlight-background
-        (.setLineBackground log (dec linecnt) (- (.getLineCount log) linecnt)
-          (ccw.CCWPlugin/getColor
-            ;; We use RGB color because we cannot take the Color directly since
-            ;; we do not "own" it (it would be disposed when colors are changed
-            ;; from the preferences, not good)
-            (-> repl-view .logPanelEditorColors .fCurrentLineBackgroundColor .getRGB)))))))
+       ; Add styles before adding text to the log panel
+       (when-not (= :skip log-style)
+         (let [style (log-style charcnt (.length new-content))]
+           (-> repl-view .logPanelStyleCache (.setStyleRange style))))
+       (.append log new-content)
+       (doto log
+         cursor-at-end
+         .showSelection)
+       (when highlight-background
+         (.setLineBackground log (dec linecnt) (- (.getLineCount log) linecnt)
+           (ccw.CCWPlugin/getColor
+             ;; We use RGB color because we cannot take the Color directly since
+             ;; we do not "own" it (it would be disposed when colors are changed
+             ;; from the preferences, not good)
+             (-> repl-view .logPanelEditorColors .fCurrentLineBackgroundColor .getRGB)))))))

 (defn eval-failure-msg
   [status s]
@@ -92,15 +92,16 @@
     (doseq [{:keys [out err value ns status] :as resp} responses]
       (evt/post-event :ccw.repl.response resp)
       (ui-sync
-        (when ns (.setCurrentNamespace repl-view ns))
-        (doseq [[k v] (dissoc resp :id :ns :status :session)
-                :when (log-styles k)]
-          (log repl-view log-component v k))
-        (doseq [status status]
-          (case status
-            "interrupted" (log repl-view log-component (eval-failure-msg status expr) :err)
-            "need-input" (.getStdIn repl-view)
-            nil))))))
+        #(do
+           (when ns (.setCurrentNamespace repl-view ns))
+           (doseq [[k v] (dissoc resp :id :ns :status :session)
+                   :when (log-styles k)]
+             (log repl-view log-component v k))
+           (doseq [status status]
+             (case status
+               "interrupted" (log repl-view log-component (eval-failure-msg status expr) :err)
+               "need-input" (.getStdIn repl-view)
+               nil)))))))

 (defn eval-expression
   "evaluate expression. Will use the current value for use-pprint and pprint-right-margin


Flesh out TaggedValue tests.

Flesh out TaggedValue tests.

--- test/puget/printer_test.clj
+++ test/puget/printer_test.clj
@@ -115,10 +115,14 @@

 (deftest canonical-tagged-value
-  (let [tval (reify TaggedValue
-               (edn-tag [this] 'foo)
-               (edn-value [this] :bar/baz))
-        doc (canonize tval)]))
+  (let [tv (reify TaggedValue
+             (edn-tag [this] 'foo)
+             (edn-value [this] :bar/baz))]
+    (is (= "#foo :bar/baz" (pprint-str tv))))
+  (let [tv (reify TaggedValue
+             (edn-tag [this] 'frobble/biznar)
+             (edn-value [this] [:foo :bar :baz]))]
+    (is (= "#frobble/biznar\n[:foo :bar :baz]" (pprint-str tv)))))

 (deftest default-canonize


fix url for 2016 (consultant.ru)

fix url for 2016 (consultant.ru)

--- src/cljs_workcalendar/datasource/consultantru.clj
+++ src/cljs_workcalendar/datasource/consultantru.clj
@@ -57,7 +57,7 @@
   ConsultantRuWorkCalendarSource
   (get-work-calendar [this]
     (concat (get-work-calendar-for-year 2016
-                                        "http://www.consultant.ru/law/ref/calendar/proizvodstvennye/")
+                                        "http://www.consultant.ru/law/ref/calendar/proizvodstvennye/2016")
             (get-work-calendar-for-year 2015
                                         "http://www.consultant.ru/law/ref/calendar/proizvodstvennye/2015/")
             (get-work-calendar-for-year 2014


Removes sneaky prints

Removes sneaky prints

--- src/wordsmith/core.cljs
+++ src/wordsmith/core.cljs
@@ -87,7 +87,6 @@
 ;; The main app

 (defn save-document [app]
-  (println (p/get-all-titles))
   (om/update! app :last-saved (js/Date.))
   (p/set-document (:title @app) (:input @app))
   (om/update! app :titles (p/get-all-titles)))
@@ -104,7 +103,6 @@
             (recur)))))
     om/IRender
     (render [_]
-            (println (:titles app))
       (dom/div #js {:className "container"}
         (om/build title-field app)
         (om/build save-button app)


Fix final csv output.

Fix final csv output.

--- src/oc/storage/representations/org.clj
+++ src/oc/storage/representations/org.clj
@@ -324,8 +324,7 @@

 (defn render-wrt-csv
   [org entries-list]
-  (let [computed-entries (mapv #(hash-map :entry (:entry %) :reads (doall (:reads %))) entries-list)
-        csv-entries (mapv (fn [{entry :entry reads :reads}]
+  (let [csv-entries (mapv (fn [{entry :entry reads :reads}]
                             (s/join "\n" [(str "Title: " (:headline entry))
                                           (str "Published on: " (lib-time/csv-date (:published-at entry)))
                                           (str "Link: " (:url entry))
@@ -339,6 +338,6 @@
                                                                          csv-empty-val)])
                                                         reads))
                                           "\n"]))
-                          computed-entries)
+                          entries-list)
         csv-intro (str "Analytics for " (:name org) " generated on " (lib-time/csv-date) "\n")]
-    (s/join "\n" (vec (cons csv-entries csv-intro)))))+    (s/join "\n" (vec (cons csv-intro csv-entries)))))


Function to read all possible sources for word(s)

--- src/zg/db_interface.clj
+++ src/zg/db_interface.clj
@@ -184,3 +184,12 @@
             (log/error e "read changes for user" user-name)
             [])))

+(defn read-sources
+    []
+    (try
+        (jdbc/query db-spec/zg-db
+                        ["select id, source from dictionary order by source"])
+        (catch Exception e
+            (log/error e "read sources")
+            [])))
+


add assertion that spec must be map

add assertion that spec must be map

--- src/org/martinklepsch/derivatives.cljc
+++ src/org/martinklepsch/derivatives.cljc
@@ -65,6 +65,7 @@
     is no longer needed by `token`, if there are no more tokens needing
     the derivative it will be removed"
   [spec]
+  {:pre [(map? spec)]}
   (let [graph (spec->graph spec)
         state (atom {:registry   {}
                      :dervatives {}})
@@ -119,7 +120,7 @@
     "Rum mixin to retrieve a derivative for `:drv-k` using the functions in the component context
      To get the derived-atom use `get-ref` for swappable client/server behavior"
     [drv-k]
-    #?(:cljs
+    #?(:cljs
        (let [token (rand-int 10000)] ;TODO
          {:class-properties {:contextTypes {get-k     js/React.PropTypes.func
                                             release-k js/React.PropTypes.func}}


fit in an int

fit in an int

--- src/org/spootnik/cyanite/es_client.clj
+++ src/org/spootnik/cyanite/es_client.clj
@@ -11,7 +11,7 @@
             [clojure.tools.logging :refer [error info debug]])
   (:import clojurewerkz.elastisch.rest.Connection))

-(def buf-size (* 4096 1024 1024))
+(def buf-size (* 4096 1024))

 (defn multi-get
   [^Connection conn index mapping-type query func]


(PDB-4938) Deliver promise after initial gc

Add a promise to shared-globals that is delivered after the initial
garbage collection finishes. On the PE side, we will wait on that
promise to start the initial sync.

--- src/puppetlabs/puppetdb/cli/services.clj
+++ src/puppetlabs/puppetdb/cli/services.clj
@@ -839,7 +839,7 @@

 (defn start-garbage-collection
   [{:keys [clean-lock stop-status] :as context}
-   job-pool db-configs db-pools db-lock-statuses shutdown-for-ex]
+   job-pool db-configs db-pools db-lock-statuses shutdown-for-ex finished-initial-gc]
   (doseq [[cfg db lock-status] (map vector db-configs db-pools db-lock-statuses)
           :let [interval (to-millis (:gc-interval cfg))]
           :when (pos? interval)]
@@ -849,11 +849,12 @@
                (with-nonfatal-exceptions-suppressed
                  (with-monitored-execution shutdown-for-ex
                    (let [incremental? (not @first?)]
-                     (when-not incremental?
-                       (reset! first? false))
                      (coordinate-gc-with-shutdown db clean-lock cfg lock-status
                                                   request stop-status
-                                                  incremental?)))))]
+                                                  incremental?)
+                     (when-not incremental?
+                       (reset! first? false)
+                       (deliver finished-initial-gc true))))))]
       (interspaced interval #(invoke-periodic-gc gc initial-gc?) job-pool))))

 (defn database-lock-status []
@@ -929,7 +930,8 @@
                    _ write-db-pools :error close-write-dbs

                    write-db-lock-statuses (repeatedly (count write-db-pools)
-                                                      database-lock-status)]
+                                                      database-lock-status)
+                   initial-gc-finished? (promise)]

         (init-metrics read-db write-db-pools)

@@ -942,7 +944,8 @@
                              shutdown-for-ex)
         (start-garbage-collection context job-pool
                                   write-db-cfgs write-db-pools write-db-lock-statuses
-                                  shutdown-for-ex)
+                                  shutdown-for-ex
+                                  initial-gc-finished?)

         (-> context
             (assoc :job-pool job-pool
@@ -953,6 +956,7 @@
                      :dlo dlo
                      :maybe-send-cmd-event! maybe-send-cmd-event!
                      :q q
+                     :initial-gc-finished? initial-gc-finished?
                      :scf-read-db read-db
                      :scf-write-dbs write-db-pools
                      :scf-write-db-cfgs write-db-cfgs


fix repos

fix repos

--- storm-kafka/project.clj
+++ storm-kafka/project.clj
@@ -1,14 +1,13 @@
-(defproject storm/storm-kafka "0.7.3-dynamic-SNAPSHOT"
+(defproject storm/storm-kafka "0.7.3-dynamic-storm8-SNAPSHOT"
   :source-path "src/clj"
   :java-source-path "src/jvm"
   :javac-options {:debug "true" :fork "true"}
   :repositories {"releases" "http://artifactory.local.twitter.com/libs-releases-local"
-                 "snapshots" "http://artifactory.local.twitter.com/libs-snapshots-local"
-                 "artifactory" "http://artifactory.local.twitter.com/repo"}
+                 "snapshots" "http://artifactory.local.twitter.com/libs-snapshots-local"}
   :dependencies [[storm/kafka "0.7.0-incubating"
                    :exclusions [org.apache.zookeeper/zookeeper
                                 log4j/log4j]]]
-  :dev-dependencies [[storm "0.7.2"]
+  :dev-dependencies [[storm "0.8.0-SNAPSHOT"]
                      [org.clojure/clojure "1.4.0"]]
   :jvm-opts ["-Djava.library.path=/usr/local/lib:/opt/local/lib:/usr/lib"]
 )


remove logging of database encryption keys

--- src/status_im/data_store/realm/core.cljs
+++ src/status_im/data_store/realm/core.cljs
@@ -26,7 +26,6 @@
   "Returns -1 if the file does not exists, the schema version if it successfully
   decrypts it, throws error otherwise."
   [file-name encryption-key]
-  (log/info "encrypted-realm-version\nfile: " file-name " buf " (str encryption-key) (nil? encryption-key))
   (if encryption-key
     (.schemaVersion rn-dependencies/realm file-name (to-buffer encryption-key))
     (.schemaVersion rn-dependencies/realm file-name)))
@@ -184,7 +183,6 @@
                                                           account/schemas
                                                           old-key)]
                   (log/info "copy old database")
-                  (log/info "with key: " (str new-key))
                   (.writeCopyTo old-account-db file-name (to-buffer new-key))
                   (log/info "old database copied")
                   (close old-account-db)


Allow importing db from script

Allow importing db from script

Signed-off-by: Andrea Maria Piana <39e16ece3c2d27e1889178b15ddb376e524032f8@gmail.com>

--- src/status_im/data_store/settings.cljs
+++ src/status_im/data_store/settings.cljs
@@ -1,11 +1,15 @@
 (ns status-im.data-store.settings
-  (:require [status-im.ethereum.eip55 :as eip55]))
+  (:require
+   [status-im.utils.config :as config]
+   [status-im.ethereum.eip55 :as eip55]))

 (defn rpc->networks [networks]
   (reduce (fn [acc {:keys [id] :as network}]
             (assoc acc id network))
           {}
-          networks))
+          (if (seq networks)
+            networks
+            config/default-networks)))

 (defn rpc->visible-tokens [visible-tokens]
   (reduce-kv (fn [acc chain visible-tokens]
@@ -36,6 +40,9 @@
       (update :dapps-address eip55/address->checksum)
       (update :address eip55/address->checksum)
       (update :networks/networks rpc->networks)
+      (update :networks/current-network #(if (seq %)
+                                           %
+                                           config/default-network))
       (update :wallet/visible-tokens rpc->visible-tokens)
       (update :pinned-mailservers rpc->pinned-mailservers)
       (update :stickers/packs-installed rpc->stickers-packs)


Include units in typical-isip

Include units in typical-isip

--- src/test_utils/fracture_diagnostics.cljc
+++ src/test_utils/fracture_diagnostics.cljc
@@ -321,8 +321,15 @@
         y-distance (* euclidean-distance (Math/sin (* (/ (+ plot-angle 90) 180) #?(:cljs Math.PI))))]
     [x-distance y-distance]))

-(defn typical-isip []
-  (tuc/draw-normal 3102 497))
+(defn typical-isip
+  "Calculate a random but typical ISIP (instantaneous shut-in pressure)"
+  ([]
+   (let [unit (rand-pressure-unit)]
+     (typical-isip unit)))
+  ([unit]
+   (case unit
+     :psi (make-measurement (tuc/draw-normal 3102 497) :psi)
+     :kPa (pressure-as (typical-isip :psi) :kPa))))

 (defn typical-inclination []
   (make-measurement (tuc/draw-normal 92.2 2.4) :deg))


Hide register button in organization events list when not logged in

--- src/cljs/elevent_client/pages/organizations/id/core.cljs
+++ src/cljs/elevent_client/pages/organizations/id/core.cljs
@@ -87,10 +87,11 @@
                            {:href (routes/event-schedule event)}
                            "Your activities"
                            [:i.right.chevron.icon]]
-                          [:a.ui.right.floated.small.button
-                           {:href (routes/event-register event)}
-                           "Register"
-                           [:i.right.chevron.icon]])
+                          (when (:token @state/session)
+                            [:a.ui.right.floated.small.button
+                             {:href (routes/event-register event)}
+                             "Register"
+                             [:i.right.chevron.icon]]))
                         [:a.ui.right.floated.small.button
                          {:href (routes/event event)}
                          "Details"


Exclude path information from md5 checksum file.

--- tasks/leiningen/tar.clj
+++ tasks/leiningen/tar.clj
@@ -1,7 +1,7 @@
 (ns leiningen.tar
   (:use [clojure.java.shell :only [sh with-sh-dir]]
         [clojure.java.io :only [file delete-file writer copy]]
-        [clojure.string :only [join capitalize trim-newline]]
+        [clojure.string :only [join capitalize trim-newline split trim]]
         [leiningen.uberjar :only [uberjar]]))

 (defn delete-file-recursively
@@ -66,16 +66,21 @@
 (defn compress
   "Convert given package directory to a .tar.bz2."
   [project tar-dir]
-  (let [tarball (str (file (:root project)
-                           "target"
-                           (str (:name project)
-                                "-"
-                                (:version project)
-                                ".tar.bz2")))]
+  (let [filename (str (:name project)
+                      "-"
+                      (:version project)
+                      ".tar.bz2")
+        tarball (str (file (:root project)
+                       "target"
+                       filename))]
     (with-sh-dir (.getParent tar-dir)
                  (print (:err (sh "tar" "cvjf" tarball (.getName tar-dir)))))
     (write (str tarball ".md5")
-           (:out (sh "md5sum" (str tarball))))))
+      (let [checksum
+            (trim (first (split (:out (sh "md5sum" (str tarball))) #" ")))]
+        (str checksum
+          " "
+          filename)))))

 (defn tar
   ([project] (tar project true))


Edit profile for no major, no year now shows as empty

--- src/verbose_spoon/views/edit_profile.clj
+++ src/verbose_spoon/views/edit_profile.clj
@@ -37,12 +37,12 @@
            [:td
              (f/label :major "Major:")]
            [:td
-             (f/drop-down {:onchange "getDepartment(this)" :id "major-dropdown"} :major (fetch-major-list))]]
+             (f/drop-down {:onchange "getDepartment(this)" :id "major-dropdown"} :major (conj (fetch-major-list) ""))]]
         [:tr
           [:td
             (f/label :year "Year:")]
           [:td
-            (f/drop-down {:id "year-dropdown"} :year ["Freshman", "Sophomore", "Junior", "Senior"])]]
+            (f/drop-down {:id "year-dropdown"} :year ["", "Freshman", "Sophomore", "Junior", "Senior"])]]
         [:tr
           [:td
             (f/label :department "Department:")]


fix bug in test

fix bug in test

--- test/babel/test/it.cljc
+++ test/babel/test/it.cljc
@@ -270,7 +270,7 @@

 (deftest casa-parse
   (is (not (empty?
-            (:parses (parse "io sono a casa"))))))
+            (:parses (first (parse "io sono a casa")))))))

 (deftest casa-generate
   (let [result (generate


+dag_unify.core/copy so that we can test performance against complex, big, dags

--- test/babel/test/it.cljc
+++ test/babel/test/it.cljc
@@ -13,7 +13,7 @@
             #?(:cljs [babel.logjs :as log])
             [clojure.string :as string]
             [clojure.set :as set]
-            [dag_unify.core :refer [get-in strip-refs]]))
+            [dag_unify.core :refer [copy get-in strip-refs]]))

 (deftest analyze-1
   (let [singular (analyze "compito")


Fix hash-to-buf! tests

Fix hash-to-buf! tests

--- test/caesium/crypto/generichash_test.clj
+++ test/caesium/crypto/generichash_test.clj
@@ -46,16 +46,14 @@
     (blake2b-vector "digest-Z-64")))

 (deftest hash-to-buf!-test
-  (are [args expected] (let [out (byte-array g/blake2b-bytes)]
-                         (array-eq (apply g/blake2b-to-buf! out args) expected))
+  (are [args expected] (let [out (byte-array g/bytes)]
+                         (array-eq (apply g/hash-to-buf! out args) expected))
     [(byte-array [])]
     (blake2b-vector "digest-empty-string-32")

-    [(.getBytes "The quick brown fox jumps over the lazy dog")
-     {:key (.getBytes "This is a super secret key. Ssshh!")
-      :salt (.getBytes "0123456789abcdef")
-      :personal (.getBytes "fedcba9876543210")}]
-    (blake2b-vector "digest-with-key-salt-personal-32")))
+    [(byte-array [])
+     {:key (byte-array 0)}]
+    (blake2b-vector "digest-empty-string-32")))

 (deftest blake2b-kat-test
   (are [args expected] (array-eq (apply g/blake2b args) expected)


adding eip

adding eip

--- test/celestial/integration/workflows.clj
+++ test/celestial/integration/workflows.clj
@@ -10,53 +10,55 @@
   (:use midje.sweet))

+(defn spec
+  ([] (spec {}))
+  ([m] (assoc (merge-with merge (s/get-system 1) m) :system-id 1)))
+
 (with-defaults
   (with-state-changes [(before :facts (populate-system redis-type redis-prox-spec))]
     (fact "proxmox creation workflows" :integration :proxmox :workflow
-      (letfn [(spec [] (assoc (s/get-system 1) :system-id 1))]
         (wf/create (spec)) => nil
         (wf/create (spec)) => (throws ExceptionInfo  (is-type? :celestial.workflows/machine-exists))
         (wf/stop (spec)) => nil
         (wf/create (spec)) => (throws ExceptionInfo  (is-type? :celestial.workflows/machine-exists))
-        (wf/destroy (spec)) => nil))
+        (wf/destroy (spec)) => nil)

-    (fact "proxmox reload workflows" :integration :ec2 :workflow
-      (letfn [(spec [] (assoc (s/get-system 1) :system-id 1))]
+    (fact "proxmox reload workflows" :integration :proxmox :workflow
         (wf/create (spec)) => nil
         (wf/reload (spec)) => nil
         (wf/destroy (spec)) => nil
-        ))
+        )
     ))

 (with-admin
- (with-conf local-conf
-  (with-state-changes [(before :facts (populate-system redis-type redis-ec2-spec))]
-    (fact "aws creation workflows" :integration :ec2 :workflow
-      (letfn [(spec [] (assoc (s/get-system 1) :system-id 1))]
-        (wf/create (spec)) => nil
-        (wf/create (spec)) => (throws ExceptionInfo  (is-type? :celestial.workflows/machine-exists))
-        (wf/stop (spec)) => nil
-        (wf/create (spec)) => (throws ExceptionInfo  (is-type? :celestial.workflows/machine-exists))
-        (wf/destroy (spec)) => nil
-        ))
+  (with-conf local-conf
+    (with-state-changes [(before :facts (populate-system redis-type redis-ec2-spec))]
+      (fact "aws creation workflows" :integration :ec2 :workflow
+          (wf/create (spec)) => nil
+          (wf/create (spec)) => (throws ExceptionInfo  (is-type? :celestial.workflows/machine-exists))
+          (wf/stop (spec)) => nil
+          (wf/create (spec)) => (throws ExceptionInfo  (is-type? :celestial.workflows/machine-exists))
+          (wf/destroy (spec)) => nil)

-    (fact "aws provisioning workflows" :integration :ec2 :workflow
-      (letfn [(spec [] (assoc (s/get-system 1) :system-id 1))]
-        (wf/create (spec)) => nil
-        (wf/reload (spec)) => nil
-        (wf/destroy (spec)) => nil
-        )))
+      (fact "aws provisioning workflows" :integration :ec2 :workflow
+          (wf/create (spec)) => nil
+          (wf/reload (spec)) => nil
+          (wf/destroy (spec)) => nil)

-    (with-state-changes [(before :facts (do (populate-system redis-type redis-ec2-centos)))]
+      (fact "aws eip workflows" :integration :ec2 :workflow
+        ; will be run only if EIP is defined
+        (when-let [eip (System/getenv "EIP")]
+          (wf/create (spec {:machine {:ip eip}})) => nil
+          (wf/reload (spec {:machine {:ip eip}})) => nil
+          (wf/destroy (spec {:machine {:ip eip}})) => nil)))
+
+(with-state-changes [(before :facts (do (populate-system redis-type redis-ec2-centos)))]
      (fact "aws centos provisioning" :integration :ec2 :workflow
-      (letfn [(spec [] (assoc (s/get-system 1) :system-id 1))]
         (wf/create (spec)) => nil
         (wf/stop (spec)) => nil
         (wf/puppetize redis-type (spec)) => (throws java.lang.AssertionError)
         (wf/start (spec)) => nil
         (wf/puppetize redis-type (spec)) => nil
-        (wf/destroy (spec)) => nil
-        )))
-    ))
+        (wf/destroy (spec)) => nil))))


Disable paralel build on figwheel (seems buggy at this moment).

--- scripts/figwheel.clj
+++ scripts/figwheel.clj
@@ -14,7 +14,7 @@
      :source-paths ["frontend"]
      :compiler {:main 'uxbox.core
                 :asset-path "js"
-                :parallel-build true
+                :parallel-build false
                 :optimizations :none
                 :pretty-print true
                 :language-in  :ecmascript5


Find the source column of a drag operation.

--- src-cljs/pepa/workflows/inbox2.cljs
+++ src-cljs/pepa/workflows/inbox2.cljs
@@ -200,6 +200,9 @@
                                     ;; source column
                                     (println "inbox/on-drop")
                                     (let [source-column (get-transfer-data e "application/x-pepa-column")
+                                          source-column (some #(when (= source-column
+                                                                        (:id %)) %)
+                                                              columns)
                                           page-ids (get-transfer-data e "application/x-pepa-pages")]
                                       (prn source-column page-ids)))}
        (om/build-all inbox-column columns


Ensure we truncate the destination table first

--- test/clojure/clojurewerkz/cassaforte/copy_table_test.clj
+++ test/clojure/clojurewerkz/cassaforte/copy_table_test.clj
@@ -15,6 +15,7 @@
       (dotimes [i n]
         (insert s :users {:name (str "name_" i) :city (str "city" i) :age (int i)}))

+      (truncate s :users2)
       (is (= 0 (perform-count s :users2)))
       (copy-table s :users :users2 :name identity 16384)
       (is (= n (perform-count s :users2)))


Test session options w/varieties of session

--- test/uruk/core_test.clj
+++ test/uruk/core_test.clj
@@ -52,80 +52,141 @@
     (is (= 6000
            (.getTimeoutMillis (request-options {:timeout-millis 6000}))))))

-(deftest accept-only-valid-request-options
+(deftest fail-on-invalid-request-option
   (testing "Options that don't exist must raise an error"
     (is (thrown? java.lang.IllegalArgumentException
                  (with-open [sess (create-session db)]
                    (execute-xquery sess "\"hello world\"" {:options {:reuqest-time-limt 500}}))))))

-
-
 ;; TODO a full end-to-end test of all request options
+
+(defn is-default-session-options?
+  "True if given session options conform to the expected default
+  SessionOptions; false otherwise."
+  [session-options]
+  (and (is (instance? RequestOptions (:default-request-options session-options)))
+       (is (instance? RequestOptions (:effective-request-options session-options)))
+       (is (instance? Logger (:logger session-options))) ;; FIXME need better test
+       (is (nil? (:user-object session-options)))
+       (is (= 0 (:transaction-timeout session-options)))
+       (is (nil? (:transaction-mode session-options)))))

 ;;;; Session options
 (deftest default-session-options
   (testing "A session with no explicitly-set options must have default options"
-    (let [sess-opts (session-options (create-session db))]
-      (and (is (instance? RequestOptions (:default-request-options sess-opts)))
-           (is (instance? RequestOptions (:effective-request-options sess-opts)))
-           (is (instance? Logger (:logger sess-opts)))
-           (is (nil? (:user-object sess-opts)))
-           (is (= 0 (:transaction-timeout sess-opts)))
-           (is (nil? (:transaction-mode sess-opts)))))))
+    (testing "basic session creation with full database specified"
+      (is-default-session-options? (session-options (create-session db))))
+    (testing "session creation with URI content source"
+      (is-default-session-options? (session-options
+                                    (create-session
+                                     db (make-uri-content-source "xdbc://localhost:8383/")
+                                     {}))))
+    (testing "session creation with URI content source using options"
+      (is-default-session-options? (session-options
+                                    (create-session
+                                     db (make-uri-content-source "xdbc://localhost:8383/"
+                                                                 {:preemptive-auth true})
+                                     {}))))
+    (testing "session creation with hosted content source"
+      (is-default-session-options? (session-options
+                                    (create-session
+                                     db (make-hosted-content-source "localhost" 8383)
+                                     {}))))
+    (testing "session creation with hosted content source using options"
+      (is-default-session-options? (session-options
+                                    (create-session
+                                     db (make-hosted-content-source "localhost" 8383
+                                                                    {:content-base "TutorialDB"})
+                                     {}))))
+    ;; TODO once we want to delve into extreme complexity of ConnectionProvider
+    ;; (testing "session creation with connectionProvider content source"
+    ;;   (is-default-session-options? (session-options
+    ;;                                 (create-session
+    ;;                                  db (make-cp-content-source ...)
+    ;;                                  {}))))
+    ;; TODO once we want to delve into extreme complexity of ConnectionProvider
+    ;; (testing "session creation with connectionProvider content source with options"
+    ;;   (is-default-session-options? (session-options
+    ;;                                 (create-session
+    ;;                                  db (make-cp-content-source ...)
+    ;;                                  {}))))
+    ))
+
+(defn as-expected-session-options?
+  [session-options expected-options]
+  (and (is (= (:timeout-millis (:default-request-options expected-options))
+              (.getTimeoutMillis (:default-request-options session-options))
+              (.getTimeoutMillis (:effective-request-options session-options))))
+       (is (instance? Logger (:logger session-options))) ;; TODO test Logger better--name?
+       (is (empty? (:user-object session-options))) ;; XXX is this all we can test user-object?
+       (is (= (:transaction-timeout session-options)
+              (:transaction-timeout expected-options)))
+       (is (= (:transaction-mode session-options)
+              (:transaction-mode expected-options)))))

 (deftest set-session-options
   (testing "A session with explicitly-set options must reflect those options"
-    (let [sess-opts (session-options
-                     (create-session db
-                                     {:default-request-options {:timeout-millis 75}
-                                      ;; TODO test user-object
-                                      ;; TODO test Logger more deeply
-                                      ;; TODO test default Req Opts more?
-                                      ;; TODO test effective Req Opts more?
-                                      :transaction-timeout 56
-                                      :transaction-mode :query}))]
-      (and (is (= 75
-                  (.getTimeoutMillis (:default-request-options sess-opts))
-                  (.getTimeoutMillis (:effective-request-options sess-opts))))
-           (is (instance? Logger (:logger sess-opts)))
-           (is (empty? (:user-object sess-opts)))
-           (is (= 56 (:transaction-timeout sess-opts)))
-           (is (= :query (:transaction-mode sess-opts)))))))
+    (let [opts {:default-request-options {:timeout-millis 75}
+                ;; TODO test default Req Opts more?
+                ;; TODO test effective Req Opts more?
+                :transaction-timeout 56
+                :transaction-mode :query}]
+      (testing "with standard database map"
+        (as-expected-session-options? (session-options
+                                       (create-session db opts))
+                                      opts))
+      (testing "with uri content source"
+        (as-expected-session-options? (session-options
+                                       (create-session db
+                                                       (make-uri-content-source "xdbc://localhost:8383/")
+                                                       opts))
+                                      opts))
+      (testing "with uri content source using options"
+        (as-expected-session-options? (session-options
+                                       (create-session
+                                        db (make-uri-content-source "xdbc://localhost:8383/"
+                                                                    {:preemptive-auth false})
+                                        opts))
+                                      opts))
+      (testing "with hosted content source"
+        (as-expected-session-options? (session-options
+                                       (create-session
+                                        db (make-hosted-content-source "localhost" 8383)
+                                        opts))
+                                      opts))
+      (testing "with hosted content source using content base"
+        (as-expected-session-options? (session-options
+                                       (create-session
+                                        db (make-hosted-content-source "localhost" 8383
+                                                                       {:content-base "TutorialDB"})
+                                        opts))
+                                      opts))
+      (testing "with hosted content source using user, password, content-base"
+        (as-expected-session-options? (session-options
+                                       (create-session
+                                        db (make-hosted-content-source "localhost" 8383
+                                                                       {:user "rest-admin"
+                                                                        :password "x"
+                                                                        :content-base "TutorialDB"})
+                                        opts))
+                                      opts))
+      (testing "with hosted content source using user and password"
+        (as-expected-session-options? (session-options
+                                       (create-session
+                                        db (make-hosted-content-source "localhost" 8383
+                                                                       {:user "rest-admin"
+                                                                        :password "x"})
+                                        opts))
+                                      opts))
+      ;; TODO once we want to delve into extreme complexity of ConnectionProvider
+      ;; (as-expected-session-options? (session-options
+      ;;                                (create-session
+      ;;                                 db (make-cp-content-source ...)
+      ;;                                 opts))
+      ;;                               opts)
+      )))

 ;; TODO accept-only-valid-session-options
-
-;; TODO all these session creation approaches
-;; (session-options (create-session {:uri "xdbc://localhost:8383/"
-;;                                   :user "rest-admin" :password "x"
-;;                                   :content-base "TutorialDB"}
-;;                                  {} (uri-content-source "xdbc://localhost:8383/")))
-
-;; (comment
-;;   (session-options (create-session {:uri "xdbc://localhost:8383/"
-;;                                     :user "rest-admin" :password "x"
-;;                                     :content-base "TutorialDB"}
-;;                                    {} (uri-content-source "xdbc://localhost:8383/"
-;;                                                           (security-options TODO)))))
-
-;; (session-options (create-session {:uri "xdbc://localhost:8383/"
-;;                                   :user "rest-admin" :password "x"
-;;                                   :content-base "TutorialDB"}
-;;                                  {} (hosted-content-source "localhost" 8383
-;;                                                            "rest-admin" "x" "TutorialDB")))
-
-;; (comment
-;;   (session-options (create-session {:uri "xdbc://localhost:8383/"
-;;                                     :user "rest-admin" :password "x"
-;;                                     :content-base "TutorialDB"}
-;;                                    {} (hosted-content-source "localhost" 8383
-;;                                                              "rest-admin" "x" "TutorialDB"
-;;                                                              (security-options TODO))))
-
-;;   (session-options (create-session {:uri "xdbc://localhost:8383/"
-;;                                     :user "rest-admin" :password "x"
-;;                                     :content-base "TutorialDB"}
-;;                                    {} (managed-content-source connection-provider ;; TODO implement https://docs.marklogic.com/javadoc/xcc/com/marklogic/xcc/spi/ConnectionProvider.html interface
-;;                                                               "rest-admin" "x" "TutorialDB"))))

 ;;;; Content creation options
@@ -205,6 +266,13 @@

 ;;;; Content Source from URI

+;; (comment
+;;   (session-options (create-session {:uri "xdbc://localhost:8383/"
+;;                                     :user "rest-admin" :password "x"
+;;                                     :content-base "TutorialDB"}
+;;                                    {} (uri-content-source "xdbc://localhost:8383/"
+;;                                                           (security-options TODO)))))
+
 (deftest content-source-creation-with-uri
   (testing "content source creation from just a URI"
     (let [cs (make-uri-content-source "xdbc://localhost:8383/")]
@@ -235,3 +303,20 @@
       (and (instance? ContentSource cs)
            (= 8383 (.getPort (.getConnectionProvider cs)))
            (= "localhost" (.getHostName (.getConnectionProvider cs)))))))
+
+;; TODO with SSLContext
+;; (comment
+;;   (session-options (create-session {:uri "xdbc://localhost:8383/"
+;;                                     :user "rest-admin" :password "x"
+;;                                     :content-base "TutorialDB"}
+;;                                    (hosted-content-source "localhost" 8383
+;;                                                           "rest-admin" "x" "TutorialDB"
+;;                                                           (security-options TODO))
+;;                                    {}))
+
+;;   (session-options (create-session {:uri "xdbc://localhost:8383/"
+;;                                     :user "rest-admin" :password "x"
+;;                                     :content-base "TutorialDB"}
+;;                                    (managed-content-source connection-provider ;; TODO implement https://docs.marklogic.com/javadoc/xcc/com/marklogic/xcc/spi/ConnectionProvider.html interface
+;;                                                            "rest-admin" "x" "TutorialDB")
+;;                                    {})))


Update pod.clj

Update pod.clj

--- boot/pod/src/boot/pod.clj
+++ boot/pod/src/boot/pod.clj
@@ -465,7 +465,7 @@
   ([expr]
      (let [{:keys [meta? expr]} (read-string expr)]
        (binding [*print-meta* meta?]
-         (pr-str (eval expr)))))
+         (pr-str (clojure.walk/prewalk identity (eval expr))))))
   ([pod expr]
      (let [arg (pr-str {:meta? *print-meta* :expr expr})
            ret (with-invoke-in pod (boot.pod/eval-in* arg))]


Test unions of records, `:type` metadata

--- test/abracad/avro_test.clj
+++ test/abracad/avro_test.clj
@@ -112,6 +112,18 @@
         records ["down" :up :down :left 0 :right "left"]]
     (is (roundtrips? schema records))))

+(deftest test-union-records
+  (let [example1 {:type :record, :name 'example1,
+                  :fields [{:name 'long, :type 'long}]}
+        example2 {:type :record, :name 'example2,
+                  :fields [{:name 'string, :type 'string}]}
+        schema (avro/parse-schema [example1 example2])
+        records [{:long 0} {:string "string"}]
+        records' (apply roundtrip-binary schema records)]
+    (is (= records records'))
+    (is (= '[example1 example2]
+           (map (comp :type meta) records')))))
+
 (deftest test-bytes
   (let [schema (avro/parse-schema
                 [{:type :fixed, :name "foo", :size 1}, :bytes])


Remove dummy test

Remove dummy test

--- test/cljc/mikron/test.cljc
+++ test/cljc/mikron/test.cljc
@@ -64,6 +64,3 @@
    ::record       [:record {:a :int :b :string :c :byte}]
    ::multi        [:multi number? {true :int false :string}]
    ::wrapped      [:wrapped unchecked-inc-int unchecked-dec-int :int]})
-
-(test/deftest foo
-  (is true))


Make lazy maps lazier, and other improvements

* Add LazyMapEntry type and return it from LazyMaps whenever map entries
  are requested. This prevents e.g. (keys some-lazy-map) from realizing
  the values of the map.
* Implement .equiv from IPersistentCollection for LazyMap. This allows
  LazyMaps to be compared using =.
* Define a convenience macro, extend-print, for generating
  multimethod extensions for print-dup and print-method. This eliminates
  the repetitive code previously used to extend both of the multimethods
  with the same definition, for three separate types (PlaceholderText,
  LazyMap, and LazyMapEntry).

--- cortex/src/cortex/util.cljc
+++ cortex/src/cortex/util.cljc
@@ -139,12 +139,147 @@
 ;;; but makes a few improvements, like having the seq not return
 ;;; map entries with Delays still in them, supporting reduce-kv,
 ;;; and having a prettier str representation.
+
+;;;; Lazy maps -- convenience macro for customizing pr-str
+
+(defmacro extend-print
+  [class str-fn]
+  `(do
+     (defmethod print-dup ~class
+       [obj# ^Writer writer#]
+       (.write writer# ^String (~str-fn obj#)))
+     (defmethod print-method ~class
+       [obj# ^Writer writer#]
+       (.write writer# ^String (~str-fn obj#)))))
+
+;;;; Lazy maps -- placeholder text for unrealized values
+
+(defrecord PlaceholderText [text])
+
+(extend-print PlaceholderText :text)
+
+;;;; Lazy maps -- map entry type
+
+(deftype LazyMapEntry [key_ val_]
+
+  clojure.lang.Associative
+  (containsKey [this k]
+    (boolean (#{0 1} k)))
+  (entryAt [this k]
+    (cond
+      (= k 0) (map-entry 0 key_)
+      (= k 1) (LazyMapEntry. 1 val_)
+      :else nil))
+
+  clojure.lang.IFn
+  (invoke [this k]
+    (.valAt this k))
+
+  clojure.lang.IHashEq
+  (hasheq [this]
+    (.hasheq
+      ^clojure.lang.IHashEq
+      (vector key_ (force val_))))
+
+  clojure.lang.ILookup
+  (valAt [this k]
+    (cond
+      (= k 0) key_
+      (= k 1) (force val_)
+      :else nil))
+  (valAt [this k not-found]
+    (cond
+      (= k 0) key_
+      (= k 1) (force val_)
+      :else not-found))
+
+  clojure.lang.IMapEntry
+  (key [this] key_)
+  (val [this] (force val_))
+
+  clojure.lang.Indexed
+  (nth [this i]
+    (cond
+      (= i 0) key_
+      (= i 1) (force val_)
+      (integer? i) (throw (IndexOutOfBoundsException.))
+      :else (throw (IllegalArgumentException. "Key must be integer")))
+    (.valAt this i))
+  (nth [this i not-found]
+    (try
+      (.nth this i)
+      (catch Exception _ not-found)))
+
+  clojure.lang.IPersistentCollection
+  (count [this] 2)
+  (empty [this] false)
+  (equiv [this o]
+    (.equiv
+      [key_ (force val_)]
+      o))
+
+  clojure.lang.IPersistentStack
+  (peek [this] (force val_))
+  (pop [this] [key_])
+
+  clojure.lang.IPersistentVector
+  (assocN [this i v]
+    (.assocN [key_ (force val_)] i v))
+  (cons [this o]
+    (.cons [key_ (force val_)] o))
+
+  clojure.lang.Reversible
+  (rseq [this] (lazy-seq (list (force val_) key_)))
+
+  clojure.lang.Seqable
+  (seq [this]
+    (cons key_ (lazy-seq (list (force val_)))))
+
+  clojure.lang.Sequential
+
+  java.io.Serializable
+
+  java.lang.Comparable
+  (compareTo [this o]
+    (.compareTo
+      ^java.lang.Comparable
+      (vector key_ (force val_))
+      o))
+
+  java.lang.Iterable
+  (iterator [this]
+    (.iterator
+      ^java.lang.Iterable
+      (.seq this)))
+
+  java.lang.Object
+  (toString [this]
+    (str [key_ (if (and (delay? val_)
+                        (not (realized? val_)))
+                 (->PlaceholderText "<unrealized>")
+                 (force val_))]))
+
+  java.util.Map$Entry
+  (getKey [this] key_)
+  (getValue [this] (force val_))
+
+  java.util.RandomAccess)
+
+(defn lazy-map-entry
+  [k v]
+  (LazyMapEntry. k v))
+
+(extend-print LazyMapEntry #(.toString ^LazyMapEntry %))
+
+;;;; Lazy maps -- map type
+
 (deftype LazyMap [^clojure.lang.IPersistentMap contents]
+
   clojure.lang.Associative
   (containsKey [this k]
     (.containsKey contents k))
   (entryAt [this k]
-    (map-entry k (.valAt this k)))
+    (lazy-map-entry k (.valAt contents k)))

   clojure.lang.IFn
   (invoke [this k]
@@ -185,6 +320,10 @@
     (.empty contents))
   (cons [this o]
     (LazyMap. (.cons contents o)))
+  (equiv [this o]
+    (.equiv
+      ^clojure.lang.IPersistentCollection
+      (into {} this) o))

   clojure.lang.IPersistentMap
   (assoc [this key val]
@@ -196,7 +335,7 @@
   (seq [this]
     ;; Using the higher-arity form of map prevents chunking.
     (map (fn [[k v] _]
-           (map-entry k (force v)))
+           (lazy-map-entry k v))
          contents
          (repeat nil)))

@@ -204,33 +343,17 @@
   (iterator [this]
     (.iterator
       ^java.lang.Iterable
-      (.seq this))))
-
-(defrecord PlaceholderText [text])
-
-(defmethod print-dup PlaceholderText
-  [placeholder ^Writer writer]
-  (.write writer ^String (:text placeholder)))
-
-(defmethod print-method PlaceholderText
-  [placeholder ^Writer writer]
-  (.write writer ^String (:text placeholder)))
-
-(defn lazy-map->str
-  ^String [^LazyMap m]
-  (str (map-vals #(if (and (delay? %)
-                           (not (realized? %)))
-                    (->PlaceholderText "<unrealized>")
-                    (force %))
-                 (.contents m))))
-
-(defmethod print-dup LazyMap
-  [m ^Writer writer]
-  (.write writer (lazy-map->str m)))
-
-(defmethod print-method LazyMap
-  [m ^Writer writer]
-  (.write writer (lazy-map->str m)))
+      (.seq this)))
+
+  java.lang.Object
+  (toString [this]
+    (str (map-vals #(if (and (delay? %)
+                             (not (realized? %)))
+                      (->PlaceholderText "<unrealized>")
+                      (force %))
+                   contents))))
+
+(extend-print LazyMap #(.toString ^LazyMap %))

 (defn ->lazy-map
   [map]


protect against empty :out

protect against empty :out

--- test/duratom/core_test.clj
+++ test/duratom/core_test.clj
@@ -17,7 +17,8 @@
     (or (try
           (some-> (shell/sh "docker-machine" "ip" "default")
                   :out
-                  str/trim-newline)
+                  str/trim-newline
+                  not-empty)
           (catch Throwable _))
         ;; per https://devilbox.readthedocs.io/en/latest/howto/docker-toolbox/find-docker-toolbox-ip-address.html
         "192.168.99.100")))


force redraw on all clients

force redraw on all clients

--- clojure/src/dnd/core.cljs
+++ clojure/src/dnd/core.cljs
@@ -21,6 +21,8 @@

 (defonce tkit (nodejs/require "terminal-kit"))
 (defonce net (nodejs/require "net"))
+
+(defonce clients (atom []))

 (defn make-character []
   (atom
@@ -48,7 +50,7 @@
         new-y (+ y dy)
         _character (character/redirect-character! character dx dy)
         [_level _character] (character/move-character! level character new-x new-y)]
-    (when-not (nil? term) (show-screen term character))
+    ;; (show-screen term character)
     ))

 (defn get-handler [term level character]
@@ -96,7 +98,8 @@
                           )]

         (apply function args)
-        (swap! queue pop)))
+        (swap! queue pop)
+        (run! #(let [{term :term character :character} %] (show-screen term character)) @clients)))

     (<! (timeout 100))
     (recur queue))
@@ -112,7 +115,6 @@
                      ;(.send client string)
                      ;))))

-(defonce clients (atom []))

 (defn kick-it [client]
   (let [{:keys [term character]} client]


Remove old button

Remove old button

--- src-cljs/frontend/components/project_settings.cljs
+++ src-cljs/frontend/components/project_settings.cljs
@@ -346,13 +346,8 @@
                                                                  :_fragment "linux-pricing"})
                              :on-click #((om/get-shared owner :track-event) {:event-type :add-more-containers-clicked
                                                                              :properties {:button-text add-button-text}})}
-                            add-button-text)
-               #_[:a {:href (routes/v1-org-settings-path {:org plan-org-name
-                                                        :vcs_type plan-vcs-type
-                                                        :_fragment "linux-pricing"})
-                    :on-click #((om/get-shared owner :track-event) {:event-type :add-more-containers-clicked
-                                                                    :properties {:button-text add-button-text}})}
-                add-button-text]])
+                            add-button-text)])
+
         (when (> parallelism (project-model/buildable-parallelism plan project))
           [:div.insufficient-trial
            "Trials only come with " (plan-model/trial-containers plan) " available containers."


Shuffle anything that can be turned into a vector

--- src/main/clojure/clojure/test/check/generators.clj
+++ src/main/clojure/clojure/test/check/generators.clj
@@ -418,10 +418,11 @@
   ^{:added "0.6.0"}
   shuffle
   "Create a generator that generates random permutations of `coll`. Shrinks
-  toward the original collection: `coll`."
+  toward the original collection: `coll`. `coll` will be turned into a vector,
+  if it's not already."
   [coll]
   (let [index-gen (choose 0 (dec (count coll)))]
-    (fmap (partial reduce swap coll)
+    (fmap (partial reduce swap (vec coll))
           ;; a vector of swap instructions, with count between
           ;; zero and 2 * count. This means that the average number
           ;; of instructions is count, which should provide sufficient


fix token-icon

fix token-icon

--- src/status_im/ui/screens/wallet/account/views.cljs
+++ src/status_im/ui/screens/wallet/account/views.cljs
@@ -21,6 +21,7 @@
             [status-im.ui.components.tabs :as tabs]
             [quo.design-system.colors :as quo-colors]
             [status-im.multiaccounts.update.core :as multiaccounts.update]
+            [status-im.ui.screens.wallet.components.views :as wallet.components]
             [status-im.utils.handlers :refer [<sub]])
   (:require-macros [status-im.utils.views :as views]))

@@ -149,11 +150,11 @@
            {:title          (:name collectible)
             :text-size      :large
             :icon
-            [list/item-image {:style  {:border-radius 40
-                                       :overflow      :hidden
-                                       :border-width  1
-                                       :border-color  "#EEF2F5"}
-                              :source {:uri (:image_url collectible)}}]
+            [wallet.components/token-icon {:style  {:border-radius 40
+                                                    :overflow      :hidden
+                                                    :border-width  1
+                                                    :border-color  "#EEF2F5"}
+                                           :source {:uri (:image_url collectible)}}]
             :accessory      :text
             :accessory-text (:owned_asset_count collectible)}]]
          :padding-vertical     0


CMR-1922: Fixed ingest routes to fix some test failures.

--- ingest-app/src/cmr/ingest/api/ingest.clj
+++ ingest-app/src/cmr/ingest/api/ingest.clj
@@ -257,12 +257,11 @@
                                    :native-id native-id
                                    :concept-type :collection}
                                   headers)]
-            (println "concept-attribs:" (pr-str concept-attribs))
             (verify-provider-against-client-id request-context provider-id)
             (acl/verify-ingest-management-permission request-context :update :provider-object provider-id)
             (info (format "Deleting collection %s from client %s"
                           (pr-str concept-attribs) (:client-id request-context)))
-            (generate-ingest-response headers (ingest/save-collection request-context concept-attribs)))))
+            (generate-ingest-response headers (ingest/delete-concept request-context concept-attribs)))))

       (context ["/validate/granule/:native-id" :native-id #".*$"] [native-id]
         (POST "/" {:keys [params headers request-context] :as request}
@@ -279,10 +278,11 @@
                           (concept->loggable-string concept) (:client-id request-context)))
             (generate-ingest-response headers (ingest/save-granule request-context concept))))
         (DELETE "/" {:keys [request-context params headers]}
-          (let [concept-attribs {:provider-id provider-id
-                                 :native-id native-id
-                                 :concept-type :granule
-                                 :revision-id (get headers "cmr-revision-id")}]
+          (let [concept-attribs (set-revision-id
+                                  {:provider-id provider-id
+                                   :native-id native-id
+                                   :concept-type :granule}
+                                  headers)]
             (verify-provider-against-client-id request-context provider-id)
             (acl/verify-ingest-management-permission request-context :update :provider-object provider-id)
             (info (format "Deleting granule %s from client %s"


Remove todo that I already did

Remove todo that I already did

--- src/aurora/compiler/stratifier.cljs
+++ src/aurora/compiler/stratifier.cljs
@@ -18,7 +18,6 @@
   (->Knowledge. (->facts rules) #{} #{}))

 ;; [:before x y] if pred x must be finished before pred y can be finished
-;; TODO handle ::any

 (def ordering-rules
   [;; preds


Delete the temporary private keys when cleaning up a build

--- src/circle/backend/action/nodes.clj
+++ src/circle/backend/action/nodes.clj
@@ -40,13 +40,16 @@
       (dosync
        (alter build assoc :instance-ids instance-ids)))))

+(defn cleanup-nodes [build]
+  (let [ids (-> @build :instance-ids)]
+    (when (seq ids)
+      (infof "terminating nodes %s" ids)
+      (apply ec2/terminate-instances! ids))
+    (infof "deleting keypair %s" (-> @build :node :keypair-name))
+    (ec2/delete-keypair (-> @build :node :keypair-name))))
+
 (defaction stop-nodes []
   {:name "stop nodes"}
   (fn [build]
-    (apply ec2/terminate-instances! (-> @build :instance-ids))))
+    (cleanup-nodes build)))

-(defn cleanup-nodes [build]
-  (let [ids (-> @build :instance-ids)]
-    (when (seq ids)
-      (errorf "terminating nodes %s" ids)
-      (apply ec2/terminate-instances! ids))))


Add support for canonical pie series, closes #7

--- src/clj/com/hypirion/clj_xchart.clj
+++ src/clj/com/hypirion/clj_xchart.clj
@@ -388,6 +388,7 @@

   For bubble-charts, use `add-bubble-series!`. For pie charts, just use
   (.addSeries chart name val)."
+  ;; TODO: Make this polymorphic over chart types
   [chart s-name data]
   (if (sequential? data)
     (apply add-raw-series chart s-name data)
@@ -629,7 +630,15 @@
          ;; entry at the top, if it's not used for documentation purposes.
          annotation-distance (:annotation-distance styling)]
      (doseq [[s-name num] series]
-       (.addSeries chart s-name num))
+       (if (number? num)
+         (.addSeries chart s-name num)
+         (let [{:keys [render-style fill-color show-in-legend?]} (:style num)
+               val (:value num)]
+           (doto-cond
+            (.addSeries chart s-name val)
+            render-style (.setChartPieSeriesRenderStyle (pie-render-styles render-style))
+            fill-color (.setFillColor (colors fill-color fill-color))
+            (not (nil? show-in-legend?)) (.setShowInLegend (boolean show-in-legend?))))))
      (doto-cond
       (.getStyler chart)
       theme (.setTheme (themes theme theme))


Use sliding buffer to implement frame-skip for both recorded and live sources

--- src/cljs/asciinema_player/core.cljs
+++ src/cljs/asciinema_player/core.cljs
@@ -3,7 +3,7 @@
             [asciinema-player.view :as view]
             [asciinema-player.util :as util]
             [asciinema-player.vt :as vt]
-            [cljs.core.async :refer [chan >! <! put! timeout close! dropping-buffer]]
+            [cljs.core.async :refer [chan >! <! put! timeout close! dropping-buffer sliding-buffer]]
             [clojure.walk :as walk]
             [clojure.set :refer [rename-keys]]
             [ajax.core :refer [GET]])
@@ -59,37 +59,31 @@
         (update-in [:cursor] merge cursor))))

 (defn coll->chan
-  "Returns a channel that emits elements from the given collection.
-  The difference from core.async/to-chan is this function expects elements of
-  the collection to be tuples of [delay data], and it emits data after delay
-  (sec) for each element. It tries to always stay 'on the schedule' by measuring
-  elapsed time and skipping elements if necessary. When reducer and init given
-  it reduces consecutive elements instead of skipping."
-  ([coll] (coll->chan coll (fn [_ v] v) nil))
-  ([coll reducer init]
-   (let [ch (chan)
-         start (js/Date.)
-         reducer (fnil reducer init)]
-     (go
-       (loop [coll coll
-              virtual-time 0
-              wall-time (elapsed-time-since start)
-              acc nil]
-         (if-let [[delay data] (first coll)]
-           (let [new-virtual-time (+ virtual-time delay)
-                 ahead (- new-virtual-time wall-time)]
-             (if (pos? ahead)
-               (do
-                 (when-not (nil? acc)
-                   (>! ch acc))
-                 (<! (timeout (* 1000 ahead)))
-                 (>! ch data)
-                 (recur (rest coll) new-virtual-time (elapsed-time-since start) nil))
-               (recur (rest coll) new-virtual-time wall-time (reducer acc data)))))
-         (when-not (nil? acc)
-           (>! ch acc)))
-       (close! ch))
-     ch)))
+  "Returns a channel that emits elements from the given collection. The
+  difference from core.async/to-chan is this function expects elements of the
+  collection to be tuples of [delay data], and it emits data after delay (sec)
+  for each element. It tries to always stay 'on the schedule' by measuring
+  elapsed time and skipping elements if necessary."
+  [coll]
+  (let [ch (chan (sliding-buffer 1))
+        start (js/Date.)]
+    (go
+      (loop [coll coll
+             virtual-time 0
+             wall-time (elapsed-time-since start)]
+        (if-let [[delay data] (first coll)]
+          (let [new-virtual-time (+ virtual-time delay)
+                ahead (- new-virtual-time wall-time)]
+            (if (pos? ahead)
+              (do
+                (<! (timeout (* 1000 ahead)))
+                (>! ch data)
+                (recur (rest coll) new-virtual-time (elapsed-time-since start)))
+              (do
+                (>! ch data)
+                (recur (rest coll) new-virtual-time wall-time))))))
+      (close! ch))
+    ch))

 (defn screen-state-at
   "Returns screen state (lines + cursor) at given time (in seconds)."
@@ -198,21 +192,28 @@

 (defmethod start-playback :stream [{{:keys [url width height]} :source :as player}]
   (let [es (js/EventSource. url)
-        es-ch (chan)
-        vt-ch (chan)
+        es-ch (chan 10000) ; make enough buffer for very fast ES producers
+        vt-ch (chan (sliding-buffer 1))
         events-ch (screen-events vt-ch)]
-    (set! (.-onopen es) #(dispatch player [:stream-connected]))
-    (set! (.-onerror es) #(dispatch player [:stream-disconnected %]))
-    (set! (.-onmessage es) #(put! es-ch (.-data %)))
+    (set! (.-onopen es) (fn []
+                          (dispatch player [:stream-connected])))
+    (set! (.-onerror es) (fn [err]
+                           (close! es-ch)
+                           (dispatch player [:stream-disconnected err])))
+    (set! (.-onmessage es) (fn [e]
+                             (put! es-ch (.-data e))))
     (go-loop [vt (vt/make-vt width height)]
-      (let [message (js->clj (.parse js/JSON (<! es-ch)))
-            stdout (get message "stdout")
-            new-vt (vt/feed-str vt stdout)]
-        (>! vt-ch new-vt)
-        (recur new-vt)))
+      (if-let [v (<! es-ch)]
+        (let [message (js->clj (.parse js/JSON v))
+              stdout (get message "stdout")
+              new-vt (vt/feed-str vt stdout)]
+          (>! vt-ch new-vt)
+          (recur new-vt))
+        (close! vt-ch)))
     (go-loop []
-      (dispatch player (<! events-ch))
-      (recur))
+      (when-let [v (<! events-ch)]
+        (dispatch player v)
+        (recur)))
     (assoc-in player [:source :event-source] es)))

 (defmulti stop-playback


fixup! Pull out a function for getting the next image

--- src/cljs/comic_reader/handlers.cljs
+++ src/cljs/comic_reader/handlers.cljs
@@ -4,8 +4,8 @@
             [re-frame.core :as rf]
             [secretary.core :as secretary]))

-(defn get-next-image [{:keys site url-list}
-                      :as db]
+(defn get-next-image [{:keys [site url-list]
+                       :as db}]
   (api/get-img-tag site (first url-list))
   (assoc db :url-list (rest url-list)))


Refactor duplicate functions

Refactor duplicate functions

burn-card / discard-card / draw-card were removed for a more general
function move-card.

--- src/cljs/love_letter_cljs/game.cljs
+++ src/cljs/love_letter_cljs/game.cljs
@@ -39,38 +39,26 @@
    :players (add-players 4)
    :current-player 1})

-(defn draw-card [game player-id]
-  (let [deck (:deck game)]
+(defn move-card [game source destination]
+  (let [card (first (get-in game source))]
     (-> game
-        (update-in [:players player-id :hand] into (take 1 deck))
-        (assoc :deck (drop 1 deck)))))
+        (update-in source (comp vec rest))
+        (update-in destination conj card))))

 (defn deal-cards [game]
   (let [player-ids (keys (:players game))]
-    (reduce draw-card game player-ids)))
-
-(defn burn-card [game]
-  (let [cards (:deck game)]
-    (-> game
-        (update-in [:burn-pile] into (vec (take 1 cards)))
-        (assoc :deck (drop 1 cards)))))
-
-(defn discard-card [game source]
-  (let [cards (get-in game source)]
-    (-> game
-        (update-in [:discard-pile] into (vec (take 1 cards)))
-        (assoc-in source (vec (drop 1 cards))))))
+    (reduce (fn [g id] (move-card g [:deck] [:players id :hand])) game player-ids)))

 (defn create-and-deal []
   (-> (create-game)
-      (burn-card)
+      (move-card [:deck] [:burn-pile])
       (deal-cards)))

 (defn- kill-player
   [game target]
   (-> game
       (update-in [:players target :alive?] not)
-      (discard-card [:players target :hand])))
+      (move-card [:players target :hand] [:discard-pile])))

 (defn reveal-card-to-player [game player target]
   (update-in game [:players target :hand 0 :visible] conj player))


card display improvement

card display improvement

--- src/cljs/netrunner/cardbrowser.cljs
+++ src/cljs/netrunner/cardbrowser.cljs
@@ -104,7 +104,8 @@
                             (filter-cards (:side-filter state) :side)
                             (filter-cards (:faction-filter state) :faction)
                             (filter-cards (:type-filter state) :type)
-                            (match (.toLowerCase (:search-query state)))))]]))))
+                            (match (.toLowerCase (:search-query state))))
+                       {:key :code})]]))))

 (om/root card-browser app-state {:target (. js/document (getElementById "cardbrowser"))})


use clojure.pprint/code-dispatch

use clojure.pprint/code-dispatch

--- src/clojure/paredit_widget/core.clj
+++ src/clojure/paredit_widget/core.clj
@@ -80,7 +80,7 @@
 (defn reformat-all-forms [s]
   (let [rvec (map (fn [[offs p]]
                     (let [len (v/length p)]
-                      (vector (- offs len) len (.trim (with-out-str (clojure.pprint/pprint (read-string (v/text p))))))))
+                      (vector (- offs len) len (.trim (with-out-str (clojure.pprint/with-pprint-dispatch clojure.pprint/code-dispatch (clojure.pprint/pprint (read-string (v/text p)))))))))
                   (filter (fn [me] (= :list (v/tag (val me)))) (v/offsets (sexp-dup s))))
           ;_ (println "rvec: " rvec)
           first-offset (first (first rvec))


adding cleanup

adding cleanup

--- data/celestial/fixtures/populate.clj
+++ data/celestial/fixtures/populate.clj
@@ -60,11 +60,15 @@
   (doseq [s (g/sample systems-with-machines 100)]
     (s/add-system s)))

+(defn cleanup
+   []
+  (es/clear)
+  (clear-all))
+
 (defn populate-all
    "populates all data types"
    []
-   (es/clear)
-   (clear-all)
+   (cleanup)
    (add-users)
    (add-types)
    (add-actions)