get sliding to work for pricing range slider

--- frontend/components/pricing-b.cljs
+++ frontend/components/pricing-b.cljs
@@ -25,91 +25,111 @@
                    [dommy.macros :refer [sel1 node]])
   (:import [goog.ui IdGenerator]))

+(def pricing-containers-max 64)
+
+(def pricing-increment (/ 100.0 pricing-containers-max))
+
+(defn calculate-drag-percent [owner event]
+  (let [slider (om/get-node owner "pricing-range")
+        width (.-width (goog.style/getSize slider))
+        slider-left (goog.style/getPageOffsetLeft slider)
+        event-left (.-pageX event)
+        ; increment (/ 100.0 64)
+        ]
+    (* pricing-increment (.ceil js/Math (/ (min 100 (max 0 (* 100 (/ (- event-left slider-left) width)))) pricing-increment)))))
+
 (defn pricing [app owner]
   (reify
     om/IDisplayName (display-name [_] "Pricing B")
     om/IRender
     (render [_]
-      (html
-        [:div.pricing.page
-         (common/nav)
-         [:div.torso
-          [:section.pricing-intro
-           [:article
-            [:h1 "Transparent pricing, built to scale."]
-            [:h3 "The first container is free and each additional one is $50/mo. "
-                 [:a "Need enterprise pricing?"]]]
-           [:div.pricing-calculator
-            [:div.pricing-calculator-controls
-             [:div.controls-containers
-              [:h2 "Containers"]
-              [:p "All of your containers are shared across your entire organization."]
-              [:div.containers-range
-               [:figure.range-back]
-               [:figure.range-highlight]
-               [:figure.range-knob {:data-count "16"}]]]
-             [:div.controls-parallelism
-              [:h2 "Parallelism"]
-              [:p
-               [:span "You can run "]
-               [:strong "3"]
-               [:span " concurrent builds with "]
-               [:strong "9"]
-               [:span " containers and "]
-               [:strong "2"]
-               [:span " parallelism. (Adjustable per project.)"]]
-              [:div.parallelism-options
-               [:button "1x"]
-               [:button.active "4x"]
-               [:button "8x"]
-               [:button "12x"]
-               [:button "16x"]]]]
-            [:div.pricing-calculator-preview
-             [:h5 "Estimated Cost"]
-             [:div.calculator-preview-item
-              [:div.item "Repos"]
-              [:div.value "0"]]
-             [:div.calculator-preview-item
-              [:div.item "Builds"]
-              [:div.value "0"]]
-             [:div.calculator-preview-item
-              [:div.item "Users"]
-              [:div.value "0"]]
-             [:div.calculator-preview-item
-              [:div.item "Max Parallelism"]
-              [:div.value "0"]]
-             [:div.calculator-preview-item
-              [:div.item "Concurrent Builds"]
-              [:div.value "0"]]
-             [:div.calculator-preview-item
-              [:div.item "Cost"]
-              [:div.value "0"]]
-             [:a.pricing-action {:role "button"} "Sign Up Free"]]]
-           [:article.pricing-features
-            [:div.pricing-feature
-             [:h3 "Easy Debugging"]
-             [:p "When your tests are broken, we help you get them fixed. We automatically warn you about common mistakes, and document how to fix them.
-                 We provide all the information you need to reproduce an error locally.
-                 And if you still can't reproduce it, you can SSH into our VMs to debug it yourself."]]
-            [:div.pricing-feature
-             [:h3 "Continuous Deployment"]
-             [:p "If your tests work, deploy straight to staging, production, or a QA server.
-                 Deploy anywhere, including Heroku, DotCloud, EngineYard, etc, or using Capistrano, Fabric or custom commands."]]
-            [:div.pricing-feature
-             [:h3 "Personalized Notifications"]
-             [:p "You don't care what John did in his feature branch, but you care what gets pushed to master.
-                 Who cares if the tests pass yet again, you only want notifications when they fail.
-                 Circle intelligently notifies you about the tests you care about, and does it over email, Hipchat, Campfire, FlowDock, IRC and webhooks."]]]
-           [:article
-            [:h3 "How do containers work?"]
-            [:p "Every time you push to GitHub, we checkout your code and run your build inside of a container.
-                 If you don't have enough free containers available, then your builds queue up until other builds finish."]
-            [:p "Everyone gets their first container free and your team can run as many builds as you want with that container.
-                 More containers allows faster builds through parallellism in addition shorter queue times"]
-            [:p "Parallelism is an extrememly powerful feature and allows to dramitcally speed up your test suite.
-                 CircleCI automatically splits your tests across multiple containers, finishing your build in a fraction of the time."]]
-           [:article
-            [:h3 "How many containers do I need?"]
-            [:p "Most of our customers use about 2.5 containers per full-time developer.
-                 Every team is different however and we're happy to set you up with a trial to help you figure out how many works best for you."]]]]
-         (common/footer)]))))
+      (let [container-count (/ (om/get-state owner :drag-percent) pricing-increment)]
+        (html
+          [:div.pricing.page {:on-mouse-up #(om/set-state! owner :dragging (utils/inspect false))
+                              :on-mouse-down #(when (om/get-state owner :dragging)
+                                                (om/set-state! owner :drag-percent (utils/inspect (calculate-drag-percent owner %))))
+                              :on-mouse-move #(when (om/get-state owner :dragging)
+                                                (om/set-state! owner :drag-percent (utils/inspect (calculate-drag-percent owner %))))}
+           (common/nav)
+           [:div.torso
+            [:section.pricing-intro
+             [:article
+              [:h1 "Transparent pricing, built to scale."]
+              [:h3 "The first container is free and each additional one is $50/mo. "
+                   [:a "Need enterprise pricing?"]]]
+             [:div.pricing-calculator
+              [:div.pricing-calculator-controls
+               [:div.controls-containers
+                [:h2 "Containers"]
+                [:p "All of your containers are shared across your entire organization."]
+                [:div.containers-range {:on-mouse-down #(om/set-state! owner :dragging (utils/inspect true))
+                                        :ref "pricing-range"}
+                 [:figure.range-back]
+                 [:figure.range-highlight {:style {:width (str (om/get-state owner :drag-percent) "%")}}]
+                 [:button.range-knob {:style {:left (str (om/get-state owner :drag-percent) "%")}
+                                      :data-count container-count}]]]
+               [:div.controls-parallelism
+                [:h2 "Parallelism"]
+                [:p
+                 [:span "You can run "]
+                 [:strong "3"]
+                 [:span " concurrent builds with "]
+                 [:strong container-count]
+                 [:span " containers and "]
+                 [:strong "2"]
+                 [:span " parallelism. (Adjustable per project.)"]]
+                [:div.parallelism-options
+                 [:button "1x"]
+                 [:button.active "4x"]
+                 [:button "8x"]
+                 [:button "12x"]
+                 [:button "16x"]]]]
+              [:div.pricing-calculator-preview
+               [:h5 "Estimated Cost"]
+               [:div.calculator-preview-item
+                [:div.item "Repos"]
+                [:div.value "0"]]
+               [:div.calculator-preview-item
+                [:div.item "Builds"]
+                [:div.value "0"]]
+               [:div.calculator-preview-item
+                [:div.item "Users"]
+                [:div.value "0"]]
+               [:div.calculator-preview-item
+                [:div.item "Max Parallelism"]
+                [:div.value "0"]]
+               [:div.calculator-preview-item
+                [:div.item "Concurrent Builds"]
+                [:div.value "0"]]
+               [:div.calculator-preview-item
+                [:div.item "Cost"]
+                [:div.value "0"]]
+               [:a.pricing-action {:role "button"} "Sign Up Free"]]]
+             [:article.pricing-features
+              [:div.pricing-feature
+               [:h3 "Easy Debugging"]
+               [:p "When your tests are broken, we help you get them fixed. We automatically warn you about common mistakes, and document how to fix them.
+                   We provide all the information you need to reproduce an error locally.
+                   And if you still can't reproduce it, you can SSH into our VMs to debug it yourself."]]
+              [:div.pricing-feature
+               [:h3 "Continuous Deployment"]
+               [:p "If your tests work, deploy straight to staging, production, or a QA server.
+                   Deploy anywhere, including Heroku, DotCloud, EngineYard, etc, or using Capistrano, Fabric or custom commands."]]
+              [:div.pricing-feature
+               [:h3 "Personalized Notifications"]
+               [:p "You don't care what John did in his feature branch, but you care what gets pushed to master.
+                   Who cares if the tests pass yet again, you only want notifications when they fail.
+                   Circle intelligently notifies you about the tests you care about, and does it over email, Hipchat, Campfire, FlowDock, IRC and webhooks."]]]
+             [:article
+              [:h3 "How do containers work?"]
+              [:p "Every time you push to GitHub, we checkout your code and run your build inside of a container.
+                   If you don't have enough free containers available, then your builds queue up until other builds finish."]
+              [:p "Everyone gets their first container free and your team can run as many builds as you want with that container.
+                   More containers allows faster builds through parallellism in addition shorter queue times"]
+              [:p "Parallelism is an extrememly powerful feature and allows to dramitcally speed up your test suite.
+                   CircleCI automatically splits your tests across multiple containers, finishing your build in a fraction of the time."]]
+             [:article
+              [:h3 "How many containers do I need?"]
+              [:p "Most of our customers use about 2.5 containers per full-time developer.
+                   Every team is different however and we're happy to set you up with a trial to help you figure out how many works best for you."]]]]
+           (common/footer)])))))


Update copyright given the new year

Update copyright given the new year

--- src/clj/chili_dog_night/views.clj
+++ src/clj/chili_dog_night/views.clj
@@ -39,7 +39,7 @@

 (defn footer []
   [:footer.ph3.ph5-ns{:role "contentinfo"}
-   [:p "© 2016,2017 Chili Dog Night Productions"]])
+   [:p "© 2016-2018 Chili Dog Night Productions"]])

 (defn common [title head body]
   (h/html5 {:lang "en"}


Use a random jetty port in test code

Use a random jetty port in test code

--- test/com/puppetlabs/test/http.clj
+++ test/com/puppetlabs/test/http.clj
@@ -99,11 +99,14 @@

 (deftest utf-8-json-responses
   (testing "JSON responses should be encoded as utf-8"
-    (let [app (fn [req] (json-response "N�rnberg"))
-          ;; How should I decide what test port to use?
-          srv (run-jetty app {:port 9753 :join? false})]
+    (let [app  (fn [req] (json-response "N�rnberg"))
+          srv  (run-jetty app {:port 0 :join? false}) ; 0 = random port
+          port (-> srv
+                   (.getConnectors)
+                   (first)
+                   (.getLocalPort))]
       (try
-        (let [resp (client/get "http://localhost:9753")]
+        (let [resp (client/get (format "http://localhost:%s" port))]
           (is (re-find #"charset=utf-8" (get-in resp [:headers "content-type"])))
           (is (= (-> resp
                      (:body)


Cleanup some tests

Cleanup some tests

--- test/reagenttest/testreagent.cljs
+++ test/reagenttest/testreagent.cljs
@@ -27,11 +27,8 @@
                         [:div "div in really-simple"])]
     (with-mounted-component [really-simple nil nil]
       (fn [c div]
-        (swap! ran inc)
-        (is (= "div in really-simple" (.-innerText div)))
-        (r/flush)
-        (is (= 2 @ran))))
-    (is (= 2 @ran))))
+        (is (= 1 @ran))
+        (is (= "div in really-simple" (.-innerText div)))))))

 (u/deftest ^:dom test-simple-callback
   (let [ran (r/atom 0)
@@ -49,8 +46,8 @@
     (with-mounted-component [comp {:foo "you"} 1]
       (fn [C div]
         (swap! ran inc)
-        (is (= "hi you." (.-innerText div)))))
-    (is (= 3 @ran))))
+        (is (= "hi you." (.-innerText div)))
+        (is (= 3 @ran))))))

 (u/deftest ^:dom test-state-change
   (let [ran (r/atom 0)


Display chrome version

Display chrome version

--- src/ui/core.cljs
+++ src/ui/core.cljs
@@ -36,9 +36,10 @@
          js/process.version)]
    [:p (str
          "Atom version is "
-         ((js->clj
-            js/process.versions)
-          "atom-shell"))]
+         ((js->clj js/process.versions) "atom-shell"))]
+   [:p (str
+         "Chrome version is "
+         ((js->clj js/process.versions) "chrome"))]
    [:h1 "Hello world!"]
    [:button
     {:on-click #(swap! state inc)}


Disable var and ns clash warning.

Disable var and ns clash warning.

--- scripts/figwheel.clj
+++ scripts/figwheel.clj
@@ -16,6 +16,7 @@
                 :asset-path "js"
                 :parallel-build false
                 :optimizations :none
+                :warnings {:ns-var-clash false}
                 :pretty-print true
                 :language-in  :ecmascript5
                 :language-out :ecmascript5


Fixing an old unit test

Fixing an old unit test

--- test/vignette/util/query_options_test.clj
+++ test/vignette/util/query_options_test.clj
@@ -29,8 +29,8 @@

 (facts :query-opts
        (query-opts thumb-option-map) => {:fill "purple" :lang "zh" :replace true}
-       (query-opts thumb-map) => nil)
-       (query-opts status-option-map) => {:status "REJECTED"}
+       (query-opts thumb-map) => nil
+       (query-opts status-option-map) => {:status "REJECTED"})

 (facts :query-opt
        (query-opt thumb-map :foo) => nil


Add :piggieback_org_maps to example-piggieback-plan

--- test-cljs/frontend/test_utils.cljs
+++ test-cljs/frontend/test_utils.cljs
@@ -124,6 +124,8 @@
   (-> (example-plan :paid)
       (dissoc :org_name)
       (assoc :piggieback_orgs ["circleci"]
+             :piggieback_org_maps [{:org_name "circleci"
+                                    :vcs_type "github"}]
              :org_name "test-org")))

 (defn- make-example-user-plans [plans]


Minor fix on projects spec.

Minor fix on projects spec.

--- frontend/src/uxbox/main/data/projects.cljs
+++ frontend/src/uxbox/main/data/projects.cljs
@@ -22,8 +22,8 @@
 (s/def ::name string?)
 (s/def ::version integer?)
 (s/def ::user uuid?)
-(s/def ::created-at dt/inst?)
-(s/def ::modified-at dt/inst?)
+(s/def ::created-at inst?)
+(s/def ::modified-at inst?)

 (s/def ::project-entity
   (s/keys ::req-un [::id


Parallel deploys

Parallel deploys

--- src/nube/app.clj
+++ src/nube/app.clj
@@ -146,15 +146,16 @@
     (if-not (health-check-host host port)
       (do
         (stop-container host id)
-        (throw (Exception. "Failed to deploy new instance.")))
+        (Exception. "Failed to deploy new instance."))
       (try
-        (println "Adding" (str host ":" port) "to as pending")
+        (println "Adding" (str host ":" port) "pending")
         (add-pending-app-instance app (str host ":" port))
+        :ok
         (catch Exception e
           (println "Deploy failed. Rolling back.")
           (try (kill-app-instance app host port)
-               (throw (Exception. "Deployment failed. Rolling back."))
-               (catch Exception e (throw (Exception. "Rollback failed. System may be in an invalid state.")))))))))
+               (Exception. "Deployment failed. Rolling back.")
+               (catch Exception e (Exception. "Rollback failed. System may be in an invalid state."))))))))

 (defn deploy-new-app-instances [app image count internal-port]
   (let [count (if (string? count) (read-string count) count)
@@ -170,9 +171,10 @@
                         (if (< (dist host) ideal-count-per-host)
                           (recur (dec count) (update-in launching [host] inc))
                           launching))))]
-    (doseq [host hosts]
-      (dotimes [n (launching host)]
-        (deploy-app-instance app host (find-available-port host) internal-port image)))))
+    (let [launches (remove #(= :ok %) (pmap #(deploy-app-instance app % (find-available-port %) internal-port image)
+                                            (flatten (map (fn [[h n]] (repeat n h)) launching))))]
+      (when-not (empty? launches)
+        (throw (first launches))))))

 (defn deploy-app-instances [app image count internal-port]
   (println "Deploying" count app "with" image)


fix canonical url

fix canonical url

--- src/io/perun.clj
+++ src/io/perun.clj
@@ -277,7 +277,11 @@
   (boot/with-pre-wrap fileset
     (let [files         (perun/get-meta fileset)
           base-url      (perun/assert-base-url (:base-url (perun/get-global-meta fileset)))
-          assoc-can-url #(assoc % :canonical-url (str base-url (:permalink %)))
+          assoc-can-url
+            #(assoc %
+                  :canonical-url
+                  ; we need to call perun/relativize-url to remove leading / becayse base-url has trailing /
+                  (str base-url (:permalink (perun/relativize-url %))))
           updated-files (map assoc-can-url files)]
         (perun/report-info "canonical-url" "added canonical urls to %s files" (count updated-files))
         (perun/merge-meta fileset updated-files))))


Correct docstring for `images-resize`, re: generated file name

--- src/io/perun.clj
+++ src/io/perun.clj
@@ -98,7 +98,7 @@
 (deftask images-resize
   "Resize images to the provided resolutions.
    Each image file would have resolution appended to it's name:
-   e.x. san-francisco.jpg would become san-francisco-3840.jpg"
+   e.x. san-francisco.jpg would become san-francisco_3840.jpg"
   [o out-dir     OUTDIR       str    "the output directory"
    r resolutions RESOLUTIONS  #{int} "resoulitions to which images should be resized"]
   (boot/with-pre-wrap fileset


Add some preconditions

Add some preconditions

--- src/str/core.clj
+++ src/str/core.clj
@@ -1,6 +1,5 @@
 (ns str.core
-  (:require clojure.string
-            [clojure.string :as str])
+  (:require clojure.string)
   (:refer-clojure :exclude [reverse replace contains?]))

 (declare slice)
@@ -149,7 +148,8 @@
   ([^String s ^long width]
    (pad-right s width " "))
   ([^String s ^long width ^String padding]
-   {:pre [(not-empty padding)]
+   {:pre [(not-empty padding)
+          (not (nil? s))]
     :post [(= (.length %) width)]}
    (if (<= width (.length s))
      s
@@ -161,7 +161,8 @@
   ([^String s ^long width]
    (pad-left s width " "))
   ([^String s ^long width ^String padding]
-   {:pre [(not-empty padding)]
+   {:pre [(not-empty padding)
+          (not (nil? s))]
     :post [(= (.length %) width)]}
    (if (<= width (.length s))
      s
@@ -173,7 +174,8 @@
   ([^String s ^long width]
    (center s width " "))
   ([^String s ^long width ^String padding]
-   {:pre [(not-empty padding)]
+   {:pre [(not-empty padding)
+          (not (nil? s))]
     :post [(= (.length %) width)]}
    (if (<= width (.length s))
      s


[hotfix][tests] Assert there is only one applicationId in ZooKeeper.

--- flink-jepsen/src/jepsen/flink/client.clj
+++ flink-jepsen/src/jepsen/flink/client.clj
@@ -47,6 +47,12 @@
   (info "Waiting for path" path "in ZK.")
   (wait-for-zk-operation zk-client zk/exists path))

+(defn get-only-application-id
+  [coll]
+  (assert (= 1 (count coll)) (str "Expected 1 application id, got " coll ". "
+                                  "Failed to deploy the Flink cluster, or there are lingering Flink clusters."))
+  (first coll))
+
 (defn wait-for-children-to-exist
   [zk-client path]
   (wait-for-zk-operation zk-client zk/children path))
@@ -60,7 +66,7 @@
     (->
       (wait-for-children-to-exist zk-client "/flink")
       (deref)
-      (first))))
+      (get-only-application-id))))

 (defn watch-node-bytes
   [zk-client path callback]


Add support for all the meta data needed for DAISY3

--- src/mdr2/dtb.clj
+++ src/mdr2/dtb.clj
@@ -1,32 +1,88 @@
 (ns mdr2.dtb
   "Functions to query [DAISY Talking Books](http://www.daisy.org/daisypedia/daisy-digital-talking-book)"
   (:require [clojure.data.xml :as xml]
-            [clojure.java.io :refer [file]])
-  (:import javax.sound.sampled.AudioSystem))
+            [clojure.java.io :refer [file]]
+            [clojure.string :as s])
+  (:import javax.sound.sampled.AudioSystem
+           java.nio.file.Files))

-(defn depth
-  "Return the depth for a given DAISY Talking Book"
-  [dtb] 0)
+(defn content-type
+  "Return the content type for a given `file`"
+  [file]
+  (Files/probeContentType (.toPath file)))

-(defn files
-  "Return the number of files for a given DAISY Talking Book"
-  [dtb] 0)
+(defn- wav-file?
+  "Is the given `file` a wav file?"
+  [file]
+  (= (content-type file) "audio/x-wav"))

-(defn size
-  "Return the size for a given DAISY Talking Book in kBytes"
-  [dtb] 0)
+(defn- audio-file?
+  "Is the given `file` an audio file, i.e. any of the valid audio file
+  formats for a DAISY Talking Book namely *MPEG-4 AAC audio*, *MPEG-1/2
+  Layer III (MP3) audio* and *Linear PCM - RIFF WAVE format audio*?"
+  [file]
+  (contains? #{"audio/mpeg" "audio/x-wav" "audio/mp4"} (content-type file)))

-(defn page-front
-  "Return the number of front pages for a given DAISY Talking Book"
-  [dtb] 0)
+(defn- text-file?
+  "Is the given `file` a text file, i.e. any of the valid text file
+  formats for a DAISY Talking Book namely DTBook XML?"
+  [file]
+  (contains? #{"application/xml"} (content-type file)))

-(defn page-normal
-  "Return the number of normal pages for a given DAISY Talking Book"
-  [dtb] 0)
+(defn- image-file?
+  "Is the given `file` an image file, i.e. any of the valid image file
+  formats for a DAISY Talking Book namely png and jpeg?"
+  [file]
+  (contains? #{"image/png" "image/jpeg"} (content-type file)))

-(defn page-special
-  "Return the number of special pages for a given DAISY Talking Book"
-  [dtb] 0)
+(defn- ncx-file?
+  "Is the given `file` an ncx file?"
+  [file]
+  (and (.isFile file) (.endsWith (.getName file) ".ncx")))
+
+(defn- has-type? [type-pred path]
+  (some type-pred (file-seq (file path))))
+
+(defn- has-audio? [{path :path}] (has-type? audio-file? path))
+(defn- has-text? [{path :path}] (has-type? text-file? path))
+(defn- has-image? [{path :path}] (has-type? image-file? path))
+(defn- has-ncx? [{path :path}] (has-type? ncx-file? path))
+
+(defn- audio-content [dtb] (when (has-audio? dtb) "audio"))
+(defn- text-content [dtb] (when (has-text? dtb) "text"))
+(defn- image-content [dtb] (when (has-image? dtb) "image"))
+
+(defn multimedia-content
+  "Return the multimedia content for a given DAISY Talking Book"
+  [dtb]
+  (->> [audio-content text-content image-content]
+       (map #(%1 dtb))
+       (remove nil?)
+       (s/join ",")))
+
+(defn multimedia-type
+  "Return the multimedia type for a given DAISY Talking Book"
+  [dtb]
+  (let [has-audio (has-audio? dtb)
+        has-text (has-text? dtb)
+        has-ncx (has-ncx? dtb)]
+    (cond
+     (and has-audio has-text) "audioFullText"
+     (and has-audio has-ncx) "audioNCX"
+     (and has-text has-ncx?) "textNCX"
+     has-audio "audioOnly"
+     :else "")))
+
+(defn audio-format
+  "Return the format in which the audio files in the DTB file set are
+  written for a given DAISY Talking Book"
+  [{path :path}]
+  (let [audio-files (filter audio-file? (file-seq (file path)))]
+    (cond
+     (every? #(contains? #{"audio/mp4"} (content-type %)) audio-files) "MP4-AAC"
+     (every? #(contains? #{"audio/mpeg"} (content-type %)) audio-files) "MP3"
+     (every? #(contains? #{"audio/x-wav"} (content-type %)) audio-files) "WAV"
+     :else "")))

 (defn- file-audio-length
   "Get the length of the audio in seconds for a given audio `file`"
@@ -39,23 +95,21 @@
         durationInSeconds (/ frames frameRate)]
     durationInSeconds))

-(defn- wav-file?
-  "Is the given `file` a wav file?"
-  [file]
-  (and (.isFile file)
-       (.endsWith (.getName file) ".wav")))
-
 (defn audio-length
   "Return the audio legth for a given DAISY Talking Book in seconds"
-  [dtb]
-  (let [audio-files (filter wav-file? (file-seq (file dtb)))]
+  [{path :path}]
+  ;; unfortunatelly getting the audio length of an mp3 file doesn't
+  ;; seem to be supported at the moment. You need to have the proper
+  ;; providers. Maybe this is a problem of openjdk? So just use wav
+  ;; files for the calculation.
+  (let [audio-files (filter wav-file? (file-seq (file path)))]
     (reduce + (map file-audio-length audio-files))))

 (defn meta-data
   "Return a map containing all queried meta data for a given DAISY Talking Book"
   [dtb]
-  (let [keys [:depth :files :size :page-front :page-normal :page-special :audio-length]
-        fns [depth files size page-front page-normal page-special audio-length]]
+  (let [keys [:multimediaType :audio-format :audio-length]
+        fns [multimedia-type audio-format audio-length]]
     ;; of course we could look up the fn using (ns-resolve ns (symbol
     ;; (name kw))) but there is a balance between readybility and
     ;; cleverness


Don't wait for create-meta-torrent

Don't wait for create-meta-torrent

--- desktop/src/nightweb_desktop/actions.clj
+++ desktop/src/nightweb_desktop/actions.clj
@@ -12,8 +12,7 @@
   (-> (assoc params :pic-hash (-> (:pic-str params)
                                   utils/decode-data-uri
                                   io/write-pic-file))
-      actions/save-profile
-      deref)
+      actions/save-profile)
   nil)

 (defn import-user
@@ -40,8 +39,7 @@
              :ptr-hash (f/base32-decode (:ptr-hash params))
              :ptr-time (edn/read-string (:ptr-time params))
              :status 1)
-      actions/new-post
-      deref)
+      actions/new-post)
   nil)

 (defn edit-post
@@ -53,16 +51,14 @@
              :pic-hashes (for [pic (edn/read-string (:pic-hashes params))]
                            (f/base32-decode pic))
              :status 1)
-      actions/new-post
-      deref)
+      actions/new-post)
   nil)

 (defn delete-post
   [params]
   (-> {:create-time (edn/read-string (:create-time params))
        :status 0}
-      actions/new-post
-      deref)
+      actions/new-post)
   nil)

 (defn switch-user
@@ -76,8 +72,7 @@
   [params]
   (-> (:userhash params)
       f/base32-decode
-      users/delete-user
-      deref)
+      users/delete-user)
   nil)

 (defn create-user
@@ -91,8 +86,7 @@
   (-> (assoc params
              :ptr-hash (f/base32-decode (:userhash params))
              :ptr-time (edn/read-string (:time params)))
-      actions/toggle-fav
-      deref)
+      actions/toggle-fav)
   nil)

 (defn check-user-exists


sql output extent minor fix

sql output extent minor fix

--- configuration/sql-output-extent.clj
+++ configuration/sql-output-extent.clj
@@ -1,6 +1,3 @@
-
-;todo Primary-key sequences (could be done via database itself...)
-
 (foreach :AdminDomain
          (add-entity [:admindomain]
                      (mapping :ID [:Id])
@@ -20,7 +17,7 @@
                      (mapping :Name [:Name])
                      (mapping :CreationTime [:CreationTime])
                      (mapping :Validity [:Validity])
-                     (mapping :Detail [:Detail])
+                     (mapping :OtherInfo [:Detail])
                      (mapping :Type [:Type])))

 (for-each-association :HasContactDomain


Update deps in generated project.clj

Update deps in generated project.clj

These all seem to work OK in actual projects based on this template.

--- resources/leiningen/new/kraken_works/project.clj
+++ resources/leiningen/new/kraken_works/project.clj
@@ -3,16 +3,16 @@
   :url "http://example.com/FIXME"
   :license {:name "Eclipse Public License"
             :url "http://www.eclipse.org/legal/epl-v10.html"}
-  :dependencies [[org.clojure/clojure "1.7.0"]
+  :dependencies [[org.clojure/clojure "1.8.0"]
                  [org.clojure/tools.logging "0.3.1"]
                  [turbovote.resource-config "0.2.0"]
-                 [com.novemberain/langohr "3.5.0"]
+                 [com.novemberain/langohr "3.6.1"]
                  [democracyworks/datomic-toolbox "2.0.1" :exclusions [com.datomic/datomic-pro]]
-                 [prismatic/schema "1.0.4"]
+                 [prismatic/schema "1.1.2"]
                  [com.datomic/datomic-pro "0.9.5327" :exclusions [org.slf4j/slf4j-nop
                                                                   org.slf4j/slf4j-log4j12]]
-                 [ch.qos.logback/logback-classic "1.1.3"]
-                 [org.immutant/core "2.1.2"]
+                 [ch.qos.logback/logback-classic "1.1.7"]
+                 [org.immutant/core "2.1.5"]
                  [democracyworks/kehaar "0.5.0"]]
   :plugins [[lein-immutant "2.1.0"]]
   :main ^:skip-aot {{name}}.core


Use reduce-kv instead of reduce

Use reduce-kv instead of reduce

--- src/npm/mvn.cljs
+++ src/npm/mvn.cljs
@@ -94,10 +94,10 @@

 (defn async-pmap [f xs done]
   (let [cnt (atom (count xs))]
-    (reduce (fn [rets [i x]]
-              (f x (fn [ret]
-                     (assoc rets i ret)
-                     (when (zero? (swap! cnt dec))
-                       (done rets)))))
-            (vec (repeat @cnt nil))
-            (map vector (iterate inc 0) xs))))
+    (reduce-kv (fn [rets i x]
+                 (f x (fn [ret]
+                        (assoc rets i ret)
+                        (when (zero? (swap! cnt dec))
+                          (done rets)))))
+               (vec (repeat @cnt nil))
+               (vec xs))))


Add missing logs parameters

Add missing logs parameters

--- src/nube/app.clj
+++ src/nube/app.clj
@@ -181,7 +181,8 @@
   (vec
    (for [instance (load-app-instances app)]
      (let [[host port] (ssplit instance)]
-       (docker! :get host (str "containers/" (:Id (load-container-by-host-and-port host port)) "/logs"))))))
+       (docker! :get host (str "containers/" (:Id (load-container-by-host-and-port host port))
+                               "/logs?stderr=1&stdout=1&timestamps=1"))))))

 (defn kill-app-instances [app]
   (doseq [instance (load-app-instances app)]


Save instances on history

Save instances on history

--- src/nube/app.clj
+++ src/nube/app.clj
@@ -70,6 +70,7 @@
   (redis! (car/lpush (str "deployments:" app)
                      {:timestamp (java.util.Date.)
                       :app app
+                      :instances (load-pending-app-instances app)
                       :image image
                       :count count})))


Use pmap in bootstrap.

Use pmap in bootstrap.


track_link needs a css element as well

track_link needs a css element as well

--- frontend/analytics/mixpanel.cljs
+++ frontend/analytics/mixpanel.cljs
@@ -7,7 +7,10 @@
 (defn track [event & [props]]
   (utils/swallow-errors (js/mixpanel.track event (clj->js (merge {:event_time (unix-timestamp)} props)))))

-(defn track-pageview [path]
+(defn track-link [element event & [props]]
+  (utils/swallow-errors (js/mixpanel.track_links element event (clj->js (merge {:event_time (unix-timestamp)} props)))))
+
+(defn track-pageview [path]
   (utils/swallow-errors (js/mixpanel.track_pageview path)))

 (defn register-once [props]


Refactored Markdown parsers keyword args dispatch.

--- lambda-blog/src/lambda_blog/parsers/md.clj
+++ lambda-blog/src/lambda_blog/parsers/md.clj
@@ -47,17 +47,21 @@
 # Header
 {{substituted}} contents.
 ```"
-  [contents subs & {:keys [previews?]
-                    :or {previews? true}
-                    :as args}]
+  [contents subs & {:keys [custom-transformers
+                           footnotes?
+                           heading-anchors
+                           previews?
+                           reference-links?]
+                    :or {footnotes? true
+                         heading-anchors true
+                         previews? true
+                         reference-links? true}}]
   (if-not (empty? contents)
-    (let [p #(do-parse % (concat [:custom-transformers [(subs-transformer subs)]
-                                  ;; NOTE These are overwritten by anything passed in the `args`.
-                                  :footnotes? true
-                                  :heading-anchors true
-                                  :reference-links? true]
-                                 ;; KLUDGE Too fiddly with the arg lists. u_u
-                                 (-> args seq flatten)))
+    (let [p #(do-parse % [:custom-transformers (conj custom-transformers
+                                                     (subs-transformer subs))
+                          :footnotes? footnotes?
+                          :heading-anchors heading-anchors
+                          :reference-links? reference-links?])
           preview-separator #"(?i)<!--\s*more\s*-->"
           preview (when (and previews?
                              (re-find preview-separator contents))


remove debugging println

remove debugging println

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

--- acqEngine/src/org/micromanager/acq_engine.clj
+++ acqEngine/src/org/micromanager/acq_engine.clj
@@ -119,7 +119,6 @@
   (merge
     (map-config (core getSystemStateCache))
     (:metadata event)
-    (println "pos-ndex" (:position-index event))
     (let [[x y] (let [xy-stage (state :default-xy-stage)]
                   (when-not (empty? xy-stage)
                     (get-in state [:last-stage-positions xy-stage])))]


add collections sort

add collections sort

--- sources/src/cljs/ru/jms/testingtool/command.cljs
+++ sources/src/cljs/ru/jms/testingtool/command.cljs
@@ -187,6 +187,7 @@
                   :config    (->> (:edited-config @data/web-data)
                                   (s/transform [:connections s/ALL :queues] (fn [coll] (u/vec-sort-by #(u/or-property % :title :name) coll)))
                                   (s/transform [:connections] #(u/vec-sort-by :title %))
+                                  (s/transform [:collections] #(u/vec-sort-by :name %))
                                   )}))

 (defn exec-client [command & params]


Spec out add-files.

Spec out add-files.

--- spec/incise/deploy/workflows/git_branch_spec.clj
+++ spec/incise/deploy/workflows/git_branch_spec.clj
@@ -55,4 +55,12 @@
       (should= (file @work-dir @file-name)
                (move-to-work-dir @ex-file)))))

+(describe "add-files"
+  (with repo-dir (create-dummy-repo))
+  (around [it] (with-repo @repo-dir (it)))
+  (with files (map (partial file @repo-dir)
+                   ["a" "b" "c"]))
+  (it "adds files"
+    (should-not-throw (add-files @files))))
+
 (run-specs)


remove references to hiccup

remove references to hiccup

--- src/babel/html.clj
+++ src/babel/html.clj
@@ -1,7 +1,6 @@
 (ns babel.html
   (:refer-clojure :exclude [get-in resolve find parents])
   (:use
-   [hiccup core page]
    [ring.util.codec :as codec])
   (:require
    [clj-time.coerce :as c]
@@ -11,11 +10,18 @@
    [clojure.string :as string]
    [clojure.tools.logging :as log]
    [environ.core :refer [env]]
-   [hiccup.element :as e]
-   [hiccup.page :as h]
    [dag_unify.core :as fs :refer [get-in ref= ref?]]))

 (def menubar-enabled true)
+
+;; TODO: implement these but use maps->json->moustache as
+;; the process of html generation.
+(defn html [content]
+  "")
+(defn include-css [url]
+  "")
+(defn include-js [url]
+  "")

 (defn verb-row [italian]
   (html
@@ -57,8 +63,8 @@
      (include-css "resources/public/css/layout.css")
      (include-css "resources/public/css/quiz.css")

-     (h/include-css "resources/public/css/bootstrap.min.css")
-     (h/include-css "resources/public/css/prettify.css")
+     (include-css "resources/public/css/bootstrap.min.css")
+     (include-css "resources/public/css/prettify.css")

      (include-css "http://maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css")

@@ -514,9 +520,6 @@
      "λ"

      ;; TODO: should support objects of any otherwise-unsupported class: simply print out the classname in fixed-width font.
-     (= (type arg) org.eclipse.jetty.server.HttpInput)
-     "<tt>org.eclipse.jetty.server.HttpInput</tt>"
-
      true
      (str "
" "don't know how to tablize this object : (type:" (type arg) ";value="  arg ")
"))))

@@ -625,7 +628,7 @@
                         (log/trace (str "env key: " key " => " (get env key))))
                       (sort (keys env)))
                  "")
-    (h/html5
+    (html
      (pretty-head title)
      (pretty-body
       options


rename variable and turn down logging

rename variable and turn down logging

--- src/babel/parse.cljc
+++ src/babel/parse.cljc
@@ -17,23 +17,24 @@

 (declare over)

-(def C (atom (cache/fifo-cache-factory {} :threshold 1024)))
+;; TODO: move this to a particular language model or lexicon; not global.
+(def lexical-cache (atom (cache/fifo-cache-factory {} :threshold 1024)))

 ;; thanks to http://tobiasbayer.com/post/2014-11-12-using-clojures-core-dot-cache/
 (defn deal-with-cache [k if-miss-do]
-  (if (cache/has? @C k)
+  (if (cache/has? @lexical-cache k)
     (do
-      (log/info (str "cache hit for " k))
-      (swap! C #(cache/hit % k)))
-    (swap! C #(cache/miss % k (if-miss-do k)))))
+      (log/trace (str "cache hit for " k))
+      (swap! lexical-cache #(cache/hit % k)))
+    (swap! lexical-cache #(cache/miss % k (if-miss-do k)))))

 (defn lookup [lookup-fn k]
   (let [lookup-fn (fn [k]
-                    (do (log/info (str "cache miss for " k))
+                    (do (log/debug (str "cache miss for " k))
                         (let [looked-up (lookup-fn k)]
                           (if (not (empty? looked-up)) looked-up :none))))]
     (deal-with-cache k lookup-fn)
-    (let [cache-value (get @C k)]
+    (let [cache-value (get @lexical-cache k)]
       (if (= cache-value :none) nil
           cache-value))))


~(defn generate-question-and-correct-set-dynamic): +:target-roots and :target-semantics to output

--- src/babel/reader.clj
+++ src/babel/reader.clj
@@ -116,7 +116,10 @@
       {:source (:source pairing)
        :targets [(:target pairing)]
        :target-spec target-spec
-       :target-semantics (:semantics pairing)})))
+       :target-roots [(get-in target-expression
+                              [:root :italiano :italiano])]
+       :target-semantics (strip-refs
+                          (get-in target-expression [:synsem :sem]))})))

 (defn generate-question-and-correct-set [target-spec source-language source-locale
                                          target-language target-locale]


Remove specs from blocks.meter code.

Remove specs from blocks.meter code.

--- src/blocks/meter.clj
+++ src/blocks/meter.clj
@@ -11,28 +11,11 @@
   well, and it is up to the receiver to interpret them."
   (:require
     [blocks.data :as data]
-    [clojure.spec.alpha :as s]
-    [clojure.tools.logging :as log])
+    [clojure.tools.logging :as log]
+    [manifold.deferred :as d])
   (:import
     java.io.InputStream
     org.apache.commons.io.input.ProxyInputStream))
-
-
-;; Recording function; called with the store and each metric event.
-(s/def ::recorder ifn?)
-
-;; Metric event type.
-(s/def ::type qualified-keyword?)
-
-;; Custom label to add to events reported to a block store.
-(s/def ::label string?)
-
-;; Metric value.
-(s/def ::value number?)
-
-;; Event map.
-(s/def ::event
-  (s/keys :req-un [::type ::label ::value]))

 (defn- meter-label
@@ -56,18 +39,17 @@
 (defn- record!
   "Helper to record an event to the metered store if a recording function is
   present."
-  [store metric-type value & {:as attrs}]
-  (let [event (assoc attrs
-                     :type metric-type
-                     :label (meter-label store)
-                     :value value)]
-    (when-not (s/valid? ::event event)
-      (log/warn "Block metric event is invalid:" (s/explain-str ::event event)))
-    (when-let [recorder (::recorder store)]
-      (try
-        (recorder store event)
-        (catch Exception ex
-          (log/warn ex "Failure while recording metric"))))))
+  [store metric-type value attrs]
+  (when-let [recorder (::recorder store)]
+    (try
+      (recorder
+        store
+        (assoc attrs
+               :type metric-type
+               :label (meter-label store)
+               :value value))
+      (catch Exception ex
+        (log/warn ex "Failure while recording metric")))))

@@ -93,7 +75,7 @@
                               (name metric-type) label block-id
                               (format-bytes sum "B")
                               (format-bytes (/ sum elapsed) "Bps"))
-                  (record! store metric-type sum :block block-id)
+                  (record! store metric-type sum {:block block-id})
                   (vreset! meter [(System/nanoTime) 0]))))]
       (proxy [ProxyInputStream] [input-stream]

@@ -140,7 +122,7 @@
   [store metric-type block]
   (when block
     (if (::recorder store)
-      (data/wrap-block
+      (data/wrap-content
         block
         (partial ->MeteredContentReader
                  store
@@ -153,7 +135,7 @@
 ;; ## Latency Measurement

 (defn- stopwatch
-  "Creates a delay expression which will return the number of milliseconds
+  "Create a delay expression which will return the number of milliseconds
   elapsed between its creation and dereference."
   []
   (let [start (System/nanoTime)]
@@ -164,15 +146,16 @@
   "Helper function for the `measure-method` macro."
   [store method-kw args body-fn]
   (let [elapsed (stopwatch)]
-    (try
-      (body-fn)
-      (finally
-        (when (::recorder store)
+    (cond-> (body-fn)
+      (::recorder store)
+      (d/finally
+        (fn record-elapsed
+          []
           (log/tracef "Method %s of %s block store on %s took %.1f ms"
                       (name method-kw)
                       (meter-label store)
                       args
                       @elapsed)
           (record! store ::method-time @elapsed
-                   :method method-kw
-                   :args args))))))
+                   {:method method-kw
+                    :args args}))))))


Whitespace fix

Whitespace fix

--- src/catalog/core.clj
+++ src/catalog/core.clj
@@ -16,7 +16,7 @@
   (-> in
    vubis/read-file
    vubis/order-and-group
-   (layout.fop/document :grossdruck (slurp editorial) (slurp recommendations) )
+   (layout.fop/document :grossdruck (slurp editorial) (slurp recommendations))
    (layout.fop/generate-pdf! out)))

 (defn neu-in-grossdruck [in out editorial recommendations]


js/JSON

js/JSON

--- src/cljs/server.cljs
+++ src/cljs/server.cljs
@@ -2,7 +2,7 @@
   (:require-macros [cljs.core.async.macros :as m :refer [go alt!]])
   (:require [cljs.nodejs :as nodejs]
             [cljs.core.async :refer [chan close! timeout put! map<]]
-            [JSON]))
+            [js/JSON]))

 (enable-console-print!)


Add explanation on schema

Add explanation on schema

--- examples/todomvc/src/todomvc/db.cljs
+++ examples/todomvc/src/todomvc/db.cljs
@@ -2,12 +2,16 @@
   (:require
     [schema.core :as s :include-macros true]))

-
-(def default-initial-state
-  {:todos   (sorted-map)        ;; todo ids are the keys (for sort)
-   :showing :all                ;; one of :all :done or :active
-   })
-
+;; -- Schema ------------------------------------------------------------------
+;;
+;; A Primatic Schema for the contents of `app-db`. At any time we can validate
+;; the contents of 'app-db' using valid schema.
+;;
+;; Only event handlers can mutate "app-db", so after each handler runs  we'll
+;; want to revalidate.
+;;
+;; In handlers.cljs, notice how we use middleware to achieve that.
+;;

 (def schema
   {:todos   (s/both (s/pred map?) (s/pred sorted?))
@@ -20,5 +24,15 @@
   (s/validate schema db))

+;; -- Default Value  ----------------------------------------------------------
+;;
+(def default-value
+  {:todos   (sorted-map)        ;; todo ids are the keys
+   :showing :all
+   })

+
+
+
+


reverse debug statement

reverse debug statement

--- frontend/components/build_steps.cljs
+++ frontend/components/build_steps.cljs
@@ -183,7 +183,7 @@
   (reify
     om/IInitState
     (init-state [_]
-      {:autoscroll? true})
+      {:autoscroll? false})
     om/IDidMount
     (did-mount [_]
       (mount-browser-resize owner))


Add fn to change view

Add fn to change view

--- frontend/src/crunsher/utils/lib.cljs
+++ frontend/src/crunsher/utils/lib.cljs
@@ -40,6 +40,10 @@
     [{:keys [state]} _ {:keys [pokemon]}]
     {:action (fn [] (swap! state update-in [:pokemon] (fn [] pokemon)))})

+(defmethod mutate 'change/view
+  [{:keys [state]} _ {:keys [view]}]
+  {:action (fn [] (swap! state update-in [:user :view] (fn [] view)))})
+
 (defmethod mutate 'increment
     [{:keys [state]} _ {:keys [pokemon]}]
     {:action (fn [] (swap! state update-in [:count] inc))})
@@ -60,15 +64,22 @@
   [pokemon-id]
   (get pokemon/all pokemon-id))

+(defn logged-in?
+  "Return boolean if user is logged in or not."
+  []
+  (get-in @app-state [:user :logged-in?]))
+
+
+;;;; About views
 (defn current-view
   "Return current selected view."
   []
   (get-in @app-state [:user :view]))

-(defn logged-in?
-  "Return boolean if user is logged in or not."
-  []
-  (get-in @app-state [:user :logged-in?]))
+(defn change-view!
+  "Return current selected view."
+  [key]
+  (om/transact! reconciler `[(change/view {:view ~key})]))

 ;;;; State transitions
 (defn update-pokemon!


report-error helper

report-error helper

--- src-cljs/frontend/utils.cljs
+++ src-cljs/frontend/utils.cljs
@@ -60,6 +60,10 @@
   (when (logging-enabled?)
     (.apply (.-error js/console) js/console (clj->js messages))))

+(defn report-error [& messages]
+  (.apply js/Rollbar.error js/Rollbar (clj->js messages))
+  (apply merror messages))
+
 (defn log-pr [& args]
   (apply print (map #(if (= (type %) (type ""))
                      %


Fix test; dropped status in command response prematurely

--- src/rill/web.clj
+++ src/rill/web.clj
@@ -15,7 +15,8 @@
     {:status 412 :body {:status :command-out-of-date}} ; HTTP 412 Precondition Failed

     :ok
-    {:status 200 :body {:events events
+    {:status 200 :body {:status :command-accepted
+                        :events events
                         :aggregate-version new-version
                         :aggregate-id (message/primary-aggregate-id command)}}


clearing ifup/down and adding simpler host setup

--- src/vc/guest.clj
+++ src/vc/guest.clj
@@ -102,19 +102,17 @@

 (defn set-ip
   "set guest static ip"
-  [hostname auth config]
+  [hostname auth {:keys [domain] :as config}]
   (let [uuid (gen-uuid) tmp-file (<< "/tmp/intrefaces_~{uuid}")]
     (debug "setting up guest static ip")
     (assert-sudo hostname auth uuid)
     (upload-file
      (debian-interfaces (update-in config [:names] (partial join ","))) tmp-file hostname auth)
     (guest-run hostname "/bin/cp" (<< "-v ~{tmp-file} /etc/network/interfaces") auth uuid [2 :seconds])
-    (guest-run hostname "/sbin/ifdown" "eth0" auth uuid [3 :seconds])
-    (guest-run hostname "/sbin/ifup" "eth0" auth uuid [3 :seconds])
-    (guest-run hostname "/usr/sbin/service" "networking restart" auth uuid [3 :seconds])
     (guest-run hostname "/bin/rm" (<< "-v ~{tmp-file}") auth uuid [2 :seconds])
-    (guest-run hostname "echo" (<< "'kernel.hostname = ~{hostname}' | sudo tee -a /etc/sysctl.conf") auth uuid [2 :seconds])
-    (guest-run hostname "sysctl" "-e -p" auth uuid [2 :seconds])
+    (guest-run hostname "sed" (<< "-i '/^.*$/c\\~{hostname}' /etc/hostname") auth uuid [2 :seconds])
+    (guest-run hostname "sed"
+      (<< "-i '/^127.0.1.1/c\\127.0.1.1     ~{hostname} ~{hostname}.~{domain}' /etc/hosts") auth uuid [2 :seconds])
     (doseq [line (split (fetch-log hostname uuid auth) #"\n")] (debug line))))

 (comment


Clean up expect expansion

Clean up expect expansion

--- src/midje/parsing/2_to_lexical_maps/examples.clj
+++ src/midje/parsing/2_to_lexical_maps/examples.clj
@@ -17,41 +17,38 @@
             [midje.emission.api :as emit])
   (:import midje.data.metaconstant.Metaconstant))

-(prn "CLEAN UP EXPECT-EXPANSION")
-
-(defmulti expect-expansion (fn [_call-form_ arrow & _rhs_]
-                             (name arrow)))
-
-(pile/def-many-methods expect-expansion [=> =not=> =deny=>]
-  [call-form arrow expected-result fakes overrides]
-  ;; (prn call-form)
-  ;; (prn arrow)
-  ;; (prn expected-result)
-  ;; (prn overrides)
-  (let [check (lexical-maps/example call-form arrow expected-result overrides)]
-;     (prn check)
-     `(midje.checking.examples/check-one ~check ~fakes)))
-
-(defmethod expect-expansion =expands-to=>
-  [call-form _arrow_ expected-result fakes overrides]
-  (let [expanded-macro `(macroexpand-1 '~call-form)
-        escaped-expected-result `(quote ~expected-result)]
-    (let [check (lexical-maps/example expanded-macro => escaped-expected-result
-                                     (concat overrides [:expected-result-form escaped-expected-result]))]
-       `(midje.checking.examples/check-one ~check ~fakes))))
-
-(defmethod expect-expansion =future=>
-  [call-form arrow expected-result _fakes_ overrides]
-  (let [check (lexical-maps/example call-form arrow expected-result overrides)]
-    `(emit/future-fact (nested-facts/descriptions ~(str "on `" call-form "`"))
-                       (:position ~check))))
-
 (defn- ^{:testable true } a-fake? [x]
   (and (seq? x)
        (semi-sweet-keyword? (first x))))
+
+(defn mkfn:arrow? [& expected]
+  (fn [actual] ((set expected) (name actual))))
+(def normal-arrows? (mkfn:arrow? => =not=> =deny=>))
+(def macroexpansion-arrow? (mkfn:arrow? =expands-to=>))
+(def future-arrow? (mkfn:arrow? =future=>))
+
+(defn expansion [call-form arrow expected-result fakes overrides]
+  (pred-cond arrow
+    normal-arrows?
+    (let [check (lexical-maps/example call-form arrow expected-result overrides)]
+      `(midje.checking.examples/check-one ~check ~(vec fakes)))
+
+    macroexpansion-arrow?
+    (let [expanded-macro `(macroexpand-1 '~call-form)
+          escaped-expected-result `(quote ~expected-result)]
+      (expansion expanded-macro => escaped-expected-result fakes
+                 (concat overrides [:expected-result-form escaped-expected-result])))
+
+    future-arrow?
+    (let [position (:position (apply hash-map-duplicates-ok overrides))]
+        `(emit/future-fact (nested-facts/descriptions ~(str "on `" call-form "`")) ~position))
+
+    :else
+    (throw (Error. (str "Program error: Unknown arrow form " arrow)))))

 (defn to-lexical-map-form [full-form]
   (domonad validate-m [[call-form arrow expected-result & fakes+overrides] (validate full-form)
                        [fakes overrides] (separate a-fake? fakes+overrides)
                        _ (validate fakes)]
-           (expect-expansion call-form arrow expected-result (vec fakes) overrides)))
+           (expansion call-form arrow expected-result fakes overrides)))
+


Removes optional-clauses.

Removes optional-clauses.

--- src/active/clojure/match.clj
+++ src/active/clojure/match.clj
@@ -117,7 +117,6 @@
 ;; 4. Match the value at a path in a map to a specific value.
 ;;    - without binding - with binding
 ;;    - optional:  without binding - with binding
-;; 5. An optional clause that contains a regular clause and makes the match optional.

 ;; 1.
 (define-record-type KeyExistsWithoutBindingClause
@@ -342,22 +341,6 @@
   [path matcher bind]
   {:pre [(and (path? path) (matcher? matcher))]}
   (make-optional-path-matches-with-binding-clause path matcher bind))
-
-;; 5.
-(define-record-type
-  ^{:doc "Represents an optional clause. Contains the original clause."}
-  OptionalClause
-  (make-optional-clause clause)
-  optional-clause?
-  [clause optional-clause-clause])
-
-(defn optional
-  "Takes a `clause` and returns it as an optional clause. If it already was an
-  optional clause, this is the identity function."
-  [clause]
-  (if (optional-clause? clause)
-    clause
-    (make-optional-clause clause)))

 (def clause? (some-fn key-exists-without-binding-clause?
                       key-exists-with-binding-clause?
@@ -374,8 +357,7 @@
                       path-matches-without-binding-clause?
                       path-matches-with-binding-clause?
                       optional-path-matches-without-binding-clause?
-                      optional-path-matches-with-binding-clause?
-                      optional-clause?))
+                      optional-path-matches-with-binding-clause?))

 ;; helpers
 (defn clause-lens
@@ -413,24 +395,6 @@
       (path-matches-with-binding-clause? clause) path-matches-with-binding-lens
       (optional-path-matches-without-binding-clause? clause) optional-path-matches-without-binding-lens
       (optional-path-matches-with-binding-clause? clause) optional-path-matches-with-binding-lens
-      (optional-clause? clause) (lens/>> optional-clause-clause ((clause-lens
-                                                                  key-exists-without-binding-lens
-                                                                  key-exists-with-binding-lens
-                                                                  optional-key-exists-without-binding-lens
-                                                                  optional-key-exists-with-binding-lens
-                                                                  path-exists-without-binding-lens
-                                                                  path-exists-with-binding-lens
-                                                                  optional-path-exists-without-binding-lens
-                                                                  optional-path-exists-with-binding-lens
-                                                                  key-matches-without-binding-lens
-                                                                  key-matches-with-binding-lens
-                                                                  optional-key-matches-without-binding-lens
-                                                                  optional-key-matches-with-binding-lens
-                                                                  path-matches-without-binding-lens
-                                                                  path-matches-with-binding-lens
-                                                                  optional-path-matches-without-binding-lens
-                                                                  optional-path-matches-with-binding-lens)
-                                                                 (optional-clause-clause clause)))
       :else
       (c/assertion-violation `clause-lens "not a valid clause" clause))))

@@ -990,10 +954,7 @@
           match-value (matcher->value matcher)]
       (if (predicate-matcher? matcher)
         `(~(fold-path path '_) :guard ~(match-value message path))
-        (fold-path path (match-value message path))))
-
-    (optional-clause? clause)
-    {}))
+        (fold-path path (match-value message path))))))

 (defn reduce-lhs
@@ -1078,10 +1039,7 @@
     (conj bindings `[])

     (optional-path-matches-with-binding-clause? clause)
-    (conj bindings (optional-path-matches-with-binding-clause->rhs-match message clause))
-
-    (optional-clause? clause)
-    (clause->rhs message bindings (optional-clause-clause clause))))
+    (conj bindings (optional-path-matches-with-binding-clause->rhs-match message clause))))

 (defn pattern->rhs
   [message pattern rhs]


CMR-387: Updated to pass pre-processed-query instead of query to elastic-results->query-results.

--- src/cmr/search/services/query_execution.clj
+++ src/cmr/search/services/query_execution.clj
@@ -154,7 +154,7 @@
                                  %
                                  (acl-service/add-acl-conditions-to-query context %)))
                              (idx/execute-query context))
-        query-results (rc/elastic-results->query-results context query elastic-results)]
+        query-results (rc/elastic-results->query-results context pre-processed-query elastic-results)]
     (post-process-query-result-features context query elastic-results query-results)))


Added `read-spec` to schemastore.inmemory

--- src/kixi/datastore/schemastore/inmemory.clj
+++ src/kixi/datastore/schemastore/inmemory.clj
@@ -11,7 +11,7 @@

 (defn persist-new-schema
   [data create-request]
-  (swap! data
+  (swap! data
          assoc
          (::ss/name create-request)
          (t/clj-form->json-str (::ss/definition create-request))))
@@ -22,34 +22,44 @@
            (get @data)
            t/json-str->clj-form))

+(defn resolve-spec
+  [spec-sym get-spec-fn]
+  (let [[initial & forms] spec-sym]
+    (when (= initial 'clojure.spec/cat)
+      (doseq [f (->> forms
+                     (partition 2)
+                     (map second))]
+        (let [inner-spec (get-spec-fn f)]
+          (s/def-impl f inner-spec (eval inner-spec)))))
+    (s/spec (eval spec-sym))))
+
 (defn read-spec
   [data name]
-  (let [definition (read-definition data name)
-        evald (eval definition)]
-    (s/spec evald))) ;; Need to reach into the map for :ps values (?) and load them from the store
+  (-> (read-definition data name)
+      (resolve-spec (partial read-definition data))))

 (defrecord InMemory
     [data communications]
-    SchemaStore
-    (exists [_ name]
-      (get @data name))
-    (fetch-definition [_ name]
-      (read-definition data name))
-    (fetch-spec [_ name]
-      (read-spec data name))
-    component/Lifecycle
-    (start [component]
-      (if-not data
-        (let [new-data (atom {})]
-          (info "Starting InMemory Schema Store")
-          (attach-sink-processor communications
-                                 #(s/valid? ::ss/create-request %)
-                                 (partial persist-new-schema new-data))
-          (assoc component :data new-data))
-        component))
-    (stop [component]
-      (if data
-        (do (info "Destroying InMemory Schema Store")
-            (reset! data {})
-            (dissoc component :data))
-        component)))
+  SchemaStore
+  (exists [_ name]
+    (get @data name))
+  (fetch-definition [_ name]
+    (read-definition data name))
+  (fetch-spec [_ name]
+    (read-spec data name))
+  component/Lifecycle
+  (start [component]
+    (if-not data
+      (let [new-data (atom {})]
+        (info "Starting InMemory Schema Store")
+        (attach-sink-processor communications
+                               #(s/valid? ::ss/create-request %)
+                               (partial persist-new-schema new-data))
+        (assoc component :data new-data))
+      component))
+  (stop [component]
+    (if data
+      (do (info "Destroying InMemory Schema Store")
+          (reset! data {})
+          (dissoc component :data))
+      component)))


another fix attempt to the one-page thread bug

--- src/mafia_votecount/scraper/team_liquid.clj
+++ src/mafia_votecount/scraper/team_liquid.clj
@@ -51,10 +51,10 @@

 (defn- get-page-numbers [content]
   (let [page-number-bar (get-page-number-bar content)
-        last-page  (if (= page-number-bar null) 1 (->> (reverse page-number-bar)
+        last-page  (->> (reverse page-number-bar)
                         (filter #(Character/isDigit (first %))) ;; Filter is lazy
                         (first)
-                        (Integer/parseInt)))]
+                        (if (integer? (Integer/parseInt)) (Integer/parseInt) 1 ))]
     (vec (range 1 (inc last-page)))))

 (defn- has-quote? [part]


split '_v' in posgresql-function

split '_v' in posgresql-function

--- src/main/clojure/pdok/featured/extracts.clj
+++ src/main/clojure/pdok/featured/extracts.clj
@@ -35,16 +35,15 @@

 (defn get-or-add-extractset [db dataset extract-type]
   "return id"
-  (let [dataset-unversioned (first (clojure.string/split dataset #"_v"))
-        query (str "select id, unique_label from " extractset-table " where dataset = ? and extract_type = ?")]
+  (let [query (str "select id, unique_label from " extractset-table " where unique_label = ? and extract_type = ?")]
     (j/with-db-connection [c db]
-      (let [result (j/query c [query dataset-unversioned extract-type])]
+      (let [result (j/query c [query dataset extract-type])]
         (if (empty? result)
           (do
-            (j/query c [(str "SELECT " extract-schema ".add_extractset(?,?,?)")
-                        dataset-unversioned
+            (j/query c [(str "SELECT " extract-schema ".add_extractset(?,?)")
+                        dataset
                         extract-type
-                        dataset])
+                        ])
             (get-or-add-extractset db dataset extract-type))

           {:extractset-id (:id (first result))
@@ -72,7 +71,7 @@
    if schema or table doesn't exists it will be created."
   (let [{:keys [extractset-id unique-label]} (get-or-add-extractset db dataset extract-type) ]
     (do
-      (jdbc-insert-extract db unique-label (map tranform-feature-for-db rendered-features))
+      (jdbc-insert-extract db (str unique-label "_" extract-type) (map tranform-feature-for-db rendered-features))
       (add-metadata-extract-records db extractset-id rendered-features))
     (count rendered-features)))


Cleaned up iso-mends representation.

Cleaned up iso-mends representation.

--- src/cmr/umm/core.clj
+++ src/cmr/umm/core.clj
@@ -28,15 +28,7 @@
   [concept]
   (dif-c/parse-collection (:metadata concept)))

-(defmethod parse-concept [:collection "application/iso+xml"]
-  [concept]
-  (iso-mends-c/parse-collection (:metadata concept)))
-
 (defmethod parse-concept [:collection "application/iso19115+xml"]
-  [concept]
-  (iso-mends-c/parse-collection (:metadata concept)))
-
-(defmethod parse-concept [:collection "application/iso-mends+xml"]
   [concept]
   (iso-mends-c/parse-collection (:metadata concept)))

@@ -61,15 +53,7 @@
   [umm format]
   (dif/umm->dif-xml umm))

-(defmethod umm->xml :iso
-  [umm format]
-  (iso-mends/umm->iso-mends-xml umm))
-
 (defmethod umm->xml :iso19115
-  [umm format]
-  (iso-mends/umm->iso-mends-xml umm))
-
-(defmethod umm->xml :iso-mends
   [umm format]
   (iso-mends/umm->iso-mends-xml umm))


Fix typo (keyword instead string)

Fix typo (keyword instead string)

--- examples/session/src/authexample/web.clj
+++ examples/session/src/authexample/web.clj
@@ -73,7 +73,7 @@
         session (:session request)
         found-password (get authdata (keyword username))]
     (if (and found-password (= found-password password))
-      (let [next-url (get-in request [:query-params :next] "/")
+      (let [next-url (get-in request [:query-params "next"] "/")
             updated-session (assoc session :identity (keyword username))]
         (-> (redirect next-url)
             (assoc :session updated-session)))


Fixes #7: wrong field type

Fixes #7: wrong field type

--- src/ardoq/swagger/common.clj
+++ src/ardoq/swagger/common.clj
@@ -29,10 +29,10 @@
     (-> (api/->Field "method" "method" "Text" (str model-id) [(api/type-id-by-name model "Operation")])
         (api/create client)))
   (when-not (field-exists? client "produces" model)
-    (-> (api/->Field "produces" "produces" "List" (str model-id) [(api/type-id-by-name model "Operation") (api/type-id-by-name model "Resource")])
+    (-> (api/->Field "produces" "produces" "Text" (str model-id) [(api/type-id-by-name model "Operation") (api/type-id-by-name model "Resource")])
         (api/create client)))
   (when-not (field-exists? client "consumes" model)
-    (-> (api/->Field "consumes" "consumes" "List" (str model-id) [(api/type-id-by-name model "Operation") (api/type-id-by-name model "Resource")])
+    (-> (api/->Field "consumes" "consumes" "Text" (str model-id) [(api/type-id-by-name model "Operation") (api/type-id-by-name model "Resource")])
         (api/create client))))

 (defn generate-operation-description [data models]


Add IName protocol on dsl ns.

Add IName protocol on dsl ns.

--- src/cljooq/dsl.clj
+++ src/cljooq/dsl.clj
@@ -1,6 +1,14 @@
 (ns cljooq.dsl
   "Sql building dsl"
-  (:import org.jooq.impl.DSL))
+  (:refer-clojure :exclude [val group-by and or not name])
+  (:require [cljooq.core :as core]
+            [cljooq.proto :as proto])
+  (:import org.jooq.impl.DSL
+           org.jooq.impl.DefaultConfiguration))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; SQL Renderer Code
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Protocols for constructors
@@ -12,6 +20,9 @@
 (defprotocol ITable
   (table [_] "Table constructor"))

+(defprotocol IName
+  (name [_] "Name constructor"))
+
 (defprotocol ICondition
   (condition [_] "Condition constructor"))

@@ -24,20 +35,38 @@

 (extend-protocol IField
   java.lang.String
-  (field [s] (DSL/field s))
+  (field* [s] (DSL/field s))

   clojure.lang.Keyword
-  (field [kw] (field (name kw))))
+  (field* [kw] (field* (clojure.core/name kw)))
+
+  org.jooq.Field
+  (field* [f] f)
+
+  ;; org.jooq.impl.SelectQueryAsExistsCondition
+  ;; (field* [f] f)
+
+  org.jooq.impl.Val
+  (field* [v] v))

 (extend-protocol ITable
   java.lang.String
   (table [s] (DSL/table s))

   clojure.lang.Keyword
-  (table [kw] (table (name kw)))
+  (table [kw] (table (clojure.core/name kw)))

   org.jooq.Table
   (table [t] t))
+
+(extend-protocol IName
+  java.lang.String
+  (name [s]
+    (-> (into-array String [s])
+        (DSL/name)))
+
+  clojure.lang.Keyword
+  (name [kw] (name (clojure.core/name kw))))

 (extend-protocol ICondition
   java.lang.String


Fixed local function document invalid

Fixed local function document invalid

--- src/control/core.clj
+++ src/control/core.clj
@@ -53,8 +53,9 @@
   (when (and *enable-logging* (not (blank? (join " " content))))
     (println (gen-log host tag content))))

-(defn local [ cmd ]
+(defn local
   "Execute command on local machine"
+  [cmd]
   (when *enable-logging* (println (cli-bash-bold "Performing " cmd " on local")))
   (let [rt (apply sh ["sh" "-c" cmd])
         status (:exit rt)


Correctly parse only changed markdown files on the second `watch` loop Doing a full compare caused all the markdown to be re-parsed on the second loop, because for some reason, the timestamp on the file changed. Since we're only interested in the content of the file, just comparing the file's hash to the previous version is sufficient, and produces the correct behavior.


close #61

close #61


Add latency command line argument.

Add latency command line argument.

--- src/dsbdp/main.clj
+++ src/dsbdp/main.clj
@@ -77,6 +77,8 @@
    ["-l" "--pipeline-length PIPELINE-LENGTH"
     :default 2
     :parse-fn #(Integer/parseInt %)]
+   ["-L" "--latency"
+    "Measure the latency that is introduced by the data processing."]
    ["-m" "--fn-mapping FN-MAPPING"
     "The mapping of dsl-expressions to processing functions."
     :default [5 5 4 3]


Remove traversal namespace.

Remove traversal namespace.

--- src/cats/labs/traversal.cljc
+++ src/cats/labs/traversal.cljc
@@ -1,198 +0,0 @@
-(ns cats.labs.traversal
-  (:require [cats.util :as util]
-            [cats.protocols :as p]
-            [cats.labs.lens :as l])
-  (:refer-clojure :exclude [nth key keys vals filter select-keys cat]))
-
-(defn traversal
-  "Given a function for getting the focused values from a state (getter)
-  and a function that takes the state and and update function (setter),
-  constructs a traversal."
-  [getter setter]
-  (fn [next]
-    (fn
-      ([s]
-       (mapcat next (getter s)))
-      ([s f]
-       (setter s #(next % f))))))
-
-(def it
-  "Identity traversal."
-  (traversal list l/id-setter))
-
-(def nothing
-  "Identity traversal under `both`."
-  (traversal
-   (constantly [])
-   l/const-setter))
-
-(defn foci
-  "Given a traversal and a state, return the values focused by the traversal."
-  [traversal s]
-  (let [getter (traversal list)]
-    (getter s)))
-
-(defn ffoci
-  "Given a traversal and a state, return the first value focused by the traversal."
-  [traversal s]
-  (first (foci traversal s)))
-
-(defn both
-  "Given two traversals, compose them in parallel. The getter of
-  the resulting traversal will combine results from both traversals
-  and the setter will update the state with both setters."
-  [one other]
-  (traversal
-   (fn [s]
-     (concat (foci one s)
-             (foci other s)))
-   (fn [s f]
-     (->> s
-          (l/over one f)
-          (l/over other f)))))
-
-(defn lens->traversal
-  "Derive a traversal from a lens."
-  [l]
-  (traversal
-   (fn [s]
-     (list (l/focus l s)))
-   (fn [s f]
-     (l/over l f s))))
-
-(def each
-  "A traversal into each element of a sequence."
-  (traversal
-   sequence
-   (fn [s f]
-     (into (l/sequential-empty s) (map f s)))))
-
-(def cat
-  (comp each each))
-
-(defn filter
-  "Given a predicate, return a traversal that focuses the elements that
-  pass the predicate."
-  [applies?]
-  (traversal
-   (fn [s]
-     (if (applies? s)
-       [s]
-       []))
-   (fn [s f]
-     (if (applies? s)
-       (f s)
-       s))))
-
-(defn only
-  "Given a predicate, return a traversal that filters a coll."
-  [applies?]
-  (comp each (filter applies?)))
-
-(def keys
-  "Focus on the keys of an associative data structure."
-  (traversal
-   (fn [s]
-     (clojure.core/keys s))
-   (fn [s f]
-     (zipmap (map f (clojure.core/keys s))
-             (clojure.core/vals s)))))
-
-(def vals
-  "Focus on the values of an associative data structure."
-  (traversal
-   (fn [s]
-     (clojure.core/vals s))
-   (fn [s f]
-     (zipmap (clojure.core/keys s)
-             (map f (clojure.core/vals s))))))
-
-(def indexed
-  (traversal
-   (fn [s]
-     (map-indexed vector s))
-   (fn [s f]
-     (map f (map-indexed vector s)))))
-
-(deftype Foci [id trav a]
-  p/Printable
-  (-repr [m]
-    (str "#<Foci [" (pr-str trav) "," (pr-str a) "]>"))
-
-  #?@(:clj
-      [clojure.lang.IDeref
-       (deref [_] (foci trav @a))
-
-       clojure.lang.IAtom
-       (reset [self newval]
-         (swap! a #(l/put trav newval %))
-         (deref self))
-       (swap [self f]
-         (swap! a (fn [s] (l/over trav f s)))
-         (deref self))
-       (swap [self f x]
-         (swap! a (fn [s] (l/over trav #(f % x) s)))
-         (deref self))
-       (swap [self f x y]
-         (swap! a (fn [s] (l/over trav #(f % x y) s)))
-         (deref self))
-       (swap [self f x y more]
-         (swap! a (fn [s] (l/over trav #(apply f % x y more) s)))
-         (deref self))
-
-       clojure.lang.IRef
-       (addWatch [self key cb]
-         (let [key (l/prefix-key key id)]
-           (add-watch a key (fn [key _ oldval newval]
-                              (let [old' (foci trav oldval)
-                                    new' (foci trav newval)]
-                                (if (not= old' new')
-                                  (cb key self old' new')))))))
-       (removeWatch [_ key]
-         (let [key (l/prefix-key key id)]
-           (remove-watch a key)))]
-
-      :cljs
-      [IDeref
-       (-deref [_] (foci trav @a))
-
-       IWatchable
-       (-add-watch [self key cb]
-         (let [key (l/prefix-key key id)]
-           (add-watch a key (fn [key _ oldval newval]
-                              (let [old' (foci trav oldval)
-                                    new' (foci trav newval)]
-                                (if (not= old' new')
-                                  (cb key self old' new')))))))
-       (-remove-watch [_ key]
-         (let [key (l/prefix-key key id)]
-           (remove-watch a key)))
-
-       IReset
-       (-reset! [self newval]
-         (swap! a #(l/put trav newval %))
-         (deref self))
-
-       ISwap
-       (-swap! [self f]
-        (swap! a (fn [s] (l/over trav f s)))
-        (deref self))
-
-       (-swap! [self f x]
-         (swap! a (fn [s] (l/over trav #(f % x) s)))
-         (deref self))
-
-       (-swap! [self f x y]
-         (swap! a (fn [s] (l/over trav #(f % x y) s)))
-         (deref self))
-
-       (-swap! [self f x y more]
-         (swap! a (fn [s] (l/over trav #(apply f % x y more) s)))
-         (deref self))]))
-
-(defn foci-atom
-  [traversal a]
-  (let [id (str (gensym "cats-traversals"))]
-    (Foci. id traversal a)))
-
-(util/make-printable Foci)


[FLINK-17172][tests] Enable DEBUG level logging in Jepsen tests

This closes #11761.

--- flink-jepsen/src/jepsen/flink/db.clj
+++ flink-jepsen/src/jepsen/flink/db.clj
@@ -67,7 +67,7 @@
                                          (seq (flink-configuration test node))))]
     (c/exec :echo c :> conf-file)
     ;; TODO: write log4j.properties properly
-    (c/exec (c/lit (str "sed -i'.bak' -e '/log4j.rootLogger=/ s/=.*/=DEBUG, file/' " install-dir "/conf/log4j.properties")))))
+    (c/exec (c/lit (str "sed -i'.bak' -e '/rootLogger\\.level/ s/=.*/= DEBUG/' " install-dir "/conf/log4j.properties")))))

 (defn- file-name
   [path]


Work on add bookmark

Work on add bookmark

--- src/clj/bookmarx/handler.clj
+++ src/clj/bookmarx/handler.clj
@@ -45,41 +45,51 @@
 (defn get-bookmarks
   "Gets all bookmark folders and their children and returns them in an HTTP response."
   [params & [status]]
-  (info "get-bookmarks")
-  (let [conn (d/connect (env :database-uri))
-        bookmarks (d/q '[:find (pull ?e [:db/id :bookmark/id :bookmark/name :bookmark/url
-                                         :bookmark/parent {:bookmark/_parent 1}])
-                         :where [?e :bookmark/id]
-                         [(missing? $ ?e :bookmark/url)]] (d/db conn))
-        headers {"content-type" "application/edn"}]
-    {:status (or status 200)
-     :headers (if (= (:csrf-token params) "true")
-                (assoc headers "csrf-token" *anti-forgery-token*)
-                headers)
-     :body (str bookmarks)}))
+  (try
+    (info "get-bookmarks")
+    (let [conn (d/connect (env :database-uri))
+          bookmarks (d/q '[:find (pull ?e [:db/id :bookmark/id :bookmark/name :bookmark/url
+                                           :bookmark/parent {:bookmark/_parent 1}])
+                           :where [?e :bookmark/id]
+                           [(missing? $ ?e :bookmark/url)]] (d/db conn))
+          headers {"content-type" "application/edn"}]
+      {:status (or status 200)
+       :headers (if (= (:csrf-token params) "true")
+                  (assoc headers "csrf-token" *anti-forgery-token*)
+                  headers)
+       :body (str bookmarks)})
+  (catch Exception e (errorf "Error %s" (.toString e)))))

 (defn get-bookmark
   "Gets a bookmark and returns it in an HTTP response."
   [id & [status]]
-  (infof "get-bookmark %s" id)
-  (let [conn (d/connect (env :database-uri))
-        bookmark (d/q `[:find (pull ?e [:db/id :bookmark/id :bookmark/name :bookmark/url
-                                        :bookmark/parent {:bookmark/_parent 1}])
-                        :where [?e :bookmark/id ~id]] (d/db conn))]
-    {:status (or status 200)
-     :headers {"content-type" "application/edn"}
-     :body (str bookmark)}))
+  (try
+    (infof "get-bookmark %s" id)
+    (let [conn (d/connect (env :database-uri))
+          bookmark (d/q `[:find (pull ?e [:db/id :bookmark/id :bookmark/name :bookmark/url
+                                          :bookmark/parent {:bookmark/_parent 1}])
+                          :where [?e :bookmark/id ~id]] (d/db conn))]
+      {:status (or status 200)
+       :headers {"content-type" "application/edn"}
+       :body (str bookmark)})
+    (catch Exception e (errorf "Error %s" (.toString e)))))

 (defn post-bookmark
   "Posts a bookmark to the database for an HTTP request."
-  [body & [status]]
-  (infof "post-bookmark %s" body)
-  ;; TODO: Add db/id and bookmark/id if missing.
-  (let [conn (d/connect (env :database-uri))
-        id @(d/transact conn body)]
-    {:status (or status 200)
-     :headers {"content-type" "application/edn"}
-     :body {:db/id id}}))
+  [params & [status]]
+  (try
+    (infof "post-bookmark %s" params)
+    ; Add db/id and bookmark/id if missing.
+    (let [conn (d/connect (env :database-uri))
+          bookmark (if (:db/id params)
+                     params
+                     (assoc params :db/id #db/id[:db.part/user] :bookmark/id (d/squuid)))
+          response @(d/transact conn [bookmark])]
+      (infof "response %s" (str response))
+      {:status (or status 200)
+       :headers {"content-type" "application/edn"}
+       :body (pr-str {:db/id response})})
+  (catch Exception e (errorf "Error %s" (.toString e)))))

 (defroutes routes
            ;; Views
@@ -91,7 +101,7 @@
            ;; API
            (GET "/api/bookmarks" {params :params} [] (get-bookmarks params))
            (GET "/api/bookmarks/:id" [id] (get-bookmark id))
-           (POST "/api/bookmarks" {body :body} (post-bookmark (slurp body)))
+           (POST "/api/bookmarks" {params :edn-params} (post-bookmark params))

            (resources "/")
            (not-found "Not Found"))


Haversine.

Haversine.

--- src/clj/triangulate/core.clj
+++ src/clj/triangulate/core.clj
@@ -10,15 +10,57 @@

 (defn polyline []
   (let [body (:body (client/get "http://maps.googleapis.com/maps/api/directions/json"
-                                {:query-params {:origin "240 East Morton Street, Old Forge"
-                                                :destination "245 East Morton Street, Old Forge"
+                                {:query-params {:origin "Intersection of Main Street and Stephenson Street, Duryea, PA"
+                                                :destination "Intersection of Main Street and Phoenix Street, Duryea, PA"
                                                 :sensor false}}))]
     (-> (parse-string body true) :routes first :overview_polyline :points)))

 (defn decode-polyline [poly]
   (map (fn [x] {:lat (.latitude x) :long (.longitude x)}) (PolylineDecoder/decodePoly poly)))

-(pprint (decode-polyline (polyline)))
+(defn haversine [a b]
+  (let [lat1 (:lat a)
+        lat2 (:lat b)
+        lon1 (:long a)
+        lon2 (:long b)
+        R 6372.8
+        dlat (Math/toRadians (- lat2 lat1))
+        dlon (Math/toRadians (- lon2 lon1))
+        lat1 (Math/toRadians lat1)
+        lat2 (Math/toRadians lat2)
+        a (+ (* (Math/sin (/ dlat 2)) (Math/sin (/ dlat 2)))
+             (* (Math/sin (/ dlon 2)) (Math/sin (/ dlon 2))
+                (Math/cos lat1) (Math/cos lat2)))]
+    (* 1000 (* R 2 (Math/asin (Math/sqrt a))))))
+
+(def coordinates (reverse (decode-polyline (polyline))))
+
+(def meters-away 200)
+
+(def pairs (partition 2 1 coordinates))
+
+(def segments (map (fn [[a b]] (haversine a b)) pairs))
+
+(defn take-segments
+  ([segments distance] (take-segments segments distance 0 0))
+  ([[head & tail] distance k n]
+     (if (>= k distance)
+       n
+       (recur tail distance (+ k head) (inc n)))))
+
+(def back-segment (take-segments segments meters-away))
+
+(def front-segment (dec back-segment))
+
+(def back-distance (reduce + (take back-segment segments)))
+
+(def front-distance (reduce + (take front-segment segments)))
+
+(def back-coordinate (nth coordinates back-segment))
+
+(def front-coordinate (nth coordinates front-segment))
+
+(def distance-to-front-segment (- back-distance meters-away))

 (defroutes routes
   (POST "/rush-hour/api/triangulate/edn" {:keys [body]}


add wrap-json-response

add wrap-json-response

--- src/clj_money/web/server.clj
+++ src/clj_money/web/server.clj
@@ -154,10 +154,11 @@
          :credential-fn (partial clj-money.models.users/authenticate (env :db))
          :redirect-on-auth? false})
       (wrap-resource "public")
-      (wrap-keyword-params)
       (wrap-params)
       (wrap-multipart-params)
       (wrap-json-params)
+      (wrap-keyword-params)
+      (wrap-json-response)
       (wrap-session)))

 (defn -main [& [port]]


add default step for number inputs

add default step for number inputs

--- src/clj_money/web/shared.clj
+++ src/clj_money/web/shared.clj
@@ -233,7 +233,8 @@
 (defn number-input-field
   ([model attribute] (number-input-field model attribute {}))
   ([model attribute options]
-   (input-field model attribute (merge options {:type :number}))))
+   (input-field model attribute (merge options {:type :number
+                                                :step "0.01"}))))

 (defn password-input-field
   ([model attribute] (password-input-field model attribute {}))


improved search limits

improved search limits

--- src/cljs/redditv/reddit.cljs
+++ src/cljs/redditv/reddit.cljs
@@ -32,7 +32,8 @@
                            {:q search
                             :sort sort
                             :t (or time "relevance")
-                            :restrict_sr "on"}))))
+                            :restrict_sr "on"
+                            :limit 100}))))

 (generate-search-url "videos" "doggo")

@@ -89,7 +90,6 @@
 (defn get-search-posts [subreddit search opts]
   (let [output-channel (chan)
         url (generate-search-url subreddit search)
-        _ (.log js/console "search-url" url)
         [success-channel error-channel] (send-jsonp url)]
     (go (let [result (js->clj (<! success-channel) :keywordize-keys true)
               data (-> result :data :children vec)]


get poll-interval from app-state if possible

--- src/cljs/searchbot/core.cljs
+++ src/cljs/searchbot/core.cljs
@@ -35,7 +35,7 @@
           (let [jobs (agg-jobs)]
             (.log js/console (str (count jobs) " jobs: " (map :agg-key jobs)))
             (>jobs jobs req-chan es-settings)
-            (<! (timeout 30000)))))
+            (<! (timeout (or (:poll-interval @app-state) 30000))))))

     (om/root off-canvas
              app-state


Add more logging methods.

Add more logging methods.

--- src/clojure/apio/logging.clj
+++ src/clojure/apio/logging.clj
@@ -3,7 +3,6 @@
            (org.slf4j Logger LoggerFactory))
   (:require [apio.concurrency.threading :as thr])
   (:gen-class))
-

 (def ^:dynamic *root-logger* (LoggerFactory/getLogger Logger/ROOT_LOGGER_NAME))

@@ -16,3 +15,13 @@
   [^String message & args]
   (into *root-logger*
     (.info (apply format (into [message] args)))))
+
+(defn error
+  [^String message & args]
+  (into *root-logger*
+    (.error (apply format (into [message] args)))))
+
+(defn debug
+  [^String message & args]
+  (into *root-logger*
+    (.debug (apply format (into [message] args)))))


Remove some comments

Remove some comments

--- src/clojure/picard/proxy.clj
+++ src/clojure/picard/proxy.clj
@@ -26,40 +26,6 @@
        (instance? ConnectException val)
        (or (nil? current-state)
            (= :pending current-state))))
-
-;; (defn mk-proxy
-;;   ([] (mk-proxy client/GLOBAL-POOL))
-;;   ([pool]
-;;      (fn [downstream req]
-;;        (let [state (atom nil)]
-;;         (with
-;;          (client/request
-;;           pool (addr-from-req req) req
-;;           (fn [upstream evt val]
-;;             ;; Not able to connect to the end server
-;;             (when (and (= :abort evt)
-;;                        (instance? ConnectException val)
-;;                        (not= :connected @state))
-;;               (downstream :response
-;;                           [502 {"content-length" "20"}
-;;                            "
Bad Gateway
"]))
-
-;;             ;; Otherwise, handle stuff
-;;             (if (= :connected evt)
-;;               (locking req
-;;                 (let [current-state @state]
-;;                   (when (= :pending current-state)
-;;                     (downstream :resume nil))
-;;                   (hard-set! state :connected)))
-;;               (downstream evt val))))
-;;          :as upstream
-;;          (when (chunked? req)
-;;            (locking req
-;;              (let [current-state @state]
-;;                (when (not= :connected current-state)
-;;                  (hard-set! state :pending)
-;;                  (downstream :pause nil)))))
-;;          (fn [evt val] (upstream evt val)))))))

 (defn mk-proxy
   ([] (mk-proxy client/GLOBAL-POOL))


(PDB-5484) node-ttl/configure-expiration-behavior: add missing (is ...) wrappers

--- test/puppetlabs/puppetdb/acceptance/node_ttl.clj
+++ test/puppetlabs/puppetdb/acceptance/node_ttl.clj
@@ -135,8 +135,8 @@
                     (facts)))
              (cli-svc/clean pdb ["purge_nodes"])
              (is (= [{"certname" "foo" "expired" nil}] (nodes)))
-             (= [{"certname" "foo", "facts" [{"name" "x", "value" 1}]}]
-                (facts)))
+             (is (= [{"certname" "foo", "facts" [{"name" "x", "value" 1}]}]
+                    (facts))))

            (testing "changing expiration from false to true allows expire/purge"
              (set-expire "foo" (now) true)
@@ -150,7 +150,7 @@
                     (facts)))
              (cli-svc/clean pdb ["purge_nodes"])
              (is (= [] (nodes)))
-             (= [] (facts)))
+             (is (= [] (facts))))

            (testing "nodes with unexpirable facts deactivate properly"
              (set-expire "foo" (now) false)


(PCP-526) Don't test error when wrapping a bad Message

After disabling schema validation, capsule/wrap does not enforce that
the Message argument is a valid Message, so we can't test that anymore.

Note that with PCP-525 we will ensure that only valid PCP messages are
accepted by pcp-broker; we can safely drop the Message validation when
creating a Capsule.

--- test/unit/puppetlabs/pcp/broker/capsule_test.clj
+++ test/unit/puppetlabs/pcp/broker/capsule_test.clj
@@ -11,8 +11,6 @@
 (deftest wrap-message-test
   (testing "wrapping a Message in a capsule"
     (is (instance? Capsule (wrap (message/make-message)))))
-  (testing "fails if an invalid message is given"
-    (is (thrown? Exception (wrap {:things "bad stuff"}))))
   (testing "does not add any debug hop entry"
     (is (empty? (:hops (wrap (message/make-message)))))))


prevent StackOverflowError error

prevent StackOverflowError error

when calling `with-subsystem-fixture`

--- lib/edge.test-utils/src/edge/test/system.clj
+++ lib/edge.test-utils/src/edge/test/system.clj
@@ -32,7 +32,7 @@

 (defn with-subsystem-fixture
   ([ks]
-   (with-subsystem-fixture default-system))
+   (with-subsystem-fixture default-system ks))
   ([system ks]
    (fn [f]
      (with-system (system) ks


add node indices

add node indices

--- frontend/components/build_head.cljs
+++ frontend/components/build_head.cljs
@@ -145,7 +145,7 @@
       (string/replace "$CIRCLE_ARTIFACTS/" "")
       (gstring/truncateMiddle 80)))

-(defn build-artifacts-list [data owner]
+(defn build-artifacts-list [data owner {:keys [show-node-indices?] :as opts}]
   (reify
     om/IRender
     (render [_]
@@ -168,13 +168,14 @@

               [:ol.build-artifacts-list
                (map (fn [artifact]
-                      [:li
-                       (if admin?
-                         ;; Be extra careful about XSS of admins
-                         (cleanup-artifact-path (:pretty_path artifact))
-
-                         [:a {:href (:url artifact) :target "_blank"}
-                          (cleanup-artifact-path (:pretty_path artifact))])])
+                      (let [display-path (-> artifact
+                                             :pretty_path
+                                             cleanup-artifact-path
+                                             (str (when show-node-indices? (str " (" (:node_index artifact) ")"))))]
+                        [:li
+                         (if admin? ; Be extra careful about XSS of admins
+                           display-path
+                           [:a {:href (:url artifact) :target "_blank"} display-path])]))
                     artifacts)]))])))))

 (defn build-head [data owner]
@@ -317,5 +318,6 @@
            (when (build-model/ssh-enabled-now? build)
              (om/build build-ssh (:node build)))
            (when (:has_artifacts build)
-             (om/build build-artifacts-list {:artifacts-data (get build-data :artifacts-data)
-                                             :user user}))]])))))
+             (om/build build-artifacts-list
+                       {:artifacts-data (get build-data :artifacts-data) :user user}
+                       {:opts {:show-node-indices? (< 1 (:parallel build))}}))]])))))


handle errors in the observers

handle errors in the observers

--- src/irmgard/core.clj
+++ src/irmgard/core.clj
@@ -128,15 +128,19 @@
         (if continue
           (do
             (log/infof "db-watcher[%s] polling" dbname)
-            (dispatch-notifications conf conn)
+            (try
+             (dispatch-notifications conf conn)
+             (catch Exception e
+               (log/errorf e "Error dispatching notifications.  Some updates failed to propigate! Retry will occurr on next NOTIFY.  Error: %s" e)))
             (try
              (Thread/sleep sleep-time)
              (catch Exception e
-               ;; do nothing
+               ;; do nothing. sleep interrupted by notify
                ))
             (recur conf (.get (:continue conf))))
           (do
             (log/infof "db-watcher[%s] terminating" dbname)))))))
+

 (defn start-watcher [wname conf]
   (let [control-atom   (AtomicBoolean. true)


Use continuation passing style to get rid of the recursion


Don't overwrite state w/ log-state WIP

Don't overwrite state w/ log-state WIP

Was happening during some messy destructuring in action-trigger.

This version is still quite broken: I get a slew of errors after this
one. But at least the handshake test runs without failing fatally at the
very beginning.


marks test-current-for-tokens-multiple-source-tokens as flaky

--- waiter/integration/waiter/token_request_test.clj
+++ waiter/integration/waiter/token_request_test.clj
@@ -1399,7 +1399,10 @@
         (finally
           (delete-token-and-assert waiter-url token))))))

