Memory management fun. Brain explodes at the idea of side-effecting double arrays inside loop. Memories cheap right? Probably slower way of doing it...

--- src/clojure/core.clj
+++ src/clojure/core.clj
@@ -43,6 +43,14 @@
       vs))
     xtract-vs))

+(defn- c-double [len]
+  (let [xtract-vs (xtract/new_double-array len)]
+    (doall
+     (map-indexed
+      (fn [idx f] (xtract/double_array_setitem xtract-vs idx (double 0.0)))
+      (range 0 len)))
+    xtract-vs))
+
 (defn- xtract-args [& args] (xtract/doublea_to_voidp (clojure->c-double args)))

 (defn with-result [t xtract-fn]
@@ -162,92 +170,94 @@
                 (map
                  (fn [v]
                    (let [wav-data (clojure->c-double (vec v))
-                         f0    (extract-fundemental-frequency wav-data block-size SAMPLE_RATE)
-                         cents (frequency->cents f0)
-                         midi  (if (> f0 0.0)
-                                 (Integer/parseInt (format "%.0f" (/ cents 100)))
-                                 0)]
-
-                     (let [windowed (clojure->c-double (range 0 block-size))
-                           spectrum (clojure->c-double (range 0 block-size))]
-                       (xtract/xtract_windowed wav-data block-size (xtract/doublea_to_voidp full-window) windowed)
-                       (xtract/xtract_init_fft block-size xtract-spectrum)
-                       (xtract/xtract_spectrum windowed block-size (xtract-args SAMPLE_RATE_RATIO xtract-spectrum-magnitude 0.0 0.0)
-                                               spectrum)
-                       (xtract/xtract_free_fft)
-
-                       (let [peaks (clojure->c-double (range 0 block-size))]
-                         (xtract/xtract_peak_spectrum spectrum
-                                                      half-block-size
-                                                      (xtract-args SAMPLE_RATE_RATIO 10.0 0.0 0.0)
-                                                      peaks)
-
-                         (let [rms                   (double-array [0])
-                               spectral-irregularity (double-array [0])
-                               spectral-centroid     (double-array [0])
-                               spectral-variance     (double-array [0])
-
-                               ;;TODO
-                               noiseness             (double-array [0])
-                               loudness              (double-array [0])
-                               tonality              (double-array [0])
-
-                               spectral-inharmonicity (spectral-inharmonicity
-                                                       peaks block-size
-                                                       f0 0.5 NUM_HARMONICS 0)]
-
-                           (xtract/xtract_rms_amplitude wav-data block-size (xtract-args SAMPLE_RATE_RATIO) rms)
-
-                           (xtract/xtract_spectral_centroid spectrum block-size (xtract-args 0.0) spectral-centroid)
-                           (xtract/xtract_irregularity_j    spectrum half-block-size nil spectral-irregularity)
-
-                           (let [spectral-skewness      (double-array [0])
-                                 spectral-std-deviation (double-array [0])
-                                 spectral-mean          (double-array [0])
-                                 spectral-kurtosis      (double-array [0])]
-
-                             (xtract/xtract_spectral_mean spectrum block-size nil spectral-mean)
-                             (xtract/xtract_variance spectrum block-size (xtract-args (first spectral-mean)) spectral-variance)
-                             (xtract/xtract_spectral_standard_deviation spectrum block-size (xtract-args (first spectral-variance)) spectral-std-deviation)
-
-                             (let [argv (xtract-args (first spectral-mean) (first spectral-std-deviation))]
-                               (xtract/xtract_spectral_skewness spectrum block-size argv spectral-skewness)
-                               (xtract/xtract_spectral_kurtosis spectrum block-size argv spectral-kurtosis))
-
-                             ;;(xtract/xtract_noisiness     wav-data block-size (xtract-args NUM_HARMONICS ) noiseness)
-
-                             (let [_ 10
-                                   ;;bark-cofficents (clojure->c-double (range 0 xtract-bark-bands))
-                                   ]
-
-                               ;;(xtract/xtract_bark_coefficients spectrum half-block-size (xtract-args ) bark-cofficents)
-                               ;;(xtract/xtract_loudness      wav-data block-size (apply xtract-args argv) loudness)
-                               )
-
-                             ;;TODO
-                             ;;(xtract/xtract_tonality      wav-data block-size (xtract-args ) tonality)
-
-                             ;;TODO: Correct to clean these here?
-                             (xtract/delete_double_array wav-data)
-                             (xtract/delete_double_array spectrum)
-                             (xtract/delete_double_array peaks)
-
-                             {(* idx (int SAMPLE_RATE))
-                              {:spectral-inharmonicity spectral-inharmonicity
-                               :spectral-irregularity  (first spectral-irregularity)
-                               :spectral-centroid      (first spectral-centroid)
-                               :spectral-skewness      (first spectral-skewness)
-                               :spectral-kurtosis      (first spectral-kurtosis)
-                               :rms-amplitude          (first rms)
-
-                               :todo {:noisiness (first noiseness)
-                                      :loudness (first loudness)
-                                      :tonality (first tonality)}
-                               :midi midi
-                               :f0 f0}
-                              })))
-                       ;;(println "Magnitude Spectrum: " (pr-str (double->clojure spectrum block-size)))
-                       )))
+                         f0       (extract-fundemental-frequency wav-data block-size SAMPLE_RATE)
+                         cents    (frequency->cents f0)
+                         midi     (if (> f0 0.0)
+                                    (Integer/parseInt (format "%.0f" (/ cents 100)))
+                                    0)
+
+                         windowed (c-double block-size)
+                         spectrum (c-double block-size)
+                         peaks    (c-double block-size)]
+
+                     (xtract/xtract_windowed wav-data block-size (xtract/doublea_to_voidp full-window) windowed)
+                     (xtract/xtract_init_fft block-size xtract-spectrum)
+                     (xtract/xtract_spectrum windowed block-size (xtract-args SAMPLE_RATE_RATIO xtract-spectrum-magnitude 0.0 0.0)
+                                             spectrum)
+                     (xtract/xtract_free_fft)
+
+                     (xtract/xtract_peak_spectrum spectrum
+                                                  half-block-size
+                                                  (xtract-args SAMPLE_RATE_RATIO 10.0 0.0 0.0)
+                                                  peaks)
+
+                     (let [rms                   (double-array [0])
+                           spectral-irregularity (double-array [0])
+                           spectral-centroid     (double-array [0])
+                           spectral-variance     (double-array [0])
+
+                           ;;TODO
+                           noiseness             (double-array [0])
+                           loudness              (double-array [0])
+                           tonality              (double-array [0])
+
+                           spectral-inharmonicity (spectral-inharmonicity
+                                                   peaks block-size
+                                                   f0 0.5 NUM_HARMONICS 0)]
+
+                       (xtract/xtract_rms_amplitude wav-data block-size (xtract-args SAMPLE_RATE_RATIO) rms)
+
+                       (xtract/xtract_spectral_centroid spectrum block-size (xtract-args 0.0) spectral-centroid)
+                       (xtract/xtract_irregularity_j    spectrum half-block-size nil spectral-irregularity)
+
+                       (let [spectral-skewness      (double-array [0])
+                             spectral-std-deviation (double-array [0])
+                             spectral-mean          (double-array [0])
+                             spectral-kurtosis      (double-array [0])]
+
+                         (xtract/xtract_spectral_mean spectrum block-size nil spectral-mean)
+                         (xtract/xtract_variance spectrum block-size (xtract-args (first spectral-mean)) spectral-variance)
+                         (xtract/xtract_spectral_standard_deviation spectrum block-size (xtract-args (first spectral-variance)) spectral-std-deviation)
+
+                         (let [argv (xtract-args (first spectral-mean) (first spectral-std-deviation))]
+                           (xtract/xtract_spectral_skewness spectrum block-size argv spectral-skewness)
+                           (xtract/xtract_spectral_kurtosis spectrum block-size argv spectral-kurtosis))
+
+                         ;;(xtract/xtract_noisiness     wav-data block-size (xtract-args NUM_HARMONICS ) noiseness)
+
+                         (let [_ 10
+                               ;;bark-cofficents (clojure->c-double (range 0 xtract-bark-bands))
+                               ]
+
+                           ;;(xtract/xtract_bark_coefficients spectrum half-block-size (xtract-args ) bark-cofficents)
+                           ;;(xtract/xtract_loudness      wav-data block-size (apply xtract-args argv) loudness)
+                           )
+
+                         ;;TODO
+                         ;;(xtract/xtract_tonality      wav-data block-size (xtract-args ) tonality)
+
+                         ;;TODO: More memory, probably slower... Re-using variables faster but sad
+                         (xtract/delete_double_array wav-data)
+                         (xtract/delete_double_array windowed)
+                         (xtract/delete_double_array spectrum)
+                         (xtract/delete_double_array peaks)
+
+                         {(* idx (int SAMPLE_RATE))
+                          {:spectral-inharmonicity spectral-inharmonicity
+                           :spectral-irregularity  (first spectral-irregularity)
+                           :spectral-centroid      (first spectral-centroid)
+                           :spectral-skewness      (first spectral-skewness)
+                           :spectral-kurtosis      (first spectral-kurtosis)
+                           :rms-amplitude          (first rms)
+
+                           :todo {:noisiness (first noiseness)
+                                  :loudness (first loudness)
+                                  :tonality (first tonality)}
+                           :midi midi
+                           :f0 f0}
+                          }))
+                     ;;(println "Magnitude Spectrum: " (pr-str (double->clojure spectrum block-size)))
+                     ))
                  s))
               data-chunks)]

@@ -282,10 +292,11 @@

 (comment

-  (let [frame-stats (peek-inside "test/fixtures/test.wav")]
-    (doseq [frame frame-stats] (println frame))
-    (println :global (global-stats frame-stats))
-    )
+  (dotimes [i 1000000]
+    (let [frame-stats (peek-inside "test/fixtures/test.wav")]
+      ;;(doseq [frame frame-stats] (println frame))
+      (println :global (global-stats frame-stats))
+      ))

   (let [m (mean [1 2 4 8 10 12 14 16])
         v (variance [1 2 4 8 10 12 14 16] (clojure->c-double [m]))


protect against handlers returning nil

protect against handlers returning nil

--- src/goodbot/bot.clj
+++ src/goodbot/bot.clj
@@ -27,8 +27,9 @@
   help-plugin)

 (defn respond-with [irc message responses]
-  (def vec-responses (if (coll? responses) responses [responses]))
-  (doseq [r vec-responses] (irclj/reply irc message r)))
+  (when-not (nil? responses)
+    (def vec-responses (if (coll? responses) responses [responses]))
+    (doseq [r vec-responses] (irclj/reply irc message r))))

 (defn make-callback [plugins]
   (def plugins-with-help (conj plugins (make-help plugins)))


CMR-3091: Fixing query execution test.

CMR-3091: Fixing query execution test.

--- search-app/test/cmr/search/test/services/query_execution.clj
+++ search-app/test/cmr/search/test/services/query_execution.clj
@@ -88,8 +88,7 @@
       {:concept-id "C1-PROV1" :result-format :echo10} :elasticsearch
       {:concept-id "C1-PROV1" :result-format :dif} :elasticsearch
       {:concept-id "C1-PROV1" :result-format :dif10} :elasticsearch
-      {:concept-id "C1-PROV1" :result-format :iso19115} :elasticsearch
-      {:concept-id "C1-PROV1" :result-format :iso-smap} :elasticsearch))
+      {:concept-id "C1-PROV1" :result-format :iso19115} :elasticsearch))

   (testing "Granule Specific"
     (are [params expected-strategy]
@@ -101,7 +100,6 @@
       {:concept-id "G1-PROV1" :result-format :dif} :direct-transformer
       {:concept-id "G1-PROV1" :result-format :dif10} :direct-transformer
       {:concept-id "G1-PROV1" :result-format :iso19115} :direct-transformer
-      {:concept-id "G1-PROV1" :result-format :iso-smap} :direct-transformer

       ;; Multiple are supported
       {:concept-id ["G1-PROV1" "G2-PROV1"] :result-format :echo10} :direct-transformer


Be consistent about wording in usage text

--- src/invadm/core.clj
+++ src/invadm/core.clj
@@ -137,10 +137,10 @@
         "Usage: invadm [options] action"
         ""
         "  invadm create -c CURRENCY --from FROM --to TO -a AMOUNT -n NET [-i ISSUE_DATE] [-f FILENAME] ID"
-        "    Creates an invoice."
+        "    Create an invoice."
         ""
         "  invadm list {-c CURRENCY, --from FROM, --to TO, -f FILENAME}"
-        "    Lists invoices."
+        "    List invoices."
         ""
         "  invadm data {-c CURRENCY, --from FROM, --to TO, -f FILENAME}"
         "    Dump all the data in a JSON array."


cosine similarity rename

cosine similarity rename

--- src/crawler/page.clj
+++ src/crawler/page.clj
@@ -13,6 +13,7 @@
     xpath-hrefs)))

 (defn signature-similarity
+  "Return cardinality of intersection"
   [sign1 sign2]
   (let [set-sign1 (set sign1)
         set-sign2 (set sign2)]
@@ -20,7 +21,8 @@
         (clojure.set/intersection set-sign1 set-sign2))
        (* (Math/sqrt (count set-sign1)) (Math/sqrt (count set-sign2))))))

