Use validated IR for testing.

Use validated IR for testing.

--- test/clj/testing/pamela/inheritance.clj
+++ test/clj/testing/pamela/inheritance.clj
@@ -17,19 +17,20 @@
             [pamela.inheritance]
             [clojure.pprint :refer :all]
             [clojure.test :refer :all]
+            [clojure.data]
             [me.raynes.fs :as fs]))

 (def debug false)

 (def expected-class-precedence '{a    [a a1 a11 a12 a13 a2 a3]
-                                a1   [a1 a11 a12 a13]
-                                a11  [a11]
-                                a12  [a12]
-                                a13  [a13]
-                                a2   [a2]
-                                a3   [a3]
-                                b    [b]
-                                main [main a a1 a11 a12 a13 a2 a3 b]})
+                                 a1   [a1 a11 a12 a13]
+                                 a11  [a11]
+                                 a12  [a12]
+                                 a13  [a13]
+                                 a2   [a2]
+                                 a3   [a3]
+                                 b    [b]
+                                 main [main a a1 a11 a12 a13 a2 a3 b]})
 (deftest test-class-precedence
   []
   (let [ir (parser/parse {:input [(clojure.java.io/file "test/pamela/inheritance-hierarchy.pamela")]})
@@ -40,9 +41,13 @@
     (is (= expected-class-precedence flat) "Class precedence list should match")))

 (defn parse-ir [file & [validate]]
-  (parser/parse {:input [(clojure.java.io/file file)]
-                 :do-not-validate (or validate true)}))
+  ;(println "parser-ir do-not-validate" validate)
+  (parser/parse {:input           [(clojure.java.io/file file)]
+                 :do-not-validate (or validate false)}))

+; sometimes and in repl only,
+; (testing.pamela.inheritance/test-flatten-inheritance "test/pamela/inherit2.pamela")
+; produces nils breathing in mode's conditional expression.
 (defn test-flatten-inheritance [file]
   (let [ir (parse-ir file)
         in-ir (pamela.inheritance/flatten-inheritance ir)
@@ -69,18 +74,31 @@
                   "test/pamela/inherit-union.expected.pamela"]
                  ["test/pamela/inherit-precedence.pamela"
                   "test/pamela/inherit-precedence.expected.pamela"]])
+
 (deftest flatten-inheritance
   []
   (let [out-dir (fs/file "target" "inheritance")]
     (if-not (fs/exists? out-dir)
       (fs/mkdirs out-dir))
-    (doseq [files test-files]
-      (let [file (first files)
-            expected (second files)
-            ir (pamela.inheritance/flatten-inheritance (parse-ir file))
+    (doseq [[file expected] test-files]
+      (let [ir (pamela.inheritance/flatten-inheritance (parse-ir file))
             exp-ir (parse-ir expected)]
         (when debug
           (println (fs/base-name file))
           (spit (fs/file out-dir (fs/base-name file)) ir)
           (spit (fs/file out-dir (fs/base-name expected)) exp-ir))
-        (is (= exp-ir ir) (str "IR should match " file " " expected))))))+        (is (= exp-ir ir) (str "IR should match " file " " expected))))))
+
+; To show diff between validated and unvalidated IR.
+(defn check-do-not-validate []
+  (let [validated (parse-ir (first (first test-files)) false)
+        not-validated (parse-ir (first (first test-files)) true)
+        dif (clojure.data/diff validated not-validated)]
+    (println "Validated")
+    (pprint validated)
+    (println "Not Validated")
+    (pprint not-validated)
+    (println "Diff validated not-validated")
+    (pprint dif)
+    (println "= " (= validated not-validated))
+    ))


CMR-5073: Added import statement to fix build.

