create test piece function for verifying appearance

--- src/t3tr0s/core.cljs
+++ src/t3tr0s/core.cljs
@@ -90,6 +90,13 @@
   []
   (swap! state assoc :board empty-board))

+(defn test-piece
+  "Clear the board, write a piece at 5,9, and print it."
+  [piece-key]
+  (clear-board)
+  (write-piece-to-board (piece-key pieces) 5 9)
+  (print-board))
+
 (defn init []
   (connect-repl)
   (print-board))


removed unneeded namespace prefix

removed unneeded namespace prefix

--- src/telldus/core.clj
+++ src/telldus/core.clj
@@ -77,9 +77,9 @@
 (defn get-device-info
   "Get info on the device specified by the id"
   [conn id]
-  (let [name (telldus/telldus conn "tdGetName" id)
-        model (telldus/telldus conn "tdGetModel" id)
-        last-command (telldus/telldus conn "tdLastSentCommand" id 255)]
+  (let [name (telldus conn "tdGetName" id)
+        model (telldus conn "tdGetModel" id)
+        last-command (telldus conn "tdLastSentCommand" id 255)]
     {:id id :name name :model model :command last-command}
     ))

@@ -88,7 +88,7 @@
   "List of all configurated devices"
   [conn]
   (let [arr (atom []) ]
-    (doseq [i (range (Integer. (telldus/get-num-devices conn)))]
-      (let [id (Integer. (telldus/telldus conn "tdGetDeviceId" i))]
+    (doseq [i (range (Integer. (get-num-devices conn)))]
+      (let [id (Integer. (telldus conn "tdGetDeviceId" i))]
         (swap! arr conj (get-device-info conn id))))
     @arr))


with-debug is gone now

with-debug is gone now

--- test/er_cassandra/model/alia/upsert_test.clj
+++ test/er_cassandra/model/alia/upsert_test.clj
@@ -244,27 +244,26 @@
 ;; since this is undesirable for secondary tables, insert should be
 ;; used instead - this test ensures that insert is used
 (deftest dont-delete-secondaries-with-nil-non-key-cols-test
-  (als/with-debug
-    (let [m (create-secondary-entity-for-nil-non-key-cols)
-          [id other-id] [(uuid/v1) (uuid/v1)]
-          r {:id id :other_id other-id :nick "foo"}
-
-          i1 (upsert-instance m r)
-          f1 (fetch-record :secondary_with_nil_non_key_cols_test [:id] [id])
-          fi1 (fetch-record :secondary_with_nil_non_key_cols_test_by_other_id
-                            [:other_id :id] [other-id id])
-
-          nnr (assoc r :nick nil)
-          i2 (upsert-instance m nnr)
-
-          f2 (fetch-record :secondary_with_nil_non_key_cols_test [:id] [id])
-          fi2 (fetch-record :secondary_with_nil_non_key_cols_test_by_other_id
-                            [:other_id :id] [other-id id])]
-      (is (= r f1))
-      (is (= r fi1))
-
-      (is (= nnr f2))
-      (is (= nnr fi2)))))
+  (let [m (create-secondary-entity-for-nil-non-key-cols)
+        [id other-id] [(uuid/v1) (uuid/v1)]
+        r {:id id :other_id other-id :nick "foo"}
+
+        i1 (upsert-instance m r)
+        f1 (fetch-record :secondary_with_nil_non_key_cols_test [:id] [id])
+        fi1 (fetch-record :secondary_with_nil_non_key_cols_test_by_other_id
+                          [:other_id :id] [other-id id])
+
+        nnr (assoc r :nick nil)
+        i2 (upsert-instance m nnr)
+
+        f2 (fetch-record :secondary_with_nil_non_key_cols_test [:id] [id])
+        fi2 (fetch-record :secondary_with_nil_non_key_cols_test_by_other_id
+                          [:other_id :id] [other-id id])]
+    (is (= r f1))
+    (is (= r fi1))
+
+    (is (= nnr f2))
+    (is (= nnr fi2))))

 (deftest upsert-secondaries-test
   (let [m (create-secondary-entity)


Removed XML dependencies from core.

Removed XML dependencies from core.

--- src/vertigo/core.clj
+++ src/vertigo/core.clj
@@ -1,7 +1,5 @@
 (ns vertigo.core
-  (:require [clojure.xml :as xml]
-            [clojure.zip :as zip]
-            [vertigo.views :as views])
+  (:require [vertigo.views :as views])
   (:use     [clojure.contrib.zip-filter.xml]
             [compojure.core]
             [ring.adapter.jetty]


RDC - Basic cell rotation tests.

RDC - Basic cell rotation tests.

--- test/icfp2015/cell_test.clj
+++ test/icfp2015/cell_test.clj
@@ -40,3 +40,19 @@
           expected-cell [-2 -2]]
       (is (= expected-cell actual-cell)))))

+(deftest rotate-cell-test
+  (testing "cell rotates clockwise around origin"
+    (let [pivot [0 0]
+          cell [1 1]
+          rotate-fn (rotate-cell pivot :clockwise)
+          actual-cell (rotate-fn cell)
+          expected-cell [-1 1]]
+      (is (= expected-cell actual-cell))))
+
+  (testing "cell rotates counterclockwise around origin"
+    (let [pivot [0 0]
+          cell [1 1]
+          rotate-fn (rotate-cell pivot :counterclockwise)
+          actual-cell (rotate-fn cell)
+          expected-cell [2 0]]
+      (is (= expected-cell actual-cell)))))


Update test for changes to protobuf.

Update test for changes to protobuf.

If you assoc nil into a protobuf with a nullable field, the key should
be present but with a value of nil.

--- test/protobuf/core_test.clj
+++ test/protobuf/core_test.clj
@@ -182,20 +182,21 @@
              (get-raw p :time))))))

 (deftest test-nullable
-  (let [p (protobuf Bar :int 1 :long 330000000000 :flt 1.23 :dbl 9.87654321 :str "foo")]
+  (let [p (protobuf Bar :int 1 :long 330000000000 :flt 1.23 :dbl 9.87654321 :str "foo")
+        keyset #{:int :long :flt :dbl :str}]
     (is (= 1            (get p :int)))
     (is (= 330000000000 (get p :long)))
     (is (= (float 1.23) (get p :flt)))
     (is (= 9.87654321   (get p :dbl)))
     (is (= "foo"        (get p :str)))
-    (is (= [:int :long :flt :dbl :str] (keys p)))
+    (is (= keyset (set (keys p))))
     (let [p (append p {:int nil :long nil :flt nil :dbl nil :str nil})]
       (is (= nil (get p :int)))
       (is (= nil (get p :long)))
       (is (= nil (get p :flt)))
       (is (= nil (get p :dbl)))
       (is (= nil (get p :str)))
-      (is (= nil (keys p))))
+      (is (= keyset (set (keys p)))))
     (testing "nullable successions"
       (let [p (protobuf Bar :label "foo")]
         (is (= "foo" (get p :label)))


CMR-6731: Fixed bulk indexing of deleted granules that are also expired.

--- indexer-app/src/cmr/indexer/services/index_service.clj
+++ indexer-app/src/cmr/indexer/services/index_service.clj
@@ -52,14 +52,16 @@
     (get-in query-field->elastic-doc-values-fields [concept-type field] field)
     field))

-(defn filter-expired-concepts
+(defn- filter-expired-concepts
   "Remove concepts that have an expired delete-time."
   [batch]
   (filter (fn [concept]
             (let [delete-time-str (get-in concept [:extra-fields :delete-time])
                   delete-time (when delete-time-str
                                 (date/parse-datetime delete-time-str))]
-              (or (nil? delete-time)
+              ;; do not filter out the concept if it is deleted (see CMR-6731)
+              (or (:deleted concept)
+                  (nil? delete-time)
                   (t/after? delete-time (tk/now)))))
           batch))


cleanup of tests

cleanup of tests

--- test/sparkling/api_test.clj
+++ test/sparkling/api_test.clj
@@ -114,7 +114,7 @@
                                                                             #sparkling/tuple ["key2" 3]
                                                                             #sparkling/tuple ["key2" 4]
                                                                             #sparkling/tuple ["key3" 5]])
-                                                    (s/reduce-by-key (fn [x y] (+ x y)))
+                                                    (s/reduce-by-key +)
                                                     s/collect
                                                     untuple-all
                                                     vec)
@@ -402,7 +402,7 @@
                       "aggregates elements of RDD using a function that takes two arguments and returns one,
                       return type is a value"
                       (is (= (-> (s/parallelize c [1 2 3 4 5])
-                                 (s/reduce (fn [x y] (+ x y)))) 15)))
+                                 (s/reduce +)) 15)))

                     (testing
                       "count-by-key returns a hashmap of (K, int) pairs with the count of each key; only available on RDDs of type (K, V)"
@@ -461,7 +461,7 @@
                     (testing
                       "fold returns aggregate each partition, and then the results for all the partitions, using a given associative function and a neutral 'zero value'"
                       (is (= (-> (s/parallelize c [1 2 3 4 5])
-                                 (s/fold 0 (fn [x y] (+ x y)))) 15)))
+                                 (s/fold 0 +)) 15)))

                     (testing
                       "first returns the first element of an RDD"


render GOL cells to the canvas

render GOL cells to the canvas

--- spinning/src/app/core.cljs
+++ spinning/src/app/core.cljs
@@ -40,6 +40,8 @@
 (defn app-div [] (poly/get-element :app))

 (defn app-canvas [] (poly/get-element :app-canvas))
+
+(defn app-context [] (-> (app-canvas) (.getContext "2d")))

 ;; -----------------------------------------------------------------------------
@@ -295,7 +297,17 @@
 (defn update! []
   (when (get-in @state [:app :update-gol?]) (update-gol!)))

-(defn render! [timestamp state]
+(defn render-cells! [context state]
+  (let [cell-size 5]
+    (set! (.-fillStyle context) "#efefef")
+    (.fillRect context 0 0 1000 1000)
+    (doseq [[[x y] cell] (get-in state [:gol :cells])
+            :let [color (:color cell)
+                  rgb (str "rgb(" (:r color) "," (:g color) "," (:b color) ")")]]
+      (set! (.-fillStyle context) rgb)
+      (.fillRect context (* cell-size x) (* cell-size y) cell-size cell-size))))
+
+(defn render-text! [timestamp state]
   (let [app-name (get-in state [:app :name])
         env-time (get-in state [:env :time])
         f-count (str "F: " (get-in state [:env :frame-count]))
@@ -312,6 +324,10 @@
         display [f-count fps generation population prime-count max-prime]]
     (set! (.-innerText (app-div)) (string/join ", " display))))

+(defn render! [timestamp state]
+  (render-text! timestamp state)
+  (render-cells! (app-context) state))
+
 (defn animate! [timestamp]
   (update!)
   (render! timestamp @state)
@@ -361,8 +377,8 @@
   (console/info "on-init")
   (let [canvas (dom/createElement "canvas")]
     (goog.object/set canvas "id" "app-canvas")
-    (goog.object/set canvas "width" 800)
-    (goog.object/set canvas "height" 800)
+    (goog.object/set canvas "width" 1000)
+    (goog.object/set canvas "height" 1000)
     (dom/appendChild (poly/get-body) canvas))
   (setup)
   ;(inspect @state)


Ãcomment cache is fourteen days

Ãcomment cache is fourteen days

--- src/ontrail/newcomment.clj
+++ src/ontrail/newcomment.clj
@@ -34,12 +34,11 @@

 (defn newcount-reset [user id]
   (dosync
-   (let [user-cache-ref (@users-cache user)]
-     (if (not= user-cache-ref nil)
-       (let [user-cache @user-cache-ref
-             id-key (keyword id)]
-         (if (contains? user-cache id-key)
-           (alter user-cache-ref dissoc id-key)))))))
+   (if-let [user-cache-ref (@users-cache user)]
+      (let [user-cache @user-cache-ref
+            id-key (keyword id)]
+        (if (contains? user-cache id-key)
+          (alter user-cache-ref dissoc id-key))))))

 (defn cache-mod[f t val] (assoc (merge-with f val {:c 1}) :ts t))

@@ -86,7 +85,7 @@
     (filter #(time/after? (get-last-visit %) active-time) (mc/distinct ONUSER "username"))))

 (defn dissoc-comment-keys [comment-cache]
-  (let [max-age (* 1000 60 60 24 21)
+  (let [max-age (* 1000 60 60 24 14)
         now-millis (System/currentTimeMillis)]
     (filter identity
       (map #(if (> (- now-millis ((comp :ts comment-cache) %)) max-age) % nil)


Fix one missing exception passback in log reader

--- src/onyx/log/zookeeper.clj
+++ src/onyx/log/zookeeper.clj
@@ -273,7 +273,8 @@
          (trace e)
          (>!! ch e))
        (catch Throwable e
-         (fatal e))))
+         (fatal e)
+         (>!! ch e))))
     (<!! rets)))

 (defmethod extensions/write-chunk [ZooKeeper :catalog]


thru rm_lm_intermediary

thru rm_lm_intermediary

--- src/pg_demo/table_defs.clj
+++ src/pg_demo/table_defs.clj
@@ -3946,6 +3946,367 @@
               PRIMARY KEY (ENTERPRISE_ID,DURATION_ID)
           ); " }

