continued to work on lengthening-ts function in analysis.clj

--- src/clj/forma/trends/analysis.clj
+++ src/clj/forma/trends/analysis.clj
@@ -38,7 +38,7 @@
 (defn windowed-apply
   "apply a function [f] to a window along a sequence [xs] of length [window]"
   [f window xs]
-  (map f (partition window 1 xs)))
+  (pmap f (partition window 1 xs)))

 ;; WHOOPBANG

@@ -56,7 +56,7 @@
   sub-timeseries of length [long-block].  The drops are smoothed by a moving
   average window of length [window]."
   [ts reli-ts long-block window]
-  (->> (fix-time-series ts reli-ts)
+  (->> (deseasonalize ts)
        (windowed-apply ols-coefficient long-block)
        (windowed-apply average window)
        (reduce min)))
@@ -95,7 +95,7 @@
   element is that associated with the time-trend. The try statement is
   meant to check whether the cofactor matrix is singular."
   [attributes t-series & cofactors]
-  {:pre [(not (empty? cofactors))]}
+  #_{:pre [(not (empty? cofactors))]}
   (let [y (deseasonalize (vec t-series))
         X (if (empty? cofactors)
             (i/matrix (t-range y))
@@ -117,10 +117,11 @@

 (defn whizbang
   [t-series start-period end-period & cofactors]
-  [t-series (apply vector cofactors)])
+  (map (partial lengthening-ts start-period end-period) (apply vector t-series cofactors))
+  #_(map long-trend
+       (map (partial lengthening-ts start-period end-period)
+            (apply vector t-series cofactors))))

-;; (map long-trend
-;;        ((partial lengthening-ts start-period end-period)
-;;           [t-series cofactors]))
+


Fixing logging handler

Fixing logging handler

--- src/clj/fortress/ring/handler.clj
+++ src/clj/fortress/ring/handler.clj
@@ -55,10 +55,10 @@
   (let [pipeline (.pipeline ch)
         state (.state this)
         {:keys [max-size handler zero-copy?]} @state]
+    (if @debug-request
+      (.addLast pipeline "logger" (LoggingHandler.)))
     (doto
       pipeline
-      (if @debug-request
-        (.addLast "logger" (LoggingHandler.)))
       (.addLast "codec" (HttpServerCodec.))
       (.addLast "aggregator" (HttpObjectAggregator. max-size))
       (.addLast "chunkedWriter"  (ChunkedWriteHandler.))


Removed cause of trash :ability-cost for The All-Seeing I

--- src/clj/game/cards-operations.clj
+++ src/clj/game/cards-operations.clj
@@ -389,7 +389,7 @@
    "The All-Seeing I"
    (let [trash-all-resources {:player :runner
                               :effect (req (doseq [resource (get-in runner [:rig :resource])]
-                                             (trash state side resource {:cause :ability-cost})))
+                                             (trash state side resource)))
                               :msg (msg "trash all resources")}]
        {:req (req tagged)
         :effect (req (prn (not (zero? (:bad-publicity corp))))


Add grid to render-environment.

Add grid to render-environment.

--- src/cljc/mazes/renderers/svg.cljc
+++ src/cljc/mazes/renderers/svg.cljc
@@ -68,6 +68,9 @@
       A higher margin will leave less space for cells.

   Values returned:
+    :grid - The grid which is being rendered; rendering functions may use this
+      for additional information. For instance, drawing connections between
+      rooms is simplified when grid/find-cell is available.
     :total-width - Passed through from input options.
     :total-height - Passed through from input options.
     :margin - Passed through from input options.
@@ -88,7 +91,8 @@
          height-per-cell (/ cell-area-height rows)
          cell-width (* width-per-cell size-spacing-ratio)
          cell-height (* height-per-cell size-spacing-ratio)]
-     {:total-width total-width
+     {:grid grid
+      :total-width total-width
       :total-height total-height
       :margin margin
       :cell-width cell-width


make view-bucket a component for cleaner things and perf.

--- src/cljs/apollo/client/pages.cljs
+++ src/cljs/apollo/client/pages.cljs
@@ -82,6 +82,13 @@
     (:label (first (filter (fn [x] (t/= (:date x) dv)) ageing-range)))))

+(defn view-bucket [{:keys [bucket-date albums]}]
+  (om/component
+   (html
+    [:span
+    [:h2 (date-to-label bucket-date)]
+    (om/build albums/album-list-partial {:artist nil :albums albums})
+    [:hr]])))

 (defn view-recently-added [data owner]
   (reify
@@ -96,7 +103,7 @@
                [:div.middle-column.pure-g
                 [:div.pure-u-1
                  [:div.content
-                  (map (fn [x]
-                         [:span
-                          [:h2 (date-to-label (first x))]
-                          (om/build albums/album-list-partial {:artist nil :albums (last x)})[:hr]]) buckets)]]]])))))
+                  (om/build-all view-bucket
+                                (map (fn [x]
+                                       {:bucket-date (first x) :albums (last x)})
+                                     buckets))]]]])))))


minor formatting

minor formatting

--- src/cljs/triboard/logic/turn.cljs
+++ src/cljs/triboard/logic/turn.cljs
@@ -53,7 +53,7 @@
   (-> turn
     (update :board transition/apply-transition transition)
     (update :scores scores/update-scores transition)
-    with-next-player))
+    (with-next-player)))

 (defn player-transitions
   "Return the transitions available for the next player"


Corrected loading error related to declare|parents-target-parent.

--- EkekoAspectJ/src/damp/ekeko/aspectj/weaverworld.clj
+++ EkekoAspectJ/src/damp/ekeko/aspectj/weaverworld.clj
@@ -1279,13 +1279,6 @@
          (declare|parents-parents|types ?declare ?types)
          (contains ?types ?type)))

-(defn
-  declare|parents-target-parent
-  "Relation between a declare parents ?declare, one of its target type ?target, and one of its parent types ?parent."
-  [?declare ?target ?parent]
-  (all
-    (declare|parents-target|type ?declare ?target)
-    (declare|parents-parent|type ?declare ?parent)))

 (comment

@@ -1333,6 +1326,17 @@
     (declare|parents ?declare)
     (type ?target)
     (succeeds (.match ?declare ?target))))
+
+
+(defn
+  declare|parents-target-parent
+  "Relation between a declare parents ?declare, one of its target type ?target, and one of its parent types ?parent."
+  [?declare ?target ?parent]
+  (all
+    (declare|parents-target|type ?declare ?target)
+    (declare|parents-parent|type ?declare ?parent)))
+
+

 (defn
   declareprecedence-patterns


Resize image only for firefox

Resize image only for firefox

--- src/export_server/browser/raw.clj
+++ src/export_server/browser/raw.clj
@@ -231,7 +231,9 @@

             screenshot (.getScreenshotAs d OutputType/BYTES)
             ;; we need to resize (on white background) cause FIREFOX crop height and it has white background
-            screenshot (resize-image screenshot options)
+            screenshot (if (= :firefox (:engine @state/options))
+                         (resize-image screenshot options)
+                         screenshot)

             error (some #(when (not (nil? %)) %) [startup binary script waiting])]


Fixed the account sign in

Fixed the account sign in

--- src/freecoin/handlers/sign_in.clj
+++ src/freecoin/handlers/sign_in.clj
@@ -107,44 +107,40 @@
                                             (r/redirect (routes/absolute-path :sign-in-form))
                                             ctx)))

-  :exists? (fn [ctx]
-             ;; the wallet exists already
-             (let [email (:email ctx)]
-               (if-let [wallet (wallet/fetch wallet-store "account")]
-                 (do
-                   (log/trace "The wallet for email " email " already exists")
-                   {::email (:email wallet)})
-
-                 ;; a new wallet has to be made
-                 (when-let [{:keys [wallet apikey]}
-                            (wallet/new-empty-wallet!
-                                wallet-store
-                              blockchain
-                              name email)]
-
-                   ;; TODO: distribute other shares to organization and auditor
-                   ;; see in freecoin.db.wallet
-                   ;; {:wallet (mongo/store! wallet-store :uid wallet)
-                   ;;  :apikey       (secret->apikey              account-secret)
-                   ;;  :participant  (secret->participant-shares  account-secret)
-                   ;;  :organization (secret->organization-shares account-secret)
-                   ;;  :auditor      (secret->auditor-shares      account-secret)
-                   ;;  }))
-
-                   ;; saved in context
-                   {::email (:email wallet)}))))
-
-  :handle-ok (fn [ctx]
-               (lr/ring-response
-                (cond-> (r/redirect (routes/absolute-path :account :email (::email ctx)))
-                  (::cookie-data ctx) (assoc-in [:session :cookie-data] (::cookie-data ctx))
-                  true (assoc-in [:session :signed-in-email] (::email ctx)))))
-
-  ;; TODO: Maybe add not found text to landing page?
-  ;; TODO: do we need this if it is checked above?
-  :handle-not-found (-> (routes/absolute-path :landing-page)
-                        r/redirect
-                        lr/ring-response))
+  :post! (fn [ctx]
+           ;; the wallet exists already
+           (let [email (:email ctx)
+                 name (first (s/split email #"@"))]
+             (if-let [wallet (wallet/fetch wallet-store email)]
+               (do
+                 (log/info "The wallet for email " email " already exists")
+                 {::email (:email wallet)})
+
+               ;; a new wallet has to be made
+               (when-let [{:keys [wallet apikey]}
+                          (wallet/new-empty-wallet!
+                              wallet-store
+                            blockchain
+                            name email)]
+
+                 ;; TODO: distribute other shares to organization and auditor
+                 ;; see in freecoin.db.wallet
+                 ;; {:wallet (mongo/store! wallet-store :uid wallet)
+                 ;;  :apikey       (secret->apikey              account-secret)
+                 ;;  :participant  (secret->participant-shares  account-secret)
+                 ;;  :organization (secret->organization-shares account-secret)
+                 ;;  :auditor      (secret->auditor-shares      account-secret)
+                 ;;  }))
+
+                 ;; saved in context
+                 {::email (:email wallet)}))))
+
+  :handle-created (fn [ctx]
+                   (log/info "CREATED")
+                   (lr/ring-response
+                    (cond-> (r/redirect (routes/absolute-path :account :email (::email ctx)))
+                      (::cookie-data ctx) (assoc-in [:session :cookie-data] (::cookie-data ctx))
+                      true (assoc-in [:session :signed-in-email] (::email ctx))))))

 (defn check-content-type [ctx content-types]


Stub chain builders.

Stub chain builders.

--- sonic-jam/src/sonic_jam/core.cljs
+++ sonic-jam/src/sonic_jam/core.cljs
@@ -57,25 +57,59 @@
                                            :get-state-ch (:get-state-ch state)}]
                             (om/build grid-view id {:state sub-state})))))))))

-(defn play-builder []
-  {"beats" [[0] [0] [0] [0]] "type" "play" "note" 30})
+(declare track-builder)

