removed extra namespace declarations from static.

--- src/clj/forma/source/static.clj
+++ src/clj/forma/source/static.clj
@@ -1,18 +1,12 @@
 (ns forma.source.static
   (:use cascalog.api
-        [forma.matrix.utils :only (idx->colrow)]
-        [forma.hadoop.io :only (chunk-tap)]
+        [forma.hadoop.io :only (chunk-tap)]
+        [forma.reproject :only (modis-sample)]
+        [clojure.string :only (split)]
         [forma.hadoop.predicate :only (sparse-windower
-                                       pixel-generator)]
-        [forma.reproject :only (wgs84-index
-                                dimensions-at-res
-                                modis-sample)]
-        [forma.source.modis :only (modis->latlon
-                                   latlon->modis
-                                   pixels-at-res
-                                   hv->tilestring)]
-        [clojure.string :only (split)])
+                                       pixel-generator)])
   (:require [cascalog.ops :as c]
+            [forma.source.modis :as m]
             [cascalog.io :as io]
             [clojure.contrib.duck-streams :as duck])
   (:gen-class))
@@ -150,7 +144,7 @@
   into modis characteristics at resolution `m-res`."
   [m-res ascii-info row col]
   (->> (rowcol->latlon ascii-info row col)
-       (apply latlon->modis m-res)))
+       (apply m/latlon->modis m-res)))

 (defn high-res-sample
   "This query is for a point grid at higher resolution than the reference
@@ -201,7 +195,7 @@
   [src]
   (<- [?dataset ?m-res ?t-res ?tilestring ?sample ?line ?val]
       (src ?dataset ?m-res ?t-res ?mod-h ?mod-v ?sample ?line ?val)
-      (hv->tilestring ?mod-h ?mod-v :> ?tilestring)))
+      (m/hv->tilestring ?mod-h ?mod-v :> ?tilestring)))

 (defn static-chunker
   "Last thing we need is the chunk-tap!"


remove pprint

remove pprint

--- src/clj/traveler/api/routes.clj
+++ src/clj/traveler/api/routes.clj
@@ -15,18 +15,12 @@

    :users-add    (resource :allowed-methods [:put]
                            :available-media-types ["application/json"]
-                           :put! (fn [ctx]
-                                   (do
-                                     (pprint (:request ctx))
-                                     (add-user ctx)))
+                           :put! (fn [ctx] (add-user ctx))
                            :handle-created (fn [ctx] (handle-created ctx)))

    :users-search (resource :allowed-methods [:get]
                            :available-media-types ["text/html"]
-                           :handle-ok (fn [ctx]
-                                        (do
-                                          (pprint (:request ctx))
-                                          (str "this is a search"))))
+                           :handle-ok (fn [ctx] (str "this is a search")))

    :users-user   (resource :allowed-methods [:get]
                            :available-media-types ["application/json"]


Use fipp to provide pprint

Use fipp to provide pprint

--- src/cljs/cljs_webrepl/core.cljs
+++ src/cljs/cljs_webrepl/core.cljs
@@ -5,7 +5,7 @@
    [cljs-webrepl.repl :as repl]
    [reagent.core :as r :refer [atom]]
    [reagent.session :as session]
-   [cljs.pprint :refer [pprint]]
+   [fipp.edn :refer [pprint]]
    [cljsjs.clipboard :as clipboard]
    [cljs-webrepl.mdl :as mdl]
    [cljs-webrepl.syntax :refer [syntaxify]]


Switch to change event from input

Switch to change event from input

Input is too unreliable, even with throttling

--- src/cljs/comic_reader/main.cljs
+++ src/cljs/comic_reader/main.cljs
@@ -65,7 +65,7 @@
     (fn [this]
       (let [node (reagent/dom-node this)
             value (.-value node)]
-        (.addEventListener node "input"
+        (.addEventListener node "change"
                            #(r/go-to
                              (r/comics-path
                               {:site site


Added merged label.

Added merged label.

--- src/cljs/darzana/view/menu.cljs
+++ src/cljs/darzana/view/menu.cljs
@@ -110,7 +110,17 @@
               (clj->js
                 { :success
                   (fn [model]
-                    (.log js/console "merged!"))})))))
+                    (.. me ($ ".label-merge-status") (label "success" "Merged!"))
+                    (js/setTimeout
+                      (fn [] (.. me ($ ".label-merge-status") (label "default" "")))
+                      1500))
+
+                  :error
+                  (fn []
+                    (.. me ($ ".label-merge-status") (label "danger" "Failed!"))
+                    (js/setTimeout
+                      (fn [] (.. me ($ ".label-merge-status") (label "default" "")))
+                      1500))})))))

       "deleteWorkspace"
       (fn [event]


Realias reagent to r

Realias reagent to r

--- src/cljs/hacker_agent/core.cljs
+++ src/cljs/hacker_agent/core.cljs
@@ -1,6 +1,6 @@
 (ns hacker-agent.core
   (:require-macros [cljs.core.async.macros :refer [go go-loop]])
-  (:require [reagent.core :as reagent :refer [atom]]
+  (:require [reagent.core :as r :refer [atom]]
             [secretary.core :as secretary :include-macros true]
             [goog.events :as events]
             [goog.history.EventType :as EventType]
@@ -140,7 +140,7 @@
 ;; -------------------------
 ;; Initialize app
 (defn init! []
-  (reagent/render-component [main-page app-state] (.getElementById js/document "app")))
+  (r/render-component [main-page app-state] (.getElementById js/document "app")))

 ;; -------------------------
 ;; History


Devtools

Devtools

--- src/cljs/learn_specter/app.cljs
+++ src/cljs/learn_specter/app.cljs
@@ -8,7 +8,7 @@
             [learn-specter.routes :as routes]
             [learn-specter.subs :as subs]
             [learn-specter.handlers :as handlers]
-            ))
+            [devtools.core :as devtools]))

 ;; Components

@@ -97,4 +97,6 @@
 (defn init []
   (dispatch-sync [:initialize])
   (routes/init)
+  (devtools/enable-feature! :sanity-hints :dirac)
+  (devtools/install!)
   (mount-root))


Moar titles

Moar titles

--- src/cljs/mokkameister/core.cljs
+++ src/cljs/mokkameister/core.cljs
@@ -73,17 +73,18 @@
            [:td (get stats line)]])]])
     (loading-gif)))

-(def ^:private chart-titles {"Brygg per monade" 2
-                             "Brygg per månad" 8
-                             "Mikrodosar per månad" 1})
-
 (defn chart [chart-data]
   (let [month-count (map :count chart-data)]
     [:pre.chart (js/chart (clj->js month-count)
                           (clj->js {:width 85}))]))

+(defn- chart-title []
+  (let [brew (rand-nth-weighted {"Brygg" 8, "Mikrodosar" 2, "Kaffidoktorar" 1})
+        month (rand-nth-weighted {"månad" 8, "monade" 2, "månefase" 1, "nymåne" 1})]
+    (str brew " per " month)))
+
 (defn chart-panel []
-  (let [title (rand-nth-weighted chart-titles)
+  (let [title (chart-title)
         chart-data (get-in @state [:stats :month-stats])]
     [:div.panel.panel-info
      [:div.panel-heading


PLD: remove walkthough

PLD: remove walkthough

--- src/cljs/ona/dataview/base.cljs
+++ src/cljs/ona/dataview/base.cljs
@@ -17,7 +17,6 @@
             [ona.utils.interop :refer [json->cljs format console-log]]
             [ona.utils.numeric :refer [pluralize-number]]
             [ona.utils.shared-dom :as shared-dom]
-            [ona.utils.walkthrough :as walkthrough-utils]
             ;; Hatti views; need to also include all namespaces where methods are defined
             [hatti.views :refer [tabbed-dataview dataview-actions]]
             [hatti.views.dataview]
@@ -187,5 +186,4 @@
                                        (fn [_] form-desc))
      (init-views hatti-shared/app-state delete-record! role chart-get shared-state)
      (post-process/integrate-attachments! hatti-shared/app-state form)
-     (walkthrough-utils/launch-data-view-walkthrough auth-token)
      (download-and-process-osm-data! auth-token dataset-id form))))


make display fn names a little more ergonomic

--- src/clojupyter/misc/display.clj
+++ src/clojupyter/misc/display.clj
@@ -38,8 +38,12 @@
     (mc/stream-to-string
      {:text/html html})))

-(defn make-html [html]
-  (HtmlString. html))
+(defn html [html-str]
+  (HtmlString. html-str))
+
+(defn ^:deprecated make-html
+  [html-str]
+  (html html-str))

 (defrecord HiccupHTML [html-data]

@@ -60,8 +64,12 @@
     (mc/stream-to-string
      {:text/latex latex})))

-(defn make-latex [latex]
-  (Latex. latex))
+(defn latex [latex-str]
+  (Latex. latex-str))
+
+(defn ^:deprecated make-latex
+  [latex-str]
+  (latex latex-str))

 ;; Markdown
@@ -73,5 +81,9 @@
     (mc/stream-to-string
      {:text/markdown markdown})))

-(defn make-markdown [markdown]
-  (Markdown. markdown))
+(defn markdown [markdown-str]
+  (Markdown. markdown-str))
+
+(defn ^:deprecated make-markdown
+  [markdown-str]
+  (markdown markdown-str))


Remove redundant type conversion on core.sing hamc function.

--- src/clojure/buddy/core/sign.clj
+++ src/clojure/buddy/core/sign.clj
@@ -27,9 +27,8 @@
   "Generic function that implement salted variant
 of keyed-hash message authentication code (hmac)."
   [algorithm value pkey & [{:keys [salt] :or {salt ""}}]]
-  (let [salt  (->byte-array salt)
-        sks   (SecretKeySpec. (make-sha512 (keys/key->bytes pkey) salt) "HmacSHA512")
-        mac   (doto (Mac/getInstance "HmacSHA256")
+  (let [sks   (SecretKeySpec. (make-sha512 (keys/key->bytes pkey) salt) algorithm)
+        mac   (doto (Mac/getInstance algorithm)
                 (.init sks))]
     (.doFinal mac (str->bytes value))))


Fix some Common Lisp style docstrings.

Fix some Common Lisp style docstrings.

--- src/clojure/clj_chess/game.cljc
+++ src/clojure/clj_chess/game.cljc
@@ -59,9 +59,10 @@
   [game]
   (tag-value game "Event"))

-(defn date [game]
+(defn date
   "The date the game was played, as a joda.time.DateTime object in Clojure,
   and a string in ClojureScript."
+  [game]
   (when-let [d (tag-value game "Date")]
     #?(:cljs d)
     #?(:clj
@@ -69,37 +70,44 @@
          (time-format/parse (time-format/formatter "YYYY.MM.dd") d)
          (catch Exception _)))))