-(deftest ^:parallel ^:integration-fast test-current-for-tokens-multiple-source-tokens
+;; fails to assert:
+;; (is (contains? references {:token {:sources [{:token token-name-a :version (token->etag waiter-url token-name-a)}
+;;                                              {:token token-name-b :version (token->etag waiter-url token-name-b)}]}})))
+(deftest ^:parallel ^:integration-fast ^:explicit test-current-for-tokens-multiple-source-tokens
   (testing-using-waiter-url
     (let [service-name (rand-name)
           token-name-a (create-token-name waiter-url (str service-name "-A"))


Fixed axiom 6 and added hyp justifies its ? form which justifies the hyp (cyclic).

--- src/paragon/core.clj
+++ src/paragon/core.clj
@@ -179,7 +179,9 @@
 (defnp check-axiom-6
   "Arrowing is one-way."
   [jg]
-  (graphalg/dag? (:graph jg)))
+  (every? (fn [[n-or-s1 n-or-s2]]
+            (not (graph/has-edge? (:graph jg) n-or-s2 n-or-s1)))
+          (graph/edges (:graph jg))))

 (defnp check-axiom-7
   "If two strokes send arrows to the same thing, and the things from which one of them receives arrows are among those from which the other receives arrows, then those strokes are identical."
@@ -300,7 +302,7 @@
   (let [stroke (format ".%s" (jgstr node))]
     (exists-just jg [stroke] node)))

-(defn- assert-color
+(defn assert-color
   [jg stroke-or-node color]
   (when @debugging? (println "asserting" stroke-or-node "as" color))
   (assoc-in jg [:coloring stroke-or-node] color))
@@ -319,6 +321,7 @@
       (exists-just [(format ".?%s" (jgstr hyp))] (format "?%s" (jgstr hyp)))
       (forall-just [(format "?%s" (jgstr hyp))] (format ".%s" (jgstr hyp)))
       (exists-just [(format ".%s" (jgstr hyp))] hyp)
+      (forall-just [hyp] (format ".?%s" (jgstr hyp)))
       (assert-black (format ".?%s" (jgstr hyp)))
       (assert-black (format "?%s" (jgstr hyp)))))


test with ubuntu_large DB

test with ubuntu_large DB

--- src/pg_demo/core.clj
+++ src/pg_demo/core.clj
@@ -16,14 +16,14 @@
 (def ora-spec
   { :classname    "oracle.jdbc.OracleDriver"  ; must be in classpath
     :subprotocol  "oracle"
-    :subname      "thin:@//10.100.6.231:1521/pvram"
+    :subname      "thin:@//10.100.6.231:1521/pvram_bkp"
     :user         "mart_user"
     :password     "rxlogix" } )

 (def pg-spec
   { :classname    "org.postgresql.Driver"
     :subprotocol  "postgresql"
-    :subname      "//localhost:5432/ubuntu" } )
+    :subname      "//localhost:5432/ubuntu_large" } )

 (def insert-chunk-size 1000)