-(defn row-builder [{:keys [cursor id]} _]
+(defn play-builder [{:keys [cursor id grid]} _]
   (reify
+    om/IRender
+    (render [_]
+      (dom/p #js {:style #js {:color "#999"}}
+             (dom/span #js {:onClick #(om/set-state! grid :builder track-builder)} "{")
+             (dom/span nil " play options ")
+             (dom/span #js {:onClick #(om/set-state! grid :builder track-builder)} "}")))))
+
+(defn synth-builder [{:keys [cursor id grid]} _]
+  (reify
+    om/IRender
+    (render [_]
+      (dom/p #js {:style #js {:color "#999"}}
+             (dom/span #js {:onClick #(om/set-state! grid :builder track-builder)} "{")
+             (dom/span nil " synth options ")
+             (dom/span #js {:onClick #(om/set-state! grid :builder track-builder)} "}")))))
+
+(defn sample-builder [{:keys [cursor id grid]} _]
+  (reify
+    om/IRender
+    (render [_]
+      (dom/p #js {:style #js {:color "#999"}}
+             (dom/span #js {:onClick #(om/set-state! grid :builder track-builder)} "{")
+             (dom/span nil " sample options ")
+             (dom/span #js {:onClick #(om/set-state! grid :builder track-builder)} "}")))))
+
+(defn track-builder [{:keys [cursor id grid]} owner]
+  (reify
+    om/IInitState
+    (init-state [_]
+      {:track-builder-expanded false})
     om/IRenderState
     (render-state [_ state]
-      (dom/p #js {:onClick #(do
-                              (om/transact! cursor "tracks"
-                                            (fn [x] (conj x (play-builder))))
-                              (go (>! (get state :set-state-ch) id)))
-                  :style #js {:color "#999"}}
-             "{}"))))
+      (if-not (:track-builder-expanded state)
+        (dom/p #js {:onClick #(om/set-state! owner :track-builder-expanded true)
+                    :style #js {:color "#999"}}
+               "{}")
+        (dom/p #js {:style #js {:color "#999"}}
+               (dom/span #js {:onClick #(om/set-state! owner :track-builder-expanded false)} "{")
+               (dom/span #js {:onClick #(om/set-state! grid :builder play-builder)} " play ")
+               (dom/span #js {:onClick #(om/set-state! grid :builder synth-builder)} " synth ")
+               (dom/span #js {:onClick #(om/set-state! grid :builder sample-builder)} " sample ")
+               (dom/span #js {:onClick #(om/set-state! owner :track-builder-expanded false)} "}"))))))

 (defn grid-view [id owner]
   (reify
     om/IInitState
     (init-state [_]
-      {:grid-expanded false})
+      {:grid-expanded false
+       :builder track-builder})
     om/IRenderState
     (render-state [_ state]
       (let [cursor (get (om/observe owner (grids)) id)]
@@ -95,7 +129,8 @@
                                                       (get cursor "tracks")
                                                       (repeat id))]
                                      (om/build-all track-view cursors {:state state})))
-                            (om/build row-builder {:cursor cursor :id id} {:state state}))))))))
+                            (om/build (:builder state) {:cursor cursor :id id :grid owner}
+                                      {:state state}))))))))

 (defn app-view [cursor _]
   (reify


more logging

more logging

--- src/babel/espanol/morphology/verbs.clj
+++ src/babel/espanol/morphology/verbs.clj
@@ -8,6 +8,8 @@
 (require '[clojure.string :refer (trim)])
 (require '[clojure.tools.logging :as log])
 (require '[dag-unify.core :refer (copy dissoc-paths fail? get-in merge ref? strip-refs unifyc)])
+
+(def suppress-morph-exceptions false)

 (defn reflexive-to-infinitive [reflexive-infinitive]
   "e.g.: quedarse -> quedar"
@@ -214,8 +216,11 @@
      (get-in word [:espanol])

      :else
-     (throw (Exception. (str "get-string-1: future regular inflection: don't know what to do with input argument: " (strip-refs word)))))))
-
+     (let [message (str "get-string-1: future regular inflection: don't know what to do with input argument: " (strip-refs word))]
+       (if suppress-morph-exceptions
+         (do (log/warn message)
+             "??")
+         (throw (Exception. message)))))))

 (defn imperfect [word & [ {usted :usted
                            vosotros :vosotros
@@ -319,7 +324,12 @@
                            :er-type er-type
                            :vosotros vosotros
                            :ustedes ustedes}})]
-       (throw (Exception. (str "get-string-1: imperfecto regular inflection: don't know what to do with input argument: " (strip-refs word))))))))
+
+       (let [message (str "get-string-1: imperfect regular inflection: don't know what to do with input argument: " (strip-refs word))]
+         (if suppress-morph-exceptions
+           (do (log/warn message)
+               "??")
+           (throw (Exception. message))))))))

 (defn present [word & [ {usted :usted
                          vosotros :vosotros
@@ -420,7 +430,11 @@
      (get-in word [:espanol])

      :else
-     (throw (Exception. (str "get-string-1: present regular inflection: don't know what to do with input argument: " (strip-refs word)))))))
+     (let [message (str "get-string-1: present regular inflection: don't know what to do with input argument: " (strip-refs word))]
+       (if suppress-morph-exceptions
+         (do (log/warn message)
+             "??")
+         (throw (Exception. message)))))))

 (declare irregular-preterito)
 (declare regular-preterito)
@@ -583,5 +597,8 @@
      (get-in word [:espanol])

      :else
-     (throw (Exception. (str "get-string-1: conditional regular inflection: don't know what to do with input argument: " (strip-refs word)))))))
-
+     (let [message (str "get-string-1: conditional regular inflection: don't know what to do with input argument: " (strip-refs word))]
+       (if suppress-morph-exceptions
+         (do (log/warn message)
+             "??")
+         (throw (Exception. message)))))))


Don't need simple-repl anymore

Don't need simple-repl anymore

--- src/cljs/cljs_webrepl/simple_repl.cljs
+++ src/cljs/cljs_webrepl/simple_repl.cljs
@@ -1,25 +0,0 @@
-(ns cljs-webrepl.repl
-  (:require
-   [cljs.tools.reader :refer [read-string]]
-   [cljs.js :refer [empty-state eval js-eval]]
-   [cljs.env :refer [*compiler*]]
-   [taoensso.timbre :as timbre
-    :refer-macros (tracef debugf infof warnf errorf)]))
-
-(defn eval-str [repl s]
-  (eval repl
-        (read-string s)
-        {:eval       js-eval
-         :source-map true
-         :context    :expr}
-        (fn [result] result)))
-
-(defn safe-eval [state s]
-  (try
-    (eval-str state s)
-    (catch js/Error e
-      (warnf "Caught exception: %s" e)
-      {:exception (.toString e)})))
-
-(defn new-repl []
-  (empty-state))


Put the right name of the app in the region modal

--- src/cljs/ikea_clojure_cup/regions.cljs
+++ src/cljs/ikea_clojure_cup/regions.cljs
@@ -3,6 +3,7 @@
             [ajax.core :refer [GET]]
             [reagent-forms.core :refer [bind-fields]]
             [alandipert.storage-atom :refer [local-storage]]
+            [ikea-clojure-cup.common :as common]
             [ikea-clojure-cup.bootstrap :as bootstrap]))

 (defonce region-state (local-storage (atom {:region nil}) :region))
@@ -37,7 +38,7 @@
 (defn- region-selection-copy
   [region-state]
   [:div
-   [:h3 "Welcome to the ITEA Transport Planner" [:small [:em "(Proper name pending)"]]]
+   [:h3 "Welcome to " common/short-name [:small [:em common/long-name]]]
    [:p "Before you begin, select your closest IKEA region."]])

 (defn region-modal


disable timeout when connecting to server

--- src/cljs/ubolonton/xulrunner/util.cljs
+++ src/cljs/ubolonton/xulrunner/util.cljs
@@ -36,7 +36,6 @@
       (.addEventListener
        "error" (fn [event]
                  (close! response-channel)))
-      (aset "timeout" 50000)
       (.open "POST" url true)
       (.send data))
     response-channel))


Enable updating GIT repos

Enable updating GIT repos

--- src/arachnida/git_data_fetcher.clj
+++ src/arachnida/git_data_fetcher.clj
@@ -93,7 +93,7 @@
     (println (str "    Repository '" (:name repository) "' with ID: " (:id repository)))
     (println "        Repo ID:" (:id repository))
     (println "        Repo URL" (:url repository))
