Use 'type-name' instead of 'type' to avoid unintentional shadowing.

--- src/pjstadig/es.clj
+++ src/pjstadig/es.clj
@@ -145,11 +145,13 @@
   (when (and (string? index-name) (pos? (count index-name)))
     index-name))

-(defn valid-type?
-  "True if type is a keyword or non-empty string"
-  [type]
-  (when (or (keyword type) (and (string? type) (pos? (count type))))
-    type))
+(defn valid-type-name?
+  "True if type-name is a keyword or non-empty string"
+  [type-name]
+  (when (or (keyword type-name)
+            (and (string? type-name)
+                 (pos? (count type-name))))
+    type-name))

 (defn valid-id?
   "True if id is a keyword, symbol, or non-empty string"
@@ -264,11 +266,11 @@
   (http-get (url es (index-list-str index-names) "_mapping")))

 (defn mapping-put
-  "Puts mapping for index-name and type."
-  [es index-name type mapping]
-  {:pre [es (valid-index-name? index-name) (valid-type? type)]}
-  (ok? (http-put (url es index-name type "_mapping")
-                 (json-body (select-keys mapping [type])))))
+  "Puts mapping for index-name and type-name."
+  [es index-name type-name mapping]
+  {:pre [es (valid-index-name? index-name) (valid-type-name? type-name)]}
+  (ok? (http-put (url es index-name type-name "_mapping")
+                 (json-body (select-keys mapping [type-name])))))

 (defn search-once* [es index-names query options]
   {:pre [es]}
@@ -313,10 +315,10 @@
   (search* es index-names query options))

 (defn doc-type
-  "Gets the type (via :_type or \"_type\") from doc."
+  "Gets the type-name (via :_type or \"_type\") from doc."
   [doc]
-  (if-let [type (or (:_type doc) (get doc "_type"))]
-    (name type)))
+  (if-let [type-name (or (:_type doc) (get doc "_type"))]
+    (name type-name)))

 (defn doc-id
   "Gets the id (via :_id or \"_id\") from doc."
@@ -340,10 +342,10 @@
   [es index-name doc & {:keys [stream?] :as options}]
   {:pre [(doc-type doc) (or (nil? (doc-id doc)) (valid-id? (doc-id doc)))]}
   (let [body ((if stream? piped-json-body json-body) doc)
-        type (doc-type doc)]
+        type-name (doc-type doc)]
     (if-let [id (doc-id doc)]
-      (http-put (url es index-name type id "_create") body)
-      (http-post (url es index-name type) body))))
+      (http-put (url es index-name type-name id "_create") body)
+      (http-post (url es index-name type-name) body))))

 (defn doc-index
   "Index doc in index-name using the ES index operation (creates it if it
@@ -411,19 +413,19 @@
   "Creates a bulk operation to create a document in ES."
   ([source]
      (doc-bulk-create (:_type source) (:_id source) source))
-  ([type id source]
-     (doc-bulk-create (:_index source) type id source))
-  ([index-name type id source]
+  ([type-name id source]
+     (doc-bulk-create (:_index source) type-name id source))
+  ([index-name type-name id source]
      {:pre [(or (nil? index-name)
                 (valid-index-name? index-name))
             (or (nil? (:_index source))
                 (and (valid-index-name? (:_index source))
                      (or (nil? index-name)
                          (= index-name (:_index source)))))
-            (valid-type? type)
+            (valid-type-name? type-name)
             (or (nil? (:_type source))
-                (and (valid-type? (:_type source))
-                     (= (name type) (:_type source))))
+                (and (valid-type-name? (:_type source))
+                     (= (name type-name) (:_type source))))
             (valid-id? id)
             (or (nil? (:_id source))
                 (and (valid-id? (:_id source))
@@ -431,7 +433,7 @@
             (nil? (get source "_index"))
             (nil? (get source "_type"))
             (nil? (get source "_id"))]}
-     {:create (merge {:_type (name type) :_id id :source source}
+     {:create (merge {:_type (name type-name) :_id id :source source}
                      (when index-name
                        {:_index index-name}))}))

@@ -439,19 +441,19 @@
   "Creates a bulk operation to index a document in ES."
   ([source]
      (doc-bulk-index (:_type source) (:_id source) source))
-  ([type id source]
-     (doc-bulk-index (:_index source) type id source))
-  ([index-name type id source]
+  ([type-name id source]
+     (doc-bulk-index (:_index source) type-name id source))
+  ([index-name type-name id source]
      {:pre [(or (nil? index-name)
                 (valid-index-name? index-name))
             (or (nil? (:_index source))
                 (and (valid-index-name? (:_index source))
                      (or (nil? index-name)
                          (= index-name (:_index source)))))
-            (valid-type? type)
+            (valid-type-name? type-name)
             (or (nil? (:_type source))
-                (and (valid-type? (:_type source))
-                     (= (name type) (:_type source))))
+                (and (valid-type-name? (:_type source))
+                     (= (name type-name) (:_type source))))
             (valid-id? id)
             (or (nil? (:_id source))
                 (and (valid-id? (:_id source))
@@ -459,15 +461,16 @@
             (nil? (get source "_index"))
             (nil? (get source "_type"))
             (nil? (get source "_id"))]}
-     {:index (merge {:_type (name type) :_id id :source source}
+     {:index (merge {:_type (name type-name) :_id id :source source}
                     (when index-name
                       {:_index index-name}))}))

 (defn doc-bulk-delete
   "Creates a bulk operation to delete a document in ES."
-  ([type id]
-     {:pre [(valid-type? type) (valid-id? id)]}
-     {:delete {:_type type :_id id}})
-  ([index-name type id]
-     {:pre [(valid-index-name? index-name) (valid-type? type) (valid-id? id)]}
-     {:delete {:_index index-name :_type type :_id id}}))
+  ([type-name id]
+     {:pre [(valid-type-name? type-name) (valid-id? id)]}
+     {:delete {:_type type-name :_id id}})
+  ([index-name type-name id]
+     {:pre [(valid-index-name? index-name) (valid-type-name? type-name)
+            (valid-id? id)]}
+     {:delete {:_index index-name :_type type-name :_id id}}))


Use asset manager in image constructor

Use asset manager in image constructor

--- src/play_clj/ui.clj
+++ src/play_clj/ui.clj
@@ -292,7 +292,8 @@
       (map? arg)
       (Image. ^TextureRegion (:object arg))
       (string? arg)
-      (Image. (Texture. ^String arg))
+      (Image. (or (u/load-asset arg Texture)
+                  (Texture. ^String arg)))
       :else
       (Image. arg))))


Add select-box

Add select-box

--- src/play_clj/ui.clj
+++ src/play_clj/ui.clj
@@ -5,8 +5,8 @@
            [com.badlogic.gdx.graphics.g2d BitmapFont TextureRegion]
            [com.badlogic.gdx.scenes.scene2d Actor Stage]
            [com.badlogic.gdx.scenes.scene2d.ui ButtonGroup CheckBox Dialog
-            HorizontalGroup Image ImageButton ImageTextButton Label Skin Slider
-            Table TextButton TextField VerticalGroup WidgetGroup]
+            HorizontalGroup Image ImageButton ImageTextButton Label SelectBox
+            Skin Slider Table TextButton TextField VerticalGroup WidgetGroup]
            [com.badlogic.gdx.scenes.scene2d.utils ActorGestureListener Align
             ChangeListener ClickListener DragListener FocusListener
             NinePatchDrawable SpriteDrawable TextureRegionDrawable
@@ -223,6 +223,20 @@
   [entity k & options]
   `(u/call! ^Label (:object ~entity) ~k ~@options))

+(defn select-box*
+  [items arg]
+  (u/create-entity (SelectBox. (into-array items) arg)))
+
+(defmacro select-box
+  [items arg & options]
+  `(let [entity# (select-box* ~items ~arg)]
+     (u/calls! ^SelectBox (:object entity#) ~@options)
+     entity#))
+
+(defmacro select-box!
+  [entity k & options]
+  `(u/call! ^SelectBox (:object ~entity) ~k ~@options))
+
 (defn slider*
   [{:keys [min max step vertical?]
     :or {min 0 max 10 step 1 vertical? false}}


:8ball: clojure RNA Transcription - case better than cond here

--- clojure/rna-transcription/rna_transcription.clj
+++ clojure/rna-transcription/rna_transcription.clj
@@ -2,10 +2,10 @@

 (defn- single-to-rna [c]
   (assert (some #{c} [\A \C \G \T]) (str "Unknown nucleotide: " c))
-  (cond
-    (= c \A) \U
-    (= c \C) \G
-    (= c \G) \C
-    (= c \T) \A))
+  (case c
+    \A \U
+    \C \G
+    \G \C
+    \T \A))

 (defn to-rna [s] (apply str (map single-to-rna s)))


(PDB-5484) post-ssl: pass opts to post; disallow extraneous args

--- test/puppetlabs/puppetdb/testutils/services.clj
+++ test/puppetlabs/puppetdb/testutils/services.clj
@@ -296,14 +296,16 @@
 (pls/defn-validated post-ssl
   "Executes a mutually authenticated POST HTTP request against
   `url-str`. Uses the above `post` function"
-  [url-str :- String
-   body
-   & [opts]]
-  (post url-str
-        body
-        {:ssl-ca-cert default-ca-cert
-         :ssl-cert default-cert
-         :ssl-key  default-ssl-key}))
+  ([url-str body] (post-ssl url-str body nil))
+  ([url-str :- String
+    body
+    opts]
+   (post url-str
+         body
+         (merge {:ssl-ca-cert default-ca-cert
+                 :ssl-cert default-cert
+                 :ssl-key  default-ssl-key}
+                opts))))

 (pls/defn-validated post-ssl-or-throw
   "Same as `post-ssl` except will throw if an error status is returned."


(TK-202) Fixup test nitpicks from PR feedback

This commit corrects a typo, collects parens, and moves a service down a
line to respond to feedback in the PR.

--- test/puppetlabs/trapperkeeper/services_test.clj
+++ test/puppetlabs/trapperkeeper/services_test.clj
@@ -186,16 +186,17 @@
 (deftest test-exception-during-restart
   (testing "restart should halt if an exception is raised"
     (let [call-seq (atom [])
-          services (conj (create-lifecycle-services call-seq) (service
-                                                                EmptyService
-                                                                []
-                                                                (stop [this context] (throw (IllegalStateException. "Exploding Service")))))]
+          services (conj (create-lifecycle-services call-seq)
+                         (service
+                           EmptyService
+                           []
+                           (stop [this context] (throw (IllegalStateException. "Exploding Service")))))]
       (ks-testutils/with-no-jvm-shutdown-hooks
        ; We can't use the with-app-with-empty-config macro because we don't
        ; want to use its implicit tk-app/stop call. We're asserting that
        ; the stop will happen because of the exception. So instead, we use
        ; the tk/run-app here to block on the app until the restart is
-       ; called an explodes in an exception.
+       ; called and explodes in an exception.
        (let [app (internal/throw-app-error-if-exists!
                   (bootstrap-services-with-empty-config services))
              app-running (future (tk/run-app app))]
@@ -207,8 +208,7 @@
            @app-running
            (catch ExecutionException e
              (is (instance? IllegalStateException (.getCause e)))
-             (is (= "Exploding Service" (.. e getCause getMessage)))))
-         ))
+             (is (= "Exploding Service" (.. e getCause getMessage)))))))
       ; Here we validate that the stop completed but no new init happened
       (is (= [:init-service1 :init-service2 :init-service3
               :start-service1 :start-service2 :start-service3


Tidy up stuff about categories and equivalent values.

--- test/clojure_the_language/clojure_numerics_test.clj
+++ test/clojure_the_language/clojure_numerics_test.clj
@@ -1,5 +1,12 @@
 (ns clojure-the-language.clojure-numerics-test
   (:require [midje.sweet :refer :all]))
+
+;;;; ___________________________________________________________________________
+;;;; ---- Terminology ----
+
+;;; The phrase "equivalent value" is used when two numbers, possibly of
+;;; different types, are the same value as seen from the point of view of
+;;; mathematics. So, for example, 2 and 2.0 are equivalent values.

 ;;;; ___________________________________________________________________________
 ;;;; ---- Numeric types ----
@@ -133,7 +140,7 @@
 ;;;; ---------------------------------------------------------------------------
 ;;;; ---- The thing that is, in my opinion, contrary to the doc string ----

-(fact "`=` return false for comparisons of equivalent numbers of different categories"
+(fact "`=` returns false for comparisons of equivalent numbers of different categories"
   ;; From /Clojure Programming/ with some changes and additions
   (fact (= 2 2.0)    => false)
   (fact (= 2 2M)     => false)
@@ -149,9 +156,9 @@
 ;;;; ---------------------------------------------------------------------------
 ;;;; ---- My playing ----

-;;; Shows that "same category" is a thing, as /Clojure Programming/ says. Shows
-;;; that the doc string's "type-independent manner" is bollocks (or at least
-;;; open to interpretation).
+;;; Shows that "same category" is A Thing, as /Clojure Programming/ says. Shows
+;;; that the doc string's "type-independent manner" is wrong (according to what
+;;; I think that should mean).

 ;;; Summary, showing the equivalence classes apart from rationals:
 ;;;
@@ -187,7 +194,7 @@
 ;;;     -----------------------------------------------

-(fact "Two numbers created from two same-looking literals are equal with ="
+(fact "Two numbers of the same type and with equivalent value are equal with ="
   (fact (= 2 2)                       => true)
   (fact (= 2N 2N)                     => true)
   (fact (= 2/3 2/3)                   => true)
@@ -196,7 +203,7 @@
   (fact (= 2.0 2.0)                   => true)
   (fact (= (Float. 2.0) (Float. 2.0)) => true))

-(fact "Two numbers of the same category and 'value' are equal with ="
+(fact "Two numbers of the same category and with equivalent value are equal with ="
   (fact (= 2   2N)           => true)
   (fact (= 2M  2.0M)         => true)
   (fact (= 2.0 (Float. 2.0)) => true))


+(log/info)

+(log/info)

--- src/babel/francais/morphology.cljc
+++ src/babel/francais/morphology.cljc
@@ -223,6 +223,7 @@
                                       ;; TODO: add checks for other -stem features, like :imperfect-stem.
                                       true
                                       (get-in word [:français]))]
+                 (log/info (str "conjugate: infinitive=" infinitive "; word=" word))
                  (conjugate infinitive word))))

            (and


Remove logging statement

Remove logging statement

--- src/cider_ci/auth/anti_forgery.clj
+++ src/cider_ci/auth/anti_forgery.clj
@@ -48,7 +48,6 @@
                   :headers {"WWW-Authenticate" msg}}))

 (defn process [request handler]
-  (logging/info request)
   (let [token (or (-> request :cookies (get cookie-name nil) :value)
                   (crypto.random/base64 32))
         resp (if (and (not (safe-request? request))


more notes

more notes

--- src/clj/backtype/storm/testing.clj
+++ src/clj/backtype/storm/testing.clj
@@ -314,6 +314,9 @@
 (defnk complete-topology [cluster-map topology :mock-sources {} :storm-conf {}]
   ;; TODO: generalize this to work with transactional topologies
   ;; instead of direclty calling FixedTupleSpout interface, want a function (or a protocol) that can get (total tuples planned) and (total tuples done) from the spout
+
+  ;; TODO: the idea of mocking for transactional topologies should be done an
+  ;; abstraction level above... should have a complete-transactional-topology for this
   (let [storm-name (str "topologytest-" (uuid))
         state (:storm-cluster-state cluster-map)
         spouts (.get_spouts topology)


Mobile plugin, gallery query fixes

Mobile plugin, gallery query fixes

--- src/clj/salava/extra/mobile/db.clj
+++ src/clj/salava/extra/mobile/db.clj
@@ -136,30 +136,30 @@
        (str where (apply str (interpose " " name-where)))
        (into args (mapcat #(list % %) name-parts))])))

-(defn- gallery-badge-query [country name order offset]
+(defn- gallery-badge-query [country name]
   (let [[join where args] (-> ["INNER JOIN user_badge ub ON g.id = ub.gallery_id"
-                               (str "WHERE ub.deleted = 0 AND ub.visibility != 'private'"
+                               (str "WHERE ub.status = 'accepted' AND ub.deleted = 0 AND ub.visibility != 'private'"
                                     " AND ub.revoked = 0 AND (ub.expires_on IS NULL OR ub.expires_on > UNIX_TIMESTAMP())")
                                []]
                               (gallery-badge-query-country country)
-                              (gallery-badge-query-name name))
+                              (gallery-badge-query-name name))]
+    [(str "FROM gallery g " join " " where) args]))
+
+
+(defn gallery-badge-search [ctx {:keys [country name order offset]}]
+  (let [[from-where args] (gallery-badge-query country name)
+
         order-by (if (= order "name") "ORDER BY g.badge_name" "ORDER BY ub.id DESC")
-        offset (if (re-find #"^[0-9]+$" offset) (str "OFFSET " (* 20 (Long. offset))) "OFFSET 0")]
-    [(str "FROM gallery g " join " " where " " order-by " LIMIT 20 " offset) args]))
-
-
-(defn gallery-badge-search [ctx {:keys [country name order offset]}]
-  (let [conn (:connection (u/get-db ctx))
-        [sql args] (gallery-badge-query country name order offset)
-        sql-count (str "SELECT COUNT(g.id) as total "
-                       sql)
-        sql-data  (str "SELECT g.id AS gallery_id, NULL as advert_id,"
+        offset (if (re-find #"^[0-9]+$" offset) (str "OFFSET " (* 20 (Long. offset))) "OFFSET 0")
+
+        sql-count (str "SELECT COUNT(DISTINCT g.id) as total " from-where)
+        sql-data  (str "SELECT DISTINCT g.id AS gallery_id, NULL as advert_id,"
                        " g.badge_id, g.badge_name, g.issuer_name, g.badge_image AS image_file "
-                       sql)]
-
+                       from-where " " order-by " LIMIT 20 " offset)
+        conn (:connection (u/get-db ctx))]
     {:badges (->> (jdbc/query conn (into [sql-data] args))
                   (map #(update % :image_file (partial png-convert-url ctx))))
-     :total (-> (jdbc/query conn (into [sql-count] args)) first :total)}))
+     :total (-> (jdbc/query conn (into [sql-count] args)) first (get :total 0))}))

 ;;;

@@ -179,7 +179,7 @@
        (str where (apply str (interpose " " name-where)))
        (into args (mapcat #(list % % %) name-parts))])))

-(defn- gallery-earnable-badge-query [country name order offset]
+(defn- gallery-earnable-badge-query [country name]
   (let [[join where args] (-> [(str "INNER JOIN badge_content bc ON a.badge_content_id = bc.id "
                                     "INNER JOIN issuer_content ic ON a.issuer_content_id = ic.id")
                                (str "WHERE a.deleted = 0"
@@ -187,23 +187,24 @@
                                     " AND (a.not_after  IS NULL OR a.not_after  = 0 OR a.not_after  >= UNIX_TIMESTAMP())")
                                []]
                               (gallery-earnable-badge-query-country country)
-                              (gallery-earnable-badge-query-name name))
+                              (gallery-earnable-badge-query-name name))]
+    [(str "FROM badge_advert a " join " " where) args]))
+
+(defn gallery-earnable-badge-search [ctx {:keys [country name order offset]}]
+  (let [[from-where args] (gallery-earnable-badge-query country name)
+
         order-by (if (= order "name") "ORDER BY badge_name" "ORDER BY a.mtime DESC")
-        offset (if (re-find #"^[0-9]+$" offset) (str "OFFSET " (* 20 (Long. offset))) "OFFSET 0")]
-    [(str "FROM badge_advert a " join " " where " " order-by " LIMIT 20 " offset) args]))
-
-(defn gallery-earnable-badge-search [ctx {:keys [country name order offset]}]
-  (let [conn (:connection (u/get-db ctx))
-        [sql args] (gallery-earnable-badge-query country name order offset)
-        sql-count (str "SELECT COUNT(a.id) as total "
-                       sql)
-        sql-data  (str "SELECT NULL AS gallery_id, a.id as advert_id,"
+        offset (if (re-find #"^[0-9]+$" offset) (str "OFFSET " (* 20 (Long. offset))) "OFFSET 0")
+
+        sql-count (str "SELECT COUNT(DISTINCT a.id) as total " from-where)
+        sql-data  (str "SELECT DISTINCT a.id as advert_id, NULL AS gallery_id,"
                        " NULL AS badge_id, bc.name AS badge_name, ic.name AS issuer_name, bc.image_file "
-                       sql)]
+                       from-where  " " order-by " LIMIT 20 " offset)
+        conn (:connection (u/get-db ctx))]

     {:badges (->> (jdbc/query conn (into [sql-data] args))
                   (map #(update % :image_file (partial png-convert-url ctx))))
-     :total (-> (jdbc/query conn (into [sql-count] args)) first :total)}))
+     :total (-> (jdbc/query conn (into [sql-count] args)) first (get :total 0))}))

 ;;;


[#2254] Test: columns could be removed without existing in txs

--- backend/test/akvo/lumen/lib/transformation_test.clj
+++ backend/test/akvo/lumen/lib/transformation_test.clj
@@ -11,15 +11,15 @@
             [akvo.lumen.lib :as lib]
             [akvo.lumen.lib.multiple-column :as multiple-column]
             [akvo.lumen.lib.transformation :as transformation]
+            [akvo.lumen.lib.transformation.derive-category :as derive-category]
             [akvo.lumen.lib.transformation.engine :as engine]
-            [akvo.lumen.lib.transformation.derive-category :as derive-category]
             [akvo.lumen.postgres :as postgres]
             [akvo.lumen.specs :as lumen.s]
             [akvo.lumen.specs.import :as import.s]
             [akvo.lumen.specs.import.column :as import.column.s]
             [akvo.lumen.specs.import.values :as import.values.s]
             [akvo.lumen.specs.transformation :as transformation.s]
-            [akvo.lumen.test-utils :refer [import-file at-least-one-true retry-job-execution] :as tu]
+            [akvo.lumen.test-utils :refer [update-file import-file at-least-one-true retry-job-execution] :as tu]
             [akvo.lumen.util :refer [conform squuid]]
             [cheshire.core :as json]
             [clj-time.coerce :as tcc]
@@ -286,6 +286,29 @@
         (is (= years (map (comp str tc/year tcc/from-long :c2) table-data)))
         (is (= years-slash (map (comp tcc/from-long :c3) table-data)))
         (is (= years-hiphen (map (comp tcc/from-long :c4) table-data)))))))
+
+
+
+(deftest ^:functional test-update-issue-2254
+  (testing "Testing https://github.com/akvo/akvo-lumen/issues/2254 "
+    (let [[job dataset] (import-file *tenant-conn* *error-tracker*
+                                     {:dataset-name "Padded titles"
+                                      :kind "clj"
+                                      :data (import.s/sample-imported-dataset [:text :number :text :number :text :number :text :number] 2)
+                                      :with-job? true})
+          dataset-id (:dataset_id dataset)
+          dataset (dataset-version-by-dataset-id *tenant-conn* {:dataset-id dataset-id
+                                                                :version 1})
+          stored-data (->> (latest-dataset-version-by-dataset-id *tenant-conn*
+                                                                 {:dataset-id dataset-id})
+                           (get-data *tenant-conn*))]
+      (testing "Testing columns are removed without tx"
+        (log/error :job job)
+       (let [updated-res (update-file *tenant-conn* *error-tracker* (:dataset-id job) (:data_source_id job)
+                                      {:kind "clj"
+                                       :data (import.s/sample-imported-dataset [:text :number :text :number :text :number] 2)})]
+         (is (some? updated-res))))
+      )))

 (deftest ^:functional derived-column-test
   (let [change-datatype-transformation (fn [column-name]


Remove debug output

Remove debug output

--- src/doctopus/doctopus/tentacle.clj
+++ src/doctopus/doctopus/tentacle.clj
@@ -60,7 +60,6 @@
       (if success?
         (do (binding [fs/*cwd* target-dir]
               (let [html-dir (fs/file output-root)]
-                (log/debug "HTML commands is:" html-commands)
                 (make-html-from-vec html-commands target-dir)
                 (check-and-report
                  (save-build-output this html-dir) name "generated HTML" "generate HTML"))))


Implement separator between filtered and non-filtered cards

--- frontend/src/faceboard/views/boards/people.cljs
+++ frontend/src/faceboard/views/boards/people.cljs
@@ -124,7 +124,7 @@
                         "translateZ(" (:z layout) "px)"))
           zoom-transform (when layout
                            (str
-                             "translateZ(" (if extended? 50 0) "px)"))]
+                             "translateZ(" (if extended? 100 0) "px)"))]
       (dom/div {:class     (str "person-card"
                              (when layout " has-layout")
                              (anim-class expansion-anim " expanding")
@@ -377,7 +377,7 @@
       [person-id
        {:left (.-offsetLeft card)
         :top  (.-offsetTop card)
-        :z    (if (is-person-filtered? filter-predicates person) -200 -50)}])))
+        :z    (if (is-person-filtered? filter-predicates person) -100 -100)}])))

 (defn retrieve-cards-layout [people filter-predicates cards]
   (apply hash-map (mapcat #(retrieve-card-layout people filter-predicates %) cards)))
@@ -407,22 +407,27 @@
           sorted-people (sort people-comparator people)
           active-filters (get-in data [:ui :filters :active])
           filter-predicates (build-filter-predicates active-filters data)
-          sorted-people-with-filter-status (map (fn [person]
-                                                  (hash-map
-                                                    :person person
-                                                    :filtered? (not (every? true? (map #(% person) filter-predicates)))))
-                                             sorted-people)
-          sorted-people-ordered-by-filter (sort-by :filtered? sorted-people-with-filter-status)]
+          person->item (fn [person] (hash-map :person person :filtered? (is-person-filtered? filter-predicates person)))
+          sorted-people-with-filter-status (map person->item sorted-people)
+          sorted-people-ordered-by-filter (sort-by :filtered? sorted-people-with-filter-status)
+          last-filtered? (atom false)
+          separator-adder (fn [item] (if (and (not @last-filtered?) (:filtered? item))
+                                       (do (reset! last-filtered? true) [{:separator true} item])
+                                       [item]))
+          sorted-people-ordered-by-filter-with-separator (mapcat separator-adder sorted-people-ordered-by-filter)]
       (dom/div {:class "people-desk people-scaffold clearfix"
                 :ref   "desk"}
-        (for [item sorted-people-ordered-by-filter]
-          (let [person (:person item)
-                person-id (:id person)
-                data {:person    person
-                      :extended? false
-                      :filtered? false
-                      :anim      0}]
-            (om/build person-component data {:react-key person-id})))))))
+        (for [item sorted-people-ordered-by-filter-with-separator]
+          (if (:separator item)
+            (dom/div {:class "separator clear"})
+            (let [person (:person item)
+                  person-id (:id person)
+                  filtered? (:filtered? item)
+                  data {:person    person
+                        :extended? false
+                        :filtered? filtered?
+                        :anim      0}]
+              (om/build person-component data {:react-key person-id}))))))))

 (defcomponent people-layout-component [data _ _]
   (render [_]


had the condition backwards

had the condition backwards

--- src-cljs/frontend/db.cljs
+++ src-cljs/frontend/db.cljs
@@ -68,17 +68,17 @@
    with :entity-id and :state keys. Backwards compatible with dummy ids."
   [app-state]
   (if (:use-frontend-ids app-state)
+    (let [{:keys [entity-id frontend-id-state]} (generate-entity-id @(:db app-state) (:frontend-id-state app-state))]
+      {:entity-id entity-id :state (assoc app-state :frontend-id-state frontend-id-state)})
     (let [eid (first (:entity-ids app-state))]
-      {:entity-id eid :state (update-in app-state [:entity-ids] disj eid)})
-    (let [{:keys [entity-id frontend-id-state]} (generate-entity-id @(:db app-state) (:frontend-id-state app-state))]
-      {:entity-id entity-id :state (assoc app-state :frontend-id-state frontend-id-state)})))
+      {:entity-id eid :state (update-in app-state [:entity-ids] disj eid)})))

 (defn get-entity-ids
   "Provides an app-state-aware API for generating entity ids, returns a map
    with :entity-id and :state keys. Backwards compatible with dummy ids."
   [app-state n]
   (if (:use-frontend-ids app-state)
+    (let [{:keys [entity-ids frontend-id-state]} (generate-entity-ids @(:db app-state) n (:frontend-id-state app-state))]
+      {:entity-ids entity-ids :state (assoc app-state :frontend-id-state frontend-id-state)})
     (let [eids (take n (:entity-ids app-state))]
-      {:entity-ids eids :state (update-in app-state [:entity-ids] #(apply disj % eids))})
-    (let [{:keys [entity-ids frontend-id-state]} (generate-entity-ids @(:db app-state) n (:frontend-id-state app-state))]
-      {:entity-ids entity-ids :state (assoc app-state :frontend-id-state frontend-id-state)})))
+      {:entity-ids eids :state (update-in app-state [:entity-ids] #(apply disj % eids))})))


Change order to match doc string.

Change order to match doc string.

--- src/afterglow/dj_link.clj
+++ src/afterglow/dj_link.clj
@@ -21,9 +21,9 @@
   sources (keyed on the address from which they transmit), set of
   active synced metronomes, and the future that processes packets."}
   state (atom {:socket nil
-               :watcher nil
                :sources-seen {}
-               :synced-metronomes #{}}))
+               :synced-metronomes #{}
+               :watcher nil}))

 (defn shut-down
   "Close the UDP server socket and terminate the packet processing


Report whether we started a cue.

Report whether we started a cue.

--- src/afterglow/max/Cue.clj
+++ src/afterglow/max/Cue.clj
@@ -156,7 +156,8 @@
 (defn -post-init
   "The post-init phase of the constructors tells Max about the inlets
   and outlets supported by this object, and registers our interest in
-  cue state with Afterglow."
+  cue state with Afterglow, setting up the function which sends
+  reports on the cue state outlet."
   [this x y]
   (let [type-string (str "m" (cue-variable-type-string this))
         cue-name (get-in @(.state this) [:cue :name])
@@ -170,7 +171,12 @@

     ;; Set up the callback function for changes to cue state
     (let [f (fn [new-state _ id]
-              (.outlet this 0 (name new-state) (into-array Atom [(Atom/newAtom id) (Atom/newAtom cue-name)]))
+              (.outlet this 0 (name new-state)
+                       (into-array Atom (concat (when (= :started new-state)
+                                                  [(Atom/newAtom (if (= id (:we-started @(.state this)))
+                                                                   "here"
+                                                                   "elsewhere"))])
+                                                [(Atom/newAtom id) (Atom/newAtom cue-name)])))
               (case new-state
                 :started (watch-cue-local-variables this)
                 :ended (unwatch-cue-local-variables this)
@@ -194,7 +200,8 @@
   (let [{:keys [x y]} @(.state this)
         [_ active] (show/find-cue-grid-active-effect *show* x y)]
     (when-not (and active (not (:ending active)))
-      (show/add-effect-from-cue-grid! x y :var-overrides (:variables @(.state this))))))
+      (let [id (show/add-effect-from-cue-grid! x y :var-overrides (:variables @(.state this)))]
+        (swap! (.state this) assoc :we-started id)))))

 (defn -end
   "Ask the cue to end; if it has already been asked once, kill it


log all the things

log all the things

--- src/albatross/handler.clj
+++ src/albatross/handler.clj
@@ -21,19 +21,19 @@

 (timbre/refer-timbre)

-(defn- logger
-  "custom logger without time"
-  [{:keys [level throwable message timestamp hostname ns]}
-   ;; Any extra appender-specific opts:
-   & [{:keys [nofonts?] :as appender-fmt-output-opts}]]
-  ;; <timestamp> <hostname> <LEVEL> [<ns>] - <message> <throwable>
-  (format "%s [%s] - %s%s"
-          (-> level name clojure.string/upper-case) ns (or message "")
-          (or (timbre/stacktrace throwable "\n" (when nofonts? {})) "")))
+;; (defn- logger
+;;   "custom logger without time"
+;;   [{:keys [level throwable message timestamp hostname ns]}
+;;    ;; Any extra appender-specific opts:
+;;    & [{:keys [nofonts?] :as appender-fmt-output-opts}]]
+;;   ;; <timestamp> <hostname> <LEVEL> [<ns>] - <message> <throwable>
+;;   (format "%s [%s] - %s%s"
+;;           (-> level name clojure.string/upper-case) ns (or message "")
+;;           (or (timbre/stacktrace throwable "\n" (when nofonts? {})) "")))

 (timbre/set-config! [:appenders :spit :enabled?] true)
 (timbre/set-config! [:shared-appender-config :spit-filename] "albatross.log")
-(timbre/merge-config! {:fmt-output-fn logger})
+;(timbre/merge-config! {:fmt-output-fn logger})

 (def home-dir
   "we place our torrents here"


As Chousuke suggested, they are equivalent.

--- src/async/http/client.clj
+++ src/async/http/client.clj
@@ -34,7 +34,7 @@
 (defmacro with-ahc
   "Creates new Async Http Client with given configuration
   than executes body and closes the client."
-  [{:as config} & body]
+  [config & body]
   `(with-open [c# (create-client ~@(apply concat config))]
      (binding [*ahc* c#]
        ~@body)))


one-shot mode in place, given that execute does stuff (it doesn't)

--- src/bitsplit_cli/core.clj
+++ src/bitsplit_cli/core.clj
@@ -33,10 +33,16 @@
 (defn -main [& args]
     (if (empty? args)
         (start-repl)
-        (println "empty" args)))
+        (execute {
+            :storage storage
+            :command (->> args
+                        (map #(str % " "))
+                        (apply str))
+            :client client
+            })))

 ; A plan:
-;  define a spec for the shell, then functions to handle each commmand
+;  define a spec for the shell, then functions to handle each command
 ;  then, just stick things in a loop and you're good. some kind
 ;  of rpc-daemonization would be dope, too


Update beta program copy

Update beta program copy

--- src-cljs/frontend/components/account.cljs
+++ src-cljs/frontend/components/account.cljs
@@ -163,10 +163,10 @@
        [:div
         [:p
          "Join our beta program to get a sneak peek into what's
-         happening at CircleCI! By joining our beta you agree to keep
-         any information provided through the program confidential.
-         Please no tweets, blogs, or other public posting. We hope you
-         love what we've been working on!"]
+          happening at CircleCI, help us test new functionality, and
+          stay informed about new beta features. By joining our beta
+          you agree to keep any information provided through the
+          program confidential."]
         [:form
          (if (not clicked-join?)
            [:input.btn
@@ -178,11 +178,19 @@
            [:div
             [:div.card
              [:h3 "Beta Terms"]
-             [:p " Our beta program is a way to engage with our most thoughtful and dedicated users. We want to build the best features with your help. To that end, in joining the beta program you should be comfortable with these expectations:"]
+             [:p
+              "Our beta program is a way to engage with our most
+               thoughtful and dedicated users. We want to build the
+               best features with your help. To that end, in joining
+               the beta program you should be comfortable with these
+               expectations:"]
              [:ul
               [:li "We'll contact you about new features through e-mail and in-app messages"]
               [:li "You'll try to give feedback about new features when we release them"]
-              [:li "You won't post information about beta features publicly. We do encourage you to talk with your coworkers!"]]]
+              [:li "You won't post information about beta features
+                    publicly. Please no tweets, blogs, or other public
+                    posting, but we do encourage you to talk with your
+                    coworkers!"]]]
             [:p]
             [:input.btn
             {:on-click #(do


fix wrong title

fix wrong title

--- src-cljs/frontend/components/overlay.cljs
+++ src-cljs/frontend/components/overlay.cljs
@@ -438,7 +438,7 @@
                [:td [:div.shortcuts-key {:title "1 Key"} "1"]]
                [:td [:div.shortcuts-result {:title "Initial view when entering doc."} "Origin"]]]
               [:tr
-               [:td [:div.shortcuts-key {:title "1 Key"} "2"]]
+               [:td [:div.shortcuts-key {:title "2 Key"} "2"]]
                [:td [:div.shortcuts-result {:title "Return to previous view after jumping to origin."} "Return"]]]
               [:tr
                [:td [:div.shortcuts-key {:title "? Key"} "?"]]


fix from a previous namespace adjustment

--- src/brevis/example/swarm/neighborhood_line_swarm.clj
+++ src/brevis/example/swarm/neighborhood_line_swarm.clj
@@ -145,6 +145,18 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; ## brevis control code

+(defn make-floor
+   "Make a floor object."
+   [w h]
+   (move (make-real {:color (vec4 0.8 0.8 0.8 1)
+                     :shininess 80
+                     :type :floor
+                     :density 8050
+                     :hasShadow false
+                     ;                    :texture *checkers*
+                     :shape (create-box w 0.1 h)})
+         (vec3 0 -3 0)))
+
 (defn initialize-simulation
   "This is the function where you add everything to the world."
   []


ignore blank lines

ignore blank lines

--- src/rester/core.clj
+++ src/rester/core.clj
@@ -202,6 +202,7 @@

 (defn tests-from [file sheet]
   (let [tests (->> (map #(zipmap fields %) (read-rows file sheet))
+                   (filter #(not (str/blank? (:test %))))
                    (map-indexed #(-> %2 (assoc :placeholders (placeholders-of %2) :id %1)
                                      (update :extractions str->map #"\s*=\s*"))))
         extractors (for [t tests :when (:extractions t)] [(:id t) (map first (:extractions t))])
@@ -224,7 +225,7 @@
           (update :exp-status #(.intValue (Double/parseDouble %)))
           (assoc :exp-body exp-body :exp-headers exp-headers)))
     (catch Exception e
-      (log/error e "error preparing test " (:test test))
+      (log/error e "error preparing test -> " (:test test))
       (assoc test :error (str "error preparing test due to " e)))))

 (defn exec-test-case [test opts]


[scamp] update 'comment in test lib

[scamp] update 'comment in test lib

--- modules/scamp/test/scamp/core_test.clj
+++ modules/scamp/test/scamp/core_test.clj
@@ -146,7 +146,22 @@

 (comment
-(binding [scamp.core/*rand* testing-rand*]
-                                                                  (for [comm (range 2 252)]
-                                                                       (-> comm-test-world (core/do-comms comm) (dissoc :config) purge-world-envelope-ids)))
+  (binding [scamp.core/*rand* testing-rand*]
+    (for [comm (range 2 252)]
+      (-> comm-test-world (core/do-comms comm) (dissoc :config) purge-world-envelope-ids)))
+
+  (binding [scamp.core/*rand* testing-rand*]
+    (let [world comm-test-world
+          result (loop [world world messages-count 0]
+                   (if (-> world :message-envelopes empty?)
+                     {:world world :messages-count messages-count}
+                     (recur (core/do-comm world) (inc messages-count))))
+          end-world (-> result
+                        :world
+                        (dissoc :config)
+                        purge-world-envelope-ids)]
+      (clojure.pprint/pprint {:end-world end-world
+                              :messages-count (:messages-count result)})
+      ))
+
   )


Added unit tests for clojure

Added unit tests for clojure

--- clojure/cljsearch/test/cljsearch/fileutil_test.clj
+++ clojure/cljsearch/test/cljsearch/fileutil_test.clj
@@ -1,4 +1,5 @@
 (ns cljsearch.fileutil-test
+  (:use [clojure.java.io :only (file)])
   (:require [clojure.test :refer :all])
   (:require [clojure.string :as str :only (join)])
   (:use [cljsearch.fileutil]))
@@ -35,3 +36,14 @@
     (is (not (hidden? ".")))
     (is (not (hidden? "..")))
     (is (hidden? ".filename.txt"))))
+
+(deftest test-is-dot-dir?
+  (testing "test-is-dot-dir?"
+    (is (is-dot-dir? "."))
+    (is (is-dot-dir? ".."))))
+
+(deftest test-split-path
+  (testing "test-split-path"
+    (let [elems (split-path (file "~/path/to/nowhere"))]
+      (is (= (first elems) "~"))
+      (is (= (second elems) "path")))))


Fixes set-extension-url-from-qr: updates it for the new manage object

Signed-off-by: Julien Eluard <c768e13f1ba4c3ebed2909a1fc1e4b50bb021a2f@gmail.com>

--- src/status_im/extensions/core.cljs
+++ src/status_im/extensions/core.cljs
@@ -246,7 +246,8 @@

 (fx/defn set-extension-url-from-qr
   [cofx url]
-  (fx/merge (assoc-in cofx [:db :extension-url] url)
+  (fx/merge (assoc-in cofx [:db :extensions/manage :url] {:value url
+                                                          :error false})
             (navigation/navigate-back)))

 (fx/defn set-input


Convert web component test to using Mockito

--- clstreams/test/clstreams/webapi/component_test.clj
+++ clstreams/test/clstreams/webapi/component_test.clj
@@ -1,67 +1,40 @@
 (ns clstreams.webapi.component-test
   (:require [aleph.http :as aleph]
             [clojure.test :refer :all]
-            [clstreams.testutil.spies :refer [spy with-spy-redefs calls]]
-            [clstreams.webapi.component :refer :all]
-            [com.stuartsierra.component :as component]))
+            [clstreams.testutil.component :as tu-comp]
+            [clstreams.testutil.mockito :as mkto]
+            [clstreams.webapi.component :refer :all])
+  (:import org.mockito.Mockito))

 (def app-factory nil)

 (deftest test-aleph-component
   (testing "Component starts and stops server"
-    (let [handler (fn [& x] nil)
-          [stop-server stop-server-spy] (spy)
-          server-dummy (reify java.io.Closeable
-                         (close [this] (stop-server this)))
-          [app-factory app-factory-spy] (spy handler)]
-      (with-spy-redefs
-        [[aleph/start-server start-server-spy] (spy server-dummy)]
+    (let [config {:host "0.1.2.3" :port 1234}

-        (let [aleph (new-aleph app-factory {:host "0.1.2.3" :port 1234})]
-          (is (= (:server aleph) nil))
-          (is (= (-> start-server-spy calls count) 0))
-          (is (= (-> stop-server-spy calls count) 0))
+          handler (mkto/mock-fn)
+          app-factory (mkto/on-call (mkto/mock-fn) [(Mockito/any)] handler)

-          (let [started-aleph (component/start aleph)]
-            (is (= (:server started-aleph) server-dummy))
-            (is (= (-> start-server-spy calls count) 1))
-            (is (= (-> stop-server-spy calls count) 0))
-            (is (= (-> app-factory-spy calls count) 1))
-            (is (= (-> app-factory-spy calls first) [aleph]))
+          server-mock (mkto/mock java.io.Closeable)
+          start-server-fn (mkto/on-call (mkto/mock-fn) [handler config] server-mock)]

-            (let [stopped-aleph (component/stop started-aleph)]
-              (is (= (:stop-server stopped-aleph) nil)))))
+      (with-redefs [aleph/start-server start-server-fn]

-        (is (= (-> start-server-spy calls count) 1))
-        (is (= (-> start-server-spy calls first) [handler {:host "0.1.2.3" :port 1234}]))
-        (is (= (-> stop-server-spy calls count) 1))
-        (is (= (-> stop-server-spy calls first) [server-dummy]))))))
+        (tu-comp/cycle-component

-(comment deftest test-immutant-component
-  (testing "Component starts and stops server"
-    (let [handler (fn [& x] nil)
-          server-dummy {:server "ze-server"}
-          [app-factory app-factory-spy] (spy handler)]
-      (with-spy-redefs
-        [[web/run web-run-spy] (spy server-dummy)
-         [web/stop web-stop-spy] (spy)]
+         [aleph (new-aleph app-factory config)]
+         ((is (= (:server aleph) nil))
+          (mkto/verify-fn start-server-fn [handler config] (mkto/never))
+          (mkto/verify-> server-mock (.close) (mkto/never)))

-        (let [im (new-immutant app-factory (sorted-map :host "0.1.2.3" :port 1234))]
-          (is (= (:server im) nil))
-          (is (= (-> web-run-spy calls count) 0))
-          (is (= (-> web-stop-spy calls count) 0))
+         [started-aleph]
+         ((is (= (:server started-aleph) server-mock))
+          (mkto/verify-fn start-server-fn [handler config])
+          (mkto/verify-> server-mock (.close) (mkto/never))
+          (mkto/verify-fn app-factory [aleph]))

-          (let [started-im (component/start im)]
-            (is (= (:server started-im) server-dummy))
-            (is (= (-> web-run-spy calls count) 1))
-            (is (= (-> web-stop-spy calls count) 0))
-            (is (= (-> app-factory-spy calls count) 1))
-            (is (= (-> app-factory-spy calls first) [im]))
+         [stopped-aleph]
+         ((is (= (:stop-server stopped-aleph) nil))
+          (mkto/verify-fn start-server-fn [handler config])
+          (mkto/verify-> server-mock (.close))))))))

-            (let [stopped-im (component/stop started-im)]
-              (is (= (:server stopped-im) nil)))))
-
-        (is (= (-> web-run-spy calls count) 1))
-        (is (= (-> web-run-spy calls first) [handler :host "0.1.2.3":port 1234]))
-        (is (= (-> web-stop-spy calls count) 1))
-        (is (= (-> web-stop-spy calls first) [server-dummy]))))))


be more careful about the component's state when timing functions

--- core/src/gorillalabs/tesla/component/telemetry.clj
+++ core/src/gorillalabs/tesla/component/telemetry.clj
@@ -57,7 +57,7 @@
   (let [start (gensym)
         result (gensym)
         elapsed (gensym)]
-    (list 'if 'gorillalabs.tesla.component.telemetry/telemetry
+    (list 'if (list :host 'gorillalabs.tesla.component.telemetry/telemetry)
           (list 'let [start   (list 'System/currentTimeMillis)
                       result  expr
                       elapsed (list '- (list 'System/currentTimeMillis) start)]


Set tabindex of a tab-panel to 0 so it can be navigated to with tab

--- src/cljs/my_money/components/tab_bar.cljs
+++ src/cljs/my_money/components/tab_bar.cljs
@@ -43,5 +43,6 @@
 (defn tab-panel [props content]
   [:div {:role "tabpanel"
          :id (:id props)
+         :tabindex="0"
          :aria-labelledby (str "tab-" (:id props))}
    content])


Kibit cleanup.

Kibit cleanup.

--- src/com/lemondronor/turboshrimp/h264j.clj
+++ src/com/lemondronor/turboshrimp/h264j.clj
@@ -21,7 +21,7 @@
           (throw (ex-info
                   (str "Unable to decode frame; len= " len)
                   {})))
-        (when (not (first got-picture))
+        (when-not (first got-picture)
           (throw (ex-info
                   (str "Unable to decode frame; got-picture= " got-picture)
                   {})))


(PE-4372) DNS Alt names written to the master cert

--- src/clj/puppetlabs/master/certificate_authority.clj
+++ src/clj/puppetlabs/master/certificate_authority.clj
@@ -172,6 +172,30 @@
     (utils/cert->pem! cacert (:cacert ca-settings))
     (utils/crl->pem! cacrl (:cacrl ca-settings))))

+(defn split-hostnames
+  "Given a comma-separated list of hostnames, return a list of the
+  individual dns alt names with all surrounding whitespace removed. If
+  hostnames is empty or nil, then nil is returned."
+  [hostnames]
+  {:pre  [(or nil? (string? hostnames))]
+   :post [(every? string? %)]}
+  (let [hostnames (str/trim (or hostnames ""))]
+    (when (and hostnames (> (count hostnames) 0))
+      (mapv #(str/trim %) (str/split hostnames #",")))))
+
+(schema/defn
+  create-master-extensions-list
+  "Create a list of extensions to be added to the master certificate."
+  [settings  :- MasterSettings
+   cert-name :- schema/Str]
+  (let [dns-alt-names (split-hostnames (:dns-alt-names settings))
+        alt-names-ext (when (> (count dns-alt-names) 0)
+                        ;; TODO: Create a list of OID def'ns in CA lib
+                        {:oid      "2.5.29.17"
+                         :critical false
+                         :value    {:dns-name (conj dns-alt-names cert-name)}})]
+    (filter #((complement nil?) %) [alt-names-ext])))
+
 (schema/defn initialize-master!
   "Given the SSL directory file paths, master certname, and CA information,
   generate and write to disk all of the necessary SSL files for the master.
@@ -191,7 +215,8 @@
     (create-parent-directories! (vals ssldir-file-paths))
     (-> ssldir-file-paths :certdir fs/file ks/mkdirs!)
     (-> ssldir-file-paths :requestdir fs/file ks/mkdirs!)
-    (let [keypair (utils/generate-key-pair keylength)
+    (let [extensions (create-master-extensions-list master-settings master-certname)
+          keypair (utils/generate-key-pair keylength)
           public-key (utils/get-public-key keypair)
           private-key (utils/get-private-key keypair)
           x500-name (utils/cn master-certname)
@@ -200,7 +225,8 @@
                                            (next-serial-number! serial-number-file)
                                            (generate-not-before-date)
                                            (generate-not-after-date)
-                                           x500-name public-key)]
+                                           x500-name public-key
+                                           extensions)]
       (utils/key->pem! public-key (:hostpubkey ssldir-file-paths))
       (utils/key->pem! private-key (:hostprivkey ssldir-file-paths))
       (utils/cert->pem! hostcert (:hostcert ssldir-file-paths))


Fix (:refer-clojure :exclude []) to work with things defined in cljs.core.

--- src/clj/cljs/compiler.clj
+++ src/clj/cljs/compiler.clj
@@ -916,7 +916,8 @@

 (defn get-expander [sym env]
   (let [mvar
-        (when-not (-> env :locals sym)  ;locals hide macros
+        (when-not (or (-> env :locals sym)        ;locals hide macros
+                      (-> env :ns :excludes sym))
           (if-let [nstr (namespace sym)]
             (when-let [ns (cond
                            (= "clojure.core" nstr) (find-ns 'cljs.core)


oops--fix nil slack uid issue

oops--fix nil slack uid issue

--- src/clj/tictag/server.clj
+++ src/clj/tictag/server.clj
@@ -41,7 +41,8 @@

 (defn slack-user [db slack-message]
   (timbre/tracef "Validating slack message: %s" slack-message)
-  (db/get-user-from-slack-id db (get-in slack-message [:event :user])))
+  (when-let [uid (get-in slack-message [:event :user])]
+    (db/get-user-from-slack-id db uid)))

 (defn api-user [db {:keys [username password]}]
   (db/authenticated-user db username password))


Updated to use PushbackReader

Updated to use PushbackReader

--- src/cljs/cljs/reader.cljs
+++ src/cljs/cljs/reader.cljs
@@ -10,71 +10,88 @@
   (:require [goog.string :as gstring
              goog.string.StringBuffer :as gstringbuf]))

+(defprotocol PushbackReader
+  (read-char [reader] "Returns the next char from the Reader,
+nil if the end of stream has been reached")
+  (unread [reader ch] "Push back a single character on to the stream")
+  (peek [reader] [reader n] "Returns the first (or nth) character of the reader without advancing the reader position"))
+
+(deftype StringPushbackReader [state]
+  PushbackReader
+  (read-char [reader] (let [original @state]
+                      (reset! state (subs 1 original))
+                      (first original)))
+  (unread [reader ch] (reset! state (str ch @state)))
+  (peek [reader] (first @state))
+  (peek [reader n] (nth @state n)))
+
+(defn push-back-reader [s]
+  "Creates a StringPushbackReader from a given string"
+  (StringPushbackReader. (atom s)))
+
 (defn- whitespace?
-  "Checks whether the character at the index is Clojurescript whitespace"
-  [s idx]
-  (let [ch (.charAt s idx)]
+  "Checks whether the reader is on a whitespace character."
+  [reader]
+  (let [ch (peek reader)]
     (or (gstring/isBreakingWhitespace ch) (= \, ch))))

 (defn- comment?
-  "Checks whether the character at the index begins a comment"
-  [s idx]
-  (= \; (.charAt s idx)))
+  "Checks whether the reader is at the beginning of a comment"
+  [reader]
+  (= \; (peek reader)))

 (defn- number-literal?
-  "Checks whether a character at the index is the first digit of a number"
-  [s idx]
-  (let [ch (.charAt s idx)]
+  "Checks whether the reader is at the first digit of a number"
+  [reader]
+  (let [ch (peek reader)]
     (or (gstring/isNumeric ch)
         (and (or (= \+ ch) (= \- ch))
-             (gstring/isNumeric (.charAt s (inc idx)))))))
+             (gstring/isNumeric (peek reader 2))))))

 (defn- string-literal?
-  "Checks whether the character at the index is the first character of a string literal"
-  [s idx])
+  "Checks whether the reader is at the first character of a string literal"
+  [reader])

 (defn- vector-literal?
-  "Checks whether the character at the index is the first character of a vector literal"
-  [s idx])
+  "Checks whether the reader is at the first character of a vector literal"
+  [reader])

 (defn- map-literal?
-  "Checks whether the character at the index is the first character of a map literal"
-  [s idx])
+  "Checks whether the reader is at the first character of a map literal"
+  [reader])

 (declare read)

 (defn read-number
-  [s idx])
+  [reader])

 (defn read-string
-  [s idx])
+  [reader])

 (defn read-vector
-  [s idx])
+  [reader])

 (defn read-map
-  [s idx])
+  [reader])

 (defn read-symbol
-  [s idx])
-
-(defn read-first
-  "Reads the first object from a string, starting at the specified index.
-Returns a tuple of the object read and the last index read.
-Returns nil of the string did not contain any forms."
-  [s idx]
-  (if (< idx (.length s))
-    (cond
-     (whitespace? s idx) (recur s (inc idx))
-     (number-literal? s idx) (read-number s idx)
-     (string-literal? s idx) (read-string s idx)
-     (vector-literal? s idx) (read-vector s idx)
-     (map-literal? s idx) (read-map s idx)
-     :default (read-symbol s idx))))
+  [reader])

 (defn read
-  "Reads a lazy sequence of objects from a string, starting at the specified index.
-Reads to the end of the string."
-  [s idx]
-  (let [obj (read-first s idx)]
-    (lazy-seq (cons (first obj) (read s (second obj))))))+  "Reads the first object from a PushbackReader. Returns the object read.
+Returns nil if the reader did not contain any forms."
+  [reader]
+  (if (not (nil? (peek reader)))
+    (cond
+     (whitespace? reader) (do (read-char reader) (recur reader))
+     (comment? reader) nil ;; TODO: burn through until end of comment
+     (number-literal? reader) (read-number reader)
+     (string-literal? reader) (read-string reader)
+     (vector-literal? reader) (read-vector reader)
+     (map-literal? reader) (read-map reader)
+     :default (read-symbol reader))))
+
+(defn read-all
+  "Reads a lazy sequence of objects from a reader."
+  [reader]
+  (lazy-seq (cons (read reader) (read-all reader))))


Use  instead of js's Math.floor

Use  instead of js's Math.floor

--- src/cljs/fatlip/core.cljs
+++ src/cljs/fatlip/core.cljs
@@ -373,7 +373,7 @@
            crossings 0]
       (if (zero? index)
         [graph tree crossings]
-        (let [parent-index (.floor js/Math (/ (dec index) 2))
+        (let [parent-index (quot (dec index) 2)
               ;; By kind of a coincidence, the index of a node's parent in our
               ;; mental model of the accumulator tree is the same as that node's
               ;; index (if it's a right child), or its sibling's index (if it's


Reduce handshake dialog coming from client

It was forwarding along a bunch of details that the renderer simply
should not ever care about.

Cope with the altered data structure that leaves them out.

This is really just a trickle-up change, but it's an important one.

--- src/cljs/frereth/fsm.cljs
+++ src/cljs/frereth/fsm.cljs
@@ -10,18 +10,42 @@

 (defn transition-to-html5
   [{:keys [body css script] :as html}]
-  (raise {:not-implemented html}))
+  ;; Q: Aren't we supposed to have symbol maps that provide useful info for this sort of thing now?
+  (raise {:not-implemented html
+          :stack-trace "Start Transition"}))

 (defn transition-world
-  "Far too much information is getting here.
-TODO: Client needs to prune most of it.
-This part really only cares about the world"
+  "Let's get this party started!"
   [{:keys [action-url
            expires
            session-token
-           world]}]
-  (let [data (:data world)
+           world]
+    :as destination}]
+  (log/info "=========================================
+This is important!!!!!
+World transition to:
+=========================================\n"
+            ;; LOL First time I tried this, I hit :hold-please
+            destination)
+  (let [data (:data destination)
         {:keys [type version]} data]
     (cond
+      ;; TODO: Need an obvious way to do exactly that.
+      ;; Although, this seems to be acting on something like a semaphore model
+      ;; right now.
+      ;; Call it once, it fails.
+      ;; Succeeds the second time around.
+      ;; Q: What do I have wrong with the basic server interaction?
+      (= destination :hold-please) (js/alert "Don't make me call a second time")
       (and (= type :html)
-           (= version 5)) (transition-to-html5 (select-keys data [:body :css :script])))))
+           (= version 5)) (transition-to-html5 (select-keys data [:body :css :script]))
+           :else (js/alert (str "Don't understand World Transition Response:\n"
+                                destination
+                                "\nwhich is a: " (type destination)
+                                "\nTop-Level Keys:\n"
+                                (keys destination)
+                                "\nkeys that matter inside the data:\n"
+                                (keys data)
+                                "\nN.B.: data is an instance of: "
+                                (comment (type data))
+                                "\nSmart money says that nested data isn't getting deserialized correctly")))))


fix mount-root problem

fix mount-root problem

there was big discussion about how figwheel should reload application
https://github.com/reagent-project/reagent/issues/112#issuecomment-82908212

--- src/cljs/kulive/core.cljs
+++ src/cljs/kulive/core.cljs
@@ -208,6 +208,10 @@

 ;; Initialise app -------------------------

-(defn init! [] (hook-browser-navigation!)
+(defn mount-root []
+  (reagent/render [current-page] (.getElementById js/document "app")))
+
+(defn init! []
+  (hook-browser-navigation!)
   (re-frame/dispatch [:initialise-db])
-  (reagent/render [current-page] (.getElementById js/document "app")))
+  (mount-root))


ensure that initial local models are initialised correctly

--- dada-demo/src/main/clojure/org/dada/demo/client.clj
+++ dada-demo/src/main/clojure/org/dada/demo/client.clj
@@ -24,6 +24,7 @@
     SessionManagerNameGetter
     SessionManager
     SessionManagerHelper
+    Update
     View
     ViewNameGetter]
    [org.dada.core.jms
@@ -86,20 +87,20 @@
     (def session-manager (.client session-manager-service-factory "SessionManager"))
     (SessionManagerHelper/setCurrentSessionManager session-manager)

-    ;; (def local-oceans (model "MetaModel" metamodel-metadata))
-
-    ;; (.registerView session-manager "MetaModel"
-    ;; 		   (.decouple view-service-factory local-metamodel))
-
-    ;; (inspect-model local-metamodel)
-
-    (defn inspect-remote-model [model-name]
-      (let [local-model (model model-name (.getMetadata session-manager model-name))]
-	(.registerView session-manager model-name (.decouple view-service-factory local-model))
-	(inspect-model local-model)
-	local-model
+    (defn remote-model [model-name]
+      (let [a-model (model model-name (.getMetadata session-manager model-name))
+	    data (.registerView session-manager model-name (.decouple view-service-factory a-model))]
+	(.update
+	 a-model
+	 (map (fn [datum] (Update. nil datum)) (.getExtant data))
+	 '()
+	 (map (fn [datum] (Update. datum nil)) (.getExtinct data)))
+
+	a-model
 	))
-
-    (inspect-remote-model "MetaModel")
-
+
+    (def *remote-metamodel*  (remote-model "MetaModel"))
+
+    (inspect-model *metamodel*)
+
     ))


(PE-3868) Using default options for master config

--- test/puppetlabs/puppetserver/certificate_authority_test.clj
+++ test/puppetlabs/puppetserver/certificate_authority_test.clj
@@ -673,7 +673,7 @@

     (testing "basic extensions are created for a master"
       (let [dns-alt-names "onefish,twofish"
-            settings      (assoc (master-test-settings ssldir "hostname")
+            settings      (assoc (master-test-settings)
                                  :dns-alt-names dns-alt-names)
             exts          (create-master-extensions subject
                                                     subject-pub
@@ -721,7 +721,7 @@
         (is (= (set exts) (set exts-expected)))))

     (testing "A non-puppet OID read from a CSR attributes file is rejected"
-      (let [config (assoc (master-test-settings ssldir "master")
+      (let [config (assoc (master-test-settings)
                           :csr-attributes
                           (str masterdir "/insecure_csr_attribute.yaml"))]
         (is (thrown-with-slingshot?
@@ -735,7 +735,7 @@
               {:type    :invalid-alt-name
                :message "Cert subjectAltName contains a wildcard, which is not allowed: *.wildcard"}
               (create-master-extensions subject subject-pub issuer-pub
-                                        (assoc (master-test-settings ssldir "hostname")
+                                        (assoc (master-test-settings)
                                                :dns-alt-names dns-alt-names))))))

     (testing "basic extensions are created for a CA"


Lazy lessons learned - can read and write an stl

--- src/main/clojure/stl_collector/writer.clj
+++ src/main/clojure/stl_collector/writer.clj
@@ -16,8 +16,7 @@
   [buffer vs]
   (let [{x :x
          y :y
-         z :z} vs
-         _ (println [x y z])]
+         z :z} vs]
     (.putFloat buffer (float x))
     (.putFloat buffer (float y))
     (.putFloat buffer (float z))
@@ -31,7 +30,8 @@
 (defn write-facet
   [buffer facet]
   (let [n  (write-vector buffer (:normal facet))
-        vs (map (partial write-vector buffer) (:vertices facet))]
+        vs (doall (for [v  (:vertices facet)]
+                     (write-vector buffer v)))]
     (pad buffer 2)))

 (defn calculate-file-size


simplify pattern matching

simplify pattern matching

--- src/hu/ssh/github_changelog/formatters/markdown.clj
+++ src/hu/ssh/github_changelog/formatters/markdown.clj
@@ -38,11 +38,11 @@

 (s/defn highlight-fn :- Fn
   [version :- Semver]
-  (match [version]
-         [{:minor 0, :patch 0, :pre-release nil :build nil}] markdown/h1
-         [{:minor _, :patch 0, :pre-release nil :build nil}] markdown/h2
-         [{:minor _, :patch _, :pre-release nil :build nil}] markdown/h3
-         [{:minor _, :patch _, :pre-release _ :build nil}] markdown/h4
+  (match (vec (map version [:minor :patch :pre-release :build]))
+         [0 0 nil nil] markdown/h1
+         [_ 0 nil nil] markdown/h2
+         [_ _ nil nil] markdown/h3
+         [_ _ _ nil] markdown/h4
          :else markdown/h5))

 (s/defn format-tag :- s/Str


demonstrating counter increment pattern

demonstrating counter increment pattern

--- example/dev/example/dev.cljs
+++ example/dev/example/dev.cljs
@@ -12,12 +12,10 @@
 (fw/start {
            :websocket-url "ws://localhost:3449/figwheel-ws"
            :build-id "example"
+           ;; if you want to disable autoloading
            ;; :autoload false
            ;; :debug true
            :on-jsload (fn []
-
-                        ;; this is a better way to reload the cube example
-                        ;; which will reload even for non-local changes
-                        ;; (example.cube/stop-and-start-ex3)
-                        )
-           })
+                        ;; it can be helpful to touch the state on
+                        ;; reload to cause a re-render
+                        (swap! core/app-state update-in [:__figwheel_counter] inc))})


[Fixes #6825] Do not open settings as a modal

Signed-off-by: Julien Eluard <c768e13f1ba4c3ebed2909a1fc1e4b50bb021a2f@gmail.com>

--- src/status_im/ui/screens/wallet/settings/views.cljs
+++ src/status_im/ui/screens/wallet/settings/views.cljs
@@ -86,5 +86,5 @@
         :icon-opts {:color               colors/white
                     :accessibility-label :options-menu-button}
         :options   (into [{:label  (i18n/label :t/wallet-manage-assets)
-                           :action #(re-frame/dispatch [:navigate-to-modal :wallet-settings-assets])}]
+                           :action #(re-frame/dispatch [:navigate-to :wallet-settings-assets])}]
                          (map setting->action settings))}]]]))


BREAKING: Drop variants

BREAKING: Drop variants

--- src/detritus/variants.clj
+++ src/detritus/variants.clj
@@ -1,140 +0,0 @@
-(ns detritus.variants
-  (:refer-clojure :exclude [val])
-  (:require [detritus.update :refer [take-when]]))
-
-(defprotocol ITaggedVal
-  (-tag [_])
-  (-val [_]))
-
-(deftype ATaggedVal [t v]
-  ITaggedVal
-  (-tag [self]
-    (.t self))
-  (-val [self]
-    (.v self))
-
-  clojure.lang.Indexed
-  (nth [self i] (nth self i nil))
-  (nth [self i o]
-    (case i
-      (0)      (.t self)
-      (1)      (.v self)
-      o))
-
-  clojure.lang.ISeq
-  (next [this] (seq this))
-  (first [this] (.t this))
-  (count [this] 2)
-  (equiv [this obj] (= (seq this) (seq obj)))
-  (seq [self]
-    (cons (.t self)
-          (cons (.v self)
-                nil)))
-
-  clojure.lang.Associative
-  (entryAt [self key]
-    (.entryAt (.v self) key))
-  (assoc [self k v]
-    (ATaggedVal. (.t self)
-                 (.assoc (.v self) k v)))
-
-  clojure.lang.ILookup
-  (valAt [self k]
-    (.valAt (.v self) k))
-  (valAt [self k o]
-    (.valAt (.v self) k o)))
-
-(defn tagged?
-  "Predicate indicating whether the argument value is a tagged value or
-  not. Returns true if and only if the argument is all of #{ITaggedVal, Indexed,
-  ISeq}."
-  [x]
-  (and (satisfies? ITaggedVal x)
-       (instance?  clojure.lang.Indexed x)
-       (instance?  clojure.lang.ISeq x)))
-
-(defn tag
-  "Returns the tag on a tagged value, returning nil if the value is not tagged."
-  [x]
-  (when (tagged? x)
-    (-tag x)))
-
-(defn val
-  "Returns the value of a tagged value, returning nil if the value is not
-  tagged."
-  [x]
-  (when (tagged? x)
-    (-val x)))
-
-(defmacro deftag
-  "Generates a tagged value smart constructor `->T` where T is the name of the
-  tag. The constructor accepts an arglist identical to the list of members and
-  returns an instance of ATaggedVal with the defined tag and a map constructed
-  from keywordized member names to given values. Preconditions on members may be
-  specified by the pre-map as for clojure.core/defn.
-
-  Also generates a predicate `T?` where T is the name of the tag. The predicate
-  will return true if and only if the argument value is `tagged?`, an instance
-  of the given tag type, and satisfies the `:pre` conditions in the tag
-  constructor if any.
-
-  Ex. => (deftag test \"A demo variant\" [a b]
-           {:pre [(number? a) (vector? b)]})
-      nil
-      => (->test 1 [1])
-      (:user/test {:a 1 :b [1]})
-      => (test? (->test 1 [1]))
-      true
-      => (tagged? (->test 1 [1]))
-      true
-      => (tag (->test 1 [1]))
-      :user/test
-      => (val (->test 1 [1]))
-      {:a 1 b [1]}"
-  {:arglists '([name doc-string? attr-map? members pre-map?])}
-  [vname & args]
-  (let [;; Parse direct args
-        [?docstring args] (take-when string? "" args)
-        [?attr-map args]  (take-when map? {} args)
-        [members args]    (take-when vector? nil args)
-        [?pre-map args]   (take-when map? {} args)
-
-        ;; FIXME inline guards are a bad habit of mine
-        _                 (assert (vector? members) "Members is not a vector!")
-        _                 (assert (every? symbol? members) "Members may contain only symbols!")
-
-        ;; Build used datastructures
-        kw-members        (mapv (comp keyword name) members)
-        kw-tag            (keyword (name (ns-name *ns*))
-                                   (name vname))
-        ?attr-map         (merge ?attr-map
-                                 ?pre-map
-                                 (when ?docstring
-                                   {:doc ?docstring}))]
-    `(do (defn ~(symbol (str "->" (name vname)))
-           ~(str "Generated constructor for the " vname " type.")
-           ~members
-           ~?pre-map
-           (->ATaggedVal ~kw-tag (hash-map ~@(interleave kw-members members))))
-         (def ~vname
-           ~?docstring
-           (detritus.variants/->TagDescriptor
-            ,,(quote ~?attr-map)
-            ,,(quote ~kw-members)
-            ,,(quote ~kw-tag)))
-         (defn ~(symbol (str (name vname) "?"))
-           ~(str "Generated predicate for the " vname " type.")
-           ([x#]
-            (and (tagged? x#)
-                 (= ~kw-tag (tag x#))
-                 (or (map? (val x#))
-                     (nil? (val x#)))
-                 (let [[_ {:keys ~members}] x#]
-                   (and ~@(:pre ?pre-map))))))
-         nil)))
-
-(deftag TagDescriptor [attrs members tag])
-
-;; FIXME: def closed variant?
-;; FIXME: def open variant?
-;; FIXME: variant dispatch?


fix(ccw.core.doc-utils): better indentation of the first line of doc

--- ccw.core/src/clj/ccw/core/doc_utils.clj
+++ ccw.core/src/clj/ccw/core/doc_utils.clj
@@ -67,7 +67,12 @@
   (when-not (str/blank? doc)
     (render-section renderer
                     "Documentation"
-                    (str "
" doc "
"))))
+                    (str
+                      "
"
+                      "  " ; We add 2 spaces because docstring are generally
+                           ; indented 2 spaces except the first line
+                      doc
+                      "
"))))

 (defn var-doc-info [renderer m]
   (let [sections [(header-doc renderer m)


Tweak a doctopus to serve routes correctly with multiple heads

--- src/doctopus/doctopus.clj
+++ src/doctopus/doctopus.clj
@@ -45,6 +45,10 @@
   (list-tentacles-by-head [this head]
     {head (h/list-tentacles (:heads this))})
   (load-routes [this]
-    (into {} (for [head (:heads this)
-           :let [route-map (h/load-tentacle-routes head)]]
-               ["/" route-map]))))
+    ;; You may be wondering, "what the hell is going on here". And that's a
+    ;; great question! The answer is: we need to make sure that what's returned
+    ;; is a map from the key "/" to a map of the form {tentacle-name
+    ;; tentacle-routes}. This is not the prettiest, but it does just that.
+    {"/" (apply merge (flatten (into [] (for [head (:heads this)
+                                  :let [route-map (h/load-tentacle-routes head)]]
+                              [route-map]))))}))


forgot a println

forgot a println

--- src/dwc_services/core.clj
+++ src/dwc_services/core.clj
@@ -36,7 +36,6 @@
   [input]
    (let [tmp (as-file (str "/tmp/dwc-" (java.util.UUID/randomUUID) ".tmp" ))]
      (.createNewFile tmp)
-     (println (.getAbsolutePath tmp))
      (with-open [output (output-stream tmp)]
        (.write output (stream-to-bytes (input-stream input))))
      (.getAbsolutePath tmp )))


Make the realtime log table

Make the realtime log table

This stores the changes to records

--- src/webapp/framework/server/systemfns.clj
+++ src/webapp/framework/server/systemfns.clj
@@ -469,7 +469,7 @@
 )

-(defn do-real [& {:keys [:table-name]}]
+(defn make-admin-table []
   (let [coils-admin-tables      (korma.core/exec-raw
                                    [" select * from pg_tables where schemaname='public' and tablename='coils_triggers'" []]
                                    :results)
@@ -495,8 +495,6 @@

-            (println "table name: " table-name)
-            (create-realtime-trigger :table-name table-name)

   )
   )
@@ -506,7 +504,50 @@

-
+(defn make-log-table []
+  (let [coils-admin-tables      (korma.core/exec-raw
+                                   [" select * from pg_tables where schemaname='public' and tablename='coils_realtime_log'" []]
+                                   :results)
+
+        coils-admin-table-exists   (pos? (count coils-admin-tables))
+
+        sql-to-create-admin-table "
+CREATE TABLE coils_realtime_log
+(
+  id serial NOT NULL,
+  record_timestamp timestamp without time zone,
+  record_table_name character varying,
+  record_id character varying,
+  record_operation character varying,
+  record_status character varying
+);
+"
+  ]
+
+      (println "Coils admin table exists: " coils-admin-table-exists)
+      (if (not coils-admin-table-exists )
+                      (korma.core/exec-raw   [sql-to-create-admin-table []]   [])
+                      nil
+        )
+
+
+
+
+
+  )
+  )
+
+
+
+
+
+
+(defn do-real [& {:keys [:table-name]}]
+  (println "table name: " table-name)
+  (make-admin-table )
+  (make-log-table   )
+  (create-realtime-trigger  :table-name  table-name)
+)

 (defn !get-query-results-v2 [{:keys [


fixed #90

fixed #90

--- src/frontend/uploads.cljs
+++ src/frontend/uploads.cljs
@@ -145,17 +145,19 @@
                                    (and (= action :unpaused)
                                         (:started? upload))
                                      (do
+                                       (println "UNPAUSED1!")
                                        (.pipe blob-stream stream)
-                                       (let [uploads-order-after-id (uploads-after-id uploads-order upload-id)
-                                             upload-to-stop-id (first (active-uploads uploads-order-after-id uploads))
-                                             upload-to-stop (uploads upload-to-stop-id)]
-                                         (if-not (nil? upload-to-stop)
-                                           (swap! app-state/app-state
-                                                  assoc
-                                                  :uploads
-                                                  (assoc (:uploads @app-state/app-state)
-                                                         upload-to-stop-id
-                                                         (stop-upload upload-to-stop))))))
+                                       (if (>  (count (active-uploads uploads-order uploads))
+                                               upload-slots)
+                                         (let [uploads-order-after-id (uploads-after-id uploads-order upload-id)
+                                               upload-to-stop-id (last (active-uploads uploads-order uploads))]
+                                           (if-let [upload-to-stop (uploads upload-to-stop-id)]
+                                             (swap! app-state/app-state
+                                                    assoc
+                                                    :uploads
+                                                    (assoc (:uploads @app-state/app-state)
+                                                           upload-to-stop-id
+                                                           (stop-upload upload-to-stop)))))))
                                    (= action :stopped)
                                      (.unpipe blob-stream)
                                    (and (= action :started)


[WIP] test report tweak

[WIP] test report tweak

report the number of namespaces/vars a test is going to do
at the start of a run. mostly for UI purposes.

--- src/main/shadow/test.cljs
+++ src/main/shadow/test.cljs
@@ -58,7 +58,7 @@
           (println (str "Namespace: " ns " not found, no tests to run.")))]
        (test-vars-grouped-block vars)))))

-(defn prepare-test-run [{:keys [report-fn] :as env}]
+(defn prepare-test-run [{:keys [report-fn] :as env} vars]
   (let [orig-report ct/report]
     [(fn []
        (ct/set-env! (assoc env ::report-fn orig-report))
@@ -76,7 +76,12 @@
            (ct/update-current-env! [:each-fixtures] assoc test-ns fix)))

        ;; just in case report-fn wants to know when things starts
-       (ct/report {:type :begin-run-tests}))]))
+       (ct/report {:type :begin-run-tests
+                   :var-count (count vars)
+                   :ns-count (->> vars
+                                  (map #(-> % meta :ns))
+                                  (set)
+                                  (count))}))]))

 (defn finish-test-run [block]
   {:pre [(vector? block)]}
@@ -94,9 +99,9 @@
   "tests all vars grouped by namespace, expects seq of test vars, can be obtained from env"
   ([test-vars]
    (run-test-vars (ct/empty-env) test-vars))
-  ([env test-vars]
-   (-> (prepare-test-run env)
-       (into (test-vars-grouped-block test-vars))
+  ([env vars]
+   (-> (prepare-test-run env vars)
+       (into (test-vars-grouped-block vars))
        (finish-test-run)
        (ct/run-block))))

@@ -105,10 +110,11 @@
   ([ns]
    (test-ns (ct/empty-env) ns))
   ([env ns]
-   (-> (prepare-test-run env)
-       (into (test-ns-block ns))
-       (finish-test-run)
-       (ct/run-block))))
+   (let [{:keys [vars]} (env/get-test-ns-info ns)]
+     (-> (prepare-test-run env vars)
+         (into (test-vars-grouped-block vars))
+         (finish-test-run)
+         (ct/run-block)))))

 (defn run-tests
   "test all vars in specified namespace symbol set"
@@ -118,12 +124,12 @@
    (run-tests env (env/get-test-namespaces)))
   ([env namespaces]
    {:pre [(set? namespaces)]}
-   (-> (prepare-test-run env)
-       (into (->> (env/get-test-vars)
-                  (filter #(contains? namespaces (-> % meta :ns)))
-                  (test-vars-grouped-block)))
-       (finish-test-run)
-       (ct/run-block))))
+   (let [vars (->> (env/get-test-vars)
+                   (filter #(contains? namespaces (-> % meta :ns))))]
+     (-> (prepare-test-run env vars)
+         (into (test-vars-grouped-block vars))
+         (finish-test-run)
+         (ct/run-block)))))

 (defn run-all-tests
   "Runs all tests in all namespaces; prints results.


Add a test for min-timeuuid

Add a test for min-timeuuid

--- test/clojurewerkz/cassaforte/cql_test.clj
+++ test/clojurewerkz/cassaforte/cql_test.clj
@@ -4,12 +4,13 @@
             [clojurewerkz.cassaforte.client :as client]
             [clojurewerkz.cassaforte.policies :as cp]
             [clojurewerkz.cassaforte.cql :as cql :refer :all]
+            [clojurewerkz.cassaforte.uuids :as uuids]
             [clojure.test :refer :all]
             [clojurewerkz.cassaforte.query :refer :all]
             [qbits.hayt.dsl.statement :as hs]
             [qbits.hayt.dsl.clause :as hc]
             [qbits.hayt.fns :as fns]
-            [clj-time.core :refer [seconds ago before?]]
+            [clj-time.core :refer [seconds ago before? date-time]]
             [clj-time.coerce :as cc]))

 (let [s (client/connect ["127.0.0.1"])]
@@ -410,6 +411,28 @@

     (drop-table s :events))

+  (deftest test-timeuuid-min-max-range-query
+    (create-table s :events
+                  (column-definitions {:message      :varchar
+                                       :city         :varchar
+                                       :created_at   :timeuuid
+                                       :primary-key  [:message :created_at]}))
+    (create-index s :events :created_at)
+    (dotimes [i 10]
+      (let [dt (date-time 2014 11 17 23 i)]
+        (insert s :events {:created_at (uuids/start-of (cc/to-long dt))
+                           :city       "London, UK"
+                           :message    (format "Message %d" i)})))
+    (let [xs  (select s :events
+                      (where [[:in :message ["Message 7" "Message 8" "Message 9" "Message 10"]]
+                              [>= :created_at (-> (date-time 2014 11 17 23 8)
+                                                  .toDate
+                                                  fns/min-timeuuid)]]))]
+        (is (= #{"Message 8" "Message 9"}
+               (set (map :message xs)))))
+
+    (drop-table s :events))
+

   (deftest test-paginate
     (create-table s :tv_series


Keep sketch on top by default.

Keep sketch on top by default.

--- clj/src/leiningen/new/quil/core.clj
+++ clj/src/leiningen/new/quil/core.clj
@@ -40,6 +40,7 @@
   ; update-state is called on each iteration before draw-state.
   :update update-state
   :draw draw-state
+  :features [:keep-on-top]
   ; This sketch uses functional-mode middleware.
   ; Check quil wiki for more info about middlewares and particularly
   ; fun-mode.


metaconstant deref test

metaconstant deref test

--- test/midje/data/t_metaconstant.clj
+++ test/midje/data/t_metaconstant.clj
@@ -180,3 +180,12 @@
           0
           ..m..) => 6)

+;;; Metaconstant behavior
+
+(unfinished gen-doc)
+(fact "=contains=> is evaluated once, even when referenced multiple times"
+  (identical? (gen-doc) (gen-doc)) => truthy
+  (provided
+    ..doc.. =contains=> {:header (rand)}
+    (gen-doc) => ..doc..))
+


[#3073] WIP Merge query

[#3073] WIP Merge query

Only needs to adapt final resultset columnnames, eg: change c1234 to d1 c345 to d2

--- backend/src/akvo/lumen/lib/transformation/merge_datasets.clj
+++ backend/src/akvo/lumen/lib/transformation/merge_datasets.clj
@@ -98,10 +98,29 @@

 (defn fetch-data-2
   [conn {:keys [source-data-group source target]}]
-  (let [simple-query? (= (:source-table-name source-data-group)
-                         (:table-name source))]
-    )
-)
+  (let [simple-query?           (= (:source-table-name source-data-group)
+                                   (:table-name source))
+        source-selected-columns (s/join ", "
+                                        (map (partial str "s.")
+                                             (map #(get % "sourceColumnName" "instance_id")
+                                                  (:columns source-data-group))))
+        subquery                (if simple-query?
+                                  (format "select %1$s from %2$s s"
+                                          source-selected-columns
+                                          (-> source :table-name))
+                                  (format "select %1$s, %2$s from %3$s s, %4$s b where s.instance_id = b.instance_id"
+                                          (str  "b." (-> source :merge-column)) ;; merge column
+                                          source-selected-columns
+                                          (-> source-data-group :source-table-name) ;; table of selected columns
+                                          (-> source :table-name) ;; merge-column table
+                                          ))
+        sql                     (format "select t.instance_id, %1$s from (%2$s) s, %3$s t where t.%4$s = s.%5$s"
+                                        source-selected-columns
+                                        subquery
+                                        (-> target :table-name)
+                                        (-> target :merge-column)
+                                        (-> source :merge-column))]
+    (rest (jdbc/query conn [sql]))))

 (defn add-columns
   "Add the new columns to the target dataset"
@@ -215,7 +234,10 @@
                                               :table-name (:table-name source-merge-column-data-group)}
                                      :target {:merge-column (get target "mergeColumn")
                                               :table-name (:table-name target-merge-data-group)}})] ;; [{:instance_id 123 :c1234 0} {:instance_id 566 :c1234 10}]
-        (postgres/create-dataset-table conn table-name columns)
+        (postgres/create-dataset-table conn table-name (map #(update % :id (fn [_]
+                                                                             (:columnName %)))
+                                                            (walk/keywordize-keys columns)))
+        (log/error :data data) ;; todo we need to adapt columnnames, eg: change c1234 to d1 c345 to d2
         (jdbc/insert-multi! conn table-name data)))

     (map #(dissoc % :original-table-name) data-groups-to-be-created)


lose dependency on BaseMV - it was breaking the build - but I tested before I checked in !!

--- dada-core/src/main/clojure/org/dada/core/SimpleModelView.clj
+++ dada-core/src/main/clojure/org/dada/core/SimpleModelView.clj
@@ -2,19 +2,19 @@
     (:use
      [org.dada.core counted-set]
      )
-    (:require
-     [org.dada.core BaseModelView]
-     )
+    ;; (:require
+    ;;  [org.dada.core BaseModelView]
+    ;;  )
     (:import
      [java.util Collection]
      [org.dada.core Metadata Update]
      )
     (:gen-class
-     :extends org.dada.core.BaseModelView
-     ;;:implements [org.dada.core.ModelView]
+     ;;:extends org.dada.core.BaseModelView
+     :implements [org.dada.core.ModelView]
      :constructors {[String org.dada.core.Metadata]
-     [String org.dada.core.Metadata]
-     ;;[]
+     ;;[String org.dada.core.Metadata]
+     []
      }
      :methods []
      :init init
@@ -27,8 +27,8 @@
 (defn -init [#^String name #^Metadata metadata]

   [ ;; super ctor args
-   [name metadata]
-   ;;[]
+   ;;[name metadata]
+   []
    ;; instance state
    (let [key-getter (.getPrimaryGetter metadata)
 	 version-comparator (.getVersionComparator metadata)
@@ -181,6 +181,6 @@
 	[_ _ views] @mutable
 	[#^Collection i #^Collection a #^Collection d] (update-fn inputs)]
     (if (not (and (empty? i) (empty? a) (empty? d)))
-      (.notifyUpdate this i a d))
+      (-notifyUpdate this i a d))
     ))


[#1077] fix publish test

[#1077] fix publish test

--- backend/test/akvo/lumen/endpoint/public_test.clj
+++ backend/test/akvo/lumen/endpoint/public_test.clj
@@ -39,7 +39,7 @@
           dashboard-share (variant/value (share/fetch *tenant-conn*
                                                       {"dashboardId" dashboard-id}))
           share           (public-impl/get-share *tenant-conn* (:id dashboard-share))
-          share-data      (public-impl/response-data *tenant-conn* share)]
+          share-data      (public-impl/response-data *tenant-conn* share {})]
       (is (every? #(contains? share-data %)
                   ["dashboardId" "dashboards" "visualisations" "datasets"]))
       (is (= 1


handle new acquired-stamp in images ns

handle new acquired-stamp in images ns

--- src/mars_ogler/images.clj
+++ src/mars_ogler/images.clj
@@ -32,16 +32,20 @@
         lag (-> (if (time/before? taken released)
                   (time/interval taken released)
                   (time/interval taken taken))
-              times/format-interval)]
+              times/format-interval)
+        acquired (:acquired dates)
+        acquired-stamp (if acquired
+                         (cvt-time/to-long acquired)
+                         0)]
     (-> (merge img dates)
-      (assoc :lag lag, :released-stamp (cvt-time/to-long released)))))
+      (assoc :lag lag, :acquired-stamp acquired-stamp))))

 (defn unparse-dates
   [img]
   (let [dates (select-keys img times/types)]
     (-> (into img (for [[type date] dates]
                     [type (times/rfc-printer date)]))
-      (dissoc :lag :released-stamp))))
+      (dissoc :lag :acquired-stamp))))

 ;;
 ;; Formatting
@@ -128,7 +132,7 @@
 (defn sort-images
   "The images must contain joda DateTime objects in their date keys."
   [imgs]
-  (into {} (for [time-type times/types]
+  (into {} (for [time-type (disj times/types :acquired)]
              (let [resort (case time-type
                             :released reverse
                             :taken-marstime identity


Scrape every 15 minutes

Scrape every 15 minutes

--- src/mars_ogler/scrape.clj
+++ src/mars_ogler/scrape.clj
@@ -272,7 +272,8 @@

 (defn scrape-loop!
   []
-  (let [backup-imgs (atom (get-cached-images))]
+  (let [backup-imgs (atom (get-cached-images))
+        scrape-period (* 15 60 1000)] ; 15 minutes
     (while true
       (try (loop [imgs @backup-imgs]
              (let [{:keys [new old all]} (fetch-tick imgs)]
@@ -280,7 +281,7 @@
                (when-not (empty? new)
                  (update-states! all)
                  (reset! backup-imgs all))
-               (Thread/sleep (* 5 60 1000))
+               (Thread/sleep scrape-period)
                (recur all)))
         (catch Throwable err
           (let [cause (.getCause err)
@@ -288,4 +289,4 @@
                              (and cause
                                   (str " caused by: ") (.getMessage cause)))]
             (println "Had some trouble in the scrape loop:" err-msg))
-          (Thread/sleep (* 60 1000)))))))
+          (Thread/sleep scrape-period))))))


re-added dep in proj file for todos

re-added dep in proj file for todos

--- examples/todo/project.clj
+++ examples/todo/project.clj
@@ -8,7 +8,7 @@
                  [org.clojure/clojurescript "0.0-3297"]
                  [com.lucasbradstreet/cljs-uuid-utils "1.0.2"]
                  [quiescent "0.2.0-RC1"]
-                 ;[quiescent-model "0.1.0-SNAPSHOT"]
+                 [quiescent-model "0.1.0-SNAPSHOT"]
                  ]

   :plugins [[lein-cljsbuild "1.0.5"]


Deserialize the key.

Deserialize the key.

--- src/onyx/plugin/kafka.clj
+++ src/onyx/plugin/kafka.clj
@@ -210,7 +210,7 @@
                      (fn [^ConsumerRecord cr]
                        {:topic (.topic cr)
                         :partition (.partition cr)
-                        :key (.key cr)
+                        :key (deserializer-fn (.key cr))
                         :message (deserializer-fn (.value cr))
                         :serialized-key-size (.serializedKeySize cr)
                         :serialized-value-size (.serializedValueSize cr)


Added xsession/dump-handlers func for diagnostics

--- src/overtime/xsession.clj
+++ src/overtime/xsession.clj
@@ -70,6 +70,8 @@
   [xs-event key]
   (swap! handlers-per-knob update-in [xs-event] dissoc key))

+(defn dump-handlers [] (doseq [[knob-key val] @handlers-per-knob] (println knob-key "=>" (keys val))))
+
 (comment
   (start)
   (stop)
@@ -81,4 +83,6 @@
   (add-handler! :2-left :foo #(println "2-left:" %))
   (add-handler! :mid-left :foo #(println "mid-left:" %))
   (add-handler! :3-left :foo #(println "3-left:" %))
-  (add-handler! :volume-left :foo #(println "volume-left:" %)))
+  (add-handler! :volume-left :foo #(println "volume-left:" %))
+  (add-handler! :headphone-left :foo (fn [_x] (println "headphone-left")))
+  (dump-handlers))


Update clojure API as per cljs change

Update clojure API as per cljs change

Was unable to test this, as the following exception is thrown on bind:

ClassNotFoundException android.content.Context  java.net.URLClassLoader$1.run (URLClassLoader.java:372)

--- src/pani/clojure/core.clj
+++ src/pani/clojure/core.clj
@@ -74,7 +74,8 @@
                        `(= ~btype ~matchtype )
                        `(. ~node ~attacher (reify ~iface
                                              (~handler ~params
-                                               (~cb (.getValue ~(second params))))))))) specs)
+                                               (~cb {:name (name ~(second params))
+                                                     :val  (.getValue ~(second params))}))))))) specs)
        :else (throw (Exception. (str ~type " is not supported"))))))

 (defn bind


Fix bug

Fix bug

--- src/pinpointer/trace.cljc
+++ src/pinpointer/trace.cljc
@@ -6,7 +6,7 @@
             (reverse (drop (count steps1) (rseq steps2))))]
     (if (= (count t) 1)
       (let [{:keys [spec val in]} (first t)]
-        {:spec spec :val val :steps in})
+        [{:spec spec :val val :steps in}])
       (reduce (fn [t [curr next]]
                 (cond-> t
                   (not= (:val curr) (:val next))


better

better

--- exercism/clojure/phone-number/src/phone_number.clj
+++ exercism/clojure/phone-number/src/phone_number.clj
@@ -3,43 +3,40 @@

 (defrecord PhoneNumber [area exchange line])

-(defn- clean [s]
-  (str/replace s #"[^0-9]" ""))
-
 (defn- validate [s]
-  (let [c (clean s)
+  (let [c (str/replace s #"\D" "")
         n (count c)]
     (cond
-      (= 10 n) s
-      (and (= 11 n) (str/starts-with? s "1")) (subs s 1)
+      (= 10 n) c
+      (and (= 11 n) (str/starts-with? c "1")) (subs c 1)
       :else "0000000000")))

 (defn- parse [s]
   (->> s
        (re-find #"(\d{3})(\d{3})(\d{4})")
-       (rest)
+       rest
        (apply ->PhoneNumber)))

 (defn- to-phone-number [s]
-  (-> s clean validate parse))
+  (-> s validate parse))

-(defn- print-flat [p]
+(defn- flat [p]
   (let [a (:area p)
         e (:exchange p)
         l (:line p)]
     (str a e l)))

-(defn print-formatted [p]
+(defn- formatted [p]
   (let [a (:area p)
         e (:exchange p)
         l (:line p)]
     (format "(%s) %s-%s" a e l)))

 (defn number [s]
-  (-> s to-phone-number print-flat))
+  (-> s to-phone-number flat))

 (defn area-code [s]
   (-> s to-phone-number :area))

 (defn pretty-print [s] s
-  (-> s to-phone-number print-formatted))
+  (-> s to-phone-number formatted))


only add [:français :present :regular] = false if {:synsem {:cat :verb}}

--- src/babel/francais/lexicon.cljc
+++ src/babel/francais/lexicon.cljc
@@ -36,8 +36,9 @@
    (map-function-on-map-vals
     (fn [lexical-string lexical-vals]
       (map (fn [lexical-val]
-             (if (or (= (string? (get-in lexical-val [:français :present :1sing])))
-                     (= (string? (get-in lexical-val [:français :boot-stem1]))))
+             (if (and (or (= (string? (get-in lexical-val [:français :present :1sing])))
+                          (= (string? (get-in lexical-val [:français :boot-stem1]))))
+                      (= :verb (get-in lexical-val [:synsem :cat])))
                (unify {:français {:present {:regular false}}}
                       lexical-val)
                lexical-val))


fix reflexive lexical rule: should be :subj :prop and :obj :prop not (just) :subj and :obj

--- src/babel/italiano/lexicon.cljc
+++ src/babel/italiano/lexicon.cljc
@@ -255,20 +255,20 @@
                  :sem {:reflexive false}}})

       (default ;; ..but if a verb *is* reflexive:
-       (let [subject-semantics (atom {:animate true})
+       (let [subject-semantics (atom :top)
              subject-agr (atom :top)]
          {:synsem {:aux false
                    :cat :verb
                    :essere true
-                   :sem {:subj subject-semantics
-                         :obj subject-semantics
+                   :sem {:subj {:prop subject-semantics}
+                         :obj {:prop subject-semantics}
                          :reflexive true}
                    :subcat {:1 {:agr subject-agr
-                                :sem subject-semantics}
+                                :sem {:prop subject-semantics}}
                             :2 {:agr subject-agr
                                 :pronoun true
                                 :reflexive true
-                                :sem subject-semantics}}}}))
+                                :sem {:prop subject-semantics}}}}}))

       ;; if a verb has a second argument (i.e. the object),
       ;; then it is not reflexive. this is to prevent
@@ -445,10 +445,10 @@
                  (or (log/debug (str "lexical entry has a cat - good : " (strip-refs %)))
                      true))
             (and (log/warn (str "ignoring lexical entry with no :cat: " (strip-refs %)))
-                 false)))
+                 false)))))

       ;; end of language-specific grammar rules
-      ))
+

 (defn compile-lexicon
   "convert source lexicon to a Clojure map."


cleanup

cleanup

--- src/babel/italiano/lexicon.cljc
+++ src/babel/italiano/lexicon.cljc
@@ -1295,7 +1295,6 @@
              :agr {:gender :fem
                    :person :3rd
                    :number :sing}
-             :number :sing
              :sem {:number :sing
                    :person :3rd}}}
    "la tua"