CMR-4561: Update Metadata Preview gem

CMR-4561: Update Metadata Preview gem

--- collection-renderer-lib/project.clj
+++ collection-renderer-lib/project.clj
@@ -14,7 +14,7 @@
    the hardcoded commit id during dev integration with cmr_metadata_preview project.
    The hardcoded commit id should be updated when MMT releases a new version of the gem."
   (or (System/getenv "CMR_METADATA_PREVIEW_COMMIT")
-      "b10367d7242"))
+      "5d0905f8cec"))

 (def gem-install-path
   "The directory within this library where Ruby gems are installed."


minor reloader chg

minor reloader chg

--- compojure/src/main/clojure/migae/reloader.clj
+++ compojure/src/main/clojure/migae/reloader.clj
@@ -1,10 +1,7 @@
 (ns migae.reloader
   (:import (javax.servlet Filter FilterChain FilterConfig
                           ServletRequest ServletResponse))
-  ;; (:gen-class :implements [javax.servlet.Filter])
   (:require [ns-tracker.core :refer :all]))
-
-(println "ring reloading reloader")

 (defn -init [^Filter this ^FilterConfig cfg])

@@ -17,7 +14,8 @@
    ^ServletRequest rqst
    ^ServletResponse resp
    ^FilterChain chain]
-  ;; (println "reloading ...")
   (doseq [ns-sym (modified-namespaces)]
     (require ns-sym :reload))
   (.doFilter chain rqst resp))
+
+(println "ring reloading reloader")


fix dropdown with chevrons style

fix dropdown with chevrons style

--- src/cljs/re_form/inputs/date_input_impl.cljs
+++ src/cljs/re_form/inputs/date_input_impl.cljs
@@ -26,6 +26,8 @@
       :width (u/px 238)
       :border border
       :background-color :white}
+     [:&.chevron-offset
+      {:margin-left (u/px h2)}]
      [:.clickable {:cursor :pointer}]]]
    [:.date-input
     {:position :relative
@@ -186,7 +188,9 @@
             {:on-click #(on-change (inc-iso value))}
             [:i.material-icons.date-chevrons "chevron_right"]])
          (when (and with-dropdown (:dropdown-visible @state))
-           [:div.calendar-dropdown {:tab-index 0}
+           [:div.calendar-dropdown
+            {:tab-index 0
+             :class (when with-chevrons :chevron-offset)}
             [re-calendar
              {:value (date-parse fmt (:value @state))
               :on-change (comp #(swap! state assoc :dropdown-visible false)


Updated to support both languages and names.

--- src/hxgm30/language/syntagmata/core.clj
+++ src/hxgm30/language/syntagmata/core.clj
@@ -5,45 +5,25 @@
     [clojure.set :as set]
     [clojure.string :as string]
     [hxgm30.language.syntagmata.corpus :as corpus]
-    [hxgm30.language.syntagmata.util :as util])
+    [hxgm30.language.syntagmata.lang.core :as lang]
+    [hxgm30.language.syntagmata.util :as util]
+    [taoensso.timbre :as log])
   (:gen-class))
-
-(def supported
-  [:afrikaans
-   :arabic
-   :chinese
-   :english
-   :finnish
-   :french
-   :gaelic
-   :german
-   :greek
-   :hebrew
-   :hindi
-   :japanese
-   :korean
-   :latin
-   :oldenglish
-   :oldnorse
-   :onomatopoetic
-   :pie
-   :russian
-   :sanskrit
-   :scots
-   :spanish])

 (defn pseudo-syllables
   ""
-  [language words]
+  [words & args]
   (map (comp #(if (= % []) [""] %)
              #(string/split % #"_")
-             #(string/replace % (re-pattern (str (corpus/re-vowel language) "+")) "_"))
+             #(string/replace %
+                              (re-pattern
+                                (str (apply corpus/re-vowel args) "+")) "_"))
        words))

 (defn pseudo-syllable-counts
   ""
-  [language words]
-  (map count (pseudo-syllables language words)))
+  [words & args]
+  (map count (apply pseudo-syllables (cons words args))))

 (defn pseudo-syllable-freqs
   "The intent of this function is to provide information regarding how many
@@ -53,20 +33,20 @@
   Create a lookup of key/value pairs where the key is the number
   pseudo-syllables and the associated value is the number of times the given
   pseudo-syllable occurs."
-  [language words]
-  (frequencies (pseudo-syllable-counts language words)))
+  [words & args]
+  (frequencies (apply pseudo-syllable-counts (cons words args))))

 (defn sound-transitions
   ""
-  [language words]
+  [words & args]
   (map (comp #(remove nil? %)
              #(mapcat rest %)
-             #(re-seq (re-pattern (corpus/re-sound-transitions language)) %))
+             #(re-seq (re-pattern (apply corpus/re-sound-transitions args)) %))
        words))

 (defn flat-sound-transitions
-  [language words]
-  (flatten (sound-transitions language words)))
+  [words & args]
+  (flatten (apply sound-transitions (cons words args))))

 (defn positional-sound-transitions
   [position transitions]
@@ -81,10 +61,10 @@

 (defn generate-stats
   ""
-  [language]
-  (let [words (corpus/load-wordlist language)
-        pseudo-syllable-freqs (pseudo-syllable-freqs language words)
-        transitions (sound-transitions language words)
+  [& args]
+  (let [words (apply corpus/load-wordlist args)
+        pseudo-syllable-freqs (apply pseudo-syllable-freqs (cons words args))
+        transitions (apply sound-transitions (cons words args))
         initial (positional-sound-transition-freqs :initial transitions)
         medial (positional-sound-transition-freqs :medial transitions)
         final (positional-sound-transition-freqs :final transitions)]
@@ -102,19 +82,39 @@
          :frequencies final
          :percent-ranges (util/frequencies->percent-ranges final)}}}))

+(defn regen-language-stats
+  []
+  (doall
+    (for [language lang/supported-languages]
+      (do
+        (log/debug "Processing %s ..." language)
+        (corpus/dump :stats language (generate-stats language))
+        {language :ok}))))
+
+(defn regen-name-stats
+  []
+  (doall
+    (for [race lang/supported-names
+          name-type lang/supported-name-types]
+      (do
+        (log/debug "Processing %s + %s ..." race name-type)
+        (corpus/dump race name-type :stats (generate-stats race name-type))
+        {race {name-type :ok}}))))
+
 (defn regen-stats
   ([]
-    (doall
-      (for [language supported]
-        (do
-          (corpus/dump :stats language (generate-stats language))
-          {language :ok}))))
+    (regen-language-stats)
+    (regen-name-stats))
   ([language]
-    (corpus/dump :stats language (generate-stats language))))
+    (corpus/dump :stats language (generate-stats language)))
+  ([race name-type]
+    (corpus/dump race name-type :stats (generate-stats race name-type))))

 (defn stats
-  [language]
-  (corpus/undump :stats language))
+  ([language]
+    (corpus/undump :stats language))
+  ([race name-type]
+    (corpus/undump race name-type :stats)))

 (defn -main
   [& args]


Use goog.string.format to make tests pass

--- src/main/clojure/clojure/tools/cli.cljc
+++ src/main/clojure/clojure/tools/cli.cljc
@@ -1,7 +1,8 @@
 (ns ^{:author "Gareth Jones, Sung Pae, Sean Corfield"
       :doc "Tools for working with command line arguments."}
   clojure.tools.cli
-  (:require [clojure.string :as s]))
+  (:require [clojure.string :as s]
+            #?(:cljs goog.string.format)))

 (defn- tokenize-args
   "Reduce arguments sequence into [opt-type opt ?optarg?] vectors and a vector
@@ -67,12 +68,10 @@
    (or docs "")])

 #?(:cljs
-   ;; `format` has been removed from cljs and Clojure's `format`
-   ;; isn't exactly what `google.format.string` does and so we
-   ;; just provide _a format_ for now
+   ;; alias to Google Closure string format
    (defn format
      [fmt & args]
-     (s/join " " args)))
+     (apply goog.string.format fmt args)))

 (defn- banner-for [desc specs]
   (when desc


Add austin to plugins.

Add austin to plugins.

--- .lein/profiles.clj
+++ .lein/profiles.clj
@@ -13,6 +13,7 @@
                   [lein-kibit "0.0.8"]
                   [lein-clojars "0.9.1"]
                   [lein-pprint "1.1.1"]
+                  [com.cemerick/austin "0.1.3"]
                   [lein-ring "0.8.0"]
                   [lein-cljsbuild "0.3.2"]
                   [lein-deps-tree "0.1.2"]


fix year ambiguity in Chinese after core.clj change

--- resources/picsou/rules/cn.duration.clj
+++ resources/picsou/rules/cn.duration.clj
@@ -38,7 +38,7 @@
    :in-width (months 1)}

   "year (unit-of-duration)"
-  #"年"
+  #"年(?=[前|后|後])"
   {:dim :unit-of-duration
    :grain years
    :in-width (years 1)}


add notes about next test

add notes about next test

--- test/clj_money/models/transactions_test.clj
+++ test/clj_money/models/transactions_test.clj
@@ -201,3 +201,9 @@
     (is (= (bigdec 900) checking-balance) "The checking account has the correct balance.")
     (is (= (bigdec 1000) salary-balance) "The salary account has the correct balance.")
     (is (= (bigdec 100) groceries-balance) "The groceries account has the correct balance.")))
+
+; TODO test balances after inserting a transaction before the end
+; subsequent item balances should be updated
+; account balances should be updated correctly
+; walking the list of subsequent items should stop as soon as
+;   the balance is equal to the new value


+log/debugs

+log/debugs

--- src/babel/francais/morphology.cljc
+++ src/babel/francais/morphology.cljc
@@ -76,8 +76,11 @@
    element of regular-patterns where the element's :u unifies successfully with
    unify-with. If lexicon is supplied, look up infinitive in lexicon and use exceptional form of
    first return value, if any."