-(defn signature-similarity2
+(defn signature-similarity-cosine
+  "Cosine similarity"
   [sign1 sign2]
   (let [sign1-map (into {} sign1)
         sign2-map (into {} sign2)]
@@ -30,12 +32,14 @@
                             (* (sign1-map k1) (sign2-map k1))
                             0)))

-          mod1       (Math/sqrt (apply + (map
-                                          #(-> % second (Math/pow 2)) sign1-map)))
+          mod1       (Math/sqrt
+                      (apply + (map
+                                #(-> % second (Math/pow 2)) sign1-map)))

-          mod2       (Math/sqrt (apply + (map
-                                          #(-> % second (Math/pow 2)) sign2-map)))]
-
+          mod2       (Math/sqrt
+                      (apply + (map
+                                #(-> % second (Math/pow 2)) sign2-map)))]
+
       (/ inner-prod (* mod1 mod2)))))

 (defn signature-similarity-manhattan
@@ -54,6 +58,23 @@

       (/ inner-prod (* mod1 mod2)))))

+(defn signature-similarity-weighted-cosine
+  "Expected signature:
+   XPath: frequency
+   weights-table:
+   [Xpath -> #of items globally, df globally]"
+  [sign1 sign2 weights-table]
+  (let [weighted-sign  (fn [sgn]
+                         (map
+                          (fn [[xpath count] sign1]
+                            [xpath (* count (weights-table xpath))])
+                          sgn))
+
+        weight-sign-1  (weighted-sign sign1)
+
+        weight-sign-2  (weighted-sign sign2)]
+    (signature-similarity-cosine weight-sign-1 weight-sign-2)))
+
 (defn page-signature
   [xpaths xpath-hrefs]
   (map


fix location/phone commands migrations #3256

Signed-off-by: Eric Dvorsak <96f164ad4d9b2b0dacf8ebee2bb1eeb3aa69adf1@dvorsak.fr>

--- src/status_im/data_store/realm/schemas/account/v21/core.cljs
+++ src/status_im/data_store/realm/schemas/account/v21/core.cljs
@@ -14,7 +14,7 @@
             [status-im.data-store.realm.schemas.account.v21.browser :as browser]
             [taoensso.timbre :as log]
             [cljs.reader :as reader]
-            [clojure.string :as str]))
+            [clojure.string :as string]))

 (def schema [chat/schema
              chat-contact/schema
@@ -45,7 +45,7 @@
             content (aget message "content")
             type    (aget message "content-type")]
         (when (and (= type "command")
-                   (> (str/index-of content "command=location") -1))
+                   (string/includes? content "command=location"))
           (aset message "show?" false))))))

 (defn remove-phone-messages! [old-realm new-realm]
@@ -55,7 +55,7 @@
             content (aget message "content")
             type    (aget message "content-type")]
         (when (and (= type "command")
-                   (> (str/index-of content "command=phone") -1))
+                   (string/includes? content "command=phone"))
           (aset message "show?" false))))))

 (defn migration [old-realm new-realm]


add wrap-with-db

add wrap-with-db

--- src/joiner/ring.clj
+++ src/joiner/ring.clj
@@ -1,6 +1,7 @@
 (ns joiner.ring
   (:require [com.ashafa.clutch.http-client :as http]
-            [com.ashafa.clutch.utils :as utils])
+            [com.ashafa.clutch.utils :as utils]
+            [com.ashafa.clutch :as clutch])
   (:use [joiner.core]))

 (defn- in-any-role? [allow-roles roles]
@@ -20,6 +21,10 @@
      :roles (:roles request)}
     (get-current-user request)))