-(defn round [game]
+(defn round
   "The tournament round of the game."
+  [game]
   (tag-value game "Round"))

-(defn site [game]
+(defn site
   "The site of the game."
+  [game]
   (tag-value game "Site"))

-(defn white-player [game]
+(defn white-player
   "Name of the white player."
+  [game]
   (tag-value game "White"))

-(defn black-player [game]
+(defn black-player
   "Name of the black player."
+  [game]
   (tag-value game "Black"))

-(defn result [game]
+(defn result
   "The result of the game. Should be one of the strings \"1-0\", \"0-1\",
   \"1/2-1/2\" and \"*\"."
+  [game]
   (tag-value game "Result"))

-(defn white-elo [game]
+(defn white-elo
   "The Elo of the white player (as an integer), or nil."
+  [game]
   (when-let [elo (tag-value game "WhiteElo")]
     (try
       (read-string elo)
       #?(:clj (catch Exception _)
          :cljs (catch js/Error _)))))

-(defn black-elo [game]
+(defn black-elo
   "The Elo of the black player (as an integer), or nil."
+  [game]
   (when-let [elo (tag-value game "BlackElo")]
     (try
       (read-string elo)


tokenized

tokenized


103 in progress

103 in progress

--- stuf/src/sandbox/4clojure.clj
+++ stuf/src/sandbox/4clojure.clj
@@ -652,3 +652,14 @@
 ;; wow solution
 ;;(fn [s] (clojure.string/replace s #"-(\w)" #(str (.toUpperCase (% 1)))))

+;;103
+(defn combinations [m n]
+  (letfn
+      [(comb-aux [m start]
+         (if (= 1 m)
+           (for [x (range start n)]
+             (list x))
+           (for [x (range start n)
+                 xs (comb-aux (dec m) (inc x))]
+             (cons x xs))))]
+    (comb-aux m 0)))


Tweaked demo.

Tweaked demo.

--- test/freactive/dom_perf.cljs
+++ test/freactive/dom_perf.cljs
@@ -20,6 +20,10 @@
 (defonce width (atom (get-window-width)))

 (defonce height (atom (get-window-height)))
+
+;(defonce width (rx @window-width))
+;
+;(defonce height (rx (- @window-height 12)))

 (defonce init
          (do
@@ -63,7 +67,7 @@
    [:div
     {:width "100%"
      :style
-     {:position "absolute" :left 0 :top 0 :height "1em"}}
+     {:position "absolute" :left 0 :top 0 :height "12px"}}
     (let [complexity (rx (str (let [n* @n n* (+ 1 (* 2 n*))] (* n* n*))))]
      [:span (rx (str @mouse-x ", " @mouse-y))
       ". n = " (rx (str @n)) " "
@@ -75,7 +79,8 @@
       " DOM attributes updated per second."])]
    [:svg/svg
    {:width "100%" :height "100%"
-     :style {:position "absolute" :left 0 :top "1em"}}
+     :style {:position "absolute" :left 0 :top "14px"}
+     :viewBox (rx (str "0 14 " @width " " @height))}
    (circle mouse-x mouse-y)
     (let [ease-x (animation/easer 0.0)
           ease-y (animation/easer 0.0)]
@@ -103,8 +108,8 @@
                             (animation/start-easer! ease-y 0.0 1.0 1000 animation/quad-out cb))
                  :on-hide (fn [x cb]
                             ;(println "hiding")
-                            (animation/start-easer! ease-x 1.0 0.0 1000 animation/quad-in cb)
-                            (animation/start-easer! ease-y 1.0 0.0 1000 animation/quad-out cb))})))
+                            (animation/start-easer! ease-x 1.0 0.0 1000 animation/quad-out cb)
+                            (animation/start-easer! ease-y 1.0 0.0 1000 animation/quad-in cb))})))
         (fn [x]                                             ;;(println "captured" x)
           )
         (fn []                                              ;;(println "invalidated")


Rename test function

Rename test function

--- test/grafter/rdf/io_test.clj
+++ test/grafter/rdf/io_test.clj
@@ -24,7 +24,7 @@
                  (mimetype->rdf-format nil))
         "throws on nil mime type")))

