fix consume lock errors

fix consume lock errors

--- kafka-clj/src/kafka_clj/consumer.clj
+++ kafka-clj/src/kafka_clj/consumer.clj
@@ -38,6 +38,8 @@
  (defn get-partitions-to-lock [topic broker-offsets members]
    "broker-offsets {broker {topic [{:partition :offset :topic}]}}
     Returns the number of partitions that should be locked"
+   ;;TODO the problem is that the partitions that were marked as locked are not locked in broker-offsets, i.e. the locked
+   ;;attribute is not kept in the map
    (try
 	   (let [broker-partitions (filter #(= (:topic %) topic) (flatten-broker-partitions broker-offsets))
 	         partition-count (count broker-partitions)
@@ -45,7 +47,7 @@
 	         e (long (/ partition-count (count members)))
 	         l (rem partition-count (count members))]

-	     ;(prn "members " members " partition-count " partition-count " locked-partition-count " locked-partition-count " e " e " l " l )
+	     (info "members " members " partition-count " partition-count " locked-partition-count " locked-partition-count " e " e " l " l )
 	     [(if (> e locked-partition-count) (count (get-add-partitions broker-partitions e)) 0)
 	      (if (> locked-partition-count e) (count (get-remove-partitions broker-partitions (- locked-partition-count e))) 0)
 	      l
@@ -58,10 +60,16 @@

  ;------- end of partition lock and release api

-(defn get-rest-of-partitions [broker topic partition state]
+(defn- get-rest-of-partitions [broker topic partition state]
   "state should be {broker {topic [{:partition :offset :topic}... ] }}
    This method will return all of the data for a broker topic that does not have :partition == partition"
   (filter #(not (= (:partition %) partition)) (-> state (get broker) (get topic))))
+
+(defn- get-current-partition [broker topic partition state]
+  "state should be {broker {topic [{:partition :offset :topic}... ] }}
+   This method will return all of the data for a broker topic that does not have :partition == partition"
+  (first (filter #(= (:partition %) partition) (-> state (get broker) (get topic)))))
+

 (defn get-partition [broker topic partition state]
   "state should be {broker {topic [{:partition :offset :topic}... ] }}
@@ -69,7 +77,7 @@
   (first (filter #(= (:partition %) partition) (-> state (get broker) (get topic)))))

-(defn merge-broker-offsets [state d]
+(defn merge-broker-offsets [curr-state d]
   "D is a collection of messages one per topic partition, that were last consumed from a fetch request,
    state is the broker-offsets {broker {topic [{:partition :offset :topic}]}}
    The function will merge d with state so that state will contain the latest offsets d,
@@ -77,22 +85,24 @@
    "
   ;(info "merge " state " with " d)
   ;(prn "state d " d)
-  ;(clojure.pprint/pprint state)
+  ;(clojure.pprint/pprint curr-state)
   (let [r (reduce (fn [state [broker messages]]
-                    (reduce (fn [state {:keys [topic partition offset error-code locked]}]
-                               (merge-with merge
+                    (reduce (fn [state {:keys [topic partition offset error-code]}]
+                              ;note that the record fomr which the keys are drawn does not have the locked key
+                              ;(info "$$$$ current record " (get-current-partition broker topic partition state))
+                              (merge-with merge
                                  state
 			                           (if (or (not error-code) (= error-code 0))
                                    {broker
 			                                 {topic
 			                                      (conj (get-rest-of-partitions broker topic partition state)
-			                                            {:offset (inc offset) :locked locked
+			                                            {:offset (inc offset) :locked (:locked (get-current-partition broker topic partition state))
                                                    :partition partition :error-code (if error-code error-code 0)  })
                                          }
                                       })))
-                            state messages))
-          state d)]
-   ; (clojure.pprint/pprint ["r " r])
+                            curr-state messages))
+          curr-state d)]
+    ;(clojure.pprint/pprint ["r " r])
     r))

 (defn- get-latest-offset [k current-offsets resp]
@@ -189,39 +199,51 @@
          (info "No messages consumed " fetch-res)
          nil))))

+
+(defn- get-locked-partitions [topic-offsets]
+  "Get the locked partitions"
+  (map (fn [[k v]]
+         (tuple k
+           (filter
+             :locked
+             v)))
+    topic-offsets))
+
 (defn send-request-and-wait [producer group-conn topic-offsets msg-ch {:keys [^Histogram m-message-size
                                                                               ^Meter m-consume-reads fetch-timeout]
                                                                        :or {fetch-timeout 60000} :as conf}]
   "Returns [the messages, and fetch errors], if any error was or timeout was detected the function returns otherwise it waits for a FetchEnd message
    and returns.
   "
-  ;(info "!!!!!!send fetch " (:broker producer) " "  (map (fn [[k v]] [k v]) topic-offsets))
-  (send-fetch producer (map (fn [[k v]] [k v]) topic-offsets))
-
-  (let [
-        persister (get-persister group-conn conf)
-        {:keys [read-ch error-ch]} (:client producer)
-        current-offsets (into {} (for [[topic v] topic-offsets
-                                        msg   v]
-                                      [#{topic (:partition msg)} (assoc msg :topic topic) ]))]
-
-      (let [[v c] (alts!! [read-ch error-ch (timeout fetch-timeout)])]
-        ;(info "Got message " (count v ) " is read " (= c read-ch) " is error " (= c error-ch))
-        (try
-	        (cond
-	          (= c read-ch)
-            ;;read-fetch will navigate and process the fetch response, sending messages to msg-ch
-	          (read-fetch-message persister current-offsets msg-ch m-consume-reads m-message-size v)
-	          (= c error-ch)
-	          (do
-	            (error v v)
-	            [[] [{:error v}]])
-	          :else
-	          (do
-	            (error "timeout reading from " (:broker producer))
-	            [[] [{:error (RuntimeException. (str "Timeout while waiting for " (:broker producer)))}]]
-	            ))
-         (finally ((:p-close persister)))))))
+  (let [locked-partitions (get-locked-partitions topic-offsets)]
+      (do
+	      (info "!!!!!!send fetch " (:broker producer) " "  locked-partitions)
+			  (send-fetch producer locked-partitions)
+
+			  (let [
+			        persister (get-persister group-conn conf)
+			        {:keys [read-ch error-ch]} (:client producer)
+			        current-offsets (into {} (for [[topic v] topic-offsets
+			                                        msg   v]
+			                                      [#{topic (:partition msg)} (assoc msg :topic topic) ]))]
+
+			      (let [[v c] (alts!! [read-ch error-ch (timeout fetch-timeout)])]
+			        ;(info "Got message " (count v ) " is read " (= c read-ch) " is error " (= c error-ch))
+			        (try
+				        (cond
+				          (= c read-ch)
+			            ;;read-fetch will navigate and process the fetch response, sending messages to msg-ch
+				          (read-fetch-message persister current-offsets msg-ch m-consume-reads m-message-size v)
+				          (= c error-ch)
+				          (do
+				            (error v v)
+				            [[] [{:error v}]])
+				          :else
+				          (do
+				            (error "timeout reading from " (:broker producer))
+				            [[] [{:error (RuntimeException. (str "Timeout while waiting for " (:broker producer)))}]]
+				            ))
+			         (finally ((:p-close persister)))))))))

 (defn consume-broker [producer group-conn topic-offsets msg-ch conf]
@@ -388,7 +410,16 @@

         )))

+(defn- release-partition [group-conn topic partition conf]
+  (if-let [host (get conf :host-name nil)]
+    (release group-conn host (str topic "/" partition))
+    (release group-conn (str topic "/" partition))))

+(defn- lock-partition [group-conn topic partition conf]
+  (if-let [host (get conf :host-name nil)]
+    (reentrant-lock group-conn host (str topic "/" partition))
+    (reentrant-lock group-conn (str topic "/" partition))))
+
 (defn calculate-locked-offsets [topic group-conn broker-offsets conf]
   "broker-offsets have format  {broker {topic [{:partition :offset :topic}]}}
    calculate which offsets should be consumed based on the locks and other members
@@ -404,20 +435,28 @@
                                  (cond
                                    (and locked (> remove-i 0))
                                    (do
-                                     (if-let [host (get conf :host-name nil)] (release group-conn host (str topic "/" partition))
-                                           (release group-conn (str topic "/" partition)))
+                                     (info ">>>>>>>>>>>>>>>>>>>>>>>>>>> calling release on " topic "/" partition)
+                                     (release-partition group-conn topic partition conf)
                                      (recur (change-partition-lock group-conn broker-offsets1 broker topic partition false conf)
                                             locked-i (dec remove-i) l-i (rest partitions)))
-                                    (and (not locked) (or (> locked-i 0) (> l-i 0))
-                                         (if-let [host (get conf :host-name nil)]  (reentrant-lock group-conn host (str topic "/" partition))
-	                                                                       (reentrant-lock group-conn (str topic "/" partition))))
-                                    ;here we know that we have a lock
-		                                (recur (change-partition-lock group-conn
-			                                                                 broker-offsets1
-												                                               broker topic partition
-												                                               true
-			                                                                 conf)
-		                                           (dec locked-i) remove-i (if (> locked-i 0) l-i (dec l-i)) (rest partitions))
+                                    (and (not locked) (or (> locked-i 0) (> l-i 0)))
+                                         (do
+                                           (info "======== calling lock on =========== " (str topic "/" partition))
+                                           (if (lock-partition group-conn topic partition conf)
+                                              ;here we know that we have a lock
+							                                (recur (change-partition-lock group-conn
+								                                                                 broker-offsets1
+																	                                               broker topic partition
+																	                                               true
+								                                                                 conf)
+                                                     (dec locked-i) remove-i (if (> locked-i 0) l-i (dec l-i)) (rest partitions))
+                                               (do
+                                                 (info ">>>>>>>>>>>>>>>>>>>>>>>>>>> calling release on " topic "/" partition)
+                                                 (release-partition group-conn topic partition conf)
+                                                 (recur (change-partition-lock group-conn broker-offsets1 broker topic partition false conf)
+                                                   locked-i (dec remove-i) l-i (rest partitions)))))
+
+

                                     :else
                                     (recur broker-offsets1 locked-i remove-i l-i (rest partitions))))
@@ -425,7 +464,7 @@
                                  broker-offsets1))]

-	          ;(clojure.pprint/pprint broker-offsets1)
+	          (clojure.pprint/pprint broker-offsets1)
 	          broker-offsets1

 	        ))
@@ -466,10 +505,7 @@
 			         (error "Error close and reconnect: " errors)

 			         (let [[producers broker-offsets] (close-and-reconnect conn bootstrap-brokers producers topics errors conf)]
-	                ;;here we need to delete the offsets that have had errors from the storage
-	                ;;or better yet set them to storage
-                 ;persist-error-offsets [group-conn broker-offsets errors conf]
-                  (info "Got new consumers " (map :broker producers))
+	                (info "Got new consumers " (map :broker producers))
 	                (persist-error-offsets group-conn broker-offsets errors conf)
                   (.stop timer-ctx)
 			            (recur producers broker-offsets)))
@@ -478,11 +514,9 @@
 	               (do (info "sleep: " fetch-poll-ms) (<!! (timeout fetch-poll-ms))))

                (.stop timer-ctx)
-               (let [r (update-broker-offsets broker-offsets2 v)]
-
-               (recur producers r))))
+               (recur producers (update-broker-offsets broker-offsets2 v)))))

-			      ))))
+			      )))

 (defn consume [conn bootstrap-brokers group-conn msg-ch topics conf]
   "Entry point for topic consumption,


Exclude potemkin as om-tools dependency, closes #63

Prevent dependency hell issues when using om-tools.

--- src/leiningen/new/chestnut.clj
+++ src/leiningen/new/chestnut.clj
@@ -41,7 +41,7 @@
 (defn project-clj-deps [opts]
   (cond-> []
           (http-kit? opts) (conj "http-kit \"2.1.19\"")
-          (om-tools? opts) (conj "prismatic/om-tools \"0.3.3\" :exclusions [org.clojure/clojure]")))
+          (om-tools? opts) (conj "prismatic/om-tools \"0.3.9\" :exclusions [potemkin]")))

 (defn project-dev-deps [opts]
   (cond-> []


Remove spurious space char

Remove spurious space char

--- src/leiningen/new/chestnut.clj
+++ src/leiningen/new/chestnut.clj
@@ -20,7 +20,7 @@
   (wrap-indent identity n list))

 (def valid-options
-  ["http-kit" "site-middleware" "om-tools" "cljx" "less" "sass" "speclj" ])
+  ["http-kit" "site-middleware" "om-tools" "cljx" "less" "sass" "speclj"])

 (doseq [opt valid-options]
   (eval


Work on Even Squares extra errors

Work on Even Squares extra errors

--- src/clojush/problems/software/even_squares.clj
+++ src/clojush/problems/software/even_squares.clj
@@ -73,23 +73,32 @@
         (the-actual-even-squares-error-function program data-cases false))
       ([program data-cases print-outputs]
         (let [behavior (atom '())
-              errors (doall
-                       (for [[input1 correct-output] (case data-cases
-                                                                  :train train-cases
-                                                                  :test test-cases
-                                                                  [])]
-                         (let [final-state (run-push program
-                                                     (->> (make-push-state)
-                                                       (push-item input1 :input)
-                                                       (push-item "" :output)))
-                               result (stack-ref :output 0 final-state)]
-                           (when print-outputs
-                             (println (format "| Correct output: %s\n| Program output: %s\n" (pr-str correct-output) (pr-str result))))
-                           ; Record the behavior
-                           (when @global-print-behavioral-diversity
-                             (swap! behavior conj result))
-                           ; Error is Levenshtein distance of printed strings
-                           (levenshtein-distance correct-output result))))]
+              errors (flatten
+                       (doall
+                         (for [[input1 correct-output] (case data-cases
+                                                         :train train-cases
+                                                         :test test-cases
+                                                         [])]
+                           (let [final-state (run-push program
+                                                       (->> (make-push-state)
+                                                         (push-item input1 :input)
+                                                         (push-item "" :output)))
+                                 result (stack-ref :output 0 final-state)]
+                             (when print-outputs
+                               (println (format "| Correct output: %s\n| Program output: %s\n" (pr-str correct-output) (pr-str result))))
+                             ; Record the behavior
+                             (when @global-print-behavioral-diversity
+                               (swap! behavior conj result))
+                             (vector
+                               ; Error 1: Levenshtein distance of printed strings
+                               (levenshtein-distance correct-output result)
+                               ; Error 2: difference in number of lines with integer-parseable strings
+                               (let [correct-number-lines (count (filter #(= % \newline) correct-output))]
+
+
+                                 )
+                               ; Error 3: For each line in the result, find the integer error compared to correct integer. Sum these.
+                               )))))]
           (when @global-print-behavioral-diversity
             (swap! population-behaviors conj @behavior))
           errors)))))
@@ -124,7 +133,7 @@
    :atom-generators even-squares-atom-generators
    :max-points 400
    :max-points-in-initial-program 200
-   :evalpush-limit 1000
+   :evalpush-limit 2000
    :population-size 1000
    :max-generations 300
    :parent-selection :lexicase
@@ -142,3 +151,58 @@
    :final-report-simplifications 5000
    :max-error 5000
    })
