avoids creating separate scheduler-config to address circular dependency (#1288)

- instead we use a promise to resolve the scheduler instance

--- waiter/src/waiter/scheduler/kubernetes.clj
+++ waiter/src/waiter/scheduler/kubernetes.clj
@@ -195,7 +195,7 @@
    when a new pod failure is listed in the given pod's lastState container status.
    Note that unique instance-ids are deterministically generated each time the pod is restarted
    by passing the pod's restartCount value to the pod->instance-id function."
-  [{:keys [service-id] :as live-instance} {:keys [service-id->failed-instances-transient-store] :as scheduler-config} pod]
+  [{:keys [service-id] :as live-instance} {:keys [service-id->failed-instances-transient-store] :as scheduler} pod]
   (try
     (let [primary-container-status (get-in pod [:status :containerStatuses 0])]
       (when-let [newest-failure (get-in primary-container-status [:lastState :terminated])]
@@ -228,7 +228,7 @@
    - it has restarted too many times (reached the restart-expiry-threshold threshold)
    - the primary container (waiter-apps) has not transitioned to running state in container-running-grace-secs seconds
    - the pod has the waiter/pod-expired=true annotation."
-  [{:keys [container-running-grace-secs restart-expiry-threshold watch-state] :as scheduler-config}
+  [{:keys [container-running-grace-secs restart-expiry-threshold watch-state] :as scheduler}
    service-id instance-id restart-count {:keys [waiter/pod-expired waiter/revision-timestamp]}
    primary-container-status pod-started-at]
   (let [rs-revision-timestamp-path [:service-id->service service-id :k8s/replicaset-annotations :waiter/revision-timestamp]
@@ -271,20 +271,20 @@
 (let [kill-restart-threshold-exceeded-pod-thread-pool (Executors/newFixedThreadPool 1)]
   (defn kill-restart-threshold-exceeded-pod
     "Processes killing of a frequently restarting pod (service instance)."
-    [scheduler-config {:keys [k8s/pod-name k8s/restart-count service-id] :as instance}]
+    [scheduler {:keys [k8s/pod-name k8s/restart-count service-id] :as instance}]
     (au/execute
       (fn kill-restart-threshold-exceeded-pod-task []
         (try
           (log/info "deleting frequently restarting pod"
                     {:pod-name pod-name :restart-count restart-count :service-id service-id})
-          (hard-delete-service-instance scheduler-config instance)
+          (hard-delete-service-instance scheduler instance)
           (catch Exception ex
             (log/error ex "error in deleting frequently restarting pod" pod-name))))
       kill-restart-threshold-exceeded-pod-thread-pool)))

 (defn pod->ServiceInstance
   "Convert a Kubernetes Pod JSON response into a Waiter Service Instance record."
-  [{:keys [api-server-url leader?-fn restart-kill-threshold] :as scheduler-config} pod]
+  [{:keys [api-server-url leader?-fn restart-kill-threshold] :as scheduler} pod]
   (try
     (let [;; waiter-app is the first container we register
           primary-container-restart-count (or (get-in pod [:status :containerStatuses 0 :restartCount]) 0)
@@ -318,7 +318,7 @@
           instance (scheduler/make-ServiceInstance
                      (cond-> {:extra-ports (->> pod-annotations :waiter/port-count Integer/parseInt range next (mapv #(+ port0 %)))
                               :flags (cond-> #{}
-                                       (check-expired scheduler-config service-id instance-id pod-restart-count pod-annotations primary-container-status pod-started-at)
+                                       (check-expired scheduler service-id instance-id pod-restart-count pod-annotations primary-container-status pod-started-at)
                                        (conj :expired))
                               :healthy? (and (true? (get primary-container-status :ready))
                                              ;; Note that when exceeded-restart-kill-threshold? becomes true, the container *just* restarted and is non-ready,
@@ -352,7 +352,7 @@
       (when exceeded-restart-kill-threshold?
         (try
           (if (leader?-fn)
-            (kill-restart-threshold-exceeded-pod scheduler-config instance)
+            (kill-restart-threshold-exceeded-pod scheduler instance)
             (log/info "skipping deleting frequently restarting pod on non-leader"
                       {:pod-name pod-name :restart-count primary-container-restart-count :service-id service-id}))
           (catch Throwable e
@@ -429,12 +429,12 @@

 (defn- get-services
   "Get all Waiter Services (reified as ReplicaSets) running in this Kubernetes cluster."
-  [{:keys [watch-state] :as scheduler-config}]
+  [{:keys [watch-state] :as scheduler}]
   (-> watch-state deref :service-id->service vals))

 (defn- get-replicaset-pods
   "Get all Kubernetes pods associated with the given Waiter Service's corresponding ReplicaSet."
-  [{:keys [watch-state] :as scheduler-config} {service-id :id}]
+  [{:keys [watch-state] :as scheduler} {service-id :id}]
   (-> watch-state deref :service-id->pod-id->pod (get service-id) vals))

 (defn- live-pod?
@@ -446,11 +446,11 @@
   "Get all active Waiter Service Instances associated with the given Waiter Service.
    Also updates the service-id->failed-instances-transient-store as a side-effect.
    Pods reporting Failed phase status are treated as failed instances and are excluded from the return value."
-  [{:keys [service-id->failed-instances-transient-store] :as scheduler-config} basic-service-info]
-  (let [all-instances (for [pod (get-replicaset-pods scheduler-config basic-service-info)
+  [{:keys [service-id->failed-instances-transient-store] :as scheduler} basic-service-info]
+  (let [all-instances (for [pod (get-replicaset-pods scheduler basic-service-info)
                             :when (live-pod? pod)]
-                        (when-let [service-instance (pod->ServiceInstance scheduler-config pod)]
-                          (track-failed-instances! service-instance scheduler-config pod)
+                        (when-let [service-instance (pod->ServiceInstance scheduler pod)]
+                          (track-failed-instances! service-instance scheduler pod)
                           service-instance))
         {active-instances false failed-instances true}
         (->> all-instances (remove nil?) (group-by #(-> % :k8s/pod-phase (= "Failed")) ))]
@@ -465,8 +465,8 @@
 (defn instances-breakdown!
   "Get all Waiter Service Instances associated with the given Waiter Service.
    Grouped by liveness status, i.e.: {:active-instances [...] :failed-instances [...] :killed-instances [...]}"
-  [{:keys [service-id->failed-instances-transient-store] :as scheduler-config} {service-id :id :as basic-service-info}]
-  {:active-instances (get-service-instances! scheduler-config basic-service-info)
+  [{:keys [service-id->failed-instances-transient-store] :as scheduler} {service-id :id :as basic-service-info}]
+  {:active-instances (get-service-instances! scheduler basic-service-info)
    :failed-instances (-> @service-id->failed-instances-transient-store (get service-id) vec)})

 (defn- patch-object-json
@@ -550,10 +550,10 @@
   "Force kill the Kubernetes pod corresponding to the given Waiter Service Instance.
    Does not adjust ReplicaSet replica count; preventing scheduling of a replacement pod must be ensured by the callee.
    Returns nil on success, but throws on failure."
-  [{:keys [api-server-url] :as scheduler-config} {:keys [service-id] :as instance}]
+  [{:keys [api-server-url] :as scheduler} {:keys [service-id] :as instance}]
   (let [pod-url (instance->pod-url api-server-url instance)]
     (try
-      (api-request pod-url scheduler-config :request-method :delete)
+      (api-request pod-url scheduler :request-method :delete)
       (catch Throwable t
         (log/error t "Error force-killing pod")))))

@@ -656,9 +656,9 @@

 (defn get-service->instances
   "Returns a map of scheduler/Service records -> map of scheduler/ServiceInstance records."
-  [scheduler-config]
-  (pc/map-from-keys #(instances-breakdown! scheduler-config %)
-                    (get-services scheduler-config)))
+  [scheduler]
+  (pc/map-from-keys #(instances-breakdown! scheduler %)
+                    (get-services scheduler)))

 ; The Waiter Scheduler protocol implementation for Kubernetes
 (defrecord KubernetesScheduler [api-server-url
@@ -1414,17 +1414,13 @@
                         watch-connect-timeout-ms (assoc :connect-timeout-ms watch-connect-timeout-ms)
                         watch-socket-timeout-ms (assoc :socket-timeout-ms watch-socket-timeout-ms))
         watch-state (atom nil)
-        scheduler-config {:api-server-url url
-                          :cluster-name cluster-name
-                          :container-running-grace-secs container-running-grace-secs
-                          :http-client http-client
-                          :leader?-fn leader?-fn
-                          :replicaset-api-version replicaset-api-version
-                          :restart-expiry-threshold restart-expiry-threshold
-                          :restart-kill-threshold restart-kill-threshold
-                          :service-id->failed-instances-transient-store service-id->failed-instances-transient-store
-                          :watch-state watch-state}
-        get-service->instances-fn #(get-service->instances scheduler-config)
+        scheduler-promise (promise) ;; resolves circular dependency
+        get-service->instances-fn (fn []
+                                    (if (realized? scheduler-promise)
+                                      (get-service->instances @scheduler-promise)
+                                      (do
+                                        (log/warn "scheduler instance has not yet been initialized")
+                                        {})))
         {:keys [retrieve-syncer-state-fn]} (start-scheduler-syncer-fn
                                              scheduler-name
                                              get-service->instances-fn
@@ -1441,27 +1437,37 @@
           auth-renewer (when authentication
                          (start-auth-renewer authentication))
           retrieve-auth-token-state-fn (or (:query-state-fn auth-renewer) (constantly nil))
-          extended-scheduler-config (assoc scheduler-config
-                                      :authorizer authorizer
-                                      :custom-options custom-options
-                                      :daemon-state daemon-state
-                                      :fileserver fileserver
-                                      :log-bucket-url log-bucket-url
-                                      :max-patch-retries max-patch-retries
-                                      :max-name-length max-name-length
-                                      :pdb-api-version pdb-api-version
-                                      :pdb-spec-builder-fn pdb-spec-builder-fn
-                                      :pod-base-port pod-base-port
-                                      :pod-sigkill-delay-secs pod-sigkill-delay-secs
-                                      :pod-suffix-length pod-suffix-length
-                                      :replicaset-spec-builder-fn replicaset-spec-builder-fn
-                                      :retrieve-auth-token-state-fn retrieve-auth-token-state-fn
-                                      :retrieve-syncer-state-fn retrieve-syncer-state-fn
-                                      :reverse-proxy reverse-proxy
-                                      :service-id->password-fn service-id->password-fn
-                                      :service-id->service-description-fn service-id->service-description-fn
-                                      :scheduler-name scheduler-name)
-          scheduler (map->KubernetesScheduler extended-scheduler-config)
+          scheduler-config {:api-server-url url
+                            :authorizer authorizer
+                            :cluster-name cluster-name
+                            :container-running-grace-secs container-running-grace-secs
+                            :custom-options custom-options
+                            :daemon-state daemon-state
+                            :fileserver fileserver
+                            :http-client http-client
+                            :leader?-fn leader?-fn
+                            :log-bucket-url log-bucket-url
+                            :max-patch-retries max-patch-retries
+                            :max-name-length max-name-length
+                            :pdb-api-version pdb-api-version
+                            :pdb-spec-builder-fn pdb-spec-builder-fn
+                            :pod-base-port pod-base-port
+                            :pod-sigkill-delay-secs pod-sigkill-delay-secs
+                            :pod-suffix-length pod-suffix-length
+                            :replicaset-api-version replicaset-api-version
+                            :replicaset-spec-builder-fn replicaset-spec-builder-fn
+                            :restart-expiry-threshold restart-expiry-threshold
+                            :restart-kill-threshold restart-kill-threshold
+                            :retrieve-auth-token-state-fn retrieve-auth-token-state-fn
+                            :retrieve-syncer-state-fn retrieve-syncer-state-fn
+                            :reverse-proxy reverse-proxy
+                            :scheduler-name scheduler-name
+                            :service-id->failed-instances-transient-store service-id->failed-instances-transient-store
+                            :service-id->password-fn service-id->password-fn
+                            :service-id->service-description-fn service-id->service-description-fn
+                            :watch-state watch-state}
+          scheduler (map->KubernetesScheduler scheduler-config)
+          _ (deliver scheduler-promise scheduler)
           pod-watch-thread (start-pods-watch! scheduler watch-options)
           rs-watch-thread (start-replicasets-watch! scheduler watch-options)]
       (reset! daemon-state {:pod-watch-daemon pod-watch-thread


sql further changes

sql further changes

--- src/clj_hypergraph_db/sql_parser/sql_to_uml_persistance_manager.clj
+++ src/clj_hypergraph_db/sql_parser/sql_to_uml_persistance_manager.clj
@@ -7,13 +7,10 @@
             [clj_hypergraph_db.sql_parser.sql_common_functions :refer :all]
             [clj_hypergraph_db.hdm_parser.hdm_uml_model_manager :refer :all]))

+;todo can this method be deleted?
 (defn get-entry
   [result-set]
-  (let [return (atom [])
-        meta-data (.getMetaData result-set)]
-    (doseq [i (range (.getColumnCount meta-data))]
-      (swap! return conj (.getString result-set (inc i))))
-    @return))
+  (->> result-set .getMetaData .getColumnCount inc (range 1) (map #(.getString result-set %)) vec))

 (defn load-input-data
   [input-persistance-model access-map]
@@ -22,41 +19,55 @@
         extent-tables (find-all-items-by-type configuration-map :foreach)
         credentials (first access-map)
         statement (.createStatement (get-connection (:database-name credentials) (:user-name credentials) (:password credentials)))]
-    (doseq [[extent-table model-table] (for [extent-table extent-tables
-                                             model-table (:tables input-model)
-                                             :when (= (:table-definition model-table) (first (:table extent-table)))]
-                                         [extent-table model-table])]
-      (if-let [extent-entity (find-first-item-by-type (:body extent-table) :add-instance)]
+    (doseq [[extent-entity model-table] (for [extent-table extent-tables
+                                              model-table (:tables input-model)
+                                              :when (= (:table-definition model-table) (first (:table extent-table)))]
+                                          [(find-first-item-by-type (:body extent-table) :add-instance) model-table])]
+      (when extent-entity
         (let [result-set (->> model-table :table-name (str "select * from ") (.executeQuery statement))
               columns (:columns model-table)]
           (while (.next result-set)
             (let [new-instance (add-class-instance (:name extent-entity))
                   meta-data (.getMetaData result-set)]
-              (doseq [i (range (.getColumnCount meta-data))]
-                (let [column (first (filter #(= (.getColumnName meta-data (inc i)) (:column-name %)) columns))
+              (doseq [i (range 1 (inc (.getColumnCount meta-data)))]
+                (let [column (first (filter #(= (.getColumnName meta-data i) (:column-name %)) columns))
                       mapping (first (filter #(= (:column-definition column) (first (:column %))) (:mappings extent-entity)))
-                      data (.getString result-set (inc i))]
+                      data (.getString result-set i)]
                   (when (and data (#{:mapping :mapping-pk} (:type mapping)))
                     (add-attribute-instance new-instance (:name mapping) data)))))))))
-    (doseq [[extent-table model-table] (for [extent-table extent-tables
+    (doseq [[associations model-table] (for [extent-table extent-tables
                                              model-table (:tables input-model)
                                              :when (= (:table-definition model-table) (first (:table extent-table)))]
-                                         [extent-table model-table])]
-      (if-let [associations (find-all-items-by-type (:body extent-table) :add-association)]
+                                         [(find-all-items-by-type (:body extent-table) :add-association) model-table])]
+      (when (not-empty associations) ;todo I changed it from (when associations..., I hope you meant to write it like this
         (let [result-set (->> model-table :table-name (str "select * from ") (.executeQuery statement))
               columns (:columns model-table)]
           (doseq [association associations]
             (while (.next result-set)
-              (let [new-association (atom (add-association-instance (:name association)))
+              (let [new-association (atom (add-association-instance (:name association))) ;todo here I added atom
                     meta-data (.getMetaData result-set)]
-                (doseq [i (range (.getColumnCount meta-data))]
-                  (let [column (first (filter #(= (.getColumnName meta-data (inc i)) (:column-name %)) columns))]
-                    (if-let [role (first (filter #(= (:column-definition column) (:column %)) (:roles association)))]
-                      (let [data (.getString result-set (inc i))]
+                (doseq [i (range 1 (inc (.getColumnCount meta-data)))]
+                  (let [column (first (filter #(= (.getColumnName meta-data i) (:column-name %)) columns))]
+                    (when-let [role (first (filter #(= (:column-definition column) (:column %)) (:roles association)))]
+                      (let [data (.getString result-set i)]
                         (swap! new-association add-role-instance-pk (:name association) (first (:name role)) data)))))))))))))
+                         ;todo and here I added swap!

-;below is old version of your code
-;besides refactoring I changed it to suit new signature of add-atttribute-instance and new functionality of add-role-instance-pk
+;todo I made quite lot of refactoring, if you like it keep it and do some more :)
+
+
+
+;todo below is old version of your code
+;todo besides refactoring I changed it to suit new signature of add-atttribute-instance and new functionality of add-role-instance-pk
+
+#_(defn get-entry
+  [result-set]
+  (let [return (atom [])
+        meta-data (.getMetaData result-set)]
+    (doseq [i (range (.getColumnCount meta-data))]
+      (swap! return conj (.getString result-set (+ 1 i))))
+    @return))
+

 #_(defn load-input-data
   [input-persistance-model access-map]


removed unused code

removed unused code

--- test/src/dda/pallet/dda_backup_crate/infra/lib/restore_lib_test.clj
+++ test/src/dda/pallet/dda_backup_crate/infra/lib/restore_lib_test.clj
@@ -76,24 +76,3 @@
                 :type-name "file"
                 :backup-path ["/var/lib/liferay/data/*"]
                 :new-owner "tomcat7"}))))))
-
-; (deftest restore-duplicity
-;   (testing
-;    "restore with duplicity"
-;     (is (=
-;          ["# Transport Backup"
-;           "export PASSPHRASE= "
-;           "export TMPDIR=/var/opt/gitblit/backup-cache"
-;           "export AWS_ACCESS_KEY_ID=A1"
-;           "export AWS_SECRET_ACCESS_KEY=A1"
-;           "export S3_USE_SIGV4=True"
-;           backup-element/prep-restore-script
-;           "/usr/bin/duplicity restore --gpg-binary gpg2 --archive-dir /var/opt/gitblit/backup-cache --verbosity notice --s3-use-new-style --s3-european-buckets --encrypt-key=1A --sign-key=1A --log-file /var/log/gitblit/duplicity.log localhost /var/opt/gitblit/backups"
-;           backup-element/post-transport-script
-;           "unset AWS_ACCESS_KEY_ID"
-;           "unset AWS_SECRET_ACCESS_KEY"
-;           "unset S3_USE_SIGV4"
-;           "unset PASSPHRASE"
-;           "unset TMPDIR"
-;           ""]
-;          (sut/restore-duplicity backup-element/test-element)))))


add some comments

add some comments

--- src/main/clojure/conexp/layouts/dim_draw.clj
+++ src/main/clojure/conexp/layouts/dim_draw.clj
@@ -8,6 +8,11 @@
             [rolling-stones.core :as sat :refer :all]))

 (defn- lt-seq
+  "Constructs a constraint stating that at most `k` of the given variables `xs` are true.
+
+  This is from ??.
+
+  Could be replaced by `rolling-stones.core/at-most`."      ; todo paper name
   ([xs k]
    (lt-seq xs k (Math/random)))
   ([xs k prefix]
@@ -37,6 +42,10 @@
   (println line))

 (defn sat-reduction
+  "Reduces the problem of finding a maximum bipartite subgraph to satisfiability.
+
+
+  As described in Section 5.2 of Dominik's paper."          ; todo paper name
   ([g]
    (first (drop-while #(= % nil) (map #(sat-reduction g %) (range)))))
   ([g k]
@@ -62,12 +71,12 @@
          clauses (concat node-clauses edge-clauses no-more-than-k-bad-edges-clauses)
          raw-solution (sat/solve-symbolic-cnf clauses)
          C (map first (filter #(and (sat/positive? %) (= (% 1) 3)) raw-solution))]
-     (println node-clauses)
-     (println edge-clauses)
-     (println no-more-than-k-bad-edges-clauses)
-     (println "solved:")
-     (println raw-solution)
-     (println C)
+     ;(println node-clauses)
+     ;(println edge-clauses)
+     ;(println no-more-than-k-bad-edges-clauses)
+     ;(println "solved:")
+     ;(println raw-solution)
+     ;(println C)
      C)))

 (sat-reduction (uber/graph [:a :b] [:a :c] [:b :e] [:c :e] [:a :e]) 1)
@@ -81,6 +90,14 @@

 (defn compute-coordinates
+  "Given a set `P` and a binary relation `<=`, computes coordinates for each
+  element of the set s.t. placing the elements to the coordinates gives a clear
+  image of the relation.
+
+  The coordinates are returned in the form `[[e1 [x1 y1]] [e2 [x2 y2]] ...]`
+  where e is the element, and x and y are the corresponding coordinates.
+
+  See paper of Dominik (2019)"                              ;todo paper name
   [P <=]
   (let [<=as-set (map edge->vec (lg/edges (make-digraph-from-condition P <=)))
         <=C
@@ -110,8 +127,7 @@

 (defn draw-ascii
   [coords]
-  (let [
-        x-step 2
+  (let [x-step 2
         size (count coords)
         spaces (.substring (replicate-str "   " (* size x-step)) (* size x-step))
         line-contents (map (fn [i] (filter
@@ -126,8 +142,7 @@
         positioned-lines (map (fn [line] (map #(vec [(first %)
                                                      (* (- (last %) min-x) x-step)])
                                               line))
-                              lines)
-        ]
+                              lines)]
     (doseq [pos-line positioned-lines]
       (println (reduce
                  (fn [l p]


Fixed selection positioning with neested groups.

--- src/uxbox/shapes.cljs
+++ src/uxbox/shapes.cljs
@@ -255,9 +255,14 @@
         y' (apply max (map (fn [{:keys [y height]}] (+ y height)) shapes))
         width (- x' x)
         height (- y' y)]
-    (as-> shape $
-      (merge $ {:width width :height height :x x :y y})
-      (container-rect $))))
+    (let [group (get-in @st/state [:shapes-by-id group])]
+      (as-> shape $
+        (merge $ {:width width
+                  :height height
+                  :x (+ x (or (:dx group) 0))
+                  :y (+ y (or (:dy group) 0))
+                  })
+        (container-rect $)))))

 (defmethod -outer-rect :default
   [shape _]


Add debugging page for finding for comparing vt output with libtsm preprocessed one

--- env/dev/cljs/asciinema_player/main.cljs
+++ env/dev/cljs/asciinema_player/main.cljs
@@ -1,6 +1,11 @@
 (ns asciinema-player.main
   (:require [asciinema-player.core :as p]
-            [clojure.walk :as walk]))
+            [asciinema-player.vt :as vt]
+            [asciinema-player.util :as util]
+            [clojure.walk :as walk]
+            [cljs.core.async :refer [chan >! <! put!]]
+            [ajax.core :refer [GET]])
+  (:require-macros [cljs.core.async.macros :refer [go]]))

 (defonce snapshot-js [[["File Edit Options Buffers Tools C++ YASnippet Help                              " {"inverse" true}]] [["/" {"fg" 1, "inverse" true}] ["* Copyright (c) 2014 Vinícius dos San" {"fg" 1}] ["$" {}] ["|" {"inverse" true}] ["/* Copyright (c) 2014 Vinícius dos Sant" {"fg" 1}] ["$" {}]] [["                                       " {"fg" 1}] ["|" {"inverse" true}] ["                                        " {"fg" 1}]] [["   Distributed under the Boost Softwar" {"fg" 1}] ["$" {}] ["|" {"inverse" true}] ["   Distributed under the Boost Software" {"fg" 1}] ["$" {}]] [["   file LICENSE_1_0.txt or copy at htt" {"fg" 1}] ["$" {}] ["|" {"inverse" true}] ["   file LICENSE_1_0.txt or copy at http" {"fg" 1}] ["$" {}]] [["                                       " {}] ["|" {"inverse" true}] ["                                        " {}]] [["#ifndef" {"fg" 4, "bold" true}] [" BOOST_HTTP_EMBEDDED_SERVER_SOC$" {}] ["|" {"inverse" true}] ["#ifndef" {"fg" 4, "bold" true}] [" BOOST_HTTP_EMBEDDED_SERVER_SOCK$" {}]] [["#define" {"fg" 4, "bold" true}] [" " {}] ["BOOST_HTTP_EMBEDDED_SERVER_SOC" {"fg" 3}] ["$" {}] ["|" {"inverse" true}] ["#define" {"fg" 4, "bold" true}] [" " {}] ["BOOST_HTTP_EMBEDDED_SERVER_SOCK" {"fg" 3}] ["$" {}]] [["                                       " {}] ["|" {"inverse" true}] ["                                        " {}]] [["#include" {"fg" 4, "bold" true}] [" " {}] ["<cstdint>" {"fg" 2}] ["                     " {}] ["|" {"inverse" true}] ["#include" {"fg" 4, "bold" true}] [" " {}] ["<cstdint>" {"fg" 2}] ["                      " {}]] [["#include" {"fg" 4, "bold" true}] [" " {}] ["<algorithm>" {"fg" 2}] ["                   " {}] ["|" {"inverse" true}] ["#include" {"fg" 4, "bold" true}] [" " {}] ["<algorithm>" {"fg" 2}] ["                    " {}]] [["                                       " {}] ["|" {"inverse" true}] ["                                        " {}]] [["#include" {"fg" 4, "bold" true}] [" " {}] ["<boost/asio/ip/tcp.hpp>" {"fg" 2}] ["       " {}] ["|" {"inverse" true}] ["#include" {"fg" 4, "bold" true}] [" " {}] ["<boost/asio/ip/tcp.hpp>" {"fg" 2}] ["        " {}]] [["                                       " {}] ["|" {"inverse" true}] ["                                        " {}]] [["#include" {"fg" 4, "bold" true}] [" " {}] ["<boost/http/outgoing_state.hp" {"fg" 2}] ["$" {}] ["|" {"inverse" true}] ["#include" {"fg" 4, "bold" true}] [" " {}] ["<boost/http/outgoing_state.hpp" {"fg" 2}] ["$" {}]] [["#include" {"fg" 4, "bold" true}] [" " {}] ["<boost/http/message.hpp>" {"fg" 2}] ["      " {}] ["|" {"inverse" true}] ["#include" {"fg" 4, "bold" true}] [" " {}] ["<boost/http/message.hpp>" {"fg" 2}] ["       " {}]] [["#include" {"fg" 4, "bold" true}] [" " {}] ["<boost/http/http_errc.hpp>" {"fg" 2}] ["    " {}] ["|" {"inverse" true}] ["#include" {"fg" 4, "bold" true}] [" " {}] ["<boost/http/http_errc.hpp>" {"fg" 2}] ["     " {}]] [["                                       " {}] ["|" {"inverse" true}] ["                                        " {}]] [["// TODO: remove me                     " {"fg" 1}] ["|" {"inverse" true}] ["// TODO: remove me                      " {"fg" 1}]] [["#include" {"fg" 4, "bold" true}] [" " {}] ["<iostream>" {"fg" 2}] ["                    " {}] ["|" {"inverse" true}] ["#include" {"fg" 4, "bold" true}] [" " {}] ["<iostream>" {"fg" 2}] ["                     " {}]] [["#include" {"fg" 4, "bold" true}] [" " {}] ["<string>" {"fg" 2}] ["                      " {}] ["|" {"inverse" true}] ["#include" {"fg" 4, "bold" true}] [" " {}] ["<string>" {"fg" 2}] ["                       " {}]] [["                                       " {}] ["|" {"inverse" true}] ["                                        " {}]] [["-UUU:----F1  " {"inverse" true}] ["embedded_server_socket.hpp" {"bold" true, "inverse" true}] ["|-UUU:----F1  " {"inverse" true}] ["embedded_server_socket.hpp" {"bold" true, "inverse" true}] [" " {"inverse" true}]] [["                                                                                " {}]]])

@@ -42,16 +47,79 @@
 ;; (defonce player-state
 ;;   (p/make-player-ratom 84 31 "/frames-color-test.json" 4.533024 options))

+;; (swap! player-state assoc :theme "solarized-dark")
+;; (swap! player-state assoc :theme "solarized-light")
+;; (swap! player-state assoc :theme "tango")
+;; (swap! player-state assoc :theme "seti")
+;; (swap! player-state assoc :current-time 45)
+;; (swap! player-state assoc :font-size "small")
+;; (swap! player-state assoc :speed 1)
+
+(defonce reload-fn (atom nil))
+
 (defn reload []
+  (@reload-fn))
+
+(defn reload-player []
   (p/create-player-with-state player-state (. js/document (getElementById "player"))))

 (defn start-dev []
-  (reload))
+  (reset! reload-fn reload-player)
+  (reload-player))

-; (swap! player-state assoc :theme "solarized-dark")
-; (swap! player-state assoc :theme "solarized-light")
-; (swap! player-state assoc :theme "tango")
-; (swap! player-state assoc :theme "seti")
-; (swap! player-state assoc :current-time 45)
-; (swap! player-state assoc :font-size "small")
-; (swap! player-state assoc :speed 1)
+(def v0-url "/frames-21195.json")
+(def v1-url "/21195.json")
+
+(defn fetch-json [url]
+  (let [ch (chan)]
+    (GET url
+         {:response-format :raw
+          :handler (fn [res]
+                     (put! ch (-> res
+                                  js/JSON.parse
+                                  (util/faster-js->clj :keywordize-keys true))))})
+    ch))
+
+(defn debug []
+  (go
+    (let [v0-json (<! (fetch-json v0-url))
+          v0-frames (vec (drop 1 (map #(p/acc->frame (last %)) (p/build-v0-frames v0-json))))
+          v1-json (<! (fetch-json v1-url))
+          v1-stdout (vec (map last (:stdout v1-json)))]
+      (loop [n 0
+             prev-vt (vt/make-vt (:width v1-json) (:height v1-json))]
+        (if-let [str (get v1-stdout n)]
+          (let [vt (vt/feed-str prev-vt str)
+                prev-lines (vt/compact-lines (:lines prev-vt))
+                prev-cursor (:cursor prev-vt)
+                actual-lines (vt/compact-lines (:lines vt))
+                actual-cursor (:cursor vt)
+                expected-lines (get-in v0-frames [n :lines])
+                expected-cursor (get-in v0-frames [n :cursor])]
+            (print n)
+            (print "fed: " str)
+            (when (> n 0)
+              (when (not= actual-lines expected-lines)
+                (print "expected lines:")
+                (prn expected-lines)
+                (print "got lines:")
+                (prn actual-lines)
+                (print "prev lines:")
+                (prn prev-lines)
+                (throw "expectation failed"))
+
+              (when (not= actual-cursor expected-cursor)
+                (print "expected cursor:")
+                (prn expected-cursor)
+                (print "got cursor:")
+                (prn actual-cursor)
+                (print "prev cursor:")
+                (prn prev-cursor)
+                (throw "expectation failed")))
+
+            (recur (inc n) vt))
+          (print "success"))))))
+
+(defn start-debug []
+  (reset! reload-fn debug)
+  (debug))


make the issue layers go away on the homepage

--- src-cljs/frontend/components/canvas.cljs
+++ src-cljs/frontend/components/canvas.cljs
@@ -408,7 +408,7 @@
             font-size 24]
         (dom/g nil
           (when-let [issue (issue-model/find-by-doc-id @issue-db document-id)]
-            (dom/g nil
+            (dom/g #js {:className "layer"}
               (svg-element {:layer/type :layer.type/text
                             :layer/text (str "Feature request -- " (gstring/truncate (:issue/title issue) 40))
                             :layer/start-x 100


Add a zookeeper-connect method

Add a zookeeper-connect method

Library will connec to zookeeper on your behalf

--- src/zk_queue/core.clj
+++ src/zk_queue/core.clj
@@ -1,6 +1,48 @@
-(ns zk-queue.core)
+(ns ^{:doc "A thin clojure wrapper over Zookeeper Queue Recipe"
+      :author "Kiran Kulkarni <kk.questworld@gmail.com>"}
+  zk-queue.core
+  (:require [clojure.string :as cs])
+  (:import (org.apache.zookeeper ZooKeeper WatchedEvent Watcher)
+           (java.util.concurrent CountDownLatch TimeUnit)))

-(defn foo
-  "I don't do a whole lot."
-  [x]
-  (println x "Hello, World!"))
+(defn- zk-node->zk-node-str
+  [{:keys [host port]}]
+  (when port
+    host
+    (str host ":" port)))
+
+
+(defn- make-watcher
+  ([handler]
+     (reify Watcher
+       (process [this event]
+         (handler (when event
+                    {:event-type (keyword (.. ^WatchedEvent event
+                                              getType
+                                              name))
+                     :keeper-state (keyword (.. ^WatchedEvent event
+                                                getState
+                                                name))
+                     :path (.getPath ^WatchedEvent event)}))))))
+
+
+(defn zk-connect!
+  [zk-nodes & {:keys [chroot zk-timeout-msec
+                      conn-timeout]
+               :or {chroot ""
+                    zk-timeout-msec 5000
+                    conn-timeout 30}}]
+  {:pre [every? :host zk-nodes]}
+  (let [zk-node-string (cs/join ","
+                                (mapv zk-node->zk-node-str zk-nodes))
+        connection-string (str zk-node-string chroot)
+        latch (CountDownLatch. 1)
+        unlatch-watcher (make-watcher (fn [event]
+                                        (when (= (:keeper-state event)
+                                                 :SyncConnected)
+                                          (.countDown latch))))
+        client (ZooKeeper. connection-string
+                           zk-timeout-msec
+                           unlatch-watcher)]
+    (when (.await latch conn-timeout TimeUnit/SECONDS)
+      client)))


Une première proposition de solution à l'exercice Acronym de Exercism dans la track Clojure

--- exercism/clojure/acronym/src/acronym.clj
+++ exercism/clojure/acronym/src/acronym.clj
@@ -1,5 +1,13 @@
-(ns acronym)
+(ns acronym
+  (:require [clojure.string :as str]))

-(defn acronym [] ;; <- arglist goes here
-  ;; your code goes here
-)
+(defn acronym [phrase]
+  (if (str/blank? phrase)
+    ""
+    (str/join
+     (map #(subs %1 0 1)
+          (flatten
+           (map #(str/split %1 #"[a-z]+")
+                (map #(str/replace %1 #",|:" "")
+                     (map  #(str (str/upper-case (subs %1 0 1)) (subs %1 1))
+                           (str/split phrase #"\s|\-")))))))))


fix a few typos, add a comment about local file context data

--- src/vip/data_processor/validation/csv.clj
+++ src/vip/data_processor/validation/csv.clj
@@ -52,7 +52,7 @@
   "Uses the supplied `format-rules` to process a given row. If there
   is a mismatch in the size of the columns in the row and the columns
   specified by the header, records an error. Increments the
-  line-number and returns the context ctx with the formatted row
+  line-number and returns the context `ctx` with the formatted row
   merged in."
   [{:keys [filename table] :as data-spec}
    {:keys [line-number headers headers-count format-rules] :as file-ctx}
@@ -82,11 +82,11 @@
 (defn process-row-chunks
   "Processes all the map rows in a chunk via `process-row` with the
   supplied format-rules (see `data-spec/create-format-rules` in
-  `do-bulk-import-and-validate-csv`) transforms (see
+  `do-bulk-import-and-validate-csv`) and transforms (see
   `data-spec/translation-fns` in
   `do-bulk-import-and-validate-csv`). Inserts the row into the
   database, and records any UNIQUE constraint-failing SQLExceptions as
-  errors. Returns the context ctx. If the supplied chunk is empty,
+  errors. Returns the context `ctx`. If the supplied chunk is empty,
   simply returns the context as-is."
   [{:keys [columns filename] :as data-spec}
    {:keys [transforms column-names headers sql-table line-number] :as file-ctx}
@@ -119,7 +119,7 @@
   "Converts the file into map rows using clojure.data.csv, chunks them
   up into partitions so that we don't go over our statement parameter
   limit, and then processes all the chunks using
-  `process-row-chunks`. Returns the context ctx. If no headers are
+  `process-row-chunks`. Returns the context `ctx`. If no headers are
   present reports an error and returns the context as-is."
   [ctx
    {:keys [table] :as data-spec}
@@ -166,7 +166,9 @@
   "Prepares all the necessary formatting and transformation functions
   along with other useful meta-data and initiates the insertion and
   preliminary validation of CSV data using the chunking mechanism in
-  vip.data-processor.db.util/chunk-rows."
+  vip.data-processor.db.util/chunk-rows. Returns the context `ctx`
+  having performed all necessary database insertions, error reporting,
+  and other preliminary validation."
   [{:keys [data-specs tables] :as ctx}
    {:keys [filename table columns] :as data-spec}
    in-file]
@@ -175,6 +177,7 @@
         ctx (warn-if-extraneous-headers ctx data-spec headers column-names)]
     (if (empty? (set/intersection (set headers) (set column-names)))
       (errors/add-errors ctx :critical table :global :no-header "No header row")
+      ;; Local file context needed for any given row during processing
       (->> {:in-file in-file
             :sql-table (get tables table)
             :headers headers


fixed config

fixed config

--- integration/org/domaindrivenarchitecture/pallet/crate/managed_ide/instantiate_aws_init.clj
+++ integration/org/domaindrivenarchitecture/pallet/crate/managed_ide/instantiate_aws_init.clj
@@ -59,8 +59,9 @@
     :domain-name "meissa-gmbh.de"
     :additional-config
     {:dda-managed-vm
-     {:provider "aws"
-      :ide-user :vmuser}})
+     {:ide-user :vmuser}
+     :dda-managed-ide
+     {:provider "aws"}})
   )

 (def config
@@ -123,7 +124,7 @@
               init/with-init
               managed-vm/with-dda-vm]
     :node-spec (aws-node-spec)
-    :count 1))
+    :count 0))

 (defn inspect-phase-plan []
   (session-tools/inspect-mock-server-spec


Cover alter with tests

Cover alter with tests

--- test/clojure/clojurewerkz/cassaforte/new_query_api_test.clj
+++ test/clojure/clojurewerkz/cassaforte/new_query_api_test.clj
@@ -8,7 +8,6 @@
 (defn normalize-string
   [s]
   (-> s
-      ;; (.setForceNoValues true)
       (.getQueryString)
       (clojure.string/replace "\t" "  ")
       (clojure.string/replace #"^\n" "")
@@ -67,7 +66,7 @@
   (is (renders-to "SELECT * FROM tv_series WHERE series_title='Futurama' AND episode_id>10 LIMIT 10;"
                   (select :tv_series
                           (paginate :key :episode_id :per-page 10 :last-key 10
-                                  :where {:series_title "Futurama"}))))
+                                    :where {:series_title "Futurama"}))))

   (is (renders-to  "SELECT * FROM foo WHERE foo='bar' ORDER BY foo ASC;"
                    (select :foo
@@ -178,8 +177,8 @@

   (is (renders-to "SELECT * FROM events WHERE message IN ('Message 7','Message 8','Message 9','Message 10') AND created_at>=minTimeuuid(1001);"
                   (select :events
-                    (where [[:in :message ["Message 7" "Message 8" "Message 9" "Message 10"]]
-                            [>= :created_at (min-timeuuid 1001)]]))))
+                          (where [[:in :message ["Message 7" "Message 8" "Message 9" "Message 10"]]
+                                  [>= :created_at (min-timeuuid 1001)]]))))

   (is (renders-to "SELECT * FROM foo WHERE token(k)>token(42);"
                   (select :foo
@@ -580,3 +579,12 @@
                              {"class"              "SimpleStrategy"
                               "replication_factor" 1}})
                            (if-not-exists))))))
+
+(deftest test-alter-keyspace
+  (is (= "ALTER KEYSPACE foo WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};"
+         (normalize-string
+          (alter-keyspace "foo"
+                          (with
+                           {:replication
+                            {"class"              "SimpleStrategy"
+                             "replication_factor" 1}}))))))


An typo

An typo

--- test/clojurewerkz/cassaforte/cql_test.clj
+++ test/clojurewerkz/cassaforte/cql_test.clj
@@ -6,7 +6,7 @@
             [clojure.test :refer :all]
             [clojurewerkz.cassaforte.query :refer :all]))

-(let [s (client/connect ["127.0.01"])]
+(let [s (client/connect ["127.0.0.1"])]
   (use-fixtures :each (fn [f]
                         (th/with-temporary-keyspace s f)))


Don't close thread on escape if text has been entered

Closes #132

--- src/braid/core/client/ui/views/thread.cljs
+++ src/braid/core/client/ui/views/thread.cljs
@@ -287,7 +287,8 @@

           :on-key-down
           (fn [e]
-            (when (= KeyCodes.ESC (.-keyCode e))
+            (when (and (= KeyCodes.ESC (.-keyCode e))
+                       (string/blank? (thread :new-message)))
               (helpers/stop-event! e)
               (dispatch [:hide-thread {:thread-id (thread :id)}])))


move parts of (cond) within (defn conjugate) for clarity

--- src/babel/italiano/morphology/verbs.cljc
+++ src/babel/italiano/morphology/verbs.cljc
@@ -541,9 +541,6 @@

     (= (get-in word [:infl]) :future)
     (regular-future word)
-
-    (= (get-in word [:infl]) :conditional)
-    (regular-conditional word)

     (and
      (= (get-in word [:infl]) :imperfect)
@@ -554,15 +551,6 @@
     (= (get-in word [:infl]) :imperfect)
     (regular-imperfect word)

-    (passato-as-head? word)
-    (passato-as-head word)
-
-    (irregular-passato? word)
-    (irregular-passato word)
-
-    (= :past (get-in word [:infl]))
-    (regular-passato word)
-
     (and
      (= (get-in word [:infl]) :present)
      (map? (get-in word [:present])))
@@ -572,6 +560,18 @@
     (= (get-in word [:infl]) :present)
     (regular-present word)

+    (= (get-in word [:infl]) :conditional)
+    (regular-conditional word)
+
+    (passato-as-head? word)
+    (passato-as-head word)
+
+    (irregular-passato? word)
+    (irregular-passato word)
+
+    (= :past (get-in word [:infl]))
+    (regular-passato word)
+
     (irregular-gerund? word)
     (irregular-gerund word)


create the scheduler one time instead of creating a new one for each mk-assignments call

--- src/clj/backtype/storm/daemon/nimbus.clj
+++ src/clj/backtype/storm/daemon/nimbus.clj
@@ -39,6 +39,11 @@
                                (log-error t "Error when processing event")
                                (halt-process! 20 "Error when processing an event")
                                ))
+   :scheduler (if (conf STORM-SCHEDULER)
+                (do (log-message "Using custom scheduler: " (conf STORM-SCHEDULER))
+                    (-> (conf STORM-SCHEDULER) (Class/forName) .newInstance))
+                (do (log-message "Using default scheduler")
+                    (DefaultScheduler.)))
    })

 (defn inbox [nimbus]
@@ -463,16 +468,9 @@
                                          supervisor-details (SupervisorDetails. sid hostname scheduler-meta all-ports)]]
                                {sid supervisor-details}))
         cluster (Cluster. supervisors existing-scheduler-assignments)
-        scheduler (if (conf STORM-SCHEDULER)
-                    (do
-                      (log-message "Using custom scheduler: " (conf STORM-SCHEDULER))
-                      (-> (conf STORM-SCHEDULER) (Class/forName) .newInstance))
-                    (do
-                      (log-message "Using system default scheduler")
-                      (DefaultScheduler.)))
         ;; call scheduler.schedule to schedule all the topologies
         ;; the new assignments for all the topologies are in the cluster object.
-        _ (.schedule scheduler topologies cluster)
+        _ (.schedule (:scheduler nimbus) topologies cluster)
         new-scheduler-assignments (.getAssignments cluster)
         ;; add more information to convert SchedulerAssignment to Assignment
         new-topology->executor->node+port (into {} (for [[topology-id assignment] new-scheduler-assignments


Extract a function for generating pages-list-normalizers

--- src/clj/comic_reader/sites/manga_fox.clj
+++ src/clj/comic_reader/sites/manga_fox.clj
@@ -73,17 +73,20 @@
 (defn extract-image-tag [html]
   (scrape/extract-image-tag html image-selector))

+(defn gen-extract-pages-list-normalize [base-url]
+  (util/html-fn {[name] :content}
+                (if-let [page-number (re-find page-normalize-pattern
+                                              name)]
+                  {:name name
+                   :url (format page-normalize-format
+                                base-url
+                                page-number)})))
+
 (defn extract-pages-list [html chapter-url]
   (let [base-url (s/replace chapter-url
                             chapter-number-pattern
                             "")
-        normalize (util/html-fn {[name] :content}
-                    (if-let [page-number (re-find page-normalize-pattern
-                                                  name)]
-                      {:name name
-                       :url (format page-normalize-format
-                                    base-url
-                                    page-number)}))]
+        normalize (gen-extract-pages-list-normalize base-url)]
     (scrape/extract-list html
                          page-list-selector
                          normalize)))


Show indicator in paginator when there are more pages than shown

--- src/cljs/my_money/components/common.cljs
+++ src/cljs/my_money/components/common.cljs
@@ -66,6 +66,17 @@
                                  (on-click index))}
                  (inc index)]])

+(defn- more-pages-indicator [visible?]
+  (when visible?
+    [:li.page-item.disabled>a.page-link {:href "#"} "..."]))
+
+(defn- navigation-button [disabled? text on-click-fn]
+  [:li.page-item {:class (when disabled? "disabled")}
+   [:a.page-link {:href "#"
+                  :on-click #(do (.preventDefault %)
+                                 (on-click-fn))}
+    text]])
+
 (defn paginator
   "on-click parameter is a function that takes as a parameter
    the index of the page to navigate to"
@@ -74,17 +85,11 @@
         last-page-button-to-show (min (+ current 3) last)]
     [:nav>ul.pagination.justify-content-center
      [page-button false 0 on-click]
-     [:li.page-item {:class (when (= current 0) "disabled")}
-      [:a.page-link {:href "#"
-                     :on-click #(do (.preventDefault %)
-                                    (on-click (dec current)))}
-                    "Previous"]]
+     [navigation-button (= current 0) "Previous" #(on-click (dec current))]
+     [more-pages-indicator (not (zero? first-page-button-to-show))]
      (for [i (range first-page-button-to-show last-page-button-to-show)]
        ^{:key (str "paginator-" i)}
        [page-button (= i current) i on-click])
-     [:li.page-item {:class (when (= (inc current) last) "disabled")}
-      [:a.page-link {:href "#"
-                     :on-click #(do (.preventDefault %)
-                                    (on-click (inc current)))}
-                    "Next"]]
+     [more-pages-indicator (not= last-page-button-to-show last)]
+     [navigation-button (= (inc current) last) "Next" #(on-click (inc current))]
      [page-button false (dec last) on-click]]))


fixed absolute url to node info

fixed absolute url to node info

fixes #263

--- src/cljs/swarmpit/component/node/list.cljs
+++ src/cljs/swarmpit/component/node/list.cljs
@@ -84,7 +84,7 @@
   [item]
   (html
     [:div.mdl-cell.node-item {:key (:id item)}
-     [:a {:href  (str "/#/nodes/" (:id item))
+     [:a {:href  (routes/path-for-frontend :node-info item)
           :style {:color          "inherit"
                   :textDecoration "inherit"}}
       (node-item-header item)


file vs res

file vs res

--- src/clojure/zensols/model/classifier.clj
+++ src/clojure/zensols/model/classifier.clj
@@ -142,16 +142,16 @@
   * **:fail-if-not-exists?** if `true` then throw an exception if the model
   file is missing"
   [name & {:keys [fail-if-not-exists?] :or {fail-if-not-exists? true}}]
-  (let [file (model-read-resource name)
-        exists? (and (instance? File) (.exists file))]
+  (let [res (model-read-resource name)
+        exists? (and (instance? File res) (.exists res))]
     (if (and fail-if-not-exists? (instance? File) (not exists?))
-      (throw (ex-info (format "no model file found: %s" file)
-                      {:file file})))
+      (throw (ex-info (format "no model file found: %s" res)
+                      {:file res})))
     (if-not exists?
-      (log/infof "no model file found %s" file)
+      (log/infof "no model resource found %s" res)
       (do
-        (log/infof "reading model from %s" file)
-        (with-open [in (input-stream file)]
+        (log/infof "reading model from %s" res)
+        (with-open [in (input-stream res)]
           (let [in-obj (java.io.ObjectInputStream. in)]
             (.readObject in-obj)))))))


return graph from connect-to-world

return graph from connect-to-world

--- src/cljx/jamesmacaulay/zelkova/signal.cljx
+++ src/cljx/jamesmacaulay/zelkova/signal.cljx
@@ -259,7 +259,6 @@
       kahn/kahn-sort
       reverse))

-
 (defrecord CompiledGraph
   [output-signal sorted-signals])

@@ -321,7 +320,8 @@
     (let [world (gather-event-sources (:sorted-signals compiled-graph))]
       (doseq [channel-fn (vals world)]
         (async/pipe (channel-fn g opts)
-                    events-channel))))
+                    events-channel)))
+    g)
   impl/Channel
   (close! [_] (impl/close! events-channel))
   (closed? [_] (impl/closed? events-channel))


fix doc

fix doc

--- src/clojure/zensols/nlparse/stopword.clj
+++ src/clojure/zensols/nlparse/stopword.clj
@@ -20,7 +20,9 @@
 Keys
 ---
 * **:post-tags** POS tags for *go words* (see namespace docs)
-* **:word-form-fn "
+* **:word-form-fn** function run on the token in [[go-word-form]]; for example
+  if `#(-> % :lemma s/lower-case)` then lemmatization is used (i.e. Running ->
+  run)"
   {:pos-tags #{"RB", "JJ", "JJR", "JJS", "MD",
                "NN", "NNS", "NNP", "NNPS",
                "VB", "VBD", "VBG", "VBN", "VBP", "VBZ",
@@ -35,14 +37,12 @@
          (contains? tags (:pos-tag token)))))

 (defn go-word-form
-  "Conical string word count form of a token.  The token is down cased and if
-  [[*stopword-config*]] has `:word-form` as `:lemma` then lemmatization
-  is used (i.e. Running -> run)."
+  "Conical string word count form of a token.  ."
   [token]
   ((:word-form-fn *stopword-config*) token))

 (defn go-word-forms
-  "Filter tokens per [[go-word-candidate?]] and return their *form*
+  "Filter tokens per [[go-word?]] and return their *form*
   based on [[go-word-form]]."
   [tokens]
   (->> tokens


Fix client's incoming Vouch filter

Fix client's incoming Vouch filter

When the client received bytes from its child, I was validating them as
an Initiate packet.

Validating them as the message contentportion of that packet wouldn't be
a terrible idea, but this was comparing the length against something
completely unrelated. Maybe the length of the Initiate header, before
the actual Message cryptobox?

Whichever. For now, that check is gone.

--- src/clojure/frereth_cp/client/initiate.clj
+++ src/clojure/frereth_cp/client/initiate.clj
@@ -131,79 +131,78 @@
   [{logger ::log/logger
     log-state ::log/state
     :as this}
-   ^bytes msg-bytes]
-  (println "Building initiated packet based on incoming" msg-bytes)
-  (let [{log-state ::log/state
-         msg ::message/possible-response
-         :as filtered} (message/filter-initial-message-bytes log-state
-                                                             msg-bytes)]
-    (if msg
-      ;; I really don't like this approach to a shared work-area.
-      ;; It kind-of made sense with the original approach, which involved
-      ;; locking down strict access from a single thread, using an agent.
-      ;; Note that this approach is worse than I thought at first glance:
-      ;; I'm really just reusing the last-used nonce (which, in theory,
-      ;; should be the one sent by the server for its cookie).
-      ;; That seems wrong all around. After all, the client can send Initiate
-      ;; packets any time it likes.
-      ;; c.f. lines 329-334 in the reference spec.
-      (let [working-nonce (byte-array K/nonce-length)
-            ;; Just reuse a subset of whatever the server sent us.
-            ;; Legal for the original Initiate Packet  because
-            ;; a) it uses a different prefix and
-            ;; b) it's a subset of the bytes the server really used anyway
-            ;; Note that this is actually for the *inner* vouch nonce.
-            ;; Which gets gets re-encrypted inside the Message chunk
-            ;; of the actual Initiate Packet.
-            ;; I'm going to trust the cryptographers about safety here.
-            nonce-suffix (b-t/sub-byte-array working-nonce
-                                             K/client-nonce-prefix-length)
-            {:keys [::specs/crypto-box]
-             log-state ::log/state
-             :as initiate-interior} (build-initiate-interior (select-keys this
-                                                                          [::log/state
-                                                                           ::specs/inner-i-nonce
-                                                                           ::shared/my-keys
-                                                                           ::shared/work-area
-                                                                           ::specs/vouch
-                                                                           ::state/shared-secrets])
-                                                             msg
-                                                             nonce-suffix)]
-        (if crypto-box
-          (let [log-state (log/info log-state
-                                    ::build-initiate-packet!
-                                    "Stuffing crypto-box into Initiate packet"
-                                    {::specs/crypto-box (when crypto-box
-                                                          (b-t/->string crypto-box))
-                                     ::message-length (count crypto-box)})
-                dscr (update-in K/initiate-packet-dscr
-                                [::K/vouch-wrapper ::K/length]
-                                +
-                                (count msg))
-                ^TweetNaclFast$Box$KeyPair short-pair (get-in this [::shared/my-keys ::shared/short-pair])
-                fields #:frereth-cp.shared.constants{:prefix K/initiate-header
-                                                     :srvr-xtn (::state/server-extension this)
-                                                     :clnt-xtn (::shared/extension this)
-                                                     :clnt-short-pk (.getPublicKey short-pair)
-                                                     :cookie (get-in this
-                                                                     [::state/server-security
-                                                                      ::state/server-cookie])
-                                                     :outer-i-nonce nonce-suffix
-                                                     :vouch-wrapper crypto-box}
-                result (serial/compose dscr
-                                       fields)]
-            (log/flush-logs! logger log-state)
-            result)
-          (do
-            (log/flush-logs! logger log-state)
-            (throw (ex-info "Building initiate-interior failed to generate a crypto-box"
-                            {::problem (dissoc initiate-interior
-                                               ::log/state)})))))
+   ^bytes msg]
+  (println "Thread:" (utils/get-current-thread) "Building initiated packet based on" (count msg) "incoming bytes in" msg)
+  (when-not msg
+    (log/flush-logs! logger log-state)
+    (throw (ex-info
+            {::specs/msg-bytes msg}))"Missing outgoing message")
+
+  ;; I really don't like this approach to a shared work-area.
+  ;; It kind-of made sense with the original approach, which involved
+  ;; locking down strict access from a single thread, using an agent.
+  ;; Note that this approach is worse than I thought at first glance:
+  ;; I'm really just reusing the last-used nonce (which, in theory,
+  ;; should be the one sent by the server for its cookie).
+  ;; That seems wrong all around. After all, the client can send Initiate
+  ;; packets any time it likes.
+  ;; c.f. lines 329-334 in the reference spec.
+  (let [working-nonce (byte-array K/nonce-length)
+        ;; Just reuse a subset of whatever the server sent us.
+        ;; Legal for the original Initiate Packet  because
+        ;; a) it uses a different prefix and
+        ;; b) it's a subset of the bytes the server really used anyway
+        ;; Note that this is actually for the *inner* vouch nonce.
+        ;; Which gets gets re-encrypted inside the Message chunk
+        ;; of the actual Initiate Packet.
+        ;; I'm going to trust the cryptographers about safety here.
+        nonce-suffix (b-t/sub-byte-array working-nonce
+                                         K/client-nonce-prefix-length)
+        {:keys [::specs/crypto-box]
+         log-state ::log/state
+         :as initiate-interior} (build-initiate-interior (select-keys this
+                                                                      [::log/state
+                                                                       ::specs/inner-i-nonce
+                                                                       ::shared/my-keys
+                                                                       ::shared/work-area
+                                                                       ::specs/vouch
+                                                                       ::state/shared-secrets])
+                                                         msg
+                                                         nonce-suffix)]
+    (if crypto-box
+      (let [log-state (log/info log-state
+                                ::build-initiate-packet!
+                                "Stuffing crypto-box into Initiate packet"
+                                {::specs/crypto-box (when crypto-box
+                                                      (b-t/->string crypto-box))
+                                 ::message-length (count crypto-box)})
+            dscr (update-in K/initiate-packet-dscr
+                            [::K/vouch-wrapper ::K/length]
+                            +
+                            (count msg))
+            ^TweetNaclFast$Box$KeyPair short-pair (get-in this [::shared/my-keys ::shared/short-pair])
+            fields #:frereth-cp.shared.constants{:prefix K/initiate-header
+                                                 :srvr-xtn (::state/server-extension this)
+                                                 :clnt-xtn (::shared/extension this)
+                                                 :clnt-short-pk (.getPublicKey short-pair)
+                                                 :cookie (get-in this
+                                                                 [::state/server-security
+                                                                  ::state/server-cookie])
+                                                 :outer-i-nonce nonce-suffix
+                                                 :vouch-wrapper crypto-box}
+            result-bytes (serial/compose dscr
+                                         fields)
+            {log-state ::log/state
+             result ::message/possible-response
+             :as filtered} (message/filter-initial-message-bytes log-state
+                                                                 result-bytes)]
+        (log/flush-logs! logger log-state)
+        result)
       (do
         (log/flush-logs! logger log-state)
-        (throw (ex-info "Illegal outgoing message"
-                        {::specs/msg-bytes msg-bytes
-                         ::filtered filtered}))))))
+        (throw (ex-info "Building initiate-interior failed to generate a crypto-box"
+                        {::problem (dissoc initiate-interior
+                                           ::log/state)}))))))

 (s/fdef do-send-vouch
         :args (s/cat :this ::state/state


working on deep trace

working on deep trace

--- src/com/billpiel/mem_tracer/util/other.clj
+++ src/com/billpiel/mem_tracer/util/other.clj
@@ -251,6 +251,16 @@
        (zipmap (tree-seq coll? seq a)
                (tree-seq coll? seq b)))

+(defn deep-replace-symbols
+  [smap coll]
+  (clojure.walk/postwalk #(if (symbol? %)
+                            (or (get smap %)
+                                %)
+                            %)
+                         coll))
+
+(deep-replace-symbols {'aa 'aaa 'a 'aa '(a) '(aa) '(aa) '(aaa)}
+              '(b (a)))

 (defn get-path->form-maps
   [src]
@@ -289,6 +299,7 @@
                    (remove list?))
           xloc->oloc (deep-zipmap (-> src clojure.walk/macroexpand-all swap-in-path-syms)
                                   (-> src swap-in-path-syms clojure.walk/macroexpand-all))
+          oloc->xloc (clojure.set/map-invert xloc->oloc)
           xl->src  (deep-zipmap (-> src clojure.walk/macroexpand-all swap-in-path-syms)
                                 (clojure.walk/macroexpand-all src))
           ol->olop (-> src
@@ -323,7 +334,10 @@
                    :olxp (-> xl
                              xloc->oloc
                              ol->olxp)
-                   :xlop ()}})]
+                   :xlop (-> xl
+                             xloc->oloc
+                             ol->olop
+                             ((partial deep-replace-symbols oloc->xloc)))}})]
       (apply merge (map f #spy/d xls))))

   (clojure.pprint/pprint (mk-expr-mapping '(-> a b))))


fix comments

fix comments

--- ex2b/src/ex2b/theServlet.clj
+++ ex2b/src/ex2b/theServlet.clj
@@ -31,8 +31,8 @@

 ;; We can just as easily implement -doGet etc. instead of -service,
 ;; since they have the same arg structure.  Try uncommenting the
-;; -doGet code below and commenting out -service (above), then
-;; recompile and test.
+;; -doGet code below and commenting out -service (above); make the
+;; corresponding changes to impl.clj.  Then recompile and test.

 ;; (defn -doGet
 ;;   [^HttpServlet this


update clj-tcp version

update clj-tcp version

--- kafka-clj/project.clj
+++ kafka-clj/project.clj
@@ -27,7 +27,7 @@
                  [org.clojure/tools.trace "0.7.6"]
                  [org.xerial.snappy/snappy-java "1.1.1-M1"]
                  [org.clojure/tools.logging "0.2.6"]
-                 [clj-tcp "0.2.19-SNAPSHOT"]
+                 [clj-tcp "0.3.0-SNAPSHOT"]
                  [fmap-clojure "LATEST"]
                  [fun-utils "LATEST"]
                  [clj-tuple "0.1.4"]


(PDB-4468) fix difference between pg11 and pg9.6

This query returns a different order in pg11 than it does in pg9.6, so
adding this ORDER BY clause makes it behave the same in both.

--- test/puppetlabs/puppetdb/testutils/db.clj
+++ test/puppetlabs/puppetdb/testutils/db.clj
@@ -308,7 +308,8 @@
     ON i.relam = am.oid
   JOIN pg_namespace AS NS ON i.relnamespace = NS.OID
   JOIN pg_user AS U ON i.relowner = U.usesysid
-WHERE NOT nspname LIKE 'pg%';")
+WHERE NOT nspname LIKE 'pg%'
+ORDER BY i.relname ASC;")

 (defn db->index-map
   "Converts the metadata columns from their database names/formats to


Click handler should sit on whole pin-point

hovering effect was inconsistent with actual click-area

--- frontend/src/faceboard/views/gizmo.cljs
+++ frontend/src/faceboard/views/gizmo.cljs
@@ -40,10 +40,10 @@
       (dom/div {:class "gizmo-point"
                 :style gizmo-point-style}
         (dom/div {:class "gizmo-wrapper"}
-          (dom/div {:class (str "pin-point" (if active? " active"))}
+          (dom/div {:class (str "pin-point" (if active? " active"))
+                    :on-click (partial toggle-gizmo-when-clicked-pin-point id position)}
             (dom/i {:class    (str "fa fa-" icon)
-                    :title    title
-                    :on-click (partial toggle-gizmo-when-clicked-pin-point id position)}))
+                    :title    title}))
           (if active?
             (dom/div {:class "gizmo-frame-correction"
                       :style frame-correction-style}


Add better error message for error.network error.

--- frontend/src/uxbox/main/locales/en.cljs
+++ frontend/src/uxbox/main/locales/en.cljs
@@ -74,6 +74,7 @@
    "errors.auth.invalid-recovery-token" "The recovery token is invalid."
    "errors.profile.update-password" "Error updating password, probably your old password is wrong."

+   "errors.network" "Unable to connect to backend server."
    "errors.generic" "Something work has happened."
    "errors.conflict" "Conflict on saving data, please refresh and try again."


:host-regex must match the Host HTTP header

--- systems/ring/src/containium/systems/ring.clj
+++ systems/ring/src/containium/systems/ring.clj
@@ -51,8 +51,8 @@

 (defmacro matcher
   "Evaluates to a match form, used by the make-app function."
-  [{:keys [host-regex context-path]} uri-sym server-name-sym]
-  (let [host-test `(re-matches ~(if host-regex (re-pattern host-regex)) ~server-name-sym)
+  [{:keys [host-regex context-path]} uri-sym host-sym]
+  (let [host-test `(re-matches ~(if host-regex (re-pattern host-regex)) ~host-sym)
         context-test `(and (.startsWith ~uri-sym ~context-path)
                            (= (get ~uri-sym ~(count context-path)) \/))]
     `(and ~@(remove nil? (list (when host-regex host-test)
@@ -78,10 +78,10 @@
                   (let [sorted (vec (sort-apps apps))
                         fn-form `(fn [~'sorted ~'request]
                                    (let [~'uri (:uri ~'request)
-                                         ~'server-name (:server-name ~'request)]
+                                         ~'host (-> ~'request headers (get "host"))]
                                      (or ~@(for [index (range (count sorted))
                                                  :let [app (get sorted index)]]
-                                             `(when (matcher ~(:ring-conf app) ~'uri ~'server-name)
+                                             `(when (matcher ~(:ring-conf app) ~'uri ~'host)
                                                 (let [~'app (get ~'sorted ~index)]
                                                   (boxure/call-in-box
                                                    (:box ~'app)


todomvc: be able to get carry-logging from Clojars

--- examples/todomvc/project.clj
+++ examples/todomvc/project.clj
@@ -28,6 +28,7 @@

              :clojars-deps {:dependencies [[carry "0.1.0"]
                                            [carry-reagent "0.1.0"]
+                                           [carry-logging "0.1.0"]

                                            ; required by carry-devtools:
                                            [cljsjs/jquery-ui "1.11.4-0"]
@@ -37,7 +38,6 @@
                         :source-paths ["src"
                                        "../../contrib/history/src"
                                        "../../contrib/persistence/src"
-                                       "../../contrib/logging/src"
                                        "../../contrib/devtools/src"
                                        "../../contrib/schema/src"]
                         :compiler     {:main                 app.core