localhost://9000 is creacted as a global var as serverhost

--- src_cljs/rrms/corecljs.cljs
+++ src_cljs/rrms/corecljs.cljs
@@ -29,6 +29,7 @@
                           :is-searched-results false
                           :user nil}))

+(def serverhost "http://localhost:9000/")

 (defn set-key-value [k v]
   (reset! storage (assoc @storage k v)))
@@ -105,7 +106,7 @@
                    (if (= (get-status json) 200)
                      ((set-key-value :user (getdata json))
                       (secretary/dispatch! "/documents"))))]
-      (http-post "http://localhost:8193/user/authenticate"
+      (http-post (str serverhost "user/authenticate")
                  onresp (.serialize (Serializer.) (clj->js @data-set ))))
     (reset! focus "on")))

@@ -170,14 +171,14 @@
 (defn get-search-url [mn dt]
   (let [mnv (st/blank? mn)
         dtv (st/blank? dt)
-        purl (str "http://localhost:9000/mutations/search?")]
+        purl (str serverhost "mutations/search?")]
     (cond (and (not mnv) dtv ) (str purl "mutationNumber=" mn)
           (and mnv (not dtv))  (str purl  "value=" dt)
           :else (str purl "mutationNumber="mn"&value="dt))))

 (defn get-index-url [is-searched-results sel-page mn dt]
   (cond (= true is-searched-results)(str (get-search-url mn dt)"&pageIndex="sel-page"&pageSize=10")
-        :else (str "http://localhost:9000/mutations?pageIndex="sel-page "&pageSize=10")))
+        :else (str serverhost "mutations?pageIndex="sel-page "&pageSize=10")))

 (defn get-new-page-data [data current-page total-pages]
   (js/console.log total-pages)
@@ -287,9 +288,6 @@
     (http-get (str (get-search-url mn dt) "&pageIndex=0&pageSize=10")
               onres)))

-;; ========================================================================================
-;; Add-update-form creation validation
-;; ========================================================================================

 (defn form-validator [data-set]
   (first (b/validate data-set
@@ -331,7 +329,7 @@
                                 (int (.-value (.getElementById js/document "districts")))))
         (let [onres (fn[json]
                       (secretary/dispatch! "/"))]
-          (http-post "http://localhost:9000/mutations"
+          (http-post (str serverhost "mutations")
                      onres  (.serialize (Serializer.) (clj->js @data-set)))))
     (reset! focus "on")))

@@ -342,7 +340,7 @@
                                 (int (.-value (.getElementById js/document "districts")))))
         (let [onres (fn[data]
                       (secretary/dispatch! "/"))]
-          (http-put (str "http://localhost:9000/mutations/" (:id @data-set))
+          (http-put (str serverhost "mutations/" (:id @data-set))
                     onres (.serialize (Serializer.) (clj->js @data-set)))))
     (reset! focus "on")))

@@ -360,7 +358,7 @@

     (set-key-value :villages [])
     (when-not ( >  1 (.-length eval))
-      (http-get (str "http://localhost:9000/villages/search?name=" eval)
+      (http-get (str serverhost "villages/search?name=" eval)
                 onresp))))

 (defn input [label type id]
@@ -368,7 +366,7 @@

 (defn get-villages []
   (let [onres (fn[json]((set-key-value :villages (getdata json))))]
-    (http-get "http://localhost:9000/villages" onres)))
+    (http-get (str serverhost "villages") onres)))

 (defn tags-template [data-set]
   (cond (nil? (:villageid @data-set)) [:select.form-control {:id "districts"}
@@ -481,10 +479,6 @@
             focus
             #(update-form-onclick update-data focus)])))

-;; ===============================================================================================
-;; end of add-update-form coding
-;; ===============================================================================================
-

 (defn click-update[id]
   (secretary/dispatch! (str "/mutations/update/" id)))
@@ -492,7 +486,7 @@
 (defn delete[id]
   (let [onres (fn [json]
                 (secretary/dispatch! "/"))]
-    (http-delete (str "http://localhost:9000/mutations/" id)  onres)))
+    (http-delete (str serverhost "mutations/" id)  onres)))

 (defn add [event]
   (secretary/dispatch! "/mutations/add"))
@@ -507,7 +501,7 @@
                   (set-key-value :page-location
                                  [render-mutations (get-value! :mutations)])))]
     (set-key-value :is-searched-results false)
-    (http-get "http://localhost:9000/mutations?pageIndex=0&pageSize=10" onres)))
+    (http-get (str serverhost "mutations?pageIndex=0&pageSize=10") onres)))

 (defn render-mutations [mutations]
   [:div
@@ -587,14 +581,14 @@
                   (set-key-value :total-pages (get-total-rec-no (.-pagesCount dt)))
                   (set-key-value :page-location  [render-mutations (get-value! :mutations)])))]
     (set-key-value :is-searched-results false)
-    (http-get (str "http://localhost:9000/mutations?pageIndex="(dec (get-value! :current-page))"&pageSize=10") onres)))
+    (http-get (str serverhost "mutations?pageIndex="(dec (get-value! :current-page))"&pageSize=10") onres)))

 (defroute documents-path "/mutations/add" []
   (let [onres (fn[json](
                         (set-key-value :villages (getdata json))
                         (set-page! [mutation-add-template])))]
-    (http-get "http://localhost:9000/villages" onres)))
+    (http-get (str serverhost "villages") onres)))

 (defroute documents-path1 "/mutations/update/:id" [id]
   (let [onres (fn[json](
@@ -602,7 +596,7 @@
                        (set-page! [mutation-update-template id
                                    (first (filter (fn[obj]
                                                     (=(.-id obj) (.parseInt js/window id))) (get-value! :mutations)))])))]
-    (http-get "http://localhost:9000/villages" onres)))
+    (http-get (str serverhost "villages") onres)))

 ;; ---------------------------------------------------------
 ;; rvenue-records
@@ -678,7 +672,7 @@
   (if (= nil (revenue-form-validator @data-set))
     (do (reset! data-set (assoc @data-set :villageid (int (.-value (.getElementById js/document "revenue-districts")))))
         (let [onres (fn[json] (secretary/dispatch! "/revenue"))]
-          (http-post "http://localhost:9000/revenuerecords" onres  (.serialize (Serializer.) (clj->js @data-set)))))
+          (http-post (str serverhost "revenuerecords") onres  (.serialize (Serializer.) (clj->js @data-set)))))
   (reset! focus "on")))

@@ -686,7 +680,7 @@
   (if (= nil (revenue-form-validator @data-set))
     (do (reset! data-set (assoc @data-set :villageid (int (.-value (.getElementById js/document "revenue-districts")))))
         (let [onres (fn[data] (secretary/dispatch! "/revenue"))]
-          (http-put (str "http://localhost:9000/revenuerecords/" (:id @data-set)) onres (.serialize (Serializer.) (clj->js @data-set)))))
+          (http-put (str serverhost "revenuerecords/" (:id @data-set)) onres (.serialize (Serializer.) (clj->js @data-set)))))
     (reset! focus "on")))

 (defn revenue-form-cancel [event]
@@ -700,7 +694,7 @@
                    (set-key-value :villages dt)))]
     (set-key-value :villages [])
     (when-not ( >  1 (.-length eval))
-      (http-get (str "http://localhost:9000/villages/search?name=" eval) onresp))))
+      (http-get (str serverhost "villages/search?name=" eval) onresp))))

 (defn revenue-tags-template [data-set]
@@ -752,7 +746,7 @@
 (defn revenue-delete[id]
   (let [onres (fn [json]
                 (secretary/dispatch! "/revenue"))]
-    (http-delete (str "http://localhost:9000/revenuerecords/" id)  onres)))
+    (http-delete (str serverhost "revenuerecords/" id)  onres)))

 (defroute revenue-list "/revenue" []
@@ -762,14 +756,14 @@
                   (set-key-value :total-pages (get-total-rec-no (.-pagesCount dt)))
                   (set-key-value :page-location  [render-revenue (get-value! :revenues)])))]
     (set-key-value :is-searched-results false)
-    (http-get (str "http://localhost:9000/revenuerecords?pageIndex="(dec (get-value! :current-page))"&pageSize=10") onres)))
+    (http-get (str serverhost "revenuerecords?pageIndex="(dec (get-value! :current-page))"&pageSize=10") onres)))

 (defroute revenue-add-path "/revenue/add" []
   (let [onres (fn[json](
                         (set-key-value :villages (getdata json))
                         (set-page! [revenue-add-template])))]
-    (http-get "http://localhost:9000/villages" onres)))
+    (http-get (str serverhost "villages") onres)))

 (defroute revenue-upd-path "/revenue/update/:id" [id]
   (let [onres (fn[json](
@@ -777,7 +771,7 @@
                         (set-page! [revenue-update-template id
                                     (first (filter (fn[obj]
                                                      (=(.-id obj) (.parseInt js/window id))) (get-value! :revenues)))])))]
-    (http-get "http://localhost:9000/villages" onres)))
+    (http-get (str serverhost "villages") onres)))

 (defn revenue-add [event]
   (secretary/dispatch! "/revenue/add"))
@@ -894,7 +888,7 @@
     (do (reset! data-set (assoc @data-set :villageid
                                 (int (.-value (.getElementById js/document "khasragirdwani-districts")))))
         (let [onres (fn[json] (secretary/dispatch! "/khasragirdwani"))]
-          (http-post "http://localhost:9000/khasragirdwanis" onres  (.serialize (Serializer.) (clj->js @data-set)))))
+          (http-post (str serverhost "khasragirdwanis") onres  (.serialize (Serializer.) (clj->js @data-set)))))
   (reset! focus "on")))

@@ -903,7 +897,7 @@
     (do (reset! data-set (assoc @data-set :villageid
                                 (int (.-value (.getElementById js/document "khasragirdwani-districts")))))
         (let [onres (fn[data] (secretary/dispatch! "/khasragirdwani"))]
-          (http-put (str "http://localhost:9000/khasragirdwanis/"
+          (http-put (str serverhost "khasragirdwanis/"
                          (:id @data-set)) onres (.serialize (Serializer.) (clj->js @data-set)))))
     (reset! focus "on")))

@@ -918,7 +912,7 @@
                    (set-key-value :villages dt)))]
     (set-key-value :villages [])
     (when-not ( >  1 (.-length eval))
-      (http-get (str "http://localhost:9000/villages/search?name=" eval) onresp))))
+      (http-get (str serverhost "villages/search?name=" eval) onresp))))

 (defn khasragirdwani-tags-template [data-set]
@@ -970,7 +964,7 @@
 (defn khasragirdwani-delete[id]
   (let [onres (fn [json]
                 (secretary/dispatch! "/khasragirdwani"))]
-    (http-delete (str "http://localhost:9000/khasragirdwanis/" id)  onres)))
+    (http-delete (str serverhost "khasragirdwanis/" id)  onres)))

 (defroute khasragirdwani-list "/khasragirdwani" []
@@ -980,14 +974,14 @@
                   (set-key-value :total-pages (get-total-rec-no (.-pagesCount dt)))
                   (set-key-value :page-location  [render-khasragirdwani (get-value! :khasragirdwanis)])))]
     (set-key-value :is-searched-results false)
-    (http-get (str "http://localhost:9000/khasragirdwanis?pageIndex="(dec (get-value! :current-page))"&pageSize=10") onres)))
+    (http-get (str serverhost "khasragirdwanis?pageIndex="(dec (get-value! :current-page))"&pageSize=10") onres)))

 (defroute khasragirdwani-add-path "/khasragirdwani/add" []
   (let [onres (fn[json](
                         (set-key-value :villages (getdata json))
                         (set-page! [khasragirdwani-add-template])))]
-    (http-get "http://localhost:9000/villages" onres)))
+    (http-get (str serverhost "villages") onres)))

 (defroute khasragirdwani-upd-path "/khasragirdwani/update/:id" [id]
   (let [onres (fn[json](
@@ -996,7 +990,7 @@
                                     (first (filter (fn[obj]
                                                      (=(.-id obj) (.parseInt js/window id)))
                                                    (get-value! :khasragirdwanis)))])))]
-    (http-get "http://localhost:9000/villages" onres)))
+    (http-get (str serverhost "villages") onres)))

 (defn khasragirdwani-add [event]
   (secretary/dispatch! "/khasragirdwani/add"))
@@ -1111,7 +1105,7 @@
   (if (= nil (masavi-form-validator @data-set))
     (do (reset! data-set (assoc @data-set :villageid (int (.-value (.getElementById js/document "masavi-districts")))))
         (let [onres (fn[json] (secretary/dispatch! "/masavi"))]
-          (http-post "http://localhost:9000/masavis" onres  (.serialize (Serializer.) (clj->js @data-set)))))
+          (http-post (str serverhost "masavis") onres  (.serialize (Serializer.) (clj->js @data-set)))))
   (reset! focus "on")))

