Refactor to use a common formatting function

--- src/expound/alpha.cljc
+++ src/expound/alpha.cljc
@@ -186,9 +186,7 @@
                             problems)]
     (->> (when (seq no-msgs)
            (printer/format
-            "should satisfy
-
-%s"
+            "should satisfy\n\n%s"
             (preds no-msgs)))
          (conj (keep (fn [{:keys [expound/via]}]
                        (let [last-spec (last via)]
@@ -221,9 +219,7 @@
     (if (string/blank? sp-str)
       ""
       (printer/format
-       "%s
-
-%s"
+       "%s\n\n%s"
        (section-label "Relevant specs")
        sp-str))))

@@ -321,7 +317,7 @@
            nil))))

 ;; TODO - maybe just return these values in an easy to destructure map
-(defn problem-parts [problem opts]
+(defn ^:private problem-parts [problem opts]
   (let [type (:expound.spec.problem/type problem)
         spec-name nil ;; TODO - fix
         val (:val problem)
@@ -337,42 +333,43 @@
      :problems problems
      :form form}))

-(defn expected-str2 [problems opts]
+;; TODO private
+(defn ^:private expected-str2 [problems opts]
   (let [problem (first problems)
         {:keys [type spec-name val in]} (problem-parts problem opts)]
     (expected-str type spec-name val in problems opts)))
+
+(def ^:private format-str "%s\n\n%s\n\n%s")
+(defn ^:private format-err [header spec-name form in expected]
+  (printer/format
+   format-str
+   (header-label header)
+   (show-spec-name spec-name (printer/indent (*value-str-fn* spec-name form in (problems/value-in form in))))
+   expected))

 (defmethod problem-group-str :problem/value-group [_type spec-name val path problems opts]
   (let [problem (first problems)
         subproblems (:problems problem)
         {:keys [form in]} (problem-parts (first subproblems) opts)
         grouped-subproblems (vals (group-by :expound.spec.problem/type subproblems))]
-    (printer/format
-     "%s
-
-%s
-
-%s"
-     (header-label "Spec failed")
-     (show-spec-name spec-name (printer/indent (*value-str-fn* spec-name form in (problems/value-in form in))))
-     (string/join
-      "\n\nor\n\n"
-      (map #(expected-str2 % opts) grouped-subproblems)))))
+    (format-err "Spec failed"
+                spec-name
+                form
+                in
+                (string/join
+                 "\n\nor\n\n"
+                 (map #(expected-str2 % opts) grouped-subproblems)))))

 (defmethod expected-str :problem/missing-key [_type spec-name val path problems opts]
   (explain-missing-keys problems))

 (defmethod problem-group-str :problem/missing-key [_type spec-name val path problems opts]
   (assert (apply = (map :val problems)) (str util/assert-message ": All values should be the same, but they are " problems))
-  (printer/format
-   "%s
-
-%s
-
-%s"
-   (header-label "Spec failed")
-   (show-spec-name spec-name (printer/indent (*value-str-fn* spec-name val path (problems/value-in val path))))
-   (expected-str _type spec-name val path problems opts)))
+  (format-err "Spec failed"
+              spec-name
+              val
+              path
+              (expected-str _type spec-name val path problems opts)))

 (defmethod expected-str :problem/not-in-set [_type _spec-name _val _path problems _opts]
   (let [combined-set (apply set/union (map :pred problems))]
@@ -388,15 +385,11 @@

 (defmethod problem-group-str :problem/not-in-set [_type spec-name val path problems opts]
   (assert (apply = (map :val problems)) (str util/assert-message ": All values should be the same, but they are " problems))
-  (printer/format
-   "%s
-
-%s
-
-%s"
-   (header-label "Spec failed")
-   (show-spec-name spec-name (printer/indent (*value-str-fn* spec-name val path (problems/value-in val path))))
-   (expected-str _type spec-name val path problems opts)))
+  (format-err "Spec failed"
+              spec-name
+              val
+              path
+              (expected-str _type spec-name val path problems opts)))

 (defmethod expected-str :problem/missing-spec [_type spec-name val path problems opts]
   (->> problems
@@ -404,10 +397,9 @@
        (string/join "\n")))

 (defmethod problem-group-str :problem/missing-spec [_type spec-name val path problems opts]
+  ;; TODO - fix when I figure out how to to format this consistent
   (printer/format
-   "%s
-
-%s"
+   "%s\n\n%s"
    (header-label "Missing spec")
    (expected-str _type spec-name val path problems opts)))

@@ -549,30 +541,22 @@
                       (expected-str (-> prob :expound.spec.problem/type) :expound/no-spec-name non-matching-value in [prob] opts))))))))

 (defmethod problem-group-str :problem/insufficient-input [_type spec-name val path problems opts]
-  (printer/format
-   "%s
-
-%s
-
-%s"
-   (header-label "Syntax error")
-   (show-spec-name spec-name (printer/indent (*value-str-fn* spec-name val path (problems/value-in val path))))
-   (expected-str _type spec-name val path problems opts)))
+  (format-err "Syntax error"
+              spec-name
+              val
+              path
+              (expected-str _type spec-name val path problems opts)))

 (defmethod expected-str :problem/extra-input [_type spec-name val path problems opts]
   (s/assert ::singleton problems)
   "has extra input")

 (defmethod problem-group-str :problem/extra-input [_type spec-name val path problems opts]
-  (printer/format
-   "%s
-
-%s
-
-%s"
-   (header-label "Syntax error")
-   (show-spec-name spec-name (printer/indent (*value-str-fn* spec-name val path (problems/value-in val path))))
-   (expected-str _type spec-name val path problems opts)))
+  (format-err "Syntax error"
+              spec-name
+              val
+              path
+              (expected-str _type spec-name val path problems opts)))

 (defmethod expected-str :problem/fspec-exception-failure [_type spec-name val path problems opts]
   (s/assert ::singleton problems)
@@ -589,37 +573,27 @@
      (printer/indent (string/join ", " (:val problem))))))

 (defmethod problem-group-str :problem/fspec-exception-failure [_type spec-name val path problems opts]
-  (printer/format
-   "%s
-
-%s
-
-%s"
-   (header-label "Exception")
-   (printer/indent (*value-str-fn* spec-name val path (problems/value-in val path)))
+  (format-err
+   "Exception"
+   spec-name
+   val
+   path
    (expected-str _type spec-name val path problems opts)))

 (defmethod expected-str :problem/fspec-ret-failure [_type spec-name val path problems opts]
   (s/assert ::singleton problems)
   (let [problem (first problems)]
     (printer/format
-     "returned an invalid value
-
-%s
-
-%s"
+     "returned an invalid value\n\n%s\n\n%s"
      (ansi/color (printer/indent (pr-str (:val problem))) :bad-value)
      (predicate-errors problems))))

 (defmethod problem-group-str :problem/fspec-ret-failure [_type spec-name val path problems opts]
-  (printer/format
-   "%s
-
-%s
-
-%s"
-   (header-label "Function spec failed")
-   (printer/indent (*value-str-fn* spec-name val path (problems/value-in val path)))
+  (format-err
+   "Function spec failed"
+   spec-name
+   val
+   path
    (expected-str _type spec-name val path problems opts)))

 (defmethod expected-str :problem/fspec-fn-failure [_type spec-name val path problems opts]
@@ -638,14 +612,11 @@

 (defmethod problem-group-str :problem/fspec-fn-failure [_type spec-name val path problems opts]
   (s/assert ::singleton problems)
-  (printer/format
-   "%s
-
-%s
-
-%s"
-   (header-label "Function spec failed")
-   (printer/indent (*value-str-fn* spec-name val path (problems/value-in val path)))
+  (format-err
+   "Function spec failed"
+   spec-name
+   val
+   path
    (expected-str _type spec-name val path problems opts)))

 (defmethod expected-str :problem/check-fn-failure [_type spec-name val path problems opts]
@@ -665,11 +636,7 @@
 (defmethod problem-group-str :problem/check-fn-failure [_type spec-name val path problems opts]
   (s/assert ::singleton problems)
   (printer/format
-   "%s
-
-%s
-
-%s"
+   format-str
    (header-label "Function spec failed")
    (ansi/color (printer/indent (pr-str (:expound/check-fn-call (first problems)))) :bad-value)
    (expected-str _type spec-name val path problems opts)))
@@ -700,14 +667,11 @@

 (defmethod problem-group-str :problem/unknown [_type spec-name val path problems opts]
   (assert (apply = (map :val problems)) (str util/assert-message ": All values should be the same, but they are " problems))
-  (printer/format
-   "%s
-
-%s
-
-%s"
-   (header-label (str "Spec failed"))
-   (show-spec-name spec-name (printer/indent (*value-str-fn* spec-name val path (problems/value-in val path))))
+  (format-err
+   "Spec failed"
+   spec-name
+   val
+   path
    (expected-str _type spec-name val path problems opts)))

 (defn ^:private instrumentation-info [failure caller]
@@ -715,8 +679,7 @@
   ;; not include failure or caller info, so
   ;; if these are null, print a placeholder
   (if (= :instrument failure)
-    (printer/format "%s:%s
-\n"
+    (printer/format "%s:%s\n\n"
                     (:file caller "<filename missing>")
                     (:line caller "<line number missing>"))
     ""))


Uncomments out specs and inlines function

--- src/expound/alpha.cljc
+++ src/expound/alpha.cljc
@@ -30,11 +30,10 @@
 (s/def :expound.printer/print-specs? boolean?)
 (s/def :expound.printer/theme #{:figwheel-theme :none})
 (s/def :expound.printer/opts (s/keys
-                              :opt-un [;;:expound.printer/show-valid-values?
+                              :opt-un [:expound.printer/show-valid-values?
                                        :expound.printer/value-str-fn
-                                       ;;:expound.printer/print-specs?
-                                       ;;:expound.printer/theme
-]))
+                                       :expound.printer/print-specs?
+                                       :expound.printer/theme]))

 ;;;;;; themes ;;;;;;

@@ -587,13 +586,6 @@
    (show-spec-name spec-name (printer/indent (*value-str-fn* spec-name val path (problems/value-in val path))))
    (expected-str _type spec-name val path problems opts)))

-;; FIXME - rename
-(defn problem-group-str1 [type spec-name val path problems opts]
-  (str
-   (problem-group-str type spec-name val path problems opts)
-   "\n\n"
-   (if (:print-specs? opts) (relevant-specs problems) "")))
-
 (defn instrumentation-info [failure caller]
   ;; As of version 1.9.562, Clojurescript does
   ;; not include failure or caller info, so
@@ -631,7 +623,10 @@
 %s
 %s %s %s\n"
          (string/join "\n\n" (for [[[in type] probs] problems]
-                               (problem-group-str1 type (spec-name explain-data) form in probs opts)))
+                               (str
+                                (problem-group-str type (spec-name explain-data) form in probs opts)
+                                "\n\n"
+                                (if (:print-specs? opts) (relevant-specs probs) ""))))
          (ansi/color (section-label) :footer)
          (ansi/color "Detected" :footer)
          (ansi/color (count problems) :footer)


Added player, team and model entities.

Added player, team and model entities.

--- src/fist/models/db.clj
+++ src/fist/models/db.clj
@@ -5,20 +5,31 @@

 (defdb db schema/db-spec)

-(defentity users)
+(declare players teams matches)

-(defn create-user [user]
-  (insert users
-          (values user)))
+(defentity players
+  (has-many matches))

-(defn update-user [id first-name last-name email]
-  (update users
-  (set-fields {:first_name first-name
-               :last_name last-name
-               :email email})
-  (where {:id id})))
+(defentity teams
+  (has-many matches))

-(defn get-user [id]
-  (first (select users
+(defentity matches
+  (belongs-to players)
+  (belongs-to teams))
+
+(defn create-player [player]
+  (insert players
+    (values player)))
+
+(defn create-team [team]
+  (insert teams
+    (values team)))
+
+(defn create-match [match]
+  (insert matches
+    (values match)))
+
+(defn get-player [id]
+  (first (select players
                  (where {:id id})
                  (limit 1))))


Silence a warning

Silence a warning

Using un-required namespaces causes a warning about undeclared names on newer Clojure(Script)s, this fix silences it.

--- src/flare/indexed.cljc
+++ src/flare/indexed.cljc
@@ -1,4 +1,5 @@
-(ns flare.indexed)
+(ns flare.indexed
+  (:require [clojure.string :as str]))

 (defn indexed-diff? [m]
   (and (map? m)
@@ -26,7 +27,7 @@
      :else (throw (ex-info "diff-or-coll must be vector or map" diff-or-coll)))))

 (defn join-with-newlines [coll]
-  (clojure.string/join "\n" coll))
+  (str/join "\n" coll))

 (defn report-indexed-diff-entry [[path diffs] report]
   (let [reports (flatten (map report diffs))


Added fix for reagent style "component" support.

--- src/freactive/dom.cljs
+++ src/freactive/dom.cljs
@@ -552,7 +552,7 @@
             (dom-element nil tag-name tail)))

         (fn? head)
-        (r/rx* (fn [] (apply head (rest elem-spec))))
+        (as-velem (r/rx* (fn [] (apply head (rest elem-spec)))))

         :default
         (as-velem (r/seq-projection elem-spec))))


Allow specification of precision defaults

--- src/gamma/program.cljs
+++ src/gamma/program.cljs
@@ -12,14 +12,22 @@
             [gamma.api :as g]))

+(defn precision-defaults [p]
+  (let [x (map (fn [[k v]] (str "precision " (name v) " " (name k) ";\n")) p)]
+    (if (empty? x)
+      ""
+      (apply str x))))

+(defn glsl [shader opts]
+  (let [p (:precision opts)]
+    (str
+      (precision-defaults p)
+      (with-out-str
+       (fipp.printer/pprint-document
+         (emit/emit (:ir shader) shader)
+         {:width 80})))))

-(defn glsl [shader]
-  (with-out-str
-    (fipp.printer/pprint-document
-      (emit/emit (:ir shader) shader)
-      {:width 80})))

 (defn ast [inputs]
   (apply g/block
@@ -29,7 +37,7 @@
            inputs)))

