Add documentation for :meta-error-categories in args.clj

--- src/clojush/args.clj
+++ src/clojush/args.clj
@@ -327,8 +327,16 @@
           ;; normalization.

           :meta-error-categories []
-          ;; A vector containing meta-error categories that can be used for parent selection, but
-          ;; do not affect total error. See clojush.evaluate for options.
+          ;; A vector containing meta-error categories that can be used for parent selection,
+          ;; but that do not affect total error or the determination of whether an individual
+          ;; is considered to be a solution. Each meta-error-category should either be a function
+          ;; (which must be namespace-qualified if provided in a command-line argument) or a
+          ;; keyword corresponding to a pre-defined meta-error function. In either case the
+          ;; function should take an individual, an evaluated population, and an argmap, and
+          ;; it should return a numeric meta error value or collection of values, for which
+          ;; lower is interpreted as better. For keyword :foo, the corresponding meta-error
+          ;; function will be clojush.meta-errors/foo-meta-error. See clojush.meta-errors for
+          ;; the current options for pre-defined meta-error functions.

           :improvement-discount 0.5
           ;; The factor by successively older improvements are discounted when calculating


fix some writing on made with post

fix some writing on made with post

--- src/pc/views/blog/ideas_are_made_with_precursor.clj
+++ src/pc/views/blog/ideas_are_made_with_precursor.clj
@@ -67,8 +67,8 @@
     [:figure (common/card "dhotlo2" "17592197311947?cx=629&cy=376&z=1&replay=true")]

     [:article
-     [:h3 "Trim the trash."]
-     [:p  "This is something I'm seeing more people practice with Precursor—prototypes don't need many detail. "
+     [:h3 "Minimum viable prototype."]
+     [:p  "This is something I'm seeing more people practice on Precursor—prototypes don't need every detail. "
           "Watch Faith contemplate the value of that avatar, explore the idea, and ultimately remove it. "]]
     [:figure (common/card "fatihturan" "17592197311774?cx=707&cy=502&z=1&replay=true")]

@@ -79,29 +79,36 @@
     [:figure (common/card "jyo208" "17592197310592?cx=584&cy=581&z=0.55&replay=true")]

     [:article
-     [:h3 "Cost of living."]
+     [:h3 "Set it up."]
      [:p  "Before Ken tried drawing any components, he got his content and spacing figured out. "
           "Isolating important areas of your ideas is crucial for expressing them quickly. "]]
     [:figure (common/card "kenseals" "17592197311539?cx=517&cy=392&z=1&replay=true&tx-count=59")]

     [:article
-     [:h3 "Solid spatial awareness."]
-     [:p  "Well that was fast. "
-          "Peter made short work of this map by staying focused on his content—a great strategy for diagramming. "
+     [:h3 "That was fast."]
+     [:p  "Peter made short work of this map by staying focused on his content—a great strategy for diagramming. "
           "He figured out alignment and connections afterwards. "]]
     [:figure (card-github "peteratticusberg" "17592197310304?cx=687&cy=636&z=0.8&replay=true" "Peter Berg" "https://avatars0.githubusercontent.com/u/3895824" "11 repos")]

     [:article
-     [:h3 "Teammate helps out."]
+     [:h3 "Avoid the tedious."]
      [:p  "Mathieu used duplication to skip over the tedious areas of his idea. "
-          "He prioritized the unique aspects of his prototype by automating the others. "]]
+          "He prioritized the unique aspects of his prototype and automated the others. "]]
     [:figure (common/card "tooks_" "17592197347828?cx=982&cy=974&z=0.45&replay")]

     [:article
      [:h3 "I'd wear that."]
-     [:p  "To thank these users for letting me use their work, I'm sending them all custom t-shirts displaying their prototypes. "
+     [:p  "To thank these users for letting me show their work, I'm sending them all custom t-shirts displaying their prototypes. "
           "I want to do this again soon, so if you make something cool, let me know. "
-          "Email danny@precursorapp.com with a link and if I feature it, you'll get a one-of-a-kind t-shirt! "]]
+          "Email "
+          [:a {:href (format "mailto:%s" (email/email-address "hi"))} "hi@precursorapp.com"]
+          " with a link and if it gets featured, you'll get a one-of-a-kind t-shirt! "]]
     [:figure [:img {:src (cdn-path "/blog/ideas-are-made-with-precursor/eddie-shirt.png")}]]

+    [:article.blogpost-author
+     [:p
+      "Written by "
+      [:a {:href "https://twitter.com/dannykingme"} "Danny King"]
+      "."]]
+
     )})


Fixing a broken test.

Fixing a broken test.

--- storm-core/src/clj/backtype/storm/daemon/nimbus.clj
+++ storm-core/src/clj/backtype/storm/daemon/nimbus.clj
@@ -1327,7 +1327,9 @@
                                                             (extract-status-str base))]
                                                (when-let [owner (:owner base)] (.set_owner topo-summ owner))
                                                (when-let [sched-status (.get @(:id->sched-status nimbus) id)] (.set_sched_status topo-summ sched-status))
-                                               (.set_replication_count topo-summ (.getReplicationCount (:code-distributor nimbus) id))
+                                               (.set_replication_count topo-summ (if (:code-distributor nimbus)
+                                                                                (.getReplicationCount (:code-distributor nimbus) id)
+                                                                                1))
                                                topo-summ
                                           ))]
           (ClusterSummary. supervisor-summaries


What even happened

What even happened

--- src/degasolv/cli.clj
+++ src/degasolv/cli.clj
@@ -670,8 +670,11 @@
             :default-desc "semver"
             :validate [#(some #{%} (keys version-comparators))
                        "Version comparison must be 'debian', 'maven', 'naive', 'python', 'rubygem', or 'semver'."]]
+           ]
+     }
     "resolve-locations"
-    {:description "Print the locations of the packages which will resolve all given dependencies."
+    {
+     :description "Print the locations of the packages which will resolve all given dependencies."
      :function resolve-locations!
      :required-arguments {:repositories ["-R" "--repository"]
                           :requirements ["-r" "--requirement"]}
@@ -776,9 +779,11 @@
                           (and (.exists ^java.io.File f)
                                (.canExecute ^java.io.File f)))
                        "Must be an executable file which exists on the file system."]]
-           ]}
+           ]
+    }
     "query-repo"
-    {:description "Query repository for a particular package"
+    {
+     :description "Query repository for a particular package"
      :function query-repo!
      :required-arguments {:repositories ["-R" "--repository"]
                           :query ["-q" "--query"]}
@@ -829,8 +834,6 @@
     }
    }
   )
-
-

 (defn errors [errors usg]
   (string/join \newline


Formatting, comment fix

Formatting, comment fix

--- src/ankha/core.cljs
+++ src/ankha/core.cljs
@@ -144,20 +144,20 @@

 (defn- editor [owner {:keys [value save-editor cancel-editor error-message]}]
   (dom/div #js {:style #js {:display "inline"}}
-                   (dom/textarea #js {:className "editor"
-                                      :style #js {:display "inline-block"}
-                                      :value value
-                                      :onKeyPress (fn [e]
-                                                    (when (= 13 (.-keyCode e))
-                                                      (.preventDefault e)))
-                                      :onKeyUp (fn [e]
-                                                    (case (.-keyCode e)
-                                                      13 (save-editor)
-                                                      27 (cancel-editor)
-                                                      nil))
-                                      :onChange (fn [e] (om/set-state! owner :edited-data (.. e -target -value)))})
-                   (when error-message (dom/span #js {:className "error" :style #js {:vertical-align "top"}}
-                                                         error-message))))
+           (dom/textarea #js {:className "editor"
+                              :style #js {:display "inline-block"}
+                              :value value
+                              :onKeyPress (fn [e]
+                                            (when (= 13 (.-keyCode e))
+                                              (.preventDefault e)))
+                              :onKeyUp (fn [e]
+                                         (case (.-keyCode e)
+                                           13 (save-editor)
+                                           27 (cancel-editor)
+                                           nil))
+                              :onChange (fn [e] (om/set-state! owner :edited-data (.. e -target -value)))})
+           (when error-message (dom/span #js {:className "error" :style #js {:vertical-align "top"}}
+                                         error-message))))

 ;; ---------------------------------------------------------------------
 ;; Main component
@@ -175,6 +175,7 @@
                         (let [new-data (reader/read-string (om/get-state owner :edited-data))]
                           ;; if the new data is the same as the old just stop editing
                           ;; if not, set data to new data, which will cause this component to re-mount
+                          ;; this is a little funky but seems necessary to avoid trying to update an unmounted component
                           (if (= new-data @data)
                             (om/set-state! owner :editing? false)
                             (om/update! data new-data)))


Use SHA1PRNG for random number, explicitly.

--- src/asid/wallet.clj
+++ src/asid/wallet.clj
@@ -13,7 +13,7 @@
   (Security/addProvider (BouncyCastleProvider.))
   (let [ecGenSpec (ECGenParameterSpec. "prime192v1")
         keyGen (KeyPairGenerator/getInstance "ECDSA" "BC")]
-    (.initialize keyGen ecGenSpec (SecureRandom.))
+    (.initialize keyGen ecGenSpec (SecureRandom/getInstance "SHA1PRNG"))
     (let [pair (.generateKeyPair keyGen)]
       {:public (to-hex (-> pair .getPublic .getEncoded))
        :private (to-hex (-> pair .getPrivate .getEncoded))})))


Stringify keys in request variables, graphql-clj is expecting string keys.

--- src/bk1/handler.clj
+++ src/bk1/handler.clj
@@ -7,19 +7,18 @@
             [ring.middleware.cors :refer [wrap-cors]]
             [ring.middleware.defaults :refer :all]
             [cheshire.core :as json]
-            [bk1.graphql :as graphql]))
+            [bk1.graphql :as graphql]
+            [clojure.walk]))

 (defroutes routes
   (GET "/" [] "Hello, World!")
   (GET "/graphql" [schema query variables :as request]
-       (println "GET query: " query)
        (response/response
         (graphql/execute query variables)))
   (POST "/graphql" [schema query variables :as request]
-        (println "POST query: " query)
         (response/response
          (try
-           (graphql/execute query (json/parse-string variables))
+           (graphql/execute query (clojure.walk/stringify-keys variables))
            (catch Throwable e
              (println e)))))
   (route/resources "/" {:root ""})


tighter records produced

tighter records produced

--- src/crawler/dom.clj
+++ src/crawler/dom.clj
@@ -438,11 +438,47 @@
       (same-node-set? (xpath-nodes xpath1 page-src)
                       (xpath-nodes xpath2 page-src))))

+(defn resolve-anchor-nodes
+  ([xpath node]
+     (resolve-anchor-nodes xpath node node))
+  ([xpath node stored]
+   (let [parent-node                (.getParentNode node)
+         anchor-children            ($x:node+ ".//a" parent-node)
+         xpaths-to-anchor-children  (reduce
+                                     (fn [acc x]
+                                       (merge-with + acc {x 1}))
+                                     {}
+                                     (map #(first (xpath-to-node %)) anchor-children))]
+
+     (cond (> (xpaths-to-anchor-children xpath) 1)
+           [(first (xpath-to-node node)) node]
+
+           (= (.getNodeName parent-node) "#document")
+           [xpath stored]
+
+           :else
+           (recur xpath parent-node stored)))))
+
 (defn minimum-maximal-xpath-records
   "Given a set of xpaths, we compute the xpaths that
 are sufficient to generate all the distinct records"
   [xpaths processed-page]
-  )
+
+  (let [xpath-nodes      (map #($x:node+ % processed-page) xpaths)
+        xpaths-nodes-map (into {} (map vector xpaths xpath-nodes))
+        potential-recs   (map (fn [[xpath nodes]]
+                                (map (fn [node]
+                                       (resolve-anchor-nodes xpath node)) nodes))
+                              xpaths-nodes-map)]
+    (into {}
+          (map
+           (fn [[xpath nodes]]
+             [xpath (distinct nodes)])
+           (reduce
+            (fn [acc [xpath node]]
+              (merge-with concat acc {xpath [node]}))
+            {}
+            (partition 2 (flatten potential-recs)))))))

 (defn date-indexed-records-filter
   "records-sets: returned by minimum-maximal-xpath-records"


removed more duplication

removed more duplication

--- src/done/handler.clj
+++ src/done/handler.clj
@@ -27,8 +27,7 @@

   (GET "/me" {cookies :cookies}
        (let [session (cookies "session")]
-         (if (nil? session)
-           {:status 404 :body "Session not found"}
+         (if-session-valid session
            (session/expand-session (session :value))))))

 ; routes to create and delete 'dones'


moved docstrings before arguments

moved docstrings before arguments

--- src/euler/helper.clj
+++ src/euler/helper.clj
@@ -26,14 +26,14 @@
                (set (concat lower upper))))))

 ;; TODO replace with facts seq
