finished garden items/descriptions

finished garden items/descriptions

--- src/house/rooms/garden.cljc
+++ src/house/rooms/garden.cljc
@@ -16,9 +16,11 @@
 (defn crow-pre
   "If trying to open the back door do it, otherwise default message."
   [gs item]
-  (if (some #{"back door"} (:names item))
-    true
-    "I didn't want to break into that."))
+  (cond
+    (some #{"back door"} (:names item)) true
+    (= (:id item) "bath-window") "There was no need to break the window, just find a way to reach it."
+    (some #{"window"} (:names item)) "I didn't want to draw too much attention."
+    :else "I didn't want to break into that."))

 (defn crow-post
   "Open the door and connect the rooms."
@@ -52,16 +54,26 @@
                                    :post `crow-post}))

 (def screwdriver (item/make "screwdriver" "the dust and the rust were competing to see who'd take over the thing first."
-                            :use-with "I didn't see any screws."
+                            :use-with "That didn't have any screws in it."
                             :take true))

 (def hammer (item/make "hammer" "The head was a bit loose but still usable."
                        :take true
                        :use-with "Everything looking like a nail, huh?"))

-; FIXME add drawer with screwdriver
-; FIXME add table
-; TODO custom text when opening the drawer
+(defn post-open
+  [old gs]
+  (let [drawer (utils/find-first gs "drawer")
+        new-drawer (update-in drawer [:open] dissoc :say)]
+    (utils/replace-item gs drawer new-drawer)))
+
+(def drawer (item/make ["drawer"] "Just a drawer."
+                       :closed true
+                       :open {:pre true
+                              :say "There was a lot of useless junk inside the drawer, and also a rusty screwdriver."
+                              :post `post-open}
+                       :items #{screwdriver}))
+
 (def shed (->
             (room/make "Shed"
                        "The shed was barely big enough for me to stand inside. There was a brief work table with a drawer against one of the walls and a tool board against the other. Right by the door was an old lawn mower."
@@ -69,6 +81,8 @@
             (room/add-item (item/make ["tool board" "tools" "board" "toolset"]
                                       "Only a mid-size hammer and a crowbar were left of what appeared to have been a big toolset."
                                       :take "Not the entire thing!") "")
+            (room/add-item (item/make ["table" "work table"] "Seemed too small to get any real work done. It had one drawer.") "")
+            (room/add-item drawer "")
             (room/add-item hammer "")
             (room/add-item crowbar "")
             (room/add-item (item/make ["lawn mower" "mower"]
@@ -88,20 +102,19 @@
                   (room/add-item (item/make "house" "It looked even bigger from this side."
                                                     :enter `can-enter
                                                     :break "Perhaps with the proper tooling."))))
-; TODO react to crowbar?
 (def bath-window (item/make "window"
                             "It was too high to look inside from where I was standing."
                             :look-in "It was too high to look inside from where I was standing."
                             :open "I could reach the border of the window but not open it from the ground level."
                             :use "I could reach the border of the window but not open it from the ground level."
                             :enter "I could reach the border of the window but not open it from the ground level."
-                            :break "There was no need to do that."))
+                            :break "There was no need to break the window, just find a way to reach it."
+                            :id "bath-window"))
 (def west-passage (->
                     (room/make "West passage"
                                "The western passage ended up in a wall with a high window, probably of a bathroom.")
                     (room/add-item bath-window "")))

-; TODO react to crowbar?
 (def east-passage (->
                     (room/make "East passage"
                                "The eastern passage ended up in the back of one of the bedrooms I saw from the street. It had a window.")


core update

core update

--- src/hvitmiddleware/core.clj
+++ src/hvitmiddleware/core.clj
@@ -24,4 +24,14 @@

-  )
+  )
+
+(defn create-oraclequery-paging [{:keys [table properties order predicate from max] :or {max 100} }]
+  "Creates a SQL query using paging and ROWNUM"
+  (str "SELECT * from (select " (clojure.string/join "," (map #(str "a." %) properties))
+    ", ROWNUM rnum from (select " (clojure.string/join "/" properties)
+    " from " table
+    " order by " (clojure.string/join "," order) " ) a "
+    " WHERE ROWNUM <= " max
+    ") WHERE " (if-not predicate "" (str predicate " and ")) " rnum >= " from))
+


added articles-page to factorize pages display

added a 'nothing in the archive?' blurb

--- src/instapapure/servlet.clj
+++ src/instapapure/servlet.clj
@@ -140,6 +140,13 @@
         find a good article you want to read later"]
       [:p "You can also save articles directly from Google Reader."]]))

+(defn nothing-in-archive []
+  (html
+    [:div.advice
+      [:p "Nothing in the archive?"]
+      [:p "When you have read an unread article, it will be moved to the archive.
+          It will remain there until you delete it."]]))
+
 (defn nothing-starred []
   (html
     [:div.advice
@@ -150,29 +157,33 @@
         whether they have been read or not"]
       [:p "To \"unstar\" a starred article, click on " (star-image true) "."]]))

+(defn articles-page
+  [type articles advice-section]
+  (layout type
+    (if (empty? articles)
+      (advice-section)
+      (map display-article articles))))
+
 (defn show-unread-articles
   "Show all unread articles"
   []
-  (let [articles (articles/find-unread (users/current-user))]
-    (layout :unread
-      (if (empty? articles)
-        (nothing-to-read)
-        (map display-article articles)))))
+  (articles-page :unread
+     (articles/find-unread (users/current-user))
+     nothing-to-read))
+
+(defn show-starred-articles
+  "Show starred articles"
+  []
+  (articles-page :starred
+    (articles/find-starred (users/current-user))
+    nothing-starred))

 (defn show-read-articles
   "Show the archive with all read articles"
   []
-  (layout :archive
-    (map display-article (articles/find-read (users/current-user)))))
-
-(defn show-starred-articles
-  "Show starred articles"
-  []
-  (let [articles (articles/find-starred (users/current-user))]
-    (layout :starred
-      (if (empty? articles)
-        (nothing-starred)
-        (map display-article articles)))))
+  (articles-page :archive
+    (articles/find-read (users/current-user))
+    nothing-in-archive))

 (defn new-article
   "Create a new article"
@@ -195,7 +206,7 @@
       (text-area "summary")
       [:br]
       (submit-button "save"))))
-
+
 (defn edit-article
   "Display HTML form to edit an article"
   [id]


Fix search config key name

Fix search config key name

--- src/lcmap/aardvark/core.clj
+++ src/lcmap/aardvark/core.clj
@@ -28,26 +28,28 @@
 ;; This nested map contains environment variable names. These values
 ;; are replaced with actual values during startup and merged into
 ;; the default configuration map, `def-cfg`.
-(def environ-cfg {:database {:default-keyspace "AARDVARK_DB_KEYSPACE"
-                             :cluster {:contact-points "AARDVARK_DB_HOST"
+(def environ-cfg {:database {:cluster {:contact-points "AARDVARK_DB_HOST"
                                        :credentials {:user "AARDVARK_DB_USER"
-                                                     :password "AARDVARK_DB_PASS"}}}
+                                                     :password "AARDVARK_DB_PASS"}}
+                             :default-keyspace "AARDVARK_DB_KEYSPACE"}
                   :html    {:base-url  "AARDVARK_BASE_URL"}
                   :http    {:port      "AARDVARK_HTTP_PORT"}
                   :event   {:host      "AARDVARK_EVENT_HOST"
+                            :port      "AARDVARK_EVENT_PORT"
                             :user      "AARDVARK_EVENT_USER"
                             :password  "AARDVARK_EVENT_PASS"}
                   :server  {:exchange  "AARDVARK_SERVER_EVENTS"
                             :queue     "AARDVARK_SERVER_EVENTS"}
                   :worker  {:exchange  "AARDVARK_WORKER_EVENTS"
                             :queue     "AARDVARK_WORKER_EVENTS"}
-                  :search  {:base-url  "AARDVARK_SEARCH_INDEX_URL"}})
+                  :search  {:index-url "AARDVARK_SEARCH_INDEX_URL"}})

 ;; This nested map contains a default configuration. It is updated with `env-cfg`
 ;; values during startup.
 (def default-cfg {:database  {:cluster {:contact-points "cassandra"
                                         :socket-options {:read-timeout-millis 20000}}
-                              :default-keyspace "lcmap_landsat"}
+                              :default-keyspace "lcmap_landsat"
+                              :schema {:setup false :teardown false}}
                   :http      {:port 5678
                               :join? false
                               :daemon? true}
@@ -59,6 +61,9 @@
                               :queue    "lcmap.landsat.worker"}
                   :search    {:index-url "http://elasticsearch:9200/tile-specs"
                               :max-result-size 10000}})
+
+(config/init default-cfg)
+(config/init (util/read-edn "lcmap.aardvark.edn"))

 (defn env-name->env-value
   "Replaces all string values with the matching environment variable."


Fix optional arguments to `new`

Fix optional arguments to `new`

--- src/leiningen/droid/new.clj
+++ src/leiningen/droid/new.clj
@@ -62,10 +62,12 @@

 (defn new
   "Creates new Android project given the project's name and package name."
-  [project-name package-name & {:keys [activity target-sdk app-name],
-                                :or {activity "MainActivity", target-sdk "10",
-                                     app-name project-name}}]
-  (let [data {:name project-name
+  [project-name package-name & options]
+  (let [options (apply hash-map options)
+        activity (get options ":activity" "MainActivity")
+        target-sdk (get options ":target-sdk" "10")
+        app-name (get options ":app-name" project-name)
+        data {:name project-name
               :package package-name
               :package-sanitized (sanitize package-name)
               :path (package-to-path (sanitize package-name))


Fix bug that highlighted code is evaluated in clojure.core namespace

--- src/leiningen/highlight.clj
+++ src/leiningen/highlight.clj
@@ -58,10 +58,13 @@
                  [:div.line {:id (str "LC" i)} line])]]]]]]])))

 (defn- handler [nsname]
-  (let [filename (-> (#'clojure.core/root-resource nsname)
-                     (str/replace #"^/" "")
-                     (str ".clj"))]
-    (->> (hl/highlight html/colorful-symbols-rule (slurp (io/resource filename)))
+  (when-let [resource (-> (#'clojure.core/root-resource nsname)
+                          (str/replace #"^/" "")
+                          (str ".clj")
+                          io/resource)]
+    (->> (hl/highlight html/colorful-symbols-rule
+                       (slurp resource)
+                       :ns (create-ns (symbol nsname)))
          (render-html nsname))))

 (defroutes app


(TK-10) Remove extraneous schema

(TK-10) Remove extraneous schema

Remove extraneous TestEndpoint schema, as it is no longer
needed.

--- src/puppetlabs/trapperkeeper/services/webserver/jetty9_core.clj
+++ src/puppetlabs/trapperkeeper/services/webserver/jetty9_core.clj
@@ -92,16 +92,6 @@
    :target-port schema/Int
    :endpoint    schema/Str
    :target-path schema/Str})
-
-(def TestEndpoint
-  {:type schema/Keyword
-   :endpoint schema/Str
-   (schema/optional-key :base-path) schema/Str
-   (schema/optional-key :servlet) java.lang.Class
-   (schema/optional-key :war) schema/Str
-   (schema/optional-key :target-host) schema/Str
-   (schema/optional-key :target-port) schema/Int
-   (schema/optional-key :target-path) schema/Str})

 (def EndpointSet
   #{(schema/either ContextEndpoint RingEndpoint ServletEndpoint WarEndpoint ProxyEndpoint)})


try head, then get

try head, then get

as recommended in
http://samsaffron.com/archive/2012/06/07/testing-3-million-hyperlinks-lessons-learned

--- src/link_checker/github.clj
+++ src/link_checker/github.clj
@@ -63,7 +63,11 @@

 (defn- fetch-link [url]
   (log/info :msg (format "Fetching link %s" url))
-  (let [resp (try (client/get url {:max-redirects 5 :throw-exceptions false})
+  (let [resp (try (let [opts {:max-redirects 5 :throw-exceptions false}
+                        head (client/head url opts)]
+                    (if (> 400 (:status head) 199)
+                      head
+                      (client/get url opts)))
                     (catch Exception err {:error err}))]
     {:url url
      :status (or (:error resp) (:status resp))


remove snapshots and release

remove snapshots and release

--- kafka-clj/project.clj
+++ kafka-clj/project.clj
@@ -30,7 +30,7 @@
                  [org.clojure/tools.trace "0.7.6"]
                  [org.xerial.snappy/snappy-java "1.1.1.6"]
                  [org.clojure/tools.logging "0.3.0"]
-                 [clj-tcp "0.4.4-SNAPSHOT"]
+                 [clj-tcp "0.4.4"]
                  [fmap-clojure "LATEST" :exclusions [org.clojure/tools.logging]]
                  [fun-utils "0.5.0" :exclusions [org.clojure/tools.logging]]
                  [clj-tuple "0.1.7"]


Only specify player-pool if arg is a number. Fixes #221.

--- src/overtone/music/time.clj
+++ src/overtone/music/time.clj
@@ -57,12 +57,18 @@

 (defn stop-player
   "Stop scheduled fn gracefully if it hasn't already executed."
-  [sched-fn] (at-at/stop sched-fn player-pool))
+  [sched-fn]
+  (if (number? sched-fn)
+    (at-at/stop sched-fn player-pool)
+    (at-at/stop sched-fn)))

 (defn kill-player
   "Kills scheduled fn immediately if it hasn't already executed. You
   are also able to specify player by job id - see print-schedule."
-  [sched-fn] (at-at/kill sched-fn player-pool))
+  [sched-fn]
+  (if (number? sched-fn)
+    (at-at/kill sched-fn player-pool)
+    (at-at/kill sched-fn)))

 (def ^{:dynamic true :private true} *apply-ahead*
   "Amount of time apply-by is scheduled to execute *before* it was


Use response-promise terminology instead of response-channel.

This seems less confusing.

--- Clojure/src/ambly/repl/jsc.clj
+++ Clojure/src/ambly/repl/jsc.clj
@@ -24,19 +24,19 @@
   (.write out (int 0)) ;; terminator
   (.flush out))

-(defn read-messages [^BufferedReader in response-channel]
+(defn read-messages [^BufferedReader in response-promise]
   (loop [sb (StringBuilder.) c (.read in)]
     (cond
       (= c -1) (do
-                 (when-let [ch @response-channel]
-                   (deliver ch :eof))
+                 (if-let [resp-promise @response-promise]
+                   (deliver resp-promise :eof))
                  :eof)
       (= c 1) (do
                 (print (str sb))
                 (flush)
                 (recur (StringBuilder.) (.read in)))
       (= c 0) (do
-                (deliver @response-channel (str sb))
+                (deliver @response-promise (str sb))
                 (recur (StringBuilder.) (.read in)))
       :else (do
               (.append sb (char c))
@@ -48,7 +48,7 @@
   (.start
         (Thread.
           #(try
-            (let [rv (read-messages (:in @(:socket repl-env)) (:response-channel repl-env))]
+            (let [rv (read-messages (:in @(:socket repl-env)) (:response-promise repl-env))]
               (when (= :eof rv)
                 (close-socket @(:socket repl-env))))
             (catch IOException e
@@ -81,7 +81,7 @@
   [repl-env js]
   (let [{:keys [out]} @(:socket repl-env)
         response-promise (promise)]
-    (reset! (:response-channel repl-env) response-promise)
+    (reset! (:response-promise repl-env) response-promise)
     (write out js)
     (let [response @response-promise]
       (if (= :eof response)
@@ -179,7 +179,7 @@
              (js/CLOSURE_IMPORT_SCRIPT
                (aget (.. js/goog -dependencies_ -nameToPath) name))))))))

-(defrecord JscEnv [host port socket response-channel]
+(defrecord JscEnv [host port socket response-promise]
   repl/IJavaScriptEnv
   (-setup [this opts]
     (setup this opts))


Added Google group and made column wider

--- src/cljs/org/broadinstitute/firecloud_ui/page/workspaces_list.cljs
+++ src/cljs/org/broadinstitute/firecloud_ui/page/workspaces_list.cljs
@@ -101,7 +101,7 @@
       [{:header [:div {:style {:marginLeft -6}} "Status"] :starting-width 60
         :content-renderer (fn [data] [StatusCell {:data data}])
         :filter-by :none}
-       {:header "Workspace" :starting-width 250
+       {:header "Workspace" :starting-width 450
         :content-renderer (fn [data] [WorkspaceCell {:data data}])
         :filter-by :name}
        {:header "Description" :starting-width 400
@@ -112,7 +112,9 @@
       :data (map (fn [ws]
                    [{:status (:status ws)
                      :onClick #((:onWorkspaceSelected props) (ws "workspace"))}
-                    {:name (get-in ws ["workspace" "name"]) :status (:status ws)
+                    {:name (str (get-in ws ["workspace" "namespace"])
+                             "/" (get-in ws ["workspace" "name"]))
+                     :status (:status ws)
                      :onClick #((:onWorkspaceSelected props) (ws "workspace"))}
                     ws])
               workspaces)}]))


Infinispan 8.x changed this guy's base class [ISPN-5573]

IllegalLifecycleStateException used to extend IllegalStateException and
now it extends CacheException. I'm sure they had a good reason.

--- caching/test/immutant/caching_test.clj
+++ caching/test/immutant/caching_test.clj
@@ -218,7 +218,7 @@
     (is (= 1 (:a c)))
     (stop "terrence")
     (is (empty? (cache "terrence")))
-    (is (thrown? IllegalStateException (empty? c)))))
+    (is (thrown? RuntimeException (empty? c)))))

 (deftest test-create-reconfigures
   (is (= -1 (.. (new-cache)


Simplify joins

Simplify joins

--- src/aurora/language.cljs
+++ src/aurora/language.cljs
@@ -130,16 +130,9 @@
       (apush result (aget values (aget ixes i))))
     (Fact. nil result (fact-hash result))))

-(defn fact-join-ixes [left-fact right-fact ixes]
-  (let [result #js []
-        left-values (.-values left-fact)
-        right-values (.-values right-fact)]
-    (dotimes [i (count ixes)]
-      (let [ix (aget ixes i)]
-        (if (< ix (alength left-values))
-          (apush result (aget left-values ix))
-          (apush result (aget right-values (- ix (alength left-values)))))))
-    (Fact. nil result (fact-hash result))))
+(defn fact-join [left-fact right-fact]
+  (let [values (.concat (.-values left-fact) (.-values right-fact))]
+    (Fact. nil values (fact-hash values))))

 (comment
   (fact-shape ::eg "[a] has a [b] with a [c]")
@@ -237,21 +230,21 @@
             (apush out-facts fact)
             (aset node->stats node "dupes" (+ (aget node->stats node "dupes") 1))))))))

-(defn lookup-update! [index-node key-ixes val-ixes]
+(defn lookup-update! [index-node key-ixes reverse?]
   (fn [node node->state node->stats in-facts out-facts]
     (let [index (aget node->state index-node)]
       (dotimes [i (alength in-facts)]
         (let [left-fact (aget in-facts i)
               key (fact-ixes left-fact key-ixes)]
           (doseq [right-fact (keys (.lookup index key))]
-              (apush out-facts (fact-join-ixes left-fact right-fact val-ixes))))))))
+              (apush out-facts (if reverse? (fact-join right-fact left-fact) (fact-join left-fact right-fact)))))))))

 ;; FLOWS

 (defrecord Union [nodes])
 (defrecord FilterMap [nodes fun&args])
 (defrecord Index [nodes key-ixes])
-(defrecord Lookup [nodes index-node key-ixes val-ixes])
+(defrecord Lookup [nodes index-node key-ixes reverse?])

 (defn flow->nodes [flow]
   (:nodes flow))
@@ -285,7 +278,7 @@
                 Union (union-update!)
                 FilterMap (filter-map-update! (apply (resolve (first (:fun&args flow))) (rest (:fun&args flow))))
                 Index (index-update! (:key-ixes flow))
-                Lookup (lookup-update! (:index-node flow) (:key-ixes flow) (:val-ixes flow))))
+                Lookup (lookup-update! (:index-node flow) (:key-ixes flow) (:reverse? flow))))
         (aset node->stats node
               (condp = (type flow)
                 Union #js {:dupes 0}
@@ -548,15 +541,13 @@
         index-ixes-b (ixes-of vars-b key-vars-b)
         lookup-ixes-a (ixes-of vars-a key-vars-b)
         lookup-ixes-b (ixes-of vars-b key-vars-a)
-        val-ixes-a (ixes-of (concat vars-a vars-b) val-vars)
-        val-ixes-b (ixes-of (concat vars-b vars-a) val-vars)
         [plan index-a] (add-flow plan (->Index nodes-a index-ixes-a))
         index-b (inc (count (:node->flow plan))) ;; gross :(
-        [plan lookup-a] (add-flow plan (->Lookup [index-a] index-b lookup-ixes-a val-ixes-a))
+        [plan lookup-a] (add-flow plan (->Lookup [index-a] index-b lookup-ixes-a false))
         [plan index-b'] (add-flow plan (->Index nodes-b index-ixes-b))
         _ (assert (= index-b index-b'))
-        [plan lookup-b] (add-flow plan (->Lookup [index-b] index-a lookup-ixes-b val-ixes-b))]
-    [plan [lookup-a lookup-b] (map #(nth (concat vars-a vars-b) %) val-ixes-a)]))
+        [plan lookup-b] (add-flow plan (->Lookup [index-b] index-a lookup-ixes-b true))]
+    [plan [lookup-a lookup-b] (vec (concat vars-a vars-b))]))

 (defn add-rule [plan rule]
   (let [recalls (filter #(= Recall (type %)) (:clauses rule))


Reuse update functions from old state

Reuse update functions from old state

--- src/aurora/language.cljs
+++ src/aurora/language.cljs
@@ -264,11 +264,14 @@
 (defrecord FlowPlan [node->flow flow->node memory->shape->node kind->shape])

 (defn flow-plan->flow-state [{:keys [node->flow] :as plan}]
-  (let [node->state (into-array (for [_ node->flow] nil))
-        node->out-nodes (into-array (for [_ node->flow] #js []))
-        node->facts (into-array (for [_ node->flow] #js []))
-        node->update! (into-array (for [_ node->flow] nil))
+  (let [node->state (make-array (count node->flow))
+        node->out-nodes (make-array (count node->flow))
+        node->facts (make-array (count node->flow))
+        node->update! (make-array (count node->flow))
         trace #js []]
+    (dotimes [node (count node->flow)]
+      (aset node->out-nodes node #js [])
+      (aset node->facts node #js []))
     (dotimes [node (count node->flow)]
       (let [flow (nth node->flow node)]
         (aset node->state node
@@ -286,6 +289,27 @@
                 Index (index-update! (:key-ixes flow))
                 Lookup (lookup-update! (:index-node flow) (:key-ixes flow) (:val-ixes flow))))))
     (FlowState. node->state node->out-nodes node->facts node->update! trace plan)))
+
+(defn empty-state-of [plan state]
+  (if (= plan (:plan state))
+    (let [node->flow (:node->flow plan)
+          node->state (make-array (count node->flow))
+          node->out-nodes (:node->out-nodes state)
+          node->facts (make-array (count node->flow))
+          node->update! (:node->update! state)
+          trace #js []]
+      (dotimes [node (alength node->out-nodes)]
+        (aset node->facts node #js [])
+        (let [flow (nth node->flow node)]
+          (aset node->state node
+              (condp = (type flow)
+                Union (transient #{})
+                FilterMap nil
+                Index (transient {})
+                Lookup nil))))
+      (FlowState. node->state node->out-nodes node->facts node->update! trace plan))
+    (do (println "Rebuilding state!")
+      (flow-plan->flow-state plan))))

 (def empty-flow-plan
   (FlowPlan. [] {} {} {}))
@@ -681,7 +705,7 @@
   ([plan] (tick plan (flow-plan->flow-state plan)))
   ([plan state]
    (js/console.time "plan->state")
-   (let [new-state (flow-plan->flow-state plan)]
+   (let [new-state (empty-state-of plan state)]
      (js/console.timeEnd "plan->state")
      (js/console.time "tick")
      (doseq [shape (get-in state [:plan :kind->shape :known])] ;; using old plan here


delaney.clj: some renaming and reordering.

--- clojure/org/gavrog/clojure/delaney.clj
+++ clojure/org/gavrog/clojure/delaney.clj
@@ -15,8 +15,8 @@
 (defprotocol IPersistentDSymbol
   (dsconj [_ new])
   (dsdisj [_ old])
-  (dsglue [_ i D E])
-  (dsunglue [_ i D]))
+  (glue [_ i D E])
+  (unglue [_ i D]))

 (extend-type DelaneySymbol
   IDSymbol
@@ -26,6 +26,19 @@
   (indices [ds] (iterator-seq (.indices ds)))
   (s [ds i D] (when (.definesOp ds i D) (.op ds i D)))
   (v [ds i j D] (when (.definesV ds i j D) (.v ds i j D))))
+
+(defn- ops [ds]
+  (into {} (for [i (indices ds)]
+             [i (into {} (for [D (elements ds)
+                               :when (s ds i D)]
+                           [D (s ds i D)]))])))
+
+(defn- vs [ds]
+  (into {} (for [i (indices ds)
+                 :when (index? ds (inc i))]
+             [i (into {} (for [D (elements ds)
+                               :when (v ds i (inc i) D)]
+                           [D (v ds i (inc i) D)]))])))

 (deftype DSymbol [dim size s# v#]
   IDSymbol
@@ -50,13 +63,14 @@
           (when (and (integer? new) (not (neg? new)))
             (DSymbol. dim (max size new) s# v#)))
   (dsdisj [_ old]
-          (let [s-remove (fn [[i a]]
-                           [i (reduce dissoc a (concat old (map (s# i) old)))])
-                v-remove (fn [[i a]] [i (reduce dissoc a old)])
-                new-s# (into {} (map s-remove s#))
-                new-v# (into {} (map v-remove v#))]
-            (DSymbol. dim size new-s# new-v#)))
-  (dsglue [ds i D E]
+          (when (= old size)
+            (let [s-remove (fn [[i a]]
+                             [i (reduce dissoc a (concat old (map (s# i) old)))])
+                  v-remove (fn [[i a]] [i (reduce dissoc a old)])
+                  new-s# (into {} (map s-remove s#))
+                  new-v# (into {} (map v-remove v#))]
+              (DSymbol. dim (dec size) new-s# new-v#))))
+  (glue [ds i D E]
           (when (and (integer? i) (not (neg? i))
                      (integer? D) (pos? D)
                      (integer? E) (pos? E))
@@ -64,7 +78,7 @@
                       (max size D E)
                       (assoc s# i (assoc (s# i) D E, E D))
                       v#)))
-  (dsunglue [ds i D]
+  (unglue [ds i D]
             (when (index? ds i)
               (DSymbol. dim
                         size
@@ -78,6 +92,13 @@
                (= (ops self) (ops other))
                (= (vs self) (vs other)))))

+
+;; === Functions for IDSymbol instances
+
+(defn size [ds] (count (elements ds)))
+
+(defn dim [ds] (dec (count (indices ds))))
+
 (defmethod print-method DSymbol [ds ^Writer w]
   (print-method (list (symbol "DSymbol.")
                       (dim ds)
@@ -85,29 +106,6 @@
                       (ops ds)
                       (vs ds))
                 w))
-
-(deftest gluing
-  (is (= (dsglue (DSymbol. 0 0 {} {}) 2 1 2)
-         (DSymbol. 2 2 {2 {1 2 2 1}} {}))))
-
-;; General D-symbol functions
-
-(defn- ops [ds]
-  (into {} (for [i (indices ds)]
-             [i (into {} (for [D (elements ds)
-                               :when (s ds i D)]
-                           [D (s ds i D)]))])))
-
-(defn- vs [ds]
-  (into {} (for [i (indices ds)
-                 :when (index? ds (inc i))]
-             [i (into {} (for [D (elements ds)
-                               :when (v ds i (inc i) D)]
-                           [D (v ds i (inc i) D)]))])))
-
-(defn size [ds] (count (elements ds)))
-
-(defn dim [ds] (dec (count (indices ds))))

 (defn walk [ds D & idxs]
   "Returns the result of applying the D-symbol operators on ds with the
@@ -123,7 +121,8 @@
         (recur (inc n) F)))))

 (defn m [ds i j D]
-  (let [v (v ds i j D), r (r ds i j D)]
+  (let [v (v ds i j D)
+        r (r ds i j D)]
     (when (and v r) (* v r))))

 (defn chain-end [ds D i j]
@@ -191,3 +190,9 @@
               (/ (s D) (v D)))))
   ([ds]
     (curvature ds 0)))
+
+;; === Tests
+
+(deftest gluing
+  (is (= (glue (DSymbol. 0 0 {} {}) 2 1 2)
+         (DSymbol. 2 2 {2 {1 2 2 1}} {}))))


Perf tweak: use peek for parser stack instead of first.

--- src/carmine/protocol.clj
+++ src/carmine/protocol.clj
@@ -167,7 +167,7 @@

       (if (= reply-count 1)
         (->> (get-basic-reply! in)
-             (apply-parser (first parsers))
+             (apply-parser (peek parsers))
              skip-check
              exception-check)


Add support for server logging

Add support for server logging

--- src/circleci/logging.clj
+++ src/circleci/logging.clj
@@ -1,4 +1,27 @@
-(ns circleci.logging)
+(ns circleci.logging
+  (:import (org.apache.log4j Logger
+			     BasicConfigurator
+                             EnhancedPatternLayout
+			     Level
+                             ConsoleAppender
+                             SimpleLayout)
+	   (org.apache.log4j.spi RootLogger))
+  (:import (org.apache.log4j.rolling TimeBasedRollingPolicy
+                                     RollingFileAppender))
+  (:import org.apache.commons.logging.LogFactory))

 (defn init []
-  (org.apache.log4j.BasicConfigurator/configure))+  (let [rolling-policy (doto (TimeBasedRollingPolicy.)
+                         (.setActiveFileName  "circleci.log" )
+                         (.setFileNamePattern "circleci-%d{yyyy-MM-dd}.log.gz")
+                         (.activateOptions))
+        layout (EnhancedPatternLayout. "%p [%d] %t - %c - %m%n")
+        rolling-log-appender (doto (RollingFileAppender.)
+                               (.setRollingPolicy rolling-policy)
+                               (.setLayout layout)
+                               (.activateOptions))]
+    (doto (Logger/getRootLogger)
+      (.removeAllAppenders)
+      (.addAppender rolling-log-appender)
+      (.addAppender (ConsoleAppender. layout))))
+  (. (Logger/getRootLogger) (setLevel Level/WARN)))


add header to the base module

add header to the base module

--- src/clj/cljs/closure.clj
+++ src/clj/cljs/closure.clj
@@ -977,7 +977,7 @@
              "document.write('<script>if (typeof goog != \"undefined\") { goog.require(\"" (comp/munge (:main opts))
              "\"); } else { console.warn(\"ClojureScript could not load :main, did you forget to specify :asset-path?\"); };</script>');\n")))))

-(declare foreign-deps-str)
+(declare foreign-deps-str add-header)

 (defn output-modules
   "Given compiler options and a sequence of module name and module description
@@ -991,9 +991,12 @@
     (assert (not (nil? source))
       (str "Module " name " did not supply :source"))
     (spit (io/file output-to)
-      (if-not (empty? foreign-deps)
-        (str (foreign-deps-str opts foreign-deps) "\n" source)
-        source))
+      (let [source (if (= name :cljs-base)
+                     (add-header opts source)
+                     source)]
+        (if-not (empty? foreign-deps)
+          (str (foreign-deps-str opts foreign-deps) "\n" source)
+          source)))
     (when (:source-map opts)
       (spit (io/file (:source-map-name module-desc))
         (:source-map-json module-desc)))))


libs and externs from classpath, fixes CLJS-134

--- src/clj/cljs/closure.clj
+++ src/clj/cljs/closure.clj
@@ -94,6 +94,54 @@
         (set-options opts compiler-options)
         compiler-options)))

+
+
+(defn jar-entry-names* [jar-path]
+  (with-open [z (java.util.zip.ZipFile. jar-path)]
+    (doall (map #(.getName %) (enumeration-seq (.entries z))))))
+
+(def jar-entry-names (memoize jar-entry-names*))
+
+(defn find-js-jar
+  "finds js resources from a given path in a jar file"
+  [jar-path lib-path]
+  (doall
+    (map #(io/resource %)
+         (filter #(do
+                    (and
+                      (.startsWith % lib-path)
+                      (.endsWith % ".js")))
+                 (jar-entry-names jar-path)))))
+(declare to-url)
+(defn find-js-fs
+  "finds js resources from a path on the files system"
+  [path]
+  (let [file (io/file path)]
+    (when (.exists file)
+      (map to-url (filter #(.endsWith (.getName %) ".js") (file-seq (io/file path)))))))
+
+
+(defn find-js-classpath [path]
+  "finds all js files on the classpath matching the path provided"
+  (let [process-entry #(if (.endsWith % ".jar")
+                           (find-js-jar % path)
+                           (find-js-fs (str % "/" path)))
+        cpath-list (let [sysp (System/getProperty  "java.class.path" )]
+                     (if (.contains sysp ";")
+                       (string/split sysp #";")
+                       (string/split sysp #":")))]
+    (doall (reduce #(let [p (process-entry %2)]
+                      (if p (concat %1 p) %1)) [] cpath-list))))
+
+(defn find-js-resources [path]
+  "finds js resources in a given path on either the file system or
+   the classpath"
+  (let [file (io/file path)]
+    (if (.exists file)
+      (find-js-fs path)
+      (find-js-classpath path))))
+
+
 (defn load-externs
   "Externs are JavaScript files which contain empty definitions of
   functions which will be provided by the envorinment. Any function in
@@ -104,16 +152,14 @@
   the default externs should be excluded."
   [{:keys [externs use-only-custom-externs target]}]
   (letfn [(filter-js [paths]
-            (for [p paths f (file-seq (io/file p))
-                  :when (.endsWith (.toLowerCase (.getName f)) ".js")]
-              (.getAbsolutePath f)))
+            (for [p paths u (find-js-resources p)] u))
           (add-target [ext]
             (if (= :nodejs target)
-              (cons (.getFile (io/resource "cljs/nodejs_externs.js"))
+              (cons (io/resource "cljs/nodejs_externs.js")
                     (or ext []))
               ext))
           (load-js [ext]
-            (map #(js-source-file % (io/input-stream %)) ext))]
+            (map #(js-source-file (.getFile %) (slurp %)) ext))]
     (let [js-sources (-> externs filter-js add-target load-js)]
       (if use-only-custom-externs
         js-sources
@@ -402,12 +448,12 @@
   containing Javascript files, return a list of maps
   containing :provides, :requires, :file and :url."
   [path]
-  (letfn [(graph-node [f]
-            (-> (io/reader f)
+  (letfn [(graph-node [u]
+            (-> (io/reader u)
                 line-seq
                 parse-js-ns
-                (assoc :file (.getPath f) :url (to-url f))))]
-    (let [js-sources (filter #(.endsWith (.getName %) ".js") (file-seq (io/file path)))]
+                (assoc :url u)))]
+    (let [js-sources (find-js-resources path)]
       (filter #(seq (:provides %)) (map graph-node js-sources)))))

 (def load-library (memoize load-library*))


CLJ-2006 Fix old function name in docstring

Signed-off-by: Stuart Halloway <4dc50fc3bc007be011b5445f3f79298b9eeb51b7@cognitect.com>

--- src/clj/clojure/spec.clj
+++ src/clj/clojure/spec.clj
@@ -697,7 +697,7 @@
   by calling get-spec with the var or fully-qualified symbol.

   Once registered, function specs are included in doc, checked by
-  instrument, tested by the runner clojure.spec.test/run-tests, and (if
+  instrument, tested by the runner clojure.spec.test/check, and (if
   a macro) used to explain errors during macroexpansion.

   Note that :fn specs require the presence of :args and :ret specs to


Share contexts between compiles

Share contexts between compiles

--- src/clj/inky/compile.clj
+++ src/clj/inky/compile.clj
@@ -36,10 +36,12 @@
       (println "Rate limit hit fetching gist id:" gist-id)
       {:success false :error-cause "Rate limit hit fetching gist."})))

+(def compile-context (atom {}))
+
 (defn compile-cljs [hash filename]
   (try
     {:success true
-     :return (binding [cljsenv/*compiler* (atom {})]
+     :return (binding [cljsenv/*compiler* compile-context]
                (cljsc/build
                  filename
                  {:optimizations :advanced


minor macro fix

minor macro fix

--- src/clj/tictag/utils.clj
+++ src/clj/tictag/utils.clj
@@ -32,7 +32,7 @@
     (assoc
      user
      :macros
-     (into {} (map (juxt :macro/expands-from #(str/split (:macro/expands-to %) #" ")) (:macros user))))))
+     (into {} (map (juxt :expands_from #(str/split (:expands_to %) #" ")) (:macros user))))))

 (defn kebab-str [kw]
   (str/replace (name kw) #"_" "-"))


Use anonymous function declaration style.

--- src/clj_ravendb/rest.clj
+++ src/clj_ravendb/rest.clj
@@ -158,8 +158,7 @@
   ([client document-ids channel]
    (watch-documents client document-ids channel {}))
   ([client document-ids channel options]
-   (watch client (fn []
-                   (load-documents client document-ids)) channel options)))
+   (watch client #(load-documents client document-ids) channel options)))

 (defn- watch-index
   "Watch the results of an index query for changes
@@ -173,8 +172,7 @@
   ([client query channel]
    (watch-index client query channel {}))
   ([client query channel options]
-   (watch client (fn []
-                   (query-index client query)) channel options)))
+   (watch client #(query-index client query) channel options)))

 (defn rest-client
   "Gets a client for a RavenDB endpoint at the


Double quote itself is actually already handled by escape-char.

--- src/cljs/go/compiler.clj
+++ src/cljs/go/compiler.clj
@@ -341,9 +341,7 @@
   (emits (wrap-in-double-quotes (escape-string x))))
 (defmethod emit-constant Boolean [x] (emits (if x "true" "false")))
 (defmethod emit-constant Character [x]
-  (emits (wrap-in-double-quotes (case x
-                                  \" "\\\""
-                                  (escape-char x)))))
+  (emits (wrap-in-double-quotes (escape-char x))))

 (defmethod emit-constant java.util.regex.Pattern [x]
   (if (= "" (str x))


Turn down product-join

Turn down product-join

--- test/aurora/btree_test.cljs
+++ test/aurora/btree_test.cljs
@@ -78,13 +78,13 @@
   (aurora.btree/self-join-prop 3))

 (defspec product-join-prop-test
-  5000
+  1000
   (aurora.btree/product-join-prop 1))

 (defspec product-join-prop-test
-  5000
+  1000
   (aurora.btree/product-join-prop 2))

 (defspec product-join-prop-test
-  5000
+  1000
   (aurora.btree/product-join-prop 3))


update shoot to track shoot related stats

--- src/wombats/game/decisions/shoot.clj
+++ src/wombats/game/decisions/shoot.clj
@@ -39,13 +39,13 @@
    damage
    shooter]

-  (let [wombat-victim? (= (:type cell-contents) :wombat)
-        contains-hp? (boolean (:hp cell-contents))
-        cell-update (when contains-hp?
+  (let [wombat-victim (= (:type cell-contents) :wombat)
+        contains-hp (boolean (:hp cell-contents))
+        cell-update (when contains-hp
                       (damage-cell cell-contents damage))
-        destroyed? (and contains-hp?
-                        (= (:type cell-update) :open))
-        wombat-shooter? (= (:type shooter) :wombat)]
+        destroyed (and contains-hp
+                       (= (:type cell-update) :open))
+        wombat-shooter (= (:type shooter) :wombat)]

     ;; Always update the cell metadata to attach the shot
     (cond-> (update-in game-state [:game/frame :frame/arena]
@@ -55,29 +55,28 @@
                                                        (get-shot-metadata shooter))))

       ;; If the cell is able to be damaged, apply damage and update the arena
-      contains-hp?
+      contains-hp
       (update-in [:game/frame :frame/arena]
                  #(au/update-cell-contents %
                                            cell-coords
                                            cell-update))

       ;; If the cell was destroyed, attach explosion metadata
-      destroyed?
+      destroyed
       (update-in [:game/frame :frame/arena]
                  #(au/update-cell-metadata %
                                            cell-coords
                                            (conj cell-metadata
                                                  (get-explosion-metadata))))

-      ;; If the affected cell was another player, updated messages
-      wombat-victim?
-      (update-in [:game/players (:uuid cell-contents)]
-                 (fn [player]
-                   ;; TODO #76 Update how many times i've been hit / killed
-                   player))
+      ;; If the affected cell was another player, updated stats
+      wombat-victim
+      (update-in [:game/players (:uuid cell-contents) :player/stats]
+                 (fn [stats]
+                   (update stats :stats/have-been-shot inc)))

       ;; If the shooter hit something, update their stats
-      (and contains-hp? wombat-shooter?)
+      (and contains-hp wombat-shooter)
       (update-in [:game/players (:uuid shooter) :player/stats]
                  (fn [stats]
                    (let [item-hit (:type cell-contents)]
@@ -107,27 +106,39 @@
                                    (:steel-barrier-hit-bonus game-parameters)))))))

       ;; If the shooter was a player and they destroyed something, update their stats
-      (and destroyed? wombat-shooter?)
+      (and destroyed wombat-shooter)
       (update-in [:game/players (:uuid shooter) :player/stats]
                  (fn [stats]
                    (case (:type cell-contents)
-                     :wombat (-> stats
-                                 (update :stats/wombats-destroyed inc)
-                                 (update :stats/score +
-                                         (:wombat-destroyed-bonus game-parameters)))
-                     :zakano (-> stats
-                                 (update :stats/zakano-destroyed inc)
-                                 (update :stats/score +
-                                         (:zakano-destroyed-bonus game-parameters)))
-                     :wood-barrier (-> stats
-                                       (update :stats/wood-barriers-destroyed inc)
-                                       (update :stats/score +
-                                               (:wood-barrier-destroyed-bonus game-parameters)))
-                     :steel-barrier (-> stats
-                                        (update :stats/steel-barriers-destroyed inc)
-                                        (update :stats/score +
-                                                (:steel-barrier-destroyed-bonus game-parameters)))
-                     stats))))))
+                     :wombat
+                     (-> stats
+                         (update :stats/wombats-destroyed inc)
+                         (update :stats/score +
+                                 (:wombat-destroyed-bonus game-parameters)))
+                     :zakano
+                     (-> stats
+                         (update :stats/zakano-destroyed inc)
+                         (update :stats/score +
+                                 (:zakano-destroyed-bonus game-parameters)))
+                     :wood-barrier
+                     (-> stats
+                         (update :stats/wood-barriers-destroyed inc)
+                         (update :stats/score +
+                                 (:wood-barrier-destroyed-bonus game-parameters)))
+                     :steel-barrier
+                     (-> stats
+                         (update :stats/steel-barriers-destroyed inc)
+                         (update :stats/score +
+                                 (:steel-barrier-destroyed-bonus game-parameters)))
+                     stats)))
+
+      ;; If the victum was a wombat and they were destroyed, update stats
+      (and destroyed wombat-victim)
+      (update-in [:game/players (:uuid cell-contents) :player/stats]
+                 (fn [stats]
+                   (-> stats
+                       (update :stats/deaths inc)
+                       (update :stats/deaths-by-shot inc)))))))

 (defn- process-shot
   "Process a cell that a shot passes through"


(MAINT) Bump up default borrow timeout for jruby-pool-int tests

This commit bumps up the default timeout for jruby-pool-int test
borrows from 3 minutes to 5 minutes.  This compensates for sporadic
failures we've seen in Travis CI when it took more than 3 minutes for a
JRuby pool initialization to complete.

--- test/integration/puppetlabs/services/jruby/jruby_pool_int_test.clj
+++ test/integration/puppetlabs/services/jruby/jruby_pool_int_test.clj
@@ -40,7 +40,7 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Utilities

-(def default-borrow-timeout 180000)
+(def default-borrow-timeout 300000)

 (defn timed-deref
   [ref]


Housekeeping

Housekeeping

--- test/test_carmine/locks.clj
+++ test/test_carmine/locks.clj
@@ -1,7 +1,6 @@
 (ns test-carmine.locks
-  (:require [taoensso.carmine :as car])
-  (:use  [clojure.test]
-         [taoensso.carmine.locks :only (acquire-lock release-lock with-lock)]))
+  (:use [clojure.test]
+        [taoensso.carmine.locks :only (acquire-lock release-lock with-lock)]))

 (deftest basic-locking
   (is (acquire-lock 2 2000 2000)) ; For 2 secs


fixed bug in new_stress_tests.clj/spit-prisoner-file that read args incorrectly

--- test/acceptance/new_stress_tests.clj
+++ test/acceptance/new_stress_tests.clj
@@ -13,7 +13,6 @@
 ;;;; setup

 (def my-interpreter (push/interpreter))
-(def cohort-size 100)
 (def program-size 1000)
 (def erc-scale 10)
 (def erc-prob 3/5)
@@ -51,14 +50,14 @@
 (with-handler! #'run-program-in-standardized-interpreter
   "If an interpreter raises an exception, dump a new prisoner file."
   [java.lang.StackOverflowError, java.lang.NullPointerException]
-  (fn [e & args]
+  (fn [e interpreter program bindings]
     (do
       (println
-        (str "\n\nSTACK OVERFLOW >>>>>>> " args))
+        (str "\n\nWRITING FILE >>>>>>> " (str e)))
       (println "\n\n saving prisoner: ")
       (spit-prisoner-file
-        (first args)
-        (second args)
+        program
+        bindings
         (.getMessage e)))
         ))

@@ -115,7 +114,7 @@

 (defn launch-some-workers
   [interpreter bindings how-many]
-  (cp/with-shutdown! [net-pool (cp/threadpool 100)]
+  (cp/with-shutdown! [net-pool (cp/threadpool 16)]
     (doall
       (lazy/upmap net-pool
         #(.write *out*


Added working testcase for sync-updated (only download new versions from remote). Need to add testcase for new versions with changed domain specs (e.g. different amount of shards etc).

--- test/clj/elephantdb/service_test.clj
+++ test/clj/elephantdb/service_test.clj
@@ -124,6 +124,73 @@
           (.shutdown handler))
         ))))

+(deftest test-update-synched
+  (with-local-tmp [lfs local-dir]
+    (with-fs-tmp [fs dtmp1 dtmp2 gtmp]
+      (let [domain-spec {:num-shards 4 :persistence-factory (JavaBerkDB.)}
+            local-config (mk-local-config local-dir)]
+        (write-clj-config! {:replication 1
+                            :hosts [(local-hostname)]
+                            :domains {"no-update" dtmp1 "do-update" dtmp2}}
+                           fs
+                           gtmp)
+
+        ;; create version 1 for no-update
+        (mk-sharded-domain fs dtmp1 domain-spec
+                           [[(barr 0) (barr 0 0)]
+                            [(barr 1) (barr 1 1)]
+                            [(barr 2) (barr 2 2)]
+                            [(barr 3) (barr 3 3)]] :version 1)
+
+        ;; create version 1 for do-update
+        (mk-sharded-domain fs dtmp2 domain-spec
+                           [[(barr 0) (barr 10 10)]
+                            [(barr 1) (barr 20 20)]
+                            [(barr 2) (barr 30 30)]
+                            [(barr 3) (barr 40 40)]] :version 1)
+
+        ;; start edb and shutdown right away to get version 1 of both domains
+        (.shutdown
+         (mk-service-handler (read-global-config gtmp local-config "111") local-dir "111" nil))
+
+        ;; create new version only for do-update domain
+        ;; create version 1 for no-update (override to make sure it didn't reload this version)
+        (mk-sharded-domain fs dtmp1 domain-spec
+                           [[(barr 0) (barr 1)]
+                            [(barr 1) (barr 2)]
+                            [(barr 2) (barr 3)]
+                            [(barr 3) (barr 4)]] :version 1)
+
+        ;; create version 2 for do-update
+        (mk-sharded-domain fs dtmp2 domain-spec
+                           [[(barr 0) (barr 11 11)]
+                            [(barr 1) (barr 22 22)]
+                            [(barr 2) (barr 33 33)]
+                            [(barr 3) (barr 44 44)]] :version 2)
+
+        (let [handler (mk-service-handler (read-global-config gtmp local-config "222") local-dir "222" nil)]
+          ;; domain no-update should not have changed
+          (is (barr= (barr 0 0)
+                     (get-val handler "no-update" (barr 0))))
+          (is (barr= (barr 1 1)
+                     (get-val handler "no-update" (barr 1))))
+          (is (barr= (barr 2 2)
+                     (get-val handler "no-update" (barr 2))))
+          (is (barr= (barr 3 3)
+                     (get-val handler "no-update" (barr 3))))
+
+          ;; domain do-update should have changed
+          (is (barr= (barr 11 11)
+                     (get-val handler "do-update" (barr 0))))
+          (is (barr= (barr 22 22)
+                     (get-val handler "do-update" (barr 1))))
+          (is (barr= (barr 33 33)
+                     (get-val handler "do-update" (barr 2))))
+          (is (barr= (barr 44 44)
+                     (get-val handler "do-update" (barr 3))))
+
+          (.shutdown handler))
+        ))))


Trivial fix to calendar holidays count test

--- test/tick/calendar_test.clj
+++ test/tick/calendar_test.clj
@@ -6,4 +6,4 @@
    [tick.calendar :as cal]))

 (deftest bank-holidays-in-england-and-wales-test
-  (is (= 65 (count (cal/bank-holidays-in-england-and-wales)))))
+  (is (= 56 (count (cal/bank-holidays-in-england-and-wales)))))


inspect data structures in percolator

inspect data structures in percolator

--- Clojure-Websockets/MainApp/src/clj/birdwatch/percolator/elastic.clj
+++ Clojure-Websockets/MainApp/src/clj/birdwatch/percolator/elastic.clj
@@ -4,6 +4,7 @@
    [clojure.tools.logging :as log]
    [pandect.core :refer [sha1]]
    [clojure.pprint :as pp]
+   [com.matthiasnehlsen.inspect :as inspect :refer [inspect]]
    [clojurewerkz.elastisch.rest.percolation :as perc]
    [clojurewerkz.elastisch.rest.response    :as esrsp]
    [clojure.core.async :as async :refer [<! put! go-loop]]))
@@ -14,12 +15,13 @@
   (let [sha (sha1 (str query))]
     (swap! subscriptions assoc uid sha)
     (perc/register-query conn "percolator" sha :query query)
-    (log/debug "Percolation registered for query" query "with SHA1" sha)))
+    (inspect :perc/start-percolator {:query query :sha sha})))

 (defn run-percolation-register-loop
   "loop for finding percolation matches and delivering those on the appropriate socket"
   [register-percolation-chan conn subscriptions]
   (go-loop [] (let [params (<! register-percolation-chan)]
+                (inspect :perc/params params)
                 (start-percolator params conn subscriptions)
                 (recur))))


Автоширина в панельных таблицах по запросу

--- radiolamp-6P3S/src/r6p3s/ui/panel_with_table.cljs
+++ radiolamp-6P3S/src/r6p3s/ui/panel_with_table.cljs
@@ -9,16 +9,18 @@

 (defn render [{:keys [cols rows
-                      striped? bordered? hover? responsive?]
-               :or   {cols        []
-                      rows        []
-                      striped?    true
-                      bordered?   true
-                      hover?      true
-                      responsive? true}
+                      striped? bordered? hover? responsive?
+                      colls-auto-width?]
+               :or   {cols              []
+                      rows              []
+                      colls-auto-width? false
+                      striped?          true
+                      bordered?         true
+                      hover?            true
+                      responsive?       true}
                :as   options}]
   (let [empty-cols? (empty? cols)
-        t-width     (when empty-cols?
+        t-width     (when (and empty-cols? (not colls-auto-width?))
                       (when-let [c (first rows)]
                         (str (quot 100 (count c)) "%")))]
     (panel/render


Improve null handling for target vectors

--- src/cortex/optimise.cljc
+++ src/cortex/optimise.cljc
@@ -178,7 +178,7 @@
   "Replaces non-numbers in the target vector with the activation (to ensure zero gradient)"
   [activation target]
   (if (= Object (m/element-type target))
-    (m/emap (fn [a b] (if (number? b) b a)) (m/coerce target activation) target)
+    (m/emap (fn [a b] (if (number? a) a b)) target activation)
     target))

 (defn mean-squared-error


Quoting the handler - Test to try to fix travis CI

--- src/ctia/http/server.clj
+++ src/ctia/http/server.clj
@@ -9,18 +9,18 @@

 (defn start! [& {:keys [join?]
                  :or {join? true}}]
-  (let [{:keys [dev-reload min-threads max-threads port]} (get-in @properties [:ctia :http])
-        handler (if dev-reload
-                  (wrap-reload handler/app)
-                  handler/app)]
-    (reset! server (let [server (jetty/run-jetty handler
+  (let [{:keys [dev-reload min-threads max-threads port]}
+        (get-in @properties [:ctia :http])]
+    (reset! server (let [server (jetty/run-jetty (if dev-reload
+                                                   (wrap-reload #'handler/app)
+                                                   #'handler/app)
                                                  {:port port
                                                   :min-threads min-threads
                                                   :max-threads max-threads
                                                   :join? join?})]
                      (doto server
                        (.setStopAtShutdown true)
-                       (.setStopTimeout (* 1000 60)))))))
+                       (.setStopTimeout (* 1000 10)))))))

 (defn stop! []
   (swap! server


cleanup

cleanup

--- src/digital/provider.clj
+++ src/digital/provider.clj
@@ -104,8 +104,5 @@
 (defmethod vconstruct :digital-ocean [{:keys [digital-ocean machine] :as spec}]
   (let [[translated ext] (translate spec)]
      (provider-validation translated)
-     (->Droplet (hypervisor* :digital-ocean :token) translated ext)
-   )
-  )
+     (->Droplet (hypervisor* :digital-ocean :token) translated ext)))

-(:status (:droplet (get-droplet "9652542")))


Commented out slow debg code.

Commented out slow debg code.

--- src/divergence/core.cljs
+++ src/divergence/core.cljs
@@ -141,9 +141,9 @@
         (js/requestAnimationFrame @animate-ref)))))

-#_(reset! animate-ref animate)
+(reset! animate-ref animate)

-(reset! animate-ref (debug-slow-down))
+;(reset! animate-ref (debug-slow-down))

 (setup e/entities)


support IN queries

support IN queries

--- src/er_cassandra/key.clj
+++ src/er_cassandra/key.clj
@@ -46,7 +46,9 @@
   (let [key (flatten (make-sequential key))
         key-value (make-sequential key-value)]
     (mapv (fn [k v]
-            [:= k v])
+            (if (sequential? v)
+              [:in k v]
+              [:= k v]))
           key
           key-value)))


added a apply-contracts macro. this is the ideal way to use contracts

--- src/fogus/me/trammel.clj
+++ src/fogus/me/trammel.clj
@@ -235,10 +235,25 @@
        ~(if (:doc mdata) (:doc mdata) "")
        ~@body)))

-(gen-class
-  :name trammel.PreconditionError
-  :extends AssertionError)
-
-(gen-class
-  :name trammel.PostconditionError
-  :extends AssertionError)
+(defmacro apply-contracts [& contracts]
+  (let [fn-names  (map first contracts)
+        contracts (for [c contracts] (list* `contract c))]
+    `(do
+       ~@(for [[n# c#] (zipmap fn-names contracts)]
+           (list `alter-var-root (list `var n#)
+                 (list `fn '[f c] (list `with-constraints 'f 'c)) c#))
+       nil)))
+
+(comment
+  (defn sqr [n] (* n n))
+  (meta #'sqr)
+  (meta sqr)
+  (sqr 0)
+
+  (apply-contracts
+   [sqr [n]
+    :requires number? (not= 0 n)
+    :ensures pos? number?])
+
+  (sqr 0)
+)


Better test example.

Better test example.

--- test/inet/data/dns_test.clj
+++ test/inet/data/dns_test.clj
@@ -7,7 +7,7 @@
     (is (dns/domain? "www.foobar.com") "Accepts valid string domains")
     (is (dns/domain? "this-is-a-valid-domain-even-though-it-has-a-quite-loooong-label.com")
         "Accepts domains with the maximum label length")
-    (is (not (dns/domain? "this-is-an-invalid-domain-because-it-has-an-overlong-label-by-un.com"))
+    (is (not (dns/domain? "this-is-an-invalid-domain-due-to-having-an-overlong-label-by-one.com"))
         "Rejects domains with overlong labels")
     (is (not (dns/domain? "this-is-an-invalid-domain-because-it-has-an-overlong-label-by-two.com"))
         "Rejects domains with even overlong-er labels"))


Pass full log test.

Pass full log test.

--- test/onyx/log/full_test.clj
+++ test/onyx/log/full_test.clj
@@ -3,7 +3,6 @@
             [com.stuartsierra.component :as component]
             [onyx.log.entry :refer [create-log-entry]]
             [onyx.extensions :as extensions]
-            [onyx.log.util :as util]
             [onyx.api :as api]
             [midje.sweet :refer :all]
             [zookeeper :as zk]))
@@ -12,37 +11,19 @@

 (def config (read-string (slurp (clojure.java.io/resource "test-config.edn"))))

-(def scheduler :onyx.task-scheduler/greedy)
+(def scheduler :onyx.job-scheduler/greedy)

 (def env-config
-  {:hornetq/mode :udp
-   :hornetq/server? true
-   :hornetq.server/type :embedded
-   :hornetq.udp/cluster-name (:cluster-name (:hornetq config))
-   :hornetq.udp/group-address (:group-address (:hornetq config))
-   :hornetq.udp/group-port (:group-port (:hornetq config))
-   :hornetq.udp/refresh-timeout (:refresh-timeout (:hornetq config))
-   :hornetq.udp/discovery-timeout (:discovery-timeout (:hornetq config))
-   :hornetq.embedded/config (:configs (:hornetq config))
-   :zookeeper/address (:address (:zookeeper config))
+  {:zookeeper/address (:address (:zookeeper config))
    :zookeeper/server? true
    :zookeeper.server/port (:spawn-port (:zookeeper config))
-   :onyx.peer/task-scheduler scheduler
    :onyx/id onyx-id})

 (def peer-config
-  {:hornetq/mode :udp
-   :hornetq.udp/cluster-name (:cluster-name (:hornetq config))
-   :hornetq.udp/group-address (:group-address (:hornetq config))
-   :hornetq.udp/group-port (:group-port (:hornetq config))
-   :hornetq.udp/refresh-timeout (:refresh-timeout (:hornetq config))
-   :hornetq.udp/discovery-timeout (:discovery-timeout (:hornetq config))
-   :zookeeper/address (:address (:zookeeper config))
+  {:zookeeper/address (:address (:zookeeper config))
    :onyx/id onyx-id
-   :onyx.peer/inbox-capacity 1000
-   :onyx.peer/outbox-capacity 1000
-   :onyx.peer/task-scheduler scheduler
-   :onyx.peer/state {:task-lifecycle-fn util/stub-task-lifecycle}})
+   :onyx.messaging/impl :http-kit-websockets
+   :onyx.peer/job-scheduler scheduler})

 (def env (onyx.api/start-env env-config))


Fix another react warning

Fix another react warning

--- src/cljs/elevent_client/pages/events/id/edit.cljs
+++ src/cljs/elevent_client/pages/events/id/edit.cljs
@@ -58,12 +58,13 @@

             clonable-events
             (cons ["None" 0]
-                  (filter (fn [[event-name event-id]]
-                            (get-in (:EventPermissions (:permissions @state/session))
-                                    [event-id :EditEvent]))
-                          (d/q '[:find ?name ?id
-                                 :where [?id :Name ?name]]
-                               @api/events-db)))
+                  (doall
+                    (filter (fn [[event-name event-id]]
+                              (get-in (:EventPermissions (:permissions @state/session))
+                                      [event-id :EditEvent]))
+                            (d/q '[:find ?name ?id
+                                   :where [?id :Name ?name]]
+                                 @api/events-db))))

             associated-organizations
             (cons ["None" 0]


Minor refactoring.

Minor refactoring.

--- src/clojure/parkour/mapreduce/input/multiplex.clj
+++ src/clojure/parkour/mapreduce/input/multiplex.clj
@@ -7,11 +7,12 @@
            [org.apache.hadoop.conf Configuration]
            [org.apache.hadoop.io Text]
            [org.apache.hadoop.io.serializer SerializationFactory]
+           [org.apache.hadoop.io.serializer Deserializer Serializer]
            [org.apache.hadoop.mapreduce InputFormat InputSplit Job]
            [org.apache.hadoop.mapreduce Mapper Mapper$Context]
            [parkour.hadoop.interfaces IInputFormat IInputSplit]
            [parkour.hadoop.input
-              MultiplexInputFormat MultiplexInputSplit MultiplexRecordReader]))
+             MultiplexInputFormat MultiplexInputSplit MultiplexRecordReader]))

 (def ^:private ^:const confs-key
   "parkour.multiplex.confs")
