Upgraded the confusion matrix.

Upgraded the confusion matrix.

--- suite/src/cortex/suite/classification.clj
+++ suite/src/cortex/suite/classification.clj
@@ -434,53 +434,86 @@
         ^JPanel display-panel (grid-layout-panel 5 5)
         class-names (:class-names dataset)
         num-classes (count class-names)
-        ^JPanel conf-panel (grid-layout-panel (+ 1 num-classes) (+ 1 num-classes))
+        ^JPanel conf-panel (grid-layout-panel (+ 2 num-classes) (+ 2 num-classes))
         ^JPanel conv-label-panel (border-layout-panel)
         label-seq (vec (concat ["label"] class-names))
+        row-end-label "correct/predicted"
+        col-end-label "correct/actual"
         retval
         (fn [network-eval]
           (let [conf-matrix (network-eval->rich-confusion-matrix network-eval)]
             (.removeAll conf-panel)
             (.removeAll display-panel)
-            (doseq [label label-seq]
+            (doseq [label (concat label-seq
+                                  [row-end-label])]
               (.add conf-panel (->label label)))
-            (doseq [label class-names]
-              (.add conf-panel (->label (str label)))
-              (doseq [compare-label class-names]
-                (let [{:keys [inferences observations]} (get-in conf-matrix [label compare-label])
-                      observation-count (count observations)
-                      target-label (->label (str observation-count))]
-                  (add-click-handler target-label
-                                     (fn [& args]
-                                       (.removeAll display-panel)
-                                       (try
-                                         (let [inference-observation-pairs
-                                               (->> (interleave (map m/emax inferences)
-                                                                observations)
-                                                    (partition 2)
-                                                    (map vec)
-                                                    (sort-by first >)
-                                                    (take 25)
-                                                    (pmap (fn [[inference observation]]
-                                                            [inference (observation->image-fn
-                                                                        observation)])))]
-                                           (doseq [[inference observation] inference-observation-pairs]
-                                             (let [^JPanel icon-panel (grid-layout-panel 2 1)]
-                                               (.add icon-panel (JIcon. ^BufferedImage observation))
-                                               (.add icon-panel (->label (format "%1.4f" inference)))
-                                               (.add display-panel icon-panel))))
-                                         (catch Throwable e
-                                           (clojure.pprint/pprint e)
-                                           nil))
-                                       (.revalidate display-panel)
-                                       (.repaint display-panel)))
-                  (.add conf-panel target-label)
-                  (.revalidate conf-panel)
-                  (.repaint conf-panel)
-                  (.revalidate outer-grid)
-                  (.repaint outer-grid))))))]
-    (.add conv-label-panel (->label "actual") BorderLayout/WEST)
-    (.add conv-label-panel (->label "predicted") BorderLayout/NORTH)
+            (doseq [col-label (concat class-names
+                                      [col-end-label])]
+              (.add conf-panel (->label (str col-label)))
+              (doseq [row-label (concat class-names
+                                        [row-end-label])]
+                (cond (and (= col-label col-end-label)
+                           (= row-label row-end-label))
+                      (let [total-correct (long (->> class-names
+                                                     (map #(get-in conf-matrix [% %]))
+                                                     (map #(count (get % :inferences)))
+                                                     (reduce +)))
+                            total-items (count (:inferences network-eval))]
+                        (.add conf-panel (->label (format "%1.2f" (double (/ total-correct total-items))))))
+                      (= col-label col-end-label)
+                      (let [entire-row (->> class-names
+                                            (map #(get-in conf-matrix [row-label %]))
+                                            (map #(count (get % :inferences))))
+                            actual-item (long (->> (get-in conf-matrix [row-label row-label])
+                                                   (#(get % :inferences))
+                                                   count))]
+                        (.add conf-panel (->label (format "%1.2f" (double (/ actual-item
+                                                                             (double (reduce + entire-row))))))))
+                      (= row-label row-end-label)
+                      (let [entire-row (->> class-names
+                                            (map #(get-in conf-matrix [% col-label]))
+                                            (map #(count (get % :inferences))))
+                            actual-item (long
+                                         (->> (get-in conf-matrix [col-label col-label])
+                                              (#(get % :inferences))
+                                              count))]
+                        (.add conf-panel (->label (format "%1.2f" (double (/ actual-item
+                                                                             (double (reduce + entire-row))))))))
+                      :else
+                      (let [{:keys [inferences observations]} (get-in conf-matrix [row-label col-label])
+                            observation-count (count observations)
+                            target-label (->label (str observation-count))]
+                        (add-click-handler target-label
+                                           (fn [& args]
+                                             (.removeAll display-panel)
+                                             (try
+                                               (let [inference-observation-pairs
+                                                     (->> (interleave (map m/emax inferences)
+                                                                      observations)
+                                                          (partition 2)
+                                                          (map vec)
+                                                          (sort-by first >)
+                                                          (take 25)
+                                                          (pmap (fn [[inference observation]]
+                                                                  [inference (observation->image-fn
+                                                                              observation)])))]
+                                                 (doseq [[inference observation] inference-observation-pairs]
+                                                   (let [^JPanel icon-panel (grid-layout-panel 2 1)]
+                                                     (.add icon-panel (JIcon. ^BufferedImage observation))
+                                                     (.add icon-panel (->label (format "%1.4f" inference)))
+                                                     (.add display-panel icon-panel))))
+                                               (catch Throwable e
+                                                 (clojure.pprint/pprint e)
+                                                 nil))
+                                             (.revalidate display-panel)
+                                             (.repaint display-panel)))
+                        (.add conf-panel target-label)))))
+            (.revalidate conf-panel)
+            (.repaint conf-panel)
+            (.revalidate outer-grid)
+            (.repaint outer-grid)))]
+    (.add conv-label-panel (->label "predicted") BorderLayout/WEST)
+    (.add conv-label-panel (->label "actual") BorderLayout/NORTH)
     (.add conv-label-panel conf-panel BorderLayout/CENTER)
     (.add outer-grid conv-label-panel)
     (.add outer-grid display-panel)


remove unnecessary functions

remove unnecessary functions

--- src/chat/client/views/new_message.cljs
+++ src/chat/client/views/new_message.cljs
@@ -191,12 +191,6 @@
             (fn []
               (om/update-state! owner :highlighted-result-index
                                 #(mod (dec %) (count results))))
-            highlight-clear!
-            (fn []
-              (om/set-state! owner :highlighted-result-index 0))
-            close-autocomplete!
-            (fn []
-              (highlight-clear!))
             reset-state!
             (fn []
               (om/update-state! owner
@@ -216,8 +210,7 @@
             choose-result!
             (fn [result]
               ((result :action) (config :thread-id))
-              (om/set-state! owner :text ((result :message-transform) text))
-              (close-autocomplete!))
+              (om/set-state! owner :text ((result :message-transform) text)))
             autocomplete-open? (and (not force-close?) (not (nil? results)))]
           (dom/div #js {:className "message new"}
             (dom/textarea #js {:placeholder (config :placeholder)
@@ -243,7 +236,6 @@
                                        (if-let [result (nth results highlighted-result-index nil)]
                                          (choose-result! result)
                                          (do
-                                           (close-autocomplete!)
                                            (om/set-state! owner :force-close? true))))
                                      ; ENTER otherwise -> send message
                                      (not e.shiftKey)
@@ -252,8 +244,7 @@
                                        (send-message!)))

                                    KeyCodes.ESC (do
-                                                  (om/set-state! owner :force-close? true)
-                                                  (close-autocomplete!))
+                                                  (om/set-state! owner :force-close? true))

                                    KeyCodes.UP (when autocomplete-open?
                                                  (.preventDefault e)


document exact semantics of select*/transform* needed for Navigator

--- src/clj/com/rpl/specter/protocols.cljx
+++ src/clj/com/rpl/specter/protocols.cljx
@@ -1,8 +1,20 @@
 (ns com.rpl.specter.protocols)

 (defprotocol Navigator
-  (select* [this structure next-fn])
-  (transform* [this structure next-fn]))
+  (select* [this structure next-fn]
+    "An implementation of `select*` must call `next-fn` on each
+     subvalue of `structure`. The result of `select*` is specified
+     as follows:
+
+     1. `NONE` if `next-fn` never called
+     2. `NONE` if all calls to `next-fn` return `NONE`
+     3. Otherwise, any non-`NONE` return value from calling `next-fn`
+     ")
+  (transform* [this structure next-fn]
+    "An implementation of `transform*` must use `next-fn` to transform
+     any subvalues of `structure` and then merge those transformed values
+     back into `structure`. Everything else in `structure` must be unchanged."
+    ))

 (defprotocol Collector
   (collect-val [this structure]))


update 3d view size

update 3d view size

--- src/cljs/ikea_clojure_cup/pack_it.cljs
+++ src/cljs/ikea_clojure_cup/pack_it.cljs
@@ -51,5 +51,5 @@
            [:p "N/A"]
            [:div
             [:p.hidden-xs "In the below box, you can pan around and zoom in and out to see how to stack your packages."]
-            [:iframe.hidden-xs {:width "500" :height "500" :src (str "/ikea/preview?bins=" (-> result-state :preview :bins) "&items=" (-> result-state :preview :items))}]
+            [:iframe.hidden-xs {:width "555" :height "555" :src (str "/ikea/preview?bins=" (-> result-state :preview :bins) "&items=" (-> result-state :preview :items))}]
             [:p.visible-xs "3D preview showing how stack the packages is not available when viewing on small screen devices. Please try again on a larger screen."]])]]])))


added wrapping to body of issue

added wrapping to body of issue

--- src/cljs/ninety_nine_issues/views.cljs
+++ src/cljs/ninety_nine_issues/views.cljs
@@ -59,7 +59,8 @@
               [:h3 (:title @issue)]]]
             [:div.row
              [:div.columns
-              [:pre (:body @issue)]]]]
+              [:pre {:style {:white-space "pre-wrap"}}
+                    (:body @issue)]]]]

            ;; if there are no more issues in the queue for user
            (empty? @issue)


Fix resource-response not working from jars.

