add -e/--edit option

add -e/--edit option

--- src/nml/core.clj
+++ src/nml/core.clj
@@ -42,18 +42,21 @@
    "namelist" fmt-namelist})

 (def msgs
-  {:bad-format    "Bad output format."
-   :create+in     "-i/--in not valid with -c/--create."
-   :get+format    "-f/--format not valid with -g/--get."
-   :get+set       "-g/--get and -s/--set may not be mixed."
-   :multi-format  "-f/--format may be specified only once."
-   :multi-in      "-i/--in may be specified only once."
-   :multi-out     "-o/--out may be specified only once."
-   :set+no-prefix "-n/--no-prefix not valid with -s/--set."})
+  {:bad-format    "Bad output format"
+   :edit+in       "-i/--in not valid with -e/--edit"
+   :edit+out      "-o/--out not valid with -e/--edit"
+   :get+edit      "-e/--edit not valid with -g/--get"
+   :get+format    "-f/--format not valid with -g/--get"
+   :get+set       "-g/--get and -s/--set may not be mixed"
+   :multi-edit    "-e/--edit may be specified only once"
+   :multi-format  "-f/--format may be specified only once"
+   :multi-in      "-i/--in may be specified only once"
+   :multi-out     "-o/--out may be specified only once"
+   :set+no-prefix "-n/--no-prefix not valid with -s/--set"})

 (def parse (insta/parser (clojure.java.io/resource "grammar")))

-(def version "0.2")
+(def version "0.3")

 ;; utility defns

@@ -66,7 +69,7 @@
 (defn- read-file [in]
   (try (slurp in)
        (catch Exception e
-         (fail (str "Could not read from '" in "'.")))))
+         (fail (str "Could not read from '" in "'")))))

 (defn- strmap [f coll]
   (apply str (map f coll)))
