Fixing drums that had old :done to :action so they remove themselves correctly.

--- src/overtone/inst/drum.clj
+++ src/overtone/inst/drum.clj
@@ -10,7 +10,7 @@
    freq-decay {:default 0.02 :min 0.001 :max 1.0 :step 0.001}
    amp-decay  {:default 0.5 :min 0.001 :max 1.0 :step 0.001}]
   (let [fenv (* (env-gen (envelope [env-ratio 1] [freq-decay] :exp)) freq)
-        aenv (env-gen (perc 0.005 amp-decay) :done FREE)]
+        aenv (env-gen (perc 0.005 amp-decay) :action FREE)]
     (* (sin-osc fenv (* 0.5 Math/PI)) aenv)))

 (definst kick2 [freq      {:default 80 :min 10 :max 20000 :step 1}
@@ -55,7 +55,7 @@
         osc-env (perc 0.001 1 freq -8)
         noiz (lpf (white-noise) (+ (env-gen:kr cutoff-env) 20))
         snd  (lpf (sin-osc (+ (env-gen:kr osc-env) 20)) 200)
-        mixed (* (+ noiz snd) (env-gen amp-env :done FREE))]
+        mixed (* (+ noiz snd) (env-gen amp-env :action FREE))]
     mixed))

 (definst dry-kick
@@ -125,7 +125,7 @@
    amp    {:default 0.3 :min 0.001 :max 1 :step 0.01}
    attack {:default 0.0001 :min 0.1 :max 1.0 :step 0.01}
    decay  {:default 0.1 :min 0.1 :max 1.0 :step 0.01}]
-  (let [env (env-gen (perc attack decay) :done FREE)
+  (let [env (env-gen (perc attack decay) :action FREE)
         noiz (bpf (* amp (gray-noise)) freq 0.3)
         snd (* noiz env)]
     snd))
@@ -138,7 +138,7 @@
    amp    {:default 0.3 :min 0.001 :max 1 :step 0.01}
    attack {:default 0.0001 :min 0.1 :max 1.0 :step 0.01}
    decay  {:default 0.1 :min 0.1 :max 1.0 :step 0.01}]
-  (let [env (env-gen (perc attack decay) :done FREE)
+  (let [env (env-gen (perc attack decay) :action FREE)
         noiz (bpf (* amp (gray-noise))
                   (line freq 50 (* decay 0.5))
                   (* env 0.1))
@@ -150,7 +150,7 @@
    amp    {:default 0.3 :min 0.001 :max 1 :step 0.01}
    attack {:default 0.0001 :min 0.1 :max 1.0 :step 0.01}
    decay  {:default 0.1 :min 0.1 :max 1.0 :step 0.01}]
-  (let [env (env-gen (perc attack decay) :done FREE)
+  (let [env (env-gen (perc attack decay) :action FREE)
         noiz (bpf (* amp (gray-noise)) (line freq 5 (* decay 0.5)) (+ env 0.1))
         wave (* 0.1 env (mix (sin-osc [4000 6500 5000])))
         snd (+ noiz wave)]
@@ -220,7 +220,7 @@
   [freq   {:default 1000 :min 100 :max 10000 :step 1}
    amp    {:default 0.3 :min 0.001 :max 1 :step 0.01}
    decay  {:default 0.1 :min 0.1 :max 1.0 :step 0.01}]
-  (let [env (env-gen (perc 0 decay) :done FREE)
+  (let [env (env-gen (perc 0 decay) :action FREE)
         snd (bpf (gray-noise) freq 3)]
     (* snd env amp)))

@@ -228,7 +228,7 @@
   [freq   {:default 1000 :min 100 :max 10000 :step 1}
    amp    {:default 0.3 :min 0.001 :max 1 :step 0.01}]
   (let [filterenv (line 1 0 0.2)
-        amp-env   (line 1 0 0.6 :done FREE)
+        amp-env   (line 1 0 0.6 :action FREE)
         snd       (pulse 100)
         snd       (lpf snd (+ (* filterenv freq) 30))
         snap-env  (line 1 0 0.2)
@@ -291,7 +291,7 @@
    amp {:default 0.3 :min 0.001 :max 1 :step 0.01}
    decay {:default 0.6 :min 0.1 :max 0.8 :step 0.001}]
   (let [noise      (bpf (lpf (white-noise) low) hi)
-        clap-env   (line 1 0 decay :done FREE)
+        clap-env   (line 1 0 decay :action FREE)
         noise-envs (map #(envelope [0 0 1 0] [(* % 0.01) 0 0.04]) (range 8))
         claps      (apply + (* noise (map env-gen noise-envs)))]
     (* claps clap-env)))
@@ -301,7 +301,7 @@
    amp {:default 0.3 :min 0.001 :max 1 :step 0.01}
    attack {:default 0.001 :min 0.0001 :max 1.0 :step 0.001}
    decay  {:default 0.1 :min 0.001 :max 1.0 :step 0.001}]
-  (let [env (env-gen (perc attack decay) :done FREE)
+  (let [env (env-gen (perc attack decay) :action FREE)
         snd (sin-osc freq)]
     (* amp env snd)))


update deps docstrings to mention that the public fns can safely be used within transactions

--- src/overtone/libs/deps.clj
+++ src/overtone/libs/deps.clj
@@ -69,7 +69,9 @@
   already been satisfied, otherwise it will run as soon as they are.

   If a dep handler has already been registered with the same key, a second
-  registration with just replace the first."
+  registration with just replace the first.
+
+  Uses an agent so it's safe to call this from within a transaction."
   [deps key handler]
   (let [deps (if (coll? deps)
                (set deps)
@@ -77,12 +79,14 @@
     (send-off dep-state* on-deps* key deps handler)))

 (defn satisfy-deps
-  "Specifies that a given dependency has been satisfied."
+  "Specifies that a given dependency has been satisfied. Uses an agent so it's
+  safe to call this from within a transaction."
   [& deps]
   (send-off dep-state* satisfy* (set deps)))

 (defn reset-deps
-  "Reset the dependency system."
+  "Reset the dependency system. Uses an agent so it's safe to call this from
+  within a transaction."
   []
   (send dep-state* (fn [& args]
                      {:satisfied #{}
@@ -90,7 +94,8 @@
                       :done []})))

 (defn unsatisfy-all-dependencies
-  "Unsatisfy all deps and reset completed tasks as todo tasks"
+  "Unsatisfy all deps and reset completed tasks as todo tasks. Uses an agent so
+  it's safe to call this from within a transaction."
   []
   (send dep-state* (fn [deps]
                      {:satisfied #{}


Fix: ensure identity analyzed results validate schema

--- src/pathfinder/analyze.clj
+++ src/pathfinder/analyze.clj
@@ -7,7 +7,9 @@
   a/Analyzer
   (analyze [this source meta]
     {:source source
-     :meta meta}))
+     :meta meta
+     :definitions []
+     :usages []}))

 (def analyzers {:clojure (->CljHeuristicAnalyzer)
                 :java    (->JavaHeuristicAnalyzer)})


add unique id to data passed to client

add unique id to data passed to client

--- src/server/capture/core.clj
+++ src/server/capture/core.clj
@@ -11,6 +11,8 @@
             [taoensso.timbre :as timbre]
             [cheshire.core :refer [decode encode]]))

+(defn uuid [] (str (java.util.UUID/randomUUID)))
+
 (timbre/refer-timbre)

 (defn ^:private random-date [start end]
@@ -23,7 +25,7 @@

 (defn ^:private wrap-data [data]
   {:type :post
-   :data data})
+   :data (merge  data {:id (uuid)})})

 (defn ^:private gen-fake-data [i]
    {:x (rand 100)


rm_case_parent_info

--- src/pg_demo/table_defs.clj
+++ src/pg_demo/table_defs.clj
@@ -1282,6 +1282,36 @@
               PRIMARY KEY (ENTERPRISE_ID,CASE_ID,SEQ_NUM,BLOB_SEQ,DLP_REVISION_NUMBER)
           ); " }

+    { "rm_case_parent_info"
+          "CREATE TABLE rm_case_parent_info (
+              ENTERPRISE_ID numeric NOT NULL,
+              CASE_ID numeric NOT NULL,
+              AGE_UNIT_ID numeric,
+              DATE_OF_LMP timestamp,
+              GENDER_ID numeric,
+              AGE numeric(22,7),
+              DOB timestamp,
+              DOB_RES numeric(1),
+              HEIGHT_CM numeric(22,7),
+              INITIALS varchar(10),
+              WEIGHT_KG numeric(22,7),
+              DOB_PARTIAL varchar(20),
+              WEIGHT_LBS numeric(22,7),
+              HEIGHT_IN numeric(22,7),
+              DELETED timestamp,
+              BREASTFEEDING numeric,
+              DATE_OF_LMP_RES numeric,
+              DATE_OF_LMP_PARTIAL varchar(20),
+              MED_HIST_TEXT text,
+              MED_HIST_TEXT_J text,
+              DLP_REVISION_NUMBER numeric NOT NULL,
+              REVISION_DELETE_FLAG numeric,
+              DELETED_FLAG numeric(1) NOT NULL,
+              EFFECTIVE_START_DATE timestamp NOT NULL,
+              EFFECTIVE_END_DATE timestamp NOT NULL,
+              PRIMARY KEY (ENTERPRISE_ID,CASE_ID,DLP_REVISION_NUMBER)
+          ); " }
+
   ] ))

 (def dummy


nth on RoseTree throws IndexOutOfBoundsException

--- src/main/clojure/clojure/test/check/rose_tree.clj
+++ src/main/clojure/clojure/test/check/rose_tree.clj
@@ -8,7 +8,7 @@
   (nth [this i]
     (cond (= i 0) root
           (= i 1) children
-          :else nil))
+          :else (throw (IndexOutOfBoundsException.))))

   (nth [this i not-found]
     (cond (= i 0) root


remove file truncation

remove file truncation

this means we can call this file on several config files and the
output is additive instead of replacing

--- src/version_parser/core.clj
+++ src/version_parser/core.clj
@@ -14,15 +14,13 @@
    ["-o" "--output OUTPUT" "path to output terraform file"]])

 (defn -main
-  "Entry Point"
+  "See README for details"
   [& args]
   (let [opts (:options (clojure.tools.cli/parse-opts args cli-options))
         output (:output opts)
         pipelines (:pipelines (conf (:config opts)))
         otherjars (:system-jar-info (:config conf (:config opts)))]
-    ; clear out the file before writing to it
-    (spit output "")
-
+

     ; for each pipeline, create <key>/jarname jarname pairs and write to file
     (doseq [[k v] pipelines]


use edge ngram tokenizer instead of token filter as suggested by https://discuss.elastic.co/t/ngram-filter-and-relevance-score/22475/3

--- src/wb_es/mappings/core.clj
+++ src/wb_es/mappings/core.clj
@@ -114,6 +114,14 @@
                         "unprefix_filter" {:type "pattern_capture"
                                            :preserve_original true
                                            :patterns [":(.+)"]}}
+               :tokenizer {:autocomplete_keyword_tokenizer {:type "edge_ngram"
+                                                            :min_gram 2
+                                                            :max_gram 20}
+                           :autocomplete_tokenizer {:type "edge_ngram"
+                                                    :min_gram 2
+                                                    :max_gram 20
+                                                    :token_chars [:letter
+                                                                  :digit]}}
                :normalizer {"lowercase_normalizer" {:type "custom"
                                                     :char_filter []
                                                     :filter ["lowercase"]}}
@@ -123,11 +131,11 @@
                  :mappings ["_ => -"]}}

                :analyzer {"autocomplete" {:type "custom"
-                                          :tokenizer "standard"
-                                          :filter ["lowercase" "autocomplete_filter"]}
+                                          :tokenizer "autocomplete_tokenizer"
+                                          :filter ["lowercase"]}
                           "autocomplete_keyword" {:type "custom"
-                                                  :tokenizer "keyword"
-                                                  :filter ["lowercase" "autocomplete_filter"]}
+                                                  :tokenizer "autocomplete_keyword_tokenizer"
+                                                  :filter ["lowercase"]}
                           "keyword_ignore_case" {:type "custom"
                                                  :tokenizer "keyword"
                                                  :filter ["lowercase"]}


Added last-vote-timestamp to profile data

--- src/polismath/conv_man.clj
+++ src/polismath/conv_man.clj
@@ -150,7 +150,7 @@
       (try
         (-> prof
             (assoc :n-ptps (:n conv))
-            (merge (hash-map-subset conv #{:n-cmts :zid})
+            (merge (hash-map-subset conv #{:n-cmts :zid :last-vote-timestamp})
                    extra-data)
             ((partial mongo-insert-results (db/mongo-collection-name "profile"))))
         (catch Exception e


whitelist comment-prioriries json input/output

--- src/polismath/conv_man.clj
+++ src/polismath/conv_man.clj
@@ -45,7 +45,7 @@
   (-> results
       ; REFORMAT BASE CLUSTERS
       (update-in [:base-clusters] clust/fold-clusters)
-      ; Whitelist of keys to be included in sent data; removes intermediates
+      ; IMPORTANT! Whitelist of keys to be included in json output; used for removing intermediates
       (assoc :lastVoteTimestamp (:last-vote-timestamp results))
       (assoc :lastModTimestamp (:last-mod-timestamp results))
       (utils/hash-map-subset #{:base-clusters
@@ -67,7 +67,8 @@
                                :votes-base
                                :group-votes
                                :subgroup-votes
-                               :subgroup-repness})))
+                               :subgroup-repness
+                               :comment-priorities})))
                                ;:subgroup-ptpt-stats})))

