Handle flexible service-offers

Handle flexible service-offers

--- jar-placement-lib/src/sixsq/slipstream/placement/core.clj
+++ jar-placement-lib/src/sixsq/slipstream/placement/core.clj
@@ -4,7 +4,8 @@
     [clojure.string :as str]
     [sixsq.slipstream.placement.cimi-util :as cu]
     [sixsq.slipstream.pricing.lib.pricing :as pr]
-    [sixsq.slipstream.client.api.cimi :as cimi]))
+    [sixsq.slipstream.client.api.cimi :as cimi]
+    [clojure.string :as string]))

 (def service-offer-currency-key :schema-org:priceCurrency)
 (def no-price -1)
@@ -118,7 +119,11 @@

 (defn- clause-cpu-ram-disk
   [component]
-  (format "schema-org:descriptionVector/schema-org:vcpu>=%sandschema-org:descriptionVector/schema-org:ram>=%sandschema-org:descriptionVector/schema-org:disk>=%s"
+  (format
+    (string/join ["schema-org:flexible='true'or"
+                  "(schema-org:descriptionVector/schema-org:vcpu>=%sand"
+                  "schema-org:descriptionVector/schema-org:ram>=%sand"
+                  "schema-org:descriptionVector/schema-org:disk>=%s)"])
           (:cpu.nb component)
           (:ram.GB component)
           (:disk.GB component)))


own router-loop, don't give browser control between dispatches

--- cljs/src/main/plastic/frame.cljs
+++ cljs/src/main/plastic/frame.cljs
@@ -1,8 +1,11 @@
 (ns plastic.frame
-  (:require-macros [plastic.macros.logging :refer [log info warn error group group-end measure-time]])
+  (:require-macros [plastic.macros.logging :refer [log info warn error group group-end measure-time]]
+                   [cljs.core.async.macros :refer [go-loop go]])
   (:require [plastic.frame.core :as frame]
             [plastic.frame.router :as router]
-            [clojure.string :as string]))
+            [clojure.string :as string]
+            [plastic.frame.handlers :refer [handle]]
+            [cljs.core.async :refer [chan put! <!]]))

 (defn simple-printer [acc val]
   (conj acc (cond
@@ -27,4 +30,26 @@
    (frame/register-handler id [timing frame/trim-v middleware] handler)))

 (def subscribe frame/subscribe)
-(def router-loop router/router-loop)+
+(defn router-loop []
+  (go-loop []
+    (let [event-v (<! router/event-chan)]                   ;; wait for an event
+      (try
+        (handle event-v)
+
+        ;; If the handler throws:
+        ;;   - allow the exception to bubble up because the app, in production,
+        ;;     may have hooked window.onerror and perform special processing.
+        ;;   - But an exception which bubbles up will break the enclosing go-loop.
+        ;;     So we'll need to start another one.
+        ;;   - purge any pending events, because they are probably related to the
+        ;;     event which just fell in a screaming heap. Not sane to handle further
+        ;;     events if the prior event failed.
+        (catch :default e
+          (do
+            ;; try to recover from this (probably uncaught) error as best we can
+            (router/purge-chan)                             ;; get rid of any pending events
+            (router-loop)                                   ;; Exception throw will cause termination of go-loop. So, start another.
+
+            (throw e)))))                                   ;; re-throw so the rest of the app's infrastructure (window.onerror?) gets told
+    (recur)))


Adressing nitpicks for dna.clj

Adressing nitpicks for dna.clj

--- clojure/nucleotide-count/dna.clj
+++ clojure/nucleotide-count/dna.clj
@@ -2,11 +2,11 @@

 (defn nucleotide-counts [dna-string]
   (let [empty {\A 0, \T 0, \C 0, \G 0}]
-    (merge-with + empty (frequencies dna-string))))
+    (merge empty (frequencies dna-string))))

 (defn count [strand dna-string]
   (let [allowed-nucleotide [\A \T \C \G \U]]
-    (if (not (some #{strand} allowed-nucleotide))
+    (when (not (some #{strand} allowed-nucleotide))
        (throw (Exception. "invalid nucleotide"))))

   (let [dna (nucleotide-counts dna-string)]


Remove unneccessary atom refer

Remove unneccessary atom refer

--- examples/simple/src/simpleexample/core.cljs
+++ examples/simple/src/simpleexample/core.cljs
@@ -1,6 +1,6 @@
 (ns simpleexample.core
   (:require-macros [reagent.ratom :refer [reaction]])
-  (:require [reagent.core :as reagent :refer [atom]]
+  (:require [reagent.core :as reagent]
             [re-frame.core :refer [register-handler
                                    path
                                    register-sub


♻ Refactor create-congregation controller to use api-command!

Why:
- Avoids special casing for a single command
- Does all the generic handing of command parameters and mapping
  exceptions to HTTP responses


use 'pmap' instead of futures + deref.

use 'pmap' instead of futures + deref.

--- src/ancient_clj/load.clj
+++ src/ancient_clj/load.clj
@@ -7,9 +7,7 @@
    keys based on artifact group and ID.

    Result will be a map associating each repository ID either with the
-   respective seq or an instance of Throwable.
-
-   This uses futures to accomplish parallelism."
+   respective seq or an instance of Throwable."
   [loaders {:keys [group id]}]
   {:pre [(map? loaders)
          (every? fn? (vals loaders))]
@@ -18,11 +16,11 @@
             (fn [x]
               (or (coll? x) (instance? Throwable x)))
             (vals %))]}
-  (let [futures (vec
-                  (for [[loader-id f] loaders]
-                    (future
-                      (try
-                        [loader-id (f group id)]
-                        (catch Throwable ex
-                          [loader-id ex])))))]
-    (into {} (map deref futures))))
+  (->> loaders
+       (pmap
+         (fn [[loader-id f]]
+           (try
+             [loader-id (f group id)]
+             (catch Throwable ex
+               [loader-id ex]))))
+       (into {})))


Tweaking

Tweaking

--- src/cljs/gampg/core.cljs
+++ src/cljs/gampg/core.cljs
@@ -26,13 +26,13 @@
 ;;
 ;; XXX: We're not properly reusing gl context's here, hurts fighweel's
 ;; reloadability
-;; (def title   lg-apartment/title)
-;; (def prog    lg-apartment/program-diffuse-per-fragment)
-;; (def gl-main lg-apartment/main)
+(def title   lg-apartment/title)
+(def prog    lg-apartment/program-diffuse-per-fragment)
+(def gl-main lg-apartment/main)

-(def title   lg14/title)
-(def prog    lg14/program-specular)
-(def gl-main lg14/main)
+;; (def title   lg14/title)
+;; (def prog    lg14/program-specular)
+;; (def gl-main lg14/main)

 (defonce app-state (atom {:live {}}))


Fix ommission in type conversion

Fix ommission in type conversion

--- src/grafter/rdf4j/io.clj
+++ src/grafter/rdf4j/io.clj
@@ -191,6 +191,10 @@
     this)

   Literal
+  (->backend-type [this]
+    this)
+
+  Statement
   (->backend-type [this]
     this)


Change doseqs to loop-with-index

Change doseqs to loop-with-index

--- src/zaffre/glterminal.clj
+++ src/zaffre/glterminal.clj
@@ -51,6 +51,27 @@
 (defmacro defn-memoized [fn-name & body]
   "Def's a memoized fn. Same semantics as defn."
   `(def ~fn-name (memoize (fn ~@body))))
+
+(defmacro loop-with-index [idx-name bindings & body]
+  "bindings => binding-form seq-expression
+
+  Repeatedly executes body (presumably for side-effects) with
+  binding form and idx-name in scope.  `idx-name` is repeatedly bound to the index of the item being
+  evaluated ex: to each successive value in `(range (count (second bindings)))`. Does not retain
+      the head of the sequence. Returns nil.
+
+   (loop-with-index idx [[k v] {:a 1 :b 2 :c 3}] (println \"idx\" idx \"k\" k \"v\" v))
+   idx 0 k :a v 1
+   idx 1 k :b v 2
+   idx 2 k :c v 3
+   nil"
+  (let [form (bindings 0) coll (bindings 1)]
+     `(loop [coll# ~coll
+             ~idx-name 0]
+        (when coll#
+          (let [~form (first coll#)]
+            ~@body
+            (recur (next coll#) (inc ~idx-name)))))))

 (defn convert-key-code [event-char event-key on-key-fn]
   ;; Cond instead of case. For an unknown reason, case does not match event-key to Keyboard/* constants.
@@ -222,29 +243,6 @@
                      (.getData dbb))))]
     (.put texture-buffer data 0 (alength data))
     (.flip texture-buffer)
-    texture-buffer))
-
-(defn- buffered-image-rgba-byte-buffer [^BufferedImage buffered-image]
-  (let [width          (.getWidth buffered-image)
-        height         (.getHeight buffered-image)
-        texture-buffer ^ByteBuffer (BufferUtils/createByteBuffer (* width height 4))
-        channel        (.getChannel (FileOutputStream. (File. (format "bytes-%dx%d.raw.data" width height)) false))]
-    (log/info "Gettting bytes for image with type" (.getType buffered-image))
-    (doseq [y (range height)
-            x (range width)
-            :let [abgr   (.getRGB buffered-image x y)
-                  g      (unsigned-bit-shift-right (bit-and 0x000000FF abgr) 0)
-                  b      (unsigned-bit-shift-right (bit-and 0x0000FF00 abgr) 8)
-                  a      (unsigned-bit-shift-right (bit-and 0x00FF0000 abgr) 16)
-                  r      (unsigned-bit-shift-right (bit-and 0xFF000000 abgr) 24)
-                  i ^int (int (+ (bit-shift-left r 24)
-                                 (bit-shift-left g 16)
-                                 (bit-shift-left b 8)
-                                 (bit-shift-left a 0)))]]
-      (.putInt texture-buffer i))
-    (.flip texture-buffer)
-    (.write channel texture-buffer)
-    (.close channel)
     texture-buffer))

 (defn- get-fields [#^Class static-class]
@@ -415,18 +413,6 @@
              (recur)))))
      ;; Wait for Display to be created
      (.await latch)))
-
-(defn- shader-error-str [shader-id]
-  (let [infoLogLength (BufferUtils/createIntBuffer 1)
-        _             (GL20/glGetShader shader-id GL20/GL_INFO_LOG_LENGTH, infoLogLength)
-        log-length    (.get infoLogLength 0)
-        infoLog ^ByteBuffer        (BufferUtils/createByteBuffer log-length)
-        _              (.clear infoLogLength)
-        _              (GL20/glGetShaderInfoLog shader-id, infoLogLength, infoLog)
-        infoLogBytes   (byte-array log-length)
-        _              (.get infoLog infoLogBytes, 0, log-length)]
-    (log/info "info length" log-length)
-    (String. infoLogBytes (Charset/forName "UTF-8"))))

 (defn- load-shader
   [^String shader-str ^Integer shader-type]
@@ -698,9 +684,11 @@
         (.clear fg-image-data)
         (.clear bg-image-data)
         (doseq [[layer-id character-map] layers-character-map]
-          (doseq [[row line] (map-indexed vector (reverse @character-map))
-                  [col c]    (map-indexed vector line)]
+        ;;  (doseq [[row line] (map-indexed vector (reverse @character-map))
+        ;;          [col c]    (map-indexed vector line)]
             ;;(log/info "row" row "col" col "c" c)
+        (loop-with-index row [line (reverse @character-map)]
+          (loop-with-index col [c line]
             (let [chr        (char (or (get c :fx-character) (get c :character)))
                   chr        (if (and (= layer-id base-layer-id)
                                       (= chr (char 0)))
@@ -745,7 +733,7 @@
                   (.position bg-image-data (+ 4 (.position bg-image-data)))))))
           (.rewind glyph-image-data)
           (.rewind fg-image-data)
-          (.rewind bg-image-data))
+          (.rewind bg-image-data)))
         (.position glyph-image-data (.limit glyph-image-data))
         (.position fg-image-data (.limit fg-image-data))
         (.position bg-image-data (.limit bg-image-data))


Removed printlns

Removed printlns

--- src/ardoq/swagger/common.clj
+++ src/ardoq/swagger/common.clj
@@ -36,11 +36,7 @@
         (api/create client))))

 (defn generate-operation-description [data models]
-  (println "BEFORE")
-  (clojure.pprint/pprint data)
   (let [data (read-string (replace-newlines data))]
-    (println "AFTER")
-    (clojure.pprint/pprint data)
     (reduce
      (fn [description [model-id {:keys [_id] :as model}]]
        (s/replace description (re-pattern (str "\\|" (name model-id) "\\|")) (str "|[" (name model-id) "](comp://" _id ")|")))


s/.size/doall/

s/.size/doall/

--- src/babel/espanol/writer.clj
+++ src/babel/espanol/writer.clj
@@ -75,18 +75,18 @@
             (log/debug (str "verb: " (strip-refs verb)))
             (let [root-form (get-in verb [:espanol :espanol])]
               (log/info (str "generating with verb: '" root-form "'"))
-              (.size (use-map-fn
+              (doall (use-map-fn
                       (fn [tense]
                         (let [debug (log/debug (str "{:root {:espanol {:espanol " root-form))
                               spec (unify/unify {:root {:espanol {:espanol root-form}}}
                                                 tense)]
-                          (.size
+                          (doall
                            (use-map-fn
                             (fn [gender]
                               (let [spec (unify/unify spec
                                                       {:comp {:synsem {:agr gender}}})]
                                   (log/debug (str "generating from gender: " gender " with spec: " spec))
-                                  (.size
+                                  (doall
                                    (use-map-fn
                                     (fn [person]
                                       (let [debug (log/debug (str "generating from spec(pre-person):" spec))
@@ -116,7 +116,7 @@
                                             ]
                                         (log/debug (str "generating from person: " person))
                                         (log/debug (str "generating from spec+person: " spec))
-                                        (.size
+                                        (doall
                                          (use-map-fn
                                           (fn [number]
                                             (let [debug (log/debug (str "generating from spec(1): " spec))


message type helper has been added

message type helper has been added

--- core/src/cljc/hellhound/message.cljc
+++ core/src/cljc/hellhound/message.cljc
@@ -73,10 +73,15 @@
                     keywords)]
     `(do ~@fns)))

-(defmacro type-helpers
+
+(defmacro make-type-helpers
   [& types]
   (apply make-filter-helpers ::type types))

+
+(defmacro make-helpers
+  [field & keywords]
+  (apply make-filter-helpers field keywords))

 (comment
   (impl/resolvers (enqueue-resolver (create) #(println %)))


consolidate to requires

consolidate to requires

--- src/bitsplit_cli/client.cljs
+++ src/bitsplit_cli/client.cljs
@@ -1,11 +1,8 @@
 (ns bitsplit-cli.client
-    (:use
-        [bitsplit.client.protocol :only
-        (Queries addresses unspent-amounts unspent-channel
-         Operations send-amounts! new-address!)]
-        [bitsplit.storage.protocol :only (all)]
-        [bitsplit-cli.constants :only (DIR)])
-    (:require [bitsplit-cli.client.network :refer (address->unspents)]
+    (:require [bitsplit-cli.client.network :refer (address->unspents urls)]
+              [bitsplit.client.protocol :refer
+                (Queries addresses unspent-amounts unspent-channel
+                 Operations send-amounts! new-address!)]
               [cljs.core.async :as a])
     (:use-macros
         [cljs.core.async.macros :only (go)]))


fix style

fix style

--- src/clj/just_married/css.clj
+++ src/clj/just_married/css.clj
@@ -122,7 +122,7 @@
               :grid-row 3}]

    [:.accommodation {:grid-column 1
-                     :grid-row 3}]
+                     :grid-row 4}]

    [:ul {:list-style "none"}]


Dubbel and rodeo

Dubbel and rodeo

--- src/clj/skidskytte/namer.clj
+++ src/clj/skidskytte/namer.clj
@@ -21,6 +21,7 @@
                 "curling"
                 "cykel"
                 "dart"
+                "dubbel"
                 "dyknings"
                 "diskus"
                 "dragkamps"
@@ -144,6 +145,7 @@
                 "polo"
                 "rally"
                 "rodd"
+                "rodeo"
                 "rodel"
                 "rugby"
                 "segling"


fixed clr for cljs

fixed clr for cljs

--- src/cljc/swarmpit/utils.cljc
+++ src/cljc/swarmpit/utils.cljc
@@ -1,5 +1,5 @@
 (ns swarmpit.utils
-  (:require [flatland.ordered.map :refer [ordered-map]]))
+  #?(:clj (:require[flatland.ordered.map :refer [ordered-map]])))

 (defn remove-el
   "Remove element in `vector` on given `index`"
@@ -48,9 +48,10 @@
   [map]
   (clojure.walk/postwalk
     #(if (map? %)
-       (let [nm (if (instance? flatland.ordered.map.OrderedMap %)
-                  (ordered-map)
-                  {})
+       (let [nm #?(:clj  (if (instance? flatland.ordered.map.OrderedMap %)
+                           (ordered-map)
+                           {})
+                   :cljs {})
              m (into nm (remove (comp empty-or-nil? val) %))]
          (when (seq m) m))
        %)


rename observer -> req-observer

rename observer -> req-observer

--- src/clojure_fabric/proto.clj
+++ src/clojure_fabric/proto.clj
@@ -939,9 +939,9 @@
   (letfn [(send-envelope-via-orderer-using-async [call-fn]
             (let [ch (async/chan 32)
                   callback (envelope-broadcast-observer ch)
-                  ^StreamObserver observer (call-fn (AtomicBroadcastGrpc/newStub ^ManagedChannel (node->channel orderer))
-                                                    callback)]
-              (.onNext observer ^Common$Envelope (clj->proto envelope))
+                  ^StreamObserver req-observer (call-fn (AtomicBroadcastGrpc/newStub ^ManagedChannel (node->channel orderer))
+                                                        callback)]
+              (.onNext req-observer ^Common$Envelope (clj->proto envelope))
               (try
                 (async/go-loop [result []]
                   (let [[v ch] (async/alts! [ch (async/timeout (:orderer-wait-time timeouts))])]
@@ -949,7 +949,7 @@
                           (nil? v) (throw (Exception. "Timeout to send Evelope using orderer"))
                           (instance? Exception v) (throw v)
                           :else (recur (conj result v)))))
-                (finally (.onCompleted observer)))))]
+                (finally (.onCompleted req-observer)))))]
     (async/<!!
      (send-envelope-via-orderer-using-async
       (case call-type


set gen-class in com.okl.tokenmgr.cli

set gen-class in com.okl.tokenmgr.cli

--- src/com/okl/tokenmgr/cli.clj
+++ src/com/okl/tokenmgr/cli.clj
@@ -1,4 +1,5 @@
 (ns com.okl.tokenmgr.cli
+  (:gen-class)
   (:require [clojure.java.io :as io]
             [clojure.tools.logging :as log]
             [clojure.string :as string]


minor improvement to logging

minor improvement to logging

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

--- acqEngine/src/org/micromanager/mm.clj
+++ acqEngine/src/org/micromanager/mm.clj
@@ -32,11 +32,12 @@
   (org.micromanager.utils.ReportingUtils/logMessage (apply str x)))

 (defmacro log-cmd [expr]
-  `(let [result# ~expr]
-     (if (nil? result#)
-       (log '~expr " -> nil")
-       (log '~expr " -> " result#))
-     result#))
+  `(do (log '~expr)
+    (let [result# ~expr]
+      (if (nil? result#)
+        (log "  --> nil")
+        (log "  --> " result#))
+      result#)))

 (defmacro core [& args]
   `(log-cmd (. mmc ~@args)))


Add backa line I accidently nuked

Add backa line I accidently nuked

--- src/ctia/schemas/graphql.clj
+++ src/ctia/schemas/graphql.clj
@@ -640,7 +640,7 @@
       (add-describable-entity-fields)
       (add-relatable-entity-fields)
       ;; add the fields here
-)
+      (.build)))

 ;; ID needs to be base64 encoded here, since it's opaque, verdicts only have an ID


use html dropdown value fields

use html dropdown value fields

--- src/day8/re_frame/trace.cljs
+++ src/day8/re_frame/trace.cljs
@@ -196,11 +196,10 @@
          [:div.filter-control {:style {:margin-bottom 20}}
            [:div.filter-control-input
             {:style {:margin-bottom 10}}
-            [:select {:value @filter-type :on-change (fn [e]
-                                                         (reset! filter-type
-                                                                 (keyword (str/replace (.. e -target -value) " " "-"))))}
-             [:option :contains]
-             [:option :slower-than]]
+            [:select {:value @filter-type
+                      :on-change #(reset! filter-type (keyword (.. % -target -value)))}
+             [:option {:value "contains"} "contains"]
+             [:option {:value "slower-than"} "slower than"]]
             [search-input {:on-save save-query
                            :on-change #(reset! filter-input (.. % -target -value))}]
             [:button.button.icon-button {:on-click save-query


Fix logic for hiding details

Fix logic for hiding details

--- src/day8/re_frame/trace.cljs
+++ src/day8/re_frame/trace.cljs
@@ -149,6 +149,8 @@
     (for [{:keys [op-type id operation tags duration] :as trace} showing-traces]
       (let [padding   {:padding "0px 5px 0px 5px"}
             row-style (merge padding {:border-top (case op-type :event "1px solid lightgrey" nil)})
+            show?     (get-in @trace-detail-expansions [:overrides id]
+                              (:showing @trace-detail-expansions))
             #_#__ (js/console.log (devtools/header-api-call tags))]
         (list [:tr {:key   id
                     :style {:color (case op-type
@@ -160,13 +162,10 @@
                                      nil)}}
                [:td {:style (merge row-style {:cursor "pointer"})
                      :on-click (fn [e]
-                                 (when (:showing @trace-detail-expansions)
-                                   (swap! trace-detail-expansions assoc :showing false))
+                                 (when show?
+                                   (swap! trace-detail-expansions assoc-in [:overrides id] true))
                                  (swap! trace-detail-expansions update-in [:overrides id] not))}
-                (if (or (get-in @trace-detail-expansions [:overrides id])
-                        (:showing @trace-detail-expansions))
-                  "▼"
-                  "▶")]
+                (if show? "▼" "▶")]
                [:td {:style row-style} (str op-type)]
                [:td {:style row-style} (if (= PersistentVector (type (js->clj operation)))
                                          (second operation)
@@ -179,12 +178,9 @@
                                           :white-space "nowrap"})}

                 (.toFixed duration 1) " ms"]]
-              (when (or (get-in @trace-detail-expansions [:overrides id])
-                        (:showing @trace-detail-expansions))
+              (when show?
                 [:tr {:key (str id "-details")}
                  [:td {:col-span 3} (with-out-str (pprint/pprint (dissoc tags :query-v :event :duration)))]]))))))
-
-

 (defn render-trace-panel []
   (let [filter-input               (r/atom "")


More status register accessor/setter fixes

--- src/emm_ess_pee/computer.clj
+++ src/emm_ess_pee/computer.clj
@@ -87,22 +87,22 @@
   (set-SR computer (set-bit (SR computer) 2 value)))

 (defn set-GIE [computer value]
-  (set-SR computer (set-bit (SR computer 3) value)))
+  (set-SR computer (set-bit (SR computer) 3 value)))

 (defn set-CPUOFF [computer value]
-  (set-SR computer (set-bit (SR computer 4) value)))
+  (set-SR computer (set-bit (SR computer) 4 value)))

 (defn set-OSCOFF [computer value]
-  (set-SR computer (set-bit (SR computer 5) value)))
+  (set-SR computer (set-bit (SR computer) 5 value)))

 (defn set-SCG0 [computer value]
-  (set-SR computer (set-bit (SR computer 6) value)))
+  (set-SR computer (set-bit (SR computer) 6 value)))

 (defn set-SCG1 [computer value]
-  (set-SR computer (set-bit (SR computer 7) value)))
+  (set-SR computer (set-bit (SR computer) 7 value)))

 (defn set-V [computer value]
-  (set-bit computer (SR computer 8) value))
+  (set-SR computer (set-bit (SR computer) 8 value)))

 (def register-names [:pc :sp :sr :r3 :r4 :r5 :r6 :r7 :r8 :r9 :r10 :r11 :r12 :r13 :r14 :r15])


Expose service

Expose service

--- src/b3api/core.clj
+++ src/b3api/core.clj
@@ -114,5 +114,5 @@
   (log/info "Starting server on 8080...")
   ;; wrap-defaults is middleware magic: takes requests and routes them
   (run-server (wrap-defaults all-routes api-defaults)
-              {:ip "localhost"
+              {:ip "0.0.0.0"
                :port 8080}))


Rename cmds to cmd-ch.

Rename cmds to cmd-ch.

--- src/cbfg/core.cljs
+++ src/cbfg/core.cljs
@@ -276,7 +276,7 @@

 ;; ------------------------------------------------

-(defn vis-init [cmds cmd-handlers el-prefix]
+(defn vis-init [cmd-ch cmd-handlers el-prefix]
   (let [max-inflight (atom 10)
         event-delay (atom 0)
         event-ch (chan)
@@ -329,7 +329,7 @@
          (let [in-ch (achan-buf world 100)
                out-ch (achan-buf world 0)]
            (ago-loop user-in world [num-ins 0]
-                     (let [cmd (<! cmds)
+                     (let [cmd (<! cmd-ch)
                            cmd-handler ((get cmd-handlers (:op cmd)) cmd)]
                        (aput user-in in-ch cmd-handler)
                        (recur (inc num-ins))))


Update finance.clj (#227)

Update finance.clj (#227)

trying to contribute in Indonesia Corpus

--- resources/languages/id/corpus/finance.clj
+++ resources/languages/id/corpus/finance.clj
@@ -30,6 +30,7 @@
 "20 Euro"
 "20 Euros"
 "EUR 20"
+"dua puluh Euro"
 (money 20 "EUR")

 "EUR29,99"


Fix CLI to only warn if no config file is present.

--- src/degasolv/cli.clj
+++ src/degasolv/cli.clj
@@ -366,9 +366,9 @@
       errors (exit 1 (string/join
                       \newline
                       [(error-msg errors)
-                      ""
-                      (usage summary)
-                      ""
+                       ""
+                       (usage summary)
+                       ""
                        (command-list (keys subcommand-cli))
                        ""])))
     (let [global-options options
@@ -378,26 +378,27 @@
         (exit 1 (error-msg [(str "Unknown command: " subcommand)])))
       (let [{:keys [options arguments errors summary]}
             (parse-opts arguments (concat
-                              (:cli subcmd-cli)
-                              [["-h" "--help" "Print this help page"]]))]
+                                   (:cli subcmd-cli)
+                                   [["-h" "--help" "Print this help page"]]))]
         (cond
           (:help options) (exit 0 (usage summary :sub-command subcommand))
           errors (exit 1 (string/join
                           \newline
                           [(error-msg errors :sub-command subcommand)
-                          ""
-                          (usage summary :sub-command subcommand)
-                          ""])))
-        ((:function subcmd-cli)
+                           ""
+                           (usage summary :sub-command subcommand)
+                           ""])))
+          ((:function subcmd-cli)
            (merge
-             (try
-               (tag/read-string
-                 (default-slurp
-                   (:config-file global-options)))
-               (catch Exception e
-                 (exit 1 (error-msg [(str "Problem reading configuration file `"
-                                          (:config-file global-options)
-                                          "`: "
-                                          (.getMessage e))]))))
-             options)
-         arguments)))))
+            (try
+              (tag/read-string
+               (default-slurp
+                (:config-file global-options)))
+              (catch Exception e
+                (binding [*out* *err*]
+                  (println "Warning: problem reading config file `"
+                           (str (:config-file global-options))
+                           "`, configuration file not used."))
+                {}))
+            options)
+           arguments)))))


Changed deprecated clj-time function in-secs to in-seconds

--- ring-core/src/ring/middleware/cookies.clj
+++ ring-core/src/ring/middleware/cookies.clj
@@ -2,7 +2,7 @@
   "Cookie manipulation."
   (:require [ring.util.codec :as codec]
             [clojure.string :as str])
-  (:use [clj-time.core :only (in-secs)]
+  (:use [clj-time.core :only (in-seconds)]
         [clj-time.format :only (formatters unparse)]
         [ring.util.parsing :only (re-token re-value)])
   (:import (org.joda.time Interval DateTime)))
@@ -74,7 +74,7 @@
   (for [[key value] attrs]
     (let [attr-name (name (set-cookie-attrs key))]
       (cond
-       (instance? Interval value) (str ";" attr-name "=" (in-secs value))
+       (instance? Interval value) (str ";" attr-name "=" (in-seconds value))
        (instance? DateTime value) (str ";" attr-name "=" (unparse (formatters :rfc822) value))
        (true? value)  (str ";" attr-name)
        (false? value) ""


little refactoring on api

little refactoring on api

--- src/dwc_rest/api.clj
+++ src/dwc_rest/api.clj
@@ -13,39 +13,41 @@
    :archive "application/zip"
    :xlsx "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"})

-(defn res
+(defn safe
+  ""
+  [fun]
+   (try (fun)
+    (catch Exception e
+      (do (.printStackTrace e)
+        {:status 500 :body (str "Server error: " (.getMessage e))}))))
+
+(defn convert-api
   ""
   [params]
-  (try
     (if-let [url (:url params)]
       (if-let [from (:from params)]
         (if-let [to (:to params)]
           (if-let [hook (:hook params)]
             (do
               (future
-                (http/post hook {:body (convert {:from from :to to :source url})
+                (http/post hook {:body (convert {:from from :to to :source url :fixes (:fixes params)})
                                   :headers {"Content-Type" (get ctypes to)}}))
               {:status 200 :body "ok"})
             {:status 200
              :headers {"Content-Disposition" (str "attachment; filename=\"dwc." to "\"")
                        "Content-Type" (get ctypes to)}
-             :body (convert {:from from :to to :source url})})
+             :body (convert {:from from :to to :source url :fixes (:fixes params)})})
           {:status 400 :body "Must provide 'to' parameter of the output format."})
         {:status 400 :body "Must provide 'from' parameter of the input format."})
-     {:status 400 :body "Must provide 'url' parameter of data source."})
-    (catch Exception e
-      (do (.printStackTrace e)
-        {:status 500 :body (str "Server error: " (.getMessage e))}))
-    )
-  )
+     {:status 400 :body "Must provide 'url' parameter of data source or data as input."}))

 (defroutes  api-v1-routes

   (GET "/convert" req
-   (res (:params req)))
+   (safe #(convert-api (:params req))))

   (POST "/convert" req
-    (res (assoc (:params req) :url (:body req))))
+    (safe #(convert-api (assoc (:params req) :url (:body req)))))

 )


Animate deletion of card

Animate deletion of card

--- frontend/src/faceboard/commands.cljs
+++ frontend/src/faceboard/commands.cljs
@@ -211,9 +211,14 @@
         (model/set [:ui :gizmo :position] position)))))

 (defmethod handle-command :delete-card [_ path]
-  (transform-app-state
-    (model/set [:ui :editing?] false)
-    (model/dissoc path)))
+  (go
+    (transform-app-state
+      (model/set [:ui :editing?] false))
+    (<! (timeout 1000))
+    (router/switch-person nil)
+    (<! (timeout 1000))
+    (transform-app-state
+      (model/dissoc path))))

 (defmethod handle-command :clear-card [_ path]
   (transform-app-state


remove dead code

remove dead code

--- src/fat_jar/core.clj
+++ src/fat_jar/core.clj
@@ -44,7 +44,6 @@
       (errors? options) (do (print-help options) (println (:errors options)))
       (help? options) (print-help options)
       :else (do
-        (println options)
         (let [mappings (->> (config :input.mappings)
                      slurp
                      edn/read-string)


refactor the env variable handling

refactor the env variable handling

and detect docker links for the datomic uri

--- src/goodbot/core.clj
+++ src/goodbot/core.clj
@@ -7,26 +7,36 @@
             [goodbot.plugins.data]
             [goodbot.plugins.help]))

-(def host     (or (System/getenv "GOODBOT_HOST")    "irc.freenode.net"))
-(def port     (or (System/getenv "GOODBOT_PORT")    6667))
-(def nick     (or (System/getenv "GOODBOT_NICK")    "goodbot-test"))
-(def channel  (or (System/getenv "GOODBOT_CHANNEL") "#goodbot-test"))
-(def server-password (or (System/getenv "GOODBOT_SERVER_PASSWORD") nil))
-(def password (or (System/getenv "GOODBOT_PASSWORD") nil))
-(def datomic-uri (or (System/getenv "GOODBOT_DATOMIC") "datomic:mem://goodbot"))
-
 (defn -main
   "Starts the bot"
   [& args]
-  (goodbot.bot/start [goodbot.plugins.ping/plugin
-                      goodbot.plugins.clojure/plugin
-                      goodbot.plugins.karma/plugin
-                      goodbot.plugins.data/plugin
-                      goodbot.plugins.help/plugin]
+  (let [[host port] (-> (System/getenv "GOODBOT_HOST")
+                        (or "irc.freenode.net:6667")
+                        (.split ":" 2))
+        channels (-> (System/getenv "GOODBOT_CHANNELS")
+                     (or "#goodbot-test")
+                     (.split ",")
+                     vec)
+        nick (-> (System/getenv "GOODBOT_NICK") (or "goodbot-test"))
+        server-password (System/getenv "GOODBOT_SERVER_PASSWORD")
+        password (System/getenv "GOODBOT_PASSWORD")
+        datomic-uri (-> (System/getenv "GOODBOT_DATOMIC")
+                        ; detect docker link
+                        (or (when-let [link-uri (System/getenv "TRANSACTOR_PORT")]
+                              (-> link-uri
+                                  (.replace "tcp" "datomic:free")
+                                  (str "/goodbot"))))
+                        ; default to in-memory
+                        (or "datomic:mem://goodbot"))]
+    (goodbot.bot/start [goodbot.plugins.ping/plugin
+                        goodbot.plugins.clojure/plugin
+                        goodbot.plugins.karma/plugin
+                        goodbot.plugins.data/plugin
+                        goodbot.plugins.help/plugin]
                        :host host
-                       :port port
+                       :port (Integer/parseInt port)
                        :nick nick
                        :password password
-                       :channels [channel]
+                       :channels channels
                        :server-password server-password
-                       :datomic-uri datomic-uri))
+                       :datomic-uri datomic-uri)))


Document api/read-examples

Document api/read-examples

--- src/grimoire/api.clj
+++ src/grimoire/api.clj
@@ -80,8 +80,10 @@
   dispatch)

 (defmulti read-examples
-  "Returns a sequence of pairs [version example-text] for all examples on prior
-  or equal versions of the given thing."
+  "Succeeds with a result Seq[Tuple[version, example-text]] for all examples on
+  prior or equal versions of the given thing sorted in decending version
+  order. Will Fail if the given Def does not exist, or if a nested Failure is
+  encountered."

   {:arglists '[[config def-thing]]}
   dispatch)


More docstring whitespace

More docstring whitespace

--- src/grimoire/doc.clj
+++ src/grimoire/doc.clj
@@ -205,7 +205,7 @@

 (defn -main
   "Usage: lein grim [src|:src|source|:source] <platform> <dst>
-     : lein grim [artifact|:artifact] <platform> <groupid> <artifactid> <version> <dst>
+     : lein grim [artifact|:artifact]      <platform> <groupid> <artifactid> <version> <dst>

   In source mode, lein-grim traverses the source paths of the current project,
   enumerating and documenting all namespaces. This is intended for documenting


Reduced default max number of Jetty threads to 50

Cloud environments like Heroku tend to have limit how many native threads
you can have per process. Setting a lower default value means people won't
be caught out as easily.

--- ring-jetty-adapter/src/ring/adapter/jetty.clj
+++ ring-jetty-adapter/src/ring/adapter/jetty.clj
@@ -72,7 +72,7 @@
   :key-password - the password to the keystore
   :truststore   - a truststore to use for SSL connections
   :trust-password - the password to the truststore
-  :max-threads  - the maximum number of threads to use (default 250)
+  :max-threads  - the maximum number of threads to use (default 50)
   :client-auth  - SSL client certificate authenticate, may be set to :need,
                   :want or :none (defaults to :none)"
   [handler options]
@@ -81,7 +81,7 @@
       (configurator s))
     (doto s
       (.setHandler (proxy-handler handler))
-      (.setThreadPool (QueuedThreadPool. (options :max-threads 250)))
+      (.setThreadPool (QueuedThreadPool. (options :max-threads 50)))
       (.start))
     (when (:join? options true)
       (.join s))


remove debug

remove debug

--- src/harland/core.clj
+++ src/harland/core.clj
@@ -8,7 +8,6 @@
              [org.httpkit.server :refer [run-server]]))

 (defn build-project [request]
-  (debug)
   (build/schedule-build "harland"))

 (defn status [request]


Don't blow up - proceed to error handling

--- src/midje/parsing/2_to_lexical_maps/folded_fakes.clj
+++ src/midje/parsing/2_to_lexical_maps/folded_fakes.clj
@@ -53,6 +53,7 @@
   (defn folded-fake? [form]
     (and (sequential? form)
          (= 'midje.semi-sweet/fake (first form))
+         (sequential? (second form))
          (some mockable-funcall? (fake-form-funcall-arglist form)))))

 (defn generate-fakes [substitutions overrides]


Add Cache-Control to Workbook Resources

Add Cache-Control to Workbook Resources

Workbooks can't be cached because they can change every time. I also
improved the ETag to include the context-path and media-type.

--- src/lens/handler.clj
+++ src/lens/handler.clj
@@ -2,7 +2,7 @@
   (:use plumbing.core)
   (:require [clojure.string :as str]
             [clojure.core.async :refer [<!! timeout]]
-            [liberator.core :refer [resource]]
+            [liberator.core :refer [resource negotiate-media-type]]
             [liberator.representation :refer [as-response]]
             [pandect.algo.md5 :refer [md5]]
             [lens.handler.util :refer :all]
@@ -47,6 +47,15 @@
       (find-workbook-form (path-for :find-workbook-handler))}}))

 ;; ---- Workbook --------------------------------------------------------------
+
+(defn workbook-etag [path-for media-type workbook]
+  (let [head (:workbook/head workbook)]
+    (str (md5 (str media-type
+                   (path-for :service-document-handler)
+                   (workbook-path path-for workbook)
+                   (version/path path-for head)))
+         ";"
+         (:version/id head))))

 (defn update-workbook-form [path-for workbook]
   {:action (workbook-path path-for workbook)
@@ -70,34 +79,54 @@

 (defn get-workbook-handler [path-for]
   (resource
-    (resource-defaults)
+    (resource-defaults :cache-control "no-cache")

     :exists?
     (fnk [db [:request [:params id]]]
       (when-let [workbook (api/workbook db id)]
         {:workbook workbook}))

-    :etag (fn [{:keys [workbook]}] (-> workbook :workbook/head :version/id))
+    :etag
+    (fnk [[:representation media-type] & more]
+      (when-let [workbook (:workbook more)]
+        (workbook-etag path-for media-type workbook)))

     :handle-ok
     (fnk [workbook] (render-workbook path-for workbook))

     :handle-not-found
     (error-body path-for "Workbook not found.")))
+
+(defn- extract-version-id [etag]
+  (second (str/split etag #";")))
+
+(defn- neg-media-type [req]
+  (-> {:request req
+       :resource {:available-media-types
+                  (constantly (:available-media-types (resource-defaults)))}}
+      (negotiate-media-type)
+      (:representation)
+      (:media-type)))
+
+(defn- etag-header [etag-value]
+  {"etag" (str "\"" etag-value "\"")})

 (defn put-workbook-handler [path-for]
   (fnk [conn [:params id] headers :as req]
     (if-let [new-version-id (:version-id (:params req))]
-      (if-let [old-version-id (some-> (headers "if-match") decode-etag)]
+      (if-let [old-version-id (some-> (headers "if-match")
+                                      decode-etag
+                                      extract-version-id)]
         (try
           (let [wb (api/update-workbook! conn id old-version-id new-version-id)]
             {:status 204
-             :headers {"etag" (str "\"" (:version/id (:workbook/head wb)) "\"")}})
+             :headers (etag-header (workbook-etag path-for (neg-media-type req) wb))})
           (catch Exception e
             (condp = (:type (ex-data e))
               :lens.schema/workbook-not-found (error path-for 404 "Workbook not found.")
               :lens.schema/precondition-failed (error path-for 412 "Precondition failed.")
-              :lens.schema/version-not-found (error path-for 422 "Version doesn't exist."))))
+              :lens.schema/version-not-found (error path-for 422 "Version doesn't exist.")
+              (throw e))))
         (error path-for 428 "Precondition required."))
       (error path-for 422 "Version id is missing."))))

@@ -172,7 +201,7 @@

 (defn find-workbook-handler [path-for]
   (resource
-    (resource-defaults)
+    (resource-defaults :cache-control "no-cache")

     :processable?
     (fnk [[:request params]]
@@ -183,7 +212,10 @@
       (when-let [workbook (api/workbook db id)]
         {:workbook workbook}))

-    :etag (fn [{:keys [workbook]}] (-> workbook :workbook/head :version/id))
+    :etag
+    (fnk [[:representation media-type] & more]
+      (when-let [workbook (:workbook more)]
+        (workbook-etag path-for media-type workbook)))

     :handle-ok
     (fnk [workbook] (render-workbook path-for workbook))


ui: remove auto correct from passphrase recover

--- src/status_im/ui/screens/accounts/recover/views.cljs
+++ src/status_im/ui/screens/accounts/recover/views.cljs
@@ -32,6 +32,7 @@
       :placeholder         (i18n/label :t/enter-12-words)
       :multiline           true
       :default-value       passphrase
+      :auto-correct        false
       :on-change-text      #(re-frame/dispatch [:set-in [:accounts/recover :passphrase] %])
       :error               error}]))

@@ -67,4 +68,4 @@
          {:forward?  true
           :label     (i18n/label :t/sign-in)
           :disabled? (not valid-form?)
-          :on-press  #(re-frame/dispatch [:recover-account passphrase password])}]]])))+          :on-press  #(re-frame/dispatch [:recover-account passphrase password])}]]])))


alignment of uses

alignment of uses

--- src/nonaga/draw.cljs
+++ src/nonaga/draw.cljs
@@ -1,11 +1,11 @@
 (ns nonaga.draw
   (:use [nonaga.react :only [div p svg create-class render-component]]
-        [nonaga.draw.instructions :only [instructions]]
-        [nonaga.draw.marble-selected :only [draw-valid-marble-moves]]
-        [nonaga.draw.draw-marbles :only [draw-marbles]]
-        [nonaga.draw.draw-rings :only [draw-rings]]
+        [nonaga.draw.instructions         :only [instructions]]
+        [nonaga.draw.marble-selected      :only [draw-valid-marble-moves]]
+        [nonaga.draw.draw-marbles         :only [draw-marbles]]
+        [nonaga.draw.draw-rings           :only [draw-rings]]
         [nonaga.draw.draw-potential-rings :only [draw-potential-rings]]
-        [nonaga.draw.draw-last-ring :only [draw-last-ring]])
+        [nonaga.draw.draw-last-ring       :only [draw-last-ring]])
   (:require [nonaga.core :as n]))

 (def board


Allow singular unit names.

Allow singular unit names.

--- src/onyx/schema.cljc
+++ src/onyx/schema.cljc
@@ -264,10 +264,11 @@
   (s/enum :accumulating :discarding))

 (def TriggerPeriod
-  (s/enum :milliseconds :seconds :minutes :hours :days))
+  (s/enum :milliseconds :seconds :minutes :hours :days
+          :mullisecond :second :minute :hour :day))

 (def TriggerThreshold
-  (s/enum :elements))
+  (s/enum :elements :element))

 (def UnsupportedTriggerKey
   (s/pred (fn [k]


Tighten the cache a bit and add some logging

--- src/pedantic/aws.clj
+++ src/pedantic/aws.clj
@@ -1,6 +1,7 @@
 (ns pedantic.aws
   (:require [amazonica.aws.securitytoken :as sts]
             [clojure.core.memoize :as memo]
+            [clojure.tools.logging :refer [info]]
             [environ.core :refer [env]]
             [pedantic
              [environments :as environments]
@@ -33,16 +34,21 @@
   [account-id]
   (format "arn:aws:iam::%s:role/%s" account-id role-name))

-(defn- alternative-credentials-if-necessary*
+(defn- assume-role*
+  [account-id]
+  (info "Assuming role")
+  (:credentials (guarded (sts/assume-role :duration-seconds (to-millis (+ credentials-ttl 5)) :role-arn (role-arn account-id) :role-session-name "pedantic"))))
+
+(def assume-role
+  (if credentials-ttl-enabled?
+    (memo/ttl assume-role* :ttl/threshold (to-millis credentials-ttl))
+    assume-role*))
+
+(defn alternative-credentials-if-necessary
   [environment-name]
   (let [account-id (environments/account-id environment-name)]
     (when-not (= account-id (id/current-account-id))
-      (:credentials (guarded (sts/assume-role :duration-seconds (to-millis (+ credentials-ttl 5)) :role-arn (role-arn account-id) :role-session-name "pedantic"))))))
-
-(def alternative-credentials-if-necessary
-  (if credentials-ttl-enabled?
-    (memo/ttl alternative-credentials-if-necessary* :ttl/threshold (to-millis credentials-ttl))
-    alternative-credentials-if-necessary*))
+      (assume-role account-id))))

 (defn config
   []


fixed NCHDA links top of What,Why,How

fixed NCHDA links top of What,Why,How


adding tracing

adding tracing

--- src/proxmox/auth.clj
+++ src/proxmox/auth.clj
@@ -45,6 +45,7 @@
       (throw (ExceptionInfo. "Illegal request, check query params" (proxmox-conf))))))

 (defn fetch-headers []
+  (trace "Refetching auth headers")
   (let [{:keys [CSRFPreventionToken ticket]} (login)]
     {"Cookie" (str "PVEAuthCookie=" ticket) "CSRFPreventionToken" CSRFPreventionToken}))


added text-area function

added text-area function

--- src/re_com/core.cljs
+++ src/re_com/core.cljs
@@ -50,7 +50,9 @@
    {:name :disabled?        :required false                  :type "boolean"    :description "Set to true to disable the input box (can be atom or value)."}
    {:name :class            :required false                  :type "string"     :description "additional CSS classes required."}
    {:name :style            :required false                  :type "map"        :description "CSS styles to add or override."}
-   {:name :attr             :required false                  :type "map"        :description "html attributes to add or override (:class/:style not allowed)."}])
+   {:name :attr             :required false                  :type "map"        :description "html attributes to add or override (:class/:style not allowed)."}
+   {:name :input-type       :required true                   :type "keyword"    :description "either :input or :textarea (only applies to super function gen-input-text"}
+   ])

 (def input-text-args
   (set (map :name input-text-args-desc)))
@@ -62,9 +64,9 @@
 ;;  - #"^[0-9a-fA-F]*$"                    ;; Hex number
 ;;  - #"^(\d{0,2})()()$|^(\d{0,1})(:{0,1})(\d{0,2})$|^(\d{0,2})(:{0,1})(\d{0,2})$" ;; Time input

-(defn input-text
-  "Returns markup for a basic text imput label"
-  [& {:keys [model] :as args}]
+(defn gen-input-text
+  "Returns markup for a basic text input label"
+  [& {:keys [model input-type] :as args}]
   {:pre [(validate-arguments input-text-args (keys args))]}
   (let [external-model (reagent/atom (deref-or-value model))  ;; Holds the last known external value of model, to detect external model changes
         internal-model (reagent/atom (if (nil? @external-model) "" @external-model))] ;; Create a new atom from the model to be used internally (avoid nil)
@@ -90,7 +92,7 @@
                               (when (and status status-icon?) "has-feedback"))
                   :style {:flex          "none"
                           :margin-bottom "0px"}}
-                 [:input
+                 [input-type
                   (merge
                     {:class       (str "form-control " class)
                      :type        "text"
@@ -133,6 +135,13 @@
                                 :height       "auto"}
                         :title status-tooltip}])]]))))

+(defn input-text
+    [& args]
+    (apply gen-input-text :input-type :input args))
+
+(defn text-area
+    [& args]
+    (apply gen-input-text :input-type :textarea args))

 ;; ------------------------------------------------------------------------------------
 ;;  Component: button


Fix the session refresh URL in the client.

--- src/shale/client.clj
+++ src/shale/client.clj
@@ -9,19 +9,19 @@
         [clojure.set :only [rename-keys]]
         shale.utils))

-(def sessions-url
+(def ^:private sessions-url
   (clojure.string/join "/" ["http://localhost:5000" "sessions"]))

-(def nodes-url
+(def ^:private nodes-url
   (clojure.string/join "/" ["http://localhost:5000" "nodes"]))

-(defn session-url [id]
+(defn ^:private session-url [id]
   (clojure.string/join "/" [sessions-url id]))

-(defn session-by-webdriver-url [webdriver-id]
+(defn ^:private session-by-webdriver-url [webdriver-id]
   (clojure.string/join "/" [sessions-url "webdriver" webdriver-id]))

-(defn map->session-url [m-or-id]
+(defn ^:private map->session-url [m-or-id]
   (if (map? m-or-id)
     (if (contains? m-or-id :webdriver-id)
       (session-by-webdriver-url (:webdriver-id m-or-id))
@@ -106,7 +106,8 @@

 (defn refresh-sessions! []
   (let [response (try+
-                   (client/post (str sessions-url "refresh") {})
+                   (client/post
+                     (clojure.string/join "/" [sessions-url "refresh"]) {})
                    (catch [:status 400] {:keys [body]} (error body) (throw+)))]
     (json/parse-string (response :body))))


:bug: Fixes problem when moving shapes in group on layers

--- frontend/src/uxbox/main/data/workspace.cljs
+++ frontend/src/uxbox/main/data/workspace.cljs
@@ -1237,6 +1237,9 @@
   (us/verify number? index)

   (ptk/reify ::relocate-shape
+    IUpdateGroup
+    (get-ids [_] [id])
+
     ptk/WatchEvent
     (watch [_ state stream]
       (let [page-id (:current-page-id state)


change build name

change build name

--- src/ci3/server.clj
+++ src/ci3/server.clj
@@ -58,10 +58,18 @@

 (def cfg {:apiVersion "ci3.io/v1" :ns "default"})

+
+(defn cleanup [s]
+  (-> s
+      (str/replace  #"\/" "-")
+      (str/replace  #"\_" "-")
+      (str/replace  #"\:" "-")))
+
 (defn create-build [payload]
   (let [repository (:repository payload)
         commit (last (:commits payload))
-        hashcommit (:id commit) ]
+        hashcommit (:id commit)
+        build-name (cleanup (str (:full_name repository) "-" hashcommit)) ]
     {:body (k8s/create cfg :builds
                        {:kind "Build"
                         :apiVersion "ci3.io/v1"
@@ -70,7 +78,7 @@
                                   :diff (:compare payload)
                                   :repository (select-keys repository
                                                            [:name :organization :full_name
-                                                            :html_url :git_url :ssh_url
+                                                            :url :html_url :git_url :ssh_url
                                                             ]
                                                            )
                                   :commit (select-keys commit


Fix dict creating

Fix dict creating

--- src/cljam/dict.clj
+++ src/cljam/dict.clj
@@ -2,7 +2,6 @@
   "Alpha - subject to change.
   Generator of a FASTA sequence dictionary file."
   (:require [clojure.java.io :refer [file writer]]
-            [clojure.string :as str]
             [cljam.common :refer [version]]
             [cljam.fasta :as fasta]
             [cljam.util :refer [string->bytes]])
@@ -19,11 +18,19 @@
         (str (subs "00000000000000000000000000000000" 0 (- 32 (count s))) s)
         s))))

+(def ^:private upper-case-offset
+  (- (byte \A) (byte \a)))
+
+(defn- upper-case [b]
+  (if (or (< b (byte \a)) (> b (byte \z)))
+    b
+    (byte (+ b upper-case-offset))))
+
 (defn- make-hash [seq]
-  (let [bases (string->bytes seq)]
+  (let [bases ^bytes (string->bytes seq)]
     (loop [i 0]
       (when (< i (count bases))
-        (aset ^bytes bases i ^byte (str/upper-case (nth bases i)))
+        (aset bases i ^byte (upper-case (nth bases i)))
         (recur (inc i))))
     (md5-hash bases)))

@@ -44,7 +51,7 @@
   file (.fasta/fa)."
   [fasta out-dict]
   (let [ur (.toString (.toURI (file fasta)))]
-   (with-open [r ^RandomAccessFile (fasta/reader fasta)
+   (with-open [r ^cljam.fasta.reader.FASTAReader (fasta/reader fasta)
                w ^BufferedWriter (writer out-dict)]
      (write-header w)
      (doseq [sq (fasta/read r)]


Explicitly require clojure.set to avoid compilation error

Signed-off-by: Gregory Haskins <640d9fe47775e6723f0355b7315e38f7d98d3539@gmail.com>

--- src/obcc/build/interface.clj
+++ src/obcc/build/interface.clj
@@ -6,6 +6,7 @@
             [clojure.zip :as zip]
             [clojure.walk :as walk]
             [clojure.string :as string]
+            [clojure.set :as set]
             [instaparse.core :as insta]
             [obcc.config.parser :as config]))

@@ -30,7 +31,7 @@
 ;; aggregate all of the interfaces declared in the config
 ;;-----------------------------------------------------------------
 (defn getinterfaces [config]
-  (into '() (clojure.set/union (getprovides config) (getconsumes config))))
+  (into '() (set/union (getprovides config) (getconsumes config))))

 (defn filename [intf]
   (str intf ".cci"))


formatting

formatting

--- src/overtone/gui/control.clj
+++ src/overtone/gui/control.clj
@@ -13,23 +13,23 @@
         to-max   (double to-max)
         v        (double v)]
     (+ to-min
-     (* (/ (- v from-min)
-           (- from-max from-min))
-        (- to-max to-min)))))
+       (* (/ (- v from-min)
+             (- from-max from-min))
+          (- to-max to-min)))))

 (defn- control-slider
   [name min-val max-val step val-atom]
   (let [init-val   @val-atom
-        ;_ (println (str name) ": " init-val min-val max-val step)
+                                        ;_ (println (str name) ": " init-val min-val max-val step)
         spin-model  (spinner-model (double init-val)
                                    :from (double min-val)
                                    :to (double max-val)
                                    :by (double step))
         spinner     (spinner-label
-                      :class :synth-control-spinner
-                      :halign :center
-                      :border (line-border :thickness 1 :color :darkgrey)
-                      :model spin-model)
+                     :class :synth-control-spinner
+                     :halign :center
+                     :border (line-border :thickness 1 :color :darkgrey)
+                     :model spin-model)
         slider-max  (int (/ (- max-val min-val) step))
         scaled-init (scale-val [min-val max-val] [0 slider-max] init-val)
         slider      (slider :class :synth-control-slider
@@ -40,98 +40,98 @@
                 [spinner "width 80:80:80"]
                 [slider "wrap"]]]

-    ; return 2 element vector of items and cleanup function. hmmm.
+                                        ; return 2 element vector of items and cleanup function. hmmm.
     [items
      (juxt
-       (bind/bind
-         slider
-         (bind/transform (partial scale-val [0 slider-max] [min-val max-val]))
-         val-atom
-         (bind/transform (partial scale-val [min-val max-val] [0 slider-max]))
-         ; if the value's "close enough" to the spinner, stop. Otherwise,
-         ; we get infinite loops caused by rounding error.
-         (bind/filter #(>= (Math/abs (- % (value slider))) 0.01))
-         slider)
+      (bind/bind
+       slider
+       (bind/transform (partial scale-val [0 slider-max] [min-val max-val]))
+       val-atom
+       (bind/transform (partial scale-val [min-val max-val] [0 slider-max]))
+                                        ; if the value's "close enough" to the spinner, stop. Otherwise,
+                                        ; we get infinite loops caused by rounding error.
+       (bind/filter #(>= (Math/abs (- % (value slider))) 0.01))
+       slider)

-       (bind/bind
-         spinner
-         val-atom
-         ; if the value's "close enough" to the slider, stop. Otherwise,
-         ; we get infinite loops caused by rounding error.
-         (bind/filter #(>= (Math/abs (- % (value spinner))) 0.01))
-         spinner))]))
+      (bind/bind
+       spinner
+       val-atom
+                                        ; if the value's "close enough" to the slider, stop. Otherwise,
+                                        ; we get infinite loops caused by rounding error.
+       (bind/filter #(>= (Math/abs (- % (value spinner))) 0.01))
+       spinner))]))

 (defn synth-controller-panel
   [synth]
   (let [full-params (filter #(not (or (= :none (:type %))
-                                        (nil? (:min %))
-                                        (nil? (:max %))
-                                        (nil? (:step %))))
-                              (:params synth))]
-      (if (zero? (count full-params))
-        (do
-          (alert (str "The '" (:name synth) "'"
+                                      (nil? (:min %))
+                                      (nil? (:max %))
+                                      (nil? (:step %))))
+                            (:params synth))]
+    (if (zero? (count full-params))
+      (do
+        (alert (str "The '" (:name synth) "'"
                     " synth or instrument does not have any parameters"
                     " with the required meta-data. "
                     " (e.g.  [freq {:default 80 :min 40 :max 880 :step 1}])"))
-          {:synth synth
-           :panel (label :text "Missing parameters" :border (:name synth))
-           :cleanup (fn [])})
-        (let [control-panes (map
-                              (fn [{:keys [name default min max step value]}]
-                                (control-slider name min max step value))
-                              full-params)
-              cleanup       (apply juxt (map second control-panes))
-              panel (mig-panel :constraints ["" "[right][center][center]" ""]
-                               :items (mapcat first control-panes)
-                               :border (:name synth))]
-          {:synth synth
-           :panel panel
-           :cleanup cleanup}))))
+        {:synth synth
+         :panel (label :text "Missing parameters" :border (:name synth))
+         :cleanup (fn [])})
+      (let [control-panes (map
+                           (fn [{:keys [name default min max step value]}]
+                             (control-slider name min max step value))
+                           full-params)
+            cleanup       (apply juxt (map second control-panes))
+            panel (mig-panel :constraints ["" "[right][center][center]" ""]
+                             :items (mapcat first control-panes)
+                             :border (:name synth))]
+        {:synth synth
+         :panel panel
+         :cleanup cleanup}))))

 (defn synth-controller
-  "Create a GUI for the given synths or instruments.  Each synth must have sufficient
-   parameter metadata in the synthdef.
+  "Create a GUI for the given synths or instruments.  Each synth must
+   have sufficient parameter metadata in the synthdef.

     (defsynth foo [freq {:default 440 :min 20 :max 10000 :step 1}]
       (out 0 (* [0.6 0.6] (env-gen (perc 0.01 0.2) :action FREE) (sin-osc freq))))

-    ; pops up gui window that will modify active synths and default param values
-    (synth-controller foo)
+   Pops up gui window that will modify active synths and default
+   param values
+   (synth-controller foo)

-    ; To reset the synth back to the original default paremeter values use
-    (reset-synth-defaults foo)
-  "
+   To reset the synth back to the original default paremeter values use
+   (reset-synth-defaults foo)"
   [& synths]
   (invoke-now
-    (let [panels  (map synth-controller-panel synths)
-          cleanup (apply juxt (map :cleanup panels))
-          frame (frame :title "Synth Controllers"
-                       :content (scrollable (vertical-panel
-                                  :border 5
-                                  :items (map :panel panels)))
-                       :on-close :dispose)]
-      ; When the window is closed, unhook everything from the synth
-      ; so the ui can be garbage collected, etc.
-      (listen frame :window-closed (fn [_] (cleanup)))
-      (-> frame pack! show!))))
+   (let [panels  (map synth-controller-panel synths)
+         cleanup (apply juxt (map :cleanup panels))
+         frame (frame :title "Synth Controllers"
+                      :content (scrollable (vertical-panel
+                                            :border 5
+                                            :items (map :panel panels)))
+                      :on-close :dispose)]
+                                        ; When the window is closed, unhook everything from the synth
+                                        ; so the ui can be garbage collected, etc.
+     (listen frame :window-closed (fn [_] (cleanup)))
+     (-> frame pack! show!))))

 (defn live-synth-controller
   "Create a synth instance and attach a synth-controller to it.
-  Allows you to control the-synth interactively.
+   Allows you to control the-synth interactively.

-  (defsynth foo [freq1 {:default 332 :min 200 :max 800 :step 1}
-                 freq2 {:default 333 :min 200 :max 800 :step 1}]
-     (out 0 (pan2 (mix [(lf-tri freq1) (lf-tri freq2)]))))
+   (defsynth foo [freq1 {:default 332 :min 200 :max 800 :step 1}
+                  freq2 {:default 333 :min 200 :max 800 :step 1}]
+      (out 0 (pan2 (mix [(lf-tri freq1) (lf-tri freq2)]))))

   (live-synth-controller foo)"
   [the-synth]
   (let [the-instance (the-synth)
-        the-watchers (map
-                      (fn [param]
+        the-watchers (map
+                      (fn [param]
                         (add-watch
                          (:value param)
-                         (keyword (:name param))
+                         (keyword (:name param))
                          (fn [_ _ _ val] (ctl the-instance (keyword (:name param)) val))))
                       (:params the-synth))
         the-controller (synth-controller the-synth)]
@@ -142,15 +142,15 @@
   (def synth {:name "Test"
               :type :test-synth
               :params [{:name "freq"
-                       :default 440
-                       :min 40
-                       :max 880
-                       :step 1
-                       :value (atom 440) }
+                        :default 440
+                        :min 40
+                        :max 880
+                        :step 1
+                        :value (atom 440) }
                        {:name "amp"
-                       :default 5.0
-                       :min 0.0
-                       :max 10.0
-                       :step 0.1
-                       :value (atom 2.5) }]})
+                        :default 5.0
+                        :min 0.0
+                        :max 10.0
+                        :step 0.1
+                        :value (atom 2.5) }]})
   (synth-controller synth))


Work on toolbox...

Work on toolbox...

* Don't import JWindow.

--- src/overtone/gui/toolbox.clj
+++ src/overtone/gui/toolbox.clj
@@ -4,8 +4,7 @@
          [make-widget :only [MakeWidget]]
          [to-widget :only [ToWidget]]
          [value :only [Value]]])
-  (:import javax.swing.JWindow
-           java.awt.MouseInfo))
+  (:import java.awt.MouseInfo))

 (defrecord Toolbox [tools primary secondary])


Lookup location of SuperCollider on Windows rather than using list of possible locations.

--- src/overtone/sc/defaults.clj
+++ src/overtone/sc/defaults.clj
@@ -1,5 +1,6 @@
 (ns overtone.sc.defaults
-  (:use [overtone.helpers.file :only [dir-exists?]])
+  (:use [overtone.helpers.file :only [dir-exists?]]
+        [overtone.repl.shell :only [ls grep]])
   (:require [overtone.at-at :as at-at]))

 (def DEFAULT-MASTER-VOLUME
@@ -43,28 +44,19 @@
   "make an at-at pool for all default scheduling"
   (at-at/mk-pool))

+(defn- lookup-windows-sc-path []
+  (let [p-files-dir (System/getenv "PROGRAMFILES(X86)")
+        p-files-dir (or p-files-dir (System/getenv "PROGRAMFILES"))
+        p-files     (ls p-files-dir)
+        sc-files    (grep p-files "SuperCollider")
+        recent-sc   (last (sort (seq sc-files)))]
+    (str p-files-dir "\\" recent-sc "\\scsynth.exe")))
+
 (def SC-PATHS
   "Default system paths to an externally installed SuperCollider server for
   various operating systems."
   {:linux ["scsynth"]
-   :windows ["C:/Program Files/SuperCollider-3.5.2/scsynth.exe"
-             "D:/Program Files/SuperCollider-3.5.2/scsynth.exe"
-             "E:/Program Files/SuperCollider-3.5.2/scsynth.exe"
-             "C:/Program Files (x86)/SuperCollider-3.5.2/scsynth.exe"
-             "D:/Program Files (x86)/SuperCollider-3.5.2/scsynth.exe"
-             "E:/Program Files (x86)/SuperCollider-3.5.2/scsynth.exe"
-             "C:/Program Files/SuperCollider-3.5.1/scsynth.exe"
-             "D:/Program Files/SuperCollider-3.5.1/scsynth.exe"
-             "E:/Program Files/SuperCollider-3.5.1/scsynth.exe"
-             "C:/Program Files (x86)/SuperCollider-3.5.1/scsynth.exe"
-             "D:/Program Files (x86)/SuperCollider-3.5.1/scsynth.exe"
-             "E:/Program Files (x86)/SuperCollider-3.5.1/scsynth.exe"
-             "C:/Program Files/SuperCollider/scsynth.exe"
-             "D:/Program Files/SuperCollider/scsynth.exe"
-             "E:/Program Files/SuperCollider/scsynth.exe"
-             "C:/Program Files (x86)/SuperCollider/scsynth.exe"
-             "D:/Program Files (x86)/SuperCollider/scsynth.exe"
-             "E:/Program Files (x86)/SuperCollider/scsynth.exe"]
+   :windows [(lookup-windows-sc-path)]
    :mac  ["/Applications/SuperCollider/scsynth"
           "/Applications/SuperCollider.app/Contents/Resources/scsynth"
           "/Applications/SuperCollider/SuperCollider.app/Contents/Resources/scsynth"]})


Remove unnecessary return

Remove unnecessary return

--- src/play_clj/core_render.clj
+++ src/play_clj/core_render.clj
@@ -56,8 +56,7 @@
         (doseq [listener ui-listeners]
           (.addListener ^Actor object listener))))
     (remove-input! renderer)
-    (add-input! renderer))
-  entities)
+    (add-input! renderer)))

 ; renderers


Revert "logging fix"

Revert "logging fix"

This reverts commit 267fbd6ed98c9f46ba64a3b71958728a419c7ad5.

--- src/polismath/simulation.clj
+++ src/polismath/simulation.clj
@@ -5,7 +5,6 @@
         polismath.named-matrix
         polismath.conversation
         clj-time.coerce
-        clojure.tools.logging
         plumbing.core
         clj-time.local))


Remove unnecessary require

Remove unnecessary require

--- src/mdr2/vubis.clj
+++ src/mdr2/vubis.clj
@@ -3,8 +3,7 @@
   (:require [clojure.java.io :as io]
             [clojure.xml :as xml]
             [clojure.zip :as zip]
-            [clojure.data.zip.xml :refer [xml-> xml1-> attr= text]]
-            [mdr2.production :as production]))
+            [clojure.data.zip.xml :refer [xml-> xml1-> attr= text]]))

 (def ^:private param-mapping
   {:title [:datafield (attr= :tag "245") :subfield (attr= :code "a")]


ga title page

ga title page

--- src/nossal/web.clj
+++ src/nossal/web.clj
@@ -80,7 +80,7 @@
                          :t "pageview"
                          :dh "noss.al"
                          :dp "/dot"
-                         :dt "dotfiles"}})
+                         :dt "dotfiles-install"}})
         (res/redirect "https://raw.githubusercontent.com/nossal/dotfiles/master/bin/dot"))
       (base "dotfiles" ""
         [[:h1 "dotfiles"]] ""))))


More work on PaaS connections.

More work on PaaS connections.

--- src/notes/paas.clj
+++ src/notes/paas.clj
@@ -3,16 +3,23 @@
    [clojure.java.io :as io]))

 (defn is-open-shift? []
-  (System/getenv "OPEN_SHIFT"))
+  (System/getenv "OPENSHIFT_APP_UUID"))

 (defn is-dotcloud? []
   (-> (io/file "/home/dotcloud/environment.json") .exists))
+
+(defn is-heroku? [] false)
+
+(defn is-beanstalk [] false)

 ;(str "mongodb://test:test@" mongo-host ":" mongo-port "/notes")

 (is-dotcloud?)

-(defn mongo-connection-uri []
+(defn mongo-connection-uri [uid pwd]
+  (cond (is-dotcloud?) "dotcloud url"
+        (is-open-shift?) "open-shift url"
+        (is-heroku?) "heroku-url"
+        (is-beanstalk?) "mongohq-url"))

-
-  (str "mongodb://test:test@" mongo-host ":" mongo-port "/notes"))
+;  (str "mongodb://test:test@" mongo-host ":" mongo-port "/notes"))


Add skeleton account notifications settings

--- src-cljs/frontend/components/account.cljs
+++ src-cljs/frontend/components/account.cljs
@@ -339,6 +339,33 @@
           :checked (= email-pref "none")
           :on-change (partial handle-email-notification-change owner "none")}]
         "Don't send me emails."]]]]]])
+
+(defn web-notifications [web-notif-pref]
+  [:div.card
+   [:div.header
+    [:h2
+     "Web Notifications"]]
+    [:div.body
+    [:div.section
+     [:form
+      [:div.radio
+       [:label
+        [:input
+         {:name "web_notif_pref" ,
+          :type "radio"
+          :checked (= web-notif-pref "on")
+          ;; :on-change (partial handle-email-notification-change owner "all")
+          }]
+        "Show me notifications when a build finishes"]]
+      [:div.radio
+       [:label
+        [:input
+         {:name "web_notif_pref" ,
+          :type "radio"
+          :checked (= web-notif-pref "off")
+          ;; :on-change (partial handle-email-notification-change owner "smart")
+          }]
+        "Don't show me notifications when a build finishes"]]]]]])

 (defn granular-email-prefs [{:keys [projects user] :as x} owner]
   (let [followed-orgs (into (sorted-set-by (fn [[x-vcs-type x-name]
@@ -409,7 +436,9 @@
           [:legend "Notification Settings"]
           (preferred-email-address owner user)
           (default-email-pref owner (:basic_email_prefs user))
-          (om/build granular-email-prefs {:projects projects :user user})])))))
+          (om/build granular-email-prefs {:projects projects :user user})
+          ;; TODO Replace "on" with a read from local storage!
+          (web-notifications "on")])))))

 (defn account [app owner]
   (reify


add experimental repl-wrapper feature

add experimental repl-wrapper feature

--- dev/bake/repl.clj
+++ dev/bake/repl.clj
@@ -1,10 +1,13 @@
-(ns bake.repl)
+(ns bake.repl
+  (:use [cake :only [*project*]]))

 (defn- reset-in []
   (while (.ready *in*) (.read *in*)))

 (defn repl [marker]
-  (clojure.main/repl
-   :init   #(in-ns 'user)
-   :caught #(do (reset-in) (clojure.main/repl-caught %))
-   :prompt #(println (str marker (ns-name *ns*)))))
+  (((or (eval (:repl-wrapper *project*)) identity)
+    (fn []
+      (clojure.main/repl
+       :init   #(in-ns 'user)
+       :caught #(do (reset-in) (clojure.main/repl-caught %))
+       :prompt #(println (str marker (ns-name *ns*))))))))


Add tests for bed writer.

Add tests for bed writer.

--- test/cljam/t_bed.clj
+++ test/cljam/t_bed.clj
@@ -212,4 +212,26 @@
   (is (= (with-open [r (bed/reader test-bed-file2-bz2)] (str->bed (bed->str (bed/read-fields r))))
          (with-open [r (bed/reader test-bed-file2-bz2)] (doall (bed/read-fields r)))))
   (is (= (with-open [r (bed/reader test-bed-file3)] (str->bed (bed->str (bed/read-fields r))))
-         (with-open [r (bed/reader test-bed-file3)] (doall (bed/read-fields r))))))
+         (with-open [r (bed/reader test-bed-file3)] (doall (bed/read-fields r)))))
+
+  (with-before-after {:before (prepare-cache!)
+                      :after (clean-cache!)}
+    (let [temp-file (str temp-dir "/test1.bed")
+          temp-file-gz (str temp-dir "/test1.bed.gz")
+          temp-file-bz2 (str temp-dir "/test1.bed.bz2")
+          xs (with-open [r (bed/reader test-bed-file1)] (doall (bed/read-fields r)))]
+      (with-open [wtr1 (bed/writer temp-file)
+                  wtr2 (bed/writer temp-file-gz)
+                  wtr3 (bed/writer temp-file-bz2)]
+        (bed/write-fields wtr1 xs)
+        (bed/write-fields wtr2 xs)
+        (bed/write-fields wtr3 xs))
+      (with-open [rdr1 (bed/reader temp-file)
+                  rdr2 (bed/reader temp-file-gz)
+                  rdr3 (bed/reader temp-file-bz2)]
+        (is (= xs
+               (bed/read-fields rdr1)))
+        (is (= xs
+               (bed/read-fields rdr2)))
+        (is (= xs
+               (bed/read-fields rdr3)))))))


Tweaks to datasets liberator resources.

Tweaks to datasets liberator resources.

--- src/kixi/hecuba/amon.clj
+++ src/kixi/hecuba/amon.clj
@@ -623,15 +623,15 @@
    :errors                    0
    :status                    "Not enough data"
    :median                    0.0
-   :synthetic                 boolean
+   :synthetic                 true
    })

 (defresource datasets [{:keys [commander querier]} handlers]
   :allowed-methods #{:get :post}
   :available-media-types #{"application/edn" "text/html"}
   :authorized? (authorized? querier :datasets)
-  :post! (fn [{{body :body {:keys [entity-id]} :route-params} :request}]
-           (let [{:keys [members name]} (-> body read-edn-body ->shallow-kebab-map)
+  :post! (fn [{{{:keys [entity-id]} :route-params :as request} :request}]
+           (let [{:keys [members name]} (decode-body request)
                  members-str            (string/join \, members)
                  ds                     {:entity_id entity-id
                                          :name name
@@ -678,8 +678,8 @@
                                                     :name name}))]
       {::item item}
       #_(throw (ex-info (format "Cannot find item of id %s")))))
-  :post! (fn [{{body :body {:keys [entity-id name]} :route-params} :request}]
-           (let [{:keys [members name]} (-> body read-edn-body ->shallow-kebab-map)
+  :post! (fn [{{{:keys [entity-id name]} :route-params :as request} :request}]
+           (let [{:keys [members name]} (decode-body request)
                  ds {:entity_id entity-id
                      :name name
                      :members (string/join \, members)}]


Force expanded identity-file path to be a string since that's what JSch expects (and expand-home returns a file if it finds something to expand and its input otherwise)


Added tests for spatially searching granules with holes.

--- test/cmr/system_int_test/search/granule_spatial_search_test.clj
+++ test/cmr/system_int_test/search/granule_spatial_search_test.clj
@@ -24,8 +24,8 @@
   "Creates a single ring polygon with the given ordinates. Points must be in counter clockwise order.
   The polygon will be closed automatically."
   [& ords]
-  (let [polygon (p/polygon [(apply r/ords->ring ords)])
-        outer (-> polygon :rings first derived/calculate-derived)]
+  (let [polygon (derived/calculate-derived (p/polygon [(apply r/ords->ring ords)]))
+        outer (-> polygon :rings first)]
     (when (and (:contains-north-pole outer)
                (:contains-south-pole outer))
       (throw (Exception. "Polygon can not contain both north and south pole. Points are likely backwards.")))
@@ -84,6 +84,13 @@
         polygon-south-pole (polygon -45 -80, -135 -80, 135 -80, 45 -80, -45 -80)
         polygon-antimeridian (polygon 135 -10, -135 -10, -135 10, 135 10, 135 -10)
         polygon-near-sp (polygon 168.1075 -78.0047, 170.1569,-78.4112, 172.019,-78.0002, 169.9779,-77.6071, 168.1075 -78.0047)
+
+        ;; polygon with holes
+        outer (r/ords->ring -5.26,-2.59, 11.56,-2.77, 10.47,8.71, -5.86,8.63, -5.26,-2.59)
+        hole1 (r/ords->ring 6.95,2.05, 2.98,2.06, 3.92,-0.08, 6.95,2.05)
+        hole2 (r/ords->ring 5.18,6.92, -1.79,7.01, -2.65,5, 4.29,5.05, 5.18,6.92)
+        polygon-with-holes  (p/polygon [outer hole1 hole2])
+
         coll (d/ingest "PROV1" (dc/collection {:spatial-coverage (dc/spatial :geodetic)}))
         make-gran (fn [& polygons]
                     (d/ingest "PROV1" (dg/granule coll {:spatial-coverage (apply dg/spatial polygons)})))
@@ -95,18 +102,35 @@
         gran6 (make-gran polygon-north-pole)
         gran7 (make-gran polygon-south-pole)
         gran8 (make-gran polygon-antimeridian)
-        gran9 (make-gran polygon-near-sp)]
+        gran9 (make-gran polygon-near-sp)
+        gran10 (make-gran polygon-with-holes)]
     (index/refresh-elastic-index)
     (are [ords items]
-         (let [matches? (d/refs-match? items (search/find-refs :granule {:polygon (apply search-poly ords) }))]
+         (let [found (search/find-refs :granule {:polygon (apply search-poly ords) })
+               matches? (d/refs-match? items found)]
            (when (and (not matches?) spatial-viz-enabled)
              (println "Displaying failed granules and search area")
+             (println "Found: " (pr-str found))
              (viz-helper/clear-geometries)
              (display-indexed-granules items)
              (display-search-area (apply polygon ords)))
            matches?)
+
+         ;; Related the polygon with the hole
+         ;; Inside holes
+         [4.1,0.64,4.95,0.97,6.06,1.76,3.8,1.5,4.1,0.64] []
+         [1.41,5.12,3.49,5.52,2.66,6.11,0.13,6.23,1.41,5.12] []
+         ;; Partially inside a hole
+         [3.58,-1.34,4.95,0.97,6.06,1.76,3.8,1.5,3.58,-1.34] [gran10]
+         ;; Covers a hole
+         [3.58,-1.34,5.6,0.05,7.6,2.33,2.41,2.92,3.58,-1.34] [gran10]
+         ;; points inside both holes
+         [4.44,0.66,5.4,1.35,2.66,6.11,0.13,6.23,4.44,0.66] [gran10]
+         ;; completely covers the polygon with holes
+         [-6.45,-3.74,12.34,-4.18,12,9.45,-6.69,9.2,-6.45,-3.74] [gran10 gran11]
+
+         ;; Normal searching
          [10 10, 30 10, 30 20, 10 20, 10 10] [gran1 gran4]
-         [173.34,-77.17, 171.41,-77.08, 170.64,-78.08, 173.71,-78.05, 173.34,-77.17] [gran9]
-         )
+         [173.34,-77.17, 171.41,-77.08, 170.64,-78.08, 173.71,-78.05, 173.34,-77.17] [gran9])))

-    ))
+


fix into-map docstring

fix into-map docstring

--- src/useful/map.clj
+++ src/useful/map.clj
@@ -29,7 +29,8 @@

 (defn into-map
   "Convert a list of heterogeneous args into a map. Args can be alternating keys and values,
-   maps of keys to values or collections of alternating keys and values."
+  maps of keys to values or collections of alternating keys and values. If the first arg is
+  a function, it will be used for merging duplicate values."
   [& args]
   (let [[args combine] (pop-if (apply list args) fn? (fn [_ x] x))]
     (loop [args args m {}]


(TK-174) Remove unused middleware from ringutils

--- src/puppetlabs/trapperkeeper/services/status/ringutils.clj
+++ src/puppetlabs/trapperkeeper/services/status/ringutils.clj
@@ -7,24 +7,6 @@

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Public
-
-(defn wrap-request-logging
-  "A ring middleware that logs the request."
-  [handler]
-  (fn [{:keys [request-method uri] :as req}]
-    (log/debug "Processing" request-method uri)
-    (log/trace "---------------------------------------------------")
-    (log/trace (ks/pprint-to-string (dissoc req :ssl-client-cert)))
-    (log/trace "---------------------------------------------------")
-    (handler req)))
-
-(defn wrap-response-logging
-  "A ring middleware that logs the response."
-  [handler]
-  (fn [req]
-    (let [resp (handler req)]
-      (log/trace "Computed response:" resp)
-      resp)))

 (defn wrap-request-data-errors
   "A rignt middleware that catches slingshot errors of :type


:fire: Remove prn.

:fire: Remove prn.

--- frontend/src/uxbox/main/exports.cljs
+++ frontend/src/uxbox/main/exports.cljs
@@ -54,7 +54,6 @@

 (mf/defc shape-wrapper
   [{:keys [frame shape objects] :as props}]
-  (prn "shape-wrapper" frame)
   (when (and shape (not (:hidden shape)))
     (let [shape (geom/transform-shape frame shape)]
       (case (:type shape)


Reorganize global Lein profie

Reorganize global Lein profie

--- etc/lein/profiles.clj
+++ etc/lein/profiles.clj
@@ -1,8 +1,8 @@
-{:user {:dependencies [[org.clojure/tools.namespace "0.3.0-alpha4"]
-                       [com.cemerick/pomegranate "1.0.0"]
+{:repl {:dependencies [^:displace [org.clojure/clojure "1.9.0"]
+                       [org.clojure/tools.namespace "0.3.0-alpha4"]
                        [eftest "0.5.2"]]
-        :repl-options {:color false}
-        :plugins [[lein-cljfmt "0.4.1" :exclusions [org.clojure/clojure]]
+        :repl-options {:color false}}
+ :user {:plugins [[lein-cljfmt "0.4.1" :exclusions [org.clojure/clojure]]
                   [lein-cloverage "1.0.6" :exclusions [org.clojure/clojure]]
                   [lein-kibit "0.1.3" :exclusions [org.clojure/clojure]]
                   [lein-eftest "0.5.2" :exclusions [org.clojure/clojure]]


Sort the participants by score

Sort the participants by score

--- src/rpi_challenger/views.clj
+++ src/rpi_challenger/views.clj
@@ -32,7 +32,7 @@

 (defsnippet tournament-overview "public/tournament.html" [:body :> any-node]
   [participants]
-  *participants-row (content (map #(participants-row %) participants)))
+  *participants-row (content (map #(participants-row %) (sort-by :score > participants))))

 ; strikes list


Add :min2 option for knock-off-chip-off-the-old-block

--- src/clojush/pushgp/selection/preselection.clj
+++ src/clojush/pushgp/selection/preselection.clj
@@ -83,7 +83,10 @@
   will be chosen randomly from the range of (int (* minfrac outof)) to
   (int (* maxfrac outof)). If the first item in (:knock-off-chip-off-the-old-block argmap)
   is :unsolved, then the remainder are interpreted as above, but only errors
-  that are not solved for a given individual are considered in the filtering."
+  that are not solved for a given individual are considered in the filtering.
+  If the first item in (:knock-off-chip-off-the-old-block argmap)
+  is :min2, then the remainder are interpreted as above, but the minimum
+  for random values is 2 rather than 1."
   [pop argmap]
   (let [knock-spec (:knock-off-chip-off-the-old-block argmap)]
     (if (not knock-spec)
@@ -93,6 +96,8 @@
          (Exception.
           ":print-history must be true for :knock-off-chip-off-the-old-block"))
         (let [knock-spec (if (= true knock-spec) [true] knock-spec)
+              min2? (= :min2 (first knock-spec))
+              knock-spec (if min2? (rest knock-spec) knock-spec)
               unsolved? (= :unsolved (first knock-spec))
               knock-spec (if unsolved? (rest knock-spec) knock-spec)
               filtered-history (if unsolved?
@@ -108,33 +113,39 @@
                                                          keep?)))
                                           hist)))
                                  :history)]
-        (if (= true (first knock-spec))
-          (let [changed (vec (filter #(not= (first (:history %)) (second (:history %)))
-                                     pop))]
-            (if (empty? changed)
-              pop
-              changed))
-          (let [diffs (first knock-spec)
-                outof (second knock-spec)
-                limit (if (= outof :random) (nth knock-spec 2) nil)
-                outof (if (= outof :random) (inc (lrand-int limit)) outof)
-                diffs (if (= diffs :random)
-                        (inc (if (> (count knock-spec) 3)
-                               (let [mindiff (int (* (nth knock-spec 3) outof))
-                                     maxdiff (if (> (count knock-spec) 4)
-                                               (int (* (nth knock-spec 4) outof))
-                                               outof)]
-                                 (+ mindiff (lrand-int (max 1 (- maxdiff mindiff)))))
-                               (lrand-int outof)))
-                        diffs)
-                changed (vec (filter #(or (< (count (:history %)) diffs)
-                                          (>= (count (distinct (take outof (:history %))))
-                                              diffs))
-                                     pop))]
-            (if (empty? changed)
-              (do (println "Universal violation of knock-off-chip-off-the-old-block constraint.")
-                  pop)
-              changed))))))))
+          (if (= true (first knock-spec))
+            (let [changed (vec (filter #(not= (first (:history %)) (second (:history %)))
+                                       pop))]
+              (if (empty? changed)
+                pop
+                changed))
+            (let [diffs (first knock-spec)
+                  outof (second knock-spec)
+                  limit (if (= outof :random) (nth knock-spec 2) nil)
+                  outof (if (= outof :random)
+                          (if min2?
+                            (inc (inc (lrand-int (dec limit))))
+                            (inc (lrand-int limit)))
+                          outof)
+                  diffs (if (= diffs :random)
+                          (inc (if (> (count knock-spec) 3)
+                                 (let [mindiff (int (* (nth knock-spec 3) outof))
+                                       maxdiff (if (> (count knock-spec) 4)
+                                                 (int (* (nth knock-spec 4) outof))
+                                                 outof)]
+                                   (+ mindiff (lrand-int (max 1 (- maxdiff mindiff)))))
+                                 (if min2?
+                                   (inc (lrand-int (dec outof)))
+                                   (lrand-int outof))))
+                          diffs)
+                  changed (vec (filter #(or (< (count (:history %)) diffs)
+                                            (>= (count (distinct (take outof (:history %))))
+                                                diffs))
+                                       pop))]
+              (if (empty? changed)
+                (do (println "Universal violation of knock-off-chip-off-the-old-block constraint.")
+                    pop)
+                changed))))))))

 (defn preselect
   "Returns the population pop reduced as appropriate considering the settings for


More docstrings

More docstrings

--- src/com/wsscode/pathom/connect/run_graph.cljc
+++ src/com/wsscode/pathom/connect/run_graph.cljc
@@ -93,6 +93,8 @@
       (get-in index-resolvers [(pc-sym node) :com.wsscode.pathom.connect/provides]))))

 (defn find-dynamic-node-to-merge
+  "Given some branch node, tries to find a node with a dynamic resolver that's the
+  same sym as the node in node-id."
   [{::keys [root] :as out}
    {::keys [branch-type]
     :as    env}
@@ -100,9 +102,12 @@
   (let [node     (get-in out [::nodes node-id])
         node-sym (pc-sym node)]
     (if (dynamic-resolver? env node-sym)
-      (some #(if (= node-sym (get-in out [::nodes % pc-sym])) %) (get-in out [::nodes root branch-type])))))
+      (some #(if (= node-sym (get-in out [::nodes % pc-sym])) %)
+        (get-in out [::nodes root branch-type])))))

 (defn simplify-branch
+  "If you pass a branch node with a single branch item, it removes the branch node
+  from the graph and puts that single item on its place.t"
   [{::keys [root] :as out}
    {::keys [branch-type]}]
   (let [items (get-in out [::nodes root branch-type])]
@@ -132,16 +137,23 @@
             (conj visited node-id))
           out)))))

-(defn remove-node [out {::keys [node-id]}]
+(defn remove-node
+  "Remove a node from the graph. In case of resolver nodes it also removes them
+  from the ::index-syms."
+  [out {::keys [node-id]}]
   (let [node (get-node out node-id)]
     (-> out
         (update-in [::index-syms (pc-sym node)] disj node-id)
         (update ::nodes dissoc node-id))))

-(defn merge-node-requires [out target-node-id {::keys [requires]}]
+(defn merge-node-requires
+  "Merge requires from node into target-node-id."
+  [out target-node-id {::keys [requires]}]
   (update-in out [::nodes target-node-id ::requires] merge-io requires))

-(defn merge-node-provides [out target-node-id {::keys [provides]}]
+(defn merge-node-provides
+  "Merge provides from node into target-node-id."
+  [out target-node-id {::keys [provides]}]
   (update-in out [::nodes target-node-id ::provides] merge-io provides))

 (defn collapse-dynamic-nodes
@@ -206,7 +218,7 @@
   [out
    {::keys [branch-type] :as env}
    {::keys [node-id] :as node}
-   branch-node]
+   branch-node-factory]
   (if node-id
     (let [root-node (get-root-node out)
           next-node (get-node out node-id)]
@@ -221,7 +233,7 @@
         (add-branch-node out env node)

         :else
-        (create-branch-node out env node (branch-node))))
+        (create-branch-node out env node (branch-node-factory))))
     out))

 (defn compute-root-or
@@ -276,7 +288,10 @@
         (assoc ::run-next run-next)))))

 (defn extend-resolver-run-next
-  "Extend "
+  "Extend resolver run next, adding the current run-next from env to it. If the sym
+  nodes don't have a run-next, it will be set for the one informed by the env. In case
+  there is already something to run next the node, a wrap AND branch node will be
+  inserted containing the previous node and the new one."
   [{::keys [index-syms] :as out}
    {::keys [run-next run-next-trail] :as env}]
   (if run-next