@@ -1119,7 +1113,7 @@
   (if (= nil (masavi-form-validator @data-set))
     (do (reset! data-set (assoc @data-set :villageid (int (.-value (.getElementById js/document "masavi-districts")))))
         (let [onres (fn[data] (secretary/dispatch! "/masavi"))]
-          (http-put (str "http://localhost:9000/masavis/" (:id @data-set)) onres (.serialize (Serializer.) (clj->js @data-set)))))
+          (http-put (str serverhost "masavis/" (:id @data-set)) onres (.serialize (Serializer.) (clj->js @data-set)))))
     (reset! focus "on")))

 (defn masavi-form-cancel [event]
@@ -1133,7 +1127,7 @@
                    (set-key-value :villages dt)))]
     (set-key-value :villages [])
     (when-not ( >  1 (.-length eval))
-      (http-get (str "http://localhost:9000/villages/search?name=" eval) onresp))))
+      (http-get (str serverhost "villages/search?name=" eval) onresp))))

 (defn masavi-tags-template [data-set]
@@ -1184,7 +1178,7 @@
 (defn masavi-delete[id]
   (let [onres (fn [json]
                 (secretary/dispatch! "/masavi"))]
-    (http-delete (str "http://localhost:9000/masavis/" id)  onres)))
+    (http-delete (str serverhost "masavis/" id)  onres)))

 (defroute masavi-list "/masavi" []
@@ -1194,14 +1188,14 @@
                   (set-key-value :total-pages (get-total-rec-no (.-pagesCount dt)))
                   (set-key-value :page-location  [render-masavi (get-value! :masavis)])))]
     (set-key-value :is-searched-results false)
-    (http-get (str "http://localhost:9000/masavis?pageIndex="(dec (get-value! :current-page))"&pageSize=10") onres)))
+    (http-get (str serverhost "masavis?pageIndex="(dec (get-value! :current-page))"&pageSize=10") onres)))

 (defroute masavi-add-path "/masavi/add" []
   (let [onres (fn[json](
                         (set-key-value :villages (getdata json))
                         (set-page! [masavi-add-template])))]
-    (http-get "http://localhost:9000/villages" onres)))
+    (http-get (str serverhost "villages") onres)))

 (defroute masavi-upd-path "/masavi/update/:id" [id]
   (let [onres (fn[json](
@@ -1209,7 +1203,7 @@
                         (set-page! [masavi-update-template id
                                     (first (filter (fn[obj]
                                                      (=(.-id obj) (.parseInt js/window id))) (get-value! :masavis)))])))]
-    (http-get "http://localhost:9000/villages" onres)))
+    (http-get (str serverhost "villages") onres)))

 (defn masavi-add [event]
   (secretary/dispatch! "/masavi/add"))
@@ -1325,7 +1319,7 @@
   (if (= nil (consolidation-form-validator @data-set))
     (do (reset! data-set (assoc @data-set :villageid (int (.-value (.getElementById js/document "consolidation-districts")))))
         (let [onres (fn[json] (secretary/dispatch! "/consolidation"))]
-          (http-post "http://localhost:9000/consolidations" onres  (.serialize (Serializer.) (clj->js @data-set)))))
+          (http-post (str serverhost "consolidations") onres  (.serialize (Serializer.) (clj->js @data-set)))))
   (reset! focus "on")))

@@ -1333,7 +1327,7 @@
   (if (= nil (consolidation-form-validator @data-set))
     (do (reset! data-set (assoc @data-set :villageid (int (.-value (.getElementById js/document "consolidation-districts")))))
         (let [onres (fn[data] (secretary/dispatch! "/consolidation"))]
-          (http-put (str "http://localhost:9000/consolidations/" (:id @data-set)) onres (.serialize (Serializer.) (clj->js @data-set)))))
+          (http-put (str serverhost "consolidations/" (:id @data-set)) onres (.serialize (Serializer.) (clj->js @data-set)))))
     (reset! focus "on")))

 (defn consolidation-form-cancel [event]
@@ -1347,7 +1341,7 @@
                    (set-key-value :villages dt)))]
     (set-key-value :villages [])
     (when-not ( >  1 (.-length eval))
-      (http-get (str "http://localhost:9000/villages/search?name=" eval) onresp))))
+      (http-get (str serverhost "villages/search?name=" eval) onresp))))

 (defn consolidation-tags-template [data-set]
@@ -1398,7 +1392,7 @@
 (defn consolidation-delete[id]
   (let [onres (fn [json]
                 (secretary/dispatch! "/consolidation"))]
-    (http-delete (str "http://localhost:9000/consolidations/" id)  onres)))
+    (http-delete (str serverhost "consolidations/" id)  onres)))

 (defroute consolidation-list "/consolidation" []
@@ -1408,14 +1402,14 @@
                   (set-key-value :total-pages (get-total-rec-no (.-pagesCount dt)))
                   (set-key-value :page-location  [render-consolidation (get-value! :consolidations)])))]
     (set-key-value :is-searched-results false)
-    (http-get (str "http://localhost:9000/consolidations?pageIndex="(dec (get-value! :current-page))"&pageSize=10") onres)))
+    (http-get (str serverhost "consolidations?pageIndex="(dec (get-value! :current-page))"&pageSize=10") onres)))

 (defroute consolidation-add-path "/consolidation/add" []
   (let [onres (fn[json](
                         (set-key-value :villages (getdata json))
                         (set-page! [consolidation-add-template])))]
-    (http-get "http://localhost:9000/villages" onres)))
+    (http-get (str serverhost "villages") onres)))

 (defroute consolidation-upd-path "/consolidation/update/:id" [id]
   (let [onres (fn[json](
@@ -1423,7 +1417,7 @@
                         (set-page! [consolidation-update-template id
                                     (first (filter (fn[obj]
                                                      (=(.-id obj) (.parseInt js/window id))) (get-value! :consolidations)))])))]
-    (http-get "http://localhost:9000/villages" onres)))
+    (http-get (str serverhost "villages") onres)))

 (defn consolidation-add [event]
   (secretary/dispatch! "/consolidation/add"))
@@ -1472,7 +1466,6 @@
                               [:td  [:a {:href "javascript:;" :on-click #(consolidation-delete(.-id mt))
                                          :class "btn btn-danger btn-sm glyphicon glyphicon-remove"}]]])]]
        [:div{:class "col-xs-6 col-centered col-max"} [shared-state 0]]]]]]])
-;; -----------------------------------------------------------------------------------------------------------

 ;; ---------------------------------------------------------
 ;; rvenue-records
@@ -1539,7 +1532,7 @@
   (if (= nil (fieldbook-form-validator @data-set))
     (do (reset! data-set (assoc @data-set :villageid (int (.-value (.getElementById js/document "fieldbook-districts")))))
         (let [onres (fn[json] (secretary/dispatch! "/fieldbook"))]
-          (http-post "http://localhost:9000/fieldbooks" onres  (.serialize (Serializer.) (clj->js @data-set)))))
+          (http-post (str serverhost "fieldbooks") onres  (.serialize (Serializer.) (clj->js @data-set)))))
   (reset! focus "on")))

@@ -1547,7 +1540,7 @@
   (if (= nil (fieldbook-form-validator @data-set))
     (do (reset! data-set (assoc @data-set :villageid (int (.-value (.getElementById js/document "fieldbook-districts")))))
         (let [onres (fn[data] (secretary/dispatch! "/fieldbook"))]
-          (http-put (str "http://localhost:9000/fieldbooks/" (:id @data-set)) onres (.serialize (Serializer.) (clj->js @data-set)))))
+          (http-put (str serverhost "fieldbooks/" (:id @data-set)) onres (.serialize (Serializer.) (clj->js @data-set)))))
     (reset! focus "on")))

 (defn fieldbook-form-cancel [event]
@@ -1561,7 +1554,7 @@
                    (set-key-value :villages dt)))]
     (set-key-value :villages [])
     (when-not ( >  1 (.-length eval))
-      (http-get (str "http://localhost:9000/villages/search?name=" eval) onresp))))
+      (http-get (str serverhost "villages/search?name=" eval) onresp))))

 (defn fieldbook-tags-template [data-set]
@@ -1612,7 +1605,7 @@
 (defn fieldbook-delete[id]
   (let [onres (fn [json]
                 (secretary/dispatch! "/fieldbook"))]
-    (http-delete (str "http://localhost:9000/fieldbooks/" id)  onres)))
+    (http-delete (str serverhost "fieldbooks/" id)  onres)))

 (defroute fieldbook-list "/fieldbook" []
@@ -1622,14 +1615,14 @@
                   (set-key-value :total-pages (get-total-rec-no (.-pagesCount dt)))
                   (set-key-value :page-location  [render-fieldbook (get-value! :fieldbooks)])))]
     (set-key-value :is-searched-results false)
-    (http-get (str "http://localhost:9000/fieldbooks?pageIndex="(dec (get-value! :current-page))"&pageSize=10") onres)))
+    (http-get (str serverhost "fieldbooks?pageIndex="(dec (get-value! :current-page))"&pageSize=10") onres)))

 (defroute fieldbook-add-path "/fieldbook/add" []
   (let [onres (fn[json](
                         (set-key-value :villages (getdata json))
                         (set-page! [fieldbook-add-template])))]
-    (http-get "http://localhost:9000/villages" onres)))
+    (http-get (str serverhost "villages") onres)))

 (defroute fieldbook-upd-path "/fieldbook/update/:id" [id]
   (let [onres (fn[json](
@@ -1637,7 +1630,7 @@
                         (set-page! [fieldbook-update-template id
                                     (first (filter (fn[obj]
                                                      (=(.-id obj) (.parseInt js/window id))) (get-value! :fieldbooks)))])))]
-    (http-get "http://localhost:9000/villages" onres)))
+    (http-get (str serverhost "villages") onres)))

 (defn fieldbook-add [event]
   (secretary/dispatch! "/fieldbook/add"))
@@ -1707,7 +1700,7 @@
                   (set-key-value :total-pages (get-total-rec-no (.-pagesCount dt)))
                   (set-key-value :page-location  [render-mutations (get-value! :mutations)])))]
     (set-key-value :is-searched-results false)
-    (http-get (str "http://localhost:9000/mutations?pageIndex="(dec (get-value! :current-page))"&pageSize=10") onres)))
+    (http-get (str serverhost "mutations?pageIndex="(dec (get-value! :current-page))"&pageSize=10") onres)))

 (defroute "*" []
   (js/alert "<h1>Not Found Page</h1>"))


PLD: show photo of and date time

PLD: show photo of and date time

--- src/hatti/views/photos.cljs
+++ src/hatti/views/photos.cljs
@@ -20,6 +20,14 @@
    qualified URL."
   [str]
   (remote/make-url (replace str #"/api/v1" "")))
+
+(defn- build-caption
+  [item]
+  (let [datetime (.-date item)
+        date (-> datetime js/moment (.format "MMM D, YYYY"))
+        time (-> datetime js/moment (.format "h:mm A"))]
+    (format "%s
Submitted at %s on %s
Record ID: %s "
+            (.-title item) time date (.-id item))))

 ;;; We use strings for some keywords below because keywords are forced to
 ;;; lower-case.
@@ -49,9 +57,7 @@
                  "addCaptionHTMLFn"
                  (fn [item caption-el is-fake]
                    (set! (-> caption-el .-children first .-innerHTML)
-                         (str (.-title item) "
Submitted at "
-                              (.-date item)
-                              "
Record ID: " (.-id item) "")))}
+                         (build-caption item)))}
         gallery (js/PhotoSwipe. pswp-element
                                 js/PhotoSwipeUI_Default
                                 (clj->js photos)
@@ -68,23 +74,37 @@
 (defn- build-photos
   "Build photos for photoswipe from a set of form data."
   [data]
-  (flatten
-   (for [datum data
-         :let [attachments (get datum constants/_attachments)]
-         :when (seq attachments)]
-     (for [attachment attachments
-           :let [rank (get datum constants/_rank)]]
-       {:src (resize-image
-              (make-url (get attachment constants/download-url))
-              width-px
-              width-px)
-        :thumb (make-url (get attachment constants/small-download-url))
-        :title (format "Submission %s" rank)
-        :date (get datum constants/_submission_time)
-        :id (get datum constants/_id)
-        :rank rank
-        :w width-px
-        :h width-px}))))
+  (let [data-with-attachments (filter #(get % constants/_attachments) data)
+        total (reduce #(+ %1 (count (get %2 constants/_attachments)))
+                      0 data-with-attachments)]
+    (loop [data-left data-with-attachments
+           result []
+           photo-index 1]
+      (if (seq data-left)
+        (let [datum (first data-left)
+              rank (get datum constants/_rank)
+              attachments (get datum constants/_attachments)]
+          (recur
+           (rest data-left)
+           (concat
+            result
+            (map-indexed
+             (fn [j attachment]
+               {:src (resize-image
+                      (make-url (get attachment constants/download-url))
+                      width-px
+                      width-px)
+                :thumb (make-url (get attachment constants/small-download-url))
+                :title (format "%s/%s | Submission %s"
+                               (+ photo-index j) total rank)
+                :date (get datum constants/_submission_time)
+                :id (get datum constants/_id)
+                :rank rank
+                :w width-px
+                :h width-px})
+             attachments))
+           (+ photo-index (count attachments))))
+        result))))

 (defn- build-photo-gallery
   "Build markup with actions for a photo gallery."


Remove unneeded import

Remove unneeded import

No functional changes.

--- clj-s3/src/clj_s3/s3_connect.clj
+++ clj-s3/src/clj_s3/s3_connect.clj
@@ -1,7 +1,6 @@
 (ns clj-s3.s3-connect
     (:import (com.amazonaws.services.s3 AmazonS3ClientBuilder)
       (com.amazonaws.services.s3.model ObjectMetadata PutObjectRequest ListObjectsV2Request DeleteObjectsRequest)
-      (com.amazonaws.auth InstanceProfileCredentialsProvider)
       (java.io ByteArrayInputStream)))

 (declare s3-region)


Don't AOT in distributed spark jar.

Don't AOT in distributed spark jar.

--- spark/project.clj
+++ spark/project.clj
@@ -23,13 +23,6 @@
    ;[org.apache.httpcomponents/httpclient "4.5.2"]
    ]

-  :aot
-  [clojure.tools.logging.impl
-   merkle-db.spark.key-partitioner
-   merkle-db.spark.table-rdd
-   sparkling.destructuring
-   sparkling.serialization]
-
   :profiles
   {:provided
    {:dependencies
@@ -42,4 +35,12 @@
                    org.slf4j/slf4j-log4j12]]
      [org.apache.spark/spark-mllib_2.11 "2.2.1"
       :exclusions [log4j org.slf4j/slf4j-log4j12]]
-     [com.thoughtworks.paranamer/paranamer "2.6"]]}})
+     [com.thoughtworks.paranamer/paranamer "2.6"]]}
+
+   :dev
+   {:aot
+    [clojure.tools.logging.impl
+     merkle-db.spark.key-partitioner
+     merkle-db.spark.table-rdd
+     sparkling.destructuring
+     sparkling.serialization]}})