@@ -29,6 +30,14 @@
 (defn ^:private get-subconfs
   [job] (edn/read-string (conf/get job confs-key)))

+(defn ^:private serializer
+  {:tag `Serializer}
+  [conf klass] (-> conf SerializationFactory. (.getSerializer klass)))
+
+(defn ^:private deserializer
+  {:tag `Deserializer}
+  [conf klass] (-> conf SerializationFactory. (.getDeserializer klass)))
+
 (defn ^:private input-split*
   ([] (input-split* nil nil nil))
   ([conf] (input-split* conf nil nil))
@@ -40,8 +49,7 @@
        (readSplit [_ in]
          (let [i (.readInt in)
                klass (->> in Text/readString (.getClassByName conf))
-               split (-> (doto (-> conf SerializationFactory.
-                                   (.getDeserializer klass))
+               split (-> (doto (deserializer conf klass)
                            (.open in))
                          (.deserialize (w/new-instance conf klass)))]
            (input-split* conf i split)))
@@ -49,7 +57,7 @@
          (let [klass (class split)]
            (.writeInt out i)
            (Text/writeString out (.getName klass))
-           (doto (-> conf SerializationFactory. (.getSerializer klass))
+           (doto (serializer conf klass)
              (.open out)
              (.serialize split))))


[#1441] Add import multiple column

[#1441] Add import multiple column

--- backend/specs/akvo/lumen/specs/import/column.clj
+++ backend/specs/akvo/lumen/specs/import/column.clj
@@ -89,12 +89,14 @@
 (s/def ::c.text/body (s/keys :req-un [::c.text/type ::c.text/value]))
 (s/def ::c.number/body (s/keys :req-un [::c.number/type ::c.number/value]))
 (s/def ::c.date/body (s/keys :req-un [::c.date/type ::c.date/value]))
+(s/def ::c.multiple/body (s/keys :req-un [::c.multiple/type ::c.multiple/value]))
 (s/def ::c.geoshape/body (s/keys :req-un [::c.geoshape/type ::c.geoshape/value]))
 (s/def ::c.geopoint/body (s/keys :req-un [::c.geopoint/type ::c.geopoint/value]))

 (defmethod column-body :text [_] ::c.text/body)
 (defmethod column-body :number [_] ::c.number/body)
 (defmethod column-body :date [_] ::c.date/body)
+(defmethod column-body :multiple [_] ::c.multiple/body)
 (defmethod column-body :geoshape [_] ::c.geoshape/body)
 (defmethod column-body :geopoint [_] ::c.geopoint/body)

@@ -108,6 +110,8 @@
   (s/keys :req-un [::c.number/header ::c.number/body]))
 (defmethod column :date [_]
   (s/keys :req-un [::c.date/header ::c.date/body]))
+(defmethod column :multiple [_]
+  (s/keys :req-un [::c.multiple/header ::c.multiple/body]))
 (defmethod column :geoshape [_]
   (s/keys :req-un [::c.geoshape/header ::c.geoshape/body]))
 (defmethod column :geopoint [_]


fix bad characters in om post

fix bad characters in om post

--- src/pc/views/blog/instrumenting_om_components.clj
+++ src/pc/views/blog/instrumenting_om_components.clj
@@ -7,13 +7,13 @@
     [:article
      [:p
       "One of the big challenges in using React.js and Om is understanding how the code you write "
-      "impacts performance and rendering time. In most cases, you shouldn’t care – React’s diffing model and "
+      "impacts performance and rendering time. In most cases, you shouldn't care - React's diffing model and "
       [:a {:href "https://swannodette.github.io/2013/12/17/the-future-of-javascript-mvcs/"}
-       "Om’s handling of immutable data structures"]
+       "Om's handling of immutable data structures"]
       " make hand-tuning mostly superfluous. There will always be places where the defaults are too slow and "
-      "micro-optimizations are required for the sake of performance. In those cases, Om’s global concerns allow "
+      "micro-optimizations are required for the sake of performance. In those cases, Om's global concerns allow "
       "us to create tools to see the bottlenecks and understand the impact of our optimzations."]
-     [:p "I’ll show you how CircleCI leverages Om’s new “descriptor” overrides to understand performance in its "
+     [:p "I'll show you how CircleCI leverages Om's new “descriptor” overrides to understand performance in its "
       [:a {:href "https://github.com/circleci/frontend"} "open-source frontend"] ". "
       [:a {:href "https://circleci.com"} "CircleCI"] " is a hosted Continuous Delivery platform used by teams that "
       "want state-of-the-art CI and deployment."]]
@@ -24,7 +24,7 @@
       " were a great way to identify performance bottlenecks in your application. If your application "
       "was unnecessarily mutating the DOM, Chrome would helpfully show you a transparent overlay over the "
       "parts of the page that were modified."]
-     [:p "Here’s an example from Circle’s old haml-coffee/knockout.js frontend. We noticed that the site "
+     [:p "Here's an example from Circle's old haml-coffee/knockout.js frontend. We noticed that the site "
       "was feeling a bit sluggish. The paint rectangles made it obvious that the problem was the sidebar"
       " being re-rendered even though the content stayed the same."]]

@@ -32,8 +32,8 @@

     [:article
      [:p "React diffs against its virtual copy of the DOM before it writes to the actual DOM, so paint rectangles "
-      "can’t show you where you’re rendering too much. The benefit of React’s global optimization is that we never "
-      "make those slow DOM updates, but the cost is that we can’t use all of the browser’s built-in tools for debugging."]
+      "can't show you where you're rendering too much. The benefit of React's global optimization is that we never "
+      "make those slow DOM updates, but the cost is that we can't use all of the browser's built-in tools for debugging."]
      [:p "My first approach to the problem was to hack the paint rectangles back into the page. I had each "
       "component generate a random border color each time it rendered, forcing React to change the DOM. By using a "
       [:a {:href "https://github.com/circleci/frontend/blob/7cf4a54480bc5aa772f465afced98d8f3d84dc8a/src-cljs/frontend/utils.clj#L51"}
@@ -47,9 +47,9 @@
     [:article
      [:p "This is a nice step forward. Like paint rectangles, it gives us a visual indication of possible "
       "performance bottlenecks. But we can do so much better. Paint rectangles can show us the regions that "
-      "are being re-rendered, but that’s not how we think of components when we write and use them. Like any "
-      "function, we want to refer to them by their name. The paint rectangles also don’t tell us how long it "
-      "takes to render each region, so we don’t know which component to prioritize."]]
+      "are being re-rendered, but that's not how we think of components when we write and use them. Like any "
+      "function, we want to refer to them by their name. The paint rectangles also don't tell us how long it "
+      "takes to render each region, so we don't know which component to prioritize."]]

     [:article
      [:h3 "Instrumenting components"]
@@ -65,4 +65,4 @@
      [:article
       [:p "The console-style instrumentation panel drops down when we hit Ctrl+j and we can see it update in real-time "
        "as components are rendered."]
-      [:p "Now it’s easy to identify the bottlenecks and measure the effects of our optimizations on render times."]])})
+      [:p "Now it's easy to identify the bottlenecks and measure the effects of our optimizations on render times."]])})


