Attempt to keep REPL namespace even if it gets reloaded

--- src/main/clojure/clojure/tools/namespace/repl.clj
+++ src/main/clojure/clojure/tools/namespace/repl.clj
@@ -25,6 +25,12 @@
         e)
     :ok))

+(defn- do-refresh [f]
+  (let [current-ns (ns-name *ns*)]
+    (alter-var-root #'refresh-tracker f)
+    (print-and-return refresh-tracker)
+    (in-ns current-ns)))
+
 (defn refresh
   "Scans source code directories for files which have changed (since
   the last time this function was run) and reloads them in dependency
@@ -34,9 +40,7 @@
   The directories to be scanned are controlled by 'set-refresh-dirs';
   defaults to all directories on the Java classpath."
   []
-  (alter-var-root #'refresh-tracker
-                  #(-> % dir/scan reload/track-reload))
-  (print-and-return refresh-tracker))
+  (do-refresh #(-> % dir/scan reload/track-reload)))

 (defn refresh-all
   "Scans source code directories for all Clojure source files and
@@ -45,9 +49,7 @@
   The directories to be scanned are controlled by 'set-refresh-dirs';
   defaults to all directories on the Java classpath."
   []
-  (alter-var-root #'refresh-tracker
-                  #(-> % dir/scan-all reload/track-reload))
-  (print-and-return refresh-tracker))
+  (do-refresh #(-> % dir/scan-all reload/track-reload)))

 (defn set-refresh-dirs
   "Sets the directories which are scanned by 'refresh'. Supports the


TNS-26: Fix local shadow of symbol 'alias' in 'recover-ns'

Recovery of namespace aliases did not work at all prior to this
change. It didn't throw an exception in 'recover-ns' because the local
binding of 'alias' was a symbol and Clojure symbols behave like
keywords when invoked (i.e., they act like 'get').

--- src/main/clojure/clojure/tools/namespace/repl.clj
+++ src/main/clojure/clojure/tools/namespace/repl.clj
@@ -75,9 +75,9 @@
           (if (= source-name target-name)
             (refer ns-name :only (list source-name))
             (refer ns-name :only () :rename {source-name target-name}))))))
-  (doseq [[alias ns-name] aliases]
+  (doseq [[alias-sym ns-name] aliases]
     (when (find-ns ns-name)
-      (alias alias ns-name))))
+      (alias alias-sym ns-name))))

 (defn- do-refresh [scan-fn after-sym]
   (when after-sym


[#2254] Fix implementation

[#2254] Fix implementation

We expect a vector of column names not a vector of vectors of column names

--- backend/src/akvo/lumen/lib/transformation/combine.clj
+++ backend/src/akvo/lumen/lib/transformation/combine.clj
@@ -45,4 +45,4 @@

 (defmethod engine/columns-used "core/combine"
   [applied-transformation columns]
-  [(:columnNames (:args applied-transformation))])
+  (vec (:columnNames (:args applied-transformation))))


Rename color calculation function.

Rename color calculation function.

--- src/videotest/falling/fall_core.clj
+++ src/videotest/falling/fall_core.clj
@@ -80,14 +80,14 @@

 (defn update-color-record
   [{:keys [triangle-points rgba-mat color-record] :as state}]
-  (let [color-fn (fn [col row]
-                   (let [cam-x (+ (* col CAM-BIN-SIZE)
-                                  CAM-BIN-SIZE-2)
-                         cam-y (+ (* row CAM-BIN-SIZE)
-                                  CAM-BIN-SIZE)]
-                     (vec (.get rgba-mat cam-y cam-x))))
+  (let [cam->color (fn [col row]
+                     (let [cam-x (+ (* col CAM-BIN-SIZE)
+                                    CAM-BIN-SIZE-2)
+                           cam-y (+ (* row CAM-BIN-SIZE)
+                                    CAM-BIN-SIZE)]
+                       (vec (.get rgba-mat cam-y cam-x))))
         colors (reduce (fn [memo [col row :as coords]]
-                         (assoc-in memo [coords] (color-fn col row)))
+                         (assoc-in memo [coords] (cam->color col row)))
                        {}
                        (keys triangle-points))]
    (assoc-in state [:color-record] colors)))


FloatCLBlockVector renamed to RealVectorCL and refactored to use pluggable CL BLAS1 engine.

--- src/clojure/uncomplicate/neanderthal/opencl.clj
+++ src/clojure/uncomplicate/neanderthal/opencl.clj
@@ -41,43 +41,44 @@
   (map-host [this])
   (unmap [this]))

-(declare cl-sv*)
-
-(defrecord CLSettings [^long max-local-size queue context prog]
-  Releaseable
-  (release [_]
-    (release prog)))
-
-(defn cl-settings [queue]
-  (let [dev (queue-device queue)
-        ctx (queue-context queue)
-        prog (build-program! (program-with-source ctx [(slurp "resources/opencl/blas.cl")]) "-cl-std=CL2.0" nil)]
-    (->CLSettings (max-work-group-size dev) queue ctx prog)))
-
-(def zero-array (float-array [0]))
-
-(deftype FloatCLBlockVector [^CLSettings settings cl-buf ^long n
-                             reduce-acc
-                             reduce-iacc
-                             linear-work-size
-                             swp-kernel
-                             scal-kernel
-                             axpy-kernel
-                             sum-reduction-kernel
-                             imax-reduction-kernel
-                             dot-reduce-kernel
-                             nrm2-reduce-kernel
-                             asum-reduce-kernel
-                             iamax-reduce-kernel]
+;;TODO
+(defprotocol BLAS1
+    (s-iamax [_ cl-x])
+    (s-rotg [_ cl-x])
+    (s-rotm [_ cl-x cl-y p])
+    (s-rotmg [_ p args])
+    (s-dot [_ cl-x cl-y])
+    (s-nrm2 [_ cl-x])
+    (s-asum [_ cl-x])
+    (s-rot [_ cl-x cl-y c s])
+    (s-scal [_ alpha cl-x])
+    (s-axpy [_ alpha cl-x cl-y])
+    (s-swp [_ cl-x cl-y]))
+
+(deftype GCNVectorEngine [^long entry-width
+                          ^long max-local-size
+                          queue
+                          n
+                          reduce-acc
+                          reduce-iacc
+                          linear-work-size
+                          swp-kernel
+                          scal-kernel
+                          axpy-kernel
+                          sum-reduction-kernel
+                          imax-reduction-kernel
+                          dot-reduce-kernel
+                          nrm2-reduce-kernel
+                          asum-reduce-kernel
+                          iamax-reduce-kernel]

   Releaseable
   (release [_]
     (and
-     (release cl-buf)
      (release reduce-acc)
      (release reduce-iacc)
      (release swp-kernel)
-     (release scal-kernel)n
+     (release scal-kernel)
      (release axpy-kernel)
      (release sum-reduction-kernel)
      (release imax-reduction-kernel)
@@ -86,62 +87,137 @@
      (release asum-reduce-kernel)
      (release iamax-reduce-kernel)))

+  BLAS1
+  (s-iamax [_ _]
+    (do
+      (enq-reduce queue iamax-reduce-kernel imax-reduction-kernel
+                  max-local-size n)
+      (enq-read-int queue reduce-iacc)))
+  (s-rotg [_ _]
+    (throw (UnsupportedOperationException.
+            "TODO.")))
+  (s-rotm [_ _ cl-y p]
+    (throw (UnsupportedOperationException.
+            "TODO.")))
+  (s-rotmg [_ p args]
+    (throw (UnsupportedOperationException.
+            "TODO.")))
+  (s-dot [_ _ cl-y]
+    (do
+      (set-arg! dot-reduce-kernel 2 cl-y)
+      (enq-reduce queue dot-reduce-kernel sum-reduction-kernel max-local-size n)
+      (enq-read-float queue reduce-acc)))
+  (s-nrm2 [_ _]
+    (do
+      (enq-reduce queue nrm2-reduce-kernel sum-reduction-kernel max-local-size n)
+      (sqrt (enq-read-float queue reduce-acc))))
+  (s-asum [_ _]
+    (do
+      (enq-reduce queue asum-reduce-kernel sum-reduction-kernel max-local-size n)
+        (enq-read-float queue reduce-acc)))
+  (s-rot [_ _ cl-y c s]
+    (throw (UnsupportedOperationException.
+            "TODO.")))
+  (s-scal [_ alpha _]
+    (do
+      (set-arg! scal-kernel 0 (float-array [alpha]))
+      (enq-nd! queue scal-kernel linear-work-size)))
+  (s-axpy [_ alpha _ cl-y]
+    (do
+      (set-arg! axpy-kernel 0 (float-array [alpha]))
+      (set-arg! axpy-kernel 2 cl-y)
+      (enq-nd! queue axpy-kernel linear-work-size)))
+  (s-swp [_ _ cl-y]
+    (do
+      (set-arg! swp-kernel 1 cl-y)
+      (enq-nd! queue swp-kernel linear-work-size))))
+
+(defn gcn-vector-engine
+  [context queue prog max-local-size cl-buf entry-width n]
+  (let [acc-size (* (long entry-width) (count-work-groups max-local-size n))
+        cl-acc (cl-buffer context acc-size :read-write)
+        cl-iacc (cl-buffer context acc-size :read-write)]
+    (->GCNVectorEngine entry-width
+                       max-local-size
+                       queue
+                       n
+                       cl-acc
+                       cl-iacc
+                       (work-size [n])
+                       (doto (kernel prog "swp") (set-arg! 0 cl-buf))
+                       (doto (kernel prog "scal") (set-arg! 1 cl-buf))
+                       (doto (kernel prog "axpy") (set-arg! 1 cl-buf))
+                       (doto (kernel prog "sum_reduction")
+                         (set-args! cl-acc))
+                       (doto (kernel prog "imax_reduction")
+                         (set-args! cl-iacc cl-acc))
+                       (doto (kernel prog "dot_reduce")
+                         (set-args! cl-acc cl-buf))
+                       (doto (kernel prog "nrm2_reduce")
+                         (set-args! cl-acc cl-buf))
+                       (doto (kernel prog "asum_reduce")
+                         (set-args! cl-acc cl-buf))
+                       (doto (kernel prog "iamax_reduce")
+                         (set-args! cl-iacc cl-acc cl-buf)))))
+
+(declare cl-real-vector)
+
+(defrecord CLSettings [^long max-local-size queue context prog]
+  Releaseable
+  (release [_]
+    (release prog)))
+
+(defn cl-settings [queue]
+  (let [dev (queue-device queue)
+        ctx (queue-context queue)
+        prog (build-program! (program-with-source ctx [(slurp "resources/opencl/blas.cl")]) "-cl-std=CL2.0" nil)]
+    (->CLSettings (max-work-group-size dev) queue ctx prog)))
+
+(def zero-array (float-array [0]))
+
+(deftype RealVectorCL [^CLSettings settings engine cl-buf ^long width-bytes ^long n]
+
+  Releaseable
+  (release [_]
+    (and
+     (release cl-buf)
+     (release engine)))
+
   Vector
   (dim [_]
     n)
   (subvector [_ k l]
-    (cl-sv* settings
-            (cl-sub-buffer cl-buf (* Float/BYTES k) (* Float/BYTES l))
-            l))
+    (cl-real-vector settings
+                    (cl-sub-buffer cl-buf (* width-bytes k) (* width-bytes l))
+                    width-bytes
+                    l))
   (iamax [_]
-    (do
-      (enq-reduce (.queue settings)
-                  iamax-reduce-kernel imax-reduction-kernel
-                  (.max-local-size settings) n)
-      (enq-read-int (.queue settings) reduce-iacc)))
-  (rotg [x]
-    (throw (UnsupportedOperationException.
-            "TODO.")))
-  (rotm [x y p]
-    (throw (UnsupportedOperationException.
-            "TODO.")))
+    (s-iamax engine cl-buf))
+  (rotg [_]
+    (s-rotg engine cl-buf))
+  (rotm [_ y p]
+    (s-rotm engine cl-buf (.cl-buf ^RealVectorCL y) p))
   (rotmg [p args]
-    (throw (UnsupportedOperationException.
-            "TODO.")))
+    (s-rotmg engine p args))
   RealVector
   (entry [_ i]
     (throw (UnsupportedOperationException.
             "To access values from the CL device, read! them first.")))
   (dot [_ y]
-    (do
-      (set-arg! dot-reduce-kernel 2 (.cl-buf ^FloatCLBlockVector y))
-      (enq-reduce (.queue settings)
-                  dot-reduce-kernel sum-reduction-kernel
-                  (.max-local-size settings) n)
-      (enq-read-float (.queue settings) reduce-acc)))
+    (s-dot engine cl-buf (.cl-buf ^RealVectorCL y)))
   (nrm2 [_]
-    (do (enq-reduce (.queue settings)
-                    nrm2-reduce-kernel sum-reduction-kernel
-                    (.max-local-size settings) n)
-        (sqrt (enq-read-float (.queue settings) reduce-acc))))
-  (asum [_n]
-    (do (enq-reduce (.queue settings)
-                    asum-reduce-kernel sum-reduction-kernel
-                    (.max-local-size settings) n)
-        (enq-read-float (.queue settings) reduce-acc)))
-  (rot [x y c s]
-    (throw (UnsupportedOperationException.
-            "TODO.")))
+    (s-nrm2 engine cl-buf))
+  (asum [_]
+    (s-asum engine cl-buf))
+  (rot [_ y c s]
+    (s-rot engine cl-buf (.cl-buf ^RealVectorCL y) c s))
   (scal [x alpha]
     (do
-      (set-arg! scal-kernel 0 (float-array [alpha]))
-      (enq-nd! (.queue settings) scal-kernel linear-work-size)
+      (s-scal engine alpha cl-buf)
       x))
   (axpy [_ alpha y]
     (do
-      (set-arg! axpy-kernel 0 (float-array [alpha]))
-      (set-arg! axpy-kernel 2 (.cl-buf ^FloatCLBlockVector y))
-      (enq-nd! (.queue settings) axpy-kernel linear-work-size)
+      (s-axpy engine alpha cl-buf (.cl-buf ^RealVectorCL y))
       y))
   RealChangeable
   (set [x val]
@@ -153,64 +229,45 @@
     (do
       (enq-read! (.queue settings) cl-buf (.buf ^FloatBlockVector host))
       host))