New tests: test-parse-int-min-int, test-parse-int-max-int, test-parse-int-overflow, and test-parse-int-bad-input

--- test/emender_jenkins/config_loader_test.clj
+++ test/emender_jenkins/config_loader_test.clj
@@ -96,3 +96,25 @@
         -65536      (parse-int "-65536")
         -2147483647 (parse-int "-2147483647")))

+(deftest test-parse-int-min-int
+    "Check the behaviour of function emender-jenkins.config/parse-int."
+    (is (== Integer/MIN_VALUE (parse-int "-2147483648"))))
+
+(deftest test-parse-int-max-int
+    "Check the behaviour of function emender-jenkins.config/parse-int."
+    (is (== Integer/MAX_VALUE (parse-int "2147483647"))))
+
+(deftest test-parse-int-overflow
+    "Check the behaviour of function emender-jenkins.config/parse-int."
+    (are [x] (thrown? NumberFormatException x)
+        (parse-int "2147483648")
+        (parse-int "-2147483649")))
+
+(deftest test-parse-int-bad-input
+    "Check the behaviour of function emender-jenkins.config/parse-int."
+    (are [x] (thrown? NumberFormatException x)
+        (parse-int "")
+        (parse-int " ")
+        (parse-int "xyzzy")))
+       ; (parse-int "+1"))) ; removed, not compatible with all supported JDKs
+