-    ;(prepare-local-repository repository)
+    (prepare-local-repository repository)
     (let [directory-name (repo-url->directory-name repository)]
         (try (jgit/with-repo directory-name
             (let [commits-stat (commits-stat/get-commits-stat-for-all-branches repo directory-name)]


s/(def/(defonce/

s/(def/(defonce/

--- src/babel/italiano/morphology.cljc
+++ src/babel/italiano/morphology.cljc
@@ -95,7 +95,7 @@
   string)

 ;; replace-patterns are declarative data that determine how analysis (and soon conjugation) are performed.
-(def replace-patterns
+(defonce replace-patterns
   (concat
    adjectives/replace-patterns
    determiners/replace-patterns


Improve generichash docstring

Improve generichash docstring

--- src/caesium/crypto/generichash.clj
+++ src/caesium/crypto/generichash.clj
@@ -22,8 +22,10 @@
   "Hashes a message with optional key into a given output buffer using
   libsodium's generichash primitive.

-  You only want this to manage the output byte array yourself. Otherwise, you
-  want [[hash]]."
+  All buffers must be `ByteArray`.
+
+  You only want this to manage the output buffer yourself. Otherwise,
+  you want [[hash]]."
   ([buf msg]
    (hash-to-buf! buf msg {}))
   ([buf msg {:keys [key] :or {key (bb/alloc 0)}}]


comment experimental code

comment experimental code

--- src/ceres_collector/geschichte.clj
+++ src/ceres_collector/geschichte.clj
@@ -2,13 +2,13 @@
   (:require [hasch.core :refer [uuid]]
             [konserve.store :refer [new-mem-store]]
             [konserve.protocols :refer [-get-in -assoc-in]]
-            [geschichte.sync :refer [server-peer client-peer]]
-            [geschichte.stage :as s]
-            [geschichte.p2p.fetch :refer [fetch]]
-            [geschichte.p2p.hash :refer [ensure-hash]]
-            [geschichte.realize :refer [commit-value]]
-            [geschichte.p2p.block-detector :refer [block-detector]]
-            [geschichte.platform :refer [create-http-kit-handler! <!? start stop]]
+            #_[geschichte.sync :refer [server-peer client-peer]]
+            #_[geschichte.stage :as s]
+            #_[geschichte.p2p.fetch :refer [fetch]]
+            #_[geschichte.p2p.hash :refer [ensure-hash]]
+            #_[geschichte.realize :refer [commit-value]]
+            #_[geschichte.p2p.block-detector :refer [block-detector]]
+            #_[geschichte.platform :refer [create-http-kit-handler! <!? start stop]]
             [clojure.core.async :refer [>!!]]
             [aprint.core :refer [aprint]]
             [taoensso.timbre :as timbre]))
@@ -44,7 +44,7 @@
                    (= name fn-name))
                  (keys eval-map))))

-(defn init [ & {:keys [user socket repo-name]}]
+#_(defn init [ & {:keys [user socket repo-name]}]
   (let [user (or user "kordano@topiq.es")
         socket (or socket "ws://127.0.0.1:31744")
         store (<!? (new-mem-store))
@@ -67,7 +67,7 @@
      :user user}))

-(defn transact-status
+#_(defn transact-status
   "Transact incoming status to geschichte and commit"
   [state status]
   (let [{:keys [store peer stage repo user]} (get-in @state [:geschichte])]
@@ -78,7 +78,7 @@
    state))

-(defn get-current-state
+#_(defn get-current-state
   "Realize head of current geschichte master branch"
   [state]
   (let [{:keys [store peer stage repo user]} (get-in @state [:geschichte])


Make SSE handler similar to the websockets.

--- src/clojure/catacumba/impl/sse.clj
+++ src/clojure/catacumba/impl/sse.clj
@@ -83,19 +83,20 @@
         xform (comp (map -make-event)
                     (map str)
                     (map hp/bytebuffer))
-        input-ch (a/chan 1 xform)
-        close-ch (a/chan)
+        out (a/chan 16 xform)
+        ctrl (a/chan (a/sliding-buffer 1))
         on-cancel (fn []
-                    (a/close! input-ch)
-                    (a/close! close-ch))
-        stream (->> (schannel/publisher input-ch {:on-cancel on-cancel})
-                    (stream/bind-exec))]
-    (handler context input-ch close-ch)
-    (ctx/set-headers! response {:content-type "text/event-stream;charset=UTF-8"
-                                :transfer-encoding "chunked"
-                                :cache-control "no-cache, no-store, max-age=0, must-revalidate"
-                                :pragma "no-cache"})
-    (.sendStream response stream)))
+                    (a/close! out)
+                    (a/put! ctrl [:close nil])
+                    (a/close! ctrl))
+        stream (schannel/publisher out {:on-cancel on-cancel})
+        headers {:content-type "text/event-stream;charset=UTF-8"
+                 :transfer-encoding "chunked"
+                 :cache-control "no-cache, no-store, max-age=0, must-revalidate"
+                 :pragma "no-cache"}]
+    (handler (assoc context :out out :ctrl ctrl))
+    (ctx/set-headers! response headers)
+    (.sendStream response (stream/bind-exec stream))))

 (defmethod handlers/adapter :catacumba/sse
   [handler]


more stats

more stats

--- src/clojure/zensols/dataset/db.clj
+++ src/clojure/zensols/dataset/db.clj
@@ -330,8 +330,11 @@
   (ids)
   (use-connection
     (if @ids-inst
-      {:train (count (:train (:train-test @ids-inst)))
-       :test (count (:test (:train-test @ids-inst)))})))
+      (let [train (count (:train (:train-test @ids-inst)))
+            test (count (:test (:train-test @ids-inst)))]
+        {:train train
+         :test test
+         :split (double (/ train (+ train test)))}))))

 (defn- id-info []
   {:train (ids :set-type :train)


Fix last commit

Fix last commit

--- src/edu/berkeley/ai/util/files.clj
+++ src/edu/berkeley/ai/util/files.clj
@@ -10,7 +10,7 @@
 (defn file-stem [path]
   (let [i (.lastIndexOf path ".")]
     (if (>= i 0)
-      (.substring path i)
+      (.substring path 0 i)
       path)))

 (defmacro current-file []


Improve readability

Improve readability

--- src/onyx/state/filter/rocksdb.clj
+++ src/onyx/state/filter/rocksdb.clj
@@ -27,13 +27,13 @@
 (def start-bucket 0)

 (defn clear-bucket! [db bucket shutdown-ch]
-  (let [bucket-val (byte bucket)
+  (let [bucket (byte bucket)
         iterator ^RocksIterator (.newIterator db)]
     (try
       (.seekToFirst iterator)
       (while (.isValid iterator)
-        (when (= (aget ^bytes (.value iterator) 0)
-                 bucket-val)
+        (when (= (bucket-val (.value iterator))
+                 bucket)
           (.remove ^RocksDB db ^bytes (.key iterator)))
         (.next iterator))
       (finally


Header is optional in file requests

Header is optional in file requests

--- src/kixi/datastore/transport_specs.clj
+++ src/kixi/datastore/transport_specs.clj
@@ -8,9 +8,9 @@

 (s/def ::filemetadata-transport
   (s/keys :req-un [::schema-id
-                   ::ms/name
-                   ::ms/header]
-          :opt-un [::ms/type]))
+                   ::ms/name]
+          :opt-un [::ms/type
+                   ::ms/header]))

 (s/def ::file-details
   (s/keys :req [::ms/id ::ms/size-bytes ::ms/provenance]))


web/merge.clj: log ignored mime types with truncated key

To avoid out-of-memory errors

--- src/org/altlaw/jobs/web/merge.clj
+++ src/org/altlaw/jobs/web/merge.clj
@@ -42,7 +42,7 @@
   (cond
     (= key :document) (map-document value)
     (map? key) (map-download key)
-    :else (do (log/warn "Unrecognized record type " (pr-str key) " => " (pr-str value))
+    :else (do (log/warn "Unrecognized record type " (log/logstr key) " => " (log/logstr value))
               (h/counter "Unrecognized record types")
               nil)))


Do not attempt to authorize OPTIONS http request in other middleware fns either (#80)

--- src/pigeon_backend/middleware.clj
+++ src/pigeon_backend/middleware.clj
@@ -34,28 +34,32 @@
   "Used after wrap-auth"
   [kws handler]
   (fn [request]
-    (if-let [username (get-in request kws)]
-      (if-let [is-a-match?
-               (= username
-                 (:user (jws/unsign
-                          (parse-auth-key request)
-                          (env :jws-shared-secret))))]
-        (handler request)
+    (if-let [should-request-be-authorized? ((:request-method request) authorizable-http-methods)]
+      (if-let [username (get-in request kws)]
+        (if-let [is-a-match?
+                 (= username
+                   (:user (jws/unsign
+                            (parse-auth-key request)
+                            (env :jws-shared-secret))))]
+          (handler request)
+          (handle-exception-info
+            (ex-info "Not authorized" {:type :validation
+                                       :cause :authorization}) {} request))
         (handle-exception-info
-          (ex-info "Not authorized" {:type :validation
-                                     :cause :authorization}) {} request))
-      (handle-exception-info
-        (ex-info "Missing argument" {:type  :validation
-                                     :cause :authorization}) {} request))))
+          (ex-info "Missing argument" {:type  :validation
+                                       :cause :authorization}) {} request))
+      (handler request))))

 (defn wrap-auth-moderator
   "Used after wrap-auth"
   [handler]
   (fn [request]
-    (if-let [is-a-mod? (:is_moderator (jws/unsign
-                                        (parse-auth-key request)
-                                        (env :jws-shared-secret)))]
-      (handler request)
-      (handle-exception-info
-        (ex-info "Not authorized" {:type :validation
-                                   :cause :authorization}) {} request))))+    (if-let [should-request-be-authorized? ((:request-method request) authorizable-http-methods)]
+      (if-let [is-a-mod? (:is_moderator (jws/unsign
+                                          (parse-auth-key request)
+                                          (env :jws-shared-secret)))]
+        (handler request)
+        (handle-exception-info
+          (ex-info "Not authorized" {:type :validation
+                                     :cause :authorization}) {} request))
+      (handler request))))


Added docstrings to the lambda-blog.templates.page namespace.

--- src/lambda_blog/templates/page.clj
+++ src/lambda_blog/templates/page.clj
@@ -1,4 +1,5 @@
 (ns lambda-blog.templates.page
+  "Generic HTML page templates."
   (:refer-clojure :exclude [meta])
   (:require [lambda-blog.templates.bits :refer [javascript row text-centered]]
             [lambda-blog.utils :refer [pathcat]]
@@ -18,7 +19,9 @@
                  :href (link-or-pathcat path-to-root %)})
        stylesheets))

-(defn header [{:keys [favicon path-to-root rss scripts stylesheets title]}]
+(defn header
+  "Creates an HTML `head` element containing various metadata, `scripts` & `stylesheets`."
+  [{:keys [favicon path-to-root rss scripts stylesheets title]}]
   (t/head (t/meta {:charset :utf-8})
           (t/title title)
           (css path-to-root stylesheets)
@@ -35,23 +38,31 @@
           (t/meta {:name :generator
                    :content (str "λ-blog v." (System/getProperty "lambda-blog.version"))})))

-(defn banner [{:keys [banner-template] :as ent}]
+(defn banner
+  "Creates a page banner `header` using configured `banner-template`."
+  [{:keys [banner-template] :as ent}]
   (t/header {:class :page-header}
             (banner-template ent)))

-(defn powered-by []
+(defn powered-by
+  "Creates a tiny \"Powerd by λ-blog\" link."
+  []
   (t/p "Powered by "
        (t/a {:href "https://github.com/Idorobots/lambda-blog"}
             "λ-blog")
        "."))

-(defn footer [{:keys [footer-scripts footer-template path-to-root] :as ent}]
+(defn footer
+  "Creates a page `footer` using configured `footer-template`. Additionally, includes various `footer-scripts`."
+  [{:keys [footer-scripts footer-template path-to-root] :as ent}]
   [(t/footer (t/hr)
              (row (footer-template ent)
                   (text-centered (powered-by))))
    (javascripts path-to-root footer-scripts)])

-(defn navigation [{:keys [brand brand-logo navigation-template path-to-root] :as ent}]
+(defn navigation
+  "Creates a page `navbar` containing branding and various links using `navigation-template`."
+  [{:keys [brand brand-logo navigation-template path-to-root] :as ent}]
   (let [l (div (when brand-logo
                  (t/img {:src (pathcat path-to-root brand-logo)}))
                brand)]
@@ -70,7 +81,9 @@
                   (t/div {:class [:collapse :navbar-collapse :navbar-right :navbar-responsive-collapse]}
                          (navigation-template ent))))))

-(defn page [contents-template entity]
+(defn page
+  "Creates a generic HTML page composed of [[header]], [[navigation]], [[banner]] & [[footer]]. Page contents are created using `contents-template`."
+  [contents-template entity]
   [(doctype :html)
    (t/html (header entity)
            (t/body (navigation entity)
@@ -81,4 +94,7 @@
                                             (contents-template entity)
                                             (footer entity))))))])

-(def static-page (partial page :contents))
+(defn static-page
+  "Creates a generic static [[page]] using `:contents` as the `contents-template`."
+  [ent]
+  (page :contents ent))


Support mime-types as formats for RDF formats.

We support mime-types as formats for tabular files, so should do this
for consistency.

--- src/rdf-common/grafter/rdf/io.clj
+++ src/rdf-common/grafter/rdf/io.clj
@@ -360,6 +360,27 @@
         "application/html" RDFFormat/RDFA
         (Rio/getParserFormatForMIMEType mime-type)))))

