Removes superflous whitespaces.

Removes superflous whitespaces.

--- src/active/clojure/match.clj
+++ src/active/clojure/match.clj
@@ -799,14 +799,14 @@
     `<key-and-name>` in the map or to `nil` if `<key-and-name>` is not
     in the map.

-  Access to nested values is also possible.  Use `[<key>+]` to access
-  a nested value, where `[<key>+]` is a sequence of keys.  When no
+  Access to nested values is also possible. Use `[<key>+]` to access
+  a nested value, where `[<key>+]` is a sequence of keys. When no
   `:as <name>` clause is given, the last `<key>` of the sequence of
   keys is used as a name to bind the value.

   `<key>` and `<key-and-name>` can be either a symbol or a keyword.
   If `<key-and-name>` is a symbol, it is converted to a string when
-  used as a key (and used as symbol for binding the value).  If
+  used as a key (and used as symbol for binding the value). If
   `<key-and-name>` is a keyword, it is converted to a name for binding
   the value (and usesd as keyword when used as a key).


support general paired fastq processing

support general paired fastq processing

--- src/aerobio/htseq/common.clj
+++ src/aerobio/htseq/common.clj
@@ -600,6 +600,13 @@
             (keep-indexed (fn[idx itm] (when (str/substring? repname itm) idx)))
             (mapv fqzs))))))

+(defn get-paired-fqs [eid repname repk]
+  (->> (get-replicate-fqzs eid repname repk)
+       (group-by (fn[fq] (if (re-find #"R2" fq) :R2 :R1)))
+       (map (fn[[k v]] [k (cljstr/join "," v)]))
+       (into {})))
+
+
 (defn replicate-name->strain-name [eid rnm]
   ((get-exp-info eid :ncbi-sample-xref) (->> rnm (str/split #"-") first)))

@@ -673,6 +680,8 @@
              :bt1 :bt2)
         star (-> template (get-in [:nodes :ph1 :name])
                  (cljstr/includes? "star"))
+        paired (-> template (get-in [:nodes :ph1 :name])
+                 (cljstr/includes? "paired"))
         sample-names (get-exp-info eid :sample-names)
         sample-names (if repk
                        (mapcat #((get-exp-info eid :replicate-names) %)
@@ -690,7 +699,7 @@
                  (let [job (assoc-in phase1-job-template [:nodes :ph1 :args]
                                      (get-phase-1-args
                                       exp eid snm :repk repk
-                                      :bowtie bt :star star))
+                                      :bowtie bt :star star :paired paired))
                        cfg (-> job
                                (pg/config-pgm-graph-nodes get-toolinfo nil nil)
                                pg/config-pgm-graph)]


Fix for api.service.handlers/wrap-lcase-params

--- src/api/service/handlers.clj
+++ src/api/service/handlers.clj
@@ -14,7 +14,7 @@
    (map? target)    (into {} (for [[k v] target]
                                [(if (string? k)
                                   (string/lower-case k)
-                                  (keyword (string/lower-case k)))
+                                  (keyword (string/lower-case (name k))))
                                 (lcase-params v)]))
    (vector? target) (mapv lcase-params target)
    :else            target))


improve doc for srange-dynamic

improve doc for srange-dynamic

--- src/clj/com/rpl/specter.cljc
+++ src/clj/com/rpl/specter.cljc
@@ -710,16 +710,17 @@
   (n/PosNavigator n/get-first n/update-first))

 (defnav
-  ^{:doc "Uses start-fn and end-fn to determine the bounds of the subsequence
-          to select when navigating. Each function takes in the structure as input."}
+  ^{:doc "Uses start-index-fn and end-index-fn to determine the bounds of the subsequence
+          to select when navigating. `start-index-fn` takes in the structure as input. `end-index-fn`
+          can be one of two forms. If a regular function (e.g. defined with `fn`), it takes in only the structure as input. If a function defined using special `end-fn` macro, it takes in the structure and the result of `start-index-fn`."}
   srange-dynamic
-  [start-fn end-fn]
-  (select* [this structure next-fn]
-    (let [s (start-fn structure)]
-      (n/srange-select structure s (n/invoke-end-fn end-fn structure s) next-fn)))
-  (transform* [this structure next-fn]
-    (let [s (start-fn structure)]
-      (n/srange-transform structure s (n/invoke-end-fn end-fn structure s) next-fn))))
+  [start-index-fn end-index-fn]
+  (select* [this structure next-fn]
+    (let [s (start-index-fn structure)]
+      (n/srange-select structure s (n/invoke-end-fn end-index-fn structure s) next-fn)))
+  (transform* [this structure next-fn]
+    (let [s (start-index-fn structure)]
+      (n/srange-transform structure s (n/invoke-end-fn end-index-fn structure s) next-fn))))

 (defnav


define pred using defnav so it uses lean navigation when possible

--- src/clj/com/rpl/specter.cljc
+++ src/clj/com/rpl/specter.cljc
@@ -514,11 +514,15 @@
     (transform* [this structure next-fn]
       (next-fn (compiled-transform late update-fn structure)))))

-(def
+(defnav
   ^{:doc "Keeps the element only if it matches the supplied predicate. This is the
           late-bound parameterized version of using a function directly in a path."}
   pred
-  i/pred*
+  [afn]
+  (select* [this structure next-fn]
+    (if (afn structure) (next-fn structure) NONE))
+  (transform* [this structure next-fn]
+    (if (afn structure) (next-fn structure) structure))
   )

 (extend-type nil


Fix the JNDI name for the datasource

Fix the JNDI name for the datasource

--- src/clj/hyphen_keeper/db.clj
+++ src/clj/hyphen_keeper/db.clj
@@ -2,7 +2,7 @@
   "Persistence for the hyphenation dictionary"
   (:require [yesql.core :refer [defqueries]]))

-(def ^:private db {:name "java:jboss/datasources/old-productions"})
+(def ^:private db {:name "java:jboss/datasources/hyphenations"})

 (defqueries "db/queries.sql" {:connection db})


add missing repl options

add missing repl options


Async collector avoids resubmitting for work in progress

--- jar-async/src/slipstream/async/collector.clj
+++ jar-async/src/slipstream/async/collector.clj
@@ -10,17 +10,32 @@
     :name slipstream.async.Collector
     :methods [#^{:static true
                  :doc "Takes: run user"}
-                [start [] void]]))
+[start [] void]]))

 (defn seconds-in-msecs
   [seconds]
   (* 1000 seconds))

+(defn msecs-in-seconds
+  [msecs]
+  (/ msecs 1000))
+
+(def busy (atom #{}))
+
+(defn- mark-busy
+ [current-busy v]
+ (conj current-busy v))
+
+(defn- free
+ [current-busy v]
+ (disj current-busy v))
+
 (def collector-chan-size 512)
 (def number-of-readers 32)
 (def timeout-all-users-loop (seconds-in-msecs 240))
 (def timeout-online-loop (seconds-in-msecs 10))
-(def timeout-collect (seconds-in-msecs 15))
+(def timeout-collect (* 2 timeout-collect-loop))
+(def timeout-collect-reader-release (+ timeout-collect (seconds-in-msecs 2)))
 (def timeout-processing-loop (seconds-in-msecs 60))

 (defn get-value
@@ -53,21 +68,37 @@
 ; This is the channel for queuing all user requests
 (def all-collector-chan (chan (sliding-buffer collector-chan-size)))

+(defn- build-user-connector-msg
+  [user connector]
+  (str "user " (get-name user) " on cloud " (.getConnectorInstanceName connector)))
+
+(defn- build-msg
+  [prefix user connector suffix]
+  (str prefix "for " (build-user-connector-msg user connector) suffix))
+
+(defn log-timeout
+  [user connector]
+  (log/log-error (build-msg "Timed out in waiting for collecting vms " user connector "")))
+
+(defn log-failure
+  [user connector]
+  (log/log-error (build-msg "Failed collecting vms " user connector "")))
+
+(defn log-collected
+  [user connector v]
+  (log/log-info (build-msg "Number of VMs collected " user connector (str ": " v))))
+
 (defn collect!
   [user connector]
   (let [ch (chan 1)]
     (go
-      (let [[v c] (alts! [ch (timeout timeout-collect)])]
-        (if (nil? v)
-          (log/log-error
-            "Timeout collecting vms for user "
-            (get-name user)
-            " on cloud "
-            (.getConnectorInstanceName connector))
-          (log/log-info "Number of VMs collected for user " (get-name user)
-            " on cloud "
-            (.getConnectorInstanceName connector) ": " v))))
-    (go (>! ch (Collector/collect user connector)))))
+      (let [[v _] (alts! [ch (timeout timeout-collect-reader-release)])]
+        (swap! busy free [(get-name user) connector])
+        (cond
+          (nil? v) (log-timeout user connector)
+          (< v 0) (log-failure user connector)
+          :else (log-collected user connector v))))
+    (go (>! ch (Collector/collect user connector (msecs-in-seconds timeout-collect))))))

 (defn update-metric!
   [user]
@@ -92,11 +123,12 @@
       (while true
         (let [[[user connector] ch] (alts! [chan (timeout timeout-processing-loop)])]
           (when (not-nil? user)
+            (swap! busy mark-busy [(get-name user) connector])
             (try
-              (log/log-debug (str "executing collect request for " (get-name user) " and " (.getConnectorInstanceName connector)))
+              (log/log-info (str "executing collect request for " (get-name user) " and " (.getConnectorInstanceName connector)))
               (collect! user connector)
               (if (updator/metering-enabled?)
-                (update-metric! user))
+                 (update-metric! user))
               (catch Exception e (log/log-warn "caught exception executing collect request: " (.getMessage e))))))))))

 (defonce ^:dynamic *online-collect-processor* (collect-readers online-collector-chan))
@@ -114,23 +146,24 @@
   (let [connectors (connectors)]
     (check-channel-size users connectors)
     (doseq [u users
-            c connectors]
-      (go
-        (>! chan [u c])))))
+      c connectors]
+      (if-not (@busy [(get-name u) c])
+        (go (>! chan [u c]))
+        (log/log-info "Avoiding working on " (build-user-connector-msg u c) " being in a process." )))))

 ; Start collector writers
 (defn collect-writers
   []
   (go
-	  (while true
-	    (<! (timeout timeout-online-loop))
-	    (let [users (online-users)]
-	      (insert-collection-requests users online-collector-chan))))
+    (while true
+      (<! (timeout timeout-online-loop))
+      (let [users (online-users)]
+        (insert-collection-requests users online-collector-chan))))
   (go
-	  (while true
-	    (<! (timeout timeout-all-users-loop))
-	    (let [users (users)]
-	      (insert-collection-requests users all-collector-chan)))))
+    (while true
+      (<! (timeout timeout-all-users-loop))
+      (let [users (users)]
+        (insert-collection-requests users all-collector-chan)))))

 (defn -start
   []


Show solutions of ranked users along with followers'

--- src/foreclojure/problems.clj
+++ src/foreclojure/problems.clj
@@ -11,7 +11,7 @@
             [foreclojure.template     :only    [def-page content-page]]
             [foreclojure.social       :only    [tweet-link]]
             [foreclojure.feeds        :only    [create-feed]]
-            [foreclojure.users        :only    [golfer? get-user-id disable-codebox?]]
+            [foreclojure.users        :only    [golfer? get-user-id disable-codebox? get-ranked-users]]
             [foreclojure.solutions    :only    [save-solution get-solution]]
             [clojail.core             :exclude [safe-read]]
             [clojail.testers          :only    [secure-tester blacklist-symbols]]
@@ -338,35 +338,55 @@
                               " to view unapproved problems")))
       (error "No such problem!"))))

