Fix ip

Fix ip

--- test/onyx/plugin/input_log_test.clj
+++ test/onyx/plugin/input_log_test.clj
@@ -28,7 +28,10 @@

 (def peer-group (onyx.api/start-peer-group peer-config))

-(def db-uri (str "datomic:free://" (butlast (slurp "eth0.ip")) ":4334/" (java.util.UUID/randomUUID)))
+(def db-uri (str "datomic:free://"
+                 (apply str (butlast (slurp "eth0.ip")))
+                 ":4334/"
+                 (java.util.UUID/randomUUID)))

 (def schema
   [{:db/id #db/id [:db.part/db]


bucket name is now a link to browser in workspace summary tab

--- src/cljs/org/broadinstitute/firecloud_ui/page/workspace/summary/tab.cljs
+++ src/cljs/org/broadinstitute/firecloud_ui/page/workspace/summary/tab.cljs
@@ -161,7 +161,12 @@
         [:div {} (get-in ws ["workspace" "createdBy"])]
         [:div {} (common/format-date (get-in ws ["workspace" "createdDate"]))])
       (style/create-section-header "Google Bucket")
-      (style/create-paragraph (get-in ws ["workspace" "bucketName"]))
+      (style/create-paragraph
+        [:a {:href (str "https://console.developers.google.com/storage/browser/" (get-in ws ["workspace" "bucketName"]) "/")
+              :title "Click to open the Google Cloud Storage browser for this bucket"
+              :style {:textDecoration "none" :color (:button-blue style/colors)}
+              :target "_blank"}
+         (get-in ws ["workspace" "bucketName"])])
       (style/create-section-header "Analysis Submissions")
       (style/create-paragraph
         (let [fail-count (->> submissions


Use flex display for summary tab

Use flex display for summary tab

--- src/cljs/org/broadinstitute/firecloud_ui/page/workspace/summary/tab.cljs
+++ src/cljs/org/broadinstitute/firecloud_ui/page/workspace/summary/tab.cljs
@@ -85,7 +85,7 @@
 (defn- render-sidebar [state props refs this ws owner? writer?]
   (let [locked? (get-in ws ["workspace" "isLocked"])
         status (common/compute-status ws)]
-    [:div {:style {:float "left" :width 290 :marginRight 40}}
+    [:div {:style {:flex "0 0 270px" :paddingRight 30}}
      [comps/StatusLabel {:text (str status
                                  (when (= status "Running")
                                    (str " (" (get-in ws ["workspaceSubmissionStats" "runningSubmissionsCount"]) ")")))
@@ -131,8 +131,8 @@

 (defn- render-main [state refs ws owner? submissions]
   (let [owners (ws "owners")]
-    [:div {}
-     [:div {:style {:display "inline-block"}}
+    [:div {:style {:flex "1 1 auto" :display "flex"}}
+     [:div {:style {:flex "1 1 50%"}}
       (style/create-section-header (str "Workspace Owner" (when (> (count owners) 1) "s")))
       (style/create-paragraph
         [:div {}
@@ -155,7 +155,7 @@
                 description description
                 :else [:span {:style {:fontStyle "oblique"}} "No description provided"])))
       (attributes/view-attributes state refs)]
-     [:div {:style {:float "right"}}
+     [:div {:style {:flex "1 1 50%" :paddingLeft 10}}
       (style/create-section-header "Created By")
       (style/create-paragraph
         [:div {} (get-in ws ["workspace" "createdBy"])]
@@ -169,8 +169,7 @@
                            count)]
           (str (count submissions) " Submissions"
             (when (pos? fail-count)
-              (str " (" fail-count " failed)")))))]
-     (common/clear-both)]))
+              (str " (" fail-count " failed)")))))]]))

 (react/defc Summary
@@ -189,7 +188,7 @@
                :else
                (let [owner? (= "OWNER" (workspace "accessLevel"))
                      writer? (or (= "WRITER" (workspace "accessLevel")) owner?)]
-                 [:div {:style {:margin "45px 25px"}}
+                 [:div {:style {:margin "45px 25px" :display "flex"}}
                   (render-overlays state props)
                   (render-sidebar state props refs this workspace owner? writer?)
                   (render-main state refs workspace owner? submissions)])))


Avoid situation where watch is lost and peer group is prevented from playing back log or rebooting.

--- src/onyx/log/zookeeper.clj
+++ src/onyx/log/zookeeper.clj
@@ -1,5 +1,5 @@
 (ns onyx.log.zookeeper
-  (:require [clojure.core.async :refer [chan >!! <!! close! thread alts!! offer!]]
+  (:require [clojure.core.async :refer [chan >!! <!! close! thread alts!! offer! timeout]]
             [com.stuartsierra.component :as component]
             [taoensso.timbre :refer [fatal warn info trace]]
             [onyx.log.curator :as zk]
@@ -265,25 +265,51 @@
     (catch KeeperException$NodeExistsException e
       (seek-to-new-origin! log ch))))

+;; Every x ms we poll the watched znode, in case our connection is incapable
+;; of firing an event.
+(def poll-znode-timeout-ms 15000)
+
+(defn receive-event [read-ch {:keys [conn opts prefix kill-ch] :as log} ch path position]
+  (loop [timeout-ch (timeout poll-znode-timeout-ms)
+         [_ active-ch] (alts!! [read-ch kill-ch timeout-ch])]
+    (cond (= active-ch kill-ch)
+          :killed
+
+          (= active-ch timeout-ch)
+          (if (zk/exists conn path)
+            (seek-and-put-entry! log position ch)
+            (let [timeout-ch (timeout poll-znode-timeout-ms)]
+              (recur timeout-ch (alts!! [read-ch kill-ch timeout-ch]))))
+
+          (= active-ch read-ch)
+          (do
+           (close! read-ch)
+           ;; Check that watch was triggered by found znode
+           ;; and not another event
+           (if (zk/exists conn path)
+             (seek-and-put-entry! log position ch)
+             :missing))
+
+          :else
+          (throw (ex-info "Subscriber should not be here." {:path path :position position})))))
+
+(defn znode [position]
+  (str "entry-" (pad-sequential-id position)))
+
+(defn znode-path [prefix position]
+  (str (log-path prefix) "/" (znode position)))
+
 (defn await-entry! [{:keys [conn opts prefix kill-ch] :as log} ch path position]
   (loop []
     (let [read-ch (chan 2)]
-      (zk/children conn (log-path prefix) :watcher (fn [_] (offer! read-ch true)))
-      ;; Log entry may have been added in between initial check and when we
-      ;; added the watch.
-      (when (zk/exists conn path)
-        (offer! read-ch true))
-      (let [[_ active-ch] (alts!! [read-ch kill-ch])]
-        (cond (= active-ch kill-ch)
-              :killed
-              (= active-ch read-ch)
-              (do
-               (close! read-ch)
-               ;; Requires one more check. Watch may have been triggered by a delete
-               ;; from a GC call.
-               (if (zk/exists conn path)
-                 (seek-and-put-entry! log position ch)
-                 (recur))))))))
+      (let [znodes (zk/children conn (log-path prefix) :watcher (fn [_] (offer! read-ch true)))
+            ;; in between the last check and setting up the watch, the znode was added
+            _ (when (get (set znodes) (znode position))
+                (offer! read-ch true))
+            event (receive-event read-ch log ch path position)]
+        (if (= event :missing)
+          (recur)
+          event)))))

 (defmethod extensions/subscribe-to-log ZooKeeper
   [{:keys [conn opts prefix kill-ch] :as log} ch]
@@ -296,13 +322,14 @@
          (>!! rets (merge (:replica origin) log-parameters))
          (close! rets)
          (loop [position starting-position]
-           (let [path (str (log-path prefix) "/entry-" (pad-sequential-id position))
+           (let [path (znode-path prefix position)
                  new-position (if (zk/exists conn path)
                                 (seek-and-put-entry! log position ch)
                                 (await-entry! log ch path position))]
              (when-not (= new-position :killed)
-               (assert (integer? new-position) new-position)
-               (recur new-position)))))
+               (do
+                (assert (integer? new-position) new-position)
+                (recur new-position))))))
        (catch java.lang.IllegalStateException e
          (trace e)
          ;; Curator client has been shutdown, pass exception along


adjust indices for having a single name

adjust indices for having a single name

--- test/vip/data_processor/db/translations/v5_1/states_postgres_test.clj
+++ test/vip/data_processor/db/translations/v5_1/states_postgres_test.clj
@@ -23,8 +23,8 @@
        out-ctx
        "st51" "VipObject.0.State.5.id"
        "ea40133" "VipObject.0.State.5.ElectionAdministrationId.0"
-       "poll001 poll010 poll100" "VipObject.0.State.5.PollingLocationIds.4"
+       "poll001 poll010 poll100" "VipObject.0.State.5.PollingLocationIds.3"
        "st42" "VipObject.0.State.6.id"
-       "Colorado" "VipObject.0.State.6.Name.3"
+       "Colorado" "VipObject.0.State.6.Name.2"
        "ocd-id" "VipObject.0.State.6.ExternalIdentifiers.1.ExternalIdentifier.0.Type.0"
        "ocd-division/country:us/state:co" "VipObject.0.State.6.ExternalIdentifiers.1.ExternalIdentifier.0.Value.1"))))


added a primay-email function to the user model

its copy/pasted from the backend. Just updated the keys to reflect what
we get back from the api.

--- src-cljs/frontend/models/user.cljs
+++ src-cljs/frontend/models/user.cljs
@@ -50,3 +50,8 @@
 (defn deauthorize-bitbucket [user]
   (-> user
       (assoc :bitbucket_authorized nil)))
+
+(defn primary-email [user]
+  (or (:selected_email user)
+      (:email user)
+      (last (:emails user))))


no need to check for liveness twice.

no need to check for liveness twice.