-(defn factorial [n]
+(defn factorial
   "*Int -> [Int]*
   Multiplies all natural numbers from 1 to n+1."
-  (reduce * (range 1N (inc n))))
-
-(def factorials
+  [n] (reduce * (range 1N (inc n))))
+
+(def factorials
   "**facts :: [Int]**
-Lazy, infinite sequence of all factorial numbers."
+  Lazy, infinite sequence of all factorial numbers."
   (lazy-cat [1] (map * factorials (iterate inc 2))))

 (defn lattice-paths [n]
@@ -42,26 +42,26 @@
            ;; by (fac(n))^2
            (Math/pow (factorial n) 2))))

-(defn triangle [n]
+(defn triangle
   "**triangle :: Int -> Int**
   Computes the nth triangle number.
   A triangle number is generated by adding the natural numbers up to n.
   Shortcut using Gauss technique."
-  (/ (* n (inc n)) 2))
+  [n] (/ (* n (inc n)) 2))

 (def fibs
   "**fibs :: [Int]**
   Lazy sequence of all Fibonacci numbers. Using BigIntegers."
   (lazy-cat [0N 1N] (map + (rest fibs) fibs)))

-(defn next-collatz [n]
+(defn next-collatz
   "computes the next number of the collatz sequence."
-  (if (even? n) (bit-shift-right n 1) (inc (* 3 n))))
-
-(defn collatz [n]
+  [n] (if (even? n) (bit-shift-right n 1) (inc (* 3 n))))
+
+(defn collatz
   "**collatz :: [Int]**
   Lazy seq of Collatz sequence of n."
-  (cons n
+  [n] (cons n
         (if (= n 1) '()
             (collatz (next-collatz n)))))

@@ -71,9 +71,10 @@
                   (inc (memo-collatz c (next-collatz n))))
            n)))

-(defn parse-grid [grid-str dimension]
+(defn parse-grid
   "**parse-grid :: String -> [[Int]]**
   Converts a string into a dimension x dimension vector of integers."
+  [grid-str dimension]
   (vec (map vec (partition dimension (map #(Integer. %) (.split grid-str "\\s+"))))))

 (defn product
@@ -116,10 +117,10 @@
                        (next-prime (+ x 2) (assoc sieve (* x x) (* x 2))))))))]
     (cons 2 (lazy-seq (next-prime 3 {})))))