-  (write! [this host]n
+  (write! [this host]
     (do
       (enq-write! (.queue settings) cl-buf (.buf ^FloatBlockVector host))
       this))
   Carrier
   (zero [_]
-    (let [zero-sv ^FloatCLBlockVector (cl-sv* settings n)]
+    (let [zero-sv ^RealVectorCL (cl-real-vector settings width-bytes n)]
       (enq-fill! (.queue settings) (.cl-buf zero-sv) zero-array)
       zero-sv))
   (byte-size [_]
-    Float/BYTES)
+    width-bytes)
   (copy [_ y]
-    (do (enq-copy! cl-buf (.cl-buf ^FloatCLBlockVector y))
+    (do (enq-copy! cl-buf (.cl-buf ^RealVectorCL y))
         y))
   (swp [x y]
     (do
-      (set-arg! swp-kernel 1 (.cl-buf ^FloatCLBlockVector y))
-      (enq-nd! (.queue settings) swp-kernel linear-work-size)
+      (s-swp engine cl-buf (.cl-buf ^RealVectorCL y))
       x)))

-(defn cl-sv*
-  ([^CLSettings settings ^long dim]
-   (cl-sv* settings
-           (cl-buffer (.context settings) (* dim Float/BYTES) :read-write)
-           dim))
-  ([^CLSettings settings cl-buf ^long dim]
-   (let [prog (.prog settings)
-         local-size (min dim (long (.max-local-size settings)))
-         acc-count (long (quot (+ dim (dec local-size)) local-size))
-         ;; TODO TODO this should be a part of the engine (queue)
-         cl-acc (cl-buffer (.context settings) (* Float/BYTES acc-count) :read-write)
-         ;; TODO TODO this should be a part of the engine (queue)
-         cl-iacc (cl-buffer (.context settings) (* Integer/BYTES acc-count) :read-write)]
-
-     (->FloatCLBlockVector settings
-                           cl-buf
-                           dim
-                           cl-acc
-                           cl-iacc
-                           (work-size [dim] [(min dim (.max-local-size settings))])
-                           (doto (kernel prog "swp") (set-arg! 0 cl-buf))
-                           (doto (kernel prog "scal") (set-arg! 1 cl-buf))
-                           (doto (kernel prog "axpy") (set-arg! 1 cl-buf))
-                           (doto (kernel prog "sum_reduction")
-                             (set-args! cl-acc))
-                           (doto (kernel prog "imax_reduction")
-                             (set-args! cl-iacc cl-acc))
-                           (doto (kernel prog "dot_reduce")
-                             (set-args! cl-acc cl-buf))
-                           (doto (kernel prog "nrm2_reduce")
-                             (set-args! cl-acc cl-buf))
-                           (doto (kernel prog "asum_reduce")
-                             (set-args! cl-acc cl-buf))
-                           (doto (kernel prog "iamax_reduce")
-                             (set-args! cl-iacc cl-acc cl-buf))
-                           ))))
+(defn cl-real-vector
+  ([^CLSettings settings cl-buf ^long width-bytes ^long dim]
+   (->RealVectorCL settings
+                   (gcn-vector-engine (.context settings)
+                                      (.queue settings)
+                                      (.prog settings)
+                                      (.max-local-size settings)
+                                      cl-buf
+                                      width-bytes
+                                      dim)
+                   cl-buf
+                   width-bytes
+                   dim))
+
+  ([^CLSettings settings ^long width-bytes ^long dim]
+   (cl-real-vector settings
+                (cl-buffer (.context settings) (* dim width-bytes) :read-write)
+                width-bytes dim)))

 (defn cl-sv [settings ^long dim]
-  (cl-sv* settings dim))
+  (cl-real-vector settings Float/BYTES dim))

 ;; ======================= Dense Matrix ========================================


Cleanup

Cleanup

--- src/clojure/clojurewerkz/cassaforte/new_query_api.clj
+++ src/clojure/clojurewerkz/cassaforte/new_query_api.clj
@@ -127,8 +127,6 @@
   []
   [2 (fn order-by-query [^Select  query-builder]
        (.allowFiltering query-builder))])
-   ;; public Select orderBy(Ordering... orderings) {
-   ;;  public Select limit(int limit) {
    ;;  public Select limit(BindMarker marker) {
    ;;  public Select allowFiltering() {

@@ -166,7 +164,6 @@
 ;; String quote(String columnName)
 ;; String token(String columnName)
 ;; String token(String... columnNames)
-
 ;; Using timestamp(long timestamp)
 ;; Using timestamp(BindMarker marker)
 ;; Using ttl(int ttl)
@@ -197,8 +194,6 @@
 ;; Assignment put(String name, Object key, Object value)
 ;; Assignment putAll(String name, Map<?, ?> map)
 ;; Assignment putAll(String name, BindMarker map)
-;; BindMarker bindMarker()
-;; BindMarker bindMarker(String name)
 ;; Object raw(String str)
 ;; Object fcall(String name, Object... parameters)
 ;; Object column(String name)


Updated predicate

Updated predicate

--- src/clojure/puppetlabs/certificate_authority/core.clj
+++ src/clojure/puppetlabs/certificate_authority/core.clj
@@ -36,6 +36,12 @@
        (not (nil? (:critical x)))
        (not (nil? (:value x)))))

+(defn extension-list?
+  "Returns true if the given data structure is a list that contains extensions."
+  [x]
+  (and (sequential? x)
+       (every? extension? x)))
+
 (defn keypair?
   "Returns true if x is a keypair (see `generate-key-pair`)."
   [x]
@@ -180,7 +186,7 @@
   ([keypair subject-dn extensions]
    {:pre  [(keypair? keypair)
            (valid-x500-name? subject-dn)
-           (sequential? extensions)]
+           (extension-list? extensions)]
     :post [(certificate-request? %)]}
    (CertificateAuthority/generateCertificateRequest
      keypair subject-dn extensions)))
@@ -214,8 +220,7 @@
           (instance? Date not-after)
           (valid-x500-name? subject-dn)
           (public-key? subject-pub-key)
-          (sequential? extensions)
-          (every? extension? extensions)]
+          (extension-list? extensions)]
     :post [(certificate? %)]}
    (CertificateAuthority/signCertificate
      issuer-dn issuer-priv-key (biginteger serial) not-before not-after subject-dn
@@ -555,8 +560,7 @@
   [ext-container]
   {:pre [(or (certificate? ext-container)
              (certificate-request? ext-container))]
-   :post [(sequential? %)
-          (every? extension? %)]}
+   :post [(extension-list? %)]}
   (-> (ExtensionsUtils/getExtensionList (javaize ext-container))
       clojureize))


Remove hack around redacted.

Remove hack around redacted.

--- src/od117_walker/core.clj
+++ src/od117_walker/core.clj
@@ -104,7 +104,9 @@
   [[key {:keys [links author]}]]
   (apply str
          (apply str (map #(str \" key \" " -> " \" % \" ";\n") links))
-         \" key \" " " "[color=" (get author-colours author) ",style=filled];\n"))
+         (if-let [colour (get author-colours author)]
+           (str \" key \" " " "[color=" colour ",style=filled];\n")
+           "")))

 (defn graphify
   "Convert a map representation of the graph into a string of graphviz dot language."
@@ -125,4 +127,4 @@
   "Calculate and print the graph of OD-117 to foo.dot."
   [& args]
   (with-open [wrtr (io/writer "foo.dot")]
-    (.write wrtr (graphify (walk start-points (conj authors "/redacted"))))))
+    (.write wrtr (graphify (walk start-points authors)))))


Commit kafka checkpoint to a global key as before

--- src/onyx/plugin/kafka.clj
+++ src/onyx/plugin/kafka.clj
@@ -13,6 +13,8 @@
             [franzy.common.metadata.protocols :as metadata]
             [franzy.clients.consumer.protocols :refer [assign-partitions! commit-offsets-sync!
                                                        poll! seek-to-offset!] :as cp]
+            [onyx.log.curator :as zk]
+            [onyx.compression.nippy :refer [zookeeper-compress zookeeper-decompress]]
             [taoensso.timbre :as log :refer [fatal info]]
             [onyx.static.uuid :refer [random-uuid]]
             [onyx.static.default-vals :refer [arg-or-default]]
@@ -42,13 +44,29 @@
      x)
     :none))