-(deftest round-trip-integer-types-test
+(deftest round-trip-numeric-types-test
   (are [xsd type number]
       (is (= number (pr/raw-value (->sesame-rdf-type (sesame-rdf-type->type (LiteralImpl. number (URIImpl. xsd)))))))


New tests: test-get-exception-message[123]

--- test/hurvinek/utils_test.clj
+++ test/hurvinek/utils_test.clj
@@ -66,3 +66,30 @@
 ; Tests for behaviour of all functions
 ;

+(deftest test-get-exception-message-1
+    "Check the function hurvinek.utils/get-exception-message."
+    (testing "the function hurvinek.utils/get-exception-message."
+        (try
+            (throw (new java.lang.Exception "Message text"))
+            (is nil "Exception not thrown as expected!")
+            (catch Exception e
+                (is (= "Message text" (get-exception-message e)))))))
+
+(deftest test-get-exception-message-2
+    "Check the function hurvinek.utils/get-exception-message."
+    (testing "the function hurvinek.utils/get-exception-message."
+        (try
+            (/ 1 0)
+            (is nil "Exception not thrown as expected!")
+            (catch Exception e
+                (is (= "Divide by zero" (get-exception-message e)))))))
+
+(deftest test-get-exception-message-3
+    "Check the function hurvinek.utils/get-exception-message."
+    (testing "the function hurvinek.utils/get-exception-message."
+        (try
+            (Integer/parseInt "unparseable")
+            (is nil "Exception not thrown as expected!")
+            (catch Exception e
+                (is (.startsWith (get-exception-message e) "For input string:"))))))
+


Format test files.

Format test files.

--- test/zprint/zprint_test.cljc
+++ test/zprint/zprint_test.cljc
@@ -13,7 +13,7 @@
             [zprint.zprint :refer
              [line-count max-width line-lengths make-record contains-nil?
               map-ignore]]
-	    [zprint.comment :refer [blanks]]
+            [zprint.comment :refer [blanks]]
             [zprint.zutil :refer [edn*]]
             [zprint.config :refer [merge-deep]]
             #?@(:clj ([clojure.repl :refer [source-fn]]))
@@ -916,8 +916,8 @@
   #?(:clj (expect
             "#<Agent FAILED [:c :d]>"
             (do (send agf + 5)
-		; Wait a bit for the send to get to the agent and for the
-		; agent to fail
+                ; Wait a bit for the send to get to the agent and for the
+                ; agent to fail
                 (Thread/sleep 100)
                 (clojure.string/replace (zprint-str agf) #"\@[0-9a-f]*" ""))))

@@ -5427,9 +5427,9 @@
   ;; Missing code!  Issue #173
   ;;

-(expect "(fn [x]\n  (bar)\n)"
-        (zprint-str "(fn [x]\n  (bar)\n   )\n"
-                    {:parse-string? true, :list {:respect-nl? true}}))
+  (expect "(fn [x]\n  (bar)\n)"
+          (zprint-str "(fn [x]\n  (bar)\n   )\n"
+                      {:parse-string? true, :list {:respect-nl? true}}))

   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   ;;


Tweak matrixify example.

Tweak matrixify example.

--- examples/parkour/example/matrixify.clj
+++ examples/parkour/example/matrixify.clj
@@ -65,8 +65,7 @@
 (def entry (avro/tuple-schema [:long :long :double]))

 (defn matrixify
-  "Run matrix-ification jobs for `dseq`, storing output under `workdir` and
-returning dseq on final matrix entries."
+  "Run matrix-ification jobs for `dseq`. Return dseq on final matrix entries."
   [conf dseq]
   (let [[c-data c-counts]
         , (-> (pg/input dseq)
@@ -84,7 +83,7 @@
                          :counts (mra/dsink [:long :long])))
         [c-counts r-counts r-data]
         , (-> [c-counts r-counts r-data]
-              (pg/execute conf "matrixify/dim-count"))
+              (pg/execute conf `dim-count))
         c-offsets (dval/edn-dval (offsets c-counts))
         r-offsets (dval/edn-dval (offsets r-counts))]
     (-> (pg/input r-data)


Linkifying still needs to happen on update

--- frontend/components/documentation.cljs
+++ frontend/components/documentation.cljs
@@ -137,6 +137,10 @@
       (add-link-targets (om/get-node owner))
       (when-let [fragment (:_fragment opts)]
         (utils/scroll-to-fragment! fragment)))
+    om/IDidUpdate
+    (did-update [_ _ _]
+      ;; TODO: Move this to the markdown rendering process
+      (add-link-targets (om/get-node owner)))
     om/IRender
     (render [_]
       (html


mapv rather than map

mapv rather than map

--- src/inkspot/converter.clj
+++ src/inkspot/converter.clj
@@ -59,7 +59,7 @@
             s (if (< l 0.5)
                 (/ d (+ max-val min-val))
                 (/ d (- 2.0 max-val min-val)))
-            [dr dg db] (map #(/ (- max-val %) d) [r g b])
+            [dr dg db] (mapv #(/ (- max-val %) d) [r g b])
             h (condp = max-val
                 r (- db dg)
                 g (- (+ 2.0 dr) db)


Preselect first icons collection with content on the workspace

--- frontend/src/uxbox/main/ui/workspace/sidebar/icons.cljs
+++ frontend/src/uxbox/main/ui/workspace/sidebar/icons.cljs
@@ -52,6 +52,16 @@
     (remove-watch local ::key)
     own))

+(defn- get-or-select-coll
+  [local colls-map]
+  (if (:id @local)
+   (get colls-map (:id @local))
+   (let [colls (->> (vals colls-map)
+                    (sort-by :name))
+         selected-coll (first (filter #(> (:num-icons %) 0) colls))]
+     (swap! local assoc :id (:id selected-coll)
+     selected-coll))))
+
 (mx/defcs icons-toolbox
   {:mixins [(mx/local) mx/reactive]
    :will-mount icons-toolbox-will-mount
@@ -62,11 +72,10 @@
         colls-map (mx/react icons/collections-ref)
         colls (->> (vals colls-map)
                    (sort-by :name))
-        coll (get colls-map (:id @local))
-
+        selected-coll (get-or-select-coll local colls-map)
         icons (mx/react icons/icons-ref)
         icons (->> (vals icons)
-                   (filter #(= (:id coll) (:collection %))))]
+                   (filter #(= (:id selected-coll) (:collection %))))]

     (letfn [(on-close [event]
               (st/emit! (dw/toggle-flag :icons)))
@@ -86,7 +95,7 @@
         [:div.figures-catalog
          ;; extract component: set selector
          [:select.input-select.small {:on-change on-change
-                                      :value (pr-str (:id coll))}
+                                      :value (pr-str (:id selected-coll))}
           [:option {:value (pr-str nil)} "Storage"]
           (for [coll colls]
             [:option {:key (str "icon-coll" (:id coll))


Add fake classpath show option

Add fake classpath show option

This is useful for IDE authors that may not have an active REPL
connection, but still need static support for navigation, etc.

--- boot/core/src/boot/task/built_in.clj
+++ boot/core/src/boot/task/built_in.clj
@@ -104,7 +104,8 @@
    f fileset          bool "Print the build fileset object."
    u updates          bool "Print newer releases of outdated dependencies."
    U update-snapshots bool "Include snapshot versions in updates searches."
-   c classpath        bool "Print the project's full classpath."]
+   c classpath        bool "Print the project's full classpath."
+   C fake-classpath   bool "Print the project's fake classpath."]

   (let [updates (or updates update-snapshots (not (or deps env fileset classpath)))]
     (core/with-pre-wrap fileset'
@@ -112,6 +113,7 @@
       (when env     (println (pr-str (core/get-env))))
       (when fileset (println (pr-str fileset')))
       (when classpath (println (or (System/getProperty "boot.class.path") "")))
+      (when fake-classpath (println (or (System/getProperty "fake.class.path") "")))
       (when updates (mapv prn (pod/outdated (core/get-env) :snapshots update-snapshots)))
       fileset')))


Extract helper function for visual-audible notification

--- boot/core/src/boot/task/built_in.clj
+++ boot/core/src/boot/task/built_in.clj
@@ -222,39 +222,32 @@
                                  [(keyword x) (.getPath f)])))))
         sounds (merge themefiles soundfiles)
         title (or title "Boot notify")
-        base-message {:title title
-                      :uid (or uid title)
-                      :icon (or icon (boot-logo))}
+        base-visual-opts {:title title
+                          :uid (or uid title)
+                          :icon (or icon (boot-logo))}
         messages (merge {:success "Success!" :warning "%s warning/s" :failure "%s"}
                         messages)
         audible-notify! (or audible-notify-fn notify/audible-notify!)
-        visual-notify!  (or visual-notify-fn  notify/visual-notify!)]
+        visual-notify!  (or visual-notify-fn  notify/visual-notify!)
+        notify! (fn [type message]
+                  (when audible
+                    (audible-notify! {:type type
+                                      :file (get sounds type)
+                                      :theme theme}))
+                  (when visual
+                    (visual-notify! (assoc base-visual-opts
+                                           :message message))))]
     (fn [next-task]
       (fn [fileset]
         (try
           (util/with-let [_ (next-task fileset)]
             (if (zero? @core/*warnings*)
-              (do
-                (when audible
-                  (audible-notify! {:type :success
-                                    :file (:success sounds)
-                                    :theme theme}))
-                (when visual
-                  (visual-notify! (assoc base-message :message (:success messages)))))
-              (do
-                (when audible
-                  (audible-notify! {:type :warning
-                                    :file (:warning sounds)
-                                    :theme theme}))
-                (when visual
-                  (visual-notify! (assoc base-message :message (format (:warning messages) (deref core/*warnings*))))))))
+              (notify! :success (:success messages))
+              (notify! :warning (format (:warning messages)
+                                        (deref core/*warnings*)))))
           (catch Throwable t
-            (when audible
-              (audible-notify! {:type :failure
-                                :file (:failure sounds)
-                                :theme theme}))
-            (when visual
-              (visual-notify! (assoc base-message :message (format (:failure messages) (.getMessage t)))))
+            (notify! :failure (format (:failure messages)
+                                      (.getMessage t)))
             (throw t)))))))

 (core/deftask show


retrigger travis

retrigger travis

--- test/riemann/graphite_test.clj
+++ test/riemann/graphite_test.clj
@@ -29,7 +29,7 @@
      (try
        (sendout! {:service "service1" :metric 1.0 :time 0})
        (sendout! {:service "service2" :metric 2.0 :time 0})
-       ; service3 does not follow protocol and should be droppec by the graphite server
+       ; the next service does not follow protocol and should be droppec by the graphite server
        ; see https://answers.launchpad.net/graphite/+question/173242
        (sendout! {:service "service3" :metric "NaN" :time 0})
        (Thread/sleep 100)


CMR-354: Added test for browse_only sort parameter.

--- test/cmr/system_int_test/search/granule_sorting_search_test.clj
+++ test/cmr/system_int_test/search/granule_sorting_search_test.clj
@@ -268,3 +268,17 @@
          "online_only" [g2 g1]
          "-downloadable" [g1 g2]
          "-online_only" [g1 g2])))
+
+(deftest granule-browse-only-sorting-test
+  (let [ru1 (dc/related-url "GET RELATED VISUALIZATION")
+        coll (d/ingest "PROV1" (dc/collection {}))
+        g1 (d/ingest "PROV1" (dg/granule coll {:related-urls [ru1]}))
+        g2 (d/ingest "PROV1" (dg/granule coll {}))]
+    (index/refresh-elastic-index)
+    (are [sort-key items]
+         (d/refs-match-order? items
+                              (search/find-refs :granule {:page-size 20
+                                                          :sort-key sort-key}))
+
+         "browse_only" [g2 g1]
+         "-browse_only" [g1 g2])))


Function to compute job status

Function to compute job status

--- src/emender_jenkins/results.clj
+++ src/emender_jenkins/results.clj
@@ -61,14 +61,28 @@
               (clojure.string/replace book-name "_" " ")
               "unknown")))

-(defn read-results
+(defn compute-job-status
+    [jenkins-job-status buildable?]
+    ; check if the 'disabled' option is set in job config
+    (if (not buildable?)
+        :disabled
+        (if jenkins-job-status ; job is buildable, so let's check the icon
+            (cond (= jenkins-job-status "blue")     :ok
+                  (= jenkins-job-status "disabled") :disabled ; should it happen?
+                  :else                             :failure)
+            :does-not-exists)))
+
+(defn read-update-job-info
     [job-list]
     (for [job job-list]
-        (let [job-name (get job "name")]
+        (let [job-name (get job "name")
+              job-color  (get job "color")
+              buildable? (get job "buildable")]
             {:job-name  job-name
              :product   (job-name->product-name job-name)
              :version   (job-name->version job-name)
              :book-name (job-name->book-name job-name)
+             :job-status (compute-job-status job-color buildable?)
             })))

 (defn reload-all-results
@@ -76,7 +90,7 @@
     (let [job-list (jenkins-api/read-list-of-test-jobs (-> configuration :jenkins :jenkins-url)
                                                        (-> configuration :jenkins :jenkins-job-list-url)
                                                        (-> configuration :jobs    :test-jobs-suffix))
-          job-results (read-results job-list)]
+          job-results (read-update-job-info job-list)]
           (clojure.pprint/pprint job-results)
           ;job-results (read-all-test-results configuration job-list)]
           (reset! results job-results)


feat(main): setup db

feat(main): setup db

--- src/busa_server/main.clj
+++ src/busa_server/main.clj
@@ -1,9 +1,13 @@
 (ns busa-server.main
-  (:require [busa-server.page.driver :as page-driver])
+  (:require
+    [busa-server.page.driver :as page-driver]
+    [busa-server.model.db :as db])
   (:gen-class))

 (defn -main
   [& args]
   (println "Starting BUSA Server")
   (page-driver/init)
-  (print "Webdrvier initialized"))
+  (println "Webdriver initialized")
+  (db/setup-db)
+  (println "Database initialized"))


remove stray file

remove stray file


Bump Eastwood version

Bump Eastwood version

--- lein/profiles.clj
+++ lein/profiles.clj
@@ -67,7 +67,7 @@
         ;;:local-repo "repo"
         :plugins [[cider/cider-nrepl "0.10.0" :exclusions [org.clojure/java.classpath]]
                   [com.jakemccrary/lein-test-refresh "0.9.0"]
-                  [jonase/eastwood "0.2.1" :exclusions [org.clojure/clojure]]
+                  [jonase/eastwood "0.2.2" :exclusions [org.clojure/clojure]]
                   [lein-ancient "0.6.7" :exclusions [cheshire common-codec commons-codec slingshot]]
                   ;; This next one's super useful, but its dependencies are out of date
                   ;; TODO: Update!


lein: dep updates, add cider-nrepl

lein: dep updates, add cider-nrepl

--- lein_profiles.clj
+++ lein_profiles.clj
@@ -1,8 +1,9 @@
 {:user {:plugins [
                   [lein-ring "0.8.10"]
-                  [lein-ancient "0.5.4"]
+                  [lein-ancient "0.5.5"]
                   [jonase/eastwood "0.1.2"]
+                  [cider/cider-nrepl "0.7.0-SNAPSHOT"]
                   ]}}
 {:dev {:dependencies
-       [[com.cemerick/pomegranate "0.2.0"]]
+       [[com.cemerick/pomegranate "0.3.0"]]
        }}


Twitter オブジェクトを引数に取ったり取らなかったりするように修正

Twitter オブジェクトを引数に取ったり取らなかったりするように修正

--- src/ghostly/momonga/twitter.clj
+++ src/ghostly/momonga/twitter.clj
@@ -5,53 +5,14 @@
                       TwitterException
                       TwitterFactory)
            (twitter4j.auth AccessToken
-                           RequestToken)))
+                           RequestToken))
+  (:require [clojure.java.io :as [io]]))
+
+
+(defstruct token :key :secret)
+

 (def *twitter* (TwitterFactory/getSingleton))
-
-
-(defn consumer-key-set! [consumer-key consumer-secret]
-  (.setOAuthConsumer *twitter* consumer-key consumer-secret))
-
-
-(defn request-token []
-  (.getOAuthRequestToken *twitter*))
-
-
-(defn authorization-url
-  ([]
-     (let [rtoken (request-token)]
-       (authorization-url rtoken)))
-  ([rtoken]
-     (.getAuthorizationURL rtoken)))
-
-
-(defn access-token [rtoken pin]
-  (let [atoken (.getOAuthAccessToken *twitter* rtoken pin)]
-    (store-access-token atoken)
-    atoken))
-
-
-(defn- store-access-token [atoken]
-  nil)
-
-
-(defn post [msg]
-  (.updateStatus *twitter* msg))
-
-
-(defn home-timeline
-  ([]
-     (.getHomeTimeline *twitter*))
-  ([pg]
-     (.getHomeTimeline *twitter* pg)))
-
-
-(defn friends-timeline
-  ([]
-     (.getFriendsTimeline *twitter*))
-  ([pg]
-     (.getFriendsTimeline *twitter* pg)))

 (defn paging [& {page :page cnt :count since-id :since-id max-id :max-id}]
@@ -65,6 +26,83 @@
    ((nil? max-id)
     (Paging. page cnt since-id))
    ((every? nil? [cnt max-id])
-    (Paging. page since-id)
-    (:else
-     (Paging. page cnt since-id max-id)))))
+    (Paging. page since-id))
+   (:else
+    (Paging. page cnt since-id max-id))))
+
+
+(defn consumer-key-set! [consumer-key consumer-secret]
+  (.setOAuthConsumer *twitter* consumer-key consumer-secret))
+
+
+(defn request-token
+  ([]
+     (request-token *twitter*))
+  ([a_twitter]
+     (.getOAuthRequestToken a_twitter))
+
+
+(defn authorization-url
+  ([]
+     (let [a_request-token (request-token)]
+       (authorization-url a_request-token)))
+  ([a_request-token]
+     (.getAuthorizationURL a_request-token)))
+
+
+(defn access-token
+  ([a_request-token pin]
+     (access-token *twitter* a_request-token pin))
+  ([a_twitter a_request-token pin]
+     (let [an_access-token (.getOAuthAccessToken a_twitter a_request-token pin)]
+       (store-access-token an_access-token)
+       an_access-token)))
+
+
+(defn- store-access-token [an_access-token]
+  (with-open [w (io/writer "twitter4j.properties" :append true)]
+    (.write (str "oauth.accessToken" "=" (.getToken an_access-token) "\n"))
+    (.write (str "oauth.accessTokenSecret" "=" (.getTokenSecret an_access-token) "\n"))))
+
+
+(defn update
+  ([update-message]
+     (update *twitter* update-message))
+  ([a_twitter update-message]
+     (.updateStatus a_twitter update-message)))
+
+
+(defn home-timeline
+  ([]
+     (home-timeline *twitter*))
+  ([^Twitter a_twitter]
+     (.getHomeTimeline a_twitter))
+  ([^Paging a_paging]
+     (home-timeline *twitter* a_paging))
+  ([^Twitter a_twitter ^Paging a_paging]
+     (.getHomeTimeline a_twitter a_paging)))
+
+
+(defn friends-timeline
+  ([]
+     (home-timeline *twitter*))
+  ([^Twitter a_twitter]
+     (.getFriendsTimeline a_twitter))
+  ([^Paging a_paging]
+     (home-timeline *twitter* a_paging))
+  ([^Twitter a_twitter ^Paging a_paging]
+     (.getFriendsTimeline a_twitter a_paging)))
+
+
+(defn menthions-timeline
+  ([]
+     (home-timeline *twitter*))
+  ([^Twitter a_twitter]
+     (.getMenthionsTimeline a_twitter))
+  ([^Paging a_paging]
+     (home-timeline *twitter* a_paging))
+  ([^Twitter a_twitter ^Paging a_paging]
+     (.getMenthionsTimeline a_twitter a_paging)))
+
+
+;; (defn status [id])


cast as long

cast as long

--- src/hackerrank/filling_jars.clj
+++ src/hackerrank/filling_jars.clj
@@ -12,7 +12,7 @@
   (let [[n, m] (parse)]
     (loop [sums 0 i m]
       (if (zero? i)
-        (println (int (/ sums n)))
+        (println (long (/ sums n)))
         (let [[a b k] (parse)]
           (recur (+ sums (* k (inc (- b a)))) (dec i)))))))


Доработка поиска и тегов

Доработка поиска и тегов

--- src/ixinfestor/core_handler.clj
+++ src/ixinfestor/core_handler.clj
@@ -324,10 +324,16 @@
                 ;;TODO: Попробовать сделать все в рамках одной транзакции
                 (let [id (Long/parseLong id)]
                   (-> {:webdoc-row (ix/com-find webdoc-entity id)  ;;; SRC
-                       :webdoctag-edit-table (ix/webdoctag-tag-tree-as-flat-groups-with-patches {:id id} :path)
                        }
                       ring.util.response/response
                       cw/error-response-json)))
+
+           (POST "/webdoctags-edit-table" request
+                (-> request
+                    :params
+                    (ix/webdoctag-tag-tree-as-flat-groups-with-patches :path)
+                    ring.util.response/response
+                    cw/error-response-json))

            (POST "/save" {{:keys [webdoc-row webdoctag-ids-for-updating swops]} :params}
                  (friend/authorize


[core] wip adjust clustering

[core] wip adjust clustering

--- src/clj_dstream/core.clj
+++ src/clj_dstream/core.clj
@@ -13,7 +13,7 @@
   [& args]
   (println "Hello, World!"))

-(defn my-log [context summary data]
+(defn log-it [context summary data]
   (info (hash context) summary data))

 ;;;TODO thought i needed to spec these "enums" for spec, but doesnt make it work
@@ -155,7 +155,7 @@
     (reduce *)))

 (defn dstream-iterations [state raw-data]
-  (my-log [state raw-data] ::dstream-iterations.starting {:raw-data-count   (count raw-data)
+  (log-it [state raw-data] ::dstream-iterations.starting {:raw-data-count   (count raw-data)
                                                           :state-properties (::state (::properties state))})
   (let [time*      (atom 0)
         the-state* (atom state)]
@@ -327,11 +327,11 @@
     (doseq [[pos-idx char-vec] (::grid-cells @state*)]
       (if (= ::dense (::label char-vec))
         (do
-          (my-log state ::dense-grid-creating-cluster {:char-vec char-vec})
+          (log-it state ::dense-grid-creating-cluster {:char-vec char-vec})
           (swap! state* assoc-in
                  [::grid-cells pos-idx ::cluster]
                  (str (java.util.UUID/randomUUID))))
-        (do (my-log state ::not-dense-grid {:char-vec char-vec})
+        (do (log-it state ::not-dense-grid {:char-vec char-vec})
             (swap! state* assoc-in
                    [::grid-cells pos-idx ::cluster]
                    "NO_CLASS"))))
@@ -377,14 +377,14 @@
     @the-state*))

 (defn- init-clustering-iterations [state iter-count]
-  (my-log state ::init-clustering {:iteration iter-count})
+  (log-it state ::init-clustering {:iteration iter-count})
   (let [state-after (initial-clustering-single-pass state)]
     (if (= state state-after)
       (do
-        (my-log state-after ::init-clustering.complete {:iterations iter-count})
+        (log-it state-after ::init-clustering.complete {:iterations iter-count})
         state-after)
       (do
-        (my-log state-after ::init-clustering.recurring {:iterations iter-count})
+        (log-it state-after ::init-clustering.recurring {:iterations iter-count})
         (recur state-after (inc iter-count))))))

 (defn initial-clustering [state t]
@@ -398,14 +398,14 @@
 (defn adjust-clustering [state t]
   (let [updated-state* (atom (update-grid-cells state t))]
     (doseq [[pos-idx char-vec] (::grid-cells @updated-state*)]
-      (my-log pos-idx ::adjust-clustering char-vec)
+      (log-it pos-idx ::adjust-clustering char-vec)
       (when (= t (::last-time-label-changed char-vec))
         (do
-          (my-log pos-idx ::label-changed-this-iteration char-vec)
+          (log-it pos-idx ::label-changed-this-iteration char-vec)
           ;;4
           (when (= ::sparse (::label char-vec))
             (do
-              (my-log pos-idx ::sparse-label char-vec)
+              (log-it pos-idx ::sparse-label char-vec)
               (let [old-cluster (::cluster char-vec)]
                 (swap! updated-state* assoc-in [::grid-cells pos-idx]
                        (assoc char-vec ::cluster "NO_CLASS"))
@@ -414,11 +414,11 @@
                   (when-not (is-grid-group
                               new-cluster)
                     (do
-                      (my-log pos-idx ::split-cluster new-cluster)
+                      (log-it pos-idx ::split-cluster new-cluster)
                       (split-cluster new-cluster)))))))
           ;;7
           (when (= ::dense (::label char-vec))
-            (do (my-log pos-idx ::dense-label char-vec)
+            (do (log-it pos-idx ::dense-label char-vec)
                 (let [neighbors          (grid-cell->neighbors {pos-idx char-vec} (::grid-cells @updated-state*))
                       neighbors-clusters (->>
                                            (::grid-cells @updated-state*)
@@ -428,24 +428,45 @@
                                            (remove nil?)
                                            not-empty)]
                   (when neighbors-clusters
-                    (let [cluster-sizes          (map (fn [cluster]
-                                                        hash-map
-                                                        :cluster cluster
-                                                        :cluster-size (cluster->size cluster @updated-state*))
-                                                      neighbors-clusters)
-                          biggest-cluster        (->> cluster-sizes
-                                                      (sort-by :cluster-size)
-                                                      first
-                                                      :cluster)
-                          grid-w-biggest-cluster (first
-                                                   (keep
-                                                     (fn [neigh-pos-id neigh-char-vec]
-                                                       (= biggest-cluster
-                                                          (:cluster neigh-char-vec)))
-                                                     neighbors))]
-                      (case (::label grid-w-biggest-cluster)
+                    (let [cluster-sizes                      (map (fn [cluster]
+                                                                    hash-map
+                                                                    :cluster cluster
+                                                                    :cluster-size (cluster->size cluster @updated-state*))
+                                                                  neighbors-clusters)
+                          biggest-neighboring-cluster        (->> cluster-sizes
+                                                                  (sort-by :cluster-size)
+                                                                  first
+                                                                  :cluster)
+                          grid-w-biggest-neighboring-cluster (first
+                                                               (keep
+                                                                 (fn [neigh-pos-id neigh-char-vec]
+                                                                   (= biggest-neighboring-cluster
+                                                                      (:cluster neigh-char-vec)))
+                                                                 neighbors))
+                          current-cluster                    (::cluster char-vec)]
+                      (case (::label grid-w-biggest-neighboring-cluster)
                         ;;9
-                        ::dense ()
+                        ::dense (
+                                  ;;10
+                                  (if (= "NO_CLASS" current-cluster)
+                                    (swap! updated-state* assoc-in [::grid-cells pos-idx]
+                                           (do
+                                             (log-it pos-idx ::move-grid-to-biggest-neighboring-cluster biggest-neighboring-cluster)
+                                             (assoc char-vec ::cluster biggest-neighboring-cluster)))
+                                    (swap! updated-state* assoc-in [::grid-cells]
+                                           (merge (::grid-cells @updated-state*)
+                                                  (if (> (cluster->size current-cluster @updated-state*)
+                                                         (cluster->size biggest-neighboring-cluster @updated-state*))
+                                                    ;;11
+                                                    (do
+                                                      (log-it pos-idx ::move-biggest-neighboring-cluster-to-current-cluster {:from biggest-neighboring-cluster
+                                                                                :to   current-cluster})
+                                                      (relabel-cluster biggest-neighboring-cluster current-cluster @updated-state*))
+                                                    ;;12
+                                                    (do
+                                                      (log-it pos-idx ::move-current-cluster-to-biggest-neighboring-cluster {:from current-cluster
+                                                                                :to   biggest-neighboring-cluster})
+                                                      (relabel-cluster current-cluster biggest-neighboring-cluster @updated-state*)))))))

                         ;;15
                         ::transitional ()


[refactor] replace reset! with swap! when possible

--- src/clj_dstream/core.clj
+++ src/clj_dstream/core.clj
@@ -161,11 +161,10 @@
         the-state* (atom state)]
     (if-not (get-in state [::properties ::N])
       (do
-        (reset! the-state* (assoc-in
-                             @the-state*
-                             [::state ::properties ::N]
-                             (phase-space->cell-count
-                               (get-in @the-state* [::state ::properties]))))))
+        (swap! the-state* assoc-in
+               [::state ::properties ::N]
+               (phase-space->cell-count
+                 (get-in @the-state* [::state ::properties])))))
     (doseq [raw-datum raw-data]
       (reset! the-state*
               (one-dstream-iteration
@@ -176,15 +175,8 @@
 (defn update-char-vec-label [{:keys [::char-vec ::properties]}]
   (let [{:keys [::N ::c_m ::c_l ::lambda]} properties
         {:keys [::density-at-last-update]} char-vec
-        dense-coeff  (/ c_m
-                        (*
-                          N
-                          (- 1.0 lambda)))
-
-        sparse-coeff (/ c_l
-                        (*
-                          N
-                          (- 1.0 lambda)))
+        dense-coeff  (/ c_m (* N (- 1.0 lambda)))
+        sparse-coeff (/ c_l (* N (- 1.0 lambda)))
         new-label    (case [(>= density-at-last-update dense-coeff)
                             (<= density-at-last-update sparse-coeff)]
                        [true false] ::dense
@@ -296,12 +288,11 @@
   (let [lambda (get-in state [::properties ::lambda])
         state* (atom state)]
     (doseq [[pos-idx char-vec] (::grid-cells @state*)]
-      (reset! state* (assoc-in
-                       @state*
-                       [::grid-cells pos-idx]
-                       (update-char-vec-label
-                         {::char-vec   (update-char-vec-density char-vec t lambda false)
-                          ::properties (::properties state)}))))
+      (swap! state* assoc-in
+             [::grid-cells pos-idx]
+             (update-char-vec-label
+               {::char-vec   (update-char-vec-density char-vec t lambda false)
+                ::properties (::properties state)})))
     @state*))

 (defn dense-grids->unique-clusters [state]
@@ -310,15 +301,13 @@
       (if (= ::dense (::label char-vec))
         (do
           (my-log state ::dense-grid-creating-cluster {:char-vec char-vec})
-          (reset! state* (assoc-in
-                           @state*
-                           [::grid-cells pos-idx ::cluster]
-                           (str (java.util.UUID/randomUUID)))))
+          (swap! state* assoc-in
+                 [::grid-cells pos-idx ::cluster]
+                 (str (java.util.UUID/randomUUID))))
         (do (my-log state ::not-dense-grid {:char-vec char-vec})
-            (reset! state* (assoc-in
-                             @state*
-                             [::grid-cells pos-idx ::cluster]
-                             "NO_CLASS")))))
+            (swap! state* assoc-in
+                   [::grid-cells pos-idx ::cluster]
+                   "NO_CLASS"))))
     @state*))

 (defn- initial-clustering-single-pass [the-state]


These should be JS bridges - or alternatively, what those in turn eventually will call

--- src/cljs/go/compiler.clj
+++ src/cljs/go/compiler.clj
@@ -185,7 +185,7 @@

 (defmethod emit-constant java.util.regex.Pattern [x]
   (if (= "" (str x))
-    (emits "(new RegExp(\"\"))")
+    (emits "(new js.RegExp(\"\"))")
     (let [[_ flags pattern] (re-find #"^(?:\(\?([idmsux]*)\))?(.*)" (str x))]
       (emits \/ (.replaceAll (re-matcher #"/" pattern) "\\\\/") \/ flags))))

@@ -228,7 +228,7 @@
 ;; tagged literal support

 (defmethod emit-constant java.util.Date [^java.util.Date date]
-  (emits "new Date(" (.getTime date) ")"))
+  (emits "new js.Date(" (.getTime date) ")"))

 (defmethod emit-constant java.util.UUID [^java.util.UUID uuid]
   (emits "new cljs.core.UUID(\"" (.toString uuid) "\")"))
@@ -591,7 +591,7 @@
                 (emitln "return " n ".call(this" (if (zero? pcnt) nil
                                                      (list "," (comma-sep (take pcnt maxparams)))) ");"))))
           (emitln "}")
-          (emitln "throw(new Error('Invalid arity: ' + arguments.length));")
+          (emitln "throw(new js.Error('Invalid arity: ' + arguments.length));")
           (emitln "};")
           (when variadic
             (emitln mname ".cljs$lang$maxFixedArity = " max-fixed-arity ";")


Turned off bounce

Turned off bounce

Block detection working
Trampetes working
TODO - stop falling

--- src/cljs/kenny/core.cljs
+++ src/cljs/kenny/core.cljs
@@ -92,21 +92,22 @@
      ]
     ))

-(defn on-supporting-block? [position]
+(defn on-block? [position block-no]
   (let [[left right] (hero-feet-coords position)
         app @app-state
         below-left (update-in left [0] + 1)
         below-right (update-in right [0] + 1)]
-    (some #{[1]} [(get-in app (into [:grid] left)) (get-in app (into [:grid] right))]
+    (some #{[block-no]} [(get-in app (into [:grid] below-left)) (get-in app (into [:grid] below-right))]
           )))

-(defn on-block? [position, block-no]
+(defn in-block? [position block-no]
   (let [[left right] (hero-feet-coords position)
-        app @app-state
-        below-left (update-in left [0] + 1)
-        below-right (update-in right [0] + 1)]
+        app @app-state]
     (some #{[block-no]} [(get-in app (into [:grid] left)) (get-in app (into [:grid] right))]
           )))
+
+(defn on-supporting-block? [position]
+  (on-block? position 1))

 (defn moving? [hero]
   (not= 0 (hero :dx))
@@ -138,6 +139,12 @@
       )
     ))

+(defn blocked? [original-hero hero]
+  (if (in-block? (get-in hero [:position]) 1)
+    (update-in hero [:position :left] (fn[_] (get-in original-hero [:position :left])))
+    hero
+    ))
+
 (defn move-right [hero]
   (let [left-position (get-in hero [:position :left])]
     (if (moving? hero)
@@ -149,19 +156,30 @@
     ))

 (defn on-red-trampete? [red-trampete hero]
-  (if (on-block? (get-in hero [:position]) 3)
-    (update-in hero [:dy] (fn [old-dy] (+ old-dy (-> red-trampete first))))
+  (if (in-block? (get-in hero [:position]) 3)
+    (let [new-hero (update-in hero [:dy] (fn [old-dy] (+ old-dy (-> red-trampete first))))]
+      ;;(update-in new-hero [:position :bottom] + 1)
+      new-hero
+      )
     hero
     ))

 (defn on-blue-trampete? [blue-trampete hero]
-  (if (on-block? (get-in hero [:position]) 4)
-    (update-in hero [:dy] (fn [old-dy] (+ old-dy (-> blue-trampete first))))
+  (if (in-block? (get-in hero [:position]) 4)
+    (let [new-hero (update-in hero [:dy] (fn [old-dy] (+ old-dy (-> blue-trampete first))))]
+      (update-in new-hero [:position :bottom] + 1)
+      )
+    hero
+    ))
+
+(defn on-ground? [hero]
+  (if (on-block? (get-in hero [:position]) 1)
+    (update-in hero [:dy] + 0.75)
     hero
     ))

 (defn spike-damage [hero]
-  (if (on-block? (get-in hero [:position]) 2)
+  (if (in-block? (get-in hero [:position]) 2)
     (update-in hero [:life] - 1)
     hero
     ))
@@ -177,8 +195,9 @@
   )

 (defn vertical-block [original-hero new-hero]
-  (let [original-bottom (get-in original-hero [:position :bottom])
-        supported (on-supporting-block? (update-in (original-hero :position) [:bottom] - 1))]
+  (let [original-position (get-in original-hero [:position])
+        original-bottom (get-in original-hero [:position :bottom])
+        supported (on-supporting-block? original-position)]
     (if supported
       (let [nearest-vertical-border (* (ceil (/ original-bottom 70)) 70)
             newer-hero (update-in new-hero [:position :bottom] (fn [_] nearest-vertical-border))]
@@ -189,7 +208,7 @@
     ))

 (defn logger [key hero]
-  ;;(console-log {key (get-in hero [:position :left])})
+  (console-log {key (get-in hero [:position :left])})
   hero
   )

@@ -210,9 +229,9 @@
   )

 (defn game-over? [original-hero hero]
-  (if (or (> 0 (get-in hero [:position :bottom]))
-          (> 0 (get-in hero [:life])))
-    (merge original-hero {:life 0})
+  (if (or (> 0 (get-in original-hero [:position :bottom]))
+          (> 0 (get-in original-hero [:life])))
+    (update-in hero [:life] (fn [_] 0))
     hero
     )
   )
@@ -230,19 +249,20 @@
               blue-trampete (get-in @app [:settings :blue-trampete])
               settings (get-in @app [:settings])
               new-hero (-> original-hero
-                           grav
-                           ((partial vertical-block original-hero))
+                           ;;((partial vertical-block original-hero))
                            move-left
                            move-right
                            ;;((partial bouncing bounce))
                            ((partial on-blue-trampete? blue-trampete))
                            ((partial on-red-trampete? red-trampete))
-                           spike-damage
-                           ((partial time-up? original-hero app))
-                           ((partial home? original-hero))
-                           ((partial game-over? original-hero))
+                           on-ground?
+                           grav
+                           ;;spike-damage
+                           ;;((partial time-up? original-hero app))
+                           ;;((partial home? original-hero))
+                           ((partial blocked? original-hero))
+                           ;;((partial game-over? original-hero))
                            )]
-
           (om/transact! app [:hero] (fn [hero] (merge hero new-hero)))
           )
         (recur)


add :sem :obj if necessary, so that (defn intransitivize) is triggered.

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -2206,6 +2206,12 @@
 (def lexicon (-> (compile-lex lexicon-source
                               morph/exception-generator
                               morph/phonize morph/english-specific-rules)
+
+                 ;; add :sem :obj if necessary, so that intransitivize is triggered.
+                 (if-then {:synsem {:cat :verb
+                                    :subcat {:2 {:cat :noun}}}}
+                          {:synsem {:sem {:obj {:pred :top}}}})
+
                  ;; make an intransitive version of every verb which has an
                  ;; [:sem :obj] path.
                  intransitivize


fixed merged issues

fixed merged issues

--- src/clinvar_submitter/form.clj
+++ src/clinvar_submitter/form.clj
@@ -49,7 +49,7 @@
   (defn interp-eval-date
   "Return the interpretation evaluation date."
   [t i]
-  (if(nil? (ld-> t i "contribution")) (log/error (str "Exception in interp-eval-date: contribution not found")))
+  (if(nil? (ld-> t i "contribution")) (log/error (str "ERROR-interp-eval-date: contribution not found")))
   (let [contribution (ld-> t i "contribution")]
     (if (nil? (get contribution "onDate")) ""
       (.format
@@ -157,7 +157,7 @@
   (if (not (nil? c))
   (let [name (get c "name")]
     (csv-colval (if (nil? name) "" name) "ERROR-condition-name"))
-  (log/error (str "Exception in function condition-name: condition name not found"))))
+  (log/error (str "ERROR-condition-name: condition name not found"))))

 (defn condition-idtype
   ;TODO modify to deal with phenotypes and multi-values for satisfying clinvar specs.
@@ -166,7 +166,7 @@
   (let [disease-coding (ld-> t c "disease" "coding")]
     (let [disease-code (get disease-coding "code")]
       (csv-colval (if (nil? disease-code) "" (get (re-find #"(.*)\_(.*)" disease-code) 1)) "ERROR-condition-idtype")))
-  (log/error (str "Exception in function condition-idtype: condition idt type not found"))))
+  (log/error (str "ERROR-condition-idtype: condition idt type not found"))))

 (defn condition-idvals
    ;TODO modify to deal with phenotypes and multi-values for satisfying clinvar specs.


[#268] Printable Erlang lists as #erl"..."

--- src/clj/clojure/core_print.clj
+++ src/clj/clojure/core_print.clj
@@ -124,7 +124,9 @@

 (defmethod print-method clojerl.erlang.List [o, ^Writer w]
   (print-meta o w)
-  (print-sequential "#erl(" pr-on " " ")" o w))
+  (if (io_lib/printable_unicode_list.e o)
+    (write w (str "#erl\"" (erlang/list_to_binary.e o) "\""))
+    (print-sequential "#erl(" pr-on " " ")" o w)))

 (defmethod print-method clojerl.Cons [o, ^Writer w]
   (print-meta o w)


New Construction can't install ICE

New Construction can't install ICE

--- src/clj/game/cards-agendas.clj
+++ src/clj/game/cards-agendas.clj
@@ -340,6 +340,7 @@
                :prompt "Install a card from HQ in a new remote?"
                :yes-ability {:prompt "Choose a card in HQ to install"
                              :choices {:req #(and (not (is-type? % "Operation"))
+                                                  (not (is-type? % "ICE"))
                                                   (= (:side %) "Corp")
                                                   (in-hand? %))}
                              :msg (msg "install a card from HQ" (when (>= (:advance-counter (get-card state card)) 5)


Forgot to remove afterburner, coffee overspeed.

--- src/clj/mokkameister/train.clj
+++ src/clj/mokkameister/train.clj
@@ -79,7 +79,7 @@
    (train-custom :coffee :coffee :running :running :running :dash)
    (train-custom :sun_with_face :lollipop :sun_with_face :lollipop
                  :sun_with_face :lollipop :sun_with_face :rainbow)
-   ":bullettrain_front::coffee::scream_cat::coffee::scream_cat::afterburner::dash:"
+   ":bullettrain_front::coffee::scream_cat::coffee::scream_cat::dash:"
    ":tractor::cow2::cow::cow2::cow::cow2::cow::cow2::dash:"
    (str "All aboard the coffee train!\n"
         (train-custom :coffee :coffee :running :running :running :dash))


Courage

Courage

--- src/clj/mokkameister/train.clj
+++ src/clj/mokkameister/train.clj
@@ -71,6 +71,7 @@
    (train-custom :coffee :coffee :running :running :running :dash)
    (train-custom :sun_with_face :lollipop :sun_with_face
                  :lollipop :sun_with_face :lollipop :rainbow)
+   ":tractor::cow2::cow::cow2::cow::cow2::cow::cow2::dash:"
    (str "All aboard the coffee train!\n"
         (train-custom :coffee :coffee :running :running :running :dash))
    "Det er kaffi å få på kjøken!"


Realizy lazy map for making sure scenario runs start immediately

--- src/clj_gatling/simulation.clj
+++ src/clj_gatling/simulation.clj
@@ -126,8 +126,9 @@
           requests)))

 (defn run-scenarios [timeout scenarios]
-  (let [results (map (fn [scenario] (thread (run-scenario timeout scenario)))
-                     scenarios)]
+  (let [results (doall (map (fn [scenario]
+                              (thread (run-scenario timeout scenario)))
+                        scenarios))]
     (mapcat #(<!! %) results)))

 (defn run-simulation [scenarios users & [options]]


Don't compile/dex Android project when 'Run with REPL' is used

--- src/clojure/nightcode/lein.clj
+++ src/clojure/nightcode/lein.clj
@@ -253,7 +253,7 @@
   (cond
     (is-android-project? path)
     (when-let [project (read-android-project project)]
-      (doseq [cmd ["doall" "repl"]]
+      (doseq [cmd ["deploy" "repl"]]
         (leiningen.droid/execute-subtask project cmd [])
         (Thread/sleep 10000)))
     :else


Move cljsbuild command before the main cond

--- src/clojure/nightcode/lein.clj
+++ src/clojure/nightcode/lein.clj
@@ -196,6 +196,8 @@

 (defn run-project-task
   [path project]
+  (when (:cljsbuild project)
+    (leiningen.cljsbuild/cljsbuild project "once"))
   (cond
     (android-project? path)
     (some-> (read-android-project project)
@@ -205,10 +207,7 @@
     (ring-project-map? project)
     (leiningen.ring/ring project "server")
     :else
-    (do
-      (when (:cljsbuild project)
-        (leiningen.cljsbuild/cljsbuild project "once"))
-      (leiningen.run/run project))))
+    (leiningen.run/run project)))

 (defn run-repl-project-task
   [path project]


Quick helper to define stacks

Quick helper to define stacks

--- src/clojure/picard/helpers.clj
+++ src/clojure/picard/helpers.clj
@@ -21,6 +21,12 @@
 (defn response-status  [[status]]    status)
 (defn response-headers [[_ headers]] headers)
 (defn response-body    [[_ _ body]]  body)
+
+(defmacro defstack
+  "Builds an application stack from downstream to upstream. The last
+  argument should be the end application and everything before that
+  is middleware."
+  [& items] `(-> ~@(reverse items)))

 (defmacro defstream
   [& handlers]


Added mock echo to the reset endpoint on the control api.

--- src/cmr/dev_system/control.clj
+++ src/cmr/dev_system/control.clj
@@ -15,7 +15,8 @@
             [cmr.metadata-db.services.concept-service :as mdb-service]
             [cmr.index-set.services.index-service :as index-set-service]
             [cmr.indexer.services.index-service :as indexer-service]
-            [cmr.search.services.query-service :as search-service]))
+            [cmr.search.services.query-service :as search-service]
+            [cmr.mock-echo.api.routes :as mock-echo-api]))

 (defn app-context
   [system app]
@@ -46,7 +47,8 @@
   {:metadata-db mdb-service/reset
    :index-set index-set-service/reset
    :indexer indexer-service/reset
-   :search search-service/clear-cache})
+   :search search-service/clear-cache
+   :mock-echo mock-echo-api/reset})

 (def service-clear-cache-fns
   "A map of services to reset functions."


Reverting changes, keeping chouser's work.

--- samples/twitterbuzz/src/twitterbuzz/stats.cljs
+++ samples/twitterbuzz/src/twitterbuzz/stats.cljs
@@ -1,69 +1,37 @@
-(ns twitterbuzz.stats)
+(ns twitterbuzz.graph)

 ;; code review from SDH:
 ;;
-;; 1. I think inc-or-nil could be replaced by fnil - fixed ar
+;; 1. I think inc-or-nil could be replaced by fnil
 ;; 2. update-retweet-count looks broken
-;;    `when` instead of `if` in function to be reduced over - fixed ar
+;;    `when` instead of `if` in function to be reduced over
 ;; 3. conversion from string keys to keywords should be
-;;    done already before we get here - fixed ar
+;;    done already before we get here
 ;; 4. fns like top-tweets should not take an n arg
-;;    consumers can always take what they want - fixed ar
-;; 5. namespace and file name do not match - fixed ar
+;;    consumers can always take what they want
+;; 5. namespace and file name do not match
+
+(defn inc-or-1
+  "Returns 1 if x is nil, (inc x) otherwise"
+  [x]
+  (if (nil? x) 1 (inc x)))

 (defn update-retweet-count
   "Updates the total count of retweets by id in m as indicated by the contents of
   the tweet t"
   [m t]
-  (let [rt-id (get-in t [:retweeted_status :id_str])]
-    (if (nil? rt-id) m (update-in m [rt-id] (fnil inc 0)))))
+  (let [rt-id (get-in t ["retweeted_status" "id_str"])]
+    (when-not (nil? rt-id) (update-in m [rt-id] inc-or-1))))

 (defn top-tweets
-  "Returns the ids of the most retweeted tweets out of tweet seq ts in descending
-  order"
-  [ts]
+  "Returns the ids of top n most retweeted tweets out of tweet seq ts"
+  [ts n]
   (let [retweet-counts (reduce update-retweet-count {} ts)
         tweet-ids (keys retweet-counts)]
-    (sort-by #(get retweet-counts %) tweet-ids)))
-
-(defn retweet-of
-  "Returns the username of the user who originally authored the tweet
-  that t is a retweet of, nil otherwise"
-  [t]
-  (get-in t [:retweeted_status :user :name]))
-
-(defn mentioned-users
-  "Returns the usernames of all the users mentioned in tweet t"
-  [t]
-  (map #(get % :screen_name) (get-in t [:entities :user_mentions])))
-
-(defn new-edges
-  "Filter the seq of sets n to find all sets in n that do not already
-  exist in the seq of sets o"
-  [n o]
-  (filter #(not (contains? o %)) n))
-
-(defn edges
-  "Return a lazy seq of pairs of usernames representing the social edges of a tweet
-  stream, where a social edge is defined as one user retweeting or
-  mentioning another user in a given tweet. Edges are not directional; if
-  @alice retweets @bob, and @bob mentions @alice, those two tweets only create
-  one edge."
-  ([ts]
-     (edges ts #{}))
-  ([ts edges]
-     (let [t (first ts)
-           other-users (concat (list (retweet-of t)) (mentioned-users t))
-           author (get-in t [:user :name])
-           tweet-edges (set (map #(set (list author %)) other-users))
-           new-edges (new-edges tweet-edges edges)]
-       (when t
-         (if (empty? new-edges)
-           (recur (rest ts) edges)
-           (lazy-seq (concat new-edges (edges (rest ts) (concat new-edges edges)))))))))
+    (take n (sort-by #(get retweet-counts %) tweet-ids))))

 (defn graph
   "Returns a map representing the graph of the tweet seq ts"
   [ts]
-  {:nodes {}
+  {:nodes []
    :edges []})


Revert "updated es mapping relation maps"

This reverts commit 2ca7f0706e18625bbc1ae9ec849506cb92a7fd2d.

--- src/ctia/stores/es/mapping.clj
+++ src/ctia/stores/es/mapping.clj
@@ -4,10 +4,9 @@
 (def string {:type "string" :index "not_analyzed"})

 (def related
-  {:type string
-   :confidence string
-   :source string
-   :relationship string})
+  {:confidence {:type "string"}
+   :source {:type "string"}
+   :relationship {:type "string"}})

 (def valid-time
   {:type "nested"


Add some ajax functions that need to be tested.


Update onyx_app.clj

Update onyx_app.clj

Did this get reverted?

--- src/leiningen/new/onyx_app.clj
+++ src/leiningen/new/onyx_app.clj
@@ -67,7 +67,7 @@
                   ["resources/prod-peer-config.edn" (render "prod-peer-config.edn" data)]

                   [(str "src/" path "/launcher/dev_system.clj") (render "dev_system.clj" data)]
-                  [(str "src/" path "/launcher/launch_prod_peers.clj") (render "launch_prod_peers.clj" data)]
+                  [(str "src/" path "/launcher/launch_prod_peers.clj") (render "launch_prod_peers_bare.clj" data)]

                   [(str "src/" path "/workflows/.gitkeep") (render "gitkeep" data)]
                   [(str "src/" path "/catalogs/.gitkeep") (render "gitkeep" data)]


Invoices table uses table component

Invoices table uses table component

--- src-cljs/frontend/components/org_settings.cljs
+++ src-cljs/frontend/components/org_settings.cljs
@@ -970,42 +970,6 @@
   [ts]
   (datetime/year-month-day-date (* 1000 ts)))

-(defn invoice-view
-  "Render an invoice table row.
-  Invoices fetched from the API look like:
-
-  ;; Invoice API Format
-  ;; ------------------
-  ;; amount_due: 3206
-  ;; currency: \"usd\"
-  ;; date: 1403535350
-  ;; id: \"in_2398vhs098AHYoi\"
-  ;; paid: true
-  ;; period_end: 1403535350
-  ;; period_start: 1402665929"
-  [invoice owner]
-  (reify
-    om/IRender
-    (render [_]
-      (html
-        (let [invoice-id (:id invoice)]
-          [:tr
-            [:td (stripe-ts->date (:date invoice))]
-            [:td (str (stripe-ts->date (:period_start invoice)))
-                      " - "
-                      (stripe-ts->date (:period_end invoice))]
-            [:td.numeric (gstring/format "$%.2f" (invoice-total invoice))]
-            [:td
-              [:span
-                (forms/managed-button
-                  [:button.btn.btn-mini.btn-primary
-                    {:data-failed-text "Failed",
-                     :data-success-text "Sent",
-                     :data-loading-text "Sending...",
-                     :on-click #(raise! owner [:resend-invoice-clicked
-                                               {:invoice-id invoice-id}])}
-                    "Resend"])]]])))))
-
 (defn- ->balance-string [balance]
   (let [suffix (cond
                 (< balance 0) " in credit."
@@ -1036,29 +1000,40 @@
               [:div.loading-spinner common/spinner]]]
             [:div.row-fluid
              [:div.span8
-               [:legend "Invoices"]
-               [:dl.dl-horizontal
-                [:dt
-                 "Account balance"
-                 [:i.fa.fa-question-circle#invoice-popover-hack
-                  {:title "Account balance"
-                   :data-content (str "
This is the credit you have with Circle. If your credit is positive, then we will use it before charging your credit card.
"
-                                      "
Contact us if you'd like us to send you a refund for the balance.
"
-                                      "
This amount may take a few hours to refresh.
")}]]
-                [:dd
-                 [:span (->balance-string account-balance)]]]
-               [:table.table.table-bordered.table-striped
-                [:thead
-                 [:tr
-                  [:th "Invoice date"]
-                  [:th "Time period covered"]
-                  [:th "Total"]
-                  [:th
-                   [:i.fa.fa-question-circle#resend-invoice-tooltip-hack
-                    {:title "Resend an invoice to the billing email above."}]
-                   "Actions"]]]
-                [:tbody
-                 (om/build-all invoice-view invoices)]]]]))))))
+              [:legend "Invoices"]
+              [:dl.dl-horizontal
+               [:dt
+                "Account balance"
+                [:i.fa.fa-question-circle#invoice-popover-hack
+                 {:title "Account balance"
+                  :data-content (str "
This is the credit you have with Circle. If your credit is positive, then we will use it before charging your credit card.
"
+                                     "
Contact us if you'd like us to send you a refund for the balance.
"
+                                     "
This amount may take a few hours to refresh.
")}]]
+               [:dd
+                [:span (->balance-string account-balance)]]]
+              (om/build table/table
+                        {:rows invoices
+                         :columns [{:header "Invoice date"
+                                    :cell-fn (comp stripe-ts->date :date)}
+
+                                   {:header "Time period covered"
+                                    :cell-fn (comp str stripe-ts->date :period_start)}
+
+                                   {:header "Total"
+                                    :type :right
+                                    :cell-fn #(gstring/format "$%.2f" (invoice-total %))}
+
+                                   {:type :shrink
+                                    :cell-fn
+                                    (fn [invoice]
+                                      (forms/managed-button
+                                       [:button.btn.btn-mini.btn-primary
+                                        {:data-failed-text "Failed" ,
+                                         :data-success-text "Sent" ,
+                                         :data-loading-text "Sending..." ,
+                                         :on-click #(raise! owner [:resend-invoice-clicked
+                                                                   {:invoice-id (:id invoice)}])}
+                                        "Resend"]))}]})]]))))))

 (defn billing [app owner]
   (reify


last commit?

last commit?

--- src-cljs/qcon/main.cljs
+++ src-cljs/qcon/main.cljs
@@ -15,7 +15,7 @@
    [om.dom :as dom :include-macros true]
    [sablono.core :as html :refer-macros [html]]
    [ankha.core :as ankha]
-   [cljs.core.async :refer [<! >! timeout buffer chan put! sliding-buffer close! pipe map< filter<]]
+   [cljs.core.async :refer [<! >! timeout buffer dropping-buffer sliding-buffer chan put! sliding-buffer close! pipe map< filter<]]
    [clojure.string :as string]
    [ajax.core :refer (GET POST)]))

@@ -452,7 +452,7 @@
             ]]]]]))))

 (def app-model
-  (atom {:current-slide 28
+  (atom {:current-slide 0
          :slides
          ;; TODO Add cardinal such that each slide has its own number to avoid react warning
          (vec


fixed up validation error messages

fixed up validation error messages

--- src/midje/ideas/background.clj
+++ src/midje/ideas/background.clj
@@ -108,7 +108,7 @@
   (cond
       (and (#{"after" "around"} (name state-description)) (not= 3 (count form)))
       (user-error-report-form form
-        (cl-format nil "    ~A form should be have a length of 3: ~A" form (name state-description)))
+        (cl-format nil "    ~A form should look like: (~A :contents/:facts/:checks (your-code))" form (name state-description)))

       (and (= "before" (name state-description))
            (not= 3 (count form))
@@ -116,9 +116,10 @@
                (and (= 5 (count form))
                     (not= :after (nth form 3)))))
       (user-error-report-form form
-        (cl-format nil "    ~A form should be have a length of 3 or 5: ~A" form (name state-description)))
-
-      ((complement valid-wrapping-targets) wrapping-target)
+        (cl-format nil "    ~A form should look like: (before :contents/:facts/:checks (your-code)) or" form (name state-description))
+        (cl-format nil "    (before :contents/:facts/:checks (your-code) :after (final-code))"))
+
+    ((complement valid-wrapping-targets) wrapping-target)
       (user-error-report-form form
         (cl-format nil "    In this form: ~A" form)
         (cl-format nil "The second element (~A) should be one of: :facts, :contents, or :checks" wrapping-target))


Dropped changes to wrap-report-and-absorb-exceptions brought in 936c73f.


syntax error

syntax error

--- src/oc/storage/util/ziggeo.clj
+++ src/oc/storage/util/ziggeo.clj
@@ -39,6 +39,6 @@
         (cb (-> body
                 json/parse-string
                 keywordize-keys) error)
-        {} (if-not error
-             true
-             error)))))+        (cb {} (if-not error
+                 true
+                 error))))))


