refactor arena utils to utils

refactor arena utils to utils

--- src/clj/battlebots/utils.clj
+++ src/clj/battlebots/utils.clj
@@ -1,6 +1,69 @@
-(ns battlebots.utils)
+(ns battlebots.utils
+  (:require [battlebots.arena :refer :all]))

 (defn in?
   "true if coll contains elm"
   [coll elm]
   (some #(= elm %) coll))
+
+;; arena utils
+
+(defn min-
+  "subtract a number from another, returning min if the result is less than min"
+  [num1 num2 min]
+  (let [res (- num1 num2)]
+    (if (<= res min) min res)))
+
+(defn max+
+  "add a number to another, returning max if the result is greater than max"
+  [num1 num2 max]
+  (let [res (+ num1 num2)]
+    (if (>= res max) max res)))
+
+(defn get-area-in-range
+  "given an arena, a position, and fov radius return an arena subset within range"
+  [arena [posx posy] radius]
+  (let [dims (get-arena-dimensions arena)
+        x-bound (- (get dims 0) 1)
+        y-bound (- (get dims 1) 1)
+        x1 (min- posx radius 0)
+        x2 (max+ posx radius x-bound)
+        y1 (min- posy radius 0)
+        y2 (min- posy radius y-bound)]
+    (map #(subvec % y1 y2) (subvec arena x1 x2))))
+
+(defn draw-line
+  "Draw a line from x1,y1 to x2,y2 using Bresenham's Algorithm"
+  [x1 y1 x2 y2]
+  (let [dist-x (Math/abs (- x1 x2))
+        dist-y (Math/abs (- y1 y2))
+        steep (> dist-y dist-x)]
+    (let [[x1 y1 x2 y2] (if steep [y1 x1 y2 x2] [x1 y1 x2 y2])]
+      (let [[x1 y1 x2 y2] (if (> x1 x2) [x2 y2 x1 y1] [x1 y1 x2 y2])]
+        (let  [delta-x (- x2 x1)
+               delta-y (Math/abs (- y1 y2))
+               y-step (if (< y1 y2) 1 -1)]
+          (loop [x x1
+                 y y1
+                 error (Math/floor (/ delta-x 2))
+                 res []]
+            (let [pt (if steep
+                      [(int x) (int y)]
+                      [(int y) (int x)])]
+              (if (>= x x2)
+                (conj res [x2 y2])
+                ; Rather then rebind error, test that it is less than delta-y not 0
+                (if (< error delta-y)
+                  (recur (inc x) (+ y y-step) (+ error (- delta-x delta-y)) (conj res pt))
+                  (recur (inc x) y            (- error delta-y) (conj res pt)))))))))))
+
+(defn test-draw-line
+  [x1 y1 x2 y2]
+  (let [arena (empty-arena (+ 5 (max x1 x2)) (+ 5 (max y1 y2)))
+        line (draw-line x1 y1 x2 y2)
+        res-arena (reduce (fn [a p] (update-cell a p {:display "*"})) arena line)]
+    res-arena))
+
+(defn pretty-print-arena
+ [arena]
+ (doseq [a arena] (println (map :display a))))


Uncomment reduce-by-key-and-window which is still untested

--- src/clj/flambo/streaming.clj
+++ src/clj/flambo/streaming.clj
@@ -74,11 +74,11 @@
 (defn reduce-by-window [dstream f window-length slide-interval]
   (.reduceByWindow dstream (function2 f) (duration window-length) (duration slide-interval)))

-;(defn reduce-by-key-and-window [dstream f window-length slide-interval]
-;  (-> dstream
-;      (.map (pair-function identity))
-;      (.reduceByKeyAndWindow (function2 f) (duration window-length) (duration slide-interval))
-;      (.map (function f/untuple))))
+(defn reduce-by-key-and-window [dstream f window-length slide-interval]
+  (-> dstream
+      (.map (pair-function identity))
+      (.reduceByKeyAndWindow (function2 f) (duration window-length) (duration slide-interval))
+      (.map (function f/untuple))))

 ;; output operations


send new bookmarks to all connected channels

--- src/clj/lesezeichen/core.clj
+++ src/clj/lesezeichen/core.clj
@@ -95,7 +95,7 @@
                     (debug (str "Message received: " msg))
                     (send! channel out-msg)
                     (debug (str "Message sent: " out-msg))
-                    #_(when (= :add-bookmark topic)
+                    (when (= :add-bookmark topic)
                       (doall
                        (map
                         #(send! (:channel %) out-msg)


revert indentation mess

revert indentation mess

--- src/clojure/duratom/core.clj
+++ src/clojure/duratom/core.clj
@@ -2,7 +2,6 @@
   (:require [duratom.backends :as storage]
             [duratom.utils :as ut]
             [clojure.java.io :as jio]
-            [clojure.edn :as edn]
             [duratom.readers :as readers]
             [duratom.utils :as ut])
   (:import (clojure.lang IAtom IDeref IRef ARef IMeta IObj Atom IAtom2)
@@ -18,31 +17,31 @@
   (swapVals [_ f]
     (ut/assert-not-released! release)
     (ut/with-locking lock
-                     (let [result (.swapVals underlying-atom f)]
+      (let [result (.swapVals underlying-atom f)]
         (storage/commit storage-backend)
         result)))
   (swapVals [_ f arg1]
     (ut/assert-not-released! release)
     (ut/with-locking lock
-                     (let [result (.swapVals underlying-atom f arg1)]
+      (let [result (.swapVals underlying-atom f arg1)]
         (storage/commit storage-backend)
         result)))
   (swapVals [_ f arg1 arg2]
     (ut/assert-not-released! release)
     (ut/with-locking lock
-                     (let [result (.swapVals underlying-atom f arg1 arg2)]
+      (let [result (.swapVals underlying-atom f arg1 arg2)]
         (storage/commit storage-backend)
         result)))
   (swapVals [_ f arg1 arg2 more]
     (ut/assert-not-released! release)
     (ut/with-locking lock
-                     (let [result (.swapVals underlying-atom f arg1 arg2 more)]
+      (let [result (.swapVals underlying-atom f arg1 arg2 more)]
         (storage/commit storage-backend)
         result)))
   (resetVals [_ newvals]
     (ut/assert-not-released! release)
     (ut/with-locking lock
-                     (let [result (.resetVals underlying-atom newvals)]
+      (let [result (.resetVals underlying-atom newvals)]
         (storage/commit storage-backend)
         result)))

@@ -50,38 +49,38 @@
   (swap [_ f]
     (ut/assert-not-released! release)
     (ut/with-locking lock
-                     (let [result (.swap underlying-atom f)]
+      (let [result (.swap underlying-atom f)]
         (storage/commit storage-backend)
         result)))
   (swap [_ f arg]
     (ut/assert-not-released! release)
     (ut/with-locking lock
-                     (let [result (.swap underlying-atom f arg)]
+      (let [result (.swap underlying-atom f arg)]
         (storage/commit storage-backend)
         result)))
   (swap [_ f arg1 arg2]
     (ut/assert-not-released! release)
     (ut/with-locking lock
-                     (let [result (.swap underlying-atom f arg1 arg2)]
+      (let [result (.swap underlying-atom f arg1 arg2)]
         (storage/commit storage-backend)
         result)))
   (swap [_ f arg1 arg2 more]
     (ut/assert-not-released! release)
     (ut/with-locking lock
-                     (let [result (.swap underlying-atom f arg1 arg2 more)]
+      (let [result (.swap underlying-atom f arg1 arg2 more)]
         (storage/commit storage-backend)
         result)))
   (compareAndSet [_ oldv newv]
     (ut/assert-not-released! release)
     (ut/with-locking lock
-                     (let [result (.compareAndSet underlying-atom oldv newv)]
+      (let [result (.compareAndSet underlying-atom oldv newv)]
         (when result
           (storage/commit storage-backend))
         result)))
   (reset [_ newval]
     (ut/assert-not-released! release)
     (ut/with-locking lock
-                     (let [result (.reset underlying-atom newval)]
+      (let [result (.reset underlying-atom newval)]
         (storage/commit storage-backend)
         result)))
   IRef
@@ -251,10 +250,10 @@

 (defmulti duratom
-  "Top level constructor function for the <Duratom> class.
+          "Top level constructor function for the <Duratom> class.
    Built-in <backed-by> types are `:local-file`, `:postgres-db` & `:aws-s3`."
-  (fn [backed-by & _args]
-    backed-by))
+          (fn [backed-by & _args]
+            backed-by))

 (defmethod duratom :local-file
   [_ & {:keys [file-path init lock rw]


Add signature-policy-envelope message

Add signature-policy-envelope message

--- src/clojure_fabric/proto.clj
+++ src/clojure_fabric/proto.clj
@@ -29,7 +29,11 @@
            io.netty.handler.ssl.SslProvider
            io.netty.handler.ssl.util.InsecureTrustManagerFactory
            org.bouncycastle.util.encoders.Hex
-           [org.hyperledger.fabric.protos.common Common$Block Common$BlockData Common$BlockHeader Common$BlockMetadata Common$ChannelHeader Common$Envelope Common$Header Common$HeaderType Common$Payload Common$SignatureHeader Configtx$ConfigGroup Configtx$ConfigPolicy Configtx$ConfigSignature Configtx$ConfigUpdate Configtx$ConfigUpdateEnvelope Configtx$ConfigValue Ledger$BlockchainInfo Policies$Policy]
+           [org.hyperledger.fabric.protos.common Common$Block Common$BlockData Common$BlockHeader Common$BlockMetadata Common$ChannelHeader
+            Common$Envelope Common$Header Common$HeaderType Common$Payload Common$SignatureHeader Configtx$ConfigGroup Configtx$ConfigPolicy
+            Configtx$ConfigSignature Configtx$ConfigUpdate Configtx$ConfigUpdateEnvelope Configtx$ConfigValue Ledger$BlockchainInfo
+            Policies$Policy Policies$SignaturePolicyEnvelope Policies$SignaturePolicy Policies$SignaturePolicy$NOutOf
+            MspPrincipal$MSPPrincipal MspPrincipal$MSPPrincipal$Classification MspPrincipal$MSPRole MspPrincipal$MSPRole$MSPRoleType]
            org.hyperledger.fabric.protos.msp.Identities$SerializedIdentity
            [org.hyperledger.fabric.protos.orderer Ab$SeekInfo Ab$SeekInfo$SeekBehavior Ab$SeekNewest Ab$SeekOldest Ab$SeekPosition Ab$SeekSpecified AtomicBroadcastGrpc AtomicBroadcastGrpc$AtomicBroadcastStub]
            [org.hyperledger.fabric.protos.peer Chaincode$ChaincodeDeploymentSpec Chaincode$ChaincodeDeploymentSpec$ExecutionEnvironment Chaincode$ChaincodeID Chaincode$ChaincodeInput Chaincode$ChaincodeInvocationSpec Chaincode$ChaincodeSpec Chaincode$ChaincodeSpec$Type ChaincodeEventPackage$ChaincodeEvent EndorserGrpc ProposalPackage$ChaincodeAction ProposalPackage$ChaincodeHeaderExtension ProposalPackage$ChaincodeProposalPayload ProposalPackage$Proposal ProposalPackage$SignedProposal ProposalResponsePackage$Endorsement ProposalResponsePackage$ProposalResponse ProposalResponsePackage$ProposalResponsePayload ProposalResponsePackage$Response Query$ChaincodeInfo Query$ChaincodeQueryResponse Query$ChannelInfo Query$ChannelQueryResponse TransactionPackage$ChaincodeActionPayload TransactionPackage$ChaincodeEndorsedAction TransactionPackage$ProcessedTransaction TransactionPackage$Transaction TransactionPackage$TransactionAction]))
@@ -312,6 +316,74 @@
   [& {:keys [type value]}]
   (map->Policy {:type type :value value}))

+(defrecord NOutOf [^Long n rules]
+  ICljToProto
+  (clj->proto [this]
+    (cond-> (Policies$SignaturePolicy$NOutOf/newBuilder)
+      n (.setN n)
+      rules  (.addAllRules (mapv #(clj->proto %) rules))
+      true (.build))))
+
+(defn make-n-out-of
+  [& {:keys [n rules]}]
+  (map->NOutOf {:n n :rules rules}))
+
+(defrecord SignaturePolicy [^Long signed-by ^NOutOf n-out-of]
+  ICljToProto
+  (clj->proto [this]
+    (cond-> (Policies$SignaturePolicy/newBuilder)
+      signed-by (.setSignedBy signed-by)
+      n-out-of  (.setNOutOf ^Policies$SignaturePolicy$NOutOf (clj->proto n-out-of))
+      true (.build))))
+
+(defn make-signature-policy
+  [& {:keys [signed-by n-out-of]}]
+  (map->SignaturePolicy {:signed-by signed-by :n-out-of n-out-of}))
+
+(defonce msp-role-type-map {:member MspPrincipal$MSPRole$MSPRoleType/MEMBER
+                            :admin MspPrincipal$MSPRole$MSPRoleType/ADMIN})
+
+(defrecord MSPRole [^String msp-identifier role]
+  ICljToProto
+  (clj->proto [this]
+    (cond-> (MspPrincipal$MSPRole/newBuilder)
+      msp-identifier (.setMspIdentifier msp-identifier)
+      role (.setRole (msp-role-type-map role))
+      true (.build))))
+
+(defn make-msp-role
+  [& {:keys [msp-identifier role]}]
+  (map->MSPRole {:msp-identifier msp-identifier :role role}))
+
+(defonce classification-map {:role MspPrincipal$MSPPrincipal$Classification/ROLE
+                             :organization-unit MspPrincipal$MSPPrincipal$Classification/ORGANIZATION_UNIT
+                             :identity MspPrincipal$MSPPrincipal$Classification/IDENTITY})
+
+(defrecord MSPPrincipal [principal-classification ^bytes principal]
+  ICljToProto
+  (clj->proto [this]
+    (cond-> (MspPrincipal$MSPPrincipal/newBuilder)
+      principal-classification (.setPrincipalClassification (classification-map principal-classification))
+      principal (.setPrincipal principal)
+      true (.build))))
+
+(defn make-msp-principal
+  [& {:keys [principal-classification principal]}]
+  (map->MSPPrincipal {:principal-classification principal-classification :principal principal}))
+
+(defrecord SignaturePolicyEnvelope [^Long version ^SignaturePolicy rule identities]
+  ICljToProto
+  (clj->proto [this]
+    (cond-> (Policies$SignaturePolicyEnvelope/newBuilder)
+      version   (.setVersion version)
+      rule      (.setRule ^Policies$SignaturePolicy (clj->proto rule))
+      identities (.addAllIdentities (mapv #(clj->proto %) identities))
+      true (.build))))
+
+(defn make-signature-policy-envelope
+  [& {:keys [version rule identities]}]
+  (map->SignaturePolicyEnvelope {:version version :rule rule :identities identities}))
+
 (defrecord ConfigPolicy [^Long version ^Policies$Policy policy ^String mod-policy]
   ICljToProto
   (clj->proto [this]
@@ -361,11 +433,10 @@
 (defrecord ConfigUpdateEnvelope [^bytes config-update signatures]
   ICljToProto
   (clj->proto [this]
-    (let [config-update-envelope (doto (Configtx$ConfigUpdateEnvelope/newBuilder)
-                                   (.setConfigUpdate (ByteString/copyFrom config-update)))]
-      (doseq [s signatures]
-        (.addSignatures config-update-envelope ^Configtx$ConfigSignature (clj->proto s)))
-      (.build config-update-envelope))))
+    (cond-> (Configtx$ConfigUpdateEnvelope/newBuilder)
+      config-update (.setConfigUpdate (ByteString/copyFrom config-update))
+      signatures (.addAllSignatures (mapv #(clj->proto %) signatures))
+      true (.build))))

 (defn make-config-update-envelope
   [& {:keys [config-update signatures]}]


CMR-6759 changes groupid for quartzite dependency

--- common-lib/project.clj
+++ common-lib/project.clj
@@ -15,7 +15,7 @@
                  [cheshire "5.8.1"]
                  [clj-time "0.15.1"]
                  [clojail "1.0.6"]
-                 [org.clojars.daniel-zamora/quartzite "2.2.1-SNAPSHOT"]
+                 [gov.nasa.earthdata/quartzite "2.2.1-SNAPSHOT"]
                  [clojusc/ltest "0.3.0"]
                  [com.dadrox/quiet-slf4j "0.1"]
                  [com.gfredericks/test.chuck "0.2.9"]


Support arity zero calls to mocks

Support arity zero calls to mocks

--- test/com/wsscode/pathom/test_helpers.cljc
+++ test/com/wsscode/pathom/test_helpers.cljc
@@ -8,6 +8,7 @@
          (deref [_] @calls)

          clojure.lang.IFn
+         (invoke [_] (swap! calls conj []))
          (invoke [_ v1] (swap! calls conj [v1]))
          (invoke [_ v1 v2] (swap! calls conj [v1 v2]))
          (invoke [_ v1 v2 v3] (swap! calls conj [v1 v2 v3]))
@@ -35,6 +36,7 @@
          (-deref [_] @calls)

          IFn
+         (-invoke [_] (swap! calls conj []))
          (-invoke [_ v1] (swap! calls conj [v1]))
          (-invoke [_ v1 v2] (swap! calls conj [v1 v2]))
          (-invoke [_ v1 v2 v3] (swap! calls conj [v1 v2 v3]))


almost working with repeated fields

almost working with repeated fields

--- src/datasplash/datastore.clj
+++ src/datasplash/datastore.clj
@@ -6,7 +6,8 @@
    ;; [com.google.cloud.datastore Datastore DatastoreOptions Entity Key KeyFactory]
    [com.google.cloud.dataflow.sdk.io.datastore DatastoreIO ]
    [com.google.cloud.dataflow.sdk Pipeline]
-   [com.google.cloud.dataflow.sdk.values PBegin PCollection])
+   [com.google.cloud.dataflow.sdk.values PBegin PCollection]
+   [com.google.datastore.v1 Entity$Builder Key$Builder Value$Builder])
   (:gen-class))

 (defn write-datastore-raw
@@ -29,19 +30,46 @@
                    (cond-> query (.withQuery query)))]
     (apply-transform pcoll ptrans named-schema opts)))

+(defprotocol IValDS
+  (make-ds-value-builder [options v]))
+
+(declare make-ds-value)
+
+(extend-protocol IValDS
+  String
+  (make-ds-value-builder [_ ^String v] (DatastoreHelper/makeValue v))
+  java.util.Date
+  (make-ds-value-builder [_ ^java.util.Date v] (DatastoreHelper/makeValue v))
+  Long
+  (make-ds-value-builder [_ ^Long v] (DatastoreHelper/makeValue v))
+  java.util.List
+  (make-ds-value-builder [options ^Iterable v] (mapv #(make-ds-value options %) v))
+  Object
+  (make-ds-value-builder [_ v] (DatastoreHelper/makeValue v)))
+
+(defn make-ds-value
+  [options v]
+  ;; stop building here when print bug id fixed in gcloud and handle excluded afterwards
+  (.build ^Value$Builder (make-ds-value-builder options v)))
+
+(defn make-ds-entity-builder
+  "Generate a datastore entity. Take as parameters the string key of the entity, a map containing the different fields and an options map defining the datastore namespace and kind"
+  [raw-key raw-values {:keys [ds-namespace ds-kind exclude-from-index] :as options}]
+  (let [^Key$Builder key-builder (DatastoreHelper/makeKey (into-array [ds-kind raw-key]))
+        excluded-set (into #{} (map name exclude-from-index))
+        ^Entity$Builder entity-builder (Entity/newBuilder)]
+    (when ds-namespace (.setNamespaceId (.getPartitionIdBuilder key-builder) ds-namespace))
+    (.setKey entity-builder (.build key-builder))
+    (doseq [[v-key v-val] raw-values]
+      (.put (.getMutableProperties entity-builder)
+            (if (keyword? v-key) (name v-key) v-key)
+            (let [^Value$Builder val-builder (make-ds-value-builder options v-val)]
+              (-> val-builder
+                  (cond-> (excluded-set (name v-key)) (.setExcludeFromIndexes true))
+                  (.build)))))
+    entity-builder))

 (defn make-ds-entity
-  "Generate a datastore entity. Take as parameters the string key of the entity, a map containing the different fields and an options map defining the datastore namespace and kind"
-  [raw-key raw-values {:keys [ds-namespace ds-kind excluded-from-index] :as options}]
-  (let [key-builder (DatastoreHelper/makeKey (into-array [ds-kind raw-key]))
-        excluded-set (into #{} (map name excluded-from-index))
-        _ (when ds-namespace (.setNamespaceId (.getPartitionIdBuilder key-builder) ds-namespace))
-        entity-builder (Entity/newBuilder)
-        _ (.setKey entity-builder (.build key-builder))
-        _ (doseq [[v-key v-val] raw-values]
-            (.put (.getMutableProperties entity-builder)
-                  (if (keyword? v-key) (name v-key) v-key )
-                  (-> (DatastoreHelper/makeValue v-val)
-                      (cond-> (excluded-set (name v-key)) (.setExcludeFromIndexes true))
-                      (.build ))))]
-    (.build entity-builder)))
+  [raw-key raw-values {:keys [ds-namespace ds-kind exclude-from-index] :as options}]
+  (-> ^Entity$Builder (make-ds-entity-builder raw-key raw-values options)
+      (.build)))


Draw titles on radial charts

Draw titles on radial charts

--- src/utree/radial.clj
+++ src/utree/radial.clj
@@ -62,8 +62,8 @@
       (.lineTo path x y))
     path))

-(def *graphics* nil)
-(def *scale* 1.0)
+(def ^:dynamic *graphics* nil)
+(def ^:dynamic *scale* 1.0)
 (defn set-color [color] (.setColor *graphics* color))
 (defn draw [shape] (.draw *graphics* shape))
 (defn fill [shape] (.fill *graphics* shape))
@@ -97,8 +97,11 @@
 (defmacro with-scaling [scale & body]
   `(binding [*scale* ~scale]
      (with-graphics (doto (.create *graphics*) (.scale ~scale ~scale))
-       (do
-         ~@body))))
+       (do ~@body))))
+
+(defmacro with-translation [tx ty & body]
+  `(with-graphics (doto (.create *graphics*) (.translate (double ~tx) (double ~ty)))
+     (do ~@body)))

 (defn draw-hull
   [ds]
@@ -113,25 +116,38 @@
   (doseq [[x y] (polar->cartesian polars)]
     (line 0 0 x y)))

+(defn draw-centered-string [cx cy str]
+  (let [layout (text-layout str)
+        bounds (.getBounds layout)]
+    (.draw layout *graphics*
+           (float (- cx (.x bounds) (/ (.width bounds) 2.0)))
+           (float (- cy (.y bounds) (/ (.height bounds) 2.0))))))
+
 (defn draw-labels
   [scale labels]
   (doseq [[l [r theta]] labels]
-    (let [[cx cy] (polar->cartesian (* scale r) theta)
-          layout (text-layout l)
-          bounds (.getBounds layout)]
-      (.draw layout *graphics*
-                   (float (- cx (.x bounds) (/ (.width bounds) 2.0)))
-                   (float (- cy (.y bounds) (/ (.height bounds) 2.0)))))))
+    (let [[cx cy] (polar->cartesian (* scale r) theta)]
+      (draw-centered-string cx cy l))))
+
+(defn draw-title
+  [w h t]
+  (set-color color-labels)
+  (set-font-size 24.0)
+  (let [tl (text-layout t)
+        text-height (.getHeight (.getBounds tl))]
+    (prn text-height)
+    (draw-centered-string (/ w 2) text-height t)
+    text-height))

 (defn draw-radar
-  [ds w h]
+  [ds w h t]
   (set-color color-background)
   (fill-rect 0 0 w h)
-  (let [scale (/ (min (- w 60) (- h 60)) 2.0)]
-    (translate (/ w 2.0) (/ h 2.0))
+  (let [scale (/ (min (- w 60) (- h 60)) 2.0)
+        yoff (draw-title w h t)]
+    (translate (/ w 2.0) (+ yoff (/ h 2.0)))
     (with-scaling scale
       (set-pen-width 1.5)
-
       (set-color color-axis)
       (draw-radials (axes ds))
       (set-pen-width 3.0)
@@ -143,12 +159,12 @@
     (draw-labels scale (labels ds))))

 (defn make-radar-panel
-  [ds width height]
+  [ds width height title]
   (doto
       (proxy [javax.swing.JComponent] []
         (paintComponent [g]
                         (with-antialiasing g
-                          (draw-radar ds (.getWidth this) (.getHeight this)))))))
+                          (draw-radar ds (.getWidth this) (.getHeight this) title))))))

 (defn show-radar-display-in-frame
   "Display a new window with a radar plot of the given data items.
@@ -159,7 +175,7 @@
    that the Performance measure scored 3 out of a possible 10. (All scores start from 0.)"
   [ds & options]
   (let [{:keys [width height title]} (into default-frame-options (apply hash-map options))
-        radar (make-radar-panel ds width height)
+        radar (make-radar-panel ds width height title)
         panel (doto (JPanel.)
                 (.setBorder (javax.swing.BorderFactory/createEmptyBorder 20 20 20 20))
                 (.setLayout (BorderLayout.))
@@ -176,20 +192,24 @@

 (defn write-radar-display-to-file
   [ds filename & options]
-  (let [{:keys [width height]} (into default-frame-options (apply hash-map options))
+  (let [{:keys [width height title]} (into default-frame-options (apply hash-map options))
         image (BufferedImage. width height BufferedImage/TYPE_INT_RGB)
         image-type (type-from-file filename)]
     (with-antialiasing (.createGraphics image)
-      (draw-radar ds width height))
+      (draw-radar ds width height title))
     (ImageIO/write image image-type (File. filename))))

-(def test-data
-     '[("Performance" 1 10)
-       ("Security" 2 5)
-       ("Scalability" 7 10)
-       ("Availability" 8 10)
-       ("Portability" 5 10)
-       ("Modifiability" 3 10)])

 (comment
-  (show-radar-display test-data))
+  (def test-data
+    '[("Performance" 1 10)
+      ("Security" 2 5)
+      ("Scalability" 7 10)
+      ("Availability" 8 10)
+      ("Portability" 5 10)
+      ("Modifiability" 3 10)])
+
+  (show-radar-display-in-frame test-data :title "Solution A")
+
+  (write-radar-display-to-file test-data "/tmp/radar.png" :title "Solution A")
+  )


Add config include function.

Add config include function.

--- src/vault/system.clj
+++ src/vault/system.clj
@@ -4,8 +4,12 @@
     [clj-time.core :as time]
     [clojure.java.io :as io]
     [com.stuartsierra.component :as component]
-    [environ.core :refer [env]]))
+    [environ.core :refer [env]])
+  (:import
+    java.io.File))

+
+;; ## System Components

 (def core
   (component/system-map))
@@ -25,4 +29,24 @@
   (component :defaults (apply hash-map ks)))

-; TODO: see riemann.config/include
+
+;; ## Configuration Files
+
+(defn- clj-file?
+  "Determines whether the given file is a clojure file."
+  [^File file]
+  (and (.isFile file)
+       (.matches (.getName file) ".*\\.clj$")))
+
+
+(defn include
+  "Include another config file or directory. If the path points to a directory,
+  all files with names ending in `.clj` within it will be loaded recursively."
+  [path]
+  (let  [file (io/file path)]
+    (binding [*ns* (find-ns 'vault.system)]
+      (if (.isDirectory file)
+        (doseq [f (file-seq file)]
+          (when (clj-file? f)
+            (load-file (str f))))
+        (load-file path)))))


Tests for following API calls: create job via template and update job

--- test/emender_jenkins/jenkins_api_test.clj
+++ test/emender_jenkins/jenkins_api_test.clj
@@ -84,6 +84,18 @@
         (is (callable? 'emender-jenkins.jenkins-api/error-response-structure))))

+(deftest test-job-related-command-existence
+    "Check that the emender-jenkins.jenkins-api/job-related-command definition exists."
+    (testing "if the emender-jenkins.jenkins-api/job-related-command definition exists."
+        (is (callable? 'emender-jenkins.jenkins-api/job-related-command))))
+
+
+(deftest test-update-template-existence
+    "Check that the emender-jenkins.jenkins-api/update-template definition exists."
+    (testing "if the emender-jenkins.jenkins-api/update-template definition exists."
+        (is (callable? 'emender-jenkins.jenkins-api/update-template))))
+
+
 (deftest test-start-job-existence
     "Check that the emender-jenkins.jenkins-api/start-job definition exists."
     (testing "if the emender-jenkins.jenkins-api/start-job definition exists."


More tests.

More tests.

--- test/onyx/coordinator/simulation_test.clj
+++ test/onyx/coordinator/simulation_test.clj
@@ -156,7 +156,20 @@

         (testing "The payload node is populated"
           (let [event (<!! sync-spy)]
-            (is (= (:path event) payload-node))))))))
+            (is (= (:path event) payload-node))))
+
+        (let [db (d/db (:conn log))]
+
+          (testing "It receives the :in task"
+            (let [task (:task (extensions/read-place sync payload-node))
+                  query '[:find ?task :where [?task :task/name :in]]]
+              (is (= (:db/id task) (ffirst (d/q query db))))))
+
+          (testing "The payload node contains the other node paths"
+            (let [nodes (:nodes (extensions/read-place sync payload-node))]
+              (is (= (clojure.set/difference (into #{} (keys nodes))
+                                             #{:payload :ack :completion :status})
+                     #{})))))))))

 (run-tests 'onyx.coordinator.simulation-test)


Clean up

Clean up

--- src/i18n_word_guess/game.clj
+++ src/i18n_word_guess/game.clj
@@ -23,7 +23,7 @@

 (defn- reveal [side mask]
   (let [edge (case side
-               :front (.indexOf mask "*")
+               :front (.indexOf     mask "*")
                :back  (.lastIndexOf mask "*"))]
     (if (neg? edge)
       mask


JSON keywords

JSON keywords

--- src/kixi/hecuba/web/amon.clj
+++ src/kixi/hecuba/web/amon.clj
@@ -81,10 +81,10 @@

   :malformed?
   (fn [{{body :body {entity-id :amon/entity-id} :route-params} :request}]
-    (let [body (decode body)]
+    (let [body (decode body keyword)]
       ;; We need to assert a few things
       (or
-       (not= (get body "entityId") entity-id))))
+       (not= (:entityId body) entity-id))))

   :post!
   (fn [{{body :body {entity-id :amon/entity-id} :route-params} :request}]


handler receives state atom, not value

handler receives state atom, not value

--- src/lambdacd_cctray/core.clj
+++ src/lambdacd_cctray/core.clj
@@ -42,8 +42,8 @@
   (xml/emit-str
     (xml/element :Projects {} (projects-for pipeline-def pipeline-state))))

-(defn cctray-handler-for [pipeline-def pipeline-state]
+(defn cctray-handler-for [pipeline-def state-atom]
   {:status  200
    :headers {"Content-Type" "application/xml"}
-   :body    (cctray-xml-for pipeline-def pipeline-state)})
+   :body    (cctray-xml-for pipeline-def @state-atom)})


Add Spanish support to the desktop version

--- desktop/src/nightweb_desktop/utils.clj
+++ desktop/src/nightweb_desktop/utils.clj
@@ -30,6 +30,7 @@
 ; language

 (def lang-files {"en" "values/strings.xml"
+                 "es" "values-es/strings.xml"
                  "de" "values-de/strings.xml"
                  "fr" "values-fr/strings.xml"
                  "ja" "values-ja/strings.xml"})


Minor refactoring, remove memoization, rename things

--- boot/pod/src/boot/file.clj
+++ boot/pod/src/boot/file.clj
@@ -109,7 +109,7 @@
           outs   (map #(srcdir->outdir % src dest) files)]
       (mapv copy-with-lastmod (map io/file files) (map io/file outs)))))

-(defn files-for [& dirs]
+(defn tree-for [& dirs]
   (->> (for [dir dirs]
          (let [path  (-> (if (string? dir) dir (.getPath dir)) (.replaceAll "/$" ""))
                snip  (count (str path "/"))]
@@ -121,14 +121,9 @@
                         {}))))
        (reduce (partial merge-with into) {})))

-(def time-diff-memo
-  (memoize
-    (fn [bef aft]
-      ((fn [[b a]] [(set/difference b a) a])
-       (->> (data/diff bef aft) (take 2) (map (comp set keys)))))))
-
 (defn time-diff [before after]
-  (time-diff-memo (:time before) (:time after)))
+  ((fn [[b a]] [(set/difference b a) a])
+   (->> (data/diff (:time before) (:time after)) (take 2) (map (comp set keys)))))

 (defmulti  patch-cp? (fn [pred a b] pred))
 (defmethod patch-cp? :default [_ a b] true)
@@ -145,8 +140,8 @@
         [:cp x a]))))

 (defn sync! [pred dest & srcs]
-  (let [before (files-for dest)
-        after  (apply files-for srcs)]
+  (let [before (tree-for dest)
+        after  (apply tree-for srcs)]
     (doseq [[op p x] (patch pred before after)]
       (case op
         :rm (io/delete-file x true)
@@ -155,7 +150,7 @@
 (defn watcher! [pred & dirs]
   (let [state (atom nil)]
     (fn []
-      (let [state' (apply files-for dirs)
+      (let [state' (apply tree-for dirs)
             patch' (patch pred @state state')]
         (reset! state state')
         patch'))))


removed buggy conference search bar for pre go live - please revert this commit afterwards

--- src/cljs/conference_rating/conference_list_page/conference_list_page.cljs
+++ src/cljs/conference_rating/conference_list_page/conference_list_page.cljs
@@ -63,8 +63,7 @@
   [:div
    (navbar/nav-bar)
    [:div {:class "container-fluid content-container pad-top"}
-    [:div {:class "conference-search form-group"}
-     [(search-for-conference-component conference-list)]]
+    [:div {:class "conference-search form-group"}]
     (add-conference-bar)
     [:div {:class "row"}(map list-entry/display-conference-list-item (sort-by :from conference-list))]]])


fix test

fix test

--- test/babel/test/en.cljc
+++ test/babel/test/en.cljc
@@ -139,7 +139,7 @@

 (deftest mod-is-empty-list
   (let [result (generate {:modified false
-                          :synsem {:cat :verb
+                          :synsem {:cat :noun
                                    :sem {:pred :name
                                          :mod '()}}})]
     (is (= (get-in result [:synsem :sem :mod]


add more examples

add more examples

--- test/babel/test/it.cljc
+++ test/babel/test/it.cljc
@@ -219,6 +219,5 @@
          "la sua ragazza dorme"
          "la sua ragazza bella dorme"
          "noi beviamo la loro acqua bella"
-         "noi abbiamo bevuto la loro acqua bella"])))
-
-
+         "noi abbiamo bevuto la loro acqua bella"
+         "Luisa e io abbiamo bevuto la loro acqua bella"])))


add new test

add new test

--- test/babel/test/it.cljc
+++ test/babel/test/it.cljc
@@ -189,5 +189,13 @@
                             (is (not (empty? parsed)))))
                         expressions))))))

-
-
+(deftest the-red-cat-woke-up
+  (let [result (parse "il gatto rosso si è alzato")]
+    ;; should find at least one structure:
+    (is (not (empty? result)))
+    ;; formatting the first of the resultant parse trees:
+    ;; output should be the same as the input to the parser:
+    (is (= "il gatto rosso si è alzato"
+           (fo (first result))))))
+
+


enable "a casa" test

enable "a casa" test

--- test/babel/test/it.cljc
+++ test/babel/test/it.cljc
@@ -1,11 +1,14 @@
 (ns babel.test.it
   (:refer-clojure :exclude [get-in])
-  (:require [babel.italiano.grammar :refer [small medium np-grammar]]
+  (:require [babel.engine :as engine]
+            [babel.forest :as forest]
+            [babel.italiano.grammar :refer [small medium np-grammar]]
             [babel.italiano.lexicon :refer [lexicon]]
             [babel.italiano.morphology :as morph :refer [analyze-regular fo replace-patterns]]
             [babel.italiano.morphology.nouns :as nouns]
             [babel.italiano.morphology.verbs :as verbs]
-            [babel.italiano.workbook :refer [analyze generate parse]]
+            [babel.italiano.workbook :refer [analyze generate lightning-bolt parse]]
+            [babel.over :as over]
             [babel.parse :as parse]
             #?(:clj [clojure.test :refer [deftest is]])
             #?(:cljs [cljs.test :refer-macros [deftest is]])
@@ -14,8 +17,7 @@
             [clojure.repl :refer [doc]]
             [clojure.string :as string]
             [clojure.set :as set]
-            [dag_unify.core :refer [copy get-in strip-refs]]
-            [babel.engine :as engine]))
+            [dag_unify.core :refer [copy fail? get-in strip-refs]]))

 (deftest analyze-1
   (let [singular (analyze "compito")
@@ -269,7 +271,7 @@
                 {:synsem {:cat :verb
                           :sem {:tense :present
                                 :pred :a
-                                :obj {:pred :casa}
+                                :obj {:pred :casa
+                                      :spec {:def :none}} ;; "a casa", not "a tua casa", "a della casa", etc
                                 :subj {:pred :I}}}})]
-    (is (or true
-            (= (fo result) "io sono a casa")))))
+    (is (= (fo result) "io sono a casa"))))


fix typo in 3 tests

fix typo in 3 tests

--- test/babel/test/it.cljc
+++ test/babel/test/it.cljc
@@ -312,12 +312,12 @@

 (deftest chiamarsi-1
   (let [result (parse "io mi chiamo Luisa")]
-    (not (empty? (mapcat :parses result)))))
+    (is (not (empty? (mapcat :parses result))))))

 (deftest chiamarsi-2
   (let [result (parse "tu ti chiami Luisa")]
-    (not (empty? (mapcat :parses result)))))
+    (is (not (empty? (mapcat :parses result))))))

 (deftest chiamarsi-3
   (let [result (parse "lei si chiama Luisa")]
-    (not (empty? (mapcat :parses result)))))
+    (is (not (empty? (mapcat :parses result))))))


Add record-spec to cljs test runner.

Add record-spec to cljs test runner.

--- test/active/clojure/test_runner.cljs
+++ test/active/clojure/test_runner.cljs
@@ -5,6 +5,7 @@
             [active.clojure.lens-test]
             [active.clojure.monad-test]
             [active.clojure.record-test]
+            [active.clojure.record-spec-test]
             [active.clojure.match-test]
             [active.clojure.config-test]))

@@ -13,5 +14,6 @@
            'active.clojure.lens-test
            'active.clojure.monad-test
            'active.clojure.record-test
+           'active.clojure.record-spec-test
            'active.clojure.match-test
            'active.clojure.config-test)


Tests for thread-last.

Tests for thread-last.

Updated thread-last tests to conform to the four following criteria as per
this blog post: http://www.reflectionlibrary.co/blog/?p=157
	* Depth of nesting greater than a given level
	* Nesting depth for non-last args less than a given level
	* The call is a top-level threadable call
	* The call is to a function for which treading makes sense

--- formatter/test/formatter/Extensions/thread_last_test.clj
+++ formatter/test/formatter/Extensions/thread_last_test.clj
@@ -18,6 +18,7 @@
     (is (= 1
            (count (get-suggestions clojuredocs-example))))))

+;;;; Using styler code in Resources:
 (def code-styler (slurp "test/resources/styler_20140115.txt"))
 (def styler-suggestions (get-suggestions code-styler))
 (def first-suggestions (set-of-first styler-suggestions))
@@ -43,21 +44,45 @@
     (is
       (contains? first-suggestions "(compojure/GET"))))

+;;;; WHY DO WE EVEN WANT TO PICK THIS ONE UP!?
+;;;; It's not threadable in the least!
+;;;; Changed it to *does not* pick it up.
 ;; Tests for:
 ;(html/defsnippet extensions-list "landing.html" *extensions-sel*
 ;  [extension]
 ;  [:a] (html/do->
 ;         (html/content (:description extension))
 ;         (html/set-attr :href (:url extension))))
-; There are other defsnippets that could *possibly* be picked up if code is wrong! It should only pick up this one, though.
 (deftest html-defsnippet
-  (testing "Tests that it picks up html/defsnippet (level 4 nesting)."
+  (testing "Tests that it *doens't* pick up html/defsnippet (L 3 non-last)."
     (is
-      (= 1
+      (= 0
          (->> styler-suggestions
               (map #(first (clojure.string/split % #" ")))
               (filter #(= "(html/defsnippet" %))
               (count))))))
+
+;;;; Using split-chain
+(def split-chain "(+ 1 (- 2 (- 3 (+ 4 (- 5 6))) (+ 7 (- 8 (+ 9 (+ 10 11))))))")
+(def split-suggestions (into #{} (get-suggestions split-chain)))
+
+(deftest does-not-suggest-multipath-calls
+  (testing "Tests that it doesn't suggest calls which have split paths"
+    (is (not (contains? split-suggestions split-chain)))))
+
+(deftest suggests-subtrees
+  (testing "Tests that it does suggest subtrees inside a non-threading node"
+    (is (and (contains? split-suggestions "(- 3 (+ 4 (- 5 6)))")
+             (contains? split-suggestions "(+ 7 (- 8 (+ 9 (+ 10 11))))")))))
+
+;; Tests that if there's a long thread-tail, it only picks the highest-order thread
+; So, (+ 1 (- 2 (- 3 (+ 4 (- 5 (+ 6 (+ 7 (- 8 (+ 9 (+ 10)))))))))) should only
+; return one result! It should not return, say, (- 8 (+ 9 (+ 10))).
+(def long-chain "(+ 1 (- 2 (- 3 (+ 4 (- 5 (+ 6 (+ 7 (- 8 (+ 9 10)))))))))")
+(deftest does-not-suggest-subresults
+  (testing "Tests that it doesn't suggest sub-results."
+    (is (= 1
+           (count (get-suggestions long-chain))))))

 ;; Test to see whether we can rebind *do-not-nest*
 (binding [ext/*do-not-nest* (conj ext/*do-not-nest* "html/defsnippet")]


add tooltips to layer icons

add tooltips to layer icons

--- frontend/src/uxbox/main/ui/workspace/sidebar/layers.cljs
+++ frontend/src/uxbox/main/ui/workspace/sidebar/layers.cljs
@@ -316,7 +316,7 @@
                (mx/with-key key))))]]
      [:div.layers-tools
       [:ul.layers-tools-content
-       [:li.clone-layer {:on-click duplicate} i/copy]
-       [:li.group-layer {:on-click group} i/folder]
-       [:li.degroup-layer {:on-click degroup} i/ungroup]
-       [:li.delete-layer {:on-click delete} i/trash]]]]))
+       [:li.clone-layer.tooltip.tooltip-top {:alt "Duplicate" :on-click duplicate} i/copy]
+       [:li.group-layer.tooltip.tooltip-top {:alt "Group" :on-click group} i/folder]
+       [:li.degroup-layer.tooltip.tooltip-top {:alt "Ungroup" :on-click degroup} i/ungroup]
+       [:li.delete-layer.tooltip.tooltip-top {:alt "Delete" :on-click delete} i/trash]]]]))


yes, core-async

yes, core-async

--- brave-true/playsync/src/playsync/core.clj
+++ brave-true/playsync/src/playsync/core.clj
@@ -2,9 +2,223 @@
   (:require [clojure.core.async
              :as a
              :refer [>! <! >!! <!! go chan buffer close! thread
-                     alts! alts!! timeout]]))
-
-(defn -main
-  "I don't do a whole lot ... yet."
-  [& args]
-  (println "Hello, World!"))
+                     alts! alts!! timeout]]
+            [midje.sweet :refer :all]))
+
+
+(def echo-chan (chan))
+
+(go (println (<! echo-chan)))
+
+(fact "process that simply prints the meassage it receives:"
+  (>!! echo-chan "ketchup")
+  => true)
+
+;;  you can create buffered channels:
+(def echo-buffer (chan 2))
+
+(fact
+  (>!! echo-buffer "ketchup")
+  => true)
+
+(fact
+  (>!! echo-buffer "ketchup")
+  => true)
+
+;;(fact
+;;  (>!! echo-buffer "ketchup")
+;;  => java.lang.TreadDeath) ;;blocks
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; go blocks, thread, blocking and parking
+
+(def hi-chan (chan))
+
+(doseq [n (range 1000)]
+  (go (>! hi-chan (str "hi " n))))
+
+;; when your process will take a long time before putting or taking, and for
+;; those occasions you should use thread:
+(thread (println (<!! echo-chan)))
+
+(fact
+  (>!! echo-chan "mustard")
+  => true)
+;; => mustard
+
+(fact "When thread's process stops, the process's return value is put on
+       the channel that thread returns:"
+  (let [t (thread "chili")]
+    (<!! t))
+  => "chili")
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; the hot dog process
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(defn hotdog-machine
+  []
+  (let [in (chan)
+        out (chan)]
+    (go (<! in)
+        (>! out "hotdog"))
+    [in out]))
+
+
+(fact "YES!, pocket lint:"
+
+  (let [[in out] (hotdog-machine)]
+    (>!! in "pocket lint")
+    (<!! out))
+  => "hotdog")
+
+
+(defn hotdog-machine-v2
+  [hotdog-count]
+  (let [in (chan)
+        out (chan)]
+    (go (loop [hc hotdog-count]
+          (if (> hc 0)
+            (let [input (<! in)]
+              (if (= 3 input)
+                (do (>! out "hotdog")
+                    (recur (dec hc)))
+                (do (>! out "wilted lettuce")
+                    (recur hc))))
+            (do (close! in)
+                (close! out)))))
+    [in out]))
+
+
+(fact "here we go:"
+
+  (let [[in out] (hotdog-machine-v2 2)]  ;; two hotdogs
+    (>!! in "pocket lint")
+    (println (<!! out))     ;; wilted lettus
+
+    (>!! in 3)
+    (println (<!! out))     ;; a hotdog
+
+    (>!! in 3)
+    (println (<!! out))     ;; a hotdog
+
+    (>!! in 3)
+    (<!! out))    => nil)   ;; nut'in
+
+
+(fact "a pipeline of processes:"
+
+  (let [c1 (chan)
+        c2 (chan)
+        c3 (chan)]
+    (go (>! c2 (clojure.string/upper-case (<! c1))))
+    (go (>! c3 (clojure.string/reverse (<! c2))))
+    (go (println (<! c3)))
+    (>!! c1 "redrum"))
+  ;; => MURDER
+  => true)
+
+;; States:  "ready to receive money"  "dispensed item"
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; choice
+;;;;;;;;;;;;;;;;;;;;;;;;;
+
+;; alts!
+
+(defn upload
+  [headshot c]
+  (go (Thread/sleep (rand 100))
+      (>! c headshot)))
+
+(let [c1 (chan)
+      c2 (chan)
+      c3 (chan)]
+  (upload "serious.jpg" c1)
+  (upload "fun.jpg" c2)
+  (upload "sassy.jpg" c3)
+  (let [[headshot channel] (alts!! [c1 c2 c3])]
+    (println "Sending headshot notification for" headshot)))
+; => Sending headshot notification for sassy.jpg
+
+
+;; timeout, should succede 20% of the time
+(let [c1 (chan)]
+  (upload "serious.jpg" c1)
+  (let [[headshot channel] (alts!! [c1 (timeout 20)])]
+    (if headshot
+      (println "Sending headshot notification for" headshot)
+      (println "Timed out!"))))
+;; => Timed out!
+
+;; You can also use alts!! to specify "put" operations. To do that, put a
+;; vector inside the vector you pass to alts, like this:
+(fact
+  (let [c1 (chan)
+        c2 (chan)]
+    (go (<! c2))
+    (let [[value channel] (alts!! [c1 [c2 "put!"]])]
+      (println value)
+      (= channel c2)))
+  ;; => true
+  => true)
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; queues
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(defn append-to-file
+  [filename s]
+  (spit filename s :append true))
+
+(defn format-quote
+  [quote]
+  (str "=== BEGIN QUOTE ===\n" quote "=== END QUOTE ===\n\n"))
+
+(defn random-quote
+  []
+  (format-quote (slurp "http://www.iheartquotes.com/api/v1/random")))
+
+(defn snag-quotes
+  [filename num-quotes]
+  (let [c (chan)]
+    (go (while true (append-to-file filename (<! c))))
+    (dotimes [n num-quotes] (go (>! c (random-quote))))))
+
+;; (snag-quotes "/tmp/quotes" 2)
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; callbacks
+;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(defn upper-caser
+  [in]
+  (let [out (chan)]
+    (go (while true (>! out (clojure.string/upper-case (<! in)))))
+    out))
+
+(defn reverser
+  [in]
+  (let [out (chan)]
+    (go (while true (>! out (clojure.string/reverse (<! in)))))
+    out))
+
+(defn printer
+  [in]
+  (go (while true (println (<! in)))))
+
+(def in-chan (chan))
+(def upper-caser-out (upper-caser in-chan))
+(def reverser-out (reverser upper-caser-out))
+(printer reverser-out)
+
+(>!! in-chan "redrum")
+; => MURDER
+
+(>!! in-chan "repaid")
+; => DIAPER


Update AWS access key hint.

Update AWS access key hint.

--- src/mash_commander/core.cljs
+++ src/mash_commander/core.cljs
@@ -46,8 +46,8 @@
     (if (nil? polly)
       (do
         (print "Polly needs AWS credentials to say:" what)
-        (print "window.localStorage.setItem('accessKeyId', /* access key id */)")
-        (print "window.localStorage.setItem('secretAccessKey', /* secret access key */"))
+        (print "window.localStorage.setItem('aws-access-key-id', /* access key id */)")
+        (print "window.localStorage.setItem('aws-secret-access-key', /* secret access key */"))
       (. polly synthesizeSpeech (clj->js {:Text what
                                           :OutputFormat "mp3"
                                           :VoiceId "Ivy"})


Nix when-lets in content creation options

--- src/uruk/core.clj
+++ src/uruk/core.clj
@@ -628,45 +628,33 @@
     (when-not (every? valid-content-creation-options (keys options))
       ;; TODO switch to spec
       (throw (IllegalArgumentException. "Invalid content creation option. Keywords passed in `options` must be a subset of `valid-content-creation-options`.")))
-    (when-let [bs (:buffer-size options)]
-      (.setBufferSize cco bs))
-    (when-let [c (:collections options)]
-      (.setCollections cco (into-array String c)))
-    (when-let [e (:encoding options)]
-      (.setEncoding cco e))
-    (when-let [f (:format options)]
-      (.setFormat cco (doc-format f)))
-
-    (when-let [g (:graph options)]
-      (.setGraph cco g))
-    (when-let [lang (:language options)]
-      (.setLanguage cco lang))
-    (when-let [locale (:locale options)]
-      (.setLocale cco locale))
-    (when-let [n (:namespace options)]
-      (.setNamespace cco n))
-    (when-let [perms (:permissions options)]
-      (.setPermissions cco (into-array ContentPermission
-                                       (reduce (fn [permissions permission]
-                                                 (conj permissions
-                                                       (ContentPermission.
-                                                        (content-capability (val (first permission)))
-                                                        (key (first permission)))))
-                                               []
-                                               perms))))
-
-    (when-let [pk (:placement-keys options)]
-      (.setPlaceKeys cco pk)) ;; FIXME bigint and long array casts?
-    (when-let [q (:quality options)]
-      (.setQuality cco q))
-    (when-let [rl (:repair-level options)]
-      (.setRepairLevel cco (doc-repair-level rl)))
-    (when-let [rbs (:resolve-buffer-size options)]
-      (.setResolveBufferSize cco rbs))
-    (when-let [re (:resolve-entities options)]
-      (.setResolveEntities cco re))
-    (when-let [tc (:temporal-collection options)]
-      (.setTemporalCollection cco tc))
+    (let [xs [[:buffer-size #(.setBufferSize cco %)]
+              [:collections #(.setCollections cco (into-array String %))]
+              [:encoding    #(.setEncoding cco %)]
+              [:format      #(.setFormat cco (doc-format %))]
+              [:graph       #(.setGraph cco %)]
+              [:language    #(.setLanguage cco %)]
+              [:locale      #(.setLocale cco %)]
+              [:namespace   #(.setNamespace cco %)]
+              [:permissions #(.setPermissions
+                              cco
+                              (into-array ContentPermission
+                                          (reduce (fn [permissions permission]
+                                                    (conj permissions
+                                                          (ContentPermission.
+                                                           (content-capability (val (first permission)))
+                                                           (key (first permission)))))
+                                                  []
+                                                  %)))]
+              [:placement-keys #(.setPlaceKeys cco %)]
+              [:quality #(setQuality cco %)]
+              [:repair-level #(.setRepairLevel cco (doc-repair-level %))]
+              [:resolve-buffer-size #(.setResolveBufferSize cco %)]
+              [:resolve-entities #(.setResolveEntities cco %)]
+              [:temporal-collection #(.setTemporalCollection cco %)]]]
+      (doseq [[k fn] xs]
+        (when-let [x (k options)]
+          (f x))))
     cco))

 (defn describe-content-creation-options


using fair round roben instead of random

--- src/vc/vijava.clj
+++ src/vc/vijava.clj
@@ -62,11 +62,14 @@
          (deliver ~p ~body) service)
        (catch Throwable e# (deliver ~p e#) service))))

+(def robin (atom 0N))
+
 (defmacro with-service
   "Uses recycled service instances see http://bit.ly/YRsiNo,
   We try to keep all agents busy still rand isn't fair (cycle would work better)."
   [body]
-  `(let [a# ((services) (rand-int (count (services)))) p# (promise)]
+  `(let [a# ((services) (mod (swap! robin inc) (count (services)))) p# (promise)]
+     (trace "using session " (hash a#) " robin is " @robin)
      (send a# (execute ~body p#))
      (let [res# @p#]
        (when (instance? Throwable res#)


Add UI for scroll to top button

Add UI for scroll to top button

--- frontend/src/cruncher/utils/views.cljs
+++ frontend/src/cruncher/utils/views.cljs
@@ -2,6 +2,7 @@
   "Reusable components, which use twitter bootstrap to reduce redundancy."
   (:require [om.next :as om :refer-macros [defui]]
             [om.dom :as dom :include-macros true]
+            [goog.dom :as gdom]
             [cruncher.utils.lib :as lib]))

 (defn sortable-table-header
@@ -25,12 +26,10 @@
   "Wrapper for font-awesome icons."
   ([class]
    (dom/i #js {:react-key (lib/get-unique-key)
-               :key       (lib/get-unique-key)
                :className (str "fa " class)}))
   ([class f]
    (println f)
    (dom/i #js {:react-key (lib/get-unique-key)
-               :key       (lib/get-unique-key)
                :className (str "pointer fa " class)
                :onClick   f})))

@@ -72,4 +71,13 @@
                            :onClick #(lib/change-view! :login)}
                       (fa-icon "fa-sign-out")
                       " Login")))))
-(def login-indicator (om/factory LoggedIn))+(def login-indicator (om/factory LoggedIn))
+
+(defui BackToTop
+  Object
+  (render [this]
+    (dom/div #js {:className (str "scrolltop")
+                  :onClick   #(.scroll js/window 0 0)}
+             (dom/div #js {:className "scroll icon"}
+                      (fa-icon "fa-angle-up")))))
+(def back-to-top (om/factory BackToTop))


Better output message: singular versus plural + number of words that have been added

--- src/zg/server.clj
+++ src/zg/server.clj
@@ -97,7 +97,9 @@
 (defn add-words-message
     [words]
     (if (seq words)
-        (str "The following words have been added into the dictionary: '" (clojure.string/join "," words) "'. Thank you!")
+        (if (> (count words) 1)
+            (str "The following " (count words) " words have been added into the dictionary: '" (clojure.string/join "," words) "'. Thank you!")
+            (str "The following word has been added into the dictionary: '" (clojure.string/join "," words) "'. Thank you!"))
         "No words have been added..."))

 (defn split-words


interestingly, this order builds correctly on ubuntu 64 10.10 server

--- config/projects/chef-full.clj
+++ config/projects/chef-full.clj
@@ -18,5 +18,5 @@
 ;;

 (project "chef-full" "0.9.12"
-         :build-order [ "prep" "zlib" "libiconv" "readline" "db" "gdbm" "ncurses"
+         :build-order [ "prep" "gdbm" "zlib" "libiconv" "readline" "db" "ncurses"
                         "openssl" "libxml2" "libxslt" "ree" "rsync" "chef" ])


fix typos

fix typos

--- day3/src/day3/csv.clj
+++ day3/src/day3/csv.clj
@@ -67,9 +67,9 @@
   {:pre [(pos? (count rows)) (keyword? id)]
    ; :post [(> (:avg %) 0.1)]
    }
-  {:min (transduce (map id) min Double/MAX_VALUE temps)
-   :max (transduce (map id) max (- Double/MAX_VALUE) temps)
-   :avg (/ (transduce (map id) + 0 temps) (count temps))})
+  {:min (transduce (map id) min Double/MAX_VALUE rows)
+   :max (transduce (map id) max (- Double/MAX_VALUE) rows)
+   :avg (/ (transduce (map id) + 0 rows) (count rows))})

 (defn load-temperatures
   []


azulenoids.clj: removed last references to Java code

--- clojure/org/gavrog/clojure/azulenoids.clj
+++ clojure/org/gavrog/clojure/azulenoids.clj
@@ -5,7 +5,6 @@
           [generators :only [results]]
           [branchings2d :only [branchings]]
           [combineTiles :only [combine-tiles]]))
-  (:import (org.gavrog.joss.dsyms.generators CombineTiles))
   (:gen-class))

 ;; Azulenoid-specific functions
@@ -41,7 +40,6 @@
     spun))

 (def octa-sets (filter #(-> % (curvature 1) (>= 0))
-                       ;(lazy-seq (CombineTiles. (java-dsymbol octagon)))))
                        (results (combine-tiles octagon))))

 (def octa-syms


Simulation ns tweaks: now spitting out csv stats for grepping

--- src/polismath/simulation.clj
+++ src/polismath/simulation.clj
@@ -78,11 +78,20 @@
   (debug-repl)
   conv)

+(defn conv-stat-row
+  [zid votes conv]
+  (str "XXX,"
+       zid ","
+       (count (:base-clusters conv)) ","
+       (count votes) ","
+       (count (rownames (:rating-mat conv)))))
+

 (defn endlessly-sim [opts]
   (let [simulator (atom (make-vote-gen opts))
         conversations (atom {})
         vote-rate (:vote-rate opts)]
+    (println "XXX,conv,k,votes,ptpts")
     (endlessly (:poll-interval opts)
       (println \newline "POLLING!")
       (let [new-votes (take vote-rate @simulator)
@@ -92,12 +101,11 @@
           (swap! conversations
             (fn [convs]
               (assoc convs zid
-                (let [updated
-                       (conv-update (or (convs zid) {:rating-mat (named-matrix)}) votes)]
-                  (println "updated")
-                  (println (keys (updated)))
-                  updated))))
-          (println zid \newline))))))
+                (conv-update (or (convs zid) {:rating-mat (named-matrix)}) votes))))
+          (let [conv (@conversations zid)]
+            (println (conv-stat-row zid votes conv)))
+          (println \newline "Conv" zid)
+        )))))

 (defn -main [& args]
@@ -113,11 +121,10 @@
   (let [big-ptpts    20000
         big-comments 100
         a (conv-update {:rating-mat (named-matrix)} (random-votes 100 10))
-        a (time2 "CONVUP med" (conv-update a (random-votes 500 10)))]
-        ;a (time2 "CONVUP big" (conv-update a (random-votes big-ptpts big-comments)))]
+        a (time2 "CONVUP med" (conv-update a (random-votes 500 10)))
+        a (time2 "CONVUP big" (conv-update a (random-votes big-ptpts big-comments)))]
     (profile :info :clusters
-      ;(time2 "CONVUP big-part" (conv-update a (random-votes big-ptpts (+ big-comments 2) :n-votes 100))))))
-      (time2 "CONVUP big-part" (conv-update a (random-votes big-ptpts (+ big-comments 2)))))))
+      (time2 "CONVUP big-part" (conv-update a (random-votes big-ptpts (+ big-comments 2)) :large-cutoff 10000)))))

 (defn replay-conv-update [filename]


:fire: Remove commented code.

:fire: Remove commented code.

--- frontend/src/uxbox/main/data/workspace.cljs
+++ frontend/src/uxbox/main/data/workspace.cljs
@@ -865,24 +865,6 @@
     (update [_ state]
       (assoc-in state [:workspace-local :zoom] 2))))

-;; --- Grid Alignment
-
-;; (defn initialize-alignment
-;;   [id]
-;;   (us/verify ::us/uuid id)
-;;   (ptk/reify ::initialize-alignment
-;;     ptk/WatchEvent
-;;     (watch [_ state stream]
-;;       (let [metadata (get-in state [:workspace-page :metadata])
-;;             params {:width c/viewport-width
-;;                     :height c/viewport-height
-;;                     :x-axis (:grid-x-axis metadata c/grid-x-axis)
-;;                     :y-axis (:grid-y-axis metadata c/grid-y-axis)}]
-;;         (rx/concat
-;;          (rx/of (deactivate-flag :grid-indexed))
-;;          (->> (uwrk/initialize-alignment params)
-;;               (rx/map #(activate-flag :grid-indexed))))))))
-
 ;; --- Selection Rect

 (declare select-shapes-by-current-selrect)


Fixed the read only log dir

Fixed the read only log dir

--- src/riak_mesos/scheduler.clj
+++ src/riak_mesos/scheduler.clj
@@ -66,7 +66,7 @@
                                                                           :mode :ro}
                                                                          {:container-path "/var/log/riak-executor"
                                                                           :host-path "/var/log/riak-executor"
-                                                                          :mode :ro} ]}
+                                                                          :mode :rw} ]}
                                                    :command {:shell false}}
                                         }]))
                                 (clj-mesos.scheduler/decline-offer driver (:id offer))))


fix pipeline

fix pipeline

--- backend/src/lambdaui/simple_pipeline.clj
+++ backend/src/lambdaui/simple_pipeline.clj
@@ -5,7 +5,7 @@
             [lambdacd.steps.control-flow :refer [either with-workspace in-parallel run]]
             [lambdacd-git.core :as git]))

-(def repo "git@github.com:flosell/testrepo")
+(def repo "https://github.com/flosell/testrepo.git")

 (defn wait-for-git [args ctx] `(git/wait-for-git ctx repo
                                                  :ref "refs/heads/master"


Temporarily commenting out the per-date message sorting; the front-end is currently building its own matrix

--- src/arktikos/data.clj
+++ src/arktikos/data.clj
@@ -240,7 +240,7 @@
     {:nodes (encode-nodes nodes)
      :links (remove nil? (encode-edges nodes edges eweights))
      :data (mail-to-data msgs (index-nodes nodes))
-     :dates (encode-mail-per-date msgs nodes)
+     ;:dates (encode-mail-per-date msgs nodes)
      }))

 (defn export-mail [msgs destination]


better function name; not always producing csv

--- src/testdouble/cljs/csv.cljs
+++ src/testdouble/cljs/csv.cljs
@@ -1,11 +1,11 @@
 (ns testdouble.cljs.csv
   (:require [clojure.string :as str]))

-(defn- ->csv [data separator]
+(defn- seperate [data separator]
   (str/join separator data))

 (defn- write-data [data separator newline]
-  (str/join newline (map #(->csv % separator) data)))
+  (str/join newline (map #(seperate % separator) data)))

 (def ^:private newlines
   {:lf "\n" :cr+lf "\r\n"})


Use correct ns for validators on uxbox.data.projects ns.

--- src/uxbox/data/projects.cljs
+++ src/uxbox/data/projects.cljs
@@ -23,22 +23,22 @@
 ;; FIXME use only one ns for validators

 (def ^:static +project-schema+
-  {:name [v/required v/string]
-   :width [v/required v/integer]
-   :height [v/required v/integer]
+  {:name [sc/required sc/string]
+   :width [sc/required sc/integer]
+   :height [sc/required sc/integer]
    :layout [sc/keyword]})

 (def ^:static +create-page-schema+
-  {:name [v/required v/string]
+  {:name [sc/required sc/string]
    :layout [sc/keyword]
-   :width [v/required v/integer]
-   :height [v/required v/integer]
-   :project [v/required sc/uuid]})
+   :width [sc/required sc/integer]
+   :height [sc/required sc/integer]
+   :project [sc/required sc/uuid]})

 (def ^:static +update-page-schema+
-  {:name [v/required v/string]
-   :width [v/required v/integer]
-   :height [v/required v/integer]
+  {:name [sc/required sc/string]
+   :width [sc/required sc/integer]
+   :height [sc/required sc/integer]
    :layout [sc/keyword]})

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


Don't forget to copy the creator

Don't forget to copy the creator

--- src/catalog/vubis.clj
+++ src/catalog/vubis.clj
@@ -175,7 +175,7 @@
   "Return a proper production based on a raw item, e.g.
   translate the language tag into proper ISO 639-1 codes"
   [{:keys [record-id source description source-publisher
-           library-signature title
+           library-signature title creator
            genre genre-code language format producer
            produced-commercially? source-date general-note
            series-title series-volume duration
@@ -188,6 +188,7 @@
                  (assoc-some
                   :record-id record-id
                   :title (remove-nonprintable-chars title)
+                  :creator creator
                   :description description
                   :source-publisher source-publisher
                   :source source


Pare down app, attempt to get files list

It's currently failing :(

--- ui/src/bucket/core.cljs
+++ ui/src/bucket/core.cljs
@@ -22,10 +22,17 @@
 ;; FIXME: remove this!
 (add-watch app :debug-watcher
            (fn [_ _ _ _]
-             (.log js/console (clj->js @app))))
+             (.log js/console app)))

 ;; the root element of our application
 (defonce root (.querySelector js/document "main"))
+
+(GET "/files/"
+     {:handler #(om/update! (om/root-cursor app) :files %)
+      :format :json
+      :response-format :json
+      :keywords? true
+      :headers {"Content-Type" "application/json"}})

 (def ^:const id-alphabet "ABCDEFGHJKMNPQRSTVWXYZ0123456789")
 (defn generate-id
@@ -35,40 +42,13 @@
   ([length] (apply str (repeatedly length #(rand-nth id-alphabet)))))

 ;; a single file or folder
-(defcomponent file [component owner]
-  (render-state [this {:keys [delete]}]
-                (html [:div "file"])))
+(defcomponent file [file owner]
+  (render [this]
+          (html [:div {:class "file"} (:name file)])))

-(defcomponent file-list [app owner]
-  (init-state [_]
-    {:create (chan)
-     :delete (chan)})
+(defcomponent file-list [files owner]
+  (render [this]
+          (html [:div {:class "file-list"}
+                 (om/build-all file files)])))

-  (will-mount [_]
-    ;; listen for events that modify the files
-    (let [create (om/get-state owner :create)
-          delete (om/get-state owner :delete)]
-      ;; create
-      (go (loop []
-            (let [component (<! create)]
-              (om/transact! app :components
-                            (fn [components]
-                              ;; add the new component onto the list
-                              (conj components component))
-                            :create)
-              (recur))))
-      ;; delete
-      (go (loop []
-            (let [component (<! delete)]
-              (om/transact! app :components
-                            (fn [components]
-                              (vec (remove #(= component %) components)))
-                            :delete)
-              (recur))))))
-
-  (render-state [this {:keys [create delete]}]
-                (html [:div {:class "file-list"}
-                       (om/build-all file (:files app)
-                                     {:init-state {:delete delete}})])))
-
-(om/root file-list app {:target root})
+(om/root file-list (:files app) {:target root})


SER-2525 | use app metric name

SER-2525 | use app metric name

--- src/vignette/http/routes.clj
+++ src/vignette/http/routes.clj
@@ -9,7 +9,7 @@
             [slingshot.slingshot :refer [try+ throw+]]
             [vignette.http.middleware :refer :all]
             [prometheus.core :as prometheus]
-            [vignette.perfmonitoring.core :refer [metrics-registry]]))
+            [vignette.perfmonitoring.core :refer [metrics-registry, app]]))

 (defn create-routes
   [image-serving-routes]
@@ -25,4 +25,4 @@
       (request-timer)
       (add-headers)
       (add-meta)
-      (prometheus/instrument-handler "vignette" (:registry @metrics-registry))))
+      (prometheus/instrument-handler app (:registry @metrics-registry))))


fix typo in macroexpand

fix typo in macroexpand

--- src/clj/cljs/core.clj
+++ src/clj/cljs/core.clj
@@ -1993,5 +1993,5 @@
              env &env]
     (core/loop [form' (ana/macroexpand-1 env form)]
       (core/if-not (core/identical? form form')
-        (recur (ana/macroexpand-1 env form))
+        (recur (ana/macroexpand-1 env form'))
         form'))))


CLJS-943: REPL require special fn is brittle

use `cljs.repl/merge-require` for require special fn.

--- src/clj/cljs/repl.clj
+++ src/clj/cljs/repl.clj
@@ -230,7 +230,9 @@
           specs)
         requires'
         `(:require
-           ~@(concat
+           ~@(reduce
+               (fn [requires spec]
+                 (merge-require requires spec))
                (rest requires)
                additions))]
     (concat before [requires'] other-specs)))
@@ -258,7 +260,8 @@
          (self repl-env env form nil))
        ([repl-env env [_ [quote spec]] opts]
          (let [original-specs (ana-api/ns-specs ana/*cljs-ns*)
-               new-specs      (update-require-spec original-specs spec)]
+               new-specs (update-require-spec original-specs
+                           (if (symbol? spec) [spec] spec))]
            (evaluate-form repl-env env "<cljs repl>"
              (with-meta
                `(~'ns ~ana/*cljs-ns*


Fixed #1: Symbol & js.RexExp working

Fixed #1: Symbol & js.RexExp working

--- src/cljsfmt/core.cljs
+++ src/cljsfmt/core.cljs
@@ -54,7 +54,7 @@
   (zw/skip zip/next whitespace? zloc))

 (defn- count-newlines [zloc]
-  (loop [zloc zloc
+  (loop [zloc zloc
          newlines 0]
     (if (zw/linebreak? zloc)
       (recur (-> zloc zip/next skip-whitespace)
@@ -141,7 +141,7 @@

 (defn- indent-matches? [key sym]
   (condp instance? key
-    ; Symbol  (= key sym)
+    Symbol  (= key sym)
     js/RegExp (re-find key (str sym))))

 (defn- token? [zloc]
@@ -201,7 +201,7 @@

 (defn- indent-order [[key _]]
   (condp instance? key
-    ;Symbol  (str 0 key)
+    Symbol  (str 0 key)
     js/RegExp (str 1 key)))

 (defn- custom-indent [zloc indents]


Changed copyright text & added comments to core module.

--- src/clouseau/core.clj
+++ src/clouseau/core.clj
@@ -3,18 +3,18 @@
 ;;;
 ;;;    Copyright (C) 2015 Pavel Tisnovsky <ptisnovs@redhat.com>
 ;;;
-;;; Bytecode synth is free software; you can redistribute it and/or modify
+;;; Clouseau is free software; you can redistribute it and/or modify
 ;;; it under the terms of the GNU General Public License as published by
 ;;; the Free Software Foundation; either version 2, or (at your option)
 ;;; any later version.
 ;;;
-;;; Bytecode synth is distributed in the hope that it will be useful, but
+;;; Clouseau is distributed in the hope that it will be useful, but
 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 ;;; General Public License for more details.
 ;;;
 ;;; You should have received a copy of the GNU General Public License
-;;; along with Bytecode synth; see the file COPYING.  If not, write to the
+;;; along with Clouseau; see the file COPYING.  If not, write to the
 ;;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 ;;; 02110-1301 USA.
 ;;;
@@ -36,7 +36,8 @@
 ;;; exception statement from your version.
 ;;;

-(ns clouseau.core)
+(ns clouseau.core
+    "Core module that contains -main function called by Leiningen to start the application.")

 (require '[ring.adapter.jetty      :as jetty])
 (require '[ring.middleware.params  :as http-params])


:sparkles: Add more zoom levels.

:sparkles: Add more zoom levels.


[feature 5904] add #cryptocurrency public chat

Signed-off-by: yenda <96f164ad4d9b2b0dacf8ebee2bb1eeb3aa69adf1@status.im>

--- src/status_im/ui/screens/add_new/new_public_chat/view.cljs
+++ src/status_im/ui/screens/add_new/new_public_chat/view.cljs
@@ -54,7 +54,7 @@
      [list/item-icon {:icon      :icons/forward
                       :icon-opts {:color :gray}}]]]])

-(def default-public-chats ["status" "status 中文" "status 日本語" "status 한국어" "status по-русски" "status español" "status فارسی" "cryptostrikers" "dapps" "ethereum" "openbounty"])
+(def default-public-chats ["status" "status 中文" "status 日本語" "status 한국어" "status по-русски" "status español" "status فارسی" "cryptocurrency" "cryptostrikers" "dapps" "ethereum" "openbounty"])

 (views/defview new-public-chat []
   (views/letsubs [topic [:get :public-group-topic]


Refactor clojure-test-test assertions out of test-ns-hook.

Use deftest to logically group and isolate assertions, and use
test-ns-hook to filter out defspec-defined tests from the test
run.

Refactor capture-test-var to fold in the functionality provided by
capture-log-test-reports, which has been removed. Also, return a map
rather than a vector to improve useability as it's now returning a
larger data structure.

The following guidelines where used when refactoring the test cases:

 - Use :keys destructuring of capture-test-var values.
 - Avoid using threading within assertions.
 - Place binding at top-level of test when used.
 - Colocate defspecs and their associated tests and support code.

Refactoring uncoverd a timing bug in the test code. Calls to
clojure.test/report can return in less than a millisecond, which is
less than the threshold used to increment
clojure-test/last-trial-report.  As such, the test code is susceptible
to timing failures. To avoid this, wait after fetching the initial
last-trial-report value before attempting an operation whose behavior
relative to last-trial-report is being tested.

Change-Id: Iada189d3f37444a01514d6c3e00233b88388883e

--- src/test/clojure/clojure/test/check/clojure_test_test.cljc
+++ src/test/clojure/clojure/test/check/clojure_test_test.cljc
@@ -13,7 +13,7 @@
                   :as test
                   :include-macros true
                   :refer [test-var]
-                  :refer-macros [is]]
+                  :refer-macros [is deftest testing]]
                  [cljs.reader :refer [read-string]]])
             #?(:clj
                [clojure.test :as test :refer :all])
@@ -22,25 +22,110 @@
             [clojure.test.check.clojure-test :as ct #?@(:clj  [:refer (defspec)]
                                                         :cljs [:refer-macros (defspec)])]))

+(declare ^:dynamic test-report)
+
+(defn capturing-report [reports m]
+  (swap! reports conj m)
+  (test-report m))
+
+(defn ^:private capture-test-var
+  "Returns map of :reports, :report-counters, :out, and :test-out."
+  [v]
+  (let [reports (atom [])]
+    (binding [test-report test/report
+              test/report (partial capturing-report reports)]
+      #?(:clj
+         (binding [*report-counters*   (ref *initial-report-counters*)
+                   *test-out*          (java.io.StringWriter.)
+                   *testing-contexts*  (list)
+                   *testing-vars*      (list)]
+           (let [out (with-out-str (test-var v))]
+             {:reports @reports
+              :report-counters @*report-counters*
+              :out out
+              :test-out (str *test-out*)}))
+         :cljs
+         (binding [test/*current-env* (test/empty-env)]
+           (let [out (with-out-str (test-var v))]
+             ;; cljs.test doesn't distinguish between *out* and *test-out*
+             {:reports @reports
+              :report-counters (:report-counters test/*current-env*)
+              :out out
+              :test-out out}))))))
+
 (defspec default-trial-counts
   (prop/for-all* [gen/int] (constantly true)))

-(defspec trial-counts 5000
+(deftest can-use-num-tests-default-value
+  (let [{:keys [out]} (capture-test-var #'default-trial-counts)
+        num-tests (:num-tests (read-string out))]
+    (is (= num-tests ct/*default-test-count*))))
+
+(def trial-counts-num-tests 5000)
+(defspec trial-counts trial-counts-num-tests
   (prop/for-all* [gen/int] (constantly true)))

+(deftest can-specify-num-tests
+  (let [{:keys [out]} (capture-test-var #'trial-counts)
+        completion (-> out read-string (select-keys [:test-var :result :num-tests]))]
+    (is (= completion {:test-var "trial-counts"
+                       :result true
+                       :num-tests trial-counts-num-tests}))))
+
+(deftest can-report-trials-with-dots
+  (binding [ct/*report-trials* true]
+    (let [{:keys [out]} (capture-test-var #'trial-counts)]
+      (is (re-matches #?(:clj (java.util.regex.Pattern/compile "(?s)\\.{5}.+")
+                         :cljs #"\.{5}[\s\S]+")
+                      out)))))
+
 (defspec long-running-spec 1000
-  (prop/for-all* []
-                 #(do
-                    #?(:clj
-                       (Thread/sleep 1)
-                       :cljs
-                       (let [start (.valueOf (js/Date.))]
+  (prop/for-all*
+    []
+    #(do
+       #?(:clj
+          (Thread/sleep 1)
+          :cljs
+          (let [start (.valueOf (js/Date.))]
             ;; let's do some busy waiting for 1 msec, so we avoid setTimeout
             ;; which would make our test async
-                         (while (= start
-                                   (.valueOf (js/Date.)))
-                           (apply + (range 50)))))
-                    true)))
+            (while (= start
+                      (.valueOf (js/Date.)))
+              (apply + (range 50)))))
+       true)))
+
+(defn wait-for-clock-tick
+  "Allow time to progress to avoid timing issues with sub-millisecond code."
+  [start]
+  #?(:clj (Thread/sleep 1)
+     :cljs (while (>= start (.valueOf (js/Date.)))
+             (apply + (range 50)))))
+
+(deftest can-report-trials-periodically
+  (binding [ct/*report-trials* ct/trial-report-periodic
+            ct/*trial-report-period* 500]
+    (let [last-trial-report @#'ct/last-trial-report]
+
+      (testing "test/report with {:type :begin-test-var} increments last-trial-report"
+        (let [initial-trial-report @last-trial-report]
+          (wait-for-clock-tick initial-trial-report)
+          (test/report {:type :begin-test-var})
+          (is (> @last-trial-report initial-trial-report))))
+
+      (testing "test/report with other :type does not increment last-trial-report"
+        (let [initial-trial-report @last-trial-report]
+          (wait-for-clock-tick initial-trial-report)
+          (test/report {:type :end-test-var})
+          (is (= @last-trial-report initial-trial-report))))
+
+      (testing "running the test increments last-trial-report"
+        (let [initial-trial-report @last-trial-report]
+          (wait-for-clock-tick initial-trial-report)
+          (is (re-seq
+                #"(Passing trial \d{3} / 1000 for .+\n)+"
+                (:test-out
+                 (capture-test-var #'long-running-spec))))
+          (is (> @last-trial-report initial-trial-report)))))))

 (defn- vector-elements-are-unique*
   [v]
@@ -53,94 +138,18 @@

 (defspec this-is-supposed-to-fail 100 vector-elements-are-unique)

-(defspec this-throws-an-exception
-  (prop/for-all [x gen/nat]
-    (throw (ex-info "this property is terrible" {}))))
+(deftest can-report-shrinking
+  (binding [ct/*report-shrinking* true]
+    (let [{:keys [report-counters test-out]} (capture-test-var #'this-is-supposed-to-fail)]
+      (is (== 1 (:fail report-counters)))
+      (is (re-seq #?(:clj (java.util.regex.Pattern/compile
+                            "(?s)Shrinking vector-elements-are-unique starting with parameters \\[\\[.+")
+                     :cljs #"Shrinking vector-elements-are-unique starting with parameters \[\[[\s\S]+")
+                  test-out)))))

-(defn ^:private capture-test-var
-  "Returns [report-counters out-str]."
-  [v]
-  #?(:clj
-     (binding [*report-counters* (ref *initial-report-counters*)]
-       (let [out (with-out-str (binding [*test-out* *out*] (test-var v)))]
-         [@*report-counters* out]))
-
-     :cljs
-     (let [restore-env    (test/get-current-env)
-           _              (test/set-env! (test/empty-env))
-           out            (with-out-str (test-var v))
-           env            (test/get-current-env)]
-       (test/set-env! restore-env)
-       [(:report-counters env) out])))
-
-(defn ^:private capture-clojure-test-reports
-  [func]
-  (let [log (atom [])]
-    (binding [test/report #(swap! log conj %)]
-      (func))
-    @log))
-
-(defn test-ns-hook
-  []
-  (is (-> (capture-test-var #'default-trial-counts)
-          second
-          read-string
-          :num-tests
-          (= ct/*default-test-count*)))
-
-  (is (-> (capture-test-var #'trial-counts)
-          second
-          read-string
-          (select-keys [:test-var :result :num-tests])
-          (= {:test-var "trial-counts", :result true, :num-tests 5000})))
-
-  (binding [ct/*report-trials* true]
-    (let [output (second (capture-test-var #'trial-counts))]
-      (is (re-matches #?(:clj  (java.util.regex.Pattern/compile "(?s)\\.{5}.+")
-                         :cljs #"\.{5}[\s\S]+")
-                      output))))
-
-  (binding [ct/*report-trials* ct/trial-report-periodic
-            ct/*trial-report-period* 500]
-    (let [last-trial-report @#'ct/last-trial-report
-          trial-report-0 @last-trial-report
-          _ (test/report {:type :begin-test-var})
-          trial-report-1 @last-trial-report]
-      (is (> trial-report-1 trial-report-0)
-          "calling with {:type :begin-test-var} makes last-trial-report to increment")
-      (test/report {:type :end-test-var})
-      (is (= trial-report-1 @last-trial-report)
-          "calling with other :type keeps last-trial-report constant")
-      (is (re-seq
-           #"(Passing trial \d{3} / 1000 for .+\n)+"
-           (second
-            (capture-test-var #'long-running-spec))))
-      (is (> @last-trial-report trial-report-1)
-          "running the test makes last-trial-report to increment")))
-
-  (let [[report-counters stdout]
-        (binding [ct/*report-shrinking* true]
-          (capture-test-var #'this-is-supposed-to-fail))]
-    (is (== 1 (:fail report-counters)))
-    (is (re-seq
-         #?(:clj
-            (java.util.regex.Pattern/compile "(?s)Shrinking vector-elements-are-unique starting with parameters \\[\\[.+")
-
-            :cljs
-            #"Shrinking vector-elements-are-unique starting with parameters \[\[[\s\S]+")
-         stdout)))
-
-  (test/testing "exceptions in properties are re-thrown to clojure.test"
-    (let [[report-counters stdout]
-          (capture-test-var #'this-throws-an-exception)]
-      (is (= report-counters {:test 1, :pass 0, :fail 0, :error 1}))
-      (is (re-find #"ERROR in \(this-throws-an-exception\)" stdout))))
-
-  ;;
-  ;; Test for TCHECK-118
-  ;;
+(deftest tcheck-118-pass-shrunk-input-on-to-clojure-test
   (let [{trial ::ct/trial, shrinking ::ct/shrinking, shrunk ::ct/shrunk}
-        (group-by :type (capture-clojure-test-reports this-is-supposed-to-fail))]
+        (group-by :type (:reports (capture-test-var #'this-is-supposed-to-fail)))]
     ;; should have had some successful runs because the initial size
     ;; is too small for duplicates
     (is (seq trial))
@@ -152,3 +161,23 @@
     (let [[a b & more] (-> shrunk first ::ct/params first)]
       (is (empty? more))
       (is (and a b (= a b))))))
+
+(defspec this-throws-an-exception
+  (prop/for-all [x gen/nat]
+    (throw (ex-info "this property is terrible" {}))))
+
+(deftest can-re-throw-exceptions-to-clojure-test
+  (let [{:keys [report-counters test-out]} (capture-test-var #'this-throws-an-exception)]
+    (is (= report-counters {:test 1, :pass 0, :fail 0, :error 1}))
+    (is (re-find #"ERROR in \(this-throws-an-exception\)" test-out))))
+
+(defn test-ns-hook
+  "Run only tests defined by deftest, ignoring those defined by defspec."
+  []
+  (let [tests (->> (vals (ns-interns #?(:clj (find-ns 'clojure.test.check.clojure-test-test)
+                                        :cljs 'clojure.test.check.clojure-test-test)))
+                   (filter #(let [m (meta %)]
+                              (and (:test m)
+                                   (not (::ct/defspec m)))))
+                   (sort-by #(:line (meta %))))]
+    (test/test-vars tests)))


always show the breadcrumbs on the build page (#1641)

we suppress the breadcrumbs during the NUX bootstrap for a cleaner and
crisper experience. However, we also want to do a demo, which means
showing the users a build before they follow anything. We need the
breadcrumbs to make it look nice, so always show them.

--- src-cljs/frontend/components/header.cljs
+++ src-cljs/frontend/components/header.cljs
@@ -363,6 +363,7 @@
                      (or (-> (feature/ab-test-treatment :new-user-landing-page user)
                              (= :dashboard)
                              not)
+                         (= :build (get-in app state/current-view-path))
                          (-> user :projects empty? not)))
             (om/build page-header/header {:crumbs crumbs
                                           :logged-out? (not (:name user))


Use div not button for range slider knob to prevent navigation on first drag.

--- src-cljs/frontend/components/shared.cljs
+++ src-cljs/frontend/components/shared.cljs
@@ -253,7 +253,7 @@
           ;[:span min-val]
           [:figure.range-back]
           [:figure.range-highlight {:style {:width (str (* value increment) "%")}}]
-          [:button.range-knob {:style {:left (str (* value increment) "%")}
+          [:div.range-knob {:style {:left (str (* value increment) "%")}
                                :data-count value}]
           ;[:span max-val]
           ])))


CMR-1855 Fixes instrument normalization for SMAP expected result.

--- umm-spec-lib/src/cmr/umm_spec/test/expected_conversion.clj
+++ umm-spec-lib/src/cmr/umm_spec/test/expected_conversion.clj
@@ -217,7 +217,7 @@

 (defn- normalize-instruments
   [platforms]
-  (let [all-instruments (mapcat :Instruments platforms)]
+  (let [all-instruments (seq (mapcat :Instruments platforms))]
     (for [platform platforms]
       (assoc platform :Instruments all-instruments))))


parse project.clj file

parse project.clj file

--- src-cljs/cljsbuild_ui/core.cljs
+++ src-cljs/cljsbuild_ui/core.cljs
@@ -1,7 +1,7 @@
 (ns cljsbuild-ui.core
   (:require
     [cljs.reader :refer [read-string]]
-    [clojure.string :refer [join replace split]]
+    [clojure.string :refer [join replace split trim]]
     [cljsbuild-ui.pages.main]
     [cljsbuild-ui.util :refer [log js-log on-windows? uuid]]))

@@ -20,38 +20,31 @@
     (.stringify js/JSON (array) nil 2)
     (js-obj "encoding" "utf8")))

-;; can't tell if this hack is horrible or brilliant
-(defn- defproject->map [s1]
-  (let [arr (split s1 #"\s")
-        prj-name (nth arr 1)
-        version (nth arr 2)
-        s2 (str "{" (join " " (drop 3 arr)))]
-    ; (js-log s2)
-    ; (js-log "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
-    ; (js-log (replace #";.*\n"))
-    (-> s2
-      (replace #";.+\n" "")
-      (replace #"\)$" "}")
-      (replace "#(" "(") ;; remove tagged literals
-      )))
+;; TODO: we probably need to add the name and version to our project map here
+(defn- parse-project-file [s1]
+  (let [s2 (replace s1 "#(" "(") ;; prevent "Could not find tag parser for" error
+        prj1 (read-string s2)]
+    (apply hash-map (drop 3 prj1))))

-;; TODO: need to handle files that do not exist, can punt on this for now
-;; TODO: parse the project.clj using transit here
-;; TODO: need to do some quick validation of the project.clj file
+;; TODO:
+;; - Need to handle files listed in projects.json that no longer exist on disk
+;;   (ie: did you remove this file?)
+;; - need to do some quick validation of project.clj
+;;   (ie: does it have :cljsbuild?)
 (defn- load-project-file [prj-file]
-  (let [file-contents (.readFileSync fs prj-file)
-        ;;prj (read-string (defproject->map file-contents))
-        prj (defproject->map file-contents)
-        ]
-    prj))
+  (let [file-contents (.readFileSync fs prj-file (js-obj "encoding" "utf8"))]
+    (parse-project-file file-contents)))

+;; TODO: need to do some quick validation on projects.json format here
 (defn- receive-app-data-path [app-data-path]
   (let [projects-file (str app-data-path slash "projects.json")]
     (when-not (.existsSync fs projects-file)
       (create-default-projects-file! app-data-path projects-file))
     (let [prj-files (js->clj (js/require projects-file))
           projects (zipmap prj-files (map load-project-file prj-files))]
-      (log projects))))
+      ;; it works!
+      (log (:cljsbuild (first (vals projects))))
+      )))

 ;; receive the OS-normalized app data path from app.js
 ;; NOTE: this event is effectively "global app init" for the webpage


Single arity for periodically-refresh!, force the user to resolve default role separately

--- src/eulalie/creds.clj
+++ src/eulalie/creds.clj
@@ -55,12 +55,6 @@
     out-chan))

 (defn periodically-refresh!
-  ([creds-atom]
-   (go-catching
-     (if-let [default-role (<? (instance-data/default-iam-role!))]
-       (periodically-refresh! creds-atom default-role)
-       (throw (ex-info "no-default-iam-role" {:type :no-default-iam-role})))))
-
   ([creds-atom role]
    (let [creds (credential-channel! #(instance-data/iam-credentials! role))]
      (go-catching
@@ -71,4 +65,4 @@
                        :data {:creds current-creds}}))
            (reset! creds-atom current-creds)
            (recur))))
-     #(async/close! creds))))
+     creds)))


BUGFIX: Shouldn't track deactivation without a :start-time

Otherwise we end up with a page that has in theory been viewed for
thousands of days.

--- src/background/relevance/background.cljs
+++ src/background/relevance/background.cljs
@@ -174,8 +174,7 @@
     ;; was deactivated (which defaults to now)
     [app-state [_ tab end-time]]
     (console/trace " Deactivating " tab)
-    (when (or (:active tab)
-              (< 0 (:start-time tab)))
+    (when (< 0 (:start-time tab))
       (dispatch [:track-time tab (- (or end-time (now))
                                     (:start-time tab))]))
     app-state))


Use the namespaced keys for the comic list

--- src/cljs/comic_reader/ui/comic_list.cljs
+++ src/cljs/comic_reader/ui/comic_list.cljs
@@ -51,8 +51,8 @@
     :list-element [:ul.no-bullet]
     :item->li (fn [comic]
                 [:a.button.radius
-                 {:on-click #(view-comic (:id comic))}
-                 (:name comic)])}
+                 {:on-click #(view-comic (:comic/id comic))}
+                 (:comic/name comic)])}
    comics))

 (defn letter-filter [set-prefix letter search-prefix]


Add history for completed items

Add history for completed items

--- src/cljs/pushpopchestnutreless/core.cljs
+++ src/cljs/pushpopchestnutreless/core.cljs
@@ -7,10 +7,12 @@

 (defonce app-state
   (atom
-    {:stack (list "first" "second")
+    {:stack ()
      :new-item-text ""
      :snooping? false
-     :filter-text ""}))
+     :filter-text ""
+     :completed ()
+     :showing-history? false}))

 (defmulti step
   (fn [_ {:keys [id]}]
@@ -27,13 +29,18 @@
     (assoc :new-item-text "")))

 (defmethod step :pop [state _]
-  (update state :stack pop))
+  (-> state
+   (update :completed conj (peek (:stack state)))
+   (update :stack pop)))

 (defmethod step :toggle-snoop [state _]
   (update state :snooping? not))

 (defmethod step :filter [state {:keys [text]}]
   (assoc state :filter-text text))
+
+(defmethod step :toggle-history [state _]
+  (update state :showing-history? not))

 ;; VIEW HELPERS
@@ -56,13 +63,12 @@

 ;; VIEW

-(defn peek-view [{:keys [stack filter-text snooping?]}]
+(defn peek-view [{:keys [stack completed filter-text snooping? showing-history?]}]
  (when (not-empty stack)
   [:div.peek-container
-   [:p
-    [:a
-     {:on-click (on-click :toggle-snoop)}
-     (if snooping? "peeking..." "peek...")]]
+   [:h3
+    {:on-click (on-click :toggle-snoop)}
+    (if snooping? "Peeking..." "Peek...")]
    (when snooping?
      [:div
       [:input
@@ -71,7 +77,17 @@
       (into [:ol]
        (->> stack
             (filter #(string/includes? % filter-text))
-            (map #(vec [:li %]))))])]))
+            (map #(vec [:li %]))))
+      [:h4
+       {:on-click (on-click :toggle-history)}
+       (if showing-history? "Hide History" "Show History")]
+      [:div
+       (when showing-history?
+        (into [:ol.history]
+         (->> completed
+              (filter #(string/includes? % filter-text))
+              (map #(vec [:li %])))))]])]))
+

 (defn push-pop-view [{:keys [stack filter-text] :as state}]
   [:div


De-lazification

De-lazification

--- src/clojush/pushgp/genetic_operators.clj
+++ src/clojush/pushgp/genetic_operators.clj
@@ -227,8 +227,9 @@
         string-tweak (fn [st]
                        (apply str (map (fn [c]
                                          (if (< (lrand) uniform-mutation-string-char-change-rate)
-                                           (lrand-nth (concat ["\n" "\t"]
-                                                              (map (comp str char) (range 32 127))))
+                                           (lrand-nth (vec (concat ["\n" "\t"]
+                                                                   (map (comp str char)
+                                                                        (range 32 127)))))
                                            c))
                                        st)))
         instruction-mutator (fn [token]
@@ -432,8 +433,9 @@
         string-tweak (fn [st]
                        (apply str (map (fn [c]
                                          (if (< (lrand) uniform-mutation-string-char-change-rate)
-                                           (lrand-nth (concat ["\n" "\t"]
-                                                              (map (comp str char) (range 32 127))))
+                                           (lrand-nth (vec (concat ["\n" "\t"]
+                                                                   (map (comp str char)
+                                                                        (range 32 127)))))
                                            c))
                                        st)))
         constant-mutator (fn [token]
@@ -732,9 +734,10 @@
     (recur parent2 parent1 argmap)
     (let [short-genome (:genome parent1)
           long-genome (:genome parent2)
-          short-genome-lengthened (concat short-genome
-                                          (repeat (- (count long-genome) (count short-genome))
-                                                  'uniform-padding))
+          short-genome-lengthened (vec (concat short-genome
+                                               (repeat (- (count long-genome)
+                                                          (count short-genome))
+                                                       'uniform-padding)))
           new-genome (vec (remove-uniform-padding
                             (mapv (fn [x1 x2]
                                     (if (< (lrand) 0.5)
@@ -1179,3 +1182,4 @@
         :is-random-replacement
         (if use-child false true)))))

+


Check for Windows in the tests. Fixes #32.

--- test/test_new.clj
+++ test/test_new.clj
@@ -4,6 +4,7 @@
         [clojure.contrib.shell :only [with-sh-dir sh]]))

 (deftest test-new
-  (sh "lein" "new" "a.b/test-new-proj")
+  (sh (if (= "Windows" (System/getProperty "os.name"))
+        "lein.bat" "lein") "new" "a.b/test-new-proj")
   (is (.exists (file "test-new-proj" "src" "a" "b" "test_new_proj" "core.clj")))
   (delete-file-recursively (file "test-new-proj") false))


Removing unused function randomLandPos

Removing unused function randomLandPos

--- src/civs/logic/demographics.clj
+++ src/civs/logic/demographics.clj
@@ -13,12 +13,6 @@

 (require '[civs.model.core :as model])

-(defn randomLandPos [world]
-  (let [pos (random-pos (.getDimension world))]
-    (if (isLand world pos)
-      pos
-      (randomLandPos world))))
-
 (defn random-pos-avoiding [world biomes-to-avoid]
   (let [pos (random-pos (.getDimension world))
         biome (biome-at world pos)]
@@ -30,8 +24,6 @@
   (model/Population. (crand-int 15) (crand-int 15) (crand-int 15) (crand-int 5) (crand-int 5)))

 (def unhospital-biomes #{com.github.lands.Biome/OCEAN com.github.lands.Biome/GLACIER com.github.lands.Biome/ICELAND})
-
-; (.get (-> w77 .getTemperature .thresholds) com.github.lands.Thresholds$Level/HIGH)

 (defn generate-tribe
   "Return a map game, tribe"


Fix kinglear URL and pubsub example (#81)

--- src/clj/datasplash/examples.clj
+++ src/clj/datasplash/examples.clj
@@ -35,7 +35,7 @@
   (format "%s: %d" k v))

 (defoptions WordCountOptions
-  {:input {:default "gs://dataflow-samples/shakespeare/kinglear.txt"
+  {:input {:default "gs://apache-beam-samples/shakespeare/kinglear.txt"
            :type String}
    :output {:default "kinglear-freqs.txt"
             :type String}
@@ -60,7 +60,7 @@
 ;; Port of https://github.com/GoogleCloudPlatform/DataflowJavaSDK/blob/master/examples/src/main/java/com/google/cloud/dataflow/examples/cookbook/DeDupExample.java

 (defoptions DeDupOptions
-  {:input {:default "gs://dataflow-samples/shakespeare/*"
+  {:input {:default "gs://apache-beam-samples/shakespeare/*"
            :type String}
    :output {:default "shakespeare-dedup.txt"
             :type String}})
@@ -205,7 +205,7 @@
 (defn run-standard-sql-query
   [str-args]
   ;; the DirectPipelineRunner doesn't support standardSql yet
-  (let [p (ds/make-pipeline StandardSQLOptions str-args {:runner "DataflowPipelineRunner"})
+  (let [p (ds/make-pipeline StandardSQLOptions str-args {:runner "DataflowRunner"})
         {:keys [input output]} (ds/get-pipeline-options p)
         query "SELECT * from `bigquery-public-data.samples.shakespeare` LIMIT 100"
         results (->> p
@@ -220,7 +220,7 @@
 ;; Port of https://github.com/GoogleCloudPlatform/DataflowJavaSDK/blob/master/examples/src/main/java/com/google/cloud/dataflow/examples/cookbook/DatastoreWordCount.java

 (defoptions DatastoreWordCountOptions
-  {:input {:default "gs://dataflow-samples/shakespeare/kinglear.txt"
+  {:input {:default "gs://apache-beam-samples/shakespeare/kinglear.txt"
            :type String}
    :output {:default "kinglear-freqs.txt"
             :type String}
@@ -286,15 +286,13 @@
 ;; Pub/Sub ;;
 ;;;;;;;;;;;;;

-;; Run using: lein run pub-sub --project=[your google cloud project] --stagingLocation=gs://[your-bucket]/jars
+;; Run using: lein run pub-sub --pubsubProject=[your google cloud project] --tempLocation=gs:/[your-bucket]/tmp/ --stagingLocation=gs://[your-bucket]/jars
 ;; You must create the my-subscription and my-transformed-subscription subscriptions, and the my-transformed-topic topics
 ;; before you run this

 (defoptions PubSubOptions
-  {:project {:default "yourproject"
-             :type String}
-   :stagingLocation {:default "gs://yourbucket"
-                     :type String}})
+  {:pubsubProject {:default "yourproject"
+                   :type String}})

 (defn stream-interactions-from-pubsub
  [pipeline read-topic write-transformed-topic]
@@ -319,13 +317,14 @@
 (defn run-pub-sub
   [str-args]
   (let [pipeline (ds/make-pipeline
+                  PubSubOptions
                   str-args
-                  {:runner "DataflowPipelineRunner"
+                  {:runner "DataflowRunner"
                    :streaming true})
-        {:keys [project]} (ds/get-pipeline-options pipeline)
-        read-topic (format "projects/%s/topics/my-topic" project)
-        write-transformed-topic (format "projects/%s/topics/my-transformed-topic" project)
-        read-transformed-subscription (format "projects/%s/subscriptions/my-transformed-subscription" project)]
+        {:keys [pubsubProject]} (ds/get-pipeline-options pipeline)
+        read-topic (format "projects/%s/topics/my-topic" pubsubProject)
+        write-transformed-topic (format "projects/%s/topics/my-transformed-topic" pubsubProject)
+        read-transformed-subscription (format "projects/%s/subscriptions/my-transformed-subscription" pubsubProject)]
     (stream-interactions-from-pubsub pipeline read-topic write-transformed-topic)
     (stream-forwarded-interactions-from-pubsub pipeline read-transformed-subscription)))


Rating enum fix 5.4 => 4.5

Rating enum fix 5.4 => 4.5

--- src/clj/salava/badge/routes.clj
+++ src/clj/salava/badge/routes.clj
@@ -96,7 +96,7 @@
                    :path-params [badgeid :- Long]
                    :body-params [visibility :- (s/enum "private" "public" "internal")
                                  evidence-url :- (s/maybe s/Str)
-                                 rating :- (s/maybe (s/enum 0.5 1 1.5 2 2.5 3 3.5 4 5.4 5))
+                                 rating :- (s/maybe (s/enum 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5))
                                  tags :- (s/maybe [s/Str])]
                    :summary "Save badge settings"
                    :components [context]