remove unused shared state

remove unused shared state

--- src-cljs/core.cljs
+++ src-cljs/core.cljs
@@ -261,11 +261,6 @@
 (defn init []
   (let [el (. js/document (getElementById "om-app"))]
     (om/root app-view app-state
-             {:target el
-              :shared {:device-type
-                       (condp > (.-innerWidth js/window)
-                         480 :phone
-                         600 :tablet
-                         :desktop)}})))
+             {:target el})))

 (.addEventListener js/window "load" init)


indenting

indenting


- add explicit args precondition to dropdown

--- src/re_com/date.cljs
+++ src/re_com/date.cljs
@@ -187,7 +187,7 @@
     (merge attributes {:enabled-days enabled-days
                        :today (now)})))

-(def api
+(def core-api
   #{:model        ; goog.date.UtcDateTime can be reagent/atom.
                   ; The calendar will be focused on corresponding date and the date represents selection.
    :on-change     ; function callback will be passed new selected goog.date.UtcDateTime
@@ -202,7 +202,7 @@

 (defn inline-picker
   [& {:keys [model] :as args}]
-  {:pre [(superset? api (keys args))]}
+  {:pre [(superset? core-api (keys args))]}
   (let [current (-> (real-value model) first-day-of-the-month reagent/atom)]
     (fn
       [& {:keys [model disabled hide-border on-change] :as properties}]
@@ -234,12 +234,14 @@
                [:span  {:class "dropdown-button activator input-group-addon"}
                 [:i {:class "glyphicon glyphicon-th"}]]]]])

+(def dropdown-api
+  (conj core-api
+        :format ; optional date format see cljs_time.format Default "yyyy MMM dd"
+  ))

 (defn dropdown-picker
-  ;; API
-  ;;  Same as inline-picker +
-  ;;  :format   - optional date format see cljs_time.format Default "yyyy MMM dd"
-  []
+  [& {:as args}]
+  {:pre [(superset? dropdown-api (keys args))]}
   (let [shown? (reagent/atom false)]
     (fn
       [& {:keys [model show-weeks on-change format] :as passthrough-args}]


fix gif creator to only accept max 2/10s delay, and dump command to file

--- src/server/core.cljs
+++ src/server/core.cljs
@@ -46,14 +46,17 @@
                 (concat [1000])) ; wait 1 second at end of loop

         ; convert delays to imagemagick unit (1/100 s)
-        delays (map #(-> % (/ 10) (js/Math.floor)) dts)
+        ; (modern browsers don't support gif delays below 0.02s)
+        dt->delay #(max 2 (-> % (/ 10) js/Math.floor))
+        delays (map dt->delay dts)

         ; create imagemagick command
-        outfile (str cwd "/anim.gif")
+        gif-file (str cwd "/anim.gif")
+        cmd-file (str cwd "/anim.sh")
         cmd (join " " (concat
                ["convert"]
                (map-indexed #(str "-delay " %2 " " (fname %1)) delays)
-               ["-layers OptimizeTransparency -loop 0" outfile]))]
+               ["-layers OptimizeTransparency -loop 0" gif-file]))]

     (println "Received " (count frames) "frames")

@@ -64,12 +67,13 @@

     ; Run imagemagick command for generating gif.
     (println cmd)
+    (.writeFile fs cmd-file cmd)
     (exec cmd (fn [error stdout stderr]
                 (println "stdout:\n" stdout)
                 (println "stderr:\n" stderr)
                 (if error
                   (println "ERROR:\n" error)
-                  (println "SUCCESS.  Wrote " outfile))))))
+                  (println "SUCCESS.  Wrote " gif-file))))))

 ;;------------------------------------------------------------
 ;; Socket Setup