+(defn- resolve-format-preference
+  "Takes an clojure.java.io destination (e.g. URL/File etc...) and a
+  format-preference and tries to resolve them in a fallback chain.
+
+  If format-preference does not resolve then we fallback to the destination's
+  file extension if there is one. If no format can be resolved we raise an
+  exception.
+
+  format-preference can be a keyword e.g. :ttl, a string of an extension e.g
+  \"nt\" or a mime-type.
+  "
+  [dest format-preference]
+  (if (instance? RDFFormat format-preference)
+    format-preference
+    (or (try (mimetype->rdf-format format-preference) (catch Exception nx nil))
+        (filename->rdf-format (str "." format-preference))
+        (condp = (class dest)
+          String (filename->rdf-format dest)
+          File   (filename->rdf-format (str dest)))
+        (throw (ex-info "Could not infer file format, please supply a :format parameter" {:error :could-not-infer-file-format :object dest})))))
+
 (defn rdf-serializer
   "Coerces destination into an java.io.Writer using
   clojure.java.io/writer and returns an RDFSerializer.
@@ -378,11 +399,7 @@

   ([destination & {:keys [append format encoding] :or {append false
                                                        encoding "UTF-8"}}]
-   (let [^RDFFormat format (or format
-                               (condp = (class destination)
-                                 String (filename->rdf-format destination)
-                                 File   (filename->rdf-format destination))
-                               (throw (ex-info "Could not infer file format, please supply a :format parameter" {:error :could-not-infer-file-format :object destination})))]
+   (let [^RDFFormat format (resolve-format-preference destination format)]
      (Rio/createWriter format
                        (io/writer destination
                                   :append append


stacktrace mapping functions need to take Map<LibraryName,SourceMap>

--- src/main/cljs/cljs/stacktrace.cljc
+++ src/main/cljs/cljs/stacktrace.cljc
@@ -490,35 +490,46 @@
 ;; -----------------------------------------------------------------------------
 ;; Stacktrace Mapping

+(defn remove-ext [file]
+  (-> file
+    (string/replace #"\.js$" "")
+    (string/replace #"\.cljs$" "")
+    (string/replace #"\.cljc$" "")
+    (string/replace #"\.clj$" "")))
+
 (defn mapped-line-column-call
   "Given a cljs.source-map source map data structure map a generated line
    and column back to the original line, column, and function called."
-  [source-map line column]
-  ;; source maps are 0 indexed for columns
-  ;; multiple segments may exist at column
-  ;; the last segment seems most accurate
-  (letfn [(get-best-column [columns column]
-            (last (or (get columns
-                        (last (filter #(<= % (dec column))
-                                (sort (keys columns)))))
-                      (second (first columns)))))
-          (adjust [mapped]
-            (vec (map #(%1 %2) [inc inc identity] mapped)))]
-    (let [default [line column nil]]
-      ;; source maps are 0 indexed for lines
-      (if-let [columns (get source-map (dec line))]
-        (adjust (map (get-best-column columns column) [:line :col :name]))
-        default))))
+  [sms file line column]
+  (let [source-map (get sms (symbol (string/replace (remove-ext file) "/" ".")))]
+    ;; source maps are 0 indexed for columns
+    ;; multiple segments may exist at column
+    ;; the last segment seems most accurate
+    (letfn [(get-best-column [columns column]
+             (last (or (get columns
+                         (last (filter #(<= % (dec column))
+                                 (sort (keys columns)))))
+                     (second (first columns)))))
+           (adjust [mapped]
+             (vec (map #(%1 %2) [inc inc identity] mapped)))]
+     (let [default [line column nil]]
+       ;; source maps are 0 indexed for lines
+       (if-let [columns (get source-map (dec line))]
+         (adjust (map (get-best-column columns column) [:line :col :name]))
+         default)))))

 (defn mapped-frame
   "Given opts and a canonicalized JavaScript stacktrace frame, return the
   ClojureScript frame."
-  [{:keys [function file line column]} sm opts]
+  [{:keys [function file line column]} sms opts]
   (let [no-source-file?      (if-not file true (starts-with? file "<"))
-        [line' column' call] (mapped-line-column-call sm line column)
-        file'                (if (ends-with? file ".js")
-                               (str (subs file 0 (- (count file) 3)) ".cljs")
-                               file)]
+        [line' column' call] (if no-source-file?
+                               [line column nil]
+                               (mapped-line-column-call sms file line column))
+        file'                (when-not no-source-file?
+                               (if (ends-with? file ".js")
+                                 (str (subs file 0 (- (count file) 3)) ".cljs")
+                                 file))]
     {:function function
      :call     call
      :file     (if no-source-file?
@@ -541,8 +552,9 @@
    identifier delimited by angle brackets. The returned mapped stacktrace will
    also contain :url entries to the original sources if it can be determined
    from the classpath."
-  ([stacktrace sm] (mapped-stacktrace stacktrace sm nil))
-  ([stacktrace sm opts]
+  ([stacktrace sms]
+   (mapped-stacktrace stacktrace sms nil))
+  ([stacktrace sms opts]
    (letfn [(call->function [x]
              (if (:call x)
                (hash-map :function (:call x))
@@ -555,7 +567,7 @@
                    unmunged-call-name
                    munged-fn-name))
                function call))]
-     (let [mapped-frames (map (memoize #(mapped-frame % sm opts)) stacktrace)]
+     (let [mapped-frames (map (memoize #(mapped-frame % sms opts)) stacktrace)]
        ;; take each non-nil :call and optionally merge it into :function one-level
        ;; up to avoid replacing with local symbols, we only replace munged name if
        ;; we can munge call symbol back to it
@@ -564,14 +576,15 @@
               (concat (rest (map call->function mapped-frames)) [{}])))))))

 (defn mapped-stacktrace-str
-  "Given a vector representing the canonicalized JavaScript stacktrace
-   print the ClojureScript stacktrace. See mapped-stacktrace."
-  ([stacktrace sm]
-   (mapped-stacktrace-str stacktrace sm nil))
-  ([stacktrace sm opts]
+  "Given a vector representing the canonicalized JavaScript stacktrace and a map
+  of library names to decoded source maps, print the ClojureScript stacktrace .
+  See mapped-stacktrace."
+  ([stacktrace sms]
+   (mapped-stacktrace-str stacktrace sms nil))
+  ([stacktrace sms opts]
    (with-out-str
      (doseq [{:keys [function file line column]}
-             (mapped-stacktrace stacktrace sm opts)]
+             (mapped-stacktrace stacktrace sms opts)]
        (println "\t"
          (str (when function (str function " "))
               "(" file (when line (str ":" line))
@@ -589,13 +602,14 @@
      :output-to "samples/hello/out/hello.js"
      :source-map true})

-  (def sm
-    (sm/decode
-      (json/read-str
-        (slurp "samples/hello/out/hello/core.js.map")
-        :key-fn keyword)))
-
-  (pp/pprint sm)
+  (def sms
+    {'hello.core
+     (sm/decode
+       (json/read-str
+         (slurp "samples/hello/out/hello/core.js.map")
+         :key-fn keyword))})
+
+  (pp/pprint sms)

   ;; maps to :line 5 :column 24
   (mapped-stacktrace
@@ -603,12 +617,12 @@
       :function "first"
       :line 6
       :column 0}]
-    sm {:output-dir "samples/hello/out"})
+    sms {:output-dir "samples/hello/out"})

   (mapped-stacktrace-str
     [{:file "hello/core.js"
       :function "first"
       :line 6
       :column 0}]
-    sm {:output-dir "samples/hello/out"})
+    sms {:output-dir "samples/hello/out"})
   )


Fixed the copying of limits vector in cl models.

--- src/clojure/uncomplicate/bayadera/opencl/models.clj
+++ src/clojure/uncomplicate/bayadera/opencl/models.clj
@@ -133,7 +133,7 @@
                               (long (params-size prior)))]
       (->CLPosteriorModel post-name post-logpdf post-mcmc-logpdf
                           (dimension prior) post-params-size
-                          (copy (limits prior))
+                          (when (limits prior) (copy (limits prior)))
                           (conj (vec (distinct (into (source prior) (source lik))))
                                 (format "%s\n%s"
                                         (format post-source post-logpdf


Remove more stuff

Remove more stuff

--- src/simplex_clj/models/schema.clj
+++ src/simplex_clj/models/schema.clj
@@ -2,29 +2,6 @@
   (:use     [korma.db :only (defdb mysql)])
   (:require [clojure.java.jdbc :as sql]
             [simplex-clj.util :as util]))
-
-(def db-spec (mysql
-  {:classname "com.mysql.jdbc.Driver"
-   :subprotocol "mysql"
-   :subname "//localhost/simplex"
-   :user "simplex"
-   :password "simplex"
-   :delimiters "`"}))
-
-(defn create-posts-table-x
-  [db-cred]
-   (sql/with-connection db-cred
-    (sql/create-table
-      :clj
-      [:id :integer "unsigned" "PRIMARY KEY" "AUTO_INCREMENT"]
-      [:author "varchar(100) DEFAULT NULL"]
-      [:itemtype "varchar(100) DEFAULT NULL"]
-      [:url "TEXT NOT NULL"]
-      [:txt "TEXT NOT NULL"]
-      [:meta "TEXT NOT NULL"]
-      [:tag "text NOT NULL"]
-      [:created "timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'"]
-      [:updated "timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"])))

 (defn create-posts-table
   [db-cred]


minor cleanup

minor cleanup

--- src/metabase/driver/mongo/util.clj
+++ src/metabase/driver/mongo/util.clj
@@ -24,11 +24,10 @@

 (def ^:private mongo-connection-options
   ;; Have to use the Java builder directly since monger's wrapper method doesn't support .serverSelectionTimeout :unamused:
-  (let [opts (com.mongodb.MongoClientOptions$Builder.)]
-    (-> opts
-        (.connectTimeout connection-timeout-ms)
-        (.serverSelectionTimeout connection-timeout-ms)
-        (.build))))
+  (-> (com.mongodb.MongoClientOptions$Builder.)
+      (.connectTimeout connection-timeout-ms)
+      (.serverSelectionTimeout connection-timeout-ms)
+      (.build)))

 (defn -with-mongo-connection
   "Run F with a new connection (bound to `*mongo-connection*`) to DATABASE.


fix initial state of quote danger

fix initial state of quote danger

--- lib/src/parinfer/indent_mode.cljc
+++ lib/src/parinfer/indent_mode.cljc
@@ -23,7 +23,7 @@
    :postindent-states []               ;; state cache after each line's indentation point (nil if none)
    :insert {:line-dy nil :x-pos nil}   ;; the place to insert closing delimiters whenever we hit appropriate indentation.
    :line-no -1                         ;; current line number we are processing.
-   :quote-danger?                      ;; odd number of quotes in comments are dangerous (track here)
+   :quote-danger? false                ;; odd number of quotes in comments are dangerous (track here)

    ;; transient line vars
    :track-indent? false                ;; "true" when we are looking for the first char on a line to signify indentation.


Fix parts validation on payment

Fix parts validation on payment

--- src/ombs/validate.clj
+++ src/ombs/validate.clj
@@ -50,6 +50,8 @@
 (defn errors-string
   ([] (reduce str (map #(str "|" % "|") (vld/get-errors))))
   ([tags] (reduce str (map #(str "|" % "|") (vld/get-errors tags)))))
+
+(defn errors? [] (vld/errors?))

 (defmacro create-rule [tag data]
   `(vld/rule ~@(list (first data)) [~tag ~(last data)] )
@@ -107,16 +109,20 @@
   "Check, if id's is correct. Used with (db/get-*id)"
   (create-validator :pay
                     [
-                     [(not= nil uid) (message [:user :empty-name])]
-                     [(not= nil eid) (message [:event :unexist])]
-                     [(<= parts (dbp/free-parts eid))] (message [:pay :wrong-parts])
+                     [(not= nil uid)
+                      (message [:user :empty-name])]
+                     [(not= nil eid)
+                      (message [:event :unexist])]
+                     [(<= parts (+ (dbp/free-parts eid) parts))
+                      (message [:pay :wrong-parts])]
                      ])
   )

 (defn parts? [ename date parts]
   (create-validator :pay
-                    [
-                     [(<= parts (db/get-rest-parts ename date)) (message [:event :parts-count])]
+                    [ ; FIXME: free-parts include parts from currect fee
+                     [(<= parts (+ (dbp/free-parts ename date) parts))
+                      (message [:event :parts-count])]
                      ])
   )


fn to cleanup all stale connections

fn to cleanup all stale connections

--- src/pc/http/sente.clj
+++ src/pc/http/sente.clj
@@ -1033,6 +1033,19 @@
                                 (select-keys @client-stats doc-uids))]
       (close-ws uid))))

+(defn cleanup-all-stale []
+  (let [subs @document-subs
+        now (time/now)
+        uids (mapcat keys (map second @pc.http.sente/document-subs))]
+    (doseq [uid uids]
+      (fetch-stats uid))
+    (Thread/sleep 10000)
+    (doseq [[uid stats] (remove (fn [[_ s]]
+                                  (and (:last-update s)
+                                       (time/after? (:last-update s) now)))
+                                (select-keys @client-stats uids))]
+      (close-ws uid))))
+
 (defn init []
   (let [{:keys [ch-recv send-fn ajax-post-fn connected-uids
                 ajax-get-or-ws-handshake-fn] :as fns} (sente/make-channel-socket!


fix routing to links

fix routing to links

--- src-cljs/frontend/history.cljs
+++ src-cljs/frontend/history.cljs
@@ -95,7 +95,10 @@
                           (.preventDefault %))

                         (utils/mlog "navigating to" location)
-                        (.setToken history-imp new-token))))))
+                        (.setToken history-imp new-token)
+                        ;; This might not be the best place for this--too much separation
+                        ;; between history and routing
+                        (set! js/document.body.scrollTop 0))))))

 (defn new-history-imp [tokens-to-ignore]
   ;; need a history element, or goog will overwrite the entire dom


Factor out creation of input files and output files. Makes the compile-content\! function more readable.

--- src/pubhouse/core.clj
+++ src/pubhouse/core.clj
@@ -93,14 +93,26 @@
                   writer (clojure.java.io/writer output)]
         (f reader writer)))))

+(defn input-file
+  "Give a path to the root of the site directory and the relative path
+  of a resource source file, return that resource source file."
+  [site-root rel-path]
+  (fs/with-cwd (str (fs/normalized site-root) "/content")
+    (fs/file rel-path)))
+
+(defn output-file
+  "Given a path to the root of the build directory and the URL of
+  a resource, return thefile to be used for output of resource compilation."
+  [build-path url]
+  (fs/with-cwd build-path (fs/file (str url ".html"))))
+
 (defn compile-content!
-  [root-path site-map build-path]
+  [site-path site-map build-path]
   (let [site (pages->site (map (partial apply make-page) site-map))]
     (doseq [[file-info page-info] site-map]
       (let [page (make-page file-info page-info)
-            input (fs/with-cwd (str (fs/normalized root-path) "/content")
-                    (fs/file (:path file-info)))
-            output (fs/with-cwd build-path (fs/file (str (:url page) ".html")))]
+            input (input-file site-path (:path file-info))
+            output (output-file build-path (:url page))]
         (with-file-ends input output
           (fn [reader writer]
             (binding [site (assoc site :current-page page)]
@@ -110,7 +122,7 @@
                                    (content-section (line-seq reader)))))))))))

 (defn compile-site!
-  [root-path build-root]
+  [site-path build-root]
   (binding [*site-map* (atom {})]
-    (fs/with-cwd root-path (build-site-map!))
-    (compile-content! root-path @*site-map* build-root)))
+    (fs/with-cwd site-path (build-site-map!))
+    (compile-content! site-path @*site-map* build-root)))


refactor out response-headers fn

refactor out response-headers fn

--- src-cljs/frontend/utils/ajax.cljs
+++ src-cljs/frontend/utils/ajax.cljs
@@ -32,10 +32,11 @@
               )]
       (f x))))

-(defn- lower-case-keys [m]
-  (into {}
-        (map (fn [[k v]] [(str/lower-case k) v]))
-        m))
+(defn- response-headers [xhrio]
+  (->> xhrio
+       .getResponseHeaders
+       js->clj*
+       (into {} (map (fn [[k v]] [(str/lower-case k) v])))))

 ;; https://github.com/JulianBirch/cljs-ajax/blob/master/src/ajax/core.cljs
 ;; copy of the default json formatter, but returns a map with json body
@@ -52,10 +53,7 @@
      :or {start-time (time/now)}}]
      {:read (fn read-json [xhrio]
               (let [json (js/JSON.parse (.getResponseText xhrio))
-                    headers (->> xhrio
-                                 .getResponseHeaders
-                                 js->clj*
-                                 lower-case-keys)
+                    headers (response-headers xhrio)
                     request-time (try
                                    (time/in-millis (time/interval start-time (time/now)))
                                    (catch :default e
@@ -88,10 +86,7 @@
     :or {start-time (time/now)}}]
   {:read (fn read-transit [xhrio]
            (let [reader (transit/reader :json)
-                 headers (->> xhrio
-                              .getResponseHeaders
-                              js->clj
-                              lower-case-keys)
+                 headers (response-headers xhrio)
                  request-time (try
                                 (time/in-millis (time/interval start-time (time/now)))
                                 (catch :default e


Enterprise plans are not piggiebackable

Enterprise plans are not piggiebackable

--- src-cljs/frontend/models/plan.cljs
+++ src-cljs/frontend/models/plan.cljs
@@ -121,11 +121,12 @@
      (trial-containers plan)))

 (defn transferrable-or-piggiebackable-plan? [plan]
-  (or (linux? plan)
-      (osx? plan)
-      ;; Trial plans shouldn't really be transferrable
-      ;; but they are piggiebackable and the UI mixes the two :(
-      (trial? plan)))
+  (and (not (enterprise? plan))
+       (or (linux? plan)
+           (osx? plan)
+           ;; Trial plans shouldn't really be transferrable
+           ;; but they are piggiebackable and the UI mixes the two :(
+           (trial? plan))))

 ;; true  if the plan has an active Stripe discount coupon.
 ;; false if the plan is nil (not loaded yet) or has no discount applied


Add a test for content stripping in clean-image-tag

--- test/comic_reader/scrape_test.clj
+++ test/comic_reader/scrape_test.clj
@@ -14,6 +14,8 @@
          [:img {:src "abc"}]))
   (is (= (clean-image-tag [:img {:alt "def"}])
          [:img {:alt "def"}]))
+  (is (= (clean-image-tag [:img {} '[lots of content]])
+         [:img {}]))
   (is (= (clean-image-tag [:img {:src "def" :walrus "i am"}])
          [:img {:src "def"}])))


prevent default & propagation of click events

using div's as controls means we need to prevent propagation or else
higher up containing divs also get their on-clicks fired.  In this case
it was resulting in closing the thread also trying to focus, which lead
to a react error when a now-unmounted component tried to focus itself

--- src/braid/client/ui/views/thread.cljs
+++ src/braid/client/ui/views/thread.cljs
@@ -141,6 +141,8 @@
                       (let [sel (.getSelection js/window)
                             selection-size (- (.-anchorOffset sel) (.-focusOffset sel))]
                         (when (zero? selection-size)
+                          (.preventDefault e)
+                          (.stopPropagation e)
                           (put! focus-chan (js/Date.))
                           (dispatch! :mark-thread-read (thread :id)))))
           :on-focus
@@ -202,15 +204,32 @@
               (if @open?
                 [:div.control.close
                  {:title "Close"
-                  :on-click (fn [_]
+                  :on-click (fn [e]
+                              ; Need to preventDefault & propagation when using
+                              ; divs as controls, otherwise divs higher up also
+                              ; get click events
+                              (.preventDefault e)
+                              (.stopPropagation e)
                               (dispatch! :hide-thread (thread :id)))}]
                 [:div.control.unread
                  {:title "Mark Unread"
-                  :on-click (fn [_] (dispatch! :reopen-thread (thread :id)))}])
+                  :on-click (fn [e]
+                              ; Need to preventDefault & propagation when using
+                              ; divs as controls, otherwise divs higher up also
+                              ; get click events
+                              (.preventDefault e)
+                              (.stopPropagation e)
+                              (dispatch! :reopen-thread (thread :id)))}])
               [:div.control.mute
                {:title "Mute"
-                :on-click (fn [_] (dispatch! :unsub-thread
-                                             {:thread-id (thread :id)}))}]])
+                :on-click (fn [e]
+                            ; Need to preventDefault & propagation when using
+                            ; divs as controls, otherwise divs higher up also
+                            ; get click events
+                            (.preventDefault e)
+                            (.stopPropagation e)
+                            (dispatch! :unsub-thread
+                                       {:thread-id (thread :id)}))}]])

            [thread-tags-view thread]]


Version 0.5.1

Version 0.5.1

--- metlog-vault/project.clj
+++ metlog-vault/project.clj
@@ -1,4 +1,4 @@
-(defproject metlog-vault "0.5.1-SNAPSHOT"
+(defproject metlog-vault "0.5.1"
   :description "Repository for long term storage of series data."

   :license {:name "Eclipse Public License"


add more diagnostics

add more diagnostics

--- src/babel/francais/morphology.cljc
+++ src/babel/francais/morphology.cljc
@@ -132,8 +132,13 @@
                                                            conjugate-with [[:français :exception]])) "; "
                                               "arg2="
                                               {:français {:infinitive infinitive
-                                                          :exception true}}))))
-
+                                                          :exception true}}
+                                              "; fail-path:"
+                                              (dag_unify.core/fail-path
+                                               (strip-refs (dissoc-paths
+                                                            conjugate-with [[:français :exception]]))
+                                               {:français {:infinitive infinitive
+                                                           :exception true}})))))
                 exceptional-surface-forms
                 (do
                   (log/debug (str "unifying spec: " spec " against irregular-conjugations."))


fix typo

fix typo

--- src/babel/italiano/morphology.cljc
+++ src/babel/italiano/morphology.cljc
@@ -1323,7 +1323,7 @@
                                                                     true
                                                                     (dissoc (copy lexeme) :serialized))]
                                                    (if (not (= :none (get-in lexeme path :none)))
-                                                     (do (log/debug (str (first lexeme-kv) " generating lexeme exceptional surface form: " (surface-form-fn lexeme)))
+                                                     (do (log/debug (str (first lexeme-kv) " generating lexeme exceptional surface form: " (surface-form-fn lexeme)
                                                          (list {(surface-form-fn lexeme)
                                                                 (merge
                                                                  lexeme


improve logging

improve logging

--- src/babel/italiano/morphology.cljc
+++ src/babel/italiano/morphology.cljc
@@ -1438,7 +1438,8 @@
                                                                       (do
                                                                         (log/warn (str ":fail in exception rule:"
                                                                                (:label path-and-merge-fn)
-                                                                                "; lexeme keys:" (keys lexeme)))
+                                                                                "; lexeme's italiano:"
+                                                                                (strip-refs (get-in lexeme [:italiano]))))
                                                                         :fail)
                                                                       (= b :fail)
                                                                       (do


Add lookup and assoc replacement to benchmarks

--- src/bench/cljs/lean_map/bench.cljs
+++ src/bench/cljs/lean_map/bench.cljs
@@ -45,6 +45,54 @@
   (println "Transient Assoc")
   (doseq [[size sample] size->sample]
     (simple-benchmark [] (transient-sized-map m size) sample)))
+
+(defmethod map-bench :assoc-replace [_ _ {:keys [small-map medium-map large-map]}]
+  (println "Assoc Replace")
+  (let [maps [small-map medium-map large-map]
+        samples [small-map-sample medium-map-sample large-map-sample]]
+    (doseq [[m sample] (partition 2 (interleave maps samples))]
+      (simple-benchmark
+        []
+        (loop [m m i (count m)]
+          (when (> i 0)
+            (recur (assoc m (get test-keys i) (inc i)) (dec i))))
+        sample))))
+
+(defmethod map-bench :transient-assoc-replace [_ _ {:keys [small-map medium-map large-map]}]
+  (println "Transient Assoc Replace")
+  (let [maps [small-map medium-map large-map]
+        samples [small-map-sample medium-map-sample large-map-sample]]
+    (doseq [[m sample] (partition 2 (interleave maps samples))]
+      (simple-benchmark
+        []
+        (loop [m (transient m) i (count m)]
+          (when (> i 0)
+            (recur (assoc! m (get test-keys i) (inc i)) (dec i))))
+        sample))))
+
+(defmethod map-bench :lookup [_ _ {:keys [small-map medium-map large-map]}]
+  (println "Lookup")
+  (let [maps [small-map medium-map large-map]
+        samples [small-map-sample medium-map-sample large-map-sample]]
+    (doseq [[m sample] (partition 2 (interleave maps samples))]
+      (simple-benchmark
+        []
+        (loop [m m i (count m)]
+          (when (> i 0)
+            (recur (get m (get test-keys i)) (dec i))))
+        sample))))
+
+(defmethod map-bench :lookup-fail [_ _ {:keys [small-map medium-map large-map]}]
+  (println "Lookup Fail")
+  (let [maps [small-map medium-map large-map]
+        samples [small-map-sample medium-map-sample large-map-sample]]
+    (doseq [[m sample] (partition 2 (interleave maps samples))]
+      (simple-benchmark
+        []
+        (loop [m m i (count m)]
+          (when (> i 0)
+            (recur (get m i) (dec i))))
+        sample))))

 (defmethod map-bench :dissoc [_ _ {:keys [small-map medium-map large-map]}]
   (println "Dissoc")
@@ -152,7 +200,8 @@
                      (range large-map-size)))

 (println "Current Maps")
-(let [benchmarks  [:assoc :transient-assoc :dissoc :transient-dissoc :dissoc-fail :hash :equals :equals-fail :worst-equals :sequence :reduce]
+(let [benchmarks  [:assoc :transient-assoc :assoc-replace :transient-assoc-replace :dissoc :transient-dissoc :dissoc-fail
+                   :lookup :lookup-fail :hash :equals :equals-fail :worst-equals :sequence :reduce]
       empty-map cem
       data {:small-map (sized-map empty-map small-map-size)
             :medium-map (sized-map empty-map medium-map-size)
@@ -160,7 +209,8 @@
   (run-benchmarks benchmarks empty-map data))

 (println "Lean Maps")
-(let [benchmarks  [:assoc :transient-assoc :dissoc :transient-dissoc :dissoc-fail :hash :equals :equals-fail :worst-equals :sequence :reduce]
+(let [benchmarks  [:assoc :transient-assoc :assoc-replace :transient-assoc-replace :dissoc :transient-dissoc :dissoc-fail
+                   :lookup :lookup-fail :hash :equals :equals-fail :worst-equals :sequence :reduce]
       empty-map lem
       data {:small-map (sized-map empty-map small-map-size)
             :medium-map (sized-map empty-map medium-map-size)


better but with crazy hack still

better but with crazy hack still

--- src/cljs/omnext_routing_one/core.cljs
+++ src/cljs/omnext_routing_one/core.cljs
@@ -93,7 +93,8 @@

   static om/IQuery
   (query [_]
-         '[(:countries {:page ?page})]
+         '[:tab-key/countries
+           (:countries {:page ?page})]
          )

   Object
@@ -116,7 +117,8 @@

   static om/IQuery
   (query [_]
-         '[:oceans]
+         '[:tab-key/oceans
+           :oceans]
          )

   Object
@@ -142,7 +144,8 @@

   static om/IQuery
   (query [_]
-         '[:hello]
+         '[:tab-key/hello
+           :hello]
          )

   Object
@@ -212,46 +215,45 @@
 (defui RootView
   static om/IQueryParams
   (params [_]
-          ;initial-params ; here and below, we're passing (pre-computed) value
-          ;               ; and not doing function calls
-          (merge {}
-         (:params (get-query-and-params-by-parsed-url tabs (parse-url-hash
-                                               js/window.location.hash
-                                               )))
-                 )
+          initial-params ; here and below, we're passing (pre-computed) value
+                         ; and not doing function calls
     )

   static om/IQuery
   (query [_]
-         ;initial-query
-         (with-meta (:query (get-query-and-params-by-parsed-url tabs (parse-url-hash
-                                               js/window.location.hash
-                                               ))) nil)
+         initial-query
     )

   Object
   (componentDidMount [this]
                      (go-loop [new-query (<! routes-chan)]
-                                             (println "new query"
-                                                      new-query)
                                 (om/set-query!
                                   this
                                   new-query
                                   )
-
                               (recur (<! routes-chan))
                        )
                      )

   (render [this]
-          (let [unbound-query (om/query this)
-                unbound-params (om/params this)
+          (println "render called. and"
+                       (meta (first (-> this om/get-query)))
+                       (-> this om/get-query)
+                   (om/query this)
+                   (om/params this)
+                   )
+          (let [;unbound-query (om/query this)
+                ;unbound-params (om/params this)
                 query (om/get-query this)
                 tab-is-active (fn [tab]
-                                (= unbound-query
-                                   (om/query
-                                     (:component tab)
-                                     )
+                                (contains?
+                                  (into #{} (comp
+                                              (filter keyword?)
+                                              (filter #(= (namespace %) "tab-key"))
+                                              (map name)
+                                              (map keyword)
+                                             ) query)
+                                   (:key tab)
                                    )
                                 )
                 ]
@@ -285,7 +287,6 @@
                                                      )]
                                 ; ...
                                 (do
-                                  (println "current-tab" current-tab)
                                   (
                                     (om/factory
                                       (:component current-tab))
@@ -306,6 +307,7 @@

 (defmethod readf :default
   [{:keys [state] :as env} k params]
+  (println "readf" k params)
   (if-let [v (get @state k)]
     {:value v}
     {:value nil}


Fix bug in query parameter parsing

Fix bug in query parameter parsing

--- src/cljs/mandelbrot_cljs/core.cljs
+++ src/cljs/mandelbrot_cljs/core.cljs
@@ -110,7 +110,7 @@
   "Gets a rendering-level from the url parameters, or returns nil"
   []
   (let [{:keys [query] :as full-url} (url (aget (aget js/window "location")"href"))
-        query                        (into {} (map (fn [[k v]] [(keyword k) v]) query))]
+        query                        (into {} (map (fn [[k v]] [(keyword k) (js/parseFloat v)]) query))]
     (when (and (:x0 query) (:y0 query) (:width query) (:height query))
       query)))


comments

comments

--- src/cljs/triboard/logic/board.cljs
+++ src/cljs/triboard/logic/board.cljs
@@ -51,7 +51,7 @@

 (s/fdef empty-cells
   :args (s/cat :board ::board)
-  :ret (partial every? #(s/valid? ::coord %))) ;; TODO - Fails with coll-of ::coord. WHY?
+  :ret (partial every? #(s/valid? ::coord %))) ;; TODO - Fails with coll-of ::coord or s/every. WHY?

 (defn board?
   "A board is a vector of vector of cells"


CMR-5145: Use the new way of assembling plugin routes.

--- src/cmr/opendap/app/middleware.clj
+++ src/cmr/opendap/app/middleware.clj
@@ -1,9 +1,9 @@
 (ns cmr.opendap.app.middleware
   "Custom ring middleware for CMR OPeNDAP."
   (:require
+   [cmr.ous.util.http.request :as request]
    [cmr.http.kit.response :as response]
-   [cmr.opendap.components.auth :as auth]
-   [cmr.opendap.http.request :as request]
+   [cmr.metadata.proxy.components.auth :as auth]
    [reitit.ring :as ring]
    [taoensso.timbre :as log]))

@@ -34,11 +34,13 @@
   ([site-routes route-data system]
     (wrap-api-version-dispatch
       site-routes route-data system (reitit-auth system)))
-  ([site-routes {:keys [main-api-routes-fn plugins-api-routes]} system opts]
+  ([site-routes {:keys [main-api-routes-fn plugins-api-routes-fns]} system opts]
     (fn [req]
-      (log/debug "Got site-routes:" (vec site-routes))
+      (log/trace "Got site-routes:" (vec site-routes))
       (let [api-version (request/accept-api-version system req)
-            api-routes (main-api-routes-fn system api-version)
+            plugins-api-routes (mapcat #(% system api-version) plugins-api-routes-fns)
+            api-routes (concat plugins-api-routes
+                               (main-api-routes-fn system api-version))
             _ (log/trace "Got plugins-api-routes:" (vec plugins-api-routes))
             _ (log/trace "Got api-routes:" (vec api-routes))
             routes (concat site-routes plugins-api-routes api-routes)


Allow authorization to return false

Allow authorization to return false

The principle of least surprise would suggest that returning false
from a call to authoriation/validate should mean that the request is
not authorized and the request should therefore fail, rather than
continuing with a request context set to false.

--- src/yada/security.clj
+++ src/yada/security.clj
@@ -124,7 +124,7 @@
          (let [credentials (get-in ctx [:authentication realm])]
            (let [validation
                  (authorization/validate ctx credentials authorization)]
-             (if (nil? validation)
+             (if (or (nil? validation) (false? validation))
                (if credentials
                  (throw
                   (ex-info "Forbidden"
@@ -139,6 +139,7 @@
                validation)))
          ctx))
      ctx (get-in ctx [:resource :access-control :realms]))))
+

 (defn to-header [v]
   (if (coll? v)


Pretty print result of eval every time

Pretty print result of eval every time

--- src/yetibot/core/commands/eval.clj
+++ src/yetibot/core/commands/eval.clj
@@ -15,7 +15,7 @@
   "eval <form> # evaluate the <form> data structure in YetiBot's context"
   [{:keys [args user]}]
   (if (user-is-allowed? user)
-    (pr-str (eval (read-string args)))
+    (with-out-str (pprint (eval (read-string args))))
     (format "You are not allowed, %s." (:name user))))

 (cmd-hook #"eval"


Restrict help all regex

Restrict help all regex

--- src/yetibot/core/commands/help.clj
+++ src/yetibot/core/commands/help.clj
@@ -28,6 +28,6 @@
             (s/join \newline section))))

 (cmd-hook #"help"
-          #"all" help-all-cmd
+          #"^all$" help-all-cmd
           #"^$" help-topics
           #"^\S+$" help-for-topic)


+him (accusative pronoun)

+him (accusative pronoun)

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -768,6 +768,16 @@
                    :number :sing}
              :sem {:human true}
              :subcat '()}}
+    "him"
+    {:synsem {:cat :noun
+              :pronoun true
+              :case :acc
+              :reflexive false
+              :agr {:person :3rd
+                    :gender :masc
+                    :number :sing}
+              :sem {:human true}
+              :subcat '()}}

    "himself"
    {:synsem {:cat :noun


woman: +{:cat :noun}

woman: +{:cat :noun}

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -1860,7 +1860,8 @@
                      :participle "winning"}}

    "woman" {:english {:plur "women"}
-            :synsem {:sem {:human true
+            :synsem {:cat :noun
+                     :sem {:human true
                            :pred :donna
                            :child false}}}


go + PP

go + PP

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -766,7 +766,8 @@
    {:synsem {:cat :verb
               :sem {:activity true
                     :discrete false
-                    :pred :go}}
+                    :pred :go}
+             :subcat {:2 {:cat :prep}}}
     :english {:past "went"}}

    "go downstairs"


added s' énerver

added s' énerver

--- src/babel/francais/lexicon.clj
+++ src/babel/francais/lexicon.clj
@@ -511,6 +511,21 @@
                                        :reflexive true
                                        :sem subject-semantics}}}})

+  "s'énerver" (let [subject-semantics (ref {:human true})
+                    subject-agr (ref :top)]
+                {:synsem {:cat :verb
+                          :essere true
+                          :sem {:pred :get-angry
+                                :reflexive true
+                                :subj subject-semantics
+                                :obj subject-semantics}
+                          :subcat {:1 {:agr subject-agr
+                                       :sem subject-semantics}
+                                   :2 {:agr subject-agr
+                                       :pronoun true
+                                       :reflexive true
+                                       :sem subject-semantics}}}})
+
   "s'ennuyer" (let [subject-semantics (ref {:human true})
                     subject-agr (ref :top)]
                 {:synsem {:cat :verb


Causes training to only display if a user has untrained phrases.

--- src/cadence/views/training.clj
+++ src/cadence/views/training.clj
@@ -17,36 +17,42 @@
      [:h1 "Training"]]
     [:p "If you don't know what this is for please checkout the "
      (link-to "/#training" "blurb on the front page") "."]
-    [:h2 "Let's get down to business!"]
-    [:div#train_well.well.container-fluid
-     [:p.help "Simply type the following phrase in the form repeatedly until I"
-      " tell you to stop."]
-     (let [phrase (model/get-phrase)]
-       (html [:div.row-fluid
-              [:div#training-phrase.input-xlarge.uneditable-input.span12
-               phrase]]
-             [:form#trainer.row-fluid
-              (common/input {:type "text"
-                             :eclass ".phrase.input-xlarge.span12"
-                             :name "phrase"
-                             :placeholder phrase})]))
-     [:div#feedback.row-fluid]
-     [:div#completion.row-fluid
-      (let [trcount (count (patrec/kept-cadences))]
-        (html
+    (let [phrase-doc (model/get-phrase (:_id (model/get-auth)) false)
+          phrase (:phrase phrase-doc)]
+      (if (nil? phrase-doc)
+        ; There are no phrases for which the current user has not already done
+        ; training.
+        (common/alert :info [:h2 "You are already trained!"]
+                      (html [:p "There are a limited number of
+                                phrases and you have done the training for all
+                                of them. Currently there is no support for
+                                redoing your training for a given phrase, but
+                                hopefully there will be soon."]) false)
+        ; Otherwise we give the user a form to train with.
+        (do (sess/put! :training-phrase phrase-doc)
+          (html
+            [:h2 "Let's get down to business!"]
+            [:div#train_well.well.container-fluid
+             [:p.help "Simply type the following phrase in the form repeatedly
+                      until I tell you to stop."]
+             (common/phrase-fields "trainer" phrase)
+             [:div#feedback.row-fluid]
+             [:div#completion.row-fluid
+              (let [trcount (count (patrec/kept-cadences))]
+                (html

-          [:div
-           {:class (str "progress progress-success progress-striped span10"
-                        (when (>= trcount @patrec/training-min) " active"))}
-           [:div.bar
-            {:style (str "width: "
-                         (min 100 (* 100.0 (/ trcount @patrec/training-min)))
-                         "%;")}]]
-          (if (>= trcount @patrec/training-min)
-            [:div.span2 [:a.btn.btn-large.btn-success
-             {:href "/user/profile"} "Already done!"]]
-            [:div.span2 [:a.btn.btn-large.disabled
-             {:href "#"} "Complete"]])))]]))
+                  [:div
+                   {:class (str "progress progress-success progress-striped span10"
+                                (when (>= trcount @patrec/training-min) " active"))}
+                   [:div.bar
+                    {:style (str "width: "
+                                 (min 100 (* 100.0 (/ trcount @patrec/training-min)))
+                                 "%;")}]]
+                  (if (>= trcount @patrec/training-min)
+                    [:div.span2 [:a.btn.btn-large.btn-success
+                                 {:href "/user/profile"} "Already done!"]]
+                    [:div.span2 [:a.btn.btn-large.disabled
+                                 {:href "#"} "Complete"]])))]]))))))

 (defpage post-training [:post "/user/training"] {:as unkeyed-cad}
   ; I like maps with keyword keys


Add new (faster) implementation for single scenario with single request scenario

--- src/clj_gatling/simulation.clj
+++ src/clj_gatling/simulation.clj
@@ -2,7 +2,7 @@
   (:require [org.httpkit.client :as http]
             [clj-time.core :as time]
             [clj-time.local :as local-time]
-            [clojure.core.async :as async :refer [go go-loop <! >!]]))
+            [clojure.core.async :as async :refer [go go-loop put! <!! alts! <! >!]]))

 (defn- collect-result [cs]
   (let [[result c] (async/alts!! cs)]
@@ -109,10 +109,58 @@
      (deliver result (run-scenarios-in-parallel scenario-runs users runner))
     result))

+(defn async-function-with-timeout [request timeout user-id result-channel]
+  (let [
+now      #(System/currentTimeMillis)
+        start    (now)
+        response (async/chan)
+        function (memoize (request-fn request))]
+    (go
+      (function user-id #(put! response
+                               {:name (:name request)
+                                :id user-id
+                                :start start
+                                :end (now)
+                                :result %}))
+      (let [[result c] (alts! [response (async/timeout timeout)])]
+        (if (= c response)
+          (>! result-channel result)
+          (>! result-channel {:name (:name request)
+                              :id user-id
+                              :start start
+                              :end (now)
+                              :result false}))))))
+
+
+(defn run-scenario-version2 [concurrency number-of-requests timeout scenario]
+  (let [cs       (repeatedly concurrency async/chan)
+        ps       (map vector (iterate inc 0) cs)
+        results  (async/chan)
+        request  (-> scenario :requests first)]
+    (doseq [[user-id c] ps]
+      (async-function-with-timeout request timeout user-id c))
+    (go-loop [i 0]
+      (let [[result c] (alts! cs)]
+        (when (< i (- number-of-requests concurrency))
+          (async-function-with-timeout request timeout (+ i concurrency) c))
+        (>! results {:name (:name scenario)
+                     :id (:id result)
+                     :start (:start result)
+                     :end (:end result)
+                     :requests [result]})
+        (when (<= i number-of-requests)
+          (recur (inc i)))))
+    (repeatedly number-of-requests #(<!! results))))
+
+
 (defn run-simulation [scenarios users & [options]]
   (let [requests (or (:requests options) users)
         duration (:duration options)
-        step-timeout (or (:timeout-in-ms options) 5000)
-        scenario-runner (partial run-nth-scenario-with-multiple-users scenarios users step-timeout requests duration)
-        results (run-parallel-and-collect-results scenario-runner (count scenarios))]
-    (flatten results)))
+        step-timeout (or (:timeout-in-ms options) 5000)]
+        ; TODO The new implementation utilizes core.async better and it can generate
+        ;      more load. However, it currently supports only one scenario with one request case
+        (if (and (nil? duration) (= 1 (count scenarios)) (= 1 (-> scenarios first :requests count)))
+          (run-scenario-version2 users requests step-timeout (first scenarios))
+          (let [scenario-runner (partial run-nth-scenario-with-multiple-users scenarios users step-timeout requests duration)
+                results (run-parallel-and-collect-results scenario-runner (count scenarios))]
+                (flatten results)))))


Fix endgame madlib generation

Fix endgame madlib generation

--- src/cljc/robinson/endgame.cljc
+++ src/cljc/robinson/endgame.cljc
@@ -57,7 +57,7 @@
                              (if (nil? max-stat)
                                "Who didn't kill anything"
                                (let [[monster-id n] max-stat]
-                                 (format (rnd-nth ["Slayer of %s" "Defeater of %s" "Eliminator of %s" "Dominator of %" "The nightmare of %s"] n2)
+                                 (format (rnd-nth ["Slayer of %s" "Defeater of %s" "Eliminator of %s" "Dominator of %s" "The nightmare of %s"] n2)
                                          (mg/id->name-plural monster-id)))))
                          :num-items-crafted
                            (let [max-stat (reduce (fn [acc [id n]]


Make bottom panes resize like before

Make bottom panes resize like before

--- src/clojure/nightcode/core.clj
+++ src/clojure/nightcode/core.clj
@@ -117,12 +117,12 @@
           (s/top-bottom-split (get-project-pane console console-io)
                               (get-repl-pane process console console-io)
                               :divider-location 0.8
-                              :resize-weight 1))
+                              :resize-weight 0.5))
         (one-touch!
           (s/top-bottom-split (get-editor-pane)
                               (get-builder-pane)
                               :divider-location 0.8
-                              :resize-weight 1))
+                              :resize-weight 0.5))
         :divider-location 0.35
         :resize-weight 0))))


Fixing orbit generate xml function.

Fixing orbit generate xml function.

--- src/cmr/umm/echo10/spatial.clj
+++ src/cmr/umm/echo10/spatial.clj
@@ -79,8 +79,8 @@

 (defn generate-orbit-xml
   [orbit]
-  (let [{:keys [ascending-crossing start-lat start-direction end-lat end-direction center-point]}
-        orbit]
+  (when-let [{:keys [ascending-crossing start-lat start-direction end-lat end-direction center-point]}
+             orbit]
     (x/element :Orbit {}
                (x/element :AscendingCrossing {} (util/double->string ascending-crossing))
                (x/element :StartLat {} (util/double->string start-lat))


fix iconpiles animation

fix iconpiles animation

--- frontend/components/common.cljs
+++ frontend/components/common.cljs
@@ -67,17 +67,15 @@
   (let [template (get ico-templates ico-name)]
     [:svg {:class "ico" :xmlns "http://www.w3.org/2000/svg" :viewBox "0 0 100 100"
            :dangerouslySetInnerHTML
-           #js {"__html" (apply str (concat
-                                     (for [path (:paths template)]
-                                       (do
-                                         (when (clojure.string/blank? path)
-                                           (utils/inspect ico-name))
-                                         (str "<path class='ico-" (name ico-name) "' fill='none'"
-                                              " d='" path "'></path>")))
-                                     (when (:d template)
-                                       [(str "<animateTransform attributeName='transform' type='rotate'"
-                                             " repeatDur='indefinite' values='" (:v template) "'"
-                                             " keyTimes='" (:k template) "'></animateTransform>")])))}}]))
+           #js {"__html" (apply str
+                                (for [path (:paths template)]
+                                  (str "<path class='ico-" (name ico-name) "' fill='none'"
+                                       " d='" path "'>"
+                                       (when (:d template)
+                                         (str "<animateTransform attributeName='transform' type='rotate'"
+                                              " repeatDur='indefinite' dur='" (:d template) "' values='" (:v template) "'"
+                                              " keyTimes='" (:k template) "'></animateTransform>"))
+                                       "</path>")))}}]))

 ;; TODO: why do we have ico and icon?
 (def icon-shapes


add test for ensure-endswith-slash

add test for ensure-endswith-slash

--- test/brainbot/nozzle/misc_test.clj
+++ test/brainbot/nozzle/misc_test.clj
@@ -13,3 +13,10 @@
   (testing "basic remap"
     (is (remap inc {}) {})
     (is (remap inc {:a 1 :b 2}) {:a 2 :b 3})))
+
+(deftest test-endswith-slash
+  (is (= (ensure-endswith-slash "") "/"))
+  (is (= (ensure-endswith-slash "/") "/"))
+  (is (= (ensure-endswith-slash "foo/") "foo/"))
+  (is (= (ensure-endswith-slash "foo/bar") "foo/bar/"))
+  (is (= (ensure-endswith-slash "foo/") "foo/")))


collect each string's results into into {}

--- ohack/src/ohack/core.clj
+++ ohack/src/ohack/core.clj
@@ -274,9 +274,10 @@
   ;; map over each 6-line-set...
   (doseq [line-set sorted-grouped-line-set-list]
     ;; map over each line in the line-set, with string index
+    (println "============")
     (doseq [[string-index tab-line] (map-indexed vector line-set)]
-      (prn string-index tab-line)
       ;; now we need to parse the tab-line...
+      (prn string-index (into {} (parse-guitar-tab-line tab-line)))
       ))

   )


inc -- extraction

inc -- extraction

--- ohack/src/ohack/core.clj
+++ ohack/src/ohack/core.clj
@@ -240,6 +240,11 @@
       (fn [m] [(:start m) (Integer/parseInt (:group m))])
       (re-seq-pos #"\d+" tab-string)))))

+;; extract out the parsing section from play-tab() so we can use the
+;; data for visualization
+(defn parse-guitar-tab [guitar-tab]
+  )
+
 ;; first, filter out all lines that don't look like guitar lines
 ;; use map-index because we need to keep ordering information
 (defn play-tab [guitar-tab]


:fire: Remove commented code.

:fire: Remove commented code.

--- frontend/src/uxbox/main/ui.cljs
+++ frontend/src/uxbox/main/ui.cljs
@@ -40,13 +40,6 @@
       (l/derive st/state)))

 ;; --- Routes
-
-;; (comment
-;;   "/dashboard/self"
-;;   "/dashboard/self/drafts"
-;;   "/dashboard/self/<project-id>"
-;;   "/dashboard/<team-id>"
-;;   "/dashboard/<team-id>/<project-id>"

 (def routes
   [["/login" :login]


update nsdeps to support nested use/require forms

--- bake/bake/nsdeps.clj
+++ bake/bake/nsdeps.clj
@@ -17,14 +17,16 @@
         [bake.find-namespaces :only [find-clojure-sources-in-dir read-file-ns-decl]]
         [bake.dependency :only [depend dependents remove-key depends?]]))

+(defn- prepend [prefix sym]
+  (symbol (str (when prefix (str prefix "."))
+               sym)))
+
 (defn- deps-from-libspec [prefix form]
-  (cond (list? form) (apply union (map (fn [f] (deps-from-libspec
-                                                (symbol (str (when prefix (str prefix "."))
-                                                             (first form)))
-                                                f))
-                                       (rest form)))
-        (vector? form) (deps-from-libspec prefix (first form))
-        (symbol? form) #{(symbol (str (when prefix (str prefix ".")) form))}
+  (cond (coll? form) (if (or prefix (some keyword? form) (= 1 (count form)))
+                       (deps-from-libspec prefix (first form))
+                       (apply union (map #(deps-from-libspec (prepend prefix (first form)) %)
+                                         (rest form))))
+        (symbol? form) #{(prepend prefix form)}
         (keyword? form) #{}
         :else (throw (IllegalArgumentException.
                       (pr-str "Unparsable namespace form:" form)))))


Make code more Clojure-idiomatic

Make code more Clojure-idiomatic

--- src/cyanite_remover/path_store.clj
+++ src/cyanite_remover/path_store.clj
@@ -87,13 +87,13 @@
 (defn- search
   "Search for a path."
   [search-fn scroll-fn tenant leafs-only limit-depth path batch-size batch-rate]
-  (let [throttle-fn (utils/fn-or-trtlfn #(do %) batch-rate)
+  (let [throttle-fn (utils/fn-or-trtlfn do batch-rate)
         query (build-query (build-filter tenant leafs-only limit-depth path))
         _ (log/trace (str "ES search query: " query))
         resp (search-fn :query query :size batch-size
                         :search_type "query_then_fetch" :scroll "1m")]
     (log/trace (str "ES search response: " resp))
-    (map #(:_source %) (map throttle-fn (scroll-fn resp)))))
+    (map :_source (map throttle-fn (scroll-fn resp)))))

 (defn- log-shards-errors
   "Log shards' errors."
@@ -119,8 +119,8 @@
          (not total) (error-fn "total")
          (not successful) (error-fn "successful")
          (not failed) (error-fn "failed")
-         (> failed 0) (do (log-shards-errors failed (:failures shards) path
-                                             stats-errors) false))
+         (pos? failed) (do (log-shards-errors failed (:failures shards) path
+                                              stats-errors) false))
         true)
       (error-fn "shards"))))


[#9665] Allow to change pin after keycard multiacc creation

--- src/status_im/hardwallet/recovery.cljs
+++ src/status_im/hardwallet/recovery.cljs
@@ -210,7 +210,8 @@
                                      (update :instance-uid #(get-in db [:hardwallet :multiaccount :instance-uid] %))))
                        (assoc-in [:hardwallet :multiaccount-wallet-address] (:wallet-address account-data))
                        (assoc-in [:hardwallet :multiaccount-whisper-public-key] (:whisper-public-key account-data))
-                       (assoc-in [:hardwallet :application-info :key-uid] (:key-uid account-data))
+                       (assoc-in [:hardwallet :application-info :key-uid]
+                                 (ethereum/normalized-hex (:key-uid account-data)))
                        (update :hardwallet dissoc :recovery-phrase)
                        (update-in [:hardwallet :secrets] dissoc :pin :puk :password)
                        (assoc :multiaccounts/new-installation-id (random-guid-generator))


fix multiple infiheads

fix multiple infiheads

--- Assets/game/core.clj
+++ Assets/game/core.clj
@@ -43,8 +43,8 @@

 (defn make-head [rb?]
-  (destroy (the infihead))
-  (destroy (the neck))
+  (dorun (map destroy (every infihead)))
+  (dorun (map destroy (every neck)))
   (let [head (human.core/make-head @data/seed)
         rag-head (the Bone.001)
         rag-neck (the Bone.002)


made some formatting nicer

made some formatting nicer

--- src/frontend/server-interface.cljs
+++ src/frontend/server-interface.cljs
@@ -120,7 +120,10 @@
   (fn [file-hash]
     (println "File does not exist on server. Will upload. Hash: " file-hash)
     (let [file (get (:file-hashes @app-state/app-state) file-hash)]
-      (swap! app-state/app-state assoc :file-hashes (dissoc (:file-hashes @app-state/app-state) file-hash))
+      (swap! app-state/app-state
+             assoc
+             :file-hashes
+             (dissoc (:file-hashes @app-state/app-state) file-hash))
       (uploads/upload-file! file))))

 (.on app-state/socket "user-muted"
@@ -137,9 +140,12 @@
 (.on app-state/socket "user-unmuted"
   (fn [socket-id]
     (println "Received umute-user signal for" socket-id)
-    (swap! app-state/app-state assoc :users (merge (:users @app-state/app-state)
-                                                   {socket-id (merge (get (:users @app-state/app-state) socket-id)
-                                                                     {"muted" false})}))))
+    (swap! app-state/app-state
+           assoc
+           :users
+           (merge (:users @app-state/app-state)
+                  {socket-id (merge (get (:users @app-state/app-state) socket-id)
+                                    {"muted" false})}))))

 (.on app-state/socket "upload-cancelled"
   (fn [id]


bump cljs version

bump cljs version

--- src/leiningen/new/mies/project.clj
+++ src/leiningen/new/mies/project.clj
@@ -3,7 +3,7 @@
   :url "http://example.com/FIXME"

   :dependencies [[org.clojure/clojure "1.6.0"]
-                 [org.clojure/clojurescript "0.0-2371"]]
+                 [org.clojure/clojurescript "0.0-2511"]]

   :plugins [[lein-cljsbuild "1.0.4-SNAPSHOT"]]


CMR-4430: Renamed function.

CMR-4430: Renamed function.

--- metadata-db-app/src/cmr/metadata_db/services/concept_service.clj
+++ metadata-db-app/src/cmr/metadata_db/services/concept_service.clj
@@ -426,8 +426,8 @@
   (fn [context concept]
     (boolean (:deleted concept))))

-(defn- delete-associations
-  "Delete the associations that matches the given search params,
+(defn- tombstone-associations
+  "Tombstone the associations that matches the given search params,
   skip-publication? flag controls if association deletion event should be generated,
   skip-publication? true means no association deletion event should be generated."
   [context assoc-type search-params skip-publication?]
@@ -449,7 +449,7 @@
                         :associated-revision-id coll-revision-id
                         :exclude-metadata true
                         :latest true})]
-    (delete-associations context assoc-type search-params true)))
+    (tombstone-associations context assoc-type search-params true)))

 (defmulti delete-associated-variable-associations
   "Delete the variable associations associated with the given concept type and concept id."
@@ -473,7 +473,7 @@
                         :exclude-metadata true
                         :latest true})]
     ;; create variable association tombstones and queue the variable association delete events
-    (delete-associations context :variable-association search-params false)))
+    (tombstone-associations context :variable-association search-params false)))

 ;; true implies creation of tombstone for the revision
 (defmethod save-concept-revision true


Adds expt

Adds expt

--- src/the_little_clojurian/chapter4.clj
+++ src/the_little_clojurian/chapter4.clj
@@ -137,3 +137,14 @@
   (is (= (equal 0 1) false))
   (is (= (equal 1 1) true))
   (is (= (equal 44 44) true)))
+
+(with-test
+  (def expt
+    (fn [n m]
+      (cond (zero? m) 1
+            :else (multiply n (expt n (sub1 m))))))
+
+  (is (= (expt 1 1) 1))
+  (is (= (expt 2 2) 4))
+  (is (= (expt 2 3) 8))
+  (is (= (expt 5 3) 125)))


Account settings => User settings

Account settings => User settings

--- src-cljs/frontend/components/pieces/topbar.cljs
+++ src-cljs/frontend/components/pieces/topbar.cljs
@@ -51,7 +51,7 @@
          [:i.material-icons "keyboard_arrow_down"]]
         [:ul.dropdown-menu.pull-right
          [:li [:a {:href "/logout/"} "Logout"]]
-         [:li [:a {:href "/account"} "Account Settings"]]]]]])))
+         [:li [:a {:href "/account"} "User Settings"]]]]]])))

 (dc/do
   (defcard topbar


blocks can  be component or ui

blocks can  be component or ui

its a start to give a type to a component

--- idecode/myappshare/mainapp.cljs
+++ idecode/myappshare/mainapp.cljs
@@ -253,12 +253,12 @@

 (def basic-blocks  [
-                     ["appshare_element_header"]
-                     ["appshare_element_text"]
-                     ["appshare_element_br"]
-                     ["appshare_element_box"]
-                     ["appshare_element_left_padding"]
-                     ["appshare_element_top_padding"]
+                     ["appshare_element_header" "ui"]
+                     ["appshare_element_text" "ui"]
+                     ["appshare_element_br" "ui"]
+                     ["appshare_element_box" "ui"]
+                     ["appshare_element_left_padding" "ui"]
+                     ["appshare_element_top_padding" "ui"]
                      ])

@@ -358,24 +358,24 @@

             (add-blocks "Basic"     basic-blocks)

-            (add-blocks "Glue"     [["appshare_custom_component"]
-                                    ["appshare_call_custom_component"]
+            (add-blocks "Glue"     [["appshare_custom_component" "component"]
+                                    ["appshare_call_custom_component" "ui"]
                                     ])

-            (add-blocks "Text"     [  ["appshare_div"]
-                                      ["appshare_no_attributes"]
-                                      ["appshare_element_attribute"]
-                                      ["appshare_element_text"]])
+            (add-blocks "Text"     [  ["appshare_div" "ui"]
+                                      ["appshare_no_attributes" "ui"]
+                                      ["appshare_element_attribute" "ui"]
+                                      ["appshare_element_text" "ui"]])

             (add-blocks "Shapes"   [])

-            (add-blocks "Custom"  [ ["appshare_ui_component"]
-                                    ["appshare_div"]
-                                    ["appshare_no_attributes"]
-                                    ["appshare_element_attribute"]
-                                    ["appshare_element_text"]])
+            (add-blocks "Custom"  [ ["appshare_ui_component" "ui"]
+                                    ["appshare_div" "ui"]
+                                    ["appshare_no_attributes" "ui"]
+                                    ["appshare_element_attribute" "ui"]
+                                    ["appshare_element_text" "ui"]])

             )


only show clear inbox button if at least 5 open threads

--- src/chat/client/views/header.cljs
+++ src/chat/client/views/header.cljs
@@ -8,12 +8,14 @@
             [chat.client.routes :as routes]
             [chat.client.dispatcher :refer [dispatch!]]))

-(defn clear-inbox-button [_ owner]
+(defn clear-inbox-button [data owner]
   (reify
     om/IRender
     (render [_]
-      (dom/button #js {:onClick (fn [_]
-                              (dispatch! :clear-inbox))} "Clear Inbox"))))
+      (dom/div {}
+        (when (< 5 (count (store/open-threads data)))
+          (dom/button #js {:onClick (fn [_]
+                                      (dispatch! :clear-inbox))} "Clear Inbox"))))))

 (defn header-view [data owner]
   (reify
@@ -21,7 +23,7 @@
     (render [_]
       (dom/div #js {:className "header"}

-        (om/build clear-inbox-button {})
+        (om/build clear-inbox-button data)

         (let [path (routes/inbox-page-path {:group-id (routes/current-group)})]
           (dom/div #js {:className (str "inbox shortcut "


Reserve inbox as board slug.

Reserve inbox as board slug.

--- src/oc/storage/resources/board.clj
+++ src/oc/storage/resources/board.clj
@@ -68,7 +68,7 @@

 ;; ----- Board Slug -----

-(def reserved-slugs #{"create-board" "settings" "boards" "all-posts" "drafts" "must-see" "follow-ups"})
+(def reserved-slugs #{"create-board" "settings" "boards" "all-posts" "drafts" "must-see" "follow-ups" "inbox"})

 (declare list-boards-by-org)
 (defn taken-slugs