+
+;;;;;
+
+;| Correct output: "4"
+;| Program output: "4\n1514"
+;
+;| Correct output: "4"
+;| Program output: ""
+;
+;| Correct output: "4\n16"
+;| Program output: "4\n1716"
+;
+;| Correct output: "4\n16"
+;| Program output: "4\n1817"
+;
+;| Correct output: "4\n16\n36\n64\n100\n144\n196\n256\n324\n400\n484\n576\n676\n784\n900\n1024\n1156\n1296\n1444\n1600\n1764\n1936\n2116\n2304\\
+;n2500\n2704\n2916\n3136\n3364\n3600\n3844\n4096\n4356\n4624\n4900\n5184\n5476\n5776\n6084\n6400\n6724\n7056\n7396\n7744\n8100\n8464\n8836\n921\
+;6"
+;| Program output: "4\n16\n36\n64\n100\n144\n196\n256\n324\n400\n484\n576\n676\n784\n900\n1024\n1156\n1296\n1444\n1600\n1764\n1936\n2116\n2304\\
+;n2500\n2704\n2916\n3136\n3364\n3600\n3844\n4096\n4356\n4624\n4900\n5184\n5476\n5776"
+;
+;| Correct output: "4\n16\n36\n64\n100\n144\n196\n256\n324\n400\n484\n576\n676\n784\n900\n1024\n1156\n1296\n1444\n1600\n1764\n1936\n2116\n2304\\
+;n2500\n2704\n2916\n3136\n3364\n3600\n3844\n4096\n4356\n4624\n4900\n5184\n5476\n5776\n6084\n6400\n6724\n7056\n7396\n7744\n8100\n8464\n8836\n921\
+;6\n9604"
+;| Program output: "4\n16\n36\n64\n100\n144\n196\n256\n324\n400\n484\n576\n676\n784\n900\n1024\n1156\n1296\n1444\n1600\n1764\n1936\n2116\n2304\\
+;n2500\n2704\n2916\n3136\n3364\n3600\n3844\n4096\n4356\n4624\n4900\n5184\n5476\n5776"
+
+;;;;;;;;;;
+;; Below here is for testing a hand-written solution.
+
+;(reset! global-evalpush-limit 2000)
+;
+;(reset! global-max-points 400)
+;
+;(defn test-program-on-training
+;  [program print-outputs]
+;  ((even-squares-error-function even-squares-data-domains) program :train print-outputs))
+;
+;(def tom-program
+;  '(
+;     4 in1 integer_lt
+;     exec_when
+;     (
+;       4 print_integer
+;       4 integer_dup integer_dup integer_mult integer_dup in1 integer_lt
+;       exec_while
+;       (
+;         print_newline print_integer
+;         integer_inc integer_inc
+;         integer_dup integer_dup integer_mult integer_dup in1 integer_lt
+;         )
+;       )
+;     ))
+;
+;(test-program-on-training tom-program false)


Prettify graphs for tech report

Prettify graphs for tech report

--- src/edu/berkeley/ai/scripts/z09_icaps08_tr.clj
+++ src/edu/berkeley/ai/scripts/z09_icaps08_tr.clj
@@ -170,10 +170,13 @@
 	      *offline*)
       [:type :graph? :ref-choice :algorithm ]
       :instance-num y-axis
-      {:term "solid color size 3,2"
+      {:term "solid dashed size 3,2"
        :ylog "t" :key "12,100000" :yrange "[10:200000]" :xlabel "Problem Number" :ylabel y-label
-       :title "Offline Warehouse World" }
-      (constantly {:lw 4})
+       :title "Offline Warehouse World"
+       }
+      (let [c (util/counter-from 0)]
+	(fn [& args] (let [v ([1 2 3] (c))]  {:lw 3 :pt v :lt v})))
+;      (constantly {:lw 4 :pt [2 3 4]})
       (fn [[type graph ref-choice alg]]
 	(cond (= alg :ahss) "AHSS" (= type :hierarchy) "AHA*" :else "Graph A*"))
       identity)
@@ -190,12 +193,14 @@
 	    (fn [m] [(:run m) (y-axis m)])]]))
       [:type :graph? :ref-choice :algorithm :switches]
       :size :ref-count
-      {:term "solid color size 3,2"
+      {:term "solid dashed size 3,2"
        :ylog "t" :xlog "t" :key "45,100000"
        :title "Offline Nav Switch"
        :xlabel "Board size (per side)" :ylabel y-label
        :xrange "[5:1000]" :yrange "[50:200000]"}
-      (constantly {:lw 4})
+      (let [c (util/counter-from 0)]
+	(fn [& args] (let [v ([1 2 3] (c))]  {:lw 3 :pt v :lt v})))
+;      (constantly {:lw 4})
       (fn [[type graph ref-choice alg]]
 	(cond (= alg :ahss) "AHSS" (= type :hierarchy) "AHA*" :else "Graph A*"))
       identity)
@@ -302,11 +307,13 @@
 	 [[:cost combiner-fn (datasets/ds-fn [cost] cost)]])
        [:algorithm :type :ref-choice]
        :max-refs :cost
-       {:term "solid color size 3,2" :xrange "[0:5000]" :yrange "[70:3000]" :key "3000, 1800"
+       {:term "solid dashed size 3,2" :xrange "[0:5000]" :yrange "[70:3000]" :key "3000, 1800"
 	:title (str "Online Warehouse World") :ylog "t"
 	:xlabel "Allowed refinements per env step"
 	:ylabel "Cost to reach goal (avg of 7 instances)"}
-      (constantly {:lw 4})
+      (let [c (util/counter-from 0)]
+	(fn [& args] (let [v ([1 2 3] (c))]  {:lw 3 :pt v :lt v})))
+;      (constantly {:lw 4})
       (fn [[alg type ref-choice]]
 	(cond (= alg :ahss) "AHSS" (= type :hierarchy) "AHLRTA*" :else "LRTA*"))
       identity)
@@ -324,13 +331,15 @@
 	[[:cost (fn [& args] (apply util/geometric-mean args)) (datasets/ds-fn [cost] cost)]])
       [:algorithm :type :ref-choice]
       :max-refs :cost
-      {:term "solid color size 3,2" :xrange (str "[10:" maxx "]")
+      {:term "solid dashed size 3,2" :xrange (str "[10:" maxx "]")
        ;:xlog "t"
        :key keyloc
        :title (str "Online Nav Switch " sz "x" sz ", 20 switches")
        :xlabel "Allowed refinements per env step"
        :ylabel "Cost to reach goal (avg of 3 random instances)" }
-      (constantly {:lw 4})
+;      (constantly {:lw 4})
+      (let [c (util/counter-from 0)]
+	(fn [& args] (let [v ([1 2 3] (c))]  {:lw 3 :pt v :lt v})))
       (fn [[alg type ref-choice]]
 	(cond (= alg :ahss) "AHSS" (= type :hierarchy) "AHLRTA*" :else "LRTA*"))
       identity)


Fixes redirect on user/profile.

Fixes redirect on user/profile.

--- src/cadence/views/user.clj
+++ src/cadence/views/user.clj
@@ -41,7 +41,7 @@
             " This should change in the near future."]]]]]])
     (do
       (flash/put! :error (str "You cannot access " username "'s page."))
-      (resp/redirect (str "/user/" (m/identity))))))
+      (resp/redirect (str "/user/profile/" (m/identity))))))

 (defpage user-profile-default "/user/profile" []
   ; Simply forward /user/profile acesses to that of the signed in user.


reflow docstrings

reflow docstrings

--- src/caesium/crypto/box.clj
+++ src/caesium/crypto/box.clj
@@ -6,9 +6,11 @@
            org.abstractj.kalium.crypto.Box))

 (defn generate-keypair
-  "Generate a secret-key and corresponding public-key with `crypto_box_curve25519xsalsa20poly1305_keypair`.
+  "Generate a secret key and corresponding public key with
+  `crypto_box_curve25519xsalsa20poly1305_keypair`.

-  If secret-key is provided as an argument, generate the corresponding public-key with `crypto_scalarmult_curve25519`.
+  If secret key is provided as an argument, generate the corresponding
+  public key with `crypto_scalarmult_curve25519`.

   Returns a map containing the public and private key bytes (mutable arrays)."
   ([]
@@ -35,7 +37,8 @@
 (defn decrypt
   "Decrypt with `crypto_box_curve25519xsalsa20poly1305_beforenm` and `crypto_box_curve25519xsalsa20poly1305_open_afternm`.

-  Please note that contrary to Kalium, it only accepts keys in byte array form. It also returns a mutable byte array."
+  Please note that contrary to Kalium, it only accepts keys in byte
+  array form. It also returns a mutable byte array."
   [^bytes public-key
    ^bytes secret-key
    nonce


Fixes #273.

Fixes #273.

--- src/onyx/log/commands/prepare_join_cluster.clj
+++ src/onyx/log/commands/prepare_join_cluster.clj
@@ -93,7 +93,7 @@
            (do
              (extensions/write-log-entry
               (:log state)
-              {:fn :leave-cluster :args {:id (:subject diff)}})
+              {:fn :leave-cluster :args {:id (:observer diff)}})
              state)
            state)
          (= (:id state) (:instant-join diff))


get job by tid

get job by tid

--- src/celestial/api/jobs.clj
+++ src/celestial/api/jobs.clj
@@ -128,4 +128,8 @@
         {:keys [username]} (friend/current-authentication)
         {:keys [envs] :as user} (u/get-user username)
         {:keys [total hits]} (es/paginate (* (- page* 1) offset*) offset* envs)]
-       (success {:jobs (map #(-> % :_source add-tid-link) hits) :total total}))))
+       (success {:jobs (map #(-> % :_source add-tid-link) hits) :total total})))
+
+  (GET- "/jobs/done/:tid" [^:string tid ]
+      {:nickname "getDoneJobByTid" :summary "Get a done job using its tid"}
+     (success (es/get tid))))


add react keys

add react keys

--- src/chat/client/views.cljs
+++ src/chat/client/views.cljs
@@ -64,7 +64,8 @@
         (om/build thread-tags-view thread)
         (apply dom/div #js {:className "messages"}
           (om/build-all message-view (->> (thread :messages)
-                                          (sort-by :created-at))))
+                                          (sort-by :created-at))
+                        {:key :id}))
         (om/build new-message-view {:thread-id (thread :id) :placeholder "Reply..."})))))

 (defn new-thread-view [data owner]
@@ -131,7 +132,7 @@
               (dom/div #js {:className "logout"
                             :onClick (fn [_] (dispatch! :logout nil))} "Log Out")))
           (apply dom/div #js {:className "threads"}
-            (concat (om/build-all thread-view threads)
+            (concat (om/build-all thread-view threads {:key :id})
                     [(om/build new-thread-view {})])))))))

 (defn login-view [data owner]


need to supply our own deps file for Node.js to load

--- src/clj/cljs/repl/node.clj
+++ src/clj/cljs/repl/node.clj
@@ -89,17 +89,23 @@
                       (assoc opts
                         :output-file (closure/src-file->target-file core)))
             deps    (closure/add-dependencies opts core-js)]