-(defn prime? [n]
+(defn prime?
   "**prime? :: Int -> Bool**
-	Checks whether a given number n is a prime number."
-  (and (< 1 n)
+  Checks whether a given number n is a prime number."
+  [n] (and (< 1 n)
        (not-any? #(factor? n %)
                  (take-while #(<= (* % %) n) primes))))

@@ -136,11 +137,11 @@
       ;; no match - next iteration
      :else (get-primes n (rest ps) acc))))

-(defn max-prime [n ps]
+(defn max-prime
   "**max-prime :: Int, [Int] -> Int**
   Given a number n and a list of prime numbers ps, returns the largest prime factor of n."
-  ;; local variable - head of prime list
-  (let [div (first ps)]
+  [n ps]
+  (let [div (first ps)] ;; local variable - head of prime list
     (cond
       ;; termination - found max prime
       (= n div) div
@@ -168,15 +169,16 @@
            (map inc)
            (reduce *)))

-(defn palindrome? [n]
+(defn palindrome?
   "**palindrome? :: Int -> Bool**
-	Checks whether the given number n is a palindrome.
-	Uses reversed string comparison"
-  (= (str n) (clojure.string/reverse (str n))))
-
-(defn least-common-multiple [input]
+  Checks whether the given number n is a palindrome.
+  Uses reversed string comparison"
+  [n] (= (str n) (clojure.string/reverse (str n))))
+
+(defn least-common-multiple
   "**least-common-multiple :: [Int] -> Int**
   Computes the smallest number divisible by all of the given input numbers."
+  [input]
   (->> input
        (map #(frequencies (get-primes %)))
        (apply merge-with max)
@@ -184,30 +186,31 @@
        (reduce *)
        (int)))

-(defn sum-of-factors [n]
+(defn sum-of-factors
   "The sum of all proper divisors, excluding  n."
-  (reduce + 1 (factors n 2))) ; include 1, but ignore n
+  [n] (reduce + 1 (factors n 2))) ; include 1, but ignore n

 (defn amicable? [a]
   (let [b (sum-of-factors a)]
     (if (and (not= a b) (= a (sum-of-factors b)))
       [a b] ())))

-(defn abundant? [n]
+(defn abundant?
   "**abundant? :: Int -> Bool**
   Checks whether the sum of the factors of n (excluding n) is greater than n."
-  (< (* 2 n) (reduce + (factors n))))
+  [n] (< (* 2 n) (reduce + (factors n))))

 (def abundants (into (sorted-set) (filter abundant? (range 12 28124))))

-(defn abundant-sum? [n]
+(defn abundant-sum?
   "**abundant-sum? :: Int -> Boolean**
   Can n be expressed as the sum of two abundant numbers?"
-  (boolean (some #(abundants (- n %)) (take-while #(< % n) abundants))))
-
-(defn truncate [number digits]
+  [n] (boolean (some #(abundants (- n %)) (take-while #(< % n) abundants))))
+
+(defn truncate
   "**truncate :: Int, Int -> Int**
   Truncates the given number up to the first n digits."
+  [number digits]
   (->> digits
        (inc)
        (- (count (str number)))
@@ -219,14 +222,15 @@
   "The Golden Ratio - (1+sqrt5)/2."
   (/ (inc (Math/sqrt 5)) 2))

-(defn digits [n]
+(defn digits
   "**digits :: Int -> [Int]**
   Converts a number n into a list of its digits."
-  (map #(Character/digit % 10) (str n)))
-
-(defn narcissistic? [n exp]
+  [n] (map #(Character/digit % 10) (str n)))
+
+(defn narcissistic?
   "A number written as the sum of its nth powers.
   Exp.: 1634 = 1^4 + 6^4 + 3^4 + 4^4."
+  [n exp]
   (->> (digits n)
        (map #(Math/pow % exp))
        (reduce +)
@@ -239,9 +243,10 @@

 (def tens ["twenty" "thirty" "forty" "fifty" "sixty" "seventy" "eighty" "ninety"])

-(defn to-words [n]
+(defn to-words
   "Converts a number (up to 1000) into its string representation, omitting spaces.
   Example: (to-words 115) => 'onehundredandfifteen'."
+  [n]
   (cond
     (< n 20) (nth singles (dec n))
     (< n 100) (if (factor? n 10)


Tweak arc radius calc

Tweak arc radius calc

It turned out that in some cases, ordering based on contiguous
groups of :up and :down per layer in the way we were still causes
some arcs to get too close to each other.  This tweak calculates
the radii based on a total ordering of :up and :down in a layer.

--- src/fatlip/plot.cljs
+++ src/fatlip/plot.cljs
@@ -835,7 +835,7 @@
 (defn get-character-layer-pairs
   [layers characters]
   (let [char-layers (map (fn [layer]
-                           (map (fn [item]
+                           (mapcat (fn [item]
                                   (if (instance? Node item)
                                     (get characters item)
                                     (get characters (first (:endpoints item)))))
@@ -844,18 +844,13 @@
     (map vector char-layers (drop 1 char-layers))))

-(defn order-groups
-  [groups order-attr char-segs]
-  (first
-   (reduce (fn [[segs order] group]
-             [(first (reduce (fn [[p i] char]
-                              [(assoc-in p [char order-attr :order] (+ order i))
-                               (inc i)])
-                            [segs 0]
-                            group))
-              (+ order (dec (count group)))])
-           [char-segs 0]
-           groups)))
+(defn order-group
+  [char-segs group order-attr]
+  (first (reduce (fn [[segs i] char]
+                   [(assoc-in segs [char order-attr :order] i)
+                    (inc i)])
+                 [char-segs 0]
+                 group)))

 (defn plot
@@ -870,17 +865,12 @@
         segs-by-layer-character (get-segments-by-layer-character char-segs layers)
         segs-by-char (->> (map (fn [layer-pair char-segs]
                                  (let [char-dir #(:dir (get char-segs %))
-                                       [src-dirs dest-dirs] (map (fn [layer]
-                                                                   (->> layer
-                                                                        (mapcat (fn [node]
-                                                                                (partition-by char-dir node)))
-                                                                        (group-by #(char-dir (first %)))))
-                                                                 layer-pair)]
-                                   (->> char-segs
-                                        (order-groups (:up src-dirs) :src)
-                                        (order-groups (reverse (map reverse (:down src-dirs))) :src)
-                                        (order-groups (reverse (map reverse (:up dest-dirs))) :dest)
-                                        (order-groups (:down dest-dirs) :dest))))
+                                       [src-dirs dest-dirs] (map #(group-by char-dir %) layer-pair)]
+                                   (-> char-segs
+                                       (order-group (:up src-dirs) :src)
+                                       (order-group ((fnil rseq []) (:down src-dirs)) :src)
+                                       (order-group ((fnil rseq []) (:up dest-dirs)) :dest)
+                                       (order-group (:down dest-dirs) :dest))))
                                character-layer-pairs
                                segs-by-layer-character)
                           (reduce (fn [by-char layer-map]


add file uniquesness

add file uniquesness

--- src/fileape/core.clj
+++ src/fileape/core.clj
@@ -143,7 +143,7 @@
     "Checks and if the file should be rolled its rolled"
     (try
       (do
-			    (.flush out)
+			    ;(.flush out)
 		      (info "Check rollover-size[ " rollover-size "] < " (.getName file) " length " (.length file) " ts " (.get ^AtomicReference updated))
 		      (if (or (>= (.length file) rollover-size)
 			            (>= (- (System/currentTimeMillis) (.get ^AtomicReference updated)) rollover-timeout))


compare top 3 graphs

compare top 3 graphs

--- src/gaugin/core.cljs
+++ src/gaugin/core.cljs
@@ -107,13 +107,13 @@

 (defn draw-fdg
   "Draw force-directed graph"
-  [data]
+  [data frame]
   (let [width 1080
         height 920
         color (-> d3 .-scale .category10)
         force (-> d3 .-layout .force (.charge -100) (.linkDistance 20) (.size [width height]))
         svg (-> d3
-                (.select "#the-canvas-2")
+                (.select frame)
                 (.attr {:width width
                         :height height}))]
     (-> force
@@ -154,4 +154,6 @@

 (draw-reingold tree-data)

-(draw-fdg graph-data-3)
+(draw-fdg graph-data-1 "#the-canvas-2")
+(draw-fdg graph-data-2 "#the-canvas-3")
+(draw-fdg graph-data-3 "#the-canvas-4")


:id -> :batch-id in failure

:id -> :batch-id in failure

--- src/eulalie/sqs.clj
+++ src/eulalie/sqs.clj
@@ -148,10 +148,13 @@
        (group-by unique-attr)
        (util/mapvals first)))

+(def failed-batch-attr-renames
+  {:code :code :id :batch-id :message :message :sender-fault :sender-fault})
+
 (defn restructure-failed-batch [body]
   (let [ms (-> body
                (x/children :batch-result-error-entry)
-               (children-by-attr :id #{:code :id :message :sender-fault}))]
+               (children-by-attr :id failed-batch-attr-renames))]
     (util/mapvals #(update-in % [:code] csk/->kebab-case-keyword) ms)))

 (defmethod restructure-response :delete-message-batch [_ body]


Adding safe-regex to utils.

Adding safe-regex to utils.

--- src/hatti/utils.cljs
+++ src/hatti/utils.cljs
@@ -30,6 +30,17 @@
   [fmt & args]
   (apply goog.string/format fmt args))

+(defn safe-regex [s & {:keys [:ignore-case?]
+                       :or    {:ignore-case? true}}]
+  "Create a safe (escaped) js regex out of a string.
+   By default, creates regex with ignore case option."
+  (let [s (.replace s
+                    #"/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/"
+                    "\\$&")] ;; See http://stackoverflow.com/a/6969486
+    (if :ignore-case?
+      (js/RegExp. s "i")
+      (js/RegExp. s))))
+
 (defn indexed [coll]
   "Given a seq, produces a two-el seq. [a b c] => [[0 a] [1 b] [2 c]]."
   (map-indexed vector coll))


Delete old export files

Delete old export files

--- android/src/clojure/net/nightweb/actions.clj
+++ android/src/clojure/net/nightweb/actions.clj
@@ -19,6 +19,7 @@
         [nightweb.router :only [create-meta-torrent
                                 create-imported-user]]
         [nightweb.io :only [read-file
+                            delete-file
                             list-dir
                             get-files-in-uri
                             write-pic-file
@@ -203,6 +204,7 @@
                        dir (android.os.Environment/getExternalStorageDirectory)
                        dest-path (-> (.getAbsolutePath dir)
                                      (str slash user-zip-file))]
+                   (delete-file dest-path)
                    ; if zip succeeds, show app chooser, otherwise show error
                    (if (zip-dir path dest-path password)
                      (send-file context "application/zip" dest-path)
@@ -218,7 +220,8 @@
                                      (str slash user-zip-file))
                        ; if it's a content URI, copy to root of SD card
                        path (if (.startsWith uri-str "content://")
-                              (do (copy-uri-to-path context uri-str temp-path)
+                              (do (delete-file temp-path)
+                                  (copy-uri-to-path context uri-str temp-path)
                                   temp-path)
                               (.getRawPath (java.net.URI. uri-str)))
                        dest-path (get-user-dir)]


42327 == icecp

42327 == icecp

--- src/icecap/core.clj
+++ src/icecap/core.clj
@@ -19,7 +19,7 @@
     (info "Initializing libsodium")
     (sodium-init)
     (info "Running icecap")
-    (run-server handler {:port 8080})))
+    (run-server handler {:port 42327})))

 (defn -main
   "Run the (development) server."


Refactor

Refactor

--- src/icecap/rest.clj
+++ src/icecap/rest.clj
@@ -11,11 +11,8 @@
             [ring.middleware.format :refer [wrap-restful-format]]))

 (defn ^:private cap-url
-  [request cap]
-  (let [netloc (str (:server-name request) ":" (:server-port request))
-        path (:uri request)
-        encoded-cap (safebase64-encode cap)]
-    (str "http://" netloc path "/" encoded-cap)))
+  [{:keys [server-name server-port uri]} cap]
+  (str "http://" server-name ":" server-port uri "/" (safebase64-encode cap)))

 (defroutes routes
   (context "/v0/caps" {components :components}


Oops! Use getenv instead of read-config.

read-config is something I copied over from Cadence.

--- src/incise/core.clj
+++ src/incise/core.clj
@@ -1,15 +1,15 @@
 (ns incise.core
   (:use (hiccup core def page))
-  (:require (compojure [route :as route]
-                       [core :refer :all])
+  (:require (compojure [route :refer [resources not-found]]
+                       [core :refer [defroutes]])
             (ring.middleware [reload :refer [wrap-reload]]
                              [stacktrace :refer [wrap-stacktrace]])
             [dieter.core :refer [asset-pipeline]]
             [org.httpkit.server :refer [run-server]]))

 (defroutes routes
-  (route/resources "/")
-  (route/not-found (html5 [:h1 "404"])))
+  (resources "/")
+  (not-found (html5 [:h1 "404"])))

 (def app (-> routes
              (wrap-stacktrace)
@@ -18,11 +18,17 @@
                               :engine :v8
                               :compress false})))

+(defn getenv
+  "A nice wrapper around System/getenv that allows a second argument to be
+  passed in as the default."
+  ([variable default] (or (System/getenv variable) default))
+  ([variable] (getenv variable nil)))
+
 (defn -main
   "Run the application."
   [& [port thread-count]]
-  (run-server {:port (or port (Integer. (read-config "PORT" "5000")))
-               :thread (or thread-count (Integer. (read-config "THREAD_COUNT" "4")))}))
+  (run-server app {:port (or port (Integer. (getenv "PORT" "5000")))
+                   :thread (or thread-count (Integer. (getenv "THREAD_COUNT" "4")))}))

 (declare server)


Add newline to end of file.

Add newline to end of file.

--- src/isla/parser.clj
+++ src/isla/parser.clj
@@ -126,4 +126,4 @@

 (def expression-types [-assignment -invocation])
 (def atom-types [-nl])
-(def value-types [-string -integer -identifier])+(def value-types [-string -integer -identifier])


Improve search result handling.

Improve search result handling.

...by canceling previous searches etc. etc.

--- src-cljs/pepa/search.cljs
+++ src-cljs/pepa/search.cljs
@@ -22,22 +22,56 @@
 (defn search-results [state]
   (:search/results state))

+(defn ^:private cancel-search! [state]
+  (when-let [ch (:search/channel state)]
+    (async/close! ch)
+    (println "Canceled previous search"
+             (str "(for " (pr-str (:search/query state)) ")"))
+    (om/update! state :search/channel nil)))
+
 (defn clear-results!
   "Resets search results to *all* documents on the server."
   [state]
   (go
-    (om/update! state :search/results
-                (<! (api/fetch-document-ids)))))
+    ;; NOTE: This is quite ugly. We should introduce a :search
+    ;; top-level key.
+    (when (let [query (:search/query state)]
+            (or query
+                (and (nil? query)
+                     (nil? (:search/channel state))
+                     (empty? (:search/results state)))))
+      (let [ch (api/fetch-document-ids)]
+        (doto state
+          (cancel-search!)
+          (om/update! :search/results nil)
+          (om/update! :search/query nil)
+          (om/update! :search/channel ch))
+        (when-let [results (<! ch)]
+          (doto state
+            (om/update! :search/channel nil)
+            (om/update! :search/results results)))))))

 (defn search! [state query]
   (go
-    (some->> (try
-               (cond
-                 (list? query)
-                 query
-                 string?
-                 (parse-query query))
-               (catch js/Error e nil))
-             (api/search-documents)
-             (<!)
-             (om/update! state :search/results))))
+    (let [query (try
+                  (cond
+                    (list? query)
+                    query
+                    (string? query)
+                    (parse-query query))
+                  (catch js/Error e nil))]
+      (when (not= query (:search/query state))
+        (println "got new query")
+        ;; Cancel old search by closing the result channel
+        (cancel-search! state)
+        ;; Start new search, store result channel in app-state
+        (let [chan (api/search-documents query)]
+          (om/transact! state (fn [state]
+                                (assoc state
+                                       :search/query query
+                                       :search/results nil
+                                       :search/channel chan)))
+          (when-let [results (<! chan)]
+            (doto state
+              (om/update! :search/channel nil)
+              (om/update! :search/results results))))))))


Fix unexpected exception.

Fix unexpected exception.

--- src/lentes/core.cljc
+++ src/lentes/core.cljc
@@ -204,7 +204,6 @@
          (set! (.-watchers self) (dissoc watchers key))
          (when (empty? watchers)
            (set! (.-watchers-added self) false)
-           (set! (.-cache self) +empty+)
            (remove-watch src id)))))

    :cljs
@@ -264,7 +263,6 @@
        (set! (.-watchers self) (dissoc watchers key))
        (when (empty? watchers)
          (set! (.-watchers-added self) false)
-         (set! (.-cache self) +empty+)
          (remove-watch src id)))))

 #?(:clj
@@ -307,7 +305,6 @@
          (set! (.-watchers self) (dissoc watchers key))
          (when (empty? watchers)
            (set! (.-watchers-added self) false)
-           (set! (.-cache self) +empty+)
            (remove-watch src id)))))

    :cljs
@@ -347,7 +344,6 @@
        (set! (.-watchers self) (dissoc watchers key))
        (when (empty? watchers)
          (set! (.-watchers-added self) false)
-         (set! (.-cache self) +empty+)
          (remove-watch src id)))))

 (defn derive


fn to add book review given just its title

--- src/myshelf/core.clj
+++ src/myshelf/core.clj
@@ -223,6 +223,16 @@
                             access-token
                             review-url
                             params)))
+
+(defn add-book-review-by-title
+  [consumer access-token user-id title rating & [review-text]]
+  (if-let [shelved-id (:id (first (find-book-on-shelves consumer
+                                                        access-token
+                                                        user-id
+                                                        title)))]
+    (add-book-review consumer access-token shelved-id rating
+                     review-text)
+    "Could not find book on shelves"))

 (defn edit-book-review
   "Edit a book review. Automatically sets book to finished


drawing possible moves in light colors

drawing possible moves in light colors

--- src/nonaga/draw.cljs
+++ src/nonaga/draw.cljs
@@ -89,21 +89,26 @@
        (map hex-coord->svg-coord)
        (mapv (fn [[x y]] (dommy/append! svg-node (ring x y))))))

-(defn draw-possible-moves [svg-node coord]
-  (->> (n/valid-destinations n/initial-game [1 4])
+(defn draw-possible-moves [svg-node coord color]
+  ; This shouldn't be using initial game
+  (->> (n/valid-destinations n/initial-game coord)
        (map hex-coord->svg-coord)
        (mapv (fn [[x y]]
-               (let [marble (marble x y "yellow")]
+               (let [marble (marble x y color)]
                  (dommy/append! svg-node marble))))))
+
+(def light-colors
+  {"red" "pink"
+   "blue" "aqua"})

 (defn draw-marbles [svg-node coords color]
   (->> coords
        (map hex-coord->svg-coord)
-       (mapv (fn [[x y :as coord]]
+       (mapv (fn [coord [x y]]
                (let [marble (marble x y color)]
                  (aset marble "onclick"
-                       (fn [e] (draw-possible-moves svg-node coord)))
-                 (dommy/append! svg-node marble))))))
+                       (fn [e] (draw-possible-moves svg-node coord (light-colors color))))
+                 (dommy/append! svg-node marble))) coords)))

 (defn draw-coords [svg-node coords]
   (letfn [(draw [coord [x y]]


Add rotation-check-interval-ms to schema

--- src/onyx/schema.cljc
+++ src/onyx/schema.cljc
@@ -375,6 +375,7 @@
    (s/optional-key :onyx.rocksdb.filter/peer-block-cache-size) PosInt
    (s/optional-key :onyx.rocksdb.filter/num-buckets) PosInt
    (s/optional-key :onyx.rocksdb.filter/num-ids-per-bucket) PosInt
+   (s/optional-key :onyx.rocksdb.filter/rotation-check-interval-ms) PosInt
    (s/optional-key :onyx.zookeeper/backoff-base-sleep-time-ms) s/Int
    (s/optional-key :onyx.zookeeper/backoff-max-sleep-time-ms) s/Int
    (s/optional-key :onyx.zookeeper/backoff-max-retries) s/Int


In `print-condition`, restrict print length to 12 for irritants.

--- src/active/clojure/condition.cljc
+++ src/active/clojure/condition.cljc
@@ -604,12 +604,13 @@
           (.write w " [")
           (print who)
           (.write w "]"))
-        (doseq [irritant stuff]
-          (doto w
-            (.write "\n")
-            (.write spaces))
-          (pr irritant))
-        (.write w "\n")))
+        (binding [*print-length* 12]
+          (doseq [irritant stuff]
+            (doto w
+              (.write "\n")
+              (.write spaces))
+            (pr irritant))
+          (.write w "\n"))))
     (print-stack-trace-of w c))))

 #?(:cljs


Remove logging.

Remove logging.

--- src/app/cljs/one/sample/view.cljs
+++ src/app/cljs/one/sample/view.cljs
@@ -127,8 +127,6 @@
   (fx/initialize-views (:form snippets) (:greeting snippets))
   (add-input-event-listeners "text-input")

-  (one.logging/start-display (one.logging/console-output))
-
   (set-value! (by-id "text-input") (rand-nth [
                                               "The quick brown fox jumped over the lazy dog.",
                                               "Hello, world!",


Force testutils to throw on error during shutdown

--- test/puppetlabs/trapperkeeper/testutils/bootstrap.clj
+++ test/puppetlabs/trapperkeeper/testutils/bootstrap.clj
@@ -22,7 +22,7 @@
        (try
          ~@body
          (finally
-           (tk-app/stop ~app))))))
+           (tk-app/stop ~app true))))))

 (defn bootstrap-services-with-cli-data
   [services cli-data]
@@ -37,7 +37,7 @@
        (try
          ~@body
          (finally
-           (tk-app/stop ~app))))))
+           (tk-app/stop ~app true))))))

 (defn bootstrap-services-with-cli-args
   [services cli-args]
@@ -51,7 +51,7 @@
        (try
          ~@body
          (finally
-           (tk-app/stop ~app))))))
+           (tk-app/stop ~app true))))))

 (defn bootstrap-services-with-empty-config
   [services]
@@ -64,7 +64,7 @@
        (try
          ~@body
          (finally
-           (tk-app/stop ~app))))))
+           (tk-app/stop ~app true))))))

 (defn bootstrap-with-empty-config
   ([]


binary tree search

binary tree search

--- src/atom_finder/util/cdt_util.clj
+++ src/atom_finder/util/cdt_util.clj
@@ -250,19 +250,48 @@

   )

-(s/defn search-tree-offset-parent :- (s/Maybe IASTNode)
+(s/defn search-tree-offset-parent :- (s/maybe IASTNode)
   "binary search the tree for an offset"
   [target :- s/Int root :- IASTNode]
   (let [{start :offset len :length} (loc root)
         end (+ start len)
         kids (children root)]
     (when (<= start target end)
-      (loop []
-        )
-      )))
-
-
-;
+      (or (some->> (search-children-offset target kids)
+                   (search-tree-offset-parent target)) ; make tail-recursive?
+          root))))
+
+16045
+16103
+(search-tree-offset-parent 16356 atom-finder.constants/big-root)
+
+(s/defn search-children-offset :- (s/maybe IASTNode)
+  [target :- s/Int kids] ; :- [IASTNode]]
+  (pprn [target kids])
+  (loop [l 0 h (unchecked-dec (count kids))]
+    (pprn [l h])
+    (if (<= h (inc l))
+       (do ;(pprn [(-> kids (nth l) loc) target])
+       (cond
+         (== h -1) nil
+         (contains-offset? (nth kids l) target) (nth kids l)
+         (contains-offset? (nth kids h) target) (nth kids h)
+         :else nil))
+       (let [m (unchecked-add l (bit-shift-right (unchecked-subtract h l) 1))]
+         (if (<= target (-> kids (nth m) offset))
+           (recur l m)
+           (recur (unchecked-inc m) h))))))
+
+(search-children-offset 16045 (->> kid children first children))
+(search-children-offset 16045 (children kid))
+
+(->>
+(search-children-offset 16045
+(->> atom-finder.constants/big-root
+     children
+     ))
+(def kid))
+
 (defn binary-search
     "Finds earliest occurrence of x in xs (a vector) using binary search."
   ([xs x]


fix Chronos Protocol

fix Chronos Protocol

--- src/clj/game/cards-identities.clj
+++ src/clj/game/cards-identities.clj
@@ -95,13 +95,14 @@

    "Chronos Protocol: Selective Mind-mapping"
    {:events
-    {:pre-resolve-damage
+    {:corp-turn-begins {:effect (effect (enable-corp-damage-choice))}
+     :runner-turn-begins {:effect (effect (enable-corp-damage-choice))}
+     :pre-resolve-damage
      {:once :per-turn
       :req (req (and (= target :net)
-                     (not (and (= (:active-player @state) :runner) (get-in @state [:damage] :damage-choose)))
+                     (corp-can-choose-damage? state)
                      (> (last targets) 0)))
-      :effect (req (swap! state assoc-in [:damage :damage-choose] true)
-                   (damage-defer state side :net (last targets))
+      :effect (req (damage-defer state side :net (last targets))
                    (show-wait-prompt state :runner "Corp to use Chronos Protocol: Selective Mind-mapping")
                    (resolve-ability state side
                      {:optional {:prompt (str "Use Chronos Protocol: Selective Mind-mapping to reveal the Runner's "
@@ -113,12 +114,12 @@
                                                         (str " and deal "
                                                              (- (get-defer-damage state side :net nil) 1)
                                                              " more net damage")))
-                                               :effect (req (swap! state update-in [:damage] dissoc :damage-choose)
-                                                            (clear-wait-prompt state :runner)
+                                               :effect (req (clear-wait-prompt state :runner)
                                                             (trash state side target {:cause :net :unpreventable true})
+                                                            (swap! state update-in [:damage] dissoc :damage-choose-corp)
                                                             (damage state side :net (- (get-defer-damage state side :net nil) 1)
                                                                     {:unpreventable true :card card}))}
-                                 :no-ability {:effect (req (swap! state update-in [:damage] dissoc :damage-choose)
+                                 :no-ability {:effect (req (swap! state update-in [:damage] dissoc :damage-choose-corp)
                                                            (clear-wait-prompt state :runner)
                                                            (damage state side :net (get-defer-damage state side :net nil)
                                                                    {:unpreventable true :card card}))}}} card nil))}}}


Export the hyphen tables on add, delete or modify of words

--- src/clj/hyphen_keeper/handler.clj
+++ src/clj/hyphen_keeper/handler.clj
@@ -1,11 +1,12 @@
 (ns hyphen-keeper.handler
   (:require [clojure.string :as string]
             [compojure
-             [core :refer [context defroutes DELETE GET POST PUT]]
+             [core :refer [defroutes DELETE GET POST PUT]]
              [route :refer [not-found resources]]]
             [hiccup.page :refer [html5 include-css include-js]]
             [hyphen-keeper
              [db :as db]
+             [export :as export]
              [hyphenate :as hyphenate]
              [middleware :refer [wrap-api-middleware wrap-site-middleware]]]
             [ring.util.response :as response]))
@@ -40,10 +41,12 @@

 (defn- word-add [word hyphenation spelling]
   (db/save-word! word hyphenation spelling)
+  (export/export)
   (response/created (str "/api/words/" word)))

 (defn- word-delete [word spelling]
   (db/remove-word! word spelling)
+  (export/export)
   (-> nil
    response/response
    (response/status 204)))


Prod.

Prod.

--- src/clj/triangulate/memcached.clj
+++ src/clj/triangulate/memcached.clj
@@ -5,7 +5,7 @@

 (def key-mapping (atom {}))

-(def conn (c/text-connection "127.0.0.1:11211"))
+(def conn (c/text-connection "rush-hour.bsfnjw.cfg.usw2.cache.amazonaws.com:11211"))

 (defn serialize-coordinates [src dst]
   (let [pair {:src src :dst dst}]


added perp-bisector nad param-line to triangle.clj

--- src/clj/triangulator/triangle.clj
+++ src/clj/triangulator/triangle.clj
@@ -2,7 +2,7 @@
   (:use [triangulator.geometry]))

 (defn midpoint [P Q]
-  (scal-mult (/ 2) (add m n)))
+  (scal-mult (/ 2) (add P Q)))

 (defn centroid [[A B C]]
   (scal-mult
@@ -95,8 +95,74 @@
    (take 3
          (partition 2 1 (drop 1 (cycle t))))))

-(comments
+(comment
  (segments [[0 0] [1 0] [0 1]])
  ;;=> [[[1 0] [0 1]] [[0 1] [0 0]] [[0 0] [1 0]]]
  )

+(defn perp-bisector
+  "return new line same distance as given line,
+passing through midpoint of and perpendicular to
+the given line"
+  [[P Q]]
+  (let [M (midpoint P Q)
+        l (distance P Q)
+        R (sub P M)
+        Rp (perp R)]
+    [(add M Rp) (sub M Rp)]))
+
+(comment
+  (perp-bisector [[0 0] [1 0]])
+  ;;=> [[1/2 -1/2] [1/2 1/2]]
+
+  (perp-bisector [[-1 0] [1 0]])
+  ;;=> [[0N -1N] [0N 1N]]
+
+  (perp-bisector [[1 0] [0 1]])
+  ;;=> [[1N 1N] [0N 0N]]
+
+  (distance [1 0] [0 1])
+  ;;=> 1.4142135623730951
+
+  ;;=> perp-bisector preserves distance and midpoints
+  (let [p1 [1 0]
+        p2 [0 1]
+        [q1 q2] (perp-bisector [p1 p2])]
+    [(== (distance p1 p2)
+         (distance q1 q2))
+     (equals (midpoint p1 p2)
+             (midpoint q1 q2))])
+  )
+
+(defn param-line
+  "given two endpoints return function
+of parameteriezed line"
+  [[P Q]]
+  (let []
+    (fn [t]
+      (add P (scal-mult t (sub Q P))))))
+
+(comment
+  (let [e1 [1 0]
+        e2 [0 1]
+        p-line (param-line [e1 e2])
+        m (midpoint e1 e2)]
+    [(equals e1 (p-line 0))
+     (equals e2 (p-line 1))
+     (equals m (p-line (/ 2)))
+     (p-line 2)
+     (p-line -2)])
+  ;;=> [true true true [-1 2] [3 -2]]
+
+    (let [e1 [0 0]
+        e2 [1 0]
+        p-line (param-line [e1 e2])
+        m (midpoint e1 e2)]
+    [(equals e1 (p-line 0))
+     (equals e2 (p-line 1))
+     (equals m (p-line (/ 2)))
+     (p-line 2)
+     (p-line -2)])
+    ;;=> [true true true [2 0] [-2 0]]
+
+  )


Start fix deploy action

Start fix deploy action

--- src/cljs/battle_console/game.cljs
+++ src/cljs/battle_console/game.cljs
@@ -251,12 +251,13 @@
         new-actions (conj current-actions action)
         game (state/get-state :raw-game-data)
         player-code (get-in game ["viewed-by" "player-code"])
+        player-context "p1"
         game (-> game
                  (assoc :actions new-actions)
                  (assoc :p2-focused-board (= player-code "p2"))
                  (assoc :action-focus player-code))
         jsgame (js/encodeURIComponent (.stringify js/JSON (clj->js game)))
-        url (str "http://rules.api.orionsbelt.eu/game/turn/" "p1" "?context=" jsgame)]
+        url (str "http://rules.api.orionsbelt.eu/game/turn/" player-context "?context=" jsgame)]
     (state/set-state :processing-action action)
     (GET url {:handler action-added
               :error-handler error-loading-action})))


Add new functions to codecs namespace.

Add new functions to codecs namespace.

--- src/clojure/buddy/core/codecs.clj
+++ src/clojure/buddy/core/codecs.clj
@@ -22,13 +22,13 @@
   "Convert octets to String."
   ([data]
    (bytes->str data "UTF-8"))
-  ([#^bytes data, ^String encoding]
+  ([^bytes data, ^String encoding]
    (String. data encoding)))

 (defn bytes->hex
   "Convert a byte array to hex
   encoded string."
-  [#^bytes data]
+  [^bytes data]
   (Hex/encodeHexString data))

 (defn hex->bytes
@@ -40,18 +40,18 @@
 (defn bytes->base64
   "Encode a bytes array to base64
 and return utf8 string."
-  [#^bytes data]
+  [^bytes data]
   (Base64/encodeBase64URLSafeString data))

 (defn bytes->bbase64
   "Encode a bytes array to base64 and
 return bytearray."
-  [#^bytes data]
+  [^bytes data]
   (Base64/encodeBase64URLSafe data))

 (defn base64->bytes
   "Decode from base64 to bytes."
-  [s]
+  [^String s]
   (Base64/decodeBase64 s))

 (defn str->base64
@@ -66,11 +66,21 @@
   [^String s]
   (String. (base64->bytes s) "UTF8"))

-(defn str->sefebase64
+(defn str->safebase64
   "Given a string, convert it to completely
 urlsafe base64 version."
   [^String s]
   (-> (str->base64 s)
+      (str/replace #"\s" "")
+      (str/replace "=" "")
+      (str/replace "+" "-")
+      (str/replace "/" "_")))
+
+(defn bytes->safebase64
+  "Given a string, convert it to completely
+urlsafe base64 version."
+  [^bytes s]
+  (-> (bytes->base64 s)
       (str/replace #"\s" "")
       (str/replace "=" "")
       (str/replace "+" "-")
@@ -87,6 +97,17 @@
       (str/replace "_" "/")
       (base64->str)))

+(defn safebase64->bytes
+  "Given urlsafe base64 string decode it to bytes."
+  [^String s]
+  (-> (case (mod (count s) 4)
+        2 (str s "==")
+        3 (str s "=")
+        s)
+      (str/replace "-" "+")
+      (str/replace "_" "/")
+      (base64->bytes)))
+
 (defprotocol ByteArray
   "Facility for convert input parameters
 to bytes array with default implementation


shop specs product variants WIP

shop specs product variants WIP

--- src/clojure/nossal/shop/spec.cljc
+++ src/clojure/nossal/shop/spec.cljc
@@ -23,7 +23,15 @@
 (s/def ::images (s/coll-of uri? :kind vector? :distinct true :into []))
 (s/def ::characteristics (s/and
                            (s/map-of ::name ::description)
-                           #(instance? PersistentTreeMap %)))
+                           #(instance? PersistentTreeMap %)
+
+(s/def ::variant (s/keys :req [::id
+                               ::name
+                               ::price
+                               ::stock-count
+                               ::available?
+                               ::images]))
+(s/def ::variants (s/coll-of ::variant :kind vector? :distinct true :into []))

 (s/def ::product (s/keys :req-un [::id
                                   ::market-price
@@ -34,7 +42,8 @@
                                   ::images
                                   ::category
                                   ::stock-count
-                                  ::available?]))
+                                  ::available?]
+                         :opt-un [::variants]))
 (s/def ::products (s/and
                     (s/map-of ::id ::product)
                     #(instance? PersistentTreeMap %)))


Log trace done, support custom styles on events

--- src/com/wsscode/pathom/trace.cljc
+++ src/com/wsscode/pathom/trace.cljc
@@ -7,9 +7,8 @@
             [clojure.walk :as walk]))

 (defn now []
-  (inst-ms
-    #?(:clj  (java.util.Date.)
-       :cljs (js/Date.))))
+  #?(:clj  (System/currentTimeMillis)
+     :cljs (inst-ms (js/Date.))))

 (defn trace [env event]
   (if-let [event-trace (get env ::trace*)]
@@ -76,13 +75,16 @@

 (defmethod trace-tree-collect :default [x _] x)

-(defn tree-assoc-detail [x row keys]
+(defn tree-assoc-detail [row x keys]
   (update-in x [:response ::details] (fnil conj [])
-    (select-keys row (into [::event ::relative-timestamp ::duration] keys))))
-
-(defn tree-assoc-key-detail [x {:keys [key] :as row} keys]
+    (select-keys row (into [::event ::relative-timestamp ::duration ::style] keys))))
+
+(defn trace-style [row style]
+  (assoc row ::style style))
+
+(defn tree-assoc-key-detail [{:keys [key] :as row} x keys]
   (update-in x [:response ::children key ::details] (fnil conj [])
-    (select-keys row (into [::event ::relative-timestamp ::duration] keys))))
+    (select-keys row (into [::event ::relative-timestamp ::duration ::style] keys))))

 (defn trace->tree* [paths path]
   (-> (reduce
@@ -122,7 +124,8 @@
             :com.wsscode.pathom.parser/max-iterations-reached
             (update-in x [:response ::children key ::details] (fnil conj []) (select-keys row [::event ::relative-timestamp :com.wsscode.pathom.parser/max-key-iterations]))

-            (:com.wsscode.pathom.parser/process-pending :com.wsscode.pathom.parser/reset-loop :com.wsscode.pathom.parser/flush-watchers-loop)
+            (:com.wsscode.pathom.parser/process-pending :com.wsscode.pathom.parser/reset-loop
+              :com.wsscode.pathom.parser/flush-watchers-loop ::trace-done)
             (update-in x [:response ::details] (fnil conj []) (select-keys row [::event ::relative-timestamp :com.wsscode.pathom.parser/provides :com.wsscode.pathom.parser/merge-result?
                                                                                :com.wsscode.pathom.parser/loop-keys]))

@@ -200,6 +203,7 @@
             parser-trace (trace-enter env' {::event ::trace-plugin})]
         (let-chan [res (parser env' tx)]
           (trace-leave env' parser-trace {::event ::trace-plugin})
+          (trace env' {::event ::trace-done})
           (assoc res :com.wsscode.pathom/trace (trace->viz @trace*))))
       (parser env tx))))


uncommented filter for open threads of the current group

--- src/braid/common/state.cljs
+++ src/braid/common/state.cljs
@@ -73,7 +73,7 @@
         open-threads (-> @threads
                          (select-keys @open-thread-ids)
                          vals
-                         #_(->> (filter (fn [thread]
+                         (->> (filter (fn [thread]
                                 (or (empty? (thread :tag-ids))
                                     (contains?
                                       (into #{} (map group-for-tag (thread :tag-ids)))


Fix requires order in bot.clj

Fix requires order in bot.clj

--- src/braid/server/db/bot.clj
+++ src/braid/server/db/bot.clj
@@ -1,12 +1,10 @@
 (ns braid.server.db.bot
   (:require
-    [datomic.api :as d]
     [braid.server.crypto :as crypto :refer [random-nonce]]
     [braid.server.db :as db]
     [braid.server.db.common :refer [bot-pull-pattern db->bot]]
-    [braid.server.db.user :as user]))
-
-;; Queries
+    [braid.server.db.user :as user]
+    [datomic.api :as d]))

 (defn bots-in-group
   [group-id]


Consider url encoding in route matching

Consider url encoding in route matching

--- src/catalog/web/handler.clj
+++ src/catalog/web/handler.clj
@@ -8,8 +8,11 @@
             [hiccup.middleware :refer [wrap-base-url]]
             [ring.middleware
              [defaults :refer [site-defaults wrap-defaults]]
-             [stacktrace :as stacktrace]]))
+             [stacktrace :as stacktrace]]
+            [ring.util.codec :refer [url-encode]]))

+
+(def hörbuch-encoded (url-encode "hörbuch"))

 (defroutes app-routes
   "Main routes for the application"
@@ -25,15 +28,15 @@
   (GET "/:year/:issue/neu-in-braille.xml"
        [year :<< as-int issue :<< as-int]
        (views/neu-in-braille year issue))
-  (GET "/:year/:issue/neu-als-hörbuch.pdf"
+  (GET (format "/:year/:issue/neu-als-%s.pdf" hörbuch-encoded)
        [year :<< as-int issue :<< as-int]
        (views/neu-als-hörbuch year issue))

   ;; editorials
-  (GET "/:year/:issue/editorial/:fmt{grossdruck|braille|hörbuch}"
+  (GET (format "/:year/:issue/editorial/:fmt{grossdruck|braille|%s}" hörbuch-encoded)
        [year :<< as-int issue :<< as-int fmt :as r]
        (views/editorial-form r fmt year issue))
-  (POST "/:year/:issue/editorial/:fmt{grossdruck|braille|hörbuch}"
+  (POST (format "/:year/:issue/editorial/:fmt{grossdruck|braille|%s}" hörbuch-encoded)
         [year :<< as-int issue :<< as-int fmt editorial recommended :as r]
         (views/editorial r fmt year issue editorial recommended))


fix typo

fix typo

--- src/chat/server/handler.clj
+++ src/chat/server/handler.clj
@@ -128,7 +128,7 @@
       (invites/request-reset (assoc user :email email)))
     {:status 200 :body (pr-str {:ok true})})
   (GET "/reset" [user token]
-    (if-let [u (and (invites/verify-reset-token user token)
+    (if-let [u (and (invites/verify-reset-nonce user token)
                  (db/with-conn (db/user-by-id (java.util.UUID/fromString user))))]
       {:status 200
        :headers {"Content-Type" "text/html"}


compile and emit case-lambda!

compile and emit case-lambda!

--- src/clj/wombat/compiler.clj
+++ src/clj/wombat/compiler.clj
@@ -188,7 +188,7 @@
   [env [_ params & body :as form]]
   (let [params (expand-params params)]
     (validate-params! params)
-    (cons 'lambda (sanitize-method params body))))
+    (cons 'lambda (sanitize-method env params body))))

 (defn sanitize-case-lambda
   [env [_ methods :as form]]
@@ -480,7 +480,7 @@

 (defn min-variadic-arity
   [fixed variadic]
-  (when variradic
+  (when variadic
     (if (= (last fixed) (dec variadic))
       variadic
       (dec variadic))))
@@ -543,12 +543,12 @@
         (. gen visitInsn Opcodes/ACONST_NULL)
         (. gen storeLocal list-local)
         (. gen invokeVirtual thistype (Method. "invoke" object-type (into-array Type (concat (repeat (dec variadic) object-type)
-                                                                                (list object-array-type)))))
+                                                                                (list (asmtype object-array-class))))))
         (. gen goTo end-switch-label))

       (. gen mark switch-label)
       ;; list count is on stack
-      (. gen switchTable (int-array fixed-arities) end-switch-label)
+      (. gen tableSwitch (int-array fixed-arities) switch-generator)
       (. gen mark end-switch-label))

     (. gen returnValue)
@@ -611,13 +611,14 @@
                          (. clinitgen invokeVirtual (asmtype MethodType)
                             (Method/getMethod "java.lang.invoke.MethodType insertParameterTypes(int,Class[])"))

+                         (. clinitgen invokeVirtual (asmtype MethodHandle)
+                            (Method/getMethod "java.lang.invoke.MethodHandle asType(java.lang.invoke.MethodType)"))
+
                          (when variadic?
                            (. clinitgen push (asmtype object-array-class))
                            (. clinitgen invokeVirtual (asmtype MethodHandle)
                               (Method/getMethod "java.lang.invoke.MethodHandle asVarargsCollector(Class)")))

-                         (. clinitgen invokeVirtual (asmtype MethodHandle)
-                            (Method/getMethod "java.lang.invoke.MethodHandle asType(java.lang.invoke.MethodType)"))
                          (. clinitgen putStatic thistype (handle-name arity) (asmtype MethodHandle)))]
       (. clinitgen visitCode)

@@ -657,7 +658,7 @@

         (. gen mark switch-label)
         ;; arity arg is on stack
-        (. gen switchTable (int-array fixed) end-switch-label)
+        (. gen tableSwitch (int-array fixed) switch-generator)
         (. gen mark end-switch-label))

       (. gen returnValue)
@@ -689,9 +690,8 @@
     (gen-handle cw thistype arglists)))

 (defn compile-lambda
-  [[_ & methods :as form]]
-  (let [fv (vec (free-vars form))
-        cw (ClassWriter. ClassWriter/COMPUTE_FRAMES)
+  [fv methods]
+  (let [cw (ClassWriter. ClassWriter/COMPUTE_FRAMES)
         lname (str (dotmunge (str (or *top-level* *lambda-name* 'lambda))) "_" (next-id))
         fqname (str "wombat/" lname)
         _ (debug "fqname:" fqname)
@@ -706,37 +706,20 @@
     (gen-ctor cw fqname fv)
     (binding [*lambda-name* (if *top-level* *lambda-name* nil)]
       (gen-methods cw env methods))
-    (. cw visitEnd)))
+    (. cw visitEnd)
+    [dotname (.toByteArray cw) fv]))

 (defmethod compile 'lambda
   [[_ params & body :as lambda]]
   (when-not (get @*compiled-lambdas* lambda)
     (validate-params! params)
     (debug "Compiling:" lambda)
-    (let [
-          before-rest (complement #{rest-token})
-          restarg (second (drop-while before-rest params))
-]
-      (binding [*lambda-name* (if *top-level* *lambda-name* nil)]
-        (. cw visit Opcodes/V1_7 Opcodes/ACC_PUBLIC fqname nil "java/lang/Object" ifaces)
-        (gen-closure-fields cw fv)
-        (gen-ctor cw fqname fv)
-        (gen-body cw env body)
-        (gen-applier cw env)
-        (gen-handle cw env)
-        (. cw visitEnd))
-      (swap! *compiled-lambdas* conj lambda)
-      [dotname (.toByteArray cw) fv])))
+    (compile-lambda (vec (free-vars lambda)) (list (cons params body)))))

 (defmethod compile 'case-lambda
   [[_ & methods :as case-lambda]]
   (debug "Compiling:" case-lambda)
-  (let [fv (vec (free-vars case-lambda))
-        cw (ClassWriter. ClassWriter/COMPUTE_FRAMES)
-        lname (str (dotmunge (str (or *lambda-name* 'lambda))) "_" (next-id))
-        fqname (str "wombat/" lname)
-        dotname (.replace fqname "/" ".")
-        ifaces (into-array String ["wombat/ILambda"])]))
+  (compile-lambda (vec (free-vars case-lambda)) methods))

 (defn emit
   [env context gen form]
@@ -934,8 +917,8 @@
   (fn [_ _ _ form] (first form))
   :default -invoke-)

-(defmethod emit-seq 'lambda
-  [env context ^GeneratorAdapter gen [_ params & body :as lambda]]
+(defn emit-lambda
+  [env context ^GeneratorAdapter gen lambda]
   (when-not (= context :context/statement)
     (let [[dotname bytecode closed-overs] (binding [*top-level* nil]
                                             (compile lambda))]
@@ -947,6 +930,14 @@
           (emit-symbol env :context/expression gen (nth closed-overs n)))
         (. gen invokeConstructor (Type/getObjectType slashname)
            (Method. "<init>" Type/VOID_TYPE (into-array Type (repeat (count closed-overs) object-type))))))))
+
+(defmethod emit-seq 'case-lambda
+  [env context ^GeneratorAdapter gen case-lambda]
+  (emit-lambda env context gen case-lambda))
+
+(defmethod emit-seq 'lambda
+  [env context ^GeneratorAdapter gen [_ params & body :as lambda]]
+  (emit-lambda env context gen lambda))

 ;; (defmethod emit-seq 'define-class*
 ;;   [env context gen [_ fields :as defcls]])


Put all interaction in the game loop

Put all interaction in the game loop

--- src/cljs/triboard/core.cljs
+++ src/cljs/triboard/core.cljs
@@ -321,17 +321,21 @@
 (def ai-players (reaction (get-in @game [:ai-players])))
 (def end-of-game (reaction (nil? @current-player)))

+(defn is-ai? [player]
+  (contains? @ai-players player))
+
+
+;; -----------------------------------------
+;; GAME LOOP
+;; -----------------------------------------
+
 (defn update-game! [f & args]
   (swap! app-state update-in [:games] conj (apply f @game args)))

-(defn new-game! []
-  (swap! app-state assoc-in [:games] (list (new-game))))
-
-(defn is-ai? [player]
-  (contains? @ai-players player))
-
-(defn restart-game! []
-  (swap! app-state update-in [:games] #(take-last 1 %)))
+(defn- handle-ai! []
+  (let [ai-algo (get @ai-players @current-player)
+        move (ai-algo @game @current-player)]
+    (update-game! play-move move)))

 (defn cancel-last-move! []
   (swap! app-state update-in [:games]
@@ -343,15 +347,13 @@
           new-list)))
     ))

-
-;; -----------------------------------------
-;; GAME LOOP
-;; -----------------------------------------
-
-(defn- handle-ai! []
-  (let [ai-algo (get @ai-players @current-player)
-        move (ai-algo @game @current-player)]
-    (update-game! play-move move)))
+(defn- handle-game-event!
+  [msg]
+  (case msg
+    :new-game (swap! app-state assoc-in [:games] (list (new-game)))
+    :restart (swap! app-state update-in [:games] #(take-last 1 %))
+    :undo (cancel-last-move!)
+    ))

 (defn start-game-loop
   "Manage transitions between player moves, ai moves, and generic game events"
@@ -360,23 +362,28 @@
         is-human-xf (fn [_] (not (is-ai? @current-player)))
         is-ai-xf (fn [_] (is-ai? @current-player))
         ai-events (chan 1 (comp (filter game-on-xf) (filter is-ai-xf)))
-        player-events (chan 1 (comp (filter game-on-xf) (filter is-human-xf)))]
+        player-events (chan 1 (comp (filter game-on-xf) (filter is-human-xf)))
+        game-events (chan 1)]

     (go
       (while true
         (alt!
+          game-events ([msg] (handle-game-event! msg))
           player-events ([coord] (update-game! play-move coord))
           ai-events ([msg] (when (= msg :ai-play) (handle-ai!)))
           (async/timeout ai-move-delay) ([_] (put! ai-events :ai-play))
           )))

-    {:player-events player-events}
-    ))
+    {:player-events player-events
+     :game-events game-events}))

 (defonce game-loop (start-game-loop))

 (def send-player-event!
-  (partial put! (game-loop :player-events)))
+  #(put! (game-loop :player-events) %))
+
+(def send-game-event!
+  #(put! (game-loop :game-events) %))

 ;; -----------------------------------------
@@ -428,11 +435,11 @@
 (defn show-top-panel
   [scores player]
   [:div.scores
-   [top-panel-button new-game! (special-char "★")]
+   [top-panel-button #(send-game-event! :new-game) (special-char "★")]
    [top-panel-button #(swap! app-state update :help not) "?"]
    (show-scores scores player)
-   [top-panel-button restart-game! (special-char "↻")]
-   [top-panel-button cancel-last-move! (special-char "↩")]])
+   [top-panel-button #(send-game-event! :restart) (special-char "↻")]
+   [top-panel-button #(send-game-event! :undo) (special-char "↩")]])

 (defn max-board-height []
   (- (-> (dom/getWindow) dom/getViewportSize .-height) 100))


Change tile cursor to "pointer" if clicking tile will have an effect

--- src/cljs/zetawar/views.cljs
+++ src/cljs/zetawar/views.cljs
@@ -110,10 +110,21 @@
              :width tiles/width :height tiles/height
              :xlink-href (site/prefix "/images/game/" image)}]))

-(defn tile [{:as view-ctx :keys [dispatch]} terrain]
+(defn tile [{:as view-ctx :keys [conn dispatch]} terrain]
   (let [{:keys [terrain/q terrain/r]} terrain]
     ^{:key (str q "," r)}
-    [:g {:on-click #(dispatch [::events.ui/select-hex q r])}
+    [:g {:on-click #(dispatch [::events.ui/select-hex q r])
+         :cursor (if (or
+                      @(subs/valid-destination-for-selected? conn q r)
+                      @(subs/enemy-in-range-of-selected? conn q r)
+                      @(subs/unit-can-act? conn q r)
+                      (and @(subs/current-base? conn q r)
+                           (not @(subs/unit-at? conn q r)))
+                      (and @(subs/repairable-friend-in-range-of-selected? conn q r)
+                           @(subs/selected-can-field-repair? conn)
+                           @(subs/has-repairable-armor-type? conn q r)))
+                   "pointer"
+                   "default")}
      [terrain-tile view-ctx terrain q r]
      [tile-border view-ctx q r]
      [board-unit view-ctx q r]


revert encoding since we are not using literal syntax for syntax form names

--- src/cljs_api_gen/encode.clj
+++ src/cljs_api_gen/encode.clj
@@ -3,32 +3,16 @@
   (:require
     [clojure.string :refer [replace]]))

-;; FIXME: if encoding/decoding fails to be lossless, and we need to add another underscore to each side
-;;        create a encoding name decorator function #(str "__" % "__")
 (def encoding
-  {"."  "_DOT_"
-   ">"  "_GT_"
-   "<"  "_LT_"
-   "!"  "_BANG_"
-   "?"  "_QMARK_"
-   "*"  "_STAR_"
-   "+"  "_PLUS_"
-   "="  "_EQ_"
-   "/"  "_SLASH_"
-
-   ";"  "_SEMICOLON_" ;; syntax - comment
-   "\\" "_BSLASH_"    ;; syntax - character
-   "#"  "_HASH_"      ;; syntax - tagged literal, regex, set, fn, cond
-   "["  "_LSQUARE_"   ;; syntax - vector
-   "]"  "_RSQUARE_"
-   "{"  "_LCURLY_"    ;; syntax - map
-   "}"  "_RCURLY_"
-   "("  "_LPAREN_"    ;; syntax - list
-   ")"  "_RPAREN_"
-   "^"  "_CARET_"     ;; syntax - meta
-   "\"" "_DQUOTE_"    ;; syntax - string
-   "'"  "_SQUOTE_"    ;; syntax - quote
-   "@"  "_ATSIGN_"    ;; syntax - reader-conditional splice
+  {"."  "DOT"
+   ">"  "GT"
+   "<"  "LT"
+   "!"  "BANG"
+   "?"  "QMARK"
+   "*"  "STAR"
+   "+"  "PLUS"
+   "="  "EQ"
+   "/"  "SLASH"
    })

 (defn encode-name [name-]


Fix parenthesis placement bug in case-error-frequency-meta-error

--- src/clojush/meta_errors.clj
+++ src/clojush/meta_errors.clj
@@ -909,6 +909,6 @@
   [ind evaluated-population argmap]
   (mapv (fn [e i]
           (count (filter #(= e (nth (:errors %) i))
-                         evaluated-population)
-                 (:errors ind)
-                 (iterate inc 0)))))
+                         evaluated-population)))
+        (:errors ind)
+        (iterate inc 0)))


Tweak hardocded resilience

Tweak hardocded resilience

--- src/clojush/meta_errors.clj
+++ src/clojush/meta_errors.clj
@@ -163,12 +163,12 @@
     (throw
      (Exception.
       ":print-history must be true for :resilience"))
-    (let [hist (take 4 (:history ind))]
+    (let [hist (take 5 (:history ind))]
       (if (< (count hist) 2)
         0
         (if (> (/ (count (distinct hist))
                   (count hist))
-               3/4)
+               1/5)
           0
           1)))))


recovery routine now searches the correct directory

--- src/clueweb_disqus/core.clj
+++ src/clueweb_disqus/core.clj
@@ -83,8 +83,9 @@
 (defn make-request
   [a-url]
   (try (-> a-url client/get :body parse-string)
-       (catch Exception e (do (Thread/sleep 3600000) ; sleep for 1 hr
-                                        ; and try again
+       (catch Exception e (do (Thread/sleep (* 60 60 1000)) ; sleep for 1 hr
+                                        ; and try again. this way the
+                                        ; system isn't so broken
                               (make-request a-url)))))

 (defn rate-limited-download
@@ -161,8 +162,9 @@

             next-pg-content (rate-limited-download next-pg-url)]
         (write-content start-epoch next-pg-content)
-        (cond (nil? (last (get next-pg-response "response")))
-              (threads-since (str (inc (Long/parseLong start-epoch)))) ; increment the pagination by 1
+        (cond (nil? (last (get next-pg-content "response")))
+              (do (Thread/sleep (* 5 60 1000)) ;; wait 5 mins and then retry
+                  (recur start-epoch first-page-content))

               (not
                (stop-iteration? start-epoch (get next-pg-content "response")))
@@ -188,7 +190,7 @@
                     (.getAbsolutePath x))
            (re-find #".clj$" (.getAbsolutePath x))))
     (file-seq
-     (java.io.File. ".")))))
+     (java.io.File. disqus-jobs-dir)))))

 (defn threads-since-recover
   "Reads the existing records and restarts the crawl from the next timestamp


Standard functions for sup and inf for lattices now use memo-fn

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

--- src/conexp/fca/lattices.clj
+++ src/conexp/fca/lattices.clj
@@ -55,7 +55,7 @@
   (or (.inf lattice)
       (let [order (order lattice)
 	    base  (base-set lattice)]
-	(fn [x y]
+	(memo-fn _ [x y]
 	  (first (for [z base
 		       :when (and (order [z x])
 				  (order [z y])
@@ -70,7 +70,7 @@
   (or (.sup lattice)
       (let [order (order lattice)
 	    base  (base-set lattice)]
-	(fn [x y]
+	(memo-fn _ [x y]
 	  (first (for [z base
 		       :when (and (order [x z])
 				  (order [y z])
@@ -80,8 +80,8 @@
 		   z))))))

 (defmethod print-method Lattice [^Lattice lattice out]
-  (.write out
-	  (str "Lattice on " (count (base-set lattice)) " elements.")))
+  (.write ^java.io.Writer out
+	  ^String (str "Lattice on " (count (base-set lattice)) " elements.")))

 ;;; Constructors


Clean up 'clean-ring-conf' function.

Clean up 'clean-ring-conf' function.

--- src/containium/http_kit.clj
+++ src/containium/http_kit.clj
@@ -64,10 +64,7 @@

 (defn- clean-ring-conf
   [ring-conf]
-  (if-let [context-path (:context-path ring-conf)]
-    (assoc ring-conf :context-path
-           (if (= (last context-path) \/) context-path (str context-path "/")))
-    ring-conf))
+  (update-in ring-conf [:context-path] #(when % (if (= (last %) \/) % (str % "/")))))

 (defn upstart-box


Change usage info

Change usage info

--- src/cyanite_remover/cli.clj
+++ src/cyanite_remover/cli.clj
@@ -25,10 +25,10 @@
   (->> ["A Cyanite data removal tool"
         ""
         "Usage: "
-        "  cyanite-remover [options] remove-metrics <tenant> <rollup:period,...> <path,...> <cassandra-host,...> <elasticsearch-url>"
-        "  cyanite-remover [options] remove-paths <tenant> <path,...> <elasticsearch-url>"
-        "  cyanite-remover [options] list-metrics <tenant> <rollup:period,...> <path,...> <cassandra-host,...> <elasticsearch-url>"
-        "  cyanite-remover [options] list-paths <tenant> <path,...> <elasticsearch-url>"
+        "  cyanite-remover [options] remove-metrics <tenant> <rollup:period,...> <path,...> <cassandra_host,...> <elasticsearch_url>"
+        "  cyanite-remover [options] remove-paths <tenant> <path,...> <elasticsearch_url>"
+        "  cyanite-remover [options] list-metrics <tenant> <rollup:period,...> <path,...> <cassandra_host,...> <elasticsearch_url>"
+        "  cyanite-remover [options] list-paths <tenant> <path,...> <elasticsearch_url>"
         "  cyanite-remover help"
         ""
         "Options:"


Updated stubs to match latest metadata fields.

--- src/dragon/cli/new/stub.clj
+++ src/dragon/cli/new/stub.clj
@@ -9,28 +9,28 @@
 (def stub-metadata
 "{:title \"REQUIRED\"
  :subtitle \"\"
- :header-image \"\"
  :excerpt \"\"
  :author \"REQUIRED\"
  :twitter \"\"
  :category \"REQUIRED\"
  :tags []
  :comment-link \"\"
- :header-image \"\"}\n")
+ :header-image \"\"
+ :public? false}\n")

 (def clj-content
 "(defn metadata
   []
   {:title \"REQUIRED\"
    :subtitle \"\"
-   :header-image \"\"
    :excerpt \"\"
    :author \"REQUIRED\"
    :twitter \"\"
    :category \"REQUIRED\"
    :tags []
    :comment-link \"\"
-   :header-image \"\"})\n
+   :header-image \"\"
+   :public? false})\n
 (defn content
   []
   \"REQUIRED\")\n")
@@ -38,7 +38,6 @@
 (def edn-content
 "{:title \"REQUIRED\"
  :subtitle \"\"
- :header-image \"\"
  :excerpt \"\"
  :author \"REQUIRED\"
  :twitter \"\"
@@ -46,6 +45,7 @@
  :tags []
  :comment-link \"\"
  :header-image \"\"
+ :public? false
  :content \"REQUIRED\"}\n")

 ;; Note that rfc5322-content uses the standard field names, when something
@@ -67,7 +67,6 @@
 (def rfc5322-content
 "Subject: REQUIRED (title)
 Subtitle:
-Header-Image:
 Excerpt:
 From: REQUIRED (author)
 Twitter:
@@ -76,6 +75,7 @@
 Comments:
 Content-Type: md
 Header-Image: img/
+Public?: true

 [content goes here]\n")


complete piece collision function and test

--- src/t3tr0s/core.cljs
+++ src/t3tr0s/core.cljs
@@ -75,10 +75,14 @@
   [x y]
   (get-in @state [:board y x]))

+(defn coord-inside?
+  [x y]
+  (and (<= 0 x 9) (<= 0 y 21)))
+
 (defn write-to-board!
   "Writes a given value to the x,y position on the board."
   [ x y value ]
-  (if (and (<= 0 x 9) (<= 0 y 21))
+  (if (coord-inside? x y)
     (swap! state assoc-in [:board y x] value)))

 (defn write-coord-to-board!
@@ -100,9 +104,16 @@
   [piece]
   (doall (map (fn [[x y]] [(- y) x]) piece)))

+(defn coord-occupied?
+  [x y]
+  (not= 0 (read-board x y)))
+
 (defn coord-collide?
   [[cx cy] x y]
-  (not= 0 (read-board (+ cx x) (+ cy y))))
+  (let [abs-x (+ x cx)
+        abs-y (+ y cy)]
+    (or (not (coord-inside? abs-x abs-y))
+        (coord-occupied? abs-x abs-y))))

 (defn piece-collide?
   "Determines if the given piece will collide with anything in the current board."
@@ -124,9 +135,19 @@

 (defn test-piece!
   "Clear the board, write a piece at 5,9, and print it."
-  [piece-key]
+  [piece-key x y]
   (clear-board!)
-  (write-piece-to-board! (piece-key pieces) 5 9)
+  (write-piece-to-board! (piece-key pieces) x y)
+  (print-board))
+
+(defn test-collide-piece!
+  "Test collision."
+  [piece-key x y]
+  (clear-board!)
+  (write-piece-to-board! (:J pieces) 5 9)
+  (println (piece-collide? (piece-key pieces) x y))
+  (println "\n")
+  (write-piece-to-board! (piece-key pieces) x y)
   (print-board))

 (defn init []


Simplify handler

Simplify handler

--- src/fixthebuild/handler.clj
+++ src/fixthebuild/handler.clj
@@ -1,14 +1,11 @@
 (ns fixthebuild.handler
   (:require [integrant.core :as ig]
-            [compojure.core :refer :all]
+            [compojure.core :refer [routes]]
             [ring.adapter.jetty :refer [run-jetty]]))
-
-(defn- make-handler [endpoints]
-  (apply routes endpoints))

 (defmethod ig/init-key ::endpoint
   [_ {:keys [endpoints]}]
-  (make-handler endpoints))
+  (apply routes endpoints))

 (defmethod ig/init-key ::jetty
   [_ {:keys [port join? handler]}]


Add fx-row to synth track properties.

Add fx-row to synth track properties.

--- sonic-jam/src/sonic_jam/core.cljs
+++ sonic-jam/src/sonic_jam/core.cljs
@@ -529,7 +529,8 @@
                                               "synth" [(dom/tr nil
                                                                (dom/td nil nil)
                                                                (dom/td nil "params:")
-                                                               (dom/td nil (om/build synth-param-editor input)))])
+                                                               (dom/td nil (om/build synth-param-editor input)))
+                                                       fx-row])
                                             [(dom/tr nil
                                                      (dom/td closer "}")
                                                      (dom/td nil nil)


CMR-2815 fixes comment

CMR-2815 fixes comment

--- access-control-app/int_test/cmr/access_control/int_test/acl_crud_test.clj
+++ access-control-app/int_test/cmr/access_control/int_test/acl_crud_test.clj
@@ -20,7 +20,7 @@
               (fixtures/grant-all-acl-fixture ["PROV1"]))

 (def system-acl
-  "A system ACL that grants create, read, update, delete to guest on any ACL"
+  "A system ingest management acl that grants read and update to guest users"
   {:group_permissions [{:user_type "guest"
                         :permissions ["read" "update"]}]
    :system_identity {:target "INGEST_MANAGEMENT_ACL"}})


Added context to errors without exceptions

--- src/kixi/datastore/web_server.clj
+++ src/kixi/datastore/web_server.clj
@@ -45,7 +45,7 @@
   (when (= 500 (get-in ctx [:response :status]))
     (if (:error ctx)
       (error (:error ctx) "Server error")
-      (error "Server error, no exception available")))
+      (error "Server error, no exception available. Ctx: " ctx)))
   ctx)

 (defn append-error-interceptor
@@ -218,7 +218,7 @@
     (consume-part [this state part]
       (if (file-part? part)
         (let [id (uuid)
-              complete-chan-r (flush-tiny-file! filestore id part (file-size part))]
+              complete-chan-r (flush-tiny-file! filestore id part (file-size part))]
           (-> part
               (assoc :id id
                      :count 1


Added get-thumb-from-search function.

Added get-thumb-from-search function.

--- src/beebster_clj/core.clj
+++ src/beebster_clj/core.clj
@@ -1,6 +1,46 @@
-(ns beebster-clj.core)
+(ns beebster-clj.core
+  (:require [compojure.route :as route])
+  (:use [ring.adapter.jetty :only [run-jetty]]
+        [net.cgrand.enlive-html :as html]
+        [clojure.java.shell :only [sh]]
+        [compojure.core]
+        [clojure.string :only [split-lines]]))

-(defn foo
-  "I don't do a whole lot."
-  [x]
-  (println x "Hello, World!"))
+
+(def iplayer-command
+  '("get_iplayer" "--nocopyright" "--limitmatches" "50" "--listformat" "<index> <pid> <thumbnail> <name> <episode>"))
+
+(defn iplayer-search
+  "run external command with given args list."
+  [search-title]
+  (split-lines (:out (apply sh (flatten (conj (list search-title) iplayer-command))))))
+
+(def iplayer-info
+  '("get_iplayer" "-i"))
+
+(defn get-info
+  "get-iplayer info for entered index"
+  [index]
+  (split-lines (:out (apply sh (flatten (conj (list index) iplayer-info))))))
+
+(defn get-thumb-from-search
+  "find thumbnail-url in string."
+  [str]
+  (re-find #"http.*jpg" str))
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+


properly apply :closure-output-charset in all cases

--- src/main/shadow/build/closure.clj
+++ src/main/shadow/build/closure.clj
@@ -1280,7 +1280,9 @@
     (when-let [lo (get-in state [:compiler-options :language-out])]
       {:language-out lo})
     (when-let [ofs (get-in state [:compiler-options :output-feature-set])]
-      {:output-feature-set ofs})))
+      {:output-feature-set ofs})
+    (when-let [charset (get-in state [:compiler-options :closure-output-charset])]
+      {:closure-output-charset charset})))

 (def cache-affecting-options
   [[:compiler-options :source-map-use-fs-paths]


http cleanup

http cleanup

--- src/org/spootnik/cyanite/http.clj
+++ src/org/spootnik/cyanite/http.clj
@@ -17,24 +17,12 @@
             [clojure.string             :refer [lower-case]]
             [clojure.tools.logging      :refer [info error debug]]))

-;(def
-;  ^{:doc "Our dead simple router"}
-;  routes [[:paths   #"^/paths.*"]
-;          [:metrics #"^/metrics.*"]
-;          [:ping #"^/ping/?"]])

 (defn now
   "Returns a unix epoch"
   []
   (quot (System/currentTimeMillis) 1000))

-;(defn keywordized
-;  "Yield a map where string keys are keywordized"
-;  [params]
-;  (dissoc
-;   (->> (map (juxt (comp keyword lower-case key) val) params)
-;        (reduce merge {}))
-;   nil))

 (defn find-best-rollup
   "Find most precise storage period given the oldest point wanted"
@@ -44,81 +32,6 @@
                       rollup-def))]
     (some within (sort-by :rollup rollups))))

-;(defn assoc-params
-;  "Parse query args"
-;  [{:keys [query-string] :as request}]
-;  (or
-;   (when-let [params (and (seq query-string)
-;                          (codec/form-decode query-string))]
-;     (assoc request
-;       :params (keywordized
-;                (cond (map? params) params
-;                      (string? params) {params nil}
-;                      :else {}))))
-;   (assoc request :params {})))
-;
-;(defn match-route
-;  ""
-;  [{:keys [uri path-info] :as request} [action re]]
-;  (when (re-matches re (or path-info uri))
-;    action))
-;
-;(defn assoc-route
-;  "Find matching route in router, store "
-;  [request]
-;  (assoc request :action (some (partial match-route request) routes)))
-;
-;(defmulti process
-;  "Process request by dispatching on the action that was found"
-;  :action)
-;
-;(defmethod process :paths
-;  [{{:keys [query tenant]} :params :keys [index] :as request}]
-;  (debug "query now: " query)
-;  (path/prefixes index (or tenant "NONE") (if (str/blank? query) "*" query)))
-;
-;(defmethod process :metrics
-;  [{{:keys [from to path agg tenant]} :params :keys [index store rollups]}]
-;  (debug "fetching paths: " path)
-;  (if-let [{:keys [rollup period]} (find-best-rollup from rollups)]
-;    (let [to    (if to (Long/parseLong to) (now))
-;          from  (Long/parseLong from)
-;          paths (mapcat (partial path/lookup index tenant)
-;                        (if (sequential? path) path [path]))]
-;      (store/fetch store (or agg "mean") paths tenant rollup period from to))
-;    {:step nil :from nil :to nil :series {}}))
-;
-;(defmethod process :ping
-;  [_]
-;  {})
-;
-;(defmethod process :default
-;  [_]
-;  (throw (ex-info "unknown action" {:status 404 :suppress? true})))
-;
-;(defn wrap-process
-;  "Process request, generating a JSON output for it, catch exception
-;   and yield a payload"
-;  [request rollups chan store index]
-;  (debug "got request: " request)
-;  (enqueue
-;   chan
-;   (try
-;     {:status  200
-;      :headers {"Content-Type" "application/json"}
-;      :body    (json/generate-string
-;                (process (assoc request
-;                           :store store
-;                           :rollups rollups
-;                           :index index)))}
-;     (catch Exception e
-;       (let [{:keys [status body suppress?]} (ex-data e)]
-;         (when-not suppress?
-;           (error e "could not process request"))
-;         {:status (or status 500)
-;          :headers {"Content-Type" "application/json"}
-;          :body    (json/generate-string
-;                    (or body {:error (.getMessage e)}))})))))

 (defn wrap-local-params [handler params]
   "Adds additional parameters to request"


bypassing https://github.com/yogthos/Selmer/issues/5

--- web/celestial/views/layout.clj
+++ web/celestial/views/layout.clj
@@ -1,10 +1,17 @@
 (ns celestial.views.layout
   (:use noir.request)
-  (:require [selmer.parser :as parser]))
+  (:require
+    [selmer.template-parser :refer [preprocess-template]]
+    [selmer.util :refer (resource-path)]
+    [selmer.parser :refer (parse render-template) ]))

 (def template-path "celestial/views/templates/")

+
 (defn render [template & [params]]
-  (parser/render-file (str template-path template)
-                      (assoc params :context (:context *request*))))
+  #_(parser/render-file (str template-path template)
+    (assoc params :context (:context *request*)))
+  (render-template
+    (parse (java.io.StringReader. (preprocess-template (str template-path template))) {})
+       (assoc params :context (:context *request*))))


Make synopsis optional

Make synopsis optional

--- src/storemi/routes/authorship.clj
+++ src/storemi/routes/authorship.clj
@@ -37,7 +37,7 @@

 (def story-creation-rules
   (one-by-one
-    (has-params [:title :synopsis])
+    (has-params [:title])
     user-is-logged-in))

 (defn proceed-creation [request]


Update to new data.json API

Update to new data.json API

Note that data.json 0.2.1 added 0.1.x API compatibility again.

--- src/taoensso/carmine/commands.clj
+++ src/taoensso/carmine/commands.clj
@@ -71,7 +71,8 @@
   "Returns parsed JSON official command reference.
   From https://github.com/antirez/redis-doc/blob/master/commands.json"
   []
-  (-> "commands.json" io/resource io/reader clojure.data.json/read-json))
+  (-> "commands.json" io/resource io/reader slurp
+      (clojure.data.json/read-str :key-fn keyword)))

 (defmacro defcommands
   "Defines an appropriate function for every command in reference. If debug?


Adds rightmost-node

Adds rightmost-node

--- src/the_little_clojurian/todo.clj
+++ src/the_little_clojurian/todo.clj
@@ -1,7 +1,7 @@
 (ns the-little-clojurian.todo
   (:require [clojure.test :refer :all]))

-(declare complete-map* complete-list* complete-node* complete-nodes*)
+(declare complete-map* complete-list* complete-node* complete-nodes* leftmost-node rightmost-node)

 (with-test
   (def leftmost-node
@@ -23,6 +23,28 @@
          {:id 2}))

   (is (= (leftmost-node {:id 1 :nodes '({:id 2 :nodes ({:id 3})})})
+         {:id 3})))
+
+(with-test
+  (def rightmost-node
+    (fn [root]
+      (cond (nil? root) nil
+            (empty? (:nodes root)) root
+            :else (rightmost-node (last (:nodes root))))))
+
+  (is (= (rightmost-node nil)
+         nil))
+
+  (is (= (rightmost-node {:id 1})
+         {:id 1}))
+
+  (is (= (rightmost-node {:id 1 :nodes '({:id 2})})
+         {:id 2}))
+
+  (is (= (rightmost-node {:id 1 :nodes '({:id 2} {:id 3})})
+         {:id 3}))
+
+  (is (= (rightmost-node {:id 1 :nodes '({:id 2 :nodes ({:id 3})})})
          {:id 3})))

 (with-test


disable :redef-in-file for now until can determine why this is problematic in REPL scenarios

--- src/clj/cljs/analyzer.clj
+++ src/clj/cljs/analyzer.clj
@@ -45,7 +45,7 @@
    :undeclared-ns true
    :undeclared-ns-form true
    :redef true
-   :redef-in-file true
+   :redef-in-file false
    :dynamic true
    :fn-var true
    :fn-arity true


More ir implementations in progress

More ir implementations in progress

--- src/clj/minijava/tree.clj
+++ src/clj/minijava/tree.clj
@@ -121,15 +121,16 @@
   [x frame]
   (Call (Name "print") [(-> x .exp (tree frame) unEx)]))

-;; (defmethod tree minijava.ast.This
-;;   [x] )
+ (defmethod tree minijava.ast.This
+   [x frame]
+   (Temp "This") ) ;;Is this the correct behaviour?

 (defmethod tree minijava.ast.Times
   [x frame]
   (binop :* x frame))

-;; (defmethod tree minijava.ast.VarDecl
-;;   [x] )
+ (defmethod tree minijava.ast.VarDecl
+   [x] )

 (defmethod tree minijava.ast.While
   [x frame]
@@ -143,5 +144,7 @@
           (Jump test)
           (Label f)])))

-;; (defmethod tree minijava.sat.ArrayLookup
-;;   [x] )
+ (defmethod tree minijava.sat.ArrayLookup
+   [x frame]
+   (Mem (binop :+ (tree (.array x) frame)) (binop :* 4 (tree (.index x) frame) ) )
+)


Reorder some of the functions in core

Reorder some of the functions in core

--- src/clj/momentum/core.clj
+++ src/clj/momentum/core.clj
@@ -42,20 +42,20 @@
 ;; ==== Async goodness
 (def abort               async/abort)
 (def aborted?            async/aborted?)
+(def async-val           async/async-val)
+(def async-seq?          async/async-seq?)
 (def batch               async/batch)
 (def blocking            async/blocking)
-(def recur*              async/recur*)
-(def join                async/join)
-(def select              async/select)
-(def async-val           async/async-val)
-(def async-seq?          async/async-seq?)
-(def pipeline            async/pipeline)
-(def put                 async/put)
-(def success?            async/success?)
 (def channel             async/channel)
 (def close               async/close)
 (def enqueue             async/enqueue)
+(def join                async/join)
+(def pipeline            async/pipeline)
+(def put                 async/put)
+(def recur*              async/recur*)
+(def select              async/select)
 (def sink                async/sink)
+(def success?            async/success?)

 (defmacro doasync
   [& args]


fix null pointer exception

fix null pointer exception

--- src/clj/tictag/system.clj
+++ src/clj/tictag/system.clj
@@ -13,7 +13,7 @@
    :server (component/using
             (server/map->Server
              {:config (:tictag-server config)})
-            [:db :tagtime :jwt :riemann :beeminder])
+            [:db :tagtime :jwt :riemann :beeminder :slack])
    :tagtime (tagtime/tagtime
              (get-in config [:tagtime :gap])
              (get-in config [:tagtime :seed]))


tests demonstrating reader #30

tests demonstrating reader #30

--- src/cljs/cljs/reader.cljs
+++ src/cljs/cljs/reader.cljs
@@ -338,3 +338,29 @@
      (if (= res reader)
        (recur reader eof-is-error sentinel is-recursive)
        res)))))
+
+(defn read-string
+  "Reads one object from the string s"
+  [s]
+  (let [r (push-back-reader s)]
+    (read r true nil false)))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Tests ;;;;;;;;;;;;;;;;
+
+(defn test-reader
+  []
+  (assert (= 1 (read-string "1")))
+  (assert (= 2 (read-string "#_nope 2")))
+  (assert (= [3 4] (read-string "[3 4]")))
+  (assert (= "foo" (read-string "\"foo\"")))
+  (assert (= :hello (read-string ":hello")))
+  (assert (= 'goodbye (read-string "goodbye")))
+  (assert (= #{1 2 3} (read-string "#{1 2 3}")))
+  (assert (= '(7 8 9) (read-string "(7 8 9)")))
+  (assert (= '(deref foo) (read-string "@foo")))
+  (assert (= '(quote bar) (read-string "'bar")))
+  (assert (= \a (read-string "\\a")))
+  (assert (= {:tag 'String} (meta (read-string "^String {:a 1}"))))
+  (assert (= [:a 'b #{'c {:d [:e :f :g]}}]
+             (read-string "[:a b #{c {:d [:e :f :g]}}]"))))
+


implement changing the editing state of the caption!

--- src/cljs/slides/core.cljs
+++ src/cljs/slides/core.cljs
@@ -28,6 +28,36 @@
     (when (within-slides? index app-state)
     (swap! app-state assoc :index index))))

+(defn set-editing-state [owner editing text]
+  ;; Use om/set-state! to change the editing and text values
+  (js/setTimeout #(.focus (om/get-node owner "title-edit")) 100))
+
+(defn update-title-on-enter [event owner model]
+  (let [key-code (.. event -keyCode)
+        new-title (om/get-state owner :text)]
+    (when (= key-code 13)
+      (om/update! model :title new-title)
+      (set-editing-state owner false new-title))))
+
+(defn slide-title [model owner]
+  (reify
+    om/IInitState
+    (init-state [_]
+      {:editing false
+       :text ""})
+    om/IRenderState
+    (render-state [_ state]
+      (dom/div #js {:className (when (:editing state) "editing")}
+        (dom/input #js {:className "title-edit"
+                        :value (:text state)
+                        :ref "title-edit"
+                        :onChange #(om/set-state! owner :text (.. % -target -value))
+                        :onBlur #(om/set-state! owner :editing false)
+                        :onKeyUp #(update-title-on-enter % owner model)})
+        (dom/h1 #js {:className "title-display"
+                     :onClick #(set-editing-state owner true (:title model))} (:title model)
+          (dom/small #js {:className "edit"} " ✎"))))))
+
 (defn slide [model owner]
   (reify
     om/IRender
@@ -36,7 +66,7 @@
         (when-let [bg (:bg model)]
           (dom/img #js {:className "bg" :src bg}))
         (dom/div #js {:className "slide-content banner"}
-          (dom/h1 #js {} (:title model)))))))
+          (om/build slide-title model))))))

 (defn next-slide-path [model f]
   (let [slides (:slides @model)
@@ -56,6 +86,9 @@
         (dom/a #js {:className "control banner next"
                     :href (next-slide-path model inc)})))))

+(defn main []
+  (om/root app app-state {:target (. js/document (getElementById "app"))}))
+
 (def slide-imgs
   [{:title "A Bird's Eye View of ClojureScript"
     :bg "/images/gull.jpg"}
@@ -64,7 +97,9 @@
    {:title "Event Handling"
     :bg "/images/swan.jpg"}
    {:title "Client-side Routing"
-    :bg "/images/heron.jpg"}])
+    :bg "/images/heron.jpg"}
+   {:title "Adding Local State"
+    :bg "/images/raven.jpg"}])

 (defn main []
   (om/root app app-state {:target (. js/document (getElementById "app"))}))


Elide create-session*

Elide create-session*

--- src/xray_charlie_charlie/core.clj
+++ src/xray_charlie_charlie/core.clj
@@ -73,8 +73,8 @@
     request))

 (defn- configure-session
-  "Configures the given Session object according to given options
-  map. Assumes correct types are passed: map
+  "Returns the given Session object, configured according to given
+  options map. Assumes correct types are passed: map
   for :default-request-options, Logger object for :logger, Object
   for :user-object, keyword for :transaction-mode, integer
   for :transaction-timeout."
@@ -91,25 +91,11 @@
     (.setTransactionTimeout session tt))
   session)

-(defn- create-session*
-  "Create a session (with no options) according to methods provided by
-  ContentSource:
-  https://docs.marklogic.com/javadoc/xcc/com/marklogic/xcc/ContentSource.html"
-  ([uri]
-   (.newSession (ContentSourceFactory/newContentSource (URI. uri))))
-  ([uri content-base]
-   (.newSession (ContentSourceFactory/newContentSource (URI. uri)) content-base))
-  ([uri user pwd]
-   (.newSession (ContentSourceFactory/newContentSource (URI. uri)) user pwd))
-  ([uri user pwd content-base] ;; <-- this is probably the one you want.
-   (.newSession (ContentSourceFactory/newContentSource (URI. uri)) user pwd content-base)))
-

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;; Session management
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

-;; FIXME there is currently no way to pass URI, usr, pwd, plus content-base, with no options
 (defn create-session
   "Create a Session according to the given parameters, configured
   according to the given options map.
@@ -121,16 +107,19 @@
   See https://docs.marklogic.com/javadoc/xcc/com/marklogic/xcc/ContentSource.html
   for allowed parameter arrangements."
   ([uri options]
-   (-> (create-session* uri)
+   (-> (.newSession (ContentSourceFactory/newContentSource (URI. uri)))
        (configure-session options)))
   ([uri content-base options]
-   (-> (create-session* uri content-base)
+   (-> (.newSession (ContentSourceFactory/newContentSource (URI. uri))
+                    content-base)
        (configure-session options)))
   ([uri user pwd options]
-   (-> (create-session* uri user pwd)
+   (-> (.newSession (ContentSourceFactory/newContentSource (URI. uri))
+                    user pwd)
        (configure-session options)))
   ([uri user pwd content-base options]
-   (-> (create-session* uri user pwd content-base)
+   (-> (.newSession (ContentSourceFactory/newContentSource (URI. uri))
+                    user pwd content-base)
        (configure-session options))))
 ;; TODO I find the repetition of configure-session cluttering.  Probably not a big deal.