--- src/overtone/sc/buffer.clj
+++ src/overtone/sc/buffer.clj
@@ -206,7 +206,6 @@
   ([buf start len]
      (ensure-buffer-active! buf)
      (assert (buffer? buf))
-     (assert (= :live @(:status buf)))
      (let [buf-id  (:id buf)
            samples (float-array len)]
        (loop [n-vals-read 0]
@@ -461,7 +460,7 @@
 (defn buffer-id
   "Return the id of buffer b. Simply punts out to to-sc-id"
   [b]
-  (to-sc-id buffer-id))
+  (to-sc-id b))

 (defmulti buffer-size type)
 (defmethod buffer-size ::buffer [buf] (:size buf))


remove debug code

remove debug code

--- src/babel/english/writer.clj
+++ src/babel/english/writer.clj
@@ -33,15 +33,9 @@
 (defn translate [source-language-short-name]
   "generate English translations of all available expressions in source language."
   (rewrite-lexicon)
-  (let [source-expressions (read-all
-                            {:synsem {:sem {:pred :arrive}}}
-
-;                            {:synsem {:sem
-;
-;                                      {:tense :future, :pred :be-able-to, :subj {:mass false, :furniture false, :pred :tu, :place false, :drinkable false, :human true, :animate true, :speakable false, :activity false, :physical-object true, :buyable false, :legible false, :artifact false, :edible false, :part-of-human-body false}}
-;{:aspect :perfect, :tense :past, :subj {:mass false, :furniture false, :pred :luisa-and-i, :place false, :drinkable false, :human true, :animate true, :speakable false, :activity false, :physical-object true, :buyable false, :legible false, :artifact false, :gender :fem, :edible false, :part-of-human-body false}, :reflexive false, :pred :imparare}
-;                                      }}
-
+  (let [spec :top
+        ;; {:synsem {:sem {:pred :arrive}}}
+        source-expressions (read-all spec
                             source-language-short-name)]
     (.size (pmap (fn [source-expression]
                    (do (log/debug (str source-language-short-name ": " (:surface source-expression)))


basic logger framework done

basic logger framework done

--- src/basilisk/logger/core.clj
+++ src/basilisk/logger/core.clj
@@ -53,7 +53,7 @@
                          :output-fn  (fn [data] "NIL")
                          :fn         (fn [data] (println (:output data)))}}})

-(def ^:no-doc config (atom default-config))
+(def ^:no-doc configuration (atom default-config))

 (def levels
   "Default level priorities. If you use a level name
@@ -124,9 +124,9 @@
 (defmacro log
   "Log the given message as args with the given level."
   [level & args]
-  (doseq [[name appender-config] (:appenders @config)]
+  (doseq [[name appender-config] (:appenders @configuration)]
     (let [min-level (or (:min-level appender-config)
-                        (:min-level @config))
+                        (:min-level @configuration))
           metadata  (meta  &form)
           timestamp (timestamp)]

@@ -171,10 +171,11 @@
   `(log :seppuku ~@args))

 (defn initialize
+  "Initialize the logger system. If you provide any configuration
+  map to this function it will override the default one."
   ([]
-   (initialize nil nil)
-   [zookeeper]
-   (initialize zookeeper nil)
+   (initialize {}))

-   [zookeeper config]
-   (let [instance-name (:me zookeeper)]))
+  ([config]
+   (let [final-config (merge default-config config)]
+     (swap! configuration (fn [_] final-config))))


put back anti

put back anti

--- src/bluebell/bubble/core.clj
+++ src/bluebell/bubble/core.clj
@@ -17,6 +17,11 @@
   [x]
   (assert (bubble? x))
   (second x))
+
+(defn anti [x]
+  (if (bubble? x)
+    (break x)
+    (bubble x)))

 (defn protect-apply
   "Call f on the args if there is no bubble, else return the first bubble in the list."
@@ -38,10 +43,6 @@
         (if x# ~a ~b))))
   ([c a]
    `(protect-if ~c ~a nil)))
-
-(defn to-nil-or-vec [x]
-  (if (not (bubble? x))
-    [x]))

 (defn wrap-f? [f?]
   (fn [x] (if (f? x) [x])))


Release cljs 0.5.1

Release cljs 0.5.1

--- modules/cljs/project.clj
+++ modules/cljs/project.clj
@@ -1,11 +1,11 @@
 ;; Copyright © 2014 JUXT LTD.

-(defproject juxt.modular/cljs "0.5.0"
+(defproject juxt.modular/cljs "0.5.1"
   :description "A modular extension that provides support for ClojureScript building and Javascript serving"
   :url "https://github.com/juxt/modular/tree/master/modules/cljs"
   :license {:name "The MIT License"
             :url "http://opensource.org/licenses/MIT"}
-  :dependencies [[juxt.modular/bidi "0.5.0"]
-                 [juxt.modular/template "0.5.0"]
+  :dependencies [[juxt.modular/bidi "0.5.4"]
+                 [juxt.modular/template "0.6.0"]
                  [prismatic/schema "0.2.1"]
                  [thheller/shadow-build "0.5.0" :exclusions [org.clojure/clojurescript]]])


Adds google analytics code to base-layout.

--- src/cadence/views/common.clj
+++ src/cadence/views/common.clj
@@ -20,7 +20,19 @@
      (include-css "/css/bootstrap.min.css")
      (include-js (str "https://ajax.googleapis.com/ajax/libs/"
                       "jquery/1.7.2/jquery.min.js")
-                 "/js/jquery-1.7.2.min.js")]
+                 "/js/jquery-1.7.2.min.js")
+     [:script {:type "text/javascript"}
+      "var _gaq = _gaq || [];
+      _gaq.push(['_setAccount', 'UA-32354071-1']);
+      _gaq.push(['_trackPageview']);
+
+      (function() {
+      var ga = document.createElement('script');
+      ga.type = 'text/javascript'; ga.async = true;
+      ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+      var s = document.getElementsByTagName('script')[0];
+      s.parentNode.insertBefore(ga, s);
+      })();"]]
     [:body
      content]
     (include-js "/js/bootstrap.min.js")


Factor out build-pattern-matching-handler

--- src/io/aviso/rook/dispatcher.clj
+++ src/io/aviso/rook/dispatcher.clj
@@ -246,9 +246,38 @@
                    non-route-params)]
            (~verb-fn-sym ~@arglist))))))

+(defn build-pattern-matching-handler
+  [routes handlers middleware apply-middleware]
+  (let [req (gensym "request__")]
+    `(let [~@(apply concat middleware)
+           ~@(mapcat (fn [[handler-sym handler-map]]
+                       [handler-sym
+                        (handler-form
+                          apply-middleware req handler-sym handler-map)])
+               handlers)]
+       (fn rook-dispatcher# [~req]
+         (match (preparse-request ~req)
+           ~@(mapcat (fn [[route-spec handler-sym]]
+                       (let [{:keys [route-params schema]}
+                             (get handlers handler-sym)]
+                         [route-spec
+                          `(let [route-params#
+                                 ~(zipmap
+                                    (map keyword route-params)
+                                    route-params)]
+                             (~handler-sym
+                               (-> ~req
+                                 (assoc :route-params route-params#)
+                                 ~@(if schema
+                                     [`(assoc-in [:rook :metadata :schema]
+                                         ~schema)]))))]))
+               routes)
+           :else nil)))))
+
 (def dispatch-table-compilation-defaults
   {:emit-fn             eval
-   :apply-middleware-fn `apply-middleware-sync})
+   :apply-middleware-fn `apply-middleware-sync
+   :build-handler-fn    build-pattern-matching-handler})

 (defn compile-dispatch-table
   "Compiles the dispatch table into a Ring handler.
@@ -263,36 +292,12 @@
      (let [options          (merge dispatch-table-compilation-defaults options)
            emit-fn          (:emit-fn options)
            apply-middleware (:apply-middleware-fn options)
-
-           req (gensym "request__")
+           build-handler    (:build-handler-fn options)

            {:keys [routes handlers middleware]}
            (analyse-dispatch-table dispatch-table)]
        (emit-fn
-         `(let [~@(apply concat middleware)
-                ~@(mapcat (fn [[handler-sym handler-map]]
-                            [handler-sym
-                             (handler-form
-                               apply-middleware req handler-sym handler-map)])
-                    handlers)]
-            (fn rook-dispatcher# [~req]
-              (match (preparse-request ~req)
-                ~@(mapcat (fn [[route-spec handler-sym]]
-                            (let [{:keys [route-params schema]}
-                                  (get handlers handler-sym)]
-                              [route-spec
-                               `(let [route-params#
-                                      ~(zipmap
-                                         (map keyword route-params)
-                                         route-params)]
-                                  (~handler-sym
-                                    (-> ~req
-                                      (assoc :route-params route-params#)
-                                      ~@(if schema
-                                          [`(assoc-in [:rook :metadata :schema]
-                                              ~schema)]))))]))
-                    routes)
-                :else nil)))))))
+         (build-handler routes handlers middleware apply-middleware)))))

 #_
 (defn compile-dispatch-table


something left

something left

--- generateme/home.clj
+++ generateme/home.clj
@@ -36,7 +36,7 @@
                                                  (p/filter-channels p/normalize-filter false
                                                                     (g/blend-machine p4 p1 b)))))

-(quick-bench (p/filter-channels p/normalize false p1))
+(quick-bench (p/filter-channels p/dilate-filter false p1))

 (core/with-canvas canvas
   (core/image (o/render-rgb-scanlines (@canvas 1))))


Adding require to bootstrap

Adding require to bootstrap