-        (apply closure/output-unoptimized opts deps))
+        (apply closure/output-unoptimized
+          (assoc opts
+            :output-to (.getPath (io/file output-dir "node_repl_deps.js")))
+          deps))
       ;; bootstrap, replace __dirname as __dirname won't be set
       ;; properly due to how we are running it - David
-      (let [rewrite-path (str (.getName (.getCanonicalFile output-dir))
-                           File/separator "goog")]
+      (let [root-path (.getCanonicalFile output-dir)
+            rewrite-path (str (.getPath root-path) File/separator "goog")]
         (node-eval repl-env
           (-> (slurp (io/resource "cljs/bootstrap_node.js"))
             (string/replace "__dirname"
               (str "\"" (str rewrite-path File/separator "bootstrap") "\""))
-            (string/replace "./.." (str "." File/separator rewrite-path)))))
-      (repl/load-file repl-env core opts)
+            (string/replace "./.." rewrite-path)))
+        (node-eval repl-env
+          (str "require('"
+            (.getPath root-path)
+            File/separator "node_repl_deps.js')")))
       ;(repl/evaluate-form repl-env
       ;  env "<cljs repl>"
       ;  '(set! *print-fn* (fn [x] (js/node_repl_print (pr-str x)))))


fix Burke Bugs, improve Markus 1.0 and Information Overload

--- src/clj/game/cards-ice.clj
+++ src/clj/game/cards-ice.clj
@@ -56,7 +56,10 @@
                                      (move state side card (conj (server->zone state target) :ices)))}}}]}

    "Burke Bugs"
-   {:abilities [trash-program]}
+   {:abilities [{:label "Trace 0 - Force the Runner to trash a program"
+                 :trace (assoc trash-program :base 0 :not-distinct true
+                                             :player :runner
+                                             :msg (msg "force the Runner to trash " (:title target)))}]}

    "Caduceus"
    {:abilities [{:label "Trace 3 - Gain 3 [Credits]"
@@ -267,7 +270,11 @@

    "Information Overload"
    {:abilities [{:label "Trace 1 - Give the Runner 1 tag"
-                 :trace {:base 1 :msg "give the Runner 1 tag" :effect (effect (gain :runner :tag 1))}}]}
+                 :trace {:base 1 :msg "give the Runner 1 tag" :effect (effect (gain :runner :tag 1))}}
+                (assoc trash-installed :label "Force the Runner to trash an installed card"
+                                       :player :runner
+                                       :msg (msg "force the Runner to trash " (:title target))
+                                       :effect (effect (trash target)))]}

    "Ireress"
    {:abilities [{:msg "make the Runner lose 1 [Credits]" :effect (effect (lose :runner :credit 1))}]}
@@ -326,7 +333,10 @@
                                    :effect (effect (add-prop :runner card :counter 1))}}}]}

    "Markus 1.0"
-   {:abilities [{:msg "force the Runner to trash a card"}
+   {:abilities [(assoc trash-installed :label "Force the Runner to trash an installed card"
+                                       :player :runner
+                                       :msg (msg "force the Runner to trash " (:title target))
+                                       :effect (effect (trash target)))
                 {:msg "end the run" :effect (effect (end-run))}]}

    "Matrix Analyzer"


disable service TS until aggregation done

--- src/clj/swarmpit/stats.clj
+++ src/clj/swarmpit/stats.clj
@@ -142,13 +142,16 @@
                      (first)
                      (get "values"))))

-(defn services-timeseries
-  "Get services timeseries data for last 24 hours"
-  []
-  (map #(m/->task-ts %)
-       (-> (influx/read-service-stats)
-           (first)
-           (get "series"))))
+;(defn services-timeseries
+;  "Get services timeseries data for last 24 hours"
+;  []
+;  (map #(m/->task-ts %)
+;       (-> (influx/read-service-stats)
+;           (first)
+;           (get "series"))))
+
+(defn services-timeseries []
+  [])

 (def services-timeseries-memo (memo/ttl services-timeseries :ttl/threshold 60000))


New command: congrats

New command: congrats

--- src/clj_mrazik/irc_bot.clj
+++ src/clj_mrazik/irc_bot.clj
@@ -160,6 +160,23 @@
 (defn dictionary-status
     []
     (str "Number of terms in dictionary: " (dictionary/term-count)))
+
+(defn congrats?
+    [input]
+    (re-matches #"congrats [a-zA-Z0-9]+" input))
+
+(defn congratulate-to
+    [name]
+    (let [messages ["%s, you continue to be amazing and inspiring. Congratulations!"
+                    "Woohoo !! Way to go %s! Congratulations"
+                    "That is an awesome accomplishment %s"]
+          message (rand-nth messages)]
+    (format message name)))
+
+(defn congratulate
+    [input]
+    (let [name (second (re-matches #"congrats ([a-zA-Z0-9]+)" input))]
+        (congratulate-to name)))

 (defn prepare-reply-text
     [incomming-message nick input-text]
@@ -196,6 +213,7 @@
                               (and number-cruncher? (is-two-numbers? input))          (print-gcd input)
                               (and number-cruncher? (is-factorial? input))            (print-factorial input)
                               (and s-expressions?   (is-s-expression? input))         (s-expression input)
+                              (congrats? input)                                       (congratulate input)
                               (is-word-from-dictionary? input) (return-words-from-dictionary input)
                               (one-word-like-this? input)      (return-word-like-this input)
                               (more-words-like-this? input)    (return-more-words-like-this input)


Basic Ranking component

Basic Ranking component

--- src/cljs/ladders/core.cljs
+++ src/cljs/ladders/core.cljs
@@ -4,12 +4,31 @@
               [secretary.core :as secretary :include-macros true]
               [accountant.core :as accountant]))

-;; -------------------------
-;; Views
+(def rankings
+  [{:player "Jeff" :stats {:wins 10 :losses 15}}
+   {:player "Dennis" :stats {:wins 9 :losses 25}}])
+
+(defn ranking-row [rank player]
+  ^{:key (:player player)}
+  [:tr
+   [:td (inc rank)]
+   [:td (:player player)]
+   [:td (-> player :stats :wins)]
+   [:td (-> player :stats :losses)]])
+
+(defn rankings-component [rankings]
+  [:table {:class "table table-hover"}
+   [:tr
+    [:th "Ranking"]
+    [:th "Player"]
+    [:th "Wins"]
+    [:th "Losses"]]
+   (map-indexed ranking-row rankings)])

 (defn home-page []
-  [:div [:h2 "Welcome to ladders"]
-   [:div [:a {:href "/about"} "go to about page"]]])
+  [:div [:h2 "Current Rankings"]
+        [:h3 "Week 1"]
+   [rankings-component rankings]])

 (defn about-page []
   [:div [:h2 "About ladders"]
@@ -17,6 +36,7 @@

 (defn current-page []
   [:div [(session/get :current-page)]])
+

 ;; -------------------------
 ;; Routes


Extract width into application state

Extract width into application state

--- src/cljs/pizarra/core.cljs
+++ src/cljs/pizarra/core.cljs
@@ -9,7 +9,8 @@

 (def app-state
   (atom {:canvas {:dimensions {:width 800 :height 400}
-                  :actions []}}))
+                  :actions []}
+         :tools {:width 4}}))

 (defprotocol Drawable
   (-draw [this context]))
@@ -37,7 +38,7 @@
   (->LineAction [] {:strokeStyle "#000000"
                     :lineCap "round"
                     :lineJoin "round"
-                    :lineWidth 4}))
+                    :lineWidth (get-in @app-state [:tools :width])}))
 (def line-tool
   (reify
     ITool
@@ -133,4 +134,6 @@

 (deref app-state)

+(swap! app-state update-in [:tools] assoc :width 3)
+
 )


add fn-macros back in to make sure defmacro is picked up

--- src/cljs_api_gen/parse.clj
+++ src/cljs_api_gen/parse.clj
@@ -207,7 +207,8 @@
   "Parse given forms from a given namespace and repo."
   [ns- repo forms]
   (binding [*cur-ns* ns-
-            *cur-repo* repo]
+            *cur-repo* repo
+            *fn-macros* (get-fn-macros forms)]
     (doall (keep parse-form forms))))

 (defn parse-ns*


whitespace

whitespace

--- src/clojure/flambo/sql.clj
+++ src/clojure/flambo/sql.clj
@@ -390,6 +390,11 @@

 (defn create-or-replace-temp-view [v-name]
   (.createOrReplaceTempView v-name))
+
+(defn ^Dataset with-column
+  "Add a column named **name** to a data frame with value **value**."
+  [^Dataset df name value]
+  (.withColumn df name (org.apache.spark.sql.functions/lit value)))

 (defn ^Encoder encoder-for-type
   "Create a Spark SQL Encoder for **type-**.  The available options for


remove `enable-console-print!`, add :no-doc metadata

--- src/cognitect/transit.cljs
+++ src/cognitect/transit.cljs
@@ -19,8 +19,6 @@
             [com.cognitect.transit.eq :as eq])
   (:import [goog.math Long]))