Add sorting functions

Add sorting functions

--- src/play_clj/core_graphics.clj
+++ src/play_clj/core_graphics.clj
@@ -1,4 +1,25 @@
 (in-ns 'play-clj.core)
+
+; misc
+
+(defmacro usage
+  "Returns a static field in [VertexAttributes.Usage](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/VertexAttributes.Usage.html)"
+  [k]
+  `~(u/gdx-field :graphics "VertexAttributes$Usage" (u/key->pascal k)))
+
+(defn low->high
+  "Sorts the `entities` by `k` in ascending order
+
+    (low->high :y entities)"
+  [k entities]
+  (sort #(if (< (get %1 k) (get %2 k)) -1 1) entities))
+
+(defn high->low
+  "Sorts the `entities` by `k` in descending order
+
+    (high->low :y entities)"
+  [k entities]
+  (sort #(if (< (get %1 k) (get %2 k)) 1 -1) entities))

 ; tiled maps

@@ -420,7 +441,7 @@
     (.begin batch)
     (doseq [entity (->> (map #(get-in screen [:layers %]) layer-names)
                         (apply concat entities)
-                        (sort #(if (< (:y %1) (:y %2)) 1 -1)))]
+                        (high->low :y))]
       (if-let [layer (:layer entity)]
         (.renderTileLayer renderer layer)
         (draw-entity! batch entity)))
@@ -543,10 +564,3 @@
   (let [^Camera camera (u/get-obj screen :camera)]
     (set! (. camera far) n)
     (.update camera)))
-
-; misc
-
-(defmacro usage
-  "Returns a static field in [VertexAttributes.Usage](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/VertexAttributes.Usage.html)"
-  [k]
-  `~(u/gdx-field :graphics "VertexAttributes$Usage" (u/key->pascal k)))


CMR-5848 Adds test for umm-json granule ingest with virtual product.

--- system-int-test/test/cmr/system_int_test/ingest/provider_cmr_only_client_id_test.clj
+++ system-int-test/test/cmr/system_int_test/ingest/provider_cmr_only_client_id_test.clj
@@ -1,15 +1,18 @@
 (ns cmr.system-int-test.ingest.provider-cmr-only-client-id-test
   "CMR provider CMR-ONLY flag and client id integration tests"
-  (:require
+  (:require
     [clojure.test :refer :all]
     [cmr.system-int-test.data2.core :as d]
     [cmr.system-int-test.data2.granule :as dg]
     [cmr.system-int-test.data2.umm-spec-collection :as data-umm-c]
+    [cmr.system-int-test.data2.umm-spec-common :as data-umm-cmn]
     [cmr.system-int-test.utils.index-util :as index]
     [cmr.system-int-test.utils.ingest-util :as ingest]
-    [cmr.system-int-test.utils.search-util :as search]))
+    [cmr.system-int-test.utils.search-util :as search]
+    [cmr.umm.umm-granule :as umm-g]))