-(defn shader [shader]
+(defn shader [shader opts]
   (let [ast (ast shader)
         ir (gamma.compiler.core/compile ast)
         v (gamma.compiler.core/variables ir)
@@ -52,7 +60,7 @@
         :ir      ir
         :ast     ast}]
       p
-      (assoc p :glsl (glsl p)))))
+      (assoc p :glsl (glsl p opts)))))

@@ -62,13 +70,15 @@
     (filter #(= :uniform (:storage %))
             (:inputs fs))))

-(defn program [x]
-  (let [{:keys [vertex-shader fragment-shader]} x
-        vs (shader vertex-shader) fs (shader fragment-shader)]
-    {:tag             :program
-     :vertex-shader   vs
-     :fragment-shader fs
-     :inputs (program-inputs vs fs)}))
+(defn program
+  ([x] (program x {}))
+  ([x opts]
+   (let [{:keys [vertex-shader fragment-shader]} x
+         vs (shader vertex-shader opts) fs (shader fragment-shader opts)]
+     {:tag             :program
+      :vertex-shader   vs
+      :fragment-shader fs
+      :inputs          (program-inputs vs fs)})))


Fix immutable messenger tests

Fix immutable messenger tests

--- test/onyx/messaging/immutable_messenger_test.clj
+++ test/onyx/messaging/immutable_messenger_test.clj
@@ -63,7 +63,7 @@
                          (m/receive-messages m))
                        (switch-peer m :p3)
                        (range 20))
-        messages (remove nil? (mapcat :messages ms))]
+        messages (map :message (mapcat :messages ms))]
     (is (= [:m1 :m3 :m2 :m4] messages))
     (is (m/all-barriers-seen? (last ms)))

@@ -77,7 +77,7 @@
                             (m/receive-messages m))
                           mnext
                           (range 20))]