get flipped cards

get flipped cards

--- Assets/game/core.clj
+++ Assets/game/core.clj
@@ -19,12 +19,19 @@
         (instantiate card-prefab (v3 100 0 0)))

 (def card (object-tagged "Card"))
-(def cards (objects-tagged "Card"))
+(defn cards [] (objects-tagged "Card"))
+
+(defn do-cards [do-card]
+  (doseq [card (cards)]
+    (do-card card)))

 ;(remove-state! card-prefab :rotate?)
-(doseq [card cards]
-  (set-state! card :flipped? false))
-; (set-state! card-prefab :flipped? false)
+(do-cards #(do
+             (set-state! % :flipped? false)
+             (set-state! % :type :default)))
+
+(do-cards #(println (state %)))
+;(set-state! card-prefab :flipped? false)
 ;(set-state! card-prefab :rotate? false)
 ;(update-state! card :rotate? (constantly true))

@@ -53,15 +60,29 @@
     (.SetTrigger animator trigger)))

 (defn cards-flipped []
-  (filter #(state % :flipped?) cards))
+  (filter #(state % :flipped?) (cards)))

 (defn cards-flip-back! [cards]
+  (do-cards set-rotate?-card))
+
+(defn cards-same []
+  (filter #(state % :type)
+          (cards-flipped)))
+
+(defn cards-are-same? []
+  (= (count (cards-same)) 2))
+
+(defn cards-destroy [cards]
   (doseq [card cards]
-    (set-rotate?-card card)))
+    (destroy card)))
+
+;; (cards-destroy (cards-flipped))

 (defn cards-flip-back!-when-2 []
   (if (= (count (cards-flipped)) 2)
-    (cards-flip-back! (cards-flipped))))
+      (if (cards-are-same?)
+        (cards-destroy (cards-same))
+        (cards-flip-back! (cards-flipped)))))

 (count cards)


#1: add cljs lint

#1: add cljs lint

--- ui/app/project.clj
+++ ui/app/project.clj
@@ -43,9 +43,12 @@
   :profiles {:dev {:dependencies [[binaryage/dirac "1.1.5"]
                                   [figwheel-sidecar "0.5.9"]
                                   [com.cemerick/piggieback "0.2.1"]]
+                   :plugins [[lein-kibit "0.1.3"]
+                             [lein-bikeshed "0.4.1"]]
                    :source-paths ["src" "dev"]
                    :repl-options {:port 8230
                                   :nrepl-middleware [dirac.nrepl/middleware]
                                   :init (do
                                           (require 'dirac.agent)
-                                          (dirac.agent/boot!))}}})
+                                          (dirac.agent/boot!))}}}
+  :aliases {"lint" ["do" ["kibit"] ["bikeshed"]]})


Remove slide animation

Remove slide animation

It's too slow, especially with the current swipe implementation that does
not use requestAnimationFrame.

--- src/app/core.cljs
+++ src/app/core.cljs
@@ -167,14 +167,7 @@

 (defn story-item [story]
   (let [;; highlight (with transition) the currently selected/touched story
-        nav (subscribe [:navigation])
-        bg-alpha (reaction (let [percent-swiped-raw (or @(:percent-swiped animation-state) 0)
-                                 negative? (< percent-swiped-raw 0)
-                                 positive? (< 0 percent-swiped-raw)
-                                 percent-swiped-clean (max 0 (min 1 (Math/abs percent-swiped-raw)))]
-                             (cond negative? percent-swiped-clean
-                                   positive? (- 1 percent-swiped-clean)
-                                   :else 0)))]
+        nav (subscribe [:navigation])]
     (fn [story]
       (let [story-id (get story "id")
             ;; TODO: ensure selected is only true if story-item is actually
@@ -182,24 +175,18 @@
             selected? (condp = (-> @nav :item-path count)
                         0 (-> @nav :next-item-id (= story-id))
                         1 (-> @nav :item-path first (= story-id))
-                        false)
-            animate? (and selected? (or (= @bg-alpha 0) (= @bg-alpha 1)))]
+                        false)]
         (if (not story)
           [:div]
           ;; :a {:href (story "url")}
           [:div.story {:style {:display "flex"
                                :justify-content "space-between"
                                :align-items "baseline"
-                               :padding "16px 10px"
-                               ;; swipe highlight
-                               :background-color (if selected?
-                                                   (format/format "rgba(150,150,150,%s)" @bg-alpha)
-                                                   "inherit")
-                               :transition-duration (if animate? "300ms" "0") ;; default duration of swipe.js (options.speed)
-                               :transition-property (if animate? "background-color" "")}
+                               :padding "16px 10px"}
                        :class (if selected? (str "selected") (str "not-selected"))
                        :data-item-id (story "id")}
-           [:div {:style {:flex "0 1 auto" :width "100%"}}
+           [:a {:style {:flex "0 1 auto" :width "100%"}
+                :href "/"}
             (story "title")]
            [:div {:style {:flex "5ex" :text-align "right"}}
             [:span (story "descendants")]]])))))