-(use-fixtures :each (ingest/reset-fixture {"provguid1" "PROV1"}))
+(use-fixtures :each (ingest/reset-fixture {"provguid1" "PROV1"
+                                           "provguid2" "GES_DISC"}))

 (def ingest-functions-to-test
   [#'ingest/validate-concept #'ingest/ingest-concept #'ingest/delete-concept])
@@ -120,4 +123,30 @@
       (assert-ingest-success #'ingest/delete-concept concept "Virtual-Product-Service")
       (index/wait-until-indexed)
       (is (= 0 (:hits (search/find-refs :granule {:granule-ur (:granule-ur granule)
+                                                  :page-size 50}))))))
+  (testing "ingest with Virtual-Product-Service with a umm-json granule"
+    (let [psa1 (data-umm-cmn/additional-attribute {:Name "source_granule_ur" :DataType "STRING" :Description "Test"})
+          collection (d/ingest-umm-spec-collection "GES_DISC" (data-umm-c/collection
+                                                                {:EntryTitle "OMI/Aura Surface UVB Irradiance and Erythemal Dose Daily L3 Global 1.0x1.0 deg Grid V003 (OMUVBd) at GES DISC"
+                                                                 :ShortName "OMUVBd_ErythemalUV"
+                                                                 :AdditionalAttributes [psa1]
+                                                                 :Version "003"}))
+          concept (-> (dg/granule-with-umm-spec-collection
+                       collection
+                       (:concept-id collection)
+                       {:granule-ur "Gran1"
+                        :provider-id "GES_DISC"
+                        :collection-ref (umm-g/map->CollectionRef {:entry-title "OMI/Aura Surface UVB Irradiance and Erythemal Dose Daily L3 Global 1.0x1.0 deg Grid V003 (OMUVBd) at GES DISC"})})
+                      (d/item->concept {:format :umm-json
+                                        :version "1.4"}))]
+      (ingest/clear-caches)
+      (assert-ingest-success #'ingest/validate-concept concept "Virtual-Product-Service")
+      (assert-ingest-success #'ingest/ingest-concept concept "Virtual-Product-Service")
+      (index/wait-until-indexed)
+      (is (= 1 (:hits (search/find-refs :granule {:granule-ur (:granule-ur "Gran1")
                                                   :page-size 50})))))))
+
+      ; (assert-ingest-success #'ingest/delete-concept concept "Virtual-Product-Service")
+      ; (index/wait-until-indexed)
+      ; (is (= 0 (:hits (search/find-refs :granule {:granule-ur (:granule-ur "Gran1")
+      ;                                             :page-size 50})))))))