-  (log/debug (str "conjugate: infinitive= " infinitive "; unify-with= " unify-with))
-  (let [exceptional-lexemes
+  (log/debug (str "conjugate1: infinitive= " infinitive "; unify-with= " unify-with))
+  (let [unify-with (dissoc-paths unify-with [[:français]])
+        diagnostics
+        (log/debug (str "conjugate2: infinitive= " infinitive "; unify-with= " unify-with))
+        exceptional-lexemes
         (lookup-in lexicon
                    {:spec (unify unify-with
                                  {:français {:infinitive infinitive


improve performance

improve performance

--- src/babel/italiano/morphology.cljc
+++ src/babel/italiano/morphology.cljc
@@ -122,8 +122,8 @@
       (and (map? (get-in word '(:a)))
            (map? (get-in word '(:b))))
       (get-string
-       (get-in word '(:a))
-       (get-in word '(:b)))
+       (get-string (get-in word [:a]))
+       (get-string (get-in word [:b])))

       (= :verb (get-in word [:cat]))
       (let [conjugated (verbs/conjugate word)]


Fix typo

Fix typo

--- src/semantic_reagent/core.cljs
+++ src/semantic_reagent/core.cljs
@@ -22,7 +22,7 @@
 (def Container (r/adapt-react-class (.-Container semantic-ui)))

 ;; Divider
-(def Divider (r/adapt-react-class (.-Container semantic-ui)))
+(def Divider (r/adapt-react-class (.-Divider semantic-ui)))

 ;; Flag
 (def Flag (r/adapt-react-class (.-Flag semantic-ui)))


add more phrasal verb tests

add more phrasal verb tests

--- test/babel/test/en.cljc
+++ test/babel/test/en.cljc
@@ -303,9 +303,12 @@
      "the cats"))

 (deftest phrasal-verbs
-  (is (not (empty? (parse "the radio"))))
   (is (not (empty? (parse "I turned on the radio"))))
-  (is (or true (not (empty? (parse "I turned the radio on"))))))
-
-
-
+  (is (not (empty? (parse "I turned the radio on"))))
+  (is (not (empty? (parse "I turned off the radio"))))
+  (is (not (empty? (parse "I turned the radio off")))))
+
+
+
+
+


working on coping with punctuation and casing

--- test/babel/test/it.cljc
+++ test/babel/test/it.cljc
@@ -343,7 +343,23 @@
   (let [result (parse "io dormo a casa")]
     (is (not (empty? (mapcat :parses result))))))

+
 (deftest parse-long-sentence
+  (let [result (parse "dopo ventotto anni ostana ha un cittadino neonato")]
+    (is (not (empty? (mapcat :parses result))))
+    (is (not (nil?
+              (some
+               #(and (= :have (get-in % [:pred]))
+                     (= :newborn (get-in % [:obj :pred]))
+                     (= :ostana (get-in % [:subj :pred]))
+                     (= :after (get-in % [:mod :pred]))
+                     (= :year (get-in % [:mod :obj :pred]))
+                     (= :twentyeight (get-in % [:mod :obj :spec :def])))
+               (map (fn [parse]
+                      (get-in parse [:synsem :sem]))
+                    (mapcat :parses result))))))))
+
+(deftest parse-long-sentence-with-punctuation
   (let [result (parse "Dopo ventotto anni, Ostana ha un cittadino neonato.")]
     (is (not (empty? (mapcat :parses result))))
     (is (not (nil?


fixed tags page reaction issues

fixed tags page reaction issues

--- src/braid/ui/views/pages/tags.cljs
+++ src/braid/ui/views/pages/tags.cljs
@@ -1,5 +1,6 @@
 (ns braid.ui.views.pages.tags
   (:require [reagent.core :as r]
+            [reagent.ratom :include-macros true :refer-macros [reaction]]
             [chat.client.reagent-adapter :refer [subscribe]]
             [chat.client.store :as store]
             [chat.client.dispatcher :refer [dispatch!]]
@@ -42,13 +43,19 @@
   []
   (let [group-id (subscribe [:open-group-id])
         tags (subscribe [:tags])
-        sorted-tags (->> @tags
+        sorted-tags (reaction (->> @tags
                          (filter (fn [t] (= @group-id (t :group-id))))
                          (sort-by :threads-count)
-                         reverse)
+                         reverse))
         subscribed-tag-ids (subscribe [:user-subscribed-tag-ids])
-        subscribed-to-tag? (fn [tag-id]
-                             (contains? @subscribed-tag-ids tag-id))]
+        subscribed-to? (fn [tag-id] (contains? (set @subscribed-tag-ids) tag-id))
+        subscribed-tags (reaction
+                          (->> @sorted-tags
+                            (filter (fn [t] (subscribed-to? (t :id))))))
+        recommended-tags (reaction
+                           (->> @sorted-tags
+                           ; TODO actually use some interesting logic here
+                             (remove (fn [t] (subscribed-to? (t :id))))))]
     (fn []
       [:div.page.channels
        [:div.title "Tags"]
@@ -56,27 +63,20 @@
        [:div.content
         [new-tag-view {:group-id @group-id}]

-        (let [subscribed-tags
-              (->> sorted-tags
-                   (filter (fn [t] (subscribed-to-tag? (t :id)))))]
-          (when (seq subscribed-tags)
+          (when (seq @subscribed-tags)
             [:div
              [:h2 "Subscribed"]
              [:div.tags
               (doall
-                (for [tag subscribed-tags]
+                (for [tag @subscribed-tags]
                   ^{:key (tag :id)}
-                  [tag-info-view tag]))]]))
+                  [tag-info-view tag]))]])

-        (let [recommended-tags
-              (->> sorted-tags
-                   ; TODO actually use some interesting logic here
-                   (remove (fn [t] (subscribed-to-tag? (t :id)))))]
-          (when (seq recommended-tags)
+          (when (seq @recommended-tags)
             [:div
              [:h2 "Recommended"]
              [:div.tags
               (doall
-                (for [tag recommended-tags]
+                (for [tag @recommended-tags]
                   ^{:key (tag :id)}
-                  [tag-info-view tag]))]]))]])))
+                  [tag-info-view tag]))]])]])))


added use of midje.repl in each lein repl

--- profiles.clj
+++ profiles.clj
@@ -1 +1,9 @@
-{:user {:plugins [[cider/cider-nrepl "0.10.0-SNAPSHOT"]]}}
+{:user {
+        :plugins [[cider/cider-nrepl "0.9.1"]
+                  [refactor-nrepl "1.1.0"]
+                  [lein-midje "3.1.3"]]
+        :dependencies [[org.clojure/tools.nrepl "0.2.7"]]
+        :repl {:dependencies [[midje "1.7.0"]]}
+        :repl-options {:init (use 'midje.repl)}}
+        }
+ }


Factor out a common with-redef in a block of unit tests.

--- scheduler/test/cook/test/mesos/api.clj
+++ scheduler/test/cook/test/mesos/api.clj
@@ -1858,11 +1858,11 @@
                        :authorization/user "user"
                        :headers {"Content-Type" "application/json"}
                        :body-params {:jobs [(minimal-job)]}})]
-    (with-redefs [api/no-job-exceeds-quota? (constantly true)]
+    (with-redefs [api/no-job-exceeds-quota? (constantly true)
+                  rate-limit/job-submission-rate-limiter rate-limit/AllowAllRateLimiter]
       (testing "successful-job-creation-response"
         (with-redefs [api/create-jobs! (fn [in-conn _]
-                                         (is (= conn in-conn)))
-                      rate-limit/job-submission-rate-limiter rate-limit/AllowAllRateLimiter]
+                                         (is (= conn in-conn)))]
           (let [handler (api/create-jobs-handler conn task-constraints gpu-enabled? is-authorized-fn)
                 {:keys [status]} (handler (new-request))]
             (is (= 201 status)))))
@@ -1871,8 +1871,7 @@
         (with-redefs [api/create-jobs! (fn [in-conn _]
                                          (is (= conn in-conn))
                                          (throw (ex-info "Transaction timed out."
-                                                         {:db.error :db.error/transaction-timeout})))
-                      rate-limit/job-submission-rate-limiter rate-limit/AllowAllRateLimiter]
+                                                         {:db.error :db.error/transaction-timeout})))]

           (let [handler (api/create-jobs-handler conn task-constraints gpu-enabled? is-authorized-fn)
                 {:keys [body status]} (handler (new-request))]
@@ -1882,25 +1881,23 @@
       (testing "generic-exception-job-creation-response"
         (with-redefs [api/create-jobs! (fn [in-conn _]
                                          (is (= conn in-conn))
-                                         (throw (Exception. "Thrown from test")))
-                      rate-limit/job-submission-rate-limiter rate-limit/AllowAllRateLimiter]
+                                         (throw (Exception. "Thrown from test")))]
           (let [handler (api/create-jobs-handler conn task-constraints gpu-enabled? is-authorized-fn)
                 {:keys [body status]} (handler (new-request))]
             (is (= 500 status))
             (is (str/includes? body "Exception occurred while creating job - Thrown from test")))))

       (testing "should fail with duplicate uuids"
-        (with-redefs [rate-limit/job-submission-rate-limiter rate-limit/AllowAllRateLimiter]
-          (let [conn (restore-fresh-database! "datomic:mem://mesos-api-test")
-                {:keys [uuid] :as j1} (minimal-job)
-                j2 (assoc (minimal-job) :uuid uuid)
-                j3 (minimal-job)
-                request (assoc-in (new-request) [:body-params :jobs] [j1 j2 j3])
-                handler (api/create-jobs-handler conn task-constraints gpu-enabled? is-authorized-fn)
-                {:keys [body status]} (handler request)]
-            (is (= 400 status))
-            (is (str/includes? body (str uuid)))
-            (is (not (str/includes? body (str (:uuid j3)))))))))))
+        (let [conn (restore-fresh-database! "datomic:mem://mesos-api-test")
+              {:keys [uuid] :as j1} (minimal-job)
+              j2 (assoc (minimal-job) :uuid uuid)
+              j3 (minimal-job)
+              request (assoc-in (new-request) [:body-params :jobs] [j1 j2 j3])
+              handler (api/create-jobs-handler conn task-constraints gpu-enabled? is-authorized-fn)
+              {:keys [body status]} (handler request)]
+          (is (= 400 status))
+          (is (str/includes? body (str uuid)))
+          (is (not (str/includes? body (str (:uuid j3))))))))))

 (deftest test-validate-partitions
   (is (api/validate-partitions {:dataset {"foo" "bar"}}))


Preserve pointers when editing posts

Preserve pointers when editing posts

--- android/src/clojure/net/nightweb/dialogs.clj
+++ android/src/clojure/net/nightweb/dialogs.clj
@@ -265,7 +265,7 @@
 (defn get-new-post-view
   [context content]
   (let [page-content (get-state context :share)
-        pointers (when (empty? content)
+        pointers (if (empty? content)
                    {:ptrhash (when (and (get page-content :userhash)
                                         (or (= :post (get page-content :type))
                                             (-> (get page-content :userhash)
@@ -273,7 +273,9 @@
                                                 (not))))
                                (get page-content :userhash))
                     :ptrtime (when (= :post (get page-content :type))
-                               (get page-content :time))})
+                               (get page-content :time))}
+                   {:ptrhash (get content :ptrhash)
+                    :ptrtime (get content :ptrtime)})
         view (make-ui context [:linear-layout {:orientation 1}
                                [:linear-layout {:orientation 0
                                                 :tag "user-info"}
@@ -297,8 +299,8 @@
     (.setPadding user-name pad 0 0 0)
     (.setLayoutParams user-img (android.widget.LinearLayout$LayoutParams. s s))
     (.setScaleType user-img android.widget.ImageView$ScaleType/CENTER_CROP)
-    (if (get pointers :ptrhash)
-      (future (let [user (get-single-user-data page-content)
+    (if-let [ptr-hash (get pointers :ptrhash)]
+      (future (let [user (get-single-user-data {:userhash ptr-hash})
                     path (get-pic-path (get user :userhash) (get user :pichash))
                     bitmap (path-to-bitmap path thumb-size)]
                 (on-ui (.setText user-name (get user :title))
@@ -330,7 +332,7 @@
   (show-dialog context
                nil
                (get-new-post-view context content)
-               {:positive-name (get-string :send)
+               {:positive-name (get-string :save)
                 :positive-func
                 (fn [context dialog-view button-view]
                   (send-post context


balance missing parens

balance missing parens

--- examples/ring-swagger/src/example/server.clj
+++ examples/ring-swagger/src/example/server.clj
@@ -77,7 +77,7 @@
     (ring/routes
       (swagger-ui/create-swagger-ui-handler
         {:path "/"
-         :config {:validatorUrl nil})
+         :config {:validatorUrl nil}})
       (ring/create-default-handler))))

 (defn start []


SC Book, 3.5

SC Book, 3.5

--- docs/sc-book/sc-three.clj
+++ docs/sc-book/sc-three.clj
@@ -218,3 +218,25 @@
 )
 (start-task)
 (stop-task)
+
+;; Page 90
+///////////////////////////////////////////////////////////////
+// Figure 3.5 Thanks to polymorphism we can substitute objects that understand the same message
+(comment
+(
+p = 64; // a constant note
+q = Pseq([1, 2, 0.5], inf).asStream; // ordered sequence of durations
+t = Task({
+        loop({
+                x.release(2);
+                x = Synth(\default, [freq: p.value.midicps]);
+                q.value.wait;
+        });
+});
+t.start;
+)
+// now change p
+p = Pseq([64, 66, 68], inf).asStream; // to a Pattern: do re mi
+p = { rrand(64, 76) }; // to a Function: random notes from a chromatic octave
+t.stop; x.release(2);
+)


Deterministically close the corpus input file.

Previously the input file was only being closed when the input stream object was finalized, now done deterministically using 'with-open'.

--- Spraff/src/spraff/core.clj
+++ Spraff/src/spraff/core.clj
@@ -111,9 +111,8 @@
                 }
             })
             :channels irc-channels)
-        (dorun (map
-            #(update-state! % state-ref)
-            (line-seq (reader corpus-file)))))))
+        (with-open [in (reader corpus-file)]
+            (dorun (map #(update-state! % state-ref) (line-seq in)))))))


Default http version

Default http version

--- src/clj/fortress/ring/response.clj
+++ src/clj/fortress/ring/response.clj
@@ -15,7 +15,8 @@
         {:keys [body headers]} ring-response]
     (w/write body
              headers
-             (and request (.getProtocolVersion request))
+             (or (and request (.getProtocolVersion request))
+                 HttpVersion/HTTP_1_1)
              status
              (and request (w/spdy-request? request))
              (.channel context))))


Change date-time format returned by the public api

--- src/clj/my_money/routes/public.clj
+++ src/clj/my_money/routes/public.clj
@@ -12,5 +12,5 @@
         (if (= (get headers "authorization") (-> config/env :secret))
           (response/ok {:lastUpdated (->> (db/get-users-newest-event-date {:username user})
                                            :created
-                                           (tf/unparse (:basic-date-time tf/formatters)))})
+                                           (tf/unparse (:date-time tf/formatters)))})
           (response/forbidden))))))


refactor

refactor

--- src/cljs/salava/core/ui/field.cljs
+++ src/cljs/salava/core/ui/field.cljs
@@ -37,10 +37,9 @@
       (swap! fields-atom assoc old-position (nth @fields-atom new-position)
              new-position (nth @fields-atom old-position)))))