-      (is (= [:m5 :m6] (remove nil? (mapcat :messages mss))))
+      (is (= [:m5 :m6] (map :message (mapcat :messages mss))))
       (is (not (m/all-barriers-seen? (last mss))))
       (let [m-p1-acks (-> (last mss)
                           (switch-peer :p1)
@@ -95,9 +95,15 @@
 (deftest atom-messaging-test
   ;; [:t2 :t1] [:t3 :t1]
   (let [pg (component/start (am/atom-peer-group {}))
-        m-p1 (component/start (assoc (am/atom-messenger) :peer-group pg :peer-id :p1))
-        m-p2 (component/start (assoc (am/atom-messenger) :peer-group pg :peer-id :p2))
-        m-p3 (component/start (assoc (am/atom-messenger) :peer-group pg :peer-id :p3))
+        m-p1 (component/start (-> (am/atom-messenger)
+                                  (assoc :peer {:peer-group {:messaging-group pg}
+                                                :id :p1})))
+        m-p2 (component/start (-> (am/atom-messenger)
+                                  (assoc :peer {:peer-group {:messaging-group pg}
+                                                :id :p2})))
+        m-p3 (component/start (-> (am/atom-messenger)
+                                  (assoc :peer {:peer-group {:messaging-group pg}
+                                                :id :p3})))
         t1-queue-p1 {:src-peer-id :p1 :dst-task-id :t1}
         t1-queue-p2 {:src-peer-id :p2 :dst-task-id :t1}
         t2-ack-queue {:src-peer-id :p3 :dst-task-id :t1}
@@ -129,9 +135,7 @@
               (m/next-epoch)
               (m/emit-barrier)
               (m/send-messages [:m5 :m6] [t1-queue-p2]))
-
-
-        messages (remove nil? (mapcat (fn [_] (m/receive-messages m-p3)) (range 20)))]
+        messages (map :message (mapcat (fn [_] (m/receive-messages m-p3)) (range 20)))]
     (is (= [:m1 :m3 :m2 :m4] messages))
     (is (m/all-barriers-seen? m))

@@ -140,9 +144,7 @@
     (let [mnext (-> m-p3
                     (m/ack-barrier)
                     (m/next-epoch))
-          messages2 (remove nil? (mapcat (fn [_] (m/receive-messages m-p3)) (range 20)))
-
-          ]
+          messages2 (map :message (mapcat (fn [_] (m/receive-messages m-p3)) (range 20)))]
       (is (= [:m5 :m6] messages2))
       (is (not (m/all-barriers-seen? mnext)))
       (let [m-p1-acks (m/receive-acks m-p1)
@@ -152,7 +154,9 @@
         (is (not (empty? m-p2-acks)))
         (is (empty? m-p2-next-acks))
         ;; Late joiner :p4 on same queues at p3 should not obtain any messages
-        (let [m-p4 (component/start (am/atom-messenger pg :p4))
+        (let [m-p4 (component/start (-> (am/atom-messenger)
+                                        (assoc :peer {:peer-group {:messaging-group pg}
+                                                      :id :p4})))
               m (-> m-p4
                     (m/set-replica-version 1)
                     (m/add-subscription t1-queue-p1)


minor: update project version in leiningen definition

--- ssclj/jar/project.clj
+++ ssclj/jar/project.clj
@@ -1,4 +1,4 @@
-(defproject com.sixsq.slipstream/ssclj "2.19.1-SNAPSHOT"
+(defproject com.sixsq.slipstream/ssclj "2.19.2-SNAPSHOT"
   :description    "Clojure REST resources"
   :url            "http://sixsq.com"
   :license {:name "Apache License, Version 2.0"
@@ -28,7 +28,7 @@
                  [org.slf4j/slf4j-log4j12                   "1.7.13"]
                  [instaparse                                "1.4.1"]
                 ; ;; Authentication service
-                 [com.sixsq.slipstream/auth                 "2.19.1-SNAPSHOT"]
+                 [com.sixsq.slipstream/auth                 "2.19.2-SNAPSHOT"]
                 ; ;; Environment settings
                  [environ                                   "1.0.1"]
                 ; ;; database


Isolate clj-time correctly in containium spec

--- resources/spec.clj
+++ resources/spec.clj
@@ -57,7 +57,7 @@
                       "clojure\\.core\\.match.*"
                       ;; Alia system deps
                       "qbits.*"
-                      "clj.time.*"
+                      "clj_time.*"
                       "cljs.core.async.*"
                       "clojure.core.async.*"
                       "lamina.*"


support command line option

support command line option

--- src/kondolisp/main.clj
+++ src/kondolisp/main.clj
@@ -25,7 +25,14 @@
    (.getMessage exception)
    #"(\w+\.)+(\w+)?Exception:[ \t]*" ""))

-(defn kondo-repl []
+(defn kondo-repl [& rest]
+  (if (> (count rest) 0)
+    (set-serial-config {:port-name (first rest)})
+    (let [serial-ports (get-serial-ports)]
+      (if (> (count serial-ports) 0)
+	(set-serial-config {:port-name (first serial-ports)})
+	(do (sys-println "No serial port is available")
+	    (System/exit 1)))))
   (open-serial)
   (let [output-queue (LinkedBlockingQueue. ),
 	serial-output-thread
@@ -245,18 +252,22 @@
   )

 (defn -main [& argv]
-  (match argv
-    ("header" "vminst" & rest)
-    (kondolisp.compiler/generate-vminst-header)
-    ;;
-    ("header" "builtin" & rest)
-    (kondolisp.compiler/generate-builtin-header)
-    ;;
-    ("repl" & rest)
-    (kondo-repl)
-    ;;
-    _	(do (sys-println (str argv))
-	    (kondo-gui)))
+  (with-command-line argv
+    "KondoLisp: A dynamic prototyping framework for Arduino"
+    [[serial-port s "Serial port to use" nil]
+     argv]
+    (match argv
+      ("header" "vminst" & rest)
+      (kondolisp.compiler/generate-vminst-header)
+      ;;
+      ("header" "builtin" & rest)
+      (kondolisp.compiler/generate-builtin-header)
+      ;;
+      ("repl" & rest)
+      (kondo-repl serial-port)
+      ;;
+      _	(do (sys-println (str argv))
+	    (kondo-gui))))
   true)


(PE-6748) Update trapperkeeper-webserver-jetty9 dependency for pe-console-services

Bump to 0.9.0 of tk-w-j9 which has a fix for the poodle sslv3 security issue.

--- configs/pe-console-services/pe-console-services.clj
+++ configs/pe-console-services/pe-console-services.clj
@@ -7,7 +7,7 @@
                  [puppetlabs/rbac-ui "{{{pe-rbac-ui-version}}}"]
                  [puppetlabs/pe-activity-service "{{{pe-activity-service-version}}}"]
                  [puppetlabs/pe-trapperkeeper-proxy "{{{pe-trapperkeeper-proxy-version}}}"]
-                 [puppetlabs/trapperkeeper-webserver-jetty9 "0.7.7"]]
+                 [puppetlabs/trapperkeeper-webserver-jetty9 "0.9.0"]]

   :uberjar-name "console-services-release.jar"


CodeMirror to occupy full height

CodeMirror to occupy full height

--- frontend/styles/faceboard/css/editor.clj
+++ frontend/styles/faceboard/css/editor.clj
@@ -5,6 +5,8 @@
 (def styles
   [(>> editor
      [:position :relative]
+     (>> CodeMirror
+       [:height :auto])
      (>> editor-host
        [:border-left "1px dashed #eee"
         :height "100%"


Relocate functions map.

Relocate functions map.

--- src/multihash/core.clj
+++ src/multihash/core.clj
@@ -127,6 +127,12 @@

 ;; Remove automatic constructor function.
 (ns-unmap *ns* '->Multihash)
+
+
+(def functions
+  "Map of supported multihash algorithm keys to hashing functions. Each function
+  should take a source of binary data as the argument and return a multihash."
+  {})

 (defn create
@@ -172,11 +178,6 @@
     (.digest algo)))

-(def functions
-  "Map of supported multihash functions."
-  {})
-
-
 (defmacro ^:private defhash
   "Defines a new convenience hashing function for the given algorithm and system
   digest name."


Don't need system names in algorithms map anymore.

--- src/multihash/core.clj
+++ src/multihash/core.clj
@@ -1,6 +1,5 @@
 (ns multihash.core
   "Core multihash type definition and helper methods."
-  (:refer-clojure :exclude [hash])
   (:require
     [clojure.string :as str])
   (:import
@@ -10,10 +9,10 @@
 ;; ## Hash Function Algorithms

 (def ^:const algorithms
-  "Map of content hashing algorithms to system names and byte encodings."
-  {:sha1     {:code 0x11, :length 20, :system "SHA-1"}
-   :sha2-256 {:code 0x12, :length 32, :system "SHA-256"}
-   :sha2-512 {:code 0x13, :length 64, :system "SHA-512"}
+  "Map of information about the available content hashing algorithms."
+  {:sha1     {:code 0x11, :length 20}
+   :sha2-256 {:code 0x12, :length 32}
+   :sha2-512 {:code 0x13, :length 64}
    :sha3     {:code 0x14, :length 64}
    :blake2b  {:code 0x40, :length 64}
    :blake2s  {:code 0x41, :length 32}})


fix zh json

fix zh json

--- prod/status_im/i18n_resources.cljs
+++ prod/status_im/i18n_resources.cljs
@@ -4,7 +4,7 @@
 (def default-device-language
   (keyword (.-language rn-dependencies/react-native-languages)))

-(def languages [:af :ar :bel :cs :da :de :de_ch :el :en :es :es_419 :es_ar :es_mx :fa :fi :fr :fr_ch :fy :he :hi :hu :id :it_ch :ja :ko :la :lt :lv :ms :nb :ne :nl :pl :pt_br :pt_pt :ro :ru :sl :sr_rs_cyrl :sr_rs :latn :sv :sw :th :tr :uk :ur :vi :zh :zh_Hans_CN :zh_hans :zh_hant :zh_hant_hk :zh_hant_sg :zh_hant_tw :zh_wuu :zh_yue])
+(def languages [:af :ar :bel :cs :da :de :de_ch :el :en :es :es_419 :es_ar :es_mx :fa :fi :fr :fr_ch :fy :he :hi :hu :id :it_ch :ja :ko :la :lt :lv :ms :nb :ne :nl :pl :pt_br :pt_pt :ro :ru :sl :sr_rs_cyrl :sr_rs :latn :sv :sw :th :tr :uk :ur :vi :zh])

 (defonce loaded-languages
   (atom
@@ -59,14 +59,7 @@
       :uk         (js/require "status-modules/translations/uk.json")
       :ur         (js/require "status-modules/translations/ur.json")
       :vi         (js/require "status-modules/translations/vi.json")
-      :zh_Hans_CN (js/require "status-modules/translations/zh_Hans_CN.json")
-      :zh_hans    (js/require "status-modules/translations/zh_hans.json")
-      :zh_hant    (js/require "status-modules/translations/zh_hant.json")
-      :zh_hant_hk (js/require "status-modules/translations/zh_hant_hk.json")
-      :zh_hant_sg (js/require "status-modules/translations/zh_hant_sg.json")
-      :zh_hant_tw (js/require "status-modules/translations/zh_hant_tw.json")
-      :zh_wuu     (js/require "status-modules/translations/zh_wuu.json")
-      :zh_yue     (js/require "status-modules/translations/zh_yue.json")})
+      :zh         (js/require "status-modules/translations/zh.json")})

 (defn valid-language [lang]
   (if (contains? prod-translations lang)


removed comment

removed comment

--- sidecar/src/figwheel_sidecar/repl.clj
+++ sidecar/src/figwheel_sidecar/repl.clj
@@ -332,7 +332,7 @@
                                  (auto/prep-build b)))
                         builds)]
       (println "Reloading Build Configuration")
-      (let [build-ids (initial-build-ids builds' [] #_(:build-ids *autobuild-env*))]
+      (let [build-ids (initial-build-ids builds' [])]
         (set! *autobuild-env* (assoc *autobuild-env*
                                      :build-ids  build-ids
                                      :all-builds builds'))


Remove reflection warning

Remove reflection warning

--- src/wellframe/bayes.clj
+++ src/wellframe/bayes.clj
@@ -2,6 +2,7 @@
   (:require [clojure.string :as s]))

 ;; http://en.wikipedia.org/wiki/Naive_Bayes_spam_filtering
+(set! *warn-on-reflection* true)

 (def max-pr 0.99)
 (def min-pr 0.01)
@@ -46,6 +47,9 @@
                (reduce +))]
     (/ 1.0 (+ 1.0 (Math/exp η)))))

+(defn- replace-all [^String t s v]
+  (.replaceAll t s v))
+
 (defn decompose-message
   "Decompose a string/html message into a tuple of
    [map from <word> -> <count>, # of total words"
@@ -53,7 +57,7 @@
   (let [words (-> message
                   .toLowerCase
                   ;; Remove non text characters
-                  (.replaceAll "[^A-Za-z \n\r]" " ")
+                  (replace-all "[^A-Za-z \n\r]" " ")

                   ;; Split via any whitespace
                   (s/split #"[ \n\r]+"))


Oops. Redefining a key in a dict literal is a bad idea (TM)

--- src/zguide/zhelpers.clj
+++ src/zguide/zhelpers.clj
@@ -26,7 +26,6 @@

             ;; More message parts are coming
             :sndmore ZMQ/SNDMORE
-            :send-more ZMQ/SNDMORE
             :send-more ZMQ/SNDMORE

             ;;; Socket types


add up/down right/left and refactor

add up/down right/left and refactor

--- src/zombie_run/quil.clj
+++ src/zombie_run/quil.clj
@@ -14,6 +14,10 @@
                  :a     :left
                  :w     :up
                  :s     :down
+                 :e     :up-right
+                 :q     :up-left
+                 :z     :down-left
+                 :x     :down-right
                  ;; vim
                  :l     :right
                  :h     :left
@@ -94,16 +98,21 @@
         default-game (z/make-game {:world-size [world-x world-y]})
         game (atom default-game)
         ticker (start-interval #(swap! game z/run-zombie-actions) 100)]
+
     (q/defsketch zombie-run
                  :size [(width* world-x) (width* world-y)]
                  :title "zombie run"
                  :draw #(display-game @game)
                  :setup #(q/frame-rate 20)
                  :key-pressed (fn []
-                                (if (= \newline (q/raw-key))
-                                  (reset! game default-game)
-                                  (when-let [action (get valid-keys (q/key-as-keyword))]
-                                    (swap! game #(z/run-player-action % action)))))
+                                (letfn [(key-newline? []
+                                          (= \newline (q/raw-key)))
+                                        (key->action []
+                                          (get valid-keys (q/key-as-keyword)))
+                                        (key-has-action? []
+                                          (boolean (key->action)))]
+                                  (cond (key-newline?) (reset! game default-game)
+                                        (key-has-action?) (swap! game #(z/run-player-action % (key->action))))))
                  :on-close #(stop-interval ticker))))

 (comment


Ready for release

Ready for release

--- modules/aleph/project.clj
+++ modules/aleph/project.clj
@@ -1,6 +1,6 @@
 ;; Copyright © 2014 JUXT LTD.

-(defproject juxt.modular/aleph "0.0.8-SNAPSHOT"
+(defproject juxt.modular/aleph "0.0.8"
   :description "A modular extension that provides support for aleph"
   :url "https://github.com/juxt/modular/tree/master/modules/aleph"
   :license {:name "The MIT License"


forgot right click path

forgot right click path

--- src-cljs/frontend/components/app.cljs
+++ src-cljs/frontend/components/app.cljs
@@ -75,6 +75,7 @@
                          :key "inner"}
              [:style "#om-app:active{cursor:auto}"]
              (om/build canvas/canvas (select-in app [state/current-tool-path
+                                                     state/right-click-learned-path
                                                      [:drawing :in-progress?]
                                                      [:drawing :relation-in-progress?]
                                                      [:mouse-down]


CMR-6137: Fixed reset fixtures.

CMR-6137: Fixed reset fixtures.

--- elastic-utils-lib/src/cmr/elastic_utils/connect.clj
+++ elastic-utils-lib/src/cmr/elastic_utils/connect.clj
@@ -49,15 +49,16 @@
   "Waits for the elasticsearch cluster health to reach yellow. Pass in a elasticsearch store that
   has a :conn key with the elastisch connection"
   [elastic-store]
-  (when (:timed_out (admin/cluster-health (:conn elastic-store) {:wait_for_status "yellow" :timeout "3s"}))
+  (when (:timed_out (admin/cluster-health
+                     (:conn elastic-store) {:wait_for_status "yellow" :timeout "3s"}))
     (errors/internal-error! "Timed out waiting for elasticsearch to reach a healthy state")))

 (defn- get-elastic-health
   "Returns the elastic health by calling elasticsearch cluster health api"
   [conn]
   (try
-    (admin/cluster-health conn :wait_for_status "yellow"
-                          :timeout (str (hh/health-check-timeout-seconds) "s"))
+    (admin/cluster-health conn {:wait_for_status "yellow"
+                                :timeout (str (hh/health-check-timeout-seconds) "s")})
     (catch Exception e
       (format "Unable to get elasticsearch cluster health, caught exception: %s"
               (.getMessage e)))))


Combined methods

Combined methods

--- src/ardoq/swagger/update_swagger2.clj
+++ src/ardoq/swagger/update_swagger2.clj
@@ -1,6 +1,9 @@
 (ns ardoq.swagger.update-swagger2
   (:require [ardoq.swagger.client :as api]
             [ardoq.swagger.common :as common]))
+
+(defn get-component-by-type [workspace type]
+  (doall (filter #(= type (:type %)) (:components workspace))))

 (defn create-component [client type schema {wid :_id} {_id :_id :as model} type-name]
   (-> (assoc nil (keyword type)
@@ -9,42 +12,21 @@
                :schema schema))
       (common/save-models client)))

+;;This function might not be possible as a single function. If so split into many and use partial
+(defn update-component [client workspace component]
+  "random return")

-(defn update-defs [client models {definitions :definitions} workspace model]
-  (doseq [{def-name :name :as model} models]
+(defn update-components [client components definitions workspace {_id :_id :as model} model-type]
+  (doseq [{def-name :name :as component} components]
     (when-not (first (filter #(= (name %) def-name) (keys definitions)))
-      (api/delete (api/map->Component model) client)))
+      (api/delete (api/map->Component component) client)))
   (reduce (fn [acc [def-name data]]
             (assoc acc (keyword def-name)
-                   (or (some->> (first (filter #(= (name def-name) (:name %)) models))
-                                (str "TO BE UPDATED: "))
-                       (first (vals (create-component client def-name data workspace model "Model"))))))
+                   (or (some->> (first (filter #(= (name def-name) (:name %)) components))
+                                (update-component client workspace))
+                       (first (vals (create-component client def-name data workspace model model-type))))))
           {}
           definitions))
-
-(defn update-parameters [client parameters {paramdefs :parameters} workspace {_id :_id :as model}]
-  (doseq [{param-name :name :as security} parameters]
-    (when-not (first (filter #(= (name %) param-name) (keys paramdefs)))
-      (api/delete (api/map->Component model) client)))
-  (reduce (fn [acc [def-name data]]
-            (assoc acc (keyword def-name)
-                   (or (some->> (first (filter #(= (name def-name) (:name %)) parameters))
-                                (str "TO BE UPDATED: "))
-                       (first (vals (create-component client def-name data workspace model "parameters"))))))
-          {}
-          paramdefs))
-
-(defn update-securities [client securities {securitydefs :securityDefinitions} workspace {_id :_id :as model}]
-  (doseq [{secur-name :name :as security} securities]
-    (when-not (first (filter #(= (name %) secur-name) (keys securitydefs)))
-      (api/delete (api/map->Component model) client)))
-  (reduce (fn [acc [def-name data]]
-            (assoc acc (keyword def-name)
-                   (or (some->> (first (filter #(= (name def-name) (:name %)) securities))
-                                (str "TO BE UPDATED: "))
-                       (first (vals (create-component client def-name data workspace model "securityDefinitions"))))))
-          {}
-          securitydefs))

 (defn update-methods [client]
   "random return"
@@ -77,10 +59,11 @@
   ;;might need to update through the infoTemplate (see swagger-v2 line 17
   ;(clojure.pprint/pprint (:components workspace))
   (let [model (common/find-or-create-model client "Swagger 2.0")
-        defs (update-defs client (doall (filter #(= "Model" (:type %)) (:components workspace))) spec workspace model)
-        params (update-parameters client (doall (filter #(= "Parameters" (:type %)) (:components workspace)))) ;TODO Been unable to find swagger with params to test
-        securs (update-securities client (doall (filter #(= "securityDefinitions" (:type %)) (:components workspace))) spec workspace model)]
+        defs (update-components client (get-component-by-type workspace "Model")  (:definitions spec) workspace model "Model")
+        params (update-components client (get-component-by-type workspace "Parameters")  (:Parameters spec) workspace model "Parameters") ;TODO Been unable to find swagger with params to test
+        securs (update-components client (get-component-by-type workspace "securityDefinitions") (:securityDefinitions spec) workspace model "securityDefinitions")
+        tags {}]
     )
-  ;;check tags
-  (update-operations client (doall (filter #(= "Resource" (:type %)) (:components workspace))) spec workspace)
+  (update-operations client (get-component-by-type workspace "Resource") spec workspace)
+  ;;update tags
   "Random return thats not nil")


+strip-refs

+strip-refs

--- test/babel/test/it.cljc
+++ test/babel/test/it.cljc
@@ -8,7 +8,7 @@
             #?(:cljs [cljs.test :refer-macros [deftest is]])
             #?(:clj [clojure.tools.logging :as log])
             #?(:cljs [babel.logjs :as log])
-            [dag_unify.core :refer [get-in]]))
+            [dag_unify.core :refer [get-in strip-refs]]))

 (deftest present-irregular
   (let [result (generate {:synsem {:subcat '()


improve spacing

improve spacing

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

 (deftest analyze-1
   (let [singular (analyze "compito")


use directory to get language model

use directory to get language model

--- test/babel/test/it.cljc
+++ test/babel/test/it.cljc
@@ -1,6 +1,7 @@
 (ns babel.test.it
   (:refer-clojure :exclude [get-in])
   (:require
+   [babel.directory :refer [models]]
    [babel.engine :as engine]
    [babel.generate :as generate]
    [babel.italiano :refer [analyze fo-ps generate lightning-bolts parse preprocess]]
@@ -21,7 +22,7 @@

 (def medium (grammar/medium))
 (def np-grammar (grammar/np-grammar))
-(def small (grammar/small))
+(defn small [] (-> ((-> models :it)) deref))

 (defn generate-with-medium [spec]
   (generate spec :model medium))
@@ -46,7 +47,7 @@
                                    :sem {:pred :be
                                          :subj {:pred :I}
                                          :tense :present}}}
-                         :model small
+                         :model (small)
                          :do-enrich false)]
     (is (= "io sono" (fo result)))))

@@ -56,7 +57,7 @@
                                    :sem {:subj {:pred :I}
                                          :tense :past
                                          :aspect :perfect}}}
-                         :model small)]
+                         :model (small))]
     (is (not (nil? result)))
     (is (= "io ho bevuto" (fo result)))))

@@ -84,7 +85,7 @@
                                          :subj {:pred :I}
                                          :tense :past
                                          :aspect :perfect}}}
-                         :model small)]
+                         :model (small))]
     (is (not (nil? result)))
     (is (= "io mi sono alzata" (fo result)))))

@@ -94,7 +95,7 @@
                                    :sem {:pred :be-called
                                          :subj {:pred :I}
                                          :iobj {:pred :luisa}}}}
-                         :model small)]
+                         :model (small))]
     (is (not (nil? result)))
     (is (= "io mi chiamo Luisa" (fo result)))))

@@ -167,7 +168,7 @@
                            #(generate {:synsem {:cat :verb
                                                 :sem {:tense :present}
                                                 :subcat '()}}
-                                      :model small)))]
+                                      :model (small))))]
     (is (= do-this-many
            (count (map-fn (fn [expr]
                             (let [fo (fo expr)
@@ -187,7 +188,7 @@
                                                 :sem {:tense :past
                                                       :aspect :progressive}
                                                 :subcat '()}}
-                                      :model small)))]
+                                      :model (small))))]
     (is (= do-this-many
            (count (map-fn (fn [expr]
                             (let [fo (fo expr)
@@ -207,7 +208,7 @@
                                                 :sem {:tense :past
                                                       :aspect :perfect}
                                                 :subcat '()}}
-                                      :model small)))]
+                                      :model (small))))]
     (is (= do-this-many
            (count (map-fn (fn [expr]
                           (let [fo (fo expr)
@@ -225,7 +226,7 @@
                            #(generate {:synsem {:cat :verb
                                                 :sem {:tense :future}
                                                 :subcat '()}}
-                                      :model small)))]
+                                      :model (small))))]
     (is (= do-this-many
            (count (map-fn (fn [expr]
                           (let [fo (fo expr)
@@ -243,7 +244,7 @@
                            #(generate {:synsem {:cat :verb
                                                 :sem {:tense :conditional}
                                                 :subcat '()}}
-                                      :model small)))]
+                                      :model (small))))]
     (is (= do-this-many
            (count (map-fn (fn [expr]
                           (let [fo (fo expr)
@@ -332,7 +333,7 @@
         (generate {:synsem {:sem {:subj {:pred :loro}
                                   :pred :manage
                                   :tense :present}}}
-                  :model small)]
+                  :model (small))]
     (is (= "loro gestiscono" (fo result)))))

 (deftest casa-generate
@@ -517,7 +518,7 @@
                                        :tense :past
                                        :subj {:gender :fem
                                               :pred :loro}}}}
-                       :model small))
+                       :model (small)))
      "loro sono andate")))

 (deftest exists1
@@ -528,7 +529,7 @@
                                        :tense :conditional}}
                         :root {:italiano {:italiano "essere"}}
                         :comp {:synsem {:agr {:number :sing}}}}
-                       :model small))
+                       :model (small)))
          "ci sarebbe")))

 (deftest exists2
@@ -540,7 +541,7 @@
                                        :tense :past}}
                         :root {:italiano {:italiano "essere"}}
                         :comp {:synsem {:agr {:number :sing}}}}
-                       :model small))
+                       :model (small)))
          "c'era")))

 (deftest exists3
@@ -551,7 +552,7 @@
                                        :tense :present}}
                         :root {:italiano {:italiano "essere"}}
                         :comp {:synsem {:agr {:number :sing}}}}
-                       :model small))
+                       :model (small)))
          "c'è")))