@@ -167,7 +168,7 @@
 (defn restructure-json-conv
   [conv]
   (-> conv
-      (utils/hash-map-subset #{:math_tick :raw-rating-mat :rating-mat :lastVoteTimestamp :mod-out :zid :pca :in-conv :n :n-cmts :group-clusters :base-clusters :repness :group-votes :subgroup-clusters :subgroup-votes :subgroup-repness :group-aware-consensus})
+      (utils/hash-map-subset #{:math_tick :raw-rating-mat :rating-mat :lastVoteTimestamp :mod-out :zid :pca :in-conv :n :n-cmts :group-clusters :base-clusters :repness :group-votes :subgroup-clusters :subgroup-votes :subgroup-repness :group-aware-consensus :comment-priorities})
       (assoc :last-vote-timestamp (get conv :lastVoteTimestamp)
              :last-mod-timestamp  (get conv :lastModTimestamp))
       ; Make sure there is an empty named matrix to operate on


Resurrect the arg to `start-http-server`

--- resources/leiningen/new/kraken_http_api/server.clj
+++ resources/leiningen/new/kraken_http_api/server.clj
@@ -19,5 +19,5 @@

 (defn -main [& args]
   (let [rabbit-resources (queue/initialize)]
-    (start-http-server)
+    (start-http-server (config [:server]))
     (immutant/at-exit (partial shutdown rabbit-resources))))


Remove unnecessary logging.

Remove unnecessary logging.

--- src/re_com/input_time.cljs
+++ src/re_com/input_time.cljs
@@ -237,7 +237,6 @@
    Rests  the text-model only if the new text is valid"
   [event text-model]
   (let [current-text (-> event .-target .-value)]           ;; gets the current input field text
-    (.log js/console "HELLO")
     (reset! text-model current-text)))

 (defn input-time-12h


Now can insert schemas, minus ability to deal with properties (n-ary) properly, from turtle. Also data.

--- src/databinder/model.clj
+++ src/databinder/model.clj
@@ -188,6 +188,15 @@
     (skolemize-model model)
     model))

+(defn to-statements [model]
+  (doall
+   (map
+    (fn [statement]
+      {:subject (stringify (.getSubject statement))
+       :predicate (stringify (.getPredicate statement))
+       :object (stringify (.getObject statement))})
+    (iterator-seq (.listStatements model)))))
+
 (defn default-model []
   (if ds
     (.close ds))


Always use our sql-quoting-style.

Always use our sql-quoting-style.

--- src/datomish/sqlite.cljc
+++ src/datomish/sqlite.cljc
@@ -24,7 +24,7 @@
 (def sql-quoting-style :ansi)

 (defn format [args]
-  (honeysql.core/format args :quoting :ansi))
+  (honeysql.core/format args :quoting sql-quoting-style))

 (defprotocol ISQLiteConnection
   (-execute!


Resolve self-referencing expansion of native js objects

--- src/devtools/format.cljs
+++ src/devtools/format.cljs
@@ -1,4 +1,5 @@
-(ns devtools.format)
+(ns devtools.format
+  (:require [devtools.debug :as debug]))

 (def max-header-elements 5)
 (def more-marker "…")
@@ -133,7 +134,8 @@
 ; we want to wrap stringified obj in a reference for further inspection
 (defn detect-else-case-and-patch-it [group obj]
   (if (and (= (count group) 3) (= (aget group 0) "#<") (= (str obj) (aget group 1)) (= (aget group 2) ">"))
-    (aset group 1 (reference (surrogate obj (aget group 1)))))) ; TODO change to direct reference after devtools guys fix the bug
+    (let [label (aget group 1)]
+      (aset group 1 (reference (surrogate obj label true (reference obj "inspect js object"))))))) ; TODO change to direct reference after devtools guys fix the bug

 (defn alt-printer-impl [obj writer opts]
   (if-let [tmpl (atomic-template obj)]
@@ -214,17 +216,17 @@

 (defn header-api-call [value]
   (cond
+    (surrogate? value) (aget value "header")
     (satisfies? IDevtoolsFormat value) (-header value)
-    (surrogate? value) (aget value "header")
-    :else (build-header value)))
+    (cljs-value? value) (build-header value)))

 (defn has-body-api-call [value]
   (cond
+    (surrogate? value) (aget value "hasBody")
     (satisfies? IDevtoolsFormat value) (-has-body value)
-    (surrogate? value) (aget value "hasBody")
     :else false))                                           ; body is emulated using surrogate references

 (defn body-api-call [value]
   (cond
-    (satisfies? IDevtoolsFormat value) (-body value)
-    (surrogate? value) (build-surrogate-body value)))+    (surrogate? value) (build-surrogate-body value)
+    (satisfies? IDevtoolsFormat value) (-body value)))


Use less defs in full-test. Also check pairs are aligned

--- test/onyx/log/full_test.clj
+++ test/onyx/log/full_test.clj
@@ -1,6 +1,7 @@
 (ns onyx.log.full-test
   (:require [clojure.core.async :refer [chan >!! <!! close!]]
             [com.stuartsierra.component :as component]
+            [onyx.messaging.aeron :as aeron]
             [onyx.log.entry :refer [create-log-entry]]
             [onyx.extensions :as extensions]
             [onyx.api :as api]
@@ -15,29 +16,33 @@

 (def peer-config (assoc (:peer-config config) :onyx/id onyx-id))

-(def env (onyx.api/start-env env-config))
+(def messaging
+  (component/start (aeron/aeron {:opts peer-config})))

-(def n-peers 20)
+(def n-peers 3)

-(def v-peers (onyx.api/start-peers n-peers peer-config))
+(facts "peers all join and watch each other"
+       (let [env (onyx.api/start-env env-config)
+             v-peers (onyx.api/start-peers n-peers peer-config)]
+         (try
+           (let [ch (chan n-peers)
+                 replica (loop [replica (extensions/subscribe-to-log (:log env) ch)]
+                           (let [position (<!! ch)
+                                 entry (extensions/read-log-entry (:log env) position)
+                                 new-replica (extensions/apply-log-entry entry replica messaging)]
+                             ;(println (:pairs new-replica) (count (:pairs new-replica)) (count (:peers new-replica)))
+                             (if (< (count (:pairs new-replica)) n-peers)
+                               (recur new-replica)
+                               new-replica)))]
+             (fact (:prepared replica) => {})
+             (fact (:accepted replica) => {})
+             (fact (set (keys (:pairs replica)))
+                   => (set (vals (:pairs replica))))
+             (fact (count (:peers replica)) => n-peers))

-(def ch (chan n-peers))
+           (finally
+             (doseq [v-peer v-peers]
+               (onyx.api/shutdown-peer v-peer))
+             (onyx.api/shutdown-env env)))))

-(def replica
-  (loop [replica (extensions/subscribe-to-log (:log env) ch)]
-    (let [position (<!! ch)
-          entry (extensions/read-log-entry (:log env) position)
-          new-replica (extensions/apply-log-entry entry replica)]
-      (if (< (count (:pairs new-replica)) n-peers)
-        (recur new-replica)
-        new-replica))))

-(fact (:prepared replica) => {})
-(fact (:accepted replica) => {})
-(fact (count (:peers replica)) => n-peers)
-
-(doseq [v-peer v-peers]
-  (onyx.api/shutdown-peer v-peer))
-
-(onyx.api/shutdown-env env)
-


Fix navbar.

Fix navbar.

--- src/flatland/handler.clj
+++ src/flatland/handler.clj
@@ -33,8 +33,7 @@
 (def pages (load-md "resources/pages"))

 (def config {:title "Cognitive Jetsam"
-             :base-url "http://blog.loganbuckley.com/"
-             :pages pages})
+             :base-url "http://blog.loganbuckley.com/"})

 (def template
   (str "<!DOCTYPE html>"
@@ -47,8 +46,9 @@
                 [:div {:class "inner clearfix"}
                  [:h1 [:a {:href (:base-url config)} (:title config)]]
                  [:ul {:class "nav"}
-                  (for [page (:pages config)]
-                    [:li [:a {:href (get page :url)} (get page :title)]])]]]
+                  (for [[name page] pages]
+                    [:li [:a {:href (str (:base-url config) name)}
+                          (get page :title)]])]]]
                [:section {:id "content"}
                 [:div {:class "inner"}
                  [:div {:class "replace-me"}]]] ; workaround to avoid parsing HTML


look for macros in cljs.core

look for macros in cljs.core

--- src/main/clojure/clojure/tools/analyzer/js.clj
+++ src/main/clojure/clojure/tools/analyzer/js.clj
@@ -89,13 +89,19 @@
        :else form))
     form))