+    { "rm_lm_dev_phase"
+          "CREATE TABLE rm_lm_dev_phase (
+              ENTERPRISE_ID numeric NOT NULL,
+              DEV_PHASE_ID numeric NOT NULL,
+              DEV_PHASE varchar(50),
+              DEV_PHASE_J varchar(50),
+              E2B_CODE numeric(2),
+              DISPLAY numeric(1),
+              PROTECTED numeric(1),
+              DELETED timestamp,
+              PRIMARY KEY (ENTERPRISE_ID,DEV_PHASE_ID)
+          ); " }
+
+    { "rm_lm_dose_frequency"
+          "CREATE TABLE rm_lm_dose_frequency (
+              ENTERPRISE_ID numeric NOT NULL,
+              FREQ_ID numeric NOT NULL,
+              FREQ varchar(15) NOT NULL,
+              PROTECTED numeric,
+              FREQ_VALUE numeric,
+              DISPLAY numeric,
+              DELETED timestamp,
+              SEPARATE_DOSAGE_NUMB_E2B numeric,
+              INTERVAL_DOSAGE_UNIT_E2B numeric,
+              INTERVAL_DOSAGE_DEF_E2B numeric,
+              FREQ_J varchar(15),
+              PRIMARY KEY (ENTERPRISE_ID,FREQ_ID)
+          ); " }
+
+    { "rm_lm_dose_units"
+          "CREATE TABLE rm_lm_dose_units (
+              ENTERPRISE_ID numeric NOT NULL,
+              UNIT_ID numeric NOT NULL,
+              UNIT varchar(25) NOT NULL,
+              PROTECTED numeric,
+              DISPLAY numeric,
+              DOSE_UNIT_VALUE numeric,
+              E2B_CODE varchar(6),
+              LAB_TEST_UNIT numeric,
+              DOSAGE_UNIT numeric NOT NULL,
+              UNIT_J varchar(25),
+              DELETED timestamp,
+              PRIMARY KEY (ENTERPRISE_ID,UNIT_ID)
+          ); " }
+
+    { "rm_lm_dsr_per_subrpt"
+          "CREATE TABLE rm_lm_dsr_per_subrpt (
+              ENTERPRISE_ID numeric NOT NULL,
+              PER_RPT_TYPE numeric NOT NULL,
+              SUB_RPT_ID numeric NOT NULL,
+              PER_BOOKMARK_NAME varchar(255),
+              TOC_NAME varchar(1000),
+              BOOKMARK_NAME varchar(255),
+              OVERLAY_REQD numeric,
+              DISPLAY_SORT_ID numeric,
+              INCL_FLAG numeric,
+              PAGE_START_PIXEL numeric,
+              PAGE_END_PIXEL numeric,
+              SPLIT_BOOKMARK_CHILD numeric,
+              PRIMARY KEY (ENTERPRISE_ID,PER_RPT_TYPE,SUB_RPT_ID)
+          ); " }
+
+    { "rm_lm_emperor"
+          "CREATE TABLE rm_lm_emperor (
+              ENTERPRISE_ID numeric NOT NULL,
+              EMPEROR_ID numeric NOT NULL,
+              EMPEROR_NAME varchar(10),
+              EMPEROR_NAME_J varchar(10),
+              OFFICE_DATE_J timestamp,
+              DISPLAY numeric(1),
+              PROTECTED numeric(1),
+              DATE_ENTRY_ABBREV varchar(1),
+              DELETED timestamp,
+              PRIMARY KEY (ENTERPRISE_ID,EMPEROR_ID)
+          ); " }
+
+    { "rm_lm_ethnicity"
+          "CREATE TABLE rm_lm_ethnicity (
+              ENTERPRISE_ID numeric NOT NULL,
+              ETHNICITY_ID numeric NOT NULL,
+              ETHNICITY varchar(40) NOT NULL,
+              PROTECTED numeric,
+              DISPLAY numeric,
+              ETHNICITY_J varchar(40),
+              DELETED timestamp,
+              PRIMARY KEY (ENTERPRISE_ID,ETHNICITY_ID)
+          ); " }
+
+    { "rm_lm_evaluator_type"
+          "CREATE TABLE rm_lm_evaluator_type (
+              ENTERPRISE_ID numeric NOT NULL,
+              EVALUATOR_TYPE_ID numeric NOT NULL,
+              EVALUATOR_TYPE varchar(25) NOT NULL,
+              SITE_ID numeric,
+              EVALUATOR_TYPE_J varchar(25),
+              DELETED timestamp,
+              PRIMARY KEY (ENTERPRISE_ID,EVALUATOR_TYPE_ID)
+          ); " }
+
+    { "rm_lm_event_group"
+          "CREATE TABLE rm_lm_event_group (
+              ENTERPRISE_ID numeric NOT NULL,
+              EG_ID numeric NOT NULL,
+              EVENT_GROUP_NAME varchar(250) NOT NULL,
+              EVENT_GROUP_NAME_J varchar(250),
+              DISPLAY numeric,
+              DELETED timestamp,
+              PRIMARY KEY (ENTERPRISE_ID,EG_ID)
+          ); " }
+
+    { "rm_lm_event_group_child"
+          "CREATE TABLE rm_lm_event_group_child (
+              ENTERPRISE_ID numeric NOT NULL,
+              ID numeric NOT NULL,
+              EG_ID numeric NOT NULL,
+              CHILD_ID numeric NOT NULL,
+              DELETED timestamp,
+              PRIMARY KEY (ENTERPRISE_ID,ID)
+          ); " }
+
+    { "rm_lm_event_group_smq"
+          "CREATE TABLE rm_lm_event_group_smq (
+              ENTERPRISE_ID numeric NOT NULL,
+              SMQ_ID numeric NOT NULL,
+              EG_ID numeric NOT NULL,
+              SMQ_CODE numeric,
+              DELETED timestamp,
+              CODE_DICT numeric,
+              PRIMARY KEY (ENTERPRISE_ID,SMQ_ID)
+          ); " }
+
+    { "rm_lm_event_group_terms"
+          "CREATE TABLE rm_lm_event_group_terms (
+              ENTERPRISE_ID numeric NOT NULL,
+              TERM_ID numeric NOT NULL,
+              EG_ID numeric NOT NULL,
+              PT varchar(250),
+              PT_J varchar(250),
+              PT_CODE varchar(50),
+              SOC varchar(250),
+              SOC_J varchar(250),
+              SOC_CODE varchar(50),
+              HLT varchar(250),
+              HLT_J varchar(250),
+              HLT_CODE varchar(50),
+              HLGT varchar(250),
+              HLGT_J varchar(250),
+              HLGT_CODE varchar(50),
+              CODE_DICT numeric,
+              TERM_TYPE numeric,
+              LLT varchar(250),
+              LLT_J varchar(250),
+              LLT_CODE varchar(50),
+              LLT_CODE_J varchar(50),
+              CODE_STATUS numeric NOT NULL,
+              CODE_STATUS_J numeric,
+              DELETED timestamp,
+              PRIMARY KEY (ENTERPRISE_ID,TERM_ID)
+          ); " }
+
+    { "rm_lm_evt_consequence"
+          "CREATE TABLE rm_lm_evt_consequence (
+              ENTERPRISE_ID numeric NOT NULL,
+              EVT_CONSEQUENCE_ID numeric NOT NULL,
+              PROTECTED numeric NOT NULL,
+              CONSEQUENCE varchar(100),
+              TERM varchar(250),
+              CONSEQUENCE_J varchar(100),
+              TERM_J varchar(250),
+              DELETED timestamp,
+              PRIMARY KEY (ENTERPRISE_ID,EVT_CONSEQUENCE_ID)
+          ); " }
+
+    { "rm_lm_evt_frequency"
+          "CREATE TABLE rm_lm_evt_frequency (
+              ENTERPRISE_ID numeric NOT NULL,
+              EVT_FREQ_ID numeric NOT NULL,
+              EVT_FREQ varchar(15) NOT NULL,
+              PROTECTED numeric,
+              DISPLAY numeric,
+              EVT_FREQ_J varchar(15),
+              DELETED timestamp,
+              PRIMARY KEY (ENTERPRISE_ID,EVT_FREQ_ID)
+          ); " }
+
+    { "rm_lm_evt_intensity"
+          "CREATE TABLE rm_lm_evt_intensity (
+              ENTERPRISE_ID numeric NOT NULL,
+              EVT_INTENSITY_ID numeric NOT NULL,
+              EVT_INTENSITY varchar(30) NOT NULL,
+              PROTECTED numeric,
+              DISPLAY numeric,
+              EVT_INTENSITY_J varchar(30),
+              DELETED timestamp,
+              PRIMARY KEY (ENTERPRISE_ID,EVT_INTENSITY_ID)
+          ); " }
+
+    { "rm_lm_evt_nature"
+          "CREATE TABLE rm_lm_evt_nature (
+              ENTERPRISE_ID numeric NOT NULL,
+              EVT_NATURE_ID numeric NOT NULL,
+              EVT_NATURE varchar(40) NOT NULL,
+              PROTECTED numeric,
+              DISPLAY numeric,
+              EVT_NATURE_J varchar(40),
+              DELETED timestamp,
+              PRIMARY KEY (ENTERPRISE_ID,EVT_NATURE_ID)
+          ); " }
+
+    { "rm_lm_evt_outcome"
+          "CREATE TABLE rm_lm_evt_outcome (
+              ENTERPRISE_ID numeric NOT NULL,
+              EVT_OUTCOME_ID numeric NOT NULL,
+              EVT_OUTCOME varchar(50) NOT NULL,
+              PROTECTED numeric,
+              DISPLAY numeric,
+              E2B_CODE numeric,
+              EVT_OUTCOME_J varchar(50),
+              DELETED timestamp,
+              PRIMARY KEY (ENTERPRISE_ID,EVT_OUTCOME_ID)
+          ); " }
+
+    { "rm_lm_failure_code"
+          "CREATE TABLE rm_lm_failure_code (
+              ENTERPRISE_ID numeric NOT NULL,
+              FAILURE_CD varchar(6) NOT NULL,
+              FAILURE_DESC varchar(100),
+              FAILURE_CD_TYPE varchar(1),
+              FAILURE_CD_GROUP varchar(16),
+              DELETED timestamp,
+              FAILURE_DEF text,
+              PRIMARY KEY (ENTERPRISE_ID,FAILURE_CD)
+          ); " }
+
+    { "rm_lm_fetal_outcome"
+          "CREATE TABLE rm_lm_fetal_outcome (
+              ENTERPRISE_ID numeric NOT NULL,
+              FETAL_OUTCOME_ID numeric NOT NULL,
+              FETAL_OUTCOME varchar(35) NOT NULL,
+              DISPLAY numeric,
+              PROTECTED numeric,
+              FETAL_OUTCOME_J varchar(35),
+              DELETED timestamp,
+              PRIMARY KEY (ENTERPRISE_ID,FETAL_OUTCOME_ID)
+          ); " }
+
+    { "rm_lm_file_template_actions"
+          "CREATE TABLE rm_lm_file_template_actions (
+              ACTION_ID numeric NOT NULL,
+              ACTION varchar(250) NOT NULL,
+              MODULE_TYPE numeric NOT NULL,
+              ACTION_TYPE numeric NOT NULL,
+              PRIMARY KEY (ACTION_ID)
+          ); " }
+
+    { "rm_lm_formulation"
+          "CREATE TABLE rm_lm_formulation (
+              ENTERPRISE_ID numeric NOT NULL,
+              FORMULATION_ID numeric NOT NULL,
+              FORMULATION varchar(100) NOT NULL,
+              PROTECTED numeric,
+              DISPLAY numeric,
+              FORMULATION_J varchar(100),
+              FORMULATION_SYMBOL_J varchar(5),
+              DELETED timestamp,
+              PRIMARY KEY (ENTERPRISE_ID,FORMULATION_ID)
+          ); " }
+
+    { "rm_lm_gender"
+          "CREATE TABLE rm_lm_gender (
+              ENTERPRISE_ID numeric NOT NULL,
+              GENDER_ID numeric NOT NULL,
+              GENDER varchar(10) NOT NULL,
+              PROTECTED numeric,
+              DISPLAY numeric,
+              E2B_CODE numeric,
+              GENDER_J varchar(10),
+              DELETED timestamp,
+              PRIMARY KEY (ENTERPRISE_ID,GENDER_ID)
+          ); " }
+
+    { "rm_lm_hcp"
+          "CREATE TABLE rm_lm_hcp (
+              ENTERPRISE_ID numeric NOT NULL,
+              HCP_ID numeric NOT NULL,
+              HCP varchar(30) NOT NULL,
+              PROTECTED numeric,
+              DISPLAY numeric,
+              HCP_J varchar(30),
+              DELETED timestamp,
+              PRIMARY KEY (ENTERPRISE_ID,HCP_ID)
+          ); " }
+
+    { "rm_lm_holiday_calendar"
+          "CREATE TABLE rm_lm_holiday_calendar (
+              ENTERPRISE_ID numeric NOT NULL,
+              HOLIDAY_ID numeric NOT NULL,
+              HOLIDAY_NAME varchar(100),
+              HOLIDAY_DATE timestamp,
+              DESCRIPTION varchar(200),
+              PROTECTED numeric(1),
+              DELETED timestamp,
+              PRIMARY KEY (ENTERPRISE_ID,HOLIDAY_ID)
+          ); " }
+
+    { "rm_lm_holiday_cal_countries"
+          "CREATE TABLE rm_lm_holiday_cal_countries (
+              ENTERPRISE_ID numeric NOT NULL,
+              SEQ_NUM numeric NOT NULL,
+              HOLIDAY_ID numeric NOT NULL,
+              COUNTRY_ID numeric NOT NULL,
+              DELETED timestamp,
+              PRIMARY KEY (ENTERPRISE_ID,SEQ_NUM)
+          ); " }
+
+    { "rm_lm_improper_use"
+          "CREATE TABLE rm_lm_improper_use (
+              ENTERPRISE_ID numeric NOT NULL,
+              IMPROPER_USE_ID numeric NOT NULL,
+              IMPROPER_USE varchar(30) NOT NULL,
+              PROTECTED numeric,
+              DISPLAY numeric,
+              IMPROPER_USE_J varchar(30),
+              DELETED timestamp,
+              PRIMARY KEY (ENTERPRISE_ID,IMPROPER_USE_ID)
+          ); " }
+
+    { "rm_lm_ingredients"
+          "CREATE TABLE rm_lm_ingredients (
+              ENTERPRISE_ID numeric NOT NULL,
+              INGREDIENT_ID numeric NOT NULL,
+              INGREDIENT varchar(120) NOT NULL,
+              INGREDIENT_J varchar(120),
+              DELETED timestamp,
+              PRIMARY KEY (ENTERPRISE_ID,INGREDIENT_ID)
+          ); " }
+
+    { "rm_lm_institution"
+          "CREATE TABLE rm_lm_institution (
+              ENTERPRISE_ID numeric NOT NULL,
+              INST_ID numeric NOT NULL,
+              INSTITUTION varchar(60),
+              INSTITUTION_ID varchar(15),
+              INSTITUTION_J varchar(60),
+              PROTECTED numeric(1),
+              DISPLAY numeric(1),
+              DELETED timestamp,
+              PRIMARY KEY (ENTERPRISE_ID,INST_ID)
+          ); " }
+
+    { "rm_lm_intermediary"
+          "CREATE TABLE rm_lm_intermediary (
+              ENTERPRISE_ID numeric NOT NULL,
+              INTERMEDIARY_ID numeric NOT NULL,
+              INTERMEDIARY varchar(30) NOT NULL,
+              PROTECTED numeric,
+              INTERMEDIARY_J varchar(30),
+              DELETED timestamp,
+              PRIMARY KEY (ENTERPRISE_ID,INTERMEDIARY_ID)
+          ); " }
+
   ] ))

 (def dummy


Update to ClojureScript 1.9.521

Update to ClojureScript 1.9.521

--- ClojureScript/replete/project.clj
+++ ClojureScript/replete/project.clj
@@ -7,7 +7,7 @@
                  [tailrecursion/cljson "1.0.7"]
                  [malabarba/lazy-map "1.1"]
                  [org.clojure/clojure "1.8.0"]
-                 [org.clojure/clojurescript "1.9.494"]
+                 [org.clojure/clojurescript "1.9.521"]
                  [org.clojure/test.check "0.9.1-SNAPSHOT"]] ; Clone and build test.check master (ref'd in script/build)
   :clean-targets ["out" "target"]
   :plugins [[lein-cljsbuild "1.1.5"]]


Updated comments for public resource api.

--- common-app-lib/src/cmr/common_app/api_docs.clj
+++ common-app-lib/src/cmr/common_app/api_docs.clj
@@ -93,6 +93,7 @@
                             {:status 200
                              :body (slurp (io/resource welcome-page-location))}))
     (context "/site" []
+      ;; Static HTML resources, typically API documentation which needs endpoint URLs replaced
       (GET ["/:page", :page #".*\.html$"] {headers :headers, {page :page} :params}
         (when-let [resource (site-resource page)]
           (let [cmr-root (str public-protocol "://" (headers "host") relative-root-url)]
@@ -100,8 +101,7 @@
              :body (-> resource
                        slurp
                        (str/replace "%CMR-ENDPOINT%" cmr-root))})))
-      ;; Static HTML resources, typically API documentation which
-      ;; needs endpoint URLs replaced
+      ;; Other static resources (Javascript, CSS)
       (route/resources "/" {:root resource-root})
       (route/not-found (site-resource "404.html")))))