Change query cache from being an atom to a ratom

--- src/re_frame/subs.cljc
+++ src/re_frame/subs.cljc
@@ -1,7 +1,7 @@
 (ns re-frame.subs
  (:require
    [re-frame.db        :refer [app-db]]
-   [re-frame.interop   :refer [add-on-dispose! debug-enabled? make-reaction ratom? deref? dispose! reagent-id]]
+   [re-frame.interop   :refer [add-on-dispose! debug-enabled? make-reaction ratom? deref? dispose! reagent-id ratom]]
    [re-frame.loggers   :refer [console]]
    [re-frame.utils     :refer [first-in-vector]]
    [re-frame.registrar :refer [get-handler clear-handlers register-handler]]
@@ -15,7 +15,7 @@
 ;; De-duplicate subscriptions. If two or more equal subscriptions
 ;; are concurrently active, we want only one handler running.
 ;; Two subscriptions are "equal" if their query vectors test "=".
-(def query->reaction (atom {}))
+(def query->reaction (ratom {}))

 (defn clear-subscription-cache!
   "Causes all subscriptions to be removed from the cache.


Add schema-changes-test to cljs test file.

--- test/datomish/test.cljs
+++ test/datomish/test.cljs
@@ -6,6 +6,7 @@
    datomish.promise-sqlite-test
    datomish.db-test
    datomish.query-test
+   datomish.schema-changes-test
    datomish.schema-test
    datomish.sqlite-user-version-test
    datomish.tofinoish-test
@@ -21,6 +22,7 @@
   'datomish.promise-sqlite-test
   'datomish.db-test
   'datomish.query-test
+  'datomish.schema-changes-test
   'datomish.schema-test
   'datomish.sqlite-user-version-test
   'datomish.tofinoish-test


Improved example.

Improved example.

--- examples/sessionexample/src/sessionexample/core.clj
+++ examples/sessionexample/src/sessionexample/core.clj
@@ -15,10 +15,11 @@
 ;; This macro works as decorator

 (defmacro authentication-required
-  [request & body]
-  `(if (authenticated? ~request)
-    (do ~@body)
-    (throw-notauthorized {:msg "Valid user is required"})))
+  [handler]
+  `(fn [request#]
+     (if (authenticated? request#)
+       (~handler request#)
+       (throw-notauthorized {:msg "Valid user is required"}))))

 ;; Views

@@ -43,18 +44,10 @@
 ;; Routes

 (defroutes app
-  (GET "/" request
-    (authentication-required request
-      (home-view request)))
-
-  (GET "/login" request
-    (login-view :get request))
-
-  (POST "/login" request
-    (login-view :post request))
-
-  (GET "/logout" request
-    (logout-view request)))
+  (GET "/" [] (authentication-required home-view))
+  (GET "/login" [] (partial login-view :get))
+  (POST "/login" [] (partial login-view :post))
+  (GET "/logout" [] logout-view))

 ;; Self defined unauthorized handler


improve logging

improve logging

--- src/babel/forest.cljc
+++ src/babel/forest.cljc
@@ -215,7 +215,12 @@
                          result))
                      (do (log/debug (str "no cache: will go through entire lexicon."))
                          nil))
-            complement-candidate-lexemes (if cached cached (flatten (vals lexicon)))]
+            complement-candidate-lexemes (if (not (= true
+                                                     (get-in bolt (concat path [:phrasal]))))
+                                           (if cached cached (flatten (vals lexicon)))
+                                           (do
+                                             (log/error (str "BOLT WANTS PHRASAL: IGNORING LEXICON."))
+                                             nil))]
         (let [semantics (get-in spec [:synsem :sem])]
           (if (not (nil? semantics))
             (if (not (nil? semantics)) (log/debug (str "  with semantics:" (strip-refs semantics))))))