+(defn fix-ns [ns]
+  (if (= ns "clojure.core")
+    "cljs.core"
+    ns))
+
 (defn maybe-macro [sym {:keys [ns]}]
-  (let [var (if-let [sym-ns (namespace sym)]
+  (let [var (if-let [sym-ns (fix-ns (namespace sym))]
               (if-let [full-ns (get-in (env/deref-env)
                                        [:namespaces ns :macro-aliases (symbol sym-ns)])]
                 (ns-resolve full-ns (symbol (name sym)))
                 (ns-resolve (symbol sym-ns) (symbol (name sym))))
-              (get-in (env/deref-env) [:namespaces ns :macro-mappings sym]))]
+              (or (get-in (env/deref-env) [:namespaces ns :macro-mappings sym])
+                  (ns-resolve 'cljs.core sym)))]
     (when (:macro (meta var))
       var)))


Added stub method for execute.

Added stub method for execute.

--- leiningen/cluster.clj
+++ leiningen/cluster.clj
@@ -1,10 +1,5 @@
 (ns leiningen.cluster
   (:use [leiningen.compile :only (eval-in-project)]))
-
-(defn destroy-cluster []
-  `(do (println "Running destroy-cluster.")
-       (forma.hadoop.cluster/destroy-cluster)
-       (println "Cluster destroyed! Hit Control-C to exit.")))

 (defn create-cluster
   [node-type node-count]
@@ -13,15 +8,25 @@
        (forma.hadoop.cluster/create-cluster ~node-type ~node-count)
        (println "Cluster created! Hit Control-C to exit.")))

+(defn destroy-cluster []
+  `(do (println "Running destroy-cluster.")
+       (forma.hadoop.cluster/destroy-cluster)
+       (println "Cluster destroyed! Hit Control-C to exit.")))
+
+(defn execute-jar
+  "TODO: Fill this out with code for uberjarring, uploading to
+  jobtracker and running a command as the hadoop user."  [])
+
 (defn cluster
-  "Hadoop cluster management task! TODO: Describe subtasks."
+  "Start or destroy a pallet-hadoop cluster."
   ([project]
      (println
       "Go ahead and supply a subtask. Options are create and destroy."))
   ([project subtask & args]
      (let [task-func (case subtask
                            "create" create-cluster
-                           "destroy" destroy-cluster)]
+                           "destroy" destroy-cluster
+                           "execute" execute-jar)]
        (eval-in-project project
                         (apply task-func args)
                         nil nil


changed at button tag

changed at button tag

--- src_cljs/rrm/corecljs.cljs
+++ src_cljs/rrm/corecljs.cljs
@@ -951,7 +951,7 @@
       [:div.row
        [:div.col-sm-8.col-md-offset-5
         [button-tool-bar
-         [button {:bs-style "primary" :on-click search } "Search"]
+         [button {:bs-style "btn btn-primary"  :on-click search } "Search"]
          [button {:bs-style "primary"  :on-click add} "Add New"]
          [button {:id "getall" :bs-style "primary" :on-click get-all-click} "Refresh"]]
         ]]]]]


Update printing code

Update printing code

--- ClojureScript/replete/src/replete/pprint.cljs
+++ ClojureScript/replete/src/replete/pprint.cljs
@@ -48,14 +48,27 @@
   [kw theme text]
   [:span [:pass (kw theme)] [:text text] [:pass (:reset-font theme)]])

+(defn- visit-default
+  "Delegates to ClojureScript for printing a value."
+  [x]
+  [:text (binding [*print-meta* false] (pr-str x))])
+
 (defrecord RepletePrinter [symbols print-meta print-length print-level print-namespace-maps theme]

   fipp.visit/IVisitor

   (visit-unknown [this x]
     (cond
+      (instance? Atom x)
+      (pretty-coll this "#object [" ['cljs.core.Atom {:val @x}] :line "]" visit)
+      (instance? Volatile x)
+      (pretty-coll this "#object [" ['cljs.core.Volatile {:val @x}] :line "]" visit)
+      (satisfies? IPrintWithWriter x)
+      (visit-default x)
       (instance? Eduction x)
-      (visit this (sequence x))
+      (if print-length
+        (fipp.visit/visit-seq this (into [] (take (inc print-length)) x))
+        (visit this (sequence x)))
       (array? x)
       (pretty-coll this "#js [" x :line "]" visit)
       (object? x)
@@ -67,9 +80,8 @@
           (fn [printer [k v]]
             [:span (visit printer k) " " (visit printer v)])))
       :else
-      [:text (binding [*print-meta* false] (pr-str x))]))
-
-
+      (visit-default x)))
+
   (visit-nil [this]
     (wrap-theme :results-font theme "nil"))


let bind the children

let bind the children

--- src/atom_finder/classifier/reversed-subscript.clj
+++ src/atom_finder/classifier/reversed-subscript.clj
@@ -17,8 +17,9 @@
 (defn reversed-subscript-atom?
   "Is this node a reversed-subscript-atom?"
   [node]
-  (and (instance? IASTArraySubscriptExpression node)
-       ;;the first and second children are the expressions outside and inside the brackets, respectively
-       ;;IBasicType covers expr-types that can be used as indices
-       (basic-expr-type? (first (children node)))
-       (not (basic-expr-type? (last (children node))))))
+  (let [[expr1 expr2] (children node)]
+    (and (instance? IASTArraySubscriptExpression node)
+         ;;the first and second children are the expressions outside and inside the brackets, respectively
+         ;;IBasicType covers expr-types that can be used as indices
+         (basic-expr-type? expr1)
+         (not (basic-expr-type? expr2)))))


Move the winner to the top of the list.

Move the winner to the top of the list.

--- src/clj/made_merits/service/leaderboard_users.clj
+++ src/clj/made_merits/service/leaderboard_users.clj
@@ -2,6 +2,12 @@
     (:require [made-merits.service.winner-calculator :as winner-calculator]
               [made-merits.service.score-calculator :as score-calculator]))

-  (defn presentable
-    [db-users]
-    (winner-calculator/with-winner (score-calculator/with-score db-users)))
+(defn with-winner-first
+  [scored-users-with-merits]
+  (reverse (sort-by #(= "winner" (:status %)) scored-users-with-merits)))
+
+(defn presentable
+  [db-users]
+  (with-winner-first
+    (winner-calculator/with-winner
+      (score-calculator/with-score db-users))))


external resources added to compose file

--- src/clj/swarmpit/docker/engine/mapper/compose.clj
+++ src/clj/swarmpit/docker/engine/mapper/compose.clj
@@ -2,20 +2,25 @@
   (:require [clojure.string :as str]
             [clojure.set :refer [rename-keys]]
             [swarmpit.utils :refer [clean select-keys*]]
+            [swarmpit.docker.utils :refer [trim-stack]]
             [swarmpit.yaml :refer [->yaml]])
   (:refer-clojure :exclude [alias]))

+(defn in-stack?
+  [stack-name map]
+  (= stack-name (:stack map)))
+
 (defn alias
-  [key stackName map]
+  [key stack-name map]
   (let [name (get map key)]
-    (if (= stackName (:stack map))
-      (str/replace name (str stackName "_") "")
+    (if (in-stack? stack-name map)
+      (trim-stack stack-name name)
       name)))

 (defn group
-  [stackName fn coll]
+  [stack-name fn coll]
   (->> coll
-       (map #(fn stackName %))
+       (map #(fn stack-name %))
        (into {})))

 (defn environment
@@ -28,32 +33,51 @@

 (defn resource
   [{:keys [cpu memory]}]
-  {:cpus   (some-> cpu (str))
-   :memory (some-> memory (str "M"))})
+  {:cpus   (when (< 0 cpu) (str cpu))
+   :memory (when (< 0 memory) (str memory "M"))})

 (defn service
-  [stackName service]
-  {(keyword (alias :serviceName stackName service))
+  [stack-name service]
+  {(keyword (alias :serviceName stack-name service))
    {:image       (-> service :repository :image)
     :environment (->> service :variables
                       (map #(str (:name %) "=" (:value %))))
     :ports       (->> service :ports
                       (map #(str (:hostPort %) ":" (:containerPort %) (when (= "udp" (:protocol %)) "/udp"))))
     :volumes     (->> service :mounts
-                      (map #(str (alias :host stackName %) "=" (:containerPath %) (when (:readOnly %) ":ro"))))
-    :networks    (->> service :networks (map #(alias :networkName stackName %)))
+                      (map #(str (alias :host stack-name %) "=" (:containerPath %) (when (:readOnly %) ":ro"))))
+    :networks    (->> service :networks (map #(alias :networkName stack-name %)))
     :deploy      {:mode      (when-not (= "replicated" (:mode service)) (:mode service))
                   :placement {:constraints (->> service :deployment :placement (map :rule))}
                   :resources {:reservations (-> service :resources :reservation resource)
                               :limits       (-> service :resources :limit resource)}}}})

 (defn network
-  [stackName net]
-  {(keyword (alias :networkName stackName net)) (select-keys net [:driver])})
+  [stack-name net]
+  {(keyword (alias :networkName stack-name net))
+   (if (in-stack? stack-name net)
+     {:driver      (:driver net)
+      :internal    (when (:internal net) true)
+      :driver_opts (:options net)}
+     {:external true})})

 (defn volume
-  [stackName volume]
-  {(keyword (alias :volumeName stackName volume)) (select-keys volume [:driver])})
+  [stack-name volume]
+  {(keyword (alias :volumeName stack-name volume))
+   (if (in-stack? stack-name volume)
+     {:driver      (:driver volume)
+      :driver_opts (:options volume)}
+     {:external true})})
+
+(defn secret
+  [_ secret]
+  {(keyword (:secretName secret))
+   {:external true}})
+
+(defn config
+  [_ config]
+  {(keyword (:configName config))
+   {:external true}})

 (defn ->compose
   [stack]
@@ -61,5 +85,7 @@
     (-> {:version  "3"
          :services (group name service (:services stack))
          :networks (group name network (:networks stack))
-         :volumes  (group name volume (:volumes stack))}
+         :volumes  (group name volume (:volumes stack))
+         :configs  (group name config (:configs stack))
+         :secrets  (group name secret (:secrets stack))}
         (clean))))


Jonathan/Tony Remove tests

Jonathan/Tony Remove tests

Removing test code

--- test/checkin/core_test.clj
+++ test/checkin/core_test.clj
@@ -1,8 +1,8 @@
 (ns checkin.core-test
   (:require [clojure.test :refer :all]
-            [checkin.core :refer :all]))
+            [checkin.handler :refer :all]))

-(deftest shouldReturn200
+#_(deftest shouldReturn200
   (let [response (home {})]
     (testing "success"
       (is (= 200 (:status response))))))


add analyze test to test-runner

add analyze test to test-runner

--- test/cljs/test-runner.cljs
+++ test/cljs/test-runner.cljs
@@ -15,4 +15,5 @@
 (defn runner []
   (test/run-tests
    (test/empty-env ::test/default)
-   'greffe.core-test))
+   'greffe.core-test
+   'greffe.analyze-test))


Transient numargs

Transient numargs

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

--- src/conexp/contrib/algorithms/downing_gallier.clj
+++ src/conexp/contrib/algorithms/downing_gallier.clj
@@ -36,14 +36,14 @@
                                                 numargs))]
     (loop [queue   (into (clojure.lang.PersistentQueue/EMPTY)
                          empty-premise-implications),
-           numargs numargs
+           numargs (transient numargs)
            result  input-set]
       (if (empty? queue)
         result
         (let [idx             (first queue),
               new             (difference (conclusion (implications idx)) result)
               [numargs queue] (reduce (fn [[numargs queue] i]
-                                        (let [numargs (assoc numargs i (dec (get numargs i)))]
+                                        (let [numargs (assoc! numargs i (dec (get numargs i)))]
                                           [numargs (if (pos? (get numargs i))
                                                      queue
                                                      (conj queue i))]))


Remove dead header code

Remove dead header code

--- src-cljs/frontend/components/app.cljs
+++ src-cljs/frontend/components/app.cljs
@@ -164,9 +164,6 @@

                 [:div.main-body
-                 (when (and (not (feature/enabled? :ui-v2))
-                            show-header-and-footer?)
-                   (om/build header/header app-without-container-data))
                  (om/build dom-com app)

                  (when (and show-header-and-footer? (config/footer-enabled?))


making svg work again

making svg work again

--- src-cljs/frontend/components/build_timings.cljs
+++ src-cljs/frontend/components/build_timings.cljs
@@ -154,7 +154,6 @@
                                          (highlight-selected-step! step selected)
                                          (highlight-selected-container! %)))
             (.on   "mouseout"  #(reset-selected! step))
-            ;(.on   "click"     (partial scroll-to-step owner))
           (.append "title")
             (.text #(gstring/format "%s (%s:%s) - %s"
                                     (aget % "name")
@@ -205,9 +204,8 @@
         (.attr "class" class-name)
         (.call axis)))

-(defn draw-chart! [{:keys [parallel steps start_time stop_time] :as build}]
-  (let [root    (om/get-node owner "build-timings-svg")
-        x-scale (create-x-scale start_time stop_time)
+(defn draw-chart! [root {:keys [parallel steps start_time stop_time] :as build}]
+  (let [x-scale (create-x-scale start_time stop_time)
         chart   (create-root-svg root parallel)
         x-axis  (create-x-axis (duration start_time stop_time))
         y-axis  (create-y-axis parallel)]
@@ -221,11 +219,12 @@
     om/IDidMount
     (did-mount [_]
       (when build
-        (draw-chart! build))
+        (draw-chart! (om/get-node owner "build-timings-svg") build))
       (om/set-state! owner [:resize-key]
                      (disposable/register
                       (gevents/listen js/window "resize"
                                       #(draw-chart!
+                                        (om/get-node owner "build-timings-svg")
                                         (om/get-props owner)))
                       gevents/unlistenByKey)))

@@ -236,7 +235,7 @@
     om/IDidUpdate
     (did-update [_ _ _]
       (when build
-        (draw-chart! build)))
+        (draw-chart! (om/get-node owner "build-timings-svg") build)))

     om/IRenderState
     (render-state [_ _]


comment out reflect namespace from repl test

--- samples/repl/src/repl/test.cljs
+++ samples/repl/src/repl/test.cljs
@@ -8,7 +8,8 @@

 (ns repl.test
   (:require [clojure.browser.repl :as repl]
-            [clojure.reflect :as reflect]))
+            ;[clojure.reflect :as reflect]
+            ))

 (repl/connect "http://localhost:9000/repl")


CMR-6431: Updated docstring.

CMR-6431: Updated docstring.

--- system-int-test/test/cmr/system_int_test/search/granule_orbit_search_test.clj
+++ system-int-test/test/cmr/system_int_test/search/granule_orbit_search_test.clj
@@ -89,7 +89,7 @@
                                                    :format-key :dif10})]
     (index/wait-until-indexed)

-    (testing "Orbit search will not throw exception."
+    (testing "Orbit search will not throw exception when crossing range is nil"
       (let [coords [0.0 0.08983152841195585 -0.07779640160194513 -0.044915750404640076
                     0.07779640160194509 -0.04491575040464015 0.0 0.08983152841195585]
             found (search/find-refs :granule


ask if the user is empty

ask if the user is empty

--- frontend/components/build_head.cljs
+++ frontend/components/build_head.cljs
@@ -242,7 +242,7 @@
             usage-queued? (build-model/in-usage-queue? build)
             plan (get-in data [:project-data :plan])
             user (:user data)
-            logged-in? (not (empty user))
+            logged-in? (not (empty? user))
             config-data (:config-data build-data)]
         (html
          [:div.build-head-wrapper


passing clone spec

passing clone spec

--- src/celestial/persistency/systems.clj
+++ src/celestial/persistency/systems.clj
@@ -118,10 +118,12 @@

 (defn clone-system
   "clones an existing system"
-  [id {:keys [hostname owner]}]
+  [id {:keys [hostname owner] :as clone-spec}]
   (add-system
     (-> (get-system id)
-      (assoc :owner owner) (assoc-in [:machine :hostname] hostname) clone)))
+      (assoc :owner owner)
+      (assoc-in [:machine :hostname] hostname)
+      (clone clone-spec))))

 (defn systems-for
   "grabs all the systems ids that this user can see"


make not-run status grey and change icon to (-)

--- src-cljs/frontend/components/pages/workflow.cljs
+++ src-cljs/frontend/components/pages/workflow.cljs
@@ -23,11 +23,10 @@

 (defn- status-class [run-status]
   (case run-status
-    :run-status/not-run :status-class/waiting
     :run-status/running :status-class/running
     :run-status/succeeded :status-class/succeeded
     :run-status/failed :status-class/failed
-    :run-status/canceled :status-class/stopped))
+    (:run-status/canceled :run-status/not-run) :status-class/stopped))

 (defn- cancelable-status? [run-status]
   (contains? #{:run-status/not-run


remove redundant require

remove redundant require

--- test/java_time/dev/gen.clj
+++ test/java_time/dev/gen.clj
@@ -169,8 +169,7 @@
       [";; NOTE: This namespace is generated by java-time.dev.gen"
        `(~'ns ~'java-time
           (:refer-clojure :exclude ~'(zero? range iterate max min contains? format abs))
-          (:require ~'[java-time.util :as jt.u]
-                    ~@(sort require-macros)))
+          (:require ~@(sort require-macros)))
        (format "(let [lock (the-ns 'java-time) do-load (delay (locking lock (require %s #?@(:bb [] :default ['java-time.mock]))))]\n  (defn load-java-time \"Load java-time implementation\" [] @do-load))"
                (str/join " " (map #(str "'" %) (sort (disj require-fns 'java-time.mock)))))
        '(if *compile-files*
@@ -179,10 +178,16 @@
             (.start (Thread. (fn [] (load-java-time))))))]
       (apply import-vars (:macros impl-info))
       (apply import-vars (:fns impl-info))
-      (map #(list 'jt.u/when-threeten-extra %) (apply import-vars (:threeten-extra-fns impl-info))))))
+      (map #(list 'java-time.utils/when-threeten-extra %) (apply import-vars (:threeten-extra-fns impl-info))))))
+
+(defn print-form [form]
+  (cond
+    (string? form) (println form)
+    :else (println (pr-str form)))
+  nil)

 (defn print-java-time-ns []
-  (run! #(println (cond-> % (not (string? %)) pr-str)) (gen-java-time-ns-forms)))
+  (run! print-form (gen-java-time-ns-forms)))

 (defn spit-java-time-ns []
   (spit "src/java_time.cljc" (with-out-str (print-java-time-ns))))


CMR-2480: Changed prn-str to pr-str

CMR-2480: Changed prn-str to pr-str

--- metadata-db-app/src/migrations/033_replace_tags_namespace_and_value_with_tag_key.clj
+++ metadata-db-app/src/migrations/033_replace_tags_namespace_and_value_with_tag_key.clj
@@ -29,8 +29,8 @@
           metadata (-> metadata
                        (assoc :tag-key tag-key)
                        (dissoc :namespace :value :category)
-                       (prn-str)
-                       (util/string->gzip-bytes))
+                       pr-str
+                       util/string->gzip-bytes)
           result (assoc result :metadata metadata :native_id tag-key)]
       (j/update! (config/db) "cmr_tags" result ["id = ?" id]))))

@@ -54,7 +54,7 @@
                        (assoc :namespace namespace
                               :value value)
                        (dissoc :tag-key)
-                       (prn-str)
-                       (util/string->gzip-bytes))
+                       pr-str
+                       util/string->gzip-bytes)
           result (assoc result :metadata metadata :native_id native-id)]
       (j/update! (config/db) "cmr_tags" result ["id = ?" id]))))


associated tests to '[]' if no tests

associated tests to '[]' if no tests

--- src-cljs/frontend/components/insights/project.cljs
+++ src-cljs/frontend/components/insights/project.cljs
@@ -229,7 +229,7 @@
             :target "_blank"}
         "test metadata documentation"]
        "."]
-      (and (nil? tests)
+      (and (not (nil? tests))
            (empty? tests))
       [:span "No failed tests to show."]

@@ -330,6 +330,8 @@
                                     (map insights/add-queued-time))
               failed-tests (get-in state state/failed-builds-tests-path)
               junit-enabled? (get-in state state/failed-builds-junit-enabled?-path)]
+         (if (nil? failed-tests)
+           (assoc-in state state/failed-builds-tests-path []))
          (html
           [:div.insights-project
            (om/build insights-metadata state)


Devcard only includes build-head-content

Punting on the tabbed build info for now.

--- src-cljs/frontend/components/pages/build/head.cljs
+++ src-cljs/frontend/components/pages/build/head.cljs
@@ -377,27 +377,27 @@
               :timer-atom (timer/initialize)}})

   (defcard-om not-running
-    build-head
+    build-head-content
     (update-in sample-data [:build-data :build] assoc
                :status "not_running"
                :queued_at nil)
     card-opts)

   (defcard-om queued
-    build-head
+    build-head-content
     (update-in sample-data [:build-data :build] assoc
                :status "queued")
     card-opts)

   (defcard-om running
-    build-head
+    build-head-content
     (update-in sample-data [:build-data :build] assoc
                :status "running"
                :start_time "2017-02-23T18:14:20.541Z")
     card-opts)

   (defcard-om success
-    build-head
+    build-head-content
     (update-in sample-data [:build-data :build] assoc
                :status "success"
                :start_time "2017-02-23T18:14:20.541Z"
@@ -405,7 +405,7 @@
     card-opts)

   (defcard-om canceled
-    build-head
+    build-head-content
     (update-in sample-data [:build-data :build] assoc
                :status "canceled"
                :start_time "2017-02-23T18:14:20.541Z"


Implement project api token deletion modal

--- src-cljs/frontend/components/project_settings.cljs
+++ src-cljs/frontend/components/project_settings.cljs
@@ -1352,11 +1352,14 @@
                                     :type #{:shrink :right}
                                     :cell-fn
                                     (fn [token]
-                                      (table/action-button
-                                       "Remove"
-                                       (icon/delete)
-                                       #(raise! owner [:deleted-project-api-token {:project-id project-id
-                                                                                :token (:token token)}])))}]}))]]])))))
+                                      (om/build remove-action-button
+                                                {:confirmation-question
+                                                 (str "Are you sure you want to remove the API token \""
+                                                      (:label token)
+                                                      "\"?")
+                                                 :remove-fn
+                                                 #(raise! owner [:deleted-project-api-token {:project-id project-id
+                                                                                :token (:token token)}])}))}]}))]]])))))

 (defn heroku [data owner]
   (reify


code headers are now properly vertically centered

--- src/day8/re_frame_10x/view/event.cljs
+++ src/day8/re_frame_10x/view/event.cljs
@@ -61,9 +61,10 @@
         open?      (get-in @(rf/subscribe [:code/code-open?]) open?-path)
         debug?     @(rf/subscribe [:settings/debug?])]
     [rc/h-box
-     :style {:border   code-border
-             :overflow "hidden"
-             :padding  "1px 6px"}
+     :align    :center
+     :style    {:border   code-border
+                :overflow "hidden"
+                :padding  "1px 6px"}
      :children [[rc/box
                  :width  "17px"
                  :height "17px"
@@ -75,8 +76,7 @@
                           :margin "auto"
                           :child  [:span.arrow (if open? "▼" "▶")]]]
                 [:pre
-                 {:style {:margin-left "2px"
-                          :margin-top  "2px"}}
+                 {:style {:margin-left "2px"}}
                  (str (:form line))
                  (when debug?
                    [:span {:class "code-fragment__result"} " " (pp/truncate-string 100 (pr-str (:result line)))])]]]))
@@ -179,6 +179,7 @@
   []
   (let [code-traces      @(rf/subscribe [:code/current-code])
         code-execution   (first code-traces) ;; Ignore multiple code executions for now
+        debug?           @(rf/subscribe [:settings/debug?])
         highlighted-form (rf/subscribe [:code/highlighted-form])]
     ;(println "EVENT-CODE")
     (if-not code-execution
@@ -186,7 +187,7 @@
       [rc/v-box
        :size "1 1 auto"
        :class "code-panel"
-       :children [#_(when debug? [:pre "Hover " (pr-str @highlighted-form) "\n"])
+       :children [(when debug? [:pre "Hover " (pr-str @highlighted-form) "\n"])
                   [event-expression]
                   [rc/gap-f :size common/gs-19s]
                   [event-fragments (->> (:code code-execution)


Expose InfraResult

Expose InfraResult

--- src/dda/pallet/dda_user_crate/app.clj
+++ src/dda/pallet/dda_user_crate/app.clj
@@ -20,6 +20,8 @@
    [dda.pallet.dda-config-crate.infra :as config-crate]
    [dda.pallet.dda-user-crate.infra :as infra]
    [dda.pallet.dda-user-crate.domain :as domain]))
+
+(def InfraResult domain/InfraResult)

 (def UserAppConfig
   {:group-specific-config


Minor change.

Minor change.

--- src/cmr/umm/echo10/collection/two_d_coordinate_system.clj
+++ src/cmr/umm/echo10/collection/two_d_coordinate_system.clj
@@ -10,11 +10,10 @@

 (defn xml-elem->TwoDCoordinateSystems
   [collection-element]
-  (let [two-ds (map xml-elem->TwoDCoordinateSystem
+  (seq (map xml-elem->TwoDCoordinateSystem
                     (cx/elements-at-path
                       collection-element
-                      [:TwoDCoordinateSystems :TwoDCoordinateSystem]))]
-    (when-not (empty? two-ds) two-ds)))
+                      [:TwoDCoordinateSystems :TwoDCoordinateSystem]))))

 (defn generate-two-ds
   [two-d-coordinate-systems]


bumped up cljs

bumped up cljs

--- src/leiningen/new/reagent/project.clj
+++ src/leiningen/new/reagent/project.clj
@@ -12,7 +12,7 @@
                  [reagent "0.5.0"]
                  [reagent-forms "0.5.0"]
                  [reagent-utils "0.1.4"]
-                 [org.clojure/clojurescript "0.0-3169" :scope "provided"]
+                 [org.clojure/clojurescript "0.0-3178" :scope "provided"]
                  [ring "1.3.2"]
                  [ring/ring-defaults "0.1.4"]
                  [prone "0.8.1"]


Fix corridors

Fix corridors

--- src/cljc/robinson/dungeons/temple.cljc
+++ src/cljc/robinson/dungeons/temple.cljc
@@ -110,6 +110,43 @@
   (map (fn [[from to]]
          [(read-string from) (read-string to)])
        (graph/MST-kruskal g true)))
+
+(defn additional-edges
+  "`room-centers` is a list of [x y]
+   `g` is a list of xy point pairs eg: [[[x y] [x y]] [[x y] [x y]] ...]"
+  [min-width min-height room-centers g]
+  (let [edges
+        (sort-by (fn [[[x1 y1] [x2 y2]]]
+                   (+ (rand-int 2) (rc/chebyshev-distance (rc/xy->pos x1 y1) (rc/xy->pos x2 y2))))
+                 (for [room-center-1 room-centers
+                       room-center-2 room-centers
+                       :when (let [[x1 y1] room-center-1
+                                   [x2 y2] room-center-2]
+                               (and ; rooms should not connect to themselves
+                                    ;(not= room-center-1 room-center-2)
+                                    ; rooms should connect only to rooms in the same row or column
+                                    (or (< (Math/abs (- x1 x2)) (+ min-width 3))
+                                        (< (Math/abs (- y1 y2)) (+ min-height 3)))
+                                    ; only close together rooms should be connected, but it must be greater than 0
+                                    ;  (ie exclude room from connecting to itself.
+                                    (let [d (rc/chebyshev-distance (rc/xy->pos x1 y1) (rc/xy->pos x2 y2))]
+                                      (< 0 d (+ min-width min-height 5)))
+                                    ; always connect from the upper left to the lower right
+                                    (< (+ (* x1 1000) y1) (+ (* x2 1000) y2))
+                                    ;; don't connect any rooms that are already connected
+                                    (not-any? (fn [room-center-pair]
+                                                (println "room-center-pair" room-center-pair)
+                                                (or (= room-center-pair
+                                                       [room-center-1 room-center-2])
+                                                    (= room-center-pair
+                                                       [room-center-2 room-center-1])))
+                                              g)))]
+                   [room-center-1 room-center-2]))]
+    (println "all extra edges" (reduce (fn [edges [[x1 y1] [x2 y2]]]
+                                         (conj edges [[x1 y1] [x2 y2] (rc/chebyshev-distance (rc/xy->pos x1 y1) (rc/xy->pos x2 y2))]))
+                                       []
+                                       edges))
+    (take 5 edges)))

 (defn vertical-or-horizontally-aligned?
   [& xys]
@@ -310,7 +347,7 @@
                                               (if (nil? canvas-cell) {:type :nil} canvas-cell))}))))
                            cells-xy))
         cells (f canvas)]
-   (print-cells cells)
+   ;(print-cells cells)
    cells))

 (defn rand-int-range [min max]
@@ -350,6 +387,8 @@
         fcg          (points-to-fully-connected-graph room-centers)
         ;; g is a list of [[x1 y1] [x2 y2]] elements. List of pairs of points.
         g            (graph-to-minimum-spanning-tree fcg)
+        more-edges   (additional-edges min-width min-height room-centers g)
+        g            (concat g more-edges)
         ;; reduce over g
         cells        (reduce (fn [cells [start goal]]
                                (let [points (make-corridor-points cells room-centers-to-room-bounds start goal)]
@@ -359,8 +398,9 @@
                              g)
         upstairs     (conj [(first room-centers)] {:type :up-stairs})
         downstairs   (conj [(last room-centers)] {:type :down-stairs})]
-    (println "fcg" fcg)
+    ;(println "fcg" fcg)
     (println "g" g)
+    (println "more-edges" more-edges)
     ;(println (vec room-bounds))
     ;(println (vec rooms))
     {:place cells #_(apply merge-with-canvas (canvas width height)


edit evidences fix, refactor

edit evidences fix, refactor

--- src/cljs/salava/badge/ui/evidence.cljs
+++ src/cljs/salava/badge/ui/evidence.cljs
@@ -47,22 +47,22 @@
                     :name (:name evidence)
                     :url (:url evidence)
                     :narrative (:narrative evidence)
-                    :properties {:hidden (get-in evidence [:properties :hidden])}}]
+                    :properties {:resource_type (get-in evidence [:properties :resource_type]) :hidden (get-in evidence [:properties :hidden])}}]
     (swap! state assoc :evidence evidence)))

 (defn toggle-show-evidence! [id data state init-data]
   (let [visibility-atom (cursor state [:evidence :properties :hidden])
         new-value (not @visibility-atom)
-        badgeid (:id data)
+        badgeid (:id @state)
         init-settings (first (plugin-fun (session/get :plugins) "modal" "show_settings_dialog"))]
     (ajax/POST
       (path-for (str "/obpv1/badge/toggle_evidence/" id))
       {:params {:show_evidence new-value
                 :user_badge_id badgeid}
-       #_:handler #_(fn [data]
-                  (prn data)
-                  #_(when (= (:status data) "success")
-                    (init-settings (:id data) state init-data "settings"))
+       :handler (fn [data]
+                  ;eset! visibility-atom new-value)
+                  (when (= (:status data) "success")
+                    (init-settings badgeid state init-data "settings"))
                   )})))

 (defn set-page-visibility-to-private [page-id]
@@ -72,7 +72,8 @@
      :handler (fn [data])}))

 (defn save-badge-evidence [data state init-data]
-  (let [{:keys [id name narrative url resource_visibility resource_id resource_type mime_type]} (:evidence @state)
+  (let [{:keys [id name narrative url resource_visibility properties]} (:evidence @state)
+        {:keys [resource_type mime_type resource_id]} properties
         badge-id (:id data)
         init-settings (first (plugin-fun (session/get :plugins) "modal" "show_settings_dialog"))]
     (swap! state assoc :evidence {:message nil})
@@ -148,11 +149,11 @@
                                             :evidence {:url value
                                                        :name name
                                                        :narrative description
-                                                       :mime_type mime_type
-                                                       :resource_id id
-                                                       :resource_type (case key
-                                                                        :page_input "page"
-                                                                        :file_input "file")
+                                                       :properties {:mime_type mime_type
+                                                                    :resource_id id
+                                                                    :resource_type (case key
+                                                                                :page_input "page"
+                                                                                :file_input "file")}
                                                        :resource_visibility visibility})) }
       (case key
         :page_input [:div.resource  [:i.fa.fa-file-text-o] name]
@@ -316,7 +317,7 @@
                    :on-click #(do

                                 (.preventDefault %)
-                                (if (= @input-mode :url_input) (reset! (cursor state [:evidence :resource_type] ) "url"))
+                                (if (= @input-mode :url_input) (reset! (cursor state [:evidence :properties :resource_type] ) "url"))
                                 (save-badge-evidence data state init-data)

                                 ;(reset! (cursor state [:show-form]) false)
@@ -332,24 +333,31 @@
 (defn evidence-list [data state init-data]
   (let [evidence-name-atom (cursor state [:evidence :name])
         evidence-narrative-atom (cursor state [:evidence :narrative])
-        visibility-atom (cursor state [:evidence :properties :hidden])]
+        ]
     (reduce (fn [r evidence]
-              (let [{:keys [narrative description name id url mtime ctime evidence_type properties]} evidence
+              (let [{:keys [narrative description name id url mtime ctime properties]} evidence
                     {:keys [resource_id resource_type mime_type hidden]} properties
                     added-by-user? (and (not (blank? description)) (starts-with? description "Added by badge recipient"))
                     desc (cond
                            (not (blank? narrative)) narrative
                            (not added-by-user?) description ;;todo use regex to match description
                            :else nil)]
-                (prn @visibility-atom)
-                (init-evidence-form evidence state true)
                 (conj r
                       (when-not (blank? url)
                         [:div.panel.panel-default
                          [:div.panel-heading {:id (str "heading" id)
                                               :role "tab"}
                           [:div.panel-title
-                           [:div.url [:div {:style {:float "left"}} [evidence-icon evidence_type]] (hyperlink url)]
+                           [:div.url [:div {:style {:float "left"}} [evidence-icon {:type resource_type :mime_type mime_type}]]
+                            (case resource_type
+                              "file" (hyperlink url)
+                              "page" (if (session/get :user)
+                                       [:a {:href "#"
+                                            :on-click #(do
+                                                         (.preventDefault %)
+                                                         (mo/open-modal [:page :view] {:page-id resource_id}))} url]
+                                       (hyperlink url))
+                              (hyperlink url))]
                            (when-not (blank? name) [:div.inline [:label (t :badge/Name) ": "] name])
                            (when-not (blank? desc) [:div [:label (t :admin/Description) ": "]   desc])]

@@ -358,8 +366,9 @@
                                           :class "close evidence-toggle"
                                           :on-click #(do
                                                        (.preventDefault %)
-                                                       (toggle-show-evidence! id data state init-data))} [:i.fa.show-more {:class (if @visibility-atom (str " fa-toggle-off") (str " fa-toggle-on"))
-                                                                                :title (if @visibility-atom (t :badge/Showevidence) (t :badge/Showevidence))}]]]
+                                                       (init-evidence-form evidence state true)
+                                                       (toggle-show-evidence! id data state init-data))} [:i.fa.show-more {:class (if (= true hidden) (str " fa-toggle-off") (str " fa-toggle-on"))
+                                                                                :title (t :badge/Showevidence)}]]]
                           (when added-by-user?
                             [:div [:div [:button {:type "button"
                                                   :aria-label "OK"


refactor evidence input

refactor evidence input

--- src/cljs/salava/badge/ui/settings.cljs
+++ src/cljs/salava/badge/ui/settings.cljs
@@ -189,11 +189,12 @@

     [:div {:id "badge-settings" :class "row flip"}
      [:div {:class "col-md-3 badge-image modal-left"}
-      [:img {:src (str "/" image_file) :alt name}]]
+      [:img {:src (str "/" image_file) :alt name}]
+      ]
      [:div {:class "col-md-9 settings-content settings-tab"}
       (if @message [:div @message])
       [:div
-       [:div.row [:label.col-md-9.sub-heading (t :badge/Addnewevidence)]]
+       [:div.row {:style {:margin-bottom "10px"}} [:label.col-md-9.sub-heading (t :badge/Addnewevidence)]]
        [:div.evidence-info (t :badge/Evidenceinfo)]

        [:div.row.form-horizontal
@@ -218,7 +219,13 @@
                        :href "#":on-click #(do
                                              (.preventDefault %)
                                              (evidence/toggle-input-mode :file_input state))
-                       } [:i.fa.fa-files-o] (t :page/Files)]]]]]
+                       } [:i.fa.fa-files-o] (t :page/Files)]]
+           [:div.cancel [:a {:href "#":on-click #(do
+                                                   (.preventDefault %)
+                                                   (swap! state assoc :tab [settings-tab-content (dissoc data :evidence) state init-data]
+                                                          :tab-no 2))}
+
+                         [:i.fa.fa-remove] (t :core/Cancel)]]]]]

         ;;Preview
@@ -251,34 +258,70 @@
                  [:div.col-md-9
                   [evidence/input {:name "narrative" :rows 5 :cols 40 :atom evidence-narrative-atom } true]]]])

-             ]]])
+             ]
+            [:div.add
+             [:button {:type "button"
+                       :class "btn btn-primary"
+                       :disabled (not (url? @evidence-url-atom))
+                       :on-click #(do
+                                    (.preventDefault %)
+                                    (if (= @input-mode :url_input) (reset! (cursor state [:evidence :properties :resource_type] ) "url"))
+                                    (evidence/save-badge-evidence data state init-data)
+                                    (when-not @(cursor state [:evidence :message])(swap! state assoc :tab [settings-tab-content data state init-data]
+                                                                                :tab-no 2)))}
+              (t :core/Add)]]]])

         ;;url input
-        (when (= @input-mode :url_input) [:div
-                                          [:div.col-md-12
-                                           [:div.resource-container {:style {:margin-bottom "10px"}}
-                                            [evidence/input {:name "evidence-url" :atom evidence-url-atom :type "url" :placeholder "http://" :preview? (cursor state [:show-preview])}]]]])
+        (when (= @input-mode :url_input)
+          [:div.preview.evidence-list.col-md-9
+           [:div.panel.panel-default
+            [:div.panel-heading
+             [:div.panel-title
+              [:div.url [:i.fa.fa-link]] [evidence/input {:name "evidence-url" :atom evidence-url-atom :type "url" :placeholder "http://"}]]]
+            [:div.panel-body.evidence-panel-body
+             [:div [:div.form-group
+                    [:label.col-md-3 "Name"]
+                    [:div.col-md-9
+                     [evidence/input {:name "name" :atom evidence-name-atom :type "text"} nil]]]
+              [:div.form-group
+               [:label.col-md-3 (t :page/Description)]
+               [:div.col-md-9
+                [evidence/input {:name "narrative" :rows 5 :cols 40 :atom evidence-narrative-atom } true]]]]]
+            [:div.add
+             [:button {:type "button"
+                       :class "btn btn-primary"
+                       :disabled (not (url? @evidence-url-atom))
+                       :on-click #(do
+                                    (.preventDefault %)
+                                    (reset! (cursor state [:evidence :properties :resource_type] ) "url")
+                                    (evidence/save-badge-evidence data state init-data)
+                                    (when-not @(cursor state [:evidence :message])(swap! state assoc :tab [settings-tab-content data state init-data]
+                                                                                :tab-no 2)))}
+              (t :core/Add)]]]]
+          #_[:div.resource-container {:style {:margin-bottom "10px"}}
+             [evidence/input {:name "evidence-url" :atom evidence-url-atom :type "url" :placeholder "http://" :preview? (cursor state [:show-preview])}]])
+
         ;;Resource grid
         (when-not @(cursor state [:show-preview])[evidence/resource-input data state init-data])

         ;;Buttons
-        [:div.col-md-12
-         [:hr]
-         (when @(cursor state [:show-preview])[:button {:type "button"
-                                                        :class "btn btn-primary"
-                                                        :disabled (not (url? @evidence-url-atom))
-                                                        :on-click #(do
-                                                                     (.preventDefault %)
-                                                                     (if (= @input-mode :url_input) (reset! (cursor state [:evidence :properties :resource_type] ) "url"))
-                                                                     (evidence/save-badge-evidence data state init-data)
-                                                                     (when-not @(cursor state [:evidence :message])(swap! state assoc :tab [settings-tab-content data state init-data]
-                                                                                :tab-no 2)))}
-                                               (t :core/Add)])
-         [:a.cancel {:on-click #(do
-                                  (.preventDefault %)
-                                  (swap! state assoc :tab [settings-tab-content (dissoc data :evidence) state init-data]
-                                         :tab-no 2))}
-          (t :core/Cancel)]]]]]]))
+        #_[:div.col-md-12
+           [:hr]
+           (when @(cursor state [:show-preview])[:button {:type "button"
+                                                          :class "btn btn-primary"
+                                                          :disabled (not (url? @evidence-url-atom))
+                                                          :on-click #(do
+                                                                       (.preventDefault %)
+                                                                       (if (= @input-mode :url_input) (reset! (cursor state [:evidence :properties :resource_type] ) "url"))
+                                                                       (evidence/save-badge-evidence data state init-data)
+                                                                       (when-not @(cursor state [:evidence :message])(swap! state assoc :tab [settings-tab-content data state init-data]
+                                                                                :tab-no 2)))}
+                                                 (t :core/Add)])
+           [:a.cancel {:on-click #(do
+                                    (.preventDefault %)
+                                    (swap! state assoc :tab [settings-tab-content (dissoc data :evidence) state init-data]
+                                           :tab-no 2))}
+            (t :core/Cancel)]]]]]]))

 (defn evidence-list [data state init-data]
   (let [evidence-name-atom (cursor state [:evidence :name])
@@ -329,7 +372,7 @@
                                       :on-click #(do
                                                    (.preventDefault %)
                                                    (evidence/init-evidence-form evidence state true)
-                                                   (evidence/toggle-show-evidence! id data state init-data))} [:i.fa.show-more {:class (if (= true hidden) (str " fa-toggle-off") (str "fa-toggle-on"))
+                                                   (evidence/toggle-show-evidence! id data state init-data))} [:i.fa.show-more {:class (if (= true hidden) (str " fa-toggle-off") (str " fa-toggle-on"))
                                                                                }]]]
                            (when added-by-user?
                              [:div [:div [:button {:type "button"
@@ -337,24 +380,33 @@
                                                    :class "close panel-edit"
                                                    :on-click #(do (.preventDefault %)
                                                                 (evidence/init-evidence-form evidence state true))
-                                                   :role "button" :data-toggle "collapse"
+                                                   :role "button"
+                                                   :data-toggle "collapse"
+                                                   :data-target (str "#collapse" id)
                                                    :data-parent "#accordion"
                                                    :href (str "#collapse" id)
                                                    :aria-expanded "true"
-                                                   :aria-controls (str "collapse" id)}
+                                                   ;:aria-controls (str "collapse" id)
+                                                   }
                                           [:i.fa.fa-edit.edit-evidence]]];;edit-button

                               [:div [:button {:type "button"
                                               :aria-label "OK"
                                               :class "close"
-                                              :on-click #(do (.preventDefault %)(evidence/delete-evidence! id data state init-data))}
+                                              :data-toggle "collapse"
+                                              ;data-target (str "#collapse" id)
+                                              :on-click #(do (.preventDefault %)
+                                                           (evidence/delete-evidence! id data state init-data))
+                                              :aria-expanded "false"
+                                              :aria-controls (str "collapse" id)
+                                              }
                                      [:i.fa.fa-trash.trash]]] ;;delete-button
                               ])]

-                          [:div {:id (str "collapse" id)
-                                 :class "panel-collapse collapse"
-                                 :role "tabpanel"
-                                 :aria-labelledby (str "heading" id)}
+                          [:div.panel-collapse {:id (str "collapse" id)
+                                                :class "collapse"
+                                                :role "tabpanel"
+                                                :aria-labelledby (str "heading" id)}
                            [:div.panel-body.evidence-panel-body {:style {:padding-top "10px"}}
                             [:div.form-group
                              [:label.col-md-3 (t :badge/Name)]
@@ -364,7 +416,7 @@
                              [:label.col-md-3 (t :page/Description)]
                              [:div.col-md-9
                               [evidence/input {:name "narrative" :rows 5 :cols 40 :atom evidence-narrative-atom } true]]]
-                            [:hr]
+                            ;[:hr]
                             [:div
                              [:button {:type         "button"
                                        :class        "btn btn-primary"


Remove useless code.

Remove useless code.

--- src/continuo/postgresql/connection.clj
+++ src/continuo/postgresql/connection.clj
@@ -37,7 +37,6 @@
   (-create [it] (boot/create it))
   (-get-connection [_] (sc/context datasource
                            {:isolation-level :serializable}))
-
   impl/ITransactor
   (-transact [it facts]
     (tx/transact it facts))
@@ -94,10 +93,3 @@
 (defmethod impl/connect :postgresql
   [uri options]
   (exec/submit (partial make-connection uri options)))
-
-(defmethod impl/connect :postgresql-test
-  [uri options]
-  (let [conn +test-connection+]
-    (assert conn "Connection should exists")
-    (exec/submit
-     #(TestTransactor. conn (atom nil)))))


Fix hiccup structure

Fix hiccup structure

--- src/day8/re_frame/trace/app_state.cljs
+++ src/day8/re_frame/trace/app_state.cljs
@@ -36,14 +36,15 @@
   (if (number? jsonml)
     jsonml
     (let [[head & args]             jsonml
-          tagnames                  #{"span" "ol" "li" "div"}]
+          tagnames                  #{"div" "span" "ol" "li" "table" "tr" "td"}]
       (cond
         (contains? tagnames head)   (let [[style & children] args]
-                                      [(keyword head) {:style (-> (js->clj style)
-                                                                  (get "style")
-                                                                  (string->css))}
-                                       (into [:div {:style {:display "inline-block"}}]
-                                             (mapv jsonml->hiccup children))])
+                                      (into
+                                        [(keyword head) {:style (-> (js->clj style)
+                                                                    (get "style")
+                                                                    (string->css))}]
+                                        (map jsonml->hiccup children)))
+
         (= head "object")           [data-structure jsonml]
         (= jsonml ", ")             " "
         :else jsonml))))


run :before-save callbacks on old-record with non-cassandra cols

so that protected columns don't get removed from the old-record
when those cols are being updated

--- src/er_cassandra/model/alia/upsert.clj
+++ src/er_cassandra/model/alia/upsert.clj
@@ -186,11 +186,25 @@
               (= (t/extract-uber-key-value entity old-record)
                  (t/extract-uber-key-value entity record))))

-  (ddo [:let [opts (ts/default-timestamp-opt opts)]
-
-        ;; serialize the old-record and record
+  (ddo [:let [opts (ts/default-timestamp-opt opts)
+
+              ;; get the non-cassandra key-vals to use on the :before-save
+              ;; callback on the old-record
+              non-cassandra-cols (->> record
+                                      keys
+                                      (filter (complement cassandra-column-name?)))
+              non-cassandra (select-keys record non-cassandra-cols)]
+
+        ;; serialize the old-record... give it the non-cassandra cols from the
+        ;; record so that e.g. protected cols don't get removed if they
+        ;; are being updated
         old-record-ser (when old-record
-                         (t/run-callbacks session entity :before-save old-record opts))
+                         (t/run-callbacks
+                          session
+                          entity
+                          :before-save
+                          (merge non-cassandra old-record)
+                          opts))
         record-ser (t/run-callbacks session entity :before-save record opts)

         :let [record-keys (-> record keys set)


#10 read config

#10 read config

--- src/kalar_plugins/templates/hiccup.clj
+++ src/kalar_plugins/templates/hiccup.clj
@@ -65,7 +65,7 @@
                  (kfile/touch output#)
                  (spit output# ~body)))))))))

-(defmacro def-excerpts [head-url tail-url-ptn dir num-perpage body]
+(defmacro def-excerpts [head-url tail-url-ptn num-perpage body]
   `(def hiccup#
      (reify HiccupPlugin
        (hiccup-compile [this]
@@ -78,7 +78,7 @@
                                             (= num# 1) {:previous-page nil :next-page (if (> total# 1) (get-url# 2))}
                                             true {:previous-page (if (= num# 1) ~head-url (get-url# (- num# 1)))
                                                   :next-page (if (= total# num#) nil (get-url# (+ num# 1)))}))
-               parts# (partition-all ~num-perpage (.listFiles (io/file ~dir)))
+               parts# (partition-all ~num-perpage (.listFiles (io/file (-> (config/read-config) :posts-dir))))
                index-abst-map# (zipmap (range 1 (+ 1 (count parts#))) parts#)
                first-abst# (first index-abst-map#)
                rest-absts# (rest index-abst-map#)


(last ... instead of (first (reverse ...

--- clj_record/core.clj
+++ clj_record/core.clj
@@ -62,7 +62,7 @@
   (dosync (commute all-models-metadata assoc model-name (ref {}))))

 (defmacro init-model [& options]
-  (let [model-name (first (reverse (re-split #"\." (name (ns-name *ns*)))))
+  (let [model-name (last (re-split #"\." (name (ns-name *ns*))))
         optional-forms (defs-from-options model-name options)]
     (setup-model-metadata model-name)
     `(do


update figwheel + clojurescript

update figwheel + clojurescript

update figwheel to 0.39 and ClojureScript to 1.7.122

--- src/leiningen/new/chestnut/project.clj
+++ src/leiningen/new/chestnut/project.clj
@@ -9,7 +9,7 @@
   :test-paths [{{{clj-test-src-path}}}]

   :dependencies [[org.clojure/clojure "1.7.0"]
-                 [org.clojure/clojurescript "1.7.48" :scope "provided"]
+                 [org.clojure/clojurescript "1.7.122" :scope "provided"]
                  [ring "1.4.0"]
                  [ring/ring-defaults "0.1.5"]
                  [slester/ring-browser-caching "0.1.1"]
@@ -53,8 +53,8 @@
   :profiles {:dev {:source-paths ["env/dev/clj"]
                    :test-paths ["test/clj"]

-                   :dependencies [[figwheel "0.3.7"]
-                                  [figwheel-sidecar "0.3.7"]
+                   :dependencies [[figwheel "0.3.9"]
+                                  [figwheel-sidecar "0.3.9"]
                                   [com.cemerick/piggieback "0.2.1"]
                                   [org.clojure/tools.nrepl "0.2.10"]
                                   [weasel "0.7.0"]{{{project-dev-deps}}}]
@@ -62,7 +62,7 @@
                    :repl-options {:init-ns {{project-ns}}.server
                                   :nrepl-middleware [cemerick.piggieback/wrap-cljs-repl{{{nrepl-middleware}}}]}

-                   :plugins [[lein-figwheel "0.3.7"]{{{project-dev-plugins}}}]
+                   :plugins [[lein-figwheel "0.3.9"]{{{project-dev-plugins}}}]

                    :figwheel {:http-server-root "public"
                               :server-port 3449


Upgrade re-frame to 1.1.0

Upgrade re-frame to 1.1.0

--- src/leiningen/new/re_frame/project.clj
+++ src/leiningen/new/re_frame/project.clj
@@ -6,7 +6,7 @@
                                org.clojure/google-closure-library-third-party]]
                  [thheller/shadow-cljs "2.11.0"]
                  [reagent "0.10.0"]
-                 [re-frame "1.0.0"]{{#10x?}}
+                 [re-frame "1.1.0"]{{#10x?}}
                  [day8.re-frame/tracing "0.6.0"]{{/10x?}}{{#re-com?}}
                  [re-com "2.8.0"]{{/re-com?}}{{#routes?}}
                  [clj-commons/secretary "1.2.4"]{{/routes?}}{{#garden?}}


Added last couple of Cypher-based validation checks.

--- src/alfresco_technical_validation/validation.clj
+++ src/alfresco_technical_validation/validation.clj
@@ -45,7 +45,7 @@
   [source]
   (comment "####TODO!!!!"))

-(defn- sanitised-api-list
+(defn- cypher-escaped-alfresco-api
   []
   (map #(s/escape % cypher-value-escapes) (alf-api/public-java-api)))

@@ -56,9 +56,9 @@
         values-2 (.substring values-1 0 (- (.length values-1) 1))]
     (s/replace query "{in-clause-values}" values-2)))

-(defn- validate-alfresco-api-usage
+(defn- api01-public-alfresco-java-api
   []
-  (let [alfresco-public-java-api (sanitised-api-list)
+  (let [alfresco-public-java-api (cypher-escaped-alfresco-api)
         cypher-query             (populate-in-clause "
                                                        START n=NODE(*)
                                                        MATCH (n)-->(m)
@@ -76,7 +76,7 @@
         res                      (cy/tquery cypher-query)]
     (println "res =" res)))  ;####TEST

-(defn- validate-java-version
+(defn- com06-compiled-jvm-version
   []
   (let [res (cy/tquery "
                          START n=NODE(*)
@@ -88,7 +88,7 @@
                        ")]
     (println "res =" res)))    ;####TEST

-(defn- validate-java-api-usage
+(defn- sec04-stb03-stb04-stb05-stb06-stb10-stb12-java-apis
   []
   (let [res (cy/tquery "
                          START n=NODE(*)
@@ -126,15 +126,63 @@
                        ")]
     (println "res =" res)))    ;####TEST

+(defn- stb07-stb14-search-apis
+  []
+  (let [res (cy/tquery "
+                         START n=NODE(*)
+                         MATCH (n)-->(m)
+                         WHERE HAS(n.name)
+                           AND HAS(m.name)
+                           AND m.name IN [
+                                           'org.alfresco.service.cmr.search.SearchService',
+                                           'org.alfresco.service.cmr.search.ResultSet'
+                                         ]
+                        RETURN m.name AS SearchAPI, COLLECT(DISTINCT n.name) AS UsedBy
+                         ORDER BY m.name
+                       ")]
+    (println "res =" res)))    ;####TEST
+
+(defn- sec02-minimise-manual-authentication
+  []
+  (let [res (cy/tquery "
+                         START n=NODE(*)
+                         MATCH (n)-->(m)
+                         WHERE HAS(n.name)
+                           AND HAS(m.name)
+                           AND m.name = 'org.alfresco.repo.security.authentication.AuthenticationUtil'
+                        RETURN n.name AS Class, m.name AS AuthenticationUtil
+                         ORDER BY n.name
+                       ")]
+    (println "res =" res)))    ;####TEST
+
+(defn- stb06-stb18-manual-transactions
+  []
+  (let [res (cy/tquery "
+ START n=NODE(*)
+ MATCH (n)-->(m)
+ WHERE HAS(n.name)
+   AND HAS(m.name)
+   AND m.name IN [
+                  'org.alfresco.repo.transaction.RetryingTransactionHelper',
+                  'org.alfresco.service.transaction.TransactionService'
+                 ]
+RETURN n.name AS Class, COLLECT(DISTINCT m.name) AS TransactionClass
+ ORDER BY n.name
+                       ")]
+    (println "res =" res)))    ;####TEST
+
+
 (defn- validate-criteria
   [neo4j-url
    source-index]
   (nr/connect! neo4j-url)
-  (validate-alfresco-api-usage)
-  (validate-java-version)
-  (validate-java-api-usage)
+  (api01-public-alfresco-java-api)
+  (com06-compiled-jvm-version)
+  (sec04-stb03-stb04-stb05-stb06-stb10-stb12-java-apis)
+  (stb07-stb14-search-apis)
+  (sec02-minimise-manual-authentication)
+  (stb06-stb18-manual-transactions)
   )
-

 (defn validate
   "Validates the given source and binaries, using the Neo4J server available at the given URL."


rename output fill

rename output fill

--- src/atom_finder/questions/superfluous_parens.clj
+++ src/atom_finder/questions/superfluous_parens.clj
@@ -126,8 +126,8 @@

 (defn main-superfluous-parens
   []
-  (let [edn-file "tmp/all-parens_2018-10-29_03_operator-precedence-child.edn"
-        csv-file "src/analysis/data/all-parens_2018-10-29_03_operator-precedence-child.csv"
+  (let [edn-file "tmp/all-parens_2018-10-30_01_exclude-template-misparses.edn"
+        csv-file "src/analysis/data/all-parens_2018-10-30_01_exclude-template-misparses.csv"
         ]
     (find-all-parens-in-project edn-file)
     (summarize-all-parens edn-file csv-file)


Bypass history/stats check for saving hidden editors in rename symbol

--- src/lt/plugins/cljrefactor/usages.cljs
+++ src/lt/plugins/cljrefactor/usages.cljs
@@ -166,7 +166,8 @@

     (.setSelections cm-ed (clj->js selections))
     (.replaceSelections cm-ed (clj->js (repeat (count selections) new)))
-    (doc/save file (editor/->val ed))
+    ;(doc/save file (editor/->val ed))
+    (files/save file (editor/->val ed))
     (object/destroy! ed)))

 (defn replace-in-open-ed! [ed selections new]


Handle end-of-file in object and array readers

--- src/main/clojure/clojure/data/json.clj
+++ src/main/clojure/clojure/data/json.clj
@@ -278,6 +278,7 @@
     (codepoint-case c
       \] []
       \, (throw (invalid-array-exception))
+      -1 (throw (Exception. "JSON error (end-of-file inside array)"))
       (do (.unread stream c)
           (read-array* stream options)))))

@@ -288,8 +289,9 @@
         (if (= (codepoint \:) (int (next-token stream)))
           key
           (throw (Exception. "JSON error (missing `:` in object)"))))
-      (if (= c (codepoint \}))
-        nil
+      (codepoint-case c
+        \} nil
+        -1 (throw (Exception. "JSON error (end-of-file inside object)"))
         (throw (Exception. (str "JSON error (non-string key in object), found `" (char c) "`, expected `\"`")))))))

 (defn- read-object [^PushbackReader stream options]
@@ -310,6 +312,7 @@
           (codepoint-case (int (next-token stream))
             \, (recur r)
             \} (persistent! r)
+            -1 (throw (Exception. "JSON error (end-of-file inside object)"))
             (throw (Exception. "JSON error (missing entry in object)"))))
         (let [r (persistent! result)]
           (if (empty? r)
@@ -806,4 +809,4 @@
     :escape-unicode false
         to turn off \\uXXXX escapes of Unicode characters."
   [x & options]
-  (apply pprint x options))+  (apply pprint x options))


Update the blurb [ci skip]

Update the blurb [ci skip]

--- frontend/components/project_settings.cljs
+++ frontend/components/project_settings.cljs
@@ -367,7 +367,7 @@
            (describe-flag {:flag :oss
                            :title "Free and Open Source"
                            :blurb [:p
-                                   "Be part of our F/OSS beta! Organizations now have a free container "
+                                   "Be part of our F/OSS beta! Organizations now have three free containers"
                                    "reserved for F/OSS projects; enabling this will allow this project's "
                                    "builds to use it and let others see your builds, both through the "
                                    "web UI and the API."]})


fix :msg and trim white space

fix :msg and trim white space

--- src/node/game/cards.cljs
+++ src/node/game/cards.cljs
@@ -422,9 +422,9 @@
                                            (when (not= (count (get-in old [:runner :hand])) hand-size)
                                              (swap! ref assoc-in [:runner :memory] hand-size))))))
     :leave-play #(remove-watch % :ekomind)}
-
+
    "Elizabeth Mills"
-   {:effect (effect (lose :bad-publicity 1)) :msg "removes 1 bad publicity"
+   {:effect (effect (lose :bad-publicity 1)) :msg "remove 1 bad publicity"
     :abilities [{:cost [:click 1]
                  :prompt "Choose a location to trash" :label "Trash a location"
                  :msg (msg "trashes " (:title target) "and takes 1 bad publicity")


more card implementations

more card implementations

--- src/node/game/cards.cljs
+++ src/node/game/cards.cljs
@@ -66,6 +66,12 @@
    "Amped Up"
    {:effect (effect (gain :click 3) (damage :brain 1))}

+   "Andromeda: Dispossessed Ristie"
+   {:effect (effect (gain :link 1) (draw 4))}
+
+   "Anonymous Tip"
+   {:effect (effect (draw 3))}
+
    "Archived Memories"
    {:prompt "Choose a card from Archives" :choices (req (:discard corp))
     :effect (effect (move target :hand) (system-msg (str "adds " (:title target) " to HQ")))}
@@ -76,11 +82,6 @@
                  :effect #(do (gain %1 :runner :credit 2)
                               (when (zero? (:counter %3)) (trash %1 :runner %3)))}]}

-   "Andromeda: Dispossessed Ristie"
-   {:effect (effect (gain :link 1) (draw 4))}
-
-   "Anonymous Tip"
-   {:effect (effect (draw 3))}

    "Argus Security: Protection Guaranteed"
    {:events {:agenda-stolen
@@ -534,6 +535,10 @@
                                  :effect (effect (move target :deck))
                                  :msg (msg "add " (if (:seen target) (:title target) "a card")
                                            " to the bottom of R&D")} card target))}}}}
+
+   "Hades Shard"
+   {:abilities [{:msg "access all cards in Archives"
+                 :effect (effect (handle-access (:discard corp)) (trash card))}]}

    "Hard at Work"
    {:events {:runner-turn-begins {:msg "gain 2 [Credits] and lose [Click]"
@@ -1295,7 +1300,8 @@

    "Thomas Haas"
    {:advanceable :always
-    :abilities [{:effect (effect (gain :credit (* 2 (:advance-counter card))) (trash card))}]}
+    :abilities [{:label "Gain credits" :msg (msg "gain " (* 2 (:advance-counter card)) " [Credits]")
+                 :effect (effect (gain :credit (* 2 (:advance-counter card))) (trash card))}]}

    "Toshiyuki Sakai"
    {:advanceable :always}
@@ -1601,6 +1607,10 @@
    {:abilities [{:msg "gain 3 [Credits]" :effect (effect (gain :credit 3))}
                 {:msg "end the run" :effect (effect (end-run))}]}

+   "Cell Portal"
+   {:abilities [{:msg "make the Runner to approach the outermost ICE"
+                 :effect #(do (swap! %1 assoc-in [:run :position] 0) (derez %1 %2 %3))}]}
+
    "Changeling"
    {:abilities [{:msg "end the run" :effect (effect (end-run))}]}

@@ -1778,6 +1788,11 @@

    "NEXT Silver"
    {:abilities [{:msg "end the run" :effect (effect (end-run))}]}
+
+   "Orion"
+   {:abilities [{:prompt "Choose a program to trash" :msg "Trash a program" :label "Trash a program"
+                 :choices (req (get-in runner [:rig :program])) :effect (effect (trash target))}
+                {:msg "end the run" :effect (effect (end-run))}]}

    "Paper Wall"
    {:abilities [{:msg "end the run" :effect (effect (end-run))}]}


Change post attribution line formatting, add post date too.

--- src/oc/email/content.clj
+++ src/oc/email/content.clj
@@ -1,12 +1,16 @@
 (ns oc.email.content
   (:require [clojure.string :as s]
             [clojure.walk :refer (keywordize-keys)]
-            [clj-time.format :as format]
+            [clj-time.format :as time-format]
             [hiccup.core :as h]
             [oc.email.config :as config]))

 (def max-logo 32)
 (def author-logo 32)
+
+(def iso-format (time-format/formatters :date-time))
+(def date-format (time-format/formatter "MMMM d"))
+(def date-format-year (time-format/formatter "MMMM d YYYY"))

 (def profile-url (str config/web-url "/profile"))

@@ -243,7 +247,19 @@
         (vspacer 15 "footer-table" "footer-table")]
       [:td {:class "small-1 large-2 columns"}]]])

+;; ----- Posts common ----
+
+(defn- post-date [timestamp]
+  (let [d (time-format/parse iso-format timestamp)]
+    (time-format/unparse date-format d)))
+
+(defn- post-attribution [entry]
+  (paragraph (str "Posted by " (-> entry :publisher :name) " in " (:board-name entry) " on " (post-date (:published-at entry)))
+   "body-block" "text-left attribution"))
+
 ;; ----- Digest -----
+
+

 (defn- post [entry]
   [(spacer 32)
@@ -251,7 +267,7 @@
    (spacer 32)
    (h2 (:headline entry))
    (spacer 16)
-   (paragraph (str (-> entry :publisher :name) " posted in " (:board-name entry)) "body-block" "attribution")
+   (post-attribution entry)
    (spacer 16)
    (read-post-button "Read post" (:url entry))])

@@ -382,7 +398,7 @@
       (spacer 40)
       (h2 headline)
       (spacer 8)
-      (paragraph attribution "body-block" "text-left attribution")
+      (post-attribution entry)
       (spacer 8)
       (read-post-button share-cta entry-url)
       (spacer 24)


Don't explicitly free the id when freeing a node, as this is already handled by a callback fn which is triggered by the server when it has completed freeing the node.

--- src/overtone/sc/node.clj
+++ src/overtone/sc/node.clj
@@ -96,10 +96,11 @@
 ;; n_end event when a synth node is destroyed.

 (defn node-free
-  "Remove a synth node."
+  "Free the specified node-ids on the server."
   [& node-ids]
   {:pre [(connected?)]}
-  (doseq [id node-ids] (free-id :node id 1 #(snd "/n_free" id))))
+  (doseq [id node-ids]
+    (snd "/n_free" id)))

 (defn- node-destroyed
   "Frees up a synth node to keep in sync with the server."


Add error checking to node arguments. All args should be floats, and if they're not we now raise an error rather than sending malformed data to scserver.

--- src/overtone/sc/node.clj
+++ src/overtone/sc/node.clj
@@ -25,6 +25,14 @@
           %)
        col))

+(defn- check-node-args!
+  "Throw an error if one of the arg values is not a float."
+  [args]
+  (doall
+   (map #(if (not (float? (last %)))
+           (throw (Exception. (str "Incorrect param type. Was expecting a float, got " (with-out-str (pr (last %))) ". Full arg list: " (vec args)) )))
+        (partition 2 args))))
+
 ;; ### Node
 ;;
 ;; A Node is an addressable node in a tree of nodes run by the synth engine.
@@ -33,9 +41,9 @@

 ;; Sending a synth-id of -1 lets the server choose an ID
 (defn node
-  "Instantiate a synth node on the audio server.  Takes the synth name and a
-  set of argument name/value pairs.  Optionally use :target <node/group-id>
-  and :position <pos> to specify where the node should be located.  The
+  "Instantiate a synth node on the audio server.  Takes the synth name and a
+  set of argument name/value pairs.  Optionally use :target <node/group-id>
+  and :position <pos> to specify where the node should be located.  The
   position can be one of :head, :tail :before, :after, or :replace.

   (node \"foo\")
@@ -52,7 +60,9 @@
         target (get argmap :target 0)
         args (flatten (seq (-> argmap (dissoc :position) (dissoc :target))))
         args (bus->id args)
-        args (stringify (floatify args))]
+        args (stringify (floatify args))
+        args (remove nil? args)]
+    (check-node-args! args)
     ;(println "node " synth-name id position target args)
     (apply snd "/s_new" synth-name id position target args)
     id))


fix

fix

Signed-off-by: Andrey Shovkoplyas <b713972e59b8e606e23253c4a13e948139fea4d1@gmail.com>

--- src/status_im/chat/views/input/animations/expandable.cljs
+++ src/status_im/chat/views/input/animations/expandable.cljs
@@ -25,7 +25,7 @@
             to-change-height  (if (= to-changed-height :max)
                                 (input-utils/max-container-area-height @chat-input-margin @layout-height)
                                 to-changed-height)
-            to-value          (or to-change-height (or height @to-default-height))]
+            to-value          (or to-change-height height @to-default-height)]
         (re-frame/dispatch [:set :expandable-view-height-to-value to-value])
         (animation/start
           (animation/spring anim-value {:toValue  to-value


Fix facebook social icon links

Fix facebook social icon links

--- frontend/src/faceboard/helpers/social.cljs
+++ frontend/src/faceboard/helpers/social.cljs
@@ -36,7 +36,7 @@
 (defn build-known-url [type id]
   ; TODO: add more services
   (condp #(str/starts-with? %2 %1) type                     ; recognized urls from id
-    "facebook" (str "https://github.com/" id)
+    "facebook" (str "https://www.facebook.com/" id)
     "twitter" (str "https://twitter.com/" id)
     "github" (str "https://github.com/" id)
     "linkedin" (str "https://www.linkedin.com/in/" id)