@@ -93,7 +96,7 @@
     (println (string/trim s))
     (try (spit out s)
          (catch Exception e
-           (fail (str "Could not write to '" out "'."))))))
+           (fail (str "Could not write to '" out "'"))))))

 (defn- nml-parse [s start src]
   (let [result (parse s :start start)]
@@ -109,7 +112,7 @@
     (if (empty? s)
       m
       (let [[nml key val] (first s)]
-        (if (nil? val) (fail (str "No value supplied for key '" key "'.")))
+        (if (nil? val) (fail (str "No value supplied for key '" key "'")))
         (recur (nml-set m nml key val) (rest s))))))

 (defn- nml-str [x]
@@ -193,6 +196,10 @@

 ;; cli

+(defn- assoc-e [m k v]
+  (if (k m) (fail (msgs :multi-edit)))
+  (assoc m k v))
+
 (defn- assoc-f [m k v]
   (if (k m) (fail (msgs :multi-format)))
   (assoc m k v))
@@ -227,6 +234,7 @@

 (def cliopts
   [["-c" "--create"     "Create new namelist"                                                              ]
+   ["-e" "--edit file"  "Edit file (instead of '-i file -o file')"     :assoc-fn assoc-e                   ]
    ["-f" "--format fmt" "Output in format 'fmt' (default: namelist)"   :assoc-fn assoc-f :parse-fn parse-f ]
    ["-g" "--get n:k"    "Get value of key 'k' in namelist 'n'"         :assoc-fn assoc-g :parse-fn parse-g ]
    ["-h" "--help"       "Show usage information"                                                           ]
@@ -239,20 +247,34 @@
 ;; main

 (defn -main [& args]
+
   (alter-var-root #'*read-eval* (constantly false))
+
+  ;; bindings
+
   (let [{:keys [options arguments summary]} (cli/parse-opts args cliopts)
         gets (:get options)
         sets (:set options)
-        in   (or (:in  options) *in* )
-        out  (or (:out options) *out*)
-        src  (or (:in options) "stdin")]
-    (if (not-empty arguments) (fail (str "Unexpected argument '" (first arguments) "'.")))
+        edit (:edit options)
+        in   (or edit (:in options) *in*)
+        out  (or edit (:out options) *out*)
+        src  (or edit (:in options) "stdin")]
+
+    ;; error checking
+
+    (if (not-empty arguments) (fail (str "Unexpected argument '" (first arguments) "'")))
     (if (:help options) (usage summary))
     (if (:version options) (do (println version) (System/exit 0)))
     (if (and gets sets) (fail (msgs :get+set)))
+    (if (and gets edit) (fail (msgs :get+edit)))
+    (if (and edit (:in options)) (fail (msgs :edit+in)))
+    (if (and edit (:out options)) (fail (msgs :edit+out)))
     (if (and gets (:format options)) (fail (msgs :get+format)))
     (if (and sets (:no-prefix options)) (fail (msgs :set+no-prefix)))
     (if (and (:create options) (:in options)) (fail (msgs :create+in)))
+
+    ;; read -> parse -> [modify] -> output
+
     (let [fmt (let [f (:format options)] (if f (formats f) fmt-namelist))
           m   (nml-map (if (:create options) "" (read-file in)) src)]
       (cond gets  (nml-out out (nml-gets m gets (:no-prefix options)))


removed RandomAccessFile which failed in non-privileged mode

--- src/main/clojure/gpio/core.clj
+++ src/main/clojure/gpio/core.clj
@@ -2,9 +2,7 @@
   (:require [clojure.core.async :as a
              :refer [go <! >! >!! chan sliding-buffer tap]]
             [clojure.core.async.impl.protocols :as p])
-  (:import [java.io RandomAccessFile FileOutputStream PrintStream]
-           [java.nio.channels FileChannel FileChannel$MapMode]
-           [io.bicycle.epoll EventPolling EventPoller PollEvent]))
+  (:import [io.bicycle.epoll EventPolling EventPoller PollEvent]))

 (defn export! [port]
   (spit "/sys/class/gpio/export" (str port)))
@@ -29,7 +27,7 @@

 (defn high-low-value [value]
   {:pre [(not (nil? (#{:high :low 1 0 'high 'low true false "1" "0" \1 \0} value)))]}
-  (byte (condp = value
+  (char (condp = value
           :high \1
           1     \1
           'high \1
@@ -44,7 +42,7 @@

 (defn- do-format
   [raw-value high low]
-  (if (= \1 raw-value) high low))
+  (if (= \1 (first raw-value)) high low))

 (defmulti format-raw-digital
   "Formats the raw values received from digital reads of pin state,
@@ -59,7 +57,7 @@

 (defmethod format-raw-digital :boolean
   [_ raw-value]
-  (= \1 raw-value))
+  (= \1 (first raw-value)))

 (defmethod format-raw-digital :symbol
   [_ raw-value]
@@ -71,11 +69,11 @@

 (defmethod format-raw-digital :char
   [_ raw-value]
-  raw-value)
+  (first raw-value))

 (defmethod format-raw-digital :default
   [_ raw-value]
-  raw-value)
+  (first raw-value))

 (defprotocol Closeable
   (close! [self] "Closes this object"))
@@ -94,34 +92,28 @@
 (defn- value-file [port]
   (str "/sys/class/gpio/gpio" port "/value"))

-(defn random-access [filename]
-  (RandomAccessFile. filename "rw"))
-
-(defrecord BasicGpioPort [port filename file formatter]
+(defrecord BasicGpioPort [port filename formatter]
   GpioPort

-  (set-direction! [_ direction]
-    (do-set-direction! port direction))
-
-  (set-active-low! [_ active-low?]
-    (do-set-active-low! port active-low?))
+  (set-direction! [this direction]
+    (do-set-direction! port direction)
+    this)
+
+  (set-active-low! [this active-low?]
+    (do-set-active-low! port active-low?)
+    this)

   (read-value
     [_]
-    (.seek file 0)
-    (formatter (char (.read file))))
+    (formatter (slurp filename)))

   (write-value!
-    [_ value]
-    (.seek file 0)
-    (.writeByte file (high-low-value value)))
-
-  clojure.lang.IDeref
-  (deref [this] (read-value this))
+    [this value]
+    (spit filename (high-low-value value))
+    this)

   Closeable
   (close! [_]
-    (.close file)
     (unexport! port)))

 (defn open-port
@@ -144,13 +136,14 @@
         formatter (or from-raw-fn
                       (partial format-raw-digital digital-result-format))
         filename (value-file port)
-        raf (random-access filename)
-        gpio-port (BasicGpioPort. port filename raf formatter)]
+        gpio-port (BasicGpioPort. port filename formatter)]
+    ; Need to wait for the direction file to be available
+    (Thread/sleep 100)
     (try
-      (when direction (set-direction! gpio-port direction))
-      (when active-low? (set-active-low! gpio-port active-low?))
-      (when initial-value (write-value! gpio-port initial-value))
-      gpio-port
+      (cond-> gpio-port
+        direction (set-direction! direction)
+        active-low? (set-active-low! active-low?)
+        initial-value (write-value! initial-value))
       (catch Exception e
         (close! gpio-port)
         (throw e)))))
@@ -176,21 +169,27 @@

   GpioPort

-  (set-direction! [_ direction] (set-direction! gpio-port direction))
-  (set-active-low! [_ active-low?] (set-active-low! gpio-port active-low?))
+  (set-direction! [this direction]
+    (set-direction! gpio-port direction)
+    this)
+
+  (set-active-low! [this active-low?]
+    (set-active-low! gpio-port active-low?)
+    this)
+
   (read-value [_] (read-value gpio-port))

-  (write-value! [this value] (>!! write-ch value))
+  (write-value! [this value]
+    (>!! write-ch value)
+    this)

   GpioChannelProvider

-  (set-edge! [_ setting]
-    (do-set-edge! port setting))
+  (set-edge! [this setting]
+    (do-set-edge! port setting)
+    this)

   (create-edge-channel [_] (tap-and-wrap-chan mult-ch (chan-factory-fn)))
-
-  clojure.lang.IDeref
-  (deref [this] (read-value this))

   Closeable
   (close! [_]


Fix the Sine test too.

Fix the Sine test too.

--- test/onyx/coordinator/sine_cluster_sim.clj
+++ test/onyx/coordinator/sine_cluster_sim.clj
@@ -87,14 +87,15 @@
 (def id (str (java.util.UUID/randomUUID)))

 (def system (onyx-coordinator
-             {:hornetq-cluster-name "onyx-cluster"
-              :hornetq-group-address "231.7.7.7"
-              :hornetq-group-port 9876
-              :hornetq-refresh-timeout 5000
-              :hornetq-discovery-timeout 5000
-              :zk-addr "127.0.0.1:2181"
-              :onyx-id id
-              :revoke-delay 2000}))
+             {:hornetq/mode :multicast
+              :hornetq.multicast/cluster-name "onyx-cluster"
+              :hornetq.multicast/group-address "231.7.7.7"
+              :hornetq.multicast/group-port 9876
+              :hornetq.multicast/refresh-timeout 5000
+              :hornetq.multicast/discovery-timeout 5000
+              :zookeeper/address "127.0.0.1:2181"
+              :onyx/id id
+              :onyx.coordinator/revoke-delay 2000}))

 (def components (component/start system))


Fix test ns references.

Fix test ns references.

--- test/vault/blob_test.clj
+++ test/vault/blob_test.clj
@@ -1,7 +1,7 @@
 (ns vault.blob-test
   (:require [clojure.test :refer :all]
             [vault.blob :refer :all]
-            [vault.print :refer [edn-tag edn-value]]))
+            [vault.data :as data]))

 (def blob-content
@@ -38,8 +38,8 @@

 (deftest edn-representation
-  (is (= 'vault/ref (edn-tag blob-ref)))
-  (is (= blob-address (edn-value blob-ref))))
+  (is (= 'vault/ref (data/tag blob-ref)))
+  (is (= blob-address (data/value blob-ref))))

 (deftest address-parsing


[#2091] Set up a new monitoring register with tenant label

--- backend/src/akvo/lumen/monitoring.clj
+++ backend/src/akvo/lumen/monitoring.clj
@@ -20,7 +20,8 @@
 (defmethod ig/init-key ::collector [_ {:keys [dropwizard-registry]}]
   (-> (prometheus/collector-registry)
       (jvm/initialize)
-      (prometheus/register (DropwizardExports. dropwizard-registry))
+      (prometheus/register (DropwizardExports. dropwizard-registry)
+                           (prometheus/histogram :app/flow-check-permissions {:labels [:tenant]}))
       (ring/initialize {:labels [:tenant]})))

 (s/def ::dropwizard-registry ::metric-registry)


move flush-manifest to shadow-devtools/browser

--- src/main/shadow/cljs/build.clj
+++ src/main/shadow/cljs/build.clj
@@ -1483,21 +1483,6 @@
            (assoc :default-module module-name)
            )))))

-(defn flush-to-disk
-  "flush all generated sources to disk, not terribly useful, use flush-unoptimized to include source maps"
-  [{:keys [work-dir sources] :as state}]
-  (with-logged-time
-    [state {:type :flush-to-disk}]
-    (doseq [{:keys [type name compiled] :as src} (vals sources)
-            :when (and (= :cljs type)
-                       compiled)]
-
-      (let [{:keys [js-name output]} src
-            target (io/file work-dir js-name)]
-        (io/make-parents target)
-        (spit target output)))
-    state))
-
 (defn closure-defines-json [{:keys [closure-defines] :as state}]
   (let [closure-defines
         (reduce-kv
@@ -2249,27 +2234,6 @@

      state)))

-
-;; FIXME: manifest should be custom step
-(defn flush-manifest [public-dir modules include-foreign?]
-  (spit
-    (io/file public-dir "manifest.json")
-    (let [data
-          (->> modules
-               (map (fn [{:keys [name js-name entries depends-on default sources foreign-files] :as mod}]
-                      (-> {:name name
-                           :js-name js-name
-                           :entries entries
-                           :depends-on depends-on
-                           :default default
-                           :sources sources}
-                          (cond->
-                            (and include-foreign? (seq foreign-files))
-                            (assoc :foreign (mapv #(select-keys % [:js-name :provides]) foreign-files))))
-                      )))]
-      (with-out-str
-        (json/pprint data :escape-slash false)))))
-
 (defn flush-foreign-bundles
   [{:keys [public-dir build-modules] :as state}]
   (doseq [{:keys [foreign-files] :as mod} build-modules
@@ -2319,8 +2283,6 @@
           (let [target (io/file public-dir cljs-runtime-path source-map-name)]
             (io/make-parents target)
             (spit target source-map-json)))))
-
-    (flush-manifest public-dir modules true)

     ;; with-logged-time expects that we return the compiler-state
     state))
@@ -2716,8 +2678,6 @@

   (with-logged-time
     [state {:type :flush-unoptimized}]
-
-    (flush-manifest public-dir build-modules false)

     (doseq [mod build-modules]
       (flush-unoptimized-module! state mod))
@@ -2798,8 +2758,6 @@
     [state {:type :flush-unoptimized
             :compact true}]

-    (flush-manifest public-dir build-modules false)
-
     ;; flush fake modules
     (doseq [{:keys [default js-name name prepend append sources web-worker] :as mod} build-modules]
       (let [target (io/file public-dir js-name)


small copy change on email

small copy change on email

--- src/pc/email.clj
+++ src/pc/email.clj
@@ -254,6 +254,8 @@
        (when (seq cust-name)
          [:p (format "Hi %s," cust-name)])
        [:p
+        "You've been granted early access to Precursor's paid features."]
+       [:p
         "You can now create private documents and control who has access to them. "
         "Let the rest of your team create private docs by having them click the request "
         "access button and filling out the same form you did."]


Remove println ;)

Remove println ;)

--- src/buddy/core/crypto.clj
+++ src/buddy/core/crypto.clj
@@ -206,7 +206,6 @@
          (bytes/bytes? key)]}
   (let [^bytes iv (or iv nonce)
         ^bytes input (codecs/->byte-array input)]
-    (println 2222 alg mode)
     (cond
       (algorithm-supported? :block alg)
       (let [cipher (block-cipher alg mode)


Undo change to compiler.clj. Save these changes for later.

--- src/clj/cljs/compiler.clj
+++ src/clj/cljs/compiler.clj
@@ -64,7 +64,7 @@
 ")

 (defn confirm-var-exists [env prefix suffix]
-  (when *cljs-warn-on-undeclared*
+  (when true ;;*cljs-warn-on-undeclared*
     (let [crnt-ns (-> env :ns :name)]
       (when (= prefix crnt-ns)
         (when-not (-> @namespaces crnt-ns :defs suffix)


remove check in the compiler that prevented anonymous multiarity fns from being optimized. transducers are now on par with reducers

--- src/clj/cljs/compiler.clj
+++ src/clj/cljs/compiler.clj
@@ -571,8 +571,7 @@
         (if variadic
           (emit-variadic-fn-method (assoc (first methods) :name name))
           (emit-fn-method (assoc (first methods) :name name)))
-        (let [has-name? (and name true)
-              name (or name (gensym))
+        (let [name (or name (gensym))
               mname (munge name)
               maxparams (apply max-key count (map :params methods))
               mmap (into {}
@@ -616,12 +615,11 @@
           (when variadic
             (emitln mname ".cljs$lang$maxFixedArity = " max-fixed-arity ";")
             (emitln mname ".cljs$lang$applyTo = " (some #(let [[n m] %] (when (:variadic m) n)) ms) ".cljs$lang$applyTo;"))
-          (when has-name?
-            (doseq [[n meth] ms]
-              (let [c (count (:params meth))]
-                (if (:variadic meth)
-                  (emitln mname ".cljs$core$IFn$_invoke$arity$variadic = " n ".cljs$core$IFn$_invoke$arity$variadic;")
-                  (emitln mname ".cljs$core$IFn$_invoke$arity$" c " = " n ";")))))
+          (doseq [[n meth] ms]
+            (let [c (count (:params meth))]
+              (if (:variadic meth)
+                (emitln mname ".cljs$core$IFn$_invoke$arity$variadic = " n ".cljs$core$IFn$_invoke$arity$variadic;")
+                (emitln mname ".cljs$core$IFn$_invoke$arity$" c " = " n ";"))))
           (emitln "return " mname ";")
           (emitln "})()")))
       (when loop-locals


Refactoring of tests for bulk operations.

--- test/pjstadig/test/es.clj
+++ test/pjstadig/test/es.clj
@@ -132,6 +132,9 @@
                                      (q/term :subject subject)
                                      :fields ["_id" "subject" "body"]))))))

+(defn bulk-ok? [response]
+  (every? (comp ok? second first) (get response ["items"])))
+
 (deftest test-bulk
   (let [mappings {"0" {"properties" {"subject" {"type" "string"
                                                 "index" "not_analyzed"}
@@ -139,43 +142,27 @@
                                              "index" "not_analyzed"}}}}
         id0 (uuid-url-str)
         id1 (uuid-url-str)
-        id2 (uuid-url-str)
         subject "subject"
         body "body"]
     (index-create es index-name0 :mappings mappings)
-    (is (= id0
-           (get (doc-create es index-name0
-                            {:_type "0" :_id id0 :subject subject :body body})
-                "_id")))
+    (is (bulk-ok? (doc-bulk es (bulk-create-ops [{:_index index-name0
+                                                  :_type "0"
+                                                  :_id id0
+                                                  :subject subject
+                                                  :body body}]))))
     (index-refresh es [index-name0])
-    (is (= [{"_id" id0 "subject" subject "body" body}]
-           (search-hits (search es index-name0
-                                (q/term :subject subject)
-                                :fields ["_id" "subject" "body"]))))
-    (is (every? (comp ok? second first)
-                (get (doc-bulk es (bulk-create-ops [{:_index index-name0
-                                                     :_type "0"
-                                                     :_id id1
-                                                     :subject subject
-                                                     :body body}]))
-                     "items")))
+    (is (= #{{"_id" id0 "subject" subject "body" body}}
+           (set (search-hits (search es index-name0
+                                     (q/term :subject subject)
+                                     :fields ["_id" "subject" "body"])))))
+    (is (bulk-ok? (doc-bulk-for-index es index-name0
+                                      (bulk-create-ops [{:_type "0"
+                                                         :_id id1
+                                                         :subject subject
+                                                         :body body}]))))
     (index-refresh es [index-name0])
     (is (= #{{"_id" id0 "subject" subject "body" body}
              {"_id" id1 "subject" subject "body" body}}
-           (set (search-hits (search es index-name0
-                                     (q/term :subject subject)
-                                     :fields ["_id" "subject" "body"])))))
-    (is (every? (comp ok? second first)
-                (get (doc-bulk-for-index es index-name0
-                                         (bulk-create-ops [{:_type "0"
-                                                            :_id id2
-                                                            :subject subject
-                                                            :body body}]))
-                     "items")))
-    (index-refresh es [index-name0])
-    (is (= #{{"_id" id0 "subject" subject "body" body}
-             {"_id" id1 "subject" subject "body" body}
-             {"_id" id2 "subject" subject "body" body}}
            (set (search-hits (search es index-name0
                                      (q/term :subject subject)
                                      :fields ["_id" "subject" "body"])))))))


Multiline textfield

Multiline textfield

--- flatguiwidgets/src/flatgui/widgets/textfield.clj
+++ flatguiwidgets/src/flatgui/widgets/textfield.clj
@@ -14,6 +14,7 @@
             [flatgui.widgets.component]
             [flatgui.widgets.scrollpanel]
             [flatgui.inputchannels.keyboard :as keyboard]
+            [flatgui.inputchannels.mouse :as mouse]
             [flatgui.inputchannels.clipboard :as clipboard]
             [flatgui.inputchannels.awtbase :as inputbase]
             [flatgui.util.matrix :as m]
@@ -126,9 +127,61 @@
           [line (max 0 (- pos total-len-prev-lines linebreaks-to-skip))])))
     [0 pos]))

+;; TODO avoid duplication with skin
+(defn- text-str-h [] (* (flatgui.awt/strh) 2.5))
+
+(defn- split-to-lines [text]
+  (let [raw-lines (clojure.string/split-lines text)]
+    (if (.endsWith text "\n")
+      (fgc/conjv raw-lines "")
+      raw-lines)))
+
 (fg/defevolverfn text-model-evolver :model
-  (if (clipboard/clipboard-event? component)
-    {:text (clipboard/get-plain-text component) :caret-pos 0 :selection-mark 0}
+  (cond
+    (clipboard/clipboard-event? component)
+    (let [text (clipboard/get-plain-text component)]
+      (merge old-model {:text text
+                        :lines (if (get-property [:this] :multiline) (split-to-lines text) [text])
+                        :caret-pos 0
+                        :selection-mark 0
+                        :caret-line 0
+                        :caret-line-pos 0
+                        :selection-mark-line 0
+                        :selection-mark-line-pos 0}))
+
+    (mouse/is-mouse-event? component)
+    (if (and
+          (pos? (count (:lines old-model)))
+          (mouse/mouse-left? component))
+      (let [click-line (if (get-property [:this] :multiline)
+                         (min (int (/ (mouse/get-mouse-rel-y component) (text-str-h))) (dec (count (:lines old-model))))
+                         0)
+            click-line-text (nth (:lines old-model) click-line)
+            click-x (mouse/get-mouse-rel-x component)
+            click-line-pos (if (pos? (.length click-line-text))
+                             (max
+                               0
+                               (loop [i 0]
+                                 (if (or (= i (.length click-line-text)) (>= (awt/strw (subs click-line-text 0 i)) click-x))
+                                   (if (> click-x (awt/strw click-line-text)) i (dec i))
+                                   (recur
+                                     (inc i)))))
+                             0)
+            click-pos (if (> click-line 0)
+                        (+
+                          (apply + (map #(.length %) (take (dec click-line) (:lines old-model)))) ; All previous lines
+                          (dec click-line) ; A linebreak symbol after each previous line
+                          click-line-pos)
+                        click-line-pos)]
+        (merge old-model {:caret-pos click-pos
+                          :selection-mark click-pos
+                          :caret-line click-line
+                          :caret-line-pos click-line-pos
+                          :selection-mark-line click-line
+                          :selection-mark-line-pos click-line-pos}))
+      old-model)
+
+    :else
     (let [text-supplier (:text-supplier component)
           supplied-text (text-supplier component)
           prevcaretpos (:caret-pos old-model)
@@ -139,10 +192,7 @@
           old-lines (:lines old-model)
           caretpos (evovle-caret-pos component prevcaretpos old-caret-line-pos old-caret-line old-selection-mark old-text old-lines supplied-text)
           text (evolve-text component prevcaretpos caretpos old-selection-mark old-text supplied-text)
-          lines (let [raw-lines (clojure.string/split-lines text)]
-                  (if (.endsWith text "\n")
-                    (fgc/conjv raw-lines "")
-                    raw-lines))
+          lines (split-to-lines text)
           selection-mark (evovle-selection-mark component caretpos old-selection-mark)
           caret-coord (pos->coord component lines caretpos)
           selection-mark-coord (pos->coord component lines selection-mark)
@@ -175,19 +225,16 @@
               caret-x (get-caret-x (subs text old-first-visible-symbol) caret-pos)
               width (- (m/x (get-property component [:this] :clip-size)) (* 1 (get-hgap)) (awt/px))]
           (if (> caret-x width)
-            (let [ diff (- caret-x width)]
+            (let [diff (- caret-x width)]
               (+
                 old-first-visible-symbol
-                (loop [ i 1]
+                (loop [i 1]
                   (if (>= (awt/strw (subs text old-first-visible-symbol (+ old-first-visible-symbol i))) diff)
                     i
                     (recur
                       (inc i))))))
             old-first-visible-symbol))))
     0))
-
-;; TODO avoid duplication with skin
-(defn- text-str-h [] (* (flatgui.awt/strh) 2.5))

 (fg/defevolverfn auto-scroll-evolver :viewport-matrix
   (let [text-field-id (first (first (:children component)))


added some timing output;

added some timing output;

--- src/mustached_hipster/core.clj
+++ src/mustached_hipster/core.clj
@@ -9,10 +9,15 @@
    ;; work around dangerous default behaviour in Clojure
    (alter-var-root #'*read-eval* (constantly false))

-   (spit "foo.txt"
-      (apply str
-         (map
-            #(str (first (split (trim %) #"\?")) "\n")
-            (filter
-               #(not= \# (first %))
-               (split-lines (:body (http/get url))))))))
+   (let
+      [then (System/nanoTime)]
+
+      (spit "foo.txt"
+         (apply str
+            (map
+               #(str (first (split (trim %) #"\?")) "\n")
+               (filter
+                  #(not= \# (first %))
+                  (split-lines (:body (http/get url)))))))
+
+      (println "the whole thing took" (/ (- (System/nanoTime) then) 1e-9) "seconds")))


Add known content type validation.

Add known content type validation.

--- src/oc/storage/api/entries.clj
+++ src/oc/storage/api/entries.clj
@@ -396,6 +396,11 @@
   :handle-not-acceptable (by-method {
                             :post (api-common/only-accept 406 mt/entry-media-type)})

+  ;; Media type client sends
+  :known-content-type? (by-method {
+                          :options true
+                          :post (fn [ctx] (api-common/known-content-type? ctx mt/revert-request-media-type))})
+
   ;; Possibly no data to handle
   :malformed? (by-method {
     :options false
@@ -437,8 +442,8 @@
   :handle-ok (fn [ctx] (entry-rep/render-entry (:existing-org ctx)
                                                (:existing-board ctx)
                                                (:updated-entry ctx)
-                                               [] ; no comments
-                                               [] ; no reactions
+                                               [] ; no comments since it's always a draft
+                                               [] ; no reactions since it's always a draft
                                                (:access-level ctx)
                                                (-> ctx :user :user-id))))


add/remove uploads from active/inactive uploads lists

--- src/frontend/uploads.cljs
+++ src/frontend/uploads.cljs
@@ -69,9 +69,29 @@
                                 (.pipe blob-stream stream)
                               (= action :stopped)
                                 (do
+                                  (swap! app-state/app-state
+                                         assoc
+                                         :active-uploads
+                                         (remove #{upload-id}
+                                                 (:active-uploads @app-state/app-state)))
+                                  (swap! app-state/app-state
+                                         assoc
+                                         :inactive-uploads
+                                         (prepend-upload (:inactive-uploads @app-state/app-state)
+                                                         upload-id))
                                   (.unpipe blob-stream))
                               (= action :started)
                                 (do
+                                  (swap! app-state/app-state
+                                         assoc
+                                         :inactive-uploads
+                                         (remove #{upload-id}
+                                                 (:inactive-uploads @app-state/app-state)))
+                                  (swap! app-state/app-state
+                                         assoc
+                                         :active-uploads
+                                         (append-upload (:active-uploads @app-state/app-state)
+                                                        upload-id))
                                   (.pipe blob-stream stream)))))]
     (.on blob-stream "end"
       (fn []


resources -> info show only provided (>0)

--- src/cljs/swarmpit/component/service/info/resources.cljs
+++ src/cljs/swarmpit/component/service/info/resources.cljs
@@ -6,12 +6,12 @@
   [resource]
   (let [cpu (:cpu resource)
         memory (:memory resource)]
-    (or (some? cpu)
-        (some? memory))))
+    (or (> cpu 0)
+        (> memory 0))))

 (rum/defc form-resource < rum/static [resource label]
   [:div
-   (comp/form-section label)
+   (comp/form-subsection label)
    (comp/form-item "CPU" (:cpu resource))
    (comp/form-item "MEMORY" (str (:memory resource) " MB"))])

@@ -20,11 +20,14 @@
     (and (provided? reservation)
          (provided? limit))
     [:div.form-service-view-group.form-service-group-border
+     (comp/form-section "Resource")
      (form-resource reservation "Reservation")
      (form-resource limit "Limit")]
     (provided? reservation)
     [:div.form-service-view-group.form-service-group-border
+     (comp/form-section "Resource")
      (form-resource reservation "Reservation")]
     (provided? limit)
     [:div.form-service-view-group.form-service-group-border
+     (comp/form-section "Resource")
      (form-resource limit "Limit")]))


[core] Refactor 'main.

[core] Refactor 'main.

Use parsed CLI, init new 'state model, listen for gossip, watch input file for
updates, start gossipping to peers, and start regularly printing out local
'state.

--- src/birdie_tell/core.clj
+++ src/birdie_tell/core.clj
@@ -277,22 +277,32 @@
         (swap! state merge-my-data data))
       (Thread/sleep reread-delay-ms)))

-(defn main
-  "'max-hotness: how many times do I tell another peer about this peer?
-  'live-percentage: what percentage of the time do I bias toward talking to peers I think are :alive, instead of :dead?"
-  [max-hotness live-percentage listen-port my-host-port & initial-peers]
-  (swap! #'peers assoc
-         :states
-         (reduce (fn [r x] (assoc r (split-hostport x) :alive))
-                 {}
-                 initial-peers))
-  (println :main-peers @#'peers)
-  (let [[my-ip-addr my-port] (split-hostport my-host-port)
-        listen-port (Integer/parseInt listen-port)
-        max-hotness (Integer/parseInt max-hotness)
-        live-percentage (Integer/parseInt live-percentage)]
-    (listen max-hotness listen-port)
-    (mingle live-percentage max-hotness 1000 5000 my-ip-addr my-port)))
+(defn main [& args]
+  (let [{:keys [peer host-port name live-percentage input-file debug uuid]} (util/parse-opts args)]
+    (if debug (reset! util/debug? true))
+    (let [uuid (or uuid (util/uuid))
+          [_ my-port] (split-hostport host-port)
+          peer (if peer #{peer} #{})]
+
+      ;; Init.
+      (swap! state assoc
+             :uuid uuid ; my self-reference into [:peers :identified]
+             :peers {:potential peer ; TODO: allow more than one potential peer
+                     :identified {uuid {:version 0
+                                        :name name
+                                        :uuid uuid
+                                        :host-port host-port}}})
+      (listen #(swap! state merge-peer-state %) my-port)
+
+      (.start (Thread. #(do-self-updating! input-file state 1000)))
+
+      ;; TODO: fix state refs to be to the var, & resolve the var
+      (.start (Thread. #(start-gossipping! live-percentage 1000 10000 state)))
+
+      ;; Output my state each second to watch for changes.
+      (while true
+        (pprint @state) (prn)
+        (Thread/sleep 1000)))))

 (comment


cassaforte upgrade to 2.0.0 release

cassaforte upgrade to 2.0.0 release

--- src/blackbox/project.clj
+++ src/blackbox/project.clj
@@ -11,7 +11,7 @@
                  [clj-aws-s3 "0.3.10"]
                  [org.clojure/clojure "1.6.0"]
                  [org.clojure/tools.cli "0.2.4"]
-                 [clojurewerkz/cassaforte "2.0.0-rc1"]
+                 [clojurewerkz/cassaforte "2.0.0"]
                  [org.clojure/tools.logging "0.2.6"]
                  [org.apache.cassandra/cassandra-all "2.1.2"]]
 )


remove extra require

remove extra require

--- src/cake/tasks/clean.clj
+++ src/cake/tasks/clean.clj
@@ -1,6 +1,5 @@
 (ns cake.tasks.clean
   (:use cake cake.ant)
-  (:require [clojure.java.io :as io])
   (:import (org.apache.tools.ant.taskdefs Delete Mkdir)))

 (deftask clean


Move declarations to top of file

Move declarations to top of file

--- src/ansel/db.clj
+++ src/ansel/db.clj
@@ -27,6 +27,15 @@
     (dosync
       (reset! config data)
       (info "data loaded from disk"))))
+
+(defn get-uploads-path []
+  (or (:upload-path @config) "uploads/"))
+
+(defn get-thumbs-path []
+  (or (:thumb-path @config) "thumbs/"))
+
+(defn get-template-path []
+  (:template-path @config))

 (defn assert-fs []
   (info "creating dirs")
@@ -150,15 +159,6 @@
 (defn get-album-by-slug [slug]
   (sql-get-album-by-slug (get-db-spec) slug))

-(defn get-uploads-path []
-  (or (:upload-path @config) "uploads/"))
-
-(defn get-thumbs-path []
-  (or (:thumb-path @config) "thumbs/"))
-
-(defn get-template-path []
-  (:template-path @config))
-
 (defn like-image [image user]
   (with-db-transaction [connection (get-db-spec)]
     (when-not (like-exists? connection (:id image) (:id user))


c.t.n.find: ns docstring

c.t.n.find: ns docstring

--- src/main/clojure/clojure/tools/namespace/find.clj
+++ src/main/clojure/clojure/tools/namespace/find.clj
@@ -8,7 +8,7 @@

 (ns
   ^{:author "Stuart Sierra",
-     :doc "Search for ns declarations in dirs, JARs, or CLASSPATH"}
+     :doc "Search for namespace declarations in directories and JAR files."}
   clojure.tools.namespace.find
   (:require [clojure.java.io :as io]
             [clojure.set :as set]


Enable nrepl

Enable nrepl

--- src/cider_ci/sm/main.clj
+++ src/cider_ci/sm/main.clj
@@ -8,6 +8,7 @@
     [cider-ci.sm.web :as web]
     [cider-ci.utils.config-loader :as config-loader]
     [cider-ci.utils.messaging :as messaging]
+    [cider-ci.utils.nrepl :as nrepl]
     [cider-ci.utils.rdbms :as rdbms]
     [cider-ci.utils.with :as with]
     [clojure.tools.logging :as logging]
@@ -37,6 +38,7 @@
 (defn -main [& args]
   (logging/debug [-main args])
   (read-config)
+  (nrepl/initialize (:nrepl @conf))
   (create-dirs (:stores @conf))
   (let [ds (rdbms/create-ds (get-db-spec))]
     (web/initialize (conj (select-keys @conf [:web :stores])


Woops... last commit was broken. Fixed now.

--- src/polismath/conversation.clj
+++ src/polismath/conversation.clj
@@ -128,8 +128,10 @@

 (defn max-k-fn
   [data max-max-k]
-  (min max-max-k
-    (int (/ (count (rownames data)) 8))))
+  (min
+    max-max-k
+    (+ 2
+       (int (/ (count (rownames data)) 8)))))

 (def small-conv-update-graph


force medium conversation code-path (to simplify client dev for now)

--- src/polismath/conversation.clj
+++ src/polismath/conversation.clj
@@ -145,9 +145,9 @@
         n-ptpts (count (distinct (into ptpts (map :pid votes))))]
     ; dispatch to the appropriate function
     ((cond
-       (< n-ptpts 100)   small-conv-update
+;       (< n-ptpts 100)   small-conv-update
        (< n-ptpts 1000)  med-conv-update
-       (< n-ptpts 1500)  med-conv-update2
+ ;      (< n-ptpts 1500)  med-conv-update2
        :else             large-conv-update)
           {:conv conv :votes votes :opts opts})))


Fixes #25 - Provide instructions in Alert emails

--- src/clj/medusa/alert.clj
+++ src/clj/medusa/alert.clj
@@ -39,12 +39,42 @@
       (let [[earliest-build latest-build] (changesets/bounding-buildids date "mozilla-central") ; get the buildids for the given date
             changeset-url (changesets/pushlog-url earliest-build latest-build "mozilla-central")]
         (log/info "Changeset URL" changeset-url)
-        (send-email (str "Alert for " metric_name " (" detector_name ") on " date)
-                    (str "Alert details: " alert-url
+        (send-email (str "Telemetry Alert for " metric_name " on " date)
+                    (str "We have detected a change in the Telemetry probe " metric_name " in Firefox Nightly builds from " date "."
                          "\n\n"
-                         "Evolution dashboard: " evo-url
+                         "Alert details: " alert-url
+                         "\n"
+                         "Changes new to Nightly builds on " date ": " changeset-url
+                         "\n"
+                         "The value of " metric_name " over time: " evo-url
                          "\n\n"
-                         "Changeset for " (build-range earliest-build latest-build) ": " changeset-url)
+                         "What to do about this:"
+                         "\n\n"
+                         "1. File a bug to track your investigation. You can just copy this email into the bug Description to get you started."
+                         "\n"
+                         "2. Reply-All to this email to let the list know that you are investigating. Include the bug number so we can help out."
+                         "\n"
+                         "3. Triage the alert. You can find instructions here: " alert-url
+                         "\n\n"
+                         "If you have any problems, please ask for help on the #telemetry IRC channel or on Slack in #fx-metrics. We'll give you a hand."
+                         "\n\n"
+                         "What this is:"
+                         "We have a system called cerberus[1] that compares Telemetry collected on different Nightly builds and "
+                         "looks for sudden changed in value distributions using the Bhattacharyya Distance[2]. It found such a "
+                         "change in " metric_name " on " date " so it asked its buddy medusa[3] to send this email to the "
+                         "dev-telemetry-alerts mailing list and to all email addresses listed in the alert_emails field of "
+                         metric_name "'s definition."
+                         "\n\n"
+                         "You can do this!"
+                         "\n\n"
+                         "Your Friendly, Neighbourhood Firefox Telemetry Team"
+                         "\n"
+                         "[1]: https://github.com/mozilla/cerberus"
+                         "\n"
+                         "[2]: https://en.wikipedia.org/wiki/Bhattacharyya_distance"
+                         "\n"
+                         "[3]: https://github.com/mozilla/medusa"
+                         "\n")
                     (concat subscribers foreign_subscribers ["dev-telemetry-alerts@lists.mozilla.org"])))
       (catch Throwable e ; could not find revisions for the given build date
         (log/info e "Retrieving changeset failed")


Box is at times used as an array for some reason, hack to mitigate that.

--- src/cljs/go/compiler.clj
+++ src/cljs/go/compiler.clj
@@ -1028,15 +1028,18 @@
 (defmethod emit* :js
   [{:keys [env code js-op segs args numeric tag]}]
   (let [aset-return? (and (= 'cljs.core/aset js-op) (= :return (:context env)))
-        args (case js-op
-               cljs.core/make-array [(go-unbox 'number (first args))]
-               cljs.core/alength [(go-unbox 'array (first args))]
-               cljs.core/aget (cons (go-unbox 'array (first args))
-                                    (map (partial go-unbox 'number) (rest args)))
-               cljs.core/aset (concat [(go-unbox 'array (first args))]
-                                      (map (partial go-unbox 'number) (butlast (rest args)))
-                                      [(last args)])
-               args)]
+        box? (= 'removed-leaf? (-> args first :info :name)) ;; horrific hack to cancel out another.
+        args (if box?
+               args
+               (case js-op
+                 cljs.core/make-array [(go-unbox 'number (first args))]
+                 cljs.core/alength [(go-unbox 'array (first args))]
+                 cljs.core/aget (cons (go-unbox 'array (first args))
+                                      (map (partial go-unbox 'number) (rest args)))
+                 cljs.core/aset (concat [(go-unbox 'array (first args))]
+                                        (map (partial go-unbox 'number) (butlast (rest args)))
+                                        [(last args)])
+                 args))]
     (binding [*go-return-tag* (when (go-needs-coercion? tag *go-return-tag*)
                                 *go-return-tag*)]
       (emit-wrap env
@@ -1044,6 +1047,9 @@
           (emits "func() " (go-type (:tag (last args))) "{ "))
         (cond
          code (emits code)
+         box? (emits (go-unbox 'cljs.core/Box (first args))
+                     ".Val" (when (= 'cljs.core/aset js-op)
+                              (str " = " (emit-str (second args)))))
          :else (emits (interleave (concat segs (repeat nil))
                                   (map (if numeric (partial go-unbox 'number) identity)
                                        (concat args [nil])))))


spacing in comments

spacing in comments

--- src/babel/ug.clj
+++ src/babel/ug.clj
@@ -228,8 +228,8 @@
   (sentence-impl input))

 ;; Phrase [:root [1]]
-;;    /      \
-;; [1] H      C
+;;       /        \
+;;  [1] H          C
 (def root-is-head
   "'root' is used to generate and search for expressions that have a given lexeme as their root. e.g. the 'root' of 'io ho parlato' is 'parlare'"
   (let [root (ref :top)]
@@ -237,16 +237,16 @@
      :head root}))

 ;; Phrase [:root [1]]
-;;    /             \
-;;  H [:root [1]]      C
+;;        /       \
+;;  H [:root [1]]  C
 (def root-is-head-root
   (let [root (ref :top)]
     {:root root
      :head {:root root}}))

 ;; Phrase [:root [1]]
-;;    /      \
-;;   H       [1] C
+;;        /       \
+;;       H     [1] C
 (def root-is-comp
   (let [root (ref :top)]
     {:root root


cleanup in prep for new release

cleanup in prep for new release

--- src/push/util/test_helpers.clj
+++ src/push/util/test_helpers.clj
@@ -1,10 +1,10 @@
 (ns push.util.test-helpers
+  (:use midje.sweet)
   (:require [push.util.stack-manipulation :as u]
             [push.interpreter.core :as i]
             [push.interpreter.templates.minimum :as m]
             [push.core :as push]
             )
-  (:use midje.sweet)
   )

@@ -17,7 +17,7 @@
   the next step after, and returns the indicated `get-stack`"
   [setup-stack items instruction read-stack]
   (let [setup (i/register-instruction
-                (u/set-stack (m/basic-interpreter) setup-stack items)
+                (u/set-stack (push/interpreter) setup-stack items)
                 instruction)
         after (i/execute-instruction setup (:token instruction))]
     (u/get-stack after read-stack)


destructuring maps in let

destructuring maps in let

--- src/saved_for_reddit/core.cljs
+++ src/saved_for_reddit/core.cljs
@@ -63,10 +63,13 @@
                                      :form-params {:grant_type "authorization_code"
                                                    :redirect_uri redirect-uri
                                                    :code code}}))
-            status (:status response)
-            body   (:body response)
-            error  (:error body)
-            access-token (:access_token body)]
+            {:keys [status body]} response
+            ;;status (:status response)
+            ;;body   (:body response)
+            {:keys [error access-token]} body
+            ;;error  (:error body)
+            ;;access-token (:access_token body)
+            ]
         #_(println response) ;; will it block here till body is available?
         (if (clojure.string/blank? error)
           (do


refactored schemas to have a conditonal owner or current-state


Use env for db spec

Use env for db spec

--- src/shouter/models/queries.clj
+++ src/shouter/models/queries.clj
@@ -1,7 +1,7 @@
 (ns shouter.models.queries
-  (:require [yesql.core :refer [defqueries]]))
+  (:require [yesql.core :refer [defqueries]]
+            [environ.core :refer [env]]))

-(def spec (or (System/getenv "DATABASE_URL")
-              "postgresql://localhost/shouter"))
+(def spec (:database-url env))

 (defqueries "queries.sql")


Add functions to format tasks into a table.

--- src/todo_repl_webapp/views.clj
+++ src/todo_repl_webapp/views.clj
@@ -16,13 +16,36 @@
                           [:post "/eval"]
                           (form/text-area {:class "form-control"}
                                           "evalInput"
-                                          "blah")
+                                          "(tasks)")
                           [:br]
                           (form/submit-button {:id "todoSubmitButton"}
                                               "Eval"))]
           [:div#display.col-md-7.col-md-offset-2]
           (page/include-js "js/eval.js")]))

-(defn eval [x & xs]
-  (core/html [:h1 "Eval"]
-        [:h2 x]))
+(defn task-item
+  "Given a task (map), return a div representing the task"
+  [task-map]
+  (core/html
+    [:div
+      [:div.col-md-7.col-md-offset-1
+        (:name task-map)]]))
+(defn task-line-item
+  "When given a single task (map), return a html table line representing the task"
+  [task-map]
+  (core/html [:tr
+               [:td (task-item task-map)]]))
+
+(defn task-table
+  "When given a vector of tasks (maps), return an html table representing those tasks"
+  [task-vec]
+  (core/html
+    [:table.table.table-bordered
+      (clojure.string/join
+        (map task-line-item task-vec))]))
+
+(defn display [x & xs]
+  (if-not (empty? x)
+    (core/html [:h2 "list"]
+          [:h3 x]
+            (task-table (vec x)))))


Extending test-case for approx-canonical-base

I am still uncomfortable with the idea of this test to fail randomly,
since I did not conduct a proper failure analysis.

Signed-off-by: Daniel Borchmann <3d0f3b9ddcacec30c4008c5e030e6c13a478cb4f@algebra20.de>

--- src/test/clojure/conexp/fca/implications_test.clj
+++ src/test/clojure/conexp/fca/implications_test.clj
@@ -411,16 +411,26 @@
 ;;;

 (deftest test-approx-canonical-base
-  (let [ε 0.3
-        δ 1e-10]
-    (with-testing-data [ctx (random-contexts 10 15)]
-      (let [exact-base (canonical-base ctx)
-            approx-base (approx-canonical-base ctx ε δ)
-            exact-models (set (all-closed-sets (attributes ctx) (clop-by-implications exact-base)))
-            approx-models (set (all-closed-sets (attributes ctx) (clop-by-implications approx-base)))]
-        (<= (+ (count (difference exact-models approx-models))
-               (count (difference approx-models exact-models)))
-            (* ε (expt 2 (count (attributes ctx)))))))))
+  (let [test-bound (fn [ctx ε δ]
+                     (let [exact-base (canonical-base ctx)
+                           approx-base (approx-canonical-base ctx ε δ)
+                           exact-models (set (all-closed-sets (attributes ctx)
+                                                              (clop-by-implications exact-base)))
+                           approx-models (set (all-closed-sets (attributes ctx)
+                                                               (clop-by-implications approx-base)))]
+                       (<= (+ (count (difference exact-models approx-models))
+                              (count (difference approx-models exact-models)))
+                           (* ε (expt 2 (count (attributes ctx)))))))]
+    (let [ε 0.3,
+          δ 1e-10]
+      (with-testing-data [ctx (random-contexts 10 15)]
+        (test-bound ctx ε δ)))
+    (let [ε 0.3,
+          δ 0.5
+          n 50]
+      (let [failures (filter (comp not #(test-bound % ε δ)) (random-contexts n 15))]
+        (< (count failures)
+           (* n (- 1 δ)))))))

 ;;;


Add unit tests.

Add unit tests.

--- test/cli4clj/test/cli.clj
+++ test/cli4clj/test/cli.clj
@@ -8,13 +8,12 @@

 (ns
   ^{:author "Ruediger Gad",
-    :doc "cli4clj allows to create simple interactive command line interfaces for Clojure applications.
-          For an example usage scenario please see the namespace cli4clj.example."}
+    :doc "Tests for cli4clj"}
   cli4clj.test.cli
   (:use clojure.test
         cli4clj.cli))

-(deftest test-simple-options-merging
+(deftest simple-options-merging-test
   (let [user-options {:cmds {:foo {:fn 123}}}
         defaults {:cmds {:bar {:fn 456}}}
         mandatory-defaults {}
@@ -22,3 +21,21 @@
                          :foo {:fn 123}}}]
     (is (= expected (merge-options defaults user-options mandatory-defaults)))))

+(deftest simple-options-override-test
+  (let [user-options {:cmds {:foo {:fn 123}
+                             :bar {:fn 789}}}
+        defaults {:cmds {:bar {:fn 456}}}
+        mandatory-defaults {}
+        expected {:cmds {:bar {:fn 789}
+                         :foo {:fn 123}}}]
+    (is (= expected (merge-options defaults user-options mandatory-defaults)))))
+
+(deftest simple-mandatory-options-override-test
+  (let [user-options {:cmds {:foo {:fn 123}
+                             :bar {:fn 789}}}
+        defaults {}
+        mandatory-defaults {:cmds {:bar {:fn 456}}}
+        expected {:cmds {:bar {:fn 456}
+                         :foo {:fn 123}}}]
+    (is (= expected (merge-options defaults user-options mandatory-defaults)))))
+


test delete-match! and creation/getting multiple matches

--- test/foosball/test/db.clj
+++ test/foosball/test/db.clj
@@ -76,15 +76,16 @@
                             (d/create-player! db id name openid )
                             (util/symbols-as-map id name openid)))
           [p1 p2 p3 p4] (map create-player ["p1" "p2" "p3" "p3"])
-          match-date (java.util.Date.)
-          team1score 10
-          team2score 5
-          reporter (create-player "reporter")]
+          match-date    (java.util.Date.)
+          team1score    10
+          team2score    5
+          reporter      (create-player "reporter")
+          create-match  (fn [] (d/create-match! db {:matchdate match-date
+                                                   :team1 {:player1 (:id p1) :player2 (:id p2) :score team1score}
+                                                   :team2 {:player1 (:id p3) :player2 (:id p4) :score team2score}
+                                                   :reported-by (:id reporter)}))]
       (testing "We can create a match with our four players,"
-        (is (not= nil (d/create-match! db {:matchdate match-date
-                                           :team1 {:player1 (:id p1) :player2 (:id p2) :score team1score}
-                                           :team2 {:player1 (:id p3) :player2 (:id p4) :score team2score}
-                                           :reported-by (:id reporter)})))
+        (is (not= nil (create-match)))
         (testing "then we can get it out again"
           (let [result (d/get-matches db)]
             (is (diff-with-first-nil? {:matchdate match-date
@@ -92,4 +93,16 @@
                                        :team2 {:player1 (:name p3) :player2 (:name p4) :score team2score}
                                        :reported-by (:name reporter)}
                                       (first result)))
-            (is (= 1 (count result)))))))))
+            (is (= 1 (count result)))))
+
+        (testing "; and we can delete it again"
+          (let [matchid (->> (d/get-matches db) first :match/id)]
+            (is (not= nil matchid))
+            (is (not= nil (d/delete-match! db matchid))))
+          (testing ", and we cannot get it out again."
+            (is (empty? (d/get-matches db)))))
+
+        (testing "Creation of multiple matches"
+          (let [num-matches 100
+                created-matches (doall (repeatedly num-matches create-match))]
+            (is (= num-matches (count (d/get-matches db))))))))))


sort and clean

sort and clean

--- babel/francais/lexicon.clj
+++ babel/francais/lexicon.clj
@@ -14,6 +14,12 @@
    "accompagner" {:synsem {:cat :verb
                            :sem {:pred :accompany}}}

+   "acheter" {:synsem {:cat :verb
+                      :sem {:pred :comprare}}}
+
+   "aider" {:synsem {:cat :verb
+                     :sem {:pred :aiutare}}}
+
    "anoncier" {:synsem {:cat :verb
                         :sem {:pred :announce}}}

@@ -28,16 +34,18 @@
    ;;  CONJUGATES LIKE TENIR
    "apprendre" {:synsem {:cat :verb
                          :sem {:pred :imparare}}}
+
+   "assurer" [{:synsem {:cat :verb
+                        :sem {:pred :assure}}}
+              {:synsem {:cat :verb
+                        :sem {:pred :insure}}}]
+
+   "attendre" {:synsem {:cat :verb
+                         :sem {:pred :wait}}}

-    "attendre" {:synsem {:cat :verb
-                         :sem {:pred :wait}}}
-
-    "assurer" {:synsem {:cat :verb
-                         :sem {:pred :assure}}}
-
-    "augmenter" {:synsem {:cat :verb
+   "augmenter" {:synsem {:cat :verb
                          :sem {:pred :increase}}}
-
+
    "avoir"
    {:synsem {:essere false
              :sem {:pred :avere}
@@ -51,74 +59,83 @@
                          :1plur "avons"
                          :2plur "avez"
                          :3plur "ont"}}}
-
-    "boire" {:synsem {:boot-stem1 "boiv"
-                        :boot-stem2 "buv"}
-    :français {:passato "bu"}
-             :synsem {:cat :verb
-                      :sem {:pred :drink}}}
-
+
+   "baisser" {:synsem {:cat :verb
+                      :sem {:pred :lower}}}
+
+   "boire" {:français {:passato "bu"
+                       :boot-stem1 "boiv"
+                       :boot-stem2 "buv"}
+            :synsem {:cat :verb
+                     :sem {:pred :drink}}}
+
    "changer" {:synsem {:cat :verb
-                         :sem {:pred :change}}}
-
-    "chanter" {:synsem {:cat :verb
-                         :sem {:pred :sing}}}
-
-
+                      :sem {:pred :cambiare}}}
+
+   "chanter" {:synsem {:cat :verb
+                       :sem {:pred :sing}}}
+
    "commencer" {:synsem {:cat :verb
                          :sem {:pred :begin}}}
+
+   "commenter" {:synsem {:cat :verb
+                         :sem {:pred :comment}}}
+
+   "comprendre" {:synsem {:cat :verb
+                          :sem {:pred :understand}}}
+
+   "conserver" [{:synsem {:cat :verb
+                          :sem {:pred :conserve}}}
+                {:synsem {:cat :verb
+                          :sem {:pred :preserve}}}]
+
+   "considérer" {:synsem {:cat :verb
+                         :sem {:pred :consider}}}

-    "comprendre" {:synsem {:cat :verb
-                         :sem {:pred :understand}}}
-
+   "couper" {:synsem {:cat :verb
+                      :sem {:pred :cut}}}
+
    "courir" {:synsem {:cat :verb
-                         :sem {:pred :run}}}
-
-     "ecouter" {:synsem {:cat :verb
-                         :sem {:pred :listen}}}
-
-     "marchcer" {:synsem {:cat :verb
-                         :sem {:pred :walk}}}
-
-     "effacer" {:synsem {:cat :verb
-                         :sem {:pred :erase}}}
-
-     "créer" {:synsem {:cat :verb
-                         :sem {:pred :believe}}}
-
-     "décider" {:synsem {:cat :verb
-                         :sem {:pred :decide}}}
-
-     "désirer" {:synsem {:cat :verb
-                         :sem {:pred :desire}}}
-
-     "donner" {:synsem {:cat :verb
-                         :sem {:pred :give}}}
-
-     "peindre" {:français {:boot-stem1 "pein"
-                        :boot-stem2 "peign"}
-     {:français {:passé "visto"
-               :futuro-stem "paindr"
-               :français :imparfait "peign"}}
-             :synsem {:cat :verb
-                      :sem {:pred :paint}}}
-
-     "s'amuser" (let [subject-semantics (ref {:human true})
-                         subject-agr (ref :top)]
-                     {:synsem {:cat :verb
-                               :essere true
-                               :sem {:pred :have-fun
-                                     :reflexive true
-                                     :subj subject-semantics
-                                     :obj subject-semantics}
-                               :subcat {:1 {:agr subject-agr
-                                            :sem subject-semantics}
-                                        :2 {:agr subject-agr
-                                            :pronoun true
-                                            :reflexive true
-                                            :sem subject-semantics}}}})
-
-
+                      :sem {:pred :run}}}
+
+   "créer" {:synsem {:cat :verb
+                     :sem {:pred :create}}}
+
+   "decider" {:synsem {:cat :verb
+                       :sem {:pred :decide}}}
+
+   "developer" {:synsem {:cat :verb
+                        :sem {:pred :develop}}}
+
+   "devoir" {:synsem {:cat :verb
+                     :sem {:pred :have-to}}}
+
+   "diviser" {:synsem {:cat :verb
+                      :sem {:pred :divide}}}
+
+   "ecouter" {:synsem {:cat :verb
+                       :sem {:pred :listen}}}
+
+   "effacer" {:synsem {:cat :verb
+                       :sem {:pred :erase}}}
+
+   "croire" {:synsem {:cat :verb
+                      :sem {:pred :believe}}}
+
+   "décider" {:synsem {:cat :verb
+                       :sem {:pred :decide}}}
+
+   "désirer" {:synsem {:cat :verb
+                       :sem {:pred :desire}}}
+
+   "donner" {:synsem {:cat :verb
+                      :sem {:pred :give}}}
+
+   "echapper" {:synsem {:cat :verb
+                        :sem {:pred :escape}}}
+
+   "écouter" {:synsem {:cat :verb
+                      :sem {:pred :listen-to}}}
    "elle"
    [{:synsem {:cat :noun
              :pronoun true
@@ -138,7 +155,6 @@
               :sem {:human false
                     :pred :lei}
              :subcat '()}}]
-
    "elles"
    [{:synsem {:cat :noun
               :pronoun true
@@ -161,8 +177,20 @@
                    :pred :loro}
              :subcat '()}}]

+   "enseigner" [{:synsem {:cat :verb
+                         :sem {:pred :show}}}
+               {:synsem {:cat :verb
+                         :sem {:pred :teach}}}]
+
+   "entrer" {:synsem {:cat :verb
+                     :sem {:pred :enter}}}
+
+   "envoyer" {:synsem {:cat :verb
+                       :sem {:pred :send}}}
+
    "essayer" {:synsem {:cat :verb
                       :sem {:pred :try}}}
+
    "être"
    (let [infl (ref :top)
          agr (ref :top)]
@@ -182,12 +210,12 @@
                            :2plur "êtes"
                            :3plur "sont"}
                  :passato "été"
-                 :imperfetto {:1sing "étais"
-                              :2sing "étais"
-                              :3sing "était"
-                              :1plur "étions"
-                              :2plur "étiez"
-                              :3plur "étaient"}
+                 :imperfect {:1sing "étais"
+                             :2sing "étais"
+                             :3sing "était"
+                             :1plur "étions"
+                             :2plur "étiez"
+                             :3plur "étaient"}
                  :futuro {:1sing "serai"
                           :2sing "seras"
                           :3sing "sera"
@@ -195,11 +223,31 @@
                           :2plur "serez"
                           :3plur "seront"}}})

+   "étudier" {:synsem {:cat :verb
+                       :sem {:pred :study}}}
+
+   "éviter" {:synsem {:cat :verb
+                      :sem {:pred :avoid}}}
+
+   "exister" {:synsem {:cat :verb
+                       :sem {:pred :exist}}}
+
+   "exprimer" {:synsem {:cat :verb
+                        :sem {:pred :express}}}
+
+   "expulser" {:synsem {:cat :verb
+                        :sem {:pred :throw-out}}}
+
+   "former" {:synsem {:cat :verb
+                     :sem {:pred :form}}}
+
    "gagner" [{:synsem {:cat :verb
                       :sem {:pred :earn}}}
             {:synsem {:cat :verb
                       :sem {:pred :win}}}]

+   "gérer" {:synsem {:cat :verb
+                    :sem {:pred :manage}}}
    "il"
    [{:synsem {:cat :noun
               :pronoun true
@@ -263,10 +311,26 @@
                  :sem {:human true
                        :pred :io}
                  :subcat '()}}
-   "manger"
-   {:synsem {:cat :verb
-             :sem {:pred :mangiare}}}
-   "nous"
+
+  "laisser" {:synsem {:cat :verb
+                      :sem {:pred :leave-behind}}}
+
+  "manger"
+  {:synsem {:cat :verb
+            :sem {:pred :mangiare}}}
+
+  "manquer" {:synsem {:cat :verb
+                      :sem {:pred :to-be-missing}}}
+
+  "marcher" [{:synsem {:cat :verb
+                       :sem {:pred :walk}}}
+             {:synsem {:cat :verb
+                       :sem {:subj {:human false}
+                              :pred :work-nonhuman}}}]
+
+  "mettre" {:synsem {:cat :verb
+                     :sem {:pred :set}}}
+  "nous"
    {:synsem {:cat :noun
              :pronoun true
              :case :nom
@@ -275,18 +339,72 @@
               :sem {:human true
                     :pred :noi}
              :subcat '()}}
+
+   "observer" {:synsem {:cat :verb
+                       :sem {:pred :observe}}}
+
+   "oublier" {:synsem {:cat :verb
+                      :sem {:pred :forget}}}
    "parler"
    [{:synsem {:cat :verb
               :sem {:pred :speak}}}
     {:synsem {:cat :verb
               :sem {:pred :talk}}}]

+   "partager" {:synsem {:cat :verb
+                       :sem {:pred :share}}}
+
+   "participer" {:synsem {:cat :verb
+                         :sem {:pred :participate}}}
+
+   "peindre" {:français {:boot-stem1 "pein"
+                         :boot-stem2 "peign"
+                         :passé "peint"
+                         :futuro-stem "paindr"
+                         :imperfect "peign"}
+              :synsem {:cat :verb
+                       :sem {:pred :paint}}}
+;  "profiter (de)" {:synsem {:cat :verb
+;                            :sem {:pred :take-advantage-of}}}
+
+
+  "regarder" [{:synsem {:cat :verb
+                        :sem {:pred :look}}}
+              {:synsem {:cat :verb
+                        :sem {:pred :watch}}}]
+
+  "remarquer" {:synsem {:cat :verb
+                        :sem {:pred :note}}}
+
+  "répondre" {:synsem {:cat :verb
+                       :sem {:pred :answer}}}
+
+  "s'amuser" (let [subject-semantics (ref {:human true})
+                    subject-agr (ref :top)]
+                {:synsem {:cat :verb
+                          :essere true
+                          :sem {:pred :have-fun
+                                :reflexive true
+                                :subj subject-semantics
+                                :obj subject-semantics}
+                          :subcat {:1 {:agr subject-agr
+                                       :sem subject-semantics}
+                                   :2 {:agr subject-agr
+                                       :pronoun true
+                                       :reflexive true
+                                       :sem subject-semantics}}}})
+  "soulever" {:synsem {:cat :verb
+                       :sem {:pred :lift}}}
+
   "soutenir" {:synsem {:cat :verb
                        :sem {:pred :support}}}

   "terminer" {:synsem {:cat :verb
                        :sem {:pred :finish}}}
-   "tu"
+
+  "touer" {:synsem {:cat :verb
+                    :sem {:pred :kill}}}
+  "tu"
    {:synsem {:cat :noun
              :pronoun true
              :case :nom
@@ -303,157 +421,7 @@
                    :number :plur}
               :sem {:human true
                     :pred :voi}
-             :subcat '()}}
-
-;  "profiter (de)" {:synsem {:cat :verb
-;                            :sem {:pred :take-advantage-of}}}
-
-  "assurer" [{:synsem {:cat :verb
-                       :sem {:pred :assure}}}
-             {:synsem {:cat :verb
-                       :sem {:pred :insure}}}]
-
-  "augmenter" {:synsem {:cat :verb
-                        :sem {:pred :increase}}}
-
-  "aider" {:synsem {:cat :verb
-                    :sem {:pred :aiutare}}}
-
-  "baisser" {:synsem {:cat :verb
-                      :sem {:pred :lower}}}
-
-  "changer" {:synsem {:cat :verb
-                      :sem {:pred :cambiare}}}
-
-  "commenter" {:synsem {:cat :verb
-                        :sem {:pred :comment}}}
-
-  "partager" {:synsem {:cat :verb
-                       :sem {:pred :share}}}
-
-  "acheter" {:synsem {:cat :verb
-                      :sem {:pred :comprare}}}
-
-  ;;CONJUGATES LIKE PRENDRE
-  "comprendre" {:synsem {:cat :verb
-                         :sem {:pred :understand}}}
-
-  "conserver" [{:synsem {:cat :verb
-                         :sem {:pred :conserve}}}
-               {:synsem {:cat :verb
-                         :sem {:pred :preserve}}}]
-
-  "considérer" {:synsem {:cat :verb
-                         :sem {:pred :consider}}}
-
-  ;;SIMILAR TO PRENDRE
-  "répondre" {:synsem {:cat :verb
-                       :sem {:pred :answer}}}
-
-
-  "corrir" {:synsem {:cat :verb
-                     :sem {:pred :run}}}
-
-  ;;  LIKE PRENDRE
-  "correspondre" {:synsem {:cat :verb
-                           :sem {:pred :correspond}}}
-
-  "couper" {:synsem {:cat :verb
-                     :sem {:pred :cut}}}
-
-  "créer" {:synsem {:cat :verb
-                    :sem {:pred :create}}}
-
-  "devoir" {:synsem {:cat :verb
-                     :sem {:pred :have-to}}}
-  ;; IRREGOLARE
-  "decider" {:synsem {:cat :verb
-                      :sem {:pred :decide}}}
-
-  "laisser" {:synsem {:cat :verb
-                      :sem {:pred :leave-behind}}}
-
-  "developer" {:synsem {:cat :verb
-                        :sem {:pred :develop}}}
-
-  "désirer" {:synsem {:cat :verb
-                      :sem {:pred :desire}}}
-
-  "expulser" {:synsem {:cat :verb
-                       :sem {:pred :throw-out}}}
-
-  "enseigner" [{:synsem {:cat :verb
-                         :sem {:pred :show}}}
-               {:synsem {:cat :verb
-                         :sem {:pred :teach}}}]
-
-  "entrer" {:synsem {:cat :verb
-                     :sem {:pred :enter}}}
-
-  "echapper" {:synsem {:cat :verb
-                       :sem {:pred :escape}}}
-
-  "écouter" {:synsem {:cat :verb
-                      :sem {:pred :listen-to}}}
-
-  "attendre" [{:synsem {:cat :verb
-                        :sem {:pred :wait-for}}}
-              {:synsem {:cat :verb
-                        :sem {:pred :hope}}}]
-
-  "étudier" {:synsem {:cat :verb
-                      :sem {:pred :study}}}
-
-  "éviter" {:synsem {:cat :verb
-                     :sem {:pred :avoid}}}
-
-  "exister" {:synsem {:cat :verb
-                      :sem {:pred :exist}}}
-
-  "exprimer" {:synsem {:cat :verb
-                       :sem {:pred :express}}}
-
-  "manquer" {:synsem {:cat :verb
-                      :sem {:pred :to-be-missing}}}
-
-  "former" {:synsem {:cat :verb
-                     :sem {:pred :form}}}
-
-  "marcher" {:synsem {:cat :verb
-                      :sem {:subj {:human false}
-                            :pred :work-nonhuman}}}
-
-  "soulever" {:synsem {:cat :verb
-                       :sem {:pred :lift}}}
-
-  "gérer" {:synsem {:cat :verb
-                    :sem {:pred :manage}}}
-  "envoyer" {:synsem {:cat :verb
-                      :sem {:pred :send}}}
-  "touer" {:synsem {:cat :verb
-                    :sem {:pred :kill}}}
-  "mettre" {:synsem {:cat :verb
-                     :sem {:pred :set}}}
-  "regarder" [{:synsem {:cat :verb
-                        :sem {:pred :look}}}
-              {:synsem {:cat :verb
-                        :sem {:pred :watch}}}]
-
-  "remarquer" {:synsem {:cat :verb
-                        :sem {:pred :note}}}
-
-  "observer" {:synsem {:cat :verb
-                       :sem {:pred :observe}}}
-
-  "oublier" {:synsem {:cat :verb
-                      :sem {:pred :forget}}}
-
-  "participer" {:synsem {:cat :verb
-                         :sem {:pred :participate}}}
-
-  "diviser" {:synsem {:cat :verb
-                      :sem {:pred :divide}}}
-
+             :subcat '()}}
    })


Remove contrib dependencies from r.h.dump.

--- ring-devel/src/ring/handler/dump.clj
+++ ring-devel/src/ring/handler/dump.clj
@@ -2,7 +2,6 @@
   "Reflect Ring requests into responses for debugging."
   (:use hiccup.core
         hiccup.page-helpers
-        [clojure.contrib.def :only (defvar-)]
         ring.util.response)
   (:require [clojure.set :as set]
             [clojure.pprint :as pprint]))
@@ -52,7 +51,7 @@
     (status 200)
     (content-type "text/html")))

-(defvar- css "
+(def ^{:private true} css "
 /*
 Copyright (c) 2008, Yahoo! Inc. All rights reserved.
 Code licensed under the BSD License:


no passphrase needed for secret-key import

--- main/src/dda/pallet/dda_user_crate/infra/gpg.clj
+++ main/src/dda/pallet/dda_user_crate/infra/gpg.clj
@@ -80,9 +80,7 @@
     (actions/exec-checked-script
      "import & trust gpg key"
      ("su" ~user-name "-c" "\"gpg" "--import" ~(str user-home "/pub.key\""))
+     ("su" ~user-name "-c" "\"gpg" "--batch" "--import" ~(str user-home "/priv.key\""))
+     ("su" ~user-name "-c" "\"/usr/lib/gpg-trust-all.sh\"")
      ("su" ~user-name "-c" "\"gpgconf" "--kill" "gpg-agent\"")
-     ("su" ~user-name "-c" "\"gpgconf" "--launch" "gpg-agent\"")
-     ("su" ~user-name "-c" "\"echo" ~passphrase "|"
-           "/usr/lib/gnupg/gpg-preset-passphrase" "--preset" ~public-key-id "\"")
-     ("su" ~user-name "-c" "\"gpg" "--batch" "--import" ~(str user-home "/priv.key\""))
-     ("su" ~user-name "-c" "\"/usr/lib/gpg-trust-all.sh\""))))
+     ("su" ~user-name "-c" "\"gpgconf" "--launch" "gpg-agent\""))))


Bump to a tools.reader version that exists on maven

--- runner/src/leiningen/light_nrepl.clj
+++ runner/src/leiningen/light_nrepl.clj
@@ -34,7 +34,7 @@
                (list 'do cur-init init)
                init)
         profile {:dependencies '[[lein-light-nrepl/lein-light-nrepl "0.1.0"]
-                                 [org.clojure/tools.reader "0.9.10"]]
+                                 [org.clojure/tools.reader "0.9.1"]]
                  :repl-options {:nrepl-middleware ['lighttable.nrepl.handler/lighttable-ops]
                                  :init (with-meta init {:replace true})}}
         project (lp/merge-profiles project [profile])]


removed broken tests

removed broken tests

--- test-cljs/frontend/controllers/controls_test.cljs
+++ test-cljs/frontend/controllers/controls_test.cljs
@@ -58,24 +58,3 @@
     (is (= {:a {:b {:c 2}}} (controls/merge-settings [[:a :b :c]], {:a {:b {:c 1}}}, {:a {:b {:c 2}}})))

     (is (= {:a {:b {:c 1, :d 2}}} (controls/merge-settings [[:a :b :c]], {:a {:b {:c 1}}}, {:a {:b {:d 2}}})))))
-
-(deftest button-ajax-works
-  (testing "button-ajax correctly sends a success event on success"
-    (let [success-event (fn [] "success")
-          failed-event (fn [] "failed")]
-      (bond/with-stub [success-event failed-event
-                       [ajax/ajax (fn [_ _ _ c _] (>! c ["" :success ""]))]]
-        (controls/button-ajax "a" "b" "c" :events {:success success-event
-                                                   :failed failed-event})
-        (is (= 1 (-> success-event bond/with-calls count)))
-        (is (= 0 (-> failed-event bond/with-calls count))))))
-
-  (testing "button-ajax correctly sends a failed event on failed"
-    (let [success-event (fn [] "success")
-          failed-event (fn [] "failed")]
-      (bond/with-stub [success-event failed-event
-                       [ajax/ajax (fn [_ _ _ c _] (>! c ["" :success ""]))]]
-        (controls/button-ajax "a" "b" "c" :events {:success success-event
-                                                   :failed failed-event})
-        (is (= 0 (-> success-event bond/with-calls count)))
-        (is (= 1 (-> failed-event bond/with-calls count)))))))


added default name for cogroup

added default name for cogroup

--- src/datasplash/core.clj
+++ src/datasplash/core.clj
@@ -1235,7 +1235,7 @@
             pcolls (for [[idx [pcoll f {:keys [drop-nil?] :as opts}]]
                          (map-indexed (fn [idx s] (if (instance? PCollection s)
                                                     [idx [s nil nil]] [idx s])) (:specs group-specs))]
-                     (let [local-name (str root-name "-" (.getName pcoll))
+                     (let [local-name (str root-name "-" (if pcoll (.getName pcoll) "pcoll"))
                            op (if f
                                 (with-keys f {:name (str local-name "-group-by")} pcoll)
                                 pcoll)]


characterize by latency

characterize by latency


Make the log location configurable.

Make the log location configurable.

--- clj/src/fmath/core.clj
+++ clj/src/fmath/core.clj
@@ -19,10 +19,13 @@
 (defn app-port []
   (Integer/parseInt (get (System/getenv) "APP_PORT" "8080")))

+(defn app-logs[]
+  (get (System/getenv) "APP_LOGS" "logs"))
+
 (defn- request-log-hander []
   "See:
     http://jetty.codehaus.org/jetty/jetty-6/apidocs/org/mortbay/jetty/NCSARequestLog.html"
-  (let [log (new NCSARequestLog "logs/jetty-yyyy_mm_dd.request.log")
+  (let [log (new NCSARequestLog (str (app-logs) "/jetty-yyyy_mm_dd.request.log"))
         handler (new RequestLogHandler)]
     (doto log
       (.setRetainDays 90)


add "you" to list of collabs

add "you" to list of collabs

--- src-cljs/frontend/components/aside.cljs
+++ src-cljs/frontend/components/aside.cljs
@@ -29,6 +29,10 @@
           ;;  (common/icon :users)
           ;;  [:span "Collaborators"]]
           [:div.aside-collaborators
+           [:button {:title "You're viewing this document. Try inviting others."}
+            [:object
+             (common/icon :user)
+             [:span "You"]]]
            (for [subscriber (disj (:subscribers app) (:client-uuid app))]
              [:button {:title "An anonymous user is viewing this document. Spooky."}
               [:object


don't show workflows sidenav button for btf enterprise

--- src-cljs/frontend/components/aside.cljs
+++ src-cljs/frontend/components/aside.cljs
@@ -506,13 +506,14 @@
       [:i.material-icons "storage"]
       [:div.nav-label "Builds"]]

-     [:a.aside-item {:class (when (contains? state/workflows-routes current-route) "current")
-                     :data-placement "right"
-                     :data-trigger "hover"
-                     :title "Workflows"
-                     :href (routes/v1-workflows)}
-      (icon/workflows)
-      [:div.nav-label "Workflows"]]
+     (when-not (config/enterprise?)
+       [:a.aside-item {:class (when (contains? state/workflows-routes current-route) "current")
+                       :data-placement "right"
+                       :data-trigger "hover"
+                       :title "Workflows"
+                       :href (routes/v1-workflows)}
+        (icon/workflows)
+        [:div.nav-label "Workflows"]])

      [:a.aside-item {:class (when (contains? state/insights-routes current-route)
                               "current")
@@ -634,15 +635,16 @@
       [:i.material-icons "storage"]
       [:div.nav-label "Builds"]]

-     [:a.aside-item {:class (when (contains? state/workflows-routes current-route)
-                              "current")
-                     :data-placement "right"
-                     :data-trigger "hover"
-                     :title "Workflows"
-                     :href (routes/v1-org-workflows-path (:vcs_type org)
-                                                         (:org org))}
-      (icon/workflows)
-      [:div.nav-label "Workflows"]]
+     (when-not (config/enterprise?)
+       [:a.aside-item {:class (when (contains? state/workflows-routes current-route)
+                                "current")
+                       :data-placement "right"
+                       :data-trigger "hover"
+                       :title "Workflows"
+                       :href (routes/v1-org-workflows-path (:vcs_type org)
+                                                           (:org org))}
+        (icon/workflows)
+        [:div.nav-label "Workflows"]])

      [:a.aside-item {:class (when (contains? state/insights-routes current-route)
                               "current")


fix nav links and classes for outer

fix nav links and classes for outer

--- src-cljs/frontend/components/outer.cljs
+++ src-cljs/frontend/components/outer.cljs
@@ -193,9 +193,9 @@
 (defn navigation []
   (html
    [:div.navigation
-     [:a.navigation-link {:href "/home" :target "_self" :role "button" :title "Home"} "Precursor"]
-     [:a.navigation-link {:href ""      :target "_self" :role "button" :title "Pricing"} "Pricing"]
-     [:a.navigation-link {:href "/blog" :target "_self" :role "button" :title "Blog"} "Blog"]
+     [:a.navigation-link {:href "/home"    :role "button" :title "Home"} "Precursor"]
+     [:a.navigation-link {:href "/pricing" :role "button" :title "Pricing"} "Pricing"]
+     [:a.navigation-link {:href "/blog"    :role "button" :title "Blog"} "Blog"]
      (om/build common/google-login {:source "Nav" :size :small})]))

 (def outer-components
@@ -213,8 +213,8 @@
             nav-point (:navigation-point app)
             component (get outer-components nav-point)]
         (html
-          [:div.outer.page-landing
-           {:class (when-not (get app :not-landing?) "landed")}
+          [:div.outer {:class (concat [(str "page-" (name nav-point))]
+                                      (when-not (get app :not-landing?) ["landed"]))}
            [:div.outer-head (navigation)]
            (om/build component app {:react-key nav-point})
            [:div.outer-foot (navigation)]])))))


Better chart updating.

Better chart updating.

Through the use of IDidUpdate. Thx @annapawlicka !

--- src-cljs/kixi/hecuba/widgets/chart.cljs
+++ src-cljs/kixi/hecuba/widgets/chart.cljs
@@ -240,6 +240,13 @@
         (while (.hasChildNodes n)
           (.removeChild n (.-lastChild n))))
       (let [measurements (:measurements chart)]
+        (draw-chart measurements (:chan opts))))
+    om/IDidUpdate
+    (did-update [_ _ _]
+      (let [n (.getElementById js/document "chart")]
+        (while (.hasChildNodes n)
+          (.removeChild n (.-lastChild n))))
+      (let [measurements (:measurements chart)]
         (draw-chart measurements (:chan opts))))))

 ;;;;;;;;;;; Bootstrap ;;;;;;;;;;;;


Use default task option description when provided one is "" (fixes #140)

--- boot/core/src/boot/cli.clj
+++ boot/core/src/boot/cli.clj
@@ -93,14 +93,15 @@
   ([short long type doc]
      (argspec->cli-argspec short long nil type doc))
   ([short long optarg type doc]
-   ((fnil into [])
-    (when short [:short-opt (str "-" short)])
-    [:id           (keyword long)
-     :long-opt     (str "--" long)
-     :required     (when optarg (str optarg))
-     :desc         (format-doc optarg type doc)
-     :parse-fn     `(#'parse-fn ~(when optarg (list 'quote optarg)))
-     :assoc-fn     `(#'assoc-fn ~(when optarg (list 'quote optarg)) '~type)])))
+   (let [doc (if-not (empty? doc) doc (format "The %s option." long))]
+     ((fnil into [])
+      (when short [:short-opt (str "-" short)])
+      [:id           (keyword long)
+       :long-opt     (str "--" long)
+       :required     (when optarg (str optarg))
+       :desc         (format-doc optarg type doc)
+       :parse-fn     `(#'parse-fn ~(when optarg (list 'quote optarg)))
+       :assoc-fn     `(#'assoc-fn ~(when optarg (list 'quote optarg)) '~type)]))))

 (defn- argspec->assert
   ([short long type doc]


Pulled the argument parsing into its own function.

It will force an early exit if the user doesn't define a -i (there's no
input file).

--- comment-breaker/src/comment_breaker/core.clj
+++ comment-breaker/src/comment_breaker/core.clj
@@ -2,7 +2,7 @@
   (:gen-class))
 (use '[clojure.tools.cli :only[cli]])

-(def line-length (atom 80))
+(def line-length (atom nil))
 (def sep-char (atom "\r\n"))

 (defn suffix-file [fstr suffix]
@@ -27,21 +27,25 @@
   (clojure.string/join @sep-char
     (map eat-line (clojure.string/split contents (re-pattern @sep-char)))))

+(defn get-args [args]
+  (let [parsed
+          (cli args
+		    ["-i" "--in-file" "File to run comment processing on."]
+			["-o" "--out-file" "Output file."]
+			["-l" "--line-length" "The desired line length."
+			  :default 80 :parse-fn #(Integer. %)])
+	    p-map (first parsed)]
+	(do
+	  (reset! line-length (:line-length p-map))
+	  (cond
+	    (not (:in-file p-map))
+	      (do (prn (last parsed)) (System/exit 0))
+	    (not (:out-file p-map))
+	      (assoc p-map :out-file (suffix-file (:in-file p-map) "-broken"))
+	    :else p-map))))
+
 ;; Should catch exceptions on I/O!
 (defn -main
   [& args]
-  (let [cli-vec
-          (cli args
-               ["-i" "--in-file" "File to run comment processing on."
-                 :default nil]
-               ["-o" "--out-file" "Output file." :default nil]
-               ["-l" "--line-length" "The desired line length."
-                 :default 80 :parse-fn #(Integer. %)])
-        cli-map (first cli-vec)
-        ifile (:in-file cli-map)
-        ofile (if-let [o (:out-file cli-map)] o
-                (suffix-file ifile "-broken"))]		; causes a NPE if no in!
-    (if-not ifile (prn (last cli-vec))
-      (do
-        (reset! line-length (:line-length cli-map))
-        (spit ofile (process-file (slurp ifile)))))))+  (let [cli-map (get-args args)]
+    (spit (:out-file cli-map) (process-file (slurp (:in-file cli-map))))))


CMR-4152: correct the request log time format to use 24 hour clock.

--- common-lib/src/cmr/common/api/web_server.clj
+++ common-lib/src/cmr/common/api/web_server.clj
@@ -9,7 +9,6 @@
    [ring.adapter.jetty :as jetty])
   (:import
    (java.io ByteArrayInputStream InputStream)
-   (java.util TimeZone)
    (org.eclipse.jetty.server Server NCSARequestLog Connector HttpConnectionFactory)
    (org.eclipse.jetty.server.handler RequestLogHandler)
    (org.eclipse.jetty.servlets.gzip GzipHandler)))
@@ -96,7 +95,7 @@
     (.setRequestLog
       (doto (NCSARequestLog.)
         (.setLogLatency true)
-        (.setLogDateFormat "yyyy-MM-dd hh:mm:ss.SSS")))))
+        (.setLogDateFormat "yyyy-MM-dd HH:mm:ss.SSS")))))

 (defn- create-gzip-handler
   "Setup gzip compression for responses.  Compression will be used for any response larger than


[build] Regen boot/myocamlbuild.boot.

[build] Regen boot/myocamlbuild.boot.

git-svn-id: e7e61699ce1738538ffebb75374fbea0924bc775@8614 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02


Only var-quote in dev-mode

Only var-quote in dev-mode

--- web/src/immutant/web.clj
+++ web/src/immutant/web.clj
@@ -18,7 +18,7 @@
   (:require [immutant.logging        :as log]
             [immutant.web.undertow   :as undertow]
             [immutant.util           :refer [concat-valid-options extract-options
-                                             validate-options enum->set mapply]]
+                                             validate-options enum->set mapply dev-mode?]]
             [immutant.web.middleware :refer [add-middleware]]
             [clojure.walk            :refer [keywordize-keys]])
   (:import org.projectodd.wunderboss.WunderBoss
@@ -69,7 +69,8 @@
   "Composes server and mount fns; ensures handler is var-quoted"
   ([handler] `(run ~handler {}))
   ([handler options]
-     (let [handler (if (and (symbol? handler)
+     (let [handler (if (and (dev-mode?)
+                         (symbol? handler)
                          (not (get &env handler))
                          (resolve handler))
                      `(var ~handler)


Split the memory section into memory-query and memory-results

This will help me make more localized updates, since the results do not
(currently) need to be redrawn as often as the query box.

--- src/cljs/memento/core.cljs
+++ src/cljs/memento/core.cljs
@@ -291,46 +291,54 @@

 (defn dispatch-on-press-enter [e d]
   (if (= 13 (.-which e))
-    (dispatch d))
-  )
-
-(defn memory-list []
-  (let [query    (subscribe [:ui-state :current-query])
-        busy?    (subscribe [:ui-state :is-searching?])
+    (dispatch d)))
+
+
+(defn memory-query []
+  (let [query (subscribe [:ui-state :current-query])]
+    (fn []
+      [:div {:class "form-horizontal"}
+       [:div {:class "form-group"}
+        [:label {:for "input-search" :class "col-lg-2 control-label"} "Search:"]
+        [:div {:class "col-lg-8"}
+         [:input {:type         "text"
+                  :class        "form-control"
+                  :id           "input-search"
+                  :value        @query
+                  :on-change    #(dispatch-sync [:update-query (-> % .-target .-value)])
+                  :on-key-press #(dispatch-on-press-enter % [:load-memories])}]]
+        [:div {:class "col-lg-1"}
+         [:button {:type "submit" :class "btn btn-primary" :on-click #(dispatch [:load-memories])} "Search"]]
+        ]])))
+
+(defn memory-results []
+  (let [busy?    (subscribe [:ui-state :is-searching?])
         memories (subscribe [:ui-state :memories])
         results  (reaction (:results @memories))]
     (fn []
-      [:span
-       [:div {:class "form-horizontal"}
-        [:div {:class "form-group"}
-         [:label {:for "input-search" :class "col-lg-2 control-label"} "Search:"]
-         [:div {:class "col-lg-8"}
-          [:input {:type         "text"
-                   :class        "form-control"
-                   :id           "input-search"
-                   :value        @query
-                   :on-change    #(dispatch-sync [:update-query (-> % .-target .-value)])
-                   :on-key-press #(dispatch-on-press-enter % [:load-memories])}]]
-         [:div {:class "col-lg-1"}
-          [:button {:type "submit" :class "btn btn-primary" :on-click #(dispatch [:load-memories])} "Search"]]
-         ]]
-       (if @busy?
-         [panel "Loading..." "Please wait while your memories are being loaded" "panel-info"]
-         [panel "Memories"
-          [:span
-           (if (empty? @results)
-             [:p "Nothing."]
-             (for [memory @results]
-               ^{:key (:id memory)}
-               [:blockquote
-                [:p (:thought memory)]
-                [:small (:created memory)]]
-               ))
-           ]
-          "panel-primary"
-          ])
-       ]
+      (if @busy?
+        [panel "Loading..." "Please wait while your memories are being loaded" "panel-info"]
+        [panel "Memories"
+         [:span
+          (if (empty? @results)
+            [:p "Nothing."]
+            (for [memory @results]
+              ^{:key (:id memory)}
+              [:blockquote
+               [:p (:thought memory)]
+               [:small (:created memory)]]
+              ))
+          ]
+         "panel-primary"
+         ])
       )))
+
+(defn memory-list []
+  (fn []
+    [:span
+     [memory-query]
+     [memory-results]]))
+

 (defn login-form []
   (let [username  (subscribe [:credentials :username])


Edit unit-terrain-effects track -Will only happen if terrain has a unit

--- src/cljs/zetawar/subs.cljs
+++ src/cljs/zetawar/subs.cljs
@@ -454,9 +454,9 @@
     @(unit-at conn q r)))

 (deftrack unit-terrain-effects [conn unit-q unit-r terrain-q terrain-r]
-  (let [unit @(unit-at conn unit-q unit-r)
-        terrain @(terrain-at conn terrain-q terrain-r)]
-    (game/unit-terrain-effects @conn unit terrain)))
+  (when-let [unit @(unit-at conn unit-q unit-r)]
+    (let [terrain @(terrain-at conn terrain-q terrain-r)]
+      (game/unit-terrain-effects @conn unit terrain))))

 (deftrack selected-terrain-effects [conn]
   (when-let [[q r] @(selected-hex conn)]


CMR-5137: Fixed failing test now that we are using https://doi.org as the base URL for DOIs.

--- system-int-test/test/cmr/system_int_test/search/collection_directory_pages_test.clj
+++ system-int-test/test/cmr/system_int_test/search/collection_directory_pages_test.clj
@@ -82,7 +82,7 @@
 (defn expected-provider3-level-links?
   [body]
   (string/includes? body "EOSDIS holdings for the PROV3 provider")
-  (let [url "http://dx.doi.org"]
+  (let [url "https://doi.org"]
     (and
       (string/includes? body (format "%s/%s" url "doi102"))
       (string/includes? body (format "%s/%s" url "doi103"))
@@ -169,27 +169,27 @@
                                      {:format :umm-json
                                       :accept-format :json})))
          someadmin-guest-colls (doall (for [n (range 120 123)]
-                                    (d/ingest-umm-spec-collection
-                                     "SOMEADMIN"
-                                     (assoc exp-conv/curr-ingest-ver-example-collection-record
-                                            :ShortName (str "s" n)
-                                            :EntryTitle (str "Collection Item " n)
-                                            :DOI (cm/map->DoiType
-                                                  {:DOI (str "doi" n)
-                                                   :Authority (str "auth" n)}))
-                                     {:format :umm-json
-                                      :accept-format :json})))
+                                       (d/ingest-umm-spec-collection
+                                        "SOMEADMIN"
+                                        (assoc exp-conv/curr-ingest-ver-example-collection-record
+                                               :ShortName (str "s" n)
+                                               :EntryTitle (str "Collection Item " n)
+                                               :DOI (cm/map->DoiType
+                                                     {:DOI (str "doi" n)
+                                                      :Authority (str "auth" n)}))
+                                        {:format :umm-json
+                                         :accept-format :json})))
          someadmin-invisible-colls (doall (for [n (range 130 133)]
-                                    (d/ingest-umm-spec-collection
-                                     "SOMEADMIN"
-                                     (assoc exp-conv/curr-ingest-ver-example-collection-record
-                                            :ShortName (str "s" n)
-                                            :EntryTitle (str "Collection Item " n)
-                                            :DOI (cm/map->DoiType
-                                                  {:DOI (str "doi" n)
-                                                   :Authority (str "auth" n)}))
-                                     {:format :umm-json
-                                      :accept-format :json})))]
+                                           (d/ingest-umm-spec-collection
+                                            "SOMEADMIN"
+                                            (assoc exp-conv/curr-ingest-ver-example-collection-record
+                                                   :ShortName (str "s" n)
+                                                   :EntryTitle (str "Collection Item " n)
+                                                   :DOI (cm/map->DoiType
+                                                         {:DOI (str "doi" n)
+                                                          :Authority (str "auth" n)}))
+                                            {:format :umm-json
+                                             :accept-format :json})))]

     (reset! test-collections
             {"PROV1" (sort (map :concept-id [c1-p1 c2-p1 c3-p1]))


Change rdf-serializer to support :append true and a few other options.

NOTE: format is now not a parameter, but an optional keyword argument.
This might break some code.

--- src/grafter/rdf/sesame.clj
+++ src/grafter/rdf/sesame.clj
@@ -297,12 +297,31 @@

 (defn rdf-serializer
   "Coerces destination into an java.io.Writer using
-  clojure.java.io/writer and returns an RDFSerializer."
-
-  ([destination]
-     (rdf-serializer destination (Rio/getWriterFormatForFileName destination)))
-  ([destination format]
-     (Rio/createWriter format (io/writer destination))))
+  clojure.java.io/writer and returns an RDFSerializer.
+
+  Accepts also the following optional options:
+
+  :append          If set to true it will append new values to the end of
+                   the file destination (default: false).
+
+  :format          If a String or a File are provided the format parameter
+                   can be optional (in which case it will be infered from
+                   the file extension).  This should be a sesame RDFFormat
+                   object.
+
+  :encoding        The character encoding to be used (default: UTF-8)"
+
+  ([destination & {:keys [append format encoding] :or {append false
+                                                       encoding "UTF-8"}}]
+     (let [format (or format
+                      (condp = (class destination)
+                        String (Rio/getWriterFormatForFileName destination)
+                        File   (Rio/getWriterFormatForFileName (str destination))
+                        (throw (ex-info "Could not infer file format, please supply a :format parameter" {:error :could-not-infer-file-format :object destination}))))]
+       (Rio/createWriter format
+                         (io/writer destination
+                                    :append append
+                                    :encoding encoding)))))

 (extend-protocol pr/ITripleWriteable
   RDFWriter


Fix tests

Fix tests

--- test/buildviz/handler_test.clj
+++ test/buildviz/handler_test.clj
@@ -161,10 +161,10 @@

     ;; GET should return job summary
     (let [app (the-app)]
-      (a-build app "someBuild" 1, {:start 10 :end 20 :outcome "pass" :inputs [{:id 42 :revision "dat_revision"}]})
-      (a-build app "someBuild" 2, {:start 30 :end 60 :outcome "fail" :inputs [{:id 42 :revision "dat_revision"}]})
-      (a-build app "someBuild" 3, {:start 70 :end 90 :outcome "fail" :inputs [{:id 42 :revision "other_revision"}]})
-      (a-build app "someBuild" 4, {:start 100 :end 120 :outcome "pass" :inputs [{:id 42 :revision "yet_another_revision"}]})
+      (a-build app "someBuild" 1, {:start 10 :end 20 :outcome "pass" :inputs [{:source_id 42 :revision "dat_revision"}]})
+      (a-build app "someBuild" 2, {:start 30 :end 60 :outcome "fail" :inputs [{:source_id 42 :revision "dat_revision"}]})
+      (a-build app "someBuild" 3, {:start 70 :end 90 :outcome "fail" :inputs [{:source_id 42 :revision "other_revision"}]})
+      (a-build app "someBuild" 4, {:start 100 :end 120 :outcome "pass" :inputs [{:source_id 42 :revision "yet_another_revision"}]})
       (is (= (:body (plain-get-request app "/jobs"))
              (join ["job,averageRuntime,totalCount,failedCount,flakyCount\n"
                     (format "someBuild,%.8f,4,2,1\n" 0.00000023)]))))
@@ -207,8 +207,8 @@

     ;; GET should return a flaky build count
     (let [app (the-app)]
-      (a-build app "flakyBuild" 1, {:outcome "pass" :inputs [{:id 42 :revision "dat_revision"}]})
-      (a-build app "flakyBuild" 2, {:outcome "fail" :inputs [{:id 42 :revision "dat_revision"}]})
+      (a-build app "flakyBuild" 1, {:outcome "pass" :inputs [{:source_id 42 :revision "dat_revision"}]})
+      (a-build app "flakyBuild" 2, {:outcome "fail" :inputs [{:source_id 42 :revision "dat_revision"}]})
       (is (= (json-body (json-get-request app "/jobs"))
              {"flakyBuild" {"failedCount" 1 "totalCount" 2 "flakyCount" 1}})))
     ))


All tests pass in clj, all but one in cljs.


Move the comments that explain what `swap!` does

--- test/com/nomistech/clojure_the_language/c_400_state_and_concurrency/s_020_atoms.clj
+++ test/com/nomistech/clojure_the_language/c_400_state_and_concurrency/s_020_atoms.clj
@@ -21,12 +21,10 @@
 (fact (deref *my-number) => 0)
 (fact @*my-number => 0)

-(do (swap! *my-number inc)
-    ;; does this: (inc 0)
+(do (swap! *my-number inc) ; does this: (inc 0)
     (fact @*my-number => 1))

-(do (swap! *my-number inc)
-    ;; does this: (inc 1)
+(do (swap! *my-number inc) ; does this: (inc 1)
     (fact @*my-number => 2))

 (fact "`swap` returns the new value of the atom"
@@ -41,12 +39,10 @@
 ;;;; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 ;;;; Supplying additional args to the data function:

-(do (swap! *my-number + 10)
-    ;; does this: (+ 2 10)
+(do (swap! *my-number + 10) ; does this: (+ 2 10)
     (fact @*my-number => 12))

-(do (swap! *my-number + 1 2 3 4 5)
-    ;; does this: (+ 12 1 2 3 4 5)
+(do (swap! *my-number + 1 2 3 4 5) ; does this: (+ 12 1 2 3 4 5)
     (fact @*my-number => 27))

 ;;;; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


tiling sprite options

tiling sprite options


reformat the auth-backend variable in the handler namespace

--- src/bitfondue/handler.clj
+++ src/bitfondue/handler.clj
@@ -52,7 +52,8 @@
   (POST "/login" [] login)
   (route/resources "/"))

-(def auth-backend (jwe-backend {:secret secret :options {:alg :a256kw :enc :a128gcm}}))
+(def auth-backend (jwe-backend {:secret config/secret
+                                :options {:alg :a256kw :enc :a128gcm}}))

 (def app (-> app-routes
              (wrap-authorization auth-backend)