CMR-6219 missed committing test updates

CMR-6219 missed committing test updates

--- system-int-test/test/cmr/system_int_test/search/service/service_association_test.clj
+++ system-int-test/test/cmr/system_int_test/search/service/service_association_test.clj
@@ -77,7 +77,7 @@
     (testing "Associate to non-existent collections"
       (let [response (association-util/associate-by-concept-ids
                       token concept-id [{:concept-id "C100-P5"}])]
-        (service-util/assert-service-association-response-ok?
+        (service-util/assert-service-association-bad-request
          {["C100-P5"] {:errors ["Collection [C100-P5] does not exist or is not visible."]}}
          response)))

@@ -87,7 +87,7 @@
             _ (index/wait-until-indexed)
             response (association-util/associate-by-concept-ids
                       token concept-id [{:concept-id c1-p1}])]
-        (service-util/assert-service-association-response-ok?
+        (service-util/assert-service-association-bad-request
          {[c1-p1] {:errors [(format "Collection [%s] does not exist or is not visible." c1-p1)]}}
          response)))

@@ -96,7 +96,7 @@
       (let [response (association-util/associate-by-concept-ids token
                                                                 concept-id
                                                                 [{:concept-id c4-p3}])]
-        (service-util/assert-service-association-response-ok?
+        (service-util/assert-service-association-bad-request
          {[c4-p3] {:errors [(format "Collection [%s] does not exist or is not visible." c4-p3)]}}
          response)))