Working clear.

Working clear.

--- 03-analog-clock/src/cljs/analog_clock/client.cljs
+++ 03-analog-clock/src/cljs/analog_clock/client.cljs
@@ -81,9 +81,7 @@
         center [(/ width 2)
                 (/ height 2)]
         date (js/Date.)]
-    ;(.save canvas)
-    ;(.clearRect canvas 0 0 width height)
-    ;(.restore canvas)
+    (.clearRect context 0 0 width height)
     (draw-hour-hand   context center (.getHours   date))
     (draw-minute-hand context center (.getMinutes date))
     (draw-second-hand context center (.getSeconds date))))


Remove mini2Dx repositories

Remove mini2Dx repositories

--- src/clojure/leiningen/new/game_clojure/desktop-project.clj
+++ src/clojure/leiningen/new/game_clojure/desktop-project.clj
@@ -7,11 +7,7 @@
                  [com.badlogicgames.gdx/gdx-platform "0.9.9"
                   :classifier "natives-desktop"]]
   :repositories [["sonatype"
-                  "https://oss.sonatype.org/content/repositories/snapshots/"]
-                 ["mini2Dx-thirdparty"
-                  "http://mini2dx.org/nexus/content/repositories/thirdparty"]
-                 ["mini2Dx"
-                  "http://mini2dx.org/nexus/content/repositories/releases"]]
+                  "https://oss.sonatype.org/content/repositories/snapshots/"]]

   :source-paths ["src/clojure" "src-common/clojure"]
   :java-source-paths ["src/java" "src-common/java"]