+(defn wrap-with-db [handler db]
+  (fn [request]
+    (clutch/with-db db
+                    (handler request))))

 (defn wrap-couchdb-user [handler & [ & {:keys [allow-roles]}]]
   "Wrap request with current couchdb user.


More unique name for api_data

More unique name for api_data

--- frontend/utils/docs.cljs
+++ frontend/utils/docs.cljs
@@ -69,7 +69,7 @@
                         (let [[name & path] (string/split m1 #"\.")
                               var (case name
                                     "versions" (aget js/window "CI" "Versions")
-                                    "api_data" (aget js/window "api_data"))
+                                    "api_data" (aget js/window "circle_api_data"))
                               val (apply aget var path)
                               filter (case m2
                                        "code-list" code-list-filter


(maint) Add test that sending updates works after subscriber disconnects

Adds an integration test that ensures sending updates works without
throwing an exception after a subscriber disconnects.

--- test/integration/puppetlabs/pcp/broker/subscription_test.clj
+++ test/integration/puppetlabs/pcp/broker/subscription_test.clj
@@ -137,7 +137,10 @@
           (#'puppetlabs.pcp.broker.inventory/send-updates (get-broker app))
           (let [response (client/recv! controller)]
             (is (= "http://puppetlabs.com/inventory_update" (:message_type response)))
-            (is (= [{:client "pcp://client01.example.com/agent" :change 1}] (get-in response [:data :changes]))))))))))
+            (is (= [{:client "pcp://client01.example.com/agent" :change 1}] (get-in response [:data :changes]))))))
+      ;; ensure send updates doesn't error after subscriber has disconnected
+      (with-open [client (client/connect :certname "client01.example.com" :force-association true)]
+        (#'puppetlabs.pcp.broker.inventory/send-updates (get-broker app)))))))

 (deftest inventory-update-after-reconnect
   (let [subscribe-client! puppetlabs.pcp.broker.inventory/subscribe-client!


Updating to get the correct postinst locations

--- src/omnibus/core.clj
+++ src/omnibus/core.clj
@@ -100,7 +100,7 @@
   (let [
         asset-name (str project-name "_" version "-" iteration "_" (if (= (os-data :machine) "x86_64") "amd64" "i386") ".deb")
         asset-path (.toString (file-str *omnibus-pkg-dir* "/" asset-name))
-        status (sh "fpm" "-s" "dir" "-t" "deb" "-v" version "--iteration" iteration "-n" project-name "/opt/opscode" "-m" "Opscode, Inc." "--post-install" "../source/postinst" "--post-uninstall" "../source/postrm" "--description" "The full stack install of Opscode Chef" "--url" "http://www.opscode.com" :dir "./pkg") ]
+        status (sh "fpm" "-s" "dir" "-t" "deb" "-v" version "--iteration" iteration "-n" project-name "/opt/opscode" "-m" "Opscode, Inc." "--post-install" (str *omnibus-source-dir* "/postinst") "--post-uninstall" (str *omnibus-source-dir* "/postrm") "--description" "The full stack install of Opscode Chef" "--url" "http://www.opscode.com" :dir "./pkg") ]
     (log-sh-result status
                    (do
                      (put-in-bucket asset-path @*bucket-name* (str (os-data :platform) "-" (os-data :platform_version) "-" (os-data :machine) "/" asset-name) @*s3-access-key* @*s3-secret-key*)
@@ -113,7 +113,7 @@
   (let [
         asset-name (str project-name "-" version "-" iteration "." (os-data :machine) ".rpm")
         asset-path (.toString (file-str *omnibus-pkg-dir* "/" asset-name))
-        status (sh "fpm" "-s" "dir" "-t" "rpm" "-v" version "--iteration" iteration "-n" project-name "/opt/opscode" "-m" "Opscode, Inc." "--post-install" "../source/postinst" "--post-uninstall" "../source/postrm" "--description" "The full stack install of Opscode Chef" "--url" "http://www.opscode.com" :dir "./pkg")]
+        status (sh "fpm" "-s" "dir" "-t" "rpm" "-v" version "--iteration" iteration "-n" project-name "/opt/opscode" "-m" "Opscode, Inc." "--post-install" (str *omnibus-source-dir* "postinst") "--post-uninstall" (str *omnibus-source-dir* "/postrm") "--description" "The full stack install of Opscode Chef" "--url" "http://www.opscode.com" :dir "./pkg")]
     (log-sh-result status
                    (do
                      (put-in-bucket asset-path @*bucket-name* (str (os-data :platform) "-" (os-data :platform_version) "-" (os-data :machine) "/" asset-name) @*s3-access-key* @*s3-secret-key*)


Sort mbean operations

Sort mbean operations

--- src/mbeanz/core.clj
+++ src/mbeanz/core.clj
@@ -8,6 +8,7 @@
 (defn get-identifiers [[bean-name & bean-ops]]
   (->> bean-ops
        (flatten)
+       (sort)
        (map (partial hash-map :bean (str bean-name) :operation))))

 (defn list-beans [object-name-pattern]


Horizontal rule var

Horizontal rule var

--- src/merkki/core.clj
+++ src/merkki/core.clj
@@ -33,7 +33,7 @@
 ;;;

 (defn header
-  "Given a number and a string, tags the string as that header level and adds a new line"
+  "Given a number and a string, tags the string as that header level (atx-style) and adds a new line"
   [n s]
   (str (reduce str (take n (repeat "#")))
        " "
@@ -98,3 +98,12 @@
 ;;;
 ;;; Block Elements
 ;;;
+
+
+;;;
+;;; Misc elements
+;;;
+
+(def hr
+  "Inserts a horizontal rule"
+  (break "***"))


Add :bgcolor option.

Add :bgcolor option.

--- src/quil/applet.clj
+++ src/quil/applet.clj
@@ -66,7 +66,14 @@
 (defn- applet-run
   "Launches the applet to the specified target."
   [applet title renderer]
-  (PApplet/runSketch (into-array String ["--hide-stop" title]) applet)
+  (PApplet/runSketch
+   (into-array String
+               (vec (filter string?
+                   [(when (and (:bgcolor (meta applet))
+                               (:present (meta applet)))
+                     (str "--bgcolor" "=" (str (:bgcolor (meta applet)))))
+                    "--hide-stop" title])))
+   applet)
   (prepare-applet-frame applet title renderer))

@@ -274,6 +281,9 @@

    :present        - Switch to sketch present mode (fullscreen without borders, OS panels).

+   :bgcolor        - Sets background color for unused space in present mode.
+                     Example: :bgcolor 200
+
    :setup          - a fn to be called once when setting the sketch up.

    :draw           - a fn to be repeatedly called at most n times per


Clean up leiningen profile

Clean up leiningen profile

Remove some pieces that I'm just not using to debug a startup error
that was working on one machine but not others

--- lein/profiles.clj
+++ lein/profiles.clj
@@ -5,13 +5,6 @@
                                                                       org.tcrawley/dynapath]]
                        [commons-io "2.5"]
                        [commons-logging "1.2"]
-                       ;; TODO: Replace this with whatever replaced it
-                       ;; Careful: 0.3.4 was working OK
-                       ;; Q: Did hara replace this too?
-                       #_[im.chit/vinyasa "0.4.7" :exclusions [im.chit/hara.reflect
-                                                             org.clojure/clojure
-                                                             org.codehaus.plexus/plexus-utils
-                                                             org.slf4j/jcl-over-slf4j]]
                        [leiningen #= (leiningen.core.main/leiningen-version) :exclusions [cheshire
                                                                                com.fasterxml.jackson.core/jackson-core
                                                                                com.fasterxml.jackson.dataformat/jackson-dataformat-smile
@@ -31,44 +24,16 @@
                        ;; Q: How many of any of the rest of these do I actually use?
                        [org.apache.maven.wagon/wagon-provider-api "2.12"]
                        [org.codehaus.plexus/plexus-utils "3.0.24"]
-                       ;; I use this everywhere. But it doesn't belong in here
-                       #_[org.clojure/tools.namespace "0.2.10"]
-                       ;; I know I have a lot of projects that transitively rely on this, but they really shouldn't
-                       #_[org.clojure/tools.nrepl "0.2.12" :exclusions [org.clojure/clojure]]
-                       [pjstadig/humane-test-output "0.8.2"]
-                       ;; Q: Is there any point to this next one?
-                       #_[ritz/ritz-nrepl-middleware "0.7.0"]
-                       ;; Q: Do I actually use this anywhere/for anything?
-                       ;; A: leiningen does.
-                       ;; Q: Why am/was I overriding?
-                       #_[slingshot "0.12.2" :exclusions [org.clojure/clojure]]]
-        :injections [#_(require '[vinyasa.inject :as inject])
-                     ;; TODO: call install-pretty-exception
-                     #_(require 'io.aviso.repl)
-                     #_(inject/in
-                      ;; Default injection ns is .
-                      [vinyasa.inject :refer [inject [in inject-in]]]
-                      [alembic.still [distill pull]]  ; Q: what is/was this?
-                      ;; I still want this.
-                      ;; Q: Where did it go?
-                      #_[cemerick.pomegranate add-classpath add-dependencies get-classpath resources]
-
-                      ;;; At least 90% certain that I don't want any of the rest of this
-                      ;; Inject into clojure.core
-                      clojure.core
-                      [vinyasa.reflection .> .? .* .% .%> .& .>ns .>var]
-
-                      ;; Inject into clojure.core, with prefix
-                      clojure.core >
-                      [clojure.pprint pprint]
-                      [clojure.java.shell sh])
+                       [pjstadig/humane-test-output "0.8.2"]]
+        :injections [;; TODO: call install-pretty-exception
                      ;;; Well, this doesn't seem awful; I think I do want something like this.
                      ;;; But it doesn't seem worth including here...really ought to be decided on
                      ;;; a case-by-case basis, oughtn't it?
                      (require 'pjstadig.humane-test-output)
                      (pjstadig.humane-test-output/activate!)]
         ;;:local-repo "repo"
-        :plugins [[com.jakemccrary/lein-test-refresh "0.20.0"]
+        :plugins [#_[cider/cider-nrepl "0.15.0" :exclusions [org.clojure/java.classpath]]
+                  [com.jakemccrary/lein-test-refresh "0.20.0"]
                   [jonase/eastwood "0.2.4" :exclusions [org.clojure/clojure]]
                   ;; Check for out-dated plugins in here using `lein ancient check-profiles`
                   [lein-ancient "0.6.10" :exclusions [cheshire
@@ -88,4 +53,4 @@
                   :print-meta true
                   :color-scheme {}
                   :print-color true}}
- :repl {:plugins [[cider/cider-nrepl "0.14.0" :exclusions [org.clojure/java.classpath]]]}}
+ :repl {:plugins [[cider/cider-nrepl "0.15.0" :exclusions [org.clojure/java.classpath]]]}}


CMR-2030: Addressed review comments.

CMR-2030: Addressed review comments.

--- umm-spec-lib/src/cmr/umm_spec/umm_to_xml_mappings/dif10.clj
+++ umm-spec-lib/src/cmr/umm_spec/umm_to_xml_mappings/dif10.clj
@@ -118,6 +118,22 @@
        (map sensor-mapping (:Sensors instrument))])
     [:Instrument
      [:Short_Name u/not-provided]]))
+
+(defn- generate-additional-attributes
+  "Returns the content generator instructions for generating DIF10 additional attributes."
+  [additional-attributes]
+  (for [aa additional-attributes]
+    [:Additional_Attributes
+     [:Name (:Name aa)]
+     [:DataType (:DataType aa)]
+     [:Description (with-default (:Description aa))]
+     [:MeasurementResolution (:MeasurementResolution aa)]
+     [:ParameterRangeBegin (with-default (:ParameterRangeBegin aa))]
+     [:ParameterRangeEnd (:ParameterRangeEnd aa)]
+     [:ParameterUnitsOfMeasure (:ParameterUnitsOfMeasure aa)]
+     [:ParameterValueAccuracy (:ParameterValueAccuracy aa)]
+     [:ValueAccuracyExplanation (:ValueAccuracyExplanation aa)]
+     [:Value (:Value aa)]]))

 (defn umm-c-to-dif10-xml
   "Returns DIF10 XML from a UMM-C collection record."
@@ -215,18 +231,7 @@
       [:Metadata_Last_Revision "2000-03-24T22:20:41-05:00"]
       [:Data_Creation "1970-01-01T00:00:00"]
       [:Data_Last_Revision "1970-01-01T00:00:00"]]
-     (for [aa (:AdditionalAttributes c)]
-       [:Additional_Attributes
-        [:Name (:Name aa)]
-        [:DataType (:DataType aa)]
-        [:Description (with-default (:Description aa))]
-        [:MeasurementResolution (:MeasurementResolution aa)]
-        [:ParameterRangeBegin (with-default (:ParameterRangeBegin aa))]
-        [:ParameterRangeEnd (:ParameterRangeEnd aa)]
-        [:ParameterUnitsOfMeasure (:ParameterUnitsOfMeasure aa)]
-        [:ParameterValueAccuracy (:ParameterValueAccuracy aa)]
-        [:ValueAccuracyExplanation (:ValueAccuracyExplanation aa)]
-        [:Value (:Value aa)]])
+     (generate-additional-attributes (:AdditionalAttributes c))
      [:Product_Level_Id (get product-levels (-> c :ProcessingLevel :Id))]
      [:Collection_Data_Type (:CollectionDataType c)]
      [:Product_Flag u/not-provided]]))


CMR-2073: Added a TODO comment

CMR-2073: Added a TODO comment

--- umm-spec-lib/src/cmr/umm_spec/umm_to_xml_mappings/dif10.clj
+++ umm-spec-lib/src/cmr/umm_spec/umm_to_xml_mappings/dif10.clj
@@ -41,6 +41,8 @@
   {:xmlns "http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/"
    :xmlns:dif "http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/"
    :xmlns:xsi "http://www.w3.org/2001/XMLSchema-instance"
+   ;; TODO: The schema location below is for DIF 10.1. Obtain a sample DIF 10.2 from GCMD
+   ;; and update the schemaLocation based on it.
    ; :xsi:schemaLocation "http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/ http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/dif_v10.1.xsd"
    })


Use $SENDMAIL from the environment, if provided.

Addresses issue #34.

--- src/postal/sendmail.clj
+++ src/postal/sendmail.clj
@@ -56,7 +56,9 @@
      :message message}))

 (defn sendmail-find []
-  (first (filter #(.isFile (java.io.File. ^String %)) sendmails)))
+  (if-let [SENDMAIL (System/getenv "SENDMAIL")]
+    SENDMAIL
+    (first (filter #(.isFile (java.io.File. ^String %)) sendmails))))

 (defn sanitize [^String text]
   (.replaceAll text "\r\n" (System/getProperty "line.separator")))


Removed unnecessary test file

Removed unnecessary test file

--- src/test/clojure/com/yolodata/tbana/storm/storm_test.clj
+++ src/test/clojure/com/yolodata/tbana/storm/storm_test.clj
@@ -1,23 +0,0 @@
-;
-; Copyright (c) 2013 Yolodata, LLC,  All Rights Reserved.
-;
-; Licensed under the Apache License, Version 2.0 (the "License");
-; you may not use this file except in compliance with the License.
-; You may obtain a copy of the License at
-;
-; http://www.apache.org/licenses/LICENSE-2.0
-;
-; Unless required by applicable law or agreed to in writing, software
-; distributed under the License is distributed on an "AS IS" BASIS,
-; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-; See the License for the specific language governing permissions and
-; limitations under the License.
-;
-
-(ns com.yolodata.tbana.storm.storm-test
-  (:use [clojure test])
-  (:use [backtype.storm testing]))
-
-(deftest splunk-spout-test
-  (with-local-cluster [cluster]
-    (Thread/sleep 500)))


deref position-injected in popover-content-wrapper now that it is not magically derefed by the arg validation code. Required so that  left-offset and top-offset can be recalculated when :no-clip? is true and the position is modified to prevent screen clipping

--- src/re_com/popover.cljs
+++ src/re_com/popover.cljs
@@ -349,7 +349,6 @@
       :or {arrow-length 11 arrow-width 22 arrow-gap -1}
       :as args}]
   {:pre [(validate-args-macro popover-content-wrapper-args-desc args "popover-content-wrapper")]}
-  ;(assert ((complement nil?) showing-injected?) "Must specify a showing-injected? atom")
   (let [left-offset              (reagent/atom 0)
         top-offset               (reagent/atom 0)
         position-no-clip-popover (fn position-no-clip-popover
@@ -377,6 +376,8 @@
              :or {arrow-length 11 arrow-width 22 arrow-gap -1}
              :as args}]
          {:pre [(validate-args-macro popover-content-wrapper-args-desc args "popover-content-wrapper")]}
+
+         @position-injected ;; Dereference this atom. Although nothing here needs its value explicitly, the calculation of left-offset and top-offset are affected by it for :no-clip? true
          [:div
           {:class "popover-content-wrapper"
            :style (merge (flex-child-style "inherit")
@@ -432,7 +433,8 @@
        (fn
          [& {:keys [showing? position anchor popover style] :as args}]
          {:pre [(validate-args-macro popover-anchor-wrapper-args-desc args "popover-anchor-wrapper")]}
-         @reset-on-hide ;; TODO: Need to dereference this reaction, otherwise it will never update (probably a better way to do this)
+
+         @reset-on-hide ;; Dereference this reaction, otherwise it won't be set up. The reaction is set to run whenever the popover closes
          (when (not= @external-position position) ;; Has position changed externally?
            (reset! external-position position)
            (reset! internal-position @external-position))


Upgrade lein-ancient

Upgrade lein-ancient

--- roles/clojure/files/profiles.clj
+++ roles/clojure/files/profiles.clj
@@ -11,7 +11,7 @@
         :plugins [[cider/cider-nrepl "0.9.0-SNAPSHOT"]
                   [codox "0.6.6"]
                   [jonase/eastwood "0.1.4"]
-                  #_[lein-ancient "0.5.5" :exclusions [commons-codec]]
+                  [lein-ancient "0.6.2" :exclusions [commons-codec]]
                   [lein-cljsbuild "1.0.3"]
                   [lein-clojars "0.9.1"]
                   [lein-cloverage "1.0.2"]


Add pomegranate dependency and aliases

Add pomegranate dependency and aliases

--- roles/clojure/files/profiles.clj
+++ roles/clojure/files/profiles.clj
@@ -3,6 +3,7 @@
         :dependencies [[acyclic/squiggly-clojure "0.1.2-SNAPSHOT"]
                        [alembic "0.2.1"]
                        [clj-stacktrace "0.2.7"]
+                       [com.cemerick/pomegranate "0.3.0"]
                        [criterium "0.4.2"]
                        [org.clojure/tools.namespace "0.2.5"]
                        [org.clojure/tools.nrepl "0.2.7"]
@@ -29,6 +30,9 @@
         :shorthand {. [^:lazy alembic.still/distill
                        ^:lazy alembic.still/load-project
                        ^:lazy ^:macro alembic.still/lein
+                       ^:lazy cemerick.pomegranate/add-classpath
+                       ^:lazy cemerick.pomegranate/get-classpath
+                       ^:lazy cemerick.pomegranate/resources
                        ^:lazy clojure.java.shell/sh
                        ^:lazy clojure.pprint/pprint
                        clojure.repl/apropos


ex37 cont.

ex37 cont.

--- examples/ex37_fractal_bestiary.clj
+++ examples/ex37_fractal_bestiary.clj
@@ -8,106 +8,147 @@
   (:import [clojure2d.math.vector Vec2]))

 (def ^:const ^int size 800)
-(def ^:const ^int hsize (/ size 2))
+(def ^:const ^double s60 (m/sin (m/radians 60.0)))
+(def ^:const ^double s60- (- s60))
+(def ^:const unit (Vec2. 1.0 0.0))
+
+(def canvas (make-canvas size size))
+(def window (show-window canvas "Fractal Bestiary"))
+
+(defn transform-sq->tri
+  ""
+  [v]
+  (let [matched (first (filter #(< (v/angle-between v (first %)) 1.0e-6) [[(Vec2. 1.0 0.0) (Vec2. 1.0 0.0)]
+                                                                          [(Vec2. -1.0 0.0) (Vec2. -1.0 0.0)]
+                                                                          [(Vec2. 1.0 -1.0) (Vec2. 0.5 s60-)]
+                                                                          [(Vec2. 0.0 -1.0) (Vec2. -0.5 s60-)]
+                                                                          [(Vec2. -1.0 -1.0) (Vec2. -0.5 s60-)]
+                                                                          [(Vec2. -1.0 1.0) (Vec2. -0.5 s60)]
+                                                                          [(Vec2. 0.0 1.0) (Vec2. 0.5 s60)]
+                                                                          [(Vec2. 1.0 1.0) (Vec2. 0.5 s60)]]))]
+    (if-not matched
+      v
+      (let [[in tg] matched]
+        (v/mult tg (/ (v/mag v) (v/mag in)))))))
+
+(defn process-recipe
+  "Process recipe from book format to angles and lengths required by method provided in this example"
+  [{:keys [grid recipe pos len]
+    :or {pos [0.1 0.6] len 0.25 grid :tri recipe [[1 0 1 1] [0 1 1 1] [1 -1 1 1] [1 0 1 1]]}}]
+  (let [transform (if (= grid :tri) transform-sq->tri identity)
+        vects (map #(let [[x y] %] (transform (Vec2. x y))) recipe)
+        angles (map #(v/relative-angle-between %2 %1) (cons unit vects) vects)
+        rot (reduce v/add vects)]
+    {:pos pos
+     :len len
+     :scale (/ (v/mag rot))
+     :rot (v/relative-angle-between unit rot)
+     :recipe (map #(conj (drop 2 %2) %1 (v/mag %3)) angles recipe vects)}))
+
+(defn draw-beast
+  "Draw recursively given recipe (internally processed)."
+  [canvas depth len {:keys [scale rot recipe] :as all}]
+
+  (mapv #(let [[vlen angle forward flip] %
+               slen (* vlen len)]
+
+           (rotate canvas angle)
+
+           (push-matrix canvas)
+           (when (neg? forward)
+             (translate canvas slen 0)
+             (flip-y canvas)
+             (rotate canvas m/PI))
+           (when (neg? flip) (flip-y canvas))
+
+           (if (zero? depth)
+             (line canvas 0 0 slen 0)
+             (do
+               (rotate canvas rot)
+               (draw-beast canvas (dec depth) (* slen scale) all)))
+           (pop-matrix canvas)
+
+           (translate canvas slen 0)) recipe)
+  canvas)
+
+(defn draw-recipe
+  ""
+  ([recipe depth]
+   (let [{len :len pos :pos :as precipe} (process-recipe recipe)
+         [px py] (v/mult pos size)]
+     (with-canvas canvas
+       (set-background 21 20 25)
+       (set-color :lightgrey 250)
+       (set-stroke 0.8)
+       (translate px py)
+       (draw-beast depth (* size len) precipe))))
+  ([recipe] (draw-recipe recipe (or (:default-depth recipe) 5))))

-(def canvas (make-canvas size size :high))
-(def window (show-window canvas "Fractal Bestiary"))
+(def recipes {;; preliminary part
+              :koch {:grid :tri :recipe [[1 0 1 1] [0 1 1 1] [1 -1 1 1] [1 0 1 1]]}
+              :p20 {:grid :tri :recipe [[1 0 1 1] [0 1 1 1] [1 -1 1 1] [1 0 1 -1]]}
+              :p22 {:grid :sq :recipe [[0 2 1 1] [1 1 1 1] [2 0 1 1] [1 -1 1 1] [0 -2 1 1]] :len 0.1 :pos [0.3 0.7]}
+              :p23 {:grid :sq :recipe [[0 2 1 1] [1 1 1 -1] [2 0 1 1] [1 -1 1 -1] [0 -2 1 1]] :len 0.1 :pos [0.3 0.7]}
+              :p24 {:grid :sq :recipe [[0 1 1 1] [1 -1 1 1] [1 0 -1 -1]] :pos [0.3 0.6] :default-depth 8}
+              ;; :p25 {:grid :sq :recipe [[0 2 -1 1] [1 0 -1 -1] [1 0 1 1] [-1 -1 1 1] [2 -1 1 -1]] :len 0.2 :pos [0.3 0.7]} ;;wrong
+              :p37-dragon-curve {:grid :sq :recipe [[1 0 1 1] [0 1 -1 -1]] :len 0.3 :pos [0.3 0.6] :default-depth 11}
+              :p37-5-dragon {:grid :sq :recipe [[0 1 1 1] [1 0 1 1] [0 -1 1 1] [1 0 1 1] [0 1 1 1]] :len 0.3 :pos [0.2 0.65]}
+              :p50-ab12 {:grid :sq :recipe [[1 0 1 1] [0 1 1 1]] :pos [0.3 0.55] :default-depth 11}
+              :p50-a3 {:grid :sq :recipe [[1 0 1 1] [0 1 1 -1]] :pos [0.3 0.55] :len 0.4 :default-depth 11}
+              :p50-c1 {:grid :sq :recipe [[1 0 1 -1] [0 1 1 1]] :pos [0.1 0.7] :len 0.4 :default-depth 11}
+              :p50-a1 {:grid :sq :recipe [[1 0 1 1] [0 1 -1 -1]] :len 0.4 :pos [0.3 0.6] :default-depth 11}
+              :p50-d1 {:grid :sq :recipe [[1 0 -1 -1] [0 1 1 1]] :len 0.4 :pos [0.2 0.7] :default-depth 11}
+              :p50-d2 {:grid :sq :recipe [[1 0 -1 -1] [0 1 -1 1]] :len 0.4 :pos [0.15 0.65] :default-depth 13}
+              :p50-b4 {:grid :sq :recipe [[1 0 -1 1] [0 1 -1 -1]] :len 0.4 :pos [0.2 0.55] :default-depth 13}
+              :p50-c2 {:grid :sq :recipe [[1 0 1 -1] [0 1 -1 1]] :len 0.4 :pos [0.1 0.7] :default-depth 11}
+              :p50-b3 {:grid :sq :recipe [[1 0 -1 1] [0 1 1 -1]] :len 0.4 :pos [0.2 0.5] :default-depth 11}
+              :p50-cd34 {:grid :sq :recipe [[1 0 -1 -1] [0 1 -1 -1]] :len 0.6 :pos [0.2 0.75] :default-depth 12}
+
+              ;; sqrt(2)
+              :p52-dragon-curve {:grid :sq :recipe [[1 0 1 1] [0 1 -1 -1]] :len 0.3 :pos [0.3 0.6] :default-depth 8}
+              :p52-polya {:grid :sq :recipe [[1 0 1 -1] [0 1 -1 1]] :len 0.4 :pos [0.1 0.7] :default-depth 8}
+
+              ;; sqrt(3)
+              :p53-sq {:grid :sq :recipe [[1 0 1 1] [0 1 1 1] [1 -1 1 1] [1 0 1 1]] :default-depth 3}
+              :p53-tri {:grid :tri :recipe [[1 0 1 1] [0 1 1 1] [1 -1 1 1] [1 0 1 1]] :default-depth 3}
+              :p55-ter-dragon {:grid :tri :recipe [[0 1 1 1] [1 -1 1 1] [0 1 1 1]] :len 0.4 :pos [0.2 0.7]}
+              :p56-inverted-ter-dragon {:grid :tri :recipe [[0 1 -1 1] [1 -1 -1 1] [0 1 -1 1]] :len 0.4 :pos [0.2 0.7]}
+              :p56 {:grid :tri :recipe [[0 1 -1 1] [1 -1 1 1] [0 1 -1 1]] :len 0.4 :pos [0.2 0.7]}
+              :p57-a {:grid :tri :recipe [[0 1 -1 1] [0 1 -1 1] [1 -1 1 -1]] :len 0.3 :pos [0.35 0.8] :default-depth 6}
+              :p57-b {:grid :tri :recipe [[0 1 1 1] [0 1 1 1] [1 -1 -1 -1]] :len 0.3 :pos [0.35 0.8]}
+              :p57-c {:grid :tri :recipe [[0 1 1 -1] [0 1 -1 1] [1 -1 1 -1]] :len 0.3 :pos [0.3 0.8] :default-depth 6}
+              :p58-a {:grid :tri :recipe [[0 1 1 -1] [0 1 -1 1] [1 -1 -1 1]] :len 0.3 :pos [0.25 0.85] :default-depth 6}
+              :p58-b {:grid :tri :recipe [[0 1 -1 -1] [0 1 1 1] [1 -1 1 1]] :len 0.25 :pos [0.25 0.7] :default-depth 6}
+              :p58-c {:grid :tri :recipe [[0 1 1 -1] [0 1 -1 1] [1 -1 1 1]] :len 0.25 :pos [0.25 0.7] :default-depth 6}
+              :p59-yin-dragon {:grid :tri :recipe [[0 1 1 1] [0 1 -1 -1] [1 -1 1 1]] :len 0.25 :pos [0.25 0.75] :default-depth 6}
+
+              ;; sqrt(4)
+              :p60-cesaros-sweep {:grid :sq :recipe [[1 0 1 1] [0 1 1 1] [0 -1 1 1] [1 0 1 1]] :len 0.4 :pos [0.1 0.7] :default-depth 4}
+              :p62 {:grid :sq :recipe [[0 1 -1 1] [1 0 1 1] [0 -1 -1 -1] [1 0 1 -1]] :pos [0.35 0.6] :default-depth 4}
+              :p63-a {:grid :sq :recipe [[0 1 1 -1] [1 0 -1 1] [0 -1 1 -1] [1 0 -1 1]] :pos [0.25 0.75] :default-depth 4}
+              :p63-b {:grid :sq :recipe [[0 1 -1 1] [1 0 1 -1] [0 -1 -1 1] [1 0 1 -1]] :pos [0.3 0.6] :default-depth 4}
+              :p64-peano-sweep {:grid :sq :recipe [[0 1 -1 -1] [1 0 1 1] [1 0 1 1] [0 -1 -1 -1]] :len 0.4 :pos [0.1 0.9] :default-depth 4}
+              :p66-v1-dragon {:grid :sq :recipe [[1 1 1 1] [1 0 -1 -1] [0 -1 1 1]] :len 0.2 :pos [0.3 0.6] :default-depth 6}
+              :p67 {:grid :sq :recipe [[1 1 -1 -1] [1 0 1 1] [0 -1 1 1]] :len 0.2 :pos [0.25 0.6] :default-depth 6}
+              :p70 {:grid :sq :recipe [[1 1 -1 1] [0 -1 -1 -1] [1 0 1 1]] :len 0.4 :pos [0.1 0.85] :default-depth 4}
+              :p70-v2-dragon {:grid :sq :recipe [[1 1 1 1] [0 -1 1 1] [1 0 -1 -1]] :pos [0.3 0.6] :default-depth 4}
+              :p71 {:grid :sq :recipe [[0 1 1 1] [1 -1 -1 -1] [1 0 1 1]] :len 0.3 :pos [0.3 0.6]}
+              :p73-dragon-of-eve {:grid :sq :recipe [[0 1 1 1] [1 -1 1 1] [1 0 -1 -1]] :pos [0.3 0.6]}
+              :p74-sierpinski-arrowhead-curve {:grid :tri :recipe [[0 1 1 -1] [1 0 1 1] [1 -1 1 -1]] :len 0.4 :pos [0.1 0.85] :default-depth 6}
+              :p75-sierpinski-family {:grid :tri :recipe [[0 1 1 -1] [1 -1 -1 -1] [1 0 1 1]] :len 0.4 :pos [0.1 0.7]}
+              :p76 {:grid :tri :recipe [[1 -1 1 1] [0 1 1 1] [0 1 1 1] [1 -1 1 1]] :pos [0.25 0.5] :default-depth 4}
+              :p77 {:grid :tri :recipe [[1 -1 1 -1] [0 1 -1 1] [0 1 1 -1] [1 -1 1 -1]] :pos [0.25 0.5] :default-depth 3}
+              :p78-a {:grid :tri :recipe [[1 -1 -1 1] [0 1 1 1] [0 1 -1 1] [1 -1 -1 1]] :pos [0.25 0.5] :default-depth 4}
+              :p78-b {:grid :tri :recipe [[0 1 -1 1] [0 1 1 -1] [1 -1 -1 1] [1 -1 1 -1]] :pos [0.35 0.7]}
+              :p80 {:grid :tri :recipe [[0 1 1 1] [0 1 -1 1] [1 -1 1 -1] [1 -1 -1 1]] :len 0.2 :pos [0.3 0.7] :default-depth 4} ;; result different...
+              :p81 {:grid :tri :recipe [[0 1 -1 -1] [0 1 1 1] [1 -1 -1 -1] [1 -1 1 1]] :len 0.2 :pos [0.3 0.7] :default-depth 3}
+              :p82 {:grid :tri :recipe [[1 0 1 1] [-1 1 -1 -1] [1 0 1 1] [1 -1 -1 -1]] :len 0.4 :pos [0.1 0.85] :default-depth 3}
+              :p83-a {:grid :tri :recipe [[1 0 -1 1] [-1 1 1 -1] [1 0 -1 1] [1 -1 1 -1]] :len 0.4 :pos [0.1 0.85] :default-depth 3}
+              :p83-b {:grid :tri :recipe [[1 0 1 1] [-1 1 -1 -1] [1 0 1 1] [1 -1 1 -1]] :len 0.4 :pos [0.1 0.85] :default-depth 3}
+
+              ;; sqrt(5)
+              })

-
-(defn draw-beast
-  ""
-  [canvas ^long depth ^double len [a1 b1 a2 b2 a3 b3 a4 b4 :as all]]
-
-;;;;;;;
-
-  (rotate canvas (- m/HALF_PI))
-
-  (push-matrix canvas)
-  (when a1
-    (translate canvas len 0)
-    (flip-y canvas)
-    (rotate canvas m/PI))
-  (when b1 (flip-y canvas))
-
-  (if (zero? depth)
-    (do
-      (line canvas 0 0 len 0))
-    (do
-      (rotate canvas (- m/HALF_PI))
-      (draw-beast canvas (dec depth) (* len (/ (m/sqrt 4.0))) all)))
-  (pop-matrix canvas)
-
-;;;;;;;;
-
-  (translate canvas len 0)
-  (rotate canvas m/HALF_PI)
-
-  (push-matrix canvas)
-  (when a2
-    (translate canvas len 0)
-    (flip-y canvas)
-    (rotate canvas m/PI))
-  (when b2 (flip-y canvas))
-
-  (if (zero? depth)
-    (do
-      (line canvas 0 0 len 0))
-    (do
-      (rotate canvas (- m/HALF_PI))
-      (draw-beast canvas (dec depth) (* len (/ (m/sqrt 4.0))) all)))
-  (pop-matrix canvas)
-
-
-;;;;;
-
-  (translate canvas len 0)
-  (rotate canvas m/HALF_PI)
-
-  (push-matrix canvas)
-  (when a3
-    (translate canvas len 0)
-    (flip-y canvas)
-    (rotate canvas m/PI))
-  (when b3 (flip-y canvas))
-
-  (if (zero? depth)
-    (do
-      (line canvas 0 0 len 0))
-    (do
-      (rotate canvas (- m/HALF_PI))
-      (draw-beast canvas (dec depth) (* len (/ (m/sqrt 4.0))) all)))
-  (pop-matrix canvas)
-
-;;;;;;;
-
-  (translate canvas len 0)
-  (rotate canvas (- m/HALF_PI))
-
-  (push-matrix canvas)
-  (when a4
-    (translate canvas len 0)
-    (flip-y canvas)
-    (rotate canvas m/PI))
-  (when b4 (flip-y canvas))
-
-  (if (zero? depth)
-    (do
-      (line canvas 0 0 len 0))
-    (do
-      (rotate canvas (- m/HALF_PI))
-      (draw-beast canvas (dec depth) (* len (/ (m/sqrt 4.0))) all)))
-  (pop-matrix canvas)
-
-
-  canvas)
-
-(let [v [true false false true true false false true]]
-  (prn v)
-  (with-canvas canvas
-    (set-background 21 20 25)
-    (set-color :lightgrey 250)
-    (set-stroke 0.8)
-    (translate 200 500)
-    (draw-beast 1 150 (map not v))))
+(draw-recipe (:p82 recipes) 6)


refactored

refactored

--- src/todo/repository.clj
+++ src/todo/repository.clj
@@ -16,19 +16,19 @@
 (defn- replace-todo [new-todo world]
   (conj (remove #(= (:uuid %) (:uuid new-todo)) world) new-todo))

-(defn- apply-event-to-world [event world]
-  (let [event-data (read-string (:EDN event))]
-    (condp = (:TYPE event)
-        "todo-created" (conj world event-data)
-        "todo-deleted" (remove #(= (:uuid %) event-data) world)
-        "todo-changed" (replace-todo event-data world))))
+(defn- apply-event-to-world [event-string world]
+  (let [event (read-string (:EDN event-string))]
+    (condp = (:TYPE event-string)
+        "todo-created" (conj world event)
+        "todo-deleted" (remove #(= (:uuid %) event) world)
+        "todo-changed" (replace-todo event world))))

 (defn- aggregate-todos [todo-events world]
   (if (empty? todo-events)
     world
-    (aggregate-todos (rest todo-events)
-                     (apply-event-to-world (first todo-events) world))))
+    (recur (rest todo-events)
+           (apply-event-to-world (first todo-events) world))))

 (defn todos []
   (aggregate-todos (find-todo-events) []))


All routes now flowing through Liberator Resources

--- src/toggler/handler.clj
+++ src/toggler/handler.clj
@@ -58,7 +58,7 @@
                       {::entry e})))
   :can-put-to-missing? false
   :put! (fn [_] (setoggle component setting newval))
-  :handle-ok true)
+  :handle-ok (encode newval))

 (defresource reconfigure [config]
   :allowed-methods [:put]
@@ -68,13 +68,23 @@
                       {::entry e})))
   :can-put-to-missing? false
   :put! (fn [_] (reload-config config))
+  :handle-ok (encode config))
+
+(defresource reset-config
+  :allowed-methods [:put]
+  :available-media-types ["application/json"]
+  :exists? (fn [_] (let [e @cfg]
+                    (if-not (nil? e)
+                      {::entry e})))
+  :can-put-to-missing? false
+  :put! (fn [_] (reset-cfg))
   :handle-ok true)

 (defroutes app-routes
   (GET "/" [] status)
   (PUT "/reconfigure" {body :body} (let [bodydecoded (decode (slurp body) true)]
-                                     (reload-config bodydecoded)))
-  (GET "/reset" [] (reset-cfg))
+                                     (reconfigure bodydecoded)))
+  (PUT "/reset" [] reset-config)
   (GET "/toggle" [] get-toggle-all)
   (GET "/toggle/:component" [component] (get-toggle-all-for-component component))
   (GET "/toggle/:component/:setting" [component setting] (get-toggle-for-component-and-setting component setting))


change toolsets with hover instead of click

--- frontend/components/landing_b.cljs
+++ frontend/components/landing_b.cljs
@@ -294,7 +294,7 @@
                   [:p
                    (for [toolset ["Languages" "databases" "queues" "browsers" "deployment"]]
                      (list
-                      [:a {:on-click #(put! controls-ch [:toolset-clicked {:toolset (keyword (str/lower-case toolset))}])} toolset] ", "))
+                      [:a {:on-mouse-enter #(put! controls-ch [:toolset-clicked {:toolset (keyword (str/lower-case toolset))}])} toolset] ", "))
                    "we support all of your tools.
                    If it runs on Linux, then it will work on CircleCI.
                    We'll even be around to help you install your own tools.


Do not hardcode people tab in routes

Do not hardcode people tab in routes

--- frontend/src/faceboard/router.cljs
+++ frontend/src/faceboard/router.cljs
@@ -52,13 +52,13 @@
 (defn define-normal-routes! []
   (defroute-with-info home-route "/" [] (perform! :switch-view :welcome))
   (defroute-with-info board-tab-route "/board/:id/:tab" [id tab] (switch-board-and-tab id tab))
-  (defroute-with-info board-route "/board/:id" [id] (navigate! (board-tab-route {:id id :tab "people"})))
+  (defroute-with-info board-route "/board/:id" [id] (switch-board-and-tab id nil))
   (defroute-with-info catch-route "*" [] (perform! :switch-view :error {:message "This page does not exist."})))

 (defn define-whitelabel-routes! [id]
   (log-info (str "Detected white-label site: implicit board-id is '" id "'"))
   (defroute-with-info whitelabel-board-tab-route "/:tab" [tab] (switch-board-and-tab id tab))
-  (defroute-with-info whitelabel-board-route "/" [] (navigate! (whitelabel-board-tab-route {:id id :tab "people"})))
+  (defroute-with-info whitelabel-board-route "/" [] (switch-board-and-tab id nil))
   (defroute-with-info whitelabel-catch-route "*" [] (perform! :switch-view :error {:message "This page does not exist."})))

 (defn define-routes! []


Doc edits to clarify forward vs prepare-forward protocols

--- cortex/src/cortex/nn/protocols.cljc
+++ cortex/src/cortex/nn/protocols.cljc
@@ -55,7 +55,8 @@
     future backward pass usage.

    During training prepare-forward must be called first to ensure that any necessary
-   pre-training calculations are performed.")
+   pre-training calculations are performed. forward itself should be deterministic,
+   but prepare-forward may modify stochastic state (e.g. dropout).")

   (backward [this input output-gradient]
     "Back propagate errors through the module with respect to the input.  Returns the


Minor cleanup of summaries

Minor cleanup of summaries

--- src/angelic/search/summaries.clj
+++ src/angelic/search/summaries.clj
@@ -132,25 +132,24 @@
   (summary-changed! [n] nil)
   (verified-summary [n min-summary] (default-verified-summary n min-summary)))

-;; TODO: fix this up ?
+
 (defn update-cache! [n cache-atom]
   (let [old @cache-atom new (summarize n)]
     (when-not (and old (summary/solved? old))
-     (when old
-       ;;      (util/assert-is (not (summary/solved? old)) "%s" [(def *bad* [old new])])
-             (when *assert-consistency* (util/assert-is (<= (summary/max-reward new) (summary/max-reward old)) "%s" [(def *bad* n)]))
-       ;;      (println (= old new) (summary/eq old new) (summary/>= old new) old new)
-       )
-     (reset! cache-atom new)
-     (not (= old new)))))
+      (when (and old *assert-consistency*)
+        (util/assert-is (<= (summary/max-reward new) (summary/max-reward old))
+                        "%s" [(def *bad* n)]))
+      (reset! cache-atom new)
+      (not (= old new)))))

 (traits/deftrait eager-cached-summarizer-node [] [summary-cache (atom nil)] []
   SummaryCache
   (summary [n] (or @summary-cache (reset! summary-cache (summarize n))))
-  (summary-changed! [n]
+  (summary-changed! [n]
     (when (update-cache! n summary-cache)
-      (notify-parents n)))
-  (verified-summary [n min-summary] (default-verified-summary n min-summary)))
+        (notify-parents n)))
+  (verified-summary [n min-summary]
+    (default-verified-summary n min-summary)))

 ;; Eager except about subsumption, which is just accidental
 (traits/deftrait less-eager-cached-summarizer-node [] [summary-cache (atom nil)] []
@@ -191,14 +190,20 @@
              (recur min-summary)))))))

-;; No notification, just pseudo-rbfs solution (which may refine suboptimal things)
-;; Can't quite replicate earlier, since we don't have control over AND expansion order...
-;; Can't use verified-summary since we need eval going up too.
-;; TODO: improve min-summary handling ?
-;; TODO: doesn't work right now, since deeper stuff doesn't get evaluated.
-;; Need to think harder about separation of concerns, how to cross-cut ?
-(defprotocol PseudoSolver
-  (pseudo-solve [n min-summary stop? evaluate!]))
+
+
+
+
+(comment
+
+ ;; No notification, just pseudo-rbfs solution (which may refine suboptimal things)
+ ;; Can't quite replicate earlier, since we don't have control over AND expansion order...
+ ;; Can't use verified-summary since we need eval going up too.
+ ;; TODO: improve min-summary handling ?
+ ;; TODO: doesn't work right now, since deeper stuff doesn't get evaluated.
+ ;; Need to think harder about separation of concerns, how to cross-cut ?
+ (defprotocol PseudoSolver
+   (pseudo-solve [n min-summary stop? evaluate!]))

 (traits/deftrait pseudo-cached-summarizer-node [] [summary-cache (atom nil)]  []
   SummaryCache
@@ -216,7 +221,7 @@
             (stop? n) (do (println "\nEVAL!") (evaluate! n) (recur min-summary stop? evaluate!))
             :else (let [child (util/safe-singleton (summary/children cs))]
                     (pseudo-solve (summary/source child) child stop? evaluate!)
-                    (recur min-summary stop? evaluate!))))))
+                    (recur min-summary stop? evaluate!)))))))