--- src/kixi/datastore/bootstrap.clj
+++ src/kixi/datastore/bootstrap.clj
@@ -1,6 +1,7 @@
 (ns kixi.datastore.bootstrap
   (:require [kixi.datastore.system]
-           [com.stuartsierra.component :as component])
+            [com.stuartsierra.component :as component]
+            [taoensso.timbre :as log])
   (:gen-class))

 (defn -main


let alignment.

let alignment.

--- src/kixi/hecuba/api/entities.clj
+++ src/kixi/hecuba/api/entities.clj
@@ -111,12 +111,12 @@

 (defn filter-entities
   ([params roles store]
-     (let [query-string    (or (:q params) "*")
-           page-number     (or (:page params) 0)
-           page-size       (or (:size params) 20)
-           results         (search/search-entities query-string page-number page-size (:search-session store))
-           total_hits      (esr/total-hits results)
-           file-bucket     (-> store :s3 :file-bucket)
+     (let [query-string   (or (:q params) "*")
+           page-number    (or (:page params) 0)
+           page-size      (or (:size params) 20)
+           results        (search/search-entities query-string page-number page-size (:search-session store))
+           total_hits     (esr/total-hits results)
+           file-bucket    (-> store :s3 :file-bucket)
            parsed-results (parse-entities results nil nil roles file-bucket)]
        {:entities {:total_hits total_hits
                    :page       page-number
@@ -127,10 +127,10 @@
            page-size      (or (:size params) 20)
            shoulds        (should-terms allowed-programmes allowed-projects)
            filter-terms   (search-filter nil shoulds nil)
-           _ (log/debugf "Filter Terms: %s" filter-terms)
+           _              (log/debugf "Filter Terms: %s" filter-terms)
            results        (search/search-entities query-string filter-terms page-number page-size (:search-session store))
            total_hits     (esr/total-hits results)
-           file-bucket     (-> store :s3 :file-bucket)
+           file-bucket    (-> store :s3 :file-bucket)
            parsed-results (parse-entities results allowed-programmes allowed-projects roles file-bucket)]
        {:entities {:total_hits total_hits
                    :page       page-number
@@ -142,10 +142,10 @@
            shoulds        (should-terms allowed-programmes allowed-projects)
            must           (must-term :project_id project_id)
            filter-terms   (search-filter must shoulds nil)
-           _ (log/debugf "Filter Terms: %s" filter-terms)
+           _              (log/debugf "Filter Terms: %s" filter-terms)
            results        (search/search-entities query-string filter-terms page-number page-size (:search-session store))
            total_hits     (esr/total-hits results)
-           file-bucket     (-> store :s3 :file-bucket)
+           file-bucket    (-> store :s3 :file-bucket)
            parsed-results (parse-entities results allowed-programmes allowed-projects roles file-bucket)]
        {:entities {:total_hits total_hits
                    :page       page-number


add a few docstrings

add a few docstrings

--- src/kixi/hecuba/api/profiles.clj
+++ src/kixi/hecuba/api/profiles.clj
@@ -620,11 +620,19 @@
     exploded-item))

 (defn extract-attribute [attr-key input]
+  "Extracts a hash-map containing a single key and its value from the input.
+  The key is expected to be a keyword, while input is supposed to be a hash-map
+  with strings as keys"
   (let [attr-name (name attr-key)
         attr-value (input attr-name)]
   {attr-key attr-value}))

 (defn extract-nested-item [attr input]
+  "Extracts a nested item from input, returning a hashmap with a single pair,
+  where the key is the nested item association name, and the value is a json
+  string representing all the attributes of the nested item.
+  attr is expected to be a hash-map with at least :name and :schema keys,
+  while input is expected to be a hash-map representing the profile, with strings as keys"
   (let [association-name   (:name   attr)
         association-schema (:schema attr)
         nested-item (->> association-schema
@@ -637,6 +645,7 @@
     {association-name nested-item}))

 (defn extract-associated-item [association-name association-schema input index]
+  "Extracts the item belonging to a 'has many' association from input, at position index."
   (->> association-schema
     (reduce
       (fn [associated-item associated-item-attr]
@@ -646,6 +655,11 @@
       {})))

 (defn extract-associated-items [attr input]
+  "Extracts a collection representing a 'has many' association from input.
+  It returns a list of hash-maps, each representing one of the items from
+  the association.
+  attr is expected to be a hash-map with at least :name and :schema keys,
+  while input is expected to be a hash-map representing the whole profile, with strings as keys"
   (let [association-name   (:name attr)
         association-schema (:schema attr)
         attribute-names    (doall (keys input))
@@ -657,6 +671,18 @@
     {association-name associated-items}))

 (defn parse-by-schema [input schema]
+  "Parses input according to schema, assuming it was shaped as a
+  'tall' CSV profile.
+  This means that the first column contains attribute names, and the
+  second column contains values. Attribute names are presented in
+  'exploded' format, in order to properly address associations and
+  nesting.
+  Example:
+
+  attribute type | attribute name              | exploded name              |
+  standaed       | timestamp                   | timestamp                  |
+  nested item    | profile_data, bedroom_count | profile_data_bedroom_count |
+  association    | storeys, first storey_type  | storeys_0_storey_type      |"
   (->> schema
        (reduce
          (fn [item attr]


+TODO

+TODO

--- src/babel/italiano/morphology.cljc
+++ src/babel/italiano/morphology.cljc
@@ -107,7 +107,8 @@

 (declare get-string)

-;; TODO: this is an overly huge method that needs to be rewritten to be easier to understand and maintain.
+;; TODO: this is an overly huge method that needs to be
+;; reimplemented: instead, add a ':g' to: babel.italiano.morphology.nouns/patterns.
 (defn get-string-1 [word]
   (let [person (get-in word [:agr :person])
         number (get-in word [:agr :number])]


Fix index creation

Fix index creation

--- src/clj/clojuredocs/main.clj
+++ src/clj/clojuredocs/main.clj
@@ -29,30 +29,42 @@
     (println)
     (System/exit -1)))

-(defn add-indexes! []
-  (mon/add-index! :examples [:var
-                             :deleted-at
-                             :author.login :author.account-source
-                             :editors.login :editors.account-source])
-  (mon/add-index! :namespaces [:name])
-  (mon/add-index! :see-alsos [:from-var.name :from-var.ns :from-var.library-url
-                              :to-var.ns :to-var.name :to-var.library-url
-                              :account.login :account.account-source])
-  (mon/add-index! :libraries [:namespaces])
-  (mon/add-index! :notes [:var.ns :var.name :var.library-url
-                          :account.login :account.account-source])
+(defn add-indexes-to-coll! [coll ks]
+  (doseq [k ks]
+    (mon/add-index! :examples [k])))

-  (mon/add-index! :legacy-var-redirects [:function-id
-                                         :editor.login :editor.account-source])
+(defn add-all-indexes! []
+  (add-indexes-to-coll!
+    :examples [:var :deleted-at
+               :author.login :author.account-source
+               :editors.login :editors.account-source])

-  (mon/add-index! :users [:login :account-source])
+  (add-indexes-to-coll! :namespaces [:name])

-  (mon/add-index! :migrate-users [:email :migraion-key]))
+  (add-indexes-to-coll!
+    :see-alsos [:from-var.name :from-var.ns :from-var.library-url
+                :to-var.ns :to-var.name :to-var.library-url
+                :account.login :account.account-source])
+
+  (add-indexes-to-coll! :libraries [:namespaces])
+
+  (add-indexes-to-coll!
+    :notes [:var.ns :var.name :var.library-url
+            :account.login :account.account-source])
+
+  (add-indexes-to-coll!
+    :legacy-var-redirects [:function-id
+                           :editor.login :editor.account-source])
+
+  (add-indexes-to-coll! :users [:login :account-source])
+
+  (add-indexes-to-coll! :migrate-users [:email :migraion-key]))
+

 (defn start [{:keys [port mongo-url entry] :as opts}]
   (report-and-exit-on-missing-env-vars!)
   (mon/set-connection! (mon/make-connection mongo-url))
-  #_(add-indexes!)
+  (add-all-indexes!)
   (let [stop-server (start-http-server entry
                       {:port port :join? false})]
     (println (format "Server running on port %d" port))


More deep map config merging

More deep map config merging

--- src/clj/pinkgorilla/core.clj
+++ src/clj/pinkgorilla/core.clj
@@ -54,13 +54,7 @@
 (defn run-gorilla-server
   [conf]
   (info "Got conf " conf)
-  ; get configuration information from parameters
-  (let [default-config  (load-edn (io/resource "pink-gorilla.edn"))
-        custom-config (if-let [rt-config-file (:runtime-config conf)]
-                        (load-edn (io/file rt-config-file))
-                        {})
-        runtime-config (deep-merge default-config custom-config)
-        version (or (:version conf) "develop")
+  (let [version (or (:version conf) "develop")
         webapp-requested-port (or (:port conf) 0)
         ip (or (:ip conf) "127.0.0.1")
         nrepl-requested-port (or (:nrepl-port conf) 0)      ;; auto-select port if none requested
@@ -68,6 +62,21 @@
         routes (if nrepl-host
                  "pinkgorilla.route/remote-repl-handler"
                  "pinkgorilla.route/default-handler")
+        default-config  (load-edn (io/resource "pink-gorilla.edn"))
+        custom-config (if-let [rt-config-file (:runtime-config conf)]
+                        (load-edn (io/file rt-config-file))
+                        {})
+        other-config {:routes          routes
+                      :nrepl-port      nrepl-requested-port
+                      :nrepl-host      (:nrepl-host conf)
+                      :nrepl-port-file (io/file (or (:nrepl-port-file conf) ".nrepl-port"))
+                      :server-port     webapp-requested-port
+                      ;; TODO bringing the websockets in is a little dirty for now
+                      :jetty-options   {:websockets {"/repl" (ws-relay/ws-processor route/nrepl-handler)}}
+                      :ip              ip}
+        merged-config (deep-merge default-config
+                                  custom-config
+                                  other-config)
         gorilla-port-file (io/file (or (:gorilla-port-file conf) ".gorilla-port"))
         ;; project (or (:project conf) {})
         ;; keymap (or (:keymap (:gorilla-options conf)) {})
@@ -77,15 +86,7 @@
     ;; (println "Using project" project)
     ;; asynchronously check for updates
     ;; (version/check-for-update version)
-    (let [s (sys/start (merge runtime-config
-                              {:routes          routes
-                               :nrepl-port      nrepl-requested-port
-                               :nrepl-host      (:nrepl-host conf)
-                               :nrepl-port-file (io/file (or (:nrepl-port-file conf) ".nrepl-port"))
-                               :server-port     webapp-requested-port
-                               ;; TODO bringing the websockets in is a little dirty for now
-                               :jetty-options   {:websockets {"/repl" (ws-relay/ws-processor route/nrepl-handler)}}
-                               :ip              ip}))
+    (let [s (sys/start merged-config)
           server (-> s (get-in [:server :jetty]))
           webapp-port (-> server .getConnectors (get 0) .getLocalPort)
           ;; webapp-port (-> s (get-in [:server :httpkit]) .getPort)


data export translations

data export translations

--- src/clj/salava/user/data.clj
+++ src/clj/salava/user/data.clj
@@ -466,13 +466,12 @@
                                                                   [:chunk (or (get-in e [:info :object_name]) "-")]"\n"
                                                                   (if (contains? (:info e) :message)
                                                                     [:chunk {:style :italic}(or (get-in e [:info :message :message]) "-")])]]
-                                                         [:cell #_(or (case (:type e)
-                                                                      "page" (t (keyword (str "social/Emailpage" (:type e))) ul)
-                                                                      "badge" (t (keyword (str "social/Emailbadge" (:type e))) ul)
-                                                                      "user" (lower-case (t (keyword (str "social/User" (:type e)))) ul)
-                                                                      "ticket" (t (keyword (str "social/ticket" (:type e))) ul)
-                                                                      "admin" (lower-case (t (keyword (str "admin/Admin" (:type e)))) ul)
-                                                                      "-") "-")]
+                                                         [:cell (cond
+                                                                  (= "page" (:type e)) (t :social/Emailpage ul)
+                                                                  (= "badge" (:type e)) (t :social/Emailbadge ul)
+                                                                  (= "user" (:type e)) (lower-case (t :social/User ul))
+                                                                  (= "admin" (:type e)) (lower-case (t :admin/Admin ul))
+                                                                  :else "-")]
                                                          [:cell (date-from-unix-time (long (* 1000 (:ctime e))) "date")]
                                                          ])))
                                               ])]


cljs token claims support

cljs token claims support

--- src/cljc/swarmpit/token.cljc
+++ src/cljc/swarmpit/token.cljc
@@ -7,7 +7,11 @@
                [buddy.sign.jwt :as jwt]
                [clj-time.core :refer [now plus days]]]
         :cljs [[clojure.string :as str]
+               [cognitect.transit :as t]
+               [clojure.walk :refer [keywordize-keys]]
                [goog.crypt.base64 :as b64]])))
+
+(def r (t/reader :json))

 (defn- token-value
   [token]
@@ -60,6 +64,16 @@
        (basic base64))))

 #?(:cljs
+   (defn decode-jwt
+     [token]
+     (keywordize-keys
+       (t/read r
+               (-> (token-value token)
+                   (clojure.string/split #"\.")
+                   (second)
+                   (b64/decodeString))))))
+
+#?(:cljs
    (defn generate-basic
      [username password]
      (let [credentials (credentials username password)


fix the graphics

fix the graphics

--- src/cljs/tictactoe/core.cljs
+++ src/cljs/tictactoe/core.cljs
@@ -13,7 +13,7 @@
   (into {}
     (for [x (range board-size)
           y (range board-size)]
-      [[x y] :cell/cross]
+      [[x y] :cell/empty]
       )))

 (defonce app-state
@@ -46,16 +46,21 @@
   [[x y] [dx dy]]
   [:line {:x1 x :y1 y
           :x2 (+ x dx) :y2 (+ y dy)
-          :fill "none" :stroke-width 0.03 :stroke "red"}
+          :fill "none" :stroke-width 0.04 :stroke "red"}
    ])

 (defmethod render-cell :cell/cross
   [_ x y]
   [:g
-   [draw-cross-line [x y] [1 1]]
-   [draw-cross-line [x (inc y)] [1 -1]]
+   [draw-cross-line [(+ x 0.05) (+ y 0.05)] [0.9 0.9]]
+   [draw-cross-line [(+ x 0.05) (+ y 0.95)] [0.9 -0.9]]
    ])

+(defn render-board-cell
+  [app-state x y]
+  (render-cell
+    (get (:board app-state) [x y])
+    x y))

 (defn tictactoe
   []
@@ -65,9 +70,9 @@
      [:svg.board
       {:view-box (str "0 0 " board-size " " board-size)
        :style {:max-height "500px"}}]
-     (for [i (range board-size)
-           j (range board-size)]
-       [render-cell (get (:board @app-state) [i j]) i j]
+     (for [x (range board-size)
+           y (range board-size)]
+       [render-board-cell @app-state x y]
        ))
    ])


Stub out Raven (Sentry) if it's not defined

--- src/cljs/zetawar/router.cljs
+++ src/cljs/zetawar/router.cljs
@@ -3,10 +3,16 @@
    [cljs.core.async :refer [<! >! chan offer!]]
    [cljsjs.raven]
    [datascript.core :as d]
+   [goog.object :as gobj]
    [taoensso.timbre :as log]
    [zetawar.players :as players])
   (:require-macros
    [cljs.core.async.macros :refer [go go-loop]]))
+
+(when-not (exists? js/Raven)
+  (let [stub #js {"captureMessage" #() "captureException" #()}
+        global (if (exists? js/window) js/window js/global)]
+    (gobj/set global "Raven" stub)))

 (defmulti handle-event (fn [ev-ctx [ev-type & _]] ev-type))


Provide tuple schema field parameters via metadata.

--- src/clojure/abracad/avro.clj
+++ src/clojure/abracad/avro.clj
@@ -98,8 +98,9 @@
      {:name name, :type "record",
       :abracad.reader "vector",
       :fields (vec (map-indexed (fn [i type]
-                                  {:name (str "field" i),
-                                   :type type})
+                                  (merge {:name (str "field" i),
+                                          :type type}
+                                         (meta type)))
                                 types))}))

 (defn ^:private order-ignore


CMR-3571 Addresses PR comments

CMR-3571 Addresses PR comments

--- access-control-app/int_test/cmr/access_control/int_test/acl_crud_test.clj
+++ access-control-app/int_test/cmr/access_control/int_test/acl_crud_test.clj
@@ -64,14 +64,28 @@
     (is (re-find #"^ACL.*" (:concept_id resp)))
     (is (= 1 (:revision_id resp)))))

+;; The following test covers creating simple but valid catalog item identity. We permit collection_applicable false
+;; and collection_identifier when granule_applicable is true.
+
 (deftest create-catalog-item-identity-acl-test
   (is (= 1 (:revision_id
              (ac/create-acl (u/conn-context)
                             {:group_permissions [{:user_type "guest"
                                                   :permissions ["read"]}]
-                             :catalog_item_identity {:name "Catalog Item Identity Without Collection Identifier"
+                             :catalog_item_identity {:name "Catalog Item Identity 1"
                                                      :provider_id "PROV1"
                                                      :collection_identifier {:access_value {:include_undefined_value true}}
+                                                     :collection_applicable true
+                                                     :granule_applicable false}}
+                            {:token (transmit-config/echo-system-token)}))))
+  (is (= 1 (:revision_id
+             (ac/create-acl (u/conn-context)
+                            {:group_permissions [{:user_type "guest"
+                                                  :permissions ["read"]}]
+                             :catalog_item_identity {:name "Catalog Item Identity 2"
+                                                     :provider_id "PROV1"
+                                                     :collection_identifier {:access_value {:include_undefined_value true}}
+                                                     :collection_applicable false
                                                      :granule_applicable true}}
                             {:token (transmit-config/echo-system-token)})))))

@@ -331,15 +345,7 @@
           "System identity target grantable permission check"
           #"\[system-identity\] ACL cannot have \[read\] permission for target \[TAG_GROUP\], only \[create, update, delete\] are grantable"
           (assoc-in (assoc-in system-acl [:group_permissions 0 :permissions] ["create" "read" "update" "delete"])
-                    [:system_identity :target] "TAG_GROUP")
-
-          "collection_applicable or granule_applicable must be true when collection_identifier is specified"
-          #"when catalog_item_identity is specified, one or both of collection_applicable or granule_applicable must be true"
-          {:group_permissions [{:user_type "guest"
-                                :permissions ["read"]}]
-           :catalog_item_identity {:name "Catalog Item Identity Without Collection Identifier"
-                                   :provider_id "PROV1"
-                                   :collection_identifier {:access_value {:include_undefined_value true}}}})
+                    [:system_identity :target] "TAG_GROUP"))

     (testing "Acceptance criteria: I receive an error if creating an ACL with invalid JSON"
       (is


Pulling predicate namespace changes in from feature/deliver

--- src/clj/forma/hadoop/predicate.clj
+++ src/clj/forma/hadoop/predicate.clj
@@ -4,6 +4,8 @@
         [forma.reproject :only (pixels-at-res)])
   (:require [forma.utils :as u]
             [forma.schema :as schema]
+            [forma.reproject :as r]
+            [forma.thrift :as thrift]
             [forma.hadoop.io :as io]
             [clojure.string :as s]
             [cascalog.ops :as c]
@@ -118,44 +120,41 @@
       (mangle #"," ?textline :> ?country ?admin-s)
       (u/strings->floats ?admin-s :> ?admin)))

-(def blossom-chunk
-  "Returns a Cascalog predicate macro that emits MODIS pixel values for each
-  element in a DataChunk array.
-
-  A DataChunk Thrift object is composed with a DataValue Thrift object which is
-  an array of pixel values representing values at different periods. This query
-  emits a tuple for each element in that array.
-
-  Input variables:
-    ?chunk - A DataChunk Thrift object.
-
-  Output variables:
-    ?s-res - The spatial resolution in meters as a string.
-    ?mod-h - The MODIS tile coordinate column.
-    ?mod-v - The MODIS tile coordinate row.
-    ?sample - The MODIS tile pixel row.
-    ?line - The MODIS tile pixel column.
-    ?val - The pixel value
+(defn blossom-chunk
+  [tile-chunk-src]
+  "Return a Cascalog predicate macro that takes a MODIS tile chunk and emits
+  all MODIS pixel coordinates.

   Example usage:
-
-    (let [src [[dc]]] ;; dc is a DataChunk Thrift object
+   (use `forma.playground)
+   (let [src tile-chunk-tap]
          (??<-
-           [?s-res ?mod-h ?mod-v ?sample ?line ?val]
-           (src ?chunk)
-           (blossom-chunk ?chunk :> ?s-res ?mod-h ?mod-v ?sample ?line ?val)))"
-  (<- [?chunk :> ?s-res ?mod-h ?mod-v ?sample ?line ?val]
-      (index ?static-chunk :> ?pix-idx ?val)
-      (schema/chunk-locval ?chunk :> ?loc ?static-chunk)
-      (schema/chunkloc->pixloc ?loc ?pix-idx :> ?pixloc)
-      (schema/pixel-prop-location ?pixloc :> ?pixlocval)
-      (schema/unpack-pixel-location ?pixlocval :> ?s-res ?mod-h ?mod-v ?sample ?line)))
-
-(defn chunkify [chunk-size]
-  (<- [?dataset !date ?s-res ?t-res ?mh ?mv ?chunkid ?chunk :> ?datachunk]
-      (schema/chunk-location ?s-res ?mh ?mv ?chunkid chunk-size :> ?location)
-      (schema/mk-data-value ?chunk :> ?data-val)
-      (schema/chunk-value ?dataset ?t-res !date ?location ?data-val :> ?datachunk)))
+          [?res ?h ?v ?sample ?line ?val]
+          (src ?tile-chunk)
+          (blossom-chunk ?tile-chunk :> ?res ?h ?v ?sample ?line ?val)))"
+  (<- [?s-res ?h ?v ?sample ?line ?val]
+      (tile-chunk-src ?tile-chunk)
+      (thrift/unpack ?tile-chunk :> _ ?tile-loc ?data _ _)
+      (thrift/unpack* ?data :> ?data-value)
+      (index ?data-value :> ?pixel-idx ?val)
+      (thrift/unpack ?tile-loc :> ?s-res ?h ?v ?id ?size)
+      (r/tile-position ?s-res ?size ?id ?pixel-idx :> ?sample ?line)))
+
+(defn chunkify
+  "Return a Cascalog predicate macro that emits a tile DataChunk of a specified size.
+
+  Example usage:
+   (use `forma.playground)
+   (let [src [[\"fire\" nil \"500\" \"16\" 8 0 0 [1 1 1 1]]]
+         query (chunkify 24000)]
+         (??<-
+          [?tile-chunk]
+          (src ?name !date ?s-res ?t-res ?h ?v ?id ?val)
+          (query ?name !date ?s-res ?t-res ?h ?v ?id ?val :> ?tile-chunk)))"
+  [size]
+  (<- [?name !date ?s-res ?t-res ?h ?v ?id ?val :> ?tile-chunk]
+      (thrift/ModisChunkLocation* ?s-res ?h ?v ?id size :> ?tile-loc)
+      (thrift/DataChunk* ?name ?tile-loc ?val ?t-res !date :> ?tile-chunk)))

 (def break
   "Takes a source of textlines representing rows of a gridded
@@ -194,6 +193,8 @@
     res - The spatial resolution.
     tileseq - Map of country ISO keywords to MODIS tiles (see: forma.source.tilesets)"
   [tmp-path res tileseq]
+  {:pre [(coll? tileseq)
+         (string? res)]}
   (let [tap (:sink (hfs-seqfile tmp-path))]
     (with-open [^TupleEntryCollector collector
                 (-> (hadoop/job-conf (conf/project-conf))
@@ -201,7 +202,7 @@
                     (.openTapForWrite tap))]
       (doseq [item (for [[h v]  tileseq
                          sample (range (pixels-at-res res))
-                         line   (range (pixels-at-res res))]
+                         line (range (pixels-at-res res))]
                      [h v sample line])]
         (.add collector (Util/coerceToTuple item))))
     (name-vars tap ["?mod-h" "?mod-v" "?sample" "?line"])))


Avoid goofy printing problems on reader errors

e.g. with missing reader literals

closes #80

--- src/clj/reply/eval_modes/nrepl.clj
+++ src/clj/reply/eval_modes/nrepl.clj
@@ -58,15 +58,20 @@
     (reset! current-command-id nil)
     @current-ns))

-(defn repl-read [request-prompt request-exit]
+(defn repl-read [request-prompt request-exit read-error]
   (if-let [start-or-end ({:line-start request-prompt :stream-end request-exit}
                          (clojure.main/skip-whitespace *in*))]
-      [[] start-or-end]
+    [[] start-or-end]
+    (try
       (let [input (clojure.core/read *in*)]
         (clojure.main/skip-if-eol *in*)
         (let [raw-input (.getRawInput *in*)]
           (.clearRawInput *in*)
-          [raw-input input]))))
+          [raw-input input]))
+      (catch Exception e
+        (clojure.main/skip-if-eol *in*)
+        (.clearRawInput *in*)
+        [e read-error]))))

 (defn run-repl
   ([connection] (run-repl connection nil))
@@ -77,18 +82,18 @@
         (flush)
         (let [eof (Object.)
               request-prompt (Object.)
+              read-error (Object.)
               [raw-input read-result]
                 (try
                   (binding [*ns* (eval-state/get-ns)]
-                    (repl-read request-prompt eof))
-                  (catch Exception e
-                    (if (= (.getMessage e) "EOF while reading")
-                      eof
-                      (prn e))))]
+                    (repl-read request-prompt eof read-error)))]
           (cond (reply.exit/done? eof read-result)
                   nil
                 (= request-prompt read-result)
                   (recur ns)
+                (= read-error read-result)
+                  (do (println raw-input) ; where we stash the read exception
+                      (recur ns))
                 :else
                   (recur (execute-with-client
                            connection


lets try that again ...

lets try that again ...

--- src/clj/shadow/devtools/server.clj
+++ src/clj/shadow/devtools/server.clj
@@ -197,7 +197,7 @@

     ;; :server only code recompile means client should not auto reload
     (when (or (true? js-reload)
-              (not= :server js-reload))
+              (and js-reload (not= :server js-reload)))
       (when (seq modified)
         (let [js-sources
               (->> modified


one more view -> (name view)

one more view -> (name view)

--- src/cljs/hatti/views/dataview.cljs
+++ src/cljs/hatti/views/dataview.cljs
@@ -105,5 +105,5 @@
           (for [{:keys [component view]} dataviews]
             [:div {:class (str "tab-page " (name view) "-page")
                    :style {:display (view->display view)}}
-             [:div.tab-content {:id (str "tab-content" view)}
+             [:div.tab-content {:id (str "tab-content" (name view))}
               (om/build component app-state {:opts opts})]])])))))


improve timestamp readability

improve timestamp readability

--- src/cljs/link_collective/view.cljs
+++ src/cljs/link_collective/view.cljs
@@ -111,7 +111,11 @@
   [comment]
   {[:.comment-text] (content (:content comment))
    [:.comment-author] (content (:author comment))
-   [:.comment-ts] (content (str (:ts comment)))})
+   [:.comment-ts] (content
+                 (let [time-diff (- (js/Date.) (:ts comment))]
+                   (if (> time-diff 3600000)
+                     (str (Math/round (/ time-diff 3600000)) " hours ago")
+                     (str (Math/round (/ time-diff 60000)) " minutes ago"))))})

 (defsnippet topiq "templates/topiqs.html" [:.topiq]
@@ -125,7 +129,6 @@
      (fn [e]
        ;; will cleanup this mess and migrate some of it into view state
        (let [selected-entries (om/get-state owner :selected-entries)]
-         (.log js/console (str selected-entries))
          (if (some #{(:id topiq)} selected-entries)
            (do
              (dommy/remove-class! (sel1 (str "#topiq-" (:id topiq))) :selected-entry)
@@ -152,7 +155,11 @@
     (set-attr "href" (str "#comments-" (:id topiq))))
    [:.topiq-text] (content (:title topiq))
    [:.topiq-author] (content (:author topiq))
-   [:.topiq-ts] (content (str (:ts topiq)))
+   [:.topiq-ts] (content
+                 (let [time-diff (- (js/Date.) (:ts topiq))]
+                   (if (> time-diff 3600000)
+                     (str (Math/round (/ time-diff 3600000)) " hours ago")
+                     (str (Math/round (/ time-diff 60000)) " minutes ago"))))
    [:.topiq-comments] (set-attr :id (str "comments-" (:id topiq)))
    [:.comments] (content (map topiq-comment (get-comments (:id topiq) app)))})

@@ -172,6 +179,7 @@
             (js/alert e))))))

