Added Vector Average problem

Added Vector Average problem

error: pathspec 'src/clojush/problems/software/vector_average.clj' did not match any file(s) known to git

--- src/clojush/problems/software/vector_average.clj
+++ src/clojush/problems/software/vector_average.clj
@@ -0,0 +1,154 @@
+;; vector_average.clj
+;; Tom Helmuth, thelmuth@cs.umass.edu
+;;
+;; Problem Source: iJava (http://ijava.cs.umass.edu/)
+;;
+;; Given a vector of floats with length in [1,50], with each float in [-1000,1000],
+;; return the average of those floats.
+;;
+;; input stack has 1 input vector of floats
+
+(ns clojush.problems.software.vector-average
+  (:use clojush.pushgp.pushgp
+        [clojush pushstate interpreter random util globals]
+        clojush.instructions.tag
+        [clojure.math numeric-tower combinatorics]
+        ))
+
+; Atom generators
+(def vector-average-atom-generators
+  (concat (list
+            ;;; end constants
+            ;;; end ERCs
+            (tag-instruction-erc [:vector_float :float :integer :exec] 1000)
+            (tagged-instruction-erc 1000)
+            ;;; end tag ERCs
+            'in1
+            ;;; end input instructions
+            )
+          (registered-for-stacks [:vector_float :float :integer :exec])))
+
+
+;; Define test cases
+(defn vector-average-input
+  "Makes a Vector Average input vector of length len with probability prob of being odd."
+  [len]
+  (vec (repeatedly len
+                   #(- (* (lrand) 2000.0) 1000.0))))
+
+;; A list of data domains for the problem. Each domain is a vector containing
+;; a "set" of inputs and two integers representing how many cases from the set
+;; should be used as training and testing cases respectively. Each "set" of
+;; inputs is either a list or a function that, when called, will create a
+;; random element of the set.
+(def vector-average-data-domains
+  [[(list [0.0] [100.0] [-100.0]) 3 0] ;; Length 1 vectors
+   [(list [2.0 129.0]
+          [0.12345 -4.678]
+          [999.99 74.113]) 3 0] ;; Length 2 vectors
+   [(fn [] (vector-average-input 50)) 4 50] ;; Length 50 vectors
+   [(fn [] (vector-average-input (inc (lrand-int 50)))) 90 950] ;; Random length, random floats
+   ])
+
+;;Can make Vector Average test data like this:
+;(test-and-train-data-from-domains vector-average-data-domains)
+
+; Helper function for error function
+(defn vector-average-test-cases
+  "Takes a sequence of inputs and gives IO test cases of the form
+   [input output]."
+  [inputs]
+  (map #(vector %
+                (/ (apply + %)
+                   (count %)))
+       inputs))
+
+; Define error function. For now, each run uses different random inputs
+(defn vector-average-error-function
+  "Returns the error function for the vector-average problem. Takes as
+   input Vector Average data domains."
+  [data-domains]
+  (let [[train-cases test-cases] (map vector-average-test-cases
+                                      (test-and-train-data-from-domains data-domains))]
+    (when true ;; Change to false to not print test cases
+      (doseq [[i case] (map vector (range) train-cases)]
+        (println (format "Train Case: %3d | Input/Output: %s" i (str case))))
+      (doseq [[i case] (map vector (range) test-cases)]
+        (println (format "Test Case: %3d | Input/Output: %s" i (str case)))))
+    (fn the-actual-vector-average-error-function
+      ([program]
+        (the-actual-vector-average-error-function program :train))
+      ([program data-cases] ;; data-cases should be :train or :test
+        (the-actual-vector-average-error-function program data-cases false))
+      ([program data-cases print-outputs]
+        (let [behavior (atom '())
+              errors (doall
+                       (for [[input1 correct-output] (case data-cases
+                                                                  :train train-cases
+                                                                  :test test-cases
+                                                                  [])]
+                         (let [final-state (run-push program
+                                                     (->> (make-push-state)
+                                                       (push-item input1 :input)))
+                               result (top-item :float final-state)]
+                           (when print-outputs
+                              (println (format "Correct output: %19.14f | Program output: %19.14f" correct-output result)))
+                           ; Record the behavior
+                           (when @global-print-behavioral-diversity
+                             (swap! behavior conj result))
+                           ; Error is integer error
+                           (if (number? result)
+                             (abs (- result correct-output)) ; distance from correct integer
+                             1000000) ; penalty for no return value
+                           )))]
+          (when @global-print-behavioral-diversity
+            (swap! population-behaviors conj @behavior))
+          errors)))))
+
+(defn vector-average-report
+  "Custom generational report."
+  [best population generation error-function report-simplifications]
+  (let [best-program (not-lazy (:program best))
+        best-test-errors (error-function best-program :test)
+        best-total-test-error (apply +' best-test-errors)]
+    (println ";;******************************")
+    (printf ";; -*- Vector Average problem report - generation %s\n" generation)(flush)
+    (println "Test total error for best:" best-total-test-error)
+    (println (format "Test mean error for best: %.5f" (double (/ best-total-test-error (count best-test-errors)))))
+    (when (zero? (:total-error best))
+      (doseq [[i error] (map vector
+                             (range)
+                             best-test-errors)]
+        (println (format "Test Case  %3d | Error: %d" i error))))
+    (println ";;------------------------------")
+    (println "Outputs of best individual on training cases:")
+    (error-function best-program :train true)
+    (println ";;******************************")
+    )) ;; To do validation, could have this function return an altered best individual
+       ;; with total-error > 0 if it had error of zero on train but not on validation
+       ;; set. Would need a third category of data cases, or a defined split of training cases.
+
+
+; Define the argmap
+(def argmap
+  {:error-function (vector-average-error-function vector-average-data-domains)
+   :atom-generators vector-average-atom-generators
+   :max-points 400
+   :max-points-in-initial-program 200
+   :evalpush-limit 800
+   :population-size 1000
+   :max-generations 300
+   :parent-selection :lexicase
+   :genetic-operator-probabilities {:alternation 0.2
+                                    :uniform-mutation 0.2
+                                    :uniform-close-mutation 0.1
+                                    [:alternation :uniform-mutation] 0.5
+                                    }
+   :alternation-rate 0.01
+   :alignment-deviation 10
+   :uniform-mutation-rate 0.01
+   :problem-specific-report vector-average-report
+   :print-behavioral-diversity true
+   :report-simplifications 0
+   :final-report-simplifications 5000
+   })


fix some documentation for `sel`

fix some documentation for `sel`

--- src/metabase/db.clj
+++ src/metabase/db.clj
@@ -209,13 +209,13 @@
   OPTION, if specified, is one of `:field`, `:fields`, or `:id`.

     ;; Only return IDs of objects.
-    (sel :one :id User :email \"cam@metabase.com\")  -> 120
+    (sel :one :id User :email \"cam@metabase.com\") -> 120

     ;; Only return the specified field.
-    (sel :many :field [User :first_name])            -> (\"Cam\" \"Sameer\" ...)
+    (sel :many :field [User :first_name]) -> (\"Cam\" \"Sameer\" ...)

     ;; Return map(s) that only contain the specified fields.
-    (sel :one :fields [User :id :first_name])        -> ({:id 1 :first_name \"Cam\"}, {:id 2 :first_name \"Sameer\"} ...)
+    (sel :one :fields [User :id :first_name]) -> ({:id 1 :first_name \"Cam\"}, {:id 2 :first_name \"Sameer\"} ...)

   ENTITY may be either an entity like `User` or a vector like `[entity & field-keys]`.
   If just an entity is passed, `sel` will return `default-fields` for ENTITY.
@@ -223,20 +223,20 @@

     (sel :many [OrgPerm :admin :id] :user_id 1) -> return admin and id of OrgPerms whose user_id is 1

-  ENTITY may optionally be a fully-qualified string name of an entity; in this case, the symbol's namespace
+  ENTITY may optionally be a fully-qualified symbol name of an entity; in this case, the symbol's namespace
   will be required and the symbol itself resolved at runtime. This is sometimes neccesary to avoid circular
   dependencies. This is slower, however, due to added runtime overhead.

-    (sel :one \"metabase.models.table/Table\" :id 1) ; require/resolve metabase.models.table/Table. then sel Table 1
+    (sel :one 'metabase.models.table/Table :id 1) ; require/resolve metabase.models.table/Table. Then `sel Table 1

   FORMS may be either keyword args, which will be added to a korma `where` clause, or other korma
    clauses such as `order`, which are passed directly.

     (sel :many Table :db_id 1)                    -> (select User (where {:id 1}))
     (sel :many Table :db_id 1 (order :name :ASC)) -> (select User (where {:id 1}) (order :name ASC))"
+  {:arglists '([one-or-many option? entity & forms])}
   [one-or-many & args]
-  {:arglists ([one-or-many option? entity & forms])
-   :pre [(contains? #{:one :many} one-or-many)]}
+  {:pre [(contains? #{:one :many} one-or-many)]}
   (if (= one-or-many :one)
     `(first (sel :many ~@args (limit 1)))
     (let [[option [entity & forms]] (u/optional keyword? args)]


[TH DG] Pass back errors

[TH DG] Pass back errors

Instead of swallowing them

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/democracyworks/notification-works.git/'


Parsing a bit more.

Parsing a bit more.

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/couragelabs/coachbot.git/'


add return type in doc generator if present (close #32)

--- scripts/cljs-api-parser/src/core.clj
+++ scripts/cljs-api-parser/src/core.clj
@@ -237,6 +237,7 @@
 (defn parse-common
   [form ns- repo]
   (let [name- (second form)
+        return-type (-> name- meta :tag)
         m (meta form)
         lines [(:line m) (:end-line m)]
         num-lines (inc (- (:end-line m) (:line m)))
@@ -245,6 +246,7 @@
         github-link (get-github-file-link repo filename lines)]
     {:ns ns-
      :name name-
+     :return-type return-type
      :full-name (str ns- "/" name-)
      :source source
      :filename filename
@@ -342,6 +344,7 @@
     (keep identity
       [(cljsdoc-section "Name" (:full-name item))
        (cljsdoc-section "Type" (:fn-or-macro item))
+       (cljsdoc-section "Return" (:return-type item))
        (cljsdoc-section "Docstring" (:docstring item))
        (cljsdoc-section "Signature" (join "\n" (:signatures item)))
        (cljsdoc-section "Filename" (:filename item))


basic relay tcp connector

basic relay tcp connector

not enabling by default just yet. need to clean up remote first.

error: pathspec 'src/main/shadow/cljs/devtools/server/relay_tcp.clj' did not match any file(s) known to git

--- src/main/shadow/cljs/devtools/server/relay_tcp.clj
+++ src/main/shadow/cljs/devtools/server/relay_tcp.clj
@@ -0,0 +1,116 @@
+(ns shadow.cljs.devtools.server.relay-tcp
+  (:require [shadow.jvm-log :as log]
+            [clojure.core.async :as async :refer (>!! <!!)]
+            [shadow.remote.relay.api :as relay]
+            [clojure.tools.reader.edn :as edn]
+            [shadow.cljs.devtools.api :as api])
+  (:import [java.net SocketException ServerSocket InetAddress]
+           [java.io BufferedWriter InputStreamReader OutputStreamWriter]
+           [clojure.lang LineNumberingPushbackReader]))
+
+
+(defmacro ^:private thread
+  [^String name daemon & body]
+  `(doto (Thread. (fn [] ~@body) ~name)
+     (.setDaemon ~daemon)
+     (.start)))
+
+(defn connection-loop [relay config socket]
+  (let [socket-in
+        (-> (.getInputStream socket)
+            (InputStreamReader.)
+            (LineNumberingPushbackReader.))
+
+        out
+        (-> (.getOutputStream socket)
+            (OutputStreamWriter.)
+            (BufferedWriter.))
+
+        to-relay
+        (async/chan 128)
+
+        from-relay
+        (async/chan 128)
+
+        relay-close
+        (relay/connect relay to-relay from-relay {:type :tcp-client})]
+
+    (thread
+      (str "shadow-cljs:tcp-relay:client-read")
+      (let [EOF (Object.)]
+        (try
+          (loop []
+            (let [res (edn/read {:eof EOF} socket-in)]
+              (if (identical? res EOF)
+                (do (async/close! to-relay)
+                    (async/close! from-relay))
+                (when (>!! to-relay res)
+                  (recur)))))
+          (catch Exception e
+            (log/debug-ex e ::read-ex)))))
+
+    (loop []
+      (when-some [msg (<!! from-relay)]
+        (when (try
+                (.write out (str (pr-str msg) "\n"))
+                (.flush out)
+                true
+                (catch SocketException se
+                  ;; writing to lost connection throws se
+                  nil)
+                (catch Exception e
+                  (log/warn-ex e ::socket-repl-ex)
+                  nil))
+          (recur))))
+
+    (.close socket)))
+
+(defn start
+  [relay
+   {:keys [host port]
+    :or {host "localhost"
+         port 0}
+    :as config}]
+  (let [addr
+        (InetAddress/getByName host) ;; nil returns loopback
+
+        server-socket
+        (ServerSocket. port 0 addr)
+
+        sockets-ref
+        (atom #{})
+
+        server-thread
+        (thread
+          (str "shadow-cljs:tcp-relay:accept") true
+          (try
+            (loop []
+              (when (not (.isClosed server-socket))
+                (try
+                  (let [conn (.accept server-socket)]
+                    (swap! sockets-ref conj conn)
+                    (thread
+                      (str "shadow-cljs:tcp-relay:client-loop") false
+                      (connection-loop relay config conn)
+                      (swap! sockets-ref disj conn)))
+                  (catch SocketException _disconnect))
+                (recur)))))]
+
+    {:server-thread server-thread
+     :server-socket server-socket
+     :sockets-ref sockets-ref
+     :relay relay
+     :host host
+     :port (.getLocalPort server-socket)}))
+
+(defn stop [{:keys [server-socket server-thread sockets-ref]}]
+  (.close server-socket)
+  (doseq [s @sockets-ref]
+    (.close s))
+  (.interrupt server-thread))
+
+(comment
+  (require '[shadow.cljs.devtools.api :as api])
+  (def x (start (:relay (api/get-runtime!)) {:port 8201}))
+
+  (stop x))


cleaning up logging of warnings and errors

--- support/src/figwheel/client.cljs
+++ support/src/figwheel/client.cljs
@@ -283,16 +283,22 @@

 (def default-on-jsload identity)

+(defn file-line-column [{:keys [file line column]}]
+  (cond-> ""
+    file (str "file " file)
+    line (str " at line " line)
+    (and line column) (str ", column " column)))
+
 (defn default-on-compile-fail [{:keys [formatted-exception exception-data cause] :as ed}]
   (utils/log :debug "Figwheel: Compile Exception")
   (doseq [msg (format-messages exception-data)]
     (utils/log :info msg))
   (if cause
-    (utils/log :info (str "Error on file " (:file cause) ", line " (:line cause) ", column " (:column cause))))
+    (utils/log :info (str "Error on " (file-line-column ed))))
   ed)

 (defn default-on-compile-warning [{:keys [message] :as w}]
-  (utils/log :warn (str "Figwheel: Compile Warning - " message))
+  (utils/log :warn (str "Figwheel: Compile Warning - " (:message message) " in " (file-line-column message)))
   w)

 (defn default-before-load [files]
@@ -318,8 +324,8 @@

    :on-cssload default-on-cssload

-   :on-compile-fail default-on-compile-fail
-   :on-compile-warning default-on-compile-warning
+   :on-compile-fail #'default-on-compile-fail
+   :on-compile-warning #'default-on-compile-warning

    :reload-dependents true


Obviate need to re-specify RMQ conn defaults

RabbitMQ's own libraries already have defaults, so let's use those instead.

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/democracyworks/scheduled-message-works.git/'


Added a private function

Added a private function

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/skprasadu/crud-ui-framework.git/'


set testing

set testing

fatal: unable to access 'https://github.com/skywind3000/language.git/': The requested URL returned error: 403


[#1441]Add :akvo.lumen.specs.transformation/next-dataset-version spec

error: pathspec 'backend/specs/akvo/lumen/specs/transformation.clj' did not match any file(s) known to git

--- backend/specs/akvo/lumen/specs/transformation.clj
+++ backend/specs/akvo/lumen/specs/transformation.clj
@@ -0,0 +1,56 @@
+(ns akvo.lumen.specs.transformation
+  (:require [akvo.lumen.specs :as lumen.s :refer (sample)]
+            [akvo.lumen.specs.db :as db.s]
+            [akvo.lumen.lib.transformation.engine :as engine]
+            [akvo.lumen.util :as u]
+            [akvo.lumen.specs.import.column :as import.column.s]
+            [akvo.lumen.specs.import.values :as i.values.s]
+            [clojure.spec.alpha :as s]
+            [clojure.spec.gen.alpha :as gen]
+            [clojure.string :as string]
+            [clojure.tools.logging :as log]))
+
+(create-ns  'akvo.lumen.specs.db.dataset-version)
+(alias 'db.dsv 'akvo.lumen.specs.db.dataset-version)
+
+(create-ns  'akvo.lumen.specs.db.dataset-version.column)
+(alias 'db.dsv.column 'akvo.lumen.specs.db.dataset-version.column)
+
+
+(s/def ::db.dsv/id ::lumen.s/str-uuid)
+(s/def ::db.dsv/dataset-id ::lumen.s/str-uuid)
+(s/def ::db.dsv/job-execution-id (s/nilable ::lumen.s/str-uuid))
+
+(defn- ds-table-name? [s]
+  (let [[_ uuid] (string/split  s #"ds_")]
+       (lumen.s/str-uuid? uuid)))
+
+(s/def ::db.dsv/table-name (s/with-gen
+                             (s/and string? ds-table-name?)
+                             #(s/gen (into #{} (take 5 (repeatedly (fn [] (str "ds_" (u/squuid)))))))))
+
+(s/def ::db.dsv/version int?)
+(s/def ::db.dsv/transformations any?) ;; TODO complete ...
+
+(s/def ::db.dsv.column/key boolean?)
+(s/def ::db.dsv.column/hidden boolean?)
+(s/def ::sort #{"asc" "dsc"})
+
+(s/def ::db.dsv.column/sort (s/nilable ::sort))
+(s/def ::db.dsv.column/direction (s/nilable string?))
+(s/def ::db.dsv.column/columnName string?)
+
+(s/def ::db.dsv.column/id (s/nilable keyword?))
+(s/def ::db.dsv/column* (s/keys :req-un [::db.dsv.column/hidden ::db.dsv.column/direction
+                                         ::db.dsv.column/sort ::db.dsv.column/columnName]))
+
+(s/def ::db.dsv/column (s/merge ::import.column.s/header ::db.dsv/column*))
+
+(s/def ::db.dsv/columns (s/coll-of ::db.dsv/column :kind vector? :distinct true))
+
+
+
+(s/def ::next-dataset-version (s/keys :req-un [::db.dsv/id ::db.dsv/dataset-id
+                                               ::db.dsv/job-execution-id ::db.dsv/table-name
+                                               ::db.dsv/imported-table-name ::db.dsv/version
+                                               ::db.dsv/transformations ::db.dsv/columns]))


start a test harness for java client

start a test harness for java client

error: pathspec 'dada-core/src/test/clojure/org/dada/core/jms/test_Client.clj' did not match any file(s) known to git

--- dada-core/src/test/clojure/org/dada/core/jms/test_Client.clj
+++ dada-core/src/test/clojure/org/dada/core/jms/test_Client.clj
@@ -0,0 +1,38 @@
+(ns org.dada.core.jms.test-Client
+    (:use
+     [clojure test]
+     [org.dada.core.jms Client])
+    (:import
+     [java.io
+      ByteArrayInputStream
+      ByteArrayOutputStream
+      ObjectInputStream
+      ObjectOutputStream
+      Serializable]
+     [javax.jms
+      Destination Session]
+     [org.dada.slf4j
+      Logger LoggerFactory]
+     [org.dada.core
+      View]
+     [org.dada.core.jms
+      Client]
+     )
+    )
+
+(deftest serialisability
+  (let [session (proxy [Session  Serializable] [])
+	destination (proxy [Destination Serializable] [])
+	client1 (Client. session destination View (long 1000) true)
+	baos (ByteArrayOutputStream.)
+	oos (ObjectOutputStream. baos)]
+    (.writeObject oos client1)
+    (.close oos)
+    (let [bais (ByteArrayInputStream. (.toByteArray baos))
+	  ois (ObjectInputStream. bais)
+	  client2 (.readObject ois)]
+      (.close ois)
+      client2)))
+
+
+


Add more test cases for futures/transform

--- core/test/finagle_clojure/futures_test.clj
+++ core/test/finagle_clojure/futures_test.clj
@@ -57,13 +57,19 @@
   (await (select (NoFuture.) (value 1))) => 1
   (await (select (value 2) (NoFuture.))) => 2)

-(let [success-fn (fn [v] (value :success))
-      failure-fn (fn [t] (value :failure))]
+(let [success-fn-a (fn [v] (value :success-a))
+      failure-fn-a (fn [t] (value :failure-a))
+      success-fn-b (fn [v] (value :success-b))
+      failure-fn-b (fn [t] (value :failure-b))]
   (facts "transform"
-    (-> (value true) (transform success-fn) await) => :success
-    (-> (value true) (transform success-fn failure-fn) await) => :success
-    (-> (exception (Exception.)) (transform success-fn) await) => (throws Exception)
-    (-> (exception (Exception.)) (transform success-fn failure-fn) await) => :failure))
+    (-> (value true) (transform success-fn-a) await) => :success-a
+    (-> (value true) (transform success-fn-a failure-fn-a) await) => :success-a
+    (-> (value true) (transform success-fn-a failure-fn-a) (transform success-fn-b) await) => :success-b
+    (-> (value true) (transform success-fn-a failure-fn-a) (transform success-fn-b failure-fn-b) await) => :success-b
+    (-> (exception (Exception.)) (transform success-fn-a) await) => (throws Exception)
+    (-> (exception (Exception.)) (transform success-fn-a failure-fn-a) await) => :failure-a
+    (-> (exception (Exception.)) (transform success-fn-a (fn [t] (exception t))) (transform success-fn-b failure-fn-b) await) => :failure-b
+    (-> (exception (Exception.)) (transform success-fn-a failure-fn-a) (transform success-fn-b failure-fn-b) await) => :success-b))

 (facts "match-class"
   (-> (IllegalArgumentException.) (match-class Exception :expected)) => :expected


unit tests for POST /api/session/reset_password

--- test/metabase/api/session_test.clj
+++ test/metabase/api/session_test.clj
@@ -7,7 +7,9 @@
             [metabase.test-data :refer :all]
             (metabase.models [session :refer [Session]]
                              [user :refer [User]])
-            [metabase.test.util :refer [expect-eval-actual-first]]))
+            [metabase.test.util :refer [random-name expect-eval-actual-first]]
+            [metabase.test-data :refer :all]
+            [metabase.test-data.create :refer [create-user]]))

 ;; ## POST /api/session
 ;; Test that we can login
@@ -62,3 +64,50 @@
 ;; Test that email not found gives 404
 (expect "Not found."
   (client :post 404 "session/forgot_password" {:email "not-found"}))
+
+
+;; POST /api/session/reset_password
+;; Test that we can reset password from token (AND after token is used it gets removed)
+(expect
+  {:reset_token nil
+   :reset_triggered nil}
+  (let [user-last-name (random-name)
+        token (.toString (java.util.UUID/randomUUID))
+        password {:old "password"
+                  :new "new_password"}
+        {:keys [email id] :as user} (create-user :password (:old password) :last_name user-last-name :reset_token token :reset_triggered (System/currentTimeMillis))
+        creds {:old {:password (:old password)
+                     :email    email}
+               :new {:password (:new password)
+                     :email    email}}]
+    ;; Check that creds work
+    (metabase.http-client/client :post 200 "session" (:old creds))
+    ;; Change the PW
+    (metabase.http-client/client :post 200 "session/reset_password" {:token    token
+                                                                     :password (:new password)})
+    ;; Old creds should no longer work
+    (assert (= (metabase.http-client/client :post 400 "session" (:old creds))
+              "password mismatch"))
+    ;; New creds *should* work
+    (metabase.http-client/client :post 200 "session" (:new creds))
+    ;; Double check that reset token was cleared
+    (sel :one :fields [User :reset_token :reset_triggered] :id id)))
+
+;; Test that token and password are required
+(expect "'token' is a required param."
+  (client :post 400 "session/reset_password" {}))
+
+(expect "'password' is a required param."
+  (client :post 400 "session/reset_password" {:token "anything"}))
+
+;; Test that invalid token returns 404
+(expect "Not found."
+  (client :post 404 "session/reset_password" {:token "not-found"
+                                              :password "whatever"}))
+
+;; Test that old token can expire
+(expect "Not found."
+  (let [token (.toString (java.util.UUID/randomUUID))]
+    (upd User (user->id :rasta) :reset_token token :reset_triggered 0)
+    (client :post 404 "session/reset_password" {:token "not-found"
+                                                :password "whatever"})))


Add a 3scale method name for /voting-methods

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/democracyworks/turbovote-http-api.git/'


Throttle failed login attempts.

Throttle failed login attempts.

Each failed attempt gets recorded and penalized by a delay of the
square of the previous failed attempts in milliseconds. This will be
unnoticeable for legitimate failures but quickly adds up for guessing
attackers; a hundred failed attempts adds a ten-second delay.

A successful login clears the failed attempts.

fatal: unable to access 'https://github.com/clojars/clojars-web.git/': The requested URL returned error: 403


remove debug output

remove debug output

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/tobiasbayer/lambdacd.git/'


Added namespace for description graphs

Added namespace for description graphs

without any implementation by now.

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

fatal: unable to access 'https://github.com/immo/clojure-conexp.git/': The requested URL returned error: 403


Refact 	modified:   test/loganalyzer/core_test.clj

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/StephenBergeron/Specter.git/'


create transfer fee payments

create transfer fee payments

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/starcity-properties/odin.git/'


Update signers to reflect recent departures

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/democracyworks/election-notification-works.git/'


webserver component revived

webserver component revived

error: pathspec 'src/clj/hellhound/components/webserver.clj' did not match any file(s) known to git

--- src/clj/hellhound/components/webserver.clj
+++ src/clj/hellhound/components/webserver.clj
@@ -0,0 +1,87 @@
+(ns hellhound.components.webserver
+  "Hellhound webserver component namespace. Webserver component is
+  responsible for running an `Immutant` webserver and setting up a
+  `bidi` ring handler. In order to run a webserver use `webserver`
+  function  alongside with `hellhound.system.defsystem` macro you can define a
+  system with webserver component in it. But if you want to define your
+  own system map you can use `make-webserver` function and do it like
+  you used to do."
+  (:require [ring.middleware.defaults       :refer [site-defaults]]
+            [hellhound.components.protocols :as protocols]
+            [taoensso.timbre                :as log]
+            [immutant.web                   :as web]))
+
+(defn- http-port
+  []
+  (Integer. (or (env :http-port)  "4000")))
+
+(defn- http-host
+  []
+  (or (env :http-host) "0.0.0.0"))
+
+
+(defrecord Webserver [handler host port]
+  protocols/Lifecycle
+  (start [component]
+    (if-not (:server component)
+      (let [config {:host host :port port :path "/"}
+            server (do (-> (str "Starting web server. Listening on host: %s "
+                                "and port: %d")
+                           (format host port)
+                           (log/info))
+                       (web/run handler config))]
+        (assoc component
+               :server  server
+               :host    host
+               :handler handler
+               :config  config
+               :port    port))
+      component))
+
+  (stop [component]
+    (let [server (:server component)]
+      (-> (str "Stopping web server on host: %s and port: %d")
+          (format (:host component) (:port component))
+          (println))
+      (web/stop server)
+      (dissoc component :server))))
+
+(defn ring-handler
+  "Create a ring handler from the given routs. This function
+  will make sure that sente's required middlewares are present
+  in the resulted handler"
+  [routes options]
+  (let [defaults-config
+        (-> site-defaults
+            (assoc-in [:static :resources] "/")
+            (assoc-in [:security :anti-forgery]
+                      {:read-token (fn [req] (-> req :params :csrf-token))}))
+        ring-defaults-config (merge defaults-config options)]
+
+    ;; To make sure that sente's required middlewares are present.
+    (ring.middleware.defaults/wrap-defaults routes ring-defaults-config)))
+
+
+(defn make-webserver
+  "Creat and launch an `immutant` server."
+  ([routes]
+   (make-webserver routes (http-host) 4000 {}))
+
+  ([routes host]
+   (make-webserver routes host 4000 {}))
+
+  ([routes host port]
+   (make-webserver routes host port {}))
+
+  ([routes host port handler-options]
+   (->Webserver (ring-handler routes handler-options) host port)))
+
+(defn webserver
+  "Create a webserver instance from the webserver components.
+  This function is meant to be used with `hellhound.system.defsystem` macro."
+  ([system-map routes]
+   (webserver system-map routes {}))
+
+  ([system-map routes handler-options]
+   (update-in system-map [:components :webserver]
+             (make-webserver routes (http-host) (http-port) handler-options))))


tiny comment improvement

tiny comment improvement

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/terrancesnyder/engulf.git/'


Add `s-451-deftype-missing-methods-ok-test`

error: pathspec 'test/com/nomistech/clojure_the_language/c_200_clojure_basics/s_451_deftype_missing_methods_ok_test.clj' did not match any file(s) known to git

--- test/com/nomistech/clojure_the_language/c_200_clojure_basics/s_451_deftype_missing_methods_ok_test.clj
+++ test/com/nomistech/clojure_the_language/c_200_clojure_basics/s_451_deftype_missing_methods_ok_test.clj
@@ -0,0 +1,23 @@
+(ns com.nomistech.clojure-the-language.c-200-clojure-basics.s-451-deftype-missing-methods-ok-test
+  (:require
+   [midje.sweet :refer :all]))
+
+;;;; The doc for `deftype` says "Methods should be supplied for all methods of
+;;;; the desired protocol(s) and interface(s), but that's not enforced as shown
+;;;; here.
+
+(defprotocol MyProtocol
+  (method-1 [_])
+  (method-2 [_]))
+
+(deftype MyType [x]
+  MyProtocol
+  (method-1
+    [_]
+    (+ x 100))
+  ;; Note that we are not defining a method for `method-2`.
+  )
+
+(fact "\"Methods should be supplied for all methods\" is not enforced"
+  (method-1 (->MyType 42))
+  => 142)


start adding actual figwheel schema

start adding actual figwheel schema

error: pathspec 'sidecar/src/figwheel_sidecar/validate_config.clj' did not match any file(s) known to git

--- sidecar/src/figwheel_sidecar/validate_config.clj
+++ sidecar/src/figwheel_sidecar/validate_config.clj
@@ -0,0 +1,142 @@
+(ns figwheel-sidecar.validate-config
+  (:require
+   [figwheel-sidecar.type-check :refer [spec ref-schema named? type-check!!!]]
+   [clojure.string :as string]))
+
+(defn boolean? [x] (or (true? x) (false? x)))
+
+(defn anything? [x] true)
+
+(defn enum [& args]
+  (let [enums (set args)]
+    (fn [x] (enums x))))
+
+(defn or-pred [& args]
+  (fn [x] (some #(% x) args)))
+
+(def symbol-or-string? (or-pred symbol? string?))
+
+(def bool-or-string? (or-pred boolean? string?))
+
+(def optimisation? (enum :none :whitespace :simple :advanced))
+(def module-type?  (enum :commonjs :amd :es6))
+
+(def CompilerWarningsSpec
+  (->>
+   [:undeclared-ns-form
+    :protocol-deprecated
+    :undeclared-protocol-symbol
+    :fn-var
+    :invalid-arithmetic
+    :preamble-missing
+    :undeclared-var
+    :protocol-invalid-method
+    :variadic-max-arity
+    :multiple-variadic-overloads
+    :fn-deprecated
+    :redef
+    :fn-arity
+    :invalid-protocol-symbol
+    :dynamic
+    :undeclared-ns
+    :overload-arity
+    :extending-base-js-type
+    :single-segment-namespace
+    :protocol-duped-method
+    :protocol-multiple-impls
+    :invoke-ctor]
+   (map #(vector % boolean?))
+   (into {})))
+
+(def schema-rules
+  (distinct
+   (concat
+    (spec 'RootMap
+          {:figwheel  (ref-schema 'FigwheelOptions)
+           :cljsbuild (ref-schema 'CljsbuildOptions)})
+    (spec 'FigwheelOptions
+          {:http-server-root  string?
+          ; :builds            (ref-schema 'FigwheelOnlyBuilds)
+           :server-port       integer?
+           :server-ip         string?
+           :css-dirs          [string?]
+           :ring-handler      named?
+           :reload-clj-files  boolean?
+           :open-file-command string?
+           :repl              boolean?
+           :nrepl-port        integer?
+           :nrepl-middleware  [named?]})
+    (spec 'FigwheelOptions
+          {:reload-clj-files {:clj  boolean?
+                              :cljc boolean?}})
+    (spec 'CljsbuildOptions
+          {:builds (ref-schema 'CljsBuilds)
+           :repl-listen-port     integer?
+           :repl-launch-commands {named? [named?]}
+           :test-commands        {named? [named?]}
+           :crossovers           [anything?]
+           :crossover-path       [anything?]
+           :crossover-jar        boolean?})
+    (spec 'CljsBuilds
+          {named? (ref-schema 'BuildOptionsMap)})
+    (spec 'CljsBuilds
+          [(ref-schema 'BuildOptionsMap)])
+    (spec 'BuildOptionsMap
+          { :id named?
+            :source-paths    [string?]
+            :figwheel        (ref-schema 'FigwheelClientOptions)
+            :compiler        (ref-schema 'CompilerOptions)
+            :notify-command  [string?]
+            :jar             boolean?
+            :incremental     boolean?
+            :assert          boolean? })
+    (spec 'BuildOptionsMap
+          { :figwheel        boolean?})
+    (spec 'FigwheelClientOptions
+          {:websocket-host      string?
+           :websocket-url       string?
+           :on-jsload           named?
+           :before-jsload       named?
+           :on-cssload          named?
+           :on-compile-fail     named?
+           :on-compile-warning  named?
+           :reload-dependents   boolean?
+           :debug               boolean?
+           :autoload            boolean?
+           :heads-up-display    boolean?
+           :load-warninged-code boolean?
+           :retry-count         integer?
+           :devcards            boolean?
+           :eval-fn             boolean?})
+    (spec 'FigwheelClientOptions
+          {:websocket-host      :js-client-host
+           :eval-fn             named?})
+    (spec 'CompilerOptions
+          :main           symbol-or-string?
+          :asset-path     string?
+          :output-to      string?
+          :output-dir     string?
+          :optimizations  optimisation?
+          :source-map     bool-or-string?
+          :verbose        boolean?
+          :pretty-print   boolean?
+          :target         :nodejs
+          :foreign-libs   [{:file string?
+                            :provides [string?]
+                            :file-min string?
+                            :requires [string?]
+                            :module-type module-type?}]
+          :externs        [string?]
+          :modules        anything? ;; TODO
+          :source-map-path string?
+          :source-map-timestamp boolean?
+          :cache-analysis    boolean?
+          :recompile-dependents boolean?
+          :static-fns  boolean?
+          :warnings    boolean?)
+    (spec 'CompilerOptions
+          {:warnings (ref-schema 'CompilerWarnings)})
+    (spec 'CompilerWarnings CompilerWarningsSpec)
+    ))
+
+  )


Day 3 part 1

Day 3 part 1

fatal: unable to access 'https://github.com/mfikes/advent-of-cljs.git/': The requested URL returned error: 403


all inputs should be within the surrounding element


remove println

remove println

--- test/clj/backtype/storm/transactional_test.clj
+++ test/clj/backtype/storm/transactional_test.clj
@@ -580,7 +580,6 @@

      (bind results (complete-topology cluster (.buildTopology builder)))

-     (println results)
      ;; need to do it this way (check for nothing transaction) because there is one transaction already saved up before that emits nothing (because of how memorytransctionalspout detects partition completion)
      (is (ms= [[0] [0] [2] [0]] (->> (read-tuples results "count")
                              (take 4)


add utility namespace that loads the BouncyCastle provider.

error: pathspec 'src/clojure/pandect/utils/bouncy_castle_provider.clj' did not match any file(s) known to git

--- src/clojure/pandect/utils/bouncy_castle_provider.clj
+++ src/clojure/pandect/utils/bouncy_castle_provider.clj
@@ -0,0 +1,6 @@
+(ns pandect.utils.bouncy-castle-provider
+  (:import java.security.Security
+           org.bouncycastle.jce.provider.BouncyCastleProvider))
+
+(defonce __install__
+  (Security/addProvider (BouncyCastleProvider.)))


started pearson correlation fn

started pearson correlation fn

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/clojure-ml/cml.git/'


Add place holder for cjia

Add place holder for cjia

error: pathspec 'src/clojure/clojure_walkthrough/cjia/ch10_xx.clj' did not match any file(s) known to git

--- src/clojure/clojure_walkthrough/cjia/ch10_xx.clj
+++ src/clojure/clojure_walkthrough/cjia/ch10_xx.clj
@@ -0,0 +1,7 @@
+(ns clojure-walkthrough.cjia.ch10-xx
+  (:require [clojure.test :refer :all]
+            [clojure-walkthrough.cjia.ch10-date-operations :refer :all]))
+
+(deftest test-simple-data-parsing
+  (let [d (date "2009-01-22")]
+    (is (= (day-from d) 22))))


he.cljs (#1296)

he.cljs (#1296)

Create he.cljs

error: pathspec 'src/status_im/translations/he.cljs' did not match any file(s) known to git

--- src/status_im/translations/he.cljs
+++ src/status_im/translations/he.cljs
@@ -0,0 +1,314 @@
+(ns status-im.translations.he)
+
+(def translations
+  {
+   ;common
+   :members-title                         "חבר"
+   :not-implemented                       "!עדיין לא יושם"
+   :chat-name                             "שם הצ'אט"
+   :notifications-title                   "התראות וצלילים"
+   :offline                               "לא מחובר"
+   :search-for                            "...חפש"
+   :cancel                                "בטל"
+   :next                                  "הבא"
+   :type-a-message                        "...הקלד הודעה"
+   :type-a-command                        "...הקלד פעולה"
+   :error                                 "שגיאה"
+
+   :camera-access-error                   ".כדי להעניק את הרשאת המצלמה הנדרשת, בבקשה, תלכו להגדרות המערכת ותוודאו שהאופציה שנבחרה היא סטטוס > מצלמה"
+   :photos-access-error                   ".כדי להעניק את הרשאת התמונות הנדרשת, בבקשה, תלכו להגדרות המערכת ותוודאו שהאופציה שנבחרה היא סטטוס > תמונות"
+
+   ;drawer
+   :invite-friends                        "הזמן חברים"
+   :faq                                   "שאלות נפוצות"
+   :switch-users                          "שנה משתמש"
+   :feedback                              "Got feedback?\nShake your phone!"
+   :view-all                              "View all"
+   :current-network                       "Current network"
+
+   ;chat
+   :is-typing                             "מקליד"
+   :and-you                               "גם אתה"
+   :search-chat                           "חפש בצ'אט"
+   :members                               {:one   "חבר אחד"
+                                           :other "{{count}} חברים"
+                                           :zero  "אין חברים"}
+   :members-active                        {:one   "חבר אחד"
+                                           :other "{{count}} חברים"
+                                           :zero  "אין חברים"}
+   :public-group-status                   "פומבי"
+   :active-online                         "מחובר"
+   :active-unknown                        "לא ידוע"
+   :available                             "זמין"
+   :no-messages                           "אין הודעות"
+   :suggestions-requests                  "בקשות"
+   :suggestions-commands                  "פקודות"
+   :faucet-success                        "בקשת הברז התקבלה"
+   :faucet-error                          "שגיאה בבקשת הברז"
+
+   ;sync
+   :sync-in-progress                      "...מסנכרן"
+   :sync-synced                           "מסונכרן"
+
+   ;messages
+   :status-sending                        "שולח"
+   :status-pending                        "ממתין"
+   :status-sent                           "נשלחה"
+   :status-seen-by-everyone               "פומבי"
+   :status-seen                           "נראה"
+   :status-delivered                      "התקבל"
+   :status-failed                         "נכשל"
+
+   ;datetime
+   :datetime-ago-format                   "{{number}} {{time-intervals}} {{ago}}"
+   :datetime-second                       {:one   "שניה"
+                                           :other "שניות"}
+   :datetime-minute                       {:one   "דקה"
+                                           :other "דקות"}
+   :datetime-hour                         {:one   "שעה"
+                                           :other "שעות"}
+   :datetime-day                          {:one   "יום"
+                                           :other "ימים"}
+   :datetime-multiple                     "s"
+   :datetime-ago                          "לפני"
+   :datetime-yesterday                    "אתמול"
+   :datetime-today                        "היום"
+
+    ;profile
+   :profile                               "פרופיל"
+   :edit-profile                          "ערוך פרופיל"
+   :report-user                           "דווח על המשתמש"
+   :message                               "הודעה"
+   :username                              "שם משתמש"
+   :not-specified                         "לא מוגדר"
+   :public-key                            "מפתח פומבי"
+   :phone-number                          "מספר טלפון"
+   :email                                 "אי-מייל"
+   :update-status                         "...עדכן סטטוס"
+   :add-a-status                          "...הוסף סטטוס"
+   :status-prompt                         ".#hashtags צור סטטוס כדי ליידע אחרים בקשר לדברים אותם אתה מציע. אתה יכול גם להשתמש ב"
+
+   :add-to-contacts                       "הוסף לאנשי קשר"
+   :in-contacts                           "באנשי קשר"
+   :remove-from-contacts                  "הסר מאנשי קשר"
+   :start-conversation                    "התחל שיחה"
+   :send-transaction                      "שלח עיסקה"
+   :share-qr                              "שתף ברקוד"
+   :error-incorrect-name                  "אנא בחר שם אחר"
+   :error-incorrect-email                 "כתובת מייל שגויה"
+
+   ;;make_photo
+   :image-source-title                    "תמונת פרופיל"
+   :image-source-make-photo               "צלם"
+   :image-source-gallery                  "בחר מהגלריה"
+   :image-source-cancel                   "בטל"
+
+   ;;sharing
+   :sharing-copy-to-clipboard             "העתק לשולחן העבודה"
+   :sharing-share                         "...שתף"
+   :sharing-cancel                        "בטל"
+
+   :browsing-title                        "דפדף"
+   :browsing-browse                       "@browse"
+   :browsing-open-in-web-browser          "פתח בדפדפן"
+   :browsing-cancel                       "בטל"
+
+   ;sign-up
+   :contacts-syncronized                  "אנשי הקשר שלך סונכרנו"
+   :confirmation-code                     (str "תודה! שלחנו לך הודעה עם קוד"
+                                               "אישור. אנא ספק את הקוד כדי לאשר את מספר הטלפון שלך")
+   :incorrect-code                        (str "סליחה הקוד שגוי, אנא נסה שנית")
+   :generate-passphrase                   (str "אנא צור משפט קוד כדי שתוכל לשחזר את הגישה שלך או להתחבר ממכשיר אחר")
+   :phew-here-is-your-passphrase          "פוו זה היה קשה, הנה משפט הקוד שלך, *תרשום אותו ותשמור עליו!* אתה תצטרך אותו כדי לשחזר את המשתמש שלך"
+   :here-is-your-passphrase               "הנה משפט הקוד שלך, *תרשום אותו ותשמור עליו!* אתה תצטרך אותו כדי לשחזר את המשתמש שלך."
+   :written-down                          "אנא וודא ששמרת אותו בצורה מאובטחת"
+   :phone-number-required                 "הקש כאן כדי להזין את מספר הטלפון שלך ואני אמצא את החברים שלך"
+   :shake-your-phone                      "!מצאת באג או שיש לך הצעה? פשוט טלטל את הפלאפון"
+   :intro-status                          "דבר איתי כדי להסדיר את המשתמש שלך ולשנות את ההגדרות"
+   :intro-message1                        "!ברוך הבא לסטטוס הקש על הודעה זו כדי לייצר סיסמא ולהתחיל"
+   :account-generation-message            "!שניה, אני הולך להשתמש בקצת קסם מתמטי ולייצר את חשבונך"
+   :move-to-internal-failure-message      "אנו זקוקים לאישורך כדי להזיז קבצים חשובים מהזיכרון החיצוני לפנימי. אנחנו לא נשתמש בזיכרון חיצוני בגרסאות עתידיות"
+   :debug-enabled                         ".שרת הניפוי הותחל! אתה יכול כעת לבצע *status-dev-cli scan* כדי למצוא את השרת מהמחשב שלך על אותה הרשת"
+
+   ;phone types
+   :phone-e164                            "בין לאומי 1"
+   :phone-international                   "בין לאומי 2"
+   :phone-national                        "לאומי"
+   :phone-significant                     "משמעותי"
+
+   ;chats
+   :chats                                 "צ'אטים"
+   :new-chat                              "צ'אט חדש"
+   :delete-chat                           "מחק צ'אט"
+   :new-group-chat                        "צ'אט קבוצתי חדש"
+   :new-public-group-chat                 "הצטרף לצ'אט פומבי"
+   :edit-chats                            "ערוך צ'אטים"
+   :search-chats                          "חפש בצ'אטים"
+   :empty-topic                           "נושא ריק"
+   :topic-format                          "פורמט שגוי [a-z0-9\\-]+"
+   :public-group-topic                    "נושא"
+
+   ;discover
+   :discover                              "גילוי"
+   :none                                  "אף אחד"
+   :search-tags                           "תקליד את תג החיפוש שלך כאן"
+   :popular-tags                          "תגים פופולאריים"
+   :recent                                "חדש"
+   :no-statuses-discovered                "לא התגלה שום סטטוס"
+   :no-statuses-found                     "לא נמצא שום סטטוס"
+
+   ;settings
+   :settings                              "הגדרות"
+
+   ;contacts
+   :contacts                              "אנשי קשר"
+   :new-contact                           "איש קשר חדש"
+   :delete-contact                        "מחק איש קשר"
+   :delete-contact-confirmation           "המשתמש הזה ימחק מרשימת אנשי הקשר שלך"
+   :remove-from-group                     "הסר מהקבוצה"
+   :edit-contacts                         "ערוך אנשי קשר"
+   :search-contacts                       "חפש באנשי הקשר"
+   :show-all                              "הראה את כולם"
+   :contacts-group-dapps                  "אפליקציות מבוזרות"
+   :contacts-group-people                 "אנשים"
+   :contacts-group-new-chat               "התחל צ'אט חדש"
+   :choose-from-contacts                  "בחר מאנשי הקשר"
+   :no-contacts                           "אין שום אנשי קשר"
+   :show-qr                               "הראה ברקוד"
+   :enter-address                         "הזן כתובת"
+   :more                                  "עוד"
+
+   ;group-settings
+   :remove                                "הסר"
+   :save                                  "שמור"
+   :delete                                "מחק"
+   :change-color                          "שנה צבע"
+   :clear-history                         "נקה היסטוריה"
+   :mute-notifications                    "השתק התראות"
+   :leave-chat                            "צא מהצ'אט"
+   :delete-and-leave                      "מחק וצא"
+   :chat-settings                         "הגדרות צ'אט"
+   :edit                                  "ערוך"
+   :add-members                           "הוסף מספרים"
+   :blue                                  "כחול"
+   :purple                                "סגול"
+   :green                                 "ירוק"
+   :red                                   "אדום"
+
+   ;commands
+   :money-command-description             "שלח כסף"
+   :location-command-description          "שלח מיקום"
+   :phone-command-description             "שלח מספר טלפון"
+   :phone-request-text                    "בקשת מספר טלפון"
+   :confirmation-code-command-description "שלח קוד אישור"
+   :confirmation-code-request-text        "בקשת קוד אישור"
+   :send-command-description              "שלח מיקום"
+   :request-command-description           "שלח בקשה"
+   :keypair-password-command-description  ""
+   :help-command-description              "עזרה"
+   :request                               "בקשה"
+   :chat-send-eth                         "{{amount}} אתר"
+   :chat-send-eth-to                      "{{amount}} אתר ל {{chat-name}}"
+   :chat-send-eth-from                    "{{amount}} מאתר {{chat-name}}"
+
+   ;new-group
+   :group-chat-name                       "שם הצ'אט"
+   :empty-group-chat-name                 "אנא הזן שם"
+   :illegal-group-chat-name               "אנא בחר שם שונה"
+   :new-group                             "קבוצה חדשה"
+   :reorder-groups                        "סדר מחדש את הקבוצה"
+   :group-name                            "שם הקבוצה"
+   :edit-group                            "ערוך את הקבוצה"
+   :delete-group                          "מחר את הקבוצה"
+   :delete-group-confirmation             "הקבוצה הזאת תמחק מרשימת הקבוצות. פעולה זאת לא תשפיע על אנשי הקשר"
+   :delete-group-prompt                   "זה לא ישפיע על אנשי הקשר"
+   :group-members                         "חברי הקבוצה"
+   :contact-s                             {:one   "איש קשר"
+                                           :other "אנשי קשר"}
+   ;participants
+   :add-participants                      "הוסף משתתפים"
+   :remove-participants                   "הסר משתתפים"
+
+   ;protocol
+   :received-invitation                   "התקבלה הזמנה לצ'אט"
+   :removed-from-chat                     "הוסרת מהצ'אט הקבוצתי"
+   :left                                  "עזב"
+   :invited                               "הוזמן"
+   :removed                               "הוסר"
+   :You                                   "אתה"
+
+   ;new-contact
+   :add-new-contact                       "הוסף איש קשר חדש"
+   :import-qr                             "לייבא"
+   :scan-qr                               "סרוק ברקוד"
+   :swow-qr                               "הראה ברקוד"
+   :name                                  "שם"
+   :whisper-identity                      "לחש זהות"
+   :address-explication                   "Maybe here should be some text explaining what an address is and where to look for it"
+   :enter-valid-address                   "אנא הזן כתובת תקפה או סרוק ברקוד"
+   :enter-valid-public-key                "אנא הזן קוד פומבי תקף או סרוק ברקוד"
+   :contact-already-added                 "איש הקשר כבר קיים"
+   :can-not-add-yourself                  "אתה לא יכול להוסיף את עצמך"
+   :unknown-address                       "כתובת לא ידועה"
+
+
+   ;login
+   :connect                               "התחבר"
+   :address                               "כתובת"
+   :password                              "סיסמא"
+   :login                                 "כניסה תלמערכת"
+   :sign-in-to-status                     "התחבר לסטטוס"
+   :sign-in                               "התחבר"
+   :wrong-password                        "סיסמא שגויה"
+
+   ;recover
+   :recover-from-passphrase               "שחזר סיסמא ממשפט קוד"
+   :recover-explain                       "אנא הזן את משפט הקוד של הסיסמא שלך כדי לשחזר גישה"
+   :passphrase                            "משפט קוד"
+   :recover                               "שחזר"
+   :enter-valid-passphrase                "אנא הקש משפט קוד"
+   :enter-valid-password                  "אנא הקש סיסמא"
+   :twelve-words-in-correct-order         "12 מילים בסדר הנכון"
+
+   ;accounts
+   :recover-access                        "שחזר גישה"
+   :add-account                           "הוסף איש קשר"
+   :create-new-account                    "יצר איש קשר חדש"
+
+   ;wallet-qr-code
+   :done                                  "הושלם"
+   :main-wallet                           "ארנק ראשי"
+
+   ;validation
+   :invalid-phone                         "מספר טלפון שגוי"
+   :amount                                "כמות"
+   :not-enough-eth                        (str "לא מספיק אתר בחשבון "
+                                               "({{balance}} אתר)")
+   ;transactions
+   :confirm                               "אשר"
+   :confirm-transactions                  {:one   "אשר העברה"
+                                           :other "אשר {{count}} העברות"
+                                           :zero  "אין העברות"}
+   :transactions-confirmed                {:one   "העברה אושרה"
+                                           :other "{{count}} העברות אושרו"
+                                           :zero  "אין העברות שהושלמו"}
+   :transaction                           "העברות"
+   :unsigned-transactions                 "העברות ללא חתימה"
+   :no-unsigned-transactions              "אין העברות ללא חתימה"
+   :enter-password-transactions           {:one   "אשר העברה אל ידי הקשת סיסמתך"
+                                           :other "אשר העברות על ידי הקשת סיסמתך"}
+   :status                                "סטטוס"
+   :pending-confirmation                  "ממתיך לאישור העברה"
+   :recipient                             "מקבל"
+   :one-more-item                         "עוד פריט אחד"
+   :fee                                   "עמלה"
+   :estimated-fee                         "עמלה מעורכת"
+   :value                                 "שווי"
+   :to                                    "ל"
+   :from                                  "מ"
+   :data                                  "נתונים"
+   :got-it                                "קיבלתי"
+   :contract-creation                     "יצירת חוזה"
+
+   ;:webview
+   :web-view-error                        "אופס,טעות"})


Update deps.

Update deps.

--- project.clj
+++ project.clj
@@ -14,20 +14,20 @@
   ;; All profile dependencies
   :dependencies [
     ;; Lisp on the JVM http://clojure.org/documentation
-    [org.clojure/clojure "1.10.1"]
+    [org.clojure/clojure "1.10.2-alpha4"]
     ;; HTML rendering https://github.com/weavejester/hiccup
     [hiccup "2.0.0-alpha2"]
     ;; Async programming tools https://github.com/ztellman/manifold
-    [manifold "0.1.9-alpha3"]
+    [manifold "0.1.9-alpha4"]
     ;; Namespace management https://github.com/clojure/tools.namespace
     ;; NB: org.clojure/tools.reader is pulled in by oc.lib
-    [org.clojure/tools.namespace "0.3.1" :exclusions [org.clojure/tools.reader]]
+    [org.clojure/tools.namespace "1.0.0" :exclusions [org.clojure/tools.reader]]

     ;; General data-binding functionality for Jackson: works on core streaming API https://github.com/FasterXML/jackson-databind
-    [com.fasterxml.jackson.core/jackson-databind "2.11.2"]
+    [com.fasterxml.jackson.core/jackson-databind "2.12.0-rc1"]

     ;; Library for OC projects https://github.com/open-company/open-company-lib
-    [open-company/lib "0.17.29-alpha45"]
+    [open-company/lib "0.17.29-alpha54" :exclusions [org.clojure/tools.logging]]
     ;; In addition to common functions, brings in the following common dependencies used by this project:
     ;; Component - Component Lifecycle https://github.com/stuartsierra/component
     ;; Schema - Data validation https://github.com/Prismatic/schema
@@ -43,7 +43,7 @@

   ;; All profile plugins
   :plugins [
-    [lein-environ "1.1.0"] ; Get environment settings from different sources https://github.com/weavejester/environ
+    [lein-environ "1.2.0"] ; Get environment settings from different sources https://github.com/weavejester/environ
   ]

   :profiles {
@@ -55,7 +55,7 @@
       }
       :plugins [
         ;; Linter https://github.com/jonase/eastwood
-        [jonase/eastwood "0.3.6"]
+        [jonase/eastwood "0.3.11"]
         ;; Static code search for non-idiomatic code https://github.com/jonase/kibit
         [lein-kibit "0.1.8" :exclusions [org.clojure/clojure]]
       ]
@@ -86,7 +86,7 @@
         ;; Runs bikeshed, kibit and eastwood https://github.com/itang/lein-checkall
         [lein-checkall "0.1.1"]
         ;; pretty-print the lein project map https://github.com/technomancy/leiningen/tree/master/lein-pprint
-        [lein-pprint "1.2.0"]
+        [lein-pprint "1.3.2"]
         ;; Check for outdated dependencies https://github.com/xsc/lein-ancient
         [lein-ancient "0.6.15"]
         ;; Catch spelling mistakes in docs and docstrings https://github.com/cldwalker/lein-spell


update misc. project dependencies

update misc. project dependencies

--- project.clj
+++ project.clj
@@ -2,27 +2,27 @@
   :dependencies [[org.clojure/clojure "1.5.1"]
                  [com.datomic/datomic-free "0.8.4159" :exclusions [com.amazonaws/aws-java-sdk]]
                  [ring/ring-core "1.2.0" :exclusions [org.clojure/tools.reader]]
-                 [org.clojure/data.json "0.2.3"]
-                 [liberator "0.10.0" :exlusions [org.clojure/data.json]]
+                 [org.clojure/data.json "0.2.4"]
+                 [liberator "0.11.0" :exlusions [org.clojure/data.json]]
                  [lib-noir "0.6.8"]
-                 [compojure "1.1.5" :exclusions [org.clojure/tools.macro
+                 [compojure "1.1.6" :exclusions [org.clojure/tools.macro
                                                  org.clojure/core.incubator
                                                  ring/ring-core]]
                  [ring-server "0.3.0" :exclusions [org.clojure/core.incubator]]
                  [com.cemerick/friend "0.2.0"]
-                 [com.taoensso/timbre "2.7.1"]
+                 [com.taoensso/timbre "3.1.6"]
                  [log4j "1.2.17" :exclusions [javax.mail/mail
                                               javax.jms/jms
                                               com.sun.jdmk/jmxtools
                                               com.sun.jmx/jmxri]]
-                 [hiccup "1.0.4"]
-                 [org.clojure/math.combinatorics "0.0.4"]
+                 [hiccup "1.0.5"]
+                 [org.clojure/math.combinatorics "0.0.7"]
                  [clj-time "0.6.0"]
-                 [com.stuartsierra/component "0.2.0"]
+                 [com.stuartsierra/component "0.2.1"]
                  [org.clojure/tools.nrepl "0.2.3"]]

   :hooks [configleaf.hooks]
-  :configleaf {:verbose true}
+  :configleaf {:verbose false}

   :lein-release {:deploy-via :shell
                  :build-via  :lein-ring-uberwar
@@ -60,13 +60,13 @@
                    :dependencies [[org.clojure/clojurescript "0.0-2030"]
                                   [org.clojure/core.async "0.1.256.0-1bf8cf-alpha"]
                                   [org.clojure/tools.namespace "0.2.4"]
-                                  [org.clojure/java.classpath "0.2.1"]
+                                  [org.clojure/java.classpath "0.2.2"]
                                   [ring-mock "0.1.5"]
                                   [ring/ring-devel "1.2.0"]
-                                  [midje "1.5.1"]
+                                  [midje "1.5.1" :exclusions [org.codehaus.plexus/plexus-utils slingshot]]
                                   [server-socket "1.0.0"]
-                                  [prismatic/dommy "0.1.1"]
-                                  [secretary "0.4.0" :exclusions [org.clojure/clojurescript]]
+                                  [prismatic/dommy "0.1.2"]
+                                  [secretary "1.1.0" :exclusions [org.clojure/clojurescript]]
                                   [jayq "2.5.0"]]
                    :plugins      [[com.cemerick/austin "0.1.3"]]
                    :repositories {"sonatype-oss-public"


version

version

--- project.clj
+++ project.clj
@@ -24,7 +24,7 @@
                  [org.clojure/tools.logging "0.3.1"]

                  ;; command line
-                 [com.zensols.tools/actioncli "0.0.8"]
+                 [com.zensols.tools/actioncli "0.0.9"]

                  ;; dev
                  [com.zensols.gui/tabres "0.0.5"]


Update React to 0.13.3-0

Update React to 0.13.3-0

--- project.clj
+++ project.clj
@@ -5,7 +5,7 @@
   :min-lein-version "2.0.0"
   :license {:name "Eclipse Public License"
             :url "http://www.eclipse.org/legal/epl-v10.html"}
-  :dependencies [[cljsjs/react "0.12.2-5"]
+  :dependencies [[cljsjs/react "0.13.3-0"]
                  [org.clojure/clojure "1.7.0-beta3"]
                  [org.clojure/clojurescript "0.0-3308" :scope "provided"]]
   :aliases {"cleantest" ["do" "clean," "test," "cljsbuild" "test"]


Add an iOS target to ClojureScript build

fatal: unable to access 'https://github.com/mfikes/qttt.git/': The requested URL returned error: 403


lein-release plugin: bumped version from 0.13 to 0.14-SNAPSHOT for next development cycle

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject tyranitar "0.13"
+(defproject tyranitar "0.14-SNAPSHOT"
   :description "Tyranitar service"
   :url "http://wikis.in.nokia.com/NokiaMusicArchitecture/Tyranitar"


more notes

more notes

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/michaelsbradleyjr/transwarp.git/'


indent

indent


Add a simple test to verify noir-app deployed

error: pathspec 'integration-tests/src/test/clojure/immutant/integs/noir.clj' did not match any file(s) known to git

--- integration-tests/src/test/clojure/immutant/integs/noir.clj
+++ integration-tests/src/test/clojure/immutant/integs/noir.clj
@@ -0,0 +1,33 @@
+;; Copyright 2008-2012 Red Hat, Inc, and individual contributors.
+;;
+;; This is free software; you can redistribute it and/or modify it
+;; under the terms of the GNU Lesser General Public License as
+;; published by the Free Software Foundation; either version 2.1 of
+;; the License, or (at your option) any later version.
+;;
+;; This software is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+;; Lesser General Public License for more details.
+;;
+;; You should have received a copy of the GNU Lesser General Public
+;; License along with this software; if not, write to the Free
+;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+;; 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+(ns immutant.integs.noir
+  (:use [fntest.core])
+  (:use clojure.test)
+  (:require [clj-http.client :as client]))
+
+(use-fixtures :once (with-deployment *file*
+                      {
+                       :root "apps/ring/noir-app/"
+                       :context-path "/noir-app"
+                       }))
+
+(deftest simple "it should work"
+  (let [result (client/get "http://localhost:8080/noir-app")]
+    ;; (println "RESPONSE" result)
+    (is (.contains (result :body) "Noir is up and running"))))
+


don't assoc db into request

don't assoc db into request

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/fhirbase/fhirterm.git/'


Solve Distance Between Two Points in clojure

error: pathspec 'solutions/uri/1015/1015.clj' did not match any file(s) known to git

--- solutions/uri/1015/1015.clj
+++ solutions/uri/1015/1015.clj
@@ -0,0 +1,10 @@
+(ns main
+  (:require [clojure.string :as str]))
+
+(defn main []
+  (let [[x1 y1] (-> (read-line) (str/split #" "))
+        [x2 y2] (-> (read-line) (str/split #" "))
+        [x1' y1' x2' y2'] (map #(Double/parseDouble %) [x1 y1 x2 y2])]
+    (printf "%.4f%n" (Math/sqrt (+ (Math/pow (- x2' x1') 2) (Math/pow (- y2' y1') 2))))))
+
+(main)


go-loop caused 100% cpu usage

go-loop caused 100% cpu usage

--- sidecar/src/figwheel_sidecar/repl.clj
+++ sidecar/src/figwheel_sidecar/repl.clj
@@ -20,12 +20,14 @@
     (<!! out)))

 ;; limit how long we wait?
+;; this is really rough we can wait for a the connection atom to
+;; change for the positive
 (defn wait-for-connection [{:keys [connection-count]}]
   (when (< @connection-count 1)
-    (<!! (go-loop []
-           (when (< @connection-count 1)
-             (timeout 500)
-             (recur))))))
+    (loop []
+      (when (< @connection-count 1)
+        (Thread/sleep 500)
+        (recur)))))

 (defn add-repl-print-callback! [{:keys [browser-callbacks]}]
   (swap! browser-callbacks assoc "figwheel-repl-print"


first version of ws-client

first version of ws-client

Written in Clojure.
Sends requests against given server with defined number of threads (or defaults to number of processors)

      Example: (run-load-test "http://localhost:8888/ws-java-servlet-blocking/testA" 2)

Currently does not have a run script, only executable through Clojure REPL. A script or gradle task will come.

It outputs logs like this for now:

timestamp:1358790809982 threads: 2 duration: 362.656
timestamp:1358790810135 threads: 2 duration: 333.307
timestamp:1358790810316 threads: 2 duration: 333.771
timestamp:1358790810476 threads: 2 duration: 340.92
timestamp:1358790810659 threads: 2 duration: 342.781
timestamp:1358790810810 threads: 2 duration: 333.922
timestamp:1358790810941 threads: 2 duration: 281.883

This will evolve as I work on the tools to convert from logs across distributed clients into a single report with graphs.

error: pathspec 'ws-client/src/main/clojure/ws/client/ws-client.clj' did not match any file(s) known to git

--- ws-client/src/main/clojure/ws/client/ws-client.clj
+++ ws-client/src/main/clojure/ws/client/ws-client.clj
@@ -0,0 +1,71 @@
+(ns ws.client.ws-client
+  (:gen-class)
+  (:require [clj-http.client :as http]
+            [clojure.java.io :as io]))
+
+(declare send-requests response-log)
+
+(defn run-load-test
+  "Execute load test against given URL
+
+  Examples:
+    (run-load-test \"http://localhost:8888/ws-java-servlet-blocking/testA\") ; to use the number of CPUs for numThreads
+    (run-load-test \"http://localhost:8888/ws-java-servlet-blocking/testA\" 2) ; to run with 2 threads
+  "
+  ([url] (run-load-test url (-> (Runtime/getRuntime) .availableProcessors)))
+  ([url num-threads]
+    (println "Starting load test")
+    (with-open [log-writer (writer "/tmp/test2.txt")]
+      (println "Log file opened")
+      (http/with-connection-pool {:timeout 500 :threads 20 :insecure? false :default-per-route 20}
+        (let [futures (doall (for [i (range num-threads)]
+                             (future
+                               (println "send-requests starting in thread: " (Thread/currentThread))
+                               (send-requests url 10 log-writer num-threads))))]
+          (println "starting")
+          (doseq [f futures]
+            ; wait for each future to complete
+            (deref f))
+          ; (println (deref f 900 #(future-cancel f))) ; this isn't working (returns function but doesn't execute it)
+          (println "Done load test."))))))
+
+
+; used for sending response logs to and serializing them to output
+(def response-log (agent 0))
+
+(defmacro duration-in-millis
+  "Evaluates expr and records the time it took in millis.
+   Passes the time as the first argument to 'on-complete' then returns the expression response."
+  [expr on-complete]
+  `(let [start# (. System (nanoTime))
+         ret# ~expr]
+     (~on-complete (/ (double (- (. System (nanoTime)) start#)) 1000000.0))
+     ret#))
+
+(defn- send-response-log
+  "Function that will 'send-off' for asynchronously logging response metrics.
+   This function itself should not nothing blocking."
+  [time-in-millis log-writer num-threads]
+  (send-off response-log (fn [count]
+              (.write log-writer (str "timestamp:" (System/currentTimeMillis) " threads: " num-threads " duration: " time-in-millis "\n"))
+              (if (= 10 count)
+                (do
+                  (.flush log-writer); flush writer every 10 log entries
+                  0) ; return 0 as the value to reset count
+                (inc count) ; increment the agent value as a counter
+              )
+              )))
+
+(defn- send-requests
+  "Send an HTTP request 'count' times and log metrics after each response."
+  [url count log-writer num-threads]
+  (dotimes [n count]
+      (let
+        ; we generate a random id to seed the request with a different arg each request
+        [url (str url "?id=" (rand-int 999999))]
+        ; perform http/get inside duration-in-millis macro which passes the
+        ; duration of the http/get function to the following function
+        (duration-in-millis (http/get url) #(send-response-log % log-writer num-threads))
+        )))
+
+


pr-str some log data

pr-str some log data

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/democracyworks/turbovote-http-api.git/'


change wording

change wording

--- sidecar/src/figwheel_sidecar/components/figwheel_server.clj
+++ sidecar/src/figwheel_sidecar/components/figwheel_server.clj
@@ -12,7 +12,7 @@
       this))
   (stop [this]
     (when (:http-server this)
-      (println "Figwheel: Stopping Server")
+      (println "Figwheel: Stopping WebSocket Server")
       (fig/stop-server this))
     (dissoc this :http-server)))


[TH JE] simplified regex on simpler tests

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/democracyworks/electorate-works.git/'


add test for history

add test for history

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/fhirbase/fhirplace.git/'


Add error view

Add error view

error: pathspec 'src/rdf_path_examples/views.clj' did not match any file(s) known to git

--- src/rdf_path_examples/views.clj
+++ src/rdf_path_examples/views.clj
@@ -0,0 +1,9 @@
+(ns rdf-path-examples.views)
+
+(defn error
+  "Render JSON-LD description of the error."
+  [{:keys [error-msg status]}]
+  {"@context" "http://www.w3.org/ns/hydra/context.jsonld"
+   "@type" "Error"
+   "statusCode" status
+   "description" error-msg})


added tutorial 4

added tutorial 4

error: pathspec 'src/maqueta/hello/update_loop.clj' did not match any file(s) known to git

--- src/maqueta/hello/update_loop.clj
+++ src/maqueta/hello/update_loop.clj
@@ -0,0 +1,17 @@
+(ns maqueta.hello.update-loop
+  (:use (maqueta application assets))
+  (:import (com.jme3.math ColorRGBA Vector3f)
+           com.jme3.scene.Geometry
+           com.jme3.scene.shape.Box))
+
+(def player (let [box (Box. Vector3f/ZERO 1 1 1)
+                  geo (Geometry. "blue cube" box)
+                  mat (load-material "Common/MatDefs/Misc/Unshaded.j3md")]
+              (.setColor mat "Color" ColorRGBA/Blue)
+              (.setMaterial geo mat)
+              geo))
+
+(defn -main
+  []
+  (.start (make-app :root-node player
+                    :update-fn #(.rotate player 0 (* 2 %2) 0))))


add java queue

add java queue

error: pathspec 'src/ca_recipe/jqueue.clj' did not match any file(s) known to git

--- src/ca_recipe/jqueue.clj
+++ src/ca_recipe/jqueue.clj
@@ -0,0 +1,25 @@
+(ns ca-recipe.jqueue
+  (:import [java.util.concurrent LinkedBlockingQueue]))
+
+(defn pusher [q n]
+  (loop [i 0]
+    (when (< i n)
+      (.put q i)
+      (recur (inc i))))
+  (.put q :END))
+
+(defn popper [q]
+  (loop [items []]
+    (let [item (.take q)]
+      (if (= item :END)
+        item
+        (recur (conj items item))))))
+
+(defn flow [n]
+  (let [q (LinkedBlockingQueue.)
+        consumer (future (papper q))
+        begin (System/currentTimeMillis)
+        producer (future (pusher q n))
+        received @cunsumer
+        end (System/currentTimeMillis)]
+    (println "Received:" (count received) "in" (- end begin) "ms")))


Document :color? option in wrap-stracktrace docstring

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/meowcakes/ring.git/'


Update ky vbm link

Update ky vbm link

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/democracyworks/vote-by-mail-works.git/'


Stub for new test module: test-utils

Stub for new test module: test-utils

error: pathspec 'test/clouseau/test_utils.clj' did not match any file(s) known to git

--- test/clouseau/test_utils.clj
+++ test/clouseau/test_utils.clj
@@ -0,0 +1,42 @@
+;;;
+;;;   Clouseau
+;;;
+;;;    Copyright (C) 2015, 2016  Pavel Tisnovsky <ptisnovs@redhat.com>
+;;;
+;;; Clouseau is free software; you can redistribute it and/or modify
+;;; it under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 2, or (at your option)
+;;; any later version.
+;;;
+;;; Clouseau is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;;; General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with Clouseau; see the file COPYING.  If not, write to the
+;;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+;;; 02110-1301 USA.
+;;;
+;;; Linking this library statically or dynamically with other modules is
+;;; making a combined work based on this library.  Thus, the terms and
+;;; conditions of the GNU General Public License cover the whole
+;;; combination.
+;;;
+;;; As a special exception, the copyright holders of this library give you
+;;; permission to link this library with independent modules to produce an
+;;; executable, regardless of the license terms of these independent
+;;; modules, and to copy and distribute the resulting executable under
+;;; terms of your choice, provided that you also meet, for each linked
+;;; independent module, the terms and conditions of the license of that
+;;; module.  An independent module is a module which is not derived from
+;;; or based on this library.  If you modify this library, you may extend
+;;; this exception to your version of the library, but you are not
+;;; obligated to do so. If you do not wish to do so, delete this
+;;; exception statement from your version.
+;;;
+
+(ns clouseau.test-utils
+  (:require [clojure.test :refer :all]
+            [clouseau.utils :refer :all]))
+


add task queuing

add task queuing

error: pathspec 'src/ca_recipe/queue.clj' did not match any file(s) known to git

--- src/ca_recipe/queue.clj
+++ src/ca_recipe/queue.clj
@@ -0,0 +1,25 @@
+(ns ch5.jqueue
+  (:import [java.util.concurrent LinkedBlockingQueue]))
+
+(defn pusher [q n]
+  (loop [i 0]
+    (when (< i n)
+      (.put q i)
+      (recur (inc i))))
+  (.put q :END))
+
+(defn popper [q]
+  (loop [items []]
+    (let [item (.take q)]
+      (if (= item :END)
+        items
+        (recur (conj items item))))))
+
+(defn flow [n]
+  (let [q (LinkedBlockingQueue.)
+        consumer (future (popper q))
+        begin (System/currentTimeMillis)
+        producer (future (pusher q n))
+        received @consumer
+        end (System/currentTimeMillis)]
+    (println "Received:" (count received) "in" (- end begin) "ms")))


Update example

Update example

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/modnakasta/weasel.git/'


left-align text on homepage because center looked odd

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/clojurecup/cc2014-frontend.git/'


added mastersign.geom namespace for geometry related functions based od java.awt.geom

error: pathspec 'src/mastersign/geom.clj' did not match any file(s) known to git

--- src/mastersign/geom.clj
+++ src/mastersign/geom.clj
@@ -0,0 +1,41 @@
+(ns mastersign.geom
+  (:import [java.awt.geom
+            Area
+            Rectangle2D Rectangle2D$Float
+            Point2D Point2D$Float
+            Ellipse2D Ellipse2D$Float]))
+
+(defn point
+  [x y] (Point2D$Float. (float x) (float y)))
+
+(defn rectangle
+  ([x y w h] (Rectangle2D$Float. (float x) (float y) (float w) (float h)))
+  ([p w h] (rectangle (.x p) (.y p) w h)))
+
+(defn ellipse
+  ([x y w h] (Ellipse2D$Float. (float x) (float y) (float w) (float h)))
+  ([p w h] (ellipse (.x p) (.y p) w h)))
+
+(defn rect-center
+  [r]
+  (point (+ (.x r) (/ (.width r) 2.0))
+         (+ (.y r) (/ (.height r) 2.0))))
+
+(defn area
+  [& shapes]
+  (let [a (Area.)]
+    (doseq [s shapes]
+      (.add a s))
+    a))
+
+(defn translate-point
+  [p x y]
+  (point (+ (.x p) x) (+ (.y p) y)))
+
+(defn translate-rect
+  [r x y]
+  (rectangle (+ (.x r) x) (+ (.y r) y) (.width r) (.height r)))
+
+(defn translate-ellipse
+  [e x y]
+  (ellipse (+ (.x e) x) (+ (.y e) y) (.width e) (.height e)))


Move collection check to lean-map for easier testing

error: pathspec 'test/collection_check/core.cljc' did not match any file(s) known to git

--- test/collection_check/core.cljc
+++ test/collection_check/core.cljc
@@ -0,0 +1,314 @@
+; Copyright
+; Martin Klepsch 2015
+; https://github.com/martinklepsch/collection-check-1
+
+; Copyright
+; Zach Tellman 2013
+; https://github.com/ztellman/collection-check
+
+; This is Martin Klepsh's port of Zach Tellmans Collection Check over to ClojureScript
+; The port is currently a PR (https://github.com/ztellman/collection-check/pull/13) waiting to get merged
+;
+; I'm including the port directly to save developers of this library extra steps to get the property based tests working
+
+(ns collection-check.core
+  (:require
+    [clojure.string :as str]
+    [clojure.test.check :refer (quick-check)]
+    [clojure.test.check.generators :as gen]
+    [clojure.test.check.properties :as prop]
+    ;; Macros Clojure
+    #?(:clj [clojure.test :as ct :refer [is]]
+       :cljs [cljs.test :as ct :refer-macros [is]])
+    #?(:clj [com.gfredericks.test.chuck.clojure-test :as chuck]
+       :cljs [com.gfredericks.test.chuck.clojure-test :as chuck :include-macros true]))
+  ;; Macros ClojureScript
+  #?(:clj (:import [java.util Collection List Map])))
+
+#?(:clj (set! *warn-on-reflection* false))
+
+;;;
+
+(defn gen-meta [gen]
+  (gen/fmap
+    (fn [[x meta]]
+      (if #?(:clj (instance? clojure.lang.IObj x)
+             :cljs (satisfies? cljs.core/IWithMeta x))
+        (with-meta x {:foo meta})
+        x))
+    (gen/tuple
+      gen
+      (gen/one-of [gen/int (gen/return nil)]))))
+
+(defn- tuple* [& args]
+  (->> args
+       (map
+         #(if (and (map? %) (contains? % :gen))
+           %
+           (gen/return %)))
+       (apply gen/tuple)))
+
+(defn- ttuple [& args]
+  (gen/tuple (apply tuple* args)))
+
+;;;
+
+(defn- seq-actions [element-generator]
+  (gen/fmap
+    (fn [[pre actions post]]
+      (concat [pre] actions [post]))
+    (tuple*
+      [:seq]
+      (gen/list
+        (gen/one-of
+          [(tuple* :rest)
+           (tuple* :map-id)
+           (tuple* :cons element-generator)
+           (tuple* :conj element-generator)]))
+      [:into])))
+
+(defn- transient-actions [& intermediate-actions]
+  (gen/fmap
+    (fn [[pre actions post]]
+      (concat [pre] actions [post]))
+    (tuple*
+      [:transient]
+      (gen/list
+        (gen/one-of
+          (vec intermediate-actions)))
+      [:persistent!])))
+
+(defn- gen-vector-actions [element-generator transient? ordered?]
+  (let [element-generator (gen-meta element-generator)
+        standard [(ttuple :pop)
+                  (ttuple :conj element-generator)
+                  (ttuple :assoc (gen/choose 0 1e3) element-generator)]]
+    (gen/list
+      (gen/one-of
+        (concat
+          standard
+          (when transient?
+            [(transient-actions
+               (tuple* :conj! element-generator)
+               (tuple* :assoc! (gen/choose 0 999) element-generator)
+               (tuple* :pop!))])
+          (when ordered?
+            [(seq-actions element-generator)]))))))
+
+(defn- gen-map-actions [key-generator value-generator transient? ordered?]
+  (let [key-generator (gen-meta key-generator)
+        value-generator (gen-meta value-generator)
+        standard [(ttuple :dissoc key-generator)
+                  (ttuple :assoc key-generator value-generator)]]
+    (gen/list
+      (gen/one-of
+        (concat
+          standard
+          (when transient?
+            [(transient-actions
+               (tuple* :dissoc! key-generator)
+               (tuple* :assoc! key-generator value-generator))])
+          (when ordered?
+            [(seq-actions (tuple* key-generator value-generator))]))))))
+
+(defn- gen-set-actions [element-generator transient? ordered?]
+  (let [element-generator (gen-meta element-generator)
+        standard [(ttuple :conj element-generator)
+                  (ttuple :disj element-generator)]]
+    (gen/list
+      (gen/one-of
+        (concat
+          standard
+          (when transient?
+            [(transient-actions
+               (tuple* :conj! element-generator)
+               (tuple* :disj! element-generator))])
+          (when ordered?
+            [(seq-actions element-generator)]))))))
+
+(defn- transient? [x]
+  #?(:clj  (instance? clojure.lang.IEditableCollection x)
+     :cljs (satisfies? cljs.core/IEditableCollection x)))
+
+(defn- build-collections
+  "Given a list of actions, constructs two parallel collections that can be compared
+   for equivalencies."
+  [coll-a coll-b vector-like? actions]
+  (let [orig-a coll-a
+        orig-b coll-b]
+    (reduce
+      (fn [[coll-a coll-b prev-actions] [action x y :as act]]
+
+        ;; if it's a vector, we need to choose a valid index
+        (let [idx (when (and vector-like? (#{:assoc :assoc!} action))
+                    (if (< 900 x)
+                      (count coll-a)
+                      (int (* (count coll-a) (/ x 1e3)))))
+              [action x y :as act] (if idx
+                                     [action idx y]
+                                     act)
+              f (case action
+                  :cons #(cons x %)
+                  :rest rest
+                  :map-id #(map identity %)
+                  :seq seq
+                  :into [#(into (empty orig-a) %) #(into (empty orig-b) %)]
+                  :persistent! persistent!
+                  :transient transient
+                  :pop #(if (empty? %) % (pop %))
+                  :pop! #(if (= 0 (count %)) % (pop! %))
+                  :conj #(conj % x)
+                  :conj! #(conj! % x)
+                  :disj #(disj % x)
+                  :disj! #(disj! % x)
+                  :assoc #(assoc % x y)
+                  :assoc! #(assoc! % x y)
+                  :dissoc #(dissoc % x)
+                  :dissoc! #(dissoc! % x))
+              f-a (if (vector? f) (first f) f)
+              f-b (if (vector? f) (second f) f)]
+
+          [(f-a coll-a)
+           (f-b coll-b)
+           (conj prev-actions act)]))
+      [coll-a coll-b []]
+      (apply concat actions))))
+
+;;;
+
+;; indirection for 1.4 compatibility
+;; (def reduced* (ns-resolve 'clojure.core 'reduced)) ;; CLJC
+
+(defn assert-equivalent-collections
+  [a b]
+  (is (= (count a) (count b) #?@(:clj [(.size a) (.size b)])))
+  (is (= a b))
+  (is (= b a))
+  (is (= (hash a) (hash b)))
+  #?@(:clj [(is (.equals ^Object a b))
+            (is (.equals ^Object b a))
+            (is (= (.hashCode ^Object a) (.hashCode ^Object b)))])
+  (is (= a b
+         (into (empty a) a)
+         (into (empty b) b)
+         (into (empty a) b)
+         (into (empty b) a)))
+  (is (= (into (empty a) (take 1 a))
+         (reduce #(reduced (conj %1 %2)) (empty a) a)))
+  (is (= (into (empty b) (take 1 b))
+         (reduce #(reduced (conj %1 %2)) (empty b) b))))
+
+(defn- meta-map [s]
+  (->> s (map #(vector % (meta %))) (into {})))
+
+(defn assert-equivalent-vectors [a b]
+  (assert-equivalent-collections a b)
+  (is (= (first a) (first b)))
+  (is (= (map #(nth a %) (range (count a)))
+         (map #(nth b %) (range (count b)))))
+  (is (= (map #(a %) (range (count a)))
+         (map #(b %) (range (count b)))))
+  (is (= (map #(get a %) (range (count a)))
+         (map #(get b %) (range (count b)))))
+  #?(:clj (is (= (map #(.get ^List a %) (range (count a)))
+                 (map #(.get ^List b %) (range (count b))))))
+  (is (= 0 (compare a b))))
+
+(defn assert-equivalent-sets [a b]
+  (assert-equivalent-collections a b)
+  (is (= (set (map #(a %) a))
+         (set (map #(b %) b))))
+  (is (= (meta-map a) (meta-map b)))
+  (is (and (every? #(contains? a %) b)
+           (every? #(contains? b %) a))))
+
+(defn assert-equivalent-maps [a b]
+  (assert-equivalent-collections a b)
+  (is (= (set (keys a)) (set (keys b))))
+  (let [ks (keys a)]
+    (is (= (map #(get a %) ks)
+           (map #(get b %) ks)))
+    (is (= (map #(a %) ks)
+           (map #(b %) ks)))
+    (is (= (map #(.get ^Map a %) ks)
+           (map #(.get ^Map b %) ks))))
+  (is (and (every? #(= (key %) (first %)) a)
+           (every? #(= (key %) (first %)) b)))
+  (is (= (meta-map (keys a)) (meta-map (keys b))))
+  (is (every? #(= (meta (a %)) (meta (b %))) (keys a)))
+  (is (every? #(= (val %) (a (key %)) (b (key %))) a)))
+
+;;;
+
+(defn pr-meta [v]
+  (if-let [m (meta v)]
+    `(with-meta ~v ~m)
+    v))
+
+(defn describe-action [[f & rst]]
+  (case f
+    :cons (list '->> (list* 'cons (map pr-meta rst)))
+    :into '(into (empty coll))
+    (if (empty? rst)
+      (symbol (name f))
+      (list*
+        (symbol (name f))
+        (map pr-meta rst)))))
+
+(defn actions->str [actions]
+  (->> actions
+       (apply concat)
+       (map describe-action)
+       (list* '-> 'coll)
+       pr-str))
+
+(defmethod ct/report #?(:clj ::chuck/shrunk :cljs [::ct/default ::chuck/shrunk]) [m]
+  (newline)
+  (println "Tests failed:\n"
+           "\n    seed =" (:seed m)
+           "\n actions =" (-> m :shrunk :smallest first (get 'actions) actions->str)))
+
+;;
+
+(defn assert-vector-like
+  "Asserts that the given empty collection behaves like a vector."
+  ([empty-coll element-generator]
+   (assert-vector-like 1e3 empty-coll element-generator nil))
+  ([n empty-coll element-generator]
+   (assert-vector-like n empty-coll element-generator nil))
+  ([n empty-coll element-generator
+    {:keys [base ordered?]
+     :or {ordered? true
+          base []}}]
+   (chuck/checking "vector-like" n
+                   [actions (gen-vector-actions element-generator (transient? empty-coll) ordered?)]
+                   (let [[a b actions] (build-collections empty-coll base true actions)]
+                     (assert-equivalent-vectors a b)))));)
+
+(defn assert-set-like
+  ([empty-coll element-generator]
+   (assert-set-like 1e3 empty-coll element-generator nil))
+  ([n empty-coll element-generator]
+   (assert-set-like n empty-coll element-generator nil))
+  ([n empty-coll element-generator
+    {:keys [base ordered?]
+     :or {ordered? false
+          base #{}}}]
+   (chuck/checking "set-like" n
+                   [actions (gen-set-actions element-generator (transient? empty-coll) ordered?)]
+                   (let [[a b actions] (build-collections empty-coll base false actions)]
+                     (assert-equivalent-sets a b)))))
+
+(defn assert-map-like
+  ([empty-coll key-generator value-generator]
+   (assert-map-like 1e3 empty-coll key-generator value-generator nil))
+  ([n empty-coll key-generator value-generator]
+   (assert-map-like n empty-coll key-generator value-generator nil))
+  ([n empty-coll key-generator value-generator
+    {:keys [base ordered?]
+     :or {ordered? false
+          base {}}}]
+   (chuck/checking "map-like" n
+                   [actions (gen-map-actions key-generator value-generator (transient? empty-coll) ordered?)]
+                   (let [[a b actions] (build-collections empty-coll base false actions)]
+                     (assert-equivalent-maps a b)))))


Add cljs abstraction for jszip library under uxbox.util.zip ns.

error: pathspec 'src/uxbox/util/zip.cljs' did not match any file(s) known to git

--- src/uxbox/util/zip.cljs
+++ src/uxbox/util/zip.cljs
@@ -0,0 +1,24 @@
+;; This Source Code Form is subject to the terms of the Mozilla Public
+;; License, v. 2.0. If a copy of the MPL was not distributed with this
+;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
+;;
+;; Copyright (c) 2016 Andrey Antukh <niwi@niwi.nz>
+
+(ns uxbox.util.zip
+  "Helpers for make zip file (using jszip)."
+  (:require [vendor.jszip]
+            [promesa.core :as p]))
+
+(defn build*
+  [files resolve reject]
+  (let [zipobj (js/JSZip.)]
+    (run! (fn [[name content]]
+            (.file zipobj name content))
+          files)
+    (-> (.generateAsync zipobj #js {:type "blob"})
+        (.then resolve reject))))
+
+(defn build
+  [files]
+  (p/promise (fn [resolve reject]
+               (build* files resolve reject))))


Commit all the files

Commit all the files

error: pathspec 'ci_environment/leiningen/files/default/profiles.clj' did not match any file(s) known to git

--- ci_environment/leiningen/files/default/profiles.clj
+++ ci_environment/leiningen/files/default/profiles.clj
@@ -0,0 +1 @@
+{:user {:plugins []}}


Automated Testing

Automated Testing

error: pathspec 'src/mark_volkmann_tutorial/automated_testing.clj' did not match any file(s) known to git

--- src/mark_volkmann_tutorial/automated_testing.clj
+++ src/mark_volkmann_tutorial/automated_testing.clj
@@ -0,0 +1,61 @@
+;; Automated Testing
+;; http://java.ociweb.com/mark/clojure/article.html#Testing
+
+(use 'clojure.test)
+
+; Test can be written in separate functions.
+(deftest add-test
+  ; The "is" macro takes a predicate, arguments to it,
+  ; and an optional message.
+  (is (= 4 (+ 2 2)))
+  (is (= 2 (+ 2 0)) "adding zero doesn't change value"))
+
+(deftest reverse-test
+  (is (= [3 2 1] (reverse [1 2 3]))))
+
+; Tests can verify that a specific exception is thrown.
+(deftest divistion-test
+  (is (thrown? ArithmeticException (/ 3 0))))
+
+; The with-test macro can be used to add tests
+; to the functions that test as metadata.
+(with-test
+  (defn my-add [a b] (+ a b))
+  (is (= 4 (my-add 2 2)))
+  (is (= 2 (my-add 2 0)) "adding zero doesn't change value"))
+
+; The "are" macro takes a predicate template and
+; multiple sets of arguments to it, but no message.
+; Each set of arguments are substituted one at a time
+; into the predicate template and evaluated.
+(deftest multiplication
+  (are [a b result]
+       (= (* a b) result) ; a template
+       1 1 1,
+       1 2 2,
+       2 3 6))
+
+; Run all the tests in the current namespace.
+; This includes tests that were added as function metadata using with-test.
+; Other namespaces can be specified as quoted arguments
+(run-tests)
+
+; limit *stack-trace-depth*
+
+; *load-tests* - set to false to avoid compiling test code when in production
+
+; assert macro - in, out function conditions
+(def dow 10000)
+(assert (>= dow 7000))
+
+; fixture - wraps test methods
+;; (defn fixture-name [test-function]
+;;   ; Perform setup here.
+;;   (test-function)
+;;   ; Perform teardown here.
+;; )
+
+; register fixtures to rap each method
+;; (use-fixtures :each fixture-1 fixture-2 ...) ; one function
+;; (use-fixtures :once fixture-1 fixture-2 ...) ; all functions
+; src, test directory -> enter "ant test"


Use diff/patch on the fileset instead of delete/scan

--- boot/pod/src/boot/tmpdir.clj
+++ boot/pod/src/boot/tmpdir.clj
@@ -8,6 +8,8 @@
     [boot.util        :as util]
     [boot.file        :as file]
     [boot.from.digest :as digest]))
+
+(def state (atom {}))

 (defprotocol ITmpFile
   (id   [this])
@@ -58,16 +60,21 @@
         (doto out (write! true) (mod! (mod src)) (write! false)))
       (doto out (#(io/copy src %)) (mod! (mod src)) (write! false)))))

+(declare diff*)
+
 (defrecord TmpFileSet [dirs tree blob]
   ITmpFileSet
   (ls [this]
     (set (vals tree)))
   (commit! [this]
     (util/with-let [{:keys [dirs tree blob]} this]
-      (apply file/empty-dir! (map file dirs))
-      (doseq [[p tmpf] tree]
-        (let [srcf (io/file blob (id tmpf))]
-          (file/copy-with-lastmod srcf (file tmpf))))))
+      (let [prev (@state dirs)
+            {:keys [added removed changed]} (diff* prev this [:hash])]
+        (doseq [tmpf (set/union (ls removed) (ls changed))]
+          (file/delete-file (file tmpf)))
+        (doseq [tmpf (set/union (ls added) (ls changed))]
+          (file/copy-with-lastmod (io/file blob (id tmpf)) (file tmpf)))
+        (swap! state assoc dirs this))))
   (rm [this tmpfiles]
     (let [{:keys [dirs tree blob]} this
           treefiles (set (vals tree))


Add message to schedule FAF response

Add message to schedule FAF response

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/democracyworks/election-notification-works.git/'


JAR success?

JAR success?

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/batasrki/blog-post-app.git/'