Made logging optional. It is on by default.

--- src/control/core.clj
+++ src/control/core.clj
@@ -5,6 +5,7 @@
         [clojure.contrib.def :only [defvar- defvar]]))

 (def *enable-color* true)
+(def ^dynamic *enable-logging* true)
 (defvar- bash-reset "\033[0m")
 (defvar- bash-bold "\033[1m")
 (defvar- bash-redbold "\033[1;31m")
@@ -62,7 +63,7 @@
        (join " " content)))

 (defn log-with-tag [host tag & content]
-  (if (not (blank? (join " " content)))
+  (if (and *enable-logging* (not (blank? (join " " content))))
     (println (gen-log host tag content))))

 (defn- not-nil? [obj]
@@ -177,7 +178,8 @@
           user (:user cluster)
           addresses (:addresses cluster)
           clients (:clients cluster)
-          task (taskName @tasks)]
+          task (taskName @tasks)
+          log (:log cluster)]
       (when-exit (nil? task)
         (str "No task named " (name taskName)))
       (when-exit (and (empty? addresses)
@@ -198,11 +200,12 @@
                        bash-reset
                        (if parallel
                          " in parallel")))
-        (dorun (map-fn #(perform % user cluster task taskName args)
-                       addresses))
-        (dorun (map-fn #(perform (:host %) (:user %) cluster task taskName args)
-                       clients))
+        (binding [*enable-logging* (if (nil? log) true log)]
+          (dorun (map-fn #(perform % user cluster task taskName args)
+                                 addresses))
+          (dorun (map-fn #(perform (:host %) (:user %) cluster task taskName args)
+                         clients)))
         (shutdown-agents)))))

 (defn begin []
-  (do-begin *command-line-args*))
+  (do-begin *command-line-args*))


query-tree, mk-query-fn

query-tree, mk-query-fn