@@ -273,12 +260,6 @@
         (reset! swipe-object (js/Swipe (reagent/dom-node this)
                                        (clj->js {:continuous false
                                                  :slideStopCallback (fn [slide-index-chanded? index]
-                                                                      (reset! (:percent-swiped animation-state)
-                                                                              (if slide-index-chanded?
-                                                                                (if (< 0 @(:percent-swiped animation-state))
-                                                                                -1
-                                                                                1)
-                                                                                0))
                                                                       (cond
                                                                         (< index @current-index)
                                                                         ;; slide left
@@ -287,9 +268,6 @@
                                                                         ;; slide right
                                                                         (dispatch [:navigation-down]))
                                                                       (reset! current-index index))
-                                                 :slideMoveCallbackDivider 10
-                                                 :slideMoveCallback (fn [percent-swiped resistance-applied?]
-                                                                      (reset! (:percent-swiped animation-state) percent-swiped))
                                                  :slideStartCallback (fn [slide-element]
                                                                        (reset! (:percent-swiped animation-state) 0)
                                                                        (let [item-id (not-empty (find-element-item-id slide-element))]


bump version

bump version

--- scheduler/project.clj
+++ scheduler/project.clj
@@ -13,7 +13,7 @@
 ;; See the License for the specific language governing permissions and
 ;; limitations under the License.
 ;;
-(defproject cook "1.58.12"
+(defproject cook "1.58.13-SNAPSHOT"
   :description "This launches jobs on a Mesos cluster with fair sharing and preemption"
   :license {:name "Apache License, Version 2.0"}
   :dependencies [[org.clojure/clojure "1.10.3"]


bump to snapshot version 1.8.3-SNAPSHOT

bump to snapshot version 1.8.3-SNAPSHOT

--- scheduler/project.clj
+++ scheduler/project.clj
@@ -13,7 +13,7 @@
 ;; See the License for the specific language governing permissions and
 ;; limitations under the License.
 ;;
-(defproject cook "1.8.2"
+(defproject cook "1.8.3-SNAPSHOT"
   :description "This launches jobs on a Mesos cluster with fair sharing and preemption"
   :license {:name "Apache License, Version 2.0"}
   :dependencies [[org.clojure/clojure "1.8.0"]


Expose route

Expose route

--- src/clj/freestuffly/routes/home.clj
+++ src/clj/freestuffly/routes/home.clj
@@ -18,5 +18,6 @@

 (defroutes home-routes
   (GET "/" [] (home-page))
+  (GET "/scrape" [] (scrape-notify-page))
   (GET "/about" [] (about-page)))


Add apidoc for execution

Add apidoc for execution

--- src/clj/lambdacd/execution/core.clj
+++ src/clj/lambdacd/execution/core.clj
@@ -1,5 +1,5 @@
 (ns lambdacd.execution.core
-  "low level functions for job-execution"
+  "Entrypoint into the pipeline/step execution engine."
   (:require [clojure.core.async :as async]
             [lambdacd.state.core :as state]
             [lambdacd.execution.internal.pipeline :as pipeline]
@@ -7,28 +7,59 @@
             [lambdacd.execution.internal.execute-steps :as execute-steps]
             [lambdacd.execution.internal.kill :as kill]))

-(defn run-pipeline [pipeline ctx]
+(defn run-pipeline
+  "Execute a complete run of the pipeline.
+  Returns with the full result of the pipeline execution:
+  ```clojure
+  > (run-pipeline pipeline ctx)
+  {:status  :success
+   :outputs {[1] {:status :success}
+             [2] {:status :success
+                  :outputs {[1 2} {:status :success}}
+  ```"
+  {:doc/format :markdown}
+  [pipeline ctx]
   (pipeline/run-pipeline pipeline ctx (state/next-build-number ctx)))

-(defn retrigger-pipeline [pipeline context build-number step-id-to-run next-build-number]
+(defn retrigger-pipeline
+  "Retriggers a previous build of the pipeline, starting from a particular step-id.
+  Returns the full results of the pipeline execution (see run-pipeline for details)"
+  [pipeline context build-number step-id-to-run next-build-number]
   (let [new-ctx (assoc context :retriggered-build-number build-number
                                :retriggered-step-id step-id-to-run)]
     (pipeline/run-pipeline pipeline new-ctx next-build-number)))

-(defn retrigger-pipeline-async [pipeline context build-number step-id-to-run]
+(defn retrigger-pipeline-async
+  "Retriggers a previous build of the pipeline asynchronously and returning only the build number of the new pipeline-execution."
+  [pipeline context build-number step-id-to-run]
   (let [next-build-number (state/next-build-number context)]
     (async/thread
       (retrigger-pipeline pipeline context build-number step-id-to-run next-build-number))
     next-build-number))

 (defn execute-step
+  "Execute a single step within a pipeline execution.
+  Takes the arguments to pass to the step, the ctx and the step-function to call.
+  Often used when implementing container steps (i.e. steps that call other, child steps)."
   ([args ctx step]
    (execute-step/execute-step args [ctx step]))
   ([args [ctx step]]
    (execute-step/execute-step args [ctx step])))

-(defn execute-steps [steps args ctx & opts]
+(defn execute-steps
+  "Execute a number of steps in a particular way (configured by opts). Usually used when implementing container steps (i.e. steps that call other, child steps).
+
+  Opts:
+
+  * `:step-results-producer` A function that can execute a set of steps and return a step result in the end. Defaults to serial execution
+  * `:is-killed` An atom with vaule true or false if the parent step needs control over when child steps are killed. Optional
+  * `:unify-results-fn` A function that takes a collection of step results and returns a single step result that will be the result of the step while it is in progress. Used to control the parent
+  * `:retrigger-predicate` A function that takes a steps context and the step itself and returns a keyword on what to do when retriggering: `:run` if the step should just run normally, `:rerun` if we rerun a step that ran before or `:mock` if we just mock the steps run by returning the previous result. Defaults to behavior that makes sense of steps run in sequence."
+  {:doc/format :markdown}
+  [steps args ctx & opts]
   (apply execute-steps/execute-steps steps args ctx opts))

-(defn kill-step [ctx build-number step-id]
+(defn kill-step
+  "Send an event to kill a particular step and return immediately."
+  [ctx build-number step-id]
   (kill/kill-step ctx build-number step-id))


Fix navi parsing

Fix navi parsing

--- src/cljs/salava/core/ui/layout.cljs
+++ src/cljs/salava/core/ui/layout.cljs
@@ -9,7 +9,7 @@
             [salava.core.i18n :refer [t]]))

 (defn navi-parent [path]
-  (let [path (s/replace (str path) (re-pattern (base-path)) "")
+  (let [path (s/replace-first (str path) (re-pattern (base-path)) "")
         sections (s/split path #"/")]
     (second sections)))


Fix docstring code style on hmac ns.

Fix docstring code style on hmac ns.

--- src/clojure/buddy/core/mac/hmac.clj
+++ src/clojure/buddy/core/mac/hmac.clj
@@ -68,8 +68,8 @@

 (defprotocol HMacType
   "Unified protocol for calculate a keyed-hash message.
-It comes with default implementations for bytes, String,
-InputStream, File, URL and URI."
+  It comes with default implementations for bytes, String,
+  InputStream, File, URL and URI."
   (make-hmac [data key alg] "Calculate hmac for input using key and alg.")
   (verify-hmac [data signature key alg] "Verify hmac for input using key and alg."))


move more logging statements to trace

move more logging statements to trace

--- src/clojure/redis_protocol/core.clj
+++ src/clojure/redis_protocol/core.clj
@@ -100,13 +100,13 @@
                  (util/crc16 ba))))))
        cluster-hash-slots))

-(defn debug-bytes [buf]
+(defn trace-bytes [buf]
   (let [^String byte-str (with-out-str (bs/print-bytes buf))
         lines (.split byte-str "\n")]
     (doseq [line (take 5 lines)]
-      (debug line))
+      (trace line))
     (if (> (count lines) 5)
-      (debug "..."))))
+      (trace "..."))))

 (defn error? [reply]
   (instance? redis.resp.Error reply))
@@ -302,6 +302,13 @@
        (debug "ignoring op" (ops->str current-ops) "->" (ops->str new-ops)))
      (.interestOps k new-ops))))

+(defmulti dispatch
+  (fn [_ _ event]
+    (first event)))
+
+(defmethod dispatch :default [_ _ [action & event]]
+  (warn "unknown action:" action "event:" event))
+
 (defn route-complete-op [op {:keys [^ConcurrentLinkedDeque dispatch-queue] :as client}]
   (let [reply (.get (.root (.parser op)) 0)]
     (if (reroute? reply)
@@ -313,7 +320,7 @@
               (.addFirst dispatch-queue [:resolve (ask op slot) address]))))
       (op reply))))

-(defn read! [client ^SelectionKey k]
+(defn handle-read! [client ^SelectionKey k]
   (let [^SocketChannel channel (.channel k)
         {:keys [^ConcurrentLinkedDeque read-queue ^ByteBuffer read-buffer] :as conn} (.attachment k)]
     (loop [n (.read channel (doto read-buffer
@@ -326,7 +333,7 @@
         :else     (let [_ (.flip read-buffer)
                         ba (byte-array n)
                         _ (.get read-buffer ba)
-                        _ (debug-bytes ba)]
+                        _ (trace-bytes ba)]
                     (loop [op (.getFirst read-queue)
                            buffer ba]
                       (let [[outcome overflow] (parse op ba)]
@@ -348,9 +355,8 @@
                           (do (error "parse error" outcome)
                               (fail-connection client conn (ex-info "Error parsing Redis Reply" {})))))))))))

-(defn write! [client ^SelectionKey k]
-  (let [^SocketChannel channel (.channel k)
-        {:keys [^SocketChannel channel ^ConcurrentLinkedDeque read-queue ^LinkedBlockingDeque write-queue] :as conn} (.attachment k)]
+(defn handle-write! [client ^SelectionKey k]
+  (let [{:keys [^SocketChannel channel ^ConcurrentLinkedDeque read-queue ^LinkedBlockingDeque write-queue] :as conn} (.attachment k)]
     (loop []
       (if-let [op (.pollFirst write-queue)]
         (let [n (.write channel ^ByteBuffer (.payload op))
@@ -361,24 +367,24 @@
             (incomplete? op) (do (debug "op is incomplete, adding back to write queue")
                                  (set-op! k OP_WRITE)
                                  (.addFirst write-queue op))
-            :else            (do (debug "done writing op")
+            :else            (do (debug "done writing:" op)
                                  (set-op! k OP_READ)
                                  (.addLast read-queue (flip op))
                                  (recur))))
         (do (trace "write queue is empty")
             (ignore-op! k OP_WRITE))))))

-(defn connect! [client ^SelectionKey k]
+(defn handle-connect! [client ^SelectionKey k]
   (let [^SocketChannel channel (.channel k)
         {:keys [^InetSocketAddress address read-queue write-queue] :as conn} (.attachment k)]
     (try
       (debug "finishing connect on" channel)
       (let [connect-finished? (.finishConnect channel)]
         (when connect-finished?
+          (set-op! k OP_READ)
           (ignore-op! k OP_CONNECT)
-          (set-op! k OP_READ)
           (debug "connected, writing queued ops on" )
-          (write! client k)))
+          (handle-write! client k)))
       (catch java.net.ConnectException ex
         (warn ex "error connecting to" address)
         (fail-connection client conn (ex-info "error connecting" {} ex))
@@ -388,13 +394,6 @@
         (fail-connection client conn ex)
         (.cancel k)))))

-(defmulti dispatch
-  (fn [_ _ event]
-    (first event)))
-
-(defmethod dispatch :default [_ _ [action & event]]
-  (warn "unknown action:" action "event:" event))
-
 (defn rand-seed [client]
   (-> client
       :seeds
@@ -406,17 +405,14 @@
 (defmethod dispatch :shutdown [connections {:keys [seeds ^Selector selector] :as client} _]
   (throw shutdown-exception))

-(defn- register! [{:keys [^SocketChannel channel ^InetSocketAddress address] :as conn} ^Selector selector]
-  (if (.connect channel address)
-    (do (debug address "can be established immediately, registering" channel "with" (ops->str OP_READ))
-        (.register channel selector OP_READ conn))
-    (do (debug address "cannot be established immediately, registering" channel "with" (ops->str OP_CONNECT))
-        (.register channel selector OP_CONNECT conn))))
-
 (defn resolve-connection [{:keys [seeds ^Selector selector connections] :as client} address]
   (or (get @connections address)
-      (let [conn (socket-connection address)]
-        (register! conn selector)
+      (let [{:keys [^SocketChannel channel ^InetSocketAddress address] :as conn} (socket-connection address)]
+        (if (.connect channel address)
+          (do (debug address "can be established immediately, registering" channel "with" (ops->str OP_READ))
+              (.register channel selector OP_READ conn))
+          (do (debug address "cannot be established immediately, registering" channel "with" (ops->str OP_CONNECT))
+              (.register channel selector OP_CONNECT conn)))
         (swap! connections assoc address conn)
         conn)))

@@ -438,10 +434,10 @@
             (if (= -1 n)
               (do (warn "connection closed")
                   (cleanup-connection client conn)
-                  (op (ex-info "Connection closed when writing" {:op op})))
+                  (op (ex-info "Connection closed when writing" {})))
               (let [k (.keyFor channel selector)]
                 (if (complete? op)
-                  (do (debug "done writing op:" op)
+                  (do (debug "done writing:" op)
                       (ignore-op! k OP_WRITE)
                       (set-op! k OP_READ)
                       (.addLast read-queue (flip op)))
@@ -482,11 +478,11 @@
                         (debug "key is not valid:" selected-key)
                         (do
                           (when (.isReadable selected-key)
-                            (read! client selected-key))
+                            (handle-read! client selected-key))
                           (when (and (.isValid selected-key) (.isWritable selected-key))
-                            (write! client selected-key))
+                            (handle-write! client selected-key))
                           (when (and (.isValid selected-key) (.isConnectable selected-key))
-                            (connect! client selected-key))))))
+                            (handle-connect! client selected-key))))))
                   (recur))
                 (recur))))
         (warn "Selector is closed")))


Split long lines.

Split long lines.

--- src/cbfg/net.cljs
+++ src/cbfg/net.cljs
@@ -132,7 +132,8 @@
                      (recur (inc ts) listens
                             (assoc streams (:send-ch stream2) stream2)
                             results)))