@@ -104,7 +104,7 @@
       (let [response (association-util/associate-by-concept-ids
                       token concept-id [{:concept-id c2-p1}
                                         {:concept-id "C100-P5"}])]
-        (service-util/assert-service-association-response-ok?
+        (service-util/assert-service-association-bad-request
          {[c2-p1] {:concept-id "SA1200000028-CMR"
                    :revision-id 1}
           ["C100-P5"] {:errors ["Collection [C100-P5] does not exist or is not visible."]}}
@@ -203,7 +203,7 @@
     (testing "Dissociate non-existent collections"
       (let [response (association-util/dissociate-by-concept-ids
                       token concept-id [{:concept-id "C100-P5"}])]
-        (service-util/assert-service-dissociation-response-ok?
+        (service-util/assert-service-dissociation-bad-request
          {["C100-P5"] {:errors ["Collection [C100-P5] does not exist or is not visible."]}}
          response)))

@@ -214,7 +214,7 @@
             _ (index/wait-until-indexed)
             response (association-util/dissociate-by-concept-ids
                       token concept-id [{:concept-id c1-p2-concept-id}])]
-        (service-util/assert-service-dissociation-response-ok?
+        (service-util/assert-service-dissociation-bad-request
          {["C1200000019-PROV2"] {:errors [(format "Collection [%s] does not exist or is not visible."
                                                   c1-p2-concept-id)]}}
          response)))
@@ -224,7 +224,7 @@
       (let [coll-concept-id (:concept-id c4-p3)
             response (association-util/dissociate-by-concept-ids
                       token concept-id [{:concept-id coll-concept-id}])]
-        (service-util/assert-service-dissociation-response-ok?
+        (service-util/assert-service-dissociation-bad-request
          {["C1200000026-PROV3"] {:errors [(format "Collection [%s] does not exist or is not visible."
                                                   coll-concept-id)]}}
          response)))))
@@ -302,7 +302,7 @@
                        {:concept-id (:concept-id coll2) :revision-id 1} ;; success
                        {:concept-id (:concept-id coll3)}])] ;; no service association

-        (service-util/assert-service-dissociation-response-ok?
+        (service-util/assert-service-dissociation-bad-request
          {["C100-P5"] {:errors ["Collection [C100-P5] does not exist or is not visible."]}
           ["C1200000012-PROV1"] {:concept-id "SA1200000016-CMR" :revision-id 2}
           ["C1200000013-PROV1" 1] {:concept-id "SA1200000017-CMR" :revision-id 2}


clean up tests

clean up tests

--- test/lambdacd_git/core_test.clj
+++ test/lambdacd_git/core_test.clj
@@ -71,20 +71,12 @@
               (recur)))))))
   state)

