don't essplode when clients disconnect

don't essplode when clients disconnect

--- clojure/src/dnd/core.cljs
+++ clojure/src/dnd/core.cljs
@@ -66,12 +66,30 @@
 (defn pusher! [& arguments]
   (swap! queue conj arguments))

-(defn setup [term character]
+(defonce clients (atom []))
+
+(defn remove-client [client]
+  (swap! clients (fn [fucks]
+                   (remove #(= client (:client %)) fucks))))
+
+(defn setup [term character client]
   (doto term
     (.clear)
     (.applicationKeypad)
-    (.hideCursor)
-    (.grabInput #js { :mouse "button" :focus true }))
+    ;; (.grabInput #js { :mouse "button" :focus true })
+    )
+
+  (.on client "end" #(let [character-name (:name @character)
+                          string (str "Character '" character-name "' has left the building")]
+                        (remove-client client)
+                        (println string)
+                        ))
+
+  ;(.on term "key"  #((let [string (str "key was " %)]
+                     ;(println string)
+                     ;(.send client string)
+                     ;)))
+

   (keyboard/HandleCharacterKeys term level character)
   (.on keyboard/emitter "move" (partial pusher! "move"))
@@ -102,23 +120,11 @@
     (recur queue))
   )

-;(defn herp [term client]
-  ;(.on term "key"  #((let [string (str "key was " %)]
-                     ;(println string)
-                     ;(.send client string)
-                     ;)))
-  ;(.on term "data" #((let [string (str "data was " %)]
-                     ;(println string)
-                     ;(.send client string)
-                     ;))))
-
-(defonce clients (atom []))

 (defn kick-it [client]
-  (let [{:keys [term character]} client]
-    (prn term)
+  (let [{:keys [term character client]} client]
     (teardown term)
-    (setup term character)
+    (setup term character client)
     (show-screen term character)
     (popper! queue)))

@@ -131,7 +137,10 @@
                                            :term   term
                                            :character (make-character) } ]
                            (swap! clients conj new-client)
-                           ;(async (swap! character assoc :name (await (generate-name))))
+                           (async
+                             (let [dat-name (await (generate-name))]
+                               (prn (str dat-name " has joined the fray."))
+                               (swap! (:character new-client) assoc :name dat-name)))
                            (kick-it new-client))))
     (.listen 2323)))


Fix add action dialog.

Fix add action dialog.

--- src/cljs/hatnik/web/client/form/add_action.cljs
+++ src/cljs/hatnik/web/client/form/add_action.cljs
@@ -103,7 +103,7 @@
   (merge default-state
          {:project-id (:project-id data)
           :email-address (:user-email data)
-          :type :email}))
+          :type "email"}))

 (defmethod get-init-state :update [data _]
   (let [action (:action data)]


ДОбавлен компонент просмотра ресурсов (файлов и картикнок) с кнопкой сакрытия. Также добавлены общие компоненты для отображения дат а также времен создания и обновления

--- radiolamp-6P3S/src/ixinfestor/omut.cljs
+++ radiolamp-6P3S/src/ixinfestor/omut.cljs
@@ -306,6 +306,20 @@
 (defn the-time-has-passed-from-the-date-as-str [date]
   (let [[d h m] (the-time-has-passed-from-the-date date)]
     (gstring/format "прошло: %d дн. %02d час. %02d мин." d h m)))
+
+
+(declare ui-glyphicon)
+
+
+(defn ui-cdate-udate [{:keys [cdate udate]}]
+  (dom/span
+   #js {:className "text-muted"}
+   (ui-glyphicon "time") " создан "
+   (date-com-format-datetime cdate) " "
+   (ui-glyphicon "time") " обновлен "
+   (date-com-format-datetime udate)))
+
+

@@ -1737,10 +1751,10 @@
                   #js {:className "input-control"
                        :style #js {:lineHeight 1.2}}
                   " страница "
-                  (dom/b nil page)
+                  (dom/b nil page)
                   (when (and count-all page-size) " из ")
                   (when (and count-all page-size) (dom/b nil (inc (quot count-all page-size))))
-
+
                   (when count-all (dom/br nil))
                   (when count-all "всего записей ")
                   (when count-all (dom/b nil (str count-all)))))
@@ -2510,6 +2524,7 @@
 (defn ui-media [{:keys [media-object
                         heading heading-2
                         on-click-fn
+                        on-click-in-image-fn
                         href
                         style
                         body
@@ -2520,7 +2535,12 @@
   (dom/div #js {:className "media" :style style
                 :onClick   on-click-fn}
            (dom/div #js {:className "media-left"}
-                    (dom/a #js {:href (or href "#")}
+                    (dom/a #js {:href    href
+                                :onClick (fn [e]
+                                           (when on-click-in-image-fn (on-click-in-image-fn))
+                                           ;; Далее прервать выполнение события для родительского
+                                           ;; компонента
+                                           (.stopPropagation e))}
                            media-object))
            (dom/div #js {:className "media-body"}
                     (when button-do-fn (ui-button {:style    #js {:float "right"}
@@ -3291,6 +3311,60 @@
 ;;..................................................................................................

+;;;**************************************************************************************************
+;;;* BEGIN images and files list viewer with button collapser
+;;;* tag: <image-and-files-btn-viewer>
+;;;*
+;;;* description: Компонент для отображения привязанных файлов и картинок в виде выпадающего через кнопку списка
+;;;*
+;;;**************************************************************************************************
+
+(defn image-and-files-btn-viewer [app own {:keys [chan-thumb-show-in-full-screen]}]
+  (reify
+    om/IRender
+    (render [_]
+      (let [{:keys [images files]} @app]
+        (ui-collapser
+         app (str "изображений (" (count images) ") файлов (" (count files) ")")
+         :k (or (not (empty? images)) (not (empty? files)))
+         (apply
+          dom/ul #js {:className "list-group"}
+          (into
+           (reduce
+            (fn [a {:keys [id path top_description description] :as row}]
+              (conj a (dom/li #js {:className "list-group-item"}
+                              (ui-media
+                               {:media-object         (ui-media-object
+                                                       {:src (str path "_as_60.png")})
+                                :heading              top_description
+                                :on-click-in-image-fn #(put! chan-thumb-show-in-full-screen row)
+                                :button-do-text       "cмотреть"
+                                :button-do-fn         #(put! chan-thumb-show-in-full-screen row)
+                                :body                 description
+                                }))))
+            [] images)
+           (reduce
+            (fn [a {:keys [id path filename top_description description] :as row}]
+              (conj a (dom/li #js {:className "list-group-item"}
+                              (ui-media
+                               {:media-object (ui-glyphicon "file" "" "2em")
+                                :href         path
+                                :on-click-fn
+                                (fn [e]
+                                  ;; Далее прервать выполнение события для родительского
+                                  ;; компонента
+                                  (.stopPropagation e))
+                                :heading      (dom/span nil top_description
+                                                        " " (dom/small nil filename))
+                                :body         description
+                                }))))
+            [] files))))))))
+
+;;; END images and files list viewer with button collapser
+;;;..................................................................................................
+
+
+

 ;;**************************************************************************************************


Correct typo in lint docstring

Correct typo in lint docstring

--- ring-devel/src/ring/middleware/lint.clj
+++ ring-devel/src/ring/middleware/lint.clj
@@ -17,7 +17,7 @@
     (catch Exception e
       (if-not (re-find #"^Ring lint error: " (.getMessage e))
         (throw (Exception. (format
-          "Ring lint error: exception occured when checking that %s on %s: %s"
+          "Ring lint error: exception occurred when checking that %s on %s: %s"
           message (pr-str val) (.getMessage e))))
         (throw e)))))


update drag-and-drop from gh-pages

update drag-and-drop from gh-pages

--- examples/drag-and-drop/src/drag_and_drop/core.cljs
+++ examples/drag-and-drop/src/drag_and_drop/core.cljs
@@ -175,19 +175,20 @@
                               :-moz-user-select "none"
                               :-ms-user-select "none"
                               :user-select "none"}}
-      (apply dom/div #js {:class "placed-boxes"}
-        (map render-solid-box (:placed-boxes state)))
-      (apply dom/div #js {:class "moving-boxes"}
-        (map render-ghost-box moving-boxes))
-      (render-ghost-box resizing-box)
-      (dom/div #js {:style #js {:position "relative"}}
-        (dom/h1 nil "Drag and drop")
-        (dom/p nil
-               "Drag to create boxes, drag to move them around, and click to remove them. "
-               (dom/a #js {:href "https://github.com/jamesmacaulay/zelkova/blob/gh-pages/examples/drag-and-drop/src/drag_and_drop/core.cljs"}
-                      "View source")
-               ".")
-        (dom/pre nil (.stringify js/JSON (clj->js state) nil 2))))))
+             (apply dom/div #js {:class "placed-boxes"}
+                    (map render-solid-box (:placed-boxes state)))
+             (apply dom/div #js {:class "moving-boxes"}
+                    (map render-ghost-box moving-boxes))
+             (render-ghost-box resizing-box)
+             (dom/div #js {:style #js {:position "relative"}}
+                      (dom/h1 nil "Drag and drop")
+                      (dom/p nil
+                             (dom/a #js {:href "https://github.com/jamesmacaulay/zelkova/blob/gh-pages/examples/drag-and-drop/src/drag_and_drop/core.cljs"}
+                                    "View source")
+                             ".")
+                      (dom/p nil
+                             "Drag to create boxes, drag to move them around, and click to remove them.")
+                      (dom/pre nil (.stringify js/JSON (clj->js state) nil 2))))))

 (om/root
   (fn [app owner]


fix compiler warning

fix compiler warning

--- frontend/favicon.cljs
+++ frontend/favicon.cljs
@@ -1,4 +1,5 @@
 (ns frontend.favicon
+  (:refer-clojure :exclude [reset!])
   (:require [dommy.attrs :as attrs]
             [frontend.utils :as utils :include-macros true])
   (:require-macros [dommy.macros :refer [sel sel1]]))


Use cover image in serials list

Use cover image in serials list

--- src/teach_by_friends/shared/components/row.cljs
+++ src/teach_by_friends/shared/components/row.cljs
@@ -4,10 +4,22 @@

 (defn row [data press-handler]
   (let [data-to-clj (js->clj data :keywordize-keys true)]
-    [ui/touchable-opacity {:style    {:border-bottom-width 1
-                                      :border-color        "rgba(0,0,0,.1)"
-                                      :padding-top         20
-                                      :padding-bottom      20
-                                      :padding-left        30}
+    [ui/touchable-opacity {:style    {:position "relative"
+                                      :height 100}
                            :on-press (partial press-handler data-to-clj)}
-     [ui/text {:style {:font-size 30 :color "white"}} (capitalize (:title data-to-clj))]]))
+     [ui/image {:source {:uri (:cover data-to-clj)}
+                :resize-mode "cover"
+                :style {:width (ui/get-device-width)
+                        :height 100}}]
+     [ui/linear-gradient {:colors ["rgba(0,0,0,0.6)" "rgba(0,0,0,0)"]
+                          :start  [0.0 0.5] :end [1.0 0.5]
+                          :style  {:width (ui/get-device-width)
+                                   :height 100
+                                   :position "absolute"
+                                   :top 0}}]
+     [ui/text {:style {:position "absolute"
+                       :font-size 14
+                       :color "white"
+                       :left 16
+                       :bottom 10}}
+      (capitalize (:title data-to-clj))]]))


:wrench: Update build configuration to use advanced compilation with pseudo-names.

--- frontend/tools.clj
+++ frontend/tools.clj
@@ -75,7 +75,9 @@

 (def main-build-build-options
   (merge main-dist-build-options
-         {:optimizations :none}))
+         {:optimizations :advanced
+          :pseudo-names true
+          :pretty-print true}))

 (def worker-dist-build-options
   (merge default-build-options
@@ -87,8 +89,9 @@

 (def worker-build-build-options
   (merge worker-dist-build-options
-         {:optimizations :none
-          :source-map true}))
+         {:optimizations :advanced
+          :pseudo-names true
+          :pretty-print true}))

 ;; --- Tasks Definitions