--- system-int-test/test/cmr/system_int_test/ingest/granule_translation_test.clj
+++ system-int-test/test/cmr/system_int_test/ingest/granule_translation_test.clj
@@ -1,14 +1,15 @@
 (ns cmr.system-int-test.ingest.granule-translation-test
   (:require
-    [clojure.test :refer :all]
-    [cmr.common.mime-types :as mt]
-    [cmr.common.util :as util]
-    [cmr.system-int-test.utils.ingest-util :as ingest]
-    [cmr.umm-spec.legacy :as umm-legacy]
-    [cmr.umm-spec.test.location-keywords-helper :as lkt]
-    [cmr.umm-spec.test.umm-g.expected-util :as expected-util]
-    [cmr.umm-spec.umm-spec-core :as umm-spec]
-    [cmr.umm.umm-granule :as umm-lib-g]))
+   [clojure.test :refer :all]
+   [cmr.common.mime-types :as mt]
+   [cmr.common.util :as util]
+   [cmr.system-int-test.utils.ingest-util :as ingest]
+   [cmr.umm-spec.legacy :as umm-legacy]
+   [cmr.umm-spec.test.location-keywords-helper :as lkt]
+   [cmr.umm-spec.test.umm-g.expected-util :as expected-util]
+   [cmr.umm-spec.umm-spec-core :as umm-spec]
+   [cmr.umm.umm-granule :as umm-lib-g])
+  (:import cmr.umm.umm_granule.UmmGranule))

 (def ^:private valid-formats
   [:umm-json


(TK-82) Added one more `with-test-logging` for test log suppression

This commit includes one additional `with-test-logging` wrapper in the
`graceful-shutdown-test` in order to suppress an unexpected error
message from the test output.

--- test/clj/puppetlabs/trapperkeeper/services/webserver/jetty9_service_test.clj
+++ test/clj/puppetlabs/trapperkeeper/services/webserver/jetty9_service_test.clj
@@ -686,7 +686,8 @@
         (with-open [async-client (async/create-client {})]
           (let [response (http-client-common/get async-client "http://localhost:8080/hello" {:as :text})]
             @in-request-handler
-            (tk-app/stop app)
+            (with-test-logging
+              (tk-app/stop app))
             (is (not (nil? (:error @response)))))))))

   (testing "no graceful shutdown when stop timeout is set to 0"


Change clear colors

Change clear colors

--- src/zaffre/glterminal.clj
+++ src/zaffre/glterminal.clj
@@ -621,11 +621,12 @@
         ;; Setup render to FBO
         (try
           (GL30/glBindFramebuffer GL30/GL_FRAMEBUFFER, fbo-id)
+          (GL11/glEnable GL11/GL_BLEND)
           (GL30/glEnablei GL11/GL_BLEND fbo-id)
           (GL14/glBlendFuncSeparate GL11/GL_SRC_ALPHA GL11/GL_ONE_MINUS_SRC_ALPHA GL11/GL_ONE GL11/GL_ONE_MINUS_SRC_ALPHA)
           (GL11/glViewport 0 0 framebuffer-width framebuffer-height)
           (except-gl-errors (str "glViewport " framebuffer-width framebuffer-height))
-          (GL11/glClearColor 0.0 0.0 1.0 1.0)
+          (GL11/glClearColor 0.0 0.0 0.0 0.0)
           (except-gl-errors (str "glClearColor  " 0.0 0.0 1.0 1.0))
           (GL11/glClear (bit-or GL11/GL_COLOR_BUFFER_BIT GL11/GL_DEPTH_BUFFER_BIT))
           (except-gl-errors (str "glClear  " (bit-or GL11/GL_COLOR_BUFFER_BIT GL11/GL_DEPTH_BUFFER_BIT)))
@@ -732,7 +733,7 @@
           ;; Draw fbo to screen
           (GL30/glBindFramebuffer GL30/GL_FRAMEBUFFER 0)
           (GL11/glViewport 0 0 framebuffer-width framebuffer-height)
-          (GL11/glClearColor 0.0 1.0 0.0 1.0)
+          (GL11/glClearColor 0.0 0.0 0.0 0.0)
           (GL11/glClear (bit-or GL11/GL_COLOR_BUFFER_BIT GL11/GL_DEPTH_BUFFER_BIT))
           (GL11/glBlendFunc GL11/GL_ONE GL11/GL_ONE_MINUS_SRC_ALPHA)
           (GL20/glUseProgram fb-program-id)


Update server path.

Update server path.

--- src/atomix_jepsen/core.clj
+++ src/atomix_jepsen/core.clj
@@ -72,7 +72,7 @@
         local-node-arg "5555"
         other-node-args (map #(str (name %) ":5555")
                              (node other-nodes))
-        jarfile "/root/.m2/repository/io/atomix/atomix-server-example/0.1.0-SNAPSHOT/atomix-server-example-0.1.0-SNAPSHOT-shaded.jar"]
+        jarfile "/root/.m2/repository/io/atomix/atomix-standalone-server-example/0.1.0-SNAPSHOT/atomix-standalone-server-example-0.1.0-SNAPSHOT-shaded.jar"]
     (info node "starting atomix")
     (meh (c/exec :truncate :--size 0 "/var/log/atomix.log"))
     (c/su


concentrating on searching lexicon more efficiently

--- src/babel/english/lab.cljc
+++ src/babel/english/lab.cljc
@@ -101,37 +101,42 @@

 (def default-fn (:default-fn model))

+(defn matching-lexemes [spec]
+  (take 1 (remove #(= :fail %)
+                  (map (fn [lexeme]
+                         (u/unify lexeme spec))
+                       lexemes))))
+
+(declare basecamp-at-spec)
+
 (defn basecamp []
   (let [tree the-static-tree]
     (-> tree
-        (basecamp-at [:head :head] (first (take 1 (shuffle ["see" "read"]))))
+        (basecamp-at-spec [:head :head])
         (u/dissoc-paths [[:head :head]])
-        (basecamp-at [:head :comp :head :head] (first (take 1 (shuffle ["game" "word" "book"]))))
+        (basecamp-at-spec [:head :comp :head :head])
         (u/dissoc-paths [[:head :comp :head :head]])
-        (basecamp-at [:head :comp :head :comp] (first (take 1 (shuffle ["new" "intelligent"]))))
+        (basecamp-at-spec [:head :comp :head :comp])
         (u/dissoc-paths [[:head :comp :head]])
-        (basecamp-at [:head :comp :comp] "the")
+        (basecamp-at-spec [:head :comp :comp])
         (u/dissoc-paths [[:head]])
-        (basecamp-at [:comp :head :head] (first (take 1 (shuffle ["boy" "man" "woman" "girl"]))))
+        (basecamp-at-spec [:comp :head :head])
         (u/dissoc-paths [[:comp :head :head]])
-        (basecamp-at [:comp :head :comp] (first (take 1 (shuffle ["tall" "small" "old"]))))
+        (basecamp-at-spec [:comp :head :comp])
         (u/dissoc-paths [[:comp :head]])
-        (basecamp-at [:comp :comp] "the")
+        (basecamp-at-spec [:comp :comp])
         (u/dissoc-paths [[:comp]]))))

-(defn basecamp-at [tree path lexeme-surface-form]
-;;  (println (str "@" path))
-  (first (->> (shuffle (filter #(= lexeme-surface-form
-                                   (u/get-in % [:english :english]))
-                               lexemes))
-              (map (fn [lexeme]
-                     (let [tree (u/copy tree)
-                           lexeme (u/copy lexeme)]
-                        (u/assoc-in! tree path lexeme))))
-              (filter #(not (= :fail %)))
-              (mapcat (fn [tree]
-                        (default-fn tree))))))
-
+(defn basecamp-at-spec [tree path]
+  (let [lexemes (matching-lexemes (u/get-in tree path))]
+    (first (->> (shuffle lexemes)
+                (map (fn [lexeme]
+                      (let [tree (u/copy tree)
+                            lexeme (u/copy lexeme)]
+                         (u/assoc-in! tree path lexeme))))
+                (filter #(not (= :fail %)))
+                (mapcat (fn [tree]
+                           (default-fn tree)))))))

 (defn nextcamp []
   (let [parse (-> "the small dogs you see" parse first)]


Remove remaining debugging printlns

Remove remaining debugging printlns

--- resources/leiningen/new/onyx_app/sample_job_test.clj
+++ resources/leiningen/new/onyx_app/sample_job_test.clj
@@ -16,15 +16,12 @@

 (deftest test-sample-dev-job
   (let [dev-env (component/start (onyx-dev-env 4))]
-    (println "done starting")
     (try
       (let [dev-cfg (-> "dev-peer-config.edn" resource slurp read-string)
             peer-config (assoc dev-cfg :onyx/id (:onyx-id dev-env))
             stubs [:read-lines :write-lines]
             dev-catalog (sc/in-memory-catalog (build-catalog 20) stubs)
-            _ (println "In memory catalog " dev-catalog)
-            dev-lifecycles (sl/in-memory-lifecycles (build-lifecycles) dev-catalog stubs)
-            _ (println "Dev lifecycles " dev-lifecycles)]
+            dev-lifecycles (sl/in-memory-lifecycles (build-lifecycles) dev-catalog stubs)]
         (sl/bind-inputs! dev-lifecycles {:read-lines dev-inputs/lines})
         (let [job {:workflow workflow
                    :catalog dev-catalog


Basic modal to upload code signing keys.

--- src-cljs/frontend/components/project_settings.cljs
+++ src-cljs/frontend/components/project_settings.cljs
@@ -1390,7 +1390,9 @@
            [:article
             [:div.header
              [:div.title "Apple Code Signing Keys"]
-             [:a.btn.upload-button "Upload Key"]]
+             [:a.btn.upload-button {:data-target "#upload-modal"
+                                    :data-toggle "modal"}
+              "Upload Key"]]
             [:hr]
             [:div "Something about apple code signing keys could go here..."]
             [:div.key-list
@@ -1406,9 +1408,15 @@
                (->> osx-keys
                     (map (partial merge {:project-name project-name}))
                     (om/build-all p12-key))]]]
-            [:div.upload
-             [:h3 "Upload a new key"]
-             (om/build p12-upload-form {:project-name project-name})]]])))))
+            [:div.modal.fade#upload-modal
+             [:div.modal-dialog
+              [:div.modal-content
+               [:div.modal-header
+                [:a.close {:data-dismiss "modal"}
+                 [:i.material-icons "clear"]]
+                [:h4.modal-title "Upload a New Apple Code Signing Key"]]
+               [:div.modal-body.upload
+                (om/build p12-upload-form {:project-name project-name})]]]]]])))))

 (defn project-settings [data owner]
   (reify


Add toggle to show/hide the slack channel override

--- src-cljs/frontend/components/project_settings.cljs
+++ src-cljs/frontend/components/project_settings.cljs
@@ -681,7 +681,8 @@
        (when show-fixed-failed?
          (om/build fixed-failed-input {:settings settings :field (keyword (str service-id "_notify_prefs"))}))]
       [:section
-       (for [{:keys [field placeholder]} inputs]
+       (for [{:keys [field placeholder] :as input} inputs
+             :when input]
          (list
           [:input {:id (string/replace (name field) "_" "-") :required true :type "text"
                    :value (str (get settings field))
@@ -715,18 +716,22 @@

 (defn notifications [project-data owner]
   (reify
+    om/IInitState
+    (init-state [_]
+      {:show-slack-channel-override (-> project-data :project :slack_channel_override seq nil? not)})
     om/IDidMount
     (did-mount [_]
       (utils/equalize-size (om/get-node owner) "chat-room-item"))
     om/IDidUpdate
     (did-update [_ _ _]
       (utils/equalize-size (om/get-node owner) "chat-room-item"))
-    om/IRender
-    (render [_]
+    om/IRenderState
+    (render-state [_ state]
       (let [project (:project project-data)
             project-id (project-model/id project)
             inputs (inputs/get-inputs-from-app-state owner)
             settings (state-utils/merge-inputs project inputs project-model/notification-keys)]
+        (js/console.log "STATE: " (clj->js state))
         (js/console.log "SETTINGS: " (clj->js settings))
         (html
          [:section
@@ -736,12 +741,23 @@
             [:a (open-ext {:href "https://circleci.com/docs/configuration#per-branch-notifications"}) "see our documentation"] "."]
            [:div.chat-rooms
             (for [chat-spec [{:service "Slack"
-                              :doc [:p "To get your Webhook URL, visit Slack's "
-                                    [:a {:href "https://my.slack.com/services/new/circleci"}
-                                     "CircleCI Integration"]
-                                    " page, choose a default channel, and click the green \"Add CircleCI Integration\" button at the bottom of the page."]
+                              :doc (list [:p "To get your Webhook URL, visit Slack's "
+                                          [:a {:href "https://my.slack.com/services/new/circleci"}
+                                           "CircleCI Integration"]
+                                          " page, choose a default channel, and click the green \"Add CircleCI Integration\" button at the bottom of the page."]
+                                         [:div
+                                          [:label
+                                           {:for "slack-channel-override"}
+                                           [:input#slack-channel-override
+                                            {:type "checkbox"
+                                             :checked (:show-slack-channel-override state)
+                                             :on-change #(do (om/update-state! owner :show-slack-channel-override not)
+                                                             (utils/edit-input owner (conj state/project-path :slack_channel_override) %
+                                                                               :value ""))}
+                                            [:span "Override room"]]]])
                               :inputs [{:field :slack_webhook_url :placeholder "Webhook URL"}
-                                       {:field :slack_channel_override :placeholder "Room Override"}]
+                                       (when (:show-slack-channel-override state)
+                                         {:field :slack_channel_override :placeholder "Room"})]
                               :show-fixed-failed? true
                               :settings-keys project-model/slack-keys}


lists test

lists test

--- test/rum/test/server_render.cljc
+++ test/rum/test/server_render.cljc
@@ -30,17 +30,26 @@
   [:ul [:li {:key "F"}] [:li {:key "M"}]])

+(rum/defc comp-lists []
+  [:div
+    [:.a (list [:.b])]
+    [:.c "d" (list [:.e])]
+    [:.f "g" (list [:.h]) "i"]])
+
+
 (rum/defc comp-header []
   [:ul.nav__content
     (list [:li.menu-item {:key "F"} "Женщинам"]
           [:li.menu-item {:key "M"} "Мужчинам"])
     [:li.menu-item {:key "outlet"} "Outlet"]])

+
 (rum/defc comp-nil1 []
   "In this case nil will be not counted against reactid"
   [:div {:class "parent"}
    nil
    [:div.child]])
+

 (rum/defc comp-nil2 []
   "In this case *both* nils will be counted against reactid"
@@ -51,10 +60,12 @@
      nil
      [:div.child2])])

+
 (rum/defc comp-span []
   [:div
    "test"
    "passed"])
+

 (rum/defc comp-campaign []
   [:div#today.content.wrapper
@@ -128,9 +139,7 @@
     [:a.clazz#id { :title "a" }]
     [:a#id.clazz { :title "a" }]
     [:a.clazz#id { :title "a" :class "b" }]
-    [:a#clazz.id { :title "a" :class "b" }]
-])
-
+    [:a#clazz.id { :title "a" :class "b" }]])

 (rum/defc comp-classes []
@@ -165,6 +174,7 @@
   { "simple"      comp-simple
     "tag"         comp-tag
     "list"        comp-list
+    "lists"       comp-lists
     "header"      comp-header
     "nil1"        comp-nil1
     "nil2"        comp-nil2


Fixed up comments to match usage.

Fixed up comments to match usage.

--- src/blutwurst/database.clj
+++ src/blutwurst/database.clj
@@ -122,9 +122,10 @@
     []))

 (defn- retrieve-keys
- "This function is responsible for building an adjacency matrix illustrating the key relationships
- between tables."
- [spec tables]
+ "This function exists to find foreign keys between tables and return them for inclusion in the table object.
+  The main reason that this is included in the table structure and not outside of it is that it will be
+  needed when doing foreign key subselects."
+  [spec tables]
  (with-jdbc-meta-data spec
    #(mapv (fn [table] (assoc table :dependencies (retrieve-dependencies-for-table % table)))
           tables)))


Make coverpage-colophon a function that adapts based on *stylesheet*

--- src/catalog/layout/fop.clj
+++ src/catalog/layout/fop.clj
@@ -524,7 +524,10 @@
   {3 "143mm"
    4 "140mm"})

-(def coverpage-colophon
+(defn- coverpage-colophon
+  "Return a hiccup style sexp for the recto coverpage colophon. Uses the
+  style information from the dynamic var [[*stylesheet*]]."
+  []
   [:fo:block {:break-before "page"}
    [:fo:block-container {:absolute-position "fixed" :width "210mm" :height "297mm"}
     (block {:font-size "0"}
@@ -532,12 +535,8 @@
             {:src (io/resource "covers/hinweis-seite.svg")
              :width "100%" :content-width "scale-to-fit"
              :fox:alt-text "Seiten-Hintergrund"}])]
-   (block {:start-indent "5mm" :end-indent "5mm"
-           :color (color :lightgrey) :line-height "1.4"
-           :font-size "16pt" :font-family "Tiresias,Verdana"}
-    (block {:font-size "20pt" :space-after "1em" :role "H2" :letter-spacing "150%"
-            :font-family "Tiresias,Verdana"}
-           "Hinweis")
+   (block (style :font {:color (color :lightgrey) :line-height "1.4" :font-weight "bold"})
+    (block (style :h2 {:letter-spacing "150%"}) "Hinweis")
     (block "Ausleihbar sind die Titel in diesem Verzeichnis")
     (block {:space-after "1em"} "nur in der Schriftgrösse Tiresias 17 Punkt.")
     (block "Sämtliche Bücher sind auch in der Tiresias-Schrift")
@@ -628,7 +627,7 @@
   [title year issue _]
   (let [svg "covers/cover-recto-grossdruck.svg"]
     ;; a large print recto page has no etikett but it has a colophon
-    (coverpage-recto-internal title year issue svg nil coverpage-colophon)))
+    (coverpage-recto-internal title year issue svg nil (coverpage-colophon))))

 (defmethod coverpage-recto :default
   [title year issue _]


Fix docstring, arguments to start-instances

--- src/circle/backend/ec2.clj
+++ src/circle/backend/ec2.clj
@@ -6,6 +6,7 @@
         [circle.utils.args :only (require-args)])
   (:use [clojure.tools.logging :only (infof error)])
   (:use [clojure.core.incubator :only (-?>)])
+  (:use [arohner.utils :only (inspect)])
   (:use [doric.core :only (table)])
   (:require [circle.backend.ssh])
   (:import com.amazonaws.services.ec2.AmazonEC2Client
@@ -198,17 +199,14 @@
        :else (throwf "failed to SSH into %s" instance-id)))))

 (defn start-instances*
-  "Starts one or more instances. Returns a seq of instance-ids.
-
-  If block-until-ready? is true, private-key is required"
+  "Starts one or more instances. Returns a seq of instance-ids."
   [{:keys [ami
            keypair-name
            security-groups
            instance-type
            min-count ;; min number of instances to start
            max-count
-           availability-zone
-           private-key]
+           availability-zone]
     :or {min-count 1
          max-count 1}}]
   (with-ec2-client client


refine logic for rendering lots

refine logic for rendering lots

--- src/clj_money/web/lots.clj
+++ src/clj_money/web/lots.clj
@@ -26,7 +26,7 @@
   [:tr
    [:td.text-right (-> record :trade-date format-date)]
    [:td.text-right (format "%s%s"
-                           (if (= :buy (:action record)) "+ " "- ")
+                           (if (= :buy (:lot-action record)) "+ " "- ")
                            (-> record :shares format-number))]
    [:td.text-right (-> record :price format-number)]
    [:td.text-right (-> record :value format-number)]
@@ -63,16 +63,15 @@

 (defn- lot-row
   [record]
-  (html
-    [:tr
-     [:td.text-right (-> record :shares-owned format-number)]
-     [:td.text-right (-> record :purchase-price format-number)]
-     [:td.text-right (-> record :current-price format-number)]
-     [:td.text-right (-> record :cost format-number)]
-     [:td.text-right (-> record :value format-number)]
-     [:td.text-right
-      {:class (if (<= 0 (:gain record)) "gain" "loss")}
-      (-> record :gain format-number)]]))
+  [:tr
+   [:td.text-right (-> record :shares-owned format-number)]
+   [:td.text-right (-> record :purchase-price format-number)]
+   [:td.text-right (-> record :current-price format-number)]
+   [:td.text-right (-> record :cost format-number)]
+   [:td.text-right (-> record :value format-number)]
+   [:td.text-right
+    {:class (if (<= 0 (:gain record)) "gain" "loss")}
+    (-> record :gain format-number)]])

 (defn- lot-section
   [record]


Fix Doc

Fix Doc

--- src/cljs/lens/handler.cljs
+++ src/cljs/lens/handler.cljs
@@ -1,7 +1,7 @@
 (ns lens.handler
   "Routing Handler

-  All handlers are called with a map of :app, :owner and :params."
+  All handlers are called with a map of :app-state, :owner and :params."
   (:require-macros [plumbing.core :refer [defnk]])
   (:require [om.core :as om :include-macros true]
             [lens.event-bus :as bus]))


format source tag

format source tag

--- src/cljs_api_gen/write.clj
+++ src/cljs_api_gen/write.clj
@@ -84,7 +84,7 @@
       (map-indexed
         (fn [i crumb]
           (if (zero? i)
-            (str crumb "@" (second (re-find #"blob/([^/]*)" (:source-link item))))
+            (str crumb " @ " (second (re-find #"blob/([^/]*)" (:source-link item))))
             (str (join (repeat (dec i) space))
                  branch
                  (if (= i last-i)


add accumulators TODO

add accumulators TODO

--- src/clojure/flambo/api.clj
+++ src/clojure/flambo/api.clj
@@ -114,6 +114,9 @@
   [f]
   (fn [x] (u/truthy? (f x))))

+;; TODO: accumulators
+;; http://spark.apache.org/docs/latest/programming-guide.html#accumulators
+
 ;; ## RDD construction
 ;;
 ;; Function for constructing new RDDs


fixed typo in comment

fixed typo in comment

--- src/structural_typing/guts/mechanics/canonicalizing_types.clj
+++ src/structural_typing/guts/mechanics/canonicalizing_types.clj
@@ -45,7 +45,7 @@

        ;; Let's work with the vectors of required paths, ending up with maps
        dc:spread-collections-of-required-paths
-       dc:split-paths-ending-in-maps   ; can preoduce a new map
+       dc:split-paths-ending-in-maps   ; can produce a new map
        dc:required-paths->maps         ; path may still contain forks

        dc:flatten-maps


Extract 'force-errors' into function for clarity

--- src/main/clojure/clojure/tools/namespace/parse.clj
+++ src/main/clojure/clojure/tools/namespace/parse.clj
@@ -20,6 +20,15 @@
     (read {:read-cond :allow} rdr)
     (read rdr)))

+(defn- force-errors
+  "Forces reader errors to be thrown immediately. Some versions of
+  Clojure accept invalid forms in the reader and only throw an
+  exception when they are printed.
+  See http://dev.clojure.org/jira/browse/TNS-1"
+  [form]
+  (str form) ; str forces errors
+  form)
+
 (defn comment?
   "Returns true if form is a (comment ...)"
   [form]
@@ -41,7 +50,7 @@
   {:pre [(instance? java.io.PushbackReader rdr)]}
   (try
    (loop []
-     (let [form (doto (read-clj rdr) str)] ; str forces errors, see TNS-1
+     (let [form (force-errors (read-clj rdr))]
        (if (ns-decl? form)
          form
          (recur))))


Remove extraneous  from meow-english-service dependencies

--- src/trapperkeeper_demo/trapperkeeper_demo_service.clj
+++ src/trapperkeeper_demo/trapperkeeper_demo_service.clj
@@ -14,7 +14,7 @@

 (trapperkeeper/defservice meow-english-service
   MeowService
-  [[:ConfigService get-in-config get-config]]
+  [[:ConfigService get-in-config]]
   (init [this context]
     (log/info "Hello, initializing meow service in English")
     (assoc context :db (read-db (get-in-config [:meow-service :db-path]))))


Clean up checking for potential address.

--- proxy-protocol/src/main/clojure/com/mattunderscore/proxy/protocol/v1/Plaintextipv4deserialiser.clj
+++ proxy-protocol/src/main/clojure/com/mattunderscore/proxy/protocol/v1/Plaintextipv4deserialiser.clj
@@ -15,6 +15,11 @@
 (defn- create-address-result-from-context [context remaining]
   (let [bytes (into-array Byte/TYPE (map (fn [group] (Integer/parseInt (clojure.string/join (map char group)))) (:groups context)))]
     (DeserialisationResult/create (java.net.Inet4Address/getByAddress bytes) (:processed context) (nil? (first remaining)))))
+
+(defn- has-potential-address [context]
+  (and
+    (= 3 (count (:groups context)))
+    (> (count (:pending context)) 0)))

 (defn- is-grouping-invalid [byte context]
   (if (is-group-separator byte)
@@ -44,8 +49,7 @@
                                             (update-in [:processed] + 1)
                                             (update-in [:pending] conj byte)))))

-      (if (and (= 3 (count (:groups context)))
-               (> (count (:pending context)) 0))
+      (if (has-potential-address context)
         ; Create the address
         (create-address-result-from-context (-> context
                                                 (update-in [:groups] conj (:pending context))
@@ -53,14 +57,13 @@
         ; Ended early
         (NotDeserialisableResult/create (+ (:processed context) 1))))
     ; No more data
-    (if (and (= 3 (count (:groups context)))
-             (> (count (:pending context)) 0))
-            ; Create the address
-            (create-address-result-from-context (-> context
-                                                    (update-in [:groups] conj (:pending context))
-                                                    (assoc :pending [])) (rest seq))
-            ; Ended early
-            (NeedsMoreDataResult/INSTANCE))))
+    (if (has-potential-address context)
+      ; Create the address
+      (create-address-result-from-context (-> context
+                                              (update-in [:groups] conj (:pending context))
+                                              (assoc :pending [])) (rest seq))
+      ; Ended early
+      (NeedsMoreDataResult/INSTANCE))))

 (defn- read-ip-from-sequence [seq]
   (process-next-byte seq {:processed 0 :groups [] :pending []}))


layout tweaks to nih warning banner

layout tweaks to nih warning banner

--- src/cljs/org/broadinstitute/firecloud_ui/nih_link_warning.cljs
+++ src/cljs/org/broadinstitute/firecloud_ui/nih_link_warning.cljs
@@ -29,8 +29,8 @@
          (when (and (get status "isDbgapAuthorized")
                     (.isBefore expire-time _24-hours-from-now))
            [:div {:style {:border "1px solid #c00" :backgroundColor "#fcc"
-                          :color "#800" :fontSize "small" :padding "6px 10px"}}
-            "Your access to TCGA Controlled Access workspaces and data will expire today at "
+                          :color "#800" :fontSize "small" :padding "6px 10px" :text-align "center"}}
+            "Your access to TCGA Controlled Access workspaces and data will expire "
             (.calendar expire-time) ". "
             [:a {:href (profile/get-nih-link-href)} "Re-link"]
             " your FireCloud and eRA Commons / NIH accounts (" (get status "linkedNihUsername")


Trival improvements

Trival improvements

--- src/main/cljc/clojure_club/meadow_finder/mgrimm.cljc
+++ src/main/cljc/clojure_club/meadow_finder/mgrimm.cljc
@@ -42,10 +42,10 @@

 ;; Path finding ----------------------------------------------------------------

-(def infinity #?(:clj Double/POSITIVE_INFINITY, :cljs +Infinity))
+(def inf #?(:clj Double/POSITIVE_INFINITY, :cljs +Infinity))
 (def cost
-  {nil    infinity
-   \space infinity
+  {nil    inf
+   \space inf
    \^     10
    \#     1})

@@ -58,15 +58,15 @@
       (fn [{:keys [goal score] :as m} neighbor]
         (let [new-score (+ (score node) (cost (get-in cave node)))]
           (cond-> m
-            (< new-score (or (score neighbor) infinity))
+            (< new-score (or (score neighbor) inf))
             (-> (update :open assoc neighbor (+ new-score (manhattan neighbor goal)))
                 (update :paths assoc neighbor node)
                 (update :score assoc neighbor new-score)))))
       (-> state (update :open dissoc node) (update :closed conj node))
-      (filter (comp not closed) (neighbors node)))))
+      (filter (complement closed) (neighbors node)))))

 (defn find-path [cave start goal]
-  (letfn [(path [node paths] (take-while identity (iterate paths node)))]
+  (letfn [(path [node paths] (reverse (take-while identity (iterate paths node))))]
     (->> {:cave cave
           :goal goal
           :open (priority-map start (manhattan start goal))
@@ -77,8 +77,7 @@
          (drop-while (comp seq :open))
          first
          :paths
-         (path goal)
-         reverse)))
+         (path goal))))

 (defn annotate-path [cave path]
   (let [dot \u00b7]
@@ -104,9 +103,14 @@
    "##^##^#"
    "####^##"])

+(def expensive-cave2
+  ["##############################"
+   "#^^^^^^^^^^^^^^^^^^#^^^^^^^^^#"
+   "##############################"])
+
 #_
 (let [cave expensive-cave]
-  (doseq [x (annotate-path cave (find-path cave [0 0] [4 4]))]
+  (doseq [x (annotate-path cave (find-path cave [0 15] [2 15]))]
     (println x)))

 #_


[#2254] Fix engine/columns-used defmethod for core/extract-multiple

--- backend/src/akvo/lumen/lib/transformation/multiple_column.clj
+++ backend/src/akvo/lumen/lib/transformation/multiple_column.clj
@@ -28,6 +28,6 @@
   (-> (apply-operation deps table-name columns op-spec)
       (update :columns walk/stringify-keys)))

-(defmethod t.engine/columns-used "core/combine"
+(defmethod t.engine/columns-used "core/extract-multiple"
   [applied-transformation columns]
   [(:columnName (:selectedColumn (:args applied-transformation)))])


remove trailing whitespace

remove trailing whitespace

--- test/such/f_wrongness.clj
+++ test/such/f_wrongness.clj
@@ -1,23 +1,22 @@
-(ns such.f-wrongness (:require [such.wrongness :as subject])
-  (:use midje.sweet))
+(ns such.f-wrongness
+  (:require [such.wrongness :as subject]
+            [midje.sweet :refer :all]))

-(fact
-  (try
+(fact
+  (try
     (subject/boom! "wow!")
     "fail" => true
   (catch Exception ex
     (.getMessage ex) => "wow!"))

-  (try
+  (try
     (subject/boom! "wow! %s" 5)
     "fail" => true
   (catch Exception ex
     (.getMessage ex) => "wow! 5"))

-  (try
+  (try
     (subject/boom! NumberFormatException "wow! %s" 5)
     "fail" => true
   (catch NumberFormatException ex
     (.getMessage ex) => "wow! 5")))
-
-


Fix bug using add-statements on a SPARQLRepository, so it preserves the graph.

Fix bug using add-statements on a SPARQLRepository, so it preserves the graph.

--- src/grafter/rdf/sesame.clj
+++ src/grafter/rdf/sesame.clj
@@ -259,7 +259,7 @@
       (ContextStatementImpl. (->sesame-rdf-type (.s is))
                              (URIImpl. (.p is))
                              (->sesame-rdf-type (.o is))
-                             (URIImpl. (.c is))))
+                             (URIImpl. (:c is))))
     (StatementImpl. (->sesame-rdf-type (.s is))
                     (URIImpl. (.p is))
                     (->sesame-rdf-type (.o is)))))
@@ -296,9 +296,14 @@
   (pr/add-statement
     ([this statement]
        {:pre [(instance? IStatement statement)]}
-       (doto this
-         (.add (IStatement->sesame-statement statement)
-               (into-array Resource []))))
+       (if-let [graph (:c statement)]
+         (doto this
+           (.add (IStatement->sesame-statement statement)
+                 (into-array Resource [(URIImpl. graph)])))
+         (doto this
+           (.add statement
+                 (into-array Resource [])))))
+
     ([this graph statement]
        {:pre [(instance? IStatement statement)]}
        (doto this
@@ -357,13 +362,16 @@
      (NativeStore. datadir indexes)))

 (defn http-repo [repo-url]
-  (HTTPRepository. repo-url))
+  (doto (HTTPRepository. repo-url)
+    (.initialize)))

 (defn sparql-repo
   ([query-url]
-     (SPARQLRepository. query-url))
+     (doto (SPARQLRepository. query-url)
+       (.initialize)))
   ([query-url update-url]
-     (SPARQLRepository. query-url update-url)))
+     (doto (SPARQLRepository. query-url update-url)
+       (.initialize))))

 (defn repo
   ([] (repo (MemoryStore.)))


put finishing touches on cljs.js, make private anything that isn't meant to be doc'ed. analyze -> analyze-str and compile -> compile-str for consistency. In the future we'll like have data oriented versions of these that can take a forms seq.

--- src/main/cljs/cljs/js.cljs
+++ src/main/cljs/cljs/js.cljs
@@ -97,7 +97,7 @@
   [{:keys [source] :as resource}]
   (js/eval source))

-(defn wrap-error [ex]
+(defn- wrap-error [ex]
   {:error ex})

 (defn empty-state
@@ -119,16 +119,16 @@
   (let [sm (sm/decode (.parse js/JSON sm-json))]
     (swap! state assoc-in [:source-maps ns] sm)))

-(defn sm-data []
+(defn- sm-data []
   (atom
     {:source-map (sorted-map)
      :gen-col    0
      :gen-line   0}))

-(defn prefix [s pre]
+(defn- prefix [s pre]
   (str pre s))

-(defn append-source-map
+(defn- append-source-map
   [state name source sb sm-data {:keys [output-dir asset-path] :as opts}]
    (let [t    (.valueOf (js/Date.))
          smn  (if name
@@ -233,7 +233,7 @@

 (declare ns-side-effects analyze-deps)

-(defn load-deps
+(defn- load-deps
   ([bound-vars ana-env lib deps cb]
    (analyze-deps bound-vars ana-env lib deps nil cb))
   ([bound-vars ana-env lib deps opts cb]
@@ -256,9 +256,9 @@
                (cb res)))))
        (cb {:value nil})))))

-(declare analyze*)
-
-(defn analyze-deps
+(declare analyze-str*)
+
+(defn- analyze-deps
   ([bound-vars ana-env lib deps cb]
    (analyze-deps bound-vars ana-env lib deps nil cb))
   ([bound-vars ana-env lib deps opts cb]
@@ -278,7 +278,7 @@
                 (if resource
                   (let [{:keys [name lang source]} resource]
                     (condp = lang
-                      :clj (analyze* bound-vars source name opts
+                      :clj (analyze-str* bound-vars source name opts
                              (fn [res]
                                (if-not (:error res)
                                  (analyze-deps bound-vars ana-env lib (next deps) opts cb)
@@ -297,7 +297,7 @@
                        (str "Could not analyze dep " dep) cause))))))
          (cb {:value nil}))))))

-(defn load-macros [bound-vars k macros reload reloads opts cb]
+(defn- load-macros [bound-vars k macros reload reloads opts cb]
   (if (seq macros)
     (let [nsym (first (vals macros))
           k    (or (k reload)
@@ -314,7 +314,7 @@
             (cb res)))))
     (cb {:value nil})))

-(defn ns-side-effects
+(defn- ns-side-effects
   ([bound-vars ana-env ast opts cb]
     (ns-side-effects false bound-vars ana-env ast opts cb))
   ([load bound-vars ana-env {:keys [op] :as ast} opts cb]
@@ -376,7 +376,7 @@
            (check-uses-and-load-macros {:value nil}))))
      (cb {:value ast}))))

-(defn analyze* [bound-vars source name opts cb]
+(defn- analyze-str* [bound-vars source name opts cb]
   (let [rdr        (rt/indexing-push-back-reader source 1 name)
         eof        (js-obj)
         aenv       (ana/empty-env)
@@ -421,7 +421,7 @@
                          (recur ast)))))
                  (cb {:value last-ast}))))))) nil)))

-(defn analyze
+(defn analyze-str
   "Analyze ClojureScript source. The compiler state will be populated with
    the results of analyzes. The parameters:

@@ -446,13 +446,13 @@
      map will contain a key :error with an ex-info instance describing the cause
      of failure."
   ([state source cb]
-   (analyze state source nil cb))
+   (analyze-str state source nil cb))
   ([state source name cb]
-   (analyze state source name nil cb))
+   (analyze-str state source name nil cb))
   ([state source name opts cb]
    {:pre [(atom? state) (string? source)
           (valid-name? name) (valid-opts? opts) (fn? cb)]}
-   (analyze*
+   (analyze-str*
      {:*compiler*     state
       :*data-readers* tags/*cljs-data-readers*
       :*passes*       (or (:passes opts) ana/*passes*)
@@ -465,7 +465,7 @@
 ;; -----------------------------------------------------------------------------
 ;; Eval

-(defn eval* [bound-vars form opts cb]
+(defn- eval* [bound-vars form opts cb]
   (let [the-ns     (or (:ns opts) 'cljs.user)
         bound-vars (cond-> (merge bound-vars {:*cljs-ns* the-ns})
                      (:source-map opts) (assoc :*sm-data* (sm-data)))]
@@ -533,7 +533,7 @@
 ;; -----------------------------------------------------------------------------
 ;; Compile

-(defn compile* [bound-vars source name opts cb]
+(defn- compile-str* [bound-vars source name opts cb]
   (let [rdr        (rt/indexing-push-back-reader source 1 name)
         eof        (js-obj)
         aenv       (ana/empty-env)
@@ -581,7 +581,7 @@
                        name source sb @comp/*source-map-data* opts))
                    (cb {:value (.toString sb)})))))))))))

-(defn compile
+(defn compile-str
   "Compile ClojureScript source into JavaScript. The parameters:

    state (atom)
@@ -605,13 +605,13 @@
      will contain a key :error with an ex-info instance describing the cause
      of failure."
   ([state source cb]
-   (compile state source nil cb))
+   (compile-str state source nil cb))
   ([state source name cb]
-   (compile state source name nil cb))
+   (compile-str state source name nil cb))
   ([state source name opts cb]
    {:pre [(atom? state) (string? source)
           (valid-name? name) (valid-opts? opts) (fn? cb)]}
-   (compile*
+   (compile-str*
      {:*compiler*     state
       :*data-readers* tags/*cljs-data-readers*
       :*analyze-deps* (or (:analyze-deps opts) true)
@@ -624,7 +624,7 @@
 ;; -----------------------------------------------------------------------------
 ;; Evaluate String

-(defn eval-str* [bound-vars source name opts cb]
+(defn- eval-str* [bound-vars source name opts cb]
   (let [rdr        (rt/indexing-push-back-reader source 1 name)
         eof        (js-obj)
         aenv       (ana/empty-env)
@@ -778,7 +778,7 @@
   (defn elide-env [env ast opts]
     (dissoc ast :env))

-  (cljs/analyze st "(+ 1 1)" nil
+  (cljs/analyze-str st "(+ 1 1)" nil
     {:passes [ana/infer-type elide-env]
      :eval node-eval}
     (fn [{:keys [value]}]
@@ -789,7 +789,7 @@
     (fn [res]
       (println res)))

-  (cljs/compile st "(defprotocol IFoo (foo [this]))"
+  (cljs/compile-str st "(defprotocol IFoo (foo [this]))"
     (fn [{:keys [value]}]
       (println "Source:")
       (println value)))
@@ -830,7 +830,7 @@
     (fn [res]
       (println res)))

-  (cljs/compile st "(defn foo\n[a b]\n(+ a b))" 'cljs.foo
+  (cljs/compile-str st "(defn foo\n[a b]\n(+ a b))" 'cljs.foo
     {:verbose true :source-map true}
     (fn [js-source]
       (println "Source:")


adjust tests to remove params we no longer take

--- test/cljs/early_vote_site/elections/events_test.cljs
+++ test/cljs/early_vote_site/elections/events_test.cljs
@@ -82,17 +82,6 @@
              "state_fips" "08"
              "election_date" "2017-10-10T06:00:00.00Z"})))))

-(deftest list-elections-params-test
-  (testing "params are empty for super-admin even with fipsCodes set"
-    (let [db {:user {:roles #{"super-admin"}
-                     :fipsCodes ["08"]}}]
-      (is (empty? (events/list-elections-params db)))))
-  (testing "params include fips when not super-admin"
-    (let [db {:user {:roles #{"county-data-user"}
-                     :fipsCodes ["08005"]}}]
-      (is (= {:fips "08"}
-             (events/list-elections-params db))))))
-
 (deftest start-edit-test
   (let [election {:id 456
                   :state-fips "08"


test: also test for nil values in changelog

--- src/test/clojure/pdok/featured/regression_test.clj
+++ src/test/clojure/pdok/featured/regression_test.clj
@@ -72,9 +72,16 @@
                           "WHERE 1 = 1 "
                           "AND " clauses )])))

-(defn- add-changelog-counts [changelog-counts action]
-  (swap! changelog-counts assoc action (+ (or (action @changelog-counts) 0)
-                                          (count (query "timeline_changelog" {:action (name action)})))))
+(defn- update-changelog-counts [changelog-counts]
+  (let [records (j/query test-db ["SELECT * FROM \"featured_regression_regression-set\".timeline_changelog"])]
+    (doseq [action [:new :change :close :delete]]
+      (let [n (count (filter #(= (:action %1) (name action)) records)) ]
+        (swap! changelog-counts update action (fnil + 0) n)))
+
+    (doseq [[column stat-name] [[:collection :nil-collections]
+                                [:feature_id :nil-ids]]]
+      (let [nils (count (filter #(= (get %1 column) nil) records)) ]
+        (swap! changelog-counts update stat-name (fnil + 0) nils)))))

 (defn process-feature-permutation [meta feature-permutation]
@@ -92,13 +99,11 @@
                       projectors (conj (config/projectors persistence) (config/timeline persistence))
                       processor (processor/create meta "regression-set" persistence projectors)]
                   (dorun (processor/consume processor features))
-                  (doseq [action [:new :change :close :delete]]
-                    (add-changelog-counts changelog-counts action)
-                    )
+                  (update-changelog-counts changelog-counts)
                   (e/fill-extract "regression-set" nil)
                   (e/flush-changelog "regression-set")
                   (:statistics (processor/shutdown processor))))
-              feature-permutation))
+              feature-permutation))
       :extracts extracts
       :changelog-counts changelog-counts})))

@@ -154,11 +159,13 @@
                                                feature-id (assoc :feature_id feature-id)))))))))

 (defn- test-timeline-changelog [expected-counts changelog-counts]
+  (is (= 0 (:nil-collections @changelog-counts)))
+  (is (= 0 (:nil-ids @changelog-counts)))
   (doseq [action [:new :change :close :delete]]
     (is (= (or ((keyword (str "n-" (name action))) expected-counts) 0)
            (action @changelog-counts)))))

-(defn- test-timeline
+(defn- test-timeline
   ([expected-counts changelog-counts] (test-timeline "col-1" "id-a" expected-counts changelog-counts))
   ([collection feature-id {:keys [timeline-current timeline timeline-changelog]} changelog-counts]
    (testing "!>>> Timeline"
@@ -176,7 +183,7 @@
     (j/query test-db [ (str "SELECT * FROM \"regression-set\".\"" table "\"" )])))

 (defn- test-geoserver
-  ([n] (test-geoserver "col-1" n))
+  ([n] (test-geoserver "col-1" n))
   ([collection n]
   (is (= n (count (query-geoserver collection))))))

@@ -199,8 +206,8 @@
   (is (= 2 (:n-processed (:stats results))))
   (is (= 0 (:n-errored (:stats results))))
   (test-persistence {:events 2 :features 1})
-  (test-timeline {:timeline-current {:n 1}
-                  :timeline {:n 1}
+  (test-timeline {:timeline-current {:n 1}
+                  :timeline {:n 1}
                   :timeline-changelog {:n-new 1 :n-change 1}}
                   (:changelog-counts results))
   (test-timeline->extract {:n-extracts 2
@@ -225,8 +232,8 @@
   (is (= 3 (:n-processed (:stats results))))
   (is (= 0 (:n-errored (:stats results))))
   (test-persistence {:events 3 :features 1})
-  (test-timeline {:timeline-current {:n 1}
-                  :timeline {:n 2}
+  (test-timeline {:timeline-current {:n 1}
+                  :timeline {:n 2}
                   :timeline-changelog {:n-new 1 :n-change 2}}
                   (:changelog-counts results))
   (test-timeline->extract {:n-extracts 3
@@ -376,4 +383,3 @@
   (test-geoserver 1)
   (test-geoserver "col-1$nestedserie" 0)
   (test-geoserver "col-1$nestedserie$label" 1))
-


Improve validation comparisons.

Improve validation comparisons.

--- src/merkle_db/validate.clj
+++ src/merkle_db/validate.clj
@@ -94,6 +94,21 @@
                   condition# (= expected# actual#)
                   state# (if condition# :pass ~bad-state)]
               (report! ~type-key state# ~message expected# actual#)
+              condition#)
+
+         ; Comparison test.
+         (and (list? test-form)
+              (contains? #{'< '> '<= '>=} (first test-form))
+              (= 3 (count test-form)))
+           `(let [v0# ~(nth test-form 1)
+                  v1# ~(nth test-form 2)
+                  condition# (~(first test-form) v0# v1#)
+                  state# (if condition# :pass ~bad-state)]
+              (report! ~type-key state# ~message
+                       '~test-form
+                       (if condition#
+                         condition#
+                         (list '~'not (list '~(first test-form) v0# v1#))))
               condition#)

          ; Predicate test.
@@ -291,7 +306,9 @@
       (check ::index/empty
         (nil? root)
         "Empty tree has nil root")
-    (<= (::record/count params) (::part/limit params))
+    (or (< (::record/count params) (::part/limit params))
+        (and (= (::record/count params) (::part/limit params))
+             (= part/data-type (:data/type root))))
       (validate-partition root params)
     :else
       (validate-index


s/pmap/map-fn/ (be consistent with map vs. pmap in rest of the file)

--- src/babel/parse.cljc
+++ src/babel/parse.cljc
@@ -152,13 +152,13 @@
                                            parents (over (:grammar model) left-signs right-signs morph-ps)
                                            truncated-parents
                                            (if parse-with-truncate
-                                             (pmap (fn [parent]
-                                                     (conj
-                                                      {:head (summarize (get-in parent [:head]) model)
-                                                       :comp (summarize (get-in parent [:comp]) model)}
-                                                      (truncate parent [[:comp]
-                                                                        [:head]]
-                                                                model)))
+                                             (map-fn (fn [parent]
+                                                       (conj
+                                                        {:head (summarize (get-in parent [:head]) model)
+                                                         :comp (summarize (get-in parent [:comp]) model)}
+                                                        (truncate parent [[:comp]
+                                                                          [:head]]
+                                                                  model)))
                                                   parents))]
                                        (if (not (empty? parents))
                                          (log/debug (str "parse/parses: parents: "


Add buffer-time operator.

Add buffer-time operator.

--- src/beicon/core.cljc
+++ src/beicon/core.cljc
@@ -838,6 +838,12 @@
    #?(:cljs (.bufferCount ob n skip)
       :clj  (.buffer ob (int n) (int skip)))))

+(defn buffer-time
+  "Buffers the source Observable values for a specific time period."
+  [ms ^Observable ob]
+  #?(:cljs (.bufferTime ob ms)
+     :clj (.buffer ob ms TimeUnit/MILLISECONDS)))
+
 (defn retry
   "Given an optional number of retries and an observable,
   repeats the source observable the specified number of


sttart to isolate/encapsulate join internal rep

--- dada2-core/src/test/clojure/org/dada2/test_join_model.clj
+++ dada2-core/src/test/clojure/org/dada2/test_join_model.clj
@@ -26,30 +26,41 @@
 ;;; e.g.
 ;;; (permute [[]] [[:a1 :a2][:b1 :b2 :b3][:c1]]) ->
 ;;; ([:a1 :b1 :c1] [:a1 :b2 :c1] [:a1 :b3 :c1] [:a2 :b1 :c1] [:a2 :b2 :c1] [:a2 :b3 :c1])
-
-;;; TODO: should use recurse
+;;; TODO:
+;;;  should use recurse
+;;;  should support both inner and outer joins
 (defn- permute [state [head & tail]]
   (if (empty? head)
     state
     (permute (mapcat (fn [i] (map (fn [j] (conj i j)) head)) state) tail)))

-;;; consider outer joins
-;; (defn- permute2 [inner state [head & tail]]
-;;   (if (empty? tail)
-;;     state
-;;     (if-let [head (if (and (empty? head) inner) nil [nil])]
-;; 	(permute (mapcat (fn [i] (map (fn [j] (conj i j)) head)) state) tail))))
-
-;; TODO: return a pair - first is notification fn, second is new-indeces - use swap*! to apply
+;;--------------------------------------------------------------------------------
+;; this layer encapsulates access to lhs index
+
+(defn- lhs-assoc [old-indeces keys lhs]
+  "associate a new lhs with existing index"
+  (let [[old-lhs-index & rhs-indeces] old-indeces
+	new-lhs-index (mapv (fn [index key] (group index (key lhs) lhs)) old-lhs-index keys)
+	new-indeces (assoc old-indeces 0 new-lhs-index)]
+    new-indeces))
+
+;;--------------------------------------------------------------------------------
+;; this layer encapsulates access to rhs indeces
+
+;;--------------------------------------------------------------------------------
+;; this layer encapsulates access to both lhs and rhs at the same time...
+

 (defn- derive-joins [v rhs-indeces ks join-fn]
   (map
    (fn [args] (apply join-fn v args))
    (permute [[]] (map (fn [index key] (index (key v))) rhs-indeces ks))))

-(defn- lhs-upsert [[old-index & rhs-indeces] ks v join-fn joined-model]
-  (let [new-index (mapv (fn [index key] (group index (key v) v)) old-index ks)
-	new-indeces (apply vector new-index rhs-indeces)
+;;--------------------------------------------------------------------------------
+
+(defn- lhs-upsert [old-indeces ks v join-fn joined-model]
+  (let [new-indeces (lhs-assoc old-indeces ks v)
+	[_ & rhs-indeces] old-indeces
 	joins (derive-joins v rhs-indeces ks join-fn)]
     [new-indeces (fn [_] (on-upserts joined-model joins))]))


Make wildfly fns safe to call OOC [IMMUTANT-575]

This also includes a little reorg/cleanup. A better man would call it
refactoring.

--- wildfly/src/immutant/wildfly.clj
+++ wildfly/src/immutant/wildfly.clj
@@ -20,29 +20,22 @@
   (:import java.net.URL
            org.projectodd.wunderboss.WunderBoss))

-(def ^:no-doc ^Class module-class-loader-class (memoize #(u/try-import 'org.jboss.modules.ModuleClassLoader)))
-
-(def ^:no-doc in-cluster (delay (-> ^Class (u/try-import 'org.projectodd.wunderboss.as.ClusterUtils)
-                                  (.getMethod "inCluster" nil)
-                                  (.invoke nil nil))))
-(defn- get-resource-loaders
-  [cl]
-  (if (module-class-loader-class)
-    (-> (doto (.getDeclaredMethod (module-class-loader-class) "getResourceLoaders"
-                (make-array Class 0))
-          (.setAccessible true))
-      (.invoke cl (make-array Class 0)))))
+(defmacro ^:no-doc ignore-load-failures [& body]
+  `(try
+     ~@body
+     (catch ClassNotFoundException _#)
+     (catch NoClassDefFoundError _#)))

 (defn- if-exists?
   "Returns the given url if it matches a file that exists."
   [url]
-  (if (and url (.exists (io/file url)))
+  (when (and url (.exists (io/file url)))
     url))

 (defn- loader->url
   "Converts a ResourceLoader into a url."
   [l]
-  (if-let [r (.getResource l "/")]
+  (when-let [r (.getResource l "/")]
     (.getURL r)))

 (defn- vfs->file
@@ -52,29 +45,38 @@
     (URL. (str "file" (last match)))
     url))

-(defn ^:no-doc get-module-loader-urls [loader]
-  (->> loader
-    get-resource-loaders
-    (map (comp if-exists? vfs->file loader->url))
-    (keep identity)))
+(let [^Class module-class-loader-class (memoize #(u/try-import 'org.jboss.modules.ModuleClassLoader))]
+  (defn- get-resource-loaders
+    [cl]
+    (when (module-class-loader-class)
+      (-> (doto (.getDeclaredMethod (module-class-loader-class) "getResourceLoaders"
+                  (make-array Class 0))
+            (.setAccessible true))
+        (.invoke cl (make-array Class 0)))))

-(defn ^:no-doc extend-module-classloader-to-cjc []
-  (when (u/try-resolve 'clojure.java.classpath/URLClasspath)
-    (eval
-      `(extend-protocol clojure.java.classpath/URLClasspath
-         (module-class-loader-class)
-         (urls [cl#]
-           (get-module-loader-urls cl#))))))
+  (defn ^:no-doc get-module-loader-urls [loader]
+    (->> loader
+      get-resource-loaders
+      (map (comp if-exists? vfs->file loader->url))
+      (keep identity)))

-(defn ^:no-doc extend-module-classloader-to-dynapath []
-  (when (u/try-resolve 'dynapath.dynamic-classpath/DynamicClasspath)
-    (eval
-      `(extend-protocol dynapath.dynamic-classpath/DynamicClasspath
-         (module-class-loader-class)
-         (can-read? [cl#] true)
-         (can-add? [cl#] false)
-         (classpath-urls [cl#]
-           (get-module-loader-urls cl#))))))
+  (defn ^:no-doc extend-module-classloader-to-cjc []
+    (when (u/try-resolve 'clojure.java.classpath/URLClasspath)
+      (eval
+        `(extend-protocol clojure.java.classpath/URLClasspath
+           (module-class-loader-class)
+           (urls [cl#]
+             (get-module-loader-urls cl#))))))
+
+  (defn ^:no-doc extend-module-classloader-to-dynapath []
+    (when (u/try-resolve 'dynapath.dynamic-classpath/DynamicClasspath)
+      (eval
+        `(extend-protocol dynapath.dynamic-classpath/DynamicClasspath
+           (module-class-loader-class)
+           (can-read? [cl#] true)
+           (can-add? [cl#] false)
+           (classpath-urls [cl#]
+             (get-module-loader-urls cl#)))))))

 (defn ^:no-doc init-deployment
   "Initializes an in-container deployment. Should be used by the
@@ -110,9 +112,10 @@
   (partial port :http))

 (defn- invoke-as-util-method [^String method]
-  (-> ^Class (u/try-import 'org.projectodd.wunderboss.as.ASUtils)
-    (.getMethod method nil)
-    (.invoke nil nil)))
+  (ignore-load-failures
+    (-> ^Class (u/try-import 'org.projectodd.wunderboss.as.ASUtils)
+      (.getMethod method nil)
+      (.invoke nil nil))))

 (let [container-type (delay (invoke-as-util-method "containerTypeAsString"))]
   (defn in-eap?
@@ -120,14 +123,11 @@
   []
   (= "EAP" @container-type)))

-(let [streaming-supported? (delay (invoke-as-util-method "isAsyncStreamingSupported"))]
+(let [streaming-supported? (delay (boolean (invoke-as-util-method "isAsyncStreamingSupported")))]
   (defn async-streaming-supported?
   "Returns true if the container supports async HTTP stream sends."
   []
-  ;; the delay returns an instance of Boolean, but not Boolean/TRUE or
-  ;; Boolean/FALSE for some reason, so we have to coerce it to a
-  ;; boolean primitive for clojure to be happy and treat false as false
-  (boolean @streaming-supported?)))
+  @streaming-supported?))

 (defn messaging-remoting-port
   "Returns the port that HornetQ is listening on for remote connections"
@@ -148,7 +148,13 @@
   ([host protocol]
      (format "%s://%s:%s%s" protocol host (http-port) (context-path))))

-(defn in-cluster?
+(let [in-cluster (delay
+                   (boolean
+                     (ignore-load-failures
+                       (-> ^Class (u/try-import 'org.projectodd.wunderboss.as.ClusterUtils)
+                         (.getMethod "inCluster" nil)
+                         (.invoke nil nil)))))]
+  (defn in-cluster?
   "Returns true if running inside a cluster"
   []
-  @in-cluster)
+  @in-cluster))


Factor out old dev-mode detection code; use new immutant.util/dev-mode? function instead.

--- modules/web/src/main/clojure/immutant/web/middleware.clj
+++ modules/web/src/main/clojure/immutant/web/middleware.clj
@@ -19,6 +19,7 @@
     (:use ring.middleware.stacktrace
           ring.middleware.reload)
     (:require [immutant.registry :as registry]
+              [immutant.util     :as util]
               [clojure.java.io :as io]
               dynapath.util))

@@ -54,9 +55,7 @@

 (defn add-middleware
   [handler options]
-  (let [project (registry/get :project)]
-    (binding [*dev* (not (or (System/getenv "LEIN_NO_DEV")
-                             (->> project meta :active-profiles (not-any? #{:dev}))))]
-      (-> handler
-          (add-auto-reload options)
-          (add-stacktraces options)))))+  (binding [*dev* (util/dev-mode?)]
+    (-> handler
+        (add-auto-reload options)
+        (add-stacktraces options))))


use comma separated list of route short names from column 3

--- src/otp_api_proxy/util.clj
+++ src/otp_api_proxy/util.clj
@@ -41,11 +41,13 @@
   (let [lines (split (route-lines-request) #"\n")]
     (for [l lines]
       (let [fields (split l #"\\")]
-        {:route_short_name (nth fields 0)
-         :frequency        (nth fields 5)}))))
+        {:route_short_names (into #{}
+                                  (split (nth fields 3) #","))
+         :frequency         (nth fields 5)}))))

 (defn anaheim-frequency-for-route-short-name [n]
-  (-> (filter (comp #{n} :route_short_name) (anaheim-route-lines))
+  (-> (filter (comp #(get % n) :route_short_names)
+              (anaheim-route-lines))
       first
       :frequency))


Add info into buffer map

Add info into buffer map

--- src/overtone/sc/buffer.clj
+++ src/overtone/sc/buffer.clj
@@ -25,7 +25,8 @@

        (with-meta {:id id
                    :size size
-                   :ready? ready?}
+                   :ready? ready?
+                   :info info}
          {:type ::buffer}))))

 (defn buffer-ready?


implement #'buffer-alloc-read using strategy from #'load-sample*

--- src/overtone/sc/buffer.clj
+++ src/overtone/sc/buffer.clj
@@ -1,5 +1,6 @@
 (ns overtone.sc.buffer
-  (:use [overtone.helpers file]
+  (:use [clojure.java.io :only [file]]
+        [overtone.helpers file]
         [overtone.util lib]
         [overtone.libs event]
         [overtone.sc server]
@@ -43,6 +44,31 @@
           :rate (:rate info)
           :id (:id info)}
          {:type ::buffer}))))
+
+(defn buffer-alloc-read
+  ([path]
+     (buffer-alloc-read path 0 -1))
+  ([path start]
+     (buffer-alloc-read path start -1))
+  ([path start n-frames]
+     (let [path (canonical-path path)
+           f    (file path)]
+       (when-not (.exists f)
+         (throw (Exception. (str "Unable to read file - file does not exist: " path))))
+       (let [f-name (.getName f)
+             id     (alloc-id :audio-buffer)]
+         (with-server-sync  #(snd "/b_allocRead" id path start n-frames))
+         (let [{:keys [id size rate n-channels]} (buffer-info id)]
+           (when (every? zero? [size rate n-channels])
+             (free-id :audio-buffer id)
+             (throw (Exception. (str "Unable to read file - file does not appear to be a valid audio file: " path))))
+           (with-meta
+             {:allocated-on-server (atom true)
+              :size size
+              :n-channels n-channels
+              :rate rate
+              :id id}
+             {:type ::buffer}))))))

 (defn buffer? [buf]
   (isa? (type buf) ::buffer))


Make samples play at normal rate even when sample-rates differ.

--- src/overtone/sc/sample.clj
+++ src/overtone/sc/sample.clj
@@ -16,16 +16,19 @@
     (defsynth mono-player
       "Plays a single channel audio buffer."
       [buf 0 rate 1.0 start-pos 0.0 loop? 0 vol 1]
-      (out 0 (* vol (pan2
-                     (play-buf 1 buf rate
-                               1 start-pos loop?
-                               FREE)))))
-
-    (defsynth stereo-player [buf 0 rate 1.0 start-pos 0.0 loop? 0 vol 1]
-      (out 0
+      (let [rate (* rate (buf-rate-scale:kr buf))]
+        (out 0 (* vol (pan2
+                       (play-buf 1 buf rate
+                                 1 start-pos loop?
+                                 FREE))))))
+
+    (defsynth stereo-player
+      [buf 0 rate 1.0 start-pos 0.0 loop? 0 vol 1]
+      (let [rate (* rate (buf-rate-scale:kr buf))]
+       (out 0
            (* vol (play-buf 2 buf rate
                             1 start-pos loop?
-                            FREE))))))
+                            FREE)))))))

 (defonce loaded-samples* (ref {}))


URIs for specifications don't have .html suffixes

This is to fix interlinking between them (via hyperlinks).

--- dev/src/yada/dev/website.clj
+++ dev/src/yada/dev/website.clj
@@ -26,6 +26,11 @@
    7239 "Forwarded HTTP Extension"
    7240 "Prefer Header for HTTP"})

+(defn rfc []
+  (fn [req]
+    (let [source (io/resource (format "static/spec/rfc%s.html" (get-in req [:route-params :rfc])))]
+      ((yada/resource source) req))))
+
 (defn index [{:keys [*router templater]}]
   (yada/resource
    (fn [ctx]
@@ -41,9 +46,9 @@
           [:li [:a {:href (path-for @*router :yada.dev.user-manual/user-manual)} "User manual"]]
           [:li "HTTP and related specifications"
            [:ul
-            [:li [:a {:href "/static/spec/rfc2616.html"} "RFC 2616: Hypertext Transfer Protocol -- HTTP/1.1"]]
+            [:li [:a {:href "/spec/rfc2616"} "RFC 2616: Hypertext Transfer Protocol -- HTTP/1.1"]]
             (for [i (range 7230 (inc 7240))]
-              [:li [:a {:href (format "/static/spec/rfc%d.html" i)}
+              [:li [:a {:href (format "/spec/rfc%d" i)}
                     (format "RFC %d: %s" i (or (get titles i) ""))]])]]
           [:li [:a {:href
                     (format "%s/index.html?url=%s/swagger.json"
@@ -62,6 +67,7 @@
   (routes [component]
     ["/"
      [["index.html" (index component)]
+      [["spec/rfc" :rfc] (rfc)]
       ["dir/" (-> (yada.bidi/resource-branch (io/file "dev/resources"))
                   (tag ::dir))]]]))


experts [12..22]

experts [12..22]


added rm_case_comments

added rm_case_comments

--- src/pg_demo/table_defs.clj
+++ src/pg_demo/table_defs.clj
@@ -285,7 +285,53 @@
               EFFECTIVE_START_DATE timestamp NOT NULL,
               EFFECTIVE_END_DATE timestamp NOT NULL,
               PRIMARY KEY (ENTERPRISE_ID,CASE_ID,DLP_REVISION_NUMBER)
-          );" }
+          ); " }
+
+    { "rm_case_bfarm_data"
+          "CREATE TABLE rm_case_bfarm_data (
+              ENTERPRISE_ID numeric NOT NULL,
+              CASE_ID numeric NOT NULL,
+              MED_STATUS_ID numeric NOT NULL,
+              MED_STATUS numeric,
+              OTHER_TEXT varchar(20),
+              DELETED timestamp,
+              DLP_REVISION_NUMBER numeric NOT NULL,
+              EFFECTIVE_START_DATE timestamp NOT NULL,
+              EFFECTIVE_END_DATE timestamp NOT NULL,
+              DELETED_FLAG numeric(1) NOT NULL,
+              REVISION_DELETE_FLAG numeric,
+              PRIMARY KEY (ENTERPRISE_ID,CASE_ID,MED_STATUS_ID,DLP_REVISION_NUMBER)
+          ); " }
+
+    { "rm_case_classifications"
+          "CREATE TABLE rm_case_classifications (
+              ENTERPRISE_ID numeric NOT NULL,
+              CASE_ID numeric NOT NULL,
+              SEQ_NUM numeric NOT NULL,
+              CLASSIFICATION_ID numeric,
+              DELETED timestamp,
+              DLP_REVISION_NUMBER numeric NOT NULL,
+              REVISION_DELETE_FLAG numeric,
+              DELETED_FLAG numeric(1) NOT NULL,
+              EFFECTIVE_START_DATE timestamp NOT NULL,
+              EFFECTIVE_END_DATE timestamp NOT NULL,
+              PRIMARY KEY (ENTERPRISE_ID,CASE_ID,SEQ_NUM,DLP_REVISION_NUMBER)
+          ); " }
+
+    { "rm_case_comments"
+          "CREATE TABLE rm_case_comments (
+              ENTERPRISE_ID numeric NOT NULL,
+              CASE_ID numeric NOT NULL,
+              COMMENT_TXT text,
+              COMMENT_TXT_J text,
+              DELETED timestamp,
+              DLP_REVISION_NUMBER numeric NOT NULL,
+              REVISION_DELETE_FLAG numeric,
+              DELETED_FLAG numeric(1) NOT NULL,
+              EFFECTIVE_START_DATE timestamp NOT NULL,
+              EFFECTIVE_END_DATE timestamp NOT NULL,
+              PRIMARY KEY (ENTERPRISE_ID,CASE_ID,DLP_REVISION_NUMBER)
+          ); " }

   ] ))


Fix error with arrow keys

Fix error with arrow keys

  - Due to browsers using different texts for the keys in events, the arrow keys
    had stopped working on firefox. This have now been resolved.

--- src/retro_fever/input.cljs
+++ src/retro_fever/input.cljs
@@ -50,6 +50,17 @@
   [k]
   (if (= k " ") "Space" k))

+;; Different browsers use different key names such as Left Arrow Key being
+;; Left (Chrome) or ArrowLeft (Firefox)
+(defn standardize-key
+  [k]
+  (case k
+    "ArrowLeft" "Left"
+    "ArrowRight" "Right"
+    "ArrowUp" "Up"
+    "ArrowDown" "Down"
+    k))
+
 (defn kbd-state-change
   "Returns a function which takes e keyboard event and swaps the atom
   state using the function f"
@@ -58,9 +69,12 @@
     (let [k (-> e
                 get-key
                 space-as-space
+                standardize-key
                 string/lower-case
                 keyword)]
-      (apply swap! [state f k]))))
+      (apply swap! [state f k])
+      (.preventDefault e)
+      (.stopPropagation e))))

 (defn key-pressed?
   [key-code]


Use remove instead of filter not

Use remove instead of filter not

--- src/snergly/algorithms.clj
+++ src/snergly/algorithms.clj
@@ -65,7 +65,7 @@
          frontier (PersistentQueue/EMPTY)]
     (let [cell (grid-cell grid current)
           current-distance (distances current)
-          links (filter #(not (contains? distances %)) (:links cell))
+          links (remove #(contains? distances %) (:links cell))
           next-frontier (apply conj frontier links)]
       (if (empty? next-frontier)
         (assoc distances :max current-distance :max-coord current)


Change id field in frontend of users

Change id field in frontend of users

--- tutorial.vent/src/tutorial/vent/frontend/main.cljs
+++ tutorial.vent/src/tutorial/vent/frontend/main.cljs
@@ -124,7 +124,7 @@
      (for [[username user] users]
        (User {:username username
               :user user}
-             {:key (:id user)}))]))
+             {:key username}))]))

 (defn Loader
   []


Fix reflection warning with newer JVM's

Fix reflection warning with newer JVM's

--- src/mavlink/core.clj
+++ src/mavlink/core.clj
@@ -515,8 +515,8 @@
                     (System/arraycopy packet
                                       (inc start-signature-idx)
                                       (.array bb) 0 6)
-                    (.put bb 6 0)
-                    (.put bb 7 0)
+                    (.put bb 6 (byte 0))
+                    (.put bb 7 (byte 0))
                     (.getLong bb))
         start-sha256-idx (+ start-signature-idx 7)]
     (if (or (nil? tuple-timestamp)
@@ -908,7 +908,7 @@
                                      ; shift the buffer and read another byte
                                      (do
                                        (doseq [i (range (Long/BYTES))]
-                                         (.put buffer i (.get buffer ^long (inc i))))
+                                         (.put buffer (int i) (.get buffer ^long (inc i))))
                                        (.position buffer (Long/BYTES))
                                        (when (read-bytes statistics input-stream buffer 1)
                                          (recur))))))))


doc(classpath-container): explanation of (take 2 dep)

--- ccw.core/src/clj/ccw/leiningen/classpath_container.clj
+++ ccw.core/src/clj/ccw/leiningen/classpath_container.clj
@@ -109,7 +109,9 @@

 (defn- artifacts-entry
   [dep repositories]
-  (let [main (resolve-artifact (take 2 dep) repositories)
+  (let [main (resolve-artifact
+               (take 2 dep) ; take only id and version, not optional exclusion sections
+               repositories)
         source (try-resolve-sources-artifact! dep repositories)]
     (if source [(-> main meta :file)
                 (-> source meta :file)]


Added the cider nrepl refactoring middleware

--- link/.lein/profiles.clj
+++ link/.lein/profiles.clj
@@ -1,5 +1,6 @@
 {:user {:aliases {"slamhound" ["run" "-m" "slam.hound"]}
         :plugins [[cider/cider-nrepl "0.8.2"]
+                  [refactor-nrepl "1.0.5"]
                   [lein-pprint "1.1.1"]
                   [lein-bikeshed "0.1.7"]
                   [lein-kibit "0.1.2"]]


CMR-2146: Added additional group save tests.

--- metadata-db-app/int_test/cmr/metadata_db/int_test/concepts/group_save_test.clj
+++ metadata-db-app/int_test/cmr/metadata_db/int_test/concepts/group_save_test.clj
@@ -70,4 +70,88 @@
                              group-concept-id (:native-id group)
                              other-group-concept-id (:native-id group)
                              :access-group provider-id) ]}
-                 (select-keys response [:status :errors]))))))))+                 (select-keys response [:status :errors]))))))))
+
+(deftest save-group-with-revision-date-test
+  (doseq [provider-id ["REG_PROV" "SMAL_PROV1"]]
+    (let [concept (util/group-concept provider-id 1 {:revision-date (t/date-time 2001 1 1 12 12 14)})
+          {:keys [status revision-id concept-id]} (util/save-concept concept)]
+      (is (= 201 status))
+      (is (= revision-id 1))
+      (let [retrieved-concept (util/get-concept-by-id-and-revision concept-id revision-id)]
+        (is (= (:revision-date concept) (:revision-date (:concept retrieved-concept))))))))
+
+(deftest save-group-with-bad-revision-date-test
+  (doseq [provider-id ["REG_PROV" "SMAL_PROV1"]]
+    (let [concept (util/group-concept provider-id 1 {:revision-date "foo"})
+          {:keys [status errors]} (util/save-concept concept)]
+      (is (= 422 status))
+      (is (= ["[foo] is not a valid datetime"] errors)))))
+
+(deftest save-group-with-same-native-id-test
+  (testing "Save groups with the same native-id for two small providers is OK"
+    (let [serv1 (util/create-and-save-group "SMAL_PROV1" 1 1 {:native-id "foo"})
+          serv2 (util/create-and-save-group "SMAL_PROV2" 2 1 {:native-id "foo"})
+          [serv1-concept-id serv2-concept-id] (map :concept-id [serv1 serv2])]
+      (util/verify-concept-was-saved serv1)
+      (util/verify-concept-was-saved serv2)
+      (is (not= serv1-concept-id serv2-concept-id)))))
+
+(deftest save-group-test-with-proper-revision-id-test
+  (doseq [provider-id ["REG_PROV" "SMAL_PROV1"]]
+    (let [concept (util/group-concept provider-id 1)]
+      ;; save the concept once
+      (let [{:keys [revision-id concept-id]} (util/save-concept concept)
+            new-revision-id (inc revision-id)
+            revision-date-0 (get-in (util/get-concept-by-id-and-revision concept-id revision-id)
+                                    [:concept :revision-date])]
+        ;; save it again with a valid revision-id
+        (let [updated-concept (assoc concept :revision-id new-revision-id :concept-id concept-id)
+              {:keys [status revision-id]} (util/save-concept updated-concept)
+              revision-date-1 (get-in (util/get-concept-by-id-and-revision concept-id revision-id)
+                                      [:concept :revision-date])]
+          (is (= 201 status))
+          (is (= revision-id new-revision-id))
+          (is (t/after? revision-date-1 revision-date-0))
+          (util/verify-concept-was-saved updated-concept))))))
+
+(deftest save-group-with-skipped-revisions-test
+  (doseq [provider-id ["REG_PROV" "SMAL_PROV1"]]
+    (let [concept (util/group-concept provider-id 1)
+          {:keys [concept-id]} (util/save-concept concept)
+          concept-with-skipped-revisions (assoc concept :concept-id concept-id :revision-id 100)
+          {:keys [status revision-id]} (util/save-concept concept-with-skipped-revisions)
+          {retrieved-concept :concept} (util/get-concept-by-id concept-id)]
+      (is (= 201 status))
+      (is (= 100 revision-id (:revision-id retrieved-concept))))))
+
+(deftest auto-increment-of-revision-id-works-with-skipped-revisions-test
+  (doseq [provider-id ["REG_PROV" "SMAL_PROV1"]]
+    (let [concept (util/group-concept provider-id 1)
+          {:keys [concept-id]} (util/save-concept concept)
+          concept-with-concept-id (assoc concept :concept-id concept-id)
+          _ (util/save-concept (assoc concept-with-concept-id :revision-id 100))
+          {:keys [status revision-id]} (util/save-concept concept-with-concept-id)
+          {retrieved-concept :concept} (util/get-concept-by-id concept-id)]
+      (is (= 201 status))
+      (is (= 101 revision-id (:revision-id retrieved-concept))))))
+
+(deftest save-group-with-low-revision-test
+  (doseq [provider-id ["REG_PROV" "SMAL_PROV1"]]
+    (let [concept (util/group-concept provider-id 1)
+          {:keys [concept-id]} (util/save-concept concept)
+          concept-with-bad-revision (assoc concept :concept-id concept-id :revision-id 0)
+          {:keys [status revision-id]} (util/save-concept concept-with-bad-revision)]
+      (is (= 409 status))
+      (is (nil? revision-id)))))
+
+(deftest save-group-with-missing-required-field
+  (doseq [provider-id ["REG_PROV" "SMAL_PROV1"]]
+    (let [concept (util/group-concept provider-id 1)]
+      (are [field] (let [{:keys [status errors]} (util/save-concept (dissoc concept field))]
+                     (and (= 422 status)
+                          (re-find (re-pattern (name field)) (first errors))))
+           :concept-type
+           :provider-id
+           :native-id
+           :extra-fields))))


Make kibit happier.

Make kibit happier.

--- src/oc/lib/utils.clj
+++ src/oc/lib/utils.clj
@@ -71,7 +71,7 @@
   (if-not (or (and (s/ends-with? value "0") (.contains value "."))
               (s/ends-with? value "."))
     value
-    (remove-trailing (subs value 0 (- (count value) 1)))))
+    (remove-trailing (subs value 0 (dec (count value))))))

 (defn truncate-decimals
   "Round and truncate to a float value to at most the specified number of decimal places,


Minor cleanup. Pushed the print statements into the logging framework and used remove to make the edge filtering clearer.

--- src/blutwurst/planner.clj
+++ src/blutwurst/planner.clj
@@ -31,7 +31,7 @@
   (let [current-node (first nonentrant-nodes)
         nonentrant-nodes (rest nonentrant-nodes)
         result (cons current-node result)
-        pruned-edges (filter (complement (partial outgoing-from-node current-node)) edges)]
+        pruned-edges (remove (partial outgoing-from-node current-node) edges)]

     (trace "Edges after pruning: " (pr-str (seq pruned-edges)))

@@ -58,7 +58,7 @@

  (let [nodes (:tables schema)
        edges (extract-edges nodes)]
-  (pprint edges)
+  (trace (pr-str (seq edges)))
   (trace "Preparing to sort graph....")

   (topological-schema-sort nodes


Allow single entities to be returned

Allow single entities to be returned

--- common/src/play_clj/core.clj
+++ common/src/play_clj/core.clj
@@ -15,6 +15,10 @@
 (load "core_2d")
 (load "core_global")
 (load "core_render")
+
+(defn transform
+  [l]
+  (->> l list flatten (remove nil?)))

 (defn defscreen*
   [{:keys [on-show on-render on-dispose on-hide on-pause on-resize on-resume
@@ -36,8 +40,7 @@
                     :total-time 0
                     :delta-time 0)
              on-show
-             vec
-             flatten
+             transform
              (reset! entities)))
       (render [delta-time]
         (let [total-time (+ (:total-time @screen) delta-time)
@@ -45,9 +48,7 @@
                                 :total-time total-time
                                 :delta-time delta-time)]
           (->> (on-render screen-map @entities)
-               (remove nil?)
-               vec
-               flatten
+               transform
                (reset! entities)
                (draw! screen-map))))
       (hide [] (on-hide @screen))


remove tokenize-dependent functions

remove tokenize-dependent functions

--- src/clj/ceres/curator.clj
+++ src/clj/ceres/curator.clj
@@ -182,7 +182,7 @@
          (->> node :tweet :entities :hashtags (into hashtags))
          hashtags)
        (if (zip/node loc)
-         (conj tokens (clojure.set/difference (into #{} (tokenize (-> loc zip/node :tweet :text))) (first tokens)))
+         (conj tokens (clojure.set/difference (into #{} (-> loc zip/node :tweet :text)) (first tokens)))
          tokens)
        (if (nil? (zip/node loc))
          (zip/next loc)


only conditionalize provides under :none, when compiled Google Closure eliminates goog.isProvided_

--- src/clj/cljs/compiler.clj
+++ src/clj/cljs/compiler.clj
@@ -788,10 +788,10 @@

 (defmethod emit* :ns
   [{:keys [name requires uses require-macros env]}]
-  (when-not (= (:optimizations *build-options*) :advanced)
+  (when (= (:optimizations *build-options*) :none)
     (emitln "if(!goog.isProvided_('" (munge name) "')) {"))
   (emitln "goog.provide('" (munge name) "');")
-  (when-not (= (:optimizations *build-options*) :advanced)
+  (when (= (:optimizations *build-options*) :none)
     (emitln "}"))
   (when-not (= name 'cljs.core)
     (emitln "goog.require('cljs.core');"))


Switch to macros for logging.

Switch to macros for logging.

The logging file names / line numbers were getting overridden.

--- src/clj/shale/logging.clj
+++ src/clj/shale/logging.clj
@@ -26,20 +26,20 @@
         (assoc :logging-config nil)
         (assoc :old-logging-config nil))))

-(defn trace [obj]
-  (timbre/trace obj))
+(defmacro trace [obj]
+  `(timbre/trace ~obj))

-(defn debug [obj]
-  (timbre/debug obj))
+(defmacro debug [obj]
+  `(timbre/debug ~obj))

-(defn info [obj]
-  (timbre/info obj))
+(defmacro info [obj]
+  `(timbre/info ~obj))

-(defn warn [obj]
-  (timbre/warn obj))
+(defmacro warn [obj]
+  `(timbre/warn ~obj))

-(defn error [obj]
-  (timbre/error obj))
+(defmacro error [obj]
+  `(timbre/error ~obj))

 (s/defn ^:always-validate new-logger :- Logger
   []


fix slack message date-time formatter

fix slack message date-time formatter

--- src/clj/tictag/server.clj
+++ src/clj/tictag/server.clj
@@ -26,7 +26,7 @@

 (taoensso.timbre/refer-timbre)

-(def wtf (f/formatter "yyyy-MM-dd HH:mm:SS"))
+(def wtf (f/formatter "yyyy-MM-dd HH:mm:ss"))

 (def UNAUTHORIZED
   {:status 401


Adding tundra, swamp, and ford terrain types

--- src/clj/zetawar/data.cljs
+++ src/clj/zetawar/data.cljs
@@ -9,12 +9,18 @@
                    :image "tilesets/elite-command/terrains/woods.png"}
    :desert        {:name "Desert"
                    :image "tilesets/elite-command/terrains/desert.png"}
-   :base          {:name "Base"
-                   :image "tilesets/elite-command/terrains/base-COLOR.png"}
+   :tundra        {:name "Tundra"
+                   :image "tilesets/elite-command/terrains/tundra.png"}
+   :swamp         {:name "Swamp"
+                   :image "tilesets/elite-command/terrains/swamp.png"}
+   :ford          {:name "Ford"
+                   :image "tilesets/elite-command/terrains/ford.png"}
    :shallow-water {:name "Shallow Water"
                    :image "tilesets/elite-command/terrains/shallow-water.png"}
    :deep-water    {:name "Deep Water"
-                   :image "tilesets/elite-command/terrains/deep-water.png"}})
+                   :image "tilesets/elite-command/terrains/deep-water.png"}
+   :base          {:name "Base"
+                   :image "tilesets/elite-command/terrains/base-COLOR.png"}})

 ;; TODO: move transitions one level deeper under :transitions key
 ;; TODO: add :description for state maps and states
@@ -44,10 +50,12 @@
      :moved-1-attacked-1 {:attack-unit  :done}
      :done               {}}}})

+;; TODO: add support multiple zone of control types
 ;; TODO: check how capturing armor works in Elite Command
 ;; TODO: check how repair amount works in Elite Command
 ;; TODO: add :buildable-at => {<terrain type ids>...}
 (def units
+  ;; Personnel
   {:infantry {:name "Infantry"
               :cost 75
               :movement 9
@@ -65,10 +73,13 @@
                :mountains {:movement-cost 6 :armor-bonus  5 :attack-bonus  2}
                :woods     {:movement-cost 4 :armor-bonus  3 :attack-bonus  2}
                :desert    {:movement-cost 4 :armor-bonus -1 :attack-bonus -1}
+               :tundra    {:movement-cost 4 :armor-bonus -1 :attack-bonus -1}
+               :swamp     {:movement-cost 6 :armor-bonus -2 :attack-bonus -2}
+               :ford      {:movement-cost 5 :armor-bonus -1 :attack-bonus -1}
                :base      {:movement-cost 2 :armor-bonus  3 :attack-bonus  2}}
               :attack-strengths
               {:personnel 6
-               :armored 3}}
+               :armored   3}}
    :grenadier {:name "Grenadier"
                :cost 150
                :movement 9
@@ -86,10 +97,14 @@
                 :mountains {:movement-cost 9 :armor-bonus  5 :attack-bonus  2}
                 :woods     {:movement-cost 4 :armor-bonus  3 :attack-bonus -1}
                 :desert    {:movement-cost 5 :armor-bonus -1 :attack-bonus  0}
+                :tundra    {:movement-cost 5 :armor-bonus -1 :attack-bonus  0}
+                :swamp     {:movement-cost 9 :armor-bonus -2 :attack-bonus -2}
+                :ford      {:movement-cost 9 :armor-bonus -1 :attack-bonus -1}
                 :base      {:movement-cost 3 :armor-bonus  3 :attack-bonus -1}}
                :attack-strengths
                {:personnel 8
-                :armored 9}}
+                :armored   9}}
+   ;; TODO: mortar should not exert zone of control
    :mortar {:name "Mortar"
             :cost 200
             :movement 9
@@ -107,10 +122,13 @@
              :mountains {:movement-cost 9 :armor-bonus  5 :attack-bonus  3}
              :woods     {:movement-cost 4 :armor-bonus  3 :attack-bonus -2}
              :desert    {:movement-cost 5 :armor-bonus -1 :attack-bonus  0}
+             :tundra    {:movement-cost 5 :armor-bonus -1 :attack-bonus -1}
+             :swamp     {:movement-cost 9 :armor-bonus -2 :attack-bonus -2}
+             :ford      {:movement-cost 9 :armor-bonus -1 :attack-bonus -2}
              :base      {:movement-cost 3 :armor-bonus  3 :attack-bonus -2}}
             :attack-strengths
             {:personnel 10
-             :armored 10}}
+             :armored   10}}
    :ranger {:name "Ranger"
             :cost 200
             :movement 9
@@ -124,14 +142,19 @@
             :state-map :move-attack
             :image "tilesets/elite-command/units/ranger-COLOR.png"
             :terrain-effects
-            {:plains    {:movement-cost 3 :armor-bonus  0 :attack-bonus  0}
-             :mountains {:movement-cost 6 :armor-bonus  5 :attack-bonus  2}
-             :woods     {:movement-cost 3 :armor-bonus  4 :attack-bonus  2}
-             :desert    {:movement-cost 3 :armor-bonus -1 :attack-bonus -1}
-             :base      {:movement-cost 2 :armor-bonus  3 :attack-bonus  2}}
+            {:plains        {:movement-cost 3 :armor-bonus  0 :attack-bonus  0}
+             :mountains     {:movement-cost 6 :armor-bonus  5 :attack-bonus  2}
+             :woods         {:movement-cost 3 :armor-bonus  4 :attack-bonus  2}
+             :desert        {:movement-cost 3 :armor-bonus -1 :attack-bonus -1}
+             :tundra        {:movement-cost 3 :armor-bonus -1 :attack-bonus -1}
+             :swamp         {:movement-cost 3 :armor-bonus -2 :attack-bonus -2}
+             :ford          {:movement-cost 3 :armor-bonus  0 :attack-bonus  0}
+             :shallow-water {:movement-cost 6 :armor-bonus -2 :attack-bonus -2}
+             :base          {:movement-cost 2 :armor-bonus  3 :attack-bonus  2}}
             :attack-strengths
             {:personnel 9
-             :armored 4}}
+             :armored   4}}
+   ;; Armored
    :humvee {:name "Humvee"
             :cost 300
             :movement 15
@@ -144,13 +167,16 @@
             :state-map :free-attack-twice
             :image "tilesets/elite-command/units/humvee-COLOR.png"
             :terrain-effects
-            {:plains    {:movement-cost 3 :armor-bonus  0 :attack-bonus  0}
-             :woods     {:movement-cost 6 :armor-bonus -2 :attack-bonus -2}
-             :desert    {:movement-cost 3 :armor-bonus  0 :attack-bonus  0}
-             :base      {:movement-cost 2 :armor-bonus  0 :attack-bonus  0}}
+            {:plains    {:movement-cost 3  :armor-bonus  0 :attack-bonus  0}
+             :woods     {:movement-cost 6  :armor-bonus -2 :attack-bonus -2}
+             :desert    {:movement-cost 3  :armor-bonus  0 :attack-bonus  0}
+             :tundra    {:movement-cost 6  :armor-bonus  0 :attack-bonus  0}
+             :swamp     {:movement-cost 12 :armor-bonus -3 :attack-bonus -3}
+             :ford      {:movement-cost 12 :armor-bonus -1 :attack-bonus -1}
+             :base      {:movement-cost 2  :armor-bonus  0 :attack-bonus  0}}
             :attack-strengths
             {:personnel 9
-             :armored 3}}
+             :armored   3}}
    :tank {:name "Tank"
           :cost 350
           :movement 12
@@ -166,10 +192,13 @@
           {:plains    {:movement-cost 3 :armor-bonus  0 :attack-bonus 0}
            :woods     {:movement-cost 6 :armor-bonus -3 :attack-bonus 0}
            :desert    {:movement-cost 4 :armor-bonus  0 :attack-bonus 0}
+           :tundra    {:movement-cost 5 :armor-bonus  0 :attack-bonus 0}
+           :swamp     {:movement-cost 8 :armor-bonus -4 :attack-bonus 0}
+           :ford      {:movement-cost 8 :armor-bonus  0 :attack-bonus 0}
            :base      {:movement-cost 2 :armor-bonus -2 :attack-bonus 0}}
           :attack-strengths
           {:personnel 10
-           :armored 10}}
+           :armored   10}}
    })

 ;; TODO: remove redundant id keys


Add method to flip the neighbor mappings

--- src/cljs/fatlip/core.cljs
+++ src/cljs/fatlip/core.cljs
@@ -554,6 +554,17 @@
     :layers (vec (rseq (:layers graph)))))

+(defn flip-graph
+  "Flips a graph along the axis perpendicular to the layers, so that nodes and
+  edges within a layer reverse their order, more or less. This doesn't touch
+  some of the attributes of a layer that give us an ordering, but only the maps
+  that we need to touch during coordinate assignment"
+  [graph]
+  (assoc graph
+    :aboves (:belows graph)
+    :belows (:aboves graph)))
+
+
 (defn order-graph-once
   "Performs one layer-by-layer sweep of the graph using ESK's algorithm"
   [sparse-graph]


Disassociate editing when focus lost

Disassociate editing when focus lost

--- src/cljs/kanban/core.cljs
+++ src/cljs/kanban/core.cljs
@@ -18,8 +18,12 @@
 (defn Card [card-cursor]
   (let [{:keys [editing title]} @card-cursor]
     (if editing
-      [:div.card.editing [:input {:type "text" :value title}]]
-      [:div.card title])))
+      [:div.card.editing
+       [:input {:type "text"
+                :value title
+                :on-change #(swap! card-cursor assoc :title (.. % -target -value))
+                :on-blur #(swap! card-cursor dissoc :editing)}]]
+      [:div.card {:on-click #(swap! card-cursor assoc :editing true)} title])))

 (defn NewCard []
   [:div.new-card


add need-export-es? to tell redo jobs from normal jobs Signed-off-by: liujiacai <jiacai2050@gmail.com>

add need-export-es? to tell redo jobs from normal jobs
Signed-off-by: liujiacai <1a8e1be74f2b4834a2c73960e376c8e00b85acb7@gmail.com>

--- src/clojure/hebo/task.clj
+++ src/clojure/hebo/task.clj
@@ -144,6 +144,15 @@
         (reset! task-running-status dt))
       (unparse dt-formatter (from-long (* 1000 ((granularity-is dgranu) datetime)))))))

+(defn need-export-es? [taskname param]
+  (if (= taskname "count-trsf")
+    true
+    (let [cur-date (apply date-time (map parse-int param))
+          deadline (date-time 2014 3 11)]
+      (if (before? cur-date deadline)
+        false
+        true))))
+
 (defn usage [options-summary]
   (->> [""
         "Usage: taskname [options] action"
@@ -205,7 +214,8 @@
                        (info "running task" '~task-name ~job-params#)
                        (~prepare# ctx#)
                        (?- sink# qry#)
-                       (~final# ctx#)
+                       (if (need-export-es? (str '~task-name) ~job-params#)
+                         (~final# ctx#))
                        (terminate (str '~task-name) ~job-params#)
                        (fire-next (str '~task-name) ~job-params#)
                        (rm (str '~task-name) ~job-params#))


Added two new products: Fedora 21 and Fedora 22

--- src/clouseau/products.clj
+++ src/clouseau/products.clj
@@ -46,6 +46,16 @@
         {:classname   "org.sqlite.JDBC"
          :subprotocol "sqlite"
          :subname     "packages/f20/primary.sqlite"
+     }]
+     ["Fedora 21"
+        {:classname   "org.sqlite.JDBC"
+         :subprotocol "sqlite"
+         :subname     "packages/f21/primary.sqlite"
+     }]
+     ["Fedora 22"
+        {:classname   "org.sqlite.JDBC"
+         :subprotocol "sqlite"
+         :subname     "packages/f22/primary.sqlite"
      }]
      ["RHEL 6"
         {:classname   "org.sqlite.JDBC"


[#2127] Fix function call

[#2127] Fix function call

--- backend/src/akvo/lumen/lib/transformation/derive/js_engine.clj
+++ backend/src/akvo/lumen/lib/transformation/derive/js_engine.clj
@@ -71,7 +71,7 @@
       11))

 (defn script-engine [factory]
-  (if (nashorn-depreciated?)
+  (if (nashorn-deprecated?)
     (.getScriptEngine factory
                       (into-array String ["--no-deprecation-warning" "--language=es6"])
                       nil class-filter)


Add-app should take description map as a single parameter.

--- src/degel/muxx/server.clj
+++ src/degel/muxx/server.clj
@@ -36,7 +36,7 @@

 (defn add-app
   "Add an app to this deployment. Apps are keyed by name."
-  [& {:keys [name base-page production-js dev-js]}]
+  [{:keys [name base-page production-js dev-js] :as app-map}]
   (swap! app-dispatch
          assoc name (->app-data name base-page production-js dev-js)))