Rename variables

Rename variables

--- src/test/cljc/mikron/runtime/test_generators.cljc
+++ src/test/cljc/mikron/runtime/test_generators.cljc
@@ -190,9 +190,9 @@
 (defmethod value-generator :enum [[_ _ enum-values]]
   (tc.gen/elements enum-values))

-(defmethod value-generator :optional [[_ _ schema]]
+(defmethod value-generator :optional [[_ _ schema']]
   (tc.gen/one-of [(value-generator [:nil {}])
-                  (value-generator schema)]))
+                  (value-generator schema')]))

 (defmethod value-generator :wrapped [_]
   (tc.gen/return "Not value-generator implemented for :wrapped"))
@@ -200,14 +200,14 @@
 (defmethod value-generator :multi [_]
   (tc.gen/return "Not value-generator implemented for :multi"))

-(defmethod value-generator :list [[_ _ schema]]
-  (tc.gen/list (value-generator schema)))
-
-(defmethod value-generator :vector [[_ _ schema]]
-  (tc.gen/vector (value-generator schema)))
-
-(defmethod value-generator :set [[_ _ schema]]
-  (tc.gen/set (value-generator schema)))
+(defmethod value-generator :list [[_ _ schema']]
+  (tc.gen/list (value-generator schema')))
+
+(defmethod value-generator :vector [[_ _ schema']]
+  (tc.gen/vector (value-generator schema')))
+
+(defmethod value-generator :set [[_ _ schema']]
+  (tc.gen/set (value-generator schema')))

 (defmethod value-generator :map [[_ _ key-schema value-schema]]
   (tc.gen/map (value-generator key-schema)


Added config.edn

Added config.edn


Updated enter gene type rule to work with ccp ext ontology

--- resources/rules/post_identifier_merge/entity/type/entrez_gene_type.clj
+++ resources/rules/post_identifier_merge/entity/type/entrez_gene_type.clj
@@ -17,7 +17,7 @@
          (?/type_field_value rdf/type ccp/IAO_EXT_0000884) ; ccp:NCBI_gene_info_record__type_of_gene_field_value
          (?/type_field_value rdf/type ?/type_ice_id)
          (?/type_ice_id obo/IAO_0000219 ?/type) ; IAO:denotes
-
+
          (!= ?/type "pseudo")
          (!= ?/type "unknown")
          (!= ?/type "other"))


CMR-2900 Fixes dependency

CMR-2900 Fixes dependency

--- access-control-app/project.clj
+++ access-control-app/project.clj
@@ -5,7 +5,7 @@
     [nasa-cmr/cmr-elastic-utils-lib "0.1.0-SNAPSHOT"]
     [nasa-cmr/cmr-message-queue-lib "0.1.0-SNAPSHOT"]
     [nasa-cmr/cmr-common-app-lib "0.1.0-SNAPSHOT"]
-    [nasa-cmr/umm-spec-lib "0.1.0-SNAPSHOT"]])
+    [nasa-cmr/cmr-umm-spec-lib "0.1.0-SNAPSHOT"]])

 (def dev-cmr-deps
   '[[nasa-cmr/cmr-metadata-db-app "0.1.0-SNAPSHOT"]


STORM-166 removing no longer required test.

--- storm-core/test/clj/backtype/storm/utils_test.clj
+++ storm-core/test/clj/backtype/storm/utils_test.clj
@@ -39,17 +39,6 @@
     (is (= (.getBaseSleepTimeMs retry) expected_interval))
     (is (= (.getN retry) expected_retries))
     (is (= (.getSleepTimeMs retry 10 0) expected_ceiling))
-  )
-)
-
-(deftest test-getConfiguredClient-throws-RunTimeException-on-bad-config
-  (let [storm-conf (merge (read-storm-config)
-                     {STORM-THRIFT-TRANSPORT-PLUGIN
-                       "backtype.storm.security.auth.SimpleTransportPlugin"
-                      Config/NIMBUS_THRIFT_PORT ""
-                     })]
-    (is (thrown-cause? RuntimeException
-      (NimbusClient/getConfiguredClient storm-conf)))
   )
 )


Gist authorization

Gist authorization

--- src/langolier/github.clj
+++ src/langolier/github.clj
@@ -2,12 +2,24 @@
   (:require [clj-http.client :as http])
   (:require [clojure.data.json :as json]))

+;; TODO Could be a part of buldozer
+
+;; set this variables or provide bindings
+(def ^:dynamic *username* nil)
+(def ^:dynamic *password* nil)
+
+(defn- auth-map []
+  (if (and *username*
+           *password*) {:basic-auth
+                        [*username* *password*]}
+           {}))
+
 (defn get-raw-links [page]
   "return list of pairs [language raw_url] from gist page"
-  (->> (str "https://api.github.com/gists?page=" page)
-       (http/get)
+  (->> (str "https://api.github.com/gists/public?page=" page)
+       (#(http/get % (auth-map)))
        (:body)
-       (json/read-str)
+       (json/read-str) ;; TODO key-fn
        (map #(get % "files"))
        (mapcat (fn [m]
                  (map (fn [[k v]]
@@ -17,5 +29,6 @@

 (defn process []
   (reduce #(apply conj %1 (get-raw-links %2))
-          []
-          (range 1 100)))
+          [] (range 1 100)))
+
+


handle the plugin cycle case gracefully

handle the plugin cycle case gracefully

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

--- src/lt/objs/plugins.cljs
+++ src/lt/objs/plugins.cljs
@@ -7,6 +7,7 @@
             [lt.objs.files :as files]
             [lt.objs.settings :as settings]
             [lt.objs.editor.pool :as pool]
+            [lt.objs.popup :as popup]
             [lt.objs.deploy :as deploy]
             [lt.objs.notifos :as notifos]
             [lt.objs.tabs :as tabs]
@@ -80,6 +81,25 @@
       (for [[nme v] plugins]
         [nme (set (map name (keys (:dependencies v))))])))

+(defn find-cycles [cur {:keys [seen root stack graph] :as state}]
+  (first (filter identity (for [c (remove seen cur)]
+                            (if (= c root)
+                              (conj stack c)
+                              (find-cycles (get graph c) (-> state
+                                                             (update-in [:stack] conj c)
+                                                             (update-in [:seen] conj c))))))))
+
+(defn ->cycles [graph]
+  (filterv identity
+           (for [[root deps] graph
+                 :let [stack (find-cycles deps {:seen #{} :stack [root] :graph graph :root root})]]
+             stack)))
+
+(defn cycle-desc [cycles]
+  (for [cycle cycles]
+    [:div
+     (reduce str (interpose " => " cycle))]))
+
 (defn local-module [plugin-name module-name]
   (files/join plugins-dir plugin-name "node_modules" module-name))

@@ -99,8 +119,26 @@
           :triggers #{:behaviors.diffs.plugin+}
           :reaction (fn [this diffs]
                       (let [plugins (::plugins @this)
-                            dep-ordered (reverse (kahn/kahn-sort (plugin-dependency-graph plugins)))]
-                        (concat diffs (mapv plugin-behaviors (map plugins dep-ordered))))))
+                            dep-graph (plugin-dependency-graph plugins)
+                            dep-ordered (-> dep-graph
+                                            (kahn/kahn-sort)
+                                            (reverse)
+                                            (seq))
+                            mapped (if dep-ordered
+                                     (map plugins dep-ordered)
+                                     (vals plugins))]
+                        (when (and (not dep-ordered)
+                                   (not (::cycle-warned @this)))
+                          (object/merge! this {::cycle-warned true})
+                          (popup/popup! {:header "There's a cycle in your plugin dependencies."
+                                         :body [:div "As a result, we can't come up with an optimal way to load them.
+                                                This means there may be unexpected consequences to being loaded out of order.
+                                                Here are the plugins causing the cycle: "
+                                                (-> dep-graph
+                                                    (->cycles)
+                                                    (cycle-desc))]
+                                         :buttons [{:label "ok"}]}))
+                        (concat diffs (mapv plugin-behaviors mapped)))))

 (behavior ::plugin-keymap-diffs
           :triggers #{:keymap.diffs.plugin+}


Fixes #1727 Invalid behaviors file

Fixes #1727 Invalid behaviors file

--- src/lt/objs/plugins.cljs
+++ src/lt/objs/plugins.cljs
@@ -138,24 +138,25 @@
       (deploy/is-newer? (:version plugin) cached))))

 (defn plugin-behaviors [plug]
-  (try
-    (let [{:keys [behaviors dir]} plug
-          file (files/join dir behaviors)
-          file (files/real-path file)
-          behs (settings/parse-file file)
-          force? (get (::force-reload @manager) file)]
-      (when force?
-        (swap! manager update-in [::force-reload] disj file))
-      (when behs
-        (walk/prewalk (fn [x]
-                        (when (coll? x)
-                          (alter-meta! x assoc ::dir dir ::force-reload force?))
-                        x)
-                      behs)
-        behs))
-    (catch :default e
-      (console/error (str "Could not load behaviors for plugin: " (:name plug)))
-      {})))
+  (when (seq plug)
+    (try
+     (let [{:keys [behaviors dir]} plug
+           file (files/join dir behaviors)
+           file (files/real-path file)
+           behs (settings/parse-file file)
+           force? (get (::force-reload @manager) file)]
+       (when force?
+         (swap! manager update-in [::force-reload] disj file))
+       (when behs
+         (walk/prewalk (fn [x]
+                         (when (coll? x)
+                           (alter-meta! x assoc ::dir dir ::force-reload force?))
+                         x)
+                       behs)
+         behs))
+     (catch :default e
+       (console/error (str "Could not load behaviors for plugin: " (:name plug)))
+       {}))))

 (defn plugin-dependency-graph [plugins]
   (into {}


add test of sorting by timestamp on raw data queries

--- test/metabase/timeseries_query_processor_test.clj
+++ test/metabase/timeseries_query_processor_test.clj
@@ -69,6 +69,44 @@
   (data (data/run-query checkins
           (ql/limit 2))))

+;;; "bare rows" query, limit, order-by timestamp desc
+(expect-with-timeseries-dbs
+  {:columns ["id"
+             "timestamp"
+             "count"
+             "user_last_login"
+             "user_name"
+             "venue_category_name"
+             "venue_latitude"
+             "venue_longitude"
+             "venue_name"
+             "venue_price"]
+   :rows [["693", "2015-12-29T08:00:00.000Z", 1, "2014-07-03T19:30:00.000Z", "Frans Hevel", "Mexican", "34.0489", "-118.238", "Señor Fish",       "2"]
+          ["570", "2015-12-26T08:00:00.000Z", 1, "2014-07-03T01:30:00.000Z", "Kfir Caj",    "Chinese", "37.7949", "-122.406", "Empress of China", "3"]]}
+  (data (data/run-query checkins
+          (ql/order-by (ql/desc $timestamp))
+          (ql/limit 2))))
+
+;;; "bare rows" query, limit, order-by timestamp asc
+(expect-with-timeseries-dbs
+  {:columns ["id"
+             "timestamp"
+             "count"
+             "user_last_login"
+             "user_name"
+             "venue_category_name"
+             "venue_latitude"
+             "venue_longitude"
+             "venue_name"
+             "venue_price"]
+   :rows [["931", "2013-01-03T08:00:00.000Z", 1, "2014-01-01T08:30:00.000Z", "Simcha Yan", "Thai", "34.094",  "-118.344", "Kinaree Thai Bistro",       "1"]
+          ["285", "2013-01-10T08:00:00.000Z", 1, "2014-07-03T01:30:00.000Z", "Kfir Caj",   "Thai", "34.1021", "-118.306", "Ruen Pair Thai Restaurant", "2"]]}
+  (data (data/run-query checkins
+          (ql/order-by (ql/asc $timestamp))
+          (ql/limit 2))))
+
+
+
 ;;; fields clause
 (expect-with-timeseries-dbs
   {:columns ["venue_name" "venue_category_name" "timestamp"],
@@ -77,6 +115,28 @@
   (data (data/run-query checkins
           (ql/fields $venue_name $venue_category_name)
           (ql/limit 2))))
+
+;;; fields clause, order by timestamp asc
+(expect-with-timeseries-dbs
+  {:columns ["venue_name" "venue_category_name" "timestamp"],
+   :rows    [["Kinaree Thai Bistro"       "Thai" "2013-01-03T08:00:00.000Z"]
+             ["Ruen Pair Thai Restaurant" "Thai" "2013-01-10T08:00:00.000Z"]]}
+  (data (data/run-query checkins
+          (ql/fields $venue_name $venue_category_name)
+          (ql/order-by (ql/asc $timestamp))
+          (ql/limit 2))))
+
+;;; fields clause, order by timestamp desc
+(expect-with-timeseries-dbs
+  {:columns ["venue_name" "venue_category_name" "timestamp"],
+   :rows    [["Señor Fish"       "Mexican" "2015-12-29T08:00:00.000Z"]
+             ["Empress of China" "Chinese" "2015-12-26T08:00:00.000Z"]]}
+  (data (data/run-query checkins
+          (ql/fields $venue_name $venue_category_name)
+          (ql/order-by (ql/desc $timestamp))
+          (ql/limit 2))))
+
+

 ;;; count
 (expect-with-timeseries-dbs


Expand range of axis autoscaling.

Expand range of axis autoscaling.

--- metlog-vault/src-client/metlog_client/tsplot.cljs
+++ metlog-vault/src-client/metlog_client/tsplot.cljs
@@ -26,7 +26,7 @@
   (mapcat (fn [ scale ]
             (map #(* % (.pow js/Math 10 scale))
                  [ 1 2 5 ]))
-          (range -3 3)))
+          (range -12 13)))

 (defn seconds [ seconds ] (* 1000 seconds))
 (defn minutes [ minutes ] (seconds (* 60 minutes)))
@@ -56,7 +56,10 @@
    (days 3)
    (days 7)
    (days 14)
-   (days 30)])
+   (days 30)
+   (days 90)
+   (days 180)
+   (days 360)])

 (def stroke-styles
   {:grid


Fix frequency string.

Fix frequency string.

--- src/oc/email/content.clj
+++ src/oc/email/content.clj
@@ -522,8 +522,15 @@
 (defn reminder-notification-headline [reminder-data]
   (str (first-name (:author reminder-data)) " created a new reminder for you"))

+(defn- frequency-string [f]
+  (case (s/lower-case f)
+    "weekly" "Weekly"
+    "biweekly" "Every other week"
+    "monthly" "Monthly"
+    "Quarterly"))
+
 (defn reminder-notification-subline [reminder-data]
-  (str (:frequency reminder-data) " starting " (reminder-due-date (:next-send reminder-data))))
+  (str (frequency-string (:frequency reminder-data)) " starting " (reminder-due-date (:next-send reminder-data))))

 (def reminder-notification-settings-footer
   [:table {:class "row reminders-footer"


Remove border from company logo in invite email.

--- src/oc/email/content.clj
+++ src/oc/email/content.clj
@@ -32,7 +32,7 @@
             [:th
               [:center
                 [:img {:class "float-center logo"
-                       :style "background-color: #ffffff;border: solid 1px rgba(78, 90, 107, 0.2);max-height: 50px;max-width: 50px;"
+                       :style "background-color: #ffffff;max-height: 100px;max-width: 100px;"
                        :src logo-url
                        :alt (str org-name " logo")}]]]]]]
       [:th {:class "small-1 large-2 last columns"}]]])


update boot docstring

update boot docstring

--- src/overtone/sc/core.clj
+++ src/overtone/sc/core.clj
@@ -169,7 +169,7 @@
   port are passed or an internal server in the case of no args."
   ([] (connect-internal))
   ([port] (connect "127.0.0.1" port))
-  ([host port]
+  ([host port]
    (dosync (ref-set status* :connecting))
    (.run (Thread. #(connect-external host port)))))

@@ -324,7 +324,10 @@
          :booting))))

 (defn boot
-  "Boot either the internal or external audio server."
+  "Boot either the internal or external audio server.
+   (boot) ; uses the default settings defined in your config
+   (boot :internal) ; boots the internal server
+   (boot :external 57110) ; boots an external server listening on port 57110"
   ([]
      (boot (get @config* :server :internal) SERVER-HOST SERVER-PORT))
   ([which & [port]]
@@ -401,4 +404,3 @@
       (log/level :error)
       (osc-debug false)
       (snd "/dumpOSC" 0))))
-


load roboto font

load roboto font

--- src/pc/views/content.clj
+++ src/pc/views/content.clj
@@ -23,6 +23,7 @@
    [:div.debugger-container]
    [:div#app]
    [:link.css-styles {:rel "stylesheet", :href (pc.stefon/asset-path "css/app.css")}]
+   [:link {:rel "stylesheet" :href "https://fonts.googleapis.com/css?family=Roboto:500,900,100,300,700,400" :type "text/css"}]
    (if (= (System/getenv "PRODUCTION") "true")
      [:script {:type "text/javascript" :src "/js/bin/main.js"}]
      (if false


support paired end reads

support paired end reads

--- src/aerobio/htseq/rnaseq.clj
+++ src/aerobio/htseq/rnaseq.clj
@@ -147,17 +147,11 @@
     (mapv (fn[fut] (deref fut)) futs-vec)))

-(defn get-fqs [eid repname repk]
-  (->> (cmn/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 {})))
-
 ;;; Get primary phase 1 arguments. These are the bowtie index, the
 ;;; fastq set, output bam and bai file names
 (defmethod cmn/get-phase-1-args :rnaseq
-  [_ eid repname & {:keys [repk star]}]
-  (let [{:keys [R1 R2]} (get-fqs eid repname repk)
+  [_ eid repname & {:keys [repk star paired]}]
+  (let [{:keys [R1 R2]} (cmn/get-paired-fqs eid repname repk)
         refnm (cmn/replicate-name->strain-name eid repname)
         btindex (fs/join (cmn/get-exp-info eid :index) refnm)
         starindex (when star
@@ -171,10 +165,12 @@
     (apply cmn/ensure-dirs (map fs/dirname [otbam otbai]))
     (when star (cmn/ensure-dirs (fs/dirname starprefix)))
     (if star
-      (if R2
+      (if (and paired R2)
         [starindex R1 R2 otbam otbai starprefix]
         [starindex R1 otbam otbai starprefix])
-      [btindex R1 otbam otbai])))
+      (if (and paired R2)
+        [btindex R1 R2 otbam otbai]
+        [btindex R1 otbam otbai]))))

 (defn get-phase-2-dirs [eid repk]


some light editing of the router loop explanation

- preserving all the flavor

--- src/re_frame/router.cljs
+++ src/re_frame/router.cljs
@@ -8,22 +8,22 @@
 ;; -- Router Loop ------------------------------------------------------------
 ;;
 ;; Conceptually, the task is to process events in a perpetual loop, one after
-;; the other, FIFO, calling the right event-handler for each. Being idle when
-;; ther are no events, and firing up when one arrives, etc. The processing
-;; of events happens "asynchronously" sometime after an event is dispatched.
+;; the other, FIFO, calling the right event-handler for each, being idle when
+;; there are no events, and firing up when one arrives, etc. The processing
+;; of an event happens "asynchronously" sometime after the event is
+;; dispatched.
 ;;
 ;; In practice, browsers only have a single thread of control and we must be
-;; careful to not hog the CPU.
-;; When processing events one after another, we must hand back control to
-;; the browser regularly, so it can redraw, process websockets, etc. But not
-;; too regularly!  If we are in a de-focused browser tab, then our app
-;; will be CPU throttled. Each time we get back control, we have to process all
-;; queued events, or else something like a bursty websocket (producing events)
-;; might overwhelm the queue. So there's a balance.
-;;
-;; The original implementation of this router loop used core.async. It
-;; was fairly simple, and it mostly worked, but it did not give enough
-;; control. So now we hand-roll our own, mini finite-state-machine and all.
+;; careful to not hog the CPU. When processing events one after another, we
+;; must hand back control to the browser regularly, so it can redraw, process
+;; websockets, etc. But not too regularly! If we are in a de-focused browser
+;; tab, our app will be CPU throttled. Each time we get back control, we have
+;; to process all queued events, or else something like a bursty websocket
+;; (producing events) might overwhelm the queue. So there's a balance.
+;;
+;; The original implementation of this router loop used core.async. It was
+;; fairly simple, and it mostly worked, but it did not give enough
+;; control. So now we hand-roll our own, finite-state-machine and all.
 ;;
 ;; The strategy is this:
 ;;   - maintain a queue of `dispatched` events.
@@ -31,20 +31,20 @@
 ;;     goog.async.nextTick, which means it will happen "very soon".
 ;;   - when processing events, do ALL the ones currently queued. Don't stop.
 ;;     Don't yield to the browser. Hog that CPU.
-;;   - but if any new events arrive during this cycle of processing,
-;;     don't do them immediately. Leave then queued. Yield first to the
-;;     browser, and do these new events in the next processing cycle.
-;;     That way we drain the queue up to a point, but we
-;;     never hog the CPU forever.  In particular, we handle the case
-;;     where handling one event will begat another event. The freshly begated
-;;     event will be handled next cycle, with yielding in between.
+;;   - but if any new events arrive during this cycle of processing, don't do
+;;     them immediately. Leave them queued. Yield first to the browser, and
+;;     do these new events in the next processing cycle. That way we drain
+;;     the queue up to a point, but we never hog the CPU forever. In
+;;     particular, we handle the case where handling one event will beget
+;;     another event. The freshly begat event will be handled next cycle,
+;;     with yielding in between.
 ;;   - In some cases, an event should not be run until after the GUI has been
-;;     updated. Ie. after the next reagent animation frame. In such a case,
+;;     updated, i.e., after the next reagent animation frame. In such a case,
 ;;     the event should be dispatched with :flush-dom metadata like this:
-;;       (dispatch ^:flush-dom  [:event-id other params])
-;;     Such an event will block all further processing, because events are
-;;     processed sequentially. We must do one event before we can handle the
-;;     ones behind it.
+;;       (dispatch ^:flush-dom [:event-id other params])
+;;     Such an event will temporarily block all further processing because
+;;     events are processed sequentially: we handle each event before we
+;;     handle the ones behind it.
 ;;
 ;; Implementation
 ;;   - queue processing can be in a number of states: scheduled, running, paused


Add assertion check for cache factory function

--- src-clj/streamsum/caches.clj
+++ src-clj/streamsum/caches.clj
@@ -107,9 +107,9 @@
         create-cache (fn ;; funciton mapping cache config entry to a new [cache-key TupleCache] pair
                        [[cache-key [cache-type _]]]
                        (let [backing-map (proto/getMap cache-server (name cache-key))
-                             ;; Look up factory function for cache-key and call it
-                             cache-instance ((get factory-fns cache-type) backing-map)]
-                         [cache-key cache-instance]))]
+                             cache-factory (get factory-fns cache-type)]
+                         (assert (not (nil? cache-factory)) (str  "No factory function found for cache type " cache-type))
+                         [cache-key (cache-factory backing-map)]))]
     (into {} (map create-cache cache-config))))


fix caching tests using event timing

fix caching tests using event timing


Reduce scope requirement for build related UI actions

--- src-cljs/frontend/components/build_head.cljs
+++ src-cljs/frontend/components/build_head.cljs
@@ -723,7 +723,7 @@
                                                        :stop (or (:start_time build) (:stop_time build))})
                    ")"])]])