-                 (if-let [stream (first (filter #(= (:close-recv-ch %) ch) (vals streams)))]
+                 (if-let [stream (first (filter #(= (:close-recv-ch %) ch)
+                                                (vals streams)))]
                    (if v ; Or, test if it's a closed close-recv-ch.
                      (recur (inc ts) listens streams results)
                      (do (aclose net (:recv-ch stream))
@@ -153,7 +154,8 @@
                                   (dissoc listens addr-port)
                                   streams
                                   results)))
-                     (if-let [[keep-open-bool result-ch result-msg] ; Or, was result-ch aput.
+                     ; Else, was succesful result-ch aput (delivery of result-msg).
+                     (if-let [[keep-open-bool result-ch result-msg]
                               (first (filter #(= (second %) ch) results))]
                        (do (when (not keep-open-bool)
                              (aclose net ch))


State.

State.

--- test/com/nomistech/clojure_the_language/c_400_state_and_concurrency/s_030_refs.clj
+++ test/com/nomistech/clojure_the_language/c_400_state_and_concurrency/s_030_refs.clj
@@ -16,11 +16,10 @@
 ;;;; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 ;;;; `ref`, `dosync`, `alter`

-(def bank-account-1-atom (ref 100))
-(def bank-account-2-atom (ref 200))
-
 (fact
-  (let [amount 20]
+  (let [bank-account-1-atom (ref 100)
+        bank-account-2-atom (ref 200)
+        amount 20]
     (dosync
      (alter bank-account-1-atom + amount)
      (alter bank-account-2-atom - amount))


Support keyword params, tweak doc & arg names.

--- src/afterglow/effects/channel.clj
+++ src/afterglow/effects/channel.clj
@@ -66,13 +66,14 @@

 (defn channel-effect
   "Returns an effect which assigns a dynamic value to all the supplied
-  channels. If htp? is true, applies highest-takes-precedence (i.e.
+  channels. If `level is a keyword, it will be looked up as a show
+  variable. If `htp?` is true, applies highest-takes-precedence (i.e.
   compares the value to the previous assignment for the channel, and
   lets the highest value remain)."
-  [name level channels & {:keys [htp?]}]
-  {:pre [(some? name) (some? *show*) (sequential? channels)]}
-  (params/validate-param-type level Number)
-  (let [f (if htp?
+  [effect-name level channels & {:keys [htp?]}]
+  {:pre [(some? effect-name) (some? *show*) (sequential? channels)]}
+  (let [level (params/bind-keyword-param level Number 0)
+        f (if htp?
             ;; We need to resolve any dynamic parameters at this point so we can apply the
             ;; highest-take-precedence rule.
             (fn [show snapshot target previous-assignment]
@@ -82,16 +83,16 @@
             (fn [show snapshot target previous-assignment]
               level))
         assigners (build-raw-channel-assigners channels f)]
-    (Effect. name always-active (fn [show snapshot] assigners) end-immediately)))
+    (Effect. effect-name always-active (fn [show snapshot] assigners) end-immediately)))

 (defn raw-channel-effect
   "Returns an effect which simply calls a function to obtain the
   current level for all the supplied channels, runs forever, and ends
   immediately when requested."
-  [name f channels]
-  {:pre [(some? name) (fn? f) (sequential? channels)]}
+  [effect-name f channels]
+  {:pre [(some? effect-name) (fn? f) (sequential? channels)]}
   (let [assigners (build-raw-channel-assigners channels f)]
-    (Effect. name always-active (fn [show snapshot] assigners) end-immediately)))
+    (Effect. effect-name always-active (fn [show snapshot] assigners) end-immediately)))

 ;; Resolves the assignment of a level to a single DMX channel.
 (defmethod fx/resolve-assignment :channel [assignment show snapshot buffers]


CMR-132: Removed call to reset database from start method of life-cycle.

--- src/cmr/metadata_db/data/oracle.clj
+++ src/cmr/metadata_db/data/oracle.clj
@@ -73,7 +73,6 @@
   lifecycle/Lifecycle

   (start [this system]
-         (reset-database this)
          this)

   (stop [this system]


fixes grammar

fixes grammar

--- access-control-app/int_test/cmr/access_control/int_test/access_control_group_crud_test.clj
+++ access-control-app/int_test/cmr/access_control/int_test/access_control_group_crud_test.clj
@@ -166,7 +166,7 @@
         (is (= ["The following users do not exist [user4]"] errors))))))

 ;; This test currently records a false positive, the single instance acl is not granting permissions because group
-;; service uses echo-rest to determine permissions therefor adding an single instance ACL to cmr has no effect.
+;; service uses echo-rest to determine permissions therefor adding a single instance acl to cmr has no effect.
 ;; The fixture system group acl in mock echo is what allows for any user to modify groups in this test. A ticket is needed to have
 ;; mock-echo use cmr for acls instead of echo-rest to more accurately depict how operations works with cmr-acl-read-enabled.
 (deftest create-group-with-managing-group-id-test


Removed obsolete movie id utility

Removed obsolete movie id utility

--- fetch_episodes.clj
+++ fetch_episodes.clj
@@ -1,49 +0,0 @@
-(require 'leiningen.exec)
-(leiningen.exec/deps '[[org.clojure/clojure "1.7.0"]
-                       [enlive "1.1.6"]
-                       [clj-http "2.0.0"]
-                       [throttler "1.0.0"]])
-
-(import 'java.net.URL)
-(require '[clojure.pprint :refer :all]
-         '[clojure.java.io :as io]
-         '[net.cgrand.enlive-html :as html]
-         '[clj-http.client :as http]
-         '[throttler.core :refer [throttle-fn]])
-
-(def urls
-  (map
-    #(str "http://mostsacked.com/allMovies.cfm?"
-          "order=sack_order&direc=ASC&startRow="
-          %
-          "&searchName=")
-    (iterate (partial + 15) 0)))
-
-(defn parse-id [url]
-  (last
-    (clojure.string/split url #"/")))
-
-(defn parse-row [tr]
-  (let [cells (html/select tr [:td])]
-    {:rt_id (-> cells second :content first :attrs :href parse-id)
-     :imdb_id (-> cells (nth 2) :content first :attrs :href parse-id)
-     :episode_id (-> cells (nth 3) :content first Integer.)
-     :title (-> cells (nth 4) :content first :content first)}))
-
-(with-open [writer (io/writer "episode_data.clj")]
-  (loop [pages urls]
-    (let [resource (html/html-resource (URL. (first pages)))
-          rows (html/select
-                 (first (html/select resource [:table.table-striped]))
-                 [:tbody :tr])]
-      (pprint (first pages))
-      (when-not
-        (-> rows
-            first
-            html/text
-            clojure.string/trim
-            (= "No matching films found!"))
-        (doseq [row rows]
-          (pprint (parse-row row) writer))
-        (recur (rest pages))))))
-


increase irefweb binary interaction query memory efficiency

--- kabob-build/src/main/resources/edu/ucdenver/ccp/kabob/build/rules/temp/irefweb/irefweb.clj
+++ kabob-build/src/main/resources/edu/ucdenver/ccp/kabob/build/rules/temp/irefweb/irefweb.clj
@@ -20,8 +20,92 @@

   :body
   ;; get binary interaction records
+  ((_/edge_field kiao/hasTemplate iaoirefweb/IRefWebInteraction_edgeTypeDataField1)
+   (_/edge_field obo/IAO_0000219 ["X" "en"])   ;; "X" signifies binary interaction
+   (_/interaction_record obo/BFO_0000051 _/edge_field)  ;; bfo/has_part
+
+   ;; get the unique interaction identifier
+   (_/interaction_record obo/BFO_0000051 _/interaction_checksum_field) ;; bfo/has_part
+   (_/interaction_checksum_field kiao/hasTemplate iaoirefweb/IRefWebInteraction_checksumInteractionDataField1)
+   (_/interaction_checksum_field obo/IAO_0000219 ?/unique_interaction_id) ;; iao/denotes
+
+   ;; get the interaction type name and ID
+   (_/interaction_record obo/BFO_0000051 _/interaction_type_record) ;; bfo/has_part
+   (_/interaction_type_record kiao/hasTemplate iaoirefweb/IRefWebInteractionTypeSchema1)
+ ;;  (?/interaction_type_record obo/BFO_0000051 ?/int_type_name_field) ;; bfo/has_part
+ ;;  (?/int_type_name_field kiao/hasTemplate iaoirefweb/IRefWebInteractionType_interactionTypeNameDataField1)
+ ;;  (?/int_type_name_field obo/IAO_0000219 ?/int_type_name) ;; iao/denotes
+   (_/interaction_type_record obo/BFO_0000051 _/int_type_id_field) ;; bfo/has_part
+   (_/int_type_id_field kiao/hasTemplate iaoirefweb/IRefWebInteractionType_interactionTypeIdDataField1)
+   (_/int_type_id_field obo/IAO_0000219 _/int_type_id_ice) ;; iao/denotes
+   (_/int_type_id_ice obo/IAO_0000219 ?/int_type_id) ;; iao/denotes
+
+   ;; get the detection method
+   (_/interaction_record obo/BFO_0000051 _/interaction_detection_method_record) ;; bfo/has_part
+   (_/interaction_detection_method_record kiao/hasTemplate iaoirefweb/IRefWebInteractionDetectionMethodSchema1)
+   (_/interaction_detection_method_record obo/BFO_0000051 _/detection_method_id_field) ;; bfo/has_part
+   (_/detection_method_id_field kiao/hasTemplate iaoirefweb/IRefWebInteractionDetectionMethod_detectionMethodIdDataField1)
+   (_/detection_method_id_field obo/IAO_0000219 ?/detection_method_id) ;; iao/denotes
+
+   ;; there is a "super" record in IRefWeb that contains references
+   ;; to the interaction record and interactor record(s)
+   (_/super_record obo/BFO_0000051 _/interaction_record) ;; bfo/has_part
+
+   ;; get the two distinct interactors for this binary interaction
+   (_/super_record obo/BFO_0000051 _/interactor_record1) ;; bfo/has_part
+   (_/interactor_record1 kiao/hasTemplate iaoirefweb/IRefWebInteractorSchema1)
+   (_/super_record obo/BFO_0000051 _/interactor_record2) ;; bfo/has_part
+   (_/interactor_record2 kiao/hasTemplate iaoirefweb/IRefWebInteractorSchema1)
+   (!= _/interactor_record1 _/interactor_record2)
+
+   ;; get the bioentity (protein) corresponding to interactor 1
+   (_/interactor_record1 obo/BFO_0000051 _/id_field1) ;; bfo/has_part
+   (_/id_field1 kiao/hasTemplate iaoirefweb/IRefWebInteractor_uniqueIdDataField1)
+   (_/id_field1 obo/IAO_0000219 _/id1) ;; iao/denotes
+   (_/id1 obo/IAO_0000219 ?/protein1) ;; iao/denotes
+
+   ;; get the bioentity (protein) corresponding to interactor 2
+   (_/interactor_record2 obo/BFO_0000051 _/id_field2) ;; bfo/has_part
+   (_/id_field2 kiao/hasTemplate iaoirefweb/IRefWebInteractor_uniqueIdDataField1)
+   (_/id_field2 obo/IAO_0000219 _/id2) ;; iao/denotes
+   (_/id2 obo/IAO_0000219 ?/protein2)) ;; iao/denotes
+
+  ;; we take advantage of the fact that IRefWeb has
+  ;; created a unique id for the interaction. This will allow us to reproducibly create
+  ;; a hash for the interaction that can be matched across records.
+  :reify ([?/interaction {:ln (:sha-1 ?/unique_interaction_id)
+                          :ns "kbio" :prefix "I_"}]
+          [?/r1 {:ln (:restriction)
+                 :ns "kbio" :prefix "R_"}]
+          [?/r2 {:ln (:restriction)
+                 :ns "kbio" :prefix "R_"}]
+          [?/protein1_sc {:ln (:sha-1 ?/interaction ?/protein1)
+                          :ns "kbio" :prefix "P_"}]
+          [?/protein2_sc {:ln (:sha-1 ?/interaction ?/protein2)
+                          :ns "kbio" :prefix "P_"}])
+
+  :options {:magic-prefixes [["franzOption_clauseReorderer" "franz:identity"]]}
+  }
+
+
+
+`{:name "irefweb-unary-interactions"
+  :description ""
+  :head ((?/interaction rdfs/subClassOf ?/int_type_id) ;interaction
+
+         ;; create subclasses of the single protein involved
+         (?/protein1_sc rdfs/subClassOf ?/protein1)
+
+         (?/r1 rdf/type owl/Restriction)
+         (?/r1 owl/onProperty obo/RO_0000057) ; has_participant
+         (?/r1 owl/someValuesFrom ?/protein1_sc)
+
+         (?/interaction rdfs/subClassOf ?/r1))
+
+  :body
+  ;; get binary interaction records
   ((?/edge_field kiao/hasTemplate iaoirefweb/IRefWebInteraction_edgeTypeDataField1)
-   (?/edge_field obo/IAO_0000219 ["X" "en"])   ;; "X" signifies binary interaction
+   (?/edge_field obo/IAO_0000219 ["Y" "en"])   ;; "Y" signifies intra-molecular interaction
    (?/interaction_record obo/BFO_0000051 ?/edge_field)  ;; bfo/has_part

    ;; get the unique interaction identifier
@@ -51,24 +135,15 @@
    ;; to the interaction record and interactor record(s)
    (?/super_record obo/BFO_0000051 ?/interaction_record) ;; bfo/has_part

-   ;; get the two distinct interactors for this binary interaction
+   ;; there is only one interactor for the unary interaction
    (?/super_record obo/BFO_0000051 ?/interactor_record1) ;; bfo/has_part
    (?/interactor_record1 kiao/hasTemplate iaoirefweb/IRefWebInteractorSchema1)
-   (?/super_record obo/BFO_0000051 ?/interactor_record2) ;; bfo/has_part
-   (?/interactor_record2 kiao/hasTemplate iaoirefweb/IRefWebInteractorSchema1)
-   (!= ?/interactor_record1 ?/interactor_record2)

    ;; get the bioentity (protein) corresponding to interactor 1
    (?/interactor_record1 obo/BFO_0000051 ?/id_field1) ;; bfo/has_part
    (?/id_field1 kiao/hasTemplate iaoirefweb/IRefWebInteractor_uniqueIdDataField1)
    (?/id_field1 obo/IAO_0000219 ?/id1) ;; iao/denotes
-   (?/id1 obo/IAO_0000219 ?/protein1) ;; iao/denotes
-
-   ;; get the bioentity (protein) corresponding to interactor 2
-   (?/interactor_record2 obo/BFO_0000051 ?/id_field2) ;; bfo/has_part
-   (?/id_field2 kiao/hasTemplate iaoirefweb/IRefWebInteractor_uniqueIdDataField1)
-   (?/id_field2 obo/IAO_0000219 ?/id2) ;; iao/denotes
-   (?/id2 obo/IAO_0000219 ?/protein2)) ;; iao/denotes
+   (?/id1 obo/IAO_0000219 ?/protein1)) ;; iao/denotes

   ;; we take advantage of the fact that IRefWeb has
   ;; created a unique id for the interaction. This will allow us to reproducibly create
@@ -77,11 +152,7 @@
                           :ns "kbio" :prefix "I_"}]
           [?/r1 {:ln (:restriction)
                  :ns "kbio" :prefix "R_"}]
-          [?/r2 {:ln (:restriction)
-                 :ns "kbio" :prefix "R_"}]
           [?/protein1_sc {:ln (:sha-1 ?/interaction ?/protein1)
-                          :ns "kbio" :prefix "P_"}]
-          [?/protein2_sc {:ln (:sha-1 ?/interaction ?/protein2)
                           :ns "kbio" :prefix "P_"}])

   :options {:magic-prefixes [["franzOption_clauseReorderer" "franz:identity"]]}
@@ -89,11 +160,12 @@

-`{:name "irefweb-unary-interactions"
-  :description ""
+`{:name "irefweb-n-ary-interactions"
+  :description "interactions with >2 participants. IRefWeb refers to them as complexes,
+  but these interactions don't necessarily form complexes."
   :head ((?/interaction rdfs/subClassOf ?/int_type_id) ;interaction

-         ;; create subclasses of the single protein involved
+         ;; create subclasses of the proteins
          (?/protein1_sc rdfs/subClassOf ?/protein1)

          (?/r1 rdf/type owl/Restriction)
@@ -105,7 +177,7 @@
   :body
   ;; get binary interaction records
   ((?/edge_field kiao/hasTemplate iaoirefweb/IRefWebInteraction_edgeTypeDataField1)
-   (?/edge_field obo/IAO_0000219 ["Y" "en"])   ;; "Y" signifies intra-molecular interaction
+   (?/edge_field obo/IAO_0000219 ["C" "en"])   ;; "C" signifies "complex" in IRefWeb, but really mean n-ary interaction where n>2
    (?/interaction_record obo/BFO_0000051 ?/edge_field)  ;; bfo/has_part

    ;; get the unique interaction identifier
@@ -135,7 +207,10 @@
    ;; to the interaction record and interactor record(s)
    (?/super_record obo/BFO_0000051 ?/interaction_record) ;; bfo/has_part

-   ;; there is only one interactor for the unary interaction
+   ;; there are two interactors, but one is a place holder that is used to bind
+   ;; multiple records together to form n-ary interactions. The placeholder is
+   ;; identical to the unique interaction ID, so we select the other interactor
+   ;; (which will be linked to a bioentity (protein))
    (?/super_record obo/BFO_0000051 ?/interactor_record1) ;; bfo/has_part
    (?/interactor_record1 kiao/hasTemplate iaoirefweb/IRefWebInteractorSchema1)

@@ -143,6 +218,7 @@
    (?/interactor_record1 obo/BFO_0000051 ?/id_field1) ;; bfo/has_part
    (?/id_field1 kiao/hasTemplate iaoirefweb/IRefWebInteractor_uniqueIdDataField1)
    (?/id_field1 obo/IAO_0000219 ?/id1) ;; iao/denotes
+   (!= ?/id1 ?/unique_interaction_id)
    (?/id1 obo/IAO_0000219 ?/protein1)) ;; iao/denotes

   ;; we take advantage of the fact that IRefWeb has
@@ -157,80 +233,3 @@

   :options {:magic-prefixes [["franzOption_clauseReorderer" "franz:identity"]]}
   }
-
-
-
-`{:name "irefweb-n-ary-interactions"
-  :description "interactions with >2 participants. IRefWeb refers to them as complexes,
-  but these interactions don't necessarily form complexes."
-  :head ((?/interaction rdfs/subClassOf ?/int_type_id) ;interaction
-
-         ;; create subclasses of the proteins
-         (?/protein1_sc rdfs/subClassOf ?/protein1)
-
-         (?/r1 rdf/type owl/Restriction)
-         (?/r1 owl/onProperty obo/RO_0000057) ; has_participant
-         (?/r1 owl/someValuesFrom ?/protein1_sc)
-
-         (?/interaction rdfs/subClassOf ?/r1))
-
-  :body
-  ;; get binary interaction records
-  ((?/edge_field kiao/hasTemplate iaoirefweb/IRefWebInteraction_edgeTypeDataField1)
-   (?/edge_field obo/IAO_0000219 ["C" "en"])   ;; "C" signifies "complex" in IRefWeb, but really mean n-ary interaction where n>2
-   (?/interaction_record obo/BFO_0000051 ?/edge_field)  ;; bfo/has_part
-
-   ;; get the unique interaction identifier
-   (?/interaction_record obo/BFO_0000051 ?/interaction_checksum_field) ;; bfo/has_part
-   (?/interaction_checksum_field kiao/hasTemplate iaoirefweb/IRefWebInteraction_checksumInteractionDataField1)
-   (?/interaction_checksum_field obo/IAO_0000219 ?/unique_interaction_id) ;; iao/denotes
-
-   ;; get the interaction type name and ID
-   (?/interaction_record obo/BFO_0000051 ?/interaction_type_record) ;; bfo/has_part
-   (?/interaction_type_record kiao/hasTemplate iaoirefweb/IRefWebInteractionTypeSchema1)
-   (?/interaction_type_record obo/BFO_0000051 ?/int_type_name_field) ;; bfo/has_part
-   (?/int_type_name_field kiao/hasTemplate iaoirefweb/IRefWebInteractionType_interactionTypeNameDataField1)
-   (?/int_type_name_field obo/IAO_0000219 ?/int_type_name) ;; iao/denotes
-   (?/interaction_type_record obo/BFO_0000051 ?/int_type_id_field) ;; bfo/has_part
-   (?/int_type_id_field kiao/hasTemplate iaoirefweb/IRefWebInteractionType_interactionTypeIdDataField1)
-   (?/int_type_id_field obo/IAO_0000219 ?/int_type_id_ice) ;; iao/denotes
-   (?/int_type_id_ice obo/IAO_0000219 ?/int_type_id) ;; iao/denotes
-
-   ;; get the detection method
-   (?/interaction_record obo/BFO_0000051 ?/interaction_detection_method_record) ;; bfo/has_part
-   (?/interaction_detection_method_record kiao/hasTemplate iaoirefweb/IRefWebInteractionDetectionMethodSchema1)
-   (?/interaction_detection_method_record obo/BFO_0000051 ?/detection_method_id_field) ;; bfo/has_part
-   (?/detection_method_id_field kiao/hasTemplate iaoirefweb/IRefWebInteractionDetectionMethod_detectionMethodIdDataField1)
-   (?/detection_method_id_field obo/IAO_0000219 ?/detection_method_id) ;; iao/denotes
-
-   ;; there is a "super" record in IRefWeb that contains references
-   ;; to the interaction record and interactor record(s)
-   (?/super_record obo/BFO_0000051 ?/interaction_record) ;; bfo/has_part
-
-   ;; there are two interactors, but one is a place holder that is used to bind
-   ;; multiple records together to form n-ary interactions. The placeholder is
-   ;; identical to the unique interaction ID, so we select the other interactor
-   ;; (which will be linked to a bioentity (protein))
-   (?/super_record obo/BFO_0000051 ?/interactor_record1) ;; bfo/has_part
-   (?/interactor_record1 kiao/hasTemplate iaoirefweb/IRefWebInteractorSchema1)
-
-   ;; get the bioentity (protein) corresponding to interactor 1
-   (?/interactor_record1 obo/BFO_0000051 ?/id_field1) ;; bfo/has_part
-   (?/id_field1 kiao/hasTemplate iaoirefweb/IRefWebInteractor_uniqueIdDataField1)
-   (?/id_field1 obo/IAO_0000219 ?/id1) ;; iao/denotes
-   (!= ?/id1 ?/unique_interaction_id)
-   (?/id1 obo/IAO_0000219 ?/protein1)) ;; iao/denotes
-
-  ;; we take advantage of the fact that IRefWeb has
-  ;; created a unique id for the interaction. This will allow us to reproducibly create
-  ;; a hash for the interaction that can be matched across records.
-  :reify ([?/interaction {:ln (:sha-1 ?/unique_interaction_id)
-                          :ns "kbio" :prefix "I_"}]
-          [?/r1 {:ln (:restriction)
-                 :ns "kbio" :prefix "R_"}]
-          [?/protein1_sc {:ln (:sha-1 ?/interaction ?/protein1)
-                          :ns "kbio" :prefix "P_"}])
-
-  :options {:magic-prefixes [["franzOption_clauseReorderer" "franz:identity"]
-                             ["franzOption_memoryLimit" "franz:85g"]]}
-  }


Add more info to index

Add more info to index

--- src/obb_rules_api/index.clj
+++ src/obb_rules_api/index.clj
@@ -1,8 +1,14 @@
 (ns obb-rules-api.index
-  (:require [obb-rules-api.reply :as reply]))
+  (:require [obb-rules-api.reply :as reply]
+            [obb-rules.turn :as turn]
+            [obb-rules.game :as game]
+            [obb-rules.actions.move :as move]))

 (defn handler
   "Processes the root endpoint"
   []
   (reply/ok {:name "obb-rules-api"
-             :version (System/getProperty "obb-rules-api.version")}))
+             :version (System/getProperty "obb-rules-api.version")
+             :rules {:version game/version
+                     :max-action-points turn/max-action-points
+                     :min-move-percentage move/min-move-percentage}}))


add missing import

add missing import

--- src/replikativ/realize.cljc
+++ src/replikativ/realize.cljc
@@ -4,13 +4,13 @@
             [konserve.core :as k]
             [replikativ.environ :refer [store-blob-trans-id store-blob-trans-value store-blob-trans]]
             [kabel.platform-log :refer [debug info warn]]
-            #?(:clj [superv.async :refer [<? go-try <?*]])
+            #?(:clj [superv.async :refer [<? go-try go-loop-try <?*]])
             #?(:clj [superv.lab :refer [go-loop-super]])
             #?(:clj [clojure.core.async :as async
                      :refer [>! timeout chan alt! put! sub unsub pub close!]]
                :cljs [cljs.core.async :as async
                       :refer [>! timeout chan put! sub unsub pub close!]]))
-  #?(:cljs (:require-macros [superv.async :refer [go-try <? <?*]])))
+  #?(:cljs (:require-macros [superv.async :refer [go-try go-loop-try <? <?*]])))

 (defn commit-transactions


Little fix

Little fix

--- src/strange_coop/bbbpin.clj
+++ src/strange_coop/bbbpin.clj
@@ -126,7 +126,7 @@
   WriteablePin
   (write! [this value]
     {:pre [(#{:on :off} direction)]}
-    (reset! (:value this) assoc value)
+    (reset! (:value this) value)
     value)
   ReadablePin
   (read! [this]


Add cluster, isip, inclination and azimuth

--- src/test_utils/sandbox.cljs
+++ src/test_utils/sandbox.cljs
@@ -74,6 +74,12 @@

 (defn rand-stage-number []
   (inc (tuc/rand-2)))
+
+(defn rand-cluster-count []
+  (inc (rand-nth (range 2 7))))
+
+(defn rand-cluster-number []
+  (inc (rand-nth (range 7))))

 (defn typical-trajectory-md-length []
   (tuc/draw-normal 93.7 0.4))
@@ -164,3 +170,12 @@
         x-distance (* euclidean-distance (Math/cos (* (/ (+ plot-angle 90) 180) Math.PI)))
         y-distance (* euclidean-distance (Math/sin (* (/ (+ plot-angle 90) 180) Math.PI)))]
     [x-distance y-distance]))
+
+(defn typical-isip []
+  (tuc/draw-normal 3102 497))
+
+(defn typical-inclination []
+  (tuc/draw-normal 92.2 2.4))
+
+(defn typical-azimuth [plot-angle]
+  (tuc/draw-normal plot-angle 1.24))


indenting

indenting

--- web/celestial/routes/system.clj
+++ web/celestial/routes/system.clj
@@ -7,7 +7,6 @@
     [celestial.model :refer [figure-virt]]
     [celestial.models.system :as sys]
     [celestial.views.layout :as layout]
-    [celestial.util :as util]
     [compojure.route :as route]))

 (def port-view 10)
@@ -41,8 +40,7 @@
 (defn- system
   "renders a system"
   [id]
-  (let [system (sys/system id)
-        props (into base {:system system })]
+  (let [system (sys/system id) props (into base {:system system})]
      (layout/render (<<  "~(-> system figure-virt name).html") props)))

 (defroutes system-routes


Fix spelling of logging dirname key namespace.

--- airesources/Clojure/src/hlt/log.clj
+++ airesources/Clojure/src/hlt/log.clj
@@ -21,7 +21,7 @@

 (defn log-game-map
   [turn game-map]
-  (let [{:keys [com.grzm.halite2.log/dirname bot-name]} @config
+  (let [{:keys [hlt.log/dirname bot-name]} @config
         game-map-file (format "%s/%s-game-map-%03d.edn" dirname bot-name turn)]
     (spit game-map-file game-map)))


[#2620] Adapt pie backend aggregation

[#2620] Adapt pie backend aggregation

--- backend/src/akvo/lumen/lib/aggregation/pie.clj
+++ backend/src/akvo/lumen/lib/aggregation/pie.clj
@@ -1,6 +1,6 @@
 (ns akvo.lumen.lib.aggregation.pie
   (:require [akvo.lumen.lib :as lib]
-            [akvo.lumen.lib.aggregation.commons :refer (run-query) :as commons]
+            [akvo.lumen.lib.aggregation.commons :refer (run-query sql-option-bucket-column) :as commons]
             [akvo.lumen.lib.dataset.utils :refer (find-column)]
             [akvo.lumen.postgres.filter :refer (sql-str)]
             [clojure.java.jdbc :as jdbc]))
@@ -10,7 +10,7 @@
   (let [filter-sql    (sql-str columns (:filters query))
         bucket-column (find-column columns (:bucketColumn query))
         query         (format "SELECT %1$s, count(*) FROM %2$s WHERE %3$s GROUP BY %1$s"
-                              (:columnName bucket-column) table-name filter-sql)
+                              (sql-option-bucket-column bucket-column) table-name filter-sql)
         counts        (run-query tenant-conn query)
         max-segments  50]
     (if (> (count counts) max-segments)


Default charset for produces/consumes

Default charset for produces/consumes

If charset is not specified, it defaults to the platform default
charset.

--- src/yada/representation.clj
+++ src/yada/representation.clj
@@ -116,7 +116,7 @@

     :otherwise
     (fn [rep]
-      (best (map (partial charset-acceptable? (:charset rep)) accepts)))))
+      (best (map (partial charset-acceptable? (or (:charset rep) charset/default-platform-charset)) accepts)))))

 (defn make-charset-quality-assessor
   [req k]


removed useless code

removed useless code

--- test/blogiseq/core_test.clj
+++ test/blogiseq/core_test.clj
@@ -1,7 +0,0 @@
-(ns blogiseq.core-test
-  (:require [clojure.test :refer :all]
-            [blogiseq.core :refer :all]))
-
-(deftest a-test
-  (testing "FIXME, I fail."
-    (is (= 0 1))))


Use structured data for movies and people

--- src/clj/chili_dog_night/views.clj
+++ src/clj/chili_dog_night/views.clj
@@ -11,10 +11,8 @@
   [:header {:role "banner"}
    [:h1 (el/link-to "/" "Chili Dog Night")]
    [:nav
-    (el/unordered-list [;(el/link-to "/gatherings" "Gatherings")
-                        (el/link-to "/about" "About")
-                        (el/link-to "/colophon" "Colophon")
-                        (el/link-to "/rss" "RSS")])]])
+    (el/unordered-list [(el/link-to "/about" "About")
+                        (el/link-to "/colophon" "Colophon")])]])

 (defn footer []
   [:footer {:role "contentinfo"}
@@ -37,12 +35,17 @@
     (footer)]))

 (defn film-citation [film]
-  [:cite
+  [:cite {:itemscope ""
+          :itemtype "http://schema.org/Movie"}
+   [:meta {:itemprop "name"
+           :content (:title film)}]
    (el/link-to (:uri film)
                (str/replace (:title film) #"\s" " "))])

-(defn comma-separate [coll]
-  (concat [" "] (reduce #(apply vector [% ", " %2]) coll)))
+(defn person [name]
+  [:span {:itemscope ""
+          :itemtype "http://schema.org/Person"}
+   [:span {:itemprop "name"} name]])

 (defn comma-separate-str [coll]
   (if (= (count coll) 1)
@@ -51,14 +54,23 @@
        ", and "
        (last coll))))

+(defn comma-separate [coll]
+  (reduce into (concat
+                (map #(vec [% ", "])
+                     (drop-last 2 coll))
+                (reduce #(vec [[ % ", and "] [%2]])
+                        (take-last 2 coll)))))
+
 (defn gathering-partial [data]
   [:section
    [:h2 (:date data)]
-   [:p (comma-separate-str (sort (:attendees data)))
-    " experienced "
-    (comma-separate
-     (map film-citation (:media data)))
-    ". They ate " (comma-separate-str (:food data)) "."]
+   (reduce into [:p]
+           [(comma-separate (map person (sort (:attendees data))))
+            " experienced "
+            (comma-separate (map film-citation (:media data)))
+            ". They ate "
+            (comma-separate-str (:food data))
+            "."])
    [:p "This is what they discussed during, and between films:"]
    (:notes data)])

@@ -93,9 +105,19 @@
             ", the real focus, and most painful kind of movie, is mainstream mediocrity, like "
             (film-citation {:title "Aloha" :uri "http://www.imdb.com/title/tt1243974/"})
             "."]
-           [:p "As of this moment Chili Dog Night is Alex Sanchez, Jason Aumann, "
-            "Greg Ryan, Jacob Dobner, Matt Beck, Colin Teal, and Kaia. They all hail from Seattle, "
-            "and are slowly losing their minds one film at a time."]]))
+           [:p "As of this moment Chili Dog Night is "
+            (person "Alex Sanchez")
+            ", "
+            (person "Jason Aumann")
+            ", "
+            (person "Greg Ryan")
+            ", "
+            (person "Jacob Dobner")
+            ", "
+            (person "Matt Beck")
+            ", "
+            (person "Colin Teal")
+            ", and Kaia. They all hail from Seattle, and are slowly losing their minds one film at a time."]]))

 (defn colophon []
   (common "Colophon"


map simple consumer messages to-clojure

map simple consumer messages to-clojure

--- src/clj_kafka/consumer/simple.clj
+++ src/clj_kafka/consumer/simple.clj
@@ -1,9 +1,8 @@
 (ns clj-kafka.consumer.simple
   (:use [clj-kafka.core :only (to-clojure)])
   (:import [kafka.javaapi.consumer SimpleConsumer]
-           [kafka.api FetchRequestBuilder PartitionOffsetRequestInfo]
-           [kafka.javaapi OffsetRequest]
-           [kafka.javaapi TopicMetadataRequest]
+           [kafka.api FetchRequest FetchRequestBuilder PartitionOffsetRequestInfo]
+           [kafka.javaapi OffsetRequest TopicMetadataRequest FetchResponse]
            [kafka.common TopicAndPartition]))

 (defn consumer
@@ -25,9 +24,9 @@
 (defn messages
   [^SimpleConsumer consumer client-id topic partition offset fetch-size]
   (let [fetch (fetch-request client-id topic partition offset fetch-size)]
-    (iterator-seq (.iterator (.messageSet ^kafka.javaapi.FetchResponse (.fetch consumer ^kafka.api.FetchRequest fetch)
-                                          topic
-                                          partition)))))
+    (map to-clojure (iterator-seq (.iterator (.messageSet ^FetchResponse (.fetch consumer ^FetchRequest fetch)
+                                                          topic
+                                                          partition))))))

 (defn topic-meta-data [consumer topics]
   (to-clojure (.send consumer (TopicMetadataRequest. topics))))


directly show action buttons after mulligan choice

--- src/cljs/netrunner/gameboard.cljs
+++ src/cljs/netrunner/gameboard.cljs
@@ -241,11 +241,9 @@
                  [:div
                   [:h4 "Keep hand?"]
                   [:button {:on-click #(send-command "keep")} "Keep hand"]
-                  [:button {:on-click #(send-command "mulligan")} "Mulligan"]]
-                 (when-not (:keep opponent)
-                   [:h4 "Waiting for opponent's mulligan choice."]))
-
-               (when (and (:keep me) (:keep opponent))
+                  [:button {:on-click #(send-command "mulligan")} "Mulligan"]])
+
+               (when (:keep me)
                  [:div
                   (when (= side :runner)
                     (cond-button "Remove Tag" "remove-tag"


fix wrong syntax

fix wrong syntax

--- exercise3/src/de/haw/vs/data_links/message_writer.clj
+++ exercise3/src/de/haw/vs/data_links/message_writer.clj
@@ -21,7 +21,7 @@
   c/Lifecycle
   (start [self]
     (log/info "-> starting MessageWriter Component")
-    (append-messages-to-file (get-in [:config :output-file] config) in-chan)
+    (append-messages-to-file (get-in config [:config :output-file]) in-chan)
     self)

   (stop [self]


Tidied up JSON library

Tidied up JSON library

--- lib/compojure/json/json.clj
+++ lib/compojure/json/json.clj
@@ -1,17 +1,15 @@
-;; Turn Clojure datatypes into a JSON string
-(ns compojure.json)
+;; compojure.json
+;;
+;; Small library for formatting standard Clojure datatype as a JSON string.

-(use '(clojure.contrib str-utils))
+(ns compojure.json
+  (:use (clojure.contrib str-utils)))

 (def json)

-(defn json-list
-  [coll]
-  (str-join ", " (map json coll)))
-
 (defn- json-array
   [coll]
-  (str "[" (json-list coll) "]"))
+  (str "[" (str-join ", " (map json coll)) "]"))

 (defn- json-object
   [hash]
@@ -20,12 +18,14 @@
     (str "{" (str-join ", " (map pair hash)) "}")))

 (defn json
-  "Parse a Clojure datatype into a portable JSON format."
+  "Format a Clojure datatype into a portable JSON format."
   [x]
   (cond
-    (nil? x)             "null"
-    (vector? x)          (json-array x)
-    (map? x)             (json-object x)
-    (string? x)          (pr-str x)
-    (keyword? x)         (pr-str (name x))
-    (instance? Number x) (pr-str x)))
+    (nil? x)     "null"
+    (seq? x)     (json-array x)
+    (vector? x)  (json-array x)
+    (map? x)     (json-object x)
+    (string? x)  (pr-str x)
+    (keyword? x) (pr-str (name x))
+    (number? x)  (pr-str x)
+                 (.toString x)))


json string

json string

--- test/celestial/fixtures.clj
+++ test/celestial/fixtures.clj
@@ -16,6 +16,8 @@

 (def user-quota (slurp-edn "fixtures/user-quota.edn"))

+;; (println (clojure.data.json/write-str redis-prox-spec :escape-slash false))
+
 (defn is-type? [type]
   (fn [exception]
     (= type (get-in (.getData exception) [:object :type]))))


fix a bug that file in the sub package of the target project could not be deleted

--- src/leiningen/leinsync/packages.clj
+++ src/leiningen/leinsync/packages.clj
@@ -61,11 +61,13 @@

 (defn delete-package-files-of-target-project [target-project folder-name package-path]
   (try
-    (doseq [file-to-delete (-> (pr/->target-project-path target-project)
-                               (str "/" folder-name "/" package-path)
-                               ^File (io/file)
-                               .listFiles)]
-      (io/delete-file file-to-delete true))
+    (doseq [^File file-to-delete (-> (pr/->target-project-path target-project)
+                                     (str "/" folder-name "/" package-path)
+                                     ^File (io/file)
+                                     .listFiles)]
+      (if (.isDirectory file-to-delete)
+        (FileUtils/deleteDirectory file-to-delete)
+        (io/delete-file file-to-delete true)))
     (catch Exception e
       (m/info "**** [Error] when deleting a file of the folder:" folder-name (.getMessage e))
       (if @u/DEBUG-MODE (m/info e)))))


update css build

update css build

--- src/dev/build.clj
+++ src/dev/build.clj
@@ -9,11 +9,10 @@
             (cb/index-path (io/file "src" "main") {})
             (cb/generate
               '{:ui
-                {:include
-                 [shadow.cljs.ui*
-                  shadow.cljs.devtools.server.web*]}})
+                {:entries
+                 [shadow.cljs.ui.main]}})
+            (cb/minify)
             (cb/write-outputs-to (io/file "src" "ui-release" "shadow" "cljs" "ui" "dist" "css")))]
-    (tap> build-state)

     (doseq [mod (:outputs build-state)
             {:keys [warning-type] :as warning} (:warnings mod)]


CLJS-1310: ns libspec error message misses :import

--- src/main/clojure/cljs/analyzer.cljc
+++ src/main/clojure/cljs/analyzer.cljc
@@ -1862,7 +1862,7 @@
           (reduce
             (fn [m [k & libs]]
               (when-not (#{:use :use-macros :require :require-macros :import} k)
-                (throw (error env "Only :refer-clojure, :require, :require-macros, :use and :use-macros libspecs supported")))
+                (throw (error env "Only :refer-clojure, :require, :require-macros, :use, :use-macros, and :import libspecs supported")))
               (when-not (@valid-forms k)
                 (throw (error env (str "Only one " k " form is allowed per namespace definition"))))
               (swap! valid-forms disj k)


Add 'suite-result?'

Add 'suite-result?'

--- src/main/clojure/lazytest/suite.clj
+++ src/main/clojure/lazytest/suite.clj
@@ -28,3 +28,6 @@
 	 (seq? children)]}
   (with-meta {:source source, :children children}
     {:type ::suite-result}))
+
+(defn suite-result? [x]
+  (isa? (type x) ::suite-result))


Fix bug where a previous epoch would be suggested

When it wasn't possible to go back further.

--- src/day8/re_frame/trace/subs.cljs
+++ src/day8/re_frame/trace/subs.cljs
@@ -238,7 +238,7 @@
   :<- [:epochs/current-epoch-id]
   :<- [:epochs/match-ids]
   (fn [[current ids]]
-    (and (pos? (count ids))
+    (and (< 1 (count ids))
          (or (nil? current)
              (> current (nth ids 0))))))

@@ -247,7 +247,7 @@
   :<- [:epochs/current-epoch-id]
   :<- [:epochs/match-ids]
   (fn [[current ids]]
-    (and (pos? (count ids))
+    (and (< 1 (count ids))
          (some? current)
          (< current (utils/last-in-vec ids)))))


Switch to using the standard screenX and screenY properties

screenLeft is non-standard.

--- src/day8/re_frame_10x/events.cljs
+++ src/day8/re_frame_10x/events.cljs
@@ -248,8 +248,8 @@
                                    (fn []
                                      ;; Only update re-frame if the windows position has changed.
                                      (let [{:keys [left top]} @pos
-                                           screen-left (.-screenLeft popup-window)
-                                           screen-top (.-screenTop popup-window)]
+                                           screen-left (.-screenX popup-window)
+                                           screen-top (.-screenY popup-window)]
                                        (when (or (not= left screen-left)
                                                (not= top screen-top))
                                          (rf/dispatch [:settings/external-window-position {:left screen-left :top screen-top}])


Fix indentation.

Fix indentation.

--- src/dsbdp/data_processing_dsl.clj
+++ src/dsbdp/data_processing_dsl.clj
@@ -21,14 +21,14 @@
         (fn [v data-proc-def-element]
           (cond
             (symbol? data-proc-def-element) (let [s data-proc-def-element]
-                                               (condp not= nil
-                                                 (ns-resolve 'clojure.core s)
-                                                   (conj v (ns-resolve 'clojure.core s))
-                                                 (ns-resolve 'dsbdp.byte-array-conversion s)
-                                                   (conj v (ns-resolve 'dsbdp.byte-array-conversion s) 'input)
-                                                 (do
-                                                   (println "Could not resolve symbol:" s)
-                                                    v)))
+                                              (condp not= nil
+                                                (ns-resolve 'clojure.core s)
+                                                  (conj v (ns-resolve 'clojure.core s))
+                                                (ns-resolve 'dsbdp.byte-array-conversion s)
+                                                  (conj v (ns-resolve 'dsbdp.byte-array-conversion s) 'input)
+                                                (do
+                                                  (println "Could not resolve symbol:" s)
+                                                   v)))
             (list? data-proc-def-element) (conj v (into '() (reverse (create-data-processing-sub-fn data-proc-def-element input offset))))
             :default (conj v data-proc-def-element)))
         [] data-processing-definition))))


fixed sample test for trialing ci options ^_^

--- test/listopia/core_test.clj
+++ test/listopia/core_test.clj
@@ -4,4 +4,4 @@

 (deftest a-test
   (testing "FIXME, I fail."
-    (is (= 0 1))))
+    (is (= 0 0))))


Added a unit test for 'field exists'

Added a unit test for 'field exists'

--- test/marcgrep/test/core.clj
+++ test/marcgrep/test/core.clj
@@ -93,3 +93,10 @@
     (doseq [dst [dest-1 dest-2 dest-3 dest-4]]
       @(:matched-ids dst))))

+
+(deftest exists-search
+  (the-query {:operator "exists"
+              :field "001"
+              :value true}
+             :on test-dataset
+             :matches ["12345" "23456"]))


I cannot type :'(

I cannot type :'(

--- test/metabase/test_util.clj
+++ test/metabase/test_util.clj
@@ -32,7 +32,7 @@

 ;;; tests for RPARTIAL

-(expect -3
+(expect 3
   ((rpartial - 5) 8))

 (expect -7


Modified to match corrected test suite

Modified to match corrected test suite

Would it have been better to just paste in my own solution?

--- exercises/proverb/src/example.clj
+++ exercises/proverb/src/example.clj
@@ -1,15 +1,15 @@
 (ns proverb
   (:require [clojure.string :as str]))

-(def subjects ["nail" "shoe" "horse" "rider" "message" "battle" "kingdom"])
-
-(def last-line "And all for the want of a nail.")
+(def last-line "And all for the want of a %s.")

 (defn- line [[cause-subject effect-subject]]
   (format "For want of a %s the %s was lost." cause-subject effect-subject))

-(def proverb (->> subjects
-                  (partition 2 1)
-                  (map line)
-                  (#(conj (vec %) last-line))
-                  (str/join "\n")))
+(defn recite [subjects]
+  (if (empty? subjects) ""
+    (->> subjects
+    (partition 2 1)
+    (map line)
+    (#(conj (vec %) (format last-line (first subjects))))
+    (str/join "\n"))))


(fix) try to fix issue #6

(fix) try to fix issue #6

--- test/papaline/core_test.clj
+++ test/papaline/core_test.clj
@@ -239,11 +239,10 @@
           sync-chan (chan)
           num 5
           f (vec (take num (repeat (fn [c sync-chan] (swap! c inc) [c sync-chan]))))
-          f (conj f (fn [c sync-chan] (>!! sync-chan 0)))
           stgs (map stage f)
           ppl (pipeline stgs)]
       (binding [*pre-execution-hook* (fn [_] (reset! h0 true))
-                *post-execution-hook* (fn [_] (reset! h1 true))]
+                *post-execution-hook* (fn [_] (reset! h1 true) (>!! sync-chan 0))]
         (run-pipeline ppl c0 sync-chan)
         (<!! sync-chan)
         (is (= num @c0))
@@ -256,11 +255,10 @@
           num 5
           executor (make-thread-pool 2 2)
           f (vec (take num (repeat (fn [c sync-chan] (swap! c inc) [c sync-chan]))))
-          f (conj f (fn [c sync-chan] (>!! sync-chan 0)))
           stgs (map stage f)
           ppl (dedicated-thread-pool-pipeline stgs executor)]
       (binding [*pre-execution-hook* (fn [_] (reset! h0 true))
-                *post-execution-hook* (fn [_] (reset! h1 true))]
+                *post-execution-hook* (fn [_] (reset! h1 true) (>!! sync-chan 0))]
         (run-pipeline ppl c0 sync-chan)
         (<!! sync-chan)
         (is (= num @c0))
@@ -273,11 +271,10 @@
           num 5
           executor (make-thread-pool 2 2)
           f (vec (take num (repeat (fn [c sync-chan] (swap! c inc) [c sync-chan]))))
-          f (conj f (fn [c sync-chan] (>!! sync-chan 0)))
           stgs (map stage f)
           ppl (async-dedicated-thread-pool-pipeline stgs executor)]
       (binding [*pre-execution-hook* (fn [_] (reset! h0 true))
-                *post-execution-hook* (fn [_] (reset! h1 true))]
+                *post-execution-hook* (fn [_] (reset! h1 true) (>!! sync-chan 0))]
         (run-pipeline ppl c0 sync-chan)
         (<!! sync-chan)
         (is (= num @c0))


(SERVER-2315) Remove deprecated HexBinaryAdapter in test

--- test/integration/puppetlabs/services/jruby/request_handler_test.clj
+++ test/integration/puppetlabs/services/jruby/request_handler_test.clj
@@ -1,7 +1,6 @@
 (ns puppetlabs.services.jruby.request-handler-test
   (:import (java.io ByteArrayInputStream)
            (java.security MessageDigest)
-           (javax.xml.bind.annotation.adapters HexBinaryAdapter)
            (org.apache.commons.io IOUtils))
   (:require [clojure.string :as string]
             [clojure.java.io :as io]
@@ -38,12 +37,10 @@
          (let [raw-byte-arr            (byte-array [(byte -128)
                                                     (byte -127)
                                                     (byte -126)])
-               expected-md5            (-> (HexBinaryAdapter.)
-                                           (.marshal (->
-                                                       (MessageDigest/getInstance
-                                                         "MD5")
-                                                       (.digest raw-byte-arr)))
-                                           (string/lower-case))
+               digested                (.digest
+                                         (MessageDigest/getInstance "MD5")
+                                         raw-byte-arr)
+               expected-md5            (.toString (BigInteger. 1 digested) 16)
                expected-bucket-file    (string/join
                                          "/"
                                          [bucket-dir


Update printer test.

Update printer test.

--- test/puget/printer_test.clj
+++ test/puget/printer_test.clj
@@ -70,7 +70,11 @@
 (deftest colored-printing
   (let [value [nil 1.0 true "foo" :bar]
         bw-str (with-out-str (pprint value))
-        colored-str (with-out-str (cprint value))
-        thin-str (with-out-str (cprint value {:width 5}))]
+        colored-str (cprint-str value)
+        thin-str (cprint-str value {:width 5})]
     (is (> (count colored-str) (count bw-str)))
-    (is (not= colored-str thin-str))))
+    (is (not= colored-str thin-str))
+    (is (= "123" (with-color (color-text :frobble "123"))))
+    (is (= "#{:baz}" (pprint-str #{:baz})))
+    (is (= (cprint-str :foo)
+           (with-color (color-text :keyword ":foo"))))))


more of the same

more of the same

--- yatzy-clj/src/yatzy_clj/yatzy.clj
+++ yatzy-clj/src/yatzy_clj/yatzy.clj
@@ -70,19 +70,16 @@
     )
   )

-
-
 (defn sixes [d1 d2 d3 d4 _5]
-  (let [dice [d1 d2 d3 d4 _5]]
-    (apply +
+  (let [dice [d1 d2 d3 d4 _5]
+        sum (apply +
            (for [at (range 0 (count dice))]
              (if (= 6 (nth dice at)) 6 0)
              )
-           )
+           )]
+    sum
     )
   )
-
-


midje autotest in repl

midje autotest in repl

--- dev/user.clj
+++ dev/user.clj
@@ -14,6 +14,8 @@
             [dev-data :as d]
             [taoensso.timbre :as timbre]
             [taoensso.timbre.appenders (socket :as socket-appender)]
+            [midje.repl :refer [autotest]]
+            [midje.config :as midje.config]
             [com.stuartsierra.component :as component]))

 (def system nil)
@@ -50,11 +52,12 @@
   []
   (init)
   (start)
+  (autotest)
   :ok)

 (defn reset []
   (stop)
-  (set-refresh-dirs "src/" "dev/")
+  (set-refresh-dirs "src/" "dev/" "test/")
   (refresh :after 'user/go))

 (defn delete-database-and-stop! []


Fix tests

Fix tests

--- test/tick/schedule_test.clj
+++ test/tick/schedule_test.clj
@@ -3,7 +3,7 @@
 (ns tick.schedule-test
   (:require
    [clojure.test :refer :all]
-   [tick.timeline :refer [periodic-seq]]
+   [tick.timeline :refer [periodic-seq timeline]]
    [tick.core :refer [seconds millis]]
    [tick.clock :refer [clock-ticking-in-seconds just-now]]
    [tick.schedule :as sched]))
@@ -13,7 +13,7 @@
         f (fn [dt] (swap! a inc))
         clk (clock-ticking-in-seconds)
         now (just-now clk)
-        timeline (take 10 (periodic-seq now (millis 10)))]
+        timeline (take 10 (timeline (periodic-seq now (millis 10))))]
     @(sched/start (sched/schedule f timeline) clk)
     (is (= @a 10))))

@@ -22,6 +22,6 @@
         f (fn [dt] (swap! a inc))
         clk (clock-ticking-in-seconds)
         now (just-now clk)
-        timeline (take 1000 (periodic-seq now (seconds 1)))]
+        timeline (take 1000 (timeline (periodic-seq now (seconds 1))))]
     @(sched/start (sched/simulate f timeline) clk)
     (is (= @a 1000))))


Move -main to bottom, fixes #51

Move -main to bottom, fixes #51

--- test/transit/test/core.cljs
+++ test/transit/test/core.cljs
@@ -158,9 +158,6 @@
   (is (= (pr-str (t/read r "{\"~#'\":\"~u550e8400-e29b-41d4-a716-446655440000\"}"))
          (pr-str #uuid "550e8400-e29b-41d4-a716-446655440000"))))

-(defn -main [& args]
-  (run-tests))
-
 ;; Test UUID comparison

 (deftest test-uuid-compare
@@ -225,9 +222,11 @@
              {:default (fn [tag value] (t/tagged-value tag value))}})]
     (is (t/tagged-value? (first (t/read r "[\"~q1\"]"))))))

+(defn -main [& args]
+  (run-tests))
+
 (set! *main-cli-fn* -main)

-
 (comment

   (run-tests)


fix empty or infinite loop

fix empty or infinite loop

--- src/neuseg/db.clj
+++ src/neuseg/db.clj
@@ -15,16 +15,18 @@
         items (clojure.string/split line #"\s+")
         wd    (first items)
         nvec  (normalise (vec (map #(Double. %1) (rest items))))]
-    (if idx
+    (if-not idx
+      (tuple -1 nil nil)
       (do
         (if (= (mod idx 1000) 0) (println idx))
         (tuple (+ idx 1) wd nvec)))))

 (defn- reg-wd-neglect [name data]
   (let [[idx wd nvec] data]
-    (do
-      (swap! assoc (get registry name) wd idx)
-      nvec)))
+    (if (> idx -1)
+      (do
+        (swap! assoc (get registry name) wd idx)
+        nvec))))

 (defn load-db [name]
   (with-open [rdr (clojure.java.io/reader (str "data" "/" name))]


upload public directory to cloudfront

upload public directory to cloudfront

--- src/pc/assets.clj
+++ src/pc/assets.clj
@@ -143,10 +143,24 @@
 (defn make-manifest-key [sha1]
   (str "releases/" sha1))

+(defn upload-public []
+  ;; TODO: traverse subdirectories
+  ;; TODO: detect if we've already uploaded an asset and invalidate it
+  (doseq [dir ["img"]
+          file (fs/listdir (fs/join "resources/public" dir))
+          :let [key (fs/join dir file)
+                full-path (fs/join "resources/public" dir file)]
+          :when (fs/file? full-path)]
+    (log/infof "uploading %s to %s" full-path key)
+    (s3/put-object :bucket-name cdn-bucket :key key :file full-path
+                   :metadata {:content-type (mime-type-of full-path)
+                              :cache-control "max-age=3155692"})))
+
 (defn upload-manifest [sha1]
   ;; TODO: this is dumb, we shouldn't write to the file
   (update-sourcemap-url assets-directory "/cljs/production/frontend.js")
   (amazonica.core/with-credential [aws-access-key aws-secret-key]
+    (upload-public)
     (let [manifest-key (make-manifest-key sha1)
           assets (reduce (fn [acc path]
                            (let [file-path (str assets-directory path)