Rect utils

Rect utils

--- flatguicore/src/flatgui/util/rectmath.clj
+++ flatguicore/src/flatgui/util/rectmath.clj
@@ -85,35 +85,52 @@
         (< (:y a) (:y b)) (> (:h a) (:h b)))
     a))

-(defn rect+ [a b]
-  (cond
-    (fully-contains? a b)
-    a
-    (fully-contains? b a)
-    b
-    :else
-    (let [h-inter (line& (:x a) (+ (:x a) (:w a)) (:x b) (+ (:x b) (:w b)))
-          v-inter (line& (:y a) (+ (:y a) (:h a)) (:y b) (+ (:y b) (:h b)))
-          v-edge (and (nil? v-inter) (or
-                                       (= (:y b) (+ (:y a) (:h a)))
-                                       (= (:y a) (+ (:y b) (:h b)))))]
-      (if (and h-inter (or v-inter v-edge))
-        {:x (first h-inter)
-         :y (min (:y a) (:y b))
-         :w (- (nth h-inter 1) (nth h-inter 0))
-         :h (if v-edge
-              (+ (:h a) (:h b))
-              (- (+ (:h a) (:h b)) (- (nth v-inter 1) (nth v-inter 0))))}
-        (let [h-edge (and (nil? h-inter) (or
-                                           (= (:x b) (+ (:x a) (:w a)))
-                                           (= (:x a) (+ (:x b) (:w b)))))]
-          (if (and v-inter (or h-inter h-edge))
-            {:x (min (:x a) (:x b))
-             :y (nth v-inter 0)
-             :w (if h-edge
-                  (+ (:w a) (:w b))
-                  (- (+ (:w a) (:w b)) (- (nth h-inter 1) (nth h-inter 0))))
-             :h (- (nth v-inter 1) (nth v-inter 0))}))))))
+(defn rect+
+  ([a b]
+   (cond
+     (fully-contains? a b)
+     a
+     (fully-contains? b a)
+     b
+     :else
+     (let [h-inter (line& (:x a) (+ (:x a) (:w a)) (:x b) (+ (:x b) (:w b)))
+           v-inter (line& (:y a) (+ (:y a) (:h a)) (:y b) (+ (:y b) (:h b)))
+           v-edge (and (nil? v-inter) (or
+                                        (= (:y b) (+ (:y a) (:h a)))
+                                        (= (:y a) (+ (:y b) (:h b)))))]
+       (if (and h-inter (or v-inter v-edge))
+         {:x (first h-inter)
+          :y (min (:y a) (:y b))
+          :w (- (nth h-inter 1) (nth h-inter 0))
+          :h (if v-edge
+               (+ (:h a) (:h b))
+               (- (+ (:h a) (:h b)) (- (nth v-inter 1) (nth v-inter 0))))}
+         (let [h-edge (and (nil? h-inter) (or
+                                            (= (:x b) (+ (:x a) (:w a)))
+                                            (= (:x a) (+ (:x b) (:w b)))))]
+           (if (and v-inter (or h-inter h-edge))
+             {:x (min (:x a) (:x b))
+              :y (nth v-inter 0)
+              :w (if h-edge
+                   (+ (:w a) (:w b))
+                   (- (+ (:w a) (:w b)) (- (nth h-inter 1) (nth h-inter 0))))
+              :h (- (nth v-inter 1) (nth v-inter 0))}))))))
+  ([a] a)
+  ([] {:x 0 :y 0 :w 0 :h 0}))
+
+(defn rect|
+  ([a b]
+    (let [x2a (+ (:x a) (:w a))
+          y2a (+ (:y a) (:h a))
+          x2b (+ (:x b) (:w b))
+          y2b (+ (:y b) (:h b))
+          x1 (min (:x a) (:x b))
+          y1 (min (:y a) (:y b))
+          x2 (max x2a x2b)
+          y2 (max y2a y2b)]
+      {:x x1 :y y1 :w (- x2 x1) :h (- y2 y1)}))
+  ([a] a)
+  ([] {:x 0 :y 0 :w 0 :h 0}))

 (defn square [a]
   (if a


Added timestamps to posts.

Added timestamps to posts.

--- src/ackbar/core.clj
+++ src/ackbar/core.clj
@@ -3,7 +3,9 @@
   (:require [appengine-magic.core :as ae]
             [appengine-magic.services.datastore :as ds]
             [clojure.contrib.str-utils2 :as s])
-  (:import com.google.appengine.api.datastore.EntityNotFoundException))
+  (:import com.google.appengine.api.datastore.EntityNotFoundException
+           java.text.SimpleDateFormat
+           java.util.Date))

 (ds/defentity Page [^:key url, title, body, timestamp])

@@ -130,6 +132,13 @@
      [:div [:h1 (:title page)]
       [:div (:body page)]])))

+(def date-format (SimpleDateFormat. "yyyy-MM-dd"))
+
+(defn to-date
+  "Converts a UNIX timstamp to a date string"
+  [timestamp]
+  (.format date-format (Date. timestamp)))
+
 (defn render-paginate
   "Renders a fixed number of pages"
   [number]
@@ -140,8 +149,9 @@
   (response-wrapper
    "Paginated"
    (html (for [page pages]
-           [:div [:h1 (:title page)]
-            [:div (:body page)]])
+           [:div {:class "post"} [:h1 {:class "title"} (page-link page)]
+            [:div {:class "date"} (to-date (:timestamp page))]
+            (:body page)])
          (if (> number 0)
            (html (link-to (str "/pages/" (dec number)) "prev") [:br]))
          (if (= pagesize (count pages))


better handling of enter key

better handling of enter key

--- src-cljs/frontend/components/outer.cljs
+++ src-cljs/frontend/components/outer.cljs
@@ -101,12 +101,11 @@
                                         :data-before "What's your company's name?"
                                         :data-after "Company Name"
                                         :content-editable true
-                                        :on-input #(let [value (goog.dom/getRawTextContent (.-target %))
-                                                         stripped-value (gstring/stripNewlines value)]
-                                                     (om/set-state! owner :company-name stripped-value)
-                                                     ;; If they hit enter, send them to the next input.
-                                                     (when (not= value stripped-value)
-                                                       (.focus (om/get-node owner "employee-count"))))}
+                                        :on-key-down #(when (= "Enter" (.-key %))
+                                                        (.preventDefault %)
+                                                        ;; If they hit enter, send them to the next input.
+                                                        (.focus (om/get-node owner "employee-count")))
+                                        :on-input #(om/set-state! owner :company-name (goog.dom/getRawTextContent (.-target %)))}

              company-name]
             [:div.adaptive-placeholder {:tab-index "3"
@@ -114,29 +113,23 @@
                                         :data-before "How many teammates do you have?"
                                         :data-after "Team Size"
                                         :content-editable true
-                                        :on-input #(let [value (goog.dom/getRawTextContent (.-target %))
-                                                         stripped-value (gstring/stripNewlines value)]
-                                                     (om/set-state! owner :employee-count stripped-value)
-                                                     ;; If they hit enter, send them to the next input.
-                                                     (when (not= value stripped-value)
-                                                       (.focus (om/get-node owner "use-case"))))}
+                                        :on-key-down #(when (= "Enter" (.-key %))
+                                                        (.preventDefault %)
+                                                        ;; If they hit enter, send them to the next input.
+                                                        (.focus (om/get-node owner "use-case")))
+                                        :on-input #(om/set-state! owner :employee-count (goog.dom/getRawTextContent (.-target %)))}
              employee-count]
             [:div.adaptive-placeholder {:tab-index "4"
                                         :ref "use-case"
                                         :data-before "How will you use Precursor?"
                                         :data-after "Use Case"
                                         :content-editable true
-                                        :on-input #(let [value (goog.dom/getRawTextContent (.-target %))
-                                                         stripped-value (gstring/stripNewlines value)]
-                                                     (om/set-state! owner :use-case stripped-value)
-                                                     ;; If they hit enter, submit the form
-                                                     (when (not= value stripped-value)
-                                                       (.focus (om/get-node owner "submit-button"))
-                                                       (.click (om/get-node owner "submit-button"))
-                                                       #_(submit-form {:company-name company-name
-                                                                     :employee-count employee-count
-                                                                     ;; Have to make sure we get the latest value
-                                                                     :use-case stripped-value})))}
+                                        :on-key-down #(when (= "Enter" (.-key %))
+                                                        (.preventDefault %)
+                                                        ;; If they hit enter, send them to the next input.
+                                                        (.focus (om/get-node owner "submit-button"))
+                                                        (.click (om/get-node owner "submit-button")))
+                                        :on-input #(om/set-state! owner :use-case (goog.dom/getRawTextContent (.-target %)))}
              use-case]
             (when (seq error)
               [:div.error error])


remove _morph_ param from all functions

remove _morph_ param from all functions

--- src/babel/over.cljc
+++ src/babel/over.cljc
@@ -66,14 +66,14 @@
       (log/trace (str "over-each-parent-comp: done. returning nil"))
       nil)))

-(defn over-each-head-child [parent children morph]
+(defn over-each-head-child [parent children]
   (log/trace (str "over-each-head-child: parent type: " (type parent)))
   (log/trace (str "over-each-head-child: head children type: " (type children)))
   (if (not (empty? children))
     (let [each-child (first children)]
       (lazy-cat
-       (overh parent each-child morph)
-       (over-each-head-child parent (rest children) morph)))
+       (overh parent each-child)
+       (over-each-head-child parent (rest children))))
     (do
       (log/trace (str "over-each-head-child: done. returning nil."))
       nil)))
@@ -138,7 +138,7 @@
    (fail? (unifyc (get-in parent [:comp :synsem :subcat] :top)
                   (get-in child [:synsem :subcat] :top)))))