fix datalog :p

fix datalog :p

Signed-off-by: Chris Granger <5654cde260ae99bc4d30054171b8bcd902efd19a@gmail.com>

--- src/aurora/compiler/datalog.cljs
+++ src/aurora/compiler/datalog.cljs
@@ -136,6 +136,12 @@
 (defn op? [op clause]
   (and (seq? clause) (= op (first clause))))

+(defn assert? [clause]
+  (op? '+ clause))
+
+(defn retract? [clause]
+  (op? '- clause))
+
 (defn gen* [clauses]
   (reduce
    (fn [query clause]


adjusted

adjusted

--- src/cljs/chestnut_gae/core.cljs
+++ src/cljs/chestnut_gae/core.cljs
@@ -23,5 +23,3 @@
       (dom/h2 nil (:text data))))
    app-state
    {:target (. js/document (getElementById "app1"))}))
-
-(main)


Get Om stuff working

Get Om stuff working

--- src/cljs/comic_reader/main.cljs
+++ src/cljs/comic_reader/main.cljs
@@ -1,5 +1,7 @@
 (ns comic-reader.main
-  (:require [figwheel.client :as fw]))
+  (:require [figwheel.client :as fw]
+            [om.core :as om :include-macros true]
+            [om.dom :as dom :include-macros true]))

 (enable-console-print!)

@@ -23,3 +25,13 @@
            ;; it can be helpful to specify a build id for
            ;; the client to focus on
            :build-id "dev"})