--- src/com/billpiel/mem_tracer/query.clj
+++ src/com/billpiel/mem_tracer/query.clj
@@ -9,3 +9,27 @@
   (->> entry
        entry->seq
        (keep #(when (qry-fn %) %))))
+
+(defn query-tree
+  [qry-fn entry]
+  (let [e' (update-in entry [:children]
+                      (partial mapcat
+                               (partial query-tree
+                                        qry-fn)))]
+    (if (qry-fn entry)
+      [e']
+      (:children e'))))
+
+(defn mk-query-fn
+  [path pred]
+  (let [pred' (cond (fn? pred)
+                    pred
+                    (instance? java.util.regex.Pattern pred)
+                    #(->> %
+                          str
+                          (re-matches pred))
+                    :default (partial = pred))]
+    (fn [v]
+      (-> v
+          (get-in path)
+          pred'))))


using assoc-in to swap state

using assoc-in to swap state

--- pp-cljs-client/src-cljs/pp_client/html.cljs
+++ pp-cljs-client/src-cljs/pp_client/html.cljs
@@ -154,21 +154,24 @@
   (sablono/html
     [:div.settings-wrapper-751dc
       [:div.settings-hdr-fa6ca "Settings"]
-      (map
-        (fn [[k v]]
+      (map
+        (fn [[k v]]
           [:div.setting-e0ddb
-            [:input (assoc v :on-change #(swap! (get-in @state [:settings k]) assoc :value (-> % .-target .-value)))]]) settings)]))
+            [:input (assoc v :on-change #(swap! state
+                                                assoc-in [:settings k :value]
+                                                (-> % .-target .-value)))]])
+        settings)]))

 (quiescent/defcomponent FormatAction [new-state]
   (sablono/html
     [:div
-      [:button#formatBtn.btn-2d976
-          {:on-click #(on-btn-click %1)
-           :disabled (if (empty? (:value new-state)) true false)}
+      [:button#formatBtn.btn-2d976
+          {:on-click #(on-btn-click %1)
+           :disabled (if (empty? (:value new-state)) true false)}
             "Format"]
         (when (:error? new-state)
           [:div.error-disp-7c4aa
-            [:i.fa.fa-times-circle.fa-2]
+            [:i.fa.fa-times-circle.fa-2]
             [:span.err-ttl-0867b "Format Error"]
               [:div.msg-6f5ee (:msg new-state)]
               (when (some? (:line new-state))
@@ -191,8 +194,8 @@
     [:div.left-body-ca07e
       [:textarea#mainTextarea.text-f3988
         {:value (:value new-state)
-         :on-change #(swap! state assoc :value (-> % .-target .-value)
-                                        :success? false
+         :on-change #(swap! state assoc :value (-> % .-target .-value)
+                                        :success? false
                                         :error? false)}]]))

 (quiescent/defcomponent Footer []
@@ -208,7 +211,7 @@
             [:div.body-inner-40af1
               [:h2.instructions-b15d3 (str "Paste " (:desc state) ":")]
               (LeftBody state)
-              (RightBody state)
+              (RightBody state)
               [:div.clr-217e3]]]
       (footer)]))

@@ -220,18 +223,18 @@
         [:div.body-inner-5a8ac
           [:h2.instructions-b15d3 "Rationale"]
           [:p.text-block-d714f
-          (str "EDN is a powerful data interchange format commonly used with "
-            "Clojure  and ClojureScript programs. It also doubles as a literal "
-            "representation of most Clojure data structures, which are often "
+          (str "EDN is a powerful data interchange format commonly used with "
+            "Clojure  and ClojureScript programs. It also doubles as a literal "
+            "representation of most Clojure data structures, which are often "
             "printed to a REPL or console environment for debugging purposes. ")]
           [:p.text-block-d714f
-            (str "Clojure core comes with clojure.pprint - which is a library to "
+            (str "Clojure core comes with clojure.pprint - which is a library to "
             "format Clojure code (and thus EDN) in a human-readable fashion. ")]
           [:p.text-block-d714f
-            (str "As of January 2015, there are numerous online services to pretty "
-            "print various data interchange formats (JSON, YAML, XML, etc), "
+            (str "As of January 2015, there are numerous online services to pretty "
+            "print various data interchange formats (JSON, YAML, XML, etc), "
             "but there is no online service for printing an EDN string.")]
-          [:p.text-block-d714f
+          [:p.text-block-d714f
             (str "This project aims to build such a service and improve the "
             "usability of working with EDN data.")]
         [:div.clr-217e3]]]


Updated icon bar examples

Updated icon bar examples

--- src/css-guide/styles/components.cljs
+++ src/css-guide/styles/components.cljs
@@ -1528,19 +1528,13 @@
   (dom/div #js {}
     (dom/nav #js {:className "o-iconbar o-iconbar--shifting is-mobile"}
       (dom/button #js {:className "o-iconbar__item is-active"}
-        (dom/span #js {:className "c-icon"}
-          (dom/svg #js {:xmlns "http://www.w3.org/2000/svg" :width "24" :height "24" :viewBox "0 0 24 24"}
-            (dom/path #js {:d "M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"})))
+        (icons/icon :home)
         (dom/span #js {:className "o-iconbar__label"} "Home"))
       (dom/button #js {:className "o-iconbar__item"}
-        (dom/span #js {:className "c-icon"}
-          (dom/svg #js {:xmlns "http://www.w3.org/2000/svg" :width "24" :height "24" :viewBox "0 0 24 24"}
-            (dom/path #js {:d "M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm2 16H8v-2h8v2zm0-4H8v-2h8v2zm-3-5V3.5L18.5 9H13z"})))
+        (icons/icon :description)
         (dom/span #js {:className "o-iconbar__label"} "Docs"))
       (dom/button #js {:className "o-iconbar__item"}
-        (dom/span #js {:className "c-icon"}
-          (dom/svg #js {:xmlns "http://www.w3.org/2000/svg" :width "24" :height "24" :viewBox "0 0 24 24"}
-            (dom/path #js {:d "M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-7 12h-2v-2h2v2zm0-4h-2V6h2v4z"})))
+        (icons/icon :feedback)
         (dom/span #js {:className "o-iconbar__label"} "Support"))
       (dom/button #js {:className "o-iconbar__item"}
         (dom/span #js {:className "c-icon"}


extract const

extract const

--- src/trackif/core.clj
+++ src/trackif/core.clj
@@ -26,14 +26,17 @@
 (def sendgrid-auth {
                     :api_key (env :sendgrid-key)
                     :api_user (env :sendgrid-user)})
+
+(def orch-api "https://api.orchestrate.io/v0/")
+
 (defn orch
   ([method key data]
-   (let [{:keys [status headers body err] :as resp} (method (str "https://api.orchestrate.io/v0/" key) (merge options {:form-params data}))]
+   (let [{:keys [status headers body err] :as resp} (method (str orch-api key) (merge options {:form-params data}))]
      (if err
        (error "orch request fail with execption" err)
        body)))
   ([method key]
-   (let [{:keys [status headers body err] :as resp} (method (str "https://api.orchestrate.io/v0/" key) options)]
+   (let [{:keys [status headers body err] :as resp} (method (str orch-api key) options)]
      (if err
        (error "orch request fail with execption" err)
        body))))


Tests for new functions

Tests for new functions

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

--- src/conexp/tests/fca/implications.clj
+++ src/conexp/tests/fca/implications.clj
@@ -280,6 +280,25 @@
   (= (stem-base-from-base [(make-implication #{1} #{2 3})
                            (make-implication #{1} #{2 4})])
      #{(make-implication #{1} #{2 3 4})}))
+
+(deftest test-canonical-base-from-clop
+  (are [ctx] (and (= (canonical-base ctx)
+                     (canonical-base-from-clop (attributes ctx) #(adprime ctx %))))
+    contexts/test-ctx-01,
+    contexts/test-ctx-04
+    contexts/test-ctx-07,
+    contexts/test-ctx-08))
+
+(deftest test-intersect-implicational-theories
+  (with-testing-data [ctx [contexts/test-ctx-01
+                           contexts/test-ctx-04
+                           contexts/test-ctx-07
+                           contexts/test-ctx-08]
+                      n   (range 1 (count (objects ctx)))]
+    (= (canonical-base ctx)
+       (apply intersect-implicational-theories (attributes ctx)
+              (map #(canonical-base (make-context % (attributes ctx) (incidence ctx)))
+                   (partition-all n (objects ctx)))))))

 ;;;


Allow routing to make the decision on what route param values are

--- src/web/routing.cljs
+++ src/web/routing.cljs
@@ -37,8 +37,25 @@
                                              :route-params
                                              {:state "UNCOMMITTED"}}})))

-(defn activate-route! [handler params]
-  (let [params' (cond-> params
-                  (contains? params :state)
-                  (update :state str/replace #"/" ":"))]
-    (set-location! @router {:handler handler :route-params params'})))
+(defn current-state-name []
+  (let [app (om/app-root reconciler)]
+    (second (:state (om/get-params app)))))
+
+(defn bind-params [params]
+  (letfn [(bind-param [res [key value]]
+            (assoc res key
+                   (if (symbol? value)
+                     (case value
+                       '?state (current-state-name)
+                       value)
+                     value)))]
+    (reduce bind-param {} params)))
+
+(defn activate-route!
+  ([route]
+   (activate-route! (:handler route) (:route-params route)))
+  ([handler params]
+   (let [params' (cond-> (bind-params params)
+                   (contains? params :state)
+                   (update :state str/replace #"/" ":"))]
+     (set-location! @router {:handler handler :route-params params'}))))


Add factory for clipboard

Add factory for clipboard

--- src/discuss/components/clipboard.cljs
+++ src/discuss/components/clipboard.cljs
@@ -99,3 +99,4 @@
                      [:h5 (t :clipboard :heading)]
                      [:p (t :clipboard :instruction)]
                      (map clipboard-item-next items)])))))
+(def clipboard (nom/factory Clipboard))


CMR-1983: Removed try/catch from migration

--- metadata-db-app/src/migrations/019_setup_tags_table.clj
+++ metadata-db-app/src/migrations/019_setup_tags_table.clj
@@ -49,7 +49,5 @@
   "Migrates the database down from version 19."
   []
   (println "migrations.019-setup-tags-table down...")
-  (try
-    (h/sql "DROP SEQUENCE METADATA_DB.tags_seq")
-    (h/sql "DROP TABLE METADATA_DB.tags")
-    (catch Exception e)))+  (h/sql "DROP SEQUENCE METADATA_DB.tags_seq")
+  (h/sql "DROP TABLE METADATA_DB.tags"))


Fix file response

Fix file response

--- src/export_server/utils/responce.clj
+++ src/export_server/utils/responce.clj
@@ -1,5 +1,6 @@
 (ns export-server.utils.responce
-  (:import (java.io File FileOutputStream))
+  (:import (java.io File FileOutputStream ByteArrayInputStream)
+           (java.util Date))
   (:require [cheshire.core :refer :all])
   (:use ring.util.response
         [ring.util.time :only (format-date)]
@@ -22,10 +23,9 @@
       (header "Access-Control-Allow-Headers" "X-Requested-With")))

 (defn file-success [byte-array file-name file-extention]
-  (let [file  ((partial apply #(File/createTempFile %1 %2) ["anychart-export-tmp" file-extention]))
-        fos (new FileOutputStream file)]
-    (.write fos byte-array)
-    (-> (response file)
+  (let [content-length (count byte-array)
+        date (format-date (Date.))]
+    (-> (response (ByteArrayInputStream. byte-array))
         (status 200)
         (content-type (case file-extention
                         ".svg" "image/svg+xml"
@@ -37,8 +37,8 @@
                         ".xls" "application/vnd.ms-excel"
                         ".xlsx" "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
                         ".jpg" "image/jpeg"))
-        (header "Content-Length" (.length file))
-        (header "Last-Modified" (format-date (last-modified-date file)))
+        (header "Content-Length" content-length)
+        (header "Last-Modified" date)
         (header "Content-Description" "File Transfer")
         (header "Content-Disposition" (str "attachment; filename=\"" file-name file-extention "\""))
         (header "Content-Transfer-Encoding" "binary")


prevent 'para 10' in ES time

prevent 'para 10' in ES time

--- resources/languages/es/rules/time.clj
+++ resources/languages/es/rules/time.clj
@@ -225,11 +225,11 @@
   (dissoc %1 :latent)

   "a las <time-of-day>" ;
-  [#"(?i)(para|al?)( las?)?|las?" {:form :time-of-day}]
+  [#"(?i)(al?)( las?)?|las?" {:form :time-of-day}]
   (dissoc %2 :latent)

   "a las <hour-min>(time-of-day)" ; a las 12:00 horas
-  [#"(?i)((para|al?)( las?)?|las?)" {:form :time-of-day} #"horas?"]
+  [#"(?i)((al?)( las?)?|las?)" {:form :time-of-day} #"horas?"]
   %2

   "hh(:|.|h)mm (time-of-day)"


Fix mongo setup

Fix mongo setup


docstr

docstr

--- src/cljc/commos/delta/compscribe.cljc
+++ src/cljc/commos/delta/compscribe.cljc
@@ -296,6 +296,8 @@
     (pipe watch-ch target)))

 (defn- wrap-on-close
+  "Pipes a channel to target and returns it, on-close is invoked when
+  it is closed."
   [target on-close]
   (doto (chan)
     (wrap-on-close target on-close)))


pprint'ing request maps to console as well as showing in html response

--- ring-devel/src/ring/handler/dump.clj
+++ ring-devel/src/ring/handler/dump.clj
@@ -3,7 +3,8 @@
   (:use (hiccup core page-helpers)
         [clojure.contrib.def :only (defvar-)]
         ring.util.response)
-  (:require (clojure [set :as set])))
+  (:require (clojure [set :as set]))
+  (:require [clojure.pprint :as pprint]))

 (declare css)

@@ -44,6 +45,8 @@
   "Returns a response tuple corresponding to an HTML dump of the request
   req as it was recieved by this app."
   [req]
+  (pprint/pprint req)
+  (println)
   (-> (response (template req))
     (status 200)
     (content-type "text/html")))


latest dependencies

latest dependencies

--- src/leiningen/new/aemette/project.clj
+++ src/leiningen/new/aemette/project.clj
@@ -1,14 +1,14 @@
 (defproject {{name}} "0.1.0-SNAPSHOT"
   :description "FIXME: write this!"
   :url "http://example.com/FIXME"
-  :dependencies [[org.clojure/clojure "1.7.0"]
+  :dependencies [[org.clojure/clojure "1.8.0"]
                  [org.clojure/clojurescript "1.7.228"]
-                 [org.omcljs/om {{#om-legacy}}"0.9.0"{{/om-legacy}}{{^om-legacy}}"1.0.0-alpha28"{{/om-legacy}}]
+                 [org.omcljs/om {{#om-legacy}}"0.9.0"{{/om-legacy}}{{^om-legacy}}"1.0.0-alpha30"{{/om-legacy}}]
                  [org.clojure/core.async "0.2.374"]
                  [secretary "1.2.3"]]

-  :plugins [[lein-cljsbuild "1.1.1"]
-            [lein-figwheel "0.5.0-2"]]
+  :plugins [[lein-cljsbuild "1.1.2"]
+            [lein-figwheel "0.5.0-4"]]

   :source-paths ["src"]
   :clean-targets ^{:protect false} [[:cljsbuild :builds 0 :compiler :output-dir]


Keep some debugging code around in a comment

--- src/fatlip/plot.cljs
+++ src/fatlip/plot.cljs
@@ -270,6 +270,56 @@
      {:succs {} :preds {}}
      (vals blocks))))

+
+(comment
+  (defn take-until
+    "Returns a lazy sequence of successive items from coll until
+   (pred item) returns true, including that item. pred must be
+   free of side-effects."
+    [pred coll]
+    (lazy-seq
+     (when-let [s (seq coll)]
+       (if (pred (first s))
+         (cons (first s) nil)
+         (cons (first s) (take-until pred (rest s)))))))
+
+  (defn rotations
+    "Returns a lazy seq of all rotations of a seq"
+    [x]
+    (if (seq x)
+      (map
+       (fn [n _]
+         (lazy-cat (drop n x) (take n x)))
+       (iterate inc 0) x)
+      (list nil)))
+
+  (defn get-cycles'
+    ([nodes adj]
+     (get-cycles' nodes adj '() #{}))
+    ([nodes adj visited cycles]
+     (reduce
+      (fn [cycles' node]
+        (if (some #{node} visited)
+          (conj cycles' (reverse (take-until #(= % node) visited)))
+          (let [unvisited-adj (set/difference (get adj node) visited)]
+            (get-cycles' (get adj node) adj (cons node visited) cycles'))))
+      cycles
+      nodes)))
+
+  (defn get-cycles
+    [nodes adj]
+    (->> (get-cycles' nodes adj)
+         (map (comp set rotations))
+         (into #{})
+         (map first)))
+
+  (get-cycles' #{:1 :2} {:1 #{:2 :3}
+                         :2 #{:1}
+                         :3 #{:2 :3}})
+  (get-cycles #{:1 :2} {:1 #{:2 :3}
+                        :2 #{:1}
+                        :3 #{:2 :3}})
+)

 (defn FlatGraph->block-info
   "Organizes all of the Nodes and Segments in a FlatGraph into horizontally-


add support for emitting unprefixed attributes

--- src/main/clojure/clojure/data/xml.clj
+++ src/main/clojure/clojure/data/xml.clj
@@ -16,7 +16,7 @@
                              XMLStreamConstants)
            (java.nio.charset Charset)
            (java.io Reader)))
-(set! *warn-on-reflection* true)
+
 ; Represents a parse event.
 ; type is one of :start-element, :end-element, or :characters
 (defrecord Event [type name attrs str])
@@ -29,7 +29,9 @@

 (defn write-attributes [{:keys (attrs)} ^javax.xml.stream.XMLStreamWriter writer]
   (doseq [[k v] attrs]
-    (.writeAttribute writer (str (namespace k)) (name k) (str v))))
+    (if (namespace k)
+      (.writeAttribute writer (str (namespace k)) (name k) (str v))
+      (.writeAttribute writer (name k) (str v)))))

 ; Represents a node of an XML tree
 (defrecord Element [tag attrs content]
@@ -60,7 +62,7 @@
     (.writeCharacters ^javax.xml.stream.XMLStreamWriter writer e)))

 (defn element [tag & [attrs & content]]
-  (Element. tag (or attrs {}) content))
+  (Element. tag (or attrs {}) (remove nil? content)))

 (defn cdata [content]
   (CData. content))
@@ -110,13 +112,13 @@
   objects. See source-seq and parse."
   [events]
   (ffirst
-    (seq-tree
-      (fn [^Event event contents]
-        (when (= :start-element (.type event))
-          (Element. (.name event) (.attrs event) contents)))
-      (fn [^Event event] (= :end-element (.type event)))
-      (fn [^Event event] (.str event))
-      events)))
+   (seq-tree
+    (fn [^Event event contents]
+      (when (= :start-element (.type event))
+        (Element. (.name event) (.attrs event) contents)))
+    (fn [^Event event] (= :end-element (.type event)))
+    (fn [^Event event] (.str event))
+    events)))

 (defprotocol AsElements
   (as-elements [expr] "Return a seq of elements represented by an expression."))
@@ -227,7 +229,7 @@
   (let [fac (doto (javax.xml.stream.XMLInputFactory/newInstance)
               (.setProperty javax.xml.stream.XMLInputFactory/IS_COALESCING true))
         sreader (.createXMLStreamReader fac s)]
-    (pull-seq sreader)))
+    (doall (pull-seq sreader))))

 (defn parse
   "Convenience function. Parses the source, which can be a File,


dissoc comments from lists

dissoc comments from lists

--- src/ontrail/exercise.clj
+++ src/ontrail/exercise.clj
@@ -66,7 +66,8 @@
   ([results]
      (as-ex-result-list (time/now) nc/zero-cache results))
   ([last-visit new-comment-cache results]
-     (map (partial as-ex-result last-visit new-comment-cache) results)))
+     (map (comp (fn [ex] (dissoc ex :comments))
+                (partial as-ex-result last-visit new-comment-cache)) results)))

 (defn decorate-results [viewing-user results]
   (let [last-visit (if (not= viewing-user "nobody")


Add an unregister-<registry name>! function to registries

--- src/main/workflo/macros/registry.clj
+++ src/main/workflo/macros/registry.clj
@@ -24,6 +24,7 @@
    will result in the following functions to be defined:

    (defn register-command! [name def] ...)
+   (defn unregister-command! [name] ...)
    (defn registered-commands [] ...)
    (defn reset-registered-commands! [] ...)
    (defn resolve-command [name] ...)."
@@ -32,6 +33,7 @@
   ([name env]
    (let [registry-sym   (symbol (str "+" name "-registry+"))
          register-sym   (symbol (str "register-" name "!"))
+         unregister-sym (symbol (str "unregister-" name "!"))
          registered-sym (symbol (str "registered-" (plural name)))
          reset-sym      (symbol (str "reset-registered-"
                                      (plural name) "!"))
@@ -41,6 +43,9 @@
         (defn ~register-sym
           [~'name ~'def]
           (swap! ~registry-sym assoc ~'name ~'def))
+        (defn ~unregister-sym
+          [~'name]
+          (swap! ~registry-sym dissoc ~'name))
         (defn ~registered-sym
           []
           (deref ~registry-sym))


update docstring

update docstring

--- src/overtone/sc/info.clj
+++ src/overtone/sc/info.clj
@@ -1,5 +1,6 @@
 (ns
-    ^{:doc "Functions for returning information regarding the connected SC server"}
+    ^{:doc "Functions for returning information regarding the connected SC server"
+      :author "Sam Aaron"}
   overtone.sc.info
   (:use [overtone.libs event]
         [overtone.sc synth gens node server]
@@ -31,7 +32,8 @@
   "Fetches a bunch of useful server info. Has to trigger and poll a synth to
   fetch data. See #'server-num-output-buses, #'server-num-input-buses,
   #'server-num-audio-buses and #'sever-num-buffers for fast cached versions
-  of the static values in this info map."
+  of the static values in this info map. Note, the number of running synths
+  will also include the synth used to obtain this information."
   []
   (when (server-disconnected?)
     (throw (Exception. "Please connect to a server before attempting to ask for server-info.")))


[style, errors] incremental changes meant to improve debugging experience while attempting to get a model to load.

--- keras/src/think/cortex/keras/core.clj
+++ keras/src/think/cortex/keras/core.clj
@@ -75,10 +75,11 @@
         activation (keyword (get config :activation "linear"))
         id (keyword (:name config))
         retval (-> (first (desc/linear output-size))
-                   (assoc :id id))
-        ]
+                   (assoc :id id))]
     (if-not (= activation :linear)
-      [(assoc retval :embedded-activation true) {:type activation :id (keyword (str (:name config) "-activation") :embedded id)}]
+      [(assoc retval :embedded-activation true)
+       {:type activation
+        :id (keyword (str (:name config) "-activation") :embedded id)}]
       [retval])))

 (defn model->simple-description
@@ -102,7 +103,11 @@
     ;;TODO models with a single channel input and figure out planar vs. interleaved
     (vec
      (flatten (concat (desc/input width height n-channels)
-                      (mapv model-item->desc model-vector))))))
+                      (try
+                        (mapv model-item->desc model-vector)
+                        (catch Exception e
+                          (do (println "caught exception: " (.getMessage ^Exception e)
+                                        "processing: " model-vector)))))))))

 (defn hdf5-child-map
   [node]


Add boolean transformations for clj->vim

--- src/main/clojure/vimclojure/util.clj
+++ src/main/clojure/vimclojure/util.clj
@@ -196,6 +196,10 @@
   [thing]
   (str-wrap thing \"))

+(defmethod clj->vim Boolean
+  [thing]
+  (if thing "1" "0"))
+
 (derive clojure.lang.ISeq              ::ToVimList)
 (derive clojure.lang.IPersistentSet    ::ToVimList)
 (derive clojure.lang.IPersistentVector ::ToVimList)


deleted word-array stuff

deleted word-array stuff

--- src/hangman/core.clj
+++ src/hangman/core.clj
@@ -34,13 +34,6 @@
   of all words of that length.  Keys are absent if no words of that length are present."
   [word-list]
   (group-by count word-list) )
-
-(defn to-word-array
-  "Returns all words of the specified length as a 2D array (vector of vectors).
-  First index selects a given word, 2nd index selects chars from that word."
-  [word-list]
-  (vec
-    (map vec word-list) ))

 (defn num-cols
   "Given a list of words (seq of seqs), return the number of columns (2nd dimension)."
@@ -212,13 +205,10 @@
     curr-len            4
     curr-words          (words-map curr-len)
       _ (assert (= curr-words     ["abcd" "xbcd" "xxcd" "xxxd"]  ))
-    word-array          (to-word-array  curr-words)
-      _ (assert (= word-array
-                   [[\a \b \c \d] [\x \b \c \d] [\x \x \c \d] [\x \x \x \d]] ))

     tgt-word            [ \x  \b  \c  \d  ]
     clue                [ nil \b  nil nil ]
-    keep-flag           (map #(guess-matches? % clue ) word-array )
+    keep-flag           (map #(guess-matches? % clue ) curr-words )
       _ (assert (= keep-flag [true true false false]))
     keep-words          (filter-with keep-flag curr-words)
       _ (assert (= keep-words ["abcd" "xbcd"] ))
@@ -239,9 +229,9 @@
   [curr-words clue guessed-chars]
   (let [keep-chars      (for [clue-char clue :when (not(nil? clue-char))] clue-char)
         fail-chars      (set/difference guessed-chars keep-chars)
-        keep-flag       (map #(guess-matches? % clue ) word-array )
-        fail-flag       (map #(guess-matches? % clue ) word-array )
-    keep-words      (filter-with keep-flag word-array) ] )
+        keep-flag       (map #(guess-matches? % clue ) curr-words )
+        fail-flag       (map #(guess-matches? % clue ) curr-words )
+    keep-words      (filter-with keep-flag curr-words) ] )
 )
 )

@@ -255,19 +245,18 @@
     (def words-map        (to-words-by-length word-seq) )
     (def curr-len         (count tgt-word) )
     (def curr-words       (words-map curr-len) )
-    (def word-array       (to-word-array  curr-words) )
     (def max-word-len     (apply max (keys words-map)) )

     (println)
     (println "************************************************************")
-    (println "word-array" (take 20 (map str/join word-array)) )
+    (println "curr-words" (take 20 (map str/join curr-words)) )
     (loop [ guessed-chars  #{}
             clue           (make-clue tgt-word guessed-chars)
           ]
       (println )
       (let [
-        keep-flag       (map #(guess-matches? % clue ) word-array )
-        keep-words      (filter-with keep-flag word-array) ]
+        keep-flag       (map #(guess-matches? % clue) curr-words )
+        keep-words      (filter-with keep-flag curr-words) ]
           (println "clue: " (format-clue clue)
                     "  keep-words(" (count keep-words) "):"
                     (take 10 (map str/join keep-words)) "..." )


Added match-guess? function

Added match-guess? function

--- src/hangman/core.clj
+++ src/hangman/core.clj
@@ -93,7 +93,8 @@
   [pred-seq data-seq]
   (let [ both-seq     (map vector pred-seq data-seq )
          filt-seq     (filter #(% 0) both-seq)
-         result       (vec (map second filt-seq)) ]
+         filt-data    (map second filt-seq)
+         result       (vec filt-data) ]
     result
   ) )

@@ -111,9 +112,32 @@
     result
   ) )

+(defn match-guess?
+  "Returns true if a guess matches the target word. The target word is a vector of
+  characters.  The guess value is a vector of the same length with elements that are
+  either a character or nil, where nil indicates a wildcard that matches any character in
+  the target word."
+  [tgt-word guess]
+  { :pre  [ (= (count tgt-word) (count guess)) ]
+    :post [] }
+  (let [ pair-seq   (map vector guess tgt-word)
+         result     (every? #(or (=    (first %) (second %))
+                                 (nil? (first %)) )
+                      pair-seq) ]
+    result
+  )
+)
+
 (defn run-tests []
   (println "----------------------------------------")
   (println "Tests:")
+
+  ; Match guesses
+  (println "match guesses" )
+  (assert (match-guess? "abcd" "abcd") )
+  (assert (match-guess? "abcd" [\a \b \c \d]) )
+  (assert (match-guess? "abcd" [nil nil nil nil]) )
+  (assert (match-guess? "abcd" [\a nil nil nil]) )

   ; Filtering one sequence with another
   (let [
@@ -156,22 +180,24 @@
         words-map (words-by-length tst-words)
         curr-len  4
         curr-words  (words-map curr-len)
+          _ (println "curr-words:" curr-words)
         word-array  (to-word-array  curr-words)
         col-char-freqs (freqs-by-col word-array)
         all-char-freqs (apply merge-with + col-char-freqs)
         most-pair (reduce #(if (< (second %1) (second %2) )  %2 %1 )
                     (seq all-char-freqs) )
+          _ (println "most-pair:" most-pair)
         max-freq-val (first most-pair)
+          _ (println "max-freq-val" max-freq-val)
         wordVec    [\x \x \c \d]
-        guessVec   [nil nil nil nil]
+        guessVec   [nil \b nil nil]
         keepFlg    (map #(nil? %) guessVec )
           _ (println "keepFlg" keepFlg)
         keepFreqs  (filter-with keepFlg col-char-freqs)
           _ (println "keepFreqs" keepFreqs)
+        keepWords  (filter-with keepFlg curr-words)
+          _ (println "keepWords" keepWords)
        ]
-    (println "curr-words:" curr-words)
-    (println "most-pair:" most-pair)
-    (println "max-freq-val" max-freq-val)
     (assert (= words-map   {4 ["abcd" "xbcd" "xxcd" "xxxd"]} ))
     (assert (= curr-words     ["abcd" "xbcd" "xxcd" "xxxd"]  ))
     (assert (= col-char-freqs [{\a 1, \x 3} {\b 2, \x 2} {\c 3, \x 1} {\d 4}] ))


bugfix direction of dct:creator rel

bugfix direction of dct:creator rel

--- src/imago/config.clj
+++ src/imago/config.clj
@@ -47,7 +47,6 @@
        (:nick foaf) "admin"
        (:name foaf) "Imago Admin"
        (:password foaf) (utils/sha-256 "admin" "imago" salt)
-       (:creator dct) coll
        (:hasRole imago) (:AdminRole imago)}}
      [(:AdminRole imago) "dct:accessRights"
       ["view-any" "edit-any" "create-coll" "upload" "maintenance"]]
@@ -58,6 +57,7 @@
      {coll
       {(:type rdf) (:MediaCollection imago)
        (:title dct) "Untitled collection"
+       (:creator dct) admin
        (:usesPreset imago) (map :id (vals presets))}}
      (reduce-kv
       (fn [acc k {:keys [id width height crop filter mime]}]
@@ -110,7 +110,7 @@
       {:select '[?id ?title]
        :query [{:where [['?u (:type rdf) (:User imago)]
                         ['?u (:nick foaf) user]
-                        ['?u (:creator dct) '?id]
+                        ['?id (:creator dct) '?u]
                         ['?id (:type rdf) (:MediaCollection imago)]
                         ['?id (:title dct) '?title]]}]})
     :get-collection


whoops, fix clojure syntax

whoops, fix clojure syntax

--- core/src/gorillalabs/tesla.clj
+++ core/src/gorillalabs/tesla.clj
@@ -48,7 +48,7 @@
     (log/info "<- Stopping system.")
     (mnt/stop))

-  (defn start [custom-components & more]
+  (defn start [custom-components & [more]]
     (log/info "-> Starting system")
     (apply mnt/start-with-args (or more {}) (concat (vals default-components) (vals custom-components)))
     (doseq [sig ["INT" "TERM"]]


always stop system before starting

always stop system before starting

--- src/polismath/runner.clj
+++ src/polismath/runner.clj
@@ -34,6 +34,8 @@

 (defn run!
   ([system-map-generator config-overrides]
+   ;; Make sure if we already have a system that it has been stopped
+   (when system (stop!))
    (init! system-map-generator config-overrides)
    (start!))
   ([system-map-generator]


Added ability for the current selection of a dropdown list to have a title attribute so that it can be shown on mouse over.

--- src/re_com/dropdown.cljs
+++ src/re_com/dropdown.cljs
@@ -160,8 +160,11 @@
   []
   (let [ignore-click (atom false)]
     (fn
-      [internal-model choices id-fn label-fn tab-index placeholder dropdown-click key-handler filter-box? drop-showing?]
-      (let [_ (reagent/set-state (reagent/current-component) {:filter-box? filter-box?})]
+      [internal-model choices id-fn label-fn tab-index placeholder dropdown-click key-handler filter-box? drop-showing? title?]
+      (let [_    (reagent/set-state (reagent/current-component) {:filter-box? filter-box?})
+            text (if @internal-model
+                   (label-fn (item-for-id @internal-model choices :id-fn id-fn))
+                   placeholder)]
         [:a.chosen-single.chosen-default
          {:href          "javascript:"   ;; Required to make this anchor appear in the tab order
           :tab-index     (when tab-index tab-index)
@@ -176,12 +179,10 @@
                            (key-handler event)
                            (when (= (.-which event) 13)  ;; Pressing enter on an anchor also triggers click event, which we don't want
                              (reset! ignore-click true)))  ;; TODO: Hmmm, have a look at calling preventDefault (and stopProp?) and removing the ignore-click stuff
-
           }
-         [:span
-          (if @internal-model
-            (label-fn (item-for-id @internal-model choices :id-fn id-fn))
-            placeholder)]
+         [:span (when title?
+                  {:title text})
+          text]
          [:div [:b]]])))) ;; This odd bit of markup produces the visual arrow on the right

@@ -200,6 +201,7 @@
    {:name :filter-box?   :required false :default false   :type "boolean"                                                      :description "if true, a filter text field is placed at the top of the dropdown"}
    {:name :regex-filter? :required false :default false   :type "boolean | atom"                                               :description "if true, the filter text field will support JavaScript regular expressions. If false, just plain text"}
    {:name :placeholder   :required false                  :type "string"                        :validate-fn string?           :description "background text when no selection"}
+   {:name :title?        :required false :default false   :type "boolean"                                                      :description "if true, it displays the title for the selected dropdown"}
    {:name :width         :required false :default "100%"  :type "string"                        :validate-fn string?           :description "the CSS width. e.g.: \"500px\" or \"20em\""}
    {:name :max-height    :required false :default "240px" :type "string"                        :validate-fn string?           :description "the maximum height of the dropdown part"}
    {:name :tab-index     :required false                  :type "integer | string"              :validate-fn number-or-string? :description "component's tabindex. A value of -1 removes from order"}
@@ -219,7 +221,7 @@
         internal-model (reagent/atom @external-model)         ;; Create a new atom from the model to be used internally
         drop-showing?  (reagent/atom false)
         filter-text    (reagent/atom "")]
-    (fn [& {:keys [choices model on-change disabled? filter-box? regex-filter? placeholder width max-height tab-index id-fn label-fn group-fn class style attr]
+    (fn [& {:keys [choices model on-change disabled? filter-box? regex-filter? placeholder width max-height tab-index id-fn label-fn group-fn class style attr title?]
             :or {id-fn :id label-fn :label group-fn :group}
             :as args}]
       {:pre [(validate-args-macro single-dropdown-args-desc args "single-dropdown")]}
@@ -297,7 +299,7 @@
                           {:width (when width width)}
                           style)}
            attr)          ;; Prevent user text selection
-         [dropdown-top internal-model choices id-fn label-fn tab-index placeholder dropdown-click key-handler filter-box? drop-showing?]
+         [dropdown-top internal-model choices id-fn label-fn tab-index placeholder dropdown-click key-handler filter-box? drop-showing? title?]
          (when (and @drop-showing? (not disabled?))
            [:div.chosen-drop
             [filter-text-box filter-box? filter-text key-handler drop-showing?]


reconnecting on broken pipes

reconnecting on broken pipes

--- src/kvm/provider.clj
+++ src/kvm/provider.clj
@@ -11,6 +11,7 @@

 (ns kvm.provider
   (:require
+    [safely.core :refer [safely]]
     [kvm.validations :refer (provider-validation)]
     [clojure.core.strint :refer (<<)]
     [kvm.clone :refer (clone-domain)]
@@ -29,10 +30,17 @@
 (timbre/refer-timbre)

 (defn connection [{:keys [host user port]}]
-  (connect (<< "qemu+ssh://~{user}@~{host}:~{port}/system")))
+    (safely
+       (connect (<< "qemu+ssh://~{user}@~{host}:~{port}/system"))
+       :on-error
+       :log-errors false
+       :max-retry 5
+       :message "Error while trying to connect to libvirt"
+       :retry-delay [:random-range :min 200 :max 500]))

 (defmacro with-connection [& body]
-  `(let [~'connection (connection ~'node)] (do ~@body)))
+  `(let [~'connection (connection ~'node)]
+      (do ~@body)))

 (defn wait-for-status [instance req-stat timeout]
   "Waiting for ec2 machine status timeout is in mili"


ADD: Started implementing path matching 2

git-svn-id: 4b252968ef0138b651a603913063d82495110737@394 5a6aabce-a326-4528-a5e9-8409bbc25adf

--- src/ru/nsu/ccfit/12222/seon/path.clj
+++ src/ru/nsu/ccfit/12222/seon/path.clj
@@ -5,26 +5,25 @@
   [expr mas]
   (if (nil? mas)
     (list expr)
-    (if (seon-map? expr)
-      (if (= "*" (first mas)) ; (first mas) == "*"
-        (map
-          (fn [subExp] (function subExp (next mas)))
-          (vals expr))
-                              ; (first mas) != *
-        (if (= ".." (first mas))
-          (concat
-            (function expr (next mas))
-            (reduce concat (map (fn [subExp]
-                                  (function subExp mas))
-                                (vals expr)))
-            )
-          (function ((keyword (first mas)) expr) (next mas)))
-        )
+    (cond (seon-map? expr)
+          (cond (= "*" (first mas))
+                (map
+                  (fn [subExp] (function subExp (next mas)))
+                  (vals expr))

-      ;else
-      (list expr)
+                (= ".." (first mas))
+                (concat
+                  (function expr (next mas))
+                  (reduce concat (map (fn [subExp]
+                                        (function subExp mas))
+                                      (vals expr)))
+                  )

-      ))
+
+                :else
+                (function ((keyword (first mas)) expr) (next mas)))
+          :else (list expr)
+          ))

   )

@@ -32,7 +31,7 @@
 (defn parser
   [expr string]
   {:pre [(seon? expr)]}
-  (function expr (re-seq #"[\w+]|[/.]{2}" string))
+  (function expr (re-seq #"\w+|[.]{2}|(?<=\[)[0-9]+(?=\])" string))

   )


Fix locale dependent specs

Fix locale dependent specs

To avoid the following:

  1) Progress Reporter reports passing run results
     Expected: "Finished in 0.12300 seconds"
          got: "Finished in 0,12300 seconds" (using =)

--- spec/speclj/report/progress_spec.clj
+++ spec/speclj/report/progress_spec.clj
@@ -1,7 +1,7 @@
 (ns speclj.report.progress-spec
   (:require ;cljs-macros
             [speclj.core :refer [around before context describe it should should= with]]
-            [speclj.platform :refer [new-exception new-failure new-pending]])
+            [speclj.platform :refer [format-seconds new-exception new-failure new-pending]])
   (:require [clojure.string :as str]
             [speclj.components :refer [new-description new-characteristic install]]
             [speclj.config :refer [*color?* *full-stack-trace?*]]
@@ -66,7 +66,7 @@
         (should= 4 (count lines))
         (should= "" (nth lines 0))
         (should= "" (nth lines 1))
-        (should= "Finished in 0.12300 seconds" (nth lines 2))
+        (should= (format "Finished in %s seconds" (format-seconds 0.123)) (nth lines 2))
         (should= (green "3 examples, 0 failures") (nth lines 3)))))

   (it "reports failing run results"
@@ -96,7 +96,7 @@
         (should= (red "     Expected dives") (nth lines 13))
         ;      (should= "/Users/micahmartin/Projects/clojure/speclj/spec/speclj/report/progress_spec.clj:56" (nth lines 14))
         (should= "" (nth lines 15))
-        (should= "Finished in 0.32100 seconds" (nth lines 16))
+        (should= (format "Finished in %s seconds" (format-seconds 0.321)) (nth lines 16))
         (should= (red "3 examples, 3 failures") (nth lines 17)))))

   (it "reports pending run results"


jme3 tutorial 2

jme3 tutorial 2

http://jmonkeyengine.org/wiki/doku.php/jme3:beginner:hello_node

--- src/maqueta/core.clj
+++ src/maqueta/core.clj
@@ -4,18 +4,29 @@
            (com.jme3.scene Geometry)
            (com.jme3.scene.shape Box)
            (com.jme3.math Vector3f)
-           (com.jme3.math ColorRGBA))
+           (com.jme3.math ColorRGBA)
+           (com.jme3.scene Node))
   (:gen-class))

 (def app (proxy [SimpleApplication] []
            (simpleInitApp []
-             (let [b (Box. Vector3f/ZERO 1 1 1)
-                   geom (Geometry. "Box" b)
-                   mat (Material. (.getAssetManager this)
-                                  "Common/MatDefs/Misc/Unshaded.j3md")]
-               (.setColor mat "Color" ColorRGBA/Blue)
-               (.setMaterial geom mat)
-               (.attachChild (.getRootNode this) geom)))))
+             (let [box1 (Box. (Vector3f. 1 -1 1) 1 1 1)
+                   blue (Geometry. "Box" box1)
+                   mat1 (Material. (.getAssetManager this)
+                                   "Common/MatDefs/Misc/Unshaded.j3md")
+                   box2 (Box. (Vector3f. 1 3 1) 1 1 1)
+                   red (Geometry. "Box" box2)
+                   mat2 (Material. (.getAssetManager this)
+                                   "Common/MatDefs/Misc/Unshaded.j3md")
+                   pivot (Node. "pivot")]
+               (.setColor mat1 "Color" ColorRGBA/Blue)
+               (.setMaterial blue mat1)
+               (.setColor mat2 "Color" ColorRGBA/Red)
+               (.setMaterial red mat2)
+               (.attachChild (.getRootNode this) pivot)
+               (.attachChild pivot blue)
+               (.attachChild pivot red)
+               (.rotate pivot 0.4 0.4 0)))))

 (defn -main [& args]
   (.start app))


Default to all builds

Default to all builds

--- src-cljs/frontend/state.cljs
+++ src-cljs/frontend/state.cljs
@@ -24,7 +24,8 @@
                              :selected-org {:login nil
                                             :type :org}
                              :show-forks true}
-              :browser-settings {:expanded-repos #{}}}
+              :browser-settings {:expanded-repos #{}
+                                 :show-all-builds true}}
    :selected-home-technology-tab nil
    :modal-video-id nil
    :builds-per-page 30


improve documentation for `split-map-values-at`

--- src-cljs/frontend/utils.cljs
+++ src-cljs/frontend/utils.cljs
@@ -337,11 +337,14 @@
 (def unexterned-prop aget)

 (defn split-map-values-at
-  "Assume M is {k -> xs, ...} split into two maps.
-
-  One containing first TOP-MAX values of xs, the other containing the rest.
-
-  This only makes sense for sorted maps."
+  "This is similar to `split-at`, but for maps.
+
+M is a map of arrays : {k -> [xs], j -> [ys] , ...}.
+
+Return [TOP-MAP BOTTOM-MAP]
+
+M is split into top and bottom maps, fitting a max of TOP-MAX keys/values (i.e. `(take top-max (concat xs ys ...))` into the
+top.  The remaining keys/values goes into the bottom."
   [m top-max]
   (loop [top-map (sorted-map)
          bottom-map (sorted-map)


Add TODO: fixup `batch-get-item` API for DynamoDB API v2

--- src/taoensso/faraday.clj
+++ src/taoensso/faraday.clj
@@ -229,7 +229,14 @@
 (defn- keys-and-attrs "Returns a new KeysAndAttributes object."
   [{:keys [key vals attrs consistent?] :as request}]
   (doto (KeysAndAttributes.)
+
+    ;; TODO Our batch-get-item API is problematic, it doesn't support v2-style
+    ;; primary keys.
+    ;;
+    ;; prim-key => {<hash-key> <val> <range-key> <val>}
+    ;; (.setKey (clj-item->db-item prim-key))
     (.setKeys (for [v vals] {(name key) (clj-val->db-val v)}))
+
     (.setAttributesToGet (when attrs (mapv name attrs)))
     (.setConsistentRead  consistent?)))

@@ -436,7 +443,7 @@
   Limits apply, Ref. http://goo.gl/Bj9TC.

   (batch-get-item creds
-    {:users {:key  :names
+    {:users {:key  :names ; TODO What about range-keys?
              :vals [\"alice\" \"bob\"]}
      :posts {:key   :id
              :vals  [1 2 3]


finish adding database-ignore-ssl option

--- src/polismath/components/postgres.clj
+++ src/polismath/components/postgres.clj
@@ -57,7 +57,7 @@
     (log/info ">> Starting Postgres component")
     (let [database-url (-> config :database :url)]
       (assert database-url "Missing database url. Make sure to set env variables.")
-      (assoc component :db-spec (heroku-db-spec database-url))))
+      (assoc component :db-spec (heroku-db-spec database-url (-> config :database :ignore-ssl)))))
   (stop [component]
     (log/info "<< Stopping Postgres component")
     (assoc component :db-spec nil)))


Properly persist as int the grid axis on workspace settings lightbox.

--- src/uxbox/ui/workspace/settings.cljs
+++ src/uxbox/ui/workspace/settings.cljs
@@ -16,7 +16,8 @@
             [uxbox.ui.lightbox :as lightbox]
             [uxbox.ui.colorpicker :as uucp]
             [uxbox.ui.workspace.base :as wb]
-            [uxbox.util.dom :as dom]))
+            [uxbox.util.dom :as dom]
+            [uxbox.util.data :refer (parse-int)]))

 ;; --- Lentes

@@ -33,7 +34,8 @@
         opts (merge (:options page)
                     (deref local))]
     (letfn [(on-field-change [field event]
-              (let [value (dom/event->value event)]
+              (let [value (dom/event->value event)
+                    value (parse-int value)]
                 (swap! local assoc field value)))
             (on-color-change [color]
               (swap! local assoc :grid/color color))
@@ -42,6 +44,7 @@
                                  (dom/checked?))]
                 (swap! local assoc :grid/align checked?)))
             (on-submit [event]
+              (dom/prevent-default event)
               (let [page (assoc page :options opts)]
                 (rs/emit! (udp/update-page-metadata page))
                 (lightbox/close!)))]
@@ -52,14 +55,15 @@
          [:input#grid-x.input-text
           {:placeholder "X px"
            :type "number"
-           :value (:grid/x-axis opts "2")
+           ;; TODO: put here the default from constants
+           :value (:grid/x-axis opts "10")
            :on-change (partial on-field-change :grid/x-axis)
            :min 1 ;;TODO check this value
            :max 100}]
          [:input#grid-y.input-text
           {:placeholder "Y px"
            :type "number"
-           :value (:grid/y-axis opts "2")
+           :value (:grid/y-axis opts "10")
            :on-change (partial on-field-change :grid/y-axis)
            :min 1
            :max 100}]]


Indent

Indent

--- src/videotest/coral/motion_seeds.clj
+++ src/videotest/coral/motion_seeds.clj
@@ -60,8 +60,8 @@
                              (assoc-in [:y] y))))))]
     (assoc-in state [:motion-seeds]
               (reduce reduce-seed
-               []
-               motion-seeds))))
+                      []
+                      motion-seeds))))

 (defn update-motion-seeds [bin-size display-w display-h state]
   (->> state


Fixed args for moving average usage in clean-probs

--- src/clj/forma/postprocess/output.clj
+++ src/clj/forma/postprocess/output.clj
@@ -64,8 +64,7 @@
   integer 0->100"
   [coll]
   (let [window 3]
-    [(vec (-> coll
-              (backward-looking-mavg window)
+    [(vec (-> (backward-looking-mavg window coll)
               (mono-inc)
               (dec->int100)))]))


remove old codes

remove old codes

--- src/clj/neb/durability/serv/core.clj
+++ src/clj/neb/durability/serv/core.clj
@@ -9,7 +9,8 @@
            (java.util UUID)
            (java.util.concurrent.locks ReentrantLock)
            (java.io OutputStream File DataOutputStream)
-           (org.apache.commons.io FileUtils)))
+           (org.apache.commons.io FileUtils)
+           (org.shisoft.neb Trunk)))

 (def start-time (System/currentTimeMillis))
 (def data-path (atom nil))
@@ -33,8 +34,7 @@
   (reset! defed-path path)
   (reset! data-path (str path "/" start-time "/"))
   (when keep-imported? (remove-imported @data-path))
-  (println "Starting backup server at:" @data-path)
-  #_(a/go-loop [] (apply collect-log (a/<! pending-logs))))
+  (println "Starting backup server at:" @data-path))

 (defn convert-server-name-for-file [^String str] (.replace str ":" "-"))

@@ -54,11 +54,8 @@
         replica-accessors (vec (map (fn [n] (let [file-path (str base-path n ".dat")
                                                   file-ins (File. file-path)]
                                               (when-not (.exists file-ins) (.createNewFile file-ins))
-                                              (BufferedRandomAccessFile. file-path "rw")))
+                                              (BufferedRandomAccessFile. file-path "rw" (Trunk/getSegSize))))
                                      (range trunks)))
-        ;log-appenders (vec (map (fn [n] (atom (io/output-stream
-        ;                                        (str base-path n "-" timestamp ".mlog"))))
-        ;                         (range trunks)))
         sync-timestamps (vec (map (fn [_] (atom 0)) (range trunks)))
         log-switches (vec (map (fn [_] (ReentrantLock.)) (range trunks)))
         pending-chan (a/chan 500)
@@ -99,38 +96,7 @@
 (defn finish-trunk-sync [sid trunk-id tail-loc timestamp]
   (let [client (get @clients sid)]
     (a/>!! (:pending-chan client) [1 trunk-id tail-loc]))
-  (reset! (get-in (get @clients sid) [:sync-time trunk-id]) timestamp)
-  #_(switch-log sid trunk-id timestamp))
-
-(defn ^:deprecated  append-log [sid trunk-id act timestamp ^UUID cell-id & [data]]
-  (let [client (get @clients sid)
-        ^OutputStream appender @(get-in client [:appenders trunk-id])
-        act (get {:write 0
-                  :delete 1} act)]
-    (a/>!! pending-logs [appender act timestamp ^UUID cell-id data])))
-
-(defn ^:deprecated  switch-log [sid trunk-id timestamp]
-  (let [client (get @clients sid)
-        log-switch (get-in client [:log-switches trunk-id])
-        base-path (:base-path client)]
-    (.lock log-switch)
-    (try
-      (let [^OutputStream appender @(get-in client [:appenders trunk-id])
-            ^OutputStream new-appender (io/output-stream (str base-path trunk-id "-" timestamp ".mlog"))]
-        (reset! (get-in client [:appenders trunk-id]) new-appender)
-        ;close orignal appender
-        (a/>!! pending-logs [appender -10 timestamp nil]))
-      (finally
-        (.unlock log-switch)))))
-
-(defn ^:deprecated  close-appender [appender]
-  (.flush appender)
-  (.close appender))
-
-(defn ^:deprecated  collect-log [^OutputStream appender act timestamp ^UUID cell-id & [data]]
-  (if (= -10 act)
-    (close-appender appender)
-    (l/append appender act timestamp cell-id data)))
+  (reset! (get-in (get @clients sid) [:sync-time trunk-id]) timestamp))

 (defn list-recover-dir []
   (let [path-file (File. ^String @defed-path)


Refactor - create `timetable-row-get-lessons-satisfying-pred`

And refactor the `find-replacement-lessons-within-time` function to use
more refactored functions.

Signed-off-by: Pang Yan Han <22594c345857f664c61cd411f607c4d40a9d4af9@gmail.com>

--- src/cljs/cljs_nusmods/timetable.cljs
+++ src/cljs/cljs_nusmods/timetable.cljs
@@ -612,6 +612,17 @@
   [day rowNum]
   (not (timetable-row-empty? day rowNum)))

+(defn- timetable-row-get-lessons-satisfying-pred
+  "Returns a sequence of vectors of `TimetableLessonInfo` object and the
+   jQuery <div> element associated with that lesson.
+   The `TimetableLessonInfo` objects must satisfy a criteria given by the
+   `predFn` predicate."
+  [day rowNum predFn]
+  (let [ttRow (timetable-get-day-row day rowNum)]
+    (filter (fn [[ttLessonInfo _]]
+              (predFn ttLessonInfo))
+            ttRow)))
+
 (defn- create-lesson-div
   "Creates a <div> element for a new lesson using jQuery"
   [& {:keys [moduleCode moduleName lessonType lessonGroup venue slotsOcc
@@ -1167,9 +1178,7 @@
    `:day` and `:rowNum` keys, and values are jQuery <div> objects for the
    shifted lesson."
   [{:keys [day rowNum startTime endTime] :as removedAugTTLessonInfo}]
-  (let [ttDay (timetable-get-day day)
-
-        ; This is the time range freed up by removal of the lesson
+  (let [; This is the time range freed up by removal of the lesson
         [lowTimeIdx highTimeIdx]
         (get-largest-consecutive-time-slot-freed-up-by-lesson
           removedAugTTLessonInfo)
@@ -1185,8 +1194,8 @@
     (.log js/console (str "lowTimeIdx = " lowTimeIdx ", highTimeIdx = " highTimeIdx))
     (:augTTLessonInfoMapToShift
       (reduce
-        (fn [reduceResult [rowIdx ttRow]]
-          (if (empty? ttRow)
+        (fn [reduceResult rowIdx]
+          (if (timetable-row-empty? day rowIdx)
               ; Skip empty row
               reduceResult

@@ -1194,14 +1203,12 @@
               (let [occupiedVec (:occupiedVec reduceResult)

                     ttLessonInfoToShift
-                    (filter (fn [[ttLessonInfo _]]
-                              (let [stime (:startTime ttLessonInfo)
-                                    etime (:endTime ttLessonInfo)]
-                                (.log js/console (str "Executing, startTime = " stime ", endTime = " etime))
-                                (and (>= stime lowTimeIdx)
-                                     (<= (dec etime) highTimeIdx)
-                                     (not-occupied? occupiedVec stime etime))))
-                            ttRow)]
+                    (timetable-row-get-lessons-satisfying-pred
+                      day rowIdx
+                      (fn [{:keys [startTime endTime]}]
+                        (and (>= startTime lowTimeIdx)
+                             (<= (dec endTime) highTimeIdx)
+                             (not-occupied? occupiedVec startTime endTime))))]
                 (.log js/console "suspect above")
                 (.log js/console (str "rowIdx = " rowIdx))
                 (.log js/console (str "occupiedVec = " (.stringify js/JSON (clj->js occupiedVec))))
@@ -1229,7 +1236,7 @@
                                      (range time-helper/TIME-INDEX-MIN
                                             (inc time-helper/TIME-INDEX-MAX))))}
         ; go through each row in the day, below the current row
-        (drop (inc rowNum) (map vector (range (count ttDay)) ttDay))))))
+        (drop (inc rowNum) (range (get-nr-rows-in-timetable-day day)))))))

 (defn- shift-lesson-to-row!
   "Shifts a lesson from its original row up to the given row.


fix order-prop issues in step-4

fix order-prop issues in step-4

--- src/cljs/phonecat_re_frame/core.cljs
+++ src/cljs/phonecat_re_frame/core.cljs
@@ -39,7 +39,8 @@
    {:phones [{:name "Nexus S" :snippet "Fast just got faster with Nexus S."}
              {:name "Motorola XOOM™ with Wi-Fi" :snippet "The Next, Next Generation tablet."}
              {:name "Motoral Xoom" :snippet "The Next, Next Generation tablet."}]
-    :search-input ""}))
+    :search-input ""
+    :order-prop "name"}))

 (defn handle-search-input-entered
   [app-state [_ search-input]]
@@ -78,9 +79,9 @@
 (defn phones-component
   []
   (let [phones (re-frame/subscribe [:phones])
-        search-input (re-frame/subscribe [:search-input])]
+        search-input (re-frame/subscribe [:search-input])
+        order-prop (re-frame/subscribe [:order-prop])]
     (fn []
-
       [:ul {:class= "phones"}
        (for [phone (->> @phones
                         (filter (partial matches-query? @search-input))


add change image on click

add change image on click

--- src/cljs/phonecat_re_frame/core.cljs
+++ src/cljs/phonecat_re_frame/core.cljs
@@ -24,9 +24,16 @@
    (reaction (:phones @db))))  ;; pulls out :phones

 (re-frame/register-sub
- :search-input
- (fn [db]
-   (reaction (:search-input @db))))
+ :selected-image-url
+ (fn [db [_ phone-id]]
+   (let [phone (re-frame/subscribe [:phone-query phone-id])
+         phone-details (re-frame/subscribe [:phone-details])
+         images (reaction (:images @phone))]
+     (reaction
+      (if @phone-details
+        (if-let [image-url (:selected-image-url @phone-details)]
+          image-url
+          (first @images)))))))

 (re-frame/register-sub
  :phone-details
@@ -48,6 +55,12 @@
  (fn [db [_ phone-id]]
    (let [phone-details-reaction (reaction (:phone-details @db))]
      (reaction ((keyword phone-id) @phone-details-reaction)))))
+
+(re-frame/register-handler
+ :set-image
+ (fn
+   [app-state [_ selected-image-url]]
+   (assoc-in app-state [:phone-details :selected-image-url] selected-image-url)))

 (re-frame/register-handler
  :process-phones-response
@@ -215,7 +228,8 @@
   [:ul {:class "phone-thumbs"}
    (for [image (:images @phone)]
      ^{:key image} [:li [:img {:src image
-                               :class "phone"}]])])
+                               :class "phone"
+                               :on-click #(re-frame/dispatch [:set-image image])}]])])

 (defn availability
   [availability]
@@ -314,10 +328,11 @@
    [additional-features (reaction (:additionalFeatures @phone))]])

 (defn phone-page [{phone-id :phone-id}]
-  (let [phone (re-frame/subscribe [:phone-query phone-id])]
+  (let [phone (re-frame/subscribe [:phone-query phone-id])
+        image-url (re-frame/subscribe [:selected-image-url phone-id])]
     (fn []
       [:div
-       [:img {:src (first (:images @phone))
+       [:img {:src @image-url
               :class "phone"}]
        [:h1 (:name @phone)]
        [:p (:description @phone)]


use deep-deref

use deep-deref

--- src/com/billpiel/mem_tracer/core.clj
+++ src/com/billpiel/mem_tracer/core.clj
@@ -96,7 +96,7 @@
   "Returns the value of the active workspace, but with all children
   recursively dereferenced. This workspace value will not receive new
   trace entries."
-  [] (#'ws/deref! workspace))
+  [] (#'ws/deep-deref! workspace))
 (util/defalias w-drf! ws-deref!)

 (defn ws-save!


add require to ns

add require to ns

--- src/com/billpiel/mem_tracer/core.clj
+++ src/com/billpiel/mem_tracer/core.clj
@@ -1,4 +1,5 @@
-(ns com.billpiel.mem-tracer.core)
+(ns com.billpiel.mem-tracer.core
+  (:require com.billpiel.mem-tracer.string-output))

 (def ^{:doc "Current stack depth of traced function calls." :private true :dynamic true}
   *trace-depth* 0)


Change the shapes moviment tracking approach.

Will facilitate grid alignment.

--- src/uxbox/ui/workspace/movement.cljs
+++ src/uxbox/ui/workspace/movement.cljs
@@ -8,15 +8,30 @@
 (ns uxbox.ui.workspace.movement
   "Shape movement in workspace logic."
   (:require [beicon.core :as rx]
+            [lentes.core :as l]
             [uxbox.rstore :as rs]
             [uxbox.state :as st]
+            [uxbox.shapes :as sh]
             [uxbox.ui.core :as uuc]
             [uxbox.ui.workspace.base :as wb]
+            [uxbox.ui.workspace.align :as align]
             [uxbox.data.shapes :as uds]
             [uxbox.util.geom.point :as gpt]))

 (declare initialize)
 (declare handle-movement)
+
+;; --- Lenses
+
+(defn- resolve-selected
+  [state]
+  (let [selected (get-in state [:workspace :selected])
+        xf (map #(get-in state [:shapes-by-id %]))]
+    (into #{} xf selected)))
+
+(def ^:const ^:private selected-shapes-l
+  (-> (l/getter resolve-selected)
+      (l/focus-atom st/state)))

 ;; --- Public Api

@@ -30,22 +45,19 @@

 (defn- initialize
   []
-  (let [stoper (->> uuc/actions-s
+  (let [shapes @selected-shapes-l
+        stoper (->> uuc/actions-s
                     (rx/map :type)
                     (rx/filter empty?)
                     (rx/take 1))]
     (as-> wb/mouse-delta-s $
       (rx/take-until stoper $)
-      (rx/on-value $ handle-movement))))
+      (rx/scan (fn [acc delta]
+                 (mapv #(sh/move % delta) acc)) shapes $)
+      (rx/subscribe $ handle-movement))))

 (defn- handle-movement
   [delta]
-  (let [pageid (get-in @st/state [:workspace :page])
-        selected (get-in @st/state [:workspace :selected])
-        shapes (->> (vals @wb/shapes-by-id-l)
-                    (filter #(= (:page %) pageid))
-                    (filter (comp selected :id)))
-        delta (gpt/divide delta @wb/zoom-l)]
-    (doseq [{:keys [id group]} shapes]
-      (rs/emit! (uds/move-shape id delta)))))
+  (doseq [shape delta]
+    (rs/emit! (uds/update-shape shape))))


Fix grammar some more

Fix grammar some more

--- src/desdemona/lifecycles/logging.clj
+++ src/desdemona/lifecycles/logging.clj
@@ -12,7 +12,7 @@
   {:lifecycle/after-batch log-batch})

 (defn add-logging
-  "Adds logging output to a tasks output-batch."
+  "Adds logging output to a task's output-batch."
   [job task]
   (if-let [entry (first (filter #(= (:onyx/name %) task) (:catalog job)))]
     (update-in


turned dot into a component

turned dot into a component

--- src/prais2/data.cljs
+++ src/prais2/data.cljs
@@ -154,6 +154,12 @@
   )

+(r/defc dot < r/static [slider value]
+  [:div {:class "dot"
+         :style {:left (str "calc("
+                            (percent->screen slider value)
+                            "% - 6px)")}}]  )
+
 (r/defc chart-cell < r/static [row]
   (let [slider 1]
     [:td {:class "chart-cell"}
@@ -164,11 +170,7 @@
       (r/with-key (bar slider (- (:inner-high row) (:inner-low row)) (:inner colour-map)) :bar3)
       (r/with-key (bar slider (- (:outer-high row) (:inner-high row)) (:outer-high colour-map)) :bar4)
       (r/with-key (bar slider (- 100 (:outer-high row)) (:high colour-map)) :bar5)
-      [:div {:key :dot
-             :class "dot"
-             :style {:left (str "calc("
-                                (percent->screen slider (:survival-rate row))
-                                "% - 6px)")}}]
+      (r/with-key (dot slider (:survival-rate row)) :dot)
       ]
      ])
   )


Core logs startup/shutdown.

Core logs startup/shutdown.

--- src/reimann/core.clj
+++ src/reimann/core.clj
@@ -1,5 +1,6 @@
 (ns reimann.core
   (:use reimann.common)
+  (:use clojure.tools.logging)
   (:require reimann.streams)
   (:require [reimann.index :as index]))

@@ -31,11 +32,13 @@
               (recur)))))

 (defn start [core]
+  (info "Hyperspace core online")
   (dosync
     (when-not (deref (:reaper core))
       (ref-set (:reaper core) (periodically-expire core)))))

 (defn stop [core]
+  (info "Core stopping")
   ; Stop expiry
   (when-let [r (deref (:reaper core))]
     (future-cancel r))


needed for catching file not found errors

--- src/spekl_package_manager/package.clj
+++ src/spekl_package_manager/package.clj
@@ -399,9 +399,11 @@
 ;;

 (defn cmd-does-not-meet-requirements [cmd]
-  (let [pattern (re-pattern (cmd :matches))]
-    (let [res (apply shell/sh (string/split (cmd :cmd) #" "))]
-      (or (not (= (res :exit) 0)) (= nil (re-find pattern (str (res :out) (res :err))))))))
+  (try
+   (let [pattern (re-pattern (cmd :matches))]
+     (let [res (apply shell/sh (string/split (cmd :cmd) #" "))]
+       (or (not (= (res :exit) 0)) (= nil (re-find pattern (str (res :out) (res :err)))))))
+   (catch Exception e true)))

 (defn environment-meets [package-description]


rewrite chunks importer to also import the url and description fields

--- src/bitfondue/migrations.clj
+++ src/bitfondue/migrations.clj
@@ -38,7 +38,9 @@
   "Parses the old database dump and imports it"
   []
   (doseq [item (parse-json-line-items "existing_data.json")]
-    (->> item
-         :tab_info
-         chunks/insert-chunk!)))
+    (let [c {:title (:title (:tab_info item))
+             :url   (:url (:tab_info item))
+             :description_summary (:text (:diffbot item))}]
+      (chunks/insert-chunk! c))))

+


Adds no-nums

Adds no-nums

--- src/the_little_clojurian/chapter4.clj
+++ src/the_little_clojurian/chapter4.clj
@@ -197,3 +197,18 @@
   (is (= (rempick 0 '()) nil))
   (is (= (rempick 1 '(apple)) '()))
   (is (= (rempick 2 '(apple bananas gin)) '(apple gin))))
+
+
+(with-test
+  (def no-nums
+    (fn [lat]
+      (cond (null? lat) '()
+            (number? (car lat)) (no-nums (cdr lat))
+            :else (cons (car lat)
+                        (no-nums
+                         (cdr lat))))))
+
+  (is (= (no-nums '()) '()))
+  (is (= (no-nums '(1)) '()))
+  (is (= (no-nums '(apple)) '(apple)))
+  (is (= (no-nums '(5 pears 6 prunes 9 dates)) '(pears prunes dates))))


Add test if old versions get deleted locally after successful live update.

--- test/clj/elephantdb/service_test.clj
+++ test/clj/elephantdb/service_test.clj
@@ -393,9 +393,17 @@
                                 3 [45 45])

           (is (= (thrift/status-ready?
-                       (.getDomainStatus handler "domain1"))))
+                  (.getDomainStatus handler "domain1"))))
           (is (= (thrift/status-ready?
-                       (.getDomainStatus handler "domain2"))))
+                  (.getDomainStatus handler "domain2"))))
+
+          ;; make sure the old versions have been deleted locally
+          (let [domain1-old-path1 (.pathToFile lfs (path (str-path local-dir "domain1" "1")))
+                domain2-old-path1 (.pathToFile lfs (path (str-path local-dir "domain2" "1")))
+                domain2-old-path2 (.pathToFile lfs (path (str-path local-dir "domain2" "2")))]
+            (is (= false (.exists domain1-old-path1)))
+            (is (= false (.exists domain2-old-path1)))
+            (is (= false (.exists domain2-old-path2))))

           (.shutdown handler))
         ))))


color fix

color fix

--- src/clj/just_married/css.clj
+++ src/clj/just_married/css.clj
@@ -118,8 +118,10 @@
                          :color (:gold COLOR-PALLETTE)
                          :margin-bottom "50px"}]

-   [:.navbar__link {:text-decoration "none"}]
-   [:a {:color (:white COLOR-PALLETTE)}]
+   ;; FIXME: should be less generic here
+   [:a {:color (:white COLOR-PALLETTE)
+        :text-decoration "none"}]
+
    [:a:hover {:color (:gold COLOR-PALLETTE)
               :border-left "1px solid white"
               :border-right "1px solid white"}]])


Add timeout to crushing wall trigger

Add timeout to crushing wall trigger

--- src/cljc/robinson/traps.cljc
+++ src/cljc/robinson/traps.cljc
@@ -110,41 +110,43 @@
   ;; determine trap advancement mechanics
   (log/info "x" x "y" y "cell" cell)
   ;; TODO: only trigger once
-  (let [{{min-x :min-x
-          min-y :min-y
-          max-x :max-x
-          max-y :max-y}
-        :room-bounds}  cell
-        trap-direction (crushing-wall-direction state (rp/player-xy state) min-x min-y max-x max-y) ;:up :down :left :right
-        trap-locations (make-trap-xy-sequence min-x min-y max-x max-y trap-direction)]
-    (-> state
-      ;; reveal trap cell
-      (rw/assoc-cell x y :trap-found true)
-      (rc/append-log "You find a trap")
-      ;; add trap obj to place
-      (conj-trap-in-current-place (assoc (Trap. ; type
-                                                :crushing-wall
-                                                ; race
-                                                :trap
-                                                ; name
-                                                "spiked wall"
-                                                ; name-plural
-                                                "spiked walls"
-                                                ; speed
-                                                1
-                                                ; size
-                                                50
-                                                ; strength
-                                                5
-                                                ; dexterity
-                                                1
-                                                ; toughness
-                                                5
-                                                ; attacks
-                                                #{:spike})
-                                     ;; crushing-wall specific
-                                     :direction trap-direction
-                                     :locations trap-locations)))))
+  (if (> (rw/get-time state) (+ (get cell :last-triggered 0) 20))
+    (let [{{min-x :min-x
+            min-y :min-y
+            max-x :max-x
+            max-y :max-y}
+          :room-bounds}  cell
+          trap-direction (crushing-wall-direction state (rp/player-xy state) min-x min-y max-x max-y) ;:up :down :left :right
+          trap-locations (make-trap-xy-sequence min-x min-y max-x max-y trap-direction)]
+      (-> state
+        ;; reveal trap cell
+        (rw/assoc-cell x y :trap-found true)
+        (rc/append-log "You find a trap")
+        ;; add trap obj to place
+        (conj-trap-in-current-place (assoc (Trap. ; type
+                                                  :crushing-wall
+                                                  ; race
+                                                  :trap
+                                                  ; name
+                                                  "spiked wall"
+                                                  ; name-plural
+                                                  "spiked walls"
+                                                  ; speed
+                                                  1
+                                                  ; size
+                                                  50
+                                                  ; strength
+                                                  5
+                                                  ; dexterity
+                                                  1
+                                                  ; toughness
+                                                  5
+                                                  ; attacks
+                                                  #{:spike})
+                                       ;; crushing-wall specific
+                                       :direction trap-direction
+                                       :locations trap-locations))))
+    state))

 (defn trigger-if-trap
   [state [x y]]


comment fix

comment fix

--- src/cljs/geoforms/utils.cljc
+++ src/cljs/geoforms/utils.cljc
@@ -31,12 +31,14 @@
 (def email-regex #"^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$")

 (def canadian-postal-code-regex
+  ;; Regex that matches Canadian Postal-Code formats with or without space
+  ;; (e.g., T2X 1V4 or T2X1V4).
   #"^[ABCEGHJKLMNPRSTVXY]{1}\d{1}[A-Z]{1} *\d{1}[A-Z]{1}\d{1}$")
-#_"Matches Canadian Postal-Code formats with or without space (e.g., T2X 1V4 or T2X1V4)."

 (def us-postal-code-regex
+  ;; Regex that matches all US format zip code formats
+  ;; (e.g., 94105-0011 or 94105)
   #"^\d{5}(-\d{4})?$")
-#_"Matches all US format zip code formats (e.g., 94105-0011 or 94105)"

 (def us-and-canadian-postal-code-regex
   #"(^\d{5}(-\d{4})?$)|(^[ABCEGHJKLMNPRSTVXY]{1}\d{1}[A-Z]{1} *\d{1}[A-Z]{1}\d{1}$)")


Hiding graph when the like-list is emptied

Otherwise we run into the same issue from commit d6e0d2a. Thanks to
re-frame we can do this succinctly and in a single place.

--- src/cljs/tropology/core.cljs
+++ src/cljs/tropology/core.cljs
@@ -95,7 +95,12 @@
   :remove-like
   (fn [app-state [_ article-ref]]
     #_ (.log js/console (str "Removing " article-ref))
-    (assoc-in app-state [:article-data :like-list] (remove #(= article-ref (:ref %)) (get-in app-state [:article-data :like-list])))
+    (let [new-like-list (remove #(= article-ref (:ref %)) (get-in app-state [:article-data :like-list]))
+          no-likes?     (empty? new-like-list)
+          show-graph?   (and (get-in app-state [:ui-state :show-graph?]) (not no-likes?))]
+      (-> app-state
+          (assoc-in [:article-data :like-list] new-like-list)
+          (assoc-in [:ui-state :show-graph?] show-graph?)))
     ))


Improve updating behavior when project tree doesn't exist

--- src/clojure/nightcode/ui.clj
+++ src/clojure/nightcode/ui.clj
@@ -191,8 +191,9 @@
     (some-> (get-project-tree)
             (update-project-tree! nil)))
   ([^String new-selection]
-    (some-> (get-project-tree)
-            (update-project-tree! new-selection)))
+    (if-let [tree (get-project-tree)]
+      (update-project-tree! tree new-selection)
+      (reset! tree-selection new-selection)))
   ([^JTree tree ^String new-selection]
     ; put new data in the tree
     (.setModel tree (create-project-tree!))


Dropping log level

Dropping log level

--- src/com/okl/tokenmgr/cli.clj
+++ src/com/okl/tokenmgr/cli.clj
@@ -93,7 +93,7 @@

 (defn- do-filter [parsed-opts]
   (let [args (:arguments parsed-opts)]
-    (log/info (str "found " (count args) " args: " args))
+    (log/debug (str "found " (count args) " args: " args))
     (if (not (= (count args) 4))
       (usage (:summary parsed-opts)))
     (let [[app envt dir] (rest args) ; skipping the filter argument


New test in config-test module: pretty-print?-existence

--- test/emender_jenkins/config_test.clj
+++ test/emender_jenkins/config_test.clj
@@ -86,3 +86,9 @@
     (testing "if the emender-jenkins.config/get-jenkins-auth definition exists."
         (is (callable? 'emender-jenkins.config/get-jenkins-auth))))

+
+(deftest test-pretty-print?-existence
+    "Check that the emender-jenkins.config/pretty-print? definition exists."
+    (testing "if the emender-jenkins.config/pretty-print? definition exists."
+        (is (callable? 'emender-jenkins.config/pretty-print?))))
+


Test function test-assoc-in-if-not-nil-2

--- test/emender_jenkins/config_test.clj
+++ test/emender_jenkins/config_test.clj
@@ -107,3 +107,11 @@
             (assoc-in-if-not-nil {:first 1 :second 2} [:third] '(1 2 3)) {:first 1 :second 2 :third '(1 2 3)}
             (assoc-in-if-not-nil {:first 1 :second 2} [:third] [1 2 3])  {:first 1 :second 2 :third [1 2 3]})))

+(deftest test-assoc-in-if-not-nil-2
+    "Check the behaviour of function emender-jenkins.config/assoc-in-if-not-nil."
+    (testing "the behaviour of function emender-jenkins.config/assoc-in-if-not-nil."
+        (are [x y] (= x y)
+            (assoc-in-if-not-nil {:first 1 :second 2} [:third] nil)   {:first 1 :second 2}
+            (assoc-in-if-not-nil {:first 1 :second 2} [:third] false) {:first 1 :second 2}
+            (assoc-in-if-not-nil {:first 1 :second 2} [:third] true)  {:first 1 :second 2 :third true})))
+


Make code more Clojure-idiomatic

Make code more Clojure-idiomatic

--- src/cyanite_remover/core.clj
+++ src/cyanite_remover/core.clj
@@ -225,10 +225,9 @@
 (defn- get-times
   "Get a list of times."
   [mstore options tenant rollup period path from to]
-  (if (or from to)
+  (when (or from to)
     (let [result (mstore/fetch mstore tenant rollup period path from to nil)]
-      (if (= result :mstore-error) [] (map #(:time %) result)))
-    nil))
+      (if (= result :mstore-error) [] (map :time result)))))

 (defn- remove-metrics-processor
   "Metrics removal processor."
@@ -399,11 +398,9 @@
                         "rollup: " rollup ", "
                         "period: " period)))
       (let [data (mstore/fetch mstore tenant rollup period path from nil 1)]
-        (if (and (not= data :mstore-error) (not (seq data)))
-          (do
-            (log/debug (str "Metrics on path '" path "' are obsolete"))
-            [path rollup-def])
-          nil)))
+        (when (and (not= data :mstore-error) (not (seq data)))
+          (log/debug (str "Metrics on path '" path "' are obsolete"))
+          [path rollup-def])))
     (catch Exception e
       (clog/error (str "Metric obsolescence checking error: " e ", "
                        "path: " path ", "
@@ -694,9 +691,8 @@
       (cp/with-shutdown! [tpool (get-thread-pool options)]
         (let [pstore (pstore/elasticsearch-path-store es-url options)
               sort (get-sort-or-dummy-fn (:sort options))
-              empty-paths (->> (tree-walker tenant paths pstore options
-                                            empty-paths-finder tpool)
-                               (sort))]
+              empty-paths (sort (tree-walker tenant paths pstore options
+                                             empty-paths-finder tpool))]
           (process-paths tenant empty-paths pstore options
                          remove-empty-paths-processor tpool))))
     (catch Exception e
@@ -711,9 +707,8 @@
     (cp/with-shutdown! [tpool (get-thread-pool options)]
       (let [pstore (pstore/elasticsearch-path-store es-url options)
             sort (get-sort-or-dummy-fn (:sort options))
-            empty-paths (->> (tree-walker tenant paths pstore options
-                                          empty-paths-finder tpool)
-                             (sort))]
+            empty-paths (sort (tree-walker tenant paths pstore options
+                                           empty-paths-finder tpool))]
         (newline)
         (dorun (map println empty-paths))))
     (catch Exception e


Fix a error in the 'show-duration'

Fix a error in the 'show-duration'

--- src/cyanite_remover/core.clj
+++ src/cyanite_remover/core.clj
@@ -67,7 +67,7 @@
         duration-pp (.print formatter (.toPeriod interval))
         duration-sec (.getSeconds (.toStandardSeconds (.toDuration interval)))
         duration-str (format "Duration: %ss%s" duration-sec
-                             (if (duration-sec > 59)
+                             (if (> duration-sec 59)
                                (format " (%s)" duration-pp) ""))]
     (log/info duration-str)
     (newline)
@@ -189,11 +189,13 @@
   "Process paths."
   [tenant paths es-url options process-fn title show-stats?]
   (clog/info (str title ":"))
-  (let [pstore (pstore/elasticsearch-path-store es-url options)]
+  (let [start-time (time/now)
+        pstore (pstore/elasticsearch-path-store es-url options)]
     (process-fn pstore options tenant paths)
     (when show-stats?
       (let [pstore-stats (pstore/get-stats pstore)]
-        (show-stats (:processed pstore-stats) (:errors pstore-stats))))))
+        (show-stats (:processed pstore-stats) (:errors pstore-stats)
+                    (time/interval start-time (time/now)))))))

 (defn remove-paths
   "Remove paths."


reinstate realm name in workspace summary tab (#737)

* reinstate realm name in workspace summary tab

* change terminology to authorization domain

--- src/cljs/main/broadfcui/page/workspace/summary/tab.cljs
+++ src/cljs/main/broadfcui/page/workspace/summary/tab.cljs
@@ -153,7 +153,7 @@
                             user-access-level library-schema request-refresh workspace-id storage-cost]}]
   (let [{:keys [owners]
          {:keys [createdBy createdDate bucketName description tags workspace-attributes library-attributes realm]} :workspace} workspace
-        realm-name (:realmName realm)
+        realm-name (:usersGroupName realm)
         render-detail-box (fn [order title & children]
                             [:div {:style {:flexBasis "50%" :order order}}
                              (style/create-section-header title)
@@ -178,7 +178,7 @@
               ")"])]
           (when realm-name
             [:div {:style {:paddingTop "0.5rem"}}
-             [:div {:style {:fontStyle "italic"}} "Access restricted to realm:"]
+             [:div {:style {:fontStyle "italic"}} "Access restricted to authorization domain:"]
              [:div {} realm-name]])))
       (render-detail-box
         3


A fer unnecessary `do`s removed.

A fer unnecessary `do`s removed.

--- src/clojure/uncomplicate/neanderthal/opencl/clblock.clj
+++ src/clojure/uncomplicate/neanderthal/opencl/clblock.clj
@@ -56,13 +56,11 @@
   (createDataSource [_ n]
     (cl-buffer ctx (* w (max 1 (long n))) :read-write))
   (initialize [_ cl-buf]
-    (do
-      (enq-fill! queue cl-buf (array-fn 1))
-      cl-buf))
+    (enq-fill! queue cl-buf (array-fn 1))
+    cl-buf)
   (initialize [_ cl-buf v]
-    (do
-      (enq-fill! queue cl-buf (wrap-fn v))
-      cl-buf))
+    (enq-fill! queue cl-buf (wrap-fn v))
+    cl-buf)
   (wrapPrim [_ s]
     (wrap-fn s))
   CLAccessor
@@ -191,9 +189,8 @@
                            (.entryType acc) true mapped-buf n strd)
         (catch Exception e (enq-unmap! queue cl-buf mapped-buf)))))
   (unmap [this mapped]
-    (do
-      (enq-unmap! (get-queue claccessor) cl-buf (.buffer ^Block mapped))
-      this)))
+    (enq-unmap! (get-queue claccessor) cl-buf (.buffer ^Block mapped))
+    this))

 (extend CLBlockVector
   Magma
@@ -352,9 +349,8 @@
                              (.entryType acc) true mapped-buf m n ld ord)
         (catch Exception e (enq-unmap! queue cl-buf mapped-buf)))))
   (unmap [this mapped]
-    (do
-      (enq-unmap! (get-queue claccessor) cl-buf (.buffer ^Block mapped))
-      this)))
+    (enq-unmap! (get-queue claccessor) cl-buf (.buffer ^Block mapped))
+    this))

 (extend CLGeneralMatrix
   Magma


No maximum password length. Feel free to use gettysburg address if you want

--- src/foreclojure/register.clj
+++ src/foreclojure/register.clj
@@ -13,7 +13,7 @@
     [:table
      (map form-row
           [[text-field :user "Username (4-13 chars.)"]
-           [password-field :pwd "Password (7-13 chars.)"]
+           [password-field :pwd "Password (7+ chars.)"]
            [password-field :repeat-pwd "Repeat Password"]
            [text-field :email "Email"]])
      [:tr
@@ -28,8 +28,8 @@
                (= lower-user
                   (first (re-seq #"[A-Za-z0-9_]+" lower-user)))
                "Username must be alphanumeric"
-               (< 6 (.length pwd) 14)
-               "Password must be 7-13 characters long",
+               (< 6 (.length pwd))
+               "Password must be at least seven characters long",
                (= pwd repeat-pwd)
                "Passwords don't match",
                (not (empty? email))


Added file-chooser and directory-chooser elements.

--- src/fx_clj/impl/elements.clj
+++ src/fx_clj/impl/elements.clj
@@ -45,7 +45,7 @@
            (javafx.scene.image ImageView)
            (javafx.embed.swing SwingNode)
            (java.lang.reflect Modifier Constructor)
-           (javafx.stage PopupWindow Stage Popup)))
+           (javafx.stage PopupWindow Stage Popup DirectoryChooser FileChooser)))

 (def element-factories (atom {}))

@@ -110,6 +110,6 @@
 (register-classes window-classes)

 (def other-classes
-  [TreeItem])
+  [TreeItem FileChooser DirectoryChooser])

 (register-classes other-classes)


Adding ability to create a range from year month day

--- src/journal_creator/core.clj
+++ src/journal_creator/core.clj
@@ -10,37 +10,41 @@
         below-end? (fn [t] (t/within? (t/interval start end) t))]
     (take-while below-end? inf-range)))

-(defn month-seq
-  [start end step]
-  (time-range start end step))
-
-(defn number-of-days-in-month
-  [year month]
-  (let [current-date (t/date-time year month)
-        end-date     (t/plus current-date (t/months 1))]
-    (month-seq current-date end-date (t/days 1))))
+(defn days-in-month
+  ([year month] (days-in-month year month 01))
+  ([year month day]
+   (let [current-date (t/date-time year month day)
+         end-date     (t/plus current-date (t/months 1))]
+     (time-range current-date end-date (t/days 1)))))

 (defn get-today []
   (t/to-time-zone (t/now) (t/default-time-zone)))

-(defn unparse-today [formatter]
+(defn unparse-today
+  [formatter]
   (f/unparse formatter (get-today)))

-(defn custom-formatter [format]
+(defn custom-formatter
+  [format]
   (f/formatter-local format))

-(defn journal-header-format [date]
+(defn journal-header-format
+  [date]
   (str "= " date " - <SUMMARY GOES HERE> ="))

-(defn file-format [file]
+(defn file-format
+  [file]
   (str file ".wiki"))

 (def journal-format "MMMM dd, yyyy, EEEE")
-(defn convert-to-journal-header [date]
+(def filename-date-format "yyyy-MM-dd")
+
+(defn convert-to-journal-header
+  [date]
   (f/unparse (custom-formatter journal-format) date))

-(def filename-date-format "yyyy-MM-dd")
-(defn convert-to-filename-extension [date]
+(defn convert-to-filename-extension
+  [date]
   (f/unparse (custom-formatter filename-date-format) date))

 (defn get-journal-header [date]
@@ -51,19 +55,21 @@

 ;; incrediblepoems.com - heaven wont be heaven

-(defn generate-journal-files-for-month [year month]
-  (loop [days (number-of-days-in-month year month)]
-    (when (seq days)
-      (let [day (first days)
-            journal-header (get-journal-header day)
-            filename (get-filename-extension day)]
-        (prn "remaining:" (count days) "journal-header: " journal-header)
-        (prn "filename: " filename)
-        (spit filename journal-header)
-        (recur (rest days))))))
+(defn generate-journal-files
+  ([year month] (generate-journal-files year month 01))
+  ([year month d]
+   (loop [days (days-in-month year month d)]
+     (when (seq days)
+       (let [day (first days)
+             journal-header (get-journal-header day)
+             filename (get-filename-extension day)]
+         (prn "remaining:" (count days) "journal-header: " journal-header)
+         (prn "filename: " filename)
+         (spit filename journal-header)
+         (recur (rest days)))))))

 (defn -main
   [& args]
   (println "Today is: " (get-journal-header (get-today)))
   (println "file format is: " (get-filename-extension (get-today)))
-  (generate-journal-files 2017 03))
+  (generate-journal-files 2017 03 04))


CLJS-1440: Allow eval to work inside a web worker

Use goog/global instead of js/window so the correct global is always used.

--- src/main/cljs/cljs/core.cljs
+++ src/main/cljs/cljs/core.cljs
@@ -10125,7 +10125,7 @@
       "nodejs"  (if ^boolean js/COMPILED
                   (js/eval munged-ns)
                   (find-ns-obj* js/global segs))
-      "default" (find-ns-obj* js/window segs)
+      "default" (find-ns-obj* goog/global segs)
       (throw (js/Error. (str "find-ns-obj not supported for target " *target*))))))

 (defn ns-interns* [sym]


Update template itself to stable release

--- template/project.clj
+++ template/project.clj
@@ -1,4 +1,4 @@
-(defproject play-clj/lein-template "0.1.0-SNAPSHOT"
+(defproject play-clj/lein-template "0.1.0"
   :description "A template for making play-clj projects"
   :url "https://github.com/oakes/play-clj"
   :license {:name "Public Domain"


Hotfix

Hotfix

--- src/word_keeper/core.clj
+++ src/word_keeper/core.clj
@@ -9,13 +9,14 @@

 (def consumer-key "5KvZggyamEy8yHD0oACgAkLxH")
 (def consumer-secret "3DeEHXQ6LVh7LxSdApivzAOiwBAcGdvRorheKzheCchbPPQF6h")
+(def consumer (oauth/make-consumer consumer-key
+                                   consumer-secret
+                                   "https://api.twitter.com/oauth/request_token"
+                                   "https://api.twitter.com/oauth/access_token"
+                                   "https://api.twitter.com/oauth/authorize"
+                                   :hmac-sha1))

-(defn action-index [req]
-  {:status 200
-   :headers {"Content-Type" "text/html"}
-   :body (render-resource
-            "views/index.html.mustache"
-            nil)})
+(def request-token (oauth/request-token consumer "http://word-keeper.clojurecup.com/signin"))

 (defroutes routes
   (GET "/" [] action-index))


make esc close the menu

make esc close the menu

--- src-cljs/frontend/controllers/controls.cljs
+++ src-cljs/frontend/controllers/controls.cljs
@@ -123,9 +123,14 @@
   [state shortcut-name]
   (overlay/replace-overlay state :shortcuts))

+(defn close-menu [state]
+  (assoc-in state [:menu :open?] false))
+
 (defmethod handle-keyboard-shortcut :escape-interaction
   [state shortcut-name]
-  (overlay/clear-overlays state))
+  (-> state
+    overlay/clear-overlays
+    close-menu))

 (defmethod handle-keyboard-shortcut :reset-canvas-position
   [state shortcut-name]
@@ -663,7 +668,7 @@
 (defmethod control-event :menu-closed
   [browser-state message _ state]
   (-> state
-      (assoc-in [:menu :open?] false)))
+    close-menu))

 (defmethod control-event :newdoc-button-clicked
   [browser-state message _ state]


model.place: should not crate new Place missing name

--- test/busa_server/model/place_test.clj
+++ test/busa_server/model/place_test.clj
@@ -8,3 +8,6 @@

 (fact "should not create new Place missing id"
   (place/new-place nil "Nummela") => (throws Exception))
+
+(fact "should not create new Place missing name"
+  (place/new-place "p1447" nil) => (throws Exception))


Negative test for parse-test-results

Negative test for parse-test-results

--- test/emender_jenkins/results_test.clj
+++ test/emender_jenkins/results_test.clj
@@ -309,3 +309,10 @@
             false (compute-job-disabled "xyzzy" true)
             true  (compute-job-disabled nil true))))

+(deftest test-parse-test-results-negative
+    "Check the emender-jenkins.results/parse-test-results function."
+    (testing "the emender-jenkins.results/parse-test-results function."
+        (are [x y] (= x y)
+            nil   (parse-test-results "")
+            nil   (parse-test-results "xyzzy")
+            nil   (parse-test-results "Total: "))))


style: use arg

style: use arg

--- src/main/cljs/cljs/tools/reader.cljs
+++ src/main/cljs/cljs/tools/reader.cljs
@@ -942,13 +942,13 @@
   Returns a vector containing the object read and the (whitespace-trimmed) string read."
   ([stream] (read+string stream true nil))
   ([stream eof-error? eof-value]
-   (let [buf (fn [reader] (str (:buffer @(.-frames stream))))
+   (let [buf (fn [stream] (str (:buffer @(.-frames stream))))
          offset (count (buf stream))
          o (log-source stream (read stream eof-error? eof-value))
          s (.trim (subs (buf stream) offset))]
      [o s]))
   ([opts stream]
-   (let [buf (fn [reader] (str (:buffer @(.-frames stream))))
+   (let [buf (fn [stream] (str (:buffer @(.-frames stream))))
          offset (count (buf stream))
          o (log-source stream (read opts stream))
          s (.trim (subs (buf stream) offset))]


Add testing for coefficiant of lift

Add testing for coefficiant of lift

--- test/hydrofoil/expectations/model.clj
+++ test/hydrofoil/expectations/model.clj
@@ -168,36 +168,36 @@

 ;;;-------- riemann-sum ----------
 (expect 0.0681
-        (round-double (integral-abstracted (NACA-design 0 5 20) upper-surface-y-function left-rule 140)))
-
-(expect 0.0681
-        (round-double (integral-abstracted (NACA-design 0 5 20) upper-surface-y-function right-rule 140)))
-
-(expect 0.0681
-        (round-double (integral-abstracted (NACA-design 0 5 20) upper-surface-y-function middle-rule 50)))
-
-(expect 0.0681
-        (round-double (trapazoid-integral (NACA-design 0 5 20) upper-surface-y-function 140)))
-
-(expect 0.0681
-        (round-double (simpson-integral (NACA-design 0 5 20) upper-surface-y-function 80)))
-
-
-
-(expect 0.0994
-        (round-double (integral-abstracted (NACA-design 4.75 4.5 20) upper-surface-y-function left-rule 80)))
-
-(expect 0.0994
-        (round-double (integral-abstracted (NACA-design 4.75 4.5 20) upper-surface-y-function right-rule 80)))
-
-(expect 0.0994
-        (round-double (integral-abstracted (NACA-design 4.75 4.5 20) upper-surface-y-function middle-rule 195)))
-
-(expect 0.0994
-        (round-double (trapazoid-integral (NACA-design 4.75 4.5 20) upper-surface-y-function 80)))
-
-(expect 0.0994
-        (round-double (simpson-integral (NACA-design 4.75 4.5 20) upper-surface-y-function 50)))
+        (round-double (integral-abstracted (NACA-design 0 5 20) upper-surface-y-function left-rule 0 1 140)))
+
+(expect 0.0681
+        (round-double (integral-abstracted (NACA-design 0 5 20) upper-surface-y-function right-rule 0 1 140)))
+
+(expect 0.0681
+        (round-double (integral-abstracted (NACA-design 0 5 20) upper-surface-y-function middle-rule 0 1 50)))
+
+(expect 0.0681
+        (round-double (trapazoid-integral (NACA-design 0 5 20) upper-surface-y-function 0 1 140)))
+
+(expect 0.0681
+        (round-double (simpson-integral (NACA-design 0 5 20) upper-surface-y-function 0 1 80)))
+
+
+
+(expect 0.0994
+        (round-double (integral-abstracted (NACA-design 4.75 4.5 20) upper-surface-y-function left-rule 0 1 80)))
+
+(expect 0.0994
+        (round-double (integral-abstracted (NACA-design 4.75 4.5 20) upper-surface-y-function right-rule 0 1 80)))
+
+(expect 0.0994
+        (round-double (integral-abstracted (NACA-design 4.75 4.5 20) upper-surface-y-function middle-rule 0 1 195)))
+
+(expect 0.0994
+        (round-double (trapazoid-integral (NACA-design 4.75 4.5 20) upper-surface-y-function  0 1  80)))
+
+(expect 0.0994
+        (round-double (simpson-integral (NACA-design 4.75 4.5 20) upper-surface-y-function 0 1 50)))

 ;;;-------- derivative ----------
 (expect 1.0455
@@ -225,7 +225,18 @@
         (round-double (coefficient-of-lift (NACA-design 0 0.5 10) (run-constants 0 0 20))))

 ;;;-------- coefficient-of-lift-Components ---------
-(expect -0.0045
-        (round-double (A-0 (NACA-design 2 4 12) (run-constants 0 0 0))))
+;(expect 0.0882
+;        (round-double (integral-production (NACA-design 2 4 12) gradient-forward-polar-function 0 1.369 (/ (theta-switch (NACA-design 2 4 12)) 200) 200)))
+
+(expect 0.0882
+        (round-double (simpson-integral (NACA-design 2 4 12) gradient-forward-polar-function 0 (theta-switch (NACA-design 2 4 12)) 200)))
+
+
+(expect -0.0044
+        (round-double (A-0 (NACA-design 2 4 12) (run-constants 0 0 0))));; should expect -0.0044
+
 (expect 0.0815
         (round-double (A-1 (NACA-design 2 4 12) (run-constants 0 0 0))))
+
+(expect 0.2275
+        (round-double (coefficient-of-lift (NACA-design 2 4 12) (run-constants 0 0 0))))


Simplified connection test.

Simplified connection test.

--- test/kixi/hecuba/data_schema_test.clj
+++ test/kixi/hecuba/data_schema_test.clj
@@ -7,7 +7,6 @@
             [com.stuartsierra.component :as component]
             [clojure.data.json :as json]
             [clj-http.client :as client]
-            [kixi.amon-schema :as amon]
             [schema_gen.core :as sg]
             [schema.core :as s]
             [clojure.tools.logging  :as log]))
@@ -31,23 +30,22 @@
 ;; -----------------------------------

 (defn- connected? []
-  (let
-      [sample (last (sg/generate-examples amon/BaseProgramme))]
-    (client/post "http://127.0.0.1:8010/4/programmes/" {:accept :json :content-type :json :basic-auth ["test@mastodonc.com" "password"] :body (json/write-str sample)}))
-  (log/info "Posted => connected"))
+  (try (client/get "http://localhost:9200/")
+       (:status (json/read-json (:body (client/get "http://localhost:9200/"))))
+       (log/info "Successful GET response.")
+       true
+       (catch Exception e (log/info "Could not connect.") false)) )

 ;;-----------------------------------
 ;; main testing fixture
 ;;-----------------------------------

 (defn data-test-fixture [tests]
-  (try
-    (connected?)
+  (when (connected?)
     (reset! system (component/start (new-system)))
     (tests)
     (component/stop @system)
-    (log/info "Completed k.h.d.* tests inside 'use-fixture'.")
-    (catch Exception e (log/info "Not connected."))))
+    (log/info "Completed k.h.d.* tests inside 'use-fixture'.")))

 (use-fixtures :once data-test-fixture)