--- ring-core/src/ring/util/response.clj
+++ ring-core/src/ring/util/response.clj
@@ -61,9 +61,8 @@
     :root - take the resource relative to this root"
   [path & [opts]]
   (let [path   (str (:root opts "") "/" path)
-        path   (.replace path "//" "/")
-        loader (clojure.lang.RT/baseLoader)]
-    (if-let [resource (.getResourceAsStream loader path)]
+        path   (.replace path "//" "/")]
+    (if-let [resource (.getResourceAsStream (class file-response) path)] ; any Ring fn will do here
       (response resource))))

 (defn status


Minor test improvement

Minor test improvement

--- test/clj/algorithms_clj/huffman_test.clj
+++ test/clj/algorithms_clj/huffman_test.clj
@@ -23,6 +23,7 @@
       (to-encoding-map []) => {}
       )
     (fact "Signal with no information still generates a encoding map"
+      (make-huffman-tree [["a" 1]]) => is-node?
       (to-encoding-map [["a" 1]]) => {"a" [0]}
       )
     (fact "Two symbols always leads to a map with single digit codes"


Fixing bug in data-table input format

Fixing bug in data-table input format

Signed-off-by: Daniel Borchmann <25857343a15bf1edafebc2912e82ecf775c585c1@mailbox.tu-dresden.de>

--- src/conexp/io/many_valued_contexts.clj
+++ src/conexp/io/many_valued_contexts.clj
@@ -91,11 +91,14 @@
   [file]
   (with-in-reader file
     (let [read-comma-line (fn []
-                            (let [line (get-line)]
-                              (read-string (str "(" line ")")))),
+                            (try
+                              (let [line (get-line)]
+                                (read-string (str "(" line ")")))
+                              (catch java.io.EOFException _
+                                nil))),
           attributes      (read-comma-line),
           lines           (doall
-                           (take-while #(not (empty? %))
+                           (take-while #(not (nil? %))
                                        (repeatedly read-comma-line))),
           line-lengths    (set-of (count line) [line lines])]
       (when (< 1 (count line-lengths))


(PDB-1109) Couldn't satisfy such that unit test failure

The couldn't satisfy such-that unit test failure can happen if the
test.check generator generates 10 possible "trees" that are not
collection, such as all leaves. This can cause false negative test
results. This commit increases the probability a tree with leaves will
be created and increases the number of attempts (from 10 to 100) that
such-that will make before giving up.

--- test/com/puppetlabs/puppetdb/test/zip.clj
+++ test/com/puppetlabs/puppetdb/test/zip.clj
@@ -18,8 +18,8 @@
             smaller-tree (gen/resize new-size (gen/sized (tree-generator coll-generators leaf-values)))]
         (gen/frequency
          (conj (mapv (fn [coll-generator]
-                       [3 (coll-generator smaller-tree)]) coll-generators)
-               [5 leaf-values]))))))
+                       [2 (coll-generator smaller-tree)]) coll-generators)
+               [1 leaf-values]))))))

 (def misc-leaves
   "Used for emulating typical tree contents with strings numbers and keywords"
@@ -86,7 +86,7 @@

 (cct/defspec post-order-collect
   50
-  (prop/for-all [w (gen/such-that coll? (gen/sized (tree-generator sequential-gen misc-leaves)))]
+  (prop/for-all [w (gen/such-that coll? (gen/sized (tree-generator sequential-gen misc-leaves)) 100)]
                 (= (:state (post-order-visit (tree-zipper w) [] [(extract-item number?)]))
                    (filter number? (flatten (seq w))))))


More test

More test

--- test/onyx/coordinator/multi_peer_test.clj
+++ test/onyx/coordinator/multi_peer_test.clj
@@ -1,6 +1,6 @@
 (ns onyx.coordinator.multi-peer-test
   (:require [clojure.test :refer :all]
-            [clojure.core.async :refer [chan tap >!! <!!]]
+            [clojure.core.async :refer [chan tap alts!! >!! <!!]]
             [com.stuartsierra.component :as component]
             [datomic.api :as d]
             [onyx.coordinator.async :as async]
@@ -16,13 +16,16 @@
       (let [peer-node-a (extensions/create sync :peer)
             peer-node-b (extensions/create sync :peer)

-            payload-node-a (extensions/create sync :payload)
-            payload-node-b (extensions/create sync :payload)
+            payload-node-a-1 (extensions/create sync :payload)
+            payload-node-b-1 (extensions/create sync :payload)
+
+            payload-node-a-2 (extensions/create sync :payload)
+            payload-node-b-2 (extensions/create sync :payload)

             sync-spy-a (chan 1)
             sync-spy-b (chan 1)
             ack-ch-spy (chan 2)
-            offer-ch-spy (chan 1)
+            offer-ch-spy (chan 10)
             status-spy (chan 2)

             catalog [{:onyx/name :in
@@ -45,11 +48,11 @@
         (tap (:ack-mult coordinator) ack-ch-spy)
         (tap (:offer-mult coordinator) offer-ch-spy)

-        (extensions/write-place sync peer-node-a payload-node-a)
-        (extensions/on-change sync payload-node-a #(>!! sync-spy-a %))
+        (extensions/write-place sync peer-node-a payload-node-a-1)
+        (extensions/on-change sync payload-node-a-1 #(>!! sync-spy-a %))

-        (extensions/write-place sync peer-node-b payload-node-b)
-        (extensions/on-change sync payload-node-b #(>!! sync-spy-b %))
+        (extensions/write-place sync peer-node-b payload-node-b-1)
+        (extensions/on-change sync payload-node-b-1 #(>!! sync-spy-b %))

         (>!! (:born-peer-ch-head coordinator) peer-node-a)
         (>!! (:born-peer-ch-head coordinator) peer-node-b)
@@ -59,12 +62,13 @@

         (>!! (:planning-ch-head coordinator) {:catalog catalog :workflow workflow})

+        (<!! offer-ch-spy)
         (<!! sync-spy-a)
         (<!! sync-spy-b)

         (testing "Both payloads are received"
-          (let [payload-a (extensions/read-place sync payload-node-a)
-                payload-b (extensions/read-place sync payload-node-b)]
+          (let [payload-a (extensions/read-place sync payload-node-a-1)
+                payload-b (extensions/read-place sync payload-node-b-1)]
             (is (not (nil? payload-a)))
             (is (not (nil? payload-b)))
             (is (not= payload-a payload-b))
@@ -81,10 +85,35 @@
             (<!! status-spy)
             (<!! status-spy)

+            (extensions/write-place sync peer-node-a payload-node-a-2)
+            (extensions/on-change sync payload-node-a-2 #(>!! sync-spy-a %))
+
+            (extensions/write-place sync peer-node-b payload-node-b-2)
+            (extensions/on-change sync payload-node-b-2 #(>!! sync-spy-b %))
+
             (extensions/touch-place sync (:completion (:nodes payload-a)))
             (extensions/touch-place sync (:completion (:nodes payload-b)))
-
-            ))))
+
+            (<!! offer-ch-spy)
+            (<!! offer-ch-spy)
+
+            (let [[v ch] (alts!! [sync-spy-a sync-spy-b])
+                  nodes (:nodes (extensions/read-place sync (:path v)))]
+              (extensions/on-change sync (:status nodes) #(>!! status-spy %))
+              (extensions/touch-place sync (:ack nodes))
+
+              (<!! ack-ch-spy)
+              (<!! status-spy)
+
+              (extensions/touch-place sync (:completion nodes))
+              (<!! offer-ch-spy))
+
+            (testing "All tasks are complete"
+              (let [db (d/db (:conn log))
+                    query '[:find (count ?task) :where
+                            [?task :task/complete? true]]
+                    result (ffirst (d/q query db))]
+                (is (= result 3))))))))

     {:eviction-delay 50000}))


Fix typo in namespace

Fix typo in namespace

--- test/rdf_path_examples/examples_test.clj
+++ test/rdf_path_examples/examples_test.clj
@@ -1,6 +1,6 @@
 (ns rdf-path-examples.examples-test
   (:require [rdf-path-examples.examples :as examples]
-            [rdf-path-examples.jsonld :refer [json-ld->rdf-model]]
+            [rdf-path-examples.json-ld :refer [json-ld->rdf-model]]
             [stencil.core :refer [render-file]]
             [clojure.test :refer :all]
             [clojure.java.io :as io])


remove inspect

remove inspect

--- src-cljs/frontend/replay.cljs
+++ src-cljs/frontend/replay.cljs
@@ -83,7 +83,7 @@

 (defn replay-and-subscribe [state & {:keys [delay-ms sleep-ms tx-count] :as args}]
   (utils/go+
-   (case (utils/inspect (<! (utils/apply-map replay state args)))
+   (case (<! (utils/apply-map replay state args))
      ::interrupted nil
      ::error (do (fdb/reset-db! (:db state) nil)
                  (sente/subscribe-to-document (:sente state) (:comms state) (:document/id state)))


Переработал модальные диалоги, теперь без JQuery

--- src-cljs/ixinfestor/omut.cljs
+++ src-cljs/ixinfestor/omut.cljs
@@ -1,16 +1,18 @@
 (ns ixinfestor.omut
+
+  (:import [goog.dom query])

   (:require-macros [cljs.core.async.macros :refer [go]])
   (:require [cljs.core.async :refer [put! chan <!]]
             [om.core :as om :include-macros true]
             [om.dom :as dom :include-macros true]

+            [goog.dom.classes :as aclasses]
             ;;[sablono.core :as html :refer-macros [html]]

             [ixinfestor.net :as ixnet]

             ))
-

@@ -19,26 +21,35 @@

 (defn modal-show [app]
   (om/transact!
-   app [:show]
+   app :show
    (fn [i] (if i (inc i) 0))))

 (defn modal-hide [app]
   (om/transact!
-   app [:show]
+   app :show
    (fn [_] false)))

-(defonce modal-id-seq (atom 0))
-(defn- modal-id- []
-  (str "modal-" (swap! modal-id-seq inc)))
-
-(defn modal [app owner {:keys [id
-                               label
+
+(defonce modals-ids (atom 0))
+(defn get-modal-id [] (swap! modals-ids inc))
+
+(defonce modals-status (atom #{}))
+(add-watch
+ modals-status :log
+ (fn [_ _ old new]
+   (when (not= old new)
+     (println "modals-status: " new)
+     (let[tag-body (aget (query "body") 0)]
+       (if (empty? new)
+         (goog.dom.classes/remove tag-body "modal-open")
+         (goog.dom.classes/add    tag-body "modal-open"))))))
+
+(defn modal [app owner {:keys [label
                                header
                                body
                                footer
                                class+]
-                        :or {id (modal-id-)
-                             label "Пустая пометка"
+                        :or {label "Пустая пометка"
                              header (dom/h4 #js {:className "modal-title"} "Пустой заголовок")
                              body (dom/p #js {:className "text-info"}
                                          "Пустое пространство диалога. Можно наполнить элементами")
@@ -48,32 +59,31 @@
                                                      :data-dismiss "modal"}
                                                 "Закрыть")
                              class+ ""}}]
-  (let [d-id  (name id)
-        qd-id (str "#" d-id)]
-    (reify
-      om/IDidUpdate
-      (did-update [this prev-props prev-state]
-        (if-let [show (get-in app [:show] false)]
-          (-> qd-id js/jQuery (.modal "show"))
-          (-> qd-id js/jQuery (.modal "hide"))))
-      om/IRender
-      (render [this]
-        (dom/div
-         nil
-         (dom/div #js {:id d-id
-                       :aria-hidden "true"
-                       :aria-labelledby label
-                       :className "modal fade "
-                       :role "dialog"
-                       :tabIndex "-1"}
-                  (dom/div #js {:className (str "modal-dialog " class+)}
-                           (dom/div #js {:className "modal-content"}
-                                    (dom/div #js {:className "modal-header"} header)
-                                    (dom/div #js {:className "modal-body"} body)
-                                    (dom/div #js {:className "modal-footer"} footer)))))))))
-
-
-
+  (reify
+    om/IInitState
+    (init-state [_]
+      {:id (get-modal-id)})
+    om/IWillUnmount
+    (will-unmount [_]
+      (swap! modals-status disj (om/get-state owner :id)))
+    om/IRenderState
+    (render-state [this {id :id}]
+      (println "modal id:" id)
+      (let [show? (:show app)]
+        (swap! modals-status (if show? conj disj) id)
+        (dom/div #js {:aria-hidden "true"
+                      :aria-labelledby label
+                      :style (if show?
+                               #js {:display "block" :paddingLeft 0}
+                               #js {:display "none" })
+                      :className (if show? "modal in" "modal")
+                      :role "dialog"
+                      :tabIndex "-1"}
+                 (dom/div #js {:className (str "modal-dialog " class+)}
+                          (dom/div #js {:className "modal-content"}
+                                   (dom/div #js {:className "modal-header"} header)
+                                   (dom/div #js {:className "modal-body"}   body)
+                                   (dom/div #js {:className "modal-footer"} footer))))))))


Даполнения и доработки

Даполнения и доработки

--- src-cljs/ixinfestor/omut.cljs
+++ src-cljs/ixinfestor/omut.cljs
@@ -840,12 +840,15 @@
 (def input-app-init
   {:value ""})

+(defn input-value [app] (get app :value))
+
 (defn input [app owner {:keys [class+
                                type
                                onChange-valid?-fn
                                onChange-updated-fn
                                onKeyPress-fn
-                               placeholder]
+                               placeholder
+                               min max step]
                         :or {class+ ""
                              type "text"
                              onChange-valid?-fn (fn [_ _] true)
@@ -867,6 +870,7 @@
                                       ))
                         :onKeyPress onKeyPress-fn
                         :type type
+                        :min min :max max :step step
                         :placeholder placeholder
                         :className (str "form-control " class+)})))))

@@ -900,6 +904,14 @@
     (om/transact! app #(assoc % :has-warning? true :text-warning "Пустое поле")))
   true)

+
+(defn input-vldfn-not-empty-or-0 [app v]
+  (helper-p-clean app)
+  (input-css-string-has?-clean app)
+  (when (or (= (count (.trim v)) 0) (= (.valueOf (new js/Number v)) 0))
+    (om/transact! app #(assoc % :has-warning? true :text-warning "Показание пустое либо равно нулю")))
+  true)
+
 ;; END input
 ;;..................................................................................................

@@ -934,11 +946,14 @@
             (= sv no-select-v)) nil sv)))

-(defn select [app _ {:keys [on-change-fn
+(defn select [app _ {:keys [first-item-text
+                            on-change-fn
                             value-field-key
+                            disabled?
                             title-field-key]
                      :or {value-field-key :id
-                          title-field-key :keyname}}]
+                          title-field-key :keyname
+                          first-item-text "Выбрать..."}}]
   (reify
     om/IRender
     (render [_]
@@ -946,6 +961,7 @@
       (dom/select
        #js {:value (@app :selected)
             :className "form-control"
+            :disabled (when disabled? "disabled")
             :onChange
             (fn [e]
               (let [v (-> e .-target .-value)]
@@ -955,7 +971,7 @@
        (doall
         (map (fn [row]
                (dom/option #js {:value (str (value-field-key row))} (title-field-key row)))
-             (into [{value-field-key no-select-v title-field-key "Выбрать..."}] (@app :list)))) ))))
+             (into [{value-field-key no-select-v title-field-key first-item-text}] (@app :list)))) ))))

 (defn select-form-group  [app _ {:keys [label
                                         type
@@ -1430,7 +1446,8 @@
                    {:keys [chan-update
                            data-update-fn
                            data-rendering-fn
-                           add-button-fn]
+                           add-button-fn
+                           tools]
                     :or {data-update-fn (fn [app]
                                           (println "Неопределена функция запроса обновления данных (data-update-fn [app] ...)")
                                           (println "параметр на входе: " (str app)))
@@ -1510,6 +1527,7 @@

                         )
                (dom/br nil)
+               (when tools tools)
                (om/build paginator app {:opts {:chan-update chan-update}})
                (dom/br nil)

@@ -2531,13 +2549,14 @@
                      ui-type
                      ui-type--add-button--type
                      ui-type--add-button--text
-                     on-selected-fn]
+                     on-selected-fn
+                     search-view-opts]
               :or {selection-type selection-type
                    ui-type ui-type
                    ui-type--add-button--type ui-type--add-button--type
                    ui-type--add-button--text ui-type--add-button--text
                    on-selected-fn on-selected-fn
-                   }}]
+                   search-view-opts {}}}]

     (reify
@@ -2646,7 +2665,7 @@

          (om/build modal (:modal app)
                    {:opts {:body (om/build search-view (get-in app [:modal :search-view])
-                                           {:opts {:selection-type selection-type}})
+                                           {:opts (merge {:selection-type selection-type} search-view-opts)})
                            :footer (dom/div #js {:className "btn-toolbar  pull-right"}
                                             (ui-button
                                              {:type :primary


Changing logging of errors returns from API to info since this is not a problem in the system but a normal behavior.

--- common-lib/src/cmr/common/api/errors.clj
+++ common-lib/src/cmr/common/api/errors.clj
@@ -102,7 +102,7 @@
     ;; Log exceptions for server errors
     (if (>= status-code 500)
       (error e)
-      (warn "Failed with status code [" status-code "], response body: " response-body))
+      (info "Failed with status code [" status-code "], response body: " response-body))
     {:status status-code
      :headers {CONTENT_TYPE_HEADER content-type
                CORS_ORIGIN_HEADER "*"}


remove unused refs

remove unused refs

--- src/babel/pos.clj
+++ src/babel/pos.clj
@@ -91,19 +91,12 @@
 ;; A generalization of intransitive and transitive:
 ;; they both have a subject, thus "subjective".
 (def verb-subjective
-  (let [subj-sem (ref :top)
-        subject-agreement (ref :nom)
-        infl (ref :top)
-        agr (ref :top)
-        essere-type (ref :top)]
-    {:synsem {:essere essere-type
-              :infl infl
-              :cat :verb
+  (let [subj-sem (ref :top)]
+    {:synsem {:cat :verb
               :sem {:subj subj-sem}
               :subcat {:1 {:sem subj-sem
                            :cat :noun
-                           :agr agr
-                           :case subject-agreement}}}}))
+                           :case :nom}}}}))

 ;; intransitive: has subject but no object.
 (def intransitive


more informative exception message

more informative exception message

--- src/babel/ug.cljc
+++ src/babel/ug.cljc
@@ -1,9 +1,11 @@
 (ns babel.ug
   (:refer-clojure :exclude [get-in resolve])
   (:require [babel.lexiconfn :refer [apply-default]]
+            [babel.over :refer [spec-info]]
+            [clojure.math.combinatorics :as combo]
             [clojure.string :as string]
             #?(:clj [clojure.tools.logging :as log])
-            [dag_unify.core :refer (fail? get-in unify)]))
+            [dag_unify.core :refer [fail? fail-path get-in strip-refs unify]]))

 (def phrasal {:phrasal true})

@@ -16,7 +18,19 @@
 (defn unify-check [ & vals]
   (let [result (apply unify vals)]
     (if (fail? result)
-      (exception (str "failed to unify grammar rule with values: " vals))
+      (exception (str "failed to unify components of grammar rule: "
+                      (first  ;; there may be other failed components, but showing
+                       ;; only one should be enough to help the grammarian without
+                       ;; overwhelming them.
+                       (filter #(not (nil? %))
+                               (map (fn [[a b]]
+                                      (let [fp (fail-path a b)]
+                                        (if (not (nil? fp))
+                                          {:path (:fail-path fp)
+                                           :a (strip-refs a)
+                                           :b (strip-refs b)})))
+                                    (filter #(= (count %) 2)
+                                            (clojure.math.combinatorics/subsets vals)))))))
       result)))

 (defn verb-default? [tree]


fix typos, add human=false

fix typos, add human=false

--- src/babel/english/lexicon.clj
+++ src/babel/english/lexicon.clj
@@ -27,7 +27,7 @@
    {:synsem {:cat :det
              :def :indef
              :mass false
-             :number :sing}}
+             :agr {:number :sing}}}

    "abandon" {:synsem {:cat :verb
                        :sem {:pred :abandon}}}
@@ -264,6 +264,7 @@

    "car" {:synsem {:cat :noun
                    :sem {:pred :car
+                         :human false
                          :place false}}}

    "carry" {:synsem {:cat :verb
@@ -470,8 +471,7 @@
                         :sem {:pred :furnish}}}

    "game" {:synsem {:cat :noun
-                    :sem {:pred :game
-                          :games true}}}
+                    :sem {:pred :game}}}
    "get angry"
    (let [subject-semantics (ref {:human true})]
      {:synsem {:cat :verb


fix typo

fix typo

--- src/babel/espanol/lexicon.clj
+++ src/babel/espanol/lexicon.clj
@@ -110,7 +110,7 @@
                                :2plur "dais"}
                      :preterito {:1sing "di"
                                  :2sing "diste"
-                                 :3sing "diò"
+                                 :3sing "dio"
                                  :1plur "dimos"
                                  :2plur "disteis"
                                  :3plur "dieron"}}


give markdown ns -main so can be lein run'd

--- src/braid/server/markdown.clj
+++ src/braid/server/markdown.clj
@@ -46,3 +46,6 @@
                             [:div.title "Changelog"]
                             [:div.content
                              changelog-hiccup]]))))))
+
+(defn -main [& args]
+  (generate-changelog))


fix ugly black buttons

fix ugly black buttons

--- src/braid/ui/styles/misc.cljs
+++ src/braid/ui/styles/misc.cljs
@@ -161,10 +161,11 @@
 (def button
   [:.button
    mixins/pill-box
-   {:color vars/grey-text
-    :border [[(px 1 "solid" vars/grey-text)]]
-    :background "none"
-    :margin-left (em 1)}
+   [:&
+    {:color vars/grey-text
+     :border [[(px 1) "solid" vars/grey-text]]
+     :background "none"
+     :margin-left (em 1)}]

    [:&:hover
     {:color "#eee"


fallback embed color if none given

fallback embed color if none given

--- src/braid/ui/views/embed.cljs
+++ src/braid/ui/views/embed.cljs
@@ -3,7 +3,9 @@
             [chat.client.xhr :refer [edn-xhr]]))

 (defn- arr->rgb [arr]
-  (str "rgb(" (arr 0) "," (arr 1) "," (arr 2) ")"))
+  (if arr
+    (str "rgb(" (arr 0) "," (arr 1) "," (arr 2) ")")
+    "rgb(150, 150, 150)"))

 (defn- website-embed-view [content]
   [:div.content.loaded.website


validating type existence

validating type existence

--- src/celestial/persistency.clj
+++ src/celestial/persistency.clj
@@ -77,7 +77,7 @@
   [system]
   (validate!
     (b/validate system
-       ;; [:type] [v/custom type-exists? :message "missing system type"]
+       [:type] [(v/custom type-exists? :message "missing system type")]
        [:machine :hostname]  [v/required str-v])
     ::non-valid-machine))


Corrected bug in pubsub write and default behavior

--- src/clj/datasplash/pubsub.clj
+++ src/clj/datasplash/pubsub.clj
@@ -96,7 +96,7 @@
 ```"
           write-from-pubsub-schema)
    :added "0.4.0"}
-  ([topic options pcoll]
+  ([topic {:keys [type] :or {type :string} :as options} pcoll]
    (-> pcoll
        (apply-transform (.to (get-in message-types [:write type]) topic) {} options)))
   ([topic pcoll] (write-to-pubsub topic {} pcoll)))


Add docs to fires.clj namespace.

Add docs to fires.clj namespace.

--- src/clj/forma/source/fire.clj
+++ src/clj/forma/source/fire.clj
@@ -1,4 +1,56 @@
 (ns forma.source.fire
+  "This namespace has functions and Cascalog queries for processing fire data.
+
+  Fires are recorded daily by the Fire Information For Resource Management
+  System (http://maps.geog.umd.edu) using the NASA Terra and Aqua satellites.
+  They are described using the following attributes which are stored in a CSV
+  file:
+
+    http://firefly.geog.umd.edu/firms/faq.htm#attributes
+
+  Here's an example CSV file:
+
+     latitude,longitude,brightness,scan,track,acq_date,acq_time,satellite,confidence,version,bright_t31,frp
+    -21.774,-48.371,328.8,2.6,1.6,05/11/2012,0125,T,100,5.0,280.7,164.3
+    -21.770,-48.378,327.4,2.6,1.6,05/11/2012,0125,T,100,5.0,280.3,157.4
+    -16.615,-43.483,307.5,1.1,1.0,05/11/2012,0125,T,55,5.0,285.7,15.8
+
+  The FORMA algorithm depends on latitude, longitude, brightness, confidence
+  and acq_date. Before these fires can be used, they have to fist get converted
+  from latitude and longitude into MODIS pixel coordinates at 500 meter resolution.
+
+  Once converted, we store each fire in a DataChunk Thrift object and store it
+  into a Pail. Pails are cool because you can append to them. This allows us to
+  incrementally process fire data. To see the Thrift object definitions, check
+  out the dev/forma.thirft IDL.
+
+  After getting converted, here's what a fire DataChunk looks like for a
+  single fire.
+
+    DataChunk
+      dataset - The name of the dataset which is just 'fire'
+      locationProperty - The ModisPixelLocation Thrift object.
+      chunkValue - The FireTuple Thrift object.
+      temporalRes - The temporal resolution of fires which is one day.
+      date - The acq_date field for the fire.
+
+  The FireTuple Thrift object defines properties of a single fire or multiple
+  fires. In this step, it represents a single fire. The 'temp330' is set to 1
+  if the fire is greater than 330 degrees Kelvin. The 'conf50' is set to 1 if
+  the fire confidence is greater than 50. If 'temp330' and 'conf50' are both 1,
+  the 'bothPreds' is set to 1. For a single fire, the 'count' is set to 1.
+
+  At the end of this step, we have a single Pail full of DataChunk objects, one
+  per fire, each which represents the fire in MODIS pixel coordinates.
+
+  Note: We received fire data organized into files by month through February
+  2010 from the University of Maryland. These are stored on S3 in the
+  s3://modisfiles/MonthlyFires directory. More recent fire data are organized
+  into daily files. The difference between them is the date formatting and
+  we have functions here to convert between them.
+
+    Daily:  MM/DD/YYYY
+    Monthly: YYYYMMDD"
   (:use cascalog.api
         [forma.date-time :only (convert)])
   (:require [clojure.string :as s]
@@ -8,42 +60,48 @@
             [forma.hadoop.io :as io]
             [forma.hadoop.predicate :as p]))

-;; ### Schema Application
-;;
-;; The fires dataset is different from previous MODIS datasets in that
-;; it requires us to keep track of multiple values for each MODIS
-;; pixel. We must maintain a total fire count, as well as a count of
-;; the subsets of the total that satisfy certain conditions, such as
-;; `Temp > 330 Kelvin`, `Confidence > 50`, or both at once. We
-;; abstract this complication away by wrapping up each of these into a
-;; clojure map. For example:
-;;
-;;    {:temp-330 1
-;;     :conf-50 1
-;;     :both-preds 1
-;;     :count 2}
-;;
-;; compound value, represented as a fire-value. We wrap
-;; up collections of fire values into a timeseries-value.
+(defn daily-datestring
+  "Returns a daily date string formatted as YYYY-MM-DD.

-;; ### Fire Predicates
+   Arguments:
+     date-str - Daily date string formatted as MM/DD/YYYY.

-(defn daily-datestring
-  "Takes a datestring from our daily fire datasets, formatted as
-  `MM/DD/YYYY`, and returns a date formatted as `YYYY-MM-DD`."
-  [datestring]
-  (let [[month day year] (s/split datestring #"/")]
+  Example usage:
+    > (daily->standard 1977/02/02)
+    02-1977-02"
+  [date-str]
+  (let [[month day year] (s/split date-str #"/")]
     (s/join "-" [year month day])))

 (defn monthly-datestring
-  "Takes a datestring from our monthly fire datasets, formatted as
-  `YYYYMMDD`, and returns a date formatted as `YYYY-MM-DD`."
-  [datestring]
-  (convert datestring :basic-date :year-month-day))
+  "Returns a monthly date string formatted as YYYY-MM-DD.
+
+   Arguments:
+     date-str - Monthly date string formatted as YYYYMMDD.
+
+  Example usage:
+    > (monthly->standard 19770202)
+    1977-02-02"
+  [date-str]
+  (convert date-str :basic-date :year-month-day))

 (def fire-characteristics
-  "Predicate macro that converts confidence and temperature into a
-   tuple of fire characteristics."
+  "Returns a Cascalog predicate macro that creates a FireTuple Thrift object.
+
+  Input variables:
+    ?conf - The fire confidence value.
+    ?kelvin - The fire degress in Kelvin
+
+  Output variables:
+    ?tuple - The FireTuple Thrift object.
+
+  Example usage:
+
+    > (let [src [[60 380]]]
+            (??<-
+            [?tuple]
+            (src ?conf ?kelvin)
+            (fire-characteristics ?conf ?kelvin :> ?tuple)))"
   (<- [?conf ?kelvin :> ?tuple]
       (p/full-count ?conf :> ?count)
       (p/filtered-count [330] ?kelvin :> ?temp-330)
@@ -51,20 +109,46 @@
       (p/bi-filtered-count [50 330] ?conf ?kelvin :> ?both-preds)
       (schema/fire-value ?temp-330 ?conf-50 ?both-preds ?count :> ?tuple)))

-;; ## Fire Queries
+(def fire-pred
+ "Returns a Cascalog predicate macro that creates a FireTuple Thrift object.

-(def fire-pred
-  (<- [?s-lat ?s-lon ?s-kelvin ?s-conf :> ?dataset ?t-res ?lat ?lon ?tuple]
+  Input variables:
+    ?s-lat - The string latitude for the fire.
+    ?s-lon - The string latitude for the fire.
+    ?s-kelvin - The string kelvin value for the fire.
+    ?s-conf - The string confidence value for the fire.
+
+  Output variables:
+    ?dataset - The fire dataset name (fire).
+    ?t-res - The fire temporal resolution (1 day).
+    ?lat - The fire latitude as a float.
+    ?lon - The fire longitude as a float.
+    ?tuple - The FireTuple Thrift object representing this fire.
+
+  Example usage:
+    > (let [src [[\"1\" \"2\" \"331\" \"51\"]]]
+           (??<-
+            [?dataset ?t-res ?lat ?lon ?fire-tuple]
+            (src ?s-lat ?s-lon ?s-kelvin ?s-conf)
+            (fire-pred ?s-lat ?s-lon ?s-kelvin ?s-conf :> ?dataset ?t-res ?lat ?lon ?tuple)))"
+ (<- [?s-lat ?s-lon ?s-kelvin ?s-conf :> ?dataset ?t-res ?lat ?lon ?tuple]
       (utils/strings->floats ?s-lat ?s-lon ?s-kelvin ?s-conf
                              :> ?lat ?lon ?kelvin ?conf)
       (p/add-fields "fire" "01" :> ?dataset ?t-res)
       (fire-characteristics ?conf ?kelvin :> ?tuple)))

 (defn fire-source-monthly
-  "Takes a source of monthly fire textlines from before , and returns
-  tuples with dataset, date, position and value all defined. In this
-  case, the value `?tuple` is a fire-value containing all relevant
-  characteristics of fires for that particular day."
+  "Returns a Cascalog query that creates tuples for monthly fires.
+
+  Source:
+    src - An hfs-textline of monthly fires (datestring _ _ s-lat s-lon s-kelvin _ _ _ s-conf)
+
+  Output variables:
+    ?dataset - The dataset name (fires).
+    ?date - The fire date formatted as YYYY-MM-DD.
+    ?t-res - The fire temporal resolution (1).
+    ?lat - The fire latitude as a float.
+    ?lon - The fire longitude as a float."
   [src]
   (<- [?dataset ?date ?t-res ?lat ?lon ?tuple]
       (src ?line)
@@ -76,10 +160,18 @@
       (:distinct false)))

 (defn fire-source-daily
-  "Takes a source of textlines, and returns tuples with dataset, date,
-  position and value all defined. In this case, the value `?tuple` is
-  a fire-value containing all relevant characteristics of fires for
-  that particular day."
+  "Returns a Cascalog query that creates tuples for daily fires.
+
+  Source:
+    src - An hfs-textline of daily fires (lat lon kelvin _ _ date _ _ conf _ _ _)
+
+  Output variables:
+    ?dataset - The dataset name (fires).
+    ?date - The fire date formatted as YYYY-MM-DD.
+    ?t-res - The fire temporal resolution (1).
+    ?lat - The fire latitude as a float.
+    ?lon - The fire longitude as a float.
+    ?tuple - The FireTuple Thrift object representing the fire."
   [src]
   (<- [?dataset ?date ?t-res ?lat ?lon ?tuple]
       (src ?line)
@@ -90,8 +182,7 @@
       (:distinct false)))

 (defn reproject-fires
-  "Aggregates fire data at the supplied path by modis pixel at the
-  supplied resolution."
+  "Returns a Cascalog query that creates DataChunk Thrift objects for fires."
   [m-res src]
   (<- [?datachunk]
       (p/add-fields m-res :> ?m-res)


fix for Sundew trigger

fix for Sundew trigger

--- src/clj/game/cards-assets.clj
+++ src/clj/game/cards-assets.clj
@@ -593,8 +593,7 @@
              :effect (effect (add-prop target :advance-counter 1 {:placed true}))}}

    "Sundew"
-   {:events {:runner-spent-click {:req (req (= (:click runner) (:click-per-turn runner)))
-                                  :once :per-turn
+   {:events {:runner-spent-click {:once :per-turn
                                   :msg (req (when (not this-server) "gain 2 [Credits]"))
                                   :effect (req (when (not this-server)
                                                  (gain state :corp :credit 2)))}}}


Make temporary workaround for axidraw bug

--- src/clj/genartlib/capture.clj
+++ src/clj/genartlib/capture.clj
@@ -141,6 +141,33 @@

        (.write wrt# "  </g>\n</svg>\n"))))

+(defmacro with-plotter-svg-capture-axidraw-workaround
+  "A temporary workaround for an axidraw bug that prevents pausing the plotter
+   in the middle of a multi-segment curve"
+  [output-file width height & body]
+  `(let [commands# (capture-helper ~@body)]
+     (println "Going to write SVG at" ~output-file)
+     (with-open [wrt# (writer ~output-file)]
+       (.write wrt# (format svg-opening ~width ~height (int (w)) (int (h))))
+       (doseq [cmd# commands#]
+         (try
+           (case (:type cmd#)
+             :line
+             (when (:stroke cmd#)
+               (.write wrt# (make-path [[(w (:start-x cmd#)) (h (:start-y cmd#))]
+                                        [(w (:end-x cmd#)) (h (:end-y cmd#))]])))
+
+             :shape
+             (when (:stroke cmd#)
+               (doseq [[p1# p2#] (partition 2 1 (:points cmd#))]
+                 (.write wrt# (make-path [[(w (:x p1#)) (h (:y p1#))]
+                                          [(w (:x p2#)) (h (:y p2#))]]))))
+
+             ; else
+             nil)))
+
+       (.write wrt# "  </g>\n</svg>\n"))))
+
 (defn command-replay
   ([cmds] (command-replay cmds (w) (h) 0 0))
   ([cmds full-width full-height] (command-replay cmds full-width full-height 0 0))


Add basic SVG capture

Add basic SVG capture

--- src/clj/genartlib/capture.clj
+++ src/clj/genartlib/capture.clj
@@ -1,9 +1,12 @@
 (ns genartlib.capture
-  (:require [clojure.pprint :refer [pprint]]
+  (:require [clojure.java.io :refer [writer]]
+            [clojure.pprint :refer [pprint]]
+            [clojure.string :as s]
+            [genartlib.util :refer [w h]]
             [quil.core :as q]))

-(defmacro with-command-capture
-  [output-file & body]
+(defmacro capture-helper
+  [& body]
   `(let [full-width# (w 1.0)
          full-height# (h 1.0)
          commands# (atom [])
@@ -96,8 +99,47 @@
                                                       :color color#}])
                                   (apply og-background# color#))]
        ~@body)
+     @commands#))
+
+(defn with-command-capture
+  [output-file & body]
+  `(let [commands# (capture-helper ~@body)]
      (println "Going to save commands to" ~output-file)
-     (pprint @commands# (clojure.java.io/writer ~output-file))))
+     (pprint commands# (clojure.java.io/writer ~output-file))))
+
+(def svg-opening
+  "<svg xmlns:svg=\"http://www.w3.org/2000/svg\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" width=\"%s\" height=\"%s\" viewBox=\"0 0 %d %d\">\n  <g fill=\"none\" stroke=\"#000000\" stroke-width=\"1\">\n")
+
+(defn make-path
+  [points]
+  (->> points
+       (map #(s/join "," %))
+       (s/join " ")
+       (format "    <path d=\"M %s\"/>\n")))
+
+(defmacro with-plotter-svg-capture
+  [output-file width height & body]
+  `(let [commands# (capture-helper ~@body)]
+     (println "Going to write SVG at" ~output-file)
+     (with-open [wrt# (writer ~output-file)]
+       (.write wrt# (format svg-opening ~width ~height (int (w)) (int (h))))
+       (doseq [cmd# commands#]
+         (try
+           (case (:type cmd#)
+             :line
+             (when (:stroke cmd#)
+               (.write wrt# (make-path [[(w (:start-x cmd#)) (h (:start-y cmd#))]
+                                        [(w (:end-x cmd#)) (h (:end-y cmd#))]])))
+
+             :shape
+             (when (:stroke cmd#)
+               (.write wrt# (make-path (for [p# (:points cmd#)]
+                                         [(w (:x p#)) (h (:y p#))]))))
+
+             ; else
+             nil)))
+
+       (.write wrt# "  </g>\n</svg>\n"))))

 (defn command-replay
   ([cmds] (command-replay cmds (w) (h) 0 0))


GM: Remove some code to get the test working

--- src/clj/ona/viewer/routes.clj
+++ src/clj/ona/viewer/routes.clj
@@ -29,10 +29,6 @@

 #_(defroutes dataset-routes
   (context "/:owner" [owner]
-           (GET "/forms"
-                {{:keys [account]} :session
-                 {xhr? :xhr} :params}
-                (datasets/list account owner project-id xhr?))
            (context "/:dataset-id" [dataset-id]
                     (GET "/"
                          {{:keys [account]} :session}


Don't shade fire or lava during night

Don't shade fire or lava during night

--- src/cljc/robinson/render.cljc
+++ src/cljc/robinson/render.cljc
@@ -1216,7 +1216,8 @@
                                                                    ["\u01c1" (color->rgb :black) (color->rgb :brown)]))
                                                              :else
                                                                out-char)
-                                           shaded-out-char (if (= (get cell :discovered) current-time)
+                                           shaded-out-char (if (and (= (get cell :discovered) current-time)
+                                                                    (not (contains? #{:fire :lava} (get cell :type))))
                                                              (update-in shaded-out-char
                                                                         [1]
                                                                         (fn [c]


Support advanced compilation mode

Support advanced compilation mode

Using `aget` doesn't work with ClojureScript advanced compilation
mode. This PR fixes the problem by using the fully qualified symbol
names for `start` and `stop`.

--- src/cljx/quile/component.cljx
+++ src/cljx/quile/component.cljx
@@ -155,7 +155,7 @@
   ([system]
     (start-system system (keys system)))
   ([system component-keys]
-    (update-system system component-keys #+clj #'start #+cljs (aget quile.component "start"))))
+    (update-system system component-keys #+clj #'start #+cljs quile.component/start)))

 (defn stop-system
   "Recursively stops components in the system, in reverse dependency
@@ -165,7 +165,7 @@
   ([system]
      (stop-system system (keys system)))
   ([system component-keys]
-     (update-system-reverse system component-keys #+clj #'stop #+cljs (aget quile.component "stop"))))
+     (update-system-reverse system component-keys #+clj #'stop #+cljs quile.component/stop)))

 (defrecord SystemMap []
   Lifecycle


Added functionality for circuit breaker configs to be change from clojure

--- src/clojure/fault/service.clj
+++ src/clojure/fault/service.clj
@@ -1,7 +1,9 @@
 (ns fault.service
   (:import (fault ServiceExecutor)
-           (fault.circuit CircuitBreaker BreakerConfig)
+           (fault.circuit CircuitBreaker BreakerConfig BreakerConfig$BreakerConfigBuilder)
            (clojure.lang ILookup)))
+
+(set! *warn-on-reflection* true)

 (deftype CLJBreaker [^CircuitBreaker breaker]
   ILookup
@@ -15,6 +17,17 @@
                  :time-to-pause-millis (.timeToPauseMillis config)})
       default)))

+(defn swap-breaker-config
+  [{:keys [circuit-breaker]}
+   {:keys [time-period-in-millis failure-threshold time-to-pause-millis]}]
+  (.setBreakerConfig
+    ^CircuitBreaker circuit-breaker
+    ^BreakerConfig (doto (BreakerConfig$BreakerConfigBuilder.)
+                     (.timePeriodInMillis time-period-in-millis)
+                     (.failureThreshold failure-threshold)
+                     (.timeToPauseMillis time-to-pause-millis)
+                     (.build))))
+
 (defn service-executor [pool-size]
   (let [executor (ServiceExecutor. pool-size)]
     {:service executor


Allow toggle button to be focused

Allow toggle button to be focused

--- src/clojure/nightmod/core.clj
+++ src/clojure/nightmod/core.clj
@@ -135,7 +135,6 @@
                            (show-internal-editor! main-window editor-window)))
         window-btn (ui/button :id :window
                               :text (nc-utils/get-string :toggle-window)
-                              :focusable? false
                               :listen [:action toggle-window!])]
     (.addWindowListener editor-window
       (proxy [WindowAdapter] []


Clearer description of update problem

Clearer description of update problem

--- src/dat/sys/client/views.cljs
+++ src/dat/sys/client/views.cljs
@@ -72,7 +72,8 @@
     [re-com/v-box
      :margin "20px 5px 5px"
      :children [[:h2 "Todos"]
-                [:p "Below are forms and views for each todo item in the database"]
+                [:p "Below are forms and views for each todo item in the database:"]
+                [:p "(There should be stuff showing up here, but there isn't just yet)"]
                 (for [todo todo-eids]
                   ^{:key todo}
                   [:div {:style {:margin "20px 5px"}}
@@ -92,7 +93,16 @@
    :children [[:h1 "Datsys"]
               [:p {:style {:font-size "18px"}} "Congrats! You've got a Datsys app running :-)"]
               ;; A debug example:
-              [dat.view/debug "todo instance eids:" @(type-instance-eids-rx app :e.type/Todo)]
+              ;[dat.view/debug "todo instance eids:" @(type-instance-eids-rx app :e.type/Todo)]
+              [dat.view/debug "Here's a debug example:"
+               @(posh/q (:conn app)
+                        ;; XXX TODO Note that changing the query here from ?t to ?t-ident doesn't update until you
+                        ;; reload the page. Also other errors... Should be updating the view dynamically
+                        '[:find ?e ?t-ident
+                        ;'[:find ?e ?t
+                          :where [?e :e/type ?t]
+                                 [?t :db/ident ?t-ident]])]
+              [:p "(This should be dynamically updating when we update the query but it isn't)"]
               ;[dat.view/debug "Here's a debug example:"
                ;@(posh/q (:conn app) '[:find ?e ?t
                                       ;:where [?e :e/type ?t]


Fixing the small provider migration so that it creates tables consistent with other concept tables at that time.

--- metadata-db-app/src/migrations/016_add_small_to_provider_table.clj
+++ metadata-db-app/src/migrations/016_add_small_to_provider_table.clj
@@ -1,9 +1,69 @@
 (ns migrations.016-add-small-to-provider-table
-  "Adds small field to provider table"
+  "Adds small field to provider table and creates the small provider concept tables. The sql must be
+  hard coded here so that the small concepts table matches the other concept tables at the time this
+  migration was written. Subsequent migrations will modify all of the concept tables in the same way.
+  If we were to just reference out to the current code to create the concept tables it would create
+  the tables differently depending on what changes had been made. This would cause subsequent
+  migrations to fail."
   (:require [clojure.java.jdbc :as j]
             [config.migrate-config :as config]
             [config.mdb-migrate-helper :as h]
             [cmr.metadata-db.data.oracle.concept-tables :as ct]))
+
+(def create-collection-sql
+  "CREATE TABLE small_prov_collections (
+    id NUMBER,
+    concept_id VARCHAR(255) NOT NULL,
+    native_id VARCHAR(1030) NOT NULL,
+    metadata BLOB NOT NULL,
+    format VARCHAR(255) NOT NULL,
+    revision_id INTEGER DEFAULT 1 NOT NULL,
+    revision_date TIMESTAMP WITH TIME ZONE DEFAULT SYSTIMESTAMP NOT NULL,
+    deleted INTEGER DEFAULT 0 NOT NULL,
+    short_name VARCHAR(85) NOT NULL,
+    version_id VARCHAR(80),
+    entry_id VARCHAR(255) NOT NULL,
+    entry_title VARCHAR(1030) NOT NULL,
+    delete_time TIMESTAMP WITH TIME ZONE,
+    provider_id VARCHAR(255) NOT NULL,
+    CONSTRAINT small_prov_collections_pk PRIMARY KEY (id),
+    CONSTRAINT small_prov_collections_con_rev
+      UNIQUE (provider_id, native_id, revision_id)
+      USING INDEX (create unique index small_prov_collections_ucr_i
+                          ON small_prov_collections(provider_id, native_id, revision_id)),
+    CONSTRAINT small_prov_collections_cid_rev
+      UNIQUE (concept_id, revision_id)
+      USING INDEX (create unique index small_prov_collections_cri
+                          ON small_prov_collections(concept_id, revision_id)))")
+
+
+(def create-granule-sql
+  "CREATE TABLE small_prov_granules (id NUMBER,
+     concept_id VARCHAR(255) NOT NULL,
+     native_id VARCHAR(250) NOT NULL,
+     parent_collection_id VARCHAR(255) NOT NULL,
+     metadata BLOB NOT NULL,
+     format VARCHAR(255) NOT NULL,
+     revision_id INTEGER DEFAULT 1 NOT NULL,
+     revision_date TIMESTAMP WITH TIME ZONE DEFAULT SYSTIMESTAMP NOT NULL,
+     deleted INTEGER DEFAULT 0 NOT NULL,
+     delete_time TIMESTAMP WITH TIME ZONE,
+     granule_ur VARCHAR(250),
+     provider_id VARCHAR(255) NOT NULL,
+     CONSTRAINT small_prov_granules_pk PRIMARY KEY (id),
+     CONSTRAINT small_prov_granules_con_rev
+      UNIQUE (provider_id, native_id, revision_id)
+      USING INDEX (create unique index small_prov_granules_ucr_i
+                          ON small_prov_granules (provider_id, native_id, revision_id)),
+    CONSTRAINT small_prov_granules_cid_rev
+      UNIQUE (concept_id, revision_id)
+      USING INDEX (create unique index small_prov_granules_cri
+                          ON small_prov_granules (concept_id, revision_id)))")
+
+(def create-coll-seq-sql "CREATE SEQUENCE small_prov_collections_seq")
+
+(def create-gran-seq-sql "CREATE SEQUENCE small_prov_granules_seq")
+

 (defn up
   "Migrates the database up to version 16."
@@ -11,22 +71,19 @@
   (println "migrations.016-add-small-to-provider-table up...")
   (h/sql "alter table providers add small INTEGER DEFAULT 0 NOT NULL")
   ;; Create the SMALL_PROV tables and sequence
-  ;; We use a dummy provider (the key is :small true) to invoke the create tables code.
-  (let [db (config/db)]
-    (ct/create-provider-concept-tables db {:provider-id "IGNORED"
-                                           :short-name "IGNORED"
-                                           :cmr-only true
-                                           :small true})))
+  (h/sql create-collection-sql)
+  (h/sql create-coll-seq-sql)
+  (h/sql create-granule-sql)
+  (h/sql create-gran-seq-sql))
+

 (defn down
   "Migrates the database down from version 16."
   []
   (println "migrations.016-add-small-to-provider-table down...")
-  ;; Drop the SMALL_PROV tables and sequence
-  (let [db (config/db)]
-    (ct/delete-provider-concept-tables db {:provider-id "IGNORED"
-                                           :short-name "IGNORED"
-                                           :cmr-only true
-                                           :small true}))
-  (h/sql "alter table providers drop column small"))
+  (h/sql "alter table providers drop column small")
+  (h/sql "drop table small_prov_collections")
+  (h/sql "drop sequence small_prov_collections_seq")
+  (h/sql "drop table small_prov_granules")
+  (h/sql "drop sequence small_prov_granules_seq"))


fix clojure project compile problem

fix clojure project compile problem

--- example/mario-ai-example-clj/project.clj
+++ example/mario-ai-example-clj/project.clj
@@ -2,4 +2,7 @@
   :description "Example Project for Mario AI in clojure, you can use it as template project."
   :dependencies [[org.clojure/clojure "1.3.0"]
                  [ch.idsia/mario-ai "0.0.1-SNAPSHOT"]]
+  :repositories {"mario-ai repos" "http://zerg000000.github.com/mario-ai/repository"}
+  ;need to specify namespace which have gen-class
+  :aot [mario-ai-example-clj.agents]
   :main mario-ai-example-clj.core)


Do not expose trial-token

Do not expose trial-token

--- src/cider_ci/api/resources/trial.clj
+++ src/cider_ci/api/resources/trial.clj
@@ -30,7 +30,7 @@
   (let [trial-id (-> request :params :id)
         trial (first (jdbc/query (rdbms/get-ds) ["SELECT * from trials WHERE id = ?" trial-id]))]
     (when trial
-      {:body trial})))
+      {:body (dissoc trial :token)})))


[REVAMP DS TEMP COMMIT]

[REVAMP DS TEMP COMMIT]

Signed-off-by: Pang Yan Han <22594c345857f664c61cd411f607c4d40a9d4af9@gmail.com>

--- src/cljs/cljs_nusmods/timetable.cljs
+++ src/cljs/cljs_nusmods/timetable.cljs
@@ -6,6 +6,22 @@
             [clojure.string]
             [cljs-nusmods.select2 :as select2]
             [cljs-nusmods.time    :as time-helper]))
+
+; Data type Definitions
+; =====================
+;
+; TimetableLessonInfo (short form: ttLessonInfo)
+; ----------------------------------------------
+; Describes a lesson in the `Timetable` global.
+; Each instance is a map in the following format:
+;
+;   {
+;     :moduleCode  -> module code string of this lesson
+;     :lessonType  -> lesson type string of this lesson
+;     :lessonGroup -> lesson group string of this lesson
+;     :startTime   -> 0-indexed start time of the lesson
+;     :endTime     -> 0-indexed end time of the lesson
+;   }

 (def ^{:doc     "Width in pixels of a half hour timeslot"
        :private true
@@ -52,8 +68,7 @@
                              :rowNum    -> 0-indexed <tr> where the lesson is
                                            stored
                              :startTime -> 0-indexed start time of lesson
-                             :endTime   -> 0-indexed end time of lesson
-                             :divElem   -> jQuery <div> of the lesson}
+                             :endTime   -> 0-indexed end time of lesson}
               }
        }"
   :private true
@@ -161,32 +176,11 @@
 (defn- create-empty-timetable-row
   "Creates an in-memory representation of an empty timetable row.

-   Each row corresponds to a <tr> in the timetable. Each row is a map of the
-   following format:
-
-       {
-         :nrLessons (integer representing the number of lesson groups
-                     occupying the current row)
-         :occupied  a vector of timeslots from 0800 to 2330 (inclusive)
-                    in 30 min intervals. Each slot is one of:
-                    - nil. The means that the slot is free
-                    - a map of module information:
-                      {
-                        :moduleCode -> module code string
-                        :lessonType -> lesson type string (long form),
-                        :lessonGroup -> Lesson group string (lesson label)
-                        :index       -> index to the list of lessons for
-                                        that lesson group.
-                      }
-                      This information can be used to access the <div> in
-                      the `ModulesSelected` global during module removal
-                      or lesson shifting.
-       }"
+   Each row corresponds to a <tr> in the timetable. Each row is a map
+   with each key is a `TimetableLessonInfo` object (see the top of this file for
+   the definition) and each value is the jQuery object of the lesson <div>."
   []
-  {
-    :nrLessons 0,
-    :occupied  (vec (map (fn [t] nil) (range 800 2400 50)))
-  })
+  {})

 (defn- create-day-repr
   "Creates in-memory representation of a single day in the timetable.
@@ -265,31 +259,22 @@
         thElem (.find (nth HTML-Timetable day) "tr > th")]
     (attr thElem "rowspan" nrRows)))

-(defn- timetable-mark-lesson-slots-occupied
-  "Given a 0-indexed row number obtained by `find-free-row-for-lesson`, marks
-   the timeslots for the lesson in that row as occupied."
-  [day rowNum startTime endTime modInfo]
+(defn- timetable-add-lesson
+  "Adds a lesson to the `Timetable` global, effectively 'marking' the
+   time interval for that lesson as being occupied."
+  [day rowNum ttLessonInfo $lessonDiv]
   (set! Timetable
-        (update-in
-          Timetable [day rowNum]
-          (fn [ttRow]
-            {
-              :nrLessons (inc (:nrLessons ttRow))
-              :occupied       (reduce (fn [occupiedVec idx]
-                                        (assoc occupiedVec idx modInfo))
-                                      (:occupied ttRow)
-                                      (range startTime endTime))
-            }))))
-
-(defn- timetable-mark-lesson-slots-free
-  "Marks the timeslots for a lesson as free. The `lessonInfo` parameter must be
-   a map with the following keys:
-
-     :day       -> 0-indexed day
-     :row       -> 0-indexed row in the day
-     :startTime -> 0-indexed start time of the lesson
-     :endTime   -> 0-indexed end time of the lesson"
-  [lessonInfo]
+        (update-in Timetable
+                   [day rowNum]
+                   (fn [ttRow]
+                     (assoc ttRow ttLessonInfo $lessonDiv)))))
+
+; TODO - update this function
+; It was formerly called timetable-mark-lesson-slots-free
+(defn- timetable-remove-lesson
+  "Removes a lesson from the `Timetable` global, effectively 'marking' the
+   time interval occupied by that lesson as free."
+  [day row ttLessonInfo]
   (let [day         (:day lessonInfo)
         row         (:rowNum lessonInfo)
         startTime   (:startTime lessonInfo)
@@ -310,32 +295,49 @@
   "Returns the 0-indexed row which can accomodate the given lesson (timeslots
    for the lesson are not occupied). If no existing row can accomodate the
    lesson, then the total number of existing rows is returned to indicate that
-   a new row must be created."
-  [lesson]
-  (let [ttDay     (get-timetable-day (:day lesson))
-        startTime (:startTime lesson)
-        endTime   (:endTime lesson)]
+   a new row must be created.
+
+   The `moduleMapLesson` parameter should be a lesson from the `ModulesMap`
+   global"
+  [moduleMapLesson]
+  (let [ttDay     (get-timetable-day (:day moduleMapLesson))
+        startTime (:startTime moduleMapLesson)
+        endTime   (:endTime moduleMapLesson)]
     (:rowIndex
       (reduce
-        (fn [result row]
+        (fn [result ttRow]
           (cond
-            (:foundFreeRow result)
-            result
-
-            (zero? (:nrLessons row))
+            (:foundFreeRow result) result
+            (zero? (count ttRow))  (assoc result :foundFreeRow true)
+
+            (empty?
+              ; Find any existing lessons which overlap with our new lesson.
+              ; The row is free if there are no existing overlapping lessons.
+              ; 4 types of overlap:
+              ;
+              ; ONE:
+              ;        |-- exist --|
+              ; |-- new --|
+              ;
+              ; TWO:
+              ; |-- exist --|
+              ;       |-- new --|
+              ;
+              ; THREE:
+              ;     |-- exist --|
+              ; |------- new -------|
+              ;
+              ; FOUR:
+              ; |------- exist -------|
+              ;      |-- new --|
+              (filter (fn [[ttLessonInfo _]]
+                        (and (>= (dec endTime) (:startTime ttLessonInfo))
+                             (< startTime (:endTime ttLessonInfo))))
+                      ttRow))
             (assoc result :foundFreeRow true)

-            (not (some (fn [x] (not (nil? x)))
-                       (map (fn [timeIdx] (nth (:occupied row) timeIdx))
-                            (range startTime endTime))))
-            (assoc result :foundFreeRow true)
-
-            :else
-            (update-in result [:rowIndex] inc)))
-        {
-          :foundFreeRow false
-          :rowIndex     0
-        }
+            :else (update-in result [:rowIndex] inc)))
+        {:foundFreeRow false, :rowIndex 0}
         ttDay))))

 (defn- get-css-hour-minute-classes-for-time
@@ -350,39 +352,42 @@
 (defn- add-module-lesson
   "Adds a single lesson of a module (obtained from the `ModulesMap` global) to
    the timetable, and returns its jQuery div element."
-  [moduleCode moduleName lessonType lessonLabel lesson lessonIdx
-   bgColorCssClass]
-  (let [rowNum      (find-free-row-for-lesson lesson)
-        day         (:day lesson)
-        startTime   (:startTime lesson)
-        endTime     (:endTime lesson)
-        slotsOcc    (- endTime startTime)
-        divElem     ($ "<div />" (js-obj "class" "lesson"))
-        [hourClass minuteClass] (get-css-hour-minute-classes-for-time
-                                  startTime)]
+  [moduleCode moduleName lessonType lessonLabel lesson bgColorCssClass]
+  (let [rowNum    (find-free-row-for-lesson lesson)
+        day       (:day lesson)
+        startTime (:startTime lesson)
+        endTime   (:endTime lesson)
+        slotsOcc  (- endTime startTime)
+        $divElem  ($ "<div />" (js-obj "class" "lesson"))
+
+        [hourClass minuteClass]
+        (get-css-hour-minute-classes-for-time startTime)]
     ; Create new row if necessary
     (if (= rowNum (get-nr-rows-in-timetable-day day))
         (add-new-row-to-timetable-day day))

     ; Update in-memory representation of timetable
-    (timetable-mark-lesson-slots-occupied
-      day rowNum startTime endTime
-      {:moduleCode moduleCode, :lessonType lessonType, :lessonGroup lessonLabel,
-       :index lessonIdx})
+    (timetable-add-lesson day rowNum
+                          {:moduleCode moduleCode,
+                           :lessonType lessonType,
+                           :lessonGroup lessonLabel,
+                           :startTime startTime,
+                           :endTime endTime}
+                          $divElem)

     ; add background color css class
-    (.addClass divElem bgColorCssClass)
-    (.append divElem (text ($ "<p />") (str moduleCode " " moduleName)))
-    (.append divElem (text ($ "<p />") (str lessonType " [" lessonLabel "]")))
-    (.append divElem (text ($ "<p />") (:venue lesson)))
-    (width divElem (str (* half-hour-pixels slotsOcc) "px"))
+    (.addClass $divElem bgColorCssClass)
+    (.append $divElem (text ($ "<p />") (str moduleCode " " moduleName)))
+    (.append $divElem (text ($ "<p />") (str lessonType " [" lessonLabel "]")))
+    (.append $divElem (text ($ "<p />") (:venue lesson)))
+    (width $divElem (str (* half-hour-pixels slotsOcc) "px"))
     (let [dayHTMLElem (nth HTML-Timetable day)
           rowHTMLElem (nth (children dayHTMLElem "tr") rowNum)
           tdHTMLElem  (nth (children
                              rowHTMLElem
                              (str "td" "." hourClass "." minuteClass))
                            0)]
-      (.append tdHTMLElem divElem)
+      (.append tdHTMLElem $divElem)
       ; Increase colspan and delete the <td> after it that occupy the timeslot
       ; of the lesson
       (attr tdHTMLElem "colspan" slotsOcc)
@@ -392,7 +397,7 @@
       ; Returns a map containing information to make it easier to remove the
       ; lesson
       {:day day, :rowNum rowNum, :startTime startTime, :endTime endTime,
-       :divElem divElem})))
+       :divElem $divElem})))

 (defn- add-module-lesson-group
   "Adds a lesson group of a module to the timetable."
@@ -404,6 +409,7 @@
                                        lessonLabel])]
     (if (and moduleName lessons)
         (let [lessonInfoSeq (doall
+                              ; remove lessonIdx
                               (map (fn [[lessonIdx lesson]]
                                      (add-module-lesson moduleCode
                                                         moduleName


Use the monospace font for numeric displays

--- src/clojure/warreq/kea/calc/util.clj
+++ src/clojure/warreq/kea/calc/util.clj
@@ -1,5 +1,6 @@
 (ns warreq.kea.calc.util
-  (:require [neko.context :refer [get-service]]))
+  (:require [neko.context :refer [get-service]])
+  (:import android.graphics.Typeface))

 (defn vibrate! [n]
   "Vibrate phone for n seconds. Convenience function for avoiding use of
@@ -13,6 +14,7 @@
   [:text-view (merge {:id id
                       :text-size 34.0
                       :layout-height 60
+                      :typeface android.graphics.Typeface/MONOSPACE
                       :gravity :right
                       :layout-width :fill}
                      cfg)])


Do not gather up true/false/null in vectors

This also should yield a slight performance improvement, but also very
hard to measure.

--- src/main/clojure/clojure/data/json.clj
+++ src/main/clojure/clojure/data/json.clj
@@ -142,29 +142,26 @@
            \" (read-json-quoted-string stream)

            ;; Read null as nil
-           \n (let [ull [(.read stream)
-                         (.read stream)
-                         (.read stream)]]
-                (if (= ull [(codepoint \u) (codepoint \l) (codepoint \l)])
-                  nil
-                  (throw (Exception. (str "JSON error (expected null): " c ull)))))
+           \n (if (and (= (codepoint \u) (.read stream))
+                       (= (codepoint \l) (.read stream))
+                       (= (codepoint \l) (.read stream)))
+                nil
+                (throw (Exception. (str "JSON error (expected null)"))))

            ;; Read true
-           \t (let [rue [(.read stream)
-                         (.read stream)
-                         (.read stream)]]
-                (if (= rue [(codepoint \r) (codepoint \u) (codepoint \e)])
-                  true
-                  (throw (Exception. (str "JSON error (expected true): " c rue)))))
+           \t (if (and (= (codepoint \r) (.read stream))
+                       (= (codepoint \u) (.read stream))
+                       (= (codepoint \e) (.read stream)))
+                true
+                (throw (Exception. (str "JSON error (expected true)"))))

            ;; Read false
-           \f (let [alse [(.read stream)
-                          (.read stream)
-                          (.read stream)
-                          (.read stream)]]
-                (if (= alse [(codepoint \a) (codepoint \l) (codepoint \s) (codepoint \e)])
-                  false
-                  (throw (Exception. (str "JSON error (expected false): " c alse)))))
+           \f (if (and (= (codepoint \a) (.read stream))
+                       (= (codepoint \l) (.read stream))
+                       (= (codepoint \s) (.read stream))
+                       (= (codepoint \e) (.read stream)))
+                false
+                (throw (Exception. (str "JSON error (expected false)"))))

            ;; Read JSON objects
            \{ (read-json-object stream keywordize?)


Changed exception message for EOF in string literal

Signed-off-by: Stuart Sierra <1d6e1cf70ec6f9ab28d3ea4b27a49a77654d370e@stuartsierra.com>

--- src/main/clojure/clojure/data/json.clj
+++ src/main/clojure/clojure/data/json.clj
@@ -133,7 +133,7 @@
     (loop []
       (let [c (.read stream)]
         (when (neg? c)
-          (throw (EOFException. "JSON error (end-of-file inside array)")))
+          (throw (EOFException. "JSON error (end-of-file inside string)")))
         (codepoint-case c
           \" (str buffer)
           \\ (do (.append buffer (read-escaped-char stream))


Replace :nested-doc with plain :doc in 'describe'

--- src/main/clojure/lazytest/describe.clj
+++ src/main/clojure/lazytest/describe.clj
@@ -16,7 +16,7 @@

 (defn- merged-metadata [body form docstring extra-attr-map]
   (merge (when (empty? body) {:pending true})
-	 {:nested-doc docstring, :file *file*, :ns *ns*}
+	 {:doc docstring, :file *file*, :ns *ns*}
 	 (meta form)
 	 extra-attr-map))


Make invite events work for both vcs types

--- src-cljs/frontend/components/invites.cljs
+++ src-cljs/frontend/components/invites.cljs
@@ -18,7 +18,8 @@
   (->> users
        (filter (fn [u] (and (:email u)
                             (:checked u))))
-       (map (fn [u] (select-keys u [:email :login :id])))
+       ;; select both login and id (GitHub) and username and uuid (Bitbucket)
+       (map (fn [u] (select-keys u [:email :login :username :id :uuid])))
        vec))

 (defn invite-tile [user owner]
@@ -70,10 +71,10 @@
            [:button.btn.btn-success (let [users-to-invite (invitees users)]
                                       {:data-success-text "Sent"
                                        :on-click #(raise! owner [:invited-github-users
-                                                                 (merge {:invitees users-to-invite}
+                                                                 (merge {:invitees users-to-invite
+                                                                         :vcs_type (:vcs_type opts)}
                                                                         (if (:project-name opts)
-                                                                          {:project-name (:project-name opts)
-                                                                           :vcs-type (:vcs-type opts)}
+                                                                          {:project-name (:project-name opts)}
                                                                           {:org-name (:org-name opts)}))])})

             "Send Invites "
@@ -84,8 +85,8 @@
     om/IWillMount
     (will-mount [_]
       (let [project-name (:project-name opts)
-            vcs-type (:vcs-type opts)]
-        (raise! owner [:load-first-green-build-github-users {:vcs-type vcs-type
+            vcs_type (:vcs_type opts)]
+        (raise! owner [:load-first-green-build-github-users {:vcs_type vcs_type
                                                              :project-name project-name}])))
     om/IRender
     (render [_]


Make results more readible in dark theme

--- planck-cljs/src/planck/themes.cljs
+++ planck-cljs/src/planck/themes.cljs
@@ -25,7 +25,7 @@

 (def ^:private dark
   (merge theme-ansi-base
-    {:results-fn   ansi/blue
+    {:results-fn   ansi/bold-blue
      :ex-msg-fn    ansi/bold-red
      :ex-stack-fn  ansi/green
      :err-font     ansi/red-font


4Clojure problem 78

4Clojure problem 78

--- src/fourclojure/4_clojure.clj
+++ src/fourclojure/4_clojure.clj
@@ -1,6 +1,6 @@
 (ns fourclojure.4-clojure)

-;problem 69
+;problem 69 merge with function
 ((fn [f & ms]
    (into {} (for [[k v]
                   (group-by first
@@ -8,14 +8,14 @@
                               [k v]))]
               {k (reduce f (map second v))}))) concat {:a [3], :b [6]} {:a [4 5], :c [8 9]} {:b [7]})

-;problem 70
+;problem 70 camel casing
 ((fn [s]
    (let [[a & others] (clojure.string/split s (re-pattern "-"))]
      (apply str a
             (map #(let [[x & ys] %]
                     (apply str (Character/toUpperCase x) ys)) others)))) "multi-word-key")

-;problem 75
+;problem Euler's totient function
 ((fn [x] (letfn [(gcd [a b]
                    (loop [ia a ib b]
                      (if (= ib 0)
@@ -23,7 +23,7 @@
                        (recur ib (mod ia ib)))))]
            (count (filter #(= 1 (gcd % x)) (range 1 (inc x)))))) 99)

-;problem 86
+;problem 86 happy numbers
 ((fn [x]
    (letfn [(square-ch [y] (let [n (Integer/parseInt (str y))] (* n n)))]
      (loop [s (str x) ctrl #{}]
@@ -32,4 +32,14 @@
          (cond
            (= s2 1) true
            (ctrl s2) false
-           :else (recur (str s2) (conj ctrl s2))))))) 7)+           :else (recur (str s2) (conj ctrl s2))))))) 7)
+
+;problem 78 reimplement trampoline
+(letfn [(triple [x] #(sub-two (* 3 x)))
+        (sub-two [x] #(stop?(- x 2)))
+        (stop? [x] (if (> x 50) x #(triple x)))]
+  ((fn my-trampo [f & args]
+     (loop [g (apply f args)]
+       (if (ifn? g)
+         (recur (g))
+         g))) triple 2))


custom domain handler just adds fields to the request map

--- src/pc/http/handlers/custom_domain.clj
+++ src/pc/http/handlers/custom_domain.clj
@@ -1,29 +1,24 @@
 (ns pc.http.handlers.custom-domain
   (:require [cemerick.url :as url]
-            [pc.http.urls :as urls]
-            [pc.profile :as profile]
-            [ring.middleware.anti-forgery]))
+            [pc.datomic :as pcd]
+            [pc.models.team :as team-model]
+            [pc.profile :as profile]))

+;; XXX: redirect for things on the protected list
 (def blacklist #{"www" "admin"})

 (defn parse-subdomain [req]
   (last (re-find (re-pattern (str "(.+)\\." (profile/hostname)))
                  (:server-name req))))

+(defn handle-custom-domains [handler req]
+  (let [subdomain (parse-subdomain req)]
+    (if-not subdomain
+      (handler req)
+      (handler (assoc req
+                      :subdomain subdomain
+                      :team (team-model/find-by-subdomain (pcd/default-db) subdomain))))))
+
 (defn wrap-custom-domains [handler]
   (fn [req]
-    (if-let [subdomain (parse-subdomain req)]
-      (cond
-        (get-in req [:auth :cust])
-        {:status 200
-         :body (str "Hi " (get-in req [:auth :cust :cust/email]) "!")}
-
-        (= "/auth/google" (:uri req))
-        (handler req)
-
-        :else
-        {:status 200
-         :body (format "Log in with Google"
-                       (urls/make-url "/login" :query (url/map->query {:redirect-subdomain subdomain
-                                                                       :redirect-csrf-token ring.middleware.anti-forgery/*anti-forgery-token*})))})
-      (handler req))))
+    (handle-custom-domains handler req)))


Changed minzoom

Changed minzoom

--- src/cljs/travel_site/components/city.cljs
+++ src/cljs/travel_site/components/city.cljs
@@ -36,7 +36,6 @@
   (reify
     om/IRender
     (render [_]
-      (js/console.log (clj->js transit-step))
       (html [:li
              [:b (:instructions transit-step)]
              [:i (str " (" (-> transit-step :distance :text) " - " (-> transit-step :duration :text) ")")]
@@ -276,7 +275,8 @@
                                 :mapTypeControl false
                                 :streetViewControl false
                                 :styles constants/map-style-arr
-                                :zoom 9})]
+                                :zoom 9
+                                :minZoom 9})]
           (om/set-state! owner :google-map google-map)
           (om/set-state! owner :google-directions-service google-directions-service)
           (gen-new-renderers owner transit-journey show-vehicle-icons)


added response content-type to logging middleware

--- src/clojure/picard/middleware/logging.clj
+++ src/clojure/picard/middleware/logging.clj
@@ -33,13 +33,16 @@
          (fn [evt val]
            (cond
             (= :response evt)
-            (let [status (response-status val)
+            (let [[status hdrs body :as response] val
+                  status (response-status response)
+                  content-type (content-type hdrs)
                   chunk-size (body-size evt val)]
               (swap!
                state
                (fn [info]
                  (assoc info
                    :response-status status
+                   :content-type content-type
                    :response-body-size
                    (+ (info :response-body-size)
                       chunk-size)))))


Adding ? to predicate

Adding ? to predicate

--- src/kixi/datastore/elasticsearch.clj
+++ src/kixi/datastore/elasticsearch.clj
@@ -90,7 +90,7 @@

 (def apply-attempts 10)

-(defn version-conflict
+(defn version-conflict?
   [resp]
   (some
    #(= "version_conflict_engine_exception"
@@ -113,7 +113,7 @@
                          (merge put-opts
                                 (when (:_version curr)
                                   {:version (:_version curr)})))]
-       (if (and (version-conflict resp)
+       (if (and (version-conflict? resp)
                 (pos? tries))
          (recur (dec tries))
          resp)))))


TCLI-10 port to cljs

TCLI-10 port to cljs

--- src/main/clojure/cljs/tools/cli.cljs
+++ src/main/clojure/cljs/tools/cli.cljs
@@ -211,9 +211,12 @@
   exceptions, and validation failures are collected into a vector of error
   message strings.

+  If the :strict flag is true, required arguments that match other options
+  are treated as missing, instead of a literal value beginning with - or --.
+
   Returns [option-map error-messages-vector]."
   [specs tokens & options]
-  (let [{:keys [no-defaults]} (apply hash-map options)
+  (let [{:keys [no-defaults strict]} (apply hash-map options)
         defaults (default-option-map specs)]
     (-> (reduce
           (fn [[m ids errors] [opt-type opt optarg]]
@@ -221,7 +224,11 @@
               (let [[value error] (parse-optarg spec opt optarg)
                     id (:id spec)]
                 (if-not (= value ::error)
-                  [((:assoc-fn spec assoc) m id value) (conj ids id) errors]
+                  (if-let [matched-spec (and strict
+                                             (or (find-spec specs :short-opt optarg)
+                                                 (find-spec specs :long-opt optarg)))]
+                    [m ids (conj errors (missing-required-error opt (:required spec)))]
+                    [((:assoc-fn spec assoc) m id value) (conj ids id) errors])
                   [m ids (conj errors error)]))
               [m ids (conj errors (str "Unknown option: " (pr-str opt)))]))
           [defaults [] []] tokens)
@@ -386,17 +393,21 @@
                   Useful for parsing options from multiple sources; i.e. from a
                   config file and from the command line.

+    :strict       Parse required arguments strictly: if a required argument value
+                  matches any other option, it is considered to be missing (and
+                  you have a parse error).
+
     :summary-fn   A function that receives the sequence of compiled option specs
                   (documented at #'clojure.tools.cli/compile-option-specs), and
                   returns a custom option summary string.
   "
   [args option-specs & options]
-  (let [{:keys [in-order no-defaults summary-fn]} (apply hash-map options)
+  (let [{:keys [in-order no-defaults strict summary-fn]} (apply hash-map options)
         specs (compile-option-specs option-specs)
         req (required-arguments specs)
         [tokens rest-args] (tokenize-args req args :in-order in-order)
-        [opts errors] (parse-option-tokens
-                        specs tokens :no-defaults no-defaults)]
+        [opts errors] (parse-option-tokens specs tokens
+                                           :no-defaults no-defaults :strict strict)]
     {:options opts
      :arguments rest-args
      :summary ((or summary-fn summarize) specs)


lose old select do not pass in model-types, we now get them from model

--- src/main/java/org/dada/demo/core.clj
+++ src/main/java/org/dada/demo/core.clj
@@ -127,46 +127,6 @@
 ;;   (let [method (symbol (make-getter-name property-name))]
 ;;     `(proxy [Getter] [] (get [bean#] (. bean# ~method)))
 ;;     ))
-
-;; properties is a vector of property descriptions of the form:
-;; [input-type input-name output-type output-name]
-(defn select2 [input-class input-model output-item-name output-model-name key-type key-name version-type version-name properties]
-  (let [output-properties (map (fn [property] (vector (nth property 2) (nth property 3))) properties)
-   	input-getters (map (fn [property] (make-proxy-getter input-class (nth property 0) (nth property 1))) properties)
-	input-getters (map (fn [property] (make-lambda-getter input-class (nth property 0) (nth property 1))) properties)
-   	output-types (map (fn [property] (nth property 2)) properties)
-   	output-names (map (fn [property] (nth property 3)) properties)
-	class-factory  (new ClassFactory)
-  	output-class (apply make-class class-factory output-item-name output-properties)
-   	key-getter (make-proxy-getter output-class key-type key-name)
-   	version-getter (make-proxy-getter output-class version-type version-name)
-   	output-getters (map (fn [property] (make-proxy-getter output-class (nth property 2) (nth property 3))) properties)
-	output-metadata (new GetterMetadata output-class output-types output-names output-getters)
-	view (new VersionedModelView output-model-name output-metadata key-getter version-getter)
-	transformer (new
-  		     Transformer
-  		     (list view)
-  		     (proxy
-  		      [Transformer$Transform]
-  		      []
-  		      (transform [input]
-				 (print "INPUT ITEM: ")
-				 (println input)
-				 (print "OUTPUT CLASS:")
-				 (println output-class)
-				 (let
-				     [values
-				      (map
-				       ;;(fn [getter] (. getter get input))
-				       (fn [getter] (getter input))
-				       input-getters)]
-				   (print "OUTPUT VALUES:")
-				   (println values)
-				   (apply make-instance output-class values)))
-		      ))]
-    (connect input-model transformer)
-    view)
-  )

 ;; should [if required] connect a transformer between model and view...
 ;; each property should be able to register a converter fn as part of the transformation...
@@ -205,16 +165,18 @@
 	(connect model transformer)
 	))))

+;; properties is a vector of property descriptions of the form:
+;; [input-name output-type output-name]
 (defn select [input-model output-item-name output-model-name key-type key-name version-type version-name properties]
-  (let [output-properties (map (fn [property] (vector (nth property 2) (nth property 3))) properties)
-   	input-names (map (fn [property] (nth property 1)) properties)
-   	output-types (map (fn [property] (nth property 2)) properties)
-   	output-names (map (fn [property] (nth property 3)) properties)
+  (let [output-properties (map (fn [property] (vector (nth property 1) (nth property 2))) properties)
+   	input-names (map (fn [property] (nth property 0)) properties)
+   	output-types (map (fn [property] (nth property 1)) properties)
+   	output-names (map (fn [property] (nth property 2)) properties)
 	class-factory  (new ClassFactory)
   	output-class (apply make-class class-factory output-item-name output-properties)
    	key-getter (make-proxy-getter output-class key-type key-name)
    	version-getter (make-proxy-getter output-class version-type version-name)
-   	output-getters (map (fn [property] (make-proxy-getter output-class (nth property 2) (nth property 3))) properties)
+   	output-getters (map (fn [property] (make-proxy-getter output-class (nth property 1) (nth property 2))) properties)
 	output-metadata (new GetterMetadata output-class output-types output-names output-getters)
 	view (new VersionedModelView output-model-name output-metadata key-getter version-getter)
 	transformer (transform input-model input-names view output-class)]
@@ -247,13 +209,13 @@
   (. input-model getData)
   (. input-model getMetadata)

-  (def view (select input-model "org.dada.core.tmp.OutputItem" "OutputModel" (Integer/TYPE) "key" (Integer/TYPE) "version" (list [(Integer/TYPE) "id" (Integer/TYPE) "key"][(Integer/TYPE) "version" (Integer/TYPE) "version"][(Double/TYPE) "amount" (Double/TYPE) "money"])))
+  (def view (select input-model "org.dada.core.tmp.OutputItem" "OutputModel" (Integer/TYPE) "key" (Integer/TYPE) "version" (list ["id" (Integer/TYPE) "key"]["version" (Integer/TYPE) "version"]["amount" (Double/TYPE) "money"])))
   (insert metamodel view)

   (def item5 (make-instance input-class 3 2 2 6.0))
   (insert input-model item5)

-  (def view2 (select view "org.dada.core.tmp.OutputItem2" "OutputModel2" Integer "key" Integer "version" (list [(Integer/TYPE) "key" Integer "key"][(Integer/TYPE) "version" Integer "version"][(Double/TYPE) "money" Double "amount"])))
+  (def view2 (select view "org.dada.core.tmp.OutputItem2" "OutputModel2" Integer "key" Integer "version" (list ["key" Integer "key"]["version" Integer "version"]["money" Double "amount"])))

   )


Add some "dom" fns.

Add some "dom" fns.

--- ClojureScript/src/clik_clak_joe/core.cljs
+++ ClojureScript/src/clik_clak_joe/core.cljs
@@ -6,15 +6,23 @@
 ;; Reset js/React back as the form above loads in an different React
 (set! js/React (js/require "react-native/Libraries/react-native/react-native"))

+(defn view
+  [opts & children]
+  (apply js/React.createElement js/React.View opts children))
+
+(defn text
+  [opts & children]
+  (apply js/React.createElement js/React.Text opts children))
+
 (defn widget [data owner]
   (reify
     om/IRender
     (render [this]
-      (js/React.createElement js/React.View
+      (view
           (clj->js {:style {:flexDirection "row",
                             :margin 40 :backgroundColor "#EEFFEE"
                             :justifyContent "center"}})
-        (js/React.createElement js/React.Text
+        (text
             (clj->js {:style {:flex 1,
                               :justifyContent "center"}})
             (:text data))))))


Restricting the input to the DB update

Restricting the input to the DB update

--- src/time_tracker/invoices/handlers.clj
+++ src/time_tracker/invoices/handlers.clj
@@ -119,10 +119,11 @@
   ;; should have only {paid: true}
   ;; as user can only update an unpaid invoice to paid.
   (util/validate-spec body ::invoices-spec/invoice-paid)
-  (let [invoice-id (Integer/parseInt (:id route-params))]
+  (let [invoice-id (Integer/parseInt (:id route-params))
+        paid (select-keys body [:paid])]
     (if-let [updated-invoice (invoices-db/mark-invoice-paid!
                                 connection
                                 invoice-id
-                                body)]
+                                paid)]
         (res/response updated-invoice)
         web-util/error-not-found)))


make shell-test less dependent on timing (#85)

--- test/clj/lambdacd/steps/shell_test.clj
+++ test/clj/lambdacd/steps/shell_test.clj
@@ -3,12 +3,19 @@
             [clojure.core.async :as async]
             [lambdacd.testsupport.test-util :refer [result-channel->map slurp-chan]]
             [lambdacd.testsupport.data :refer [some-ctx some-ctx-with]]
-            [lambdacd.steps.shell :refer :all]))
+            [lambdacd.steps.shell :refer :all]
+            [lambdacd.event-bus :as event-bus]))

-(defn- kill-after-one-sec [is-killed]
-  (async/thread
-    (Thread/sleep 1000)
-    (reset! is-killed true)))
+(defn- contains-bar-output [[k v]]
+  (and
+    (= :out k)
+    (.contains v "bar")))
+
+(defn- kill-after-bar-is-echoed [ctx]
+  (async/go-loop []
+    (if (contains-bar-output (async/<! (:result-channel ctx)))
+      (reset! (:is-killed ctx) true)
+      (recur))))

 (deftest shell-return-code-test
   (testing "that bash returns the right return code for a single successful command"
@@ -60,17 +67,18 @@

 (deftest kill-test
   (testing "that we are able to kill a running shell-step"
-    (let [is-killed (atom false)]
-      (kill-after-one-sec is-killed)
+    (let [is-killed (atom false)
+          ctx       (some-ctx-with :is-killed is-killed)]
+      (kill-after-bar-is-echoed ctx)
       (is (= {:exit   143
               :out    "foo\nbar\n"
               :status :killed}
-             (bash (some-ctx-with :is-killed is-killed) "/"
-                "echo foo"
-                "sleep .5"
-                "echo bar"
-                "sleep 5"
-                "echo this-is-after-more-than-five-seconds-and-shouldnt-appear-in-output")))))
+             (bash ctx "/"
+                   "echo foo"
+                   "sleep .5"
+                   "echo bar"
+                   "sleep 5"
+                   "echo this-is-after-more-than-five-seconds-and-shouldnt-appear-in-output")))))
   (testing "that we are able to handle jobs that are already killed from the start"
     (let [is-killed (atom true)]
       (is (= {:exit   143


Update multi mem test.

Update multi mem test.

--- test/onyx/peer/multi_peer_mem_test.clj
+++ test/onyx/peer/multi_peer_mem_test.clj
@@ -94,11 +94,12 @@

 (def workflow {:in {:inc :out}})

-(def v-peers (onyx.api/start-peers! 1 peer-config))
+(def v-peers (onyx.api/start-peers! 8 peer-config))

-(onyx.api/submit-job peer-config
-                     {:catalog catalog :workflow workflow
-                      :task-scheduler :onyx.task-scheduler/round-robin})
+(onyx.api/submit-job
+ peer-config
+ {:catalog catalog :workflow workflow
+  :task-scheduler :onyx.task-scheduler/round-robin})

 (def results (hq-util/consume-queue! hq-config out-queue echo))


Missed one instance of the moved var.

Missed one instance of the moved var.

--- test/onyx/plugin/input_resume_test.clj
+++ test/onyx/plugin/input_resume_test.clj
@@ -58,7 +58,7 @@
                                                       {:profile :test})
         zk-address (get-in peer-config [:zookeeper/address])
         job (build-job zk-address test-topic 2 1000)
-        {:keys [out read-messages]} (core-async/get-core-async-channels job)
+        {:keys [out read-messages]} (get-core-async-channels job)
         test-data [{:n 1} {:n 2} {:n 3} {:n 4} {:n 5} {:n 6} :done]
         mock (atom {})]
     (try