-(enable-console-print!)
-
 (extend-protocol IEquiv
   Long
   (-equiv [this other]
@@ -47,20 +45,20 @@
   (-hash [this]
     (eq/hashCode this)))

-(defn opts-merge [a b]
+(defn ^:no-doc opts-merge [a b]
   (doseq [k (js-keys b)]
     (let [v (aget b k)]
       (aset a k v)))
   a)

-(deftype MapBuilder []
+(deftype ^:no-doc MapBuilder []
   Object
   (init [_ node] (transient {}))
   (add [_ m k v node] (assoc! m k v))
   (finalize [_ m node] (persistent! m))
   (fromArray [_ arr node] (cljs.core/PersistentArrayMap.fromArray arr true true)))

-(deftype VectorBuilder []
+(deftype ^:no-doc VectorBuilder []
   Object
   (init [_ node] (transient []))
   (add [_ v x node] (conj! v x))
@@ -97,19 +95,19 @@
   [r str]
   (.read r str))

-(deftype KeywordHandler []
+(deftype ^:no-doc KeywordHandler []
   Object
   (tag [_ v] ":")
   (rep [_ v] (.-fqn v))
   (stringRep [_ v] (.-fqn v)))

-(deftype SymbolHandler []
+(deftype ^:no-doc SymbolHandler []
   Object
   (tag [_ v] "$")
   (rep [_ v] (.-str v))
   (stringRep [_ v] (.-str v)))

-(deftype ListHandler []
+(deftype ^:no-doc ListHandler []
   Object
   (tag [_ v] "list")
   (rep [_ v]
@@ -118,13 +116,13 @@
       (t/tagged "array" ret)))
   (stringRep [_ v] nil))

-(deftype MapHandler []
+(deftype ^:no-doc MapHandler []
   Object
   (tag [_ v] "map")
   (rep [_ v] v)
   (stringRep [_ v] nil))

-(deftype SetHandler []
+(deftype ^:no-doc SetHandler []
   Object
   (tag [_ v] "set")
   (rep [_ v]
@@ -133,7 +131,7 @@
       (t/tagged "array" ret)))
   (stringRep [v] nil))

-(deftype VectorHandler []
+(deftype ^:no-doc VectorHandler []
   Object
   (tag [_ v] "array")
   (rep [_ v]


Fix error in toplevel gui code

Fix error in toplevel gui code

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

--- src/conexp/contrib/gui.clj
+++ src/conexp/contrib/gui.clj
@@ -7,8 +7,9 @@
 ;; You must not remove this notice, or any other, from this software.

 (ns conexp.contrib.gui
-  (:use conexp.contrib.gui.base)
-  (:use seesaw.core))
+  (:use [conexp.base :only (ns-doc)])
+  (:use [conexp.contrib.gui.base :only (conexp-main-frame)])
+  (:use [seesaw.core :only (native! pack! show!)]))

 (ns-doc "Provides standard gui for conexp-clj.")


Fixed typo

Fixed typo

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

--- src/conexp/util/fcalib.clj
+++ src/conexp/util/fcalib.clj
@@ -77,7 +77,7 @@
   context as base context."
   [conexp-clj-context conexp-clj-implications]
   (let [^ImplicationSet fcalib-implication-set (ImplicationSet. (to-fcalib-context conexp-clj-context))]
-    (doseq [impl (map to-fcalib-implication conexp-clj-set-of-implications)]
+    (doseq [impl (map to-fcalib-implication conexp-clj-implications)]
       (.add fcalib-implication-set impl))
     fcalib-implication-set))


Tests for functions run-fetcher-in-a-loop, run-fetcher, and run-fetcher-in-thread

--- test/emender_jenkins/job_data_fetcher_test.clj
+++ test/emender_jenkins/job_data_fetcher_test.clj
@@ -60,3 +60,20 @@
         (is (callable? 'emender-jenkins.job-data_fetcher/get-formatted-time))))

+(deftest test-run-fetcher-in-a-loop-existence
+    "Check that the emender-jenkins.job-data_fetcher/run-fetcher-in-a-loop definition exists."
+    (testing "if the emender-jenkins.job-data_fetcher/run-fetcher-in-a-loop definition exists."
+        (is (callable? 'emender-jenkins.job-data_fetcher/run-fetcher-in-a-loop))))
+
+
+(deftest test-run-fetcher-existence
+    "Check that the emender-jenkins.job-data_fetcher/run-fetcher definition exists."
+    (testing "if the emender-jenkins.job-data_fetcher/run-fetcher definition exists."
+        (is (callable? 'emender-jenkins.job-data_fetcher/run-fetcher))))
+
+
+(deftest test-run-fetcher-in-thread-existence
+    "Check that the emender-jenkins.job-data_fetcher/run-fetcher-in-thread definition exists."
+    (testing "if the emender-jenkins.job-data_fetcher/run-fetcher-in-thread definition exists."
+        (is (callable? 'emender-jenkins.job-data_fetcher/run-fetcher-in-thread))))
+


Add function to coerce a mimetype string into an RDFFormat.

--- src/grafter/rdf/sesame.clj
+++ src/grafter/rdf/sesame.clj
@@ -664,6 +664,14 @@
   object based on the files extension."
   [fname]
   (Rio/getParserFormatForFileName fname))
+
+(defn mimetype->rdf-format
+  "Given a mimetype string we attempt to return an appropriate
+  RDFFormat object based on the files extension."
+  [mime-type]
+  (condp = mime-type
+    "application/n-triples" RDFFormat/NTRIPLES ;; Sesame doesn't yet support application/n-triples
+    (Rio/getParserFormatForMIMEType mime-type)))

 ;; http://clj-me.cgrand.net/2010/04/02/pipe-dreams-are-not-necessarily-made-of-promises/
 (defn- pipe


CMR-6495 Fixes issue with 1.7 to 1.6 migration

--- umm-spec-lib/src/cmr/umm_spec/migration/version/variable.clj
+++ umm-spec-lib/src/cmr/umm_spec/migration/version/variable.clj
@@ -209,4 +209,4 @@
       (assoc :AcquisitionSourceName spec-util/not-provided)
       (assoc-in [:Characteristics :IndexRanges] (get v :IndexRanges))
       (assoc-in [:Characteristics :GroupPath] (get v :Name))
-      (dissoc :IndexRanges)))
+      (dissoc :IndexRanges :StandardName)))


Fix also the publish entry function.

Fix also the publish entry function.

--- src/oc/storage/api/entries.clj
+++ src/oc/storage/api/entries.clj
@@ -173,11 +173,10 @@
   (if-let* [user (:user ctx)
             org (:existing-org ctx)
             board (:existing-board ctx)
-            old-board (:moving-board ctx)
             entry (:existing-entry ctx)
             updated-entry (:updated-entry ctx)
             publish-result (entry-res/publish-entry! conn (:uuid updated-entry) updated-entry user)]
-    (do
+    (let [old-board (:moving-board ctx)]
       (undraft-board conn user org board)
       ;; If we are moving the entry from a draft board, check if we need to remove the board itself.
       (when old-board


(SERVER-269) Removed a few extraneous imports and requires

This commit removes a few extraneous imports and requires from the
request_handler_core namespace.

--- src/clj/puppetlabs/services/request_handler/request_handler_core.clj
+++ src/clj/puppetlabs/services/request_handler/request_handler_core.clj
@@ -1,16 +1,12 @@
 (ns puppetlabs.services.request-handler.request-handler-core
-  (:import (java.security.cert X509Certificate)
-           (java.util HashMap)
+  (:import (java.util HashMap)
            (java.io StringReader)
-           (com.puppetlabs.puppetserver JRubyPuppetResponse)
-           (org.apache.commons.io IOUtils))
+           (com.puppetlabs.puppetserver JRubyPuppetResponse))
   (:require [clojure.tools.logging :as log]
             [clojure.string :as string]
-            [clojure.walk :as walk]
             [puppetlabs.kitchensink.core :as ks]
             [puppetlabs.certificate-authority.core :as ssl]
             [ring.middleware.params :as ring-params]
-            [ring.middleware.nested-params :as ring-nested-params]
             [ring.util.codec :as ring-codec]
             [ring.util.response :as ring-response]
             [slingshot.slingshot :as sling]))


pre-conditions for the top-level api

pre-conditions for the top-level api

--- src/main/cljs/cljs/js.cljs
+++ src/main/cljs/cljs/js.cljs
@@ -31,6 +31,15 @@
   "Given a namespace as a symbol return the relative path sans extension"
   [ns-sym]
   (string/replace (ana/munge-path ns-sym) \. \/))
+
+(defn atom? [x]
+  (instance? Atom x))
+
+(defn valid-name? [x]
+  (or (nil? x) (symbol? x) (string? x)))
+
+(defn valid-opts? [x]
+  (or (nil? x) (map? x)))

 (defonce
   ^{:doc "Each runtime environment provides a different way to load a library.
@@ -320,6 +329,8 @@
   ([state source name cb]
    (analyze state source name nil cb))
   ([state source name opts cb]
+   {:pre [(atom? state) (string? source)
+          (valid-name? name) (valid-opts? opts) (fn? cb)]}
    (analyze*
      {:*compiler*     state
       :*data-readers* tags/*cljs-data-readers*
@@ -447,15 +458,17 @@
   ([state source name cb]
    (compile state source name nil cb))
   ([state source name opts cb]
-    (compile*
-      {:*compiler*     state
-       :*data-readers* tags/*cljs-data-readers*
-       :*analyze-deps* (or (:analyze-deps opts) true)
-       :*load-macros*  (or (:load-macros opts) true)
-       :*load-fn*      (or (:load-fn opts) *load-fn*)
-       :*eval-fn*      (or (:eval-fn opts) *eval-fn*)
-       :*sm-data*      (when (:source-map opts) (sm-data))}
-      source name opts cb)))
+   {:pre [(atom? state) (string? source)
+          (valid-name? name) (valid-opts? opts) (fn? cb)]}
+   (compile*
+     {:*compiler*     state
+      :*data-readers* tags/*cljs-data-readers*
+      :*analyze-deps* (or (:analyze-deps opts) true)
+      :*load-macros*  (or (:load-macros opts) true)
+      :*load-fn*      (or (:load-fn opts) *load-fn*)
+      :*eval-fn*      (or (:eval-fn opts) *eval-fn*)
+      :*sm-data*      (when (:source-map opts) (sm-data))}
+     source name opts cb)))

 ;; -----------------------------------------------------------------------------
 ;; Evaluate String
@@ -530,7 +543,9 @@
    (eval-str state source nil cb))
   ([state source name cb]
    (eval-str state source name nil cb))
-  ([state source opts name cb]
+  ([state source name opts cb]
+   {:pre [(atom? state) (string? source)
+          (valid-name? name) (valid-opts? opts) (fn? cb)]}
    (eval-str*
      {:*compiler*     state
       :*data-readers* tags/*cljs-data-readers*


Support for font-awesome duotone

Support for font-awesome duotone

--- src/reflecti/font_awesome.cljs
+++ src/reflecti/font_awesome.cljs
@@ -9,7 +9,7 @@
   by passing a seq of strings. Examples can be found at:
     http://fontawesome.io/examples/"
   [{:keys [name type classes] :or {type :regular} :as props}]
-  {:pre [(#{:solid :regular :light :brands} type)]}
+  {:pre [(#{:solid :regular :light :duotone :brands} type)]}
   [:i (merge
        {:class (str (->> type clojure.core/name first (str "fa"))
                     " fa-" name " " (st/join " " classes))}


ban route 20

ban route 20

--- src/otp_api_proxy/util.clj
+++ src/otp_api_proxy/util.clj
@@ -152,13 +152,16 @@
         otp-url
         (str "http://anaheim-otp.ed-groth.com/otp/routers/default/plan"
              "?"
+             ;; banned routes format is: agency_id '__' route_id
+             ;; agency_id 248 is Anaheim, route id 1711 is route 20
              (reduce str [(pass-arg "fromPlace")
                           "&" (pass-arg "toPlace")
                           "&" (pass-arg "time")
                           "&" (pass-arg "date")
                           "&mode=TRANSIT,WALK"
-                          "&maxWalkDistance=750"
-                          "&walkReluctance=40"
+                          "&bannedRoutes=248__1711"
+                          "&maxWalkDistance=1000"
+                          "&walkReluctance=2"
                           "&walkSpeed=0.3"
                           "&arriveBy=false"
                           "&showIntermediateStops=false"


Use the correct timezone when querying the database for time series data.

--- metlog-vault/src-server/metlog_vault/data.clj
+++ metlog-vault/src-server/metlog_vault/data.clj
@@ -78,7 +78,7 @@
                          " FROM sample, series"
                          " WHERE sample.series_id = series.series_id"
                          "   AND series.series_name=?"
-                         "   AND t > TIMESTAMPADD(SQL_TSI_SECOND, ?, CURRENT_TIMESTAMP)"
+                         "   AND t > TIMESTAMPADD(SQL_TSI_SECOND, ?, NOW)"
                          " ORDER BY t")
                     series-name
                     (- window-size-secs)])))


refactor conversation manager into conv-actors

--- src/polismath/conv_man.clj
+++ src/polismath/conv_man.clj
@@ -331,6 +331,55 @@
       (postgres/mark-task-complete! postgres "generate_report_data" rid))))

+(defn conv-actor
+  [{:as conv-man :keys [conversations kill-chan config listeners]} zid]
+  (log/info "Starting message batch queue and handler routine for conv zid:" zid)
+  (let [conv (load-or-init conv-man zid :recompute (:recompute config))
+        _ (log/info "Conversation loaded for conv zid:" zid)
+        ;; Set up our main message chan
+        message-chan (chan 10000)
+        ;; Separate channel for messages that we've tried to process but that haven't worked for one reason or another (buffer size not important here)
+        retry-chan   (chan 10)]
+    (go-loop [conv conv]
+      ;; If nil comes through as the first message, then the chan is closed, and we should be done, not continue looping forever
+      (when-not (async/poll! kill-chan)
+        (when-let [first-msg (<! message-chan)]
+          ;; If there are any retry messages from a failed recompute, we put them at the front of the message stack.
+          ;; But retry messages only get processed in this way if there are new messages that have come in triggering the
+          ;; first-msg take above, ensuring we don't just loop forever on a broken message/update.
+          (log/info "Message chan put in queue-message-batch! for zid:" zid)
+          (let [retry-msgs (async/poll! retry-chan)
+                msgs (vec (concat retry-msgs [first-msg] (take-all! message-chan)))
+                ;; Regardless, now we split the messages by message type and process them as below
+                {:as split-msgs :keys [votes moderation generate_report_data]} (split-batches msgs)
+                ;; Here we construct an error handler that gets passed to the conv update process, wrapping the retry queue,
+                ;; error reporting, etc.
+                error-handler (build-update-error-handler conv-man retry-chan conv)
+                ;; Run moderation and vote updates
+                conv (if moderation
+                       (conv/mod-update conv moderation)
+                       conv)
+                ;; Note that we run the update here if there are either new votes or changes in moderation; conv update
+                ;; should work on nil vote seq; we also run if we get a report gen request but haven't built the reating mat
+                conv (if (or moderation votes (not (:rating-mat conv)))
+                       (conv-update conv-man conv votes error-handler)
+                       conv)
+                math-tick (postgres/inc-math-tick (:postgres conv-man) zid)]
+            (log/info "Completed computing conversation zid:" zid)
+            (log/debug "Mod out for zid" zid "is:" (:mod-out conv))
+            (write-conv-updates! conv-man conv math-tick)
+            ;; Run reports corr matrix stuff (etc)
+            (doseq [report-task generate_report_data]
+              (generate-report-data! conv-man conv math-tick report-task))
+            ;; Here, we assoc into the parent conversations state as a convenience; the actual "current state" is
+            ;; as closed over in this go-loop.
+            (swap! conversations assoc-in [zid :conv] conv)
+            (async/thread
+              (doseq [[k f] @listeners] (try (f conv) (catch Exception e (log/error e "Listener error")))))
+            (recur conv)))))
+    {:conv conv :message-chan message-chan :retry-chan retry-chan}))
+
+
 ;; Need to think about what to do if failed conversations lead to messages piling up in the message queue XXX
 (defn queue-message-batch!
   "Queue message batches for a given conversation by zid"
@@ -340,54 +389,10 @@
       ;; Then we already have a go loop running for this
       (>!! message-chan {:message-type message-type :message-batch message-batch})
       ;; Then we need to initialize the conversation and set up the conversation channel and go routine
-      (let [_ (log/info "Starting message batch queue and handler routine for conv zid:" zid)
-            conv (load-or-init conv-man zid :recompute (:recompute config))
-            _ (log/info "Conversation loaded for conv zid:" zid)
-            ;; XXX Need to set up message chan buffer as a env var
-            message-chan (chan 100000)
-            ;; We use a separate channel for messages that we've tried to process but that haven't worked for one reason or another
-            retry-chan   (chan 10)] ; only really need buffer 1 here?
-        (swap! conversations assoc zid {:conv conv :message-chan message-chan :retry-chan retry-chan})
+      (let [conv-actor (conv-actor zid)]
+        (swap! conversations assoc zid conv-actor)
         ;; Just call again to make sure the message gets on the chan (using the if-let fork above) :-)
-        (queue-message-batch! conv-man message-type zid message-batch)
-        ;; However, we don't use the conversations atom conv state, but keep track of it explicitly in the loop,
-        ;; ensuring that we don't have race conditions for conv state. The state kept in the atom is basically
-        ;; just a convenience.
-        (go-loop [conv conv]
-          ;; If nil comes through as the first message, then the chan is closed, and we should be done, not continue looping forever
-          (when-not (async/poll! kill-chan)
-            (when-let [first-msg (<! message-chan)]
-              ;; If there are any retry messages from a failed recompute, we put them at the front of the message stack.
-              ;; But retry messages only get processed in this way if there are new messages that have come in triggering the
-              ;; first-msg take above, ensuring we don't just loop forever on a broken message/update.
-              (log/info "Message chan put in queue-message-batch! for zid:" zid)
-              (let [retry-msgs (async/poll! retry-chan)
-                    msgs (vec (concat retry-msgs [first-msg] (take-all! message-chan)))
-                    ;; Regardless, now we split the messages by message type and process them as below
-                    {:as split-msgs :keys [votes moderation generate_report_data]} (split-batches msgs)
-                    ;; Here we construct an error handler that gets passed to the conv update process, wrapping the retry queue,
-                    ;; error reporting, etc.
-                    error-handler (build-update-error-handler conv-man retry-chan conv)
-                    ;; Run moderation and vote updates
-                    conv (if moderation
-                           (conv/mod-update conv moderation)
-                           conv)
-                    ;; Note that we run the update here if there are either new votes or changes in moderation; conv update
-                    ;; should work on nil vote seq; we also run if we get a report gen request but haven't built the reating mat
-                    conv (if (or moderation votes (not (:rating-mat conv)))
-                           (conv-update conv-man conv votes error-handler)
-                           conv)
-                    math-tick (postgres/inc-math-tick (:postgres conv-man) zid)]
-                (log/info "Completed computing conversation zid:" zid)
-                (log/debug "Mod out for zid" zid "is:" (:mod-out conv))
-                (write-conv-updates! conv-man conv math-tick)
-                ;; Run reports corr matrix stuff (etc)
-                (doseq [report-task generate_report_data]
-                  (generate-report-data! conv-man conv math-tick report-task))
-                (swap! conversations assoc-in [zid :conv] conv)
-                (async/thread
-                  (doseq [[k f] @listeners] (try (f conv) (catch Exception e (log/error e "Listener error")))))
-                (recur conv)))))))))
+        (queue-message-batch! conv-man message-type zid message-batch)))))

 ;; Need to find a good way of making sure these tests don't ever get committed uncommented


refactor toolbar action

refactor toolbar action

--- src/status_im/chat/screen.cljs
+++ src/status_im/chat/screen.cljs
@@ -88,15 +88,13 @@
 (defn toolbar-action []
   (let [show-actions (subscribe [:chat-ui-props :show-actions?])]
     (fn []
-      (if @show-actions
+      (let [show-actions @show-actions]
         [touchable-highlight
-         {:on-press #(dispatch [:set-chat-ui-props {:show-actions? false}])}
+         {:on-press #(dispatch [:set-chat-ui-props {:show-actions? (not show-actions)}])}
          [view st/action
-          [vi/icon :icons/dropdown-up]]]
-        [touchable-highlight
-         {:on-press #(dispatch [:set-chat-ui-props {:show-actions? true}])}
-         [view st/action
-          [chat-icon]]]))))
+          (if show-actions
+            [vi/icon :icons/dropdown-up]
+            [chat-icon])]]))))

 (defview add-contact-bar []
   [chat-id [:get :current-chat-id]


whitespace

whitespace

--- src/babel/italiano/lexicon.cljc
+++ src/babel/italiano/lexicon.cljc
@@ -524,11 +524,9 @@
                           :pet true
                           :pred :cane}}})

-
    "capire" {:italiano {:boot-stem1 "capisc"}
              :synsem {:cat :verb
                       :sem {:pred :understand}}}
-
    "casa"
     (unify agreement-noun
            common-noun
@@ -1692,13 +1690,13 @@
    "ricordare"  {:synsem {:cat :verb
                           :sem {:pred :ricordare}}}

-"rimanere" {:synsem {:cat :verb
-                      :essere true
-                      :sem {:pred :remain}}
-             :italiano {:passato "rimasto"
-                        :present {:1sing "rimango"
-                                  :3plur "rimangono"}
-                        :future-stem "rimarr"}}
+   "rimanere" {:synsem {:cat :verb
+                        :essere true
+                        :sem {:pred :remain}}
+               :italiano {:passato "rimasto"
+                          :present {:1sing "rimango"
+                                    :3plur "rimangono"}
+                          :future-stem "rimarr"}}

    "riposare" {:synsem {:cat :verb
                         :sem {:pred :rest}}}


renaming and namespacing

renaming and namespacing

--- src/babel/italiano/lexicon.cljc
+++ src/babel/italiano/lexicon.cljc
@@ -3,15 +3,16 @@
   (:refer-clojure :exclude [get-in])
   (:require
    [babel.encyclopedia :as encyc]
-   [babel.lexiconfn :as lexiconfn
+   [babel.lexiconfn
+    :as lexfn
     :refer [apply-unify-key default evaluate
             filter-vals listify map-function-on-map-vals
             new-entries rewrite-keys verb-pred-defaults]]

    #?(:clj [clojure.tools.logging :as log])
    #?(:cljs [babel.logjs :as log])
-   [babel.italiano.morphology :refer [agreement exception-generator
-                                      phonize2]]
+   [babel.italiano.morphology :as morph
+    :refer [phonize2]]

    [clojure.edn :as edn]
    [clojure.java.io :refer [reader resource]]
@@ -51,22 +52,21 @@
                :essere essere
                :infl infl}})})

-;; TODO rename without confusing "2"
-(defn exception-generator2 [lexicon]
-  (let [exception-maps (exception-generator lexicon)]
+(defn exception-generator [lexicon]
+  (let [exception-maps (morph/exception-generator lexicon)]
     (if (not (empty? exception-maps))
       (merge-with concat
                   lexicon
                   (reduce (fn [m1 m2]
                             (merge-with concat m1 m2))
-                          (exception-generator lexicon)))
+                          (morph/exception-generator lexicon)))
       lexicon)))

 ;; TODO: see if we can use Clojure transducers here. (http://clojure.org/reference/transducers)
 (defn edn2lexicon [resource]
-  (-> (lexiconfn/edn2lexicon resource)
-
-      exception-generator2 ;; add new keys to the map for all exceptions found.
+  (-> (lexfn/edn2lexicon resource)
+
+      exception-generator ;; add new keys to the map for all exceptions found.

       ;; <noun default rules>
       (default ;; a noun by default is neither a pronoun nor a propernoun.


set socket timeout on peer ping

set socket timeout on peer ping

--- src/block_chain/peer_client.clj
+++ src/block_chain/peer_client.clj
@@ -31,8 +31,10 @@
   (req :get (url peer "blocks" block-hash)))

 (defn send-peer [peer port]
+  (log/info "Connect to peer:" peer "from port:" port)
   (req :post (url peer "peers") {:form-params {:port port}
                                  :content-type :json
+                                 :socket-timeout 3000
                                  :throw-exceptions false}))

 (defn send-block [peer block]


fix spit call

fix spit call

Signed-off-by: Stanislas Nanchen <b54ae7893982d10f03c27dbc889098ce04898c8b@hood.ch>

--- src/ch/hood/odpg/impl/expdp.clj
+++ src/ch/hood/odpg/impl/expdp.clj
@@ -128,7 +128,7 @@
 								 (footer ctx)])))
 	([file exp-data :- ExpData]
 		(let [script (render-exp-script exp-data)]
-			(spit file exp-data))))
+			(spit file script))))

 (comment
 	(def input {:schemas     {"SIMON1"


Attempt to parse a date using "dd-MM-yyyy" format

--- api/src/clojure/org/akvo/flow_api/datastore/form_instance.clj
+++ api/src/clojure/org/akvo/flow_api/datastore/form_instance.clj
@@ -148,7 +148,11 @@
                     (let [;; SimpleDateFormat is not thread safe so we create a
                           ;; new one every time.
                           date-format (SimpleDateFormat. "dd-MM-yyyy HH:mm:ss z")]
-                      (.parse date-format response-str))))]
+                      (try
+                        (.parse date-format response-str)
+                        (catch java.text.ParseException _
+                          (let [date-format-2 (SimpleDateFormat. "dd-MM-yyyy")]
+                            (.parse date-format-2 response-str)))))))]
     (ds/to-iso-8601 date)))

 (defmethod parse-response "CASCADE"
@@ -269,7 +273,7 @@

 (defn form-instances-by-id
   [^DatastoreService ds ids]
-  (.get ds ^Iterable (mapv (fn [^long x]
+  (.get ds ^Iterable (mapv (fn [^Long x]
                              (KeyFactory/createKey "SurveyInstance" x)) ids)))

 (defn by-ids
@@ -281,4 +285,4 @@
                               (assoc form-instance
                                 :responses
                                 (get responses (:id form-instance))))
-                        form-instances)})))+                        form-instances)})))


Finished library and follow doc strings.


Remove failing test

Remove failing test

--- test/cljc/mikron/test.cljc
+++ test/cljc/mikron/test.cljc
@@ -36,6 +36,3 @@
    t-record       [:record {:a :int :b :string :c :byte}]
    t-multi        [:multi number? {true :int false :string}]
    t-wrapped      [:wrapped unchecked-inc-int unchecked-dec-int :int]})
-
-(test/deftest failing-test
-  (test/is (= 0 1)))


register-codec doesn't need to be a bang operation.

--- core/src/immutant/codecs.clj
+++ core/src/immutant/codecs.clj
@@ -53,14 +53,14 @@
   (-> (Codecs.)
     (.add None/INSTANCE)))

-(defn register-codec!
+(defn register-codec
   "Registers a codec for use.

    `codec` should be the result of {{make-codec}}."
   [codec]
   (.add codecs codec))

-(register-codec!
+(register-codec
   (make-codec
     {:name :edn
      :content-type "application/edn"
@@ -73,7 +73,7 @@
                             (str "Invalid edn-encoded data (type=" (class data) "): " data)
                             e)))))}))

-(register-codec!
+(register-codec
   (make-codec
     {:name :fressian
      :content-type "application/fressian"
@@ -97,7 +97,7 @@
                  (throw (IllegalArgumentException.
                           "Can't decode fressian. Add org.clojure/data.fressian to your dependencies."))))}))

-(register-codec!
+(register-codec
   (make-codec
     {:name :json
      :content-type "application/json"


fix chat-icon-view rerendering

fix chat-icon-view rerendering

--- src/status_im/components/chat_icon/screen.cljs
+++ src/status_im/components/chat_icon/screen.cljs
@@ -74,6 +74,7 @@
     :default-chat-icon-text st/default-chat-icon-text}])

 (defn chat-icon-view-action [chat-id group-chat name color online]
+  ^{:key chat-id}
   [chat-icon-view chat-id group-chat name online
    {:container              st/container
     :online-view-wrapper    st/online-view-wrapper


Trying out using query and template from routes

--- src/wishlistd/views/routes.clj
+++ src/wishlistd/views/routes.clj
@@ -1,6 +1,7 @@
 (ns wishlistd.views.routes
-  (:require [wishlistd.views.wishlist :as wishlist])
+  (:require [wishlistd.views.wishlist :as wishlist]
+	        [wishlistd.models.queries :as queries])
   (:use noir.core))

 (defpage "/" [] (wishlist/main-page))
-(defpage "/create-wishlist" [] (wishlist/create-wishlist-html))+(defpage "/create-wishlist" [] (wishlist/wishlist-as-html (queries/create-wishlist-with-wishes)))


(TK-369) Adjust shutdown test conditions for travis

The graceful shutdown test has started failing in travis recently,
potentially due to a race inside jetty's shutdown sequence. This has
been difficult to reproduce outside of travis, but doesn't seem to have
much real world consequence, besides getting a 404 instead of a 500 in
an unlikely server configuration during shutdown.

--- test/clj/puppetlabs/trapperkeeper/services/webserver/jetty9_service_test.clj
+++ test/clj/puppetlabs/trapperkeeper/services/webserver/jetty9_service_test.clj
@@ -723,7 +723,11 @@
            (let [response (http-client-common/get async-client "http://localhost:8080/hello" {:as :text})]
              @in-request-handler
              (tk-app/stop app)
-             (is (not (nil? (:error @response))))))))))
+             (let [resp @response]
+               (is (or
+                    (not (nil? (:error resp)))
+                    (= 404 (:status resp)))
+                   resp))))))))

   (testing "tk app can still restart even if stop timeout expires"
     (let [in-request-handler? (promise)


t-pile had the wrong namespace.

t-pile had the wrong namespace.

--- test/midje/util/t_pile.clj
+++ test/midje/util/t_pile.clj
@@ -1,4 +1,4 @@
-(ns midje.util.pile
+(ns midje.util.t-pile
   (:use [midje.util.pile])
   (:use [midje.sweet])
   (:use [midje.test-util]))


1. pageSize 최소값 변경 0 -> 1

1. pageSize 최소값 변경 0 -> 1

--- src/clj/cauca/dao/mysql_dao.clj
+++ src/clj/cauca/dao/mysql_dao.clj
@@ -13,7 +13,7 @@
   (let [getNum (fn [data default] (if (nil? data) default (if (string? data) (Integer/parseInt data) data)))
         getVal (fn [data min max] (if (< data min) min (if (> data max) max data)))
         page (getVal (getNum (params "page") 1) 1 100)
-        pageSize (getVal (getNum (params "pageSize") 10) 0 100)]
+        pageSize (getVal (getNum (params "pageSize") 10) 1 100)]
     (string/join \newline
                  ["SELECT * FROM courtauction"
                   "WHERE 1 = 1"


Added preconditions to simplify deseasonalization

--- src/clj/forma/trends/filter.clj
+++ src/clj/forma/trends/filter.clj
@@ -24,21 +24,23 @@
   only the trend component and the idiosyncratic disturbance of the
   original time series.

-  Precondition avoids singular matrix when `ts` is shorter than `freq`.
+  Precondition avoids singular matrix by throwing exception
+  when `ts` is shorter than `freq`. Throws an exception - due to meaningless
+  results - if `freq` equals 1 or in case we see `nil` as the `ts`.

   Example:
     (deseasonalize 23 (s/sample-uniform 200))"
   [freq ts]
-  {:pre [(>= (count ts) freq)]}
-  (if (nil? ts)
-    nil
-    (let [x (dummy-mat freq (i/nrow ts))
+  {:pre [(>= (count ts) freq)
+         (when nil? ts)
+         (< 1 freq)]}
+  (let [x (dummy-mat freq (i/nrow ts))
           xt (i/trans x)
           xtx (i/mmult xt x)
           coefs (i/mmult (i/solve xtx) xt ts)
           fitted (i/mmult x coefs)]
       (i/to-vect (i/plus (i/minus ts fitted)
-                         (s/mean ts))))))
+                         (s/mean ts)))))

 ;; Remove seasonal component by harmonic decomposition


Pawn's central server requirement, automatic advancement, free install

--- src/clj/game/cards-programs.clj
+++ src/clj/game/cards-programs.clj
@@ -191,9 +191,9 @@
     :abilities [{:counter-cost 1 :cost [:click 1] :msg "force the Corp to trash the top card of R&D"
                  :effect (effect (mill :corp))}]}

-    "Harbinger"
-    {:trash-effect
-      {:req (req (not (some #{:facedown} (:previous-zone card))))
+   "Harbinger"
+   {:trash-effect
+     {:req (req (not (some #{:facedown} (:previous-zone card))))
        :effect (effect (runner-install card {:facedown true}))}}

    "Hemorrhage"
@@ -371,12 +371,29 @@
    {:recurring 2}

    "Pawn"
-   {:abilities [{:label "Host Pawn on a piece of ICE" :cost [:click 1]
+   {:abilities [{:prompt "Host Pawn on the outermost ICE of a central server" :cost [:click 1]
                  :choices {:req #(and (= (:type %) "ICE")
                                       (= (last (:zone %)) :ices)
-                                      (not (some (fn [c] (has? c :subtype "Caïssa")) (:hosted %))))}
+                                      (some #{:hq :rd :archives} (rest (butlast (:zone %)))))}
                  :msg (msg "host it on " (if (:rezzed target) (:title target) "a piece of ICE"))
-                 :effect (effect (host target card))}]}
+                 :effect (effect (host target card))}]
+    :events {:successful-run
+             {:effect (req (let [i (ice-index state (:host card))
+                                 nextice (when (> i 0) (nth (get-in @state
+                                                              (vec (concat [:corp] (:zone (:host card))))) (dec i)))]
+                             (if (pos? i)
+                               (host state side nextice card)
+                               (do (resolve-ability state side
+                                     {:prompt "Install a Caïssa program from Grip or Heap?" :choices ["Grip" "Heap"]
+                                      :msg (msg "install a Caïssa program from " target)
+                                      :effect (req (let [p target]
+                                                     (resolve-ability state side
+                                                       {:prompt "Choose a Caïssa program to install"
+                                                        :choices (req (filter #(has? % :subtype "Caïssa")
+                                                                        ((if (= p "Heap") :discard :hand) runner)))
+                                                        :effect (effect (runner-install target {:no-cost true}))} card nil)))}
+                                    card nil)
+                                   (trash state side card)))))}}}

    "Pheromones"
    {:recurring (effect (set-prop card :rec-counter (:counter card)))


Correct secretary macro refer

Correct secretary macro refer

--- src/cljs/comic_reader/main.cljs
+++ src/cljs/comic_reader/main.cljs
@@ -9,7 +9,7 @@
              :refer [comic-viewer]]
             [reagent.core :as reagent :refer [atom]]
             [secretary.core :as secretary
-             :include-macros true :refer [defroute]]
+             :refer-macros [defroute]]
             [goog.events :as events]
             [goog.history.EventType :as EventType]))


Added close button to header

Added close button to header

--- src/clojure/staircase/views.clj
+++ src/clojure/staircase/views.clj
@@ -273,6 +273,7 @@
 (def edit-step (html
    [:div.modal-header
     [:h3.modal-title
+     [:button.btn.btn-warning.pull-right {:ng-click "cancel()"} "close"]
      "Edit step data"]]
    [:div.modal-body.edit-step-data
     [:form.form


english default-fn: return a vector of maps, not just a map

--- src/babel/english/grammar.cljc
+++ src/babel/english/grammar.cljc
@@ -108,7 +108,7 @@
     (log/debug (str "tense  (post): " (strip-refs (get-in result
                                                           [:synsem :sem :tense]
                                                           ::unset))))
-    result))
+    [result]))

 (declare cache)


move "they" gender-markers to {:notes}

move "they" gender-markers to {:notes}

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -1691,9 +1691,9 @@
               :subcat '()}}
     ]

-   ;; TODO: move gender symbol to :notes for all "they" variants.
-   "they (♂)"
-   [{:synsem {:cat :noun
+   "they"
+   [{:note "♂"
+     :synsem {:cat :noun
               :pronoun true
               :case :nom
               :agr {:person :3rd
@@ -1703,7 +1703,8 @@
                     :human true
                     :pred :loro}
               :subcat '()}}
-    {:synsem {:cat :noun
+    {:note "♂"
+     :synsem {:cat :noun
               :pronoun true
               :case :nom
               :agr {:person :3rd
@@ -1712,9 +1713,9 @@
               :sem {:gender :masc
                     :human false
                     :pred :loro}
-              :subcat '()}}]
-   "they (♀)"
-   [{:synsem {:cat :noun
+              :subcat '()}}
+    {:note "♀"
+     :synsem {:cat :noun
               :pronoun true
               :case :nom
               :agr {:person :3rd
@@ -1724,7 +1725,8 @@
                     :human true
                    :pred :loro}
               :subcat '()}}
-    {:synsem {:cat :noun
+    {:note "♀"
+     :synsem {:cat :noun
               :pronoun true
               :case :nom
               :agr {:person :3rd
@@ -1735,7 +1737,7 @@
                     :pred :loro}
               :subcat '()}}]

-    "think" {:synsem {:cat :verb
+   "think" {:synsem {:cat :verb
                      :sem {:pred :think }}
             :english {:past "thought"}}


Add support more units in litedocx.unit package

--- src/bakyeono/litedocx/unit.clj
+++ src/bakyeono/litedocx/unit.clj
@@ -21,13 +21,18 @@
   {:cm       2.54
    :dxa      1440
    :emu      914400
+   :feet     12
+   :ft       12
+   :in.      1
    :inch     1
    :km       0.0000254
    :m        0.0254
    :mm       25.4
    :pt       72
    :px       96
-   :twip     1440})
+   :twip     1440
+   :yard     36
+   :yd       36})

 (defconst inch-per-unit (reverse-conversion-map unit-per-inch))


Change XML data in wpml package as proper clojure.data.xml data

--- src/bakyeono/litedocx/wpml.clj
+++ src/bakyeono/litedocx/wpml.clj
@@ -53,59 +53,49 @@
    :xmlns:w "http://schemas.openxmlformats.org/wordprocessingml/2006/main"})

 (def ^:const ^{:private true} default-content-types
-  [(node :Default
-         {:Extension "rels"
-          :ContentType "application/vnd.openxmlformats-package.relationships+xml"})
-   (node :Override
-         {:ContentType "application/vnd.openxmlformats-officedocument.extended-properties+xml"
-          :PartName "/docProps/app.xml"})
-   (node :Override
-         {:ContentType "application/vnd.openxmlformats-package.core-properties+xml"
-          :PartName "/docProps/core.xml"})
-   (node :Override
-         {:ContentType "application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"
-          :PartName "/word/document.xml"})])
+  [(node :Default {:Extension "rels"
+                   :ContentType "application/vnd.openxmlformats-package.relationships+xml"})
+   (node :Override {:ContentType "application/vnd.openxmlformats-officedocument.extended-properties+xml"
+                    :PartName "/docProps/app.xml"})
+   (node :Override {:ContentType "application/vnd.openxmlformats-package.core-properties+xml"
+                    :PartName "/docProps/core.xml"})
+   (node :Override {:ContentType "application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"
+                    :PartName "/word/document.xml"})])

 (def ^:const ^{:private true} default-styles
   [(node :w:style
          {:w:type "paragraph" :w:styleId "a" :w:default "true"}
-         [(node :w:name {:w:val "Normal"})
-          (node :w:qFormat)
-          (node :w:pPr
-                {}
-                [(node :w:widowControl {:w:val "false"})
-                 (node :w:wordWrap {:w:val "false"})
-                 (node :w:autoSpaceDE {:w:val "false"})
-                 (node :w:autoSpaceDN {:w:val "false"})
-                 (node :w:jc {:w:val "both"})])])
-   (node :w:style
-         {:w:type "character" :w:styleId "a0" :w:default "true"}
-         [(node :w:name {:w:val "Default Paragraph Font"})
-          (node :w:uiPriority {:w:val "1"})
-          (node :w:semiHidden)
-          (node :w:unhideWhenUsed)])
-   (node :w:style
-         {:w:type "table" :w:styleId "a1" :w:default "true"}
-         [(node :w:name {:w:val "Normal Table"})
-          (node :w:uiPriority {:w:val "99"})
-          (node :w:semiHidden)
-          (node :w:unhideWhenUsed)
-          (node :w:qFormat)
-          (node :w:tblPr
-                {}
-                [(node :w:tblInd {:w:w "0" :w:type "dxa"})
-                 (node :w:tblCellMar
-                       {}
-                       [(node :w:top {:w:w "0" :w:type "dxa"})
-                        (node :w:left {:w:w "108" :w:type "dxa"})
-                        (node :w:bottom {:w:w "0" :w:type "dxa"})
-                        (node :w:right {:w:w "108" :w:type "dxa"})])])])
-   (node :w:style
-         {:w:type "numbering" :w:styleId "a2" :w:default "true"}
-         [(node :w:name {:w:val "No List"})
-          (node :w:uiPriority {:w:val "99"})
-          (node :w:semiHidden)
-          (node :w:unhideWhenUsed)])])
+         (node :w:name {:w:val "Normal"})
+         (node :w:qFormat)
+         (node :w:pPr {}
+               (node :w:widowControl {:w:val "false"})
+               (node :w:wordWrap {:w:val "false"})
+               (node :w:autoSpaceDE {:w:val "false"})
+               (node :w:autoSpaceDN {:w:val "false"})
+               (node :w:jc {:w:val "both"})))
+   (node :w:style {:w:type "character" :w:styleId "a0" :w:default "true"}
+         (node :w:name {:w:val "Default Paragraph Font"})
+         (node :w:uiPriority {:w:val "1"})
+         (node :w:semiHidden)
+         (node :w:unhideWhenUsed))
+   (node :w:style {:w:type "table" :w:styleId "a1" :w:default "true"}
+         (node :w:name {:w:val "Normal Table"})
+         (node :w:uiPriority {:w:val "99"})
+         (node :w:semiHidden)
+         (node :w:unhideWhenUsed)
+         (node :w:qFormat)
+         (node :w:tblPr {}
+               (node :w:tblInd {:w:w "0" :w:type "dxa"})
+               (node :w:tblCellMar {}
+                     (node :w:top {:w:w "0" :w:type "dxa"})
+                     (node :w:left {:w:w "108" :w:type "dxa"})
+                     (node :w:bottom {:w:w "0" :w:type "dxa"})
+                     (node :w:right {:w:w "108" :w:type "dxa"}))))
+   (node :w:style {:w:type "numbering" :w:styleId "a2" :w:default "true"}
+         (node :w:name {:w:val "No List"})
+         (node :w:uiPriority {:w:val "99"})
+         (node :w:semiHidden)
+         (node :w:unhideWhenUsed))])

 (defn when-v-node
   "Returns an XML tag node when the value exists."
@@ -170,9 +160,8 @@
   "Returns Override XML tag node of given resource information map.
   Called by content-types-xml."
   [{:keys [content-type part-name]}]
-  {:tag :Override
-   :attrs {:ContentType content-type
-           :PartName part-name}})
+  (node :Override {:ContentType content-type
+                   :PartName part-name}))

 (defn content-types-xml
   "Creates XML data for [Content_Types].xml file in DOCX package.
@@ -182,10 +171,9 @@

   Note that resources should be created by make-resources."
   [resources]
-  {:tag :Types
-   :attrs content-types-xml-xmlns
-   :content (into default-content-types
-                  (map resource-type-override resources))})
+  (node :Types content-types-xml-xmlns
+        default-content-types
+        (map resource-type-override resources)))

 (defn doc-props-app-xml
   "Creates XML data for docProps/app.xml file in DOCX pakcage.
@@ -197,34 +185,24 @@
   - (doc-props-app-xml :application \"Microsoft Office Word\" :app-version \"12.0000\")"
   [& {:as options
       :keys [application app-version]}]
-  {:tag :properties:Properties
-   :attrs doc-props-app-xml-xmlns
-   :content (remove-nil
-              (map when-v-node
-                   [application app-version]
-                   [:properties:Application :properties:AppVersion]))})
+  (node :properties:Properties doc-props-app-xml-xmlns
+        (map when-v-node
+             [application app-version]
+             [:properties:Application :properties:AppVersion])))

 (defn rels-rels
   "Creates XML data for _rels/.rels file in DOCX package."
   []
-  {:tag :Relationships
-   :attrs relationships-xmlns
-   :content
-   [{:tag :Relationship
-     :attrs
-     {:Id "rId1"
-      :Type "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"
-      :Target "word/document.xml"}}
-    {:tag :Relationship
-     :attrs
-     {:Id "rId2"
-      :Type "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties"
-      :Target "docProps/core.xml"}}
-    {:tag :Relationship
-     :attrs
-     {:Id "rId3"
-      :Target "docProps/app.xml"
-      :Type "http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties"}}]})
+  (node :Relationships relationships-xmlns
+        (node :Relationship {:Id "rId1"
+                             :Type "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"
+                             :Target "word/document.xml"})
+        (node :Relationship {:Id "rId2"
+                             :Type "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties"
+                             :Target "docProps/core.xml"})
+        (node :Relationship {:Id "rId3"
+                             :Target "docProps/app.xml"
+                             :Type "http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties"})))

 (defn doc-props-core-xml
   "Creates XML data for docProps/core.xml file in DOCX pakcage.
@@ -236,36 +214,26 @@
   - (doc-props-core-xml :creator \"Bak Yeon O\" :last-modified-by \"Bak Yeon O\")"
   [& {:as properties
       :keys [title subject creator keywords description last-modified-by]}]
-  {:tag :cp:coreProperties
-   :attrs doc-props-core-xml-xmlns
-   :content (remove-nil
-              (map when-v-node
-                   [title subject creator keywords description last-modified-by]
-                   [:dc:title :dc:subject :dc:creator :cp:keywords
-                    :dc:description :cp:lastModifiedBy]))})
+  (node :cp:coreProperties doc-props-core-xml-xmlns
+        (map when-v-node
+             [title subject creator keywords description last-modified-by]
+             [:dc:title :dc:subject :dc:creator :cp:keywords
+              :dc:description :cp:lastModifiedBy])))

 (defn word-document-xml
   "Creates XML data for word/document.xml file in DOCX pakcage."
   [& body]
-  {:tag :w:document
-   :attrs word-xmlns
-   :content
-   [{:tag :w:body
-     :content
-     (remove-nil
-       (conj
-         (remove-nil body)
-         {:tag :w:sectPr
-          :content
-          [{:tag :w:pgSz
-            :attrs {:w:w 11907
-                    :w:h 16839
-                    :w:code 9}}
-           {:tag :w:pgMar
-            :attrs {:w:top 720
-                    :w:right 720
-                    :w:bottom 720
-                    :w:left 720}}]}))}]})
+  (node :w:document word-xmlns
+        (node :w:body {}
+              body
+              (node :w:sectPr {}
+                    (node :w:pgSz {:w:w 11907
+                                   :w:h 16839
+                                   :w:code 9})
+                    (node :w:pgMar {:w:top 720
+                                    :w:right 720
+                                    :w:bottom 720
+                                    :w:left 720})))))

 (defn- ppr
   "Creates w:pPr tag node. Called by paragaph-style."
@@ -274,54 +242,42 @@
            space-before space-after space-line
            indent-left indent-right indent-first-line
            mirror-indents?]}]
-  {:tag :w:pPr
-   :content (remove-nil
-              [(when (or space-before space-after space-line)
-                 {:tag :w:spacing
-                  :attrs (make-attrs :w:before space-before
-                                     :w:after space-after
-                                     :w:line space-line
-                                     :w:lineRule "auto")})
-               (when (or indent-left indent-right indent-first-line)
-                 {:tag :w:ind
-                  :attrs (make-attrs :w:left indent-left
-                                     :w:right indent-right
-                                     :w:firstLine indent-first-line)})
-               (when mirror-indents?
-                 {:tag :w:mirrorIndents})
-               (when align
-                 {:tag :w:jc
-                  :attrs {:w:val align}})])})
+  (node :w:pPr {}
+        (when (or space-before space-after space-line)
+          (node :w:spacing (make-attrs :w:before space-before
+                                       :w:after space-after
+                                       :w:line space-line
+                                       :w:lineRule "auto")))
+        (when (or indent-left indent-right indent-first-line)
+          (node :w:ind (make-attrs :w:left indent-left
+                                   :w:right indent-right
+                                   :w:firstLine indent-first-line)))
+        (when mirror-indents?
+          (node :w:mirrorIndents))
+        (when align
+          (node :w:jc {:w:val align}))))

 (defn- rpr
   "Creates w:rPr tag node. Called by paragaph-style."
   [{:as options
     :keys [font font-size font-color bold? italic? underline? strike?]}]
-  {:tag :w:rPr
-   :content (remove-nil
-              [(when font
-                 {:tag :w:rFonts
-                  :attrs {:w:ascii font
-                          :w:hAnsi font
-                          :w:eastAsia font}})
-               (when font-size
-                 {:tag :w:sz
-                  :attrs {:w:val font-size}})
-               (when font-color
-                 {:tag :w:color
-                  :attrs {:w:val font-color}})
-               (when bold?
-                 {:tag :w:b
-                  :attrs {:w:val true}})
-               (when italic?
-                 {:tag :w:b
-                  :attrs {:w:val true}})
-               (when underline?
-                 {:tag :w:u
-                  :attrs {:w:val "single"}})
-               (when strike?
-                 {:tag :w:strike
-                  :attrs {:w:val true}})])})
+  (node :w:rPr {}
+        (when font
+          (node :w:rFonts {:w:ascii font
+                           :w:hAnsi font
+                           :w:eastAsia font}))
+        (when font-size
+          (node :w:sz {:w:val font-size}))
+        (when font-color
+          (node :w:color {:w:val font-color}))
+        (when bold?
+          (node :w:b {:w:val true}))
+        (when italic?
+          (node :w:b {:w:val true}))
+        (when underline?
+          (node :w:u {:w:val "single"}))
+        (when strike?
+          (node :w:strike {:w:val true}))))

 (defn paragraph-style
   "Creates a w:style tag of paragraph. Returns w:style tag for paragraph style with
@@ -345,46 +301,35 @@
              space-before space-after space-line
              indent-left indent-right indent-first-line mirror-indents?]}]
   (let [font-style-name (str "character-style-of-" name)]
-    (remove-nil
-      [;; paragraph style
-       {:tag :w:style
-        :attrs {:w:type "paragraph"
-                :w:styleId "normal"
-                :w:customStyle "true"}
-        :content
-        (remove-nil
-          [{:tag :w:name
-            :attrs {:w:val name}}
-           {:tag :w:basedOn
-            :attrs {:w:val "a"}}
-           (when font {:tag :w:link
-                       :attrs {:w:val font-style-name}})
-           {:tag :w:qFormat}
+    [;; paragraph style
+     (node :w:style {:w:type "paragraph"
+                     :w:styleId "normal"
+                     :w:customStyle "true"}
+           (node :w:name {:w:val name})
+           (node :w:basedOn {:w:val "a"})
+           (when font
+             (node :w:link {:w:val font-style-name}))
+           (node :w:qFormat)
            (when (or align
                      space-before space-after space-line
                      indent-left indent-right indent-first-line mirror-indents?)
              (ppr options))
            (when (or font font-size font-color bold? italic? underline?)
-             (rpr options))])}
-       ;; font style of the paragraph style
-       (when font
-         {:tag :w:style
-          :attrs {:w:type "character"
-                  :w:styleId font-style-name
-                  :w:customStyle "true"}
-          :content
-          [{:tag :w:name
-            :attrs {:w:val font-style-name}}
-           {:tag :w:basedOn
-            :attrs {:w:val "a0"}}
-           (rpr options)]})])))
+             (rpr options)))
+     ;; font style of the paragraph style
+     (when font
+       (node :w:style {:w:type "character"
+                       :w:styleId font-style-name
+                       :w:customStyle "true"}
+             (node :w:name {:w:val font-style-name})
+             (node :w:basedOn {:w:val "a0"})
+             (rpr options)))]))

 (defn word-styles-xml
   "descripted on: http://officeopenxml.com/WPstyles.php"
   [& styles]
-  {:tag :w:styles
-   :attrs word-xmlns
-   :content (remove-nil (flatten [default-styles styles]))})
+  (node :w:styles word-xmlns
+        (flatten [default-styles styles])))

 (defn word-media-resources
   "Creates a vector of resource data map. Each map has :path and :byte-array
@@ -402,10 +347,9 @@
   "Returns Relationship XML tag node of given resource information map.
   Called by word-rels-document-xml-rels."
   [{:keys [id type target]}]
-  {:tag :Relationship
-   :attrs {:Id id
-           :Type type
-           :Target target}})
+  (node :Relationship {:Id id
+                       :Type type
+                       :Target target}))

 (defn word-rels-document-xml-rels
   "Creates XML data for word/_rels/document.xml.rels file in DOCX package.
@@ -415,9 +359,8 @@

   Note that resources should be created by make-resources."
   [resources]
-  {:tag :Relationships
-   :attrs relationships-xmlns
-   :content (map rels resources)})
+  (node :Relationships relationships-xmlns
+        (map rels resources)))

 (defn table
   "Returns XML tag node of table.
@@ -431,25 +374,16 @@
   Examples:
   (table \"table-style1\" :center [964 964 8072] ...)"
   [style h-align widths & body]
-  {:tag :w:tbl
-   :content
-   (remove-nil
-     (into
-       [{:tag :w:tblPr
-         :content
-         [{:tag :w:tblStyle
-           :attrs {:w:val style}}
-          {:tag :w:tblW
-           :attrs {:w:w (reduce + widths)
-                   :w:type "dxa"}}
-          {:tag :w:jc
-           :attrs {:w:val (name h-align)}}]}
-        {:tag :w:tblGrid
-         :content
-         (for [w widths]
-           {:tag :w:gridCol
-            :attrs {:w:gridCol w}})}]
-       body))})
+  (node :w:tbl {}
+        (node :w:tblPr {}
+              (node :w:tblStyle {:w:val style})
+              (node :w:tblW {:w:w (reduce + widths)
+                             :w:type "dxa"})
+              (node :w:jc {:w:val (name h-align)}))
+        (node :w:tblGrid {}
+              (for [w widths]
+                (node :w:gridCol {:w:gridCol w})))
+        body))

 (defn tr
   "Returns XML tag node of table.
@@ -457,8 +391,8 @@
   Parameters:
   - & body: content of row (td is expected)"
   [& body]
-  {:tag :w:tr
-   :content (remove-nil body)})
+  (node :w:tr {}
+        body))

 (defn td
   "Returns XML tag node of table.
@@ -467,16 +401,11 @@
   - width: width of cell
   - & body: content of cell"
   [width & body]
-  {:tag :w:tc
-   :content
-   (remove-nil
-     (into
-       [{:tag :w:tcPr
-         :content
-         [{:tag :w:tcW
-           :attrs {:w:w width
-                   :w:type "dxa"}}]}]
-       body))})
+  (node :w:tc {}
+        (node :w:tcPr {}
+              (node :w:tcW {:w:w width
+                            :w:type "dxa"}))
+        body))

 (defn p
   "Returns XML tag node of paragraph.
@@ -485,21 +414,15 @@
   - style: <string or keyword> style of paragraph
   - text: <string> text in paragraph"
   ([text]
-   {:tag :w:p
-    :content
-    [{:tag :w:r
-      :content
-      [{:tag :w:t
-        :content [text]}]}]})
+   (node :w:p {}
+         (node :w:r {}
+               (node :w:t {}
+                     text))))
   ([style text]
-   {:tag :w:p
-    :content
-    [{:tag :w:pPr
-      :content
-      [{:tag :w:pStyle
-        :attrs {:w:val (name style)}}]}
-     {:tag :w:r
-      :content
-      [{:tag :w:t
-        :content [text]}]}]}))
-
+   (node :w:p {}
+         (node :w:pPr {}
+               (node :w:pStyle {:w:val (name style)}))
+         (node :w:r {}
+               (node :w:t {}
+                     text)))))
+


capture result of calling protoc- print error messages if the compiler fails

--- src/clj/leiningen/protobuf.clj
+++ src/clj/leiningen/protobuf.clj
@@ -128,14 +128,18 @@
          (.mkdirs dest)
          (.mkdir (io/file target "proto"))
          (doseq [proto protos]
-           (println "Compiling" proto "to" dest-path)
+           (print "Compiling" proto "to" dest-path "... ")
            (extract-dependencies (io/file proto-path proto) target)
-           (sh "protoc"
-               proto
-               (str "--java_out=" dest-path)
-               "-I."
-               (str "-I" target "/proto")
-               :dir proto-path))
+           (let [protoc-result (sh "protoc"
+                                   proto
+                                   (str "--java_out=" dest-path)
+                                   "-I."
+                                   (str "-I" target "/proto")
+                                   :dir proto-path)]
+             (if (= (:exit protoc-result) 0)
+               (println "Success")
+               (do (println "Error")
+                   (println (:err protoc-result))))))
          (javac (assoc project :java-source-path dest-path))))))

 (defn compile-google-protobuf


temp fix for spam  emails

temp fix for spam  emails

--- src/clj/salava/social/mail.clj
+++ src/clj/salava/social/mail.clj
@@ -52,14 +52,14 @@
                                                        (t :social/Emailpages lng))))]
     (html-mail-body-li
      (str  (:first_name item) " " (:last_name item) " "
-          (t :social/Emailhaspublish lng)
+          (t :social/Emailhaspublish lng)
           badge-body
           (if (and badge-body page-body)
             (str " " (t :social/Emailand lng)))
           page-body
-
+
           ".")))
-
+
   )

 (defn follow-events
@@ -74,8 +74,8 @@
                        (assoc-in [key :first_name] (:first_name item))
                        (assoc-in [key :last_name] (:last_name item))
                        (assoc-in  [key typecount]  (inc (get-in current [key typecount] 0))))))
-
-        reduced-events (vals (reduce helper {} (reverse follow-events)))]
+
+        reduced-events (vals (reduce helper {} (reverse (filter #(every? % [:first_name :last_name]) follow-events))))]
     (if-not (empty? follow-events)
       (map (fn [item] (follow-message item lng)) reduced-events))))

@@ -97,7 +97,7 @@
     (if (or admin-events follow-events message-events)
       (html-mail-body-item [:ul
                             (if-not (empty? admin-events)
-                              admin-events)
+                              admin-events)
                             (if-not (empty? follow-events)
                               follow-events)
                             (if-not (empty? message-events)
@@ -111,7 +111,7 @@
   (let [admin? (= "admin" (:role user))
         events (events ctx user lng)
         social-url (str (get-full-path ctx) "/social")]
-    (if (not (empty? events))
+    (if (not (empty? events))
       [:table
        {:width "100%", :border "0", :cellspacing "0", :cellpadding "0"}
        (html-mail-body-item  [:strong (str (t :user/Emailnotificationtext2 lng) ":")] )


Improve performance of common-prefix and suffix functions for Strings.

--- src/clj_diff/optimizations.clj
+++ src/clj_diff/optimizations.clj
@@ -56,8 +56,8 @@

   java.lang.String
   (common-prefix [^String a ^String b]
-                 (let [n (Math/min (.length a) (.length b))
-                       i (loop [i 0]
+                 (let [n (int (Math/min (.length a) (.length b)))
+                       i (loop [i (int 0)]
                            (if (< i n)
                              (if (not= (.charAt a i) (.charAt b i))
                                i
@@ -65,10 +65,10 @@
                              n))]
                    [i (.substring a i) (.substring b i)]))
   (common-suffix [^String a ^String b]
-                 (let [a-length (.length a)
-                       b-length (.length b)
-                       n (Math/min a-length b-length)
-                       i (loop [i 1]
+                 (let [a-length (int (.length a))
+                       b-length (int (.length b))
+                       n (int (Math/min a-length b-length))
+                       i (loop [i (int 1)]
                            (if (<= i n)
                              (if (not= (.charAt a (- a-length i))
                                        (.charAt b (- b-length i)))
@@ -80,13 +80,13 @@
                     (.substring b 0 (- b-length i))]))
   (index-of ([^String a ^String b]
                (.indexOf a b))
-            ([^String a ^String b start]
+            ([^String a ^String b ^Integer start]
                (.indexOf a b start)))
-  (subsequence ([^String a start]
+  (subsequence ([^String a ^Integer start]
                   (.substring a start))
-               ([^String a start end]
+               ([^String a ^Integer start ^Integer end]
                   (.substring a start end)))
-  (concatinate [a b]
+  (concatinate [^String a ^String b]
                (str a b)))

 (defn- short-within-long
@@ -94,7 +94,7 @@
   use the expensive diff algorithm for this."
   [a b ca cb]
   (let [[short long] (if (> ca cb) [b a] [a b])
-        i (index-of long short)]
+        i (int (index-of long short))]
     (if (= i -1)
       nil
       (if (= short a)
@@ -110,7 +110,7 @@
                          (range (+ i cb) ca)))}))))

 (defn- half-match* [long short i]
-  (let [target (subsequence long i (+ i (/ (count long) 4)))]
+  (let [target (subsequence long i (+ i (quot (count long) 4)))]
     (loop [j (index-of short target 0)
            result []]
       (if (= j -1)
@@ -146,8 +146,8 @@
     (if (or (< long-count 4)
             (< (* short-count 2) long-count))
       nil
-      (let [hm-second-q (half-match* long short (/ (+ long-count 3) 4))
-            hm-third-q (half-match* long short (/ (+ long-count 1) 2))
+      (let [hm-second-q (half-match* long short (quot (+ long-count 3) 4))
+            hm-third-q (half-match* long short (quot (+ long-count 1) 2))
             half-match (cond (and hm-second-q hm-third-q)
                              (if (> (count (first hm-second-q))
                                     (count (first hm-third-q)))