Add Wrapper, a [value callback] combo that looks like an atom

--- src/reagent/impl/util.cljs
+++ src/reagent/impl/util.cljs
@@ -159,6 +159,54 @@
     (doseq [f (vals @roots)]
       (f)))
   "Updated")
+
+
+;;; Wrapper
+
+(deftype Wrapper [^:mutable state callback ^:mutable changed]
+
+  IAtom
+
+  IDeref
+  (-deref [this] state)
+
+  IReset
+  (-reset! [this newval]
+           (set! changed true)
+           (set! state newval)
+           (callback newval))
+
+  ISwap
+  (-swap! [a f]
+    (-reset! a (f state)))
+  (-swap! [a f x]
+    (-reset! a (f state x)))
+  (-swap! [a f x y]
+    (-reset! a (f state x y)))
+  (-swap! [a f x y more]
+    (-reset! a (apply f state x y more)))
+
+  IEquiv
+  (-equiv [_ other]
+          (and (instance? Wrapper other)
+               ;; If either of the wrappers have changed, equality
+               ;; cannot be relied on.
+               (not changed)
+               (not (.-changed other))
+               (= state (.-state other))
+               (= callback (.-callback other))))
+
+  IPrintWithWriter
+  (-pr-writer [_ writer opts]
+    (-write writer "#<wrap: ")
+    (pr-writer state writer opts)
+    (-write writer ">")))
+
+(defn make-wrapper [value callback-fn args]
+  (Wrapper. value
+            (partial-ifn. callback-fn args nil)
+            false))
+

 ;;; Helpers for shouldComponentUpdate


specify how figwheel loads a script with FIGWHEEL_IMPORT_SCRIPT

and refactor some script loading functionality

--- support/src/figwheel/client/file_reloading.cljs
+++ support/src/figwheel/client/file_reloading.cljs
@@ -222,52 +222,70 @@
     (.addCallback #(apply callback [true]))
     (.addErrback  #(apply callback [false]))))

+(def ^:export write-script-tag-import reload-file-in-html-env)
+
+(defn ^:export worker-import-script [request-url callback]
+  (dev-assert (string? request-url) (not (nil? callback)))
+  (callback (try
+              (do (.importScripts js/self (add-cache-buster request-url))
+                  true)
+              (catch js/Error e
+                (utils/log :error (str  "Figwheel: Error loading file " request-url))
+                (utils/log :error (.-stack e))
+                false))))
+
+(defn ^:export create-node-script-import-fn []
+  (let [node-path-lib (js/require "path")
+        ;; just finding a file that is in the cache so we can
+        ;; figure out where we are
+        util-pattern (str (.-sep node-path-lib)
+                          (.join node-path-lib "goog" "bootstrap" "nodejs.js"))
+        util-path (gobj/findKey js/require.cache (fn [v k o] (gstring/endsWith k util-pattern)))
+        parts     (-> (string/split util-path #"[/\\]") pop pop)
+        root-path (string/join (.-sep node-path-lib) parts)]
+    (fn [request-url callback]
+      (dev-assert (string? request-url) (not (nil? callback)))
+      (let [cache-path (.resolve node-path-lib root-path request-url)]
+        (gobj/remove (.-cache js/require) cache-path)
+        (callback (try
+                    (js/require cache-path)
+                    (catch js/Error e
+                      (utils/log :error (str  "Figwheel: Error loading file " cache-path))
+                      (utils/log :error (.-stack e))
+                      false)))))))
+
+;; TODO
+#_(defn async-fetch-import-script [request-url callback]
+  (let [base-url (or goog.global.FIGWHEEL_RELOAD_BASE_URL "http://localhost:8081")]
+    (doto (js/fetch (str base-url "/" request-url))
+      (.then (fn [r] ))
+      )))
+
 (def reload-file*
   (condp = (utils/host-env?)
-    :node
-    (let [node-path-lib (js/require "path")
-          ;; just finding a file that is in the cache so we can
-          ;; figure out where we are
-          util-pattern (str (.-sep node-path-lib)
-                            (.join node-path-lib "goog" "bootstrap" "nodejs.js"))
-          util-path (gobj/findKey js/require.cache (fn [v k o] (gstring/endsWith k util-pattern)))
-          parts     (-> (string/split util-path #"[/\\]") pop pop)
-          root-path (string/join (.-sep node-path-lib) parts)]
-      (fn [request-url callback]
-        (dev-assert (string? request-url) (not (nil? callback)))
-        (let [cache-path (.resolve node-path-lib root-path request-url)]
-          (gobj/remove (.-cache js/require) cache-path)
-          (callback (try
-                      (js/require cache-path)
-                      (catch js/Error e
-                        (utils/log :error (str  "Figwheel: Error loading file " cache-path))
-                        (utils/log :error (.-stack e))
-                        false))))))
-    :html reload-file-in-html-env
-    :react-native reload-file-in-html-env
-    :worker (fn [request-url callback]
-              (dev-assert (string? request-url) (not (nil? callback)))
-              (callback (try
-                          (do (.importScripts js/self (add-cache-buster request-url))
-                              true)
-                          (catch js/Error e
-                            (utils/log :error (str  "Figwheel: Error loading file " request-url))
-                            (utils/log :error (.-stack e))
-                            false))))
+    :node (create-node-script-import-fn)
+    :html write-script-tag-import
+    ;; TODO react native reloading not supported internally yet
+    ;:react-native
+    #_(if (utils/worker-env?)
+      worker-import-script
+      async-fetch-import-script)
+    :worker worker-import-script
     (fn [a b] (throw "Reload not defined for this platform"))))

 (defn reload-file [{:keys [request-url] :as file-msg} callback]
   (dev-assert (string? request-url) (not (nil? callback)))
   (utils/debug-prn (str "FigWheel: Attempting to load " request-url))
-  (reload-file* request-url
-                (fn [success?]
-                  (if success?
-                    (do
-                      (utils/debug-prn (str "FigWheel: Successfully loaded " request-url))
-                      (apply callback [(assoc file-msg :loaded-file true)]))
-                    (do
-                      (utils/log :error (str  "Figwheel: Error loading file " request-url))
-                      (apply callback [file-msg]))))))
+  ((or (gobj/get goog.global "FIGWHEEL_IMPORT_SCRIPT") reload-file*)
+   request-url
+   (fn [success?]
+     (if success?
+       (do
+         (utils/debug-prn (str "FigWheel: Successfully loaded " request-url))
+         (apply callback [(assoc file-msg :loaded-file true)]))
+       (do
+         (utils/log :error (str  "Figwheel: Error loading file " request-url))
+         (apply callback [file-msg]))))))

 ;; for goog.require consumption
 (defonce reload-chan (chan))


:globe_with_meridians: Snap to Grid French

Signed-off-by: mathieu.brunot <cbb78c9d6ecc8139b4697c3352cc1f1edbdf61d7@monogramm.io>

--- frontend/src/uxbox/main/locales/fr.cljs
+++ frontend/src/uxbox/main/locales/fr.cljs
@@ -124,7 +124,7 @@
    "header.image" "Image (Ctrl + I)"
    "header.rules" "Règles"
    "header.grid" "Grille (Ctrl + G)"
-   "header.grid-snap" "Snap to grid"
+   "header.grid-snap" "Coller à la grille"
    "header.align" "Aligner (Ctrl + A)"
    "header.view-mode" "Mode visualisation (Ctrl + P)"


More cues for the demo.

More cues for the demo.

Including my first moving head chase.

--- src/afterglow/examples.clj
+++ src/afterglow/examples.clj
@@ -313,7 +313,14 @@
                  (oscillators/sawtooth-bar) :max 360)
         hue-gradient (params/build-spatial-param ; Spread a rainbow across the light grid
                       (show/all-fixtures)
-                      (fn [head] (- (:x head) (:min-x @(:dimensions *show*)))) :end 360)]
+                      (fn [head] (- (:x head) (:min-x @(:dimensions *show*)))) :end 360)
+        hue-z-gradient (params/build-spatial-param ; Spread a rainbow across the light grid
+                      (show/all-fixtures)
+                      (fn [head] (- (:z head) (:min-z @(:dimensions *show*)))) :end 360)
+        x-triangle-phrase (params/build-oscillated-param ; Move back and forth over a phrase
+                           (oscillators/triangle-phrase) :min -5 :max 5)
+        y-triangle-bar (params/build-oscillated-param ; Move back and forth over a phrase
+                        (oscillators/triangle-bar) :min 0.4 :max 5)]
     (global-color-cue "red" 0 0 :include-color-wheels true)
     (global-color-cue "orange" 1 0 :include-color-wheels true)
     (global-color-cue "yellow" 2 0 :include-color-wheels true)