+(defn solution-block [username code]
+  [:div.follower-solution
+   [:div.solution-username (str username "'s solution:")]
+   [:pre.solution-code
+    (escape-html code)]])
+
 (def-page show-solutions-page [problem-id]
   {:title "4Clojure - Problem Solutions"
    :content
    (list
     [:div.message (session/flash-get :message)]
     [:div#problems-error.error (session/flash-get :error)]
-    [:h3 {:style "margin-top: -20px;"} "Solutions:"]
+    [:h3 {:style "margin-top: -20px;"} "Your solution"]
     (with-user [{:keys [_id following]}]
       (list
        (let [user-code (get-solution :public _id problem-id)]
          [:pre.solution-code.solution-user-code
           (escape-html user-code)])
-       (if (empty? following)
-         [:p "You can only see solutions of users whom you follow.  Click on any name from the " (link-to "/users" "users") " listing page to see their profile, and click follow from there."]
-         (if (some (complement nil?) (map #(get-solution :public % problem-id) following))
-           (interpose [:hr.solution]
-                      (for [f-user-id following
-                            :let [f-user (:user (from-mongo
-                                                 (fetch-one :users
-                                                            :where {:_id f-user-id}
-                                                            :only [:user])))
-                                  f-code (get-solution :public
-                                                       f-user-id problem-id)]
-                            :when f-code]
-                        [:div.follower-solution
-                         [:div.solution-username (str f-user "'s solution:")]
-                         [:pre.solution-code
-                          (escape-html f-code)]]))
-           [:p "None of the users you follow have solved this problem yet!"])))))})
+
+       [:h3 "Your followers' solutions"]
+       (if (some (complement nil?) (map #(get-solution :public % problem-id) following))
+         (interpose
+          [:hr.solution]
+          (for [f-user-id following
+                :let [f-user (:user (from-mongo
+                                     (fetch-one :users
+                                                :where {:_id f-user-id}
+                                                :only [:user])))
+                      f-code (get-solution :public
+                                           f-user-id problem-id)]
+                :when f-code]
+            (solution-block f-user f-code)))
+         [:p "None of the users you follow have solved this problem yet!"])
+
+       [:h3 "Top users' solutions"]
+       [:p "These solutions were written by some of the top users of 4Clojure."]
+       (interpose
+        [:hr.solution]
+        (let [top-users (take 15 (get-ranked-users))
+              top-users-m (zipmap (map :_id top-users) top-users)
+
+              solns (fetch :solutions
+                           :where {:user {:$in (map :_id top-users)}
+                                   :code {:$ne nil}}
+                           :limit 5)]
+          (for [soln solns
+                :let [username (:user (top-users-m (:user soln)))
+                      code (:code soln)]]
+            (solution-block username code)))))))})

 (defn show-solutions [id]
   (let [problem-id (Integer. id)


Randomly choose from variations.

Randomly choose from variations.

--- src/african_polyphony_and_polyrhythm/talk.clj
+++ src/african_polyphony_and_polyrhythm/talk.clj
@@ -57,6 +57,36 @@
 (defmethod live/play-note :default [{:keys [pitch]}]
   (when pitch (akadinda pitch)))

+(defn rand-variations [variations]
+  (concat
+    (rand-nth variations)
+    (lazy-seq (after 4 (rand-variations variations)))))
+
+
+(defn part [model variations]
+  ((apply juxt variations) model))
+
+(def tete
+  (part
+    (phrase [2 1/2 3/2] (repeat 0))
+    [identity
+     #(->> % (split 0 1/8) (split 1 1/7))
+     #(->> % (split 0 1/8) (split 1 1/7) (split 2 1/6))
+     #(->> % (split 0 1/8))]))
+
+(def ta
+  (part
+    (phrase [1 5/4 3/4 1] (cons nil (repeat 1)))
+    [identity
+     #(->> % (split 2 1/3))
+     #(->> % (split 3 1/2))]))
+
+(def ha
+  (part
+    (phrase [1/2 3 1/2] (cons nil (repeat 2)))
+    [identity
+     #(->> % (split 0 1/4) (split 2 1/6) (split 4 1/2))]))
+
 (def balendorc
   (let [a (phrase [2 1/2 3/2] (repeat 0))
         b (phrase [1 5/4 3/4 1] (cons nil (repeat 1)))
@@ -64,7 +94,10 @@
         d (phrase [2 2] (repeat 2))
         e (phrase [3/2 3/4 7/4] (cons nil (repeat 2)))
         ]
-    (with a b c d e)
+    (->> (rand-variations tete)
+         (with (rand-variations ta))
+         (with (rand-variations ha))
+         (take-while #(-> % :time (< 32))))
     )
   )

@@ -74,7 +107,6 @@
   (->>
     balendorc
     (where :pitch (comp temperament/equal A inverse-pentatonic))
-    (times 8)
     (tempo (bpm 120))
     (live/play)
     )


random examples cleanup

random examples cleanup

--- src/atom_finder/questions/random_examples.clj
+++ src/atom_finder/questions/random_examples.clj
@@ -24,7 +24,8 @@
       (if (str/starts-with? (str (:file found-atom)) "gcc")
         "gcc-mirror/gcc/blob/2c3133a09ceedead50c2b585ef7f62738ad5c81e/"
         "torvalds/linux/blob/e19b205be43d11bff638cad4487008c48d21c103/")
-      (str/replace-first (:file found-atom) #"[^/]*/" "")
+      ;(str/replace-first (:file found-atom) #"[^/]*/" "")
+      (:file found-atom)
       "#L"
       (:line found-atom)))

@@ -32,9 +33,9 @@
  "~/opt/src/linux"
  expand-home
  c-files
- ;(take 100000)
+ (take 50000)
  shuffle
- (take 1000)
+ (take 10000)
  (def random-c-files)
  time-mins
  )
@@ -42,6 +43,7 @@
 (quote
 (->>
  random-c-files
+ (pap (constantly (now)))
  (map parse-file)
  (mapcat
   (fn [root]


CMR-493: Fixed string multi-attribute tests.

--- src/cmr/search/services/legacy_parameters.clj
+++ src/cmr/search/services/legacy_parameters.clj
@@ -105,6 +105,8 @@
   "Process legacy product specific attributes by parsing the query string and updating params
   with attributes matching the new cmr csv style"
   [params query-string]
+  (println params)
+  (println query-string)
   (psa-pre-validation params)
   (let [param-strings (map rc/url-decode (s/split query-string #"&"))
         param-tuples (keep legacy-psa-param->tuple param-strings)


added helpful comment

added helpful comment

--- lein/credentials.clj
+++ lein/credentials.clj
@@ -1,2 +1,6 @@
+;; To encrypt this file, run:
+;; --------------------------
+;; gpg --default-recipient-self -e ~/.lein/credentials.clj > ~/.lein/credentials.clj.gpg
+
 {#"my\.datomic\.com" {:username "evansp2@gmail.com" :password <PASSWORD>}
  #"https://clojars.org/repo" {:username "evanspa" :password <PASSWORD>}}


Refactoring: clone-mirror-repo should use the 'sh' function

--- src/branch_handler/core.clj
+++ src/branch_handler/core.clj
@@ -74,7 +74,7 @@
 (defn clone-mirror-repo
     [workdir group reponame repository-url]
     (log/info "Cloning mirror repository" repository-url)
-    (exec "git" "clone" "--mirror" repository-url (repo-workdir workdir group reponame)))
+    (clojure.java.shell/sh "git" "clone" "--mirror" repository-url (repo-workdir workdir group reponame)))

 (defn read-branch-list-from-repo
     [workdir group reponame]


Add premain introspection

Add premain introspection

--- src/clj/introspect/core.clj
+++ src/clj/introspect/core.clj
@@ -63,12 +63,17 @@
     )
   )

+(defonce introspected-namespaces (atom #{}))
 (defn introspect-namespace
   [namespace-sym]
-  (IntrospectProfilingAgent/initializeAgent (-> namespace-sym
-                                                name
-                                                (.replace "-" "_")))
-  (compile namespace-sym)
+  (when (not (get introspected-namespaces namespace-sym))
+    (println (str "Introspecting " (name namespace-sym)))
+    (swap! introspected-namespaces conj namespace-sym)
+
+    (IntrospectProfilingAgent/initializeAgent (-> namespace-sym
+                                                  name
+                                                  (.replace "-" "_")))
+    (compile namespace-sym))
   ;; v.ns.name.name.replace('.', '/').replace('-','_') + "$" + munge(v.sym.name);
   )

@@ -88,3 +93,21 @@
   [t1 t2]
   (instance? (class t1)
              (class t2)))
+
+
+(gen-class
+ :name    introspect.Premain
+ :methods [#^{:static true} [premain [String java.lang.instrument.Instrumentation] void]])
+
+(defn -premain
+  [agent-args instrumentation]
+  (println " _       _                                 _ ")
+  (println "(_)_ __ | |_ _ __ ___  ___ _ __   ___  ___| |_")
+  (println "| | '_ \\| __| '__/ _ \\/ __| '_ \\ / _ \\/ __| __|")
+  (println "| | | | | |_| | | (_) \\__ \\ |_) |  __/ (__| |_")
+  (println "|_|_| |_|\\__|_|  \\___/|___/ .__/ \\___|\\___|\\__|")
+  (println "                          |_|                  ")
+
+  (binding [*compile-path* (str (System/getProperty "user.dir") "/target/classes")]
+    (doseq [n (clojure.string/split agent-args #";")]
+      (introspect-namespace (symbol n)))))


Removing leftover template file

Removing leftover template file

Likely from a Luminus template, since the default is handling auth through
ring sessions.

--- src/clj/memento/session.clj
+++ src/clj/memento/session.clj
@@ -1,20 +0,0 @@
-(ns memento.session)
-
-(defonce mem (atom {}))
-(def half-hour 1800000)
-
-(defn- current-time []
-  (quot (System/currentTimeMillis) 1000))
-
-(defn- expired? [[id session]]
-  (pos? (- (:ring.middleware.session-timeout/idle-timeout session) (current-time))))
-
-(defn clear-expired-sessions []
-  (clojure.core/swap! mem #(->> % (filter expired?) (into {}))))
-
-(defn start-cleanup-job! []
-  (future
-    (loop []
-      (clear-expired-sessions)
-      (Thread/sleep half-hour)
-      (recur))))


Fixes an AOT bug when compiling from a clean repo

Require the resumable remote webdriver .clj file, forcing it to
compile, before importing the java class

--- src/clj/shale/webdriver.clj
+++ src/clj/shale/webdriver.clj
@@ -4,7 +4,8 @@
             [clj-webdriver.core :as core]
             [clj-webdriver.remote.driver :refer [session-id]]
             [clj-webdriver.taxi :refer [execute-script]]
-            wall.hack)
+            wall.hack
+            shale.ext.ResumableRemoteWebDriver)
   (:import org.openqa.selenium.remote.DesiredCapabilities
            clj_webdriver.ext.remote.RemoteWebDriverExt
            java.net.URL


Removed time check function.

Removed time check function.

--- src/cljs/bookmarx/core.cljs
+++ src/cljs/bookmarx/core.cljs
@@ -39,7 +39,7 @@

 (defn load-bookmarks "Request bookmarks from the server and set local state."
   [rev]
-  (go (time (let [url (str (:host-url env) (:prefix env) "/api/bookmarks/since/" rev)
+  (go (let [url (str (:host-url env) (:prefix env) "/api/bookmarks/since/" rev)
             response (<! (http/get url {:query-params {:csrf-token true} :with-credentials? false}))
             bookmarks (into {} (map #(vector (:bookmark/id %) %) (get-in response [:body :bookmarks])))
             revision (get-in response [:body :revision])]
@@ -53,7 +53,7 @@
                                            :max-age (* (:cache-refresh-hours env) 60 60)})
         (when-not (= rev revision)
           (.setItem (.-localStorage js/window) "bookmarks"
-                    (pr-str (into {} (remove #(keyword? (key %)) @session/state)))))))))
+                    (pr-str (into {} (remove #(keyword? (key %)) @session/state))))))))

 (defn current-page "Render the current page."
   []


More schema support for a :description metadata key

--- src/io/aviso/rook/schema.clj
+++ src/io/aviso/rook/schema.clj
@@ -1,6 +1,7 @@
 (ns io.aviso.rook.schema
   "Some small enhancements to Prismatic Schema that are valuable to, or needed by, the Swagger support."
-  {:added "0.1.27"})
+  {:added "0.1.27"}
+  (:require [schema.core :as s]))

 (defmacro schema
   "Creates a named schema, which includes metadata as per [[defschema]]. This is useful for one-off
@@ -25,4 +26,16 @@
   ([name docstring form]
    `(def ~name ~docstring (schema ~name ~docstring ~form))))

+(defn with-description
+  "Adds a :description key to the metadata of the schema.

+  Since nil can't have metadata, a nil schema is quietly converted to schema.core/Any."
+  [description schema]
+  (vary-meta (or schema s/Any) assoc :description description))
+
+(defn description
+  "A convienience for generating a description with no schema."
+  [s]
+  (with-description s nil))
+
+


Remove unused display-types

Remove unused display-types

--- src/metabase/models/card.clj
+++ src/metabase/models/card.clj
@@ -7,19 +7,6 @@
                              [revision :as revision])
             (metabase [query :as q]
                       [util :as u])))
-
-(def ^:const display-types
-  "Valid values of `Card.display_type`."
-  #{:area
-    :bar
-    :country
-    :line
-    :pie
-    :pin_map
-    :scalar
-    :state
-    :table
-    :timeseries})

 (i/defentity Card :report_card)


Removed a whitespace

Removed a whitespace

and made a commit! Wauh!

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

--- src/conexp/fca/lattices.clj
+++ src/conexp/fca/lattices.clj
@@ -252,7 +252,7 @@
   [lat]
   (make-context (lattice-sup-irreducibles lat)
 		(lattice-inf-irreducibles lat)
-		(fn [x y]
+		(fn [x y]
 		  ((order lat) [x y]))))

 ;;;


Improve linear-backward! to avoid allocations

--- src/cortex/impl/layers.cljc
+++ src/cortex/impl/layers.cljc
@@ -259,7 +259,8 @@
        (blas/gemv! input-gradient true 1.0 weights output-gradient 0.0)
        (assoc this :input-gradient input-gradient))
      (do
-       (assoc this :input-gradient (m/inner-product (m/transpose weights) output-gradient))))))
+       (m/set-inner-product! (:input-gradient this) (m/transpose weights) output-gradient)
+       this))))

 ;; LINEAR
 ;; function that implements a linear transformation (weights + bias)


Adds UTF-8 encoding to getBytes for html in TOC generation

getBytes was called without an encoding specification, garbling non-ASCII
characters that have not been encoded in the html source file. Fixes #24

--- src/leiningen/new/cryogen/src/cryogen/toc.clj
+++ src/leiningen/new/cryogen/src/cryogen/toc.clj
@@ -19,7 +19,7 @@

 (defn generate-toc [html]
   (-> html
-      (.getBytes)
+      (.getBytes "UTF-8")
       (java.io.ByteArrayInputStream.)
       (html/parse)
       :content


Call `(shutdown-agents)` after test runs. Some stray non-daemon threads may cause the JVM to hang on exit. Call this after all tests have run to allow proper shutdown.

--- src/main/resources/clojuresque/tasks/test.clj
+++ src/main/resources/clojuresque/tasks/test.clj
@@ -42,7 +42,12 @@

 (deftask main
   [{:keys [junit tests] :as options}]
-  (cond
-    junit       (test-junit/test-namespaces options)
-    (seq tests) (test-vars options)
-    :else       (test-namespaces options)))
+  (try
+    (cond
+      junit       (test-junit/test-namespaces options)
+      (seq tests) (test-vars options)
+      :else       (test-namespaces options))
+  ;; Some stray non-daemon threads may cause the JVM to hang on exit.
+  ;; Call this after all tests have run to allow proper shutdown.
+  (finally
+    (shutdown-agents))))


Simplify TimerInput implementation.

Simplify TimerInput implementation.

--- src/org/playasophy/wonderdome/input/timer.clj
+++ src/org/playasophy/wonderdome/input/timer.clj
@@ -8,6 +8,7 @@
   "Constructs a new runnable looping function which puts an event on the given
   output channel every period milliseconds. The loop can be terminated by
   interrupting the thread."
+  ^Runnable
   [period channel]
   (fn []
     (try
@@ -21,32 +22,28 @@

 (defrecord TimerInput
-  [period out thread])
+  [^long period output ^Thread thread]

-(extend-type TimerInput
   component/Lifecycle

   (start
     [this]
     (println (str "Starting " this "..."))
-    (when-not (:out this)
+    (when-not output
       (throw (IllegalStateException. "Cannot start TimerInput without output channel")))
     ; TODO: create sliding-buffer and mix into output?
-    (if (:thread this)
-      (do
-        (println (str this " is already running"))
-        this)
-      (let [run (timer-loop (:period this) (:out this))]
-        (assoc this :thread
-          (doto (Thread. ^Runnable run "TimerInput")
-            (.setDaemon true)
-            (.start))))))
+    (if thread
+      this
+      (assoc this :thread
+        (doto (Thread. (timer-loop period output) "TimerInput")
+          (.setDaemon true)
+          (.start)))))

   (stop
     [this]
     (println (str "Stopping " this "..."))
-    (when-let [^Thread thread (:thread this)]
+    (when thread
       (.interrupt thread)
       (.join thread 1000))
     (assoc this :thread nil)))
@@ -55,7 +52,6 @@
 (defn timer
   "Creates a new timer that will put an event on the output channel every period
   milliseconds."
-  ([period]
-   (TimerInput. period nil nil))
-  ([period out]
-   (TimerInput. period out nil)))
+  [period]
+  {:pre [(pos? period)]}
+  (TimerInput. period nil nil))


Cleaned up :require/:import

Cleaned up :require/:import

--- desktop/src-common/ds3/ship.clj
+++ desktop/src-common/ds3/ship.clj
@@ -2,11 +2,10 @@
   (:require [pixel-ships.core :as psc :refer :all]
             [pixel-ships.bollinger :as bollinger :refer :all]
             [ds3.common :as c]
-            [play-clj.core :refer [bundle shape color key-pressed? pixmap! pixmap*]]
+            [play-clj.core :refer [bundle shape color key-pressed? pixmap! pixmap* pixmap-format]]
             [play-clj.g2d :refer [texture]]
             [play-clj.g2d-physics :refer :all]
-            [play-clj.math :refer [vector-2]])
-  (:import [com.badlogic.gdx.graphics Pixmap Texture TextureData Pixmap$Format]))
+            [play-clj.math :refer [vector-2]]))

 (declare play-clj-color hsv-to-rgb create-ship-body! move draw-rect-pixelmap create-pixel-ship-texture)

@@ -44,7 +43,7 @@
    (create-pixel-ship-texture (rand-int Integer/MAX_VALUE)))
   ([seed]
    (let [pixel-map-list (create-pixel-map-list seed)
-         pix-map (pixmap* 16 16 Pixmap$Format/RGBA8888)]
+         pix-map (pixmap* 16 16 (pixmap-format :r-g-b-a8888))]
      (doseq [pixel pixel-map-list] (draw-rect-pixelmap pix-map pixel))
      (texture pix-map))))


ns fix

ns fix

--- resources/leiningen/new/closp/clj/components/handler.clj
+++ resources/leiningen/new/closp/clj/components/handler.clj
@@ -32,7 +32,7 @@
   (-> (app-handler
         (into [] (concat (when (:registration-allowed? config) [(registration-routes config)])
                          ;; add your application routes here
-                         [(cc-routes) home-routes (user-routes config) base-routes]))
+                         [(cc-routes config) home-routes (user-routes config) base-routes]))
         ;; add custom middleware here
         :middleware (load-middleware config (:tconfig locale))
         :ring-defaults (mk-defaults false)


tweaked comments

tweaked comments

--HG--
extra : rebase_source : 7edc37d43ee47da349ddc8f2ae3fc2697987b2fd

--- sherpa-clojure/src/main/clojure/sherpa/sherpa_client.clj
+++ sherpa-clojure/src/main/clojure/sherpa/sherpa_client.clj
@@ -24,11 +24,11 @@
   (query [client sparql params props]
     "Execute a query on a SPARQL processor and return a sequence of results for the query.
       sparql - query string
-      params - map of param names and values
-      props - map of query properties like: timeout
+      params - map of param names and values (keys are expected to be keywords)
+      props - map of query properties like: timeout (keys are expected to be keywords)
     The return value is a map of info:
       :results The result sequence
-      :query-hnadle An opaque query handle that can be used to cancel the query")
+      :query-handle An opaque query handle that can be used to cancel the query")
   (cancel [client query-handle] "Cancel the query based on query-handle.")
   (close [client query-handle] "Close the query execution and release all resources.")
   (shutdown [client] "Close the client and release all resources."))


Refactor focus check

Refactor focus check

--- src/obb_rules/translator.clj
+++ src/obb_rules/translator.clj
@@ -1,20 +1,26 @@
 (ns obb-rules.translator
   (:require [obb-rules.board :as board]
+            [obb-rules.simplifier :as simplify]
             [obb-rules.element :as element]))

 (def max-coordinate (+ 1 board/default-board-w))

+(defn- default-focus?
+  "Checks if the current given focus is the default one"
+  [focus]
+  (simplify/name= :p1 focus))
+
 (defn coordinate
   "Translates a coordinate for a given player focus"
   [focus [x y]]
-  (if (= :p1 focus)
+  (if (default-focus? focus)
     [x y]
     [(- max-coordinate x) (- max-coordinate y)]))

 (defn direction
   "Translates a direction for a given player focus"
   [focus dir]
-  (if (= :p1 focus)
+  (if (default-focus? focus)
     dir
     (cond
       (= (keyword dir) :south) :north
@@ -25,7 +31,7 @@
 (defn element
   "Translates an element for a given player focus"
   [focus element]
-  (if (= :p1 focus)
+  (if (default-focus? focus)
     element
     (let [dir (element/element-direction element)
           coord (element/element-coordinate element)]
@@ -54,7 +60,7 @@
 (defn action
   "Translates an action for a given player focus"
   [focus action]
-  (if (= :p1 focus)
+  (if (default-focus? focus)
     action
     (convert-action action)))

@@ -74,6 +80,6 @@
 (defn board
   "Translates a full board to a given player focus"
   [focus board]
-  (if (= :p1 focus)
+  (if (default-focus? focus)
     board
     (convert-board board)))


Fix pre checks for read-paginated-recently-posted-entries.

--- src/oc/storage/db/common.clj
+++ src/oc/storage/db/common.clj
@@ -147,8 +147,8 @@
    container-last-seen-at {count? :count unseen :unseen container-id :container-id :or {count? false unseen false}}]
   {:pre [(db-common/conn? conn)
          (db-common/s-or-k? table-name)
-         (db-common/s-or-k? index-name)
-         (or (string? index-value) (sequential? index-value))
+         (keyword? index-name)
+         (sequential? index-value)
          (db-common/s-or-k? relation-table-name)
          (#{:desc :asc} order)
          (or (nil? start)


Use resource-uuid-reaction to filter on comments also in inbox query, add the not author filter after.

--- src/oc/storage/db/common.clj
+++ src/oc/storage/db/common.clj
@@ -105,7 +105,9 @@
             ;; Merge in a last-activity-at date for each post (last comment created-at, fallback to published-at)
             (r/merge query (r/fn [post-row]
               {:last-activity-at (-> (r/table relation-table-name)
-                                     (r/get-all [(r/get-field post-row :uuid) user-id nil] {:index :resource-uuid-author-uuid-reaction})
+                                     (r/get-all [(r/get-field post-row :uuid) nil] {:index :resource-uuid-reaction})
+                                     (r/filter (r/fn [interaction-row]
+                                       (r/ne (r/get-field interaction-row [:author :user-id]) user-id)))
                                      (r/max :created-at)
                                      (r/default
                                       (r/default


Auto-loading mixer once the studio is ready.

--- src/overtone/studio/core.clj
+++ src/overtone/studio/core.clj
@@ -31,11 +31,9 @@
                            clamp-time relax-time)]
     (out out-bus (pan2 limited pan volume))))

-(on-event :new-synth :mixer-loader
-  (fn [evt]
-    (when (= "mixer" (:name (:synth evt)))
-      (let [mix (mixer :tgt @mixer-group*)]
-        (dosync (ref-set mixer-id* mix))))))
+(defn start-mixer []
+  (let [mix (mixer :tgt @mixer-group*)]
+    (dosync (ref-set mixer-id* mix))))

 (defn setup-studio []
   (let [g (group :tail ROOT-GROUP)
@@ -45,7 +43,9 @@
       (ref-set inst-group* g)
       (ref-set mixer-group* m)
       (ref-set record-group* r)
-      (map-vals #(assoc % :group (group :tail g)) @instruments*))))
+      (ref-set instruments* (map-vals #(assoc % :group (group :tail g))
+                                      @instruments*)))
+    (start-mixer)))

 (on-sync-event :connected :studio-setup setup-studio)


start the mixer after a suitable delay (to ensure all synths have had time to be reified on the server) in a separate non-synchronous thread after the studio setup has completed

--- src/overtone/studio/core.clj
+++ src/overtone/studio/core.clj
@@ -32,8 +32,11 @@
     (out out-bus (pan2 limited pan volume))))

 (defn start-mixer []
+  (Thread/sleep 2000)
   (let [mix (mixer :tgt @mixer-group*)]
     (dosync (ref-set mixer-id* mix))))
+
+(on-event :studio-setup-completed :start-mixer start-mixer)

 (defn setup-studio []
   (let [g (group :tail ROOT-GROUP)
@@ -43,9 +46,9 @@
       (ref-set inst-group* g)
       (ref-set mixer-group* m)
       (ref-set record-group* r)
-      (ref-set instruments* (map-vals #(assoc % :group (group :tail g))
+      (ref-set instruments* (map-vals #(assoc % :group (group :tail g))
                                       @instruments*)))
-    (start-mixer)))
+    (event :studio-setup-completed)))

 (on-sync-event :connected :studio-setup setup-studio)


use to-sc-id in favour of :id

use to-sc-id in favour of :id

--- src/overtone/studio/inst.clj
+++ src/overtone/studio/inst.clj
@@ -69,7 +69,7 @@
 (defmethod inst-fx! :stereo
   [inst fx]
   (let [fx-group (:fx-group inst)
-        bus-l (:id (:bus inst))
+        bus-l (to-sc-id (:bus inst))
         bus-r (inc bus-l)
         fx-ids [(fx :tgt fx-group :pos :tail :bus bus-l)
                 (fx :tgt fx-group :pos :tail :bus bus-r)]]


Update comment.

Update comment.

--- src/cavm/h2.clj
+++ src/cavm/h2.clj
@@ -548,7 +548,8 @@
 ; pass in a function to return the seq, instead.

 (defn load-exp
-  "Load matrix file and metadata. Skips the data load if file hashes are unchanged."
+  "Load matrix file and metadata. Skips the data load if file hashes are unchanged,
+  and 'force' is false."
   ([files metadata matrix-fn features]
    (load-exp files metadata matrix-fn features false))


replace dorun/map with doseq.

replace dorun/map with doseq.

--- src/cavm/h2.clj
+++ src/cavm/h2.clj
@@ -483,9 +483,10 @@
  (let [ia (float-array idxs)]
   (amap ia i ret (aget a i))))

-(defn ashuffle-float [mapping ^floats out ^floats in]
-  (dorun (map #(aset out (% 1) (aget in (% 0))) mapping))
-  out)
+(defn ashuffle-float [mappings ^floats out ^floats in]
+   (doseq [[i-in i-out] mappings]
+     (aset out i-out (aget in i-in)))
+   out)

 (defn bytes-to-floats [^bytes barr]
   (let [bb (java.nio.ByteBuffer/allocate (alength barr))
@@ -962,9 +963,8 @@
 ; Take map of bin copy fns, list of scores rows, and a map of output arrays,
 ; copying the scores to the output arrays via the bin copy fns.
 (defn- build-score-arrays [rows bfns out]
-  (dorun (map (fn [{i :I scores :SCORES field :NAME}]
-                ((bfns i) (out field) scores))
-              rows))
+  (doseq [{i :I scores :SCORES field :NAME} rows]
+    ((bfns i) (out field) scores))
   out)

 (defn- col-arrays [columns n]


Convenience method for adding references

--- src/derive/nativestore.cljs
+++ src/derive/nativestore.cljs
@@ -164,6 +164,14 @@
   (resolve-ref [_] (get store id))
   (reference-id [_] id)
   (reference-db [_] store))
+
+(declare native?)
+
+(defn reference [db obj]
+  (NativeReference.
+   db (if (native? obj)
+        ((key-fn (.-root db)) obj)
+        obj)))

 ;; Mutation can only be done on Natives in
 ;; a transaction or on copies of Natives generated


Cleaned up microscope code

Cleaned up microscope code

--- src/polismath/microscope.clj
+++ src/polismath/microscope.clj
@@ -11,12 +11,6 @@
             [clojure.tools.trace :as tr]
             [clojure.tools.logging :as log]
             [clojure.newtools.cli :refer [parse-opts]]))
-
-
-
-(def cli-options
-  [["-z" "--zid ZID" "ZID on which to do a rerun" :parse-fn #(Integer/parseInt %)]
-   ["-Z" "--zinvite ZINVITE" "ZINVITE code on which to perform a rerun"]])

 (defn conv-poll
@@ -39,10 +33,8 @@

 (defn recompute
-  [& args]
-  (let [{:keys [options arguments errors summary]} (parse-opts args cli-options)
-        {:keys [zid zinvite]} options
-        _          (assert (xor zid zinvite))
+  [& {:keys [zid zinvite] :as args}]
+  (let [_          (assert (xor zid zinvite))
         zid        (or zid (get-zid-from-zinvite zinvite))
         new-votes  (conv-poll zid)
         conv-agent ((cm/new-conv-agent-builder zid))]
@@ -61,6 +53,18 @@
   [& {:keys [zid zinvite] :as args}]
   (assert (xor zid zinvite))
   (let [zid (or zid (get-zid-from-zinvite zinvite))]
-    (load-conv zid)))
+    (db/load-conv zid)))

+(def cli-options
+  [["-z" "--zid ZID" "ZID on which to do a rerun" :parse-fn #(Integer/parseInt %)]
+   ["-Z" "--zinvite ZINVITE" "ZINVITE code on which to perform a rerun"]])
+
+
+(defn -main
+  [& args]
+  (let [{:keys [options arguments errors summary]} (parse-opts args cli-options)]
+    (apply-kwargs recompute options)))
+
+
+


Workflow run list empty states, plus spinners

--- src-cljs/frontend/components/pages/workflow.cljs
+++ src-cljs/frontend/components/pages/workflow.cljs
@@ -1,12 +1,13 @@
 (ns frontend.components.pages.workflow
-  (:require [cljs-time.coerce :as t-coerce]
-            [clojure.string :as string]
+  (:require [clojure.string :as string]
             [frontend.api :as api]
             [frontend.components.aside :as aside]
             [frontend.components.common :as common]
             [frontend.components.pieces.button :as button]
             [frontend.components.pieces.card :as card]
+            [frontend.components.pieces.empty-state :as empty-state]
             [frontend.components.pieces.icon :as icon]
+            [frontend.components.pieces.spinner :refer [spinner]]
             [frontend.components.templates.main :as main-template]
             [frontend.datetime :as datetime]
             [frontend.models.build :as build-model]
@@ -185,7 +186,15 @@
   Object
   (render [this]
     (component
-      (-> this om-next/props :project/workflow-runs run-row-collection))))
+      (if-let [runs (seq (:project/workflow-runs (om-next/props this)))]
+        (run-row-collection runs)
+        (let [project-name (:project/name (om-next/props this))
+              org-name (:organization/name (:project/organization (om-next/props this)))]
+          (card/basic
+           (empty-state/empty-state
+            {:icon (icon/workflows)
+             :heading (html [:span (empty-state/important (str org-name "/" project-name)) " has no workflows defined yet"])
+             :subheading (str "Add a workflow section to " project-name "'s config to start running workflows.")})))))))

 (def project-workflow-runs (om-next/factory ProjectWorkflowRuns))

@@ -253,8 +262,9 @@
                   :vcs_type vcs-type}]
         :header-actions (settings-link vcs-type org-name project-name)
         :sidebar (build-legacy legacy-branch-picker (:legacy/state (om-next/props this)))
-        :main-content (when-let [project (:project-for-runs (om-next/props this))]
-                        (project-workflow-runs project))}))))
+        :main-content (if-let [project (:project-for-runs (om-next/props this))]
+                        (project-workflow-runs project)
+                        (spinner))}))))

 (defui ^:once OrgWorkflowRuns
   static om-next/IQuery
@@ -265,7 +275,14 @@
   Object
   (render [this]
     (component
-      (-> this om-next/props :organization/workflow-runs run-row-collection))))
+      (if-let [runs (seq (:organization/workflow-runs (om-next/props this)))]
+        (run-row-collection runs)
+        (let [org-name (:organization/name (om-next/props this))]
+          (card/basic
+           (empty-state/empty-state
+            {:icon (icon/workflows)
+             :heading (html [:span (empty-state/important org-name) " has no workflows defined yet"])
+             :subheading (str "Add a workflow section to one of " org-name "'s project configs to start running workflows.")})))))))

 (def org-workflow-runs (om-next/factory OrgWorkflowRuns))

@@ -299,5 +316,6 @@
                   :username org-name
                   :vcs_type vcs-type}]
         :sidebar (build-legacy legacy-branch-picker (:legacy/state (om-next/props this)))
-        :main-content (when-let [org (:org-for-runs (om-next/props this))]
-                        (org-workflow-runs org))}))))
+        :main-content (if-let [org (:org-for-runs (om-next/props this))]
+                        (org-workflow-runs org)
+                        (spinner))}))))


fix: version info

fix: version info

--- src/featured_gml/runner.clj
+++ src/featured_gml/runner.clj
@@ -73,13 +73,9 @@
   (System/exit status))

 (defn implementation-version []
-(->> "project.clj"
-     slurp
-     read-string
-     (drop 2)
-     (cons :version)
-     (apply hash-map)
-     (:version)))
+  (if-let [version (System/getProperty "featured-gml.version")]
+    version
+    (-> ^java.lang.Class (eval 'featured_gml.runner) .getPackage .getImplementationVersion)))

 (defn usage [options-summary]
   (->> ["This program converts xml to featured-ready json. The conversion is done using the provided mappingconfig(uration) specified in edn."


Adding more description

Adding more description

--- src/hasta_la_vista/core.clj
+++ src/hasta_la_vista/core.clj
@@ -28,6 +28,9 @@
 ;; Read config

 ;;https://github.com/l1x/shovel/blob/master/src/shovel/core.clj
+;;this is considered defensing programming, but it is intentional
+;;supplying an arbitrary bad input should not cause this function to
+;;explode, in fact it should just return an error
 (defn read-file
   "Returns {:ok string } or {:error...}"
   [^String file]
@@ -40,8 +43,11 @@
   (catch Exception e
     {:error "Exception" :fn "read-file" :exception (.getMessage e) }))) ; catch all exceptions

-;Parsing a string to Clojure data structures the safe way
+;;Parsing a string to Clojure data structures the safe way
+;;aka what could possibly go wrong dealing with a random
+;;user controlled string
 (defn parse-edn-string
+  "Returns the Clojure data structure representation of s"
   [s]
   (try
     {:ok (clojure.edn/read-string s)}
@@ -50,7 +56,8 @@

 ;This function wraps the read-file and the parse-edn-string
 ;so that it only return {:ok ... } or {:error ...}
-(defn read-config
+(defn read-config
+  "Returns the Clojure data structure version of the config file"
   [file]
   (let
     [ file-string (read-file file) ]
@@ -71,7 +78,9 @@

 ;; Connecting to CB

-(defn connect
+(defn connect
+  "Returns a client that is connected to the Couchbase cluster
+   using multiple threads"
   [cb-client-config]
   (client/defclient client-connection cb-client-config))

@@ -102,6 +111,9 @@
 (defn -main
   "
   This is the main entry point when you start up the JAR
+  parses the config, starts up the connections in each thread
+  and starts to consume the view by 1000 item chunks
+
   "
   [& args]
   (let [  chan    (chan 5)
@@ -129,6 +141,10 @@
       (blocking-consumer
         (go
           (let [[result source] (alts! [chan (timeout 1500)])]
+            ;; if source is the channel than a value is returned in result
+            ;; when the source is something else like timeout, we time out
+            ;; and stop execution
+            ;; production timeout should be like 1-3 mins
             (if (= source chan)
               (println "Got a value!" result)
               ;else - timeout


Atoms: Add missing test

Atoms: Add missing test

--- test/com/nomistech/clojure_the_language/c_900_appy_stuff/s_100_science/ss_atomic_orbitals.clj
+++ test/com/nomistech/clojure_the_language/c_900_appy_stuff/s_100_science/ss_atomic_orbitals.clj
@@ -17,6 +17,9 @@
        (reductions +)))

 ;;;; ___________________________________________________________________________
+
+(fact +n-orbitals-extra-at-energy-level-diffs+
+  => [0 1 3 0 5 0 7 0])

 (fact +n-electrons-extra-at-energy-level-diffs+
   => [0 2 6 0 10 0 14 0])


CMR-3113: Removed unneeded code.

CMR-3113: Removed unneeded code.

--- umm-spec-lib/src/cmr/umm_spec/validation/collection.clj
+++ umm-spec-lib/src/cmr/umm_spec/validation/collection.clj
@@ -2,9 +2,6 @@
   "Defines validations for UMM collections."
   (:require [clj-time.core :as t]
             [cmr.common.validations.core :as v]
-            [cmr.spatial.polygon :as poly]
-            [cmr.spatial.ring-relations :as rr]
-            [cmr.spatial.validation :as sv]
             [cmr.umm-spec.validation.spatial :as s]
             [cmr.umm-spec.validation.platform :as p]
             [cmr.umm-spec.validation.additional-attribute :as aa]))
@@ -20,30 +17,6 @@
 (def temporal-extent-validation
   {:RangeDateTimes (v/every range-date-time-validation)})

-(defn boundary->ring
-  [coord-sys boundary]
-  (rr/ords->ring coord-sys (mapcat #(vector (:Longitude %) (:Latitude %))(:Points boundary))))
-
-(defn gpolygon->polygon
-  [coord-sys gpolygon]
-  (poly/polygon
-   coord-sys
-   (concat [(boundary->ring coord-sys (:Boundary gpolygon))]
-           ;; holes would go here
-           nil)))
-
-(defn polygon-validation
-  [field-path gpolygon]
-  (let [coord-sys :geodetic]
-    (when-let [errors (seq (sv/validate (gpolygon->polygon coord-sys gpolygon)))]
-      {field-path errors})))
-
-(def spatial-extent-validation
-  {:HorizontalSpatialDomain
-   {:Geometry
-    {:GPolygons (v/every polygon-validation)}}})
-
-
 (def collection-validations
   "Defines validations for collections"
   {:TemporalExtents (v/every temporal-extent-validation)


Added string_atoi to instructions.

Added string_atoi to instructions.

--- src/clojush.clj
+++ src/clojush.clj
@@ -1018,6 +1018,17 @@
                  :integer
                  (pop-item :string state))
       state)))
+
+(define-registered
+  string_atoi
+  (fn [state]
+    (if (not (empty? (:string state)))
+      (try (pop-item :string
+                     (push-item (Integer/parseInt (top-item :string state))
+                                :integer state))
+           (catch Exception e state))
+      state)))
+

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; code and exec instructions


CMR-3682: Cleaned up the require in data_date.clj.

--- umm-spec-lib/src/cmr/umm_spec/validation/data_date.clj
+++ umm-spec-lib/src/cmr/umm_spec/validation/data_date.clj
@@ -1,11 +1,8 @@
 (ns cmr.umm-spec.validation.data-date
   "Defines validations for UMM collection DataDates and MetadataDates"
   (:require
-   [cmr.umm-spec.date-util :as date-util]
    [clj-time.core :as time]
-   [cmr.common.validations.core :as v]
-   [cmr.umm-spec.date-util :as date]
-   [cmr.umm-spec.validation.umm-spec-validation-utils :as vu]))
+   [cmr.umm-spec.date-util :as date-util]))

 (defn data-dates-warning-validation
   "Validate that DataDates/MetadataDates'


Updated Hello World version.

Updated Hello World version.

--- examples/hello-world/project.clj
+++ examples/hello-world/project.clj
@@ -2,6 +2,6 @@
   :license {:name "Eclipse Public License"
             :url "http://www.eclipse.org/legal/epl-v10.html"}
   :dependencies [[org.clojure/clojure "1.10.0"]
-                 [uncomplicate/neanderthal "0.23.0-SNAPSHOT"]]
+                 [uncomplicate/neanderthal "0.23.0"]]
   :exclusions [[org.jcuda/jcuda-natives :classifier "apple-x86_64"]
                [org.jcuda/jcublas-natives :classifier "apple-x86_64"]])


core.async: Improve sentynil tests.

core.async: Improve sentynil tests.

--- test/com/nomistech/clojure_the_language/core_async_mapping_etc_test.clj
+++ test/com/nomistech/clojure_the_language/core_async_mapping_etc_test.clj
@@ -141,22 +141,22 @@
 (defn sentynil-chan [ch] (a/remove> sentynil? ch))

 (fact "About using a sentynil value for nil"
-
-  (fact "In Clojure 1.6"
-    (let [wrapped-ch  (a/chan)
-          wrapping-ch (sentynil-chan wrapped-ch)]
-      (a/go
-        (doseq [i [0 1 nil 3 nil]]
-          (a/>! wrapping-ch (nil->sentynil i)))
-        (a/close! wrapping-ch))
-      (chan->seq wrapped-ch))
-    => [0 1 3])
+
+  (letfn [(put-stuff-and-close [c]
+            (a/go
+              (doseq [i [0 1 nil 3 nil]]
+                (a/>! c (nil->sentynil i)))
+              (a/close! c)))]

-  (fact "In Clojure 1.7"
-    (let [c (a/chan 1 (remove sentynil?))]
-      (a/go
-        (doseq [i [0 1 nil 3 nil]]
-          (a/>! c (nil->sentynil i)))
-        (a/close! c))
-      (chan->seq c))
-    => [0 1 3]))
+    (fact "In Clojure 1.6"
+      (let [wrapped-ch  (a/chan)
+            wrapping-ch (sentynil-chan wrapped-ch)]
+        (put-stuff-and-close wrapping-ch)
+        (chan->seq wrapped-ch))
+      => [0 1 3])
+
+    (fact "In Clojure 1.7"
+      (let [c (a/chan 1 (remove sentynil?))]
+        (put-stuff-and-close c)
+        (chan->seq c))
+      => [0 1 3])))


Gui: own token maker not longer used (doesn't work anyway...)

--- src/gui/main.clj
+++ src/gui/main.clj
@@ -11,8 +11,8 @@
 (native!)

 ; register own editor parser for highlighting
-(let [tmf (TokenMakerFactory/getDefaultInstance)]
-  (.putMapping tmf "text/mpa" "fully.qualified.MpaTokenMaker"))
+;(let [tmf (TokenMakerFactory/getDefaultInstance)]
+;  (.putMapping tmf "text/mpa" "fully.qualified.MpaTokenMaker"))

 ; result handling
 ; this must be placed here, so it can be accessed from handler.clj


CMR-3167 Additional unit tests to cover date/time scenarios

--- umm-spec-lib/test/cmr/umm_spec/test/validation/additional_attribute.clj
+++ umm-spec-lib/test/cmr/umm_spec/test/validation/additional_attribute.clj
@@ -105,6 +105,8 @@
            :datetime "bar" :ParameterRangeBegin ["Parameter Range Begin [bar] is not a valid value for type [DATETIME]."]
            :date "2002-01-01T00:00:00.000Z" :ParameterRangeBegin ["Parameter Range Begin [2002-01-01T00:00:00.000Z] is not a valid value for type [DATE]."]
            :time "2002-01-01T00:00:00.000Z" :ParameterRangeBegin ["Parameter Range Begin [2002-01-01T00:00:00.000Z] is not a valid value for type [TIME]."]
+           :date "00:03:01.000" :ParameterRangeBegin ["Parameter Range Begin [00:03:01.000] is not a valid value for type [DATE]."]
+           :time "2002-01-01" :ParameterRangeBegin ["Parameter Range Begin [2002-01-01] is not a valid value for type [TIME]."]

            :boolean "true" :ParameterRangeEnd ["Parameter Range End is not allowed for type [BOOLEAN]"]
            :float "bar" :ParameterRangeEnd ["Parameter Range End [bar] is not a valid value for type [FLOAT]."]
@@ -114,6 +116,8 @@
            :datetime "bar" :ParameterRangeEnd ["Parameter Range End [bar] is not a valid value for type [DATETIME]."]
            :date "2002-01-01T00:00:00.000Z" :ParameterRangeEnd ["Parameter Range End [2002-01-01T00:00:00.000Z] is not a valid value for type [DATE]."]
            :time "2002-01-01T00:00:00.000Z" :ParameterRangeEnd ["Parameter Range End [2002-01-01T00:00:00.000Z] is not a valid value for type [TIME]."]
+           :date "00:03:01.000" :ParameterRangeEnd ["Parameter Range End [00:03:01.000] is not a valid value for type [DATE]."]
+           :time "2002-01-01" :ParameterRangeEnd ["Parameter Range End [2002-01-01] is not a valid value for type [TIME]."]

            :boolean "bar" :Value ["Value [bar] is not a valid value for type [BOOLEAN]."]
            :float "bar" :Value ["Value [bar] is not a valid value for type [FLOAT]."]
@@ -122,7 +126,9 @@
            :time "bar" :Value ["Value [bar] is not a valid value for type [TIME]."]
            :datetime "bar" :Value ["Value [bar] is not a valid value for type [DATETIME]."]
            :date "2002-01-01T00:00:00.000Z" :Value ["Value [2002-01-01T00:00:00.000Z] is not a valid value for type [DATE]."]
-           :time "2002-01-01T00:00:00.000Z" :Value ["Value [2002-01-01T00:00:00.000Z] is not a valid value for type [TIME]."]))
+           :time "2002-01-01T00:00:00.000Z" :Value ["Value [2002-01-01T00:00:00.000Z] is not a valid value for type [TIME]."]
+           :date "00:03:01.000" :Value ["Value [00:03:01.000] is not a valid value for type [DATE]."]
+           :time "2002-01-01" :Value ["Value [2002-01-01] is not a valid value for type [TIME]."]))

     (testing "multiple invalid values"
       (h/assert-multiple-invalid


Formatting change

Formatting change

--- src/io/aviso/rook/async.clj
+++ src/io/aviso/rook/async.clj
@@ -24,22 +24,21 @@
     perform its own async operations, is more challenging.
     The delegated handler should be invoked inside a [[safe-go]] block, so that the result from the handler
     can be obtained without blocking."
-  (:import (javax.servlet.http HttpServletResponse))
-  (:require
-    io.aviso.rook.internals
-    [clojure.core.async :refer [chan go >! <! <!! >!! thread put! take! close!]]
-    [io.aviso.toolchest.exceptions :refer [to-message]]
-    ring.middleware.params
-    ring.middleware.keyword-params
-    [ring.middleware
-     [session :as session]
-     [format-params :as format-params]
-     [format-response :as format-response]]
-    [io.aviso.rook
-     [schema-validation :as sv]
-     [response-validation :as rv]
-     [utils :as utils]]
-    [potemkin :as p]))
+  (:require io.aviso.rook.internals
+            [clojure.core.async :refer [chan go >! <! <!! >!! thread put! take! close!]]
+            [io.aviso.toolchest.exceptions :refer [to-message]]
+            ring.middleware.params
+            ring.middleware.keyword-params
+            [ring.middleware
+             [session :as session]
+             [format-params :as format-params]
+             [format-response :as format-response]]
+            [io.aviso.rook
+             [schema-validation :as sv]
+             [response-validation :as rv]
+             [utils :as utils]]
+            [potemkin :as p])
+  (:import (javax.servlet.http HttpServletResponse)))

 (p/import-vars [io.aviso.rook.internals

@@ -59,31 +58,31 @@
   "Asychronous version of `ring.middleware.format/wrap-restful-format`; this implementation
   will work properly inside an asynchronous pipeline."
   ([handler]
-   (wrap-restful-format handler [:json-kw :edn]))
+    (wrap-restful-format handler [:json-kw :edn]))
   ([handler formats]
-   (let [req-handler (format-params/wrap-restful-params handler :formats formats)]
-     (fn [request]
-       (let [response-ch (chan 1)]
-         ;; To keep things fully asynchronous, we first invoke the downstream handler.
-         (take! (try
-                  (req-handler request)
-                  (catch Throwable t
-                         (result->channel
-                           (utils/response HttpServletResponse/SC_INTERNAL_SERVER_ERROR
-                                           {:exception (to-message t)}))))
-                (fn [handler-response]
-                  (if handler-response
-                    (put! response-ch
-                          (->
-                            ;; We can't pass the asynchronous req-handler to w-r-r, it expects
-                            ;; a sync handler. Instead, we provide a "fake" sync handler
-                            ;; that returns the previously obtained handler response.
-                            (constantly handler-response)
-                            (format-response/wrap-restful-response :formats formats)
-                            ;; Capture and invoke the wrapped, fake handler
-                            (as-> f (f request))))
-                    (close! response-ch))))
-         response-ch)))))
+    (let [req-handler (format-params/wrap-restful-params handler :formats formats)]
+      (fn [request]
+        (let [response-ch (chan 1)]
+          ;; To keep things fully asynchronous, we first invoke the downstream handler.
+          (take! (try
+                   (req-handler request)
+                   (catch Throwable t
+                     (result->channel
+                       (utils/response HttpServletResponse/SC_INTERNAL_SERVER_ERROR
+                                       {:exception (to-message t)}))))
+                 (fn [handler-response]
+                   (if handler-response
+                     (put! response-ch
+                           (->
+                             ;; We can't pass the asynchronous req-handler to w-r-r, it expects
+                             ;; a sync handler. Instead, we provide a "fake" sync handler
+                             ;; that returns the previously obtained handler response.
+                             (constantly handler-response)
+                             (format-response/wrap-restful-response :formats formats)
+                             ;; Capture and invoke the wrapped, fake handler
+                             (as-> f (f request))))
+                     (close! response-ch))))
+          response-ch)))))

 (defn wrap-with-standard-middleware
   "The equivalent of [[rook/wrap-with-standard-middleware]], but for an asynchronous pipeline."
@@ -102,28 +101,28 @@
   added in explicitly."
   ([handler] (wrap-session handler {}))
   ([handler options]
-   (let [options' (session-options-alias options)]
-     (fn [request]
-       (let [response-ch (chan 1)
-             request' (session/session-request request options')]
-         (take! (handler request')
-                (fn [handler-response]
-                  (if handler-response
-                    (put! response-ch (session/session-response handler-response request' options'))
-                    (close! response-ch))))
-         response-ch)))))
+    (let [options' (session-options-alias options)]
+      (fn [request]
+        (let [response-ch (chan 1)
+              request' (session/session-request request options')]
+          (take! (handler request')
+                 (fn [handler-response]
+                   (if handler-response
+                     (put! response-ch (session/session-response handler-response request' options'))
+                     (close! response-ch))))
+          response-ch)))))

 (defn wrap-with-response-validation
   "The async version of [[rv/wrap-with-response-validation]]."
   {:since "0.1.11"}
   ([handler metadata]
-   (wrap-with-response-validation handler metadata true))
+    (wrap-with-response-validation handler metadata true))
   ([handler metadata enabled]
-   (if enabled
-     (if-let [responses (:responses metadata)]
-       (fn [request]
-         (let [response-ch (chan 1)]
-           (take! (handler request)
-                  (fn [response]
-                    (put! response-ch (rv/ensure-matching-response response (:function metadata) responses))))
-           response-ch))))))
+    (if enabled
+      (if-let [responses (:responses metadata)]
+        (fn [request]
+          (let [response-ch (chan 1)]
+            (take! (handler request)
+                   (fn [response]
+                     (put! response-ch (rv/ensure-matching-response response (:function metadata) responses))))
+            response-ch))))))


Implement getName() for LessSource, to assist with generating proper source maps

--- src/io/aviso/twixt/less.clj
+++ src/io/aviso/twixt/less.clj
@@ -29,6 +29,8 @@
       (if-let [rel (find-relative asset-resolver asset filename context)]
         (create-less-source asset-resolver dependencies rel context)
         (throw (new LessSource$FileNotFound))))
+
+    (getName [] (-> asset :asset-path utils/path->name))

     (toString [] (:resource-path asset))

@@ -70,8 +72,10 @@
         (try
           (let [dependencies (atom {})
                 root-source (create-less-source asset-resolver dependencies asset context)
+                ^LessCompiler$Configuration options  (doto (LessCompiler$Configuration.)
+                                                              (.setLinkSourceMap false))
                 ;; A bit of work to trick the Less compiler into writing the right thing into the output CSS.
-                ^LessCompiler$CompilationResult output (.compile less-compiler root-source)
+                ^LessCompiler$CompilationResult output (.compile less-compiler root-source options)
                 complete-css (str
                                (.getCss output)
                                "\n/*# sourceMappingURL="


cleanup

cleanup

--- examples/storyboard/page.cljs
+++ examples/storyboard/page.cljs
@@ -50,34 +50,6 @@
                   :scale 1}
          :data {:foo "Foo"
                 :bar "Bar"}}))
-
-(def new-state
-  {:content
-   {:title "Thinking Ruby"
-    :issue "Issue No #87 2008"
-    :publisher "The Ruby Review"
-    :logo "http://placekitten.com/404/404"
-    :editorial "Dynamic programming Redux"
-    :interviews ["DHH " "Jason, " "Joe"]
-    :developer-pic "/img/ruby.png"
-    :quotes {:dev-quote "It’s a lot harder to pull your head up and ask why."
-             :nolen-best "The Functional Final Frontier in Clojurescript"}}
-   :styles {:font-size-base (em 1.5)
-            :line-height-base (em 1.45)
-            :min-width (px 400)
-            :max-width (px 1200)
-            :min-font (px 12)
-            :max-font (px 24)
-            :body-font ["Alegreya" "Baskerville" "Georgia" "Times" "serif"]
-            :body-font-weight 400
-            :header-font (:firasans typo/font-families)
-            :header-font-weight 600
-            :breakpoints {:mobile (px 480)
-                          :tablet (px 720)
-                          :desktop (px 960)}
-            :scale 1}
-   :data {:foo "Foo"
-          :bar "Bar"}})

 (def history
   (atom [@app-state]))
@@ -170,10 +142,3 @@

 #_(mount component "storyboard")
 #_(unmount "storyboard")
-
-;; Demos
-
-#_(swap! app-state assoc-in [:content :logo] "/img/logo.png")
-#_(swap! app-state assoc-in [:content :developer-pic] "/img/cljs.png")
-#_(swap! app-state assoc-in [:content :quotes :nolen-tweet] "Lisp's revenge")
-#_(reset! app-state new-state)


Don't need medley anymore

Don't need medley anymore

--- re-frame-todo/project.clj
+++ re-frame-todo/project.clj
@@ -1,7 +1,6 @@
 (defproject re-frame-todo "0.1.0-SNAPSHOT"
   :dependencies [[org.clojure/clojure "1.8.0"]
                  [org.clojure/clojurescript "1.9.908"]
-                 [medley "1.0.0"]
                  [reagent "0.7.0"]
                  [re-frame "0.10.1"]]


redraw-graph now receives a code as a parameter

I wasn't entirely happy with getting the code from the element directly,
since it limited extensibility.  This will make adding new functions
easier.

Added new list-tropes option as a front end test.

--- src-cljs/tropology/core.cljs
+++ src-cljs/tropology/core.cljs
@@ -1,5 +1,7 @@
 (ns tropology.core
   (:require [reagent.core :as reagent :refer [atom]]
+            [clojure.string :refer [lower-case]]
+            [goog.object :as gobject]
             [secretary.core :as secretary]
             [reagent.session :as session]
             [reagent-forms.core :refer [bind-fields]]
@@ -31,6 +33,7 @@
     [:div.navbar-collapse.collapse
      [:ul.nav.navbar-nav
       (nav-item :home "Home" "")
+      (nav-item :tropes "Tropes" "tropes")
       (nav-item :about "About" "about")
       ]]]])

@@ -51,7 +54,7 @@
                                              (-> (js* "this")
                                                  .-allNeighborsIndex
                                                  (aget node-id)
-                                                 goog.object/getKeys)) ; The graph keeps the neighbors as properties
+                                                 gobject/getKeys)) ; The graph keeps the neighbors as properties
                                            ))

@@ -79,7 +82,7 @@
   )

 (defn create-graph [base-code]
-  (let [code    (clojure.string/lower-case base-code)
+  (let [code    (lower-case base-code)
         sig     (js/sigma. (clj->js {:renderer
                                                {:type      "canvas"
                                                 :container (.getElementById js/document "graph-container")}
@@ -96,10 +99,10 @@
                     (.startForceAtlas2 sig {:worker true :barnesHutOptimize false})
                     (js/setTimeout #(.stopForceAtlas2 sig) 5000)
                     ; Set the colors
-                    (goog.object/forEach (-> sig .-graph .nodes)
-                                         #(aset % "originalColor" (aget % "color")))
-                    (goog.object/forEach (-> sig .-graph .edges)
-                                         #(aset % "originalColor" (aget % "color")))
+                    (gobject/forEach (-> sig .-graph .nodes)
+                                     #(aset % "originalColor" (aget % "color")))
+                    (gobject/forEach (-> sig .-graph .edges)
+                                     #(aset % "originalColor" (aget % "color")))

                     (.bind sig "clickNode"
                            (fn [clicked]
@@ -137,32 +140,58 @@

     ))

-(defn redraw-graph []
+(defn redraw-graph [trope-code]
   (let [current (:sigma @state)]                            ; Must be set by importer on creation
     (if current
       (do
         (.kill current)
         (swap! state assoc :sigma nil)))
-    (create-graph (-> (.getElementById js/document "trope-code") .-value))
+    ; (create-graph (-> (.getElementById js/document "trope-code") .-value))
+    (create-graph trope-code)
     ))

-(defn plot []
+(defn list-tropes [trope-code]
+  (.log js/console trope-code))
+
+
+(def trope-code-form
   [:div
-   (text-input :trope-code "Trope code:")
-   [:input {:type     "button" :value "Graph!"
-            :on-click #(redraw-graph)}]
-   [:div {:id "graph-container"}]])
+   (text-input :trope-code "Article code:")])
+
+
+(defn trope-data []
+  (let [form-data (atom {})]
+    (fn []
+      [:div
+       [bind-fields trope-code-form form-data]
+       (cond
+         (= :home (session/get :page)) [:div
+                                        [:input {:type     "button"
+                                                 :value    "Graph!"
+                                                 :on-click #(redraw-graph (:trope-code @form-data))}]
+                                        [:div {:id "graph-container"}]]
+         (= :tropes (session/get :page)) [:div
+                                          [:input {:type     "button"
+                                                   :value    "List tropes"
+                                                   :on-click #(list-tropes (:trope-code @form-data))}]
+                                          [:div {:id "trope-list-container"}]]
+         :else "Nope"
+         )])
+    ))
+

 (def pages
-  {:home  plot
-   :about about-page})
+  {:home   trope-data
+   :tropes trope-data
+   :about  about-page})

 (defn page []
   [(pages (session/get :page))])

 (defroute "/" [] (session/put! :page :home))
+(defroute "/tropes" [] (session/put! :page :tropes))
 (defroute "/about" [] (session/put! :page :about))


Updated to 0.19.0.

Updated to 0.19.0.

--- examples/benchmarks/project.clj
+++ examples/benchmarks/project.clj
@@ -1,4 +1,4 @@
-(defproject benchmarks "0.17.2"
+(defproject benchmarks "0.19.0"
   :description "Benchmarks and comparisons between Neanderthal and other Java matrix libraries."
   :url "https://github.com/uncomplicate/neanderthal/tree/master/examples/benchmarks"
   :license {:name "Eclipse Public License"


Add to classpath only sources from chosen build-id

- Fixes #81
- Previously all build's sources were added to the classpath
leaving room for name clashes.

--- plugin/src/leiningen/doo.clj
+++ plugin/src/leiningen/doo.clj
@@ -14,25 +14,23 @@
 (defn project->builds [project]
   (get-in project [:cljsbuild :builds]))

+(defn add-sources [project sources]
+  (update-in project [:source-paths] #(into % sources)))
+
 ;; TODO: what's this for?
-;; I think it is to ensure that the source paths are in the classpath
-;; Then it might resolved to (update-in [:source-paths] concat)
 (defn make-subproject [project]
   (-> project
-    ;; This might be protecting against something, remove?
-    (select-keys [:checkout-deps-shares
-                  :eval-in
-                  :jvm-opts
-                  :local-repo
-                  :repositories
-                  :resource-paths
-                  :dependencies])
-    ;; This might be the important function
-    (merge {:local-repo-classpath true
-            :source-paths (concat
-                            (:source-paths project)
-                            (mapcat :source-paths (project->builds project)))})
-    (with-meta (meta project))))
+      ;; This might be protecting against something, remove?
+      (select-keys [:checkout-deps-shares
+                    :eval-in
+                    :jvm-opts
+                    :local-repo
+                    :repositories
+                    :resource-paths
+                    :source-paths
+                    :dependencies])
+      (assoc :local-repo-classpath true)
+      (with-meta (meta project))))

 (defn add-dep
   "Adds one dependency (needs to be a vector with a quoted symbol)
@@ -201,15 +199,16 @@
          js-envs (cli->js-envs cli opts)
          ;; FIX: get the version dynamically
          project' (-> project
-                    correct-builds
-                    (add-dep ['doo "0.1.7-SNAPSHOT"]))
+                      correct-builds
+                      (add-dep ['doo "0.1.7-SNAPSHOT"]))
          {:keys [source-paths compiler]}
          (cli->build cli project' opts)]
      (doo/assert-alias alias js-envs (:alias opts))
      (doseq [js-env js-envs]
        (doo/assert-js-env js-env))
      ;; FIX: there is probably a bug regarding the incorrect use of builds
-     (run-local-project project'
+     ;; Important to add sources to the classpath
+     (run-local-project (add-sources project' source-paths)
        '(require 'cljs.build.api 'doo.core 'doo.karma)
        `(let [compiler# (cljs.build.api/add-implicit-options ~compiler)]
           (doseq [js-env# ~js-envs]


Disable working are (temporary).

Disable working are (temporary).

--- frontend/uxbox/ui/workspace.cljs
+++ frontend/uxbox/ui/workspace.cljs
@@ -30,7 +30,7 @@
       (wr/v-rule)

       ;; Canvas
-      (wa/working-area)
+      ;; (wa/working-area)
       ;; (working-area conn @open-toolboxes page project shapes (rum/react ws/zoom) (rum/react ws/grid?))
     ;;   ;; Aside
     ;;   (when-not (empty? @open-toolboxes)


CMR-8622 - removing a function that is no longer needed (#1716)

--- transmit-lib/src/cmr/transmit/http_helper.clj
+++ transmit-lib/src/cmr/transmit/http_helper.clj
@@ -133,39 +133,6 @@
              headers# (when token# {config/token-header token#})]
          (request context# ~app-name
                   {:url-fn ~url-fn
-                   :method :post
-                   :raw? raw?#
-                   :http-options (merge {:body (json/generate-string item#)
-                                         :content-type :json
-                                         :headers headers#
-                                         :accept :json}
-                                        http-options#)}))))))
-
-(defmacro defcreator2
-  "Creates a function that can be used to send standard requests to create an item using JSON.
-   This version differs from defcreater in that it sends two parameters to url-fn which allows
-   the caller to send in a list of values to be used by url-fn for constructing the path. This
-   is needed when a service requires extra paramaters then normal.
-   "
-  ([fn-name app-name url-fn]
-   `(defcreator ~fn-name ~app-name ~url-fn nil))
-  ([fn-name app-name url-fn default-options]
-   `(defn ~fn-name
-      "Sends a request to create the item. Valid options are
-      * :raw? - set to true to indicate the raw response should be returned. See
-      cmr.transmit.http-helper for more info. Default false.
-      * token - the user token to use when creating the item. If not set the token in the context will
-      be used.
-      * http-options - Other http-options to be sent to clj-http."
-      ([context# url-items# item#]
-       (~fn-name context# url-items# item# nil))
-      ([context# url-items# item# options#]
-       (let [options# (merge options# ~default-options)
-             {raw?# :raw? token# :token http-options# :http-options} options#
-             token# (or token# (:token context#))
-             headers# (when token# {config/token-header token#})]
-         (request context# ~app-name
-                  {:url-fn #(~url-fn % url-items#)
                    :method :post
                    :raw? raw?#
                    :http-options (merge {:body (json/generate-string item#)


Fixing validation issue

Fixing validation issue

--- src/shuppet/core_shuppet.clj
+++ src/shuppet/core_shuppet.clj
@@ -113,13 +113,14 @@
   (let [config (cf/with-messages {:env env :app-name app-name}
                    (load-config env app-name))]
     (cf/with-messages {:env env :app-name app-name :config config}
+      (when app-name
+        (validate config))
       (doto config
-          validate
-          ensure-sgs
-          ensure-elb
-          ensure-iam
-          ensure-s3s
-          ensure-ddbs))))
+        ensure-sgs
+        ensure-elb
+        ensure-iam
+        ensure-s3s
+        ensure-ddbs))))

 (defn clean-config [environment app-name]
   (let [config (load-config environment app-name)]


[#1142] Group-by rnum instead of geom to speed up by queries

--- backend/src/akvo/lumen/lib/visualisation/map_config.clj
+++ backend/src/akvo/lumen/lib/visualisation/map_config.clj
@@ -158,44 +158,60 @@
         hue (color-to-hue (clojure.string/upper-case (get current-layer "gradientColor" "#FF0000")))
         extra-cols (popup-and-label-cols (get current-layer "popup") (get current-layer "shapeLabelColumn"))]

-    (format "with temp_table as
-              (select
+    (format "
+            SELECT
+              %s
+              _aggregation,
+              shapefill,
+              %s.%s
+            FROM
+              (
+                with temp_table as
+                  (select
+                      %s
+                      %s.rnum AS shapeRowNum,
+                      %s(pointTable.%s::decimal) AS aggregation
+                    from %s
+                    left join (select * from %s)pointTable on
+                    st_contains(%s.%s, pointTable.%s)
+                    GROUP BY %s.rnum %s)
+                select
                   %s
-                  %s.%s,
-                  %s(pointTable.%s::decimal) AS aggregation
-                from %s
-                left join (select * from %s)pointTable on
-                st_contains(%s.%s, pointTable.%s)
-                GROUP BY %s.%s %s)
-            select
+                  shapeRowNum,
+                  aggregation as _aggregation,
+                  CASE WHEN aggregation IS NULL THEN
+                      'grey'
+                    ELSE
+                      concat(
+                        'hsl(%s, 75%%, ',
+                        100 - floor(
+                          CASE
+                            WHEN (select max(aggregation) from temp_table)::decimal=(select min(aggregation) from temp_table)::decimal THEN 50
+                            ELSE
+                              (
+                                (aggregation::decimal - (select min(aggregation) from temp_table)::decimal) /
+                                ((select max(aggregation) from temp_table)::decimal - (select min(aggregation) from temp_table)::decimal)
+                              ) * 50
+                          END
+                        ),
+                        '%%)'
+                      )
+                  END as shapefill
+                from
+                  temp_table
+              )row_query
+            LEFT JOIN
               %s
-              %s,
-              aggregation as _aggregation,
-              CASE WHEN aggregation IS NULL THEN
-                  'grey'
-                ELSE
-                  concat(
-                    'hsl(%s, 75%%, ',
-                    100 - floor(
-                      CASE
-                        WHEN (select max(aggregation) from temp_table)::decimal=(select min(aggregation) from temp_table)::decimal THEN 50
-                        ELSE
-                          (
-                            (aggregation::decimal - (select min(aggregation) from temp_table)::decimal) /
-                            ((select max(aggregation) from temp_table)::decimal - (select min(aggregation) from temp_table)::decimal)
-                          ) * 50
-                      END
-                    ),
-                    '%%)'
-                  )
-              END as shapefill
-            from
-              temp_table;
+            ON
+              row_query.shapeRowNum = %s.rnum
+            ;
             "

+            (shape-aggregagation-extra-cols-sql extra-cols "row_query" "" ",")
+            shape-table-name
+            (get current-layer "geom")
             (shape-aggregagation-extra-cols-sql extra-cols shape-table-name "" ",")
             shape-table-name
-            (get current-layer "geom")
             aggregation-method
             (get current-layer "aggregationColumn")
             shape-table-name
@@ -204,11 +220,11 @@
             (get current-layer "geom")
             (get current-layer "aggregationGeomColumn")
             shape-table-name
-            (get current-layer "geom")
             (shape-aggregagation-extra-cols-sql extra-cols shape-table-name "," "")
             (shape-aggregagation-extra-cols-sql extra-cols "temp_table" "" ",")
-            (get current-layer "geom")
-            hue)))
+            hue
+            shape-table-name
+            shape-table-name)))

 (defn point-sql [tenant-conn columns table-name geom-column popup-columns
                  point-color-column where-clause {:strs [datasetId] :as layer}]


Fix params use in apply-fn

Fix params use in apply-fn

--- src/onyx/peer/transform.clj
+++ src/onyx/peer/transform.clj
@@ -48,8 +48,7 @@
 (defn apply-fn [event]
   (let [f (:fn event)
         g (curry-params f (:params event))
-        apply-fn (:apply-fn event)
-        rets (apply-fn f event)]
+        rets ((:apply-fn event) g event)]
     (trace (format "[%s / %s] Applied fn to %s segments"
                    (:id rets)
                    (:lifecycle-id rets)


Update Insights tests

Update Insights tests

--- test-cljs/frontend/components/test_insights.cljs
+++ test-cljs/frontend/components/test_insights.cljs
@@ -74,13 +74,20 @@
 (deftest can-render-insights-cards
   (let [test-node (goog.dom/htmlToDocumentFragment "

")]
     (om/root insights/cards
-             {:plans test-utils/example-user-plans-paid
-              :projects [test-project/private-project]
+             {:projects [(insights/decorate-project test-utils/example-user-plans-paid test-project/private-project)]
               :selected-filter :all
               :selected-sorting :alphabetical}
              {:target test-node
               :shared {:timer-atom (timer/initialize)}})
-    (testing "Simple render of feature container.")))
+    (testing "Simple render of cards.")))
+
+(deftest can-render-single-project-insights
+  (let [test-node (goog.dom/htmlToDocumentFragment "

")]
+    (om/root insights/single-project-insights
+             (insights/decorate-project test-utils/example-user-plans-paid test-project/private-project)
+             {:target test-node
+              :shared {:timer-atom (timer/initialize)}})
+    (testing "Simple render of single-project insights.")))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; TODO: Async testing does not work right now, it's not in scope to fix it ;;


Link start button to story-list

Link start button to story-list

--- src/unspun/screens/logo.cljs
+++ src/unspun/screens/logo.cljs
@@ -23,7 +23,7 @@
    :textAlign  "center"
    :color      (:light-primary (get-palette (rum/react palette-index)))})

-(defc logo-page < rum/reactive []
+(defcs logo-page < rum/reactive [state]
   (view {:style (page-style)}
         (status-bar {:key 10
                      :hidden   false
@@ -40,16 +40,17 @@
                       :resizeMode "contain"
                       :style      {:marginTop -170
                                    :transform [{:scale 0.3}]}}))
-        (touchable-highlight {:style   {:flex 0.075
-                                        :margin          20
-                                        :backgroundColor (:accent (get-palette (rum/react palette-index)))
-                                        :borderRadius    30
-                                        :shadowColor     "#000"
-                                        :shadowOffset    {:width shadow-size :height shadow-size}
-                                        :shadowRadius    shadow-size
-                                        :shadowOpacity   0.5
-                                        :alignItems      "center"
-                                        :justifyContent  "center"
-                                        }
-                              :onPress #(alert "Hello!")}
+        (touchable-highlight {:style {:flex            0.075
+                                      :margin          20
+                                      :backgroundColor (:accent (get-palette (rum/react palette-index)))
+                                      :borderRadius    30
+                                      :shadowColor     "#000"
+                                      :shadowOffset    {:width shadow-size :height shadow-size}
+                                      :shadowRadius    shadow-size
+                                      :shadowOpacity   0.5
+                                      :alignItems      "center"
+                                      :justifyContent  "center"
+                                      }
+                              :onPress   #(.push (aget (:rum/react-component state) "props" "navigator") "stories")                   ;#(alert "Hello!")
+                              }
                              (text {:style {:color (:text-icons (get-palette (rum/react palette-index))) :textAlign "center" :fontWeight "bold" :width 55}} "Start"))))


Update dependencies

Update dependencies

--- build.boot
+++ build.boot
@@ -1,9 +1,9 @@
 (set-env!
   :source-paths #{"test"}
-  :dependencies '[[org.clojure/clojure "1.6.0"     :scope "provided"]
-                  [boot/core           "2.0.0"     :scope "provided"]
-                  [adzerk/bootlaces    "0.1.10"    :scope "test"]
-                  [http-kit            "2.1.18"    :scope "test"]])
+  :dependencies '[[org.clojure/clojure "1.7.0"     :scope "provided"]
+                  [boot/core           "2.5.5"     :scope "provided"]
+                  [adzerk/bootlaces    "0.1.13"    :scope "test"]
+                  [http-kit            "2.1.19"    :scope "test"]])

 (require '[adzerk.bootlaces :refer :all])


Update version to 0.2.14

Update version to 0.2.14

Signed-off-by: Tom Marble <b248307e886b80bf9cb4014595572a835b049bf4@info9.net>

--- build.boot
+++ build.boot
@@ -5,7 +5,7 @@
 ;; the file LICENSE at the root of this distribution.

 (def project 'dollabs/plan-schema)
-(def version "0.2.13")
+(def version "0.2.14")
 (def description "Temporal Planning Network schema utilities")
 (def project-url "https://github.com/dollabs/plan-schema")
 (def main 'plan-schema.cli)


remove notify plugin

remove notify plugin

--- build.boot
+++ build.boot
@@ -6,7 +6,6 @@
                   [hashobject/boot-s3 "0.1.0-SNAPSHOT"]
                   [clj-time "0.9.0"]
                   [pandeiro/boot-http "0.6.2"]
-                  [jeluard/boot-notify "0.2.0"]
                   [pandeiro/boot-http "0.6.3-SNAPSHOT"]
                   [org.martinklepsch/boot-gzip "0.1.1"]])

@@ -16,8 +15,7 @@
          '[blog.hashobject.views.post :as post-view]
          '[pandeiro.boot-http :refer [serve]]
          '[hashobject.boot-s3 :refer :all]
-         '[org.martinklepsch.boot-gzip :refer [gzip]]
-         '[jeluard.boot-notify :refer [notify]])
+         '[org.martinklepsch.boot-gzip :refer [gzip]])

 (task-options!
@@ -43,8 +41,7 @@
         (if prod (sitemap :filename "sitemap.xml") identity)
         (if prod (rss :title "Hashobject" :description "Hashobject blog" :link "http://blog.hashobject.com") identity)
         (if prod (s3-sync) identity)
-        (gzip :regex [#".html$" #".css$" #".js$"])
-        (notify)))
+        (gzip :regex [#".html$" #".css$" #".js$"])))

 (deftask dev
   []


Upgrade java.jdbc to 0.7.3

Upgrade java.jdbc to 0.7.3

--- build.boot
+++ build.boot
@@ -18,7 +18,7 @@
                  [org.clojure/clojure "1.9.0-beta2"]
                  [org.clojure/clojurescript "1.9.946"]
                  [org.clojure/core.async "0.3.443"]
-                 [org.clojure/java.jdbc "0.6.2-alpha2"]
+                 [org.clojure/java.jdbc "0.7.3"]
                  [org.clojure/math.numeric-tower "0.0.4"]])

 (require


setup testing

setup testing

--- build.boot
+++ build.boot
@@ -88,6 +88,17 @@

 (task-options!
  gae/run modules
+ ;; test {:startup (fn []
+ ;;                  (println "XXXXXXXXXXXXXXXX")
+ ;;                  ;; (set-env! ;; :source-paths #(conj % "test/clj" "target")
+ ;;                  ;;  :asset-paths #{"resources"}
+ ;;                  ;;  :resource-paths #{"src/clj" "test/clj"})
+ ;;                  #_(require 'test.rig)
+ ;;                  #_(test.rig/setup))
+ ;;       ;;:shutdown test.rig/teardown
+ ;;       }
+ ;; run-tests {:startup test.rig/setup
+ ;;            :shutdown test.rig/teardown}
  pom  {:project     +project+
        :version     +version+
        :description "Example code, boot, miraj, GAE"
@@ -101,12 +112,12 @@
         (boot/target)))

 (deftask testing
-  "Profile setup for running tests."
+  "Profile setup for running tests. E.g. $ boot testing test -n test.emap"
   []
   ;; (dev)
-  (set-env! :source-paths #(conj % "test/clj" "target")
-            ;; :asset-paths #{"resources"}
-            :resource-paths #{"src/clj" "resources"})
+  (set-env! ;; :source-paths #(conj % "test/clj" "target")
+            :asset-paths #{"resources"}
+            :resource-paths #{"src/clj" "test/clj"})
   identity)

 (deftask watchme


fix the enable-console-print! call

fix the enable-console-print! call

--- dev-cljs/frontend/dev.cljs
+++ dev-cljs/frontend/dev.cljs
@@ -9,7 +9,7 @@
   (ws-repl/connect "ws://localhost:9001" :verbose true)
   ;; the repl tries to take over *out*, workaround for
   ;; https://github.com/cemerick/austin/issues/49
-  (js/setInterval #(enable-console-print!) 1000))
+  (js/setInterval #(cljs.core/enable-console-print!) 1000))

 (defn setup-figwheel [{:keys [js-callback]}]
   (figwheel/start {:on-jsload js-callback


Add missing query parameter on pages history service func.

--- src/uxbox/services/pages.clj
+++ src/uxbox/services/pages.clj
@@ -121,8 +121,9 @@
   (let [sql (str "SELECT * FROM pages_history "
                  " WHERE \"user\"=? AND page=?"
                  " AND created_at < ?"
-                 " ORDER BY created_at DESC")
-        sqlv [sql user id since]]
+                 " ORDER BY created_at DESC"
+                 " LIMIT ?")
+        sqlv [sql user id since max]]
     (->> (sc/fetch conn sqlv)
          (map usc/normalize-attrs))))


Added processing of new video files

Added processing of new video files

--- src/video_server/process.clj
+++ src/video_server/process.clj
@@ -72,7 +72,9 @@
           (log/trace "processing" (str file-or-video))
           (try (when encode?
                  (if (instance? File file-or-video)
-                   (process-subtitle folder file-or-video)
+                   (cond
+                     (file/video? file-or-video) (process-video folder (library/video-for-file folder file-or-video) fmt size)
+                     (file/subtitles? file-or-video) (process-subtitle folder file-or-video))
                    (process-video folder file-or-video fmt size)))
                (catch Exception e (log/error e "error processing video" (str file-or-video))))))))


do leave-one-out cross-validation with the toy ML model from ch09

--- src/r_incantations/core.clj
+++ src/r_incantations/core.clj
@@ -301,28 +301,45 @@
                             "Infected" tr-inf-proc-mean tr-inf-mem-mean
                             "Normal" tr-norm-proc-mean tr-norm-mem-mean)
                    test-data)
-        good-guesses (-> (incanter.core/query-dataset
-                          test-data
-                          ;; Is there a better way to check for
-                          ;; equality between two columns?
-                          (fn [row] (= (row :state) (row :prediction))))
-                         :rows
-                         count)
-        accuracy (-> good-guesses
+        good-guesses-cnt (-> (incanter.core/query-dataset
+                              test-data
+                              ;; Is there a better way to check for
+                              ;; equality between two columns?
+                              (fn [row] (= (row :state) (row :prediction))))
+                             :rows
+                             count)
+        accuracy (-> good-guesses-cnt
                      (/ (incanter.core/nrow test-data))
                      float)]
-    accuracy
-    #_
-    {:tr-inf-proc-mean tr-inf-proc-mean
-     :tr-inf-mem-mean tr-inf-mem-mean
-     :tr-norm-proc-mean tr-norm-proc-mean
-     :tr-norm-mem-mean tr-norm-mem-mean}
-    #_
-    {:n n
-     :test-size test-size
-     :test-sel test-sel
-     :test-data test-data
-     :training-data training-data}))
+    accuracy))
+
+(defn ch09-ml-test [data test-sel]
+  (let [test-data (-> (incanter.core/sel data :rows [test-sel] :cols [:proc :mem :state])
+                      :rows
+                      first)
+        training-data (incanter.core/sel data :except-rows [test-sel])
+        tr-inf-proc-mean (col-mean training-data "Infected" :proc)
+        tr-inf-mem-mean (col-mean training-data "Infected" :mem)
+        tr-norm-proc-mean (col-mean training-data "Normal" :proc)
+        tr-norm-mem-mean (col-mean training-data "Normal" :mem)]
+    (= (:state test-data)
+       (compare-euclidian-distance
+        "Infected" tr-inf-proc-mean tr-inf-mem-mean
+        "Normal" tr-norm-proc-mean tr-norm-mem-mean
+        (:proc test-data) (:mem test-data)))))
+
+(defn ch09-ml-toy2
+  "Same Euclidian distance basis as ch09-ml-toy, but does
+   leave-one-out cross-validation.
+   http://en.wikipedia.org/wiki/Cross-validation_(statistics)#Leave-one-out_cross-validation"
+  []
+  (let [memproc (read-memproc-data)
+        n (count (:rows memproc))
+        test-size (dec n)
+        tf-results (-> (for [test-sel (range n)]
+                         (ch09-ml-test memproc test-sel))
+                       contingency-table)]
+    (float (/ (tf-results true) n))))

 (comment


move scroll, add default values

move scroll, add default values

--- src/cljs/org/broadinstitute/firecloud_ui/page/workspace/summary_tab.cljs
+++ src/cljs/org/broadinstitute/firecloud_ui/page/workspace/summary_tab.cljs
@@ -280,11 +280,13 @@
                          (style/create-form-label "Namespace:")
                          (style/create-text-field {:ref "namespace"
                                                    :style {:width "100%"}
+                                                   :defaultValue (get-in props [:workspace-id :namespace])
                                                    :placeholder "Required"
                                                    :onChange #(swap! state dissoc :error)})
                          (style/create-form-label "Name:")
                          (style/create-text-field {:ref "name"
                                                    :style {:width "100%"}
+                                                   :defaultValue (get-in props [:workspace-id :name])
                                                    :placeholder "Required"
                                                    :onChange #(swap! state dissoc :error)})
                          (when (:error @state)
@@ -296,6 +298,9 @@
                                          :onClick #(react/call :do-clone this)}])}])
                     :get-first-element-dom-node #(.getDOMNode (@refs "namespace"))
                     :get-last-element-dom-node #(.getDOMNode (@refs "okButton"))}])
+   :component-did-mount
+   (fn []
+     (common/scroll-to-top 100))
    :do-clone
    (fn [{:keys [props refs state]}]
      (let [[namespace name] (common/get-text refs "namespace" "name")]
@@ -322,7 +327,6 @@
                  :dismiss-self #(swap! state dissoc :editing-acl?)
                  :update-owners #(swap! state update-in [:server-response :workspace] assoc "owners" %)}])
    (when (:cloning? @state)
-     (common/scroll-to-top 100)
      [WorkspaceCloner {:dismiss #(swap! state dissoc :cloning?)
                        :workspace-id (:workspace-id props)}])
    [:div {:style {:float "left" :width 290 :marginRight 40}}


Added type to decoded message output

Added type to decoded message output

--- src/ais/core.clj
+++ src/ais/core.clj
@@ -86,18 +86,19 @@

 (defn parse [output-type line]
   (let [[acc collector] (output-type-handler output-type)
-        [envelope checksum] (ais-ex/extract-envelope-checksum line)
-         metadata (parse-tag-block acc collector line ["c" "s" "n"])] ; Let's not hardcode this
+        [envelope checksum] (ais-ex/extract-envelope-checksum line)]
     (if (not-any? nil? [envelope checksum])
       (if (valid-envelope? envelope checksum)
         (try
 	  (let [bits (ais-util/pad
                        (payload->binary (ais-ex/extract-payload envelope))
-                       (ais-ex/extract-fill-bits envelope))]
-            (decode-binary-payload (ais-mappings/msg-spec (ais-types/u (subs bits 0 6))) ; type specification
-                                   (parse-tag-block acc collector line ["c" "s" "n"])    ; use metadata as base output accumulator
-                                   collector                                             ; accumulator function
-                                   (subs bits 6)))                                       ; raw binary payload
+                       (ais-ex/extract-fill-bits envelope))
+                msg-type (ais-types/u (subs bits 0 6))
+                metadata (parse-tag-block (collector acc "type" msg-type) collector line ["c" "s" "n"])]
+            (decode-binary-payload (ais-mappings/msg-spec msg-type) ; type specification
+                                   metadata                         ; use metadata as initial accumulator
+                                   collector                        ; accumulator function
+                                   (subs bits 6)))                  ; raw binary payload
           (catch Exception e
             (strace/print-stack-trace e)
 	    {"error" (str "Exception: " e)}))