-(defn move-positions [fields-atom old-position new-position]
+(defn move-field-drop [fields-atom old-position new-position]
   (let [fields @fields-atom
-        new-position (if-not (nil? new-position) new-position (do #_(assoc fields (inc (count fields)) {})
-                                                                (count fields)))
+        new-position (if-not (nil? new-position) new-position (count fields))
         direction (if (< new-position old-position) :up :down)
         start (subvec fields 0 new-position)
         end (subvec fields new-position (count fields))]


Magic suggestions fix (#772)

Magic suggestions fix (#772)

--- src/status_im/chat/screen.cljs
+++ src/status_im/chat/screen.cljs
@@ -200,9 +200,9 @@
     [messages-view group-chat]]
    ;; todo uncomment this
    #_(when @group-chat [typing-all])
-   (when-not command?
+   (if command?
+     [response-view]
      [suggestion-container])
-   [response-view]
    (when show-emoji?
      [emoji-view])
    [chat-message-input-view]


Remove namespace self reference.

Remove namespace self reference.

This was preventing running lein cloverage

--- src/pipeline/grafter/pipeline/types.clj
+++ src/pipeline/grafter/pipeline/types.clj
@@ -12,8 +12,7 @@
             [clojure.instant :refer [read-instant-date]]
             [clojure.set :as set]
             [clojure.string :as str]
-            [clojure.java.io :as io]
-            [grafter.pipeline.types :as sut])
+            [clojure.java.io :as io])
   (:import [java.net URI URL]
            [java.util UUID Date Map]))


Bump versions

Bump versions

--- ClojureScript/project.clj
+++ ClojureScript/project.clj
@@ -1,4 +1,4 @@
-(defproject goby "0.2.0"
+(defproject goby "0.3.0"
   :description "Develop iOS apps in ClojureScript"
   :url "http://github.com/mfikes/goby"
   :license {:name "Eclipse"
@@ -7,7 +7,7 @@
   :source-paths  ["src"]

   :dependencies [[org.clojure/clojure "1.6.0"]
-                 [org.clojure/clojurescript "0.0-2511" :scope "provided"]
+                 [org.clojure/clojurescript "0.0-3058" :scope "provided"]
                  [org.clojure/core.async "0.1.346.0-17112a-alpha" :scope "provided"]]

-  :plugins [[lein-cljsbuild "1.0.3"]])
+  :plugins [[lein-cljsbuild "1.0.5"]])


Changed paths to relative

Changed paths to relative

--- etl/src/etl/core.clj
+++ etl/src/etl/core.clj
@@ -22,8 +22,8 @@
    (pig/map (fn [line] (select-keys line headers)))))

-(def joined (let [tickets (load-csv headers-tickets "/Users/tomassvarovsky/Desktop/tomas/10_tickets.csv")
-                  coupons (load-csv headers-coupons "/Users/tomassvarovsky/Desktop/tomas/10_coupons.csv")
+(def joined (let [tickets (load-csv headers-tickets "../10_tickets.csv")
+                  coupons (load-csv headers-coupons "../10_coupons.csv")
                   projected-tickets (->> tickets (project [:ITIN_ID :COUPONS :ITIN_FARE :DISTANCE]))
                   projected-coupons (->> coupons (project [:ITIN_ID :MKT_ID :SEQ_NUM :ORIGIN :DEST :YEAR :QUARTER]))]
               (->> (pig/join [(projected-tickets :on :ITIN_ID)
@@ -36,5 +36,3 @@
                         (->> (fold/map :ORIGIN) (fold/first))
                         (->> (fold/map :DEST) (fold/first)))})
      pig/dump)
-
-


fixing test

fixing test

--- test/spcr/core_test.clj
+++ test/spcr/core_test.clj
@@ -3,5 +3,5 @@
             [spcr.core :refer :all]))

 (deftest a-test
-  (testing "FIXME, I fail."
-    (is (= 0 1))))
+  (testing "Checking test-data path"
+    (is (> (.length test-data) (.length "PEB_ETF.csv")))))


Fix bugs in query compiler

Fix bugs in query compiler

--- src/aurora/language.cljs
+++ src/aurora/language.cljs
@@ -220,6 +220,9 @@

   (deffact edge "[x] has an edge to [y]")
   (deffact connected "[x] is connected to [y]")
+
+  ;; [x] has an edge to [y]
+  ;; + [x] is connected to [y]

   ;; [x] has an edge to [y]
   ;; [y] is connected to [z]
@@ -444,6 +447,13 @@
   (let [[plan node] (add-flow plan (FilterMap. (memory->nodes memory) (pattern->deconstructor pattern)))]
     [plan [node] (pattern->vars pattern)]))

+(comment
+  (let [plan empty-flow-plan
+        [plan nodes-a vars-a] (recall->nodes plan (Recall. :known&pretended (->edge 'x 'y)))
+        [plan nodes-b vars-b] (recall->nodes plan (Recall. :known (->connected 'x 0)))]
+    [plan nodes-a nodes-b vars-a vars-b])
+  )
+
 ;; if clause can be calculated somehow then return a new [plan node vars] pair that calculates it
 ;; TODO make this extensible
 (defn compute->nodes [plan nodes vars {:keys [pattern]}]
@@ -465,6 +475,24 @@
                  [plan node] (add-flow plan (->FilterMap nodes filter-map-fun))]
              [plan [node] vars]))))

+(comment
+  (let [plan empty-flow-plan
+        [plan nodes-a vars-a] (recall->nodes plan (Recall. :known&pretended (->edge 'x 'y)))
+        [plan nodes-b vars-b] (compute->nodes plan nodes-a vars-a (Compute. (->Let 'z '[x y] "x + y")))]
+    [plan nodes-a nodes-b vars-a vars-b])
+
+
+  (let [plan empty-flow-plan
+        [plan nodes-a vars-a] (recall->nodes plan (Recall. :known&pretended (->edge 'x 'y)))
+        res (compute->nodes plan nodes-a vars-a (Compute. (->Let 'z '[w x y] "w + x + y")))]
+    res)
+
+  (let [plan empty-flow-plan
+        [plan nodes-a vars-a] (recall->nodes plan (Recall. :known&pretended (->edge 'x 'y)))
+        [plan nodes-b vars-b] (compute->nodes plan nodes-a vars-a (Compute. (->When '[x y] "x > y")))]
+    [plan nodes-a nodes-b vars-a vars-b])
+  )
+
 (defn computes->nodes [plan nodes vars computes]
     (loop [orig-nodes nodes
            plan plan
@@ -474,18 +502,37 @@
            computes-applied computes-applied
            computes-unapplied []]
       (if-let [[compute & computes-remaining] (seq computes-remaining)]
-        (if-let [[new-plan new-nodes new-vars] (compute->nodess plan nodes vars compute)]
+        (if-let [[new-plan new-nodes new-vars] (compute->nodes plan nodes vars compute)]
           (recur orig-nodes new-plan new-nodes new-vars computes-remaining (conj computes-applied compute) computes-unapplied)
           (recur orig-nodes plan nodes vars computes-remaining computes-applied (conj computes-unapplied compute)))
         (if (= nodes orig-nodes)
           [plan nodes vars (set computes-applied)]
           (recur nodes plan nodes vars computes-unapplied computes-applied [])))))

+(comment
+  (let [plan empty-flow-plan
+        [plan nodes-a vars-a] (recall->nodes plan (Recall. :known&pretended (->edge 'x 'y)))
+        [plan nodes-b vars-b computes-applied] (computes->nodes plan nodes-a vars-a [(Compute. (->When '[x z] "x > z"))
+                                                                                (Compute. (->Let 'z '[x y] "x + y"))
+                                                                                (Compute. (->Let 'z '[w x] "a + x"))])]
+    [plan nodes-b vars-b computes-applied])
+  )
+
 (defn output->nodes [plan nodes vars {:keys [memory pattern]}]
   (assert (every? (set vars) (pattern->vars pattern)))
-  (let [[plan output-node] (add-flow plan (FilterMap. nodes (pattern->constructor pattern)))
+  (let [[plan output-node] (add-flow plan (FilterMap. nodes (pattern->constructor pattern vars)))
         plan (add-output plan output-node memory)]
     plan))
+
+(comment
+  (let [plan empty-flow-plan
+        [plan nodes-a vars-a] (recall->nodes plan (Recall. :known&pretended (->edge 'x 'y)))
+        [plan nodes-b vars-b computes-applied] (computes->nodes plan nodes-a vars-a [(Compute. (->When '[x z] "x > z"))
+                                                                                (Compute. (->Let 'z '[x y] "x + y"))
+                                                                                (Compute. (->Let 'z '[w x] "a + x"))])
+        plan (output->nodes plan nodes-b vars-b (Output. :remembered (->connected 'x 'y)))]
+    plan)
+  )

 (defn join->nodes [plan nodes-a vars-a computes-applied-a nodes-b vars-b computes-applied-b]
   (let [key-vars (intersection (set vars-a) (set vars-b))
@@ -500,6 +547,14 @@
         [plan lookup-b] (add-flow plan (->Lookup [index-b] index-a key-ixes-b val-ixes-b))]
     [plan [lookup-a lookup-b] (distinct (concat vars-a vars-b)) (union computes-applied-a computes-applied-b)]))

+(comment
+  (let [plan empty-flow-plan
+        [plan nodes-a vars-a] (recall->nodes plan (Recall. :known&pretended (->edge 'x 'y)))
+        [plan nodes-b vars-b] (recall->nodes plan (Recall. :known (->connected 'y 'z)))
+        [plan nodes-c vars-c computes-applied] (join->nodes plan nodes-a vars-a #{} nodes-b vars-b #{})]
+    [plan nodes-c vars-c])
+  )
+
 ;; RULES

 (defrecord Rule [clauses])
@@ -517,15 +572,28 @@
                                       (let [plan @main-plan
                                             [plan node vars] (recall->nodes plan recall)
                                             [plan node vars computes-applied] (computes->nodes plan node vars computes)]
-                                        (swap! main-plan plan)
+                                        (reset! main-plan plan)
                                         [node vars computes-applied]))
         [nodes vars computes-applied] (reduce (fn [[nodes-a vars-a computes-applied-a] [nodes-b vars-b computes-applied-b]]
                                                (let [plan @main-plan
                                                      [plan nodes vars computes-applied-old] (join->nodes plan nodes-a vars-a computes-applied-a nodes-b vars-b computes-applied-b)
                                                      [plan nodes vars computes-applied-new] (computes->nodes plan nodes vars (difference computes computes-applied-old))]
-                                                 (swap! main-plan plan)
+                                                 (reset! main-plan plan)
                                                  [nodes vars (union computes-applied-old computes-applied-new)]))
                                               nodes&vars&computes-applied)]
     (assert (= computes-applied (set computes)) (str "Could not apply " (pr-str (difference (set computes) computes-applied))))
     (doseq [output outputs]
-      (swap! main-plan (output->nodes @main-plan nodes vars output)))))
+      (reset! main-plan (output->nodes @main-plan nodes vars output)))
+    @main-plan))
+
+
+  (deffact edge "[x] has an edge to [y]")
+  (deffact connected "[x] is connected to [y]")
+
+(rule->flow-plan (Rule. [(Recall. :known&pretended (->edge 'x 'y))
+                         (Output. :pretended (->connected 'x 'y))]))
+
+(rule->flow-plan (Rule. [(Recall. :known&pretended (->edge 'x 'y))
+                         (Recall. :known&pretended (->connected 'y 'z))
+                         (Output. :pretended (->connected 'x 'z))]))
+


Reorder :awesome profiles

Reorder :awesome profiles

--- profiles.clj
+++ profiles.clj
@@ -177,8 +177,8 @@
            :humane
            :inject
            :alembic
-           :refresh
-           :pretty]
+           :pretty
+           :refresh]

  ;; When running tests.
  :test [:humane]


grr state

grr state

--- labs/architecture-examples/om/src/todomvc/item.cljs
+++ labs/architecture-examples/om/src/todomvc/item.cljs
@@ -47,7 +47,7 @@
   (reify
     dom/IInitState
     (-init-state [_ _]
-      {:edit-text (:title title)})
+      {:edit-text title})
     dom/IRender
     (-render [_ owner]
       (let [m {:owner owner :comm comm}


Even friendlier rendering

Even friendlier rendering

This lets the browser take prioritiy between every sample, rather than
every new morph. Each successive sample is only slightly harder to
produce than the last (as the size increases), but each successive morph
is much harder to produce than the last (since we need to keep
generating samples until we hit a new morph).

--- src-cljs/frontend/devcards/morphs.cljs
+++ src-cljs/frontend/devcards/morphs.cljs
@@ -1,5 +1,5 @@
 (ns frontend.devcards.morphs
-  (:require [cljs.core.async :as async :refer [<! chan]]
+  (:require [cljs.core.async :as async :refer [<! chan close!]]
             [clojure.spec :as s :include-macros true]
             [clojure.test.check.generators :as gen]
             [goog.object :as gobject]
@@ -31,6 +31,23 @@
         (.render renderer elt)
         (.getRenderOutput renderer)))))

+(defn friendly-pipe
+  "Like core.async/pipe, but gives the browser an opportunity to run higher
+  priority tasks between each element."
+  ([from to] (friendly-pipe from to true))
+  ([from to close?]
+   (go-loop []
+     (let [v (<! from)]
+       (if (nil? v)
+         (when close? (close! to))
+         (when (>! to v)
+           ;; This gives the browser a chance to break away from the pipe
+           ;; process and return later.
+           (<! (async/timeout 0))
+           (recur)))))
+   to))
+
+
 (defn generate
   "Generates signature, morph pairs for component-factory-var (using optional
   generator overrides) and puts them onto ch."
@@ -40,10 +57,12 @@
          spec (:args (s/get-spec component-factory-var))
          samples (take sample-size (gen/sample-seq (s/gen spec overrides)))
          signature-of-sample (comp signature (partial apply shallow-render (deref component-factory-var)))
+         samples-ch (chan)
          morphs-ch (chan 1 (comp
                             (map (juxt signature-of-sample identity))
                             (distinct-by first)))]
-     (async/onto-chan morphs-ch samples)
+     (async/onto-chan samples-ch samples)
+     (friendly-pipe samples-ch morphs-ch)
      (async/pipe morphs-ch ch))))

@@ -52,9 +71,6 @@
     (go-loop []
       (when-let [morph (<! morph-ch)]
         (om-next/update-state! this update :morphs conj morph)
-        ;; This gives the browser a chance to draw what we've got before
-        ;; calculating more morphs.
-        (<! (async/timeout 1))
         (recur)))))

 (defui ^:once ^:private MorphDisplay


Make repro more accurate

Make repro more accurate

--- bin/sample.cljs
+++ bin/sample.cljs
@@ -1,5 +1,5 @@
 (ns sample
-  (:require [expound.alpha :as expound])
+  (:require [expound.alpha :as expound :include-macros true])
   )

 (expound/def ::foo int? "hi")


Fix code style in pipeline-structure-test

--- test/clj/lambdacd/presentation/pipeline_structure_test.clj
+++ test/clj/lambdacd/presentation/pipeline_structure_test.clj
@@ -39,47 +39,38 @@
   (deftest display-type-test
     (testing "that in-parallel gets detected"
       (is (= :parallel (display-type `in-parallel)))
-      (is (= :parallel (display-type (first (first pipeline)))))
-    )
+      (is (= :parallel (display-type (first (first pipeline))))))
     (testing "that container types get detected"
       (is (= :container (display-type `in-cwd)))
-      (is (= :container (display-type (first (second pipeline)))))
-    )
+      (is (= :container (display-type (first (second pipeline))))))
     (testing "that normal steps get detected"
       (is (= :step (display-type `do-stuff)))
-      (is (= :step (display-type (first simple-pipeline))))
-    )
+      (is (= :step (display-type (first simple-pipeline)))))
     (testing "that a string is unknown type"
       (is (= :unknown (display-type "foo")))
-      (is (= :unknown (display-type (second (second (first pipeline))))))
-    )
+      (is (= :unknown (display-type (second (second (first pipeline)))))))
     (testing "that a sequence is a step" ; TODO: display-representation expects it this way. not entirely sure this is correct..
       (is (= :step (display-type `(do-stuff do-more-stuff))))
-      (is (= :step (display-type simple-pipeline)))
-    ))
-  (deftest display-name-test
+      (is (= :step (display-type simple-pipeline)))))
+                  (deftest display-name-test
     (testing "that the display-name for a step is just the function-name"
       (is (= "do-even-more-stuff" (display-name `do-even-more-stuff)))
-      (is (= "do-even-more-stuff" (display-name (last (second pipeline)))))
-    )
+      (is (= "do-even-more-stuff" (display-name (last (second pipeline))))))
     (testing "that the display-name for a parallel is just the function-name"
       (is (= "in-parallel" (display-name `in-parallel)))
-      (is (= "in-parallel" (display-name (first (first pipeline)))))
-    )))
+      (is (= "in-parallel" (display-name (first (first pipeline))))))))

 (deftest display-representation-test
   (testing "that the display-representation of a step is the display-name and display-type"
-    (is (= {:name "do-even-more-stuff" :type :step :step-id '()} (display-representation (last (second pipeline)))))
-  )
+    (is (= {:name "do-even-more-stuff" :type :step :step-id '()} (display-representation (last (second pipeline))))))
   (testing "that the display-representation of a step with children has name, type and children"
     (is (= {:name "in-cwd"
             :type :container
             :step-id '()
-            :children [{:name "do-even-more-stuff" :type :step :step-id '(1)}]} (display-representation (second pipeline))))
-  )
+            :children [{:name "do-even-more-stuff" :type :step :step-id '(1)}]} (display-representation (second pipeline)))))
   (testing "that a display-representation of a sequence of only steps works"
     (is (= [{:name "do-stuff" :type :step :step-id '(1)} {:name "do-other-stuff" :type :step :step-id '(2)}] (display-representation simple-pipeline))))
   (testing "that foo-pipeline works"
@@ -94,5 +85,4 @@
                {:name "in-cwd"
                 :type :container
                 :step-id '(2 1)
-                :children [{:name "do-other-stuff" :type :step :step-id '(1 2 1)}]}]}] (display-representation foo-pipeline))))
-)
+                :children [{:name "do-other-stuff" :type :step :step-id '(1 2 1)}]}]}] (display-representation foo-pipeline)))) )


Fixed 'issue date' bug.

Fixed 'issue date' bug.

--- src/chronograph/data.clj
+++ src/chronograph/data.clj
@@ -254,7 +254,7 @@
                   updatedInput (-> item :deposited :date-parts first)
                   updated (apply crdate/crossref-date updatedInput)
                   updatedDate (coerce/to-sql-date (crdate/as-date updated))]
-              (insert-event the-doi issued-type-id metadata-source-id date true 1 issuedString nil nil)
+              (insert-event the-doi issued-type-id metadata-source-id issuedDate true 1 issuedString nil nil)
               (insert-event the-doi updated-type-id metadata-source-id updatedDate true 1 nil nil nil))))
         (prn "Next"))))


Fix exception stringification

Fix exception stringification

--- src/cider_ci/utils/exception.clj
+++ src/cider_ci/utils/exception.clj
@@ -5,8 +5,16 @@

 (ns cider-ci.utils.exception
   (:require
+    [clj-logging-config.log4j :as logging-config]
     [clojure.stacktrace :as stacktrace]
+    [clojure.tools.logging :as logging]
+    [clojure.string :as string]
     ))
+
+;(logging-config/set-logger! :level :debug)
+;(logging-config/set-logger! :level :info)
+
+

 (defn expand-to-seq [^Throwable tr]
@@ -18,8 +26,7 @@

 (defn trace-string-seq [ex]
   (map (fn [e] (with-out-str (stacktrace/print-trace-element e)))
-       (.getStackTrace ex)
-       ))
+       (.getStackTrace ex)))

 ;(trace-string-seq (IllegalStateException. "asdfa"))

@@ -33,11 +40,12 @@
 ;(filter-trace-string-seq (trace-string-seq (IllegalStateException. "asdfa")))

 (defn stringify [^Throwable tr]
-  (map
-    (fn [ex]
-      (str [ (with-out-str (stacktrace/print-throwable ex))
-            (filter-trace-string-seq (trace-string-seq ex))]))
-    (expand-to-seq tr)))
-
+  (string/join ", " (map
+                      (fn [ex]
+                        (logging/debug {:ex ex})
+                        (str [ (with-out-str (stacktrace/print-throwable ex))
+                              (filter-trace-string-seq (trace-string-seq ex))]))
+                      (expand-to-seq tr))))
+
 ;(stringify (IllegalStateException. "A"))
 ;(stringify (java.sql.SQLException. "SQ"))


Blacklist require and import

Blacklist require and import


Allow general seqs on in clause for embedded use.

--- src/clj/fleetdb/lint.clj
+++ src/clj/fleetdb/lint.clj
@@ -98,7 +98,7 @@
            (lint #(= 3 (count %)) where "in clause has 2 arguments")
            (let [[_ attr vals] where]
              (lint-attr attr)
-             (lint vector? vals "vals for in must be in a vector")
+             (lint sequential? vals "vals for in must be in a sequence")
              (domap lint-val vals)))
        :else
          (fail "unrecognized where operation" op))))


Add toString implementations for all asm instrs.

--- src/clj/minijava/gas.clj
+++ src/clj/minijava/gas.clj
@@ -6,53 +6,73 @@
 ;;this is NOT an x86 instruction - it is a constant argument to an
 ;;instruction (ie addl $2 %eax)
 (deftype CONST [value]
-  clojure.lang.IPersistentMap)
+  clojure.lang.IPersistentMap
+  Object
+  (toString [] (str "$" value)))

 ;;this is NOT an x86 instruction - it is a memory lookup argument
 ;;for an instruction (ie addl 2(%edx) %eax) offset is optional; its
 ;;the number of bytes off from the address to read from
 (deftype MEMORY [adr offset?]
-  clojure.lang.IPersistentMap)
+  clojure.lang.IPersistentMap
+  Object
+  (toString [] (str offset? "(" adr ")")))

 ;;this is NOT an x86 instruction - it is just a marker that this
 ;;position is the destination of a label
 (deftype LABEL [lbl]
-  clojure.lang.IPersistentMap)
+  clojure.lang.IPersistentMap
+  Object
+  (toString [] (str lbl)))

 ;;movl %eax, %ebx copies the contents of %eax to %ebx
 (deftype movl [src dst]
-  clojure.lang.IPersistentMap)
+  clojure.lang.IPersistentMap
+  Object
+  (toString [] (str "movl " src "," dst)))

 ;;Adds the first operand to the second, storing the result in the second
 (deftype addl [src dst]
-  clojure.lang.IPersistentMap)
+  clojure.lang.IPersistentMap
+  Object
+  (toString [] (str "addl " src "," dst)))

 ;;Subtract the two operands. This subtracts the first operand from
 ;;the second, and stores the result in the second operand.
 (deftype subl [src dst]
-  clojure.lang.IPersistentMap)
+  clojure.lang.IPersistentMap
+  Object
+  (toString [] (str "subl " src "," dst)))

 ;;Performs signed multiplication and stores the result in the second
 ;;operand.  If the second operand is left out, it is assumed to be
 ;;%eax, and the full result is stored in the double-word %edx:%eax.
 (deftype imull [src dst]
-  clojure.lang.IPersistentMap)
+  clojure.lang.IPersistentMap
+  Object
+  (toString [] (str "imull " src "," dst)))

 ;;This pushes what would be the next value for %eip onto the stack,
 ;;and jumps to the destination address. Used for function calls.
 (deftype call [dst]
-  clojure.lang.IPersistentMap)
+  clojure.lang.IPersistentMap
+  Object
+  (toString [] (str "call " dst)))

 ;;An unconditional jump. This simply sets %eip to the destination
 ;;address.
 (deftype jmp [dst]
-  clojure.lang.IPersistentMap)
+  clojure.lang.IPersistentMap
+  Object
+  (toString [] (str "jmp " dst)))

 ;;Compares two integers. It does this by subtracting the first operand
 ;;from the second.  It discards the results, but sets the flags
 ;;accordingly. Usually used before a conditional jump.
 (deftype cmpl [a b]
-  clojure.lang.IPersistentMap)
+  clojure.lang.IPersistentMap
+  Object
+  (toString [] (str "cmpl " a "," b)))

 ;;Conditional branch. cc is the condition code. Jumps to the given
 ;;address if the condition code is true (set from the previous
@@ -70,12 +90,16 @@
 ;;'jcc' is itself not an x86 instruction. The actual instruction will
 ;;be 'jge', if cc is set to ge.
 (deftype jcc [cc dst]
- clojure.lang.IPersistentMap)
+ clojure.lang.IPersistentMap
+ Object
+ (toString [] (str "jcc " dst))) ;; TODO: why does jcc manage cc?

 ;;Pops a value off of the stack and then sets %eip to that value. Used
 ;;to return from function calls.
 (deftype ret []
-   clojure.lang.IPersistentMap)
+   clojure.lang.IPersistentMap
+   Object
+   (toString [] "ret"))

 ;;returns a list of all temps used by this instruction
 (defn uses [instr]


Add 'View Raw' button to pastes

Add 'View Raw' button to pastes

--- src/clj_codetip/view.clj
+++ src/clj_codetip/view.clj
@@ -179,10 +179,11 @@

 (defn paste
   "Read-only paste view."
-  [{:keys [content content-type expires]}]
+  [{:keys [content content-type expires]} id]
   (list
    [:div.sub-navbar
     [:a.btn {:href "/"} "New paste"]
+    [:a.btn {:href (format "/%s/raw" id)} "View Raw"]
     [:label "Expires"]
     [:span (f/unparse (f/formatters :rfc822) expires)]]
    [:div#focus.paste-content


Add possibility to configure root path via :root key

--- src/clj_gatling/core.clj
+++ src/clj_gatling/core.clj
@@ -5,13 +5,14 @@
             [clj-gatling.report :as report]
             [clj-gatling.simulation :as simulation]))

-(def results-dir "target/results")
-
 (defn create-dir [dir]
   (.mkdirs (java.io.File. dir)))

-(defn run-simulation [scenario users]
+(defn run-simulation [scenario users & [options]]
  (let [start-time (LocalDateTime.)
+       results-dir (if (nil? (:root options))
+                      "target/results"
+                      (:root options))
        result (simulation/run-simulation scenario users)
        csv (csv/write-csv (report/create-result-lines start-time result) :delimiter "\t" :end-of-line "\n")]
    (create-dir (str results-dir "/input"))


Remove :classifier "aot"

Remove :classifier "aot"

AOT causes cljsbuild to drop cljs version to 0.0-3211 https://github.com/emezeske/lein-cljsbuild/issues/431

--- src/leiningen/new/mies/project.clj
+++ src/leiningen/new/mies/project.clj
@@ -2,9 +2,9 @@
   :description "FIXME: write this!"
   :url "http://example.com/FIXME"
   :dependencies [[org.clojure/clojure "1.7.0"]
-                 [org.clojure/clojurescript "1.7.170" :classifier "aot"
+                 [org.clojure/clojurescript "1.7.170"
                   :exclusion [org.clojure/data.json]]
-                 [org.clojure/data.json "0.2.6" :classifier "aot"]]
+                 [org.clojure/data.json "0.2.6"]]
   :jvm-opts ^:replace ["-Xmx1g" "-server"]
   :plugins [[lein-npm "0.6.1"]]
   :npm {:dependencies [[source-map-support "0.3.2"]]}


Update deps

Update deps

--- frontend/project.clj
+++ frontend/project.clj
@@ -9,11 +9,12 @@
   :dependencies [[org.clojure/clojure "1.8.0"]
                  [org.clojure/clojurescript "1.9.93"]
                  [org.clojure/core.async "0.2.385" :exclusions [org.clojure/tools.reader]]
-                 [org.omcljs/om "1.0.0-alpha36"]
+                 [org.omcljs/om "1.0.0-alpha40"]
                  [cljs-ajax "0.5.8"]                        ; AJAX for om
                  [com.cognitect/transit-cljs "0.8.239"]     ; Better JSON support
                  [figwheel-sidecar "0.5.3-2" :scope "devcards"]
-                 [devcards "0.2.1-7" :scope "devcards" :exclusions [org.clojure/clojurescript]]]
+                 [devcards "0.2.1-7" :scope "devcards" :exclusions [org.clojure/clojurescript]]
+                 [devcards-om-next "0.1.1" :scope "devcards"]]

   :plugins [[lein-figwheel "0.5.4-7"]
             [lein-cljsbuild "1.1.3" :exclusions [[org.clojure/clojure]]]]
@@ -43,7 +44,7 @@
                 :source-paths ["src/crunsher" "src/devcards"]
                 :figwheel {:devcards true}
                 :compiler {:main crunsher.devcards.core
-                           :asset-path "../js/compiled/devcards/out"
+                           :asset-path "js/compiled/devcards/out"
                            :output-to "resources/public/js/compiled/crunsher.js"
                            :output-dir "resources/public/js/compiled/devcards/out"
                            :source-map-timestamp true}}


Fix route name

Fix route name

--- frontend/routes.cljs
+++ frontend/routes.cljs
@@ -38,7 +38,7 @@
 (defn define-admin-routes! [nav-ch]
   (defroute v1-admin-recent-builds "/admin/recent-builds" []
     (open-to-inner! nav-ch :dashboard {:admin true}))
-  (defroute v1-admin-recent-builds "/admin/deployments" []
+  (defroute v1-admin-deployments "/admin/deployments" []
     (open-to-inner! nav-ch :dashboard {:deployments true}))
   (defroute v1-admin-build-state "/admin/build-state" []
     (open-to-inner! nav-ch :build-state {:admin true}))


pass through the query-params and other args on the project-dashboard route

--- frontend/routes.cljs
+++ frontend/routes.cljs
@@ -76,8 +76,8 @@
   (defroute v1-project-dashboard "/gh/:org/:repo" {:as params}
     (open-to-inner! nav-ch :dashboard params))
   (defroute v1-project-branch-dashboard #"/gh/([^/]+)/([^/]+)/tree/(.+)" ; workaround secretary's annoying auto-decode
-    [org repo branch]
-    (open-to-inner! nav-ch :dashboard {:org org :repo repo :branch branch}))
+    [org repo branch args]
+    (open-to-inner! nav-ch :dashboard (merge args {:org org :repo repo :branch branch})))
   (defroute v1-build #"/gh/([^/]+)/([^/]+)/(\d+)"
     [org repo build-num]
     (open-to-inner! nav-ch :build {:project-name (str org "/" repo)


makes render-route work for fragment-routes

--- frontend/routes.cljs
+++ frontend/routes.cljs
@@ -46,12 +46,13 @@
     (open-to-inner! nav-ch :admin {:admin true})))

-;; TODO: make this handle params
 ;; Creates a route that will ignore fragments and add them to params as {:_fragment "#fragment"}
 (defrecord FragmentRoute [route]
   sec/IRenderRoute
   (render-route [this]
-    route))
+    (sec/render-route route))
+  (render-route [this params]
+    (sec/render-route route params)))

 (extend-protocol sec/IRouteMatches
   FragmentRoute


Add value event type to firebase channels

--- src/cljs/hacker_agent/hacker-base.cljs
+++ src/cljs/hacker_agent/hacker-base.cljs
@@ -52,7 +52,7 @@
    (fb->chan fbref (chan)))
   ([fbref close-chan]
    (let [mult-close (mult close-chan)
-         events [:child_added :child_changed :child_removed]
+         events [:child_added :child_changed :child_removed :value]
          event-chans (map (fn [event]
                             (fb->chan fbref (tap mult-close (chan)) event))
                           events)]
@@ -83,6 +83,7 @@
       :child_added (swap! data assoc-in child-path val)
       :child_changed (swap! data assoc-in child-path val)
       :child_removed (swap! data update-in path dissoc key)
+      :value nil
       (.log js/console (clj->js [event key val])))))

 (defn item-cache-fn [data path]
@@ -104,6 +105,7 @@
         :child_changed (do
                          (f val)
                          (swap! data assoc-in child-path val))
+        :value nil
         (.log js/console (clj->js [event key val]))))))

 (defn r-item-binder [f]
@@ -119,6 +121,7 @@
         :child_added (add-change-fn)
         :child_changed (add-change-fn)
         :child_removed (swap! data update-in path dissoc key)
+        :value nil
         (.log js/console (clj->js [event key val]))))))

 (defn- r-cache-fn [data path]
@@ -153,6 +156,7 @@
         :child_added (add-change-fn)
         :child_changed (add-change-fn)
         :child_removed (swap! data update-in path dissoc key)
+        :value nil
         (.log js/console (clj->js [event key val]))))) )

 (defn unbind! [data path]


Code style

Code style

--- src/cljs/hacker_agent/hacker-base.cljs
+++ src/cljs/hacker_agent/hacker-base.cljs
@@ -132,7 +132,7 @@
                (id->fbref id)
                (r-item-binder (r-cache-fn data path)))))))