+
 (deftemplate topiqs "templates/topiqs.html"
   [app owner]
   {[:.list-group] (content (map #(topiq % app owner) (get-topiqs app)))


Warn when making identical AJAX calls in debug environment (no JIRA) (#1019)

--- src/cljs/main/broadfcui/utils.cljs
+++ src/cljs/main/broadfcui/utils.cljs
@@ -116,16 +116,23 @@
 ;; TODO - make this unnecessary
 (def content-type=json {"Content-Type" "application/json"})

-(defn ajax [arg-map]
-  (let [url (:url arg-map)
-        on-done (:on-done arg-map)
-        method (if-let [method (:method arg-map)] (string/upper-case (name method)) "GET")
-        headers (:headers arg-map)
-        data (:data arg-map)
-        with-credentials? (:with-credentials? arg-map)
-        canned-response-params (when-not @use-live-data? (:canned-response arg-map))]
+(defonce ^:private recent-ajax-calls (atom #{}))
+(def ^:private double-call-threshold 2000)
+
+(defn ajax [{:keys [url on-done method headers data with-credentials? canned-response] :as arg-map}]
+  (let [method (if method (string/upper-case (name method)) "GET")
+        canned-response-params (when-not @use-live-data? canned-response)]
     (assert url (str "Missing url parameter: " arg-map))
     (assert on-done (str "Missing on-done callback: " arg-map))
+
+    (when (config/debug?)
+      (let [request (restructure method url data)]
+        (when (contains? @recent-ajax-calls request)
+          (js/console.warn (str "WARNING: repeated ajax calls to " method " " url
+                                (when data (str " with payload " data)))))
+        (swap! recent-ajax-calls conj request)
+        (js/setTimeout #(swap! recent-ajax-calls disj request) double-call-threshold)))
+
     (let [xhr (if-not canned-response-params
                 (js/XMLHttpRequest.)
                 (let [xhr (js-obj)]


clean spec

clean spec

--- src/cljs/triboard/logic/board.cljs
+++ src/cljs/triboard/logic/board.cljs
@@ -71,7 +71,11 @@
 ;; -----------------------------------------

 (s/def ::coord (set coordinates))
-(s/def ::board (s/every (s/every ::player/owner :count 11) :count 16))
+
+(s/def ::board
+  (s/every
+    (s/every ::player/owner :count height)
+    :count width))

 (s/fdef new-board
   :ret ::board)


add more logic to deleting playing track

--- src/cljs/western_music/lib/ui.cljs
+++ src/cljs/western_music/lib/ui.cljs
@@ -139,11 +139,15 @@
     (cond-> player
       (not= where max-index) (player-set-playing (q (inc where)) (:player/paused player)))))

-(defn player-dequeue-track [player track-id]
-  (let [q (remove-track (:player/queue player) track-id)
+(defn player-dequeue-track [{queue :player/queue :as player} track-id]
+  (let [index (track-index queue {:track/id track-id})
+        max-index (dec (count queue))
+        q (remove-track queue track-id)
+        currently-playing? (-> player :player/playing :track/id (= track-id))
         empty (zero? (count q))]
     (cond-> player
-      (-> player :player/playing :track/id (= track-id)) (player-forward)
+      (and currently-playing? (= index max-index)) (player-back)
+      (and currently-playing? (not= index max-index)) (player-forward)
       empty (assoc :player/playing nil)
       true (merge #:player{:queue q :paused empty}))))


Reorder commands to allow reloading again

--- src/clojure/nightcode/builders.clj
+++ src/clojure/nightcode/builders.clj
@@ -117,14 +117,13 @@
                       :center (s/config! console :id :build-console))
         ; create the actions for each button
         run! (fn [_]
+               (lein/run-project! process (ui/get-io! console) path)
                (when (lein/is-java-project? path)
-                 (reset! last-reload (System/currentTimeMillis)))
-               (lein/run-project! process (ui/get-io! console) path))
+                 (reset! last-reload (System/currentTimeMillis))))
         run-repl! (fn [_]
+                    (lein/run-repl-project! process (ui/get-io! console) path)
                     (when (not (lein/is-java-project? path))
-                      (reset! last-reload (System/currentTimeMillis)))
-                    (lein/run-repl-project! process (ui/get-io! console) path)
-                    (s/request-focus! (-> console .getViewport .getView)))
+                      (reset! last-reload (System/currentTimeMillis))))
         reload! (fn [_]
                   (if (lein/is-java-project? path)
                     (lein/run-hot-swap! (ui/get-io! console) path)


apply new parse changes

apply new parse changes

--- src/clojure/zensols/cisql/core.clj
+++ src/clojure/zensols/cisql/core.clj
@@ -17,24 +17,25 @@
     (println "Database subprotocols include:"
              (s/join ", " (spec/registered-names)))))

-(def ^:private version-info-command
+(def version-info-command
   {:description "Get the version of the application."
    :options [["-g" "--gitref"]]
    :app (fn [{refp :gitref} & args]
           (println cisql.version/version)
           (if refp (println cisql.version/gitref)))})

-(defn create-command-context []
-  {:command-defs '((:interactive zensols.cisql interactive interactive-command)
-                   (:describe zensols.cisql spec driver-describe-command)
-                   (:add zensols.cisql spec driver-add-command)
-                   (:purge zensols.cisql spec driver-user-registry-purge-command))
-   :single-commands {:version version-info-command}
-   :command-print-order [:interactive :describe :add :purge :version]
-   :print-help-fn print-help})
+(defn- create-action-context []
+  (parse/multi-action-context
+   '((:interactive zensols.cisql interactive interactive-command)
+     (:describe zensols.cisql spec driver-describe-command)
+     (:add zensols.cisql spec driver-add-command)
+     (:purge zensols.cisql spec driver-user-registry-purge-command))
+   :action-print-order [:interactive :describe :add :purge :version]
+   :version-option version-info-command
+   :print-help-fn print-help))

 (defn -main [& args]
   (lu/configure "cisql-log4j2.xml")
   (parse/set-program-name "cisql")
-  (let [command-context (create-command-context)]
-    (apply parse/process-arguments command-context args)))
+  (-> (create-action-context)
+      (parse/process-arguments args)))


Доработка компонента вывода графика

Доработка компонента вывода графика

--- radiolamp-6P3S/src/r6p3s/cpt/d3/chart_2.cljs
+++ radiolamp-6P3S/src/r6p3s/cpt/d3/chart_2.cljs
@@ -28,6 +28,7 @@
                                  y-label
                                  title
                                  description
+                                 x-value-as-num-fn
                                  ]
                           :or   {main-width  d3c/full-screen-width
                                  main-height 300
@@ -87,7 +88,8 @@
                       data]}       @app
               ;; Размерность x
               x-scale              (-> js/d3 .-time  .scale
-                                       (.domain (d3c/min-max #(-> % x-value-fn .getTime) min max data))
+                                       (.domain (d3c/min-max (or x-value-as-num-fn #(-> % x-value-fn .getTime))
+                                                             min max data))
                                        ;;(.domain (.extent js/d3 data :pdate))
                                        (.range #js [0 chart-width]))
               ;; Размерность y
@@ -228,7 +230,7 @@
                                           y-label))
                          (dom/g #js {:className "x axis" :transform (str "translate(0," chart-height ")")})
                          (dom/g #js {:className "charting pathes"})
+                         (dom/g #js {:className "x brush" :width chart-width :height chart-height})
                          (dom/g #js {:className "lines brush"}
                                 (dom/line #js {:className "brush-line-left"})
-                                (dom/line #js {:className "brush-line-right"}))
-                         (dom/g #js {:className "x brush" :width chart-width :height chart-height}))))))))
+                                (dom/line #js {:className "brush-line-right"})))))))))


bug #4381 - fixed regression in wallet qr code scanner caused by network updates

Signed-off-by: Igor Mandrigin <042dc4512fa3d391c5170cf3aa61e6a638f84342@mandrigin.ru>

--- src/status_im/ui/screens/wallet/choose_recipient/events.cljs
+++ src/status_im/ui/screens/wallet/choose_recipient/events.cljs
@@ -38,7 +38,7 @@
  :wallet/fill-request-from-url
  (fn [{{:keys [network] :as db} :db} [_ data]]
    (let [{:keys [view-id]}                db
-         current-chain-id                 (get-in constants/default-networks [network :raw-config :NetworkId])
+         current-chain-id                 (get-in constants/default-networks [network :config :NetworkId])
          {:keys [address chain-id] :as details} (extract-details data current-chain-id)
          valid-network?                   (boolean (= current-chain-id chain-id))]
      (cond-> {:db         db


[CS] Add valid types

[CS] Add valid types

--- src/vip/data_processor/validation/data_spec/value_format.clj
+++ src/vip/data_processor/validation/data_spec/value_format.clj
@@ -5,7 +5,7 @@
    :message "Invalid data type"})

 (def contest-election-type
-  {:check ["general" "primary" "run-off" "referendum"]
+  {:check ["general" "primary" "run-off" "referendum" "judge retention"]
    :message "Invalid election_type"})

 (def date
@@ -21,7 +21,7 @@
    :message "Invalid election_type"})

 (def electoral-district-type
-  {:check ["statewide" "state senate" "state house" "fire district" "congressional district" "school district"]
+  {:check ["statewide" "state senate" "state house" "fire district" "congressional district" "school district" "county"]
    :message "Invalid type"})

 (def email


Remove lein-standalone-repl workaround.

Remove lein-standalone-repl workaround.

This hasn't been an issue for a while.

--- opt/profiles.clj
+++ opt/profiles.clj
@@ -1,12 +1,3 @@
-{:user {:mirrors {"central" "http://s3pository.herokuapp.com/maven-central"
-                  ;; TODO: re-enable once clojars releases repo is up
-                  ;; "clojars" "http://s3pository.herokuapp.com/clojars"
-                  }
-        :aliases {"repl" "standalone-repl"}
-        :plugins [[lein-standalone-repl "0.1.5"]]}
- :production {:mirrors {"central" "http://s3pository.herokuapp.com/maven-central"
-                        ;; "clojars" "http://s3pository.herokuapp.com/clojars"
-                        }}
- :heroku {:mirrors {"central" "http://s3pository.herokuapp.com/maven-central"
-                    ;; "clojars" "http://s3pository.herokuapp.com/clojars"
-                    }}}
+{:user {:mirrors {"central" "http://s3pository.herokuapp.com/maven-central"}}
+ :production {:mirrors {"central" "http://s3pository.herokuapp.com/maven-central"}}
+ :heroku {:mirrors {"central" "http://s3pository.herokuapp.com/maven-central"}}}


S3pository for clojars only.

S3pository for clojars only.

--- opt/profiles.clj
+++ opt/profiles.clj
@@ -1,8 +1,5 @@
-{:user {:mirrors {#"central|clojars"
-                  "http://s3pository.herokuapp.com/clojure"}
+{:user {:mirrors {"clojars" "http://s3pository.herokuapp.com/clojure"}
         :aliases {"repl" "standalone-repl"}
         :plugins [[lein-standalone-repl "0.1.3"]]}
- :production {:mirrors {#"central|clojars"
-                        "http://s3pository.herokuapp.com/clojure"}}
- :heroku {:mirrors {#"central|clojars"
-                    "http://s3pository.herokuapp.com/clojure"}}}+ :production {:mirrors {"clojars" "http://s3pository.herokuapp.com/clojure"}}
+ :heroku {:mirrors {"clojars" "http://s3pository.herokuapp.com/clojure"}}}


Start the gui from within reply

Start the gui from within reply

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

--- src/scripts/conexp-clj.clj
+++ src/scripts/conexp-clj.clj
@@ -7,8 +7,6 @@
 ;; You must not remove this notice, or any other, from this software.

 (use 'clojure.tools.cli)
-(require 'conexp.contrib.gui)
-(require 'conexp.contrib.gui.repl-utils)
 (require '[reply.main :as reply])

 ;;
@@ -23,13 +21,16 @@
     (println doc)
     ;;
     (contains? options :gui)
-    (binding [conexp.contrib.gui.repl-utils/*main-frame*
-              (conexp.contrib.gui/gui :default-close-operation :exit)]
-      (reply/launch
-       {:custom-eval '(do
-                        (use 'conexp.main)
-                        (use 'clojure.repl)
-                        (require '[conexp.contrib.gui.repl-utils :as gui]))}))
+    (reply/launch
+     {:custom-eval '(do
+                      (use 'conexp.main)
+                      (use 'clojure.repl)
+                      (require '[conexp.contrib.gui.repl-utils :as gui])
+                      (require 'conexp.contrib.gui)
+                      (alter-var-root
+                       (var conexp.contrib.gui.repl-utils/*main-frame*)
+                       (fn [_]
+                         (conexp.contrib.gui/gui :default-close-operation :exit))))})
     ;;
     (contains? options :load)
     (do (when (not (options :load))


don't use a vec for the ui

don't use a vec for the ui

Signed-off-by: Chris Granger <5654cde260ae99bc4d30054171b8bcd902efd19a@gmail.com>

--- src/lt/objs/sidebar/command.cljs
+++ src/lt/objs/sidebar/command.cljs
@@ -275,9 +275,9 @@
                 :search ""
                 :init (fn [this opts]
                         (let [opts (merge {:size 100} opts)
-                              lis (vec (for [x (range (:size opts))]
-                                         (item this x)))]
-                          (object/merge! this (merge {:lis lis} opts))
+                              lis (for [x (range (:size opts))]
+                                         (item this x))]
+                          (object/merge! this (merge {:lis (vec lis)} opts))
                           [:div.filter-list
                            (input this)
                            [:ul


:bug: Fixes problem when drawing new shape

--- frontend/src/uxbox/main/ui/workspace/drawarea.cljs
+++ frontend/src/uxbox/main/ui/workspace/drawarea.cljs
@@ -301,7 +301,7 @@

 (mf/defc generic-draw-area
   [{:keys [shape zoom]}]
-  (let [{:keys [x y width height]} (geom/shape->rect-shape shape)]
+  (let [{:keys [x y width height]} (geom/transform-selrect nil shape)]
     (when (and x y)
       [:g
        [:& shapes/shape-wrapper {:shape shape}]


Improve tailing

Improve tailing

--- test/com/nomistech/clojure_the_language/c_920_io/tailing.clj
+++ test/com/nomistech/clojure_the_language/c_920_io/tailing.clj
@@ -56,9 +56,9 @@

 (fact (let [delay-ms        100
             sleep-ms        (+ delay-ms 10)
-            lines-s         [["a-1" "b-1" "c-1" "d-1" "e-1"]
-                             ["a-2" "b-2" "c-2" "d-2" "e-2"]
-                             ["a-3" "b-3" "c-3" "d-3" "e-3"]]
+            lines-s         [["I met" "her in" "a" "pool" "room"]
+                             ["Her" " name" "I" "didn't" "catch"]
+                             ["She" "looked" " like" "something" "special"]]
             f               (let [f (File. "test/_work-dir/plop.log")]
                               ;; Setting up some initial content makes things
                               ;; work as I expect; without this my first line
@@ -71,20 +71,8 @@
         (spit-lines-s f lines-s sleep-ms)
         (stop-tailer-and-channel t-and-c)
         (a/<!! result-ch)
-        => ["a-1"
-            "b-1"
-            "c-1"
-            "d-1"
-            "e-1"
-            "a-2"
-            "b-2"
-            "c-2"
-            "d-2"
-            "e-2"
-            "a-3"
-            "b-3"
-            "c-3"
-            "d-3"
-            "e-3"]))
+        => ["I met" "her in" "a" "pool" "room"
+            "Her" " name" "I" "didn't" "catch"
+            "She" "looked" " like" "something" "special"]))

 ;; TODO Check that bug: https://issues.apache.org/jira/browse/IO-399


Added linesbefore/after matching in clojure

--- clojure/cljsearch/src/cljsearch/searcher.clj
+++ clojure/cljsearch/src/cljsearch/searcher.clj
@@ -177,6 +177,27 @@
         search-results (search-binary-string contents settings)
         with-file-results (map #(assoc-in % [:file] f) search-results)]
     (doseq [r with-file-results] (save-search-result r))))
+
+(defn matches-any-pattern [s pp]
+  (some #(re-find % s) pp))
+
+(defn any-matches-any-pattern [ss pp]
+  (some #(not (= % nil)) (map #(matches-any-pattern % pp) ss)))
+
+(defn linesmatch [lines inpatterns outpatterns]
+  (and
+    (or
+      (empty? inpatterns)
+      (any-matches-any-pattern lines inpatterns))
+    (or
+      (empty? outpatterns)
+      (not (any-matches-any-pattern lines outpatterns)))))
+
+(defn linesbefore-match [linesbefore settings]
+  (linesmatch linesbefore (:in-linesbeforepatterns settings) (:out-linesbeforepatterns settings)))
+
+(defn linesafter-match [linesafter settings]
+  (linesmatch linesafter (:in-linesafterpatterns settings) (:out-linesafterpatterns settings)))

 (defn get-newline-indices [s]
   (map first
@@ -238,10 +259,19 @@
                        line
                        linesbefore
                        linesafter)]
-          (if (:firstmatch settings)
-            [result]
-            (concat [result] (search-multiline-string-for-pattern s m
-              endmatchindex startlineindices endlineindices settings)))))
+          (if
+            (and
+              (or
+                (= (:linesbefore settings) 0)
+                (linesbefore-match linesbefore settings))
+              (or
+                (= (:linesafter settings) 0)
+                (linesafter-match linesafter settings)))
+            (if (:firstmatch settings)
+              [result]
+              (concat [result] (search-multiline-string-for-pattern s m
+                endmatchindex startlineindices endlineindices settings)))
+            [])))
       [])))

 (defn search-multiline-string [s settings]
@@ -253,27 +283,6 @@
         search-results (search-multiline-string contents settings)
         with-file-results (map #(assoc-in % [:file] f) search-results)]
     (doseq [r with-file-results] (save-search-result r))))
-
-(defn matches-any-pattern [s pp]
-  (some #(re-find % s) pp))
-
-(defn any-matches-any-pattern [ss pp]
-  (some true? (map #(matches-any-pattern % pp) ss)))
-
-(defn linesmatch [lines inpatterns outpatterns]
-  (and
-    (or
-      (empty? inpatterns)
-      (any-matches-any-pattern lines inpatterns))
-    (or
-      (empty? outpatterns)
-      (not (any-matches-any-pattern lines outpatterns)))))
-
-(defn linesbefore-match [linesbefore settings]
-  (linesmatch linesbefore (:in-linesbeforepatterns settings) (:out-linesbeforepatterns settings)))
-
-(defn linesafter-match [linesafter settings]
-  (linesmatch linesafter (:in-linesafterpatterns settings) (:out-linesafterpatterns settings)))

 (defn search-line-for-pattern
   ([linenum line linesbefore linesafter p settings]


Add logistics-loop

Add logistics-loop

--- src/overtone_workspace/beats.clj
+++ src/overtone_workspace/beats.clj
@@ -8,7 +8,38 @@
 (def kick (sample "resources/kick.wav"))
 ;; (kick)

-;; (ambi-loop sequencer-metro (sequencer-metro))
+;; SynthDef (\fmchord01, {|freq=440, amp=0.2, dur=2|
+;;                        var index_env, amp_env, out;
+;;                        index_env = EnvGen.ar (Env.perc (0.0001, 0.2, 1, -4));
+;;                        amp_env = EnvGen.ar (Env.perc (0.0001, 1, dur, -4), doneAction:2);
+;;                        out = PMOsc.ar (freq, freq * 1.02, (index_env * 2)) * amp_env;
+;;                        out = FreeVerb.ar (out.dup, 0.5, 0.8, 0.9);
+;;                        Out.ar (0, out * amp);
+;;                        }).add;
+(definst fmchord01 [freq 440 amp 0.2 dur 2]
+  (let [index-env (env-gen (perc 0.0001 0.2 1 -4))
+        amp-env (env-gen (perc 0.0001 1 dur -4) :action FREE)
+        snd (pm-osc freq (* freq 1.02) (* index-env 2))
+        reverb (free-verb (* snd amp-env) 0.5 0.8 0.9)]
+    (pan2 (* amp reverb))))
+;;(fmchord01)
+
+(def logistics-scale (scale :C2 :minor-pentatonic (range 1 15)))
+(def logistics-r 3.8)
+(defn logistics-loop [metro beat x]
+  (let [idx (Math/floor (* x (count logistics-scale)))
+        note (nth logistics-scale idx)
+        freq (midi->hz note)
+        dur (* 2/8 (/ 60.0 (metro :bpm)))
+        next-beat (+ 2/8 beat)
+        next-x (* logistics-r x (- 1 x))] ;; x = r * x * (1 - x)
+    (if (< 0 (rand-int 3))
+      (at (metro beat)
+          (fmchord01 :freq freq :dur dur :amp 1)))
+    (apply-by (metro next-beat) #'logistics-loop [metro next-beat next-x])))
+
+;; (logistics-loop sequencer-metro (sequencer-metro) 0.1)
+;; (stop)

 (volume (/ 25 127))

@@ -103,7 +134,8 @@
 (def fn-beats {ambi-rand [_]
                ;;ambi-rand (vec (repeat 16 1))
                rand-laser (vec (repeat 16 1))
-               rand-latchbell (vec (repeat 16 1))})
+               ;;rand-latchbell (vec (repeat 16 1))
+               })
 (def *fn-beats (atom fn-beats))
 (comment
   (start-live-fn-sequencer (sequencer-metro (next-beat (sequencer-metro) 0 (* 8 beat-per-pattern))) (* 1 beat-per-pattern) *fn-beats "fn-beats")
@@ -113,7 +145,8 @@
   (swap! *fn-beats assoc ambi-rand [[1 _ _ [1 1]] [(vec (repeat 8 1)) _ _ 1] [_ _ 1 _] [(vec (repeat 8 1)) _ _ [1 1 1]]])
   (swap! *fn-beats assoc ambi-rand (vec (repeat 16 1)))
   (swap! *fn-beats assoc rand-laser (vec (repeat 16 1)))
-  (swap! *fn-beats assoc rand-latchbell (vec (repeat 16 1)))
+  (swap! *fn-beats assoc rand-latchbell (vec (repeat 8 1)))
+  (swap! *fn-beats assoc rand-latchbell [_])

   (apply-by (sequencer-metro (- (next-beat (sequencer-metro) 0 (* 8 beat-per-pattern)) 1/256))
             #'stop-live-sequencer ["fn-beats"])


Add a link to the next problem the user probably wants to try

--- src/foreclojure/problems.clj
+++ src/foreclojure/problems.clj
@@ -1,7 +1,7 @@
 (ns foreclojure.problems
-  (:use foreclojure.utils
-        [foreclojure.social :only [tweet-link gist!]]
-        [foreclojure.feeds :only [create-feed]]
+  (:use (foreclojure utils
+                     [social :only [tweet-link gist!]]
+                     [feeds :only [create-feed]])
         [clojail core testers]
         somnium.congomongo
         (hiccup form-helpers page-helpers core)
@@ -29,6 +29,18 @@
           :only [:_id :title :tags :times-solved]
           :sort {:_id 1})))

+(defn next-unsolved-problem [solved-problems]
+  (when-let [unsolved (->> (get-problem-list)
+                           (remove (comp (set solved-problems) :_id))
+                           (seq))]
+    (apply min-key :_id unsolved)))
+
+(defn next-problem-link [completed-problem-id]
+  (when-let [{:keys [solved]} (get-user (session/session-get :user))]
+    (if-let [{:keys [_id title]} (next-unsolved-problem solved)]
+      (str "Now try " title "!")
+      "You've solved them all! Come back later for more!")))
+
 (defn get-recent-problems [n]
   (map get-problem (map :_id (take-last n (get-problem-list)))))

@@ -54,7 +66,8 @@
               (update! :users {:user user} {:$addToSet {:solved id}})
               (update! :problems {:_id id} {:$inc {:times-solved 1}})
               (send total-solved inc))
-            "Congratulations, you've solved the problem!")
+            (str "Congratulations, you've solved the problem!"
+                 "
" (next-problem-link id)))
           "You've solved the problem! If you log in we can track your progress.")]
     (session/session-put! :code [id code])
     (flash-msg (str message " " gist-link) (str "/problem/" id))))


removed tab fn to do as exercise

removed tab fn to do as exercise

--- src/functional_music/tab.clj
+++ src/functional_music/tab.clj
@@ -14,10 +14,7 @@
 (defn filter-tab-lines
   "Only keep the lines that are tabs. Assuming that tab lines must have a '-' and '|' characters."
   [coll]
-  (->> coll
-       ;; filter lines with '-' and '|' characters
-       (filter #(.contains % "-"))
-       (filter #(.contains % "|"))))
+  )

 (defn- join-tabs
   "Join two sets of tabs together"
@@ -32,19 +29,13 @@
        (reduce join-tabs)))

 (defn remove-format [coll]
-  (->> coll
-       (map #(s/replace % #"\|" ""))
-       (map #(s/replace % #"^[A-z]" ""))))
+  )

 (defn to-string-fret [[s f]]
   [s (java.lang.Character/getNumericValue f)])

 (defn tab->string-fret [e B G D A E]
-  (->> [E A D G B e]
-       (map-indexed vector)
-       ;; coerce char to string then check with regex
-       (filter #(re-seq #"[0-9]" (str (second %))))
-       (map to-string-fret)))
+  )

 (defn parse-guitar-tab [s]
   (->> s


Add numbering to ignores and failures

Add numbering to ignores and failures

--- src/radicalzephyr/boot_junit.clj
+++ src/radicalzephyr/boot_junit.clj
@@ -40,18 +40,20 @@
   (when (seq ignored-tests)
     (println "Ignored:")
     (println)
-    (doseq [ignored ignored-tests]
-      (println (style (.getDisplayName ignored) :yellow))
+    (doseq [[i ignored] (map-indexed vector ignored-tests)]
+      (printf "  %d) %s\n"
+              (inc i) (style (.getDisplayName ignored) :yellow))
       (println))))

 (defn- print-failed-tests [test-failures]
   (when (seq test-failures)
     (println "Failed:")
     (println)
-    (doseq [failure test-failures]
-      (println (.getTestHeader failure))
-      (println (style (.getTrace failure)
-                      :red))
+    (doseq [[i failure] (map-indexed vector test-failures)]
+      (printf "  %d) %s\n"
+              (inc i) (.getTestHeader failure))
+      (printf "     %s\n" (style (.getTrace failure)
+                              :red))
       (println))))

 (defn- print-test-summary [result]
@@ -74,7 +76,7 @@
                  (str/join ", " packages)))

       (testRunFinished [result]
-        (println "\n")
+        (print "\n\n")
         (print-ignored-tests @ignored-tests)
         (print-failed-tests (.getFailures result))
         (print-test-summary result))


Add better descriptions for empty file errors

--- test/comic_reader/sites_test.clj
+++ test/comic_reader/sites_test.clj
@@ -19,13 +19,14 @@
           (str "Contents of `sites/" site ".clj'"
                " cannot be empty")))))

-(defn try-read-file [filename]
+(defn try-read-file [filename error-message]
   (try
     (read-file filename)
     (catch java.lang.RuntimeException re
       (is false
           (str "Contents of `" filename "'"
-               " cannot be empty")))))
+               " cannot be empty.\n"
+               error-message)))))

 (def ^:dynamic site-name)

@@ -165,7 +166,9 @@

 (defn test-image-page-extraction []
   (let [results (try-read-file
-                 (site-test-resource "image.clj"))]
+                 (site-test-resource "image.clj")
+                 (str "Please add a map with keys for :image-tag,"
+                      " :pages-list and :chapter-url."))]
     (if-let [html (image-page-html)]
       (and
        (test-extract-image-tag html (:image-tag results))
@@ -178,7 +181,8 @@

 (defn test-extract-chapters-list []
   (let [results (try-read-file
-                 (site-test-resource "chapter_list.clj"))]
+                 (site-test-resource "chapter_list.clj")
+                 "Please add a map with a :chapter-list key.")]
     (if-let [html (chapter-list-html)]
       (and
        (tu/ensure-dependencies-defined extract-chapters-list)
@@ -191,7 +195,8 @@

 (defn test-extract-comic-list []
   (let [results (try-read-file
-                 (site-test-resource "comic_list.clj"))]
+                 (site-test-resource "comic_list.clj")
+                 "Please add a map with a :comic-list key.")]
     (if-let [html (comic-list-html)]
       (and
        (tu/ensure-dependencies-defined extract-comics-list)


Poll for new channels

Poll for new channels

--- src/home/cljs/virt/home.cljs
+++ src/home/cljs/virt/home.cljs
@@ -83,6 +83,14 @@
             ; Wait for data to load before continuing
             (while (some? (<! (async/merge [channels-loading apps-loading]))))
             (om/transact! app [:page-stack] #(pop %)))
+          (om/set-state! owner :poll-interval
+            (js/setInterval
+              #(go
+                 (let [loc (<! (get-geolocation))]
+                   (om/update! app [:geolocation] loc)
+                   (let [response (<! (http/get "/api/channels" {:query-params loc}))]
+                     (om/update! app [:channels] (:body response)))))
+              3000))
           (while true
             (let [[msg data] (<! comm)]
               (case msg
@@ -109,6 +117,9 @@
                   (om/transact! app [:channels] (fn [cs] (conj cs (:body response))))
                   (put! comm [:navigate [:back]]))
                 nil))))))
+    om/IWillUnmount
+    (will-unmount [_]
+      (js/clearInterval (om/get-state :poll-interval)))
     om/IRenderState
     (render-state [_ {:keys [comm]}]
       (let [page-stack (:page-stack app)


new-web-server constructor takes kv args

--- components/http-kit/src/modular/http_kit.clj
+++ components/http-kit/src/modular/http_kit.clj
@@ -30,7 +30,7 @@
   Index
   (types [this] #{modular.ring/RingHandlerProvider}))

-(defn new-webserver [opts]
+(defn new-webserver [& {:as opts}]
   (let [{:keys [port]} (->> (merge {:port default-port} opts)
                             (s/validate {:port s/Int}))]
     (->Webserver port)


Fix filter on entries query.

Fix filter on entries query.

--- src/oc/storage/resources/entry.clj
+++ src/oc/storage/resources/entry.clj
@@ -299,10 +299,15 @@
     (let [authors (:author original-entry)
           ts (db-common/current-timestamp)
           publisher (lib-schema/author-for-user user)
+          old-user-visibility (:user-visibility original-entry)
           merged-entry (merge original-entry entry-props {:status :published
                                                           :published-at ts
                                                           :publisher publisher
-                                                          :secure-uuid (db-common/unique-id)})
+                                                          :secure-uuid (db-common/unique-id)
+                                                          :user-visibility (assoc old-user-visibility
+                                                                            (keyword (:user-id user))
+                                                                            {:follow true
+                                                                             :dismiss-at (db-common/current-timestamp)})})
           updated-authors (conj authors (assoc publisher :updated-at ts))
           entry-update (assoc merged-entry :author updated-authors)]
       (schema/validate common/Entry entry-update)
@@ -454,24 +459,24 @@
                      :interactions common/interaction-table-name :uuid :resource-uuid
                      list-comment-properties {:count count})]
     (remove nil?
-     (filter
+     (filterv
       (fn [entry]
        (let [sorted-comments (sort-by :created-at
-                               (filter #(and (contains? % :body)
+                              (filterv #(and (contains? % :body)
                                              (not= (-> % :author :user-id) user-id))
-                                (:iteractions entry)))
-              last-activity-timestamp (when (seq sorted-comments)
-                                        (:created-at (last sorted-comments)))
+                               (:interactions entry)))
+             last-activity-timestamp (when (seq sorted-comments)
+                                       (:created-at (last sorted-comments)))
              user-visibility (some (fn [[k v]] (when (= k (keyword user-id)) v)) (:user-visibility entry))]
          (when (or ;; User has never dismissed not followed/unfollowed the post
                    (empty? user-visibility)
-                   ;; User has not unfollowed (not (and (contains? :follow) (not (:follow entry-user-vis))))
-                   (not (and (contains? user-visibility :follow)
-                             (not (:follow user-visibility))))
-                   ;; User is following the post, has dismissed before but last comment is after dismiss-at
-                   (and (:follow user-visibility)
-                        (contains? user-visibility :dismiss-at)
-                        (pos? (compare (:dismiss-at user-visibility) last-activity-timestamp))))
+                   ;; User is following the post, has dismissed but before last comment
+                   (and last-activity-timestamp
+                        (:follow user-visibility)
+                        (pos? (compare last-activity-timestamp (:dismiss-at user-visibility))))
+                   ;; There are no comments on post, user has dismissed but before published-at
+                   (and (not last-activity-timestamp)
+                        (pos? (compare (:published-at entry) (:dismiss-at user-visibility)))))
           entry)))
       all-entries)))))


Supply context rather than full opts to sync-fn

--- src/onyx/triggers/triggers_api.clj
+++ src/onyx/triggers/triggers_api.clj
@@ -94,7 +94,7 @@
          (let [window-metadata {:window-id window-id
                                 :lower-bound lower
                                 :upper-bound upper
-                                :opts opts}]
+                                :context (:context opts)}]
            (refine-state event trigger)
            ((:trigger/sync-fn trigger) event window trigger window-metadata state)
            (if (refinement-destructive? event trigger)


only return public companies in /companies

--- src/open_company/api/companies.clj
+++ src/open_company/api/companies.clj
@@ -140,7 +140,7 @@
   :handle-not-acceptable (common/only-accept 406 company-rep/collection-media-type)

   ;; Get a list of companies
-  :exists? (fn [_] {:companies (company/list-companies conn)})
+  :exists? (fn [_] {:companies (filter :public (company/list-companies conn))})

   :processable? (by-method {
     :get true


send error codes to client

send error codes to client

--- src/wombats/handlers/helpers.clj
+++ src/wombats/handlers/helpers.clj
@@ -15,4 +15,5 @@
                                     :message (->> params
                                                   (into [message])
                                                   (apply format))
-                                    :details details}))))
+                                    :details details
+                                    :code code}))))


second duplicate image second

second duplicate image second

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

--- acqEngine/src/org/micromanager/test.clj
+++ acqEngine/src/org/micromanager/test.clj
@@ -76,7 +76,7 @@
         (let [tags (json-clone (.tags img))]
           (update-tag! tags "ChannelIndex" #(+ 2 %))
           (update-tag! tags "Channel" #(str % "-2"))
-          [(TaggedImage. (.pix img) tags) img]))))
+          [img (TaggedImage. (.pix img) tags)]))))

 (defn restart-test []
   (remove-all-image-processors!)


add tests for compiler

add tests for compiler

--- test/kondolisp/compiler_test.clj
+++ test/kondolisp/compiler_test.clj
@@ -48,11 +48,28 @@
   (is (= [[:VM_IVAL (make-num 1)]]
          (compile-pass1 1)))

+  (is (= [[:VM_IVAL (make-num 1)]]
+         (compile-pass1 '(quote 1))))
+
   (is (= [[:VM_IVAL (make-sym "aa")]]
          (compile-pass1 ''aa)))

   (is (= [[:VM_IVAL (make-t)]]
          (compile-pass1 't)))

+  (is (= [[:VM_IVAL (make-t)]]
+         (compile-pass1 ''t)))
+
   (is (= [[:VM_IVAL (make-nil)]]
          (compile-pass1 'nil))))
+
+(deftest test-compile-pass1-quote
+  (is (= [[:VM_IVAL (make-num 1)]
+          [:VM_PUSH]
+          [:VM_IVAL (make-num 2)]
+          [:VM_PUSH]
+          [:VM_IVAL (make-nil)]
+          [:VM_CONS]
+          [:VM_CONS]]
+         (compile-pass1 '(quote (1 2)))))
+  )


Add :lazy option, and lazy-handler function

--- src/io/aviso/rook/server.clj
+++ src/io/aviso/rook/server.clj
@@ -37,6 +37,14 @@
   (fn [request]
     ((creator) request)))

+(defn lazy-handler
+  "Wraps a handler creator function such that the root handler is created lazily on first access."
+  {:added "0.1.28"}
+  [creator]
+  (let [handler (delay (creator))]
+    (fn [request]
+      (@handler request))))
+
 (defn wrap-log-request
   "Logs incoming requests (as info), identifying method and URI."
   [handler]
@@ -112,9 +120,6 @@
             (assoc :body (io/input-stream body-array))
             handler)))))

-(def ^:private not-found-response
-  (utils/response HttpServletResponse/SC_NOT_FOUND))
-
 (defn- log-response
   "Logs the response at debug level (if enabled) with nice formatting; returns a new response (since reading
   an InputStream body is destructive)."
@@ -195,6 +200,10 @@
   :reload
   : enables the above-described reloading of the handler.

+  :lazy
+  : if true (and :reload is false) then the handler is not created until first needed, rather
+    then immediately on invoking this function.
+
   :debug
   : enables logging (at debug level) of each incoming request via [[wrap-debug-request]]
     and [[wrap-debug-response]]
@@ -213,10 +222,16 @@

   The extra middleware is added around the root handler (or the
   reloading handler that creates the root handler)."
-  [{:keys [reload log debug track standard exceptions]} creator & creator-args]
+  [{:keys [reload log debug track standard exceptions lazy]} creator & creator-args]
   (let [creator' (wrap-creator creator creator-args)
-        handler (if reload
+        handler (cond
+                  reload
                   (reloading-handler creator')
+
+                  lazy
+                  (lazy-handler creator')
+
+                  :else
                   ;; Or just do it once, right now.
                   (creator'))]
     (cond-> handler


add steps

add steps

--- src/tamaki_core/invoke.clj
+++ src/tamaki_core/invoke.clj
@@ -1,6 +1,6 @@
 (ns tamaki-core.invoke
-  (:require [tamaki-core.config :as config])
-  )
+  (:require [tamaki-core.config :as config]))
+
 (defn invoke
   ([phase config]
     (doseq [func (get (:hooks config) (keyword phase))]
@@ -10,14 +10,29 @@
     (let [config (config/load-config)]
       (invoke phase config))))

-(comment
-(def ^:private clean-lifecycle '(clean))
-
-(defn clean
-  ([config]
-   (doseq [phase clean-lifecycle]
-     (invoke phase config)))
-  ([] (clean (config/load-config))))
+(defn- sub-steps [step steps]
+  (let [last-step (.indexOf steps step)]
+    (if (= -1 last-step)
+      []
+      (subvec steps 0 (+ 1 last-step)))))

-(def ^:private deploy-lifecycle '()))
+(def ^:private steps ["clean"
+                      "initialize"
+                      "process-resources"
+                      "do-compilation"])
+
+(defn defined-step? [step]
+  (not (= (.indexOf steps step) -1)))
+
+(defn proc
+  ([step config]
+   (doseq [p (sub-steps step steps)]
+     (invoke p config)))
+  ([step] (proc step (config/load-config))))
+
+
+
+
+
+


CM/GG #4 check for flash message on objective create

--- integration/d_cent/front_end_integration_tests.clj
+++ integration/d_cent/front_end_integration_tests.clj
@@ -88,21 +88,20 @@

 (fact "authorised user can post and retrieve objective"
       twitter-authentication-background
+      (against-background (api/create-objective {:title "my objective title"
+                                 :goals "my objective goals"
+                                 :description "my objective description"
+                                 :end-date "my objective end-date"
+                                 :created-by "twitter-user_id"}) => {:_id "some-id"})
       (let [store (atom {})
             app-config (into core/app-config {:store store})
             user-session (p/session (core/app app-config))
             params {:title "my objective title"
                     :goals "my objective goals"
                     :description "my objective description"
-                    :end-date "my objective end-date"}]
-          (-> (access-as-signed-in-user user-session "/objectives" :request-method :post :params params)
-            :response
+                    :end-date "my objective end-date"}
+            response (:response (access-as-signed-in-user user-session "/objectives" :request-method :post :params params))]
+          (:flash response) => (contains "Your objective has been created!")
+          (-> response
             :headers
-            (get "Location"))
-        => (contains "/objectives/some-id")
-        (provided
-          (api/create-objective {:title "my objective title"
-                               :goals "my objective goals"
-                               :description "my objective description"
-                               :end-date "my objective end-date"
-                               :created-by "twitter-user_id"}) => {:_id "some-id"})))
+            (get "Location")) => (contains "/objectives/some-id")))


InviteModal: prevent loss of state if props updated

--- src-cljs/frontend/components/pages/team.cljs
+++ src-cljs/frontend/components/pages/team.cljs
@@ -102,7 +102,8 @@
           (let [new-selected-org (:selected-org new-props)
                 new-vcs-users (:vcs-users-by-handle new-selected-org)
                 old-vcs-users (get-in (om/get-props owner) [:selected-org :vcs-users-by-handle])
-                new-show-modal? (:show-modal? new-props)]
+                new-show-modal? (:show-modal? new-props)
+                component-users-by-handle (om/get-state owner :org-members-by-handle)]
             (when (and new-show-modal?
                        (not new-vcs-users))
               (api/get-org-members (:name new-selected-org) (:vcs_type new-selected-org) (om/get-shared owner [:comms :api])))
@@ -112,11 +113,13 @@
                              (into {}
                                    (for [[handle {:keys [user? email]
                                                   :as user}] new-vcs-users
-                                         :when (not user?)
-                                         :let [trimmed-email (some-> email gstr/trim)]]
-                                     [handle {:entered-email trimmed-email
-                                              :selected? (valid-email? trimmed-email)}]))))))
-
+                                         :when (not user?)]
+                                     (if-let [component-user (get component-users-by-handle handle)]
+                                       [handle component-user]
+                                       (let [trimmed-email (some-> email gstr/trim)]
+                                         [handle {:entered-email trimmed-email
+                                                  :selected? (valid-email? trimmed-email)}]))))))))
+
         om/IRenderState
         (render-state [_ {:keys [org-members-by-handle]}]
           (component


use log/info, not println, to avoid interfering with benchmarking

--- src/babel/english.cljc
+++ src/babel/english.cljc
@@ -20,9 +20,9 @@
            (realized? medium-model))
     @medium-model
     @(do
-       (println (str "creating model..(will be slow the first time).."))
+       (log/info (str "creating model..(will be slow the first time).."))
        (let [result (deliver medium-model (grammar/medium))]
-         (println (str "done."))
+         (log/info (str "done."))
          result))))

 (declare morph)


Update en.cljs

Update en.cljs

Change public key info message

--- src/status_im/translations/en.cljs
+++ src/status_im/translations/en.cljs
@@ -275,7 +275,7 @@
    :scan-qr                               "Scan QR code"
    :name                                  "Name"
    :whisper-identity                      "Whisper Identity"
-   :address-explication                   "Your public key is what identifies you on Ethereum and is a series of numbers and letters"
+   :address-explication                   "Your public key is used to generate your address on Ethereum and is a series of numbers and letters. You can find it easily in your profile"
    :enter-valid-address                   "Please enter a valid address or scan a QR code"
    :enter-valid-public-key                "Please enter a valid public key or scan a QR code"
    :contact-already-added                 "The contact has already been added"


Changed "enter your full name" to "Display name"

Signed-off-by: Andrey Shovkoplyas <b713972e59b8e606e23253c4a13e948139fea4d1@gmail.com>

--- src/status_im/translations/en.cljs
+++ src/status_im/translations/en.cljs
@@ -41,7 +41,7 @@
    :creating-your-account                "Creating your account on the blockchain. We can't touch it, no one can, except for you!"
    :password-placeholder                 "Type your password"
    :password-placeholder2                "Confirm your password"
-   :name-placeholder                     "Enter your full name…"
+   :name-placeholder                     "Display name"
    :password_error1                      "Password confirmation doesn't match password."
    :password-description                 "You'll need this password to open the app, confirm transactions and whenever you need to regain access on a new device or install."
    :name-description                     "This will be the name everybody who uses Status will see. You can change it later."


[bug #2260] Fixing the Etherscan domain name

--- src/status_im/translations/en.cljs
+++ src/status_im/translations/en.cljs
@@ -351,7 +351,7 @@
    :confirmations                         "Confirmations"
    :confirmations-helper-text             "Please wait for at least 12 confirmations to make sure your transaction is processed securely"
    :copy-transaction-hash                 "Copy transaction hash"
-   :open-on-etherscan                     "Open on Etherscan.org"
+   :open-on-etherscan                     "Open on Etherscan.io"

    ;;webview
    :web-view-error                        "oops, error"


Simplify

Simplify

--- frontend/src/crunsher/core.cljs
+++ frontend/src/crunsher/core.cljs
@@ -10,8 +10,7 @@

 (enable-console-print!)

-(om/add-root! lib/reconciler
-              views/Main (gdom/getElement "crunsher-main"))
+(om/add-root! lib/reconciler views/Main (gdom/getElement "crunsher-main"))

 (defn on-js-reload []
   ;; optionally touch your app-state to force rerendering depending on


Very minor refactorings

Very minor refactorings

--- src/build_mon/core.clj
+++ src/build_mon/core.clj
@@ -20,9 +20,7 @@
   (if (in-progress? build) (:status build) (:result build)))

 (defn determine-build-author [build]
-  (or
-    (-> build :requestedFor :displayName)
-    "N/A"))
+  (or (-> build :requestedFor :displayName) "N/A"))

 (defn determine-text [build]
   (let [sep " – "]
@@ -34,7 +32,7 @@
       (determine-status-text build))))

 (defn tryparse [string]
-  (try (. Integer parseInt string)
+  (try (Integer. string)
        (catch Exception e nil)))

 (defn determine-refresh-rate [params]
@@ -50,7 +48,7 @@
         text (determine-text build)]
     (str "<head>"
          "<title>Build Status</title>"
-         (if refresh (str "<meta http-equiv=\"refresh\" content=\"" refresh "\" />"))
+         (when refresh (str "<meta http-equiv=\"refresh\" content=\"" refresh "\" />"))
          "<link rel=\"shortcut icon\" href=\"/favicon_" background-colour ".ico\" />"
          "</head>"
          "<body style=\"background-color:" background-colour ";\">"


Revert "Remove rate-gauge."

Revert "Remove rate-gauge."

This reverts commit cf320d2ca547ef65366cda7837a1631b3d734ce2.

--- src/uswitch/bifrost/s3.clj
+++ src/uswitch/bifrost/s3.clj
@@ -7,7 +7,8 @@
             [metrics.timers :refer (time! timer)]
             [clj-kafka.zk :refer (committed-offset set-offset!)]
             [uswitch.bifrost.util :refer (close-channels)]
-            [uswitch.bifrost.async :refer (observable-chan map->Spawner)]))
+            [uswitch.bifrost.async :refer (observable-chan map->Spawner)]
+            [uswitch.bifrost.telemetry :refer (rate-gauge reset-gauge! stop-gauge! update-gauge!)]))

 (def buffer-size 100)

@@ -18,14 +19,21 @@
           partition
           (format "%010d" first-offset)))

+(def caching-rate-gauge (memoize rate-gauge))
+
 (defn upload-to-s3 [credentials bucket consumer-group-id topic partition first-offset file-path]
   (let [f (file file-path)]
     (if (.exists f)
-      (let [key      (generate-key consumer-group-id topic partition first-offset)
+      (let [g        (caching-rate-gauge (str topic "-" partition "-uploadBytes"))
+            key      (generate-key consumer-group-id topic partition first-offset)
             dest-url (str "s3n://" bucket "/" key)]
         (info "Uploading" file-path "to" dest-url)
         (time! (timer (str topic "-s3-upload-time"))
-               (put-object credentials bucket key f))
+               (do (reset-gauge! g)
+                   (put-object credentials bucket key f {:progress-listener (fn [{:keys [bytes-transferred event]}]
+                                                                              (when (= :transferring event)
+                                                                                (update-gauge! g bytes-transferred)))})
+                   (stop-gauge! g)))
         (info "Finished uploading" dest-url))
       (warn "Unable to find file" file-path))))


fixed ns declaration

fixed ns declaration

--- components/neo4j/src/gorillalabs/tesla/component/neo4j.clj
+++ components/neo4j/src/gorillalabs/tesla/component/neo4j.clj
@@ -1,9 +1,8 @@
-(ns gorillalabs.tesla.component.neo4j)
-
-(:require [neo4j-clj.core :as neo4j]
-  [clojure.tools.logging :as log]
-  [gorillalabs.tesla.component.configuration :as config]
-  [mount.core :as mnt])
+(ns gorillalabs.tesla.component.neo4j
+    (:require [neo4j-clj.core :as neo4j]
+      [clojure.tools.logging :as log]
+      [gorillalabs.tesla.component.configuration :as config]
+      [mount.core :as mnt]))

 (defn- start []
        (let [url (config/config config/configuration [:neo4j :url])