-(defn moreover-head [parent child lexfn-sem-impl morph]
+(defn moreover-head [parent child lexfn-sem-impl & [morph]]
   (let [morph (if morph morph (fn [x] (strip-refs (dissoc x :serialized))))]
     (log/debug (str "moreover-head (candidate) parent: [" (get-in parent [:rule]) "] '" (morph parent) "' sem:    " (strip-refs (get-in parent '(:synsem :sem) :no-semantics))))
     (log/debug (str "moreover-head (candidate) head child: [" (get-in parent [:child]) "] '" (morph child) "' sem:" (strip-refs (get-in child '(:synsem :sem) :top))))
@@ -251,7 +251,7 @@

 (defn overh
   "add given head as the head child of the phrase: parent."
-  [parent head morph]
+  [parent head]
   (when (and (map? parent)
              (map? head))
     (do
@@ -275,19 +275,19 @@
    (or (set? head)
        (vector? head))
    (do (log/trace "head is a set: converting to a seq.")
-       (overh parent (lazy-seq head) morph))
+       (overh parent (lazy-seq head)))

    (seq? head)
    (let [head-children head]
      (log/trace (str "head is a seq - actual type is " (type head)))
      (filter (fn [result]
                (not (fail? result)))
-             (over-each-head-child parent head-children morph)))
+             (over-each-head-child parent head-children)))

    true
    ;; TODO: 'true' here assumes that both parent and head are maps: make this assumption explicit,
    ;; and save 'true' for errors.
-   (let [result (moreover-head parent head sem-impl morph)
+   (let [result (moreover-head parent head sem-impl)
          is-fail? (fail? result)
          label (if (get-in parent [:rule]) (get-in parent [:rule]) (:comment parent))]
      (if (not is-fail?)
@@ -343,8 +343,8 @@
      (if (not is-fail?)
        (list result)))))

-(defn overhc [parent head comp & [morph]]
-  (overc (overh parent head morph) comp))
+(defn overhc [parent head comp]
+  (overc (overh parent head) comp))

 ;; TODO: distinguish between when:
 ;; 1) called with only a child1 (no child2),


+debug logging

+debug logging

--- src/babel/over.cljc
+++ src/babel/over.cljc
@@ -88,9 +88,12 @@
                          {:head (copy head)})]
       (if (not (= :fail result))
         (do
-          (log/debug (str "overh: " (get-in parent [:rule]) " -> " (spec-info head)))
+          (log/debug (str "overh: " (get-in parent [:rule]) " -> " (spec-info head) " : "
+                          (strip-refs
+                           (dissoc
+                            head :dag_unify.core/serialized))))
           (list result))
-        (log/debug (str "overh: fail-path for rule: " (:rule parent) ":"
+        (log/debug (str "overh: fail-path for rule: " (:rule parent) " with head:" (spec-info head) ":"
                         (dag_unify.core/fail-path
                          (copy parent)
                          {:head (copy head)})))))))


Prevent IPV6 issues with nrepl start-server

--- src/yetibot/core/init.clj
+++ src/yetibot/core/init.clj
@@ -22,7 +22,9 @@
   (if-let [c (mconfig/reload-config!)]
     (do
       (welcome-message!)
-      (start-server :port 6789)
+      ;; Note: if you don't set :bind it defaults to :: which may not work if it
+      ;; resolves to an IPV6 stack and you're running in Docker
+      (start-server :port 6789 :bind "localhost")
       (web/start-web-server)
       (db/start)
       (logging/start)


Check that hash-fn returns a multihash in read!.

--- src/blocks/core.clj
+++ src/blocks/core.clj
@@ -92,10 +92,14 @@
    (read! source :sha2-256))
   ([source algorithm]
    (let [hash-fn (resolve-hash! algorithm)
-         content (bytes/to-byte-array source)]
+         content (bytes/to-byte-array source)
+         id (hash-fn content)]
      (when-not (empty? content)
-       (Block. (hash-fn content)
-               (PersistentBytes/wrap content))))))
+       (when-not (instance? Multihash id)
+         (throw (RuntimeException.
+                  (str "Block identifier must be a Multihash, "
+                       "hashing algorithm returned: " (pr-str id)))))
+       (Block. id (PersistentBytes/wrap content))))))

 (defn write!


change gif button state while gif rendering is in progress

--- src/cellf/core.cljs
+++ src/cellf/core.cljs
@@ -259,44 +259,54 @@

         no-stream?
           (dom/div nil
-            (str
+            (dom/h1 nil "Hi")
+            (dom/p nil (str
               "Cellf is an interactive experiment that reflects the player and their "
-              "surroundings as they play. Click OK to prompt for camera access.")
+              "surroundings as they play. Click OK to prompt for camera access*."))
             (dom/em nil (str
-              "There is no server or multiplayer component to this: "
+              "*There is no server or multiplayer component to this: "
               "your image stays on your device."))
             (dom/button #js {:onClick get-camera!} "ok"))

+        result-gif
+          (dom/div nil
+            (dom/h1 nil "Your Cellf")
+            (dom/img #js {:src result-gif})
+            "Save this gif and share it with the world."
+            (dom/button #js {:onClick #(om/update! app :result-gif nil)} "done"))
+
         winner?
           (dom/div nil
-            "You win! For more of a challenge, drag the slider to create a bigger grid."
+            (dom/h1 nil "You win!")
+            "For more of a challenge, drag the slider to create a bigger grid."
+            (apply dom/button
+              (if gif-building?
+                [#js {:className "wait"} "hold on"]
+                [#js {:onClick #(make-gif app tick-ms)} "make gif replay"]))
             (dom/button #js {:onClick #(set-grid-size! app grid-size)} "new game"))

-        result-gif
-          (dom/div nil
-            (dom/img #js {:src result-gif})
-            "You can save this gif and share it with the world."
-            (dom/button #js {:onClick #(om/update! app :result-gif nil)} "done"))
-
         show-about?
           (dom/div nil
+            (dom/h1 nil "How to play")
             (dom/p nil
               (str
-                "Simply click a square next to the empty space to move it. "
+                "Simply click a cell next to the empty cell to move it. "
                 "When you shuffle them into the correct order, you win."))
             (dom/p nil
               (str
-                "You can also export a replay of your moves to an animated gif. "
-                "Cellf is ")
-              (dom/a #js {:href "https://github.com/dmotz/cellf"} "open source")
-              ". For more experiments like this, visit "
+                "You can also export a replay of your moves to an animated gif by "
+                "clicking the 'make gif' button."))
+
+            (dom/p (dom/a #js {:href "https://github.com/dmotz/cellf"} "open source")
+              "For more experiments like this, visit "
               (dom/a #js {:href "http://oxism.com"} "oxism.com")
-              \.
-              (dom/button #js {:onClick #(om/update! app :show-about? false)} "got it")))))))
+              \.)
+
+            (dom/button #js {:onClick #(om/update! app :show-about? false)} "got it"))))))

 (om/root
-  (fn [{:keys [stream moves tick tick-ms grid-size show-nums] :as app} owner]
+  (fn [{:keys [stream moves tick tick-ms grid-size show-nums gif-building?] :as app} owner]
     (reify
       om/IDidMount
       (did-mount [_]
@@ -335,8 +345,6 @@

             (when stream
               (dom/div nil
-                (dom/button #js {:onClick #(make-gif app tick-ms)} "make gif")
-
                 (dom/label
                   #js {:className "move-count"}
                   (str (inc tick) \/ (count moves)))
@@ -368,7 +376,12 @@
                   :step     "10"
                   :onChange #(set-tick-ms! app (- (js/parseInt (.. % -target -value))))})

-                (dom/button #js {:onClick #(om/update! app :show-about? true)} "info"))))
+                (apply dom/button
+                  (if gif-building?
+                    [#js {:className "wait"} "hold on"]
+                    [#js {:onClick #(make-gif app tick-ms)} "make gif"]))
+
+                (dom/button #js {:onClick #(om/update! app :show-about? true)} "help"))))

           (when stream (om/build grid app))))))
   app-state


Switch probemaps to tsv reader.

Switch probemaps to tsv reader.

--- src/cgdata/core.clj
+++ src/cgdata/core.clj
@@ -357,57 +357,12 @@
      :features feature   ; slurped clinicalFeatures
      :data-fn (fn [in] (matrix-data metadata feature (line-seq ((:reader in)))))}))

-;
-; cgData probemaps
-;
-
-(defn- probemap-row [row]
-  (let [[probe genes chrom start end strand] (s/split row #"\t")]
-    {:name probe
-     :genes (split-no-empty genes #",")
-     :chrom chrom
-     :chromStart (. Integer parseInt start)
-     :chromEnd (. Integer parseInt end)
-     :strand strand}))
-
-
 (defn- chr-order [position]
   (mapv position [:chrom :chromStart]))

-(defn- probemap-data
-  "Return seq of probes entries as maps"
-  [rows]
-  (let [columns (sort-by chr-order (map probemap-row rows)) ; XXX move sort to cavm
-        probe-names (map :name columns)
-        probe-feature (ad-hoc-order {} probe-names)
-        probe-vals (map (:order probe-feature) probe-names)]
-    [{:field "name"
-      :valueType "category"
-      :feature probe-feature
-      :rows probe-vals}
-     {:field "position"
-      :valueType "position"
-      :rows (map #(select-keys % [:chrom :chromStart :chromEnd :strand]) columns)}
-     {:field "genes"
-      :valueType "genes"
-      :row-val identity
-      :rows (mapv :genes columns)}]))
-
-(defn probemap-file
-  "Return a map describing a cgData probemap file. This will read
-  any assoicated json."
-  [file & {docroot :docroot :or {docroot fs/unix-root}}]
-  (let [metadata (cgdata-meta file)
-        refs (references docroot file metadata)]
-    {:metadata metadata
-     :refs refs
-     :data-fn (fn [in] (probemap-data (line-seq ((:reader in)))))}))
-
-;
-; mutationVector
-;
-
-;TARGET-30-PAHYWC-01     chr5    33549462        33549462        ADAMTS12        G       T       missense_variant        0.452962        NA      F1384L
+;
+; general tsv reader
+;

 (defn tsv-rows [in]
   (map tabbed (filter #(and (not-blank? %)
@@ -484,37 +439,6 @@
                                  (mapv (fn [t i parse] [t (parse (get % i ""))])
                                        tlist ilist plist))
                            (tsv-rows in))))})))
-
-(def ^:private mutation-column-types
-  {:sampleID :category
-   :chrom :category
-   :ref :category
-   :chromStart :float
-   :chromEnd :float
-   :position :position
-   :genes :gene
-   :reference :category
-   :alt :category
-   :effect :category
-   :dna-vaf :float
-   :rna-vaf :float
-   :amino-acid :category})
-
-(def mutation-columns
-  {#"(?i)sample[ _]*(name|id)?" :sampleID
-   #"(?i)chr(om)?" :chrom
-   #"(?i)start" :chromStart
-   #"(?i)end" :chromEnd
-   #"(?i)genes?" :genes
-   #"(?i)alt(ernate)?" :alt
-   #"(?i)ref(erence)?" :ref
-   #"(?i)effect" :effect
-   #"(?i)dna[-_ ]*v?af" :dna-vaf
-   #"(?i)rna[-_ ]*v?af" :rna-vaf
-   #"(?i)amino[-_ ]*acid[-_ ]*(change)?" :amino-acid})
-
-(def ^:private mutation-default-columns
-  [:sampleID :chrom :chromStart :chromEnd :genes :ref :alt :effect :dna-vaf :rna-vaf :amino-acid])

 (defn columns-from-header [header patterns]
   (when header
@@ -601,6 +525,40 @@
             sorted-fields (map #(update-in % [:rows] resort order) (consume-vec fields))]
         sorted-fields)
       (consume-vec fields))))
+;
+; mutationVector
+;
+
+(def ^:private mutation-column-types
+  {:sampleID :category
+   :chrom :category
+   :ref :category
+   :chromStart :float
+   :chromEnd :float
+   :position :position
+   :genes :gene
+   :reference :category
+   :alt :category
+   :effect :category
+   :dna-vaf :float
+   :rna-vaf :float
+   :amino-acid :category})
+
+(def mutation-columns
+  {#"(?i)sample[ _]*(name|id)?" :sampleID
+   #"(?i)chr(om)?" :chrom
+   #"(?i)start" :chromStart
+   #"(?i)end" :chromEnd
+   #"(?i)genes?" :genes
+   #"(?i)alt(ernate)?" :alt
+   #"(?i)ref(erence)?" :ref
+   #"(?i)effect" :effect
+   #"(?i)dna[-_ ]*v?af" :dna-vaf
+   #"(?i)rna[-_ ]*v?af" :rna-vaf
+   #"(?i)amino[-_ ]*acid[-_ ]*(change)?" :amino-acid})
+
+(def ^:private mutation-default-columns
+  [:sampleID :chrom :chromStart :chromEnd :genes :ref :alt :effect :dna-vaf :rna-vaf :amino-acid])

 (defn mutation-file
   "Return a map describing a cgData mutation file. This will read
@@ -618,6 +576,47 @@
                          mutation-column-types
                          in))}))

+;
+; probemap
+;
+(def ^:private probemap-column-types
+  {:name :category
+   :chrom :category
+   :chromStart :float
+   :chromEnd :float
+   :position :position
+   :genes :gene})
+
+(def ^:private probemap-default-columns
+  [:name :genes :chrom :chromStart :chromEnd :strand])
+
+(def probemap-columns
+  {#"(?i)chr(om)?" :chrom
+   #"(?i)start" :chromStart
+   #"(?i)end" :chromEnd
+   #"(?i)strand" :strand
+   #"(?i)genes?" :genes
+   #"(?i)name" :name})
+
+; XXX refactor this function pattern. It appears three times.
+(defn probemap-file
+  "Return a map describing a cgData probemap file. This will read
+  any assoicated json."
+  [file & {docroot :docroot :or {docroot fs/unix-root}}]
+  (let [metadata (cgdata-meta file)
+        start-index (get metadata "start_index" 1)
+        refs (references docroot file metadata)]
+    {:metadata metadata
+     :refs refs
+     :data-fn (fn [in] (tsv-data
+                         start-index
+                         probemap-columns
+                         probemap-default-columns
+                         probemap-column-types
+                         in))}))
+;
+; gene prediction
+;

 (def ^:private gene-pred-column-types
   {:bin :float
@@ -682,6 +681,8 @@
                          gene-pred-default-columns
                          gene-pred-column-types
                          in))}))
+
+;
 ; cgdata file detector
 ;


Korjattu repository-määre

Korjattu repository-määre

--- clj-string-normalizer/project.clj
+++ clj-string-normalizer/project.clj
@@ -10,12 +10,12 @@
                               :username      :env/artifactory_username
                               :password      :env/artifactory_password
                               :sign-releases false
-                              :snapshots     false}
-                  ["snapshots" {:url           "https://artifactory.opinlein topolku.fi/artifactory/oph-sade-snapshot-local"
-                                :username      :env/artifactory_username
-                                :password      :env/artifactory_password
-                                :sign-releases false
-                                :snapshots     true}]]]
+                              :snapshots     false}]
+                 ["snapshots" {:url           "https://artifactory.opintopolku.fi/artifactory/oph-sade-snapshot-local"
+                               :username      :env/artifactory_username
+                               :password      :env/artifactory_password
+                               :sign-releases false
+                               :snapshots     true}]]

   :source-paths ["src/clj" "src/cljc" "src/cljs"]


fixing snapshot output for date formatting into json

--- src/clj/tdd_trainer/routes/snapshot.clj
+++ src/clj/tdd_trainer/routes/snapshot.clj
@@ -12,7 +12,7 @@
   [{:keys [session-id start-time snapshots]}]
   {:sessionId session-id
    :startTime (f/unparse json-date-formatter start-time)
-   :snapshots snapshots})
+   :snapshots (map #(update % :timestamp (partial f/unparse json-date-formatter)) snapshots)})

 (defroutes snapshot-routes
   (POST "/session" [timestamp]
@@ -23,11 +23,13 @@
   (GET "/session/:session-id/stats" [session-id]
        (let [stats (gen-stat-summary @d/session-data)]
          (response/ok stats)))
+

   (GET "/session/:session-id/snapshot" [session-id] (response/ok (format-session-data @d/session-data)))
+
   (POST "/session/:session-id/snapshot" [session-id timestamp failingTestCount failingTestNames]
         (do
-          (d/update-session-data session-id {:timestamp timestamp
+          (d/update-session-data session-id {:timestamp (f/parse json-date-formatter timestamp)
                                              :failing-test-count failingTestCount
                                              :failing-test-names failingTestNames})
           (response/ok))))


Implement view selection links

Implement view selection links

--- src/cljs/cglossa/search_inputs/cwb.cljs
+++ src/cljs/cglossa/search_inputs/cwb.cljs
@@ -102,20 +102,24 @@
                         :cqp cqp
                         simple)
         languages     (:langs @corpus)
-        multilingual? (> (count languages) 1)]
+        multilingual? (> (count languages) 1)
+        set-view (fn [view e] (reset! search-view view) (.preventDefault e))]
     [:span
      [:div.search-input-links
       (if (= view simple)
         [:b "Simple"]
-        [:a {:href "" :title "Simple search box" :on-click #()} "Simple"])
+        [:a {:href "" :title "Simple search box"
+             :on-click #(set-view :simple %)} "Simple"])
       " | "
       (if (= view extended)
         [:b "Extended"]
-        [:a {:href "" :title "Search for grammatical categories etc." :on-click #()} "Extended"])
+        [:a {:href "" :title "Search for grammatical categories etc."
+             :on-click #(set-view :extended %)} "Extended"])
       " | "
       (if (= view cqp)
         [:b "CQP query"]
-        [:a {:href "" :title "CQP expressions" :on-click #()} "CQP query"])
+        [:a {:href "" :title "CQP expressions"
+             :on-click #(set-view :cqp %)} "CQP query"])
       [search-button multilingual?]
       (when multilingual? [add-language-button])]


Cursor arguments are switched now

Cursor arguments are switched now

--- src/cljs/cglossa/search_inputs/cwb.cljs
+++ src/cljs/cglossa/search_inputs/cwb.cljs
@@ -1,6 +1,6 @@
 (ns cglossa.search-inputs.cwb
   (:require [clojure.string :as str]
-            [reagent.core :as reagent :refer [cursor]]))
+            [reagent.core :as reagent]))

 (defn- phrase->cqp [phrase phonetic?]
   (let [attr (if phonetic? "phon" "word")
@@ -109,7 +109,7 @@
      ; and display a row of search inputs for each of them. The doall call is needed
      ; because ratoms cannot be derefed inside lazy seqs.
      (doall (for [index (range (count @search-queries))]
-              (let [query-cursor (cursor [index] search-queries)
+              (let [query-cursor (reagent/cursor search-queries [index])
                     selected-language (-> @query-cursor :query :lang)]
                 (when multilingual? [language-select languages selected-language])
                 [view query-cursor multilingual?])))


extract method

extract method

--- src/cljs/triboard/logic/transition.cljs
+++ src/cljs/triboard/logic/transition.cljs
@@ -31,6 +31,10 @@
   [cell]
   (or (= cell :empty) (= cell :wall)))

+(defn- is-source?
+  [looser cell]
+  (and looser (not= looser cell)))
+
 (defn- aboard-cell-at
   [board x y]
   (if (and (< -1 x board/width) (< -1 y board/height))
@@ -40,7 +44,7 @@
 (defn- seek-jump-source-toward
   "Starting from the destination of a jump (an empty cell):
    * search for valid source for the jump
-   * collect the jumped cells along the way" ;; TODO - Separate this? (could be faster)
+   * collect the jumped cells along the way"                ;; TODO - Separate this? (could be faster)
   [board [x-init y-init :as destination] [dx dy]]
   (loop [x (+ x-init dx)
          y (+ y-init dy)
@@ -49,10 +53,10 @@
     (let [cell (aboard-cell-at board x y)]
       (cond
         (block-jump? cell) nil
-        (and looser (not= looser cell)) {:winner cell
-                                         :looser looser
-                                         :destination destination
-                                         :taken taken}
+        (is-source? looser cell) {:winner cell
+                                  :looser looser
+                                  :destination destination
+                                  :taken taken}
         :else (recur
                 (+ x dx)
                 (+ y dy)


Make input view the first swipable screen.

--- src/clojure/my/stuff/fitlogger/main.clj
+++ src/clojure/my/stuff/fitlogger/main.clj
@@ -169,22 +169,12 @@
       (set-elmt activity :date
                 (format "%d%02d%02d" year (inc month) day)))))

-(defn pager-adapter [activity]
-  (proxy [PagerAdapter] []
-    (getCount [] 2)
-    (isViewFromObject [v o] (= v o))
-    (instantiateItem [coll, pos]
-      (let [tv (TextView. activity)]
-        (do (.setText tv (str pos))
-            (.addView coll tv 0)
-            tv)))))

 (defn show-picker [^Activity activity dp]
   (. dp show (. activity getFragmentManager) "datePicker"))

 (defn viewpager-layout [activity]
   [:linear-layout {:orientation :vertical}
-   [:edit-text {:hint "BLUB"}]
    [:view-pager {:id :awesomepager}]])

 (defn input-layout [activity]
@@ -209,6 +199,21 @@
                   :layout-weight 1}
     (format-listing @listing)]])

+
+(defn pager-adapter [activity]
+  (proxy [PagerAdapter] []
+    (getCount [] 2)
+    (isViewFromObject [v o] (= v o))
+    (instantiateItem [coll, pos]
+      (if (= pos 0)
+        (let [layout (make-ui activity (input-layout activity))]
+          (do (.addView coll layout 0)
+              layout))
+        (let [tv (TextView. activity)]
+          (do (.setText tv (str pos))
+              (.addView coll tv 0)
+              tv))))))
+
 ;; This is how an Activity is defined. We create one and specify its onCreate
 ;; method. Inside we create a user interface that consists of an edit and a
 ;; button. We also give set callback to the button.


Langohr 3.3.0

Langohr 3.3.0

--- clojure/project.clj
+++ clojure/project.clj
@@ -4,4 +4,4 @@
   :license {:name "Eclipse Public License"
             :url "http://www.eclipse.org/legal/epl-v10.html"}
   :dependencies [[org.clojure/clojure     "1.6.0"]
-                 [com.novemberain/langohr "3.0.1"]])
+                 [com.novemberain/langohr "3.3.0"]])


Fixed with-testing-data

Fixed with-testing-data

was broken for more than one testing argument.

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

--- src/conexp/util.clj
+++ src/conexp/util.clj
@@ -48,15 +48,16 @@
 				    namespaces))))))

 (defmacro with-testing-data
-  "Expects for all bindings of var to elements of coll the body to be
-  evaluated to true."
-  [[var coll] & body]
-  `(forall [~var ~coll]
+  "Expects for all bindings the body to be evaluated to true. bindings
+  must be those of forall."
+  [bindings & body]
+  `(forall ~bindings
      ~@(map (fn [expr]
               `(let [result# (do ~expr)]
                  (if-not result#
-                   (do (println "Test failed for" '~var "being" ~var)
-                       (is false))
+                   ~(let [vars (vec (take-nth 2 bindings))]
+                      `(do (println "Test failed for" '~vars "being" ~vars)
+                           (is false)))
                    (is true))))
             body)))


Use defcard-om for all cards

Use defcard-om for all cards

--- src/devcards/discuss/devcards/core.cljs
+++ src/devcards/discuss/devcards/core.cljs
@@ -17,10 +17,10 @@

 (def test-state (atom {:val {:discussion {:add_premise_text "There are many parks in neighbouring towns holds, because...", :bubbles [{:votecounts 29, :votecounts_message "29 more participants with this opinion.", :data_argument_uid "None", :omit_url false, :data_is_supportive "True", :is_status false, :id "1464001655.6145825", :data_statement_uid "51", :is_user true, :is_info false, :data_type "statement", :url "http://localhost:4284/discuss/town-has-to-cut-spending", :is_system false, :message "There are many parks in neighbouring towns."} {:votecounts 0, :votecounts_message "You are the first one with this opinion.", :data_argument_uid "None", :omit_url true, :data_is_supportive "None", :is_status true, :id "now", :data_statement_uid "None", :is_user false, :is_info false, :data_type "None", :url "None", :is_system false, :message "Now"} {:votecounts 0, :votecounts_message "You are the first one with this opinion.", :data_argument_uid "None", :omit_url true, :data_is_supportive "None", :is_status false, :id "1464001655.6119502", :data_statement_uid "None", :is_user false, :is_info false, :data_type "None", :url "None", :is_system true, :message "What is your most important reason why  there are many parks in neighbouring towns holds?
Because..."} {:votecounts 0, :votecounts_message "You are the first one with this opinion.", :data_argument_uid "None", :omit_url false, :data_is_supportive "None", :is_status false, :id "end", :data_statement_uid "None", :is_user false, :is_info true, :data_type "None", :url "None", :is_system false, :message "You are the first one, who said that There are many parks in neighbouring towns.
Please enter your reason for your statement."}], :mode "justify", :is_supportive true, :save_statement_url "ajax_set_new_start_statement", :search {:issue "1", :distance_name "Levensthein", :values [{:distance "00038", :url "api/town-has-to-cut-spending/justify/53/t", :statement_uid 53, :index 0, :text "Parks are very important for our climate."} {:distance "00040", :url "api/town-has-to-cut-spending/justify/51/t", :statement_uid 51, :index 1, :text "There are many parks in neighbouring towns."} {:distance "00067", :url "api/town-has-to-cut-spending/justify/44/t", :statement_uid 44, :index 2, :text "Spending of the city for these festivals are higher than the earnings."} {:distance "00081", :url "api/town-has-to-cut-spending/justify/54/t", :statement_uid 54, :index 3, :text "Our swimming pools are very old and it would take a major investment to repair them."}]}}, :issues {:date "3 hours ago", :slug "town-has-to-cut-spending", :uid 1, :all [{:uid "1", :url "", :arg_count 18, :title "Town has to cut spending ", :date "3 hours ago", :slug "town-has-to-cut-spending", :enabled "disabled", :info "Our town needs to cut spending. Please discuss ideas how this should be done."} {:uid "2", :url "api/cat-or-dog", :arg_count 30, :title "Cat or Dog", :date "3 hours ago", :slug "cat-or-dog", :enabled "enabled", :info "Your familiy argues about whether to buy a cat or dog as pet. Now your opinion matters!"} {:uid "3", :url "api/elektroautos", :arg_count 9, :title "Elektroautos", :date "3 hours ago", :slug "elektroautos", :enabled "enabled", :info "Elektroautos - Die Autos der Zukunft? Bitte diskutieren Sie dazu."} {:uid "4", :url "api/unterstuumltzung-der-sekretariate", :arg_count 0, :title "Unterstützung der Sekretariate", :date "3 hours ago", :slug "unterstuumltzung-der-sekretariate", :enabled "enabled", :info "Unsere Sekretariate in der Informatik sind arbeitsmäßig stark überlastet. Bitte diskutieren Sie Ma&szlignahmen zur Unterstützung der Sekretariate."}], :title "Town has to cut spending ", :info "Our town needs to cut spending. Please discuss ideas how this should be done.", :intro "Current discussion is about", :tooltip "The discussion was started 3 hours ago and already has 18 argument.", :arg_count 18}, :items [{:url "add", :already_used_text "", :id "item_start_premise", :already_used false, :premises [{:id 0, :title "None of the above! Let me state my own reason!"}], :attitude "justify"}], :layout {:loading? false, :add? false, :add-type :add-justify-premise, :template :discussion, :add-text "Let me enter my reason!", :title "discuss", :error-msg nil, :reference "Eine Krise in den neunziger Jahren brachte die Wende für die Stadt", :intro "The current discussion is about:", :error? false}, :debug {:last-api "api/get/statements/1/3/are", :response {:issues {:date "3 hours ago", :slug "town-has-to-cut-spending", :uid 1, :all [{:uid "1", :url "", :arg_count 18, :title "Town has to cut spending ", :date "3 hours ago", :slug "town-has-to-cut-spending", :enabled "disabled", :info "Our town needs to cut spending. Please discuss ideas how this should be done."} {:uid "2", :url "api/cat-or-dog", :arg_count 30, :title "Cat or Dog", :date "3 hours ago", :slug "cat-or-dog", :enabled "enabled", :info "Your familiy argues about whether to buy a cat or dog as pet. Now your opinion matters!"} {:uid "3", :url "api/elektroautos", :arg_count 9, :title "Elektroautos", :date "3 hours ago", :slug "elektroautos", :enabled "enabled", :info "Elektroautos - Die Autos der Zukunft? Bitte diskutieren Sie dazu."} {:uid "4", :url "api/unterstuumltzung-der-sekretariate", :arg_count 0, :title "Unterstützung der Sekretariate", :date "3 hours ago", :slug "unterstuumltzung-der-sekretariate", :enabled "enabled", :info "Unsere Sekretariate in der Informatik sind arbeitsmäßig stark überlastet. Bitte diskutieren Sie Ma&szlignahmen zur Unterstützung der Sekretariate."}], :title "Town has to cut spending ", :info "Our town needs to cut spending. Please discuss ideas how this should be done.", :intro "Current discussion is about", :tooltip "The discussion was started 3 hours ago and already has 18 argument.", :arg_count 18}, :items [{:url "add", :already_used_text "", :id "item_start_premise", :already_used false, :premises [{:id 0, :title "None of the above! Let me state my own reason!"}], :attitude "justify"}], :extras {:is_reportable false, :lang_is_de false, :link_en_class "active", :lang_is_en true, :nickname "Christian", :is_user_neutral false, :close_premise_container false, :is_user_female false, :logged_in true, :users_avatar "https://secure.gravatar.com/avatar/5fb6235d584543384ee61ac6814195bb?s=80&d=wavatar", :link_de_class "", :users_name "Christian", :show_bar_icon false, :is_user_male true, :restart_url "api/town-has-to-cut-spending", :add_premise_container_style "", :add_statement_container_style "display: none", :is_editable false, :show_display_style false}, :discussion {:add_premise_text "There are many parks in neighbouring towns holds, because...", :bubbles [{:votecounts 29, :votecounts_message "29 more participants with this opinion.", :data_argument_uid "None", :omit_url false, :data_is_supportive "True", :is_status false, :id "1464001655.6145825", :data_statement_uid "51", :is_user true, :is_info false, :data_type "statement", :url "http://localhost:4284/discuss/town-has-to-cut-spending", :is_system false, :message "There are many parks in neighbouring towns."} {:votecounts 0, :votecounts_message "You are the first one with this opinion.", :data_argument_uid "None", :omit_url true, :data_is_supportive "None", :is_status true, :id "now", :data_statement_uid "None", :is_user false, :is_info false, :data_type "None", :url "None", :is_system false, :message "Now"} {:votecounts 0, :votecounts_message "You are the first one with this opinion.", :data_argument_uid "None", :omit_url true, :data_is_supportive "None", :is_status false, :id "1464001655.6119502", :data_statement_uid "None", :is_user false, :is_info false, :data_type "None", :url "None", :is_system true, :message "What is your most important reason why  there are many parks in neighbouring towns holds?
Because..."} {:votecounts 0, :votecounts_message "You are the first one with this opinion.", :data_argument_uid "None", :omit_url false, :data_is_supportive "None", :is_status false, :id "end", :data_statement_uid "None", :is_user false, :is_info true, :data_type "None", :url "None", :is_system false, :message "You are the first one, who said that There are many parks in neighbouring towns.
Please enter your reason for your statement."}], :mode "justify", :is_supportive true, :save_statement_url "ajax_set_new_start_statement"}}}, :user {:nickname "Christian", :token "Christian-f96bad3afea854b9e2781a235f39d90ce32ed80e80732cf08defa279b202cbb0f3a811bc4d8150b2ad1463c21f45a36f1f5a444c52f19c09359e3bc8f9cc9dd5", :logged-in? true, :mouse-x 445, :mouse-y 783}, :clipboard {:selections nil, :current nil}, :sidebar {:show? true}}}))

-(defcard main
-         (dc/om-root views/main-view)
-         lib/app-state
-         #_{:history true})
+(defcard-om main
+            views/main-view
+            lib/app-state
+            #_{:history true})

 (defcard control-buttons
          ""
@@ -30,9 +30,10 @@
                               (vlib/fa-icon "fa-fort-awesome"))
                   (debug/control-buttons lib/app-state)))

-(defcard find-form
-         "*Select issue and search for statements.*"
-         (dc/om-root find/form-view))
+(defcard-om find-form
+            "*Select issue and search for statements.*"
+            find/form-view
+            lib/app-state)

 (defcard-om find-statement
             "*Query database to find statements.*"


Support question marks in text, Related #8

--- src/discuss/references/integration.cljs
+++ src/discuss/references/integration.cljs
@@ -2,6 +2,7 @@
   "Listen for mouse clicks, get references and highlight them in the article."
   (:require-macros [cljs.core.async.macros :refer [go]])
   (:require [goog.events :as events]
+            [goog.string :as gstring]
             [om.core :as om]
             [cljs.core.async :refer [put! chan <!]]
             [clojure.string :refer [split lower-case]]
@@ -70,7 +71,8 @@
         doms (minify-doms doms-raw)
         parent (get-parent doms ref-text)]
     (when (and parent (not (rlib/highlighted? ref-text)))
-      (let [dom-parts (split (lib/trim-and-normalize (.-innerHTML parent)) (re-pattern ref-text))
+      (let [ref-text-escaped (clojure.string/replace ref-text #"\?" "\\?")
+            dom-parts (split (lib/trim-and-normalize (.-innerHTML parent)) (re-pattern ref-text-escaped))
             first-part (first dom-parts)
             last-part (last dom-parts)]
         (om/root reference-view {:text     ref-text


Refactoring: function to read and parse numberic value from any stream read from Jenkins

--- src/emender_jenkins/metadata_reader.clj
+++ src/emender_jenkins/metadata_reader.clj
@@ -99,11 +99,16 @@
     [jenkins-url job-name]
 )

+(defn parse-first-number-from-stream
+    [input-stream default-value]
+    (let [lines (if input-stream (clojure.string/split-lines input-stream))]
+          (-> (first lines)
+              (parse-int default-value))))
+
 (defn read-and-parse-zpage-count
     [jenkins-url job-name]
-    (let [raw-data  (jenkins-api/read-file-from-artifact jenkins-url job-name (:zpage-count GuideStatisticResultNames) nil)
-          lines     (if raw-data (clojure.string/split-lines raw-data))]
-          (-> (first lines) parse-int)))
+    (-> (jenkins-api/read-file-from-artifact jenkins-url job-name (:zpage-count GuideStatisticResultNames) nil)
+        (parse-first-number-from-stream -1)))

 (defn job-results->job-names
     [job-results]


make duffel properly exit when done

make duffel properly exit when done

--- src/duffel/core.clj
+++ src/duffel/core.clj
@@ -77,11 +77,14 @@
      [ backup-count "Number of backup files to keep" "3" ]
      remaining]
     (if-let [dir (first remaining)]
-      (run { :proj-root (if-not (= (last dir) \/) (str dir "/") dir)
-             :chroot chroot
-             :no-backup no-backup?
-             :backup-dir backup-directory
-             :backup-count (str->int backup-count) })
+      (do
+        (run { :proj-root (if-not (= (last dir) \/) (str dir "/") dir)
+               :chroot chroot
+               :no-backup no-backup?
+               :backup-dir backup-directory
+               :backup-count (str->int backup-count) })
+        (flush)
+        (System/exit 0))
       (binding [*out* *err*]
           (println "A duffel directory must be specified")
           (flush)


Use port environment value when trying to investigate not starting on heroku

--- src/findash/web.clj
+++ src/findash/web.clj
@@ -4,7 +4,7 @@
             [compojure.handler :as handler]
             [compojure.route :as route]
             [hiccup.page :as page]
-            [environ.core :refer [env]
+            [environ.core :refer [env]]
             [org.httpkit.server :as httpkit]
             [findash.json :as json]
             [findash.socket :as socket]


Add tests for enabling tracing.

Add tests for enabling tracing.

--- test/cli4clj/test/cli.clj
+++ test/cli4clj/test/cli.clj
@@ -263,6 +263,23 @@

+(deftest enable-trace-test
+  (let [cli-opts {}
+        test-cmd-input ["_enable-trace true"]
+        out-string (test-cli-stdout #(start-cli cli-opts) test-cmd-input)]
+    (is (= (expected-string ["print-exception-trace is set to: true"]) out-string))))
+
+(deftest enable-trace-wrong-arg-test
+  (let [cli-opts {}
+        test-cmd-input ["_enable-trace 123"]
+        out-string (test-cli-stdout #(start-cli cli-opts) test-cmd-input)]
+    (is (= (expected-string
+             ["Error, you need to supply a boolean value: true or false"
+              "print-exception-trace is set to: false"])
+           out-string))))
+
+
+
 (deftest simple-jline-input-stream-mock-test
   (let [in-string (str "a 1" *cli4clj-line-sep* "b 2 3" *cli4clj-line-sep* "q" *cli4clj-line-sep*)
         out (binding [*jline-input-stream* (ByteArrayInputStream. (.getBytes in-string))]


adding more debug logs (#301)

adding more debug logs (#301)

--- server/src/spacon/components/config/core.clj
+++ server/src/spacon/components/config/core.clj
@@ -45,9 +45,9 @@
     (do (log/debug "Received request for config" msg)
       (let [user  (token->user (:jwt msg))
             cfg   (create-config config-comp user)]
-      (log/debug "Sending config to" user)
-      (queueapi/publish queue-comp (assoc msg :payload cfg))))
-    (log/error (s/explain :spacon.specs.msg/msg msg))))
+        (log/debug "Sending config to" user)
+        (queueapi/publish queue-comp (assoc msg :payload cfg))))
+    (log/errorf "config message was invalid b/c %s" (s/explain :spacon.specs.msg/msg msg))))

 (defn- queue->register
   "Queue message handler that registers a device"


cache last namespace seen on prompt

cache last namespace seen on prompt

read ana/*cljs-ns* only when we know for sure it is bound to proper value from REPL

--- sidecar/src/figwheel_sidecar/repl/driver.clj
+++ sidecar/src/figwheel_sidecar/repl/driver.clj
@@ -14,6 +14,7 @@

 (defn get-initial-settings []
   {:commands-channel                     (chan)                                                                               ; channel for REPL commands (actually command records) from *in* and also network
+   :last-ns                              (volatile! "")                                                                       ; string name of last namespace seen on prompt
    :current-job                          (volatile! nil)                                                                      ; command-record currently being processed {:request-id :kind :command}
    :active-repl-opts                     (volatile! nil)                                                                      ; cached repl opts
    :recording?                           (volatile! false)                                                                    ; should we record printing into *out* and *err*?
@@ -33,6 +34,12 @@
     (assert sniffer&)
     @sniffer&))

+(defn get-last-ns [driver]
+  @(:last-ns driver))
+
+(defn set-last-ns [driver name]
+  (vreset! (:last-ns driver) name))
+
 ; -- announcements ----------------------------------------------------------------------------------------------------------

 (defn announce-job-start [driver job]
@@ -44,7 +51,7 @@
     (messaging/announce-job-end (:server driver) request-id)))

 (defn announce-ns [driver]
-  (messaging/announce-repl-ns (:server driver) (str ana/*cljs-ns*)))
+  (messaging/announce-repl-ns (:server driver) (get-last-ns driver)))

 ; -- job management ---------------------------------------------------------------------------------------------------------

@@ -226,6 +233,7 @@
 (defn custom-prompt-factory [driver]
   (fn []
     (let [stdout-sniffer (get-sniffer driver :stdout)]
+      (set-last-ns driver (str ana/*cljs-ns*))
       (announce-ns driver)
       (suppress-flushing driver :stdout)
       (cljs-repl/repl-prompt)


CMR-4986: Added tests for new var bounds.

--- test/cmr/opendap/tests/unit/ous/variable.clj
+++ test/cmr/opendap/tests/unit/ous/variable.clj
@@ -132,6 +132,12 @@
          (variable/normalize-lat-lon
           (variable/extract-dimensions no-spatial-dims)))))

+(deftest extract-bounds
+  (is (= {:low {:lon -180 :lat -90}
+          :high {:lon 180 :lat 90}
+          :lat-reversed? false}
+         (into {} (variable/extract-bounds ummvar-1-2-bounds)))))
+
 (deftest create-opendap-bounds
   (let [dims (array-map :Longitude {:Size 360} :Latitude {:Size 180})
         bounds [-27.421875 53.296875 18.5625 69.75]


has-lookups?-test

has-lookups?-test

--- test/er_cassandra/model/alia/upsert_test.clj
+++ test/er_cassandra/model/alia/upsert_test.clj
@@ -338,7 +338,21 @@
             {})))))

 (deftest has-lookups?-test
-  )
+  (let [m (t/create-entity
+           {:primary-table {:name :has_lookups_test :key [:org_id :id]}
+            :unique-key-tables [{:name :has_lookups_test_by_nick
+                                 :key [:org_id :nick]}]})]
+    (is (= false (u/has-lookups? m))))
+  (let [m (t/create-entity
+           {:primary-table {:name :has_lookups_test :key [:org_id :id]}
+            :lookup-key-tables [{:name :has_lookups_test_by_nick
+                                 :key [:org_id :nick]}]})]
+    (is (= true (u/has-lookups? m))))
+  (let [m (t/create-entity
+           {:primary-table {:name :has_lookups_test :key [:org_id :id]}
+            :secondary-tables [{:name :has_lookups_test_by_nick
+                                :key [:org_id :nick]}]})]
+    (is (= true (u/has-lookups? m)))))

 (deftest update-secondaries-and-lookups-test)


fixes with-mongo macro by removing uneeded 'karras/' qualifier

This was probably cruft from a refactoring...

--- src/karras/core.clj
+++ src/karras/core.clj
@@ -89,7 +89,7 @@
 (defmacro with-mongo
   "Macro to bind *mongo-db*"
   [mongo-db & body]
-  `(binding [karras/*mongo-db* ~mongo-db]
+  `(binding [*mongo-db* ~mongo-db]
      ~@body))

 (defmacro with-mongo-request


add node-stats to consumer.node

add node-stats to consumer.node

--- kafka-clj/src/kafka_clj/consumer/node.clj
+++ kafka-clj/src/kafka_clj/consumer/node.clj
@@ -3,7 +3,7 @@
            (org.openjdk.jol.info GraphLayout))
   (:require
     [kafka-clj.consumer.work-organiser :refer [create-organiser! close-organiser! calculate-new-work]]
-    [kafka-clj.consumer.consumer :refer [consume! close-consumer!]]
+    [kafka-clj.consumer.consumer :refer [consume! close-consumer! consumer-pool-stats]]
     [kafka-clj.redis.core :as redis]
     [com.stuartsierra.component :as component]
     [fun-utils.core :refer [fixdelay-thread stop-fixdelay buffered-chan]]
@@ -154,6 +154,11 @@
      :redis-conn         redis-conn
      :work-unit-event-ch work-unit-event-ch}))

+(def node-stats
+  "Returns the consumer stats, takes as argument the instance returned from create-node!"
+  [{:keys [consumer]}]
+  (consumer-pool-stats consumer))
+
 (defn conn-pool-idle
   "Return the number of idle redis connections used by the consumer node"
   [{:keys [redis-conn]}]


Fix Problem with Duplicate Datoms in Transaction.

--- src/lens/schema.clj
+++ src/lens/schema.clj
@@ -280,7 +280,7 @@
                    cells new-cell-seq
                    tx-data [{:db/id new-col :query.col/cells tid}]]
               (if (next cells)
-                (let [next-tid #db/id[:db.part/user]]
+                (let [next-tid (d/tempid :db.part/user)]
                   (recur
                     next-tid
                     (rest cells)


Styling of change password form

Styling of change password form

--- src/braid/core/client/ui/styles/pages/me.cljs
+++ src/braid/core/client/ui/styles/pages/me.cljs
@@ -6,4 +6,9 @@

 (def me-page
   [:>.page.me
-   (mixins/settings-style)])
+   (mixins/settings-style)
+   [:>.content
+    [:>.setting
+     [:form.password
+      [:label
+       {:display "block"}]]]]])


Use same thickness for all graph edge lines. #48

--- samples/twitterbuzz/src/twitterbuzz/showgraph.cljs
+++ samples/twitterbuzz/src/twitterbuzz/showgraph.cljs
@@ -12,7 +12,6 @@

 ; Drawing configuration
 (def avatar-size 32) ; used for both x and y dimensions of avatars
-(def edge-widths [0 1 2 3 4]) ; More mentions == thicker edges
 (def anneal-skipping 10)
 (def cooling 1000)
 ; fail whale
@@ -25,10 +24,7 @@
 ; BAD HACK: don't change globals like this -- find a better way:
 ;(set! anim/TIMEOUT 500)

-(def edge-strokes
-  (vec (map #(graphics/Stroke. % "#009") edge-widths)))
-
-(def max-stroke (peek edge-strokes))
+(def edge-stroke (graphics/Stroke. 1 "#009"))

 (def g
   (doto (graphics/createGraphics "100%" "100%")
@@ -57,7 +53,7 @@
               y2 (unit-to-pixel uy2 (.height canvas-size))]
           (.drawPath g
                     (-> (. g (createPath)) (.moveTo x1 y1) (.lineTo x2 y2))
-                    (get edge-strokes mention-count max-stroke) nil))))
+                    edge-stroke nil))))

     ; Draw avatar nodes
     (doseq [[username {:keys [x y] :as foo}] locs]


relax matching headers

relax matching headers

--- src/rester/core.clj
+++ src/rester/core.clj
@@ -162,7 +162,7 @@
    (and (not= status exp-status)
         (format "expected status %d, but received %d" exp-status status))
    (some (fn [[header value]]
-           (if (not= value (headers header))
+           (if-not (.contains (str (headers header) "") value)
              (str "header " header " was " (headers header) " expected " value))) exp-headers)
    (when-let [ldiff (diff* exp-body body)]
      (log/error "failed matching body. expected:" exp-body " got:" body)


Move runbld.conf to /etc/runbld/

Move runbld.conf to /etc/runbld/

--- src/runbld/opts.clj
+++ src/runbld/opts.clj
@@ -39,8 +39,8 @@
 (defn system-config []
   (io/file
    (if (.startsWith (System/getProperty "os.name") "Windows")
-     "c:\\runbld.conf"
-     "/etc/runbld.conf")))
+     "c:\\runbld\\runbld.conf"
+     "/etc/runbld/runbld.conf")))

 (defn merge-opts-with-file [opts]
   (deep-merge-with deep-merge


Fix the scheduler interval bug

Fix the scheduler interval bug

--- src/shuppet/web.clj
+++ src/shuppet/web.clj
@@ -107,7 +107,7 @@

 (defn- stop-schedule
   [env name interval]
-  (let [interval (or interval core/default-stop-interval)]
+  (let [interval (Integer/valueOf (or interval core/default-stop-interval))]
     (core/stop-schedule-temporarily env name interval)
     (response {:message (str "Scheduler for " name " is stopped for " interval " minutes in environment" env)})))


Fix auth to report heroku url

Fix auth to report heroku url

--- src/sleuth/auth.clj
+++ src/sleuth/auth.clj
@@ -8,7 +8,9 @@
 (defn verify
   [assertion]
   (let [body  (json/write-str {:assertion assertion
-                               :audience "http://localhost:3000"})]
+                               :audience (if (get (System/getenv) "LEIN_NO_DEV")
+                                           "https://sleuther.herokuapp.com"
+                                           "http://localhost:3000")})]
     (client/post "https://login.persona.org/verify"
                  {:body body
                   :headers {"Content-Type" "application/json"}})))


[#1161] Catch Throwable to handle possible OutOfMemoryError

--- backend/src/akvo/lumen/lib/raster_impl.clj
+++ backend/src/akvo/lumen/lib/raster_impl.clj
@@ -104,7 +104,7 @@
                                          (.setValue (json/generate-string metadata)))
                              :raster-table table-name})
         (update-successful-job-execution conn {:id job-execution-id})))
-    (catch Exception e
+    (catch Throwable e
       (update-failed-job-execution conn {:id job-execution-id
                                          :reason (.getMessage e)}))))


removed clj src

removed clj src

--- src/uboats/core.clj
+++ src/uboats/core.clj
@@ -1,14 +0,0 @@
-(ns uboats.core
-  (:use ring.adapter.jetty)
-  (:use ring.util.response)
-  (:use ring.middleware.file)
-  (:use ring.middleware.resource))
-
-(defn handler [request]
-  (file-response "index.html" {:root "resources/public"}))
-
-(def static-files
-  (wrap-file handler "resources/public"))
-
-(defn -main []
-  (run-jetty static-files {:port 3000}))


CMR-1953: Add KMS cache, KMS connection config, and Cubby config to bootstrap app

--- bootstrap-app/src/cmr/bootstrap/system.clj
+++ bootstrap-app/src/cmr/bootstrap/system.clj
@@ -23,6 +23,7 @@
             [cmr.indexer.data.concepts.granule :as g]
             [cmr.common.cache :as cache]
             [cmr.common.cache.in-memory-cache :as mem-cache]
+            [cmr.common-app.services.kms-fetcher :as kf]
             [cmr.common.config :as cfg :refer [defconfig]]
             [cmr.bootstrap.config :as bootstrap-config]
             [cmr.acl.core :as acl]))
@@ -85,8 +86,9 @@
              :scheduler (jobs/create-clustered-scheduler `system-holder :jobs-db bootstrap-jobs/jobs)
              :zipkin (context/zipkin-config "bootstrap" false)
              :relative-root-url (transmit-config/bootstrap-relative-root-url)
-             :caches {acl/token-imp-cache-key (acl/create-token-imp-cache)}}]
-    (transmit-config/system-with-connections sys [:metadata-db :echo-rest])))
+             :caches {acl/token-imp-cache-key (acl/create-token-imp-cache)
+                      kf/kms-cache-key (kf/create-kms-cache)}}]
+    (transmit-config/system-with-connections sys [:metadata-db :echo-rest :kms :cubby ])))

 (defn start
   "Performs side effects to initialize the system, acquire resources,


Breaking apart v2 build header into smaller helper functions.

--- src-cljs/frontend/components/build_head.cljs
+++ src-cljs/frontend/components/build_head.cljs
@@ -1081,6 +1081,68 @@
              ;; avoid errors if a nonexistent tab is typed in the URL
              nil)]])))))

+(defn build-canceler [canceler github-endpoint]
+  [:div.row
+   [:span
+    (list "Canceled by "
+          [:a  {:href  (str  (github-endpoint) "/"  (:login canceler))}
+           (if  (not-empty  (:name canceler))
+             (:name canceler)
+             (:login canceler))])]])
+
+(defn pull-requests [urls]
+  ;; It's possible for a build to be part of multiple PRs, but it's rare
+  (list
+    [:span.summary-spacer "•"]
+    [:span.summary-label
+     (str "Pull Request" (when (< 1 (count urls)) "s") ": ")]
+    [:span
+     (interpose
+       ", "
+       (map (fn [url] [:a {:href url} "#"
+                       (let [n (re-find #"/\d+$" url)]
+                         (if n (subs n 1) "?"))])
+            urls))]))
+
+(defn queued-time [build]
+  (if (< 0 (build-model/run-queued-time build))
+    [:span
+     (om/build common/updating-duration {:start (:usage_queued_at build)
+                                         :stop (or (:queued_at build) (:stop_time build))})
+     " waiting + "
+     (om/build common/updating-duration {:start (:queued_at build)
+                                         :stop (or (:start_time build) (:stop_time build))})
+     " in queue"]
+
+    [:span
+     (om/build common/updating-duration {:start (:usage_queued_at build)
+                                         :stop (or (:queued_at build) (:stop_time build))})
+     " waiting for builds to finish"]))
+
+(defn build-finished-status [build]
+  (let [stop-time  (:stop_time build)
+        start-time (:start_time build)]
+    [:div
+     [:span.summary-label "Finished: "]
+     [:span.stop-time
+      (when stop-time
+        {:title (datetime/full-datetime stop-time)})
+      (when stop-time
+        (list (om/build common/updating-duration
+                        {:start stop-time}
+                        {:opts {:formatter datetime/time-ago}}) " ago"))]
+
+     [:span
+      " ("
+      (if (build-model/running? build)
+        (om/build common/updating-duration {:start start-time
+                                            :stop  stop-time})
+        (build-model/duration build))
+      (om/build expected-duration {:start start-time
+                                   :stop  stop-time
+                                   :build build})
+      ")"]]))
+
 (defn build-head-v2 [data owner]
   (reify
     om/IRender
@@ -1108,27 +1170,8 @@
              [:span.badge.build-status {:class (build-model/status-class build)}
               [:img.badge-icon {:src (-> build build-model/status-icon-v2 common/icon-path)}]
               (build-model/status-words build)]
-             (when-let [stop-time (:stop_time build)]
-               [:div
-                [:span.summary-label "Finished: "]
-                [:span.stop-time
-                 (when (:stop_time build)
-                   {:title (datetime/full-datetime (:stop_time build))})
-                 (when (:stop_time build)
-                   (list (om/build common/updating-duration
-                                   {:start (:stop_time build)}
-                                   {:opts {:formatter datetime/time-ago}}) " ago"))]
-
-                [:span
-                 " ("
-                 (if (build-model/running? build)
-                   (om/build common/updating-duration {:start (:start_time build)
-                                                       :stop (:stop_time build)})
-                   (build-model/duration build))
-                 (om/build expected-duration {:start (:start_time build)
-                                              :stop (:stop_time build)
-                                              :build build})
-                 ")"]])
+             (when (:stop_time build)
+               (build-finished-status build))
              [:div
               [:span.summary-label "Previous:"]
               [:a {:href (routes/v1-build-path (vcs-url/org-name vcs-url) (vcs-url/repo-name vcs-url) (:build_num (:previous build)))}
@@ -1143,37 +1186,18 @@
              (when (:usage_queued_at build)
                [:div
                 [:span.summary-label "Queued"]
-                [:span (if (< 0 (build-model/run-queued-time build))
-                         [:span
-                          (om/build common/updating-duration {:start (:usage_queued_at build)
-                                                              :stop (or (:queued_at build) (:stop_time build))})
-                          " waiting + "
-                          (om/build common/updating-duration {:start (:queued_at build)
-                                                              :stop (or (:start_time build) (:stop_time build))})
-                          " in queue"]
-
-                         [:span
-                          (om/build common/updating-duration {:start (:usage_queued_at build)
-                                                              :stop (or (:queued_at build) (:stop_time build))})
-                          " waiting for builds to finish"])]])
+                [:span  (queued-time build)]])

              [:div.summary-build-contents
               [:span.summary-label "Triggered by: "]
               [:span (trigger-html build)]

               (when-let [urls (seq (:pull_request_urls build))]
-                ;; It's possible for a build to be part of multiple PRs, but it's rare
-                (list
-                  [:span.summary-spacer "•"]
-                  [:span.summary-label
-                    (str "Pull Request" (when (< 1 (count urls)) "s") ": ")]
-                  [:span
-                   (interpose
-                     ", "
-                     (map (fn [url] [:a {:href url} "#"
-                                     (let [n (re-find #"/\d+$" url)]
-                                       (if n (subs n 1) "?"))])
-                          urls))]))]]]
+                (pull-requests urls))]]]
+
+           (when-let  [canceler  (and  (=  (:status build) "canceled")
+                                       (:canceler build))]
+             (build-canceler canceler github-endpoint))
            [:div.card
             [:div.small-emphasis "Commits (" (-> build :all_commit_details count) ")"]
             (om/build build-commits-v2 build-data)]


matcher-combinators: Improve `sets-test`

--- test/com/nomistech/clojure_the_language/c_800_libraries/s_106_matcher_combinators/matcher_generators_test.clj
+++ test/com/nomistech/clojure_the_language/c_800_libraries/s_106_matcher_combinators/matcher_generators_test.clj
@@ -124,17 +124,17 @@
               [1 2 3])))

 (deftest sets-test
-  ;; A set is also interpreted as an `equals` matcher.
-  (is (match? #{1 2 3} #{3 2 1}))
-  (is (match? #{odd? even?} #{1 2}))
-  ;; use m/set-equals to repeat predicates
-  (is (match? (m/set-equals [odd? odd? even?]) #{1 2 3}))
-
+  ;; A set is interpreted as an `equals` matcher.
   ;; NOTE: matching sets is an O(n!) operation because it compares every
   ;; expected element with every actual element in order to find a best-match
   ;; for each one, removing matched elements from both sets as it goes.
   ;; Avoid applying this to large sets.
-  )
+
+  (is (match? #{1 2 3} #{3 2 1}))
+  (is (match? #{odd? even?} #{1 2}))
+
+  ;; Use `m/set-equals` to repeat predicates.
+  (is (match? (m/set-equals [odd? odd? 2]) #{1 2 3})))

 (deftest nested-datastructures-test
   ;; Maps, sequences, and sets follow the same semantics whether at


:cake:

:cake:

Adding subscription

--- src/main/clj/agency/irl/instagrammer/core.clj
+++ src/main/clj/agency/irl/instagrammer/core.clj
@@ -67,15 +67,15 @@
   (run-server app {:port (Integer. (or port (env :port) 5000))})

   ;; Bing all that jazz
-; (binding [subscribe/*client-id*     (:client-id client-options)
-;           subscribe/*client-secret* (:client-secret client-options)
-;           subscribe/*callback-url*  (:callback-url client-options)]
+  (binding [subscribe/*client-id*     (:client-id client-options)
+            subscribe/*client-secret* (:client-secret client-options)
+            subscribe/*callback-url*  (:callback-url client-options)]

-;   (let [sub-geo (subscribe/geo :lat 40.7903 :lng 73.9597 :radius 25)]
-;     (println "<<<<<")
-;     (println @sub-geo)
-;     (println ">>>>>")
-;     ))
+    (let [sub-geo (subscribe/geo :lat 40.7903 :lng 73.9597 :radius 25)]
+      (println "<<<<<")
+      (println @sub-geo)
+      (println ">>>>>")
+      ))

 ; (with-instagram client-options
 ;   (let [geo-sub (subscribe/geo :lng 0 :lat 0 :radius 100)


Move some of the copy into the dialog

Move some of the copy into the dialog

--- src-cljs/frontend/components/project_settings.cljs
+++ src-cljs/frontend/components/project_settings.cljs
@@ -467,15 +467,15 @@
                "The values can be any bash expression and can reference other variables, such as setting "
                [:code "M2_MAVEN"] " to " [:code "${HOME}/.m2)"] "."]

-              [:p
-               " To disable string substitution you need to escape the " [:code "$"]
-               " characters by prefixing them with " [:code "\\"] "."
-               " For example, a value like " [:code "usd$"] " would be entered as " [:code "usd\\$"] "."]
               (when show-modal?
                 (let [close-fn #(om/set-state! owner :show-modal? false)]
                   (modal/modal-dialog {:title "Add an Environment Variable"
                                        :body (html
                                               [:form
+                                               [:p
+                                                " To disable string substitution you need to escape the " [:code "$"]
+                                                " characters by prefixing them with " [:code "\\"] "."
+                                                " For example, a value like " [:code "usd$"] " would be entered as " [:code "usd\\$"] "."]
                                                [:div.form-group
                                                 [:label "Name"]
                                                 [:input.form-control#env-var-name


redirect after signin

redirect after signin

--- src/word_keeper/frontend.clj
+++ src/word_keeper/frontend.clj
@@ -41,13 +41,14 @@
       (do
         (if (nil? (find-twitter-user (Integer/parseInt user_id)))
           (create-twitter-user! (Integer/parseInt user_id)  screen_name))
-        {:status 200
-         :headers {"Content-Type" "text/plain"}
-         :body (str "Signed in as " screen_name)
+        {:status 301
+         :headers {"location" "/vocabulary"}
          :session (assoc (:session req) :uid (:uid (find-twitter-user (Integer/parseInt user_id))))})
-      {:status 200
-       :headers {"Content-Type" "text/plain"}
-       :body ("Something went wrong")})))
+      {:status 301
+       :headers {"location" "/"}
+       :session (assoc (:session req)
+                  :notice "Something went wrong. Please try again."
+                  :show_notice true)})))

 (defn action-signout [req]
   (let [session (assoc (:session req)


prevent leakage of clojure-agent-send-off-pools

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

--- acqEngine/src/org/micromanager/acq_engine.clj
+++ acqEngine/src/org/micromanager/acq_engine.clj
@@ -400,11 +400,13 @@
                            (if (instance? Throwable item)
                              (throw item)
                              item))))]
-    (future (dotimes [_ n]
-              (try (.put queue (function))
-                   (catch Throwable t
-                          (.put queue t)
-                          (throw t)))))
+    (future (try
+              (dotimes [_ n]
+                (try (.put queue (function))
+                     (catch Throwable t
+                            (.put queue t)
+                            (throw t))))
+              (catch Throwable t nil)))
     queue))

 (defn pop-burst-images


Use keywords rather than midi.

Use keywords rather than midi.

--- src/overtunes/songs/row_row_row_your_boat.clj
+++ src/overtunes/songs/row_row_row_your_boat.clj
@@ -9,23 +9,29 @@
       (pluck (* (white-noise) (env-gen (perc 0.001 5) :action FREE))
              1 1 (/ 1 freq) (* duration 2) 0.25))))

-(def notes
+(def melody
   (let [pitches
-         [67 67 67 69 71              ; Row, row, row your boat,
-          71 69 71 72 74              ; Gently down the stream,
-          79 79 79 74 74 74 71 71 71  ; Merrily, merrily, merrily, merrily,
-          67 67 67 74 72 71 69 67]    ; Life is but a dream!
+         [:C4 :C4 :C4 :D4 :E4
+          ; Row, row, row your boat,
+          :E4 :D4 :E4 :F4 :G4
+          ; Gently down the stream,
+          :C5 :C5 :C5 :G4 :G4 :G4 :E4 :E4 :E4 :C4 :C4 :C4
+          ; Merrily, merrily, merrily, merrily,
+          :G4 :F4 :E4 :D4 :C4]
+          ; Life is but a dream!
         durations
          [1 1 2/3 1/3 1
           2/3 1/3 2/3 1/3 2
           1/3 1/3 1/3 1/3 1/3 1/3 1/3 1/3 1/3 1/3 1/3 1/3
           2/3 1/3 2/3 1/3 2]
         times (reductions + 0 durations)]
-    (map vector timings pitches)))
+    (map vector times pitches)))
+
+(note :C3)

 (defn play [metro notes]
-  (let [play-note (fn [[beat midi]] (at (metro beat) (-> midi midi->hz harpsichord)))]
+  (let [play-note (fn [[beat pitch]] (at (metro beat) (-> pitch note midi->hz harpsichord)))]
     (dorun (map play-note notes))))

 (defn play-round [metro notes]
@@ -35,5 +41,5 @@
     (play (after 8 metro) notes)
     (play (after 16 metro) notes)))

-;(play (metronome 120) notes)
-;(play-round (metronome 120) notes)
+;(play (metronome 120) melody)
+;(play-round (metronome 120) melody)


Remove number or arguments case.

Remove number or arguments case.

--- test/cli4clj/test/example.clj
+++ test/cli4clj/test/example.clj
@@ -34,11 +34,9 @@

 (deftest advanced-main-method-error-example-test
   (let [test-cmd-input ["xyz"
-                        "d 4 0"
-                        "a 1 2 3"]
+                        "d 4 0"]
         out-string (test-cli-stderr #(-main "") test-cmd-input)]
     (is (= (expected-string ["Invalid command: \"[xyz]\". Please type \"help\" to get an overview of commands."
-                             "Divide by zero"
-                             "Wrong number of args (3) passed to: example/-main/fn--117"])
+                             "Divide by zero"])
            out-string))))


Reformat

Reformat

--- test/icecap/e2e/http_test.clj
+++ test/icecap/e2e/http_test.clj
@@ -82,5 +82,5 @@

 (deftest invalid-http-step-tests
   (are [step expected] (= (get-body @(create-cap step)) {:error expected})
-       {:type :http} '{:url missing-required-key
-                       :method missing-required-key}))
+    {:type :http} '{:url missing-required-key
+                    :method missing-required-key}))


optimized hugely with computer magic

optimized hugely with computer magic

--- src/atom_finder/classifier/operator-precedence.clj
+++ src/atom_finder/classifier/operator-precedence.clj
@@ -51,16 +51,16 @@
 (defn specific-confusing-operator-combination?
   "if the combination of groups of operators exists in this set, then the combination is confusing"
   [combination]
-  (some #(= % combination) (map sort [[:de_incr :pointer] [:multiply :add] [:arith_unary :add] [:arith_unary :multiply]
-                                      [:and :add] [:and :multiply] [:and :arith_unary] [:or :add]
-                                      [:or :multiply] [:or :arith_unary] [:or :and] [:not :add]
-                                      [:not :multiply] [:not :arith_unary] [:not :and] [:not :or]
-                                      ;;[:compare :and] [:compare :or] // Underclassify
-                                      [:compare :not] [:compare :compare] [:pointer :add] [:cond :arith_unary]
-                                      [:cond :and] [:cond :or] [:cond :not] [:cond :compare]
-                                      [:cond :cond] [:non-asso :add] [:non-asso :multiply] [:non-asso :arith_unary]
-                                      [:non-asso :and] [:non-asso :or] [:non-asso :not] [:non-asso :non-asso]
-                                      [:field_ref :pointer]])))
+  (some #(= % combination) (into #{} (map sort [[:de_incr :pointer] [:multiply :add] [:arith_unary :add] [:arith_unary :multiply]
+                                                [:and :add] [:and :multiply] [:and :arith_unary] [:or :add]
+                                                [:or :multiply] [:or :arith_unary] [:or :and] [:not :add]
+                                                [:not :multiply] [:not :arith_unary] [:not :and] [:not :or]
+                                                ;;[:compare :and] [:compare :or] // Underclassify
+                                                [:compare :not] [:compare :compare] [:pointer :add] [:cond :arith_unary]
+                                                [:cond :and] [:cond :or] [:cond :not] [:cond :compare]
+                                                [:cond :cond] [:non-asso :add] [:non-asso :multiply] [:non-asso :arith_unary]
+                                                [:non-asso :and] [:non-asso :or] [:non-asso :not] [:non-asso :non-asso]
+                                                [:field_ref :pointer]]))))

 (def always-confusing-operator-groups
   "If any of these operator groups is used along with another operator, then it is confusing"


upsert test data in the past

upsert test data in the past


expose more bookmarks

expose more bookmarks


Changed jetty :join option to :join? to match doc

--- ring-jetty-adapter/src/ring/adapter/jetty.clj
+++ ring-jetty-adapter/src/ring/adapter/jetty.clj
@@ -66,6 +66,6 @@
     (doto s
       (.setHandler (proxy-handler handler))
       (.start))
-    (when (:join options true)
+    (when (:join? options true)
       (.join s))
     s))


Update comment with REPL output

Update comment with REPL output

--- examples/caching_middleware.clj
+++ examples/caching_middleware.clj
@@ -51,12 +51,12 @@
 ;;
 ;; user> (use '[clj-http.examples.caching-middleware :as mw])
 ;; nil
-;; user> (clojure.pprint/pprint (mw/example))
+;; user> (mw/example)
 ;; CACHE MISS
-;; "Elapsed time: 2044.735745 msecs"
-;; nil
-;; user> (clojure.pprint/pprint (mw/example))
+;; "Elapsed time: 1910.027361 msecs"
+;; {:status 200, :reason-phrase "OK"}
+;; user> (mw/example)
 ;; CACHE HIT
-;; "Elapsed time: 0.89591 msecs"
-;; nil
+;; "Elapsed time: 0.83484 msecs"
+;; {:status 200, :reason-phrase "OK"}
 ;; user>


fixes flaky test (#1179)

fixes flaky test (#1179)

> **Epic** #
> Close #https://github.com/advthreat/iroh/issues/6016
> Related #

[§](#qa) QA
============================

No QA is needed.

[§](#squashed-commits) Squashed Commits
======================================================================

--- test/ctia/http/generative/fulltext_search_test.clj
+++ test/ctia/http/generative/fulltext_search_test.clj
@@ -316,13 +316,23 @@
                                  (fn [items]
                                    (utils/update-items items #(merge % expected))))))
                       gen/generate)
-
-            _ (bundle/import-bundle
-               bundle
-               nil    ;; external-key-prefixes
-               login services)
-
             ignore-ks  [:created :groups :id :incident_time :modified :owner :timestamp]]
+
+        ;; to avoid accidentally picking up previous state
+        (store/delete-search incidents-store
+                             {:query "intrusion event 3\\:19187\\:7 incident"
+                              :REALLY_DELETE_ALL_THESE_ENTITIES true}
+                             login nil)
+        (is (-> incidents-store
+                (store/query-string-search
+                 {:query "intrusion event 3\\:19187\\:7 incident"}
+                 login {})
+                :data
+                empty?))
+
+        (bundle/import-bundle bundle
+                              nil    ;; external-key-prefixes
+                              login services)
         (are [desc query check-fn] (let [res (-> incidents-store
                                                  (store/query-string-search
                                                   (merge query {:default_operator "AND"})


Add some whitespace

Add some whitespace

--- test/onyx/peer/restart_pred_fn_test.clj
+++ test/onyx/peer/restart_pred_fn_test.clj
@@ -39,6 +39,7 @@
                              (when (= (swap! batch-counter inc) 2)
                                (throw (ex-info "Oops, I died." {:restartable? true})))
                              {})})
+
 (defn my-inc [{:keys [n] :as segment}]
   (assoc segment :n (inc n)))


p30 test.

p30 test.


Code refactor: improve variable naming.

Code refactor: improve variable naming.

--- hackerrank/simple-array-sum.clj
+++ hackerrank/simple-array-sum.clj
@@ -1,9 +1,9 @@
 ; https://www.hackerrank.com/challenges/simple-array-sum
 (use '[clojure.string :only (split triml)])

-(let [n_t (read-line)
-      n (Integer/parseInt n_t)
-      arr_temp (read-line)
-      arr_t (split arr_temp #"\s+")
-      arr (map #(Integer/parseInt %) arr_t)]
-  (println(reduce + arr)))
+(let [arrayLengthString (read-line)
+      arrayLength (Integer/parseInt arrayLengthString)
+      arrayLine (read-line)
+      arrayString (split arrayLine #"\s+")
+      array (map #(Integer/parseInt %) arrayString)]
+  (println(reduce + array)))


Use namespaced state

Use namespaced state

--- fulcro-todo/src/main/app/ui.cljs
+++ fulcro-todo/src/main/app/ui.cljs
@@ -6,11 +6,11 @@
 (defui ^:once ItemAdder
   static
   fc/InitialAppState
-  (initial-state [c params] {:input-value ""
-                             :valid-input-value? false})
+  (initial-state [c params] {:item-adder/input-value ""})
   Object
   (render [this]
-          (let [{:keys [input-value valid-input-value?]} (om/props this)]
+          (let [{:keys [item-adder/input-value]} (om/props this)
+                valid-input-value? false]
             (dom/form
              #js {:className "item-adder"
                   :onSubmit #(.preventDefault %)}
@@ -32,12 +32,12 @@
 (defui ^:once Item
   static
   fc/InitialAppState
-  (initial-state [c {:keys [added-at text]}] {:added-at added-at
-                                              :text text
-                                              :checked? false})
+  (initial-state [c {:keys [added-at text]}] {:item/added-at added-at
+                                              :item/text text
+                                              :item/checked? false})
   Object
   (render [this]
-          (let [{:keys [added-at text checked?]} (om/props this)]
+          (let [{:keys [item/added-at item/text item/checked?]} (om/props this)]
             (dom/li
              #js {:className "item"}

@@ -65,21 +65,16 @@
 (defui ^:once ItemList
   static
   fc/InitialAppState
-  (initial-state [c params] {:items-by-added-at {1508175827181 {:added-at 1508175827181
-                                                                :text "hello"}
-                                                 1508175970713 {:added-at 1508175970713
-                                                                :text "world"}}
-                             :item-list '(1508175827181 1508175970713)
-                             :items [(fc/get-initial-state Item {:added-at 1508175827181
-                                                                 :text "hello"
-                                                                 :checked? false})
-                                     (fc/get-initial-state Item {:added-at 1508175970713
-                                                                 :text "world"
-                                                                 :checked? true})]})
+  (initial-state [c params] {:item-list/items [(fc/get-initial-state Item {:added-at 1508175827181
+                                                                           :text "hello"
+                                                                           :checked? false})
+                                               (fc/get-initial-state Item {:added-at 1508175970713
+                                                                           :text "world"
+                                                                           :checked? true})]})
   Object
   (render [this]
-          (let [{:keys [items-by-added-at item-list items]} (om/props this)]
-            (if (empty? item-list)
+          (let [{:keys [item-list/items]} (om/props this)]
+            (if (empty? items)
               (dom/div
                #js {:className "item-list"}
                (dom/div
@@ -109,13 +104,13 @@
 (defui ^:once App
   static
   fc/InitialAppState
-  (initial-state [c params] {:item-adder (fc/get-initial-state ItemAdder {})
-                             :item-list (fc/get-initial-state ItemList {})})
+  (initial-state [c params] {:app/item-adder (fc/get-initial-state ItemAdder {})
+                             :app/item-list (fc/get-initial-state ItemList {})})

   Object
   (render [this]
           (let [{:keys [ui/react-key]} (om/props this)
-                {:keys [item-adder item-list]} (fc/get-initial-state App {})]
+                {:keys [app/item-adder app/item-list]} (fc/get-initial-state App {})]
             (dom/div
              #js {:key react-key
                   :className "app"}