+
+(defonce app-state (atom {:text "Om..."}))
+
+(om/root
+ (fn [data owner]
+   (reify om/IRender
+     (render [_]
+       (dom/h1 nil (:text data)))))
+ app-state
+ {:target (. js/document (getElementById "main-area"))})


Rename page-key for comic reading view

Rename page-key for comic reading view

--- src/cljs/comic_reader/main.cljs
+++ src/cljs/comic_reader/main.cljs
@@ -49,17 +49,17 @@
                 :comic-list :loading))))

   (re-frame/register-handler
-   :view-comic
+   :read-comic
    (fn [db [_ comic-id]]
      (-> db
-         (set-page-key :comic-viewer)))))
+         (set-page-key :reader)))))

 (defn main-panel
   [page-key]
   (case page-key
     :site-list [site-list/site-list-container]
     :comic-list [comic-list/comic-page-container]
-    :comic-viewer [:div [:h1 "Read a Comic!"]]
+    :reader [:div [:h1 "Read a Comic!"]]
     nil [:span ""]
     [base/four-oh-four]))


reload

reload

--- src/cljs/secret_shame/core.cljs
+++ src/cljs/secret_shame/core.cljs
@@ -65,7 +65,7 @@
       (if-not @editing?
         [:h4.list-group-item-heading "Reformed Thief"]
         [:input.list-group-item-heading.editing
-         {:onChange (fn [e] (.log js/console "occupation has changed"))
+         {:onChange (fn [e] (.log js/console "occupation changed"))
           :value "Thief"}])]

      [:div.list-group.item.widget.widget-card


Small tweak to delete-judgement

Small tweak to delete-judgement

--- src/cia/stores/sql/judgement.clj
+++ src/cia/stores/sql/judgement.clj
@@ -83,9 +83,11 @@
 (defn delete-judgement [id]
   (kdb/transaction
    (let [num-rows-deleted
-         (k/delete @judgement (k/where {:id id}))]
-     (k/delete @judgement-indicator
-               (k/where {:judgement_id id}))
+         (+
+          (k/delete @judgement
+                    (k/where {:id id}))
+          (k/delete @judgement-indicator
+                    (k/where {:judgement_id id})))]
      (> num-rows-deleted 0))))

 (defn calculate-verdict [{:keys [type value] :as _observable_}]


Make start game madlib more archaic

Make start game madlib more archaic

--- src/cljc/robinson/startgame.cljc
+++ src/cljc/robinson/startgame.cljc
@@ -34,9 +34,8 @@

 (defn start-text [state]
   (let [[n1 n2]            (get-in state [:world :random-numbers])
-        modes-of-transport ["boat" "airplane" "train" "blimp" "jetpack" "hovercraft" "bicycle"
-                           "sailboat" "steamboat" "barge" "oceanliner" "ferry" "helicopter"
-                           "biplane"]
+        modes-of-transport ["boat" "carriage" "horseback" "wagon" "stagewagon"
+                           "sailboat" "barge" "ship" "ferry" "foot"]
         mode-of-transport (nth modes-of-transport (mod n1 (count modes-of-transport)))
         natural-disasters ["hurricane" "tornado" "dark storm" "cyclone" "squall"]
         natural-disaster  (nth natural-disasters (mod n2 (count natural-disasters)))


Realias reagent as r

Realias reagent as r

--- src/cljs/caves_of_cljs/core.cljs
+++ src/cljs/caves_of_cljs/core.cljs
@@ -1,6 +1,6 @@
 (ns caves-of-cljs.core
   (:require-macros [cljs.core.async.macros :refer [go go-loop]])
-  (:require [reagent.core :as reagent :refer [atom]]
+  (:require [reagent.core :as r :refer [atom]]
             [clojure.set :as set]
             [cljs.core.async :as async :refer [put! chan <!]]
             [secretary.core :as secretary :include-macros true]
@@ -102,7 +102,7 @@
 ;; Views

 (defn canvas [state]
-  (reagent/create-class
+  (r/create-class
    {:component-did-mount (fn [this]
                            (let [console (js/ROT.Display.
                                           #js {:width 40
@@ -166,4 +166,4 @@
 ;; Initialize app
 (defn init! []
   (hook-browser-navigation!)
-  (reagent/render-component [current-page app-state] (.getElementById js/document "app")))
+  (r/render-component [current-page app-state] (.getElementById js/document "app")))


Add a slider component in debug namespace

--- src/cljs/hacker_agent/debug.cljs
+++ src/cljs/hacker_agent/debug.cljs
@@ -26,6 +26,12 @@
 ;; Proxy into console for live reload
 (defn view [state]
   [console state])
+
+(defn slider [value min max]
+  [:input {:type "range" :value @value :min min :max max
+           :style {:width "100%"}
+           :on-change #(let [new-val (-> % .-target .-value)]
+                         (reset! value new-val))}])

 (defn edit-value [value]
   (if (< 50 (count (str @value)))


Print a message if barcode can not be read

--- src/cljs/proto/goods_search.cljs
+++ src/cljs/proto/goods_search.cljs
@@ -71,9 +71,9 @@
 (defn barcode-writer
   "Writes the scanned barcode into an atom."
   [result]
-  (if (seq result)
-    (write-barcode! (.-Value (nth result 0)))
-    (write-barcode! "Error trying to read barcode!")))
+  (if (empty? result)
+    (write-barcode! "Error trying to read barcode!")
+    (write-barcode! (.-Value (nth result 0)))))

 (defn scan-barcode
   [dom-event]


Tweak suffix regex in completions

Tweak suffix regex in completions

A couple of more tweaks to the suffix regex were necessary.
The first will make so that we consider a : (keyword completion) as suffix and
therefore filter by colon the completion candidates.
The second allows suffixes to have numbers in it - according to Clojure's
specification only the first char of a symbol cannot be a number.

--- src/cljs/snapshot/lumo/repl.cljs
+++ src/cljs/snapshot/lumo/repl.cljs
@@ -1444,7 +1444,7 @@
     (let [top-level? (boolean (re-find #"^\s*\(\s*[^()\s]*$" line))
           skip-suffix-check? (or (= "(" line) (string/ends-with? line "/") (empty? line))
           ns-alias (second (re-find #"\(*(\b[a-zA-Z-.<>*=&?]+)/[a-zA-Z-]*$" line))
-          line-match-suffix (first (re-find #":?([a-zA-Z-.<>*=&?]*|^\(/)$" line))
+          line-match-suffix (first (re-find #"^:$|:?([a-zA-Z-.<>_*=&?]{1}[a-zA-Z0-9-.'<>_*=&?]*|^\(/)$" line))
           line-prefix (subs line 0 (- (count line) (count line-match-suffix)))
           completions (reduce (fn [ret item]
                                 (doto ret


removed warning

removed warning

--- src/bluebell/utils/ebmd/type.clj
+++ src/bluebell/utils/ebmd/type.clj
@@ -3,7 +3,8 @@
                                          pred any-arg]])
   (:refer-clojure :exclude [any number
                             sequential set keyword
-                            string coll map empty]))
+                            string coll map empty
+                            symbol]))

 ;;;------- Common arg types -------


fix bugs in test

fix bugs in test

- reports for tags and functions
- fixtures for tags and function
- some slight refactoring

--- bake/bake/test.clj
+++ bake/bake/test.clj
@@ -1,14 +1,8 @@
 (ns bake.test
-  (:use [cake.contrib.find-namespaces :only [find-namespaces-in-dir]])
-  (:require clojure.test
+  (:use [cake.contrib.find-namespaces :only [find-namespaces-in-dir]]
+        useful)
+  (:require [clojure.test :as test]
             [clojure.stacktrace :as stack]))
-
-(defn map-tags [nses]
-  (reduce (partial merge-with concat)
-          (for [ns nses
-                [name f] (ns-publics ns)
-                tag (:tags (meta f))]
-            {tag [f]})))

 (defn all-test-namespaces []
   (find-namespaces-in-dir (java.io.File. "test")))
@@ -23,18 +17,10 @@
         (keyword?  test) :tag
         :else            :ns))

-(defn group-opts [coll]
-  ;; don't use group-by so we are compatible with 1.1
-  (reduce
-   (fn [ret x]
-     (let [k (test-type x)]
-       (assoc ret k (conj (get ret k []) x))))
-   {}
-   coll))
-
 (defn get-grouped-tests [namespaces opts]
   (let [tests (:test opts)]
-    (group-opts
+    (group-by
+     test-type
      (if (nil? tests)
        namespaces
        (map prep-opt tests)))))
@@ -49,22 +35,26 @@
   (println (:fail m) "failures," (:error m) "errors.")
   (when (:start-time m) (timer (:start-time m))))

-(defmethod clojure.test/report :begin-test-ns [m]
-  (clojure.test/with-test-out
+(defmethod test/report :begin-test-ns [m]
+  (test/with-test-out
    (println "\nTesting" (ns-name (:ns m)))))

-(defmethod clojure.test/report :summary [m]
-  (clojure.test/with-test-out
+(defmethod test/report :summary [m]
+  (test/with-test-out
     (print-results m)))

+<<<<<<< HEAD
 (defmethod clojure.test/report :fn-summary [m]
   (clojure.test/with-test-out
     (print-results m)))

 (defmethod clojure.test/report :begin-auto [m])
+=======
+(defmethod test/report :begin-auto [m])
+>>>>>>> fix bugs in test

-(defmethod clojure.test/report :summary-auto [m]
-  (clojure.test/with-test-out
+(defmethod test/report :summary-auto [m]
+  (test/with-test-out
     (if (and (= 0 (:fail m))
              (= 0 (:error m))
              (not (:full-report? m)))
@@ -74,61 +64,69 @@
 (comment defn diff-actual [[f [_ expected actual]]]
   (diff/clean-difform expected actual))

-(defmethod clojure.test/report :fail [m]
-  (clojure.test/with-test-out
-    (clojure.test/inc-report-counter :fail)
-    (println "\nFAIL in" (clojure.test/testing-vars-str m))
-    (when (seq clojure.test/*testing-contexts*) (println (clojure.test/testing-contexts-str)))
+(defmethod test/report :fail [m]
+  (test/with-test-out
+    (test/inc-report-counter :fail)
+    (println "\nFAIL in" (test/testing-vars-str m))
+    (when (seq test/*testing-contexts*) (println (test/testing-contexts-str)))
     (when-let [message (:message m)] (println message))
     (let [expected (:expected m)
           actual   (:actual m)]
-      (println "expected:" (pr-str expected))
-      (println "  actual:" (pr-str actual))
       (comment when (seq? actual)
         (diff-actual actual)))))

 (declare start-time)

+(defn test-fn-seq [pairs]
+  (binding [test/*report-counters* (ref test/*initial-report-counters*)
+            start-time (System/nanoTime)]
+    (doseq [[ns fs] pairs]
+      (let [ns (find-ns (symbol ns))
+            once-fixture-fn (test/join-fixtures (::test/once-fixtures (meta ns)))
+            each-fixture-fn (test/join-fixtures (::test/each-fixtures (meta ns)))]
+        (once-fixture-fn
+         (fn [] (doseq [f fs]
+                  (each-fixture-fn (fn [] (test/test-var f))))))))
+    (test/report (assoc @test/*report-counters* :type :summary :start-time start-time))))
+
 (defn run-tests-for-fns [grouped-tests]
-  (when-let [input-fs (:fn grouped-tests)]
-    (println "testing functions:" (apply str (interpose ", " input-fs)))
-    (binding [clojure.test/*report-counters* (ref clojure.test/*initial-report-counters*)
-              start-time (System/nanoTime)]
-      (doseq [f input-fs]
-        (clojure.test/test-var (ns-resolve (symbol (namespace f))
-                                           (symbol (name f)))))
-      (clojure.test/report (assoc @clojure.test/*report-counters* :type :fn-summary :start-time start-time)))))
+  (when-let [input-fs (seq (for [[ns fs] (group-by namespace (:fn grouped-tests))
+                                 f fs]
+                             [ns (ns-resolve (symbol (namespace f))
+                                             (symbol (name f)))]))]
+    (test-fn-seq (reduce (fn [m [k v]] (update m k conj v)) {} input-fs))))

 (defn run-tests-for-nses [grouped-tests]
   (for [ns (:ns grouped-tests)]
-    (binding [clojure.test/*report-counters* (ref clojure.test/*initial-report-counters*)
+    (binding [test/*report-counters* (ref test/*initial-report-counters*)
               start-time (System/nanoTime)]
-      (clojure.test/report {:type :begin-test-ns :ns ns})
-      (clojure.test/test-all-vars (find-ns ns))
-      (clojure.test/report (assoc @clojure.test/*report-counters* :type :summary :start-time start-time))
-      @clojure.test/*report-counters*)))
+      (test/report {:type :begin-test-ns :ns ns})
+      (test/test-all-vars (find-ns ns))
+      (test/report (assoc @test/*report-counters* :type :summary :start-time start-time))
+      @test/*report-counters*)))
+
+(defn map-tags [nses tags]
+  (reduce (partial merge-with concat)
+          (for [ns nses
+                [name f] (ns-publics ns)
+                tag (:tags (meta f))]
+            (when (contains? (set tags) tag)
+              {ns [f]}))))

 (defn run-tests-for-tags [grouped-tests test-namespaces]
   (when-let [input-tags (:tag grouped-tests)]
-    (let [tags-to-fs (map-tags test-namespaces)]
-      (doall (for [tag input-tags]
-               (binding [clojure.test/*report-counters* (ref clojure.test/*initial-report-counters*)
-                         start-time (System/nanoTime)]
-                 (println "Testing" tag)
-                 (doseq [test (tag tags-to-fs)]
-                   (clojure.test/test-var test))
-                 (clojure.test/report (assoc @clojure.test/*report-counters* :type :summary :start-time start-time))
-                 @clojure.test/*report-counters*))))))
+    (let [input-fs (-> test-namespaces (map-tags input-tags) )]
+      (test-fn-seq input-fs))))

 (defn run-tests-for-auto [grouped-tests & full-report]
   (for [ns (:ns grouped-tests)]
-    (binding [clojure.test/*report-counters* (ref clojure.test/*initial-report-counters*)
+    (binding [test/*report-counters* (ref test/*initial-report-counters*)
               start-time (System/nanoTime)]
-      (clojure.test/report {:type :begin-auto :ns ns})
-      (clojure.test/test-all-vars ns)
-      (clojure.test/report
-       (let [report (assoc @clojure.test/*report-counters* :type :summary-auto :start-time start-time)]
+      (test/report {:type :begin-auto :ns ns})
+      (test/test-all-vars ns)
+      (test/report
+       (let [report (assoc @test/*report-counters* :type :summary-auto :start-time start-time)]
          (if (first full-report)
            (assoc report :full-report? true)
            report)))
-      @clojure.test/*report-counters*)))
+      @test/*report-counters*)))


Try locking for the 'text file busy' problem

--- src/cider_ci/ex/scripts/exec.clj
+++ src/cider_ci/ex/scripts/exec.clj
@@ -53,8 +53,8 @@
 (defn- create-script-file [params]
   (let [script (:body params)
         script-file (clj-fs/file (script-file-path params))]
-    (doto script-file clj-fs/create .deleteOnExit (spit script)
-      (.setExecutable true false))
+    (doto script-file
+      clj-fs/create (spit script) (.setExecutable true false))
     (.getAbsolutePath script-file)))

@@ -91,7 +91,6 @@
   (let [working-dir (working-dir params)
         wrapper-file (doto (clj-fs/file (wrapper-file-path params))
                        clj-fs/create
-                       .deleteOnExit
                        (spit (wrapper-body params))
                        (.setExecutable true false))]
     (logging/debug {:WRAPPER-FILE (.getAbsolutePath wrapper-file)})
@@ -177,16 +176,21 @@
   (try (merge-params script-atom
                      {:started_at (time/now)
                       :state "executing"
-                      :watchdog (create-watchdog)})
-       ; do it again because the env vars must be already in place when calling
-       ; create-script-file and create-wrapper-file
-       (merge-params script-atom
-                     {:script-file (create-script-file @script-atom)
-                      :wrapper-file (create-wrapper-file @script-atom)})
-       (let [exec-future (exec-sh script-atom)]
-         (merge-params script-atom {:exec-future exec-future})
-         (wait-for-or-terminate script-atom)
-         (merge-params script-atom (get-final-parameters @exec-future)))
+                      :watchdog (create-watchdog)
+                      :lock (str (:trial_id @script-atom) "_" (:key @script-atom))})
+       ; TODO we get occasional bug reports with 'text file busy" in theory the
+       ; lock approach makes no sense because writing is done when we start the
+       ; script ; some people claim it helps; so we give it a try (it might also
+       ; just help because some side effect, e.g. timing ...
+       (locking (:lock @script-atom)
+         (merge-params script-atom
+                       {:script-file (create-script-file @script-atom)
+                        :wrapper-file (create-wrapper-file @script-atom)}))
+       (locking (:lock @script-atom)
+         (let [exec-future (exec-sh script-atom)]
+           (merge-params script-atom {:exec-future exec-future})
+           (wait-for-or-terminate script-atom)
+           (merge-params script-atom (get-final-parameters @exec-future))))
        script-atom
        (catch Exception e
          (set-script-atom-for-execption script-atom e)


Fix submission form.

Fix submission form.

--- src/circleci/web/views/index.clj
+++ src/circleci/web/views/index.clj
@@ -1,50 +1,35 @@
 (ns circleci.web.views.index
-  (use noir.core
+  (:use noir.core
        hiccup.core
-       hiccup.page-helpers)
-  (use circleci.web.views.common)
-  (:require [circleci.model.beta-notify :as beta]))
+       hiccup.page-helpers
+       hiccup.form-helpers
+       circleci.web.views.common
+       ring.util.response)
+  (:use [circleci.db :only (with-conn)])
+  (:use [ring.util.response :only (redirect)])
+  (:require [circleci.model.beta-notify :as beta])
+  (:require [noir.cookies :as cookies]))
+

 (defpage [:post "/"] {:as request}
   (with-conn
                (beta/insert {:email (:email request)
                              :environment ""
                              :features ""})
-               (redirect "/beta-thanks")))
+               (cookies/put! :signed-up "1")
+               (redirect "/")))
+
+
+(declare signupform youre-done)

 (defpage "/" []
   (layout
    [:div#pitch_wrap
     [:div#pitch

-     [:div#cileft
-      [:h1#cititle "Continuous Integration" [:br] "made easy"]]
-
-
-     [:div#ciright
-      [:div#cirightinner
-      [:div#cirightinnerest
-
-      [:h2.takepart "Take part in the beta"]
-      [:p.whenready "We'll email you when we're ready."]
-      [:form {:action "/" :method "POST"}
-       [:fieldset#actualform
-        (unordered-list
-         [(list (text-field {:id "email"
-                             :type "text"
-                             :onfocus "if (this.value == 'Email address') { this.value=''};"
-                             :onblur "if (this.value == '') { this.value = 'Email address'};"}
-                             "email" "Email address"))
-          (list (check-box {:id "contact"
-                             :name "contact"
-                             :checked true} "contact")
-                [:div [:div
-                (label {:id "contact-label"} "contact" "May we contact you to ask about your platform, stack, test suite, etc?")]])])]
-       [:fieldset
-        [:input.call_to_action {:type "submit"
-                                :value "Get Notified"}]]]]]]
+     [:div#cileft [:h1#cititle "Continuous Integration" [:br] "made easy"]]
+     [:div#ciright (if (cookies/get :signed-up) (youre-done) (signupform))]
      [:div.clear]]]
-

    [:div#content_wrap
     [:div#content
@@ -73,3 +58,37 @@
               :height 55}]
        [:h3 "Parallel testing"]
        [:p "Reduce test time by running the tests in parallel on multiple boxes"]]]]]))
+
+(defpartial signupform [& content]
+  [:div#cirightinner
+  [:div#cirightinnerest
+
+  [:h2.takepart "Take part in the beta"]
+  [:p.whenready "We'll email you when we're ready."]
+  [:form {:action "/" :method "POST"}
+   [:fieldset#actualform
+    (unordered-list
+     [(list (text-field {:id "email"
+                         :type "text"
+                         :onfocus "if (this.value == 'Email address') { this.value=''};"
+                         :onblur "if (this.value == '') { this.value = 'Email address'};"}
+                         "email" "Email address"))
+      (list (check-box {:id "contact"
+                         :name "contact"
+                         :checked true} "contact")
+            [:div [:div
+            (label {:id "contact-label"} "contact" "May we contact you to ask about your platform, stack, test suite, etc?")]])])]
+   [:fieldset
+    [:input.call_to_action {:type "submit"
+                            :value "Get Notified"}]]]]]
+)
+
+(defpartial youre-done [& content]
+  [:div#cirightinner
+  [:div#cirightinnerest
+
+  [:h2 "Thanks, we'll be in touch soon!"]
+                            ]]
+)
+
+


Fix user not showing up on ns page

Fix user not showing up on ns page

--- src/clj/clojuredocs/site/nss.clj
+++ src/clj/clojuredocs/site/nss.clj
@@ -37,13 +37,14 @@
        [:td [:div.doc doc]]])))

 (defn index [ns-str]
-  (fn [r]
+  (fn [{:keys [user] :as r}]
     (let [lib (library-for ns-str)
           ns (namespace-for ns-str)
           vars (sort-by #(-> % :name str/lower-case) (vars-for ns-str))]
       (when ns
         (common/$main
           {:body-class "ns-page"
+           :user user
            :content [:div
                      [:div.row
                       [:div.col-sm-2


remove dummy routes

remove dummy routes

--- src/clj/dokkaa_builder/route.clj
+++ src/clj/dokkaa_builder/route.clj
@@ -9,35 +9,6 @@
             [cheshire.core :as j]
             [cemerick.friend :as friend]
             [dokkaa-builder.oauth.github :as github]))
-
-(declare render-status-page)
-(declare render-repos-page)
-(declare get-github-repos)
-
-(defn render-status-page [request]
-  (let [count (:count (:session request) 0)
-        session (assoc (:session request) :count (inc count))]
-    (-> (ring.util.response/response
-           (str "
We've hit the session page " (:count session)
-                " times.

The current session: " session "
"))
-         (assoc :session session))))
-
-(defn render-repos-page
-  "Shows a list of the current users github repositories by calling the github api
-   with the OAuth2 access token that the friend authentication has retrieved."
-  [request]
-  (prn request)
-  (let [access-token (get-in request [:session :cemerick.friend/identity :current :access-token])
-        repos-response (get-github-repos access-token)]
-    (str (vec (map :name repos-response)))))
-
-(defn get-github-repos
-  "Github API call for the current authenticated users repository list."
-  [access-token]
-  (let [url (str "https://api.github.com/user/repos?access_token=" access-token)
-        response (http/get url {:accept :json})
-        repos (j/parse-string (:body response) true)]
-    repos))

 (defn get-apps [req]
   {:status 200
@@ -94,18 +65,12 @@
   (PUT    "/:app" req (update-app req))
   (DELETE "/:app" req (delete-app req)))

-(defroutes users-routes
-  (GET "/" request "My Github Repositories
Status")
-  (GET "/status" request (render-status-page request))
-  (GET "/repos"  request (friend/authorize #{:user} (render-repos-page request)))
-  (friend/logout (ANY "/logout" request (ring.util.response/redirect "/"))))
-
 (defroutes routes
   (GET "/" req (index req))
   (GET "/_ping"  [] ping)
-  (context "/users" req users-routes)
   (context "/apps/" req apps-routes)
   (resources "/")
+  (friend/logout (ANY "/logout" request (ring.util.response/redirect "/")))
   (not-found "404 Not Found"))

 (def app (-> routes


everything marked token-note(-...) will be displayed in square brackets beside form in single pdgm display

--- src/clj/webapp/models/sparql.clj
+++ src/clj/webapp/models/sparql.clj
@@ -167,10 +167,11 @@
 	   OPTIONAL { ?s {{lpref}}:gender / rdfs:label ?gen . }
 	   OPTIONAL { ?s aamas:memberOf / rdfs:comment ?comment . }
 	   ?s {{lpref}}:token ?tkn .
-           BIND ((IF(BOUND(?pngSC),
-                     CONCAT(?tkn,\"[\",SUBSTR(?shapeClass,4,1),\"]\"),
-                     ?tkn))
-                 AS ?token) .
+           OPTIONAL { ?s ?t ?o . FILTER (CONTAINS(str(?t), \"token-note\"))}
+           BIND((IF(BOUND(?o),
+                    CONCAT(?tkn, \"  [\", ?o, \"]\"),
+                    ?tkn))
+                   AS ?token) .
 	  }
 	 }
 	}


adding route & clean functions for messages

--- src/cljc/ow/starbuck/client.cljc
+++ src/cljc/ow/starbuck/client.cljc
@@ -19,6 +19,16 @@
          :ow.starbuck.routing/component '()
          :ow.starbuck.routing/transition-count 0
          :ow.starbuck.routing/max-transitions max-transitions))
+
+(defn route [msg]
+  (:ow.starbuck.routing/route msg))
+
+(defn clean-message [msg]
+  (dissoc msg
+          :ow.starbuck.routing/route
+          :ow.starbuck.routing/component
+          :ow.starbuck.routing/transition-count
+          :ow.starbuck.routing/max-transitions))


Fix sticky not positioning correctly on page load

--- src/cljs/clojuredocs/sticky.cljs
+++ src/cljs/clojuredocs/sticky.cljs
@@ -57,4 +57,5 @@
                   :top (str px-offset "px")))
               (dom/remove-class! $el :sticky)))]
     (dom/listen! js/window :scroll f)
-    (dom/listen! js/window :resize f)))
+    (dom/listen! js/window :resize f)
+    (f nil)))


Bring back timer stopping code

Bring back timer stopping code

--- src/clojure/nightmod/manager.clj
+++ src/clojure/nightmod/manager.clj
@@ -12,6 +12,22 @@
                    (FileHandle. (io/file @u/project-dir file-name))))))
 (set-asset-manager! manager)

+; keep a reference to all timers to we can stop them later
+(def timers (atom []))
+(let [create-and-add-timer! (deref #'play-clj.core/create-and-add-timer!)]
+  (intern 'play-clj.core
+          'create-and-add-timer!
+          (fn [screen id]
+            (let [t (create-and-add-timer! screen id)]
+              (swap! timers conj t)
+              t))))
+
+(defn stop-timers!
+  []
+  (doseq [t @timers]
+    (.stop t))
+  (reset! timers []))
+
 (defn clear-ns!
   [nspace]
   (doall (map #(ns-unmap nspace %) (keys (ns-interns nspace)))))
@@ -19,4 +35,5 @@
 (defn clean!
   []
   (clear-ns! u/game-ns)
+  (stop-timers!)
   (on-gl (asset-manager! manager :clear)))


Add some grpc functions

Add some grpc functions

--- src/clojure_fabric/grpc_core.clj
+++ src/clojure_fabric/grpc_core.clj
@@ -1,7 +1,3 @@
-(ns clojure-fabric.grpc-core)
-
-
-
 ;; Note that under the cover there are two different kinds of communications with the fabric backend
 ;; that trigger different events to be emitted back to the application’s handlers:
 ;; - the grpc client with the orderer service uses a “regular” stateless HTTP connection in
@@ -12,3 +8,103 @@
 ;;      event source Peer as part of the internal event hub mechanism in order to support
 ;;      the fabric events “BLOCK”, “CHAINCODE” and “TRANSACTION”. These events should cause
 ;;      the method to emit “complete” or “error” events to the application
+(ns clojure-fabric.grpc-core
+  (:import [org.hyperledger.fabric.protos.peer Chaincode$ChaincodeID
+            Chaincode$ChaincodeSpec Chaincode$ChaincodeInput Chaincode$ChaincodeSpec$Type
+            Chaincode$ChaincodeInvocationSpec
+            ProposalPackage$ChaincodeHeaderExtension]
+           [org.hyperledger.fabric.protos.common Common$ChannelHeader Common$HeaderType]
+           [com.google.protobuf ByteString Timestamp]))
+
+(defn make-chaincode-id
+  ([name]
+   (make-chaincode-id name {}))
+  ([name {:keys [version path] :or {version "" path ""}}]
+   (-> (Chaincode$ChaincodeID/newBuilder)
+       (.setName name)
+       (.setVersion version)
+       (.setPath path)
+       (.build))))
+
+(defn make-chaincode-input
+  ([args]
+   (-> (Chaincode$ChaincodeInput/newBuilder)
+       (.addAllArgs args)
+       (.build)))
+  ;; FIXME: can't find deatails on decorations
+  #_
+  ([args decorations]
+   (-> (Chaincode$ChaincodeInput/newBuilder)
+       (.addAllArgs args))))
+
+(defn make-chaincode-spec
+  ([chaincode-id input]
+   (-> (Chaincode$ChaincodeSpec/newBuilder)
+       (.setType Chaincode$ChaincodeSpec$Type/GOLANG)
+       (.setChaincodeId ^Chaincode$ChaincodeID chaincode-id)
+       (.setInput ^Chaincode$ChaincodeInput input)
+       (.build)))
+  ;; FIXME: use of timeout
+  #_
+  ([type chaincode-id input timeout]
+   (-> (Chaincode$ChaincodeSpec/newBuilder)
+       (.setType)
+       (.setChaincodeId)
+       (.setInput)
+       (.setTimeout)
+       (.build))))
+
+(defn make-chaincode-invocation-spec
+  ([^Chaincode$ChaincodeSpec chaincode-spec]
+   (-> (Chaincode$ChaincodeInvocationSpec/newBuilder)
+       (.setChaincodeSpec chaincode-spec)))
+  ;; FIXME: setIdGenerationAlg
+  #_
+  ([^Chaincode$ChaincodeSpec chaincode-spec id-generation-alg]
+   (-> (Chaincode$ChaincodeInvocationSpec/newBuilder)
+       (.setChaincodeSpec chaincode-spec)
+       (.setIdGenerationAlg id-generation-alg))))
+
+(defn make-chaincode-header-extention
+  ([chaincode-id]
+   (make-chaincode-header-extention chaincode-id ByteString/EMPTY))
+  ([^Chaincode$ChaincodeID chaincode-id payload-visibility]
+   (-> (ProposalPackage$ChaincodeHeaderExtension/newBuilder)
+       (.setChaincodeId chaincode-id)
+       ;; FIXME: payload-visibility is ByteString
+       ;; Use above arity 1 function - currently all other SDKs do this
+       (.setPayloadVisibility payload-visibility)
+       (.build))))
+
+(defn make-current-grpc-timestamp
+  []
+  (let [now (System/currentTimeMillis)]
+    (-> (Timestamp/newBuilder)
+        (.setSeconds (quot now 1000))
+        (.setNanos (-> now (rem 1000) (* 10000000)))
+        (.build))))
+
+(defn make-channel-header
+  ([type version channel-id tx-id epoch]
+   (make-channel-header type version channel-id tx-id epoch ByteString/EMPTY))
+  ([type version channel-id tx-id epoch extension]
+   (let [now (System/currentTimeMillis)]
+    (-> (Common$ChannelHeader/newBuilder)
+        (.setType type)
+        (.setVersion version)
+        (.setTimestamp ^Timestamp (make-current-grpc-timestamp))
+        (.setChannelId ^Chaincode$ChaincodeID channel-id)
+        (.setTxId tx-id)
+        (.setEpoch epoch)
+        (.setExtension extension)
+        (.build)))))
+
+(defn make-chaincode-header
+  [^Chaincode$ChaincodeID chaincode-id channel-id tx-id epoch]
+  (make-channel-header Common$HeaderType/ENDORSER_TRANSACTION ; type
+                       1                ; version
+                       channel-id
+                       tx-id
+                       epoch
+                       (make-chaincode-header-extention chaincode-id)))
+


default value for :pool-op (#236)

default value for :pool-op (#236)

--- src/cortex/compute/nn/layers.clj
+++ src/cortex/compute/nn/layers.clj
@@ -408,7 +408,7 @@
                                                    pad-x pad-y
                                                    stride-x stride-y
                                                    :dimension-op (get layer :dimension-op)
-                                                   :pool-op (get layer :pool-op))]
+                                                   :pool-op (or (get layer :pool-op) :max))]
        (->PoolingLayer backend layer batch-size pool-desc)))))


removed model computation at crawl time. do it at the end

--- src/crawler/discussion_forum.clj
+++ src/crawler/discussion_forum.clj
@@ -47,26 +47,27 @@

 (defn stop?
   [x num-leaves]
-  (let [estimated-model (estimate-model x)
+  (let [;estimated-model (estimate-model x)

-        estimated-yield (reduce
-                         (fn [acc l]
-                           (do (pprint l)
-                               (corpus/estimate-yield
-                                l
-                                (:pagination estimated-model)
-                                (:corpus x))
-                               (+ acc
-                                  (:yield
-                                   (corpus/estimate-yield
-                                    l
-                                    (:pagination estimated-model)
-                                    (:corpus x))))))
-                         0
-                         (:actions estimated-model))]
+        ;; estimated-yield (reduce
+        ;;                  (fn [acc l]
+        ;;                    (do (pprint l)
+        ;;                        (corpus/estimate-yield
+        ;;                         l
+        ;;                         (:pagination estimated-model)
+        ;;                         (:corpus x))
+        ;;                        (+ acc
+        ;;                           (:yield
+        ;;                            (corpus/estimate-yield
+        ;;                             l
+        ;;                             (:pagination estimated-model)
+        ;;                             (:corpus x))))))
+        ;;                  0
+        ;;                  (:actions estimated-model))
+        ]
                                         ;(pprint estimated-model)
     (do (utils/sayln :pages-observed-so-far (:observed x))
-        (utils/sayln :estimated-yield-thus-far estimated-yield)
+        ;(utils/sayln :estimated-yield-thus-far estimated-yield)
         (>= (:observed x) num-leaves))))

 (defn leaf?


Added splitted-match helper

Added splitted-match helper

--- src/de/kotka/vimclojure/util.clj
+++ src/de/kotka/vimclojure/util.clj
@@ -40,6 +40,21 @@
   collection's items with the given separator."
   [coll sep]
   (apply str (interpose sep coll)))
+
+(defn splitted-match
+  "Splits pattern and candidate at the given delimiters and matches
+  the parts of the pattern with the parts of the candidate. Match
+  means „startsWith“ here."
+  [pattern candidate delimiters]
+  (if-let [delimiters (seq delimiters)]
+    (let [delim           (first delimiters)
+          pattern-split   (.split pattern delim)
+          candidate-split (.split candidate delim)]
+      (and (<= (count pattern-split) (count candidate-split))
+           (reduce #(and %1 %2) (map #(splitted-match %1 %2 (rest delimiters))
+                                     pattern-split
+                                     candidate-split))))
+    (.startsWith candidate pattern)))

 ; Command-line handling
 (defn print-usage
@@ -228,4 +243,3 @@
   (let [eof (Object.)
         rdr (fn [] (read stream false eof))]
     (take-while #(not= % eof) (repeatedly rdr))))
-


Remove commented code on ui.users ns.

Remove commented code on ui.users ns.


Update job REST API call does not fail with NPE for missing input

--- src/emender_jenkins/rest_api.clj
+++ src/emender_jenkins/rest_api.clj
@@ -205,22 +205,26 @@

 (defn update-job
     [request]
-    (let [input-data (-> (read-request-body request)
-                         body->job-info)
-          job-name   (get input-data :name)
-          git-repo   (get input-data :url_to_repo)
-          branch     (get input-data :branch)]
-        (if (results/job-exists? job-name)
-            (if (and job-name git-repo branch)
-                (-> (jenkins-api/update-job (config/get-jenkins-url request)
-                                            (config/get-jenkins-auth request)
-                                            job-name git-repo branch)
-                    ;(reload-job-list request)
-                    (send-response request))
-                (-> (error-response (or job-name "not set!") "update" "invalid input")
-                    (send-error-response request)))
-            (-> (job-does-not-exist-response job-name "update")
-                (send-error-response request)))))
+    (try
+        (let [input-data (-> (read-request-body request)
+                             body->job-info)
+              job-name   (get input-data :name)
+              git-repo   (get input-data :url_to_repo)
+              branch     (get input-data :branch)]
+            (if (results/job-exists? job-name)
+                (if (and job-name git-repo branch)
+                    (-> (jenkins-api/update-job (config/get-jenkins-url request)
+                                                (config/get-jenkins-auth request)
+                                                job-name git-repo branch)
+                        ;(reload-job-list request)
+                        (send-response request))
+                    (-> (error-response (or job-name "not set!") "update" "invalid input")
+                        (send-error-response request)))
+                (-> (job-does-not-exist-response job-name "update")
+                    (send-error-response request))))
+        (catch Exception e
+                (-> (error-response "not set!" "update" "invalid input")
+                    (send-error-response request)))))

 (defn get-jobs
     [request]


Speed query times up by 50% using a memoized db->tree

--- src/web/reconciler.cljs
+++ src/web/reconciler.cljs
@@ -23,10 +23,12 @@

 ;;;; CUSTARD data

+(def db->tree-cached (memoize om/db->tree))
+
 (defmethod read :states
   [{:keys [state query]} key _]
   (let [st @state]
-    {:value (om/db->tree query (get st key) st)
+    {:value (db->tree-cached query (get st key) st)
      :remote true}))

 (defmethod read :state
@@ -37,31 +39,32 @@
 (defmethod read :project
   [{:keys [state query]} key params]
   (let [st @state]
-    {:value (om/db->tree query (get st key) st)
+    {:value (db->tree-cached query (get st key) st)
      :remote true}))

 (defmethod read :requirements
   [{:keys [state query]} key params]
+  (println "read :requirements")
   (let [st @state]
-    {:value (om/db->tree query (get st key) st)
+    {:value (db->tree-cached query (get st key) st)
      :remote true}))

 (defmethod read :components
   [{:keys [state query]} key params]
   (let [st @state]
-    {:value (om/db->tree query (get st key) st)
+    {:value (db->tree-cached query (get st key) st)
      :remote true}))

 (defmethod read :tags
   [{:keys [state query]} key params]
   (let [st @state]
-    {:value (om/db->tree query (get st key) st)
+    {:value (db->tree-cached query (get st key) st)
      :remote true}))

 (defmethod read :work-items
   [{:keys [state query]} key params]
   (let [st @state]
-    {:value (om/db->tree query (get st key) st)
+    {:value (db->tree-cached query (get st key) st)
      :remote true}))

 ;;;; UI state


bump lein-cljsbuild to 1.1.0

bump lein-cljsbuild to 1.1.0

--- cljs/project.clj
+++ cljs/project.clj
@@ -20,7 +20,7 @@
    [cljsjs/react "0.13.3-1"]]

   :plugins
-  [[lein-cljsbuild "1.0.6"]
+  [[lein-cljsbuild "1.1.0"]
    [lein-figwheel "0.3.3"]]

   :source-paths


Rename preparse-request to request-route-spec

--- src/io/aviso/rook/dispatcher.clj
+++ src/io/aviso/rook/dispatcher.clj
@@ -32,7 +32,7 @@
   (pp/write form :dispatch pp/code-dispatch)
   (prn))

-(defn preparse-request
+(defn request-route-spec
   "Takes a Ring request map and returns [method pathvec], where method
   is a request method keyword and pathvec is a vector of path
   segments.
@@ -268,7 +268,7 @@
                           apply-middleware req handler-sym handler-map)])
                handlers)]
        (fn rook-pattern-matching-dispatcher# [~req]
-         (match (preparse-request ~req)
+         (match (request-route-spec ~req)
            ~@(mapcat (fn [[route-spec handler-sym]]
                        (let [{:keys [route-params schema]}
                              (get handlers handler-sym)]
@@ -336,7 +336,7 @@
          (ns-unmap *ns* '~tmp)
          (fn rook-map-traversal-dispatcher# [~req]
            [dispatch-map# endpoint-fns#]
-           (loop [pathvec#      (second (preparse-request ~req))
+           (loop [pathvec#      (second (request-route-spec ~req))
                   dispatch#     dispatch-map#
                   route-params# {}]
              (if-let [seg# (first pathvec#)]
@@ -394,7 +394,7 @@
                                                   `apply-middleware-sync)]
        (emit-fn
          `(fn rook-dispatcher# [~req]
-            (match (preparse-request ~req)
+            (match (request-route-spec ~req)
               ~@(mapcat
                   (fn [[method pathvec verb-fn-sym middleware]]
                     (let [method           (if (identical? method :all)