-(defn r-cache [data path id]
+(defn r-cache! [data path id]
   ((r-cache-fn data path) id))

 (defn item-binder [& [levels & more]]


Reverting snapshot-list to a native array because converting it to a clojure vector is too slow too to it's size.

--- src-cljs/app/main.cljs
+++ src-cljs/app/main.cljs
@@ -72,15 +72,15 @@
   (* hours 3600000))

 (defn sync-time-with-snapshot! []
-  (reset! selected-time (:time (@snapshot-list @snapshot-index))))
+  (reset! selected-time (.-time (nth @snapshot-list @snapshot-index))))

 ; TODO: This could be improved. Probably need to rethink my data model
 (defn show-closest-snapshot! []
   (let [timestamp @selected-time
-        earlier-index (first (keep-indexed #(if (>= timestamp (:time %2)) %1) @snapshot-list))
+        earlier-index (first (keep-indexed #(if (>= timestamp (.-time %2)) %1) @snapshot-list))
         later-index (max (dec earlier-index) 0)
-        later (:time (@snapshot-list later-index))
-        earlier (:time (@snapshot-list earlier-index))
+        later (.-time (nth @snapshot-list later-index))
+        earlier (.-time (nth @snapshot-list earlier-index))
         display-index (if (< (- later timestamp) (- timestamp earlier))
                         later-index
                         earlier-index)]
@@ -96,8 +96,8 @@
 ;;------------------------------------------------------------------------------

 (defn on-snapshot-list-change [_ _ _ snapshot-list]
-  (let [start-date (js/Date. (:time (last snapshot-list)))
-        end-date (js/Date. (:time (first snapshot-list)))
+  (let [start-date (js/Date. (.-time (last snapshot-list)))
+        end-date (js/Date. (.-time (first snapshot-list)))
         datepicker-el ($ "#datepicker")]
     (.datepicker datepicker-el "remove")
     (.datepicker datepicker-el
@@ -122,10 +122,10 @@
 (add-watch selected-time :_ on-selected-time-change)

 (defn on-snapshot-index-change [_ _ _ new-index]
-  (let [snapshot (@snapshot-list new-index)
-        timestamp (:time snapshot)
+  (let [snapshot (nth @snapshot-list new-index)
+        timestamp (.-time snapshot)
         datetime (js/Date. timestamp)
-        image (:image snapshot)
+        image (.-image snapshot)
         time-display (str (.toDateString datetime) " " (.toLocaleTimeString datetime))]
     (attr ($ "#currentSnapshot") "src" image)
     (text ($ "#imageDateTime") time-display)
@@ -216,13 +216,13 @@

 (defn init-snapshot-list []
   (->> (.-SNAPSHOT_LIST js/window) ; server injected to this in a <script>
-       (js->clj)
-       (clojure.walk/keywordize-keys)
+       ; (js->clj)
+       ; (clojure.walk/keywordize-keys)
        (reset! snapshot-list)))

 (defn init-snapshot-index []
   (let [image (attr ($ "#currentSnapshot") "src")
-        starting-index (first (keep-indexed #(if (= image (:image %2)) %1) @snapshot-list))]
+        starting-index (first (keep-indexed #(if (= image (.-image %2)) %1) @snapshot-list))]
     (reset! snapshot-index
       (if (pos? starting-index)
         starting-index


lein-release plugin: bumped version from 0.1.11 to 0.1.12-SNAPSHOT for next development cycle

--- re_view_hiccup/project.clj
+++ re_view_hiccup/project.clj
@@ -1,4 +1,4 @@
-(defproject re-view-hiccup "0.1.11"
+(defproject re-view-hiccup "0.1.12-SNAPSHOT"
   :description "Hiccup parser for re-view"

   :url "https://www.github.com/braintripping/re-view/tree/master/re_view_hiccup"


Added temporary defspec that will log failures better than test.check. Changed string generators to skip whitespace to workaround data.xml problem with empty whitespace nodes.

--- src/cmr/common/test/test_check_ext.clj
+++ src/cmr/common/test/test_check_ext.clj
@@ -1,8 +1,55 @@
 (ns cmr.common.test.test-check-ext
   (:require [clojure.test.check.generators :as gen]
             [clojure.string :as s]
-            [clj-time.coerce :as c])
+            [clj-time.coerce :as c]
+            [clojure.test.check.clojure-test]
+            [clojure.test])
   (:import java.util.Random))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; The following two functions were copy and pasted from the clojure test.check library to fix a small
+;; issue relating to the printing out of failed specs.
+;; See http://dev.clojure.org/jira/browse/TCHECK-18
+;; This defspec can be used until the test.check issue is fixed and released.
+
+(defn- assert-check
+  [{:keys [result] :as m}]
+  (println (pr-str m))
+  (if (instance? Throwable result)
+    (throw result)
+    (clojure.test/is result)))
+
+(defmacro defspec
+  "Defines a new clojure.test test var that uses `quick-check` to verify
+  [property] with the given [args] (should be a sequence of generators),
+  [default-times] times by default.  You can call the function defined as [name]
+  with no arguments to trigger this test directly (i.e.  without starting a
+  wider clojure.test run), or with a single argument that will override
+  [default-times]."
+  ([name property]
+   `(defspec ~name ~clojure.test.check.clojure-test/*default-test-count* ~property))
+
+  ([name default-times property]
+   `(do
+      ;; consider my shame for introducing a cyclical dependency like this...
+      ;; Don't think we'll know what the solution is until clojure.test.check
+      ;; integration with another test framework is attempted.
+      (require 'clojure.test.check)
+      (defn ~(vary-meta name assoc
+                        ::defspec true
+                        :test `#(#'cmr.common.test.test-check-ext/assert-check (assoc (~name) :test-var (str '~name))))
+        ([] (~name ~default-times))
+        ([times# & {:keys [seed# max-size#] :as quick-check-opts#}]
+           (apply
+             clojure.test.check/quick-check
+             times#
+             (vary-meta ~property assoc :name (str '~property))
+             (flatten (seq quick-check-opts#))))))))
+
+
+;; End of copy and pasted section
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+

 (defn optional
   "Returns either nil or the given generator. This should be used for optional fields"
@@ -65,12 +112,17 @@
           #(and (>= % lower) (<= % upper))
           [value (map double-rose-tree (shrink-double value))])))))

+(defn- not-whitespace
+  "Takes a string generator and returns a new string generator that will not contain only whitespace"
+  [generator]
+  (gen/such-that #(not (re-matches #"^\s+$" %)) generator))
+
 (defn string-ascii
   "Like the clojure.test.check.generators/string-ascii but allows a min and max length to be set"
   ([]
    gen/string-ascii)
   ([min-size max-size]
-   (gen/fmap s/join (gen/vector gen/char-ascii min-size max-size))))
+   (not-whitespace (gen/fmap s/join (gen/vector gen/char-ascii min-size max-size)))))

 (defn string-alpha-numeric
   "Like the clojure.test.check.generators/string-alpha-numeric but allows a min and max length to be set"


Fix available status of Noop.

Fix available status of Noop.

--- src/clj/hatnik/web/server/renderer.clj
+++ src/clj/hatnik/web/server/renderer.clj
@@ -95,15 +95,15 @@
    [:ul.actions
     [:li.available [:strong  "Email"]
      " - send an email with custom text. You can use template variables to substitute the library name or the version."]
+    [:li.available {:title "Work in progress"} [:strong "Noop"]
+     " - does nothing. Useful if you want to "
+     "have a place that lists the latest versions for selected libraries."]
     [:li.unavailable {:title "Work in progress"} [:strong "GitHub Issue"]
      " - create an issue in the selected repo. The text can be customized just like in email."]
     [:li.unavailable {:title "Work in progress"} [:strong "GitHub Pull Request"]
      " - create a pull request in selected repo using simple find-and-replace-in-file operations."]
     [:li.unavailable {:title "Work in progress"} [:strong "GitHub Wiki"]
-     " - update a wiki page using the same find-and-replace operations."]
-    [:li.unavailable {:title "Work in progress"} [:strong "Noop"]
-     " - does nothing. Useful if you want to "
-     "have a place that lists the latest versions for selected libraries."]]
+     " - update a wiki page using the same find-and-replace operations."]]
    ])

 (defn core-page [config user]


coercion and truncation functions for vec2

--- src/cljs/infinitelives/utils/vec2.cljs
+++ src/cljs/infinitelives/utils/vec2.cljs
@@ -170,3 +170,19 @@
             (Math/atan (/ y x))
             (+ Math/PI Math/PI (Math/atan (/ y x))))
           (+ Math/PI (Math/atan (/ y x))))))))
+
+(defn truncate
+  [v scalar]
+  (let [len (magnitude v)]
+    (if (> len scalar)
+      (scale (unit v) scalar)
+      v)))
+
+(defn as-vector [v]
+  [(aget v 0) (aget v 1)])
+
+(defn get-x [v]
+  (aget v 0))
+
+(defn get-y [v]
+  (aget v 1))


refactoring

refactoring

--- src/cljs/salava/badge/ui/settings.cljs
+++ src/cljs/salava/badge/ui/settings.cljs
@@ -32,18 +32,20 @@
       {:params {:badges (list (:id @state)) :lang-option lang-option }
        :handler (js-navigate-to badge-url)})))

+(defn update-settings [badge-id state]
+  (ajax/GET
+    (path-for (str "/obpv1/badge/settings/" badge-id) true)
+    {:handler (fn [data]
+                (swap! state assoc :badge-settings data (assoc data :new-tag "")))}))
+
+
 (defn save-raiting [id state init-data raiting]
   (ajax/POST
     (path-for (str "/obpv1/badge/save_raiting/" id))
     {:params   {:rating  (if (pos? raiting) raiting nil)}
      :handler (fn []
-                (init-data state id (:tab-no @state)))}))
-
-(defn update-settings [badge-id state]
-  (ajax/GET
-    (path-for (str "/obpv1/badge/settings/" badge-id) true)
-    {:handler (fn [data]
-                (swap! state assoc :badge-settings data (assoc data :new-tag "")))}))
+                (update-settings id state)
+                #_(init-data state id (:tab-no @state)))}))

 (defn save-settings [state init-data context]


Refactored code based on review comments; Added comments.

--- src/cmr/search/services/parameters.clj
+++ src/cmr/search/services/parameters.clj
@@ -7,6 +7,9 @@
             [cmr.common.date-time-parser :as dt-parser]
             [cmr.common.util :as u]
             [cmr.search.services.legacy-parameters :as lp]))
+
+(def nrt-aliases
+  ["near_real_time","nrt", "NRT", "near real time","near-real time","near-real-time","near real-time"])

 (def concept-param->type
   "A mapping of param names to query condition types based on concept-type"
@@ -145,11 +148,12 @@
         (map #(parameter->condition concept-type param % options) value))
       (qm/or-conds
         (map #(parameter->condition concept-type param % options) value)))
-    (let [nrt-aliases ["near_real_time","nrt", "NRT", "near real time","near-real time","near-real-time","near real-time"]
-          value (if (some #{value} nrt-aliases) "NEAR_REAL_TIME" value)]
+    (let [value (if (some #{value} nrt-aliases) "NEAR_REAL_TIME" value)]
       (if (or (= "SCIENCE_QUALITY" value)
               (and (= "SCIENCE_QUALITY" (s/upper-case value))
                    (not= "false" (get-in options [:collection-data-type :ignore-case]))))
+        ; SCIENCE_QUALITY collection-data-type should match concepts with SCIENCE_QUALITY
+        ; or the ones missing collection-data-type field
         (qm/or-conds
           [(string-condition-with-options :collection-data-type value options :collection-data-type)
            (qm/map->MissingCondition {:field :collection-data-type})])


switch to use binding instead of env

switch to use binding instead of env

env data can (due to a bug) end up getting written to disc for cache.
adding a function breaks that cache.

--- src/main/shadow/build/compiler.clj
+++ src/main/shadow/build/compiler.clj
@@ -190,6 +190,8 @@
    ;; FIXME: write a patch that gets rid of this. totally pointless to have these in each env
    :js-globals ana-js-globals})

+(def ^:dynamic *analyze-top* nil)
+
 (defn analyze
   ([state compile-state form]
    (analyze state compile-state form false))
@@ -229,19 +231,19 @@
                         :context :expr
                         :def-emits-var true)))

+
            result
-           (-> base-env
-               ;; FIXME: could also use a binding? env is passed everywhere though
-               (assoc ::analyze-top (fn [form]
-                                      ;; will be turned into statements. repl-context would turn them into :expr
-                                      (let [ast (analyze state compile-state form false)]
-                                        (swap! injected-forms-ref conj ast))))
-
-               ;; ana/analyze rebinds ana/*cljs-warnings* which we already did
-               ;; it seems to do this to get rid of duplicated warnings?
-               ;; we just do a distinct later
-               (ana/analyze* form nil opts)
-               (post-analyze state))]
+           (binding [*analyze-top*
+                     (fn [form]
+                       ;; will be turned into statements. repl-context would turn them into :expr
+                       (let [ast (analyze state compile-state form false)]
+                         (swap! injected-forms-ref conj ast)))]
+             (-> base-env
+                 ;; ana/analyze rebinds ana/*cljs-warnings* which we already did
+                 ;; it seems to do this to get rid of duplicated warnings?
+                 ;; we just do a distinct later
+                 (ana/analyze* form nil opts)
+                 (post-analyze state)))]

        (let [injected-forms @injected-forms-ref]
          (if-not (seq injected-forms)


Rename round-start-time to start-time (for consistency)

--- src/wombats/sockets/messages.clj
+++ src/wombats/sockets/messages.clj
@@ -110,7 +110,7 @@

   (get-message :game-info
                {:game/id (:game/id game-config)
-                :game/round-start-time (get-start-time game-state)
+                :game/start-time (get-start-time game-state)
                 :game/round-number (get-round-number game-state)
                 :game/max-players (:game/max-players game-config)
                 :game/player-count (count (:players game-state))


Fix horizontal bug in navigation

Fix horizontal bug in navigation

--- src/discuss/components/navigation.cljs
+++ src/discuss/components/navigation.cljs
@@ -53,10 +53,10 @@
   []
   (reify om/IRender
     (render [_]
-      (dom/div #js {:className "text-muted row"}
-               (dom/div #js {:className "col-md-6"}
+      (dom/div #js {:className "text-muted"}
+               (dom/div #js {:className "col col-md-6"}
                         (home)
                         (find-arg)
                         (options))
-               (dom/div #js {:className "col-md-6 text-right"}
+               (dom/div #js {:className "col col-md-6 text-right"}
                         (if (lib/logged-in?) (logout) (login)))))))


deal with already deleted record when deleting

--- src/er_cassandra/model/alia/delete.clj
+++ src/er_cassandra/model/alia/delete.clj
@@ -12,20 +12,10 @@
    [er_cassandra.model.types Model]
    [er_cassandra.session Session]))

-(defn delete*
-  "delete a single instance, removing primary, secondary unique-key and
-   lookup records "
-
-  ([^Session session ^Model model key record-or-key-value opts]
-
-   (with-context deferred-context
-     (mlet [[record & _] (alia-select/select* session
-                                              model
-                                              key
-                                              record-or-key-value
-                                              nil)
-
-            primary-response (m/when record
+(defn ^:private delete-with-primary
+  [^Session session ^Model model key record opts]
+  (with-context deferred-context
+    (mlet [primary-response (m/when record
                                (alia-upsert/delete-record
                                 session
                                 model
@@ -54,5 +44,22 @@
                                 model
                                 record
                                 nil))]
-       (return
-        [:ok record :deleted])))))
+      (return
+       [:ok record :deleted]))))
+
+(defn delete*
+  "delete a single instance, removing primary, secondary unique-key and
+   lookup records "
+
+  ([^Session session ^Model model key record-or-key-value opts]
+
+   (with-context deferred-context
+     (mlet [[record & _] (alia-select/select* session
+                                              model
+                                              key
+                                              record-or-key-value
+                                              nil)]
+       (if record
+         (delete-with-primary session model key record opts)
+         (return
+          [:ok nil :no-primary-record]))))))


nil values for removed keys

nil values for removed keys

--- src/er_cassandra/model/alia/upsert.clj
+++ src/er_cassandra/model/alia/upsert.clj
@@ -179,9 +179,22 @@
               (= (t/extract-uber-key-value entity old-record)
                  (t/extract-uber-key-value entity record))))

-  (ddo [:let [opts (ts/default-timestamp-opt opts)]
-
-        record (t/run-callbacks session entity :before-save record opts)
+  (ddo [:let [opts (ts/default-timestamp-opt opts)
+
+              record-keys (-> record keys set)]
+
+
+        record-bs (t/run-callbacks session entity :before-save record opts)
+
+        :let [record-bs-keys (-> record-bs keys set)
+              removed-keys (set/difference record-keys record-bs-keys)
+
+              ;; if the op is an insert, then old-record will be nil,
+              ;; and we will need nil values for any removed keys
+              nil-removed (->> removed-keys
+                               (map (fn [k] [k nil]))
+                               (into {}))]
+

         [updated-record-with-keys
          acquire-failures] (unique-key/upsert-primary-record-and-update-unique-keys
@@ -209,7 +222,7 @@
     (return
      ;; merge the updated-record-with-keys with the old-record, so any
      ;; cols not included in the update are in the response
-     (pair (merge old-record updated-record-with-keys)
+     (pair (merge nil-removed old-record updated-record-with-keys)
            acquire-failures))))

 (s/defn upsert*


Syntax error

Syntax error

--- resources/leiningen/new/onyx_app/project.clj
+++ resources/leiningen/new/onyx_app/project.clj
@@ -8,4 +8,4 @@
                  [com.mdrogalis/onyx "0.6.0-beta1"]
                  [com.stuartsierra/component "0.2.3"]
   :profiles {:dev {:dependencies [[org.clojure/tools.namespace "0.2.10"]]
-                   :source-paths ["env/dev" "src"]}}u)
+                   :source-paths ["env/dev" "src"]}})


Remove superfluous local variables from fact test cases

Signed-off-by: Deepak Giridharagopal <d11186354d1ef01ca06ae37d7e23e827da13e85f@puppetlabs.com>

--- test/com/puppetlabs/cmdb/test/http/facts.clj
+++ test/com/puppetlabs/cmdb/test/http/facts.clj
@@ -42,19 +42,17 @@
     (scf-store/add-certname! certname_with_facts)
     (scf-store/add-facts! certname_with_facts facts)
     (testing "for an absent node"
-      (let [content-type "application/json"
-            request (make-request "/facts/imaginary_node")
+      (let [request (make-request "/facts/imaginary_node")
             response (*app* request)]
         (is (= (:status response) 404))
-        (is (= (get-in response [:headers "Content-Type"]) content-type))
+        (is (= (get-in response [:headers "Content-Type"]) *content-type*))
         (is (= (json/parse-string (:body response) true)
                {:error "Could not find facts for imaginary_node"}))))
     (testing "for a present node without facts"
-      (let [content-type "application/json"
-            request (make-request (format "/facts/%s" certname_without_facts))
+      (let [request (make-request (format "/facts/%s" certname_without_facts))
             response (*app* request)]
         (is (= (:status response) 404))
-        (is (= (get-in response [:headers "Content-Type"]) content-type))
+        (is (= (get-in response [:headers "Content-Type"]) *content-type*))
         (is (= (json/parse-string (:body response) true)
                {:error (str "Could not find facts for " certname_without_facts)}))))
     (testing "for a present node with facts"


deprecation notice.

deprecation notice.

--- src/cavm/h2.clj
+++ src/cavm/h2.clj
@@ -1297,6 +1297,11 @@
     (H2Db. db)))

 ;
+; The following is deprecated, due to poor performance.  Will be dropped after the next
+; client code release.
+;
+
+;
 ; Support for pulling a row from a blob column. Implements
 ; an LRU cache of retrieved blobs.
 ;


working matchdate update

working matchdate update

--- src/cljs/foosball/locations/report_match.cljs
+++ src/cljs/foosball/locations/report_match.cljs
@@ -155,10 +155,8 @@
   (om/update! report-match path player))

 (defn handle-matchdate-update [report-match path js-date]
-  (if-let [matchdate (dc/to-date-time js-date)]
-    (debug "handle matchdate " matchdate)
-                                        ;      (om/transact! report-match path (fn [v] ()))
-    ))
+  (let [matchdate (dc/to-date-time js-date)]
+    (om/update! report-match path matchdate)))

 (defn report-match-component [{:keys [active-players report-match] :as app} owner]
   (reify
@@ -196,6 +194,7 @@
                                      (selected-players (:team1 report-match)
                                                        (:team2 report-match))))
             __ (debug "scores" (map (fn [kw] (get-in report-match [kw :score])) [:team1 :team2]))
+            ___ (debug "matchdate" (-> report-match :matchdate d/->str))
             render-team (partial render-team-controls app)]
         (html
          [:div


CMR-5387: Changed variable name to be more readable.

--- ingest-app/src/cmr/ingest/api/translation.clj
+++ ingest-app/src/cmr/ingest/api/translation.clj
@@ -57,11 +57,11 @@

 (defn- get-template
   "Returns a XSLT template from the filename, using the context cache."
-  [context f]
+  [context filename]
   (cache/get-value
    (cache/context->cache context xsl-transformer-cache-name)
-   f
-   #(xslt/read-template f)))
+   filename
+   #(xslt/read-template filename)))

 (defn- generate-granule-iso-mends-metadata
   "Generate granule ISO MENDS metadata from the given umm-lib granule model.


Improve code sample on batch2

Improve code sample on batch2

--- src-docs/com/wsscode/pathom/book/connect/batch2.cljs
+++ src-docs/com/wsscode/pathom/book/connect/batch2.cljs
@@ -29,11 +29,12 @@
       (async/<! (sleep 1000))
       ; the input will be sequencial if a batch oportunity happens
       (if (sequential? input)
-        (mapv (fn [v] {:number-added (inc (:number v))}) input)
         ; this will return a list of results, this order should match the input order, like this:
         ; [{:number-added 4}
         ;  {:number-added 11}
         ;  {:number-added 19}]
+        (mapv (fn [v] {:number-added (inc (:number v))}) input)
+        ; the else case still handles the single input case
         {:number-added (inc (:number input))}))))

 (def parser (p/async-parser {::p/plugins [(p/env-plugin {::p/reader             [p/map-reader pc/all-async-readers]


(PDB-5484) http.facts-test: remove vestigial compare-structured-response

Remove it, instead of just marking the version argument unused.  It
wasn't needed after 019cf18e18cfa566a9eaa20339b41e0c8dad0e87.

--- test/puppetlabs/puppetdb/http/facts_test.clj
+++ test/puppetlabs/puppetdb/http/facts_test.clj
@@ -57,11 +57,6 @@
     (is (= (count expected-results) (count actual-result)))
     (is (= expected-results (set actual-result)))
     (is (= HttpURLConnection/HTTP_OK status))))
-
-(defn compare-structured-response
-  "compare maps that may have been stringified differently."
-  [response expected version]
-  (is (= response expected)))

 (def common-subquery-tests
   (omap/ordered-map
@@ -930,9 +925,7 @@
                               :body
                               slurp)
                   actual (json/parse-string actual true)]
-              (compare-structured-response (map unkeywordize-values actual)
-                                           expected
-                                           version)))))
+              (is (= (map unkeywordize-values actual) expected))))))

       (testing "works on value"
         (doseq [[order expected] [["ASC" [f1 f3]]
@@ -943,9 +936,7 @@
                               :body
                               slurp)
                   actual (json/parse-string actual true)]
-              (compare-structured-response (map unkeywordize-values actual)
-                                           expected
-                                           version)))))
+              (is (= (map unkeywordize-values actual) expected))))))

       (testing "unextracted field with alias"
         (doseq [[order expected] [["ASC" [f1 f2 f3 f4 f5]]
@@ -956,10 +947,8 @@
                               :body
                               slurp)
                   actual (json/parse-string actual true)]
-              (compare-structured-response
-                (map (comp :environment unkeywordize-values) actual)
-                (map :environment expected)
-                version)))))
+              (is (= (map (comp :environment unkeywordize-values) actual)
+                     (map :environment expected)))))))

       (testing "multiple fields"
         (doseq [[[name-order certname-order] expected] [[["DESC" "ASC"]  [f2 f4 f5 f1 f3]]
@@ -973,9 +962,7 @@
                               :body
                               slurp)
                   actual (json/parse-string actual true)]
-              (compare-structured-response (map unkeywordize-values actual)
-                                           expected
-                                           version))))))
+              (is (= (map unkeywordize-values actual) expected)))))))

     (testing "offset"
       (doseq [[order expected-sequences] [["ASC"  [[0 [f1 f2 f3 f4 f5]]
@@ -998,9 +985,7 @@
                               :body
                               slurp)
                   actual (json/parse-string actual true)]
-              (compare-structured-response (map unkeywordize-values actual)
-                                           expected
-                                           version))))))))
+              (is (= (map unkeywordize-values actual) expected)))))))))

 (deftest-http-app facts-environment-paging
   [[_version endpoint] facts-endpoints
@@ -1063,9 +1048,8 @@
                                        {:order_by
                                                  (vector-param method [{"field" "environment" "order" env-order}
                                                                       {"field" "name" "order" name-order}])})]
-            (compare-structured-response (map unkeywordize-values (json/parse-string (slurp (:body actual)) true))
-                                         expected
-                                         version)))))))
+            (is (= (map unkeywordize-values (json/parse-string (slurp (:body actual)) true))
+                   expected))))))))

 (deftest-http-app fact-environment-queries
   [[_version endpoint] facts-endpoints


Group tests

Group tests

--- test/buildviz/handler_test.clj
+++ test/buildviz/handler_test.clj
@@ -5,7 +5,7 @@
   (:require [cheshire.core :as json]))

 (deftest test-app
-  (testing "app"
+  (testing "PUT to /builds/:job/:build"
     ; PUT should return 200
     (let [response (app (request :put "/builds/mybuild/1"))]
       (is (= (:status response) 200)))
@@ -17,8 +17,9 @@
                             (content-type "application/json")))
           resp-data (json/parse-string (:body response))]
       (is (= resp-data
-             {"start" 42 "end" 43})))
+             {"start" 42 "end" 43}))))

+  (testing "GET to /builds/:job/:build"
     ; GET should return 200
     (app (-> (request :put
                       "/builds/anotherBuild/1")


Update figwheel 0.5.0-2 => 0.5.0-3

Update figwheel 0.5.0-2 => 0.5.0-3

--- src/leiningen/new/chestnut/project.clj
+++ src/leiningen/new/chestnut/project.clj
@@ -92,8 +92,8 @@
   :auto {"sassc"  {:file-pattern  #"\.(scss)$"}}{{/sass?}}

   :profiles {:dev
-             {:dependencies [[figwheel "0.5.0-2"]
-                             [figwheel-sidecar "0.5.0-2"]
+             {:dependencies [[figwheel "0.5.0-3"]
+                             [figwheel-sidecar "0.5.0-3"]
                              [com.cemerick/piggieback "0.2.1"]
                              [org.clojure/tools.nrepl "0.2.12"]{{{project-dev-deps}}}]


change tag url;add tag search function

change tag url;add tag search function

--- src/bookmarks/core.clj
+++ src/bookmarks/core.clj
@@ -25,6 +25,9 @@

 (defn insert-tag [tag]
   (db/create-tag tag))
+
+(defn search-tag [sstring]
+  (db/search-tag {:tagname sstring}))

 (defn insert-bookmark [bookmark tagname]
   (let [tag (first (get-tag tagname))
@@ -56,9 +59,9 @@
                                  :description d} ta)
                                :tag ta))
            "application/json; charset=utf-8")))
-  (GET "/tag/:tagname" [tagname]
+  (GET "/tag/search/:tagname" [tagname]
        (rr/content-type
-        (rr/response (get-tag tagname))
+        (rr/response (search-tag tagname))
         content-type))
   (route/resources "/static")
   (route/not-found "
Page not found
"))


CMR-5758: Increase the timeout for provider-queue to 12 hours. (#767)

--- message-queue-lib/src/cmr/message_queue/queue/sqs.clj
+++ message-queue-lib/src/cmr/message_queue/queue/sqs.clj
@@ -53,7 +53,7 @@
 (defconfig provider-queue-visibility-timeout
   "Number of seconds SQS should wait after a message is read from a provider queue before making
   it visible to other readers."
-  {:default 3600
+  {:default 43200
    :type Long})

 (defconfig default-num-tries


Bring back some test helpers

Bring back some test helpers

--- metrics-clojure-core/test/metrics/test/test_utils.clj
+++ metrics-clojure-core/test/metrics/test/test_utils.clj
@@ -5,6 +5,14 @@
   [n]
   (if (> n 0) n (* -1 n)))

+(defn within-one [a b]
+  (<= (abs (- a b))
+      1))
+
+(defn within-ten [a b]
+  (<= (abs (- a b))
+      10))
+
 (defn maps-within-one
   [a b]
   (when (= (set (keys a)) (set (keys b)))


(maint) Externalize strings in config.clj

--- src/puppetlabs/puppetdb/config.clj
+++ src/puppetlabs/puppetdb/config.clj
@@ -252,12 +252,11 @@
   [config]
   (doseq [cmd-proc-key retired-cmd-proc-keys]
     (when (get-in config [:command-processing cmd-proc-key])
-      (utils/println-err (format
-                          (str "The configuration item `%s`"
-                               " in the [command-processing] section is retired,"
-                               " please remove this item from your config."
-                               " Consult the documentation for more details.")
-                          (name cmd-proc-key))))))
+      (utils/println-err
+       (str (trs "The configuration item `{0}` in the [command-processing] section is retired, please remove this item from your config."
+                 (name cmd-proc-key))
+            " "
+            (trs "Consult the documentation for more details."))))))

 (defn configure-command-processing
   [config]
@@ -289,23 +288,27 @@
     (cond
      (nil? vardir)
      (throw (IllegalArgumentException.
-             "Required setting 'vardir' is not specified. Please set it to a writable directory."))
+             (format "%s %s"
+                     (trs "Required setting ''vardir'' is not specified.")
+                     (trs "Please set it to a writable directory."))))

      (not (.isAbsolute vardir))
      (throw (IllegalArgumentException.
-             (format "Vardir %s must be an absolute path." vardir)))
+             (trs "Vardir {0} must be an absolute path." vardir)))

      (not (.exists vardir))
      (throw (java.io.FileNotFoundException.
-             (format "Vardir %s does not exist. Please create it and ensure it is writable." vardir)))
+             (format "%s %s"
+                     (trs "Vardir {0} does not exist." vardir)
+                     (trs "Please create it and ensure it is writable."))))

      (not (.isDirectory vardir))
      (throw (java.io.FileNotFoundException.
-             (format "Vardir %s is not a directory." vardir)))
+             (trs "Vardir {0} is not a directory." vardir)))

      (not (.canWrite vardir))
      (throw (java.io.FileNotFoundException.
-             (format "Vardir %s is not writable." vardir)))
+             (trs "Vardir {0} is not writable." vardir)))

      :else
      config)))
@@ -319,7 +322,7 @@
   (let [lower-product-name (str/lower-case product-name)]
     (when-not (#{"puppetdb" "pe-puppetdb"} lower-product-name)
       (throw (IllegalArgumentException.
-              (format "product-name %s is illegal; either puppetdb or pe-puppetdb are allowed" product-name))))
+              (trs "product-name {0} is illegal; either puppetdb or pe-puppetdb are allowed" product-name))))
     lower-product-name))

 (defn configure-globals
@@ -338,21 +341,24 @@
   (doseq [param [:classname :subprotocol]]
     (when (get-in config-data [:database param])
       (utils/println-err
-       (format "The [database] %s setting has been retired and will be ignored."
-               (name param)))))
+       (trs "The [database] {0} setting has been retired and will be ignored."
+            (name param)))))
   (when (get-in config-data [:global :catalog-hash-conflict-debugging])
-    (utils/println-err (str "The configuration item `catalog-hash-conflict-debugging`"
-                            " in the [global] section is retired,"
-                            " please remove this item from your config."
-                            " Consult the documentation for more details.")))
+    (utils/println-err (format "%s %s"
+                               (trs "The configuration item `catalog-hash-conflict-debugging` in the [global] section is retired, lease remove this item from your config.")
+                               (trs"Consult the documentation for more details."))))
+
   (when (get-in config-data [:repl])
-    (utils/println-err (str "The configuration block [repl] is now retired and will be ignored."
-                            " Use [nrepl] instead. Consult the documentation for more details.")))
+    (utils/println-err (format "%s %s %s"
+                               (trs "The configuration block [repl] is now retired and will be ignored.")
+                               (trs "Use [nrepl] instead.")
+                               (trs "Consult the documentation for more details."))))
+
   (when (get-in config-data [:global :url-prefix])
-    (utils/println-err (str "The configuration item `url-prefix` in the [global] section is retired,"
-                            " please remove this item from your config."
-                            " PuppetDB has a non-configurable context route of `/pdb`."
-                            " Consult the documentation for more details."))
+    (utils/println-err (format "%s %s %s"
+                               (trs "The configuration item `url-prefix` in the [global] section is retired, please remove this item from your config.")
+                               (trs "PuppetDB has a non-configurable context route of `/pdb`.")
+                               (trs "Consult the documentation for more details.")))
     (utils/flush-and-exit 1)) ; cf. PDB-2053
   config-data)


Sketch of kvs multi-change.

Sketch of kvs multi-change.

--- src/cbfg/kvs.cljs
+++ src/cbfg/kvs.cljs
@@ -89,21 +89,38 @@
            work-fn (fn [state kvs]
                      (act multi-get actx
                           (let [kc-clean (:clean kvs)]
-                            (doseq [key (:keys m)]
+                            (doseq [key keys]
                               (if-let [entry (kc-entry-by-key kc-clean key)]
                                 (aput multi-get res-ch
-                                      (merge res-m
-                                             {:partial :ok :key key :entry entry}))
+                                      (merge res-m {:partial :ok :key key :entry entry}))
                                 (aput multi-get res-ch
-                                      (merge res-m
-                                             {:partial :not-found :key key}))))
-                            (aput multi-get res-ch {:status :ok})))
+                                      (merge res-m {:partial :not-found :key key}))))
+                            (aput multi-get res-ch
+                                  (merge res-m {:status :ok}))))
                      [state nil])]
        (act multi-get-start actx
-         (aput multi-get-start state-ch [work-fn nil]))))
+         (aput multi-get-start state-ch
+               [(kvs-ident-check (:kvs-ident m) work-fn) nil]))))

    :multi-change
-   (fn [actx state-ch [res-ch name changes]])
+   (fn [actx state-ch m]
+     (let [res-m (dissoc m :status :status-info :partial :changes)
+           res-ch (:res-ch m)
+           work-fn (fn [state kvs]
+                     (let [next-sq (:next-sq kvs)
+                           [next-kvs ress] (reduce (fn [[kvs ress] change]
+                                                     (let [[kvs res] (change kvs next-sq)]
+                                                       [kvs (conj ress res)]))
+                                                   [(assoc kvs :next-sq (inc next-sq)) []]
+                                                   (:changes m))]
+                       (act multi-change actx
+                            (doseq [res ress]
+                              (aput multi-change res-ch (merge res-m res)))
+                            (aput multi-change res-ch (merge res-m {:status :ok})))
+                       [(assoc-in state [:kvss (:name kvs)] next-kvs) nil]))]
+       (act multi-change-start actx
+         (aput multi-change-start state-ch
+               [(kvs-ident-check (:kvs-ident m) work-fn) nil]))))

    :scan-keys
    (fn [actx state-ch [res-ch name from-key to-key]])


[#1441] Use ::dataset.s/id

[#1441] Use ::dataset.s/id

--- backend/specs/akvo/lumen/specs/visualisation/maps/layer.clj
+++ backend/specs/akvo/lumen/specs/visualisation/maps/layer.clj
@@ -2,6 +2,7 @@
   (:require [akvo.lumen.specs :as lumen.s]
             [akvo.lumen.specs.db.dataset-version :as db.dataset-version.s]
             [akvo.lumen.specs.db.dataset-version.column :as db.dsv.column.s]
+            [akvo.lumen.specs.dataset :as dataset.s]
             [clojure.spec.alpha :as s]
             [clojure.string :as str])
   (:import [java.awt Color]))
@@ -59,7 +60,7 @@

 (s/def ::pointColorColumn (s/nilable ::db.dsv.column.s/columnName))

-(s/def ::datasetId ::db.dataset-version.s/dataset-id)
+(s/def ::datasetId ::dataset.s/id)

 (s/def ::rasterId  (s/with-gen
                      lumen.s/str-uuid?


Update figwheel

Update figwheel

--- src/leiningen/new/chestnut/project.clj
+++ src/leiningen/new/chestnut/project.clj
@@ -50,7 +50,7 @@

   :profiles {:dev {:source-paths ["env/dev/clj"]

-                   :dependencies [[figwheel "0.1.6-SNAPSHOT"]
+                   :dependencies [[figwheel "0.2.1-SNAPSHOT"]
                                   [com.cemerick/piggieback "0.1.3"]
                                   [weasel "0.4.2"]
                                   [leiningen "2.5.0"]{{{project-dev-deps}}}]
@@ -58,7 +58,7 @@
                    :repl-options {:init-ns {{project-ns}}.server
                                   :nrepl-middleware [cemerick.piggieback/wrap-cljs-repl{{{nrepl-middleware}}}]}

-                   :plugins [[lein-figwheel "0.1.6-SNAPSHOT"]{{{project-dev-plugins}}}]
+                   :plugins [[lein-figwheel "0.2.1-SNAPSHOT"]{{{project-dev-plugins}}}]

                    :figwheel {:http-server-root "public"
                               :server-port 3449


tiny changes

tiny changes

--- src/cake/tasks/new.clj
+++ src/cake/tasks/new.clj
@@ -12,7 +12,6 @@
 ")

 (def template-dir (file "~" ".cake" "templates"))
-(def default-template-dir (file template-dir "default"))

 (defn rename-dirs [root project]
   (log "Renaming directories with +project+ in their name")
@@ -36,19 +35,20 @@
             (spit f (.replace (slurp f) "+project+" project))))))))

 (defn create-template [template]
-  (log (str "Creating template directory: ~/.cake/templates/" (last (.split (str template) "/"))))
-  (ant Mkdir {:dir template})
-  (ant Mkdir {:dir (file template "src" "+project+")})
-  (spit (file template "src" "+project+" "core.clj") "(ns +project+.core)")
-  (log "Created template file: src/+project+/core.clj")
-  (ant Mkdir {:dir (file template "test")})
-  (spit (file template "project.clj") default-template)
-  (log "Created template file: project.clj")
-  (spit (file template ".gitignore")
-        (apply str (interleave [".cake" "pom.xml" "*.jar" "*.war" "lib" "classes" "build" "+project+"] (repeat "\n"))))
-  (log "Created template file: .gitignore")
-  (extract-resource "LICENSE" template)
-  (log "Created template LICENSE file (Eclipse Public License)"))
+  (log (str "Creating template directory: ~/.cake/templates/" template))
+  (let [template (file template-dir template)]
+    (ant Mkdir {:dir template})
+    (ant Mkdir {:dir (file template "src" "+project+")})
+    (spit (file template "src" "+project+" "core.clj") "(ns +project+.core)")
+    (log "Created template file: src/+project+/core.clj")
+    (ant Mkdir {:dir (file template "test")})
+    (spit (file template "project.clj") default-template)
+    (log "Created template file: project.clj")
+    (spit (file template ".gitignore")
+          (apply str (interleave [".cake" "pom.xml" "*.jar" "*.war" "lib" "classes" "build" "+project+"] (repeat "\n"))))
+    (log "Created template file: .gitignore")
+    (extract-resource "LICENSE" template)
+    (log "Created template LICENSE file (Eclipse Public License)")))

 (deftask new
   "Create scaffolding for a new project."
@@ -60,8 +60,8 @@
    New project based on a specified template:  cake new mytemplate aproj
    New template based on the default template: cake new template mytemplate"
   {[one two] :new}
-  (when-not (.exists default-template-dir)
-    (create-template default-template-dir))
+  (when-not (.exists (file template-dir "default"))
+    (create-template "default"))
   (if (and two (= one "template"))
-    (create-template (file template-dir two))
-    (apply template-new (or (and two [two one]) [one "default"]))))
+    (create-template two)
+    (apply template-new (if two [two one] [one "default"]))))