thru rm_lm_medical_device_info

thru rm_lm_medical_device_info

--- src/pg_demo/table_defs.clj
+++ src/pg_demo/table_defs.clj
@@ -4307,6 +4307,372 @@
               PRIMARY KEY (ENTERPRISE_ID,INTERMEDIARY_ID)
           ); " }

+    { "rm_lm_investigators"
+          "CREATE TABLE rm_lm_investigators (
+              ENTERPRISE_ID numeric NOT NULL,
+              CENTER_ID numeric NOT NULL,
+              SEQ_NUM numeric NOT NULL,
+              NAME varchar(140),
+              PHONE varchar(20),
+              FAX varchar(50),
+              NOTES varchar(100),
+              DELETED timestamp,
+              PRIMARY KEY (ENTERPRISE_ID,CENTER_ID,SEQ_NUM)
+          ); " }
+
+    { "rm_lm_justifications"
+          "CREATE TABLE rm_lm_justifications (
+              ENTERPRISE_ID numeric NOT NULL,
+              JUSTIFICATION_ID numeric NOT NULL,
+              FIELD_ID numeric NOT NULL,
+              JUSTIFICATION varchar(1000),
+              PROTECTED numeric(1),
+              JUSTIFICATION_J varchar(1000),
+              DELETED timestamp,
+              PRIMARY KEY (ENTERPRISE_ID,JUSTIFICATION_ID,FIELD_ID)
+          ); " }
+
+    { "rm_lm_keywords"
+          "CREATE TABLE rm_lm_keywords (
+              ENTERPRISE_ID numeric NOT NULL,
+              KEYWORD_ID numeric NOT NULL,
+              KEYWORD varchar(40),
+              DISPLAY numeric(1),
+              PROTECTED numeric(1),
+              KEYWORD_J varchar(40),
+              DELETED timestamp,
+              PRIMARY KEY (ENTERPRISE_ID,KEYWORD_ID)
+          ); " }
+
+    { "rm_lm_labeled_terms"
+          "CREATE TABLE rm_lm_labeled_terms (
+              ENTERPRISE_ID numeric NOT NULL,
+              DATASHEET_ID numeric NOT NULL,
+              LABEL_TERM_ID numeric,
+              TERM_CODE varchar(40),
+              CODE_DICT numeric,
+              TERM_LEVEL numeric,
+              LABELED_TERM varchar(250),
+              DELETED timestamp,
+              SEQ_NUM numeric NOT NULL,
+              REVISION numeric,
+              ADDED_DATE timestamp,
+              CODE_STATUS numeric,
+              CODE_STATUS_J numeric,
+              LABELED_TERM_J varchar(250),
+              TERM_LLT varchar(250),
+              TERM_HLT varchar(250),
+              TERM_HLGT varchar(250),
+              TERM_SOC varchar(250),
+              TERM_LLT_CODE varchar(50),
+              TERM_HLT_CODE varchar(50),
+              TERM_HLGT_CODE varchar(50),
+              TERM_SOC_CODE varchar(50),
+              TERM_AS_CODED varchar(250),
+              TERM_AS_REPTD varchar(250),
+              TERM_LLT_J varchar(250),
+              TERM_HLT_J varchar(250),
+              TERM_HLGT_J varchar(250),
+              TERM_SOC_J varchar(250),
+              TERM_LLT_CODE_J varchar(50),
+              TERM_AS_CODED_J varchar(250),
+              TERM_AS_REPTD_J varchar(250),
+              SYN_CODE numeric,
+              SYN_CODE_J numeric,
+              NOTES text,
+              NOTES_J text,
+              EG_ID numeric,
+              PRIMARY KEY (ENTERPRISE_ID,SEQ_NUM)
+          ); " }
+
+    { "rm_lm_lab_assessment"
+          "CREATE TABLE rm_lm_lab_assessment (
+              ENTERPRISE_ID numeric NOT NULL,
+              ASSESSMENT_ID numeric NOT NULL,
+              ASSESSMENT varchar(20) NOT NULL,
+              DISPLAY numeric(1),
+              PROTECTED numeric(1),
+              ASSESSMENT_J varchar(20),
+              DELETED timestamp,
+              PRIMARY KEY (ENTERPRISE_ID,ASSESSMENT_ID)
+          ); " }
+
+    { "rm_lm_lab_test_group"
+          "CREATE TABLE rm_lm_lab_test_group (
+              ENTERPRISE_ID numeric NOT NULL,
+              LAB_TEST_GROUP_ID numeric NOT NULL,
+              LAB_TEST_GROUP varchar(100),
+              DISPLAY numeric(1),
+              PROTECTED numeric(1),
+              DELETED timestamp,
+              PRIMARY KEY (ENTERPRISE_ID,LAB_TEST_GROUP_ID)
+          ); " }
+
+    { "rm_lm_lab_test_types"
+          "CREATE TABLE rm_lm_lab_test_types (
+              ENTERPRISE_ID numeric NOT NULL,
+              LAB_TEST_ID numeric NOT NULL,
+              LAB_TEST varchar(250) NOT NULL,
+              NORM_LOW varchar(10),
+              NORM_HIGH varchar(10),
+              TEST_LLT varchar(250),
+              TEST_HLT varchar(250),
+              TEST_HLGT varchar(250),
+              TEST_SOC varchar(250),
+              TEST_LLT_CODE varchar(50),
+              TEST_PT_CODE varchar(50),
+              TEST_HLT_CODE varchar(50),
+              TEST_HLGT_CODE varchar(50),
+              TEST_SOC_CODE varchar(50),
+              DELETED timestamp,
+              CODE_STATUS numeric,
+              CODE_DICT numeric,
+              TEST_CODED varchar(250),
+              TEST_REPTD varchar(250),
+              CODE_STATUS_J numeric,
+              LAB_TEST_J varchar(250),
+              TEST_HLGT_J varchar(250),
+              TEST_HLT_J varchar(250),
+              TEST_LLT_CODE_J varchar(50),
+              TEST_LLT_J varchar(250),
+              TEST_SOC_J varchar(250),
+              TEST_REPTD_J varchar(250),
+              TEST_CODED_J varchar(250),
+              SYN_CODE numeric,
+              SYN_CODE_J numeric,
+              PRIMARY KEY (ENTERPRISE_ID,LAB_TEST_ID)
+          ); " }
+
+    { "rm_lm_lab_test_type_groups"
+          "CREATE TABLE rm_lm_lab_test_type_groups (
+              ENTERPRISE_ID numeric NOT NULL,
+              SEQ_NUM numeric NOT NULL,
+              LAB_TEST_ID numeric NOT NULL,
+              LAB_TEST_GROUP_ID numeric NOT NULL,
+              DELETED timestamp,
+              PRIMARY KEY (ENTERPRISE_ID,SEQ_NUM)
+          ); " }
+
+    { "rm_lm_languages"
+          "CREATE TABLE rm_lm_languages (
+              ENTERPRISE_ID numeric NOT NULL,
+              LANGUAGE_ID numeric NOT NULL,
+              LANGUAGE varchar(40),
+              ENABLED numeric,
+              LANGUAGE_J varchar(40),
+              DELETED timestamp,
+              PRIMARY KEY (ENTERPRISE_ID,LANGUAGE_ID)
+          ); " }
+
+    { "rm_lm_language_data"
+          "CREATE TABLE rm_lm_language_data (
+              ENTERPRISE_ID numeric NOT NULL,
+              ID numeric NOT NULL,
+              FIELD_ID numeric NOT NULL,
+              LANGUAGE_ID numeric NOT NULL,
+              DELETED timestamp,
+              TEXT text,
+              PRIMARY KEY (ENTERPRISE_ID,ID,FIELD_ID,LANGUAGE_ID)
+          ); " }
+
+    { "rm_lm_license"
+          "CREATE TABLE rm_lm_license (
+              ENTERPRISE_ID numeric NOT NULL,
+              LICENSE_ID numeric NOT NULL,
+              TRADE_NAME varchar(70),
+              MANUFACTURER_ID numeric,
+              COUNTRY_ID numeric,
+              LICENSE_TYPE_ID numeric,
+              LIC_NUMBER varchar(40),
+              AWARD_DATE timestamp,
+              WITHDRAW_DATE timestamp,
+              DRL_ID varchar(45),
+              BIOLOGIC numeric,
+              REG_RPT_RULES_ID numeric,
+              USE_AWARD_IBD_DATE numeric,
+              ACTIVE_MOIETY numeric,
+              DATASHEET_ID numeric,
+              GROUP_ID numeric,
+              COMPANY_ITEM_NO varchar(40),
+              PRODUCT_INFO_LOCATION varchar(400),
+              DELETED timestamp,
+              SINGLE_USE numeric,
+              COMBINATION_PRODUCT numeric,
+              OTC_PRODUCT numeric NOT NULL,
+              PMA varchar(20),
+              NOMENCLATURE numeric(5),
+              MEDICAL_DEVICE_INFO_ID numeric,
+              CTPR_GROUP_NAME varchar(50),
+              COMMENTS varchar(1000),
+              MHLW_RE_EXAMINATION_DATE timestamp,
+              CLINICAL_COMPOUND_NUMBER varchar(70),
+              TRADE_NAME_J varchar(70),
+              COMMENTS_J varchar(1000),
+              EXCLUDE_RPT_CANDIDATE numeric(1),
+              PMDA_CLASS_ID_1 numeric,
+              PMDA_CLASS_ID_2 numeric,
+              PMDA_CLASS_ID_3 numeric,
+              PRIMARY KEY (ENTERPRISE_ID,LICENSE_ID)
+          ); " }
+
+    { "rm_lm_license_types"
+          "CREATE TABLE rm_lm_license_types (
+              LICENSE_TYPE_ID numeric NOT NULL,
+              LICENSE_TYPE varchar(30),
+              LICENSE_TYPE_J varchar(30),
+              DELETED timestamp,
+              PRIMARY KEY (LICENSE_TYPE_ID)
+          ); " }
+
+    { "rm_lm_lic_category"
+          "CREATE TABLE rm_lm_lic_category (
+              ENTERPRISE_ID numeric NOT NULL,
+              CATEGORY_ID numeric NOT NULL,
+              CATEGORY_J varchar(200),
+              E2B_CODE numeric,
+              DISPLAY numeric,
+              CATEGORY varchar(200),
+              PROTECTED numeric,
+              DELETED timestamp,
+              PRIMARY KEY (ENTERPRISE_ID,CATEGORY_ID)
+          ); " }
+
+    { "rm_lm_lic_countries"
+          "CREATE TABLE rm_lm_lic_countries (
+              ENTERPRISE_ID numeric NOT NULL,
+              COUNTRY_ID numeric NOT NULL,
+              LICENSE_ID numeric NOT NULL,
+              SEQ_NUM numeric NOT NULL,
+              DELETED timestamp,
+              PRIMARY KEY (ENTERPRISE_ID,COUNTRY_ID,LICENSE_ID,SEQ_NUM)
+          ); " }
+
+    { "rm_lm_lic_products"
+          "CREATE TABLE rm_lm_lic_products (
+              ENTERPRISE_ID numeric NOT NULL,
+              LICENSE_ID numeric NOT NULL,
+              PRODUCT_ID numeric NOT NULL,
+              SEQ_NUM numeric NOT NULL,
+              DISPLAY numeric(4),
+              DELETED timestamp,
+              PRIMARY KEY (ENTERPRISE_ID,LICENSE_ID,PRODUCT_ID,SEQ_NUM)
+          ); " }
+
+    { "rm_lm_lic_report_rules"
+          "CREATE TABLE rm_lm_lic_report_rules (
+              ENTERPRISE_ID numeric NOT NULL,
+              LICENSE_ID numeric NOT NULL,
+              SEQ_NUM numeric NOT NULL,
+              FREQ numeric,
+              START_MONTH numeric,
+              END_MONTH numeric,
+              DELETED timestamp,
+              PRIMARY KEY (ENTERPRISE_ID,LICENSE_ID,SEQ_NUM)
+          ); " }
+
+    { "rm_lm_listedness"
+          "CREATE TABLE rm_lm_listedness (
+              ENTERPRISE_ID numeric NOT NULL,
+              LISTEDNESS_ID numeric NOT NULL,
+              LISTEDNESS varchar(20),
+              PROTECTED numeric,
+              DISPLAY numeric,
+              DELETED timestamp,
+              LABELEDNESS varchar(20),
+              LABELEDNESS_J varchar(20),
+              LISTEDNESS_J varchar(20),
+              PRIMARY KEY (ENTERPRISE_ID,LISTEDNESS_ID)
+          ); " }
+
+    { "rm_lm_literature_type"
+          "CREATE TABLE rm_lm_literature_type (
+              ENTERPRISE_ID numeric NOT NULL,
+              ID numeric NOT NULL,
+              TYPE varchar(40),
+              TYPE_J varchar(40),
+              DISPLAY numeric(1),
+              PROTECTED numeric(1),
+              DELETED timestamp,
+              PRIMARY KEY (ENTERPRISE_ID,ID)
+          ); " }
+
+    { "rm_lm_lit_citations"
+          "CREATE TABLE rm_lm_lit_citations (
+              ENTERPRISE_ID numeric NOT NULL,
+              LITERATURE_ID numeric NOT NULL,
+              JOURNAL varchar(80),
+              AUTHOR varchar(200),
+              TITLE varchar(250),
+              VOL varchar(15),
+              YEAR varchar(4),
+              PGS varchar(30),
+              AUTHOR_J varchar(200),
+              JOURNAL_J varchar(80),
+              TITLE_J varchar(250),
+              DELETED timestamp,
+              PRIMARY KEY (ENTERPRISE_ID,LITERATURE_ID)
+          ); " }
+
+    { "rm_lm_location"
+          "CREATE TABLE rm_lm_location (
+              ENTERPRISE_ID numeric NOT NULL,
+              LOCATION_ID numeric NOT NULL,
+              LOCATION_DESC varchar(20) NOT NULL,
+              PROTECTED numeric,
+              DISPLAY numeric,
+              LOCATION_DESC_J varchar(20),
+              DELETED timestamp,
+              PRIMARY KEY (ENTERPRISE_ID,LOCATION_ID)
+          ); " }
+
+    { "rm_lm_malfunction_type"
+          "CREATE TABLE rm_lm_malfunction_type (
+              ENTERPRISE_ID numeric NOT NULL,
+              MALFUNCTION_TYPE_ID numeric NOT NULL,
+              MALFUNCTION_TYPE varchar(100) NOT NULL,
+              PROTECTED numeric,
+              DISPLAY numeric,
+              ENABLE_DATE numeric,
+              MALFUNCTION_TYPE_J varchar(100),
+              DELETED timestamp,
+              PRIMARY KEY (ENTERPRISE_ID,MALFUNCTION_TYPE_ID)
+          ); " }
+
+    { "rm_lm_manufacturer"
+          "CREATE TABLE rm_lm_manufacturer (
+              ENTERPRISE_ID numeric NOT NULL,
+              MANUFACTURER_ID numeric NOT NULL,
+              MANU_NAME varchar(40) NOT NULL,
+              ADDRESS varchar(120),
+              CITY varchar(30),
+              STATE varchar(10),
+              POSTAL_CODE varchar(10),
+              COUNTRY varchar(50),
+              CONTACT varchar(40),
+              PHONE varchar(20),
+              REG_NO varchar(10),
+              DELETED timestamp,
+              FAX varchar(50),
+              COUNTRY_ID numeric,
+              ADDRESS_J varchar(120),
+              CITY_J varchar(30),
+              CONTACT_J varchar(40),
+              MANU_NAME_J varchar(40),
+              STATE_J varchar(10),
+              PRIMARY KEY (ENTERPRISE_ID,MANUFACTURER_ID)
+          ); " }
+
+    { "rm_lm_medical_device_info"
+          "CREATE TABLE rm_lm_medical_device_info (
+              ENTERPRISE_ID numeric NOT NULL,
+              MEDICAL_DEVICE_INFO_ID numeric NOT NULL,
+              MEDICAL_DEVICE_INFO varchar(200),
+              PROTECTED numeric(1) NOT NULL,
+              DISPLAY numeric(1) NOT NULL,
+              DELETED timestamp,
+              PRIMARY KEY (ENTERPRISE_ID,MEDICAL_DEVICE_INFO_ID)
+          ); " }
+
   ] ))

 (def dummy


Add after-apply-fn to info model order

Add after-apply-fn to info model order

--- src/onyx/information_model.cljc
+++ src/onyx/information_model.cljc
@@ -1433,6 +1433,7 @@
     :lifecycle/before-task-start
     :lifecycle/before-batch
     :lifecycle/after-read-batch
+    :lifecycle/after-apply-fn
     :lifecycle/after-batch
     :lifecycle/after-task-stop
     :lifecycle/after-ack-segment


[clojure] Add pomegranate to global dependencies

--- lein/profiles.clj
+++ lein/profiles.clj
@@ -1,4 +1,5 @@
 {:user {:dependencies [[org.clojure/tools.namespace "0.3.0-alpha4"]
+                       [com.cemerick/pomegranate "1.0.0"]
                        [eftest "0.5.2"]]
         :repl-options {:color false}
         :plugins [[lein-cljfmt "0.4.1" :exclusions [org.clojure/clojure]]


fixed small bug with accessing cursor wrong in gallery.willmount and reduced dual channel to single with if statement on receiving end

--- src/photosure/client/gallery.cljs
+++ src/photosure/client/gallery.cljs
@@ -33,54 +33,39 @@
 (defn prev-btn [app owner]
   (reify
     om/IRenderState
-    (render-state [this {:keys [prev]}]
-      (dom/div #js {:id "prev-btn" :className "btn" :onClick (fn [e] (put! prev (peek (:prev-photos @app-state))))}))))
+    (render-state [this {:keys [slide-chan]}]
+      (dom/div #js {:id "prev-btn" :className "btn" :onClick (fn [e] (put! slide-chan "prev"))}))))

 (defn next-btn [app owner]
   (reify
     om/IRenderState
-    (render-state [this {:keys [next]}]
-      (dom/div #js {:id "next-btn" :className "btn" :onClick (fn [e] (put! next (peek (:next-photos @app-state))))}))))
+    (render-state [this {:keys [slide-chan]}]
+      (dom/div #js {:id "next-btn" :className "btn" :onClick (fn [e] (put! slide-chan "next"))}))))

 (defn gallery [app owner]
   (reify
     om/IInitState
     (init-state [_]
-      {:next-chan (chan)
-       :prev-chan (chan)
+      {:slide-chan (chan)
        :curr (atom #{0 1 2})})

     om/IWillMount
     (will-mount [_]
-      (let [next-photo (om/get-state owner :next-chan)
-            prev-photo (om/get-state owner :prev-chan)]
+      (let [slide-chan (om/get-state owner :slide-chan)]
         (go (loop []
-              (let [photo (<! next-photo)
-                    len (count (:photos app))]
-                (om/update-state! owner :curr (fn [_] (map #(mod (inc %) len) _)))
-                (<! (timeout 500))
-                (recur))))
-        (go (loop []
-              (let [photo (<! prev-photo)
-                    len (count (:photos app))]
-                (om/update-state! owner :curr (fn [_] (map #(mod (dec %) len) _)))
+              (let [len (count (:photos @app))]
+                (if (= (<! slide-chan) "next")
+                  (om/update-state! owner :curr (fn [_] (map #(mod (inc %) len) _)))
+                  (om/update-state! owner :curr (fn [_] (map #(mod (dec %) len) _))))
                 (<! (timeout 500))
                 (recur))))))

-
-;    (let [curr (om/get-state owner :curr)]
- ;     (filter  #(curr (second %)) (map vector (:photos app) (range)))
-  ;    {:key :photo}
-   ;)
-
     om/IRenderState
-    (render-state [this {:keys [prev-chan next-chan curr]}]
+    (render-state [this {:keys [slide-chan curr]}]
       (dom/div #js {:id "photo-gallery-container"}
-               (dom/div #js {:id "left-pane"} (om/build prev-btn app {:init-state {:prev prev-chan}}))
+               (dom/div #js {:id "left-pane"} (om/build prev-btn app {:init-state {:slide-chan slide-chan}}))
                (apply dom/div #js {:id "photo-gallery"}
-                      (om/build-all photo
-                                    (let [curr2 (om/get-state owner :curr)]
-                                      (map first (filter #(@curr (second %)) (map vector (:photos app) (range)))))))
-               (dom/div #js {:id "right-pane"} (om/build next-btn app {:init-state {:next next-chan}}))))))
+                      (om/build-all photo (map first (filter #(@curr (second %)) (map vector (:photos app) (range)))) {:key :photo}))
+               (dom/div #js {:id "right-pane"} (om/build next-btn app {:init-state {:slide-chan slide-chan}}))))))

 (defn run [] (om/root gallery app-state {:target (. js/document (getElementById "gallery"))}))


Don't use condp where case will do

Don't use condp where case will do

--- src/asciinema/player/vt.cljc
+++ src/asciinema/player/vt.cljc
@@ -468,7 +468,7 @@

 (defn execute-ed [vt]
   (let [n (get-param vt 0 0)]
-    (condp = n
+    (case n
       0 (clear-to-end-of-screen vt)
       1 (clear-to-beginning-of-screen vt)
       2 (clear-screen vt)
@@ -477,7 +477,7 @@
 (defn execute-el [{:keys [width height char-attrs] {:keys [x y]} :cursor :as vt}]
   (let [n (get-param vt 0 0)]
     (update-in vt [:lines y] (fn [line]
-                               (condp = n
+                               (case n
                                  0 (clear-line-right line x char-attrs)
                                  1 (clear-line-left line x char-attrs)
                                  2 (empty-line width char-attrs)
@@ -529,7 +529,7 @@

 (defn execute-ctc [{{:keys [x]} :cursor :keys [width] :as vt}]
   (let [n (get-param vt 0 0)]
-    (condp = n
+    (case n
       0 (if (< 0 x width) (update vt :tabs conj x) vt)
       2 (update vt :tabs disj x)
       5 (update vt :tabs empty)
@@ -549,7 +549,7 @@

 (defn execute-tbc [{{:keys [x]} :cursor :as vt}]
   (let [n (get-param vt 0 0)]
-    (condp = n
+    (case n
       0 (update vt :tabs disj x)
       3 (update vt :tabs empty)
       vt)))
@@ -684,7 +684,7 @@
     (do-print vt input)))

 (defn execute [vt input]
-  (if-let [action (condp = input
+  (if-let [action (case input
                     0x08 execute-bs
                     0x09 execute-ht
                     0x0a execute-lf
@@ -722,7 +722,7 @@
          :else vt))

 (defn csi-dispatch [vt input]
-  (if-let [action (condp = input
+  (if-let [action (case input
                     0x40 execute-ich
                     0x41 execute-cuu
                     0x42 execute-cud


added cljs-ajax

added cljs-ajax

--- src/leiningen/new/reagent/project.clj
+++ src/leiningen/new/reagent/project.clj
@@ -8,6 +8,7 @@

   :dependencies [[org.clojure/clojure "1.6.0"]
                  [org.clojure/clojurescript "0.0-2371" :scope "provided"]
+                 [cljs-ajax "0.3.3"]
                  [ring "1.3.1"]
                  [compojure "1.2.0"]
                  [lib-noir "0.9.3"]


removed weasel/piggieback added figwheel nrepl

--- src/leiningen/new/reagent/project.clj
+++ src/leiningen/new/reagent/project.clj
@@ -54,10 +54,8 @@

                    :dependencies [[ring-mock "0.1.5"]
                                   [ring/ring-devel "1.3.2"]
-                                  [weasel "0.6.0"]
                                   [leiningen-core "2.5.1"]
                                   [lein-figwheel "0.3.3"]
-                                  [com.cemerick/piggieback "0.2.1"]
                                   [org.clojure/tools.nrepl "0.2.10"]
                                   [pjstadig/humane-test-output "0.7.0"]{{{dev-dependencies}}}]

@@ -70,6 +68,7 @@

                    :figwheel {:http-server-root "public"
                               :server-port 3449
+                              :nrepl-port 7002
                               :css-dirs ["resources/public/css"]
                               :ring-handler {{project-ns}}.handler/app}


Fixed weighted-mean; was leaving out factoring term.

--- src/polismath/clusters.clj
+++ src/polismath/clusters.clj
@@ -79,13 +79,14 @@
 (defmethod weighted-mean [true false]
   [mat & {:keys [weights]}]
   (if weights
-    (mean
-      (reduce
-        (fn [m [row-i weight]]
-          (multiply-row m row-i weight))
-        mat
-        (with-indices weights)))
-    (mean mat)))
+    (weighted-mean
+      (* (/ (count weights) (pc/sum weights))
+         (reduce
+           (fn [m [row-i weight]]
+             (multiply-row m row-i weight))
+           mat
+           (with-indices weights))))
+    (mean (matrix mat))))

 ; It's a vector...
 (defmethod weighted-mean [false true]
@@ -97,7 +98,7 @@
 ; It's a named matrix...
 (defmethod weighted-mean [false false]
   [nmat & {:keys [weights]}]
-  (weighted-mean (matrix (get-matrix nmat))
+  (weighted-mean (get-matrix nmat)
                  :weights
                  (when weights
                    (reduce


Intercom cleanup: more logging, json refactoring, etc

--- src/polismath/intercom.clj
+++ src/polismath/intercom.clj
@@ -14,13 +14,28 @@
             [polismath.poller :as poll]))

+
+(defn gets
+  "Like get, but gives a coll mapped from all the keys"
+  [m ks & [not-found]]
+  (mapv #(get m % not-found) ks))
+
+
 (def intercom-http-params
   {:accept :json
    :basic-auth ["nb5hla8s" (env/env :intercom-api-key)]
    :content-type :json})
-
-
-(defn get-intercom-users
+
+
+(defn parse-json-resp
+  [resp]
+  (->> resp
+       :body
+       ch/parse-string
+       (into {})))
+
+
+(defn get-icusers
   "Get the list of users from intercom (don't want to create intercom users for users that haven't
   actually signed up"
   [& [page]]
@@ -37,14 +52,10 @@
     (sort-by
       (fn [u] (int (get u "created_at")))
       (if next-page
-        (into users (get-intercom-users next-page))
+        (into users (get-icusers next-page))
         users))))

-(defn gets
-  "Like get, but gives a coll mapped from all the keys"
-  [m ks & [not-found]]
-  (mapv #(get m % not-found) ks))

 (defn update-icuser
@@ -185,7 +196,7 @@
 (defn backup-intercom-users
   "Backup intercom users to json file specified by filename arg."
   [filename]
-  (let [icusers (get-intercom-users)]
+  (let [icusers (get-icusers)]
     (spit filename (ch/generate-string icusers))))

@@ -195,10 +206,12 @@
   []
   (let [db-spec          (poll/heroku-db-spec (env/env :database-url))
         ; Get intercom users and break down by those that have id and those that don't, but have email
-        icusers          (get-intercom-users)
+        _                (println "Fetching data from intercom")
+        icusers          (get-icusers)
         icusers-by-id    (filter #(get % "user_id") icusers)
         icusers-by-email (filter #(not (get % "user_id")) icusers)
         ; Get users by id, then by email for those without id, then put them all together in one collection
+        _                (println "Fetching pg db records")
         dbusers-by-id    (get-db-users-by-uid db-spec
                            (map #(Integer/parseInt (get % "user_id")) icusers-by-id))
         dbusers-by-email (get-db-users-by-email db-spec


Remove spyscope macro

Remove spyscope macro

--- src/refactor_nrepl/analyzer.clj
+++ src/refactor_nrepl/analyzer.clj
@@ -72,10 +72,10 @@
   (try
     (cachable-ast file-content)
     (catch Exception ex
-      (if #spy/d (config/get-opt :debug)
-          (throw ex)
-          (throw (IllegalStateException.
-                  (str (first (parse-ns file-content)) " is in a bad state!")))))))
+      (if (config/get-opt :debug)
+        (throw ex)
+        (throw (IllegalStateException.
+                (str (first (parse-ns file-content)) " is in a bad state!")))))))

 (defn warm-ast-cache []
   (doseq [f (util/find-clojure-sources-in-project)]


Instead of explicitly setting JAVA_HOME, just source /etc/profile.

--- atlasdb-jepsen-tests/src/jepsen/atlasdb.clj
+++ atlasdb-jepsen-tests/src/jepsen/atlasdb.clj
@@ -31,7 +31,7 @@
         (c/upload "resources/atlasdb/timelock.yml" "/atlasdb-timelock-server/var/conf")
         (c/exec :sed :-i (format "s/<HOSTNAME>/%s/" (name node)) "/atlasdb-timelock-server/var/conf/timelock.yml")
         (info node "Starting timelock server")
-        (c/exec :env "JAVA_HOME=/usr/lib/jvm/java-8-oracle/" "/atlasdb-timelock-server/service/bin/init.sh" "start")
+        (c/exec "source" "/etc/profile" "&&" "/atlasdb-timelock-server/service/bin/init.sh" "start")
         (info node "Waiting until timelock cluster is ready")
         (TimestampClient/waitUntilHostReady (name node))
         (TimestampClient/waitUntilTimestampClusterReady '("n1" "n2" "n3" "n4" "n5"))))


Add IContent impl for URL, URI, File and Path.

--- src/uxbox/media/impl.clj
+++ src/uxbox/media/impl.clj
@@ -76,6 +76,22 @@
   (-input-stream [v]
     (ByteArrayInputStream. (codecs/str->bytes v)))

+  Path
+  (-input-stream [v]
+    (io/input-stream v))
+
+  File
+  (-input-stream [v]
+    (io/input-stream v))
+
+  URI
+  (-input-stream [v]
+    (io/input-stream v))
+
+  URL
+  (-input-stream [v]
+    (io/input-stream v))
+
   InputStream
   (-input-stream [v]
     v)


print the value(s) to be shrunk readably when reporting

--- src/simple_check/clojure_test.clj
+++ src/simple_check/clojure_test.clj
@@ -102,7 +102,7 @@
 (defmethod ct/report ::shrinking [m]
   (when *report-shrinking*
     (ct/with-test-out
-      (println "Shrinking" (get-property-name m) "starting with parameters" (::params m)))))
+      (println "Shrinking" (get-property-name m) "starting with parameters" (pr-str (::params m))))))

 (defn report-trial
   [property-fun so-far num-tests]


get the examples using update and the cleanup-rules

Signed-off-by: Chris Granger <5654cde260ae99bc4d30054171b8bcd902efd19a@gmail.com>

--- src/aurora/runtime/core.cljs
+++ src/aurora/runtime/core.cljs
@@ -92,44 +92,47 @@
                              (- {:name :ui/event-listener :id id :entity entity :event event}))
                        ])

+  (def timer-cleanup-rules [(rule {:name :wait :time t :id i}
+                                  (- {:name :wait :time t :id i}))])
+
+  (def io-cleanup-rules [(rule ^get {:name :http-get}
+                               (- get))])
+
+
   (def tick (run-env {:kn #{[3 5] [9 8 7] [:tick]}
-                      :tick-rules [(rule {:name :wait :time t :id i}
-                                         (- {:name :wait :time t :id i}))]
-                      :rules [(rule [:tick]
-                                  (- [:tick])
-                                  (+ {:name :wait :time 1000 :id 1}))
-                              (rule {:name :tick :id 1 :timestamp ts}
-                                  (+ [:tick])
-                                  (+ ["hi!" ts]))]}))
+                      :cleanup-rules (concat ui-cleanup-rules timer-cleanup-rules
+                                             [])
+                      :tick-rules [(rule [:tick]
+                                         (- [:tick])
+                                         (+ {:name :wait :time 1000 :id 1}))]
+                      :rules [(rule {:name :tick :id 1 :timestamp ts}
+                                    (+ [:tick])
+                                    (+ ["hi!" ts]))]}))

   (pause tick)
   (unpause tick)
   @tick

-  (def clock (run-env {:kn #{{:name :tick :id "clock" :timestamp ""}}
-                       :tick-rules [(rule {:name :wait :time t :id i}
-                                          (- {:name :wait :time t :id i}))
-                                    (rule {:name :ui/text :id "time-0" :text text}
-                                          (- {:name :ui/text :id "time-0" :text text}))
-                                    (rule {:name :tick :id "clock" :timestamp ts}
-                                          (+ {:name :wait :time 1000 :id "clock"}))
-                                    ]
+  (def clock (run-env {:kn #{{:name :tick :id "clock"}}
+                       :cleanup-rules (concat ui-cleanup-rules timer-cleanup-rules
+                                              [])
+                       :tick-rules [(rule {:name :tick :id "clock"}
+                                          (+ {:name :wait :time 1000 :id "clock"}))]
                        :rules [[(rule {:name :tick :id "clock" :timestamp ts}
-                                      (+s (hiccup [:p {:id "time"} (str "time is: " (js/Date. ts))])))
-                                ]]
+                                      (+s (hiccup [:p {:id "time"} (str "time is: " (js/Date. ts))])))]]
                        }))

   (pause clock)
   (unpause clock)
-  @clock
+  (-> @clock :kn :old)

   (def incrementer (run-env {:kn #{{:name "counter" :value 0}}
-                             :tick-rules [(rule {:name :ui/text :id "counter-ui-0" :text text}
-                                                (- {:name :ui/text :id "counter-ui-0" :text text}))
-                                          (rule {:name :ui/onClick :id "incr-button"}
+                             :cleanup-rules (concat ui-cleanup-rules timer-cleanup-rules
+                                                    [])
+                             :tick-rules [(rule {:name :ui/onClick :id "incr-button"}
                                                 {:name "counter" :value v}
-                                                (- {:name "counter" :value v})
-                                                (+ {:name "counter" :value (inc v)}))]
+                                                (= z (inc v))
+                                                (> {:name "counter"} {:value z}))]
                              :rules [[(rule {:name "counter" :value v}
                                             (+s (hiccup
                                                  [:p {:id "counter-ui"} v]
@@ -137,20 +140,16 @@

   (pause incrementer)
   (unpause incrementer)
-  (:kn @incrementer)
+  (-> @incrementer :kn :old)

   (def fetcher (run-env {:kn #{{:name "content" :value "Click button to fetch google"}}
-                         :tick-rules [(rule {:name :ui/text :id "content-ui-0" :text text}
-                                             (- {:name :ui/text :id "content-ui-0" :text text}))
-                                       (rule {:name :http-get :url "https://google.com" :id "google"}
-                                             (- {:name :http-get :url "https://google.com" :id "google"}))
-                                       (rule {:name :ui/onClick :id "fetch-button"}
-                                             (+ {:name :http-get :url "https://google.com" :id "google"}))
-                                       (rule {:name :http-response :id "google" :data data}
-                                             {:name "content" :value v}
-                                             (- {:name "content" :value v})
-                                             (+ {:name "content" :value data}))
-                                       ]
+                         :cleanup-rules (concat ui-cleanup-rules timer-cleanup-rules io-cleanup-rules
+                                                [])
+                         :tick-rules [(rule {:name :ui/onClick :id "fetch-button"}
+                                            (+ {:name :http-get :url "https://google.com" :id "google"}))
+                                      (rule {:name :http-response :id "google" :data data}
+                                            (> {:name "content"} {:value data}))
+                                      ]
                          :rules [[(rule {:name "content" :value v}
                                         (+s (hiccup
                                              [:p {:id "content-ui"} v]
@@ -175,11 +174,8 @@
                       :cleanup-rules (concat ui-cleanup-rules
                                              [])
                       :tick-rules [;;on change
-                                   (rule {:name :ui/onChange :id "todo-input"}
-                                         {:name :todo/current-text :value v}
-                                         (- {:name :todo/current-text :value v}))
                                    (rule {:name :ui/onChange :id "todo-input" :value v}
-                                         (+ {:name :todo/current-text :value v}))
+                                         (> {:name :todo/current-text} {:value v}))

                                    ;;submit
                                    (rule {:name :ui/onClick :id "add-todo"}
@@ -191,64 +187,46 @@
                                    (rule {:name :todo/new!}
                                          {:name "counter" :value v}
                                          {:name :todo/current-text :value text}
+                                         (= new-count (inc v))
                                          (- {:name :todo/new!})
-                                         (- {:name "counter" :value v})
-                                         (- {:name :todo/current-text :value text})
-                                         (+ {:name :todo/current-text :value ""})
-                                         (+ {:name "counter" :value (inc v)})
-                                         (+ {:name "todo" :id (inc v) :text text :order (inc v)})
-                                         (+ {:name "todo-editing" :id (inc v) :editing? "false"})
-                                         (+ {:name "todo-done" :id (inc v) :done? "false"})
-                                         )
+                                         (> {:name "counter"} {:value new-count})
+                                         (> {:name :todo/current-text} {:value ""})
+                                         (+ {:name "todo" :id new-count :text text :order new-count})
+                                         (+ {:name "todo-editing" :id new-count :editing? "false"})
+                                         (+ {:name "todo-done" :id new-count :done? "false"}))

                                    ;;todo editing
                                    (rule {:name :ui/onDoubleClick :entity ent}
                                          {:name "todo-editing" :id ent :editing? "false"}
-                                         (- {:name "todo-editing" :id ent :editing? "false"})
-                                         (+ {:name "todo-editing" :id ent :editing? "true"})
-                                         )
+                                         (> {:name "todo-editing" :id ent} {:editing? "true"}))

                                    (rule {:name :ui/onBlur :entity ent}
                                          {:name "todo-editing" :id ent :editing? "true"}
-                                         (- {:name "todo-editing" :id ent :editing? "true"})
-                                         (+ {:name "todo-editing" :id ent :editing? "false"})
-                                         )
-
-
-                                   (rule {:name :ui/onChange :id "todo-editor"}
-                                         {:name :todo/edit-text :value v}
-                                         (- {:name :todo/edit-text :value v}))
+                                         (> {:name "todo-editing" :id ent} {:editing? "false"}))
+
                                    (rule {:name :ui/onChange :id "todo-editor" :value v}
+                                         (> {:name :todo/edit-text} {:value v})
                                          (+ {:name :todo/edit-text :value v}))

                                    (rule {:name :ui/onKeyDown :id "todo-editor" :keyCode 13 :entity ent}
-                                         {:name "todo" :id ent :text text :order order}
                                          {:name :todo/edit-text :value new-value}
-                                         (- {:name "todo" :id ent :text text :order order})
-                                         (+ {:name "todo" :id ent :text new-value :order order})
-                                         (- {:name "todo-editing" :id ent :editing? "true"})
-                                         (+ {:name "todo-editing" :id ent :editing? "false"}))
-
-
-                                   (rule {:name :ui/onChange :event-key "todo-checkbox" :entity ent}
-                                         {:name "todo-done" :id ent :done? done}
-                                         (- {:name "todo-done" :id ent :done? done}))
+                                         (> {:name "todo" :id ent} {:text new-value})
+                                         (> {:name "todo-editing" :id ent} {:editing? "false"}))
+
                                    (rule {:name :ui/onChange :event-key "todo-checkbox" :entity ent :value v}
-                                         (+ {:name "todo-done" :id ent :done? v}))
-
-
-
-
+                                         (> {:name "todo-done" :id ent} {:done? v}))
                                    ]
                       :rules [
                               [(rule {:name "todo" :id id :text text :order order}
-                                     (+s (hiccup
-                                           [:input {:id (str "todo-checkbox" id)
+                                     (= parent-id (str "todo" id))
+                                     (= child-id (str "todo-checkbox" id))
+                                     (+s (hiccup
+                                           [:input {:id child-id
                                                     :event-key "todo-checkbox"
                                                     :entity id
                                                     :events ["onChange"]
                                                     :type "checkbox"}]))
-                                     (+ {:name :ui/child :id (str "todo" id) :child (str "todo-checkbox" id) :pos -1}))
+                                     (+ {:name :ui/child :id parent-id :child child-id :pos -1}))
                                (rule {:name "todo" :id id :text text :order order}
                                      {:name "todo-done" :id id :done? "true"}
                                      (+ {:name :ui/attr :id id :attr "checked" :value "checked"})) ]
@@ -257,12 +235,13 @@
                                      (+s (hiccup
                                           [:li {:id (str "todo" id) :entity id :event-key "todo" :events ["onDoubleClick"]}
                                            text]))
-                                     (+ {:name :ui/child :id "todo-list" :child (str "todo" id) :pos order}))
+                                     (= child-id (str "todo" id))
+                                     (+ {:name :ui/child :id "todo-list" :child child-id :pos order}))
                                (rule {:name "todo" :id id :text text :order order}
                                      {:name "todo-editing" :id id :editing? "true"}
                                      (+s (hiccup
                                           [:input {:id (str "todo-editor") :entity id :event-key "todo-editor" :defaultValue text :events ["onChange" "onKeyDown" "onBlur"]}]))
-                                     (+ {:name :ui/child :id "todo-list" :child (str "todo-editor") :pos order}))
+                                     (+ {:name :ui/child :id "todo-list" :child "todo-editor" :pos order}))
                                ]
                               [(rule {:name :todo/current-text :value v}
                                      (+s (hiccup
@@ -277,6 +256,8 @@
                                      )]
                               ]}))

+  ((query ^todo {:name :todo/edit-text}
+          (+ todo)) (-> @todo :kn))

   (enable-console-print!)
   )


Remove trailing whitespaces

Remove trailing whitespaces

--- src/sormilla/gui.clj
+++ src/sormilla/gui.clj
@@ -35,7 +35,7 @@

     ; setup
     (.setRenderingHint g RenderingHints/KEY_ANTIALIASING RenderingHints/VALUE_ANTIALIAS_ON)
-
+
     ; video feed
     (if image
       (doto g
@@ -47,8 +47,8 @@
         (.fillRect 0 0 w h)
         (.setColor Color/WHITE)
         (.drawString "no image feed" 25 75)))
-
-    ; emergency background
+
+    ; emergency background
     (when (= (:control-state telemetry) :emergency)
       (.setColor g (if (< (mod (System/currentTimeMillis) 400) 200) (Color. 128 16 16) (Color. 192 16 16)))
       (.fillRect g 0 0 w h))
@@ -71,12 +71,12 @@
       (when up     (.fill g (swing/->shape w2 h6 (* 4 w6) (* 2 h6) (* 2 w6) (* 2 h6))))
       (when down   (.fill g (swing/->shape w2 (* 5 h6) (* 4 w6) (* 4 h6) (* 2 w6) (* 4 h6))))
       (when space  (.fill g (swing/->shape 50 (- h 40) (- w 50) (- h 40) (- w 50) (- h 10) 50 (- h 10)))))
-
+
     ; draw grid
     ;(.setColor g hud-lo-color)
     ;(doseq [x (range (/ w 10) w (/ w 10))] (.drawLine g x 0 x h))
     ;(doseq [y (range (/ h 10) h (/ h 10))] (.drawLine g 0 y w y))
-
+
     ; draw zero axis
     (.setColor g hud-color)
     (.drawLine g w2 0 w2 h)
@@ -107,7 +107,7 @@
           (.drawOval g aim-x aim-y aim-w aim-h)
           (.drawLine g -2000 0 2000 0)
           (.drawLine g 0 -2000 0 2000))))
-
+
     ; draw telemetry
     (let [{:keys [pitch roll alt]} telemetry]
       (when (and pitch roll alt)
@@ -164,7 +164,7 @@
     (.createBufferStrategy canvas 2)
     (->Frame frame canvas)))

-;;
+;;
 ;; =================================================================================
 ;; Lifecycle:
 ;; =================================================================================


s/small/(small)/

s/small/(small)/

--- src/babel/espanol/writer.clj
+++ src/babel/espanol/writer.clj
@@ -22,7 +22,7 @@

 (defn expression [& [spec]]
   (let [spec (if spec spec :top)]
-    (engine/expression small spec)))
+    (engine/expression (small) spec)))

 (defn fo [expression]
   (morph/fo expression))


cleanup comments

cleanup comments

--- src/doctopus/storage.clj
+++ src/doctopus/storage.clj
@@ -15,30 +15,15 @@
 ;; Initial backends:
 ;; - Temporary filesystem (provides it's own directory)
 ;; - Permanent filesystem (needs a directory provided)
-;; - Amazon S3
+;; - Amazon S3 (maybe?)
 ;;
 ;; At time of writing, I'm thinking of loading and saving one Tentacle worth of
 ;; documents all at once.
-
-;; P. Sure I'm not using this
-;; Control atom for Backend functions.
-;;(def *backend* (atom "temp-fs"))
-;; (defn load-documents [k] (load-from-storage @*backend* k))
-;; (defn save-documents [k docs] (save-to-storage @*backend* k docs))

 (defprotocol DoctopusBackend
   (set-backend! [this backend])
   (load-from-storage [this k])
   (save-to-storage [this k v]))
-
-;; (defmulti set-backend!
-;;   "Makes sure the Backend gets set only to a valid instance of the Backend class"
-;;   class)
-
-;; (defmethod set-backend! doctopus.files.storage.Backend
-;;   [bkend]
-;;   ())
-;; (defmethod set-backend! :default)

 ;; The actual interface to a backend.
 (defrecord Backend


Make teh available backends and setting of a backend make more sense

--- src/doctopus/storage.clj
+++ src/doctopus/storage.clj
@@ -54,5 +54,5 @@
                   storage-impls/permanent-fs-backend]]
     (into {} (for [b backends] [(:name b) b]))))

-(def default-backend :perm-fs)
-(def backend (Backend. default-backend available-backends))
+(def default-backend :permanent-fs)
+(def backend (Backend. (atom (default-backend available-backends)) available-backends))


use natal-shell 0.1.6

use natal-shell 0.1.6

--- resources/project.clj
+++ resources/project.clj
@@ -7,7 +7,7 @@
                  [org.clojure/clojurescript "1.7.189"]
                  [$REACT_INTERFACE$]
                  [org.omcljs/ambly "0.6.0"]
-                 [natal-shell "0.1.4"]]
+                 [natal-shell "0.1.6"]]
  :plugins [[lein-cljsbuild "1.1.2"]]
  :cljsbuild {:builds {:dev {:source-paths ["src"]
                             :compiler {:output-to "target/out/main.js"


Apply a change suggested by Miikka Koskinen.

--- modules/reitit-core/src/reitit/core.cljc
+++ modules/reitit-core/src/reitit/core.cljc
@@ -66,16 +66,14 @@
            coerce (into [] (keep #(coerce % opts)))))

 (defn path-conflicting-routes [routes]
-  (let [conflicting-routes
-        (into {}
-              (comp (map-indexed (fn [index route]
-                                   [route (into #{}
-                                                (filter #(impl/conflicting-routes? route %))
-                                                (subvec routes (inc index)))]))
-                    (filter (comp seq second)))
-              routes)]
-    (when (seq conflicting-routes)
-      conflicting-routes)))
+  (-> (into {}
+            (comp (map-indexed (fn [index route]
+                                 [route (into #{}
+                                              (filter #(impl/conflicting-routes? route %))
+                                              (subvec routes (inc index)))]))
+                  (filter (comp seq second)))
+            routes)
+      (not-empty)))

 (defn conflicting-paths [conflicts]
   (->> (for [[p pc] conflicts]


Perf: use protocol for argument coercion

--- src/taoensso/carmine/protocol.clj
+++ src/taoensso/carmine/protocol.clj
@@ -7,7 +7,8 @@
   (:require [clojure.string         :as str]
             [taoensso.carmine.utils :as utils]
             [taoensso.nippy.tools   :as nippy-tools])
-  (:import  [java.io DataInputStream BufferedOutputStream]))
+  (:import  [java.io DataInputStream BufferedOutputStream]
+            [clojure.lang Keyword]))

 ;; Hack to allow cleaner separation of namespaces
 (utils/declare-remote taoensso.carmine.connections/get-spec
@@ -40,6 +41,23 @@
 ;; the data requires special reply handling
 (def ^bytes bs-bin     (bytestring "\u0000<")) ; Binary data marker
 (def ^bytes bs-clj     (bytestring "\u0000>")) ; Frozen data marker
+
+(defprotocol IRedisArg (coerce-bs [x] "x -> [<ba> <meta>]"))
+(extend-protocol IRedisArg
+  String  (coerce-bs [x] [(bytestring ^String x) nil])
+  Keyword (coerce-bs [x] [(bytestring ^String (utils/fq-name x)) nil])
+
+  ;;; Simple number types (Redis understands these)
+  Long    (coerce-bs [x] [(bytestring (str x)) nil])
+  Double  (coerce-bs [x] [(bytestring (str x)) nil])
+  Float   (coerce-bs [x] [(bytestring (str x)) nil])
+  Integer (coerce-bs [x] [(bytestring (str x)) nil]))
+
+(extend utils/bytes-class IRedisArg {:coerce-bs (fn [x] [x :mark-bytes])})
+(extend-protocol          IRedisArg
+  WrappedRaw (coerce-bs [x] [(:ba x) :raw])
+  nil        (coerce-bs [x] [(nippy-tools/freeze x) :mark-frozen])
+  Object     (coerce-bs [x] [(nippy-tools/freeze x) :mark-frozen]))

 ;;; Macros to actually send data to stream buffer
 (defmacro ^:private send-crlf [out] `(.write ~out bs-crlf 0 2))
@@ -57,34 +75,22 @@
     * Simple numbers (integers, longs, floats, doubles) become byte strings.
     * Binary (byte array) args go through un-munged.
     * Everything else gets serialized."
-  [^BufferedOutputStream out arg] ; TODO Try as protocol
-  `(let [out# ~out
-         arg# ~arg
-         [type# ^bytes ba# marked-type#]
-         (cond (string? arg#) [:string  (bytestring ^String arg#) nil]
-               (keyword arg#) [:keyword (bytestring ^String (utils/fq-name arg#)) nil]
-               (or (instance? Long    arg#)
-                   (instance? Double  arg#)
-                   (instance? Integer arg#)
-                   (instance? Float   arg#))
-               [:simple-num (bytestring (str arg#)) nil]
-               (utils/bytes? arg#)         [:bytes arg# :bytes]
-               (instance? WrappedRaw arg#) [:raw (:ba arg#) nil]
-               :else [:frozen (nippy-tools/freeze arg#) :frozen])
-
+  [^BufferedOutputStream out arg]
+  `(let [out#          ~out
+         [ba# meta#]   (coerce-bs ~arg)
          ba#           (bytes   ba#)
          payload-size# (alength ba#)
-         data-size#    (if marked-type# (+ payload-size# 2) payload-size#)]
-
-     ;; To support various special goodies like serialization, we reserve
-     ;; strings that begin with a null terminator
-     (when (and (not marked-type#) (zero? (aget ba# 0)) (not= type# :raw))
-       (throw (Exception. (str "Args can't begin with the null terminator: " arg#))))
+         data-size#    (case meta# (:mark-bytes :mark-frozen) (+ payload-size# 2)
+                             payload-size#)]
+
+     ;; Reserve null first-byte for marked reply identification
+     (when (and (nil? meta#) (> payload-size# 0) (zero? (aget ba# 0)))
+       (throw (Exception. (str "Args can't begin with null terminator: " ~arg))))

      (send-$ out#) (.write out# (bytestring (str data-size#))) (send-crlf out#)
-     (case marked-type# :bytes  (send-bin out#)
-                        :frozen (send-clj out#)
-                        nil)
+     (case meta# :mark-bytes  (send-bin out#)
+                 :mark-frozen (send-clj out#)
+                 nil)
      (.write out# ba# 0 payload-size#)
      (send-crlf out#)))


Using base64 for json encoding

Using base64 for json encoding

--- src/celestial/api/audits.clj
+++ src/celestial/api/audits.clj
@@ -17,6 +17,7 @@
     [celestial.persistency.audits :as a]
     [celestial.common :refer (import-logging success wrap-errors conflict bad-req link)]
     [swag.model :refer (defmodel defc)]
+    [ring.util.codec :refer (base64-decode)]
     [swag.core :refer (GET- POST- PUT- DELETE- defroutes- errors)]))

 (defc "/audits" [:type] (keyword v))
@@ -35,7 +36,7 @@

   (GET- "/audits/:name/:args" [^:string name ^:string args] {:nickname "linkFor" :summary "Get audit link"}
     (let [{:keys [query]} (a/get-audit name)]
-       (success {:link (link query (json/read-str args :key-fn keyword))}))))
+       (success {:link (link query (json/read-str (String. (base64-decode args)) :key-fn keyword))}))))

 (defroutes- audits {:path "/audit" :description "Operations on audits"}
   (POST- "/audits" [& ^:audit audit] {:nickname "addAudit" :summary "Add audit"}


rename

rename

--- src/ceres_analytics/tree.clj
+++ src/ceres_analytics/tree.clj
@@ -58,7 +58,7 @@
    (find-full-reactions pub)))

-(defn summary [tree]
+(defn tree-summary [tree]
   (loop [size 0
          max-path 0
          loc tree]


Add home button in chat

Add home button in chat

--- src/chat/cljs/virt/chat.cljs
+++ src/chat/cljs/virt/chat.cljs
@@ -21,7 +21,11 @@
     om/IRenderState
     (render-state [_ {:keys [comm]}]
       (dom/header nil
-        (dom/div nil)
+        (dom/div nil
+          (dom/button #js {:id "home-button"
+                           :className "transparent-button"
+                           :onClick #(set! (.-location js/window) "/")}
+                      "Home"))
         (dom/div nil
           (dom/div #js {:id "header-title"} "Chat"))
         (dom/div nil


Properly set game mode on game over.

Properly set game mode on game over.

--- src/tetris/core.cljs
+++ src/tetris/core.cljs
@@ -267,7 +267,7 @@
   "Stop the game if there is no active tetrimino."
   [{t :tetrimino :as state}]
   (if-not t
-    (assoc state :running? false)
+    (assoc state :mode :game-over)
     state))

 (defn maybe-level-up


Rename All media received? label to Media attachments received

--- src/hatti/ona/forms.cljs
+++ src/hatti/ona/forms.cljs
@@ -40,7 +40,7 @@

 (def media_received_field {:name      _media_all_received
                            :full-name _media_all_received
-                           :label     "All media received?"
+                           :label     "Media attachments received"
                            :type      "text"})

 (def extra-submission-details [last_edited
@@ -327,7 +327,7 @@
                   "uuid"          "UUID"
                   "instanceID"    "Instance ID"
                   "phonenumber"   "Phone number"
-                  "_media_all_received"    "All media received?"
+                  "_media_all_received"    "Media attachments received"
                   name)
                 (case name
                   _submission_time       "Submission time"


return 400 if stackfile compose empty

return 400 if stackfile compose empty

--- src/clj/swarmpit/handler.clj
+++ src/clj/swarmpit/handler.clj
@@ -1,6 +1,7 @@
 (ns swarmpit.handler
   (:require [clojure.walk :refer [keywordize-keys]]
             [clojure.java.io :as io]
+            [clojure.string :as str]
             [swarmpit.version :as version]
             [swarmpit.api :as api]
             [swarmpit.slt :as slt]
@@ -483,14 +484,18 @@
 (defmethod dispatch :stack-create [_]
   (fn [{:keys [params]}]
     (let [payload (keywordize-keys params)]
-      (-> (api/create-stack payload)
-          (resp-ok)))))
+      (if (str/blank? (:compose payload))
+        (resp-error 400 "Compose file empty")
+        (-> (api/create-stack payload)
+            (resp-created))))))

 (defmethod dispatch :stack-update [_]
   (fn [{:keys [route-params params]}]
     (let [payload (keywordize-keys params)]
-      (api/update-stack (:name route-params) payload)
-      (resp-ok))))
+      (if (str/blank? (:compose payload))
+        (resp-error 400 "Compose file empty")
+        (-> (api/update-stack (:name route-params) payload)
+            (resp-ok))))))

 (defmethod dispatch :stack-delete [_]
   (fn [{:keys [route-params]}]


rn cache cacher

rn cache cacher

--- src/cljc/commos/service.cljc
+++ src/cljc/commos/service.cljc
@@ -133,7 +133,7 @@
   (doto (chan)
     (on-close-pipe target on-close)))

-(defn cache
+(defn cacher
   "Transform a service into a cached service.

   The cached service internally builds caches for equal request specs


improve naming of ai algorithm

improve naming of ai algorithm

--- src/cljs/triboard/ai/ai.cljs
+++ src/cljs/triboard/ai/ai.cljs
@@ -12,14 +12,18 @@
 ;; Private
 ;; -----------------------------------------

+(defn- neighbouring-walls
+  [board point]
+  (eduction
+    (filter #(= :wall (board/get-cell-at board % :wall)))
+    (utils/coord-neighbors point)))
+
 (defn- compute-cell-strength
   "Compute a cell strength based on the number of walls it has"
   {:pre [(coord? point)]}
   [board point]
-  (let [neighbors (utils/coord-neighbors point)
-        walls (filter #(= :wall (board/get-cell-at board % :wall)) neighbors)
-        count-wall (count walls)]
-    (+ 1 (* count-wall count-wall 0.25))))
+  (let [wall-nb (count (neighbouring-walls board point))]
+    (+ 1 (* wall-nb wall-nb 0.25))))

 (defn- compute-cells-strength
   "Adds to a given turn the strength of each of its cells"


Add race info.

Add race info.

--- src/cljs/yadnd5ecs/core.cljs
+++ src/cljs/yadnd5ecs/core.cljs
@@ -6,7 +6,29 @@
 (enable-console-print!)

 (def app-state (atom {:name {:player "Bob"
-                             :character "Bruenor"}}))
+                             :character "Bruenor"}
+                      :race {:main :dwarf
+                             :subrace :mountain}}))
+
+(def races
+  {:dwarf {:ability-score-increase [{:constitution 2}]
+           :age "Dwarves mature at the same rate as humans, but
+           they’re considered young until they reach the age of 50. On
+           average, they live about 350 years."
+           :alignment "Most dwarves are lawful, believing firmly in the benefits of a well-ordered society. They tend toward good as well, with a strong sense of fair play and a belief that everyone deserves to share in the benefits of a just order."
+           :size "Dwarves stand between 4 and 5 feet tall and average about 150 pounds. Your size is Medium."
+           :speed "25 feet"
+           :traits ["Darkvision"
+                    "Dwarven Resilience"
+                    "Dwarven Combat Training"
+                    "Tool Proficiency"
+                    "Stonecunning"]
+           :languages ["Common"
+                       "Dwarvish"]
+           :subraces {:hill {:ability-score-increases [{:wisdom 1}]
+                             :traits ["Dwarven Toughness"]}
+                      :mountain {:ability-score-increases [{:strength 2}]
+                                 :traits ["Dwarven Armor Training"]}}}})

 (defcomponent name-view
   [name owner]


Make github build hook call correct build fn

--- backend/src/circle/workers.clj
+++ backend/src/circle/workers.clj
@@ -8,14 +8,7 @@

 (defn process-json [github-json]
   (when (= "CircleCI" (-> github-json :repository :name))
-    (let [build (circle/circle-build)]
-      (dosync
-       (alter build merge
-              {:vcs-url (->ssh (-> github-json :repository :url))
-               :repository (-> github-json :repository)
-               :commits (-> github-json :commits)
-               :vcs-revision (-> github-json :commits last :id)
-               :num-nodes 1}))
+    (let [build (config/build-from-json github-json)]
       (infof "process-json: build: %s" @build)
       (run/run-build build))))


Add default defmethods for default chains

This allows us to signal an error if no potemkin namespace has been required.

--- src/yada/handler.clj
+++ src/yada/handler.clj
@@ -233,7 +233,18 @@
   (map->Handler model))

 (defmulti interceptor-chain "" (fn [options] (:interceptor-chain options)))
+
+(defmethod interceptor-chain :default [options]
+  (if-let [ic (:interceptor-chain options)]
+    (throw (ex-info (format "No default interceptor chain found for %s" ic) options))
+    (throw (ex-info "No default interceptor chain defmethod defined. Have you required yada.yada (or a yada.yada sub-namespace)?" {}))))
+
 (defmulti error-interceptor-chain "" (fn [options] (:error-interceptor-chain options)))
+
+(defmethod error-interceptor-chain :default [options]
+  (if-let [ic (:error-interceptor-chain options)]
+    (throw (ex-info (format "No default error interceptor chain found for %s" ic) options))
+    (throw (ex-info "No default error interceptor chain defmethod defined. Have you required yada.yada (or a yada.yada sub-namespace)?" {}))))

 (defn handler
   "Create a Ring handler"


allow to filter for a test in a namespace when running tests form CLI.

--- ssclj/jar/build.boot
+++ ssclj/jar/build.boot
@@ -121,11 +121,12 @@
                         :auth-public-key  (str (clojure.java.io/resource "auth_pubkey.pem"))}))

 (deftask run-tests-ns
-         [n namespaces NAMESPACES #{sym} "The set of namespace symbols to run tests in."]
+         [n namespaces NAMESPACES #{sym} "The set of namespace symbols to run tests in."
+          f filters    EXPR       #{edn} "The set of expressions to use to filter namespaces. Ex: '(re-find #\"my-test\" (str %))'"]
          (comp
            (dev-env)
            (dev-fixture-env)
-           (test :namespaces namespaces)))
+           (test :namespaces namespaces :filters filters)))

 (deftask run-tests
          "runs all tests and performs full compilation"


[#1979] akvo..postgres.filter/value spec support dates(numbers)

--- backend/specs/akvo/lumen/specs/postgres.clj
+++ backend/specs/akvo/lumen/specs/postgres.clj
@@ -11,15 +11,18 @@

 (s/def ::postgres.filter/aggregation #{"mean" "sum" "min" "max" "count"})

-(s/def ::postgres.filter/value (s/nilable string?))
+(s/def ::postgres.filter/value (s/nilable (s/or :string string?
+                                                :number number?)))
+

 (alias 'db.dsv.column 'akvo.lumen.specs.db.dataset-version.column)

 (s/def ::postgres.filter/column ::db.dsv.column/columnName)
-(s/def ::postgres.filter/filter (s/nilable (s/keys :req-un [::postgres.filter/operation
-                                                            ::postgres.filter/strategy
-                                                            ::postgres.filter/value
-                                                            ::postgres.filter/column])))
+(s/def ::postgres.filter/filter
+  (s/nilable (s/keys :req-un [::postgres.filter/operation
+                              ::postgres.filter/strategy
+                              ::postgres.filter/value
+                              ::postgres.filter/column])))

 (s/def ::postgres.filter/filters (s/coll-of ::postgres.filter/filter :gen-max 3))

@@ -38,5 +41,3 @@
 	 :columns (s/nilable (s/coll-of ::db.dsv/column :distinct true))
 	 :filters (s/nilable ::postgres.filter/filters))
   :ret string?)
-
-


[#472] Add back test-dos-file and remove some unused tests

--- backend/test/akvo/lumen/import/csv_test.clj
+++ backend/test/akvo/lumen/import/csv_test.clj
@@ -26,25 +26,9 @@
     (do-import test-conn {:file-upload-path "/tmp/akvo/dash"} job-id)
     (:dataset_id (dataset-id-by-job-execution-id test-conn {:id job-id}))))

-#_(deftest test-util-functions
-    (testing "SQL generation"
-      (is (= "CREATE TEMP TABLE uuid1 (rnum serial primary key, c1 text, c2 text, c3 text)"
-             (get-create-table-sql "uuid1" 3 "text" true)))
-      (is (= "CREATE TABLE uuid2 (rnum integer primary key, c1 jsonb, c2 jsonb, c3 jsonb)"
-             (get-create-table-sql "uuid2" 3 "jsonb" false)))
-      (is (= "COPY uuid1 (c1, c2, c3) FROM STDIN WITH (FORMAT CSV, ENCODING 'UTF-8')"
-             (get-copy-sql "uuid1" 3 false "UTF-8")))
-      (is (= "COPY uuid2 (c1, c2, c3) FROM STDIN WITH (FORMAT CSV, ENCODING 'ISO-8859-1', HEADER true)"
-             (get-copy-sql "uuid2" 3 true "ISO-8859-1")))
-      (is (= "INSERT INTO uuid1 (rnum, c1, c2) SELECT rnum, to_json(replace(c1, '\\', '\\\\'))::jsonb, to_json(replace(c2, '\\', '\\\\'))::jsonb FROM t_uuid1"
-             (get-insert-sql "t_uuid1" "uuid1" 2)))
-      (is (= 19 (get-num-cols (io/file (io/resource "artist")) \tab "UTF-8")))
-      (is (= 23 (get-num-cols (io/file (io/resource "products")) \, "UTF-8")))
-      (is (= 60 (get-num-cols (io/file (io/resource "rural-population")) \, "UTF-8")))))
-
-#_(deftest ^:functional test-dos-file
-    (testing "Import of DOS-formatted CSV file"
-      (let [dataset-id (import-file "dos.csv" {:dataset-name "DOS data"})
-            dataset (dataset-version-by-dataset-id test-conn {:dataset-id dataset-id
-                                                              :version 1})]
-        (is (= 2 (count (:columns dataset)))))))
+(deftest ^:functional test-dos-file
+  (testing "Import of DOS-formatted CSV file"
+    (let [dataset-id (import-file "dos.csv" {:dataset-name "DOS data"})
+          dataset (dataset-version-by-dataset-id test-conn {:dataset-id dataset-id
+                                                            :version 1})]
+      (is (= 2 (count (:columns dataset)))))))


version, cleanup

version, cleanup

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

                  ;; command line
-                 [com.zensols.tools/actioncli "0.0.10"]]
+                 [com.zensols.tools/actioncli "0.0.11"]]
   :pom-plugins [[org.codehaus.mojo/appassembler-maven-plugin "1.6"
                  {:configuration ([:programs
                                    [:program
@@ -32,6 +32,5 @@
              :appassem {:aot :all}
              :dev
              {:jvm-opts
-              ["-Dlog4j.configurationFile=test-resources/log4j2.xml" "-Xms4g" "-Xmx12g" "-XX:+UseConcMarkSweepGC"]
-              :dependencies [[com.zensols/clj-append "1.0.4"]]}}
+              ["-Dlog4j.configurationFile=test-resources/log4j2.xml" "-Xms4g" "-Xmx12g" "-XX:+UseConcMarkSweepGC"]}}
   :main ${project.main-class})


Handle :cache-result with check for key presence

--- src/xray_charlie_charlie/core.clj
+++ src/xray_charlie_charlie/core.clj
@@ -43,10 +43,8 @@
       (throw (IllegalArgumentException. "Invalid request option. Keywords passed in `options` must be a subset of `valid-request-options`.")))
     (when-let [ardm (:auto-retry-delay-millis options)]
       (.setAutoRetryDelayMillis request ardm))
-    (when (or (true? (:cache-result options))
-              (false? (:cache-result options)))
+    (when (contains? options :cache-result)
       (.setCacheResult request (:cache-result options)))
-    ;; FIXME This does not deal with {:cache-result nil} in a sensible way.  Better check for key presence then true?/false?
     (when-let [dxv (:default-xquery-version options)]
       (.setDefaultXQueryVersion request dxv))
     ;; TODO A macro might be useful to replace the chain of when-lets with use-once variable names


Remove some unecessary tests

Remove some unecessary tests

--- test/grafter_2/rdf/protocols_test.cljs
+++ test/grafter_2/rdf/protocols_test.cljs
@@ -33,10 +33,7 @@
       xsd:boolean (pr/datatype-uri true)
       xsd:boolean (pr/datatype-uri false)

-      xsd:string (pr/datatype-uri "")
-      xsd:string (pr/datatype-uri " ")
-      xsd:string (pr/datatype-uri "a")
-      xsd:string (pr/datatype-uri "a b"))))
+      xsd:string (pr/datatype-uri "an xsd string"))))

 (deftest bnode-equality-test
   (testing "BNode equality"


Add test for pick.

Add test for pick.


also capture :ns for api/cljs-eval

also capture :ns for api/cljs-eval

--- src/main/shadow/cljs/devtools/api.clj
+++ src/main/shadow/cljs/devtools/api.clj
@@ -636,10 +636,14 @@
         {:keys [relay]}
         (get-runtime!)

+        init-ns
+        (:ns opts 'cljs.user)
+
         results-ref
         (atom {:results []
                :out ""
-               :err ""})]
+               :err ""
+               :ns init-ns})]

     ;; FIXME: should this throw if worker isn't running?
     (when worker
@@ -649,7 +653,7 @@
         (StringReader. code)
         (async/chan)
         {:init-state
-         {:ns (:ns opts 'cljs.user)}
+         {:ns init-ns}

          :repl-prompt
          (fn repl-prompt [repl-state])
@@ -659,7 +663,8 @@
            (swap! results-ref assoc :read-ex ex))

          :repl-result
-         (fn repl-result [repl-state result-as-printed-string]
+         (fn repl-result [{:keys [ns] :as repl-state} result-as-printed-string]
+           (swap! results-ref assoc :ns ns)
            (when-not (nil? result-as-printed-string)
              (swap! results-ref update :results conj result-as-printed-string)))


also add api fn to toggle autobuild on/off

--- src/main/shadow/cljs/devtools/api.clj
+++ src/main/shadow/cljs/devtools/api.clj
@@ -114,6 +114,26 @@

     :ok))

+(defn watch-set-autobuild!
+  "starts/stops autobuild for a watch worker by id
+   (watch-set-autobuild :app true|false)"
+  [build-id toggle]
+  (let [worker (get-worker build-id)]
+    (cond
+      (nil? worker)
+      :watch-not-running
+
+      toggle
+      (-> worker
+          (worker/start-autobuild)
+          (worker/sync!))
+
+      :else
+      (-> worker
+          (worker/stop-autobuild)
+          (worker/sync!)))
+    :ok))
+
 (defn watch
   "starts a dev worker process for a given :build-id
   opts defaults to {:autobuild true}"


No more gen-class

No more gen-class

--- jvm-runner/src/clojure/codewars/stdin.clj
+++ jvm-runner/src/clojure/codewars/stdin.clj
@@ -3,11 +3,10 @@
             [codewars.runners :refer [run]]
             [codewars.runners.groovy]
             [codewars.runners.clojure]
-            [codewars.runners.java])
-  (:gen-class))
+            [codewars.runners.java]))

 (defn listen
   "Listens to *in* for a JSON message, parses it and calls the appropriate runner"
-  [& _]
+  []
   (let [input (json/parse-stream *in* true)]
     (run input)))


setting puny connection

setting puny connection

--- src/celestial/redis.clj
+++ src/celestial/redis.clj
@@ -21,11 +21,14 @@
     [taoensso.carmine.locks :only (with-lock)]
     [taoensso.timbre :only (debug trace info error warn)])
   (:require
+    [puny.redis :as r]
     [taoensso.carmine.message-queue :as carmine-mq]
     [taoensso.carmine :as car])
   (:import java.util.Date))

-(defm server-conn [] {:pool {} :spec {:host (get! :redis :host)}})
+(defm server-conn [] {:pool {} :spec (get! :redis)})
+
+(r/server-conn (server-conn))

 (defmacro wcar [& body]
    `(try
@@ -49,5 +52,7 @@
   (carmine-mq/worker (server-conn) name {:handler f :eoq-backoff-ms 200}))

 (defn clear-all []
-  (wcar (car/flushdb)))
+  (info "Clearing redis db" (server-conn))
+  (wcar (car/flushdb))
+  )


returning vm

returning vm

--- src/celestial/tasks.clj
+++ src/celestial/tasks.clj
@@ -38,7 +38,9 @@
     (.start vm)
     (assert (= (.status vm) "running")); might not match all providers
     (post-create-hooks machine)
-    (info "done system setup")))
+    (info "done system setup")
+     vm
+    ))

 (defn puppetize [type spec]
   (info "starting to provision")


Acking daemon was timing out fresh acks

Acking daemon was timing out fresh acks

--- src/onyx/messaging/acking_daemon.clj
+++ src/onyx/messaging/acking_daemon.clj
@@ -16,7 +16,7 @@
         (Thread/sleep interval)
         (let [t (now)
               snapshot @state
-              dead (map first (remove (fn [[k v]] (>= (- t (:timestamp v)) timeout)) snapshot))]
+              dead (map first (filter (fn [[k v]] (>= (- t (:timestamp v)) timeout)) snapshot))]
           (doseq [k dead]
             (swap! state dissoc k)))
         (catch InterruptedException e


Log as :info level when Aeron starts up in a healthy state (#897)

It should not be producing warnings if it starts up normally

--- src/onyx/peer/peer_group_manager.clj
+++ src/onyx/peer/peer_group_manager.clj
@@ -274,7 +274,7 @@

           (and (not (:up? state)) (media-driver-healthy? media-driver-dir))
           (do
-           (warn "Aeron media driver is healthy, thus starting all peers.")
+           (info "Aeron media driver is healthy, thus starting all peers.")
            (action state-shutdown [:start-peer-group]))

           :else


combineTiles.clj: fixed some issues

combineTiles.clj: fixed some issues

--- clojure/org/gavrog/clojure/combineTiles.clj
+++ clojure/org/gavrog/clojure/combineTiles.clj
@@ -54,23 +54,20 @@
             :when (pos? n)
             [form s] (forms part)
             :when (= (sig D) (s 1))
-            face (orbit-elements symbol (range (dec d)) D)]
+            :let [face (orbit-elements symbol (range (dec d)) D)]]
         [(glue-faces (append symbol form) d D (inc sz))
          (into sig (for [D (range 1 (inc (size form)))] [(+ sz D) (s D)]))
          (difference (union free-elements
-                            (range (inc sz) (inc (+ sz (size form)))))
+                            (set (range (inc sz) (inc (+ sz (size form))))))
                      face
-                     (range (inc sz) (+ sz (count face))))
+                     (set (range (inc sz) (inc (+ sz (count face))))))
          (assoc free-components part (dec (free-components part)))]))))
-
-(defn- children [d forms state]
-  (concat (augmentations d forms state) (extensions d forms state)))

 (defn combine-tiles [ds]
   (let [d (inc (dim ds))
         face-idcs (range (dim ds))
         counts (components-with-multiplicities ds)
-        parts (keys counts)
+        parts (sort-by (comp vec invariant) (keys counts))
         forms (into {} (for [sub parts]
                          [sub (for [f (inequivalent-forms sub)]
                                 [f (signatures f face-idcs)])]))]
@@ -85,4 +82,6 @@
                              (every? (comp zero? second) free-components)
                              (canonical? symbol))
                     symbol))
-       :children (partial children d forms)})))
+       :children (fn [state]
+                   (concat (augmentations d forms state)
+                           (extensions d forms state)))})))


Adds equal?

Adds equal?

--- src/the_little_clojurian/chapter5.clj
+++ src/the_little_clojurian/chapter5.clj
@@ -134,7 +134,21 @@
   (is (= (eqlist? '(strawberry ice cream) '(strawberry cream ice)) false))
   (is (= (eqlist? '((coffee) (cup)) '((coffee) (cup))) true)))

+(with-test
+  (def equal?
+    (fn [s1 s2]
+      (cond (and (atom? s1) (atom? s2)) (equan? s1 s2)
+            (or (atom? s1) (atom? s2)) false
+            :else (eqlist? s1 s2))))
+
+  (is (= (equal? 'a 'a) true))
+  (is (= (equal? 'a 'b) false))
+  (is (= (equal? 'a '(a)) false))
+  (is (= (equal? '(a) 'a) false))
+  (is (= (equal? '(a) '(a)) true))
+  (is (= (equal? '(a) '(b)) false)))

+;; exercises
 (with-test
   (def replace*
     (fn [new old l]


Clean up detached signature tests

Clean up detached signature tests

--- test/caesium/crypto/sign_test.clj
+++ test/caesium/crypto/sign_test.clj
@@ -28,10 +28,8 @@
 (def signature
   (u/unhexify "6bd710a368c1249923fc7a1610747403040f0cc30815a00f9ff548a896bbda0b4eb2ca19ebcf917f0f34200a9edbad3901b64ab09cc5ef7b9bcc3c40c0ff7509"))

-(deftest sign-test
-  (testing "Can sign a message"
-    (is (u/array-eq signature
-                    (s/sign secret message)))))
+(deftest detached-sign-test
+  (is (u/array-eq signature (s/sign secret message))))

 (deftest verify-test
   (testing "Verifying correct signature works"


Starting to build TokenSource implementation that will be used to manage the tokens in a JDBC connected database

--- src/zuul/session/sql_token_source.clj
+++ src/zuul/session/sql_token_source.clj
@@ -1,18 +1,23 @@
 (ns zuul.session.sql-token-source
   (:require [zuul.session.token-proto :as token-proto]
+            [zuul.db.core :as db]
             [com.stuartsierra.component :as component])
   (:gen-class))

-(defrecord SqlTokenSource [conninfo ]
+(defrecord SqlTokenSource []
   component/Lifecycle

   (start [component ])
   (stop [component ])

   token-proto/PersistentTokenSource
+
   (get-token [component username])
   (get-user [component token])
   (remove-token [component token])
   (add-token [component token ttl-sec])
   (create-token [component ])
   (update-token-ttl [component token ttl-sec]))
+
+(defn new sql-token-source []
+  (map->SqlTokenSource {}))


Use balance-transfer network

Use balance-transfer network

--- test/clojure_fabric/core_test.clj
+++ test/clojure_fabric/core_test.clj
@@ -20,7 +20,7 @@
 ;;;
 (defn domain-name->cert-map
   [domain-name]
-  (let [cert-pem (-> "fixture/e2e-2Orgs/channel/crypto-config/peerOrganizations/%s/ca/ca.%s-cert.pem"
+  (let [cert-pem (-> "fixture/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/%s/ca/ca.%s-cert.pem"
                      (format domain-name domain-name)
                      (io/resource)
                      (io/as-file))]
@@ -39,8 +39,7 @@
    :v11 {:name "example_cc_go" :path "github.com/example_cc" :version "11"}})

 (defonce channel-defs
-  {:foo {:name "foo"}
-   :bar {:name "bar"}})
+  {:mychannel {:name "mychannel"}})

 #_
 (defonce org-defs
@@ -95,7 +94,7 @@
   [{:keys [org-type domain-name]} {user-name :name}]
   (let [org-type-name (name org-type)
         user-name+domain-name (format "%s@%s" (clojure.string/capitalize user-name) domain-name)
-        dir (format "fixture/e2e-2Orgs/channel/crypto-config/%sOrganizations/%s/users/%s/msp/"
+        dir (format "fixture/balance-transfer/artifacts/channel/crypto-config/%sOrganizations/%s/users/%s/msp/"
                     org-type-name domain-name user-name+domain-name)]
     {:private-key (-> (str dir "keystore/")
                       (io/resource)
@@ -118,7 +117,7 @@
                                :peer "peers"
                                :orderer "orderers")
                              node-end-name+domain-name)
-        dir (format "fixture/e2e-2Orgs/channel/crypto-config/%sOrganizations/%s/%s/msp/"
+        dir (format "fixture/balance-transfer/artifacts/channel/crypto-config/%sOrganizations/%s/%s/msp/"
                     org-type-name domain-name end-node-dir)]
     {:pem (-> (format "%ssigncerts/%s-cert.pem" dir node-end-name+domain-name)
               (io/resource)
@@ -180,8 +179,7 @@
   []
   (doseq [[_ v] @users]
     (let [org-def (get org-defs (:msp-id v))]
-     (new-channel! v {:name "foo" :orderers (populate-orderers org-def) :peers (populate-peers org-def)})
-     (new-channel! v {:name "bar" :orderers (populate-orderers org-def) :peers (populate-peers org-def)}))))
+     (new-channel! v {:name "mychannel" :orderers (populate-orderers org-def) :peers (populate-peers org-def)}))))

 (defn clear-users!
   []
@@ -206,28 +204,19 @@

 (expect clojure_fabric.core.Channel
         (let [user (get-user "Org1MSP" "user1")]
-          (get-channel user "foo")))
-(expect clojure_fabric.core.Channel
-        (let [user (get-user "Org1MSP" "user1")]
-          (get-channel user "bar")))
+          (get-channel user "mychannel")))
 (expect clojure_fabric.core.Channel
         (let [user (get-user "Org2MSP" "user1")]
-          (get-channel user "foo")))
-(expect clojure_fabric.core.Channel
-        (let [user (get-user "Org2MSP" "user1")]
-          (get-channel user "bar")))
+          (get-channel user "mychannel")))

 (expect (let [user (get-user "Org1MSP" "user1")
-              bar-chan (get-channel user "bar")]
-          (get-peers bar-chan)))
+              mychannel (get-channel user "mychannel")]
+          (get-peers mychannel)))

 (expect (let [user (get-user "Org1MSP" "user1")
-              bar-chan (get-channel user "bar")]
-          (query-installed-chaincodes user (get-random-peer bar-chan))))
-#_
-(expect 11
-        (let [user (get-user "Org2MSP" "user1")]
-          (oquery-installed-chaincodes user "bar")))
+              mychannel (get-channel user "mychannel")]
+          (query-installed-chaincodes user (get-random-peer mychannel))))
+
 ;;; 3. Add orderers and peers

 ;;; 4. Add event-hubs


fix prices tests

fix prices tests

--- test/clj_money/models/prices_test.clj
+++ test/clj_money/models/prices_test.clj
@@ -8,7 +8,8 @@
             [clj-money.factories.user-factory]
             [clj-money.serialization :as serialization]
             [clj-money.validation :as validation]
-            [clj-money.test-helpers :refer [reset-db]]
+            [clj-money.test-helpers :refer [reset-db
+                                            find-commodity]]
             [clj-money.models.commodities :as commodities]
             [clj-money.models.prices :as prices]))

@@ -21,7 +22,7 @@
    :entities [{:name "Personal"}
               {:name "Business"}]
    :commodities [{:name "Apple"
-                  :symbol "APPL"
+                  :symbol "AAPL"
                   :type :stock
                   :exchange :nasdaq}]})

@@ -114,7 +115,7 @@
                                             :trade-date [:between
                                                          (t/local-date 2017 1 1)
                                                          (t/local-date 2017 12 31)]})]
-    (is (integer? (:id price-1))
+    (is (:id price-1)
         "The first result contains an ID value")
     (is (nil? (:id price-2))
         "The duplicate value does not receive an ID")
@@ -135,7 +136,7 @@
                                             :trade-date [:between
                                                          (t/local-date 2017 3 1)
                                                          (t/local-date 2017 3 31)]})]
-    (is (integer? (:id price))
+    (is (:id price)
         "The result contains an ID value")
     (is (empty? (validation/error-messages price))
         "The result does not contain any validation errors")
@@ -185,7 +186,7 @@
                                             :trade-date [:between
                                                          (t/local-date 2017 3 1)
                                                          (t/local-date 2017 3 31)]})]
-    (is (integer? (:id price))
+    (is (:id price)
         "The result contains an ID value")
     (is (empty? (validation/error-messages price))
         "The result does not contain any validation errors")
@@ -193,7 +194,7 @@
         "The price can be retrieved after create")))

 (def ^:private existing-price-context
-  (assoc price-context :prices [{:commodity-id "APPL"
+  (assoc price-context :prices [{:commodity-id "AAPL"
                                  :trade-date (t/local-date 2017 3 2)
                                  :price 12.34M}]))

@@ -217,18 +218,18 @@
         "The result is not retrieved after delete")))

 (def ^:private multi-price-context
-  (assoc price-context :prices [{:commodity-id "APPL"
+  (assoc price-context :prices [{:commodity-id "AAPL"
                                  :trade-date (t/local-date 2017 2 27)
                                  :price 12.34M}
-                                {:commodity-id "APPL"
+                                {:commodity-id "AAPL"
                                  :trade-date (t/local-date 2017 3 2)
                                  :price 12.20}
-                                {:commodity-id "APPL"
+                                {:commodity-id "AAPL"
                                  :trade-date (t/local-date 2017 3 1)
                                  :price 12.00}]))

 (deftest get-the-most-recent-price-for-a-commodity
   (let [context (serialization/realize storage-spec multi-price-context)
-        commodity (-> context :commodities first)
+        commodity (find-commodity context "AAPL")
         price (prices/most-recent storage-spec (:id commodity))]
     (is (= 12.20M (:price price)) "The must recent price is returned")))


Test: read-currently-building-jobs (negative)

--- test/emender_jenkins/results_test.clj
+++ test/emender_jenkins/results_test.clj
@@ -455,6 +455,13 @@
             (is (= (read-currently-building-jobs configuration)
                     read-currently-building-jobs-expected-result)))))

+(deftest test-read-currently-building-jobs-negative
+    "Check the function emender-jenkins.results/read-building-jobs-from-jenkins."
+    (with-redefs [jenkins-api/get-command (fn [all-jobs-url] nil)]
+        (let [configuration {:jenkins {:currently-building-view "Building"
+                                       :jenkins-url "http://10.20.30.40:8080/"}}]
+            (is (nil? (read-currently-building-jobs configuration))))))
+
 (deftest test-read-queue-info-from-jenkins-negative
     "Check the function emender-jenkins.results/read-queue-info-from-jenkins."
     (testing "the function emender-jenkins.results/read-queue-info-from-jenkins."


Add a single test

Add a single test

--- test/hydrofoil/expectations/utils.clj
+++ test/hydrofoil/expectations/utils.clj
@@ -7,3 +7,6 @@
 ;;; --------- Utils Tests ------------
 (print "--------- Running Utils Tests ------------")
 (print "--------- Finished Utils Tests ------------")
+
+(expect 2
+        (+ 1 1))


Added docker env vars as first choice for ES port and host

--- src/search_clojure_archives/core.clj
+++ src/search_clojure_archives/core.clj
@@ -57,8 +57,12 @@
   and ES_PORT.  Defaults are localhost and 9200 respectively."
   [& [port]]
   (let [webserver-port (Integer. (or port (System/getenv "PORT") "8080"))
-        elasticsearch-host (or (System/getenv "ES_HOST") "localhost")
-        elasticsearch-port (Integer. (or (System/getenv "ES_PORT") "9200"))
+        elasticsearch-host (or (System/getenv "ELASTICSEARCH_PORT_9200_TCP_ADDR")
+                               (System/getenv "ES_HOST")
+                               "localhost")
+        elasticsearch-port (Integer. (or (System/getenv "ELASTICSEARCH_PORT_9200_TCP_PORT")
+                                         (System/getenv "ES_PORT")
+                                         "9200"))
         elasticsearch-url (format "http://%s:%d/" elasticsearch-host elasticsearch-port)]
     (try
       (reset! es-url elasticsearch-url)


fix hot reload

fix hot reload

--- src/site/daveconservatoire/site.cljs
+++ src/site/daveconservatoire/site.cljs
@@ -17,5 +17,4 @@

 (pushy/start! history)

-(if-not (:mounted? @app)
-  (reset! app (uc/mount @app ui/Root "app-container")))
+(reset! app (uc/mount @app ui/Root "app-container"))


Ensure nil result from load

Ensure nil result from load

--- src/oxcart.clj
+++ src/oxcart.clj
@@ -161,4 +161,5 @@
                (when debug?
                  (println *ns* "|" form))
                (eval form options)
-               (recur))))))))
+               (recur)))))
+       nil)))


Add busy spin idle strategy (probably shouldn't ever be used)

--- src/onyx/messaging/aeron.clj
+++ src/onyx/messaging/aeron.clj
@@ -15,7 +15,7 @@
            [uk.co.real_logic.agrona.concurrent UnsafeBuffer]
            [uk.co.real_logic.agrona CloseHelper]
            [uk.co.real_logic.agrona ErrorHandler]
-           [uk.co.real_logic.agrona.concurrent IdleStrategy BackoffIdleStrategy]
+           [uk.co.real_logic.agrona.concurrent IdleStrategy BackoffIdleStrategy BusySpinIdleStrategy]
            [java.util.function Consumer]
            [java.util.concurrent TimeUnit]))

@@ -87,6 +87,7 @@

 (defn backoff-strategy [strategy]
   (case strategy
+    :busy-spin (BusySpinIdleStrategy.)
     :low-restart-latency (BackoffIdleStrategy. 1
                                                10
                                                (.toNanos TimeUnit/MICROSECONDS 1)


rename resolve-note to note and NOTE to NOTES

--- src/overtone/music/pitch.clj
+++ src/overtone/music/pitch.clj
@@ -10,6 +10,10 @@
 ;; Notes in a typical scale are related by small, prime number ratios. Of all
 ;; possible 7 note scales, the major scale has the highest number of consonant
 ;; intervals.
+
+(defn play
+  [s notes]
+  (doall (map #(s %) notes)))

 (defmacro defratio [rname ratio]
   `(defn ~rname [freq#] (* freq# ~ratio)))
@@ -81,7 +85,7 @@
   [octave note]
   (+ (+ (* octave 12) note) 12))

-(def NOTE {:C  0  :c  0
+(def NOTES {:C  0  :c  0
            :C# 1  :c# 1  :Db 1  :db 1
            :D  2  :d  2
            :D# 3  :d# 3  :Eb 3  :eb 3
@@ -95,47 +99,47 @@
            :B  11 :b  11})

-(defn resolve-note
+(defn note
   "Resolves note to MIDI number format. Resolves upper and lower-case keywords
   and strings in MIDI note format. If given an integer or nil, returns them
   unmodified. All other inputs will raise an exception.

   Usage examples:

-  (resolve-note \"C4\")  ;=> 60
-  (resolve-note \"C#4\") ;=> 61
-  (resolve-note \"eb2\") ;=> 39
-  (resolve-note :F#7)    ;=> 102
-  (resolve-note :db5)    ;=> 73
-  (resolve-note 60)      ;=> 60
-  (resolve-note nil)     ;=> nil"
-
-  [note]
+  (note \"C4\")  ;=> 60
+  (note \"C#4\") ;=> 61
+  (note \"eb2\") ;=> 39
+  (note :F#7)    ;=> 102
+  (note :db5)    ;=> 73
+  (note 60)      ;=> 60
+  (note nil)     ;=> nil"
+
+  [n]
   (cond
-   (nil? note) nil
-   (integer? note) (if (>= note 0)
-                    note
+   (nil? n) nil
+   (integer? n) (if (>= n 0)
+                    n
                     (throw (IllegalArgumentException.
-                            (str "Unable to resolve note: " note ". Value is out of range. Lowest value is 0"))))
-   (keyword? note) (resolve-note (name note))
-   (string? note) (let [midi-note-re #"\A([a-gA-G][#b]?)([-0-9]+\Z)"
-                        separated (re-find midi-note-re note)
+                            (str "Unable to resolve note: " n ". Value is out of range. Lowest value is 0"))))
+   (keyword? n) (note (name n))
+   (string? n) (let [midi-note-re #"\A([a-gA-G][#b]?)([-0-9]+\Z)"
+                        separated (re-find midi-note-re n)
                         _ (when (nil? separated)
                             (throw (IllegalArgumentException.
-                                    (str "Unable to resolve note: " note ". Does not appear to be in MIDI format i.e. C#4"))))
+                                    (str "Unable to resolve note: " n ". Does not appear to be in MIDI format i.e. C#4"))))

                         [_ pitch-class octave] separated
                         octave (Integer. octave)
                         _ (when (< octave -1)
                             (throw (IllegalArgumentException.
-                                    (str "Unable to resolve note: " note ". Octave is out of range. Lowest octave value is -1"))))
-                        interval (NOTE (keyword pitch-class))
+                                    (str "Unable to resolve note: " n ". Octave is out of range. Lowest octave value is -1"))))
+                        interval (NOTES (keyword pitch-class))

                         _ (when (nil? interval)
                             (throw (IllegalArgumentException.
-                                    (str "Unable to resolve note: " note ". Not a valid pitch class such as C or Db"))))]
+                                    (str "Unable to resolve note: " n ". Not a valid pitch class such as C or Db"))))]
                     (+ interval 12 (* 12 octave)))
-   :else (throw (IllegalArgumentException. (str "Unable to resolve note: " note ". Wasn't a recognised format (either an integer, keyword, string or nil)")))))
+   :else (throw (IllegalArgumentException. (str "Unable to resolve note: " n ". Wasn't a recognised format (either an integer, keyword, string or nil)")))))

 ;; * Each note in a scale acts as either a generator or a collector of other notes,
 ;; depending on their relations in time within a sequence.
@@ -209,7 +213,7 @@
   representing the key and an optional scale name (defaulting to :major):
   (scale-field :g)
   (scale-field :g :minor)"
-  (let [base (NOTE skey)
+  (let [base (NOTES skey)
         sname (or sname :major)
         intervals (SCALE sname)]
     (reverse (next
@@ -270,7 +274,7 @@
 (defn degrees->pitches
   "Convert intervals to pitches in MIDI number format.  Supports nested collections."
   [degrees scale root]
-  (let [root (resolve-note root)]
+  (let [root (note root)]
     (when (nil? root)
       (throw (IllegalArgumentException. (str "root resolved to a nil value. degrees->pitches requires a non-nil root."))))
     (map (fn [degree]
@@ -296,7 +300,7 @@

   ([root scale-name] (scale root scale-name (range 1 8)))
   ([root scale-name degrees]
-     (let [root (resolve-note root)
+     (let [root (note root)
            degrees (resolve-degrees degrees)]
        (cons root (map #(+ root (nth-interval scale-name %)) degrees)))))

@@ -380,7 +384,7 @@
   (chord :Bb4 :dim)   ; b flat diminished -> #{70 73 76}
   "
   ([root chord-name]
-     (let [root (resolve-note root)
+     (let [root (note root)
            chord (resolve-chord chord-name)]
        (set (map #(+ % root) chord)))))


참조 링크 추가

참조 링크 추가


Start work on body functions

Start work on body functions

--- src/play_clj/g2d_physics.clj
+++ src/play_clj/g2d_physics.clj
@@ -1,7 +1,9 @@
 (ns play-clj.g2d-physics
   (:require [play-clj.math :as m]
             [play-clj.utils :as u])
-  (:import [com.badlogic.gdx.physics.box2d ContactListener World]))
+  (:import [com.badlogic.gdx.physics.box2d Body BodyDef ContactListener World]))
+
+; world

 (defn box-2d*
   ([]
@@ -21,6 +23,37 @@
   [screen k & options]
   `(u/call! ^World (:world ~screen) ~k ~@options))

+; body
+
+(defmacro body-type
+  [k]
+  `~(symbol (str u/main-package ".physics.box2d.BodyDef$BodyType/"
+                 (u/key->pascal k) "Body")))
+
+(defn body-def*
+  [type-symbol]
+  (let [bdef (BodyDef.)]
+    (set! (. bdef type) type-symbol)
+    bdef))
+
+(defmacro body-def
+  [type-name]
+  `(body-def* (body-type ~type-name)))
+
+(defn body*
+  [screen entity bdef]
+  (assoc entity :body (box-2d! screen :create-body bdef)))
+
+(defmacro body
+  [screen entity type-name & options]
+  `(let [entity# (body* ~screen ~entity (body-def ~type-name))]
+     (u/calls! ^Body (:body entity#) ~@options)
+     entity#))
+
+(defmacro body!
+  [entity k & options]
+  `(u/call! ^Body (:body ~entity) ~k ~@options))
+
 (defn contact-listener
   [{:keys [on-begin-contact on-end-contact on-post-solve on-pre-solve]} execute-fn!]
   (reify ContactListener


add syntax-quote

add syntax-quote

--- src/useful.clj
+++ src/useful.clj
@@ -1,4 +1,5 @@
-(ns useful)
+(ns useful
+  (:use [clojure.walk :only [walk]]))

 (defmacro assoc-if
   "Create mapping from keys to values in map if test returns true."
@@ -308,6 +309,16 @@
   (let [plural (or plural (str singular "s"))]
     (str num " " (if (= 1 num) singular plural))))

+(defn syntax-quote ;; from leiningen.core/unquote-project
+  "Syntax quote the given form, wrapping all seqs and symbols in quote."
+  [form]
+  (walk (fn [form]
+          (cond (and (seq? form) (= `unquote (first form))) (second form)
+                (or (seq? form) (symbol? form)) (list 'quote form)
+                :else (syntax-quote form)))
+        identity
+        form))
+
 (defn construct
   "Construct a new instance of class using reflection."
   [class & args]


Consistent capitalization

Consistent capitalization

--- test/cljs/fatlip/core_test.cljs
+++ test/cljs/fatlip/core_test.cljs
@@ -91,7 +91,7 @@
     (is (= (f/set-positions layer) (assoc layer :positions {seg-1 0, node-1 2, node-2 3
                                                             seg-2 4, node-3 7, seg-3 8
                                                             node-4 9}))
-        "positions are set correctly")))
+        "Positions are set correctly")))

 (deftest set-qs-non-qs
@@ -100,4 +100,4 @@
         graph {:q #{q}}
         layer (f/Layer. 0 0 [q not-q])]
     (is (= (f/set-qs-non-qs graph layer) (assoc layer :qs #{q} :non-qs #{not-q}))
-        "q nodes and non-q nodes are distinguised correctly")))
+        "Q nodes and non-q nodes are distinguised correctly")))


Use new lookup fns on params passed to invoked fns.

--- src/isla/interpreter.clj
+++ src/isla/interpreter.clj
@@ -38,8 +38,8 @@
       (throw (Exception. (str "I do not know what a " type-identifier " is."))))))

 (defmethod interpret :invocation [node env]
-  (let [function (lookup (interpret (extract node [:c 0]) env) env)
-        param (interpret (extract node [:c 1]) env)]
+  (let [function (lookup-ref (interpret (extract node [:c 0]) env) env)
+        param (:val (interpret (extract node [:c 1]) env))]
     (let [return-val (function env param)] ;; call fn
       (nreturn (:ctx env) return-val))))


Might as well rename the input file

Might as well rename the input file

When we "copy the input as the output" as we do
for XML formatted 5.1 files, let's also rename
the file so it comes out nicely.