@@ -270,35 +275,55 @@
             (if (empty? return-val)

               ;; else, no complements could be added to this bolt: Throw an exception
-              (let [log-limit 10
+              (let [log-limit 100
+                    log-fn (if (= (get-in bolt (concat path [:phrasal]))
+                                  false)
+                             (fn [message] (log/debug message));; since complement must be phrasal, less logging
+
+                             ;; else: should have found a lexical complement: log all problems: provide logging for diagnostics.
+                             (fn [message] (log/error message)))
+                    throw-exception-if-no-complements-found true
                     message
-                    (str " add-complement to " (get-in bolt [:rule]) " at path: " path " took " run-time " msec, but found no lexical complements for "
-                         "'" (morph from-bolt) "'"
-                         ". Desired complement [:synsem :sem :pred] was: " (strip-refs (get-in bolt (concat path [:synsem :sem :pred])))
-                         ". " (count complement-candidate-lexemes) " complement(s) tried were:"
-                         (str " "
-                              (string/join "," (map morph (take log-limit complement-candidate-lexemes)))
-
-                              "; with preds:"
-                              (string/join "," (map #(get-in % [:synsem :sem :pred]) (take log-limit complement-candidate-lexemes)))
-
-                              "; fail-paths:"
-                              (string/join "," (map #(if (or true (not (fail? (unifyc (get-in % [:synsem :sem :pred])
-                                                                                (get-in bolt (concat path [:synsem :sem :pred]))))))
-                                                       (str "'" (morph %) "':"
-                                                            (fail-path-between (strip-refs %)
-                                                                               (strip-refs (get-in bolt path)))))
-                                                    (take log-limit complement-candidate-lexemes)))
-
-                              (if (< 0 (- (count complement-candidate-lexemes) log-limit))
-                                (str ".. and "
-                                     (- (count complement-candidate-lexemes) log-limit) " more."))))]
-                (log/warn message)
+                    (cond (= (get-in bolt (concat path [:phrasal]))
+                             true)
+                          (str "skipping logging about lexical complements since bolt wants a phrasal complement.")
+                          true
+                          (str " add-complement to " (get-in bolt [:rule]) " at path: " path " took " run-time " msec, but found no lexical complements for "
+                               "'" (morph from-bolt) "'"
+                               ". Bolt wants phrasal-wise: " (get-in bolt (concat path [:phrasal]))
+                               ". Desired complement [:synsem] was: " (strip-refs (get-in bolt (concat path [:synsem])))
+                               ". " (count complement-candidate-lexemes) " complement(s) tried were:"
+                               (str " "
+                                    (string/join "," (map morph (take log-limit complement-candidate-lexemes)))
+
+                                    (if (< 0 (- (count complement-candidate-lexemes) log-limit))
+                                      (str ",.. and "
+                                           (- (count complement-candidate-lexemes) log-limit) " more."))
+
+                                    ";     with preds:   "
+                                    (string/join "," (map #(get-in % [:synsem :sem :pred]) (take log-limit complement-candidate-lexemes)))
+
+                                    ";     fail-paths:   "
+                                    (string/join "," (map #(if (or true (not (fail? (unifyc (get-in % [:synsem :sem :pred])
+                                                                                (get-in bolt (concat path [:synsem :sem :pred]))))))
+                                                             (str "'" (morph %) "':"
+                                                                  (fail-path-between (strip-refs %)
+                                                                                (strip-refs (get-in bolt path)))))
+                                                          (take log-limit complement-candidate-lexemes)))
+
+                                    (if (< 0 (- (count complement-candidate-lexemes) log-limit))
+                                      (str ",.. and "
+                                           (- (count complement-candidate-lexemes) log-limit) " more.")))))]
+                (log-fn message)

                 ;; set to true to work on optimizing generation, since this situation of failing to add any
                 ;; complements is expensive.
-                (if false (exception message))
+                (if (and throw-exception-if-no-complements-found
+                         (not (= true (get-in bolt (concat path [:phrasal])))))
+                  (exception message))
                 )
+
+              ;; else, return-val was not empty.
               (do (log/debug (str "add-complement after adding complement: "
                                   (morph (first return-val)) ",.."))
                   return-val)))))


Expose relation in API

Expose relation in API

--- src/tick/alpha/api.clj
+++ src/tick/alpha/api.clj
@@ -157,6 +157,8 @@
 ;; onwards are free to use by the caller.
 (defn interval? [v] (and (vector? v) (>= (count v) 2)))