-            (when (and (has-scope :write-settings data)
+            (when (and (has-scope :read-settings data)
                        (show-ssh-button? project))
               [tab-tag {:class (when (= :ssh-info selected-tab) "active")}
                [tab-link {:href "#ssh-info"}
@@ -1012,11 +1012,11 @@
             plan (get-in data state/project-plan-path)
             user (get-in data state/user-path)
             logged-in? (not (empty? user))
-            has-write-settings? (:write-settings
+            has-read-settings? (:read-settings
                                   (get-in data state/project-scopes-path))]
         (html
           [:div.build-actions-v2
-           (when (and (build-model/can-cancel? build) has-write-settings?)
+           (when (and (build-model/can-cancel? build) has-read-settings?)
              (forms/managed-button
                [:a.cancel-build
                 {:data-loading-text "canceling"
@@ -1025,7 +1025,7 @@
                                                                   :vcs-url vcs-url
                                                                   :build-num build-num}])}
                 "cancel build"]))
-           (when has-write-settings?
+           (when has-read-settings?
              (om/build rebuild-actions {:build build :project project}))
            [:div.build-settings
             [:a.build-action


tweak schemas

tweak schemas

--- src/chessground/schemas.cljs
+++ src/chessground/schemas.cljs
@@ -27,10 +27,13 @@

 (defschema AnyMap {Any Any})

+(def valid-files (set (seq "abcdefgh")))
+(def valid-ranks (set (seq "12345678")))
+
 (defschema Square
   (s/both
-    (s/pred #(contains? (set (seq "abcdefgh")) (first %)) 'proper-file)
-    (s/pred #(contains? (set (seq "12345678")) (second %)) 'proper-rank)))
+    (s/pred #(contains? valid-files (first %)) 'proper-file)
+    (s/pred #(contains? valid-ranks (second %)) 'proper-rank)))

 (defschema ChessPiece
   {:role  (s/enum "pawn" "rook" "knight" "bishop" "queen" "king")


replace sort logic in prices query

replace sort logic in prices query

--- src/clj_money/models/storage/sql_storage.clj
+++ src/clj_money/models/storage/sql_storage.clj
@@ -522,6 +522,7 @@
                                   (h/from [table :p])
                                   (h/join [:commodities :c] [:= :c.id :p.commodity_id])
                                   (append-where criteria {:prefix "p"})
+                                  (append-sort options)
                                   (append-limit options)
                                   (append-paging options))
                           updated-records (concat records (query db-spec sql))]


apply date range back to criteria

apply date range back to criteria

--- src/clj_money/models/storage/sql_storage.clj
+++ src/clj_money/models/storage/sql_storage.clj
@@ -825,7 +825,11 @@
   (select-transaction-items
     [this criteria options]
     (validate-criteria criteria ::transaction-item-criteria)
-    (let [d-range (date-range this (:transaction-date criteria))]
+    (let [d-range (date-range this (:transaction-date criteria))
+          criteria (update-in criteria [:transaction-date] (fn [_]
+                                                            (if (apply = d-range)
+                                                              (first d-range)
+                                                              (concat [:between] d-range))))]
       (let [result (with-partitioning db-spec [:transaction_items :transactions] d-range options [tables]
                     (-> (h/select :i.* :t.description, [:r.status "reconciliation_status"])
                         (h/from [(first tables) :i])


fix small bug in viewer

fix small bug in viewer

--- src/cljs/offcourse/views/containers/app.cljs
+++ src/cljs/offcourse/views/containers/app.cljs
@@ -10,7 +10,9 @@
   {:dangerouslySetInnerHTML {:__html (md->html content)}})

 (defn Viewer [checkpoint]
-  (d/section (markdown (:content (:resource checkpoint)))))
+  (if-let [content (:content (:resource checkpoint))]
+    (d/section (markdown content))
+    (d/section {} "Waiting")))

 (defn App [{:keys [viewmodel user-id mode]} handlers]
   (d/section {:className (css/classes "app" mode "waypoints")}


Fixing system int tests for a pull request not yet merged.

--- src/cmr/system_int_test/data2/collection.clj
+++ src/cmr/system_int_test/data2/collection.clj
@@ -116,6 +116,9 @@
    (related-url type (d/unique-str "http://example.com/file")))
   ([type url]
    (c/->RelatedURL type nil url (d/unique-str "description"))))
+   (related-url type nil url))
+  ([type mime-type url]
+   (c/->RelatedURL type nil url (d/unique-str "description") mime-type)))

 (defn spatial
   ([gsr]