-(defn start-wait-for-git-step-with-ref [state ref]
+(defn start-wait-for-git-step [state & {:keys [ref ms-between-polls] :or {ms-between-polls 100
+                                                                              ref          "refs/heads/master"}}]
   (let [wait-for-result-channel (async/go
                                   (let [execute-step-result (lambdacd-core/execute-step {} (:ctx @state)
                                                                                (fn [args ctx]
-                                                                                (wait-for-git ctx (get-in @state [:git :remote]) :ref ref :ms-between-polls 100)))]
-                                    (first (vals (:outputs execute-step-result)))))]
-    (swap! state #(assoc % :result-channel wait-for-result-channel))
-    (wait-for-step-waiting state)
-    state))
-(defn start-wait-for-git-step [state]
-  (let [wait-for-result-channel (async/go
-                                  (let [execute-step-result (lambdacd-core/execute-step {} (:ctx @state)
-                                                                                (fn [args ctx]
-                                                                                (wait-for-git ctx (get-in @state [:git :remote]) :ms-between-polls 100)))]
+                                                                                (wait-for-git ctx (get-in @state [:git :remote]) :ref ref :ms-between-polls ms-between-polls)))]
                                     (first (vals (:outputs execute-step-result)))))]
     (swap! state #(assoc % :result-channel wait-for-result-channel))
     (wait-for-step-waiting state)
@@ -145,12 +137,12 @@
 (defn- expected-timestamp [state commit-msg]
   (git-utils/commit-timestamp-date (:git @state) (commit-hash-by-msg state commit-msg)))

-(deftest wait-for-git-test-clean
+(deftest wait-for-git-test
   (testing "that it waits for a new commit to happen and that it prints out information on old and new commit"
     (let [state (-> (init-state)
                     (git-init)
                     (git-commit "initial commit")
-                    (start-wait-for-git-step-with-ref "refs/heads/master")
+                    (start-wait-for-git-step :ref "refs/heads/master")
                     (wait-for-step-waiting)
                     (git-commit "other commit")
                     (get-step-result))]
@@ -166,7 +158,7 @@
                     (git-init)
                     (git-commit "initial commit")
                     (git-checkout-b "some-branch")
-                    (start-wait-for-git-step-with-ref (fn [ref] (.endsWith ref "some-branch")))
+                    (start-wait-for-git-step :ref (fn [ref] (.endsWith ref "some-branch")))
                     (git-commit "other commit")
                     (get-step-result))]
       (is (= :success (:status (step-result state))))
@@ -178,7 +170,7 @@
                     (git-init)
                     (git-commit "initial commit")
                     (git-checkout-b "some-branch")
-                    (start-wait-for-git-step-with-ref #"refs/heads/some-.*")
+                    (start-wait-for-git-step :ref #"refs/heads/some-.*")
                     (git-commit "other commit")
                     (get-step-result))]
       (is (= :success (:status (step-result state))))
@@ -191,12 +183,12 @@
                     (git-commit "initial commit")
                     (git-checkout-b "some-branch")

-                    (start-wait-for-git-step-with-ref (fn [ref] true))
+                    (start-wait-for-git-step :ref (fn [ref] true))
                     (git-commit "some commit on master")
                     (wait-for-step-to-complete)

                     (git-checkout "some-branch")
-                    (start-wait-for-git-step-with-ref (fn [ref] true))
+                    (start-wait-for-git-step :ref (fn [ref] true))
                     (git-commit "some commit on branch")

                     (get-step-result))]
@@ -371,5 +363,4 @@
             (get-step-result))
         (is (str-containing "Current HEAD" (:out (step-result state))))
         (is (str-containing (commit-hash-by-msg state "some commit") (:out (step-result state))))
-        (is (= :success (:status (step-result state)))))
-      )))+        (is (= :success (:status (step-result state))))))))


Add interpose test

Add interpose test

--- test/simple_check/core_test.clj
+++ test/simple_check/core_test.clj
@@ -86,6 +86,20 @@
                  (let [v (gen/vector gen/int)]
                    (sc/quick-check 1000 concat-counts-correct [v v]))))))

+;; Interpose
+;; ---------------------------------------------------------------------------
+
+(defn interpose-twice-the-length
+  [v]
+  (= (count (interpose :i v))
+     (* 2 (count v))))
+
+(deftest interpose-creates-sequence-twice-the-length
+  (is "Interposing a collection with a value makes it's count
+      twice the original collection"
+      (:result
+        (sc/quick-check 1000 interpose-twice-the-length [(gen/vector gen/int)]))))
+
 ;; Tests are deterministic
 ;; ---------------------------------------------------------------------------


loggin selected value

loggin selected value

--- src/reagent_search/search.cljs
+++ src/reagent_search/search.cljs
@@ -22,13 +22,15 @@
   "handles autocomplete item selected by
   1. logging selected item
   2. resetting the text input value
-  3. removing the autocomplete panel"
-  [chan-selecteditems ref-items ref-textvalue]
+  3. removing the autocomplete panel
+  4. logs the selected component"
+  [chan-selecteditems ref-items ref-textvalue chan-log]
   (go-loop
    []
    (let [sel (<! chan-selecteditems)]
      (reset! ref-textvalue sel)
-     (reset! ref-items []))
+     (reset! ref-items [])
+     (slogger/info-message chan-log (str "selected value:" sel)))
    (recur)))

 (defn- handle-autocomplete-focus
@@ -53,9 +55,9 @@
   "renders the autocomplete component given a list of items to display
   and a selected item channel
   the number of items rendered is limited to size items"
-  [size itemsref textvalue chan-selecteditems chan-focus]
+  [size itemsref textvalue chan-selecteditems chan-focus chan-log]
   (let [ref-focus-item (atom -1)]
-        (handle-autocompleteitemselected chan-selecteditems itemsref textvalue)
+        (handle-autocompleteitemselected chan-selecteditems itemsref textvalue chan-log)
         (handle-autocomplete-focus chan-focus itemsref ref-focus-item)
     (fn []
       (if-not (empty? @itemsref)
@@ -152,7 +154,21 @@
          :on-change #(put! chan-textvalue (-> % .-target .-value))
          :on-key-up #(put! chan-keys (-> % .-which))}]
        [:span.input-group-addon.glyphicon.glyphicon-search]
-       [autocomplete-component (:autocomplete-size props) autocomplete-items textvalue chan-selecteditems chan-focus]])))
+       [autocomplete-component (:autocomplete-size props) autocomplete-items textvalue chan-selecteditems chan-focus chan-log]])))
+
+;; how to model behavior of search results?
+;; typeahead component sends search query message to search-query channel
+;; local handler listens to search-query-channel and updates local state
+;; component localstate:
+;; search-query - selected search query
+;; search-results - list of results for search query
+(defn- search-results
+  "renders search results"
+  [chan-search-query]
+  (let [query-term (atom "No Search Query")
+        query-result (atom [])]
+    )
+  )

 (defn mount-search
   "mounts the search component with data props at dom-id"


Fix parameter passing for SGD

Fix parameter passing for SGD

--- src/cortex/optimise.cljc
+++ src/cortex/optimise.cljc
@@ -142,7 +142,7 @@
   ([size {:keys [learn-rate momentum] :as options}]
    (let [dx (new-mutable-vector size)]
       (m/assign! dx 0.0)
-      (SGDOptimiser. dx))))
+      (SGDOptimiser. dx nil options))))

 (extend-protocol cp/PGradientOptimiser
   SGDOptimiser


Rework uploader as we do not want to upload a track 120 times if soundcloud is processing tracks slowly at the moment

--- src/speech_melody/uploader.clj
+++ src/speech_melody/uploader.clj
@@ -3,9 +3,9 @@
   (:import [com.soundcloud.api ApiWrapper Request Endpoints Params$Track Http]
            [org.apache.http HttpStatus]))

-(defmulti #^{:private true} try-upload (fn [provider & _] provider))
+(defmulti upload (fn [provider & _] provider))

-(defn- soundcloud-request [wrapper input title author tags description]
+(defn- post-request-to-soundcloud [wrapper input title author tags description]
   (let [request (Request/to Endpoints/TRACKS nil)]
     (doto request
       (.add Params$Track/TITLE title)
@@ -16,29 +16,31 @@
       (.withFile Params$Track/ASSET_DATA input))
     (.post wrapper request)))

-(defn- soundcloud-finished-processing [wrapper uri]
+(defn- upload-to-soundcloud [cfg wrapper input title author]
+  (.login wrapper (:username cfg) (:password cfg) nil)
+  (let [tags "Blues Classical Electronic Speech"
+        description "some description"
+        response (post-request-to-soundcloud wrapper input title author tags description)
+        status-code (.. response getStatusLine getStatusCode)
+        reason (.. response getStatusLine getReasonPhrase)
+        json (Http/getJSON response)]
+    (when (not= status-code HttpStatus/SC_CREATED)
+      (throw (ex-info "Unexpected status code"
+                      {:status-code status-code, :reason reason, :args [input title], :json json})))
+    json))
+
+(defn- ensure-soundcloud-has-finished-processing [wrapper uri]
   (let [request (Request/to uri nil)
         state (-> (.get wrapper request) Http/getJSON (.get "state"))]
     (when (= state "processing")
       (println "Processing" uri)
       (throw (ex-info "Still processing" {:uri uri})))))

-(defmethod try-upload :soundcloud [_ input title author config]
+(defmethod upload :soundcloud [_ input title author config]
   (let [cfg (:soundcloud config)
         wrapper (ApiWrapper. (:client-id cfg) (:client-secret cfg) nil nil)
-        _ (.login wrapper (:username cfg) (:password cfg) nil)
-        tags "Blues Classical Electronic Speech"
-        description "some description"
-        response (soundcloud-request wrapper input title author tags description)
-        status-code (.. response getStatusLine getStatusCode)
-        reason (.. response getStatusLine getReasonPhrase)
-        json (Http/getJSON response)]
-    (when (not= status-code HttpStatus/SC_CREATED)
-      (throw (ex-info "Unexpected status code"
-                      {:status-code status-code, :reason reason, :args [input title], :json json})))
+        try-options {:sleep 1000, :decay :double, :tries 15} ; about 136 mins max and 273 mins total
+        json (try-try-again try-options upload-to-soundcloud cfg wrapper input title author)]
     (Thread/sleep 5000)
-    (try-try-again {:sleep 5000 :tries 120} soundcloud-finished-processing wrapper (.get json "uri"))
+    (try-try-again try-options ensure-soundcloud-has-finished-processing wrapper (.get json "uri"))
     (.get json "permalink_url")))
-
-(defn upload [& args]
-  (try-try-again {:sleep 5000 :tries 120} apply try-upload args))


fix undeclared var

fix undeclared var

--- src/status_im/chat/events.cljs
+++ src/status_im/chat/events.cljs
@@ -184,7 +184,7 @@
           (-> new-db
               (assoc-in [:message-data :preview] message-previews)
               (assoc :handler-data (handler-data/get-all))
-              (assoc :chats chats')
+              (assoc :chats chats)
               (init-console-chat true)
               (update :dispatch-n conj event)))))))


fixes https://github.com/status-im/status-react/issues/984

--- src/status_im/chat/screen.cljs
+++ src/status_im/chat/screen.cljs
@@ -137,7 +137,9 @@
                             (sort-by :clock-value >)
                             (map #(assoc % :datemark (time/day-relative (:timestamp %))))
                             (group-by :datemark)
-                            (map (fn [[k v]] [v {:type :datemark :value k}]))
+                            (vals)
+                            (sort-by (comp :clock-value first) >)
+                            (map (fn [v] [v {:type :datemark :value (:datemark (first v))}]))
                             (flatten))
         remove-last?   (some (fn [{:keys [content-type]}]
                                (= content-type content-type-status))


🏗 Recover from a down database and other uncaught exceptions

Why:
- The notifier thread used to exit after the first uncaught exception
  and such exceptions will happen if the database is down, after which
  only the scheduled refresh would be operational

--- src/territory_bro/gis_sync.clj
+++ src/territory_bro/gis_sync.clj
@@ -99,7 +99,14 @@
       (.setUncaughtExceptionHandler executors/uncaught-exception-handler)
       (.build)))

+(defn- until-interrupted [task]
+  (fn []
+    (while (not (.isInterrupted (Thread/currentThread)))
+      (task))))
+
 (mount/defstate notified-refresh
   :start (doto (Executors/newFixedThreadPool 1 notified-refresh-thread-factory)
-           (.submit (executors/safe-task #(listen-for-gis-changes refresh-async!))))
+           (.submit ^Callable (until-interrupted
+                               (executors/safe-task
+                                #(listen-for-gis-changes refresh-async!)))))
   :stop (.shutdownNow ^ScheduledExecutorService notified-refresh))