@@ -337,6 +344,17 @@
                                            (params/build-color-param :s 100 :l 50 :h hue-gradient
                                                                      :adjust-hue hue-bar)))
                            :short-name "Rainbow Grid+Bar"))
+
+    (ct/set-cue! (:cue-grid *show*) 4 1
+                 (cues/cue :color (fn [_] (global-color-effect
+                                           (params/build-color-param :s 100 :l 50 :h hue-z-gradient)
+                                           :include-color-wheels true))
+                           :short-name "Z Rainbow Grid"))
+    (ct/set-cue! (:cue-grid *show*) 5 1
+                 (cues/cue :color (fn [_] (global-color-effect
+                                           (params/build-color-param :s 100 :l 50 :h hue-z-gradient
+                                                                     :adjust-hue hue-bar)))
+                           :short-name "Z Rainbow Grid+Bar"))

     (ct/set-cue! (:cue-grid *show*) 7 1
                  (cues/cue :color (fn [_] (global-color-effect
@@ -621,6 +639,15 @@
                  (cues/function-cue :t2-gobo-rotation :gobo-rotation-counterclockwise (show/fixtures-named "torrent-2")
                                     :effect-name "T2 Spin Gobo CCW" :color (create-color :cyan)))

+    ;; Some basic moving head chases
+    (ct/set-cue! (:cue-grid *show*) 0 9
+                 (cues/cue :movement (fn [var-map]
+                                       (move/aim-effect
+                                        "Can Can"
+                                        (params/build-aim-param :x x-triangle-phrase :y y-triangle-bar
+                                                                :z (tf/inches 300))
+                                        (show/all-fixtures)))))
+
     ;; A couple snowball cues
     (ct/set-cue! (:cue-grid *show*) 0 10 (cues/function-cue :sb-pos :beams-fixed (show/fixtures-named "snowball")
                                                              :effect-name "Snowball Fixed"))


[#3036] Fix specs

[#3036] Fix specs

--- backend/specs/akvo/lumen/specs/transformation.clj
+++ backend/specs/akvo/lumen/specs/transformation.clj
@@ -349,7 +349,7 @@
 (alias 'transformation.rename-column 'akvo.lumen.specs.transformation.rename-column)

 (s/def ::transformation.rename-column/newColumnTitle string?) ;; reuse s/def also used in combine
-(s/def ::transformation.rename-column/columnName columnName?)
+(s/def ::transformation.rename-column/columnName ::db.dsv.column.s/columnName)

 (s/def ::transformation.rename-column/args
   (s/keys :req-un [::transformation.derive/newColumnTitle


Ensure new series have some sort of valid earliest date for monotonic input.

--- metlog-vault/src-server/metlog_vault/data.clj
+++ metlog-vault/src-server/metlog_vault/data.clj
@@ -72,7 +72,8 @@
   (let [series-id (intern-series-name series-name)]
     (if-let [latest-t (@latest-sample-times series-id)]
       latest-t
-      (let [query-latest-t (query-series-latest-sample-time series-name)]
+      (let [query-latest-t (or (query-series-latest-sample-time series-name)
+                               (java.util.Date. 0))]
         (swap! latest-sample-times assoc series-id query-latest-t)
         (log/info "Latest sample times from DB" @latest-sample-times)
         query-latest-t))))


Draw effect list scroll indicators.

Draw effect list scroll indicators.

--- src/afterglow/controllers/ableton_push_2.clj
+++ src/afterglow/controllers/ableton_push_2.clj
@@ -1035,11 +1035,24 @@
                 (draw-bottom-button-label controller (inc (* 2 x)) "More →" white-color))
               (when (seq (rest fx))
                 (recur (rest fx) (rest fx-meta) (inc x)))))
+
           ;; Draw indicators if there are effects hidden from view in either direction
           (when (pos? num-skipped)
-            #_(aset (get (:next-display controller) 3) (* first-cell 17) (util/ubyte 0)))
+            (set-graphics-color graphics white-color)
+            (.draw graphics (java.awt.geom.Line2D$Double.
+                             (+ (* first-cell 2 button-cell-width) 7) (- Wayang/DISPLAY_HEIGHT 16)
+                             (* first-cell 2 button-cell-width) (- Wayang/DISPLAY_HEIGHT 9)))
+            (.draw graphics (java.awt.geom.Line2D$Double.
+                             (* first-cell 2 button-cell-width) (- Wayang/DISPLAY_HEIGHT 9)
+                             (+ (* first-cell 2 button-cell-width) 7) (- Wayang/DISPLAY_HEIGHT 2))))
           (when (pos? @(:effect-offset controller))
-            #_(aset (get (:next-display controller) 3) 67 (util/ubyte 0))))
+            (set-graphics-color graphics white-color)
+            (.draw graphics (java.awt.geom.Line2D$Double.
+                             (- Wayang/DISPLAY_WIDTH 8) (- Wayang/DISPLAY_HEIGHT 16)
+                             (dec Wayang/DISPLAY_WIDTH) (- Wayang/DISPLAY_HEIGHT 9)))
+            (.draw graphics (java.awt.geom.Line2D$Double.
+                             (dec Wayang/DISPLAY_WIDTH) (- Wayang/DISPLAY_HEIGHT 9)
+                             (- Wayang/DISPLAY_WIDTH 8) (- Wayang/DISPLAY_HEIGHT 2)))))
       (do
         (let [font  (get-display-font :condensed-light Font/ITALIC 36)
               text  "No effects are active."


fix whitespace

fix whitespace

--- src/clj_money/models/storage/sql_storage.clj
+++ src/clj_money/models/storage/sql_storage.clj
@@ -877,9 +877,9 @@
   (create-attachment
     [_ attachment]
     (insert db-spec :attachments attachment :transaction-id
-                                  :caption
-                                  :image-id
-                                  :mime-type))
+                                            :caption
+                                            :image-id
+                                            :mime-type))

   (select-attachments
     [_ criteria]


[#2127] Fix: keep meta in v3/formdata

[#2127] Fix: keep meta in v3/formdata

--- backend/src/akvo/lumen/lib/import/flow_v3.clj
+++ backend/src/akvo/lumen/lib/import/flow_v3.clj
@@ -91,9 +91,11 @@
            (let [data-point-id (get form-instance "dataPointId")]
              (if-let [data-point (get data-points data-point-id)]
                (let [[main-group & more-groups] (response-data form (get form-instance "responses"))]
-                 (into [(merge main-group
-                                (flow-common/common-records form-instance data-point)
-                                {:device_id (get form-instance "deviceIdentifier")})]
+                 (into [(with-meta
+                          (merge main-group
+                                 (flow-common/common-records form-instance data-point)
+                                 {:device_id (get form-instance "deviceIdentifier")})
+                          (meta main-group))]
                        more-groups))
                (throw (ex-info "Flow form (dataPointId) referenced data point not in survey"
                                {:form-instance-id (get form-instance "id")


Add verify functions to Mockito wrapper

Add verify functions to Mockito wrapper

--- clstreams/test/clstreams/testutil/mockito.clj
+++ clstreams/test/clstreams/testutil/mockito.clj
@@ -14,3 +14,21 @@

 (defmacro on-call [mock-fn-expr parameter-expr-list return-value-expr]
   `(return-> ~mock-fn-expr (.invoke ~@parameter-expr-list) ~return-value-expr))
+
+(defmacro verify->
+  ([mock-obj-expr method-invocation-form]
+   `(verify-> ~mock-obj-expr ~method-invocation-form (Mockito/times 1)))
+  ([mock-obj-expr method-invocation-form counting-predicate-expr]
+   `(-> ~mock-obj-expr (Mockito/verify ~counting-predicate-expr) ~method-invocation-form)))
+
+(defmacro verify-fn
+  ([mock-fn-expr parameter-expr-list]
+   `(verify-> ~mock-fn-expr (.invoke ~@parameter-expr-list)))
+  ([mock-fn-expr parameter-expr-list counting-predicate-expr]
+   `(verify-> ~mock-fn-expr (.invoke ~@parameter-expr-list) ~counting-predicate-expr)))
+
+(defn times [n] (Mockito/times n))
+(defn at-least-once [] (Mockito/atLeastOnce))
+(defn at-least [n] (Mockito/atLeast n))
+(defn at-most [n] (Mockito/atMost n))
+(defn never [] (Mockito/never))


Add multi-connect test

Add multi-connect test

--- test/clojurewerkz/cassaforte/multi/cql_test.clj
+++ test/clojurewerkz/cassaforte/multi/cql_test.clj
@@ -359,3 +359,12 @@
        (insert th/session :users r))
      (is (= r (first (select th/session :users))))
      (truncate th/session :users))))
+
+(deftest multi-connect
+  (let [session (-> (client/build-cluster {:contact-points ["127.0.0.1"]
+                                           :port 19042})
+                    (client/connect :new_cql_keyspace))]
+    (let [r {:name "Alex" :city "Munich" :age (int 19)}]
+      (insert session :users r)
+      (is (= r (first (select session :users))))
+      (truncate session :users))))


test against clojure.lang.BigInt again

test against clojure.lang.BigInt again

--- test/jvm/clojure/lang/platform/numbers_test.clj
+++ test/jvm/clojure/lang/platform/numbers_test.clj
@@ -32,7 +32,7 @@
    (short val)      ; java.lang.Short
    (int val)        ; java.lang.Integer
    (long val)       ; java.lang.Long
-   ;(bigint val)     ; clojure.lang.BigInt
+   (bigint val)     ; clojure.lang.BigInt
    (biginteger val) ; java.math.BigInteger
    ])


Return updates in reverse chronological order.

--- src/open_company/api/stakeholder_updates.clj
+++ src/open_company/api/stakeholder_updates.clj
@@ -44,7 +44,7 @@
   (if-let* [company (company-res/get-company conn company-slug)
             su-list (su-res/list-stakeholder-updates conn company-slug [:slug :title :medium :author])
             su-filtered-list (su-res/distinct-updates su-list)]
-    {:company company :stakeholder-updates su-filtered-list}
+    {:company company :stakeholder-updates (reverse su-filtered-list)}
     false))

 (defn- stakeholder-update-for


Probably better to actually use the global config

--- modules/cache/src/main/clojure/immutant/cache/core.clj
+++ modules/cache/src/main/clojure/immutant/cache/core.clj
@@ -25,13 +25,12 @@
              org.infinispan.transaction.lookup.GenericTransactionManagerLookup
              org.infinispan.util.concurrent.IsolationLevel))

+(def file-store-path (str (io/file (System/getProperty "jboss.server.data.dir") "immutant-cache-persist")))
 (def clustered-manager (registry/get "jboss.infinispan.web"))
-(def local-manager (delay (DefaultCacheManager.)))
-(def file-store-path (str (io/file (System/getProperty "jboss.server.data.dir") "immutant-cache-persist")))
-
-(let [builder (org.infinispan.configuration.global.GlobalConfigurationBuilder.)]
-  (.. builder globalJmxStatistics (allowDuplicateDomains true))
-  (.build builder))
+(def global-config (let [builder (org.infinispan.configuration.global.GlobalConfigurationBuilder.)]
+                     (.. builder globalJmxStatistics (allowDuplicateDomains true))
+                     (.build builder)))
+(def local-manager (delay (DefaultCacheManager. global-config)))

 (defn cache-mode
   [{:keys [mode sync]}]


adapted to the version of paredit.clj which emits text deltas. Better handling of undos, not showing full text selection anymore

--- ccw.core/src/ccw/editors/antlrbased/PareditAutoEditStrategy.clj
+++ ccw.core/src/ccw/editors/antlrbased/PareditAutoEditStrategy.clj
@@ -27,9 +27,9 @@
                           {:text (.get document)
                            :offset (.offset command)
                            :length 0})]
-      (println "result:" result)
-      (set! (.offset command) 0)
-      (set! (.length command) (.length (.get document)))
-      (set! (.text command) (:text result))
+      #_(println "result:" result)
+      (set! (.offset command) (-> result :modifs first :offset))
+      (set! (.length command) (-> result :modifs first :length))
+      (set! (.text command) (-> result :modifs first :text))
       (set! (.shiftsCaret command) false)
       (set! (.caretOffset command) (:offset result)))))


clojure: fixed imports in delaney3d

clojure: fixed imports in delaney3d

--- clojure/org/gavrog/clojure/dsymbols/delaney3d.clj
+++ clojure/org/gavrog/clojure/dsymbols/delaney3d.clj
@@ -2,12 +2,12 @@
   (:use (org.gavrog.clojure.dsymbols
           delaney
           covers
+          fundamental
           simplify3d
           orbifoldInvariant3d
           euclideanInvariants)
         (org.gavrog.clojure.common
           util
-          fundamental
           [generators :only [results]])
         (org.gavrog.clojure.fpgroups
           cosets)))


failing LWT unit tests

failing LWT unit tests

--- test/er_cassandra/model/alia/upsert_test.clj
+++ test/er_cassandra/model/alia/upsert_test.clj
@@ -1,6 +1,7 @@
 (ns er-cassandra.model.alia.upsert-test
   (:require
-   [er-cassandra.model.util.test :as tu :refer [fetch-record insert-record upsert-instance]]
+   [er-cassandra.model.util.test :as tu
+    :refer [fetch-record insert-record delete-record upsert-instance]]
    [clojure.test :as test :refer [deftest is are testing use-fixtures]]
    [schema.test :as st]
    [clj-uuid :as uuid]
@@ -563,3 +564,95 @@

     (is (= record (fetch-record :upsert_unique_lookup_secondaries_test
                                 [:org_id :id] [org-id id])))))
+
+(deftest upsert*-if-not-exists-test
+  (let [m (create-simple-entity)
+        id (uuid/v1)
+
+        record-foo {:id id :nick "foo"}
+        record-bar {:id id :nick "bar"}]
+
+    (testing "insert record-foo if-not-exists"
+      (let [[r e] @(u/upsert*
+                    tu/*model-session*
+                    m
+                    record-foo
+                    (ts/default-timestamp-opt
+                     {:if-not-exists true}))]
+        (is (= record-foo r))))
+
+    (testing "doesn't insert record-bar if-not-exists"
+      (let [[r e] @(u/upsert*
+                    tu/*model-session*
+                    m
+                    record-bar
+                    (ts/default-timestamp-opt
+                     {:if-not-exists true}))
+
+            fr (fetch-record :simple_upsert_test :id id)]
+        (is (= nil r))
+        (is (= record-foo fr))))))
+
+(deftest upsert*-if-exists-test
+  (let [m (create-simple-entity)
+        id (uuid/v1)
+
+        record-foo {:id id :nick "foo"}
+        record-bar {:id id :nick "bar"}
+
+        _ (insert-record :simple_upsert_test record-bar)]
+
+    (testing "upsert record-foo if-exists and it does exist"
+      (let [[r e] @(u/upsert*
+                    tu/*model-session*
+                    m
+                    record-foo
+                    (ts/default-timestamp-opt
+                     {:if-exists true}))
+            fr (fetch-record :simple_upsert_test :id id)]
+        (is (= record-foo fr))))
+
+    (testing "doesn't insert record-bar if-exists and it doesn't exist"
+      (let [_ (delete-record :simple_upsert_test :id id)
+
+            [r e] @(u/upsert*
+                    tu/*model-session*
+                    m
+                    record-bar
+                    (ts/default-timestamp-opt
+                     {:if-exists true}))
+
+            fr (fetch-record :simple_upsert_test :id id)]
+        (is (= nil r))
+        (is (= record-bar fr))))))
+
+(deftest upsert*-only-if-test
+  (let [m (create-simple-entity)
+        id (uuid/v1)
+
+        record-foo {:id id :nick "foo"}
+        record-bar {:id id :nick "bar"}
+
+        _ (insert-record :simple_upsert_test record-bar)]
+
+    (testing "upsert record-foo if condition holds"
+      (let [[r e] @(u/upsert*
+                    tu/*model-session*
+                    m
+                    record-foo
+                    (ts/default-timestamp-opt
+                     {:only-if [[:= :nick "bar"]]}))
+            fr (fetch-record :simple_upsert_test :id id)]
+        (is (= record-foo fr))))
+
+    (testing "doesn't insert record-bar if condition fails"
+      (let [[r e] @(u/upsert*
+                    tu/*model-session*
+                    m
+                    record-bar
+                    (ts/default-timestamp-opt
+                     {:only-if [[:= :nick "bar"]]}))
+
+            fr (fetch-record :simple_upsert_test :id id)]
+        (is (= nil r))
+        (is (= record-foo fr))))))


Fix some whitespace

Fix some whitespace

--- test/com/nomistech/clojure_the_language/c_200_clojure_basics/s_370_chunked_sequences.clj
+++ test/com/nomistech/clojure_the_language/c_200_clojure_basics/s_370_chunked_sequences.clj
@@ -43,25 +43,25 @@

 ;;; Built-in functions use chunk-buffer and chunk-cons:
 ;;;
- ;; (defn range
- ;;   "Returns a lazy seq of nums from start (inclusive) to end
- ;;   (exclusive), by step, where start defaults to 0, step to 1, and end
- ;;   to infinity."
- ;;   {:added "1.0"
- ;;    :static true}
- ;;   ([] (range 0 Double/POSITIVE_INFINITY 1))
- ;;   ([end] (range 0 end 1))
- ;;   ([start end] (range start end 1))
- ;;   ([start end step]
- ;;    (lazy-seq
- ;;     (let [b (chunk-buffer 32)
- ;;           comp (if (pos? step) < >)]
- ;;       (loop [i start]
- ;;         (if (and (< (count b) 32)
- ;;                  (comp i end))
- ;;           (do
- ;;             (chunk-append b i)
- ;;             (recur (+ i step)))
- ;;           (chunk-cons (chunk b)
- ;;                       (when (comp i end)
- ;;                         (range i end step)))))))))
+;; (defn range
+;;   "Returns a lazy seq of nums from start (inclusive) to end
+;;   (exclusive), by step, where start defaults to 0, step to 1, and end
+;;   to infinity."
+;;   {:added "1.0"
+;;    :static true}
+;;   ([] (range 0 Double/POSITIVE_INFINITY 1))
+;;   ([end] (range 0 end 1))
+;;   ([start end] (range start end 1))
+;;   ([start end step]
+;;    (lazy-seq
+;;     (let [b (chunk-buffer 32)
+;;           comp (if (pos? step) < >)]
+;;       (loop [i start]
+;;         (if (and (< (count b) 32)
+;;                  (comp i end))
+;;           (do
+;;             (chunk-append b i)
+;;             (recur (+ i step)))
+;;           (chunk-cons (chunk b)
+;;                       (when (comp i end)
+;;                         (range i end step)))))))))


remove reference file

remove reference file

--- src/braid/desktop/draggable.cljs
+++ src/braid/desktop/draggable.cljs
@@ -1,120 +0,0 @@
-(ns braid.desktop.draggable
-  (:require [cljs.core.async :as async :refer [put!]]
-            [goog.events :as events]
-            [goog.style :as gstyle])
-  (:import [goog.events EventType]))
-
-(defn gsize->vec [size]
-  [(.-width size) (.-height size)])
-
-(defn node-size [node]
-  (gsize->vec (gstyle/getSize node)))
-
-(defn to?
-  "Is the owner transitioning to k (either in state or props)"
-  [owner next-props next-state k]
-  (or (and (not (om/get-render-state owner k))
-        (k next-state))
-      (and (not (k (om/get-props owner)))
-        (k next-props))))
-
-(defn from?
-  "Is the owner transitioning from k (either in state or props)"
-  [owner next-props next-state k]
-  (or (and (om/get-render-state owner k)
-        (not (k next-state)))
-      (and (k (om/get-props owner))
-        (not (k next-props)))))
-
-(defn location
-  [e]
-  [(.-clientX e) (.-clientY e)])
-
-(defn element-offset
-  [el]
-  (let [offset (gstyle/getPageOffset el)]
-    [(.-x offset) (.-y offset)]))
-
-(defn dragging?
-  [owner]
-  (om/get-state owner :dragging))
-
-(defn drag-start
-  [e item owner]
-  (when-not (dragging? owner)
-    (.preventDefault e)
-    (let [el (om/get-node owner "draggable")
-          state (om/get-state owner)
-          drag-start (location e)
-          el-offset (element-offset el)
-          drag-offset (vec (map - el-offset drag-start))]
-      (when-not (:delegate state)
-        (om/set-state! owner :dragging true))
-      (doto owner
-        (om/set-state! :location ((or (:constrain state) identity) el-offset))
-        (om/set-state! :drag-offset drag-offset))
-      (when-let [c (:chan state)]
-        (put! c {:event :drag-start :id (:id item)
-                 :location (vec (map + drag-start drag-offset))})))))
-
-(defn drag-stop
-  [e item owner]
-  (when (dragging? owner)
-    (let [state (om/get-state owner)]
-      (when (:dragging state)
-        (om/set-state! owner :dragging false))
-      (when-not (:delegate state)
-        (doto owner
-          (om/set-state! :location nil)
-          (om/set-state! :drag-offset nil)))
-      (when-let [c (:chan state)]
-        (put! c {:event :drag-stop :id (:id item)})))))
-
-(defn drag
-  [e item owner]
-  (let [state (om/get-state owner)]
-    (when (dragging? owner)
-      (let [loc ((or (:constrain state) identity)
-                 (vec (map + (location e) (:drag-offset state))))]
-        (om/set-state! owner :location loc)
-        (when-let [c (:chan state)]
-          (put! c {:event :drag :location loc :id (:id item)}))))))
-
-(defn draggable [item owner opts]
-  (reify
-    om/IDidMount
-    (did-mount [_]
-      (let [dims (node-size (om/get-node owner "draggable"))]
-        (om/set-state! owner :dimensions dims)
-        (when-let [dims-chan (:dims-chan (om/get-state owner))]
-          (put! dims-chan dims))))
-    om/IWillUpdate
-    (will-update [_ next-props next-state]
-      (when (to? owner next-props next-state :dragging)
-        (let [mouse-up #(drag-stop % @next-props owner)
-              mouse-move #(drag % @next-props owner)]
-          (om/set-state! owner :window-listeners [mouse-up mouse-move])
-          (doto js/window
-            (events/listen EventType.MOUSEUP mouse-up)
-            (events/listen EventType.MOUSEMOVE mouse-move))))
-      (when (from? owner next-props next-state :dragging)
-        (let [[mouse-up mouse-move] (om/get-state owner :window-listeners)]
-          (doto js/window
-            (events/unlisten EventType.MOUSEUP mouse-up)
-            (events/unlisten EventType.MOUSEMOVE mouse-move)))))
-    om/IRenderState
-    (render-state [_ state]
-      (let [style (if (dragging? owner)
-                    (let [[x y] (:location state)
-                          [w h] (:dimensions state)]
-                      #js {:position "absolute"
-                           :top y :left x :z-index 1
-                           :width w :height h})
-                    #js {:position "static" :z-index 0})]
-        (dom/li #js {:classname (when (dragging? owner) "dragging")
-                     :style style
-                     :ref "draggable"
-                     :onMouseDown #(drag-start % @item owner)
-                     :onMouseUp #(drag-stop % @item owner)
-                     :onMouseMove #(drag % @item owner)}
-          (om/build (:view state) item opts))))))


guard against nonexistant user?

guard against nonexistant user?

--- src/chat/client/views/pills.cljs
+++ src/chat/client/views/pills.cljs
@@ -37,15 +37,18 @@
   (reify
     om/IRender
     (render [_]
-      (let [user (om/observe owner (user-cursor (user :id)))]
-        (dom/a #js {:className (str "user pill" (case (user :status)
-                                                  :online " on"
-                                                  " off"))
-                    :tabIndex -1
-                    :style #js {:backgroundColor (id->color (user :id))
-                                :color (id->color (user :id))
-                                :borderColor (id->color (user :id))}
-                    :href (routes/user-page-path {:group-id (routes/current-group)
-                                                  :user-id (user :id)})}
-          (dom/span #js {:className "name"} (str "@" (user :nickname)))
-          #_(dom/div #js {:className (str "status " ((fnil name "") (user :status)))}))))))
+      (if-let [cur (user-cursor (user :id))]
+        (let [user (om/observe owner cur)]
+          (dom/a #js {:className (str "user pill" (case (user :status)
+                                                    :online " on"
+                                                    " off"))
+                      :tabIndex -1
+                      :style #js {:backgroundColor (id->color (user :id))
+                                  :color (id->color (user :id))
+                                  :borderColor (id->color (user :id))}
+                      :href (routes/user-page-path {:group-id (routes/current-group)
+                                                    :user-id (user :id)})}
+            (dom/span #js {:className "name"} (str "@" (user :nickname)))
+            #_(dom/div #js {:className (str "status " ((fnil name "") (user :status)))})))
+        (dom/a #js {:className "user pill" :tabIndex -1 :href "#"}
+          (dom/span #js {:className "name"} "????"))))))


order artist list alphabetically

order artist list alphabetically

--- src/clj/cljspazzer/db/schema.clj
+++ src/clj/cljspazzer/db/schema.clj
@@ -120,8 +120,8 @@

 (defn artist-search [db prefix]
   (cond (= prefix "all") (artist-list db)
-        (= prefix "#") (sql/query db [(format "select distinct artist_canonical as artist from tracks where artist_canonical < 'a'")])
-    :else (sql/query db [(format "select distinct artist_canonical as artist from tracks where artist_canonical like '%s%%'" prefix)])))
+        (= prefix "#") (sql/query db [(format "select distinct artist_canonical as artist from tracks where artist_canonical < 'a' order by artist")])
+    :else (sql/query db [(format "select distinct artist_canonical as artist from tracks where artist_canonical like '%s%%' order by artist" prefix)])))

 (defn album-list-by-artist [db artist]
   (sql/query db ["select distinct album_canonical, year from tracks where artist_canonical=? order by year" (utils/canonicalize artist)]))


fixed disconnection handling

fixed disconnection handling

--- src/clj/funstructor/commands.clj
+++ src/clj/funstructor/commands.clj
@@ -181,9 +181,10 @@
      opponent
      "Other player has disconnected")

+    (u/log "Sending update to his opponent: " opponent)
     (send-command
      {:type :game-update
-      :data (make-update-data game opponent)}
+      :data (make-update-data (gs/get-game (gs/current-global-state) game-id) opponent)}
      (gs/channel-for-player (gs/current-global-state) opponent))))

 (defmethod handle-command :default [command channel]


inline code style

inline code style

--- src/clj/iwaswhere_web/export.clj
+++ src/clj/iwaswhere_web/export.clj
@@ -24,6 +24,7 @@
    :br         [:spacer]
    :img        [:image]
    :pre        [:paragraph {:size 10 :family :courier}]
+   :code       [:chunk {:family :courier :style :bold}]
    :p          [:paragraph]
    :b          [:chunk {:style :bold}]
    :em         [:chunk {:style :italic}]


Isolate app-state :game into a reagent wrap

--- src/cljs/caves_of_cljs/core.cljs
+++ src/cljs/caves_of_cljs/core.cljs
@@ -31,8 +31,7 @@
               input (get *keys* (if (<= 96 key-code 105)
                                   (- key-code 48)
                                   key-code))]
-          (when (:game @app-state)
-            (swap! state assoc-in [:game :input] input)))
+          (swap! state assoc :input input))
         (recur)))))

 (defmulti draw-ui
@@ -84,11 +83,9 @@
     game))

 (defn tick-game [state screen]
-  (let [game (:game @state)]
-    (swap! state assoc :game
-           (-> game
-               handle-input
-               (draw-game screen)))))
+  (reset! state (-> @state
+                    handle-input
+                    (draw-game screen))))

 (defn game-loop! [state screen]
   (tick-game state screen)
@@ -96,7 +93,7 @@

 (defn init-game! [state screen]
   (init-key-handler! state (.getContainer screen))
-  (game-loop! app-state screen))
+  (game-loop! state screen))

 ;; -------------------------
 ;; Views
@@ -117,8 +114,7 @@
 (defn home-page [state]
   [:div [:h2 "Caves of Clojurescript"]
    [:div [:a {:href "#/about"} "go to the about page"]]
-   (when-not (empty? (:uis (:game @state)))
-     [canvas state])])
+   [canvas (r/wrap (:game @state) swap! state assoc :game)]])

 (defn about-page []
   [:div [:h2 "About caves-of-cljs"]


morph: add shorthand => for prop redefinition

--- src/cljs/cljs_morphic/morph.cljs
+++ src/cljs/cljs_morphic/morph.cljs
@@ -1,7 +1,7 @@
 (ns cljs-morphic.morph
   (:require-macros [cljs.analyzer.macros :refer [no-warn]]
                    [cljs.core.async.macros :refer [go go-loop]]
-                   [fresnel.lenses :refer [deflens]]
+                   [fresnel.lenses :refer [deflens deffetch]]
                    [cljs-morphic.macros :refer [morph-fn rectangle ellipse image text polygon]])
   (:require [cljs-morphic.evaluator :refer [morph-eval morph-eval-str]]
             [cljs-morphic.event :as event :refer [signals]]
@@ -23,7 +23,7 @@

             [om.core :as om :include-macros true]
             [om.dom :as dom :include-macros true]
-            [fresnel.lenses :refer [fetch putback create-lens create-lens dissoc-trigger]])
+            [fresnel.lenses :refer [fetch putback create-lens create-lens dissoc-trigger IFetch IPutback]])
   (:import [goog.net XhrIo]
            [goog.events EventType]))

@@ -38,7 +38,7 @@

 (declare without)

-(declare rerender redefine on-drag find-morph)
+(declare rerender redefine on-drag)

 (declare add-morph add-morph-before without set-prop)

@@ -440,6 +440,22 @@
   "Set the property prop-name of morph with id in world to prop-value"
   (putback world [($morph id) properties prop-name] prop-value))

+(defn =>
+  ([world id prop-name]
+   (cond
+     (fetch world id) (fetch world [id properties prop-name])
+     :default (fetch world [($morph id) properties prop-name])))
+  ([world id prop-name new-value]
+   (if (and (bi-lens? id) (fetch world id))
+     (let [v (fetch world [id properties prop-name])]
+         (cond
+         (fn? new-value) (putback world [id properties prop-name] (new-value v))
+                   :default (putback world [id properties prop-name] new-value)))
+     (let [v (fetch world [($morph id) properties prop-name])]
+       (cond
+         (fn? new-value) (set-prop world id prop-name (new-value v))
+         :default (set-prop world id prop-name new-value))))))
+
 (defn add-morphs-to [world id morphs]
   "Add collection of morphs to the morph with id in world"
   (-> world (redefine ($morph id) (fn [self props submorphs]


Minor doc fix

Minor doc fix

--- src/clojure/neko/application.clj
+++ src/clojure/neko/application.clj
@@ -10,7 +10,7 @@
 ; this software.

 (ns neko.application
-  "Contains the tools to create and manipulate Application instances."
+  "Contains tools to create and manipulate Application instances."
   (:use [neko.-utils :only [simple-name]]
         [neko.init :only [init]]
         [neko.context :only [context]]


Use smaller transactions for better throughput

--- src/com/puppetlabs/cmdb/core.clj
+++ src/com/puppetlabs/cmdb/core.clj
@@ -86,39 +86,36 @@
                 {:host host :source source :target target})]
         (apply sql/insert-records :edges rows)))

-(defn persist-catalog!*
+(defn persist-catalog!
   "Persist the supplied catalog in the database"
   [catalog]
-  (sql/transaction
-   ;; I think we can live with a commit delay, for better performance
-   (sql/do-commands "SET LOCAL synchronous_commit TO OFF")
+  (let [{host "name" resources "resources" edges "edges"} catalog]

-   (let [{host "name" resources "resources" edges "edges"} catalog]
-
-     (persist-hostname! host catalog)
-     (persist-classes! host catalog)
-     (doseq [resource resources] (persist-resource! host resource))
-     (persist-edges! host catalog))))
-
-(defn persist-catalog!
-  "Persist the supplied catalog, returning boolean indicating if
-caller must retry the operation"
-  [catalog]
-  (try
-    (sql/with-connection *db*
-      (persist-catalog!* catalog))
-    ;; Return nil, signalling no need to retry
-    nil
-    ;; TODO Replace broad exception catch with fn that unwinds chain to find root cause
-    (catch Exception e
-      (if (re-find #"PSQLException: .* deadlock detected" (.getMessage e))
-        true
-        (throw e)))))
+    (sql/transaction (persist-hostname! host catalog))
+    (sql/transaction (persist-classes! host catalog))
+    (sql/transaction (persist-edges! host catalog))
+    (doseq [resource resources]
+      (sql/transaction (persist-resource! host resource)))))

 (defn initialize-store
   "Eventually code that initializes the DB will go here"
   [])

+(defn farm-out
+  "Like map, except f is applied in parallel. Semi-lazy in that the
+  parallel computation stays ahead of the consumption, but doesn't
+  realize the entire result unless required. Only useful for
+  computationally intensive functions where the time of f dominates
+  the coordination overhead."
+  [n f coll]
+  (let [rets (map #(future (f %)) coll)
+        step (fn step [[x & xs :as vs] fs]
+               (lazy-seq
+                (if-let [s (seq fs)]
+                  (cons (deref x) (step xs (rest s)))
+                  (map deref vs))))]
+    (step rets (drop n rets))))
+
 (defn -main
   [& args]
   (sql/with-connection *db*
@@ -126,11 +123,8 @@
   (log/info "Generating and storing catalogs...")
   (let [catalogs       (catalog-seq "/Users/deepak/Desktop/many_catalogs")
         handle-catalog (fn [catalog]
-                         (loop []
-                           (log/info (catalog "name"))
-                           (when (persist-catalog! catalog)
-                             (log/error (format "Retrying %s" (catalog "name")))
-                             (Thread/sleep 1000)
-                             (recur))))]
+                         (log/info (catalog "name"))
+                         (time (sql/with-connection *db*
+                           (persist-catalog! catalog))))]
     (dorun (pmap handle-catalog catalogs)))
   (log/info "Done persisting catalogs."))


Fix AST on lift-placeholders

Fix AST on lift-placeholders

--- src/com/wsscode/pathom/core.cljc
+++ src/com/wsscode/pathom/core.cljc
@@ -510,7 +510,7 @@
                           regular      false} (group-by #(and (= :join (:type %))
                                                               (contains? placeholder-prefixes
                                                                 (namespace (:dispatch-key %)))) children)]
-                     (as-> (assoc x :children regular) <>
+                     (as-> (assoc x :children (or regular [])) <>
                            (reduce merge-queries* <> placeholders)))
                    x))
                ast)]


Remove obsolete album code from acquisition engine

git-svn-id: 03a8048b5ee8463be5048a3801110fb50f378627@10787 d0ab736e-dc22-4aeb-8dc9-08def0aa14fd

--- acqEngine/src/org/micromanager/acq_engine.clj
+++ acqEngine/src/org/micromanager/acq_engine.clj
@@ -824,52 +824,6 @@
       "z-step_um" (get-z-step-um (:slices settings))
      })))

-;; acquire button
-
-(def current-album-tags (atom nil))
-
-(def albums (atom {}))
-
-(def current-album-name (atom nil))
-
-(defn compatible-to-current-album? [image-tags]
-  (select-values-match?
-    @current-album-tags
-    image-tags
-    ["Width" "Height" "PixelType"]))
-
-(defn initialize-display-ranges [window]
-  (do (.setChannelDisplayRange window 0 0 256)
-      (.setChannelDisplayRange window 1 0 256)
-      (.setChannelDisplayRange window 2 0 256)))
-
-(defn create-basic-event []
-  {:position-index 0, :position nil,
-   :frame-index 0, :slice 0.0, :channel-index 0, :slice-index 0, :frame 0
-   :channel {:name (core getCurrentConfig (core getChannelGroup))},
-   :exposure (core getExposure), :relative-z true,
-   :wait-time-ms 0})
-
-(defn create-basic-state []
-  {:init-width (core getImageWidth)
-   :init-height (core getImageHeight)
-   :summary-metadata (make-summary-metadata nil)
-   :pixel-type (get-pixel-type)
-   :bit-depth (core getImageBitDepth)
-   :binning (core getProperty (core getCameraDevice) "Binning")})
-
-(defn acquire-tagged-images []
-  (core snapImage)
-  (let [events (make-multicamera-events (create-basic-event))]
-    (for [event events]
-      (annotate-image (collect-snap-image event nil) event
-                      (create-basic-state) nil))))
-
-(defn add-to-album []
-  (doseq [img (acquire-tagged-images)]
-    (def x img)
-    (.addToAlbum gui (make-TaggedImage img))))
-
 (defn run [this settings cleanup?]
   (def last-acq this)
     (reset! (.state this) {:stop false :pause false :finished false})
@@ -888,7 +842,7 @@
         (.start acq-thread)
         out-queue)))

-;; java interop -- implements org.micromanager.api.Pipeline
+;; java interop -- implements org.micromanager.api.IAcquisitionEngine2010

 (defn -init [script-gui]
   [[] (do (load-mm script-gui)
@@ -905,7 +859,7 @@
   (:summary-metadata @(.state this)))

 (defn -acquireSingle [this]
-  (add-to-album))
+  (ReportingUtils/logError "Call to deprecated acquireSingle"))

 (defn -pause [this]
   (log "pause requested!")
@@ -964,12 +918,6 @@
     (.setParentGUI gui)
     (.setPositionList (.getPositionList gui))))))

-;(defn test-dialog [eng]
-;  (.show (AcqControlDlg. eng (Preferences/userNodeForPackage (.getClass gui)) gui)))
-
-;(defn run-test []
-;  (test-dialog (create-acq-eng)))
-
 (defn stop []
   (when-let [acq-thread (:acq-thread (.state last-acq))]
     (.stop acq-thread)))


stop live mode before starting acquisition

git-svn-id: 03a8048b5ee8463be5048a3801110fb50f378627@6363 d0ab736e-dc22-4aeb-8dc9-08def0aa14fd

--- acqEngine/src/org/micromanager/acq_engine.clj
+++ acqEngine/src/org/micromanager/acq_engine.clj
@@ -497,7 +497,7 @@
       ;(proxy [TaggedImageAnalyzer] []
         ;(analyze [img] (log "pretending to analyze"))))
     (when-not (:stop @(.state this))
-      (if (. gui isLiveModeOn)
+      (if (. gui getLiveMode)
         (. gui enableLiveMode false))
       (.start acq-thread)
       (swap! (.state this) assoc :display display)


refactoring

refactoring

--- pigpen-cascading/src/main/clojure/pigpen/cascading.clj
+++ pigpen-cascading/src/main/clojure/pigpen/cascading.clj
@@ -67,7 +67,50 @@
       (add-val [:pipe-to-sink] (first ancestors) id)
       (add-val [:sinks] id ((get-tap-fn storage) location opts))))

-(defmethod command->flowdef :code-def
+(defn- partial-aggregation-code
+  [pipe inits funcs cogroup-opts field-projections flowdef]
+  (let [key-fields (cfields (first (:keys cogroup-opts)))
+        ; This is a hack to emulate multiple streams with a single stream by using a sentinel value to fill absent fields.
+        ; For example, if we have generate1 -> [1 1 2 3], generate2 => [1 2 2 3], the resulting merged stream will be:
+        ; [[1 1 s] [1 1 s] [2 2 s] [3 3 s] [1 s 1] [2 s 2] [2 s 2] [3 s 3]], where each tuple contains [key, value1, value2],
+        ; and s represents the sentinel value.
+        ; Another twist is that in case of a self join, a single pipe must be used because otherwise cascading will
+        ; do each operation twice.
+        agg-fields (->> field-projections
+                        (filter #(= :projection-func (:type %)))
+                        (map :alias)
+                        (map str))
+        field-to-source (zipmap agg-fields (:ancestors cogroup-opts))
+        pipes (->> (:ancestors cogroup-opts)
+                   (map (:pipes flowdef))
+                   (map-indexed (fn [index pipe]
+                                  (Rename. pipe (cfields ["value"]) (cfields [(nth agg-fields index)]))))
+                   (map #(if (:group-all cogroup-opts)
+                          (Each. % (Insert. (cfields ["group_all"]) (into-array [-1])) Fields/ALL)
+                          %))
+                   (map-indexed (fn [index pipe]
+                                  (reduce (fn [pipe {:keys [field shared-source]}]
+                                            (if shared-source
+                                              (Each. pipe (cfields [(nth agg-fields index)]) (Identity. (cfields [field])) Fields/ALL)
+                                              (Each. pipe (Insert. (cfields [field]) (into-array [OperationUtil/SENTINEL_VALUE])) Fields/ALL)))
+                                          pipe
+                                          (keep-indexed (fn [i v]
+                                                          (if (= index i)
+                                                            nil {:field v :shared-source (= (.getName pipe) (str (field-to-source (nth agg-fields i))))}))
+                                                        agg-fields))))
+                   (reduce (fn [pipes pipe]
+                             (let [pipe-names (into #{} (map #(.getName %) pipes))]
+                               (if (pipe-names (.getName pipe))
+                                 pipes
+                                 (conj pipes pipe))))
+                           [])
+                   (into-array))]
+    (add-val flowdef [:pipes] pipe (let [p (PigPenAggregateBy/buildAssembly (str pipe) pipes key-fields agg-fields inits funcs)]
+                                     (if (:group-all cogroup-opts)
+                                       (Discard. p (cfields ["group_all"]))
+                                       p)))))
+
+(defn- code->flowdef
   [{:keys [code-defs pipe field-projections]} flowdef]
   {:pre [code-defs (= (count (distinct (map :udf code-defs))) 1)]}
   (let [inits (mapv #(str (get-in % [:expr :init])) code-defs)
@@ -80,47 +123,7 @@
         cogroup-opts (get-in flowdef [:cogroup-opts pipe])]
     (if-not (nil? cogroup-opts)
       (if (= udf :algebraic)
-        (let [key-fields (cfields (first (:keys cogroup-opts)))
-              ; This is a hack to emulate multiple streams with a single stream by using a sentinel value to fill absent fields.
-              ; For example, if we have generate1 -> [1 1 2 3], generate2 => [1 2 2 3], the resulting merged stream will be:
-              ; [[1 1 s] [1 1 s] [2 2 s] [3 3 s] [1 s 1] [2 s 2] [2 s 2] [3 s 3]], where each tuple contains [key, value1, value2],
-              ; and s represents the sentinel value.
-              ; Another twist is that in case of a self join, a single pipe must be used because otherwise cascading will
-              ; do each operation twice.
-              agg-fields (->> field-projections
-                              (filter #(= :projection-func (:type %)))
-                              (map :alias)
-                              (map str))
-              field-to-source (zipmap agg-fields (:ancestors cogroup-opts))
-              pipes (->> (:ancestors cogroup-opts)
-                         (map (:pipes flowdef))
-                         (map-indexed (fn [index pipe]
-                                        (Rename. pipe (cfields ["value"]) (cfields [(nth agg-fields index)]))))
-                         (map #(if (:group-all cogroup-opts)
-                                (Each. % (Insert. (cfields ["group_all"]) (into-array [-1])) Fields/ALL)
-                                %))
-                         (map-indexed (fn [index pipe]
-                                        (reduce (fn [pipe {:keys [field shared-source]}]
-                                                  (if shared-source
-                                                    (Each. pipe (cfields [(nth agg-fields index)]) (Identity. (cfields [field])) Fields/ALL)
-                                                    (Each. pipe (Insert. (cfields [field]) (into-array [OperationUtil/SENTINEL_VALUE])) Fields/ALL)))
-                                                pipe
-                                                (keep-indexed (fn [i v]
-                                                                (if (= index i)
-                                                                  nil {:field v :shared-source (= (.getName pipe) (str (field-to-source (nth agg-fields i))))}))
-                                                              agg-fields))))
-                         (reduce (fn [pipes pipe]
-                                   (let [pipe-names (into #{} (map #(.getName %) pipes))]
-                                     (if (pipe-names (.getName pipe))
-                                       pipes
-                                       (conj pipes pipe))))
-                                 [])
-                         (into-array))]
-          (add-val flowdef [:pipes] pipe (let [p (PigPenAggregateBy/buildAssembly (str pipe) pipes key-fields agg-fields inits funcs)]
-                                           (if (:group-all cogroup-opts)
-                                             (Discard. p (cfields ["group_all"]))
-                                             p))))
-
+        (partial-aggregation-code pipe inits funcs cogroup-opts field-projections flowdef)
         (let [key-separate-from-value (or (= udf :algebraic)
                                           (> (count (first (map :args code-defs))) (:num-streams cogroup-opts)))
               buffer (case (:group-type cogroup-opts)
@@ -137,12 +140,12 @@
 (defn- partial-aggregation
   [id is-group-all keys ancestors flowdef]
   (-> flowdef
-        (add-val [:pipes] id (Pipe. (str id)))
-        (add-val [:cogroup-opts] id {:group-id   id
-                                     :group-type :partial-aggregation
-                                     :keys       keys
-                                     :ancestors  ancestors
-                                     :group-all  is-group-all})))
+      (add-val [:pipes] id (Pipe. (str id)))
+      (add-val [:cogroup-opts] id {:group-id   id
+                                   :group-type :partial-aggregation
+                                   :keys       keys
+                                   :ancestors  ancestors
+                                   :group-all  is-group-all})))

 (defn- cogroup
   [id is-group-all keys ancestors join-types opts flowdef]
@@ -238,11 +241,10 @@
                   (if (= (:group-id pipe-opts) ancestor)
                     (add-val flowdef [:cogroup-opts] id pipe-opts)
                     flowdef))
-        flowdef (command->flowdef {:type              :code-def
-                                   :pipe              id
-                                   :field-projections field-projections
-                                   :code-defs         code-defs}
-                                  flowdef)]
+        flowdef (code->flowdef {:pipe              id
+                                :field-projections field-projections
+                                :code-defs         code-defs}
+                               flowdef)]
     flowdef))

 (defmethod command->flowdef :distinct


move this to the left a bit

move this to the left a bit

--- src/tabby/client_state.clj
+++ src/tabby/client_state.clj
@@ -32,10 +32,11 @@
    for each pending read.  This establishes
    the quorum count for each read."
   [clients src]
-  (utils/mapf clients (fn [client]
-                        (if (has-reads? client)
-                          (update-in client [:pending-read :hb-count] conj src)
-                          client))))
+  (utils/mapf clients
+              (fn [client]
+                (if (has-reads? client)
+                  (update-in client [:pending-read :hb-count] conj src)
+                  client))))

 (defn- handle-read-cas
   "handles compare-and-swap operations,


Mock :live handler for live profile

Mock :live handler for live profile

--- src/tabswitcher/popup.cljs
+++ src/tabswitcher/popup.cljs
@@ -20,6 +20,7 @@
     (go
       (>! bg :tabs)
       (let [tabs (<! bg)]
+        (dispatch [:assign-bg-chan bg])
         (dispatch [:update tabs])
         (console/log tabs))))


Enable numbered headings for audio book catalog

--- src/catalog/layout/fop.clj
+++ src/catalog/layout/fop.clj
@@ -44,10 +44,18 @@
   ([class attrs]
    (merge (*stylesheet* class {}) attrs)))

-(defn heading [level title path]
-  [:fo:block (style level
-                    {:id (hash path)})
-   (layout/translations title)])
+(defn- section-numbers [numbers]
+  (when (not-empty numbers)
+    (str (string/join "." numbers) ". ")))
+
+(defn heading
+  ([level title path]
+   (heading level title path []))
+  ([level title path numbers]
+   [:fo:block (style level
+                     {:id (hash path)})
+    (section-numbers numbers)
+    (layout/translations title)]))

 (def ^:private running-header-class-name "running-header")

@@ -60,6 +68,10 @@
 (defn- set-marker [title]
   [:fo:block {:keep-with-next "always"}
    [:fo:marker {:marker-class-name running-header-class-name} title]])
+
+(defn- add-number [coll number]
+  (when (not-empty coll)
+    (conj coll (inc number))))

 (defn- order
   "Return `items` ordered. Checks first if `items` are either a subset
@@ -77,17 +89,21 @@
       (keep items layout/subgenres))))

 (defn- toc-entry
-  ([items path depth]
-   (toc-entry items path depth 1))
-  ([items path depth current-depth]
-   [:fo:block (-> {:text-align-last "justify" :role "TOCI"}
-                  (cond-> (> current-depth 1) (assoc :start-indent "1em")))
+  ([items path numbers depth]
+   (toc-entry items path numbers depth 1))
+  ([items path numbers depth current-depth]
+   [:fo:block {:text-align-last "justify" :role "TOCI"
+               :start-indent (str (- current-depth 1) "em")}
     [:fo:basic-link {:internal-destination (hash path)}
-     (inline {:role "Reference"} (layout/translations (last path)))
+     (inline {:role "Reference"} (section-numbers numbers) (layout/translations (last path)))
      " " [:fo:leader {:leader-pattern "dots" :role "NonStruct"}] " "
      [:fo:page-number-citation {:ref-id (hash path) :role "Reference"}]]
     (when (and (map? items) (< current-depth depth))
-      (map #(toc-entry (% items) (conj path %) depth (inc current-depth)) (order (keys items))))]))
+      (letfn [(numbered-toc [number itm]
+                (toc-entry (get items itm) (conj path itm)
+                           (add-number numbers number)
+                           depth (inc current-depth)))]
+        (map-indexed #(numbered-toc %1 %2) (order (keys items)))))]))

 (defn- add-extra-headings [entries editorial? recommendation-at-end? single-recommendation?]
   (let [recommendation (if single-recommendation? :recommendation :recommendations)]
@@ -96,14 +112,15 @@
       editorial? (concat [:editorial recommendation] entries)
       :else entries)))

-(defn toc [items path depth & {:keys [heading? editorial? recommendation-at-end? single-recommendation?]}]
+(defn toc [items path depth &
+           {:keys [heading? editorial? recommendation-at-end? single-recommendation? numbered?]}]
   (when (map? items)
     [:fo:block {:line-height "150%"
                 :role "TOC"}
      (when heading? (heading :h1 :inhalt []))
      (let [entries (-> items keys order
-                    (add-extra-headings editorial? recommendation-at-end? single-recommendation?))]
-       (map #(toc-entry (get items %) (conj path %) depth) entries))]))
+                       (add-extra-headings editorial? recommendation-at-end? single-recommendation?))]
+       (map-indexed #(toc-entry (get items %2) (conj path %2) (if numbered? [(inc %1)] []) depth) entries))]))

 (defn- to-url
   "Return an url given a `record-id`"
@@ -278,22 +295,27 @@
 (defn- level-to-h [level]
   (keyword (str "h" level)))

-(defn subgenre-sexp [items fmt genre subgenre level]
-  [(heading (level-to-h level) subgenre [fmt genre subgenre])
+(defn subgenre-sexp [items fmt genre subgenre level numbers]
+  [(heading (level-to-h level) subgenre [fmt genre subgenre] numbers)
    (when-not (#{:kinder-und-jugendbücher} genre)
      (set-marker (layout/translations subgenre)))
    (entries-sexp items)])

-(defn subgenres-sexp [items fmt genre level]
-  (mapcat #(subgenre-sexp (get items %) fmt genre % level) (order (keys items))))
-
-(defn genre-sexp [items fmt genre level]
-  [(heading (level-to-h level) genre [fmt genre])
-   (set-marker (layout/translations genre))
-   (cond
-     (#{:kinder-und-jugendbücher} genre) (subgenres-sexp items fmt genre (inc level))
-     (#{:hörbuch} fmt) (subgenres-sexp items fmt genre (inc level))
-     :else (entries-sexp items))])
+(defn subgenres-sexp [items fmt genre level numbers]
+  (letfn [(numbered-subgenre [number subgenre]
+            (subgenre-sexp (get items subgenre) fmt genre subgenre level (add-number numbers number)))]
+    (apply concat (map-indexed #(numbered-subgenre %1 %2) (order (keys items))))))
+
+(defn genre-sexp
+  ([items fmt genre level]
+   (genre-sexp items fmt genre level []))
+  ([items fmt genre level numbers]
+   [(heading (level-to-h level) genre [fmt genre] numbers)
+    (set-marker (layout/translations genre))
+    (cond
+      (#{:kinder-und-jugendbücher} genre) (subgenres-sexp items fmt genre (inc level) numbers)
+      (#{:hörbuch} fmt) (subgenres-sexp items fmt genre (inc level) numbers)
+      :else (entries-sexp items))]))

 (defn format-sexp [items fmt level]
   [(heading (level-to-h level) fmt [fmt])
@@ -448,12 +470,15 @@

     (let [subitems (get items fmt)]
       [:fo:flow {:flow-name "xsl-region-body"}
-       (toc subitems [fmt] 3 :heading? true :editorial? true :recommendation-at-end? true)
+       (toc (select-keys items [fmt]) [] 3
+            :heading? true :editorial? true :recommendation-at-end? true :numbered? true)
        (block {:break-before "odd-page"}) ;; the very first format should start on recto
-       (heading :h1 :editorial [fmt :editorial])
-       (heading :h1 :hörbuch [fmt :hörbuch])
-       (mapcat #(genre-sexp (get subitems %) fmt % 2) (order (keys subitems)))
-       (heading :h1 :recommendations [fmt :recommendations])])]])
+       (heading :h1 :editorial [:editorial] [1])
+       (heading :h1 :hörbuch [:hörbuch] [2])
+       (letfn [(numbered-genre [number genre]
+                 (genre-sexp (get subitems genre) fmt genre 2 (add-number [2] number)))]
+         (apply concat (map-indexed #(numbered-genre %1 %2) (order (keys subitems)))))
+       (heading :h1 :recommendations [:recommendations] [3])])]])

 (defmethod document-sexp :all-formats
   [items _ {:keys [description date]}]


removed require of om header namespace

removed require of om header namespace

--- src/chat/client/views.cljs
+++ src/chat/client/views.cljs
@@ -7,7 +7,6 @@
             [chat.client.views.style :refer [style-view]]
             [braid.ui.views.sidebar :refer [sidebar-view]]
             [braid.ui.views.header :refer [header-view]]
-            [chat.client.views.header]
             [chat.client.views.pages.search :refer [search-page-view]]
             [chat.client.views.pages.inbox :refer [inbox-page-view]]
             [chat.client.views.pages.recent :refer [recent-page-view]]


print

print

--- src/ci3/repo/bitbucket.clj
+++ src/ci3/repo/bitbucket.clj
@@ -166,7 +166,7 @@
     (if-not (= (str/lower-case (:fullName repo))
                (get-in payload [:repository :fullName]))
       {::u/status :error
-       ::u/message "Invalid payload"})))
+       ::u/message (str "Invalid payload" repo payload)})))

 (defmethod interf/mk-build
   :bitbucket


Convert keywords to strings in the tag value as well

--- src/circle/backend/ec2.clj
+++ src/circle/backend/ec2.clj
@@ -231,7 +231,7 @@
   [instance-ids tags]
   (with-ec2-client client
     (let [request (CreateTagsRequest. instance-ids (for [[k v] tags]
-                                                     (Tag. (name k) v)))]
+                                                     (Tag. (name k) (name v))))]
       (.createTags client request))))

 (defn describe-tags


Refactor rule firing logic to be reusable in distributed systems.

--- src/clara/rules/engine.clj
+++ src/clara/rules/engine.clj
@@ -667,6 +667,30 @@

 (declare print-memory)

+(defn fire-rules*
+   "Fire rules for the given nodes."
+   [rulebase nodes transient-memory transport]
+   (binding [*current-session* {:rulebase rulebase
+                                :transient-memory transient-memory
+                                :transport transport
+                                :insertions (atom 0)}]
+
+     (loop [insertion-count 0]
+       (doseq [node nodes
+               token (get-tokens transient-memory node {})]
+
+         ;; Fire the node if it has not already been done for the token.
+         (when (not (is-fired-token transient-memory node token))
+           (binding [*rule-context* {:token token :node node}]
+             ((:rhs node) token)
+
+             ;; The rule fired for the given token, so mark it as such.
+             (mark-as-fired! transient-memory node token))))
+
+       ;; If the rules inserted new facts, re-fire to ensure they are accounted for.
+       (when (> (deref (:insertions *current-session*)) insertion-count)
+         (recur (deref (:insertions *current-session*)))))))
+
 (defrecord LocalSession [rulebase memory transport]
   ISession
   (insert [session facts]
@@ -688,25 +712,10 @@
   (fire-rules [session]

     (let [transient-memory (to-transient memory)]
-      (binding [*current-session* {:rulebase rulebase
-                                   :transient-memory transient-memory
-                                   :transport transport
-                                   :insertions (atom 0)}]
-        (loop [insertion-count 0]
-          (doseq [node (get-in session [:rulebase :production-nodes])
-                  token (get-tokens transient-memory node {})]
-
-            ;; Fire the node if it has not already been done for the token.
-            (when (not (is-fired-token transient-memory node token))
-              (binding [*rule-context* {:token token :node node}]
-                ((:rhs node) token)
-
-                ;; The rule fired for the given token, so mark it as such.
-                (mark-as-fired! transient-memory node token))))
-
-          ;; If the rules inserted new facts, re-fire to ensure they are accounted for.
-          (when (> (deref (:insertions *current-session*)) insertion-count)
-            (recur (deref (:insertions *current-session*)) ))))
+      (fire-rules* rulebase
+	               (get-in session [:rulebase :production-nodes])
+	               transient-memory
+	               transport)

       (->LocalSession rulebase (to-persistent! transient-memory) transport)))


fix Troll interaction with Adjusted Chronotype

--- src/clj/game/cards-ice.clj
+++ src/clj/game/cards-ice.clj
@@ -880,10 +880,11 @@
                                   :prompt "Choose one"
                                   :choices ["Lose [Click]" "End the run"]
                                   :effect (req (if-not (and (= target "Lose [Click]")
-                                                            (pay state side card :click 1))
+                                                            (apply pay state side card [:click 1]))
                                                  (do (end-run state side)
                                                      (system-msg state side "ends the run"))
-                                                 (system-msg state side "loses [Click]")))})]}
+                                                 (do (lose state side :click 1)
+                                                     (system-msg state side "loses [Click]"))))})]}

    "Tsurugi"
    {:abilities [end-the-run


add test for Excalibur

add test for Excalibur

--- src/clj/test/cards-ice.clj
+++ src/clj/test/cards-ice.clj
@@ -191,6 +191,26 @@
       (core/rez state :corp enig)
       (card-ability state :corp enig 0)
       (is (= 2 (:click (get-runner))) "Runner lost 1 click"))))
+
+(deftest excalibur
+  "Excalibur - Prevent Runner from making another run this turn"
+  (do-game
+    (new-game (default-corp [(qty "Excalibur" 1)])
+              (default-runner [(qty "Stimhack" 1)]))
+    (play-from-hand state :corp "Excalibur" "HQ")
+    (take-credits state :corp)
+    (let [excal (get-ice state :hq 0)]
+      (run-on state "HQ")
+      (core/rez state :corp excal)
+      (card-ability state :corp excal 0)
+      (run-jack-out state)
+      (run-on state "R&D")
+      (is (not (:run @state)) "No run initiated")
+      (is (= 3 (:click (get-runner))))
+      (play-from-hand state :runner "Stimhack")
+      (is (not (:run @state)) "No run initiated")
+      (is (= 3 (:click (get-runner))))
+      (is (empty? (:discard (get-runner))) "Card not played from Grip"))))

 (deftest fenris
   "Fenris - Illicit ICE give Corp 1 bad publicity when rezzed"


handle vertical bars as spaces in FASTA parser

--- src/cljam/fasta/reader.clj
+++ src/cljam/fasta/reader.clj
@@ -18,14 +18,22 @@
   [line]
   (= (first line) \>))

+(def ^:private vertial-bar (char 0x7c))
+
+(defn- vertial-bar?
+  [c]
+  (= c vertial-bar))
+
 (defn- parse-header-line
   [line]
   (let [line (subs line 1)]
     {:name (->> line
-                (take-while (complement space?))
+                (take-while #(and ((complement space?) %)
+                                  ((complement vertial-bar?) %)))
                 (apply str))
      :desc (->> line
-                (drop-while (complement space?))
+                (drop-while #(and ((complement space?) %)
+                                  ((complement vertial-bar?) %)))
                 (drop 1)
                 (apply str))}))