+(def relation interval/relation)
+
 (defn duration [interval]
   (let [interval (interval/interval interval)]
     (s/assert :tick.interval/interval interval)


Add entities-where query dispatcher

Add entities-where query dispatcher

--- src/todomvc/rules.cljs
+++ src/todomvc/rules.cljs
@@ -165,6 +165,13 @@
 ;  []
 ;  [?visible-todos <- VisibleTodos])
 ;
+(defquery qav-
+  "(Q)uery (A)ttribute (V)alue. Finds facts matching args attribute and value"
+  [:?a :?v]
+  [:all [[e a v]] (= e ?e) (= a ?a) (= v ?v)])
+(defn qav [session a v]
+  (clara-tups->maps
+    (query session qav- :?a a :?v v)))
 ;(defquery find-todos
 ;  []
 ;  [?todos <- (acc/all) :from [Todo]])
@@ -228,3 +235,11 @@
 (cljs.pprint/pprint (entity session (:db/id (first (clara-tups->maps all-done)))))

 (cljs.pprint/pprint (find-by-attribute session :ui/visibility-filter))
+
+(defn entities-where
+  "Returns hydrated entities matching an attribute-only or an attribute-value query"
+  ([session a] (map #(entity session (:db/id %)) (find-by-attribute session a)))
+  ([session a v] (map #(entity session (:db/id %)) (qav session a v))))
+
+(cljs.pprint/pprint (map #(entity session (:db/id %)) (qav session :todo/status :done)))
+(cljs.pprint/pprint (entities-where session :todo/status :done))


fix docstr example

fix docstr example

--- src/cljc/commos/delta/compscribe.cljc
+++ src/cljc/commos/delta/compscribe.cljc
@@ -267,9 +267,9 @@

   Example spec:

-  [:users {:user/orders [:orders {:order/invoice [:invoices]
-                                  :order/item [:items]}]
-           :user/cart [:items]}]
+  [:users [:user {:user/orders [:order {:order/invoice [:invoice]
+                                        :order/item [:item]}]
+                  :user/cart [:item]}]]

   Subscriptions are coordinated, meaning nested subscriptions are
   streamed always after a delta that started them and never after a


simple hook to load fonts without breakage

--- src/cljs/infinitelives/pixi/font.cljs
+++ src/cljs/infinitelives/pixi/font.cljs
@@ -1,5 +1,6 @@
 (ns infinitelives.pixi.font
   (:require [cljs.core.async :refer [put! chan <! >! alts! timeout close!]]
+            [clojure.string :as string]
             [infinitelives.utils.console :refer [log]]
             [infinitelives.utils.dom :as dom]
             [infinitelives.pixi.sprite :as sprite]
@@ -290,6 +291,18 @@
           (recur r (+ xp w))
           [(+ xp w x) y])))))

+(defn- make-google-font-uri [font-family]
+  (str "http://fonts.googleapis.com/css?family="
+       (string/replace font-family #" " "+")))
+
+(defn google
+  "Load in one or more specified google font by name"
+  [[font & rest]]
+  (when font
+    (install-google-font-stylesheet! (make-google-font-uri font))
+    (install-google-font-dom-anchor! font)
+    (recur rest)))
+

 ;; install the installer??
 (install-google-webfont-script!)


add extra dom stuff so we could use it in fonts

--- src/cljs/infinitelives/utils/dom.cljs
+++ src/cljs/infinitelives/utils/dom.cljs
@@ -7,6 +7,12 @@
   (if (keyword? s)
     (str (some-> (namespace s) (str "/")) (name s))
     s))
+
+(defn parent [elem]
+  (.-parentNode elem))
+
+(defn children [elem]
+  (.-children elem))

 (defn set-style!
   "Set the style of `elem` using key-value pairs:
@@ -23,3 +29,46 @@
   ([parent child]
      (doto parent
        (.appendChild child))))
+
+(defn create-element
+  ([tag]
+     (.createElement js/document (as-str tag)))
+  ([tag-ns tag]
+     (.createElementNS
+      js/document (as-str tag-ns) (as-str tag))))
+
+(defn insert-before!
+  "Insert `elem` before `other`, `other` must have a parent"
+  [elem other]
+  (let [p (parent other)]
+    (assert p "Target element must have a parent")
+    (.insertBefore p elem other)
+    elem))
+
+(defn set-attr!
+  "Sets dom attributes on and returns `elem`.
+   Attributes without values will be set to their name:
+       (set-attr! elem :disabled)
+   With values, the function takes variadic kv pairs:
+       (set-attr! elem :id \"some-id\"
+                       :name \"some-name\")"
+  ([elem k] (set-attr! elem k (as-str k)))
+  ([elem k v]
+     (let [k (as-str k)]
+       (when v
+         (if (fn? v)
+           (doto elem (aset k v))
+           (doto elem (.setAttribute k v))))))
+  ([elem k v & kvs]
+     (assert (even? (count kvs)))
+     (doseq [[k v] (->> kvs (partition 2) (cons [k v]))]
+       (set-attr! elem k v))
+     elem))
+
+(defn set-text!
+  "Set the textContent of `elem` to `text`, fall back to innerText"
+  [elem text]
+  (if-not (undefined? (.-textContent elem))
+    (set! (.-textContent elem) text)
+    (set! (.-innerText elem) text))
+  elem)


fix bug

fix bug

--- src/cljs/triangulator/components.cljs
+++ src/cljs/triangulator/components.cljs
@@ -75,7 +75,10 @@
                     (if (= (:step new-state) 3)
                       (let [{:keys [p1 p2 p3]} new-state]
                         (om/set-state! owner {:step 4})
-                        (om/
+                        (om/update! app :triangle [p1 p2 p3]))
+                      (do
+                        (om/set-state! owner new-state)
+                        (recur type new-state))))))))))

     om/IRenderState
     (render-state [_ state]


Small change to :status, not final.

Small change to :status, not final.

--- src/vacation2/main.clj
+++ src/vacation2/main.clj
@@ -92,7 +92,7 @@
     {:reservations
       (for [i (range n-reservations)]
         (ref {:id          i
-              :status      :unprocessed ; :unprocessed|:in-process|:processed
+              :status      :unprocessed ; :unprocessed|:in-process|:processed XXX
               :destination (str (rand-int 100)) ; 1 of 100 locations
               ; Note: the concept of destination does not exist in the original
               ; vacation benchmark. We introduce it, to generate PNRs.
@@ -157,7 +157,7 @@
       (when found-flight (reserve-relation reservation found-flight 1))
       (when found-room   (reserve-relation reservation found-room 1))
       (alter reservation assoc
-        :status true
+        :status :in-process
         :pnr    pnr))))
 ; TODO: add some logging


Fixed indentation.

Fixed indentation.

--- src/cats/builtin.cljc
+++ src/cats/builtin.cljc
@@ -73,12 +73,12 @@
     (-fapply [_ self av]
       ;; Each function (outer loop) applied to each value (inner loop).
       (->> (loop [[h & t :as c] self
-                   result ()]
+                  result ()]
              (if (empty? c)
                result
                (recur t
                       (cons (loop [[h' & t' :as c'] av
-                               result' ()]
+                                   result' ()]
                               (if (empty? c')
                                 result'
                                 (recur t' (cons (h h') result'))))


Simplify context inference and add strict mode (not documented).

--- src/cats/context.cljc
+++ src/cats/context.cljc
@@ -1,5 +1,5 @@
-;; Copyright (c) 2014-2015 Andrey Antukh <niwi@niwi.nz>
-;; Copyright (c) 2014-2015 Alejandro Gómez <alejandro@dialelo.com>
+;; Copyright (c) 2014-2016 Andrey Antukh <niwi@niwi.nz>
+;; Copyright (c) 2014-2016 Alejandro Gómez <alejandro@dialelo.com>
 ;; All rights reserved.
 ;;
 ;; Redistribution and use in source and binary forms, with or without
@@ -28,8 +28,7 @@
   (:require [cats.protocols :as p]))

 (def ^:dynamic *context* nil)
-(def ^:const +level-default+ 10)
-(def ^:const +level-transformer+ 100)
+(def ^:dynamic *strict* false)

 (defn throw-illegal-argument
   {:no-doc true :internal true}
@@ -37,22 +36,28 @@
   #?(:cljs (throw (ex-info text {}))
      :clj  (throw (IllegalArgumentException. text))))

+(defn context?
+  "Returnt `true` if the provided value satisfies
+  the Context protocol."
+  [v]
+  (satisfies? p/Context v))
+
 #?(:clj
    (defmacro with-context
      "Set current context to specific monad."
      [ctx & body]
      `(do
-        (when (not (satisfies? p/Context ~ctx))
-          (throw-illegal-argument "The provided context does not implements Context."))
+        (when-not (context? ~ctx)
+          (throw-illegal-argument
+           "The provided context does not implements Context."))
         (if (nil? *context*)
           (binding [*context* ~ctx]
             ~@body)
-          (let [clevel# (p/-get-level *context*)
-                nlevel# (p/-get-level ~ctx)]
-            (if (>= nlevel# clevel#)
-              (binding [*context* ~ctx]
-                ~@body)
-              (do ~@body)))))))
+          (if (and *strict* (not= *context* ~ctx))
+            (throw-illegal-argument
+             "Context already set, no redefinition is posible in strict mode.")
+            (binding [*context* ~ctx]
+              ~@body))))))

 #?(:clj
    (defmacro with-monad
@@ -61,28 +66,36 @@
      `(with-context ~ctx
         ~@body)))

-(def ^:private not-nil? (comp not nil?))
+;; TODO: improve error messages

-(defn get-current
-  "Get current context or obtain it from
-  the provided instance."
+(defn infer
+  "Given an optional value infer its context. If context is already set, it
+  is returned as is without any inference operation."
   {:no-doc true}
   ([]
-   (if (not-nil? *context*)
-     *context*
-     (throw-illegal-argument
-      "No context is set and it can not be automatically resolved.")))
-  ([param]
+   (if (nil? *context*)
+     (throw-illegal-argument "No context is set.")
+     *context*))
+  ([v]
    (cond
-     (not-nil? *context*)
+     (not (nil? *context*))
      *context*

-     (satisfies? p/Contextual param)
-     (p/-get-context param)
+     (satisfies? p/Contextual v)
+     (p/-get-context v)

-     (satisfies? p/Context param)
-     param
+     (satisfies? p/Context v)
+     v

      :else
      (throw-illegal-argument
-      "No context is set and it can not be automatically resolved."))))
+      (str "No context is set and it can not be automatically "
+           "resolved from provided value")))))
+
+(defn get-current
+  "Deprecated alias to `infer`."
+  {:deprecated true}
+  [& args]
+  (apply infer args))
+
+


#99 use custom pretty printer in core.clj

--- src/cheshire/core.clj
+++ src/cheshire/core.clj
@@ -9,67 +9,34 @@
 																			 JsonGenerator
 																			 PrettyPrinter
 																			 JsonGenerator$Feature)
+           (cheshire.prettyprint CustomPrettyPrinter)
 					 (com.fasterxml.jackson.dataformat.smile SmileFactory)
 					 (java.io StringWriter StringReader BufferedReader BufferedWriter
 										ByteArrayOutputStream OutputStream Reader Writer)))

-(defn- indent-with-spaces
-	[indentation level]
-	(let [space (apply str (repeat indentation " "))
-				spaces (apply str (repeat level space))]
-		(str "\n" spaces)))
-
-(defn- indent-fn
-	[indentation]
-	(partial indent-with-spaces indentation))
-
-(defn- ^PrettyPrinter generate-pretty-printer
-	"Generates a pretty printer instance from
-	a map with flags"
-	[options]
-	(let [defaults {:indentation 2
-									:indent-arrays? true
-									:array-value-separator ", " ; used when not indent-arrays?
-									:object-key-value-separator " : "}
-				level (atom 0)
-				{:keys [indentation
-								indent-arrays?
-								array-value-separator
-								object-key-value-separator]} (merge defaults options)
-				indent (memoize (indent-fn indentation))]
-		(reify PrettyPrinter
-			(writeStartArray [_ gen]
-				(.writeRaw gen "[")
-				(swap! level inc))
-			(beforeArrayValues [_ gen]
-				(if indent-arrays?
-					(.writeRaw gen (indent @level))))
-			(writeArrayValueSeparator [_ gen]
-				(if indent-arrays?
-					(.writeRaw gen (str "," (indent @level)))
-					(.writeRaw gen array-value-separator)))
-			(writeEndArray [_ gen _]
-				(swap! level dec)
-				(if indent-arrays?
-					(.writeRaw gen (str (indent @level) "]"))
-					(.writeRaw gen "]")))
-
-			(writeStartObject [_ gen]
-				(.writeRaw gen "{")
-				(swap! level inc)
-				(.writeRaw gen (indent @level)))
-			(beforeObjectEntries [_ gen]
-				(.writeRaw gen ""))
-			(writeObjectFieldValueSeparator [_ gen]
-				(.writeRaw gen object-key-value-separator))
-			(writeObjectEntrySeparator [_ gen]
-				(.writeRaw gen (str "," (indent @level))))
-			(writeEndObject [_ gen _]
-				(swap! level dec)
-				(.writeRaw gen (str (indent @level) "}")))
-
-			(writeRootValueSeparator [_ jg]
-				(.writeRaw jg "")))))
+(def ^:private default-pretty-print-options
+	{:indentation 2
+	 :indent-arrays? false
+	 :indent-objects? true
+	 :before-array-values nil
+	 :after-array-values nil
+	 :object-field-value-separator nil})
+
+(defn- create-pretty-printer
+	 "Returns an instance of CustomPrettyPrinter based on the configuration
+	 provided as argument"
+	 [options]
+	 (let [{:keys [indentation
+								 indent-arrays?
+								 indent-objects?
+								 before-array-values
+								 after-array-values
+								 object-field-value-separator]} (merge default-pretty-print-options options)]
+		(-> (new CustomPrettyPrinter)
+				(.setIndentation indentation indent-objects? indent-arrays?)
+				(.setBeforeArrayValues before-array-values)
+				(.setAfterArrayValues after-array-values)
+				(.setObjectFieldValueSeparator object-field-value-separator))))

 ;; Generators
 (defn ^String generate-string
@@ -91,10 +58,7 @@
 					; pretty = true uses default pretty printer
 					(.useDefaultPrettyPrinter generator)
 					; else we construct a custom pretty printer
-					(.setPrettyPrinter generator
-														 (generate-pretty-printer (if (map? print-pretty)
-																													print-pretty
-																													{})))))
+					(.setPrettyPrinter generator (create-pretty-printer print-pretty))))
 		 (when (:escape-non-ascii opt-map)
 			 (.enable generator JsonGenerator$Feature/ESCAPE_NON_ASCII))
 		 (gen/generate generator obj
@@ -116,9 +80,14 @@
 	 (let [generator (.createGenerator
 										^JsonFactory (or factory/*json-factory*
 																		 factory/json-factory)
-										^Writer writer)]
-		 (when (:pretty opt-map)
-			 (.useDefaultPrettyPrinter generator))
+										^Writer writer)
+				 print-pretty (:pretty opt-map)]
+		 (when print-pretty
+			 (if (= print-pretty true)
+				 ; pretty = true uses default pretty printer
+				 (.useDefaultPrettyPrinter generator)
+				 ; else we construct a custom pretty printer
+				 (.setPrettyPrinter generator (create-pretty-printer print-pretty))))
 		 (when (:escape-non-ascii opt-map)
 			 (.enable generator JsonGenerator$Feature/ESCAPE_NON_ASCII))
 		 (gen/generate generator obj (or (:date-format opt-map)


Properly close connection on create database implementation.

--- src/continuo/postgresql/bootstrap.clj
+++ src/continuo/postgresql/bootstrap.clj
@@ -53,7 +53,7 @@
 (defn create
   [tx]
   (exec/submit
-   #(let [conn (impl/-get-connection tx)]
+   #(with-open [conn (impl/-get-connection tx)]
       (sc/atomic-apply conn create'))))

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


fix for Firefox focus

fix for Firefox focus

--- iwaswhere-web/src/cljs/iwaswhere_web/ui/search.cljs
+++ iwaswhere-web/src/cljs/iwaswhere_web/ui/search.cljs
@@ -16,7 +16,7 @@
                                            #(aset js/window "location" "hash" (js/encodeURIComponent search-text))
                                            5000))
         update-search-fn (fn [new-search]
-                           (swap! local assoc-in [:current-query] new-search)
+                           (swap! local assoc-in [:temp-query] new-search)
                            (swap! local update-in [:set-location]
                                   (fn [prev] (when prev (.clearTimeout js/window prev))
                                     (location-timeout-fn (:search-text new-search))))
@@ -24,13 +24,15 @@
         on-input-fn #(update-search-fn (h/parse-search (.. % -target -innerText)))

         ; find incomplete tag or mention before cursor, show suggestions
-        before-cursor (h/string-before-cursor (:search-text (:current-query @local)))
+        before-cursor (h/string-before-cursor (:search-text (:temp-query @local)))
         [curr-tag f-tags] (h/autocomplete-tags before-cursor "#" hashtags)
         [curr-mention f-mentions] (h/autocomplete-tags before-cursor "@" mentions)
         tag-replace-fn (fn [curr-tag tag]
                          (let [curr-tag-regex (js/RegExp (str curr-tag "(?!" h/tag-char-class ")") "i")
-                               search-text (:search-text (:current-query @local))]
-                           (update-search-fn (h/parse-search (s/replace search-text curr-tag-regex tag)))))
+                               search-text (:search-text (:temp-query @local))
+                               new-search (h/parse-search (s/replace search-text curr-tag-regex tag))]
+                           (swap! local assoc-in [:current-query] new-search)
+                           (update-search-fn new-search)))
         get-tags #(% (:current-query @local))
         on-keydown-fn (fn [ev]
                         (let [key-code (.. ev -keyCode)]
@@ -39,7 +41,7 @@
                               (tag-replace-fn curr-tag (first f-tags)))
                             (when (and curr-mention (seq f-mentions))
                               (tag-replace-fn curr-mention (first f-mentions)))
-                            (.setTimeout js/window (fn [] (u/focus-on-end (.-target ev))) 0)
+                            (.setTimeout js/window (fn [] (u/focus-on-end (.-target ev))) 50)
                             (.preventDefault ev))))]
     [:div.search
      [:div.hashtags
@@ -61,7 +63,7 @@
   the latest query on change, plus sends query to backend."
   [{:keys [local put-fn]}]
   (let [hash-change-fn #(let [new-query (h/query-from-search-hash)]
-                         (when (not= new-query (:current-query @local))
+                         (when (not= new-query (:temp-query @local))
                            (swap! local assoc-in [:current-query] new-query)
                            (put-fn [:state/get new-query])))]
     (aset js/window "onhashchange" hash-change-fn)


CLJS-1140: typo in cljs.repl/repl, `:need-prompt prompt` instead of `:need-prompt need-prompt`

--- src/clj/cljs/repl.clj
+++ src/clj/cljs/repl.clj
@@ -674,7 +674,8 @@
               repl-opts
               opts
               {:init init
-               :need-prompt prompt
+               :prompt prompt
+               :need-prompt need-prompt
                :flush flush
                :read read
                :print print


Buffer debug output to avoid mangling output (#544)

Fixes #536

--- src/clj_http/core.clj
+++ src/clj_http/core.clj
@@ -485,27 +485,29 @@
 (defn- print-debug!
   "Print out debugging information to *out* for a given request."
   [{:keys [debug-body body] :as req} http-req]
-  (println "Request:" (type body))
-  (clojure.pprint/pprint
-   (assoc req
-          :body (if (opt req :debug-body)
-                  (cond
-                    (isa? (type body) String)
-                    body
-
-                    (isa? (type body) HttpEntity)
-                    (let [baos (ByteArrayOutputStream.)]
-                      (.writeTo ^HttpEntity body baos)
-                      (.toString baos "UTF-8"))
-
-                    :else nil)
-                  (if (isa? (type body) String)
-                    (format "... %s bytes ..."
-                            (count body))
-                    (and body (bean body))))
-          :body-type (type body)))
-  (println "HttpRequest:")
-  (clojure.pprint/pprint (bean http-req)))
+  (println
+   (with-out-str
+     (println "Request:" (type body))
+     (clojure.pprint/pprint
+      (assoc req
+             :body (if (opt req :debug-body)
+                     (cond
+                       (isa? (type body) String)
+                       body
+
+                       (isa? (type body) HttpEntity)
+                       (let [baos (ByteArrayOutputStream.)]
+                         (.writeTo ^HttpEntity body baos)
+                         (.toString baos "UTF-8"))
+
+                       :else nil)
+                     (if (isa? (type body) String)
+                       (format "... %s bytes ..."
+                               (count body))
+                       (and body (bean body))))
+             :body-type (type body)))
+     (println "HttpRequest:")
+     (clojure.pprint/pprint (bean http-req)))))

 (defn- build-response-map
   [^HttpResponse response req ^HttpUriRequest http-req http-url


--- src/clj_http/core.clj
+++ src/clj_http/core.clj
@@ -87,9 +87,18 @@
 (defn add-client-params!
   "Add various client params to the http-client object, if needed."
   [http-client kvs]
-  (doto http-client
+  (let [cookie-spec-factory (:cookie-spec-factory kvs)
+        cookie-policy (or
+                        (not-empty (str (class cookie-spec-factory)))
+                        CookiePolicy/BROWSER_COMPATIBILITY)
+        kvs (dissoc kvs :cookie-spec-factory)]
+    (when cookie-spec-factory
+      (-> http-client
+        .getCookieSpecs
+        (.register cookie-policy, cookie-spec-factory)))
+  (doto http-client
     (set-client-param ClientPNames/COOKIE_POLICY
-                      CookiePolicy/BROWSER_COMPATIBILITY)
+                      cookie-policy)
     (set-client-param CookieSpecPNames/SINGLE_COOKIE_HEADER true)
     (set-client-param ClientPNames/HANDLE_REDIRECTS false))

@@ -98,7 +107,7 @@
                       k (cond
                          (and (not= "http.connection-manager.timeout" k)
                               (instance? Long v)) (Integer. ^Long v)
-                              true v))))
+                              true v)))))

 (defn- coerce-body-entity
@@ -175,7 +184,7 @@
            socket-timeout conn-timeout  ;; in milliseconds
            insecure? save-request? proxy-host proxy-port as cookie-store
            retry-handler response-interceptor digest-auth connection-manager
-           client-params] :as req}]
+           client-params] :as req}]
   (let [^ClientConnectionManager conn-mgr
         (or connection-manager
             conn/*connection-manager*


[console] All input and output goes to console

- Restructured server-flow so that output can be printed and consoled
- Consoling Exception output as well
- Input has a ">> " prefix in console to separate it out

--- src/cljshell/core.clj
+++ src/cljshell/core.clj
@@ -18,10 +18,13 @@
              *out* (OutputStreamWriter. out)]
       (let [line (read-line)]
         (try
-          (console line)
-          (println (load-string line))
-          (catch Exception e (println e))))
-      (.close *out*))))
+          (console (str ">> " line))
+          (let [return-val (load-string line)]
+            (console return-val)
+            (println return-val))
+          (catch Exception e (do (console e)
+                                 (println e))))
+      (.close *out*)))))

 (defn -main
   "I don't do a whole lot ... yet."


Updated function looad-property-file not to parse all expressions

--- src/emender_jenkins/config_loader.clj
+++ src/emender_jenkins/config_loader.clj
@@ -36,7 +36,7 @@
     [properties]
     (into {}
         (for [[k v] properties]
-              [(keyword k) (read-string v)])))
+              [(keyword k) v])))

 (defn load-property-file
     "Load configuration from the provided property file."


Removed unnecessary div

Removed unnecessary div

--- src/beebster_clj/views.clj
+++ src/beebster_clj/views.clj
@@ -100,8 +100,8 @@
             [:a {:href (get-url ind) :alt desc}
              [:img.img {:src img}]]]
            [:div.t1
-            (str desc)]]])]
-      [:div.clear " "]))))
+            [:div.imgtitle
+             (str desc)]]]])]))))

 (defn category-page
   [category]
@@ -118,7 +118,6 @@
    (header '(("/" "search") ("/about" "about")))
    [:h2.header "Search Results"]
    (display-results (iplayer-search searchterm))))
-

 (defn info-page


format track duration as mm:ss

format track duration as mm:ss

--- src-cljs/core.cljs
+++ src-cljs/core.cljs
@@ -18,6 +18,15 @@
      :search-term ""
      }))

+(defn mmss [seconds]
+  (let [m (quot seconds 60)
+        s (- seconds (* 60 m))]
+    (str m ":" (.substr (str "000" s) -2))))
+
+
+#_(println (mmss 20) (mmss 40) (mmss 60) (mmss 80)
+         (mmss 200) (mmss 4000) (mmss 6000) (mmss 381))
+
 (defn results-track-view [track owner]
   (reify
     om/IRenderState
@@ -25,8 +34,9 @@
       (dom/div #js {:className "track"}
                (dom/span #js {:className "artist"} (get track "artist"))
                (dom/span #js {:className "album"} (get track "album" ))
-               (dom/span #js {:className "title"} (get track "title"))
-               (dom/span #js {:className "duration"} (get track "length"))
+               (dom/span #js {:className "title"}
+                         (str (get track "track") " - " (get track "title")))
+               (dom/span #js {:className "duration"} (mmss (get track "length")))
                (dom/button #js {:onClick (fn [e] (put! enqueue @track))}
                            "+")))))

@@ -68,7 +78,7 @@
                (dom/span #js {:className "artist"} (get track "artist"))
                (dom/span #js {:className "album"} (get track "album" ))
                (dom/span #js {:className "title"} (get track "title"))
-               (dom/span #js {:className "duration"} (get track "length"))
+               (dom/span #js {:className "duration"} (mmss (get track "length")))
                (dom/button #js {:onClick (fn [e] (put! dequeue @track))}
                            "-")))))


crawl is now executed. need to print more stuff in the prepare routine

--- src/crawler/crawl.clj
+++ src/crawler/crawl.clj
@@ -458,15 +458,14 @@
                                        (:body y)))))
            examples        (map rand-nth clusters)

-           leaf-paths      (frequencies
-                            (map
-                             :path
-                             (filter
-                              (fn [x]
-                                (leaf? {:anchor-text (:src-text x)
-                                        :src-url     (:url x)
-                                        :body        (:body x)}))
-                              sampled-corpus)))]
+           leaf-paths      (map
+                            :path
+                            (filter
+                             (fn [x]
+                               (leaf? {:anchor-text (:src-text x)
+                                       :src-url     (:url x)
+                                       :body        (:body x)}))
+                             sampled-corpus))]
        (merge-with concat acc {:leaf-paths leaf-paths
                                :examples examples
                                :corpus   sampled-corpus})))
@@ -530,19 +529,17 @@
                            :body       body}))
                (do
                  (utils/sayln :crawl-done)
-                 ;; {:state  {:url-queue  url-queue
-                 ;;           :visited    visited
-                 ;;           :lookahead  lookahead
-                 ;;           :leaf-paths leaf-paths
-                 ;;           :leaf-limit leaf-limit}
+                 {:state  {:url-queue  url-queue
+                           :visited    visited
+                           :lookahead  lookahead
+                           :leaf-paths leaf-paths
+                           :leaf-limit leaf-limit}

-                 ;;  :model  (frequencies leaf-paths)
+                  :model  (frequencies leaf-paths)

-                 ;;  :corpus corpus
+                  :corpus corpus

-                 ;;  :prefix (uri/host (uri/uri url))}
-
-                 )
+                  :prefix (uri/host (uri/uri url))})

                ;; this is an initial test.
                ;; I personally prefer performing the
@@ -553,9 +550,32 @@
                                                (first url-queue)
                                                {}
                                                blacklist)
-                         prepared (prepare-example (:xpath-nav-info state-action)
-                                                   (-> url-queue first :path)
-                                                   url
-                                                   leaf?)]
-                     prepared)))))))
-
+                         {items :examples
+                          leaf-paths-obs :leaf-paths
+                          sampled-corpus :corpus}
+                         (prepare-example (:xpath-nav-info state-action)
+                                          (-> url-queue first :path)
+                                          url
+                                          leaf?)
+
+                         new-queue (concat (rest url-queue) items)
+                         new-corpus (merge corpus
+                                           (reduce
+                                            (fn [acc x]
+                                              (merge
+                                               acc
+                                               {(:url x)
+                                                x}))
+                                            {}
+                                            sampled-corpus))]
+                     (recur new-queue
+                            (clojure.set/union visited
+                                               (map :url sampled-corpus))
+                            lookahead
+                            leaf?
+                            extract
+                            stop?
+                            (concat leaf-paths-obs leaf-paths)
+                            leaf-limit
+                            new-corpus))))))))
+


Rename `extension` to `ext` and rename `base-name` function.

--- src/datoteka/core.clj
+++ src/datoteka/core.clj
@@ -197,15 +197,11 @@
        (subs path-str i)]
       [path-str nil])))

-(defn extension
+(defn ext
   "Return the extension part of a file."
   [path]
-  (subs (last (split-ext path)) 1))
-
-(defn base-name
-  "Return the name part of a file."
-  [path]
-  (first (split-ext path)))
+  (some-> (last (split-ext path))
+          (subs 1)))

 (defn normalize
   "Normalize the path."


Fix user-is-group-admin subscription

Fix user-is-group-admin subscription

Needs to be able to handler either one or two dynamic values (although
may be able to switch to just the always one dval case, as the two dvals
is in users page which currently isn't used

--- src/braid/client/subs.cljs
+++ src/braid/client/subs.cljs
@@ -70,8 +70,9 @@

 (reg-sub
   :user-is-group-admin?
-  (fn [state _ [user-id group-id]]
-    (contains? (get-in state [:groups group-id :admins]) user-id)))
+  (fn [state [_ & qvals] dvals]
+    (let [[user-id group-id] (concat (drop (count dvals) qvals) dvals)]
+      (contains? (set (get-in state [:groups group-id :admins])) user-id))))

 (reg-sub
   :current-user-is-group-admin?


Update view

Update view

--- src/discuss/find.cljs
+++ src/discuss/find.cljs
@@ -70,7 +70,6 @@
     (render-state [_ {:keys [search-value issue-id]}]
       (dom/div nil
                (dom/div #js {:className "form-group"}
-                        (dom/label nil "Select Issue")
                         (dom/select #js {:className "form-control"
                                          :onChange  #(store-selected-issue % owner)}
                                     (map #(issue-selector-view % owner) (lib/get-issues))))


Make FlatLayers Flippable, and do it when flipping graphs

--- src/fatlip/order.cljs
+++ src/fatlip/order.cljs
@@ -4,7 +4,7 @@
             [clojure.string :as s]
             [fatlip.protocols :refer [Layered Sparse Directed Reversible
                                       Flippable Nodey Node Edge Edge->Segment
-                                      rev]]))
+                                      rev flip]]))

 (defrecord OrderedGraph [layers succs preds ps qs rs
@@ -60,12 +60,17 @@
   Flippable
   (flip [this]
     (assoc this
+           :layers (mapv flip layers)
            :aboves belows
            :belows aboves
            :top-idxs bot-idxs
            :bot-idxs top-idxs)))

-(defrecord FlatLayer [id duration items])
+(defrecord FlatLayer [id duration items]
+  Flippable
+  (flip [this]
+    (assoc this
+           :items (reverse items))))

 (defrecord AccumulatorNode [weight node-edges is-seg-c])


added react dependency

added react dependency

--- src/leiningen/new/reagent/project.clj
+++ src/leiningen/new/reagent/project.clj
@@ -7,7 +7,8 @@
   :source-paths ["src/clj" "src/cljs"{{{cljx-source-paths}}}]

   :dependencies [[org.clojure/clojure "1.6.0"]
-                 [reagent "0.4.3"]
+                 [com.facebook/react "0.11.2"]
+                 [reagent "4.3.0"]
                  [reagent-utils "0.1.0"]
                  [secretary "1.2.0"]{{{app-dependencies}}}]


bumped up compojure

bumped up compojure

--- src/leiningen/new/reagent/project.clj
+++ src/leiningen/new/reagent/project.clj
@@ -16,7 +16,7 @@
                  [ring "1.3.2"]
                  [ring/ring-defaults "0.1.4"]
                  [prone "0.8.1"]
-                 [compojure "1.3.2"]
+                 [compojure "1.3.3"]
                  [selmer "0.8.2"]
                  [environ "1.0.0"]
                  [secretary "1.2.2"]{{{app-dependencies}}}]


Fetch rather than pull, fixes several bugs checking out user's code.

--- src/circle/backend/git.clj
+++ src/circle/backend/git.clj
@@ -100,12 +100,12 @@
             (git checkout ~revision))
            :repo repo))

-(defn pull
+(defn fetch
   "Git pull an existing repo"
   [repo & {:keys [ssh-key]}]
-  (infof "git pull %s" repo)
+  (infof "git fetch %s" repo)
   (git-fn* (sh/q
-            (git pull))
+            (git fetch))
            :ssh-key ssh-key
            :repo repo))

@@ -117,8 +117,7 @@
   (let [path (or path (default-repo-path url))]
     (if (repo-exists? path)
       (when update
-        (checkout path "master") ;; you have to be on a branch to pull
-        (pull path :ssh-key ssh-key))
+        (fetch path :ssh-key ssh-key))
       (clone url :path path :ssh-key ssh-key))))

 (defn format-log


htmlFor

htmlFor

--- src/clj/html2om/parser.clj
+++ src/clj/html2om/parser.clj
@@ -8,6 +8,7 @@
   {:class :className
    :colspan :colSpan
    :rowspan :rowSpan
+   :for :htmlFor
    }
   )


Make fails more verbose

Make fails more verbose

--- src/clj/subman/helpers.clj
+++ src/clj/subman/helpers.clj
@@ -35,7 +35,10 @@
   [fnc fallback]
   (fn [x]
     (try (fnc x)
-      (catch Exception e (do (print-cause-trace e)
+      (catch Exception e (do
+                           (println (str "FAIL START:\n" fnc " WITH " x))
+                           (print-cause-trace e)
+                           (println (str "FAIL END:\n" fnc " WITH " x))
                            fallback)))))

 (defn get-season-episode


Add a require

Add a require

--- src/cljs/bmihw/common.cljs
+++ src/cljs/bmihw/common.cljs
@@ -1,4 +1,5 @@
-(ns bmihw.common)
+(ns bmihw.common
+  (:require [cljsjs.firebase :as firebase]))

 (def stuff (atom nil))
 (def fb (js/Firebase. "https://bmihw.firebaseio.com"))


Bugfix: Was expecting one more page

Bugfix: Was expecting one more page

--- src/cljs/memento/core.cljs
+++ src/cljs/memento/core.cljs
@@ -68,7 +68,6 @@
 (adapt-bootstrap OverlayTrigger)
 (adapt-bootstrap Popover)
 (adapt-bootstrap Tooltip)
-(def Pagination (reagent/adapt-react-class js/ReactBootstrap.Pagination))
 (def Modal (reagent/adapt-react-class js/ReactBootstrap.Modal))
 (def ModalBody (reagent/adapt-react-class js/ReactBootstrap.ModalBody))
 (def ModalFooter (reagent/adapt-react-class js/ReactBootstrap.ModalFooter))
@@ -571,13 +570,11 @@
         page-index  (subscribe [:search-state :page-index])
         total-pages (reaction (:pages @(subscribe [:search-state :last-result])))]
     (fn []
-      (if (< @page-index @total-pages)
+      (if (< @page-index (dec @total-pages))
         [:div {:style {:text-align "center"}}
          (if @searching?
            [:i {:class "fa fa-spinner fa-spin"}]
-           [:i {:class "fa fa-ellipsis-h" :id "load-trigger"}])
-
-         ]))))
+           [:i {:class "fa fa-ellipsis-h" :id "load-trigger"}])]))))

 (defn list-memories [results show-thread-btn?]
   (for [memory results]


fix letfn*,catch,finally emit code

fix letfn*,catch,finally emit code

--- src/cljs_api_gen/parse.clj
+++ src/cljs_api_gen/parse.clj
@@ -500,13 +500,13 @@
    (defmethod parse 'op ...)
    (defmethod emit* :op ...)"
   [name]
-  (get '{"js*"   :js
-         "."     :dot
-         "var"   :var-special
-         "fn*"   :fn
-         "lefn*" :letfn
-         "loop*" :loop
-         "let*"  :let}
+  (get '{"js*"    :js
+         "."      :dot
+         "var"    :var-special
+         "fn*"    :fn
+         "letfn*" :letfn
+         "loop*"  :loop
+         "let*"   :let}
     name
     (keyword name))) ;; <-- default just converts to a keyword

@@ -1191,7 +1191,7 @@
         make (fn [name-]
                (assoc
                  (select-keys try-form
-                              [:docstring :source])
+                              [:docstring :source :extra-sources])
                  :ns "cljs.core"
                  :type "special form"
                  :name name-


fixed warnings

fixed warnings

--- src/cljx/mesh/respond.cljx
+++ src/cljx/mesh/respond.cljx
@@ -1,5 +1,5 @@
 (ns mesh.respond
-  (:refer-clojure :exclude [+ - * /])
+  (:refer-clojure :exclude [+ - * / rem])
   #+cljs
   (:require-macros [mesh.def :refer [defbreakpoint]])
   #+clj


Focus management #38

Focus management #38

--- src/flatgui/focus.clj
+++ src/flatgui/focus.clj
@@ -13,11 +13,6 @@
       [flatgui.inputchannels.mouse :as mouse]
       [flatgui.inputchannels.keyboard :as keyboard])
   (:import (java.awt.event KeyEvent)))
-
-; TODO - Known issues
-; 1. When window is clicked it receives focus - this is correct. But should it give focus exactly to clicked component?
-; 2. Should ctrl-tab from open cycle container added to window, quit to another window, not to controls of the same window?
-

 (def clean-state {:mode :none
                   :focused-child nil})
@@ -43,7 +38,6 @@
           child-count (count accepting-children)
           child-ids (mapv :id accepting-children)
           closed (:closed-focus-root component)
-          _ (println "get-in-cycle for " (:id component) " dir " dir " child-ids " child-ids " c-id " c-id)
           cycle-keeper (fn [i]
                          (cond
                            (>= i child-count) (if closed 0)
@@ -99,19 +93,25 @@
         :has-focus clean-state
         :none clean-state
         :parent-of-focused (if (= parent-focused-child (:id component))
-                             ;; My parent is ready to give me focus.
-                             ;;   a) If I have any child requesting focus then I give focus to it.
-                             ;;      Otherwise I leave focus with myself. (*1)
-                             ;;   b) If I am acutally not focusable then I pass focus to the first
-                             ;;      child in my cycle
-                             (if-let [child-id (if (:focusable component)
-                                                 (:id (first (filter
-                                                               #(= :requests-focus (:mode (:focus-state %)))
-                                                               (for [[_ c] (:children component)] c))))
-                                                 (get-in-cycle component :first))]
-                               (focus-child child-id)
-                               {:mode :has-focus
-                                :focused-child nil})
+                             ;; If my parent is :parent-of-focused and I am :parent-of-focused,
+                             ;; then no changes needed here.
+                             (if (not= this-mode :parent-of-focused)
+                               ;; My parent is ready to give me focus.
+                               ;;   If I have any child requesting focus then I give focus to it.
+                               ;;   Otherwise I leave focus with myself. (*1)
+                               ;;   Else, if I am acutally not focusable then I pass focus to the first
+                               ;;   child in my cycle
+                               (if-let [child-id (if-let [requesting-child-id
+                                                          (:id (first (filter
+                                                                        #(= :requests-focus (:mode (:focus-state %)))
+                                                                        (for [[_ c] (:children component)] c))))]
+                                                   requesting-child-id
+                                                   (if (not (:focusable component))
+                                                     (get-in-cycle component :first)))]
+                                 (focus-child child-id)
+                                 {:mode :has-focus
+                                  :focused-child nil})
+                               old-focus-state)

                              ;; Another component next to me has focus, therefore my state is clean
                              clean-state)


CMR-2562: Removing TODO

CMR-2562: Removing TODO

--- bootstrap-app/src/cmr/bootstrap/api/routes.clj
+++ bootstrap-app/src/cmr/bootstrap/api/routes.clj
@@ -123,7 +123,6 @@

       (context "/rebalancing_collections/:concept-id" [concept-id]

-       ;; TODO document in README
        ;; Start rebalancing
        (POST "/start" {:keys [request-context params]}
          (start-rebalance-collection request-context concept-id params))


make shadow/dev work in nrepl

make shadow/dev work in nrepl

its really just watch since nrepl is not an actual loop

closes #72

--- src/main/shadow/cljs/devtools/api.clj
+++ src/main/shadow/cljs/devtools/api.clj
@@ -27,6 +27,11 @@
   (:import (java.io PushbackReader StringReader)
            (java.lang ProcessBuilder$Redirect)))

+;; nREPL support
+
+(def ^:dynamic *nrepl-cljs* nil)
+(def ^:dynamic *nrepl-active* false)
+
 (defn get-worker
   [id]
   {:pre [(keyword? id)]}
@@ -144,33 +149,6 @@
 (defn get-build-config [id]
   {:pre [(keyword? id)]}
   (config/get-build! id))
-
-(defn dev*
-  [build-config {:keys [autobuild] :as opts}]
-  (let [config
-        (config/load-cljs-edn)
-
-        {:keys [out supervisor] :as app}
-        (runtime/get-instance!)]
-
-    (-> (get-or-start-worker build-config opts)
-        (worker/watch out false)
-        (worker/start-autobuild)
-        (worker/sync!)
-        (repl-impl/stdin-takeover! app))
-
-    (super/stop-worker supervisor (:build-id build-config))
-    :done))
-
-(defn dev
-  ([build]
-   (dev build {:autobuild true}))
-  ([build {:keys [autobuild] :as opts}]
-   (try
-     (let [build-config (config/get-build! build)]
-       (dev* build-config opts))
-     (catch Exception e
-       (e/user-friendly-error e)))))

 (defn build-finish [{::build/keys [build-info] :as state} config]
   (util/print-build-complete build-info config)
@@ -262,11 +240,6 @@
      (catch Exception e
        (e/user-friendly-error e)))))

-;; nREPL support
-
-(def ^:dynamic *nrepl-cljs* nil)
-(def ^:dynamic *nrepl-active* false)
-
 (defn nrepl-select [id]
   (if-not (get-worker id)
     [:no-worker id]
@@ -277,7 +250,6 @@
         (println "To quit, type: :repl/quit")
         [:selected id])))

-
 (defn repl [build-id]
   (if *nrepl-active*
     (nrepl-select build-id)
@@ -289,6 +261,38 @@
       (if-not worker
         :no-worker
         (repl-impl/stdin-takeover! worker app)))))
+
+(defn dev*
+  [build-config {:keys [autobuild] :as opts}]
+  (let [config
+        (config/load-cljs-edn)
+
+        {:keys [out supervisor] :as app}
+        (runtime/get-instance!)
+
+        worker
+        (-> (get-or-start-worker build-config opts)
+            (worker/watch out false)
+            (worker/start-autobuild)
+            (worker/sync!))]
+
+    ;; for normal REPL loops we wait for the CLJS loop to end
+    (when-not *nrepl-active*
+      (repl-impl/stdin-takeover! worker app)
+      (super/stop-worker supervisor (:build-id build-config)))
+
+    :done))
+
+(defn dev
+  ([build]
+   (dev build {:autobuild true}))
+  ([build {:keys [autobuild] :as opts}]
+   (try
+     (let [build-config (config/get-build! build)]
+       (dev* build-config opts))
+     (catch Exception e
+       (e/user-friendly-error e)))))
+

 (defn help []
   (-> (slurp (io/resource "shadow/txt/repl-help.txt"))