+(defn checkpoint-str [id]
+  (str "/onyx/onyx-kafka/checkpoint/" id))
+
+;; Temporary until ABS
+(defn commit! [{:keys [conn opts prefix monitoring] :as log} chunk id]
+  (let [bytes (zookeeper-compress chunk)]
+    (let [node (checkpoint-str id)
+          version (:version (zk/exists conn node))]
+      (if (nil? version)
+        (zk/create-all conn node :persistent? true :data bytes)
+        (zk/set-data conn node bytes version)))))
+
+(defn read-commit [{:keys [conn opts prefix monitoring] :as log} id]
+  (let [node (checkpoint-str id)]
+    (zookeeper-decompress (:data (zk/data conn node)))))
+
 (defn checkpoint-name [group-id topic assigned-partition]
   (format "%s-%s-%s" group-id topic assigned-partition))

 (defn checkpoint-or-beginning [log consumer topic kpartition group-id task-map]
   (let [k (checkpoint-name group-id topic kpartition)]
     (try
-      (let [offset (inc (:offset (extensions/read-chunk log :chunk k)))]
+      (let [offset (inc (:offset (read-commit log k)))]
         (seek-to-offset! consumer {:topic topic :partition kpartition} offset))
       (catch org.apache.zookeeper.KeeperException$NoNodeException nne
         (if-let [start-offsets (:kafka/start-offsets task-map)]
@@ -117,7 +135,7 @@
       (when-let [offset (highest-offset-to-commit @pending-commits)]
         (let [k (checkpoint-name group-id topic kpartition)
               data {:offset offset}]
-          (extensions/force-write-chunk log :chunk data k)
+          (commit! log data k)
           (swap! pending-commits (fn [coll] (remove (fn [k] (<= k offset)) coll)))))
       (when-not (Thread/interrupted)
         (recur)))


Refactor project menu, split big method into smaller chunks.

--- src/cljs/hatnik/web/client/form/project_menu.cljs
+++ src/cljs/hatnik/web/client/form/project_menu.cljs
@@ -3,9 +3,49 @@
             [om.dom :as dom :include-macros true]
             [hatnik.web.client.z-actions :as action]
             [hatnik.web.client.utils :as u]
-            [hatnik.schema :as schm])
-  (:use [jayq.core :only [$]]))
+            [hatnik.schema :as schm]
+            [jayq.core :refer [$]]))

+(defn header [data]
+  (dom/div
+   #js {:className "modal-header"}
+   (dom/h4 #js {:className "modal-title"}
+           (if (:project-id data)
+             "Update project"
+             "Create project")
+           (when (u/mobile?)
+             (dom/button
+              #js {:className "btn btn-default close-btn"
+                   :onClick #(.modal ($ :#iModalProjectMenu) "hide")}
+              "Close")))))
+
+(defn body [data]
+  (dom/div
+   #js {:className "modal-body"}
+   (dom/form #js {:className "form-horizontal"}
+             (u/form-field {:data data
+                            :field :name
+                            :title "Name"
+                            :type :text
+                            :validator (schm/string-of-length 1 128)}))))
+
+(defn footer [data]
+  (let [id (:project-id data)
+        name (:name data)]
+    (dom/div
+     #js {:className "modal-footer"}
+     (dom/div
+      #js {:className "btn btn-primary pull-left"
+           :onClick (if id
+                      #(action/update-project id name)
+                      #(action/send-new-project-request name))}
+      (if id
+        "Update"
+        "Create"))
+     (when id
+       (dom/div #js {:className "btn btn-danger pull-right"
+                     :onClick #(action/delete-project id)}
+                "Delete")))))

 (defn- project-menu [data owner]
   (reify
@@ -15,46 +55,13 @@

     om/IRender
     (render [this]
-      (let [name (:name data)
-            id (:project-id data)]
-        (dom/div
-         #js {:className "modal-dialog"}
-         (dom/div
-          #js {:className "modal-content"}
-          (dom/div #js {:className "modal-header"}
-                   (dom/h4 #js {:className "modal-title"}
-                           (if id
-                             "Update project"
-                             "Create project")
-                           (when (u/mobile?)
-                             (dom/button
-                              #js {:className "btn btn-default close-btn"
-                                   :onClick #(.modal ($ :#iModalProjectMenu) "hide")}
-                              "Close"))))
-
-          (dom/div
-           #js {:className "modal-body"}
-           (dom/form nil
-                     (dom/div #js {:className (str "form-group "
-                                                   (u/validate (schm/string-of-length 1 128) name))}
-                              (dom/input #js {:className "form-control"
-                                              :type "text"
-                                              :value name
-                                              :onChange #(om/update! data :name (u/ev-value %))}))))
-
-          (dom/div #js {:className "modal-footer"}
-
-                   (dom/div #js {:className "btn btn-primary pull-left"
-                                 :onClick (if id
-                                            #(action/update-project id name)
-                                            #(action/send-new-project-request name))}
-                            (if id
-                              "Update"
-                              "Create"))
-                   (when id
-                     (dom/div #js {:className "btn btn-danger pull-right"
-                                   :onClick #(action/delete-project id)}
-                              "Delete")))))))))
+      (dom/div
+       #js {:className "modal-dialog"}
+       (dom/div
+        #js {:className "modal-content"}
+        (header data)
+        (body data)
+        (footer data))))))

 (defn show [project]
   (om/root project-menu project


generating to dist

generating to dist

--- src/replify/core.clj
+++ src/replify/core.clj
@@ -44,8 +44,8 @@
   (println "Building 'Release' ...")
   (let [start (System/nanoTime)]
     (b/build "src"
-             {:output-to "out/app.min.js"
-              :output-dir "release"
+             {:output-to "dis/app.min.js"
+              :output-dir "target"
               :optimizations :advanced
               :verbose true})
     (println "... done. Elapsed" (/ (- (System/nanoTime) start) 1e9) "seconds")))


updated problem 1

updated problem 1

--- src/problems/problem1.clj
+++ src/problems/problem1.clj
@@ -1 +1,3 @@
-(+ 1 2)
+(ns problems.problem1
+  (:require [problems.core :refer :all]))
+


problem 8 solved

problem 8 solved


Add inverted

Add inverted

--- src/exp/ahois.clj
+++ src/exp/ahois.clj
@@ -74,13 +74,15 @@
 (defn lift-hfs
   "Lift child-solution into the context of parent-node."
   [parent child-solution]
-    (assert (:opt-sol child-solution))
-    (HierarchicalForwardState
-     (lift-state        (:state parent)   (:state child-solution))
-     (+                 (:reward parent)  (:reward child-solution))
-     (concat            (:opt-sol parent) (:opt-sol child-solution))
-     (next (:remaining-actions parent))))
-
+  (assert (:opt-sol child-solution))
+  (HierarchicalForwardState
+   (lift-state        (:state parent)   (:state child-solution))
+   (+                 (:reward parent)  (:reward child-solution))
+   (concat            (:opt-sol parent) (:opt-sol child-solution))
+   (next (:remaining-actions parent))))
+
+(defn adjust-hfs-reward [h r]
+  (HierarchicalForwardState (:state h) (+ r (:reward h)) (:opt-sol h) (:remaining-actions h)))

 (defn sa-node-name
   ([state action] (sa-node-name state action (env/precondition-context action state)))
@@ -152,22 +154,73 @@
   (first (recursively-searchify-hfs (make-root-hfs state action))))

+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Inverted ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+;; Note: Rewards passed around are all global-best.
+
+;; TODO:
+
+;; Note: can we cache results across calls?
+;; We need same initial state, at least.
+;;  Different goal is possible, but might as well integrate this above as well.
+
+;; TODO: think about IDA*
+
+
+;; TODO: partial expansions for goals ?
+
+; base-reward is reward of first parent.
+;; TODO: this implementation may notify really bad parnets unnecessarily...
+
+(declare make-upward-node make-inverted-node)
+
+; parents are [parent-hfs parent-ic] pairs.
+(deftype InvertedCache [results-atom parents-atom base-reward])
+
+(defn add-cache-result [cc [hfs ic :as hfs-ic-pair]]
+  (let [{:keys [results-atom parents-atom base-reward]} ic]
+;    (when-let [o (peek @results-atom)] (util/assert-is (<= (:reward hfs) (:reward o))))
+    (swap! results-atom conj hfs)
+    (map #(make-upward-node cc % hfs base-reward) @parents-atom)))
+
+(defn add-cache-parent [#^HashMap cc [parent-hfs parent-ic :as parent-pair]]
+  (let [[name abstract-hfs-fn] (drop-hfs parent-hfs)
+        ic (util/cache-with cc name (InvertedCache (atom []) (atom []) (:reward parent-hfs)))
+        {:keys [results-atom parents-atom base-reward]} ic]
+;    (when-let [o (last @parents-atom)] (util/assert-is (<= (:reward parent-hfs) (:reward (first o)))))
+    (swap! parents-atom conj parent-pair)
+    (if (= (count @parents-atom) 1)
+        (map #(make-inverted-node cc [% ic])
+             (next-hfs-flat (adjust-hfs-reward (abstract-hfs-fn) base-reward)))
+      (map #(make-upward-node cc parent-pair % base-reward) @results-atom))))
+
+(defn make-inverted-node [cc [hfs parent-ic :as hfs-ic-pair]]
+  (is/SimpleNode
+   (conj (hfs-name hfs) parent-ic) (:reward hfs) nil
+   (lazy-seq ((if (seq (:remaining-actions hfs)) add-cache-parent add-cache-result) cc hfs-ic-pair))
+   nil))
+
+(defn make-upward-node [cc [hfs ic] child-hfs base-reward]
+  (let [lifted (lift-hfs hfs child-hfs base-reward)]
+    (if ic (make-inverted-node cc [lifted ic]) (hfs->simple-node lifted))))
+
+(defn make-inverted-search [state action]
+  (is/make-flat-incremental-dijkstra
+   (make-inverted-node (HashMap.) [(make-root-hfs state action) nil])))
+

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; SAHA ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 ;; Here, subsearches should only generate goal nodes. So, we only have to deal with
 ; expanding the initial nodes we populate the search with.  These can be dummies.

-; Worry about refactoring later.
-
-
-;; TODO: these should all be single-solution .
+;; TODO: these should all be single-solution . Note: sequence enforces this ?
 ;; These caches cache erfinements, optimsitic descriptions, and solve final-state connection probelm
 ; Refinements and valuation for abstracted SA

 (declare get-saha-sps-search)

-;; TODO: smarter about failed searches...
+;; TODO: smarter about failed searches... ?
 (defn get-inner-sa-cache "Get a map from inner final states to SAS nodes."[hfs]
   (let [[name abstract-hfs-fn] (drop-hfs hfs)]
     (util/cache-with *problem-cache* name
@@ -248,6 +301,9 @@

 (defn sahucs-simple [henv]
   (hierarchical-search henv nil make-recursive-search))
+
+(defn sahucs-inverted [henv]
+  (hierarchical-search henv nil make-inverted-search))

 (defn saha-simple [henv]
   (hierarchical-search henv nil make-saha-search))


Kick off all the futures at the same time.

The lazy nature of collections means that we weren't trying to kick all
these off at the same time. So a test that was supposed to run for 5
minutes ran for more like 30 because some of the futures would be super
delayed.

--- src/frmr/dstt.clj
+++ src/frmr/dstt.clj
@@ -47,7 +47,7 @@
   (let [request-indicies (range number-of-requests)
         request-delays (map #(* % pause-between-requests) request-indicies)
         request-futures (map #(issue-timed-request request-invoker % handler) request-delays)
-        result-timings (map #(deref %) request-futures)
+        result-timings (doall (map deref (doall request-futures)))
         grouped-result-categories (partition (count result-timings) (apply interleave result-timings))
         average-timing-per-category (map #(-> % (average) (str "ms")) grouped-result-categories)]
     (println (str "Average time per category:\n" (vec average-timing-per-category)))))


Implement support for custom invoker builders.

--- src/frmr/dstt.clj
+++ src/frmr/dstt.clj
@@ -108,7 +108,7 @@
    :else
    client/get))

-(defn- build-request-invoker
+(defn- build-default-request-invoker
   "Builds a request invoker function given the name of the HTTP function you want to invoke, the url
   you want to execute requests against, and a map of options you want to provide to the underlying
   HTTP library."
@@ -121,8 +121,9 @@
 (defn run-load-test
   "Execute a load test against a specified URL by issuing the number-of-requests spread over the
   number-of-milliseconds using the http-method, request-options, and result-handler specified."
-  [url http-method number-of-requests number-of-milliseconds request-options result-handler]
-  (let [request-invoker (build-request-invoker http-method url request-options)
+  [url http-method number-of-requests number-of-milliseconds request-options result-handler custom-request-invoker]
+  (let [request-invoker (or custom-request-invoker
+                            (build-default-request-invoker http-method url request-options))
         pause-between-requests (/ number-of-requests number-of-milliseconds)]
     (load-test-url request-invoker number-of-requests pause-between-requests result-handler)))

@@ -168,6 +169,10 @@

    [nil "--handler HANDLER" "Custom handler file."
     :id :handler
+    :default nil]
+
+   [nil "--invoker-builder INVOKERFILE" "Pass in a Clojure file that constructs your request invoker function."
+    :id :invoker-builder
     :default nil]

    ["-h" "--help"]
@@ -202,6 +207,7 @@
       (let [{requests :requests
              seconds :time
              handler :handler
+             invoker-builder :invoker-builder
              http-method :method
              http-headers :headers
              http-body :body
@@ -215,7 +221,13 @@
                                    (some-> http-body parse-body)
                                    {:follow-redirects false
                                     :throw-exceptions false})
-            request-invoker (build-request-invoker http-method url request-options)
+
+            [request-invoker custom-invoker-name] (if-not (nil? invoker-builder)
+                                                    [(let [build-custom-request-invoker (eval (read (PushbackReader. (io/reader invoker-builder))))]
+                                                       (build-custom-request-invoker http-method url request-options))
+                                                     invoker-builder]
+                                                    [(build-default-request-invoker http-method url request-options)
+                                                     nil])

             [parsed-handler custom-handler-name] (if-not (nil? handler)
                                                    [(eval (read (PushbackReader. (io/reader handler))))
@@ -226,6 +238,7 @@
         (println (str requests " requests spread over " seconds " seconds."))
         (if verbose (println (str "Request options: " request-options)))
         (if custom-handler-name (println (str "Using custom handler: " custom-handler-name)))
+        (if custom-invoker-name (println (str "Using custom request invoker: " custom-invoker-name)))
         (println "")
         (let [load-test-results (load-test-url request-invoker
                                                requests


Pull out helper functions.

Pull out helper functions.

--- src/midje/sweet/sweet_to_semi_sweet_rewrite.clj
+++ src/midje/sweet/sweet_to_semi_sweet_rewrite.clj
@@ -29,17 +29,23 @@
 (defn overrides [possibles]
   (apply concat (take-while (comp keyword? first) (partition 2 possibles))))

+(defn one-fake-body-content [forms]
+  (let [constant-part (take 3 forms)
+	overrides (overrides (nthnext forms 3))]
+    (concat constant-part overrides)))
+
 (defn partition-fake-bodies
   ([expectations]
      (partition-fake-bodies [] expectations))
   ([so-far remainder]
     (if (empty? remainder)
       so-far
-      (let [constant-part (take 3 remainder)
-	    overrides (overrides (nthnext remainder 3))
-	    whole-body (concat constant-part overrides)]
+      (let [whole-body (one-fake-body-content remainder)]
 	(recur (conj so-far whole-body)
 	       (nthnext remainder (count whole-body)))))))
+
+(defn make-fake [fake-body]
+  `(midje.semi-sweet/fake ~@fake-body))

 ;; Simple movement

@@ -93,11 +99,11 @@

 ;; The meat of it.
+
 (defn expand-following-into-fake-calls [provided-loc]
   (let [expectations (rest (zip/node (zip/up provided-loc)))
 	fake-bodies (partition-fake-bodies expectations)]
-    (map (fn [fake-body] `(midje.semi-sweet/fake ~@fake-body))
-	 fake-bodies)))
+    (map make-fake fake-bodies)))

 (defn rewrite [multi-form]
   (loop [loc (zip/seq-zip multi-form)]


Factor to-string out into device-info.

Factor to-string out into device-info.

--- src/org/playasophy/wonderdome/input/usb_hid.clj
+++ src/org/playasophy/wonderdome/input/usb_hid.clj
@@ -9,6 +9,9 @@
       HIDManager)))

+
+;;;;; CONFIGURATION ;;;;;
+
 (def ^:private library-name
   "JNI library to load when finding devices."
   "hidapi-jni-64")
@@ -17,6 +20,18 @@
 (def ^:private ^:const buffer-size
   "Byte buffer size for reading USB input state."
   256)
+
+
+
+;;;;; HELPER FUNCTIONS ;;;;;
+
+(defn device-info
+  "Builds a map with a device's manufacturer, product, and serial number."
+  [^HIDDevice device]
+  (when device
+    {:manufacturer (.getManufacturerString device)
+     :product (.getProductString device)
+     :serial (.getSerialNumberString device)}))

 (defn find-device
@@ -61,6 +76,9 @@
           nil)))))

+
+;;;;; INPUT COMPONENT ;;;;;
+
 (defrecord HIDInput
   [channel
    ^HIDDevice device
@@ -88,24 +106,7 @@
     (when process
       (.interrupt process)
       (.join process 1000))
-    (assoc this :process nil))
-
-
-  Object
-
-  (toString
-    [this]
-    (str
-      "HID "
-      (if device
-        (str
-          (.getManufacturerString device) " / "
-          (.getProductString device) " / "
-          (.getSerialNumberString device))
-        "(no device)")
-      (if process
-        " [running]"
-        ""))))
+    (assoc this :process nil)))

 (defn hid-input


Allow users to specify scsynth path in overtone config.

E.g. :sc-path "C:\\Program Files (x86)\\SuperCollider\\scsynth.exe"

--- src/overtone/sc/machinery/server/connection.clj
+++ src/overtone/sc/machinery/server/connection.clj
@@ -271,7 +271,7 @@
   "Creates a sctring array representing the sc command to execute in an
   external process (typically with #'external-booter)"
   [port opts]
-  (into-array String (cons (find-sc-path) (scsynth-arglist (merge-sc-args {:port port} opts)))))
+  (into-array String (cons (or (config-get :sc-path) (find-sc-path)) (scsynth-arglist (merge-sc-args {:port port} opts)))))

 (defn- boot-external-server
   "Boot the audio server in an external process and tell it to listen on


Bugfix: Draw charts even when no data is available

Draw a single line at "0.00"

--- src-cljs/tamarack/chart.cljs
+++ src-cljs/tamarack/chart.cljs
@@ -15,7 +15,7 @@
         height (- canvas-height margin-top margin-bottom)

         minutes (util/minutes-between from to)
-        max-data (apply max (map (fn [[_ v]] v) data))
+        max-data (apply max 0 (map (fn [[_ v]] v) data))
         total-minutes (- (count minutes) 1)
         step-width (/ width total-minutes)
         step-height (if (zero? max-data) 0 (/ height max-data))


Added convenience REPL functions for cpu, mem, and PIDs (processes and docker).

--- dev-resources/src/cmr/dev/env/manager/repl.clj
+++ dev-resources/src/cmr/dev/env/manager/repl.clj
@@ -55,13 +55,21 @@
   [service-key]
   (process/get-process system service-key))

+(defn get-process-cpu
+  [service-key]
+  (process/get-process-cpu system service-key))
+
+(defn get-process-descendants
+  [service-key]
+  (process/get-process-descendants system service-key))
+
 (defn get-process-id
   [service-key]
   (process/get-process-id system service-key))

-(defn get-process-descendants
-  [service-key]
-  (process/get-process-descendants system service-key))
+(defn get-process-mem
+  [service-key]
+  (process/get-process-mem system service-key))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;   Messaging Functions   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -96,6 +104,18 @@
 (defn get-docker-container-state
   [service-key]
   (docker/get-container-state system service-key))
+
+(defn get-docker-container-pid
+  [service-key]
+  (docker/get-container-pid system service-key))
+
+(defn get-docker-container-cpu
+  [service-key]
+  (docker/get-container-cpu system service-key))
+
+(defn get-docker-container-mem
+  [service-key]
+  (docker/get-container-mem system service-key))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;   Health checks   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


DM #94 - Add functional test for promoting/demoting questions

--- test/objective8/functional/functional_tests.clj
+++ test/objective8/functional/functional_tests.clj
@@ -61,335 +61,353 @@

 (facts "About user journeys"
        (against-background
-         [(before :contents (do (integration-helpers/db-connection)
-                                (integration-helpers/truncate-tables)
-                                (core/start-server config-without-twitter)
-                                (wd/set-driver! {:browser :firefox})
-                                (reset! journey-state {})
-                                (clear-screenshots)))
-          (after :contents (do (wd/quit)
+        [(before :contents (do (integration-helpers/db-connection)
                                (integration-helpers/truncate-tables)
-                               (core/stop-server)))]
-         (fact "can add an objective"
-               (try (wd/to "localhost:8080")
-                    (wait-for-title "Objective[8]")
-                    (screenshot "home_page")
-
-                    (wd/click "a[href='/objectives']")
-                    (wait-for-title "Objectives | Objective[8]")
-                    (screenshot "objectives_page")
-
-                    (wd/click "a[href='/objectives/create']")
-                    (wait-for-title "Sign in or Sign up | Objective[8]")
-                    (screenshot "sign_in_page")
-
-                    (wd/click ".func--sign-in-with-twitter")
-                    (wait-for-title "Sign up | Objective[8]")
-                    (screenshot "sign_up_almost_there")
-
-                    (wd/input-text "#username" "funcTestUser123")
-                    (-> "#email-address"
-                        (wd/input-text "func_test_user@domain.com")
-                        wd/submit)
-
-                    (screenshot "create_objective_page")
-                    (wait-for-title "Create an Objective | Objective[8]")
-
-                    (wd/input-text ".func--input-objective-title" "Functional test headline")
-                    (wd/input-text ".func--input-objective-goal-1" "Functional test goal")
-                    (-> ".func--input-objective-background"
-                        (wd/input-text
-                          "Functional test description with lots of hipster-ipsum:
+                               (core/start-server config-without-twitter)
+                               (wd/set-driver! {:browser :firefox})
+                               (reset! journey-state {})
+                               (clear-screenshots)))
+         (after :contents (do (wd/quit)
+                              (integration-helpers/truncate-tables)
+                              (core/stop-server)))]
+        (fact "can add an objective"
+              (try (wd/to "localhost:8080")
+                   (wait-for-title "Objective[8]")
+                   (screenshot "home_page")
+
+                   (wd/click "a[href='/objectives']")
+                   (wait-for-title "Objectives | Objective[8]")
+                   (screenshot "objectives_page")
+
+                   (wd/click "a[href='/objectives/create']")
+                   (wait-for-title "Sign in or Sign up | Objective[8]")
+                   (screenshot "sign_in_page")
+
+                   (wd/click ".func--sign-in-with-twitter")
+                   (wait-for-title "Sign up | Objective[8]")
+                   (screenshot "sign_up_almost_there")
+
+                   (wd/input-text "#username" "funcTestUser123")
+                   (-> "#email-address"
+                       (wd/input-text "func_test_user@domain.com")
+                       wd/submit)
+
+                   (screenshot "create_objective_page")
+                   (wait-for-title "Create an Objective | Objective[8]")
+
+                   (wd/input-text ".func--input-objective-title" "Functional test headline")
+                   (wd/input-text ".func--input-objective-goal-1" "Functional test goal")
+                   (-> ".func--input-objective-background"
+                       (wd/input-text
+                        "Functional test description with lots of hipster-ipsum:
                           Master cleanse squid nulla, ugh kitsch biodiesel cronut food truck. Nostrud Schlitz tempor farm-to-table skateboard, wayfarers adipisicing Pitchfork sunt Neutra brunch four dollar toast forage placeat. Fugiat lo-fi sed polaroid Portland et tofu Austin. Blue Bottle labore forage, in bitters incididunt ugh delectus seitan flannel. Mixtape migas cardigan, quis American Apparel culpa aliquip cupidatat et nisi scenester. Labore sriracha Etsy flannel XOXO. Normcore selvage do vero keytar synth.")
-                        wd/submit)
-
-                    (wait-for-title "Functional test headline | Objective[8]")
-                    (swap! journey-state assoc :objective-url (wd/current-url))
-                    (screenshot "objective_page")
-
-                    {:page-title (wd/title)
-                     :writer-name (wd/text".func--writer-name")}
-
-                    (catch Exception e
-                      (screenshot "ERROR-Can-add-an-objective")
-                      (throw e)))
-               =>  (contains {:page-title "Functional test headline | Objective[8]"
-                              :writer-name "funcTestUser123"}))
-
-         (fact "Can star an objective"
-               (try (wd/to (:objective-url @journey-state))
-                    (wait-for-title "Functional test headline | Objective[8]")
-
-                    (wd/click ".func--objective-star")
-
-                    (wd/to "/")
-
-                    (wd/to (:objective-url @journey-state))
-                    (wait-for-title "Functional test headline | Objective[8]")
-
-                    (screenshot "objective_page_with_starred_objective")
-
-                    (wd/attribute ".func--objective-star" :class)
-
-                    (catch Exception e
-                      (screenshot "ERROR-Can-star-an-objective")
-                      (throw e)))
-               => (contains "starred"))
-
-         (fact "Can add a question"
-               (try (wd/to "localhost:8080/objectives")
-                    (wait-for-title "Objectives | Objective[8]")
-                    (screenshot "objectives_page_with_an_objective")
-
-                    (wd/click ".func--objective-list-item-link")
-                    (wait-for-title "Functional test headline | Objective[8]")
-                    (screenshot "objective_page")
-
-                    (wd/click ".func--add-question")
-                    (wait-for-element ".func--question-textarea")
-                    (screenshot "add_question_page")
-
-                    (-> ".func--question-textarea"
-                        (wd/input-text "Functional test question")
-                        (wd/submit))
-
-                    (wait-for-element ".func--add-question")
-                    (screenshot "objective_page_with_question")
-
-                    (catch Exception e
-                      (screenshot "Error-Can-add-questions")
-                      (throw e))))
-
-(fact "Can answer a question"
-      (try (wd/to (:objective-url @journey-state))
-           (wait-for-element ".func--answer-link")
-
-           (wd/click ".func--answer-link")
-           (wait-for-element ".func--add-answer")
-
-           (-> ".func--add-answer"
-               (wd/input-text "Functional test answer")
-               (wd/submit))
-
-           (wait-for-element ".func--answer-text")
-           (screenshot "answered_question")
-           (swap! journey-state assoc :question-url (wd/current-url))
-
-           (wd/text ".func--answer-text")
-
-           (catch Exception e
-             (screenshot "Error-Can-answer-questions")
-             (throw e)))
-      => "Functional test answer")
-
-(fact "Can up vote an answer"
-      (try (wd/to (:question-url @journey-state))
-
-           (wait-for-element "textarea.func--add-answer")
-           (wd/text ".func--up-score") => "0"
-
-           (wd/click "button.func--up-vote")
-
-           (wait-for-element "textarea.func--add-answer")
-           (wd/text ".func--up-score") => "1"
-
-           (catch Exception e
-             (screenshot "Error-Can-vote-on-an-answer")
-             (throw e))))
-
-(fact "Can invite a writer"
-      (try (wd/to (:objective-url @journey-state))
-           (wait-for-title "Functional test headline | Objective[8]")
-           (screenshot "objective_page")
-
-           (wd/click ".func--invite-writer")
-           (wait-for-element ".func--invite-writer")
-           (screenshot "invite_writer_page")
-
-           (wd/input-text ".func--writer-name" "Functional Test Writer Name")
-           (wd/input-text ".func--writer-email" "func_test_candidate@domain.com")
-           (-> ".func--writer-reason"
-               (wd/input-text "Functional test invitation reason")
-               wd/submit)
-           (wait-for-title "Functional test headline | Objective[8]")
-           (screenshot "objective_with_invitation_flash")
-
-           (->> (wd/value ".func--invitation-url")
-                (re-find #"http://.*$")
-                (swap! journey-state assoc :invitation-url))
-           {:page-title (wd/title)
-            :flash-message (wd/text ".func--invitation-guidance")}
-
-           (catch Exception e
-             (screenshot "ERROR-Can-invite-a-writer")
-             (throw e)))
-      => (contains {:page-title "Functional test headline | Objective[8]"
-                    :flash-message (contains "Your writer's invitation")}))
-
-
-(fact "Can accept a writer invitation"
-      (try (wd/to (:invitation-url @journey-state))
-           (wait-for-title "Functional test headline | Objective[8]")
-           (screenshot "objective_page_after_hitting_invitation_url")
-
-           (wd/click ".func--invitation-accept")
-           (wait-for-element ".func--objective-page")
-           (screenshot "objective_page_from_recently_added_writer")
-
-           (wd/text (second (wd/elements ".func--writer-name")))
-
-           (catch Exception e
-             (screenshot "ERROR-Can-accept-a-writer-invitation")
-             (throw e)))
-      => "Functional Test Writer Name")
-
-(against-background
-  [(before :contents (-> (:objective-url @journey-state)
-                         (string/split #"/")
-                         last
-                         Integer/parseInt
-                         actions/start-drafting!))]
-  (fact "Can submit a draft"
-        (try
-          (wd/to (str (:objective-url @journey-state) "/drafts/latest"))
-          (wait-for-title "Policy draft | Objective[8]")
-          (screenshot "latest_draft_no_draft")
-
-          (wd/click ".func--add-a-draft")
-          (wait-for-title "Add draft | Objective[8]")
-          (screenshot "add_draft_empty")
-
-          (wd/input-text ".func--add-draft-content" FIRST_DRAFT_MARKDOWN)
-          (wd/click ".func--preview-action")
-          (wait-for-title "Add draft | Objective[8]")
-          (screenshot "preview_draft")
-
-          (wd/click ".func--submit-action")
-
-          (wait-for-title "Policy draft | Objective[8]")
-          (screenshot "submitted_draft")
-
-          {:page-title (wd/title)
-           :page-source (wd/page-source)}
-
-          (catch Exception e
-            (screenshot "ERROR-Can-submit-a-draft")
-            (throw e)))
-        => (contains {:page-title "Policy draft | Objective[8]"
-                      :page-source (contains FIRST_DRAFT_HTML)}))
-
-  (fact "Can view latest draft"
-        (try
-          (wd/to (:objective-url @journey-state))
-          (wait-for-title "Functional test headline | Objective[8]")
-          (screenshot "drafting_started_objective")
-
-          (wd/click ".func--drafting-message-link")
-          (wait-for-title "Drafts | Objective[8]")
-          (screenshot "drafts_list_with_one_draft")
-
-          (wd/click ".func--latest-draft-link")
-          (wait-for-title "Policy draft | Objective[8]")
-          (screenshot "latest_draft")
-
-          {:page-title (wd/title)
-           :page-source (wd/page-source)}
-
-          (catch Exception e
-            (screenshot "ERROR-Can-view-latest-draft")
-            (throw e)))
-        => (contains {:page-title "Policy draft | Objective[8]"
-                      :page-source (contains FIRST_DRAFT_HTML)}))
-
-  (fact "Can comment on a draft"
-        (try
-          (wd/to (str (:objective-url @journey-state) "/drafts/latest"))
-          (wait-for-title "Policy draft | Objective[8]")
-
-          (wd/input-text ".func--comment-form-text-area" "Functional test comment text")
-          (wd/click ".func--comment-form-submit")
-          (wait-for-title "Policy draft | Objective[8]")
-          (screenshot "draft_with_comment")
-
-          (wd/page-source)
-
-          (catch Exception e
-            (screenshot "ERROR-Can-comment-on-a-draft")
-            (throw e)))
-        => (contains "Functional test comment text"))
-
-  (fact "Can down vote a comment on a draft"
-        (try
-          (wd/to (str (:objective-url @journey-state) "/drafts/latest"))
-          (wait-for-title "Policy draft | Objective[8]")
-
-          (wd/text ".func--down-score") => "0"
-
-          (wd/click "button.func--down-vote")
-
-          (wait-for-title "Policy draft | Objective[8]")
-          (wd/text ".func--down-score") => "1"
-
-          (catch Exception e
-            (screenshot "ERROR-Can-vote-on-a-comment-on-a-draft")
-            (throw e))))
-
-  (fact "Can navigate between drafts"
-        (try
-          (wd/to (str (:objective-url @journey-state) "/drafts"))
-          (wait-for-title "Drafts | Objective[8]")
-          (screenshot "list_of_drafts_with_one_draft")
-
-          (wd/click ".func--add-a-draft")
-          (wait-for-title "Add draft | Objective[8]")
-          (wd/input-text ".func--add-draft-content" SECOND_DRAFT_MARKDOWN)
-
-          (wd/click ".func--submit-action")
-          (wait-for-title "Policy draft | Objective[8]")
-          (screenshot "second_draft")
-
-          (wd/click ".func--add-a-draft")
-          (wait-for-title "Add draft | Objective[8]")
-          (wd/input-text ".func--add-draft-content" THIRD_DRAFT_MARKDOWN)
-
-          (wd/click ".func--submit-action")
-          (wait-for-title "Policy draft | Objective[8]")
-
-          (wd/to (str (:objective-url @journey-state) "/drafts"))
-          (wait-for-title "Drafts | Objective[8]")
-          (screenshot "list_of_drafts_with_three_drafts")
-
-          (wd/to (str (:objective-url @journey-state) "/drafts/latest"))
-          (wait-for-title "Policy draft | Objective[8]")
-          (screenshot "latest_draft_with_previous_button")
-
-          (wd/click ".func--draft-version-previous-link")
-          (wait-for-title "Policy draft | Objective[8]")
-          (screenshot "second_draft_with_next")
-
-          (wd/click ".func--draft-version-next-link")
-          (wait-for-title "Policy draft | Objective[8]")
-          (screenshot "third_draft")
-
-          (wd/page-source)
-          (catch Exception e
-            (screenshot "ERROR-Can-navigate-between-drafts")
-            (throw e)))
-        => (contains THIRD_DRAFT_HTML))
-
-(fact "Can navigate to import from Google Drive"
-      (try
-        (wd/to (str (:objective-url @journey-state) "/drafts"))
-        (wait-for-title "Drafts | Objective[8]")
-
-        (wd/click ".func--import-draft-link")
-        (wait-for-title "Import draft | Objective[8]")
-        (screenshot "import_draft")
-
-        (wd/click ".func--cancel-link")
-        (wait-for-title "Drafts | Objective[8]")
-        (screenshot "draft_list")
-
-        (catch Exception e
-          (screenshot "ERROR-Can-navigate-to-import-from-Google-Drive")
-          (throw e)))))))
+                       wd/submit)
+
+                   (wait-for-title "Functional test headline | Objective[8]")
+                   (swap! journey-state assoc :objective-url (wd/current-url))
+                   (screenshot "objective_page")
+
+                   {:page-title (wd/title)
+                    :writer-name (wd/text".func--writer-name")}
+
+                   (catch Exception e
+                     (screenshot "ERROR-Can-add-an-objective")
+                     (throw e)))
+              =>  (contains {:page-title "Functional test headline | Objective[8]"
+                             :writer-name "funcTestUser123"}))
+
+        (fact "Can star an objective"
+              (try (wd/to (:objective-url @journey-state))
+                   (wait-for-title "Functional test headline | Objective[8]")
+
+                   (wd/click ".func--objective-star")
+
+                   (wd/to "/")
+
+                   (wd/to (:objective-url @journey-state))
+                   (wait-for-title "Functional test headline | Objective[8]")
+
+                   (screenshot "objective_page_with_starred_objective")
+
+                   (wd/attribute ".func--objective-star" :class)
+
+                   (catch Exception e
+                     (screenshot "ERROR-Can-star-an-objective")
+                     (throw e)))
+              => (contains "starred"))
+
+        (fact "Can add a question"
+              (try (wd/to "localhost:8080/objectives")
+                   (wait-for-title "Objectives | Objective[8]")
+                   (screenshot "objectives_page_with_an_objective")
+
+                   (wd/click ".func--objective-list-item-link")
+                   (wait-for-title "Functional test headline | Objective[8]")
+                   (screenshot "objective_page")
+
+                   (wd/click ".func--add-question")
+                   (wait-for-element ".func--question-textarea")
+                   (screenshot "add_question_page")
+
+                   (-> ".func--question-textarea"
+                       (wd/input-text "Functional test question")
+                       (wd/submit))
+
+                   (wait-for-element ".func--add-question")
+                   (screenshot "objective_page_with_question")
+
+                   (catch Exception e
+                     (screenshot "Error-Can-add-questions")
+                     (throw e))))
+
+        (fact "Objective owner can promote and demote questions"
+              (try (wd/to (:objective-url @journey-state))
+                   (wait-for-element ".func--promote-question")
+
+                   (wd/click ".func--promote-question")
+                   (wait-for-element ".func--demote-question")
+                   (screenshot "promoted_question")
+
+                   (wd/click ".func--demote-question")
+                   (wait-for-element ".func--promote-question")
+                   (screenshot "demoted_question")
+
+                   (catch Exception e
+                     (screenshot "Error-Objective-owner-can-promote-and-demote-questions")
+                     (throw e))))
+
+        (fact "Can answer a question"
+              (try (wd/to (:objective-url @journey-state))
+                   (wait-for-element ".func--answer-link")
+
+                   (wd/click ".func--answer-link")
+                   (wait-for-element ".func--add-answer")
+
+                   (-> ".func--add-answer"
+                       (wd/input-text "Functional test answer")
+                       (wd/submit))
+
+                   (wait-for-element ".func--answer-text")
+                   (screenshot "answered_question")
+                   (swap! journey-state assoc :question-url (wd/current-url))
+
+                   (wd/text ".func--answer-text")
+
+                   (catch Exception e
+                     (screenshot "Error-Can-answer-questions")
+                     (throw e)))
+              => "Functional test answer")
+
+        (fact "Can up vote an answer"
+              (try (wd/to (:question-url @journey-state))
+
+                   (wait-for-element "textarea.func--add-answer")
+                   (wd/text ".func--up-score") => "0"
+
+                   (wd/click "button.func--up-vote")
+
+                   (wait-for-element "textarea.func--add-answer")
+                   (wd/text ".func--up-score") => "1"
+
+                   (catch Exception e
+                     (screenshot "Error-Can-vote-on-an-answer")
+                     (throw e))))
+
+        (fact "Can invite a writer"
+              (try (wd/to (:objective-url @journey-state))
+                   (wait-for-title "Functional test headline | Objective[8]")
+                   (screenshot "objective_page")
+
+                   (wd/click ".func--invite-writer")
+                   (wait-for-element ".func--invite-writer")
+                   (screenshot "invite_writer_page")
+
+                   (wd/input-text ".func--writer-name" "Functional Test Writer Name")
+                   (wd/input-text ".func--writer-email" "func_test_candidate@domain.com")
+                   (-> ".func--writer-reason"
+                       (wd/input-text "Functional test invitation reason")
+                       wd/submit)
+                   (wait-for-title "Functional test headline | Objective[8]")
+                   (screenshot "objective_with_invitation_flash")
+
+                   (->> (wd/value ".func--invitation-url")
+                        (re-find #"http://.*$")
+                        (swap! journey-state assoc :invitation-url))
+                   {:page-title (wd/title)
+                    :flash-message (wd/text ".func--invitation-guidance")}
+
+                   (catch Exception e
+                     (screenshot "ERROR-Can-invite-a-writer")
+                     (throw e)))
+              => (contains {:page-title "Functional test headline | Objective[8]"
+                            :flash-message (contains "Your writer's invitation")}))
+
+
+        (fact "Can accept a writer invitation"
+              (try (wd/to (:invitation-url @journey-state))
+                   (wait-for-title "Functional test headline | Objective[8]")
+                   (screenshot "objective_page_after_hitting_invitation_url")
+
+                   (wd/click ".func--invitation-accept")
+                   (wait-for-element ".func--objective-page")
+                   (screenshot "objective_page_from_recently_added_writer")
+
+                   (wd/text (second (wd/elements ".func--writer-name")))
+
+                   (catch Exception e
+                     (screenshot "ERROR-Can-accept-a-writer-invitation")
+                     (throw e)))
+              => "Functional Test Writer Name")
+
+
+
+        (against-background
+         [(before :contents (-> (:objective-url @journey-state)
+                                (string/split #"/")
+                                last
+                                Integer/parseInt
+                                actions/start-drafting!))]
+         (fact "Can submit a draft"
+               (try
+                 (wd/to (str (:objective-url @journey-state) "/drafts/latest"))
+                 (wait-for-title "Policy draft | Objective[8]")
+                 (screenshot "latest_draft_no_draft")
+
+                 (wd/click ".func--add-a-draft")
+                 (wait-for-title "Add draft | Objective[8]")
+                 (screenshot "add_draft_empty")
+
+                 (wd/input-text ".func--add-draft-content" FIRST_DRAFT_MARKDOWN)
+                 (wd/click ".func--preview-action")
+                 (wait-for-title "Add draft | Objective[8]")
+                 (screenshot "preview_draft")
+
+                 (wd/click ".func--submit-action")
+
+                 (wait-for-title "Policy draft | Objective[8]")
+                 (screenshot "submitted_draft")
+
+                 {:page-title (wd/title)
+                  :page-source (wd/page-source)}
+
+                 (catch Exception e
+                   (screenshot "ERROR-Can-submit-a-draft")
+                   (throw e)))
+               => (contains {:page-title "Policy draft | Objective[8]"
+                             :page-source (contains FIRST_DRAFT_HTML)}))
+
+         (fact "Can view latest draft"
+               (try
+                 (wd/to (:objective-url @journey-state))
+                 (wait-for-title "Functional test headline | Objective[8]")
+                 (screenshot "drafting_started_objective")
+
+                 (wd/click ".func--drafting-message-link")
+                 (wait-for-title "Drafts | Objective[8]")
+                 (screenshot "drafts_list_with_one_draft")
+
+                 (wd/click ".func--latest-draft-link")
+                 (wait-for-title "Policy draft | Objective[8]")
+                 (screenshot "latest_draft")
+
+                 {:page-title (wd/title)
+                  :page-source (wd/page-source)}
+
+                 (catch Exception e
+                   (screenshot "ERROR-Can-view-latest-draft")
+                   (throw e)))
+               => (contains {:page-title "Policy draft | Objective[8]"
+                             :page-source (contains FIRST_DRAFT_HTML)}))
+
+         (fact "Can comment on a draft"
+               (try
+                 (wd/to (str (:objective-url @journey-state) "/drafts/latest"))
+                 (wait-for-title "Policy draft | Objective[8]")
+
+                 (wd/input-text ".func--comment-form-text-area" "Functional test comment text")
+                 (wd/click ".func--comment-form-submit")
+                 (wait-for-title "Policy draft | Objective[8]")
+                 (screenshot "draft_with_comment")
+
+                 (wd/page-source)
+
+                 (catch Exception e
+                   (screenshot "ERROR-Can-comment-on-a-draft")
+                   (throw e)))
+               => (contains "Functional test comment text"))
+
+         (fact "Can down vote a comment on a draft"
+               (try
+                 (wd/to (str (:objective-url @journey-state) "/drafts/latest"))
+                 (wait-for-title "Policy draft | Objective[8]")
+
+                 (wd/text ".func--down-score") => "0"
+
+                 (wd/click "button.func--down-vote")
+
+                 (wait-for-title "Policy draft | Objective[8]")
+                 (wd/text ".func--down-score") => "1"
+
+                 (catch Exception e
+                   (screenshot "ERROR-Can-vote-on-a-comment-on-a-draft")
+                   (throw e))))
+
+         (fact "Can navigate between drafts"
+               (try
+                 (wd/to (str (:objective-url @journey-state) "/drafts"))
+                 (wait-for-title "Drafts | Objective[8]")
+                 (screenshot "list_of_drafts_with_one_draft")
+
+                 (wd/click ".func--add-a-draft")
+                 (wait-for-title "Add draft | Objective[8]")
+                 (wd/input-text ".func--add-draft-content" SECOND_DRAFT_MARKDOWN)
+
+                 (wd/click ".func--submit-action")
+                 (wait-for-title "Policy draft | Objective[8]")
+                 (screenshot "second_draft")
+
+                 (wd/click ".func--add-a-draft")
+                 (wait-for-title "Add draft | Objective[8]")
+                 (wd/input-text ".func--add-draft-content" THIRD_DRAFT_MARKDOWN)
+
+                 (wd/click ".func--submit-action")
+                 (wait-for-title "Policy draft | Objective[8]")
+
+                 (wd/to (str (:objective-url @journey-state) "/drafts"))
+                 (wait-for-title "Drafts | Objective[8]")
+                 (screenshot "list_of_drafts_with_three_drafts")
+
+                 (wd/to (str (:objective-url @journey-state) "/drafts/latest"))
+                 (wait-for-title "Policy draft | Objective[8]")
+                 (screenshot "latest_draft_with_previous_button")
+
+                 (wd/click ".func--draft-version-previous-link")
+                 (wait-for-title "Policy draft | Objective[8]")
+                 (screenshot "second_draft_with_next")
+
+                 (wd/click ".func--draft-version-next-link")
+                 (wait-for-title "Policy draft | Objective[8]")
+                 (screenshot "third_draft")
+
+                 (wd/page-source)
+                 (catch Exception e
+                   (screenshot "ERROR-Can-navigate-between-drafts")
+                   (throw e)))
+               => (contains THIRD_DRAFT_HTML))
+
+         (fact "Can navigate to import from Google Drive"
+               (try
+                 (wd/to (str (:objective-url @journey-state) "/drafts"))
+                 (wait-for-title "Drafts | Objective[8]")
+
+                 (wd/click ".func--import-draft-link")
+                 (wait-for-title "Import draft | Objective[8]")
+                 (screenshot "import_draft")
+
+                 (wd/click ".func--cancel-link")
+                 (wait-for-title "Drafts | Objective[8]")
+                 (screenshot "draft_list")
+
+                 (catch Exception e
+                   (screenshot "ERROR-Can-navigate-to-import-from-Google-Drive")
+                   (throw e)))))))


itemsOnLifecicyle: replacing an if with a when-not

--- src/app/itemsOnLifecycle.clj
+++ src/app/itemsOnLifecycle.clj
@@ -144,8 +144,8 @@
 (defn utilClassProblem
   "Return a problem found about a utils class or nil, if none can be found"
   [utilClass]
-  (if (hasOnlyOnePrivateConstructorTakingNoParams utilClass)
-    nil "The class should have only one single private constructor taking no params"))
+  (when-not (hasOnlyOnePrivateConstructorTakingNoParams utilClass)
+    "The class should have only one single private constructor taking no params"))

 (defn- utilsClassesQuery [params]
   (let [{cus :cus onlyIncorrect :onlyIncorrect} params


Bring the rest of the tests back

Bring the rest of the tests back

--- test/clojure/clojurewerkz/cassaforte/cql_test.clj
+++ test/clojure/clojurewerkz/cassaforte/cql_test.clj
@@ -455,33 +455,25 @@
                                  {:name "Alex" :city "Munich" :age (int 19)}))
     (is (= r (first (select *session* :users (limit 1)))))))

-;; (deftest test-insert-without-prepared-statements
-;;   (comment
-;;     (let [r {:name "Alex" :city "Munich" :age (int 19)}]
-;;       (client/without-prepared-statements
-;;        (insert s :users r))
-;;       (is (= r (get-one s :users)))
-;;       (truncate s :users))))
-
-;; (deftest test-raw-cql-insert
-;;   (testing "With default session"
-;;     (client/execute s "INSERT INTO users (name, city, age) VALUES ('Alex', 'Munich', 19);")
-;;     (is (= {:name "Alex" :city "Munich" :age (int 19)}
-;;            (first (client/execute s "SELECT * FROM users;"))))
-;;     (client/execute s "TRUNCATE users;"))
-;;   (testing "Prepared statement"
-;;     (client/execute s
-;;                     (client/bind
-;;                      (client/prepare s "INSERT INTO users (name, city, age) VALUES (?, ?, ?);")
-;;                      ["Alex" "Munich" (int 19)]))
-;;     (is (= {:name "Alex" :city "Munich" :age (int 19)}
-;;            (first (client/execute s "SELECT * FROM users;"))))
-;;     (client/execute s "TRUNCATE users;")))
-
-;; (deftest test-insert-nils
-;;   (let [r {:name "Alex" :city "Munich" :age nil}]
-;;     (client/execute s
-;;                     (client/bind
-;;                      (client/prepare s "INSERT INTO users (name, city, age) VALUES (?, ?, ?);")
-;;                      ["Alex" "Munich" nil]))
-;;     (is (= r (first (select s :users))))))
+(deftest test-raw-cql-insert
+  (testing "With default session"
+    (client/execute *session* "INSERT INTO users (name, city, age) VALUES ('Alex', 'Munich', 19);")
+    (is (= {:name "Alex" :city "Munich" :age (int 19)}
+           (first (client/execute *session* "SELECT * FROM users;"))))
+    (client/execute *session* "TRUNCATE users;"))
+  (testing "Prepared statement"
+    (client/execute *session*
+                    (client/bind
+                     (client/prepare *session* "INSERT INTO users (name, city, age) VALUES (?, ?, ?);")
+                     ["Alex" "Munich" (int 19)]))
+    (is (= {:name "Alex" :city "Munich" :age (int 19)}
+           (first (client/execute *session* "SELECT * FROM users;"))))
+    (client/execute *session* "TRUNCATE users;")))
+
+(deftest test-insert-nils
+  (let [r {:name "Alex" :city "Munich" :age nil}]
+    (client/execute *session*
+                    (client/bind
+                     (client/prepare *session* "INSERT INTO users (name, city, age) VALUES (?, ?, ?);")
+                     ["Alex" "Munich" nil]))
+    (is (= r (first (select *session* :users))))))


missed a change

missed a change

--- test/structural_typing/mechanics/fm_canonical.clj
+++ test/structural_typing/mechanics/fm_canonical.clj
@@ -382,9 +382,9 @@
                (just [:a :b] #{even?})))

     (fact "combining into a type description"
-      (let [result (ppp/dc2:ppps->type-description [ (vector [:a :b] #{even?})
-                                                         (vector [:a :b] #{odd?})
-                                                         (vector [:a] #{pred/required-key})])]
+      (let [result (ppp/->type-description [ (vector [:a :b] #{even?})
+                                             (vector [:a :b] #{odd?})
+                                             (vector [:a] #{pred/required-key})])]
         (get result [:a :b]) => vector?
         (get result [:a :b]) => (just [(exactly even?) (exactly odd?)] :in-any-order)
         (get result [:a]) => vector?


Refresh XboxApi Key

Refresh XboxApi Key

--- src/bltool/data/xboxlive.clj
+++ src/bltool/data/xboxlive.clj
@@ -10,7 +10,7 @@
   ["--xbox-360-platform" "Platform string to use for Xbox 360 games (recommended: 360, Xbox, XBLA, XNA, XbxGoD)" :default "360"]
   ["--xbox-one-platform" "Platform string to use for Xbox One games (recommended: XBO, Xbox, XbxGoD)" :default "XBO"])

-(def xboxapi-key "d22a2a5ed917343a163712dfdf15ef4839b9ea85")
+(def xboxapi-key "527f7671354689326b1856b986c564192cd05df6")

 (defn- xml-to-map
   [tag]


change top-level codec to be a map for readability

--- src/cafebabe/class_codec.clj
+++ src/cafebabe/class_codec.clj
@@ -179,25 +179,14 @@
           (repeated method-info :prefix :uint16))

-(def class-def [class-hdr
-                cp-info
-                (ordered-map
-                  :access-flags :uint16
-                  :this-class :uint16
-                  :super-class :uint16)
-                interfaces
-                fields
-                c-methods
-                attributes])
-
 (defcodec class-codec
-          [class-hdr
-           cp-info
-           (ordered-map
+          (ordered-map
+             :header class-hdr
+             :constant-pool cp-info
              :access-flags :uint16
              :this-class :uint16
-             :super-class :uint16)
-           interfaces
-           fields
-           c-methods
-           attributes])+             :super-class :uint16
+             :interfaces interfaces
+             :fields fields
+             :methods c-methods
+             :attributes attributes))


Fixes persistent toasting for econ assets.

--- src/clj/game/core-events.clj
+++ src/clj/game/core-events.clj
@@ -14,9 +14,10 @@
 (defn unregister-events
   "Removes all event handlers defined for the given card."
   [state side card]
-  (doseq [e (:events (card-def card))]
-    (swap! state update-in [:events (first e)]
-           #(remove (fn [effect] (= (get-in effect [:card :cid]) (:cid card))) %)))
+  (let [cdef (card-def card)]
+    (doseq [e (merge (:events cdef) (:derezzed-events cdef))]
+      (swap! state update-in [:events (first e)]
+             #(remove (fn [effect] (= (get-in effect [:card :cid]) (:cid card))) %))))
   (unregister-suppress state side card))

 (defn trigger-event


background

background

--- src/clj/just_married/css.clj
+++ src/clj/just_married/css.clj
@@ -67,7 +67,8 @@
                       :font-size "4em"
                       :line-height ".1em"
                       :margin-right ".25em"
-                      :vertical-align "-.4em"}]
+                      :vertical-align "-.4em"
+                      :box-shadow "0 0 20px #999c"}]

   ;; various language settings
   [:.language-group {:padding-right "20px"}]
@@ -81,6 +82,7 @@
                 ;; if possible
                 ;; :background-image
                 ;;[(url (format "'%s'" (:bw-cats IMAGES)))]
+                :background (:quote-background COLOR-PALLETTE)
                 :background-repeat "no-repeat"
                 :text-align "center"
                 :font-weight "bold"
@@ -98,5 +100,5 @@
   [:#map {:width "500px"
           :height "500px"
           :padding "15px"
-          :box-shadow "0 0 20px #999"
-          :border-radius "2px"}])
+          :box-shadow "10px 10px 20px #999"
+          :border-radius "10px"}])


publish badge advert

publish badge advert

--- src/clj/salava/core/util.clj
+++ src/clj/salava/core/util.clj
@@ -227,3 +227,7 @@
 (defn event [ctx subject verb object type]
   ;TODO VALIDATE DATA
   (publish ctx :event {:subject subject :verb verb :object object :type type}))
+
+(defn advert [ctx subject verb object type country]
+  (publish ctx :advert {:subject subject :verb verb :object object :type type :country country}))
+


fix nil lang bug

fix nil lang bug

--- src/clj/salava/user/data.clj
+++ src/clj/salava/user/data.clj
@@ -111,17 +111,24 @@
                                               [:paragraph.generic
                                                [:chunk.chunk (str (t :user/UserID ul)": ")] [:chunk (str (:id $user))]"\n"
                                                [:chunk.chunk (str (t :user/Role ul) ": ")] [:chunk (if (= "user" (:role $user)) (t :social/User ul) (t :admin/Admin ul))]"\n"
-                                               [:chunk.chunk (str (t :user/Firstname ul)": ")] [:chunk (capitalize (:first_name $user))]"\n"
-                                               [:chunk.chunk (str (t :user/Lastname ul)": ")][:chunk (capitalize (:last_name $user))]"\n"
+                                               (when-not (blank? (:first_name $user))
+                                                 [:phrase
+                                                  [:chunk.chunk (str (t :user/Firstname ul)": ")] [:chunk (capitalize (:first_name $user))]"\n"])
+                                               (when-not (blank? (:last_name $user))
+                                                 [:phrase
+                                                  [:chunk.chunk (str (t :user/Lastname ul)": ")][:chunk (capitalize (:last_name $user))]"\n"])
                                                (if-not (blank? (:profile_picture $user))
                                                  [:paragraph
                                                   [:chunk.chunk (str (t :user/Profilepicture ul)": ")] [:chunk (str site-url "/" (:profile_picture $user))]"\n"]
                                                  )
-                                               [:chunk.chunk (str (t :user/Language ul)": ")][:chunk (str (upper-case (:language $user)) "  ")]
+                                               (when-not (blank? (:language $user))
+                                                 [:chunk.chunk (str (t :user/Language ul)": ")][:chunk (str (upper-case (:language $user)) "  ")])
                                                [:chunk.chunk (str (t :user/Country ul)": ")][:chunk (str (:country $user))]"\n"
                                                [:chunk.chunk (str (t :user/Activated ul) ": ")][:chunk (str (if (true? (:activated $user)) (t :core/Yes ul) (t :core/No ul)) "  ")]
                                                [:chunk.chunk (str (t :user/Emailnotifications ul) ": ")][:chunk (str (if (true? (:email_notifications $user)) (t :core/Yes ul) (t :core/No ul)) "  ")]
-                                               [:chunk.chunk (str (t :user/Profilevisibility ul) ": ")][:chunk (t (keyword (str "core/"(capitalize (:profile_visibility $user)))) ul)]"\n"
+                                               (when-not (blank? (:profile_visibility $user))
+                                                 [:phrase
+                                                  [:chunk.chunk (str (t :user/Profilevisibility ul) ": ")][:chunk (t (keyword (str "core/"(capitalize (:profile_visibility $user)))) ul)]"\n"])
                                                (when-not (blank? (:about $user))
                                                  [:paragraph
                                                   [:chunk.chunk (str (t :user/Aboutme ul) ":")]"\n"


user not found handling

user not found handling

--- src/clj/swarmpit/handler.clj
+++ src/clj/swarmpit/handler.clj
@@ -114,8 +114,10 @@

 (defmethod dispatch :user [_]
   (fn [{:keys [route-params]}]
-    (->> (api/user (:id route-params))
-         (resp-ok))))
+    (let [user (api/user (:id route-params))]
+      (if (some? user)
+        (resp-ok user)
+        (resp-error 404 "user doesn't exist")))))

 (defmethod dispatch :user-delete [_]
   (fn [{:keys [route-params identity]}]


correct error in glyph-button

correct error in glyph-button

--- src/clj_money/web/shared.clj
+++ src/clj_money/web/shared.clj
@@ -24,7 +24,7 @@
 (defn- glyph-button-css
   [options]
   (cond-> #{"btn"}
-    true (conj (str "btn-" (get options :level "default")))
+    true (conj (str "btn-" (name (get options :level :default))))
     (:size options) (conj (str "btn-"
                                (get glyph-button-sizes (:size options))))))


Send pageview to Google Analytics on page change

--- src/cljs/netrunner/main.cljs
+++ src/cljs/netrunner/main.cljs
@@ -11,6 +11,7 @@
 (defn navigate [token]
   (let [page-number (case token "/" 0 "/play" 1 "/deckbuilder" 2 "/cards" 3 "/news" 4)]
     (.carousel (js/$ ".carousel") page-number))
+  (js/ga "send" "pageview")
   (swap! app-state assoc :active-page [token]))

 (def history (Html5History.))


Edits to questions for consistency & spelling.

--- src/cljs/quiz/questions.cljs
+++ src/cljs/quiz/questions.cljs
@@ -14,23 +14,23 @@
     :answer "How many roads must a man walk down?"}

    {:question "In the beginning of the 1st book, Arthur Dent's house was demolished to make way for what?"
-    :choices ["a subway"
-              "a corporate headquaters"
-              "a pub"
-              "a bypass"]
-    :answer  "a bypass"}
+    :choices ["A subway."
+              "A corporate headquaters."
+              "A pub."
+              "A bypass."]
+    :answer  "A bypass."}

    {:question "In the beginning of the 1st book, planet Earth was demolished to make way for what?"
-    :choices ["a sub-etha casino"
-              "a Galgafrinchian golf course"
-              "a Hyperspace byypass."
-              "a space maze for white mice"]
-    :answer  "a Hyperspace byypass."}
+    :choices ["A sub-etha casino."
+              "A Galgafrinchian golf course."
+              "A Hyperspace byypass."
+              "A space maze for white mice."]
+    :answer  "A Hyperspace byypass."}

    {:question "Yeah, that's *their* cover story - but really?"
     :choices ["To kill Arthur Dent, who was inexplicably woven into the fabric of time and space."
               "To kill Zaphod Beeblebrox, who had a secret locked up inside of his brain."
-              "To kill Fanchurch, who had a secret locked up inside of her brain."
+              "To kill Fenchurch, who had a secret locked up inside of her brain."
               "To stop the *real* question from being discovered on Earth."
               "3 and 4."
               "... demolishing planets is just what Vogons do."]
@@ -50,60 +50,61 @@

    {:question "... and after Ford Prefect spending 15 years stuck on the planet, what does it expand to?"
     :choices ["Deadly but boring"
-              "Beautiful.. kind of"
+              "Beautiful...kind of"
               "Boring but deadly"
               "Mostly harmless"]
     :answer "Mostly harmless"
     }

    {:question "Arthur Dent, when trying to get Heart of Gold's supercomputer to brew him a drink, was invariably getting a cup of hot, brown liquied, which was almost, but not quite, entirely unlike... what?"
-    :choices [ "tea"
-               "coffee"
-               "gin"
-               "milk"]
-    :answer "tea"}
+    :choices [ "Tea"
+               "Coffee"
+               "Gin"
+               "Milk"]
+    :answer "Tea"}

-   {:question "How do you spell \"Magrathea\""
-    :choices ["MA-grathea"
-              "Magr-A-thea"
-              "Magra-THEA"]
-    :answer "Magra-THEA"}
+   {:question "How do you pronounce \"Magrathea\""
+    :choices ["MA-gra-the-a"
+              "Ma-GRA-the-a"
+              "Ma-gra-THE-a"
+              "Ma-gra-the-A"]
+    :answer "Ma-gra-THE-a"}

    {:question "When orbiting the legendary planet of Magrathea, two incoming nuclear missiles were turned by the Improbability Drive of Heart Of Gold spaceship into... what, exactly?"
-    :choices ["a little rubber mallet and a vinyl of Elvis"
-              "a sperm whale and bowl of petunias."
-              "a team of sales executives"
-              "all of the above"]
-    :answer "a sperm whale and bowl of petunias."}
+    :choices ["A little rubber mallet and a vinyl of Elvis."
+              "A sperm whale and bowl of petunias."
+              "A team of sales executives."
+              "All of the above."]
+    :answer "A sperm whale and bowl of petunias."}
    {:question " What's the trick to learning how to fly?"
-    :choices ["really convince yourself you actually can do it"
-              "procuring some antigrav gel"
-              "start falling but manage to miss the ground"
-              "spend an year on top of a pillar on a second planet of Stavromula Beta"]
-    :answer "start falling but manage to miss the ground"}
+    :choices ["Really convince yourself you actually can do it."
+              "Procuring some antigrav gel."
+              "Start falling but manage to miss the ground."
+              "Spend an year on top of a pillar on a second planet of Stavromula Beta."]
+    :answer "Start falling but manage to miss the ground."}
    {:question " Written in thirty-foot high letters of fire on top of the Quentulus Quazgar Mountains in the land of Sevorbeupstry on planet Preliumtarn is God's Final Message to His Creation. What is it?"
-    :choices ["Conditions may apply"
-              "May cause depression and anxiety"
-              "Don't panic"
-              "We apologize for the inconvenience"]
-    :answer "We apologize for the inconvenience"}
+    :choices ["Conditions may apply."
+              "May cause depression and anxiety."
+              "Don't panic!"
+              "We apologize for the inconvenience."]
+    :answer "We apologize for the inconvenience."}
    {:question " Marvin, 'the paranoid android', especially loathed this creation of his native Cirius Cybernetics Corporation."
-    :choices ["robotic tanks"
-              "electronic salesmen"
-              "sentient elevators"
-              "talking doors"]
-    :answer "talking doors"}
+    :choices ["Robotic tanks."
+              "Electronic salesmen."
+              "Sentient elevators."
+              "Talking doors."]
+    :answer "Talking doors."}
    {:question " As a Sandwich Maker of Lamuella, meat of what animal was Arthur Dent using for his sandwiches?"
     :choices ["Perfectly Normal Beast"
               "The Dish Of The Day"
-              "scintillating jeweled scuttling crabs"
-              "none of the above"]
+              "Scintillating Jeweled Scuttling Crabs"
+              "None of the above"]
     :answer "Perfectly Normal Beast"}
    {:question "What was the message dolphins left on Earth, before disappearing?"
-    :choices ["so long, and thanks for all the fish"
-              "it was nice, but now it's gone"
-              "take care, and visit us on Santraginus V"]
-    :answer "it was nice, but now it's gone"}
+    :choices ["So long, and thanks for all the fish."
+              "It was nice, but now it's gone."
+              "Take care, and visit us on Santraginus V."]
+    :answer "It was nice, but now it's gone."}
    {:question "What was the name of the daughter of Arthur Dent and Trillian."
     :choices ["Last Call Amanda"
               "Melody Pond"


cleaning

cleaning

--- src/cljs/tictactoe/core.cljs
+++ src/cljs/tictactoe/core.cljs
@@ -60,12 +60,13 @@
   [board]
   (some #(winning-line? board %) lines))

+(defn is-empty-cell?
+  [board x y]
+  (= (get board [x y]) :cell/empty))
+
 (defn valid-move?
   [board x y]
-  (and
-    (not (game-over? board))
-    (= :cell/empty (get board [x y]))
-    ))
+  (and (is-empty-cell? board x y) (not (game-over? board))))

 (defn on-move
   "Convert the cell to current player, switch player, look at win conditions"


refactor the ai

refactor the ai

--- src/cljs/triboard/ai/ai.cljs
+++ src/cljs/triboard/ai/ai.cljs
@@ -23,14 +23,11 @@
       (move/empty-cell-conversion player point))
     ))

-(defn- worst-immediate-loss ;; TODO - It should consider what the other player could win
-  "Return the next worse lost turn move for 'looser' if 'player' plays"
-  {:pre [(player? player) (player? looser)]}
-  [weights-by-cell turn player looser]
-  (let [all-moves (turn/get-moves-of turn player)]
-    (scores/min-delta-for looser
-      (map #(score-move weights-by-cell player %) all-moves)
-      )))
+(defn- get-worst-possible-score-for
+  [weights-by-cell turn player other-players]
+  (let [all-adverse-moves (mapcat #(turn/get-moves-of turn %) other-players)
+        all-possible-scores (map #(score-move weights-by-cell player %) all-adverse-moves)]
+    (scores/min-delta-for player all-possible-scores)))

 ;; -----------------------------------------
@@ -49,9 +46,9 @@
       (utils/fast-max-key
         (fn [[m converted :as move]]
           (let [new-turn (turn/play-move turn m)
-                new-diff (get (score-move weights-by-cell player move) player)
-                next-diff (map #(worst-immediate-loss weights-by-cell new-turn % player) others)]
-            (+ new-diff (apply min next-diff))))
+                move-diff (get (score-move weights-by-cell player move) player)
+                next-diff (get-worst-possible-score-for weights-by-cell new-turn player others)]
+            (+ move-diff next-diff)))
         (turn/get-moves-of turn player)
         ))
     ))


add some try-catches

add some try-catches

--- src/cljs/uberblick/core.cljs
+++ src/cljs/uberblick/core.cljs
@@ -54,12 +54,16 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; filter macro test
 (defn eval-str [s]
-  (eval (empty-state)
-        s;(read-string s)
-        {:eval       js-eval
-         :source-map true
-         :context    :expr}
-        (fn [result] result)))
+  (try
+    (eval (empty-state)
+          s;(read-string s)
+          {:eval       js-eval
+           :source-map true
+           :context    :expr}
+          (fn [result] result))
+    (catch :default e
+      (println "Error while evaluating string")
+      (prn e))))

 ;; Todo: Add ":my-bla"
 (defn create-filter-fn
@@ -82,8 +86,12 @@
                                       (not (keyword? sym)) sym
                                       (some #{sym} thekeys) `(if (~sym ~my-user) (~sym ~my-user) "")
                                       :else sym))]
-    (->>
-     (read-string expr ,,,)
+    (some->>
+     (try
+       (read-string expr ,,,)
+       (catch :default e
+         (prn "Error while reading string")
+         (prn e)))
      (walk/postwalk replace-where-appropriate ,,,)
      ((fn [new-expr]
         `(fn [~my-user] ~new-expr)) ,,,,)
@@ -98,15 +106,19 @@
 ;; partition the users by 200

 (defn filter-people [people]
-  (let [all-the-people (if-not (empty? @filters)
-                         (let [my-filters (map #(create-filter-fn all-profile-keys %) @filters)]
-                           (filter (apply every-pred my-filters) people))
-                         people)
+  (let [all-the-people (try
+                         (if-not (empty? @filters)
+                           (let [my-filters (map #(create-filter-fn all-profile-keys %) @filters)]
+                             (filter (apply every-pred my-filters) people))
+                           people)
+                         (catch :default e
+                           (println "Error while filtering")
+                           (prn e)))
         nil->Out (fn [by-floors]
                  (into {}
                        (for [[k v] by-floors]
                          [(if (nil? k) "Out" k) v])))]
-    (->> all-the-people
+    (some->> all-the-people
              (group-by :KeyscanStatus)
              (nil->Out)  ; mark the OUT ones for better processing!
              (genome/filter-in?)
@@ -161,10 +173,11 @@
 (defn home-page []
   [:div
    (let [people (filter-people @people-atom)]
-     (if (> (count people) 0)
-       (for [[floor people] people]
-         ^{:key floor} [Floor floor people])
-       [:h2 "No one that fits your filters is in!"]))])
+     (cond
+       (nil? people) [:h2 "There has been an error while applying your filters!"]
+       (= 0 (count people)) [:h2 "No one that fits your filters is in!"]
+       :else (for [[floor people] people]
+               ^{:key floor} [Floor floor people])))])

 (defn About
 "Take the readme, render it to HTML, and set it as the element!"


Add support for cmd.config args

Add support for cmd.config args

--- src/aerobio/server.clj
+++ src/aerobio/server.clj
@@ -186,11 +186,14 @@
              :callback config-tool
              :options {:recursive true}}])))

-(defn get-toolinfo [toolname]
+
+(defn get-toolinfo [toolname eid]
   (assert (@tool-configs toolname)
           (format "No such tool %s" toolname))
-  (merge {:inputOption "" :options "" :args ""}
-         (@tool-configs toolname)))
+  (let [args ((cmn/get-exp-info eid :cmdsargs) toolname {})]
+    (merge {:inputOption "" :options "" :args "" :argcard {}}
+           (@tool-configs toolname)
+           {:args args})))

 ;;; ------------------------------------------------------------------------;;;
@@ -424,6 +427,7 @@
       (send-end-msg ws {:op :validate :payload vmsg})
       (let [{:keys [cmd eid template]} params
             dt (date-time-stg)
+            get-toolinfo #(get-toolinfo % eid)
             resmap (actions/action cmd eid params get-toolinfo template)
             resfut (resmap :fut)
             jobdb-info (or (get-jdb [user eid action]) [])]
@@ -475,6 +479,7 @@
         (send-end-msg ws {:op :validate :payload vmsg})
         (let [{:keys [cmd eid template]} params
               dt (date-time-stg)
+              get-toolinfo #(get-toolinfo % eid)
               resmap (actions/action cmd eid params get-toolinfo template)
               resfut (resmap :fut)
               jobdb-info (or (get-jdb [user eid phase]) [])]
@@ -698,6 +703,7 @@
                   {:ph0 {:name "rnaseq-phase0", :type "tool", :args []},
                    :prn1 {:type "func", :name "prn"}},
                   :edges {:ph0 [:prn1]}}
+        get-toolinfo #(get-toolinfo % eid)
         ph0 template
         cfg (-> (assoc-in ph0 [:nodes :ph0 :args] [eid recipient])
                 (pg/config-pgm-graph-nodes get-toolinfo nil nil)


removed stale ns from refactor

removed stale ns from refactor

--- src/ctia/stores/es/index.clj
+++ src/ctia/stores/es/index.clj
@@ -1,31 +0,0 @@
-(ns ctia.stores.es.index
-  (:require
-   [clojurewerkz.elastisch.native :as n]
-   [clojurewerkz.elastisch.native.index :as idx]
-   [ctia.stores.es.mapping :refer [mappings]]
-   [ctia.properties :refer [properties]]))
-
-(defn read-index-spec []
-  "read es index config properties, returns an option map"
-  (get-in @properties [:ctia :store :es]))
-
-(defn init-conn []
-  "initiate an ES connection returns a map containing transport and
-   the configured index name"
-
-  (let [props (read-index-spec)]
-    {:index (:indexname props)
-     :conn (n/connect [[(:host props) (Integer. (:port props))]]
-                      {"cluster.name" (:clustername props)})}))
-
-(defn delete!
-  "delete an index, abort if non existant"
-  [conn index-name]
-  (when (idx/exists? conn index-name)
-    (idx/delete conn index-name)))
-
-(defn create!
-  "create an index, abort if already exists"
-  [conn index-name]
-  (when-not (idx/exists? conn index-name)
-    (idx/create conn index-name :mappings mappings)))


[#3] Removed comment block.

[#3] Removed comment block.

--- src/gbu/utils.clj
+++ src/gbu/utils.clj
@@ -62,20 +62,3 @@
   (let [re     #"^@@ .*? \+(\d+),.*$"
         [_ number] (re-matches re line)]
     (Integer/parseInt number)))
-
-(comment
- (patch-position "@@ -109,7 +109,7 @@ option_spec_list() ->")
- (def patch (str "@@ -109,7 +109,7 @@ option_spec_list() ->\n     [\n      {help,"
-              " $h, \"help\", undefined, \"Show this help information.\"},\n"
-              "      {config, $c, \"config\", string, Commands},\n-     "
-              "{commands, undefined, \"commands\", undefined, \"Show available"
-              " commands.\"}\n+     {commands, undefined, \"commands\", "
-              "undefined, \"Show available commands.\"} %% Long Line\n    "
-              " ].\n \n -spec process_options([atom()], [string()]) -> ok."
-              "\n@@ -175,3 +175,5 @@ git-hook         Pre-commit Git Hook: "
-              "Gets all staged files and runs the rules\n                  "
-              "                     files.\n \">>,\n    io:put_chars(Commands)."
-              "\n+\n+%% Another dummy change to check how patches are built "
-              "with changes wide apart."))
-  (abs-line->patch-line patch 112)
- )