Changed at all grids and adding date validation and year

--- src_cljs/rrm/corecljs.cljs
+++ src_cljs/rrm/corecljs.cljs
@@ -360,15 +360,28 @@
 ;; --------------------------------------------------------------------------
 ;; mutation form

+(defn year-after? [date]
+  (let [year (js/parseInt (re-find #"\d+" date))]
+    (tt/after? (tt/date-time year)  (tt/date-time 1900))))
+
+(defn year-before? [date]
+  (let [year (js/parseInt (re-find #"\d+" date))]
+    (tt/before?  (tt/date-time year) (tt/date-time 9999))))
+
 (defn form-validator [data-set]
   (first (b/validate data-set
                      :mutationnumber [[v/required :message "Field is required"]]
                      :nameofthefirstparty [[v/required :message "Field is required"]]
                      :nameofthesecondparty [[v/required :message "Field is required"]]
-                     :dateofinstitution [[v/required :message "Field is required"]]
+                     :dateofinstitution [[v/required :message "Field is required"]
+                                         [year-after? :message "Year must greater than 1900"]
+                                         [year-before? :message "Year must less than 9999"]
+                                         ]
                      :nameofpo [[v/required :message "Field is required"]]
                      :dateofdecision [[v/required :message "Field is required"]
-                                      [v/datetime :message "Please enter valid date"]]
+                                      [year-after? :message "Year must greater than 1900"]
+                                      [year-before? :message "Year must less than 9999"]
+                                      ]
                      :title [[v/required :message "Field is required"]]
                      :khasranumber [[v/required :message "Field is required"]]
                      ;; :area [[v/required :message "Field is required"]]
@@ -570,7 +583,7 @@
          (when (nil? (:id @data-set)) [button {:bs-style "info" :on-click #((reset! data-set {:isactive true})
                                                                             (reset-mut-combo-boxes))} "Refresh"])
          [button {:bs-style "danger" :on-click form-cancel } "Cancel"]]]
-       ;;[:span (str @data-set)]
+       ;; [:span (str @data-set)]
        ]]]]])

 (defn upd-check-input-element [data-set focus bool ]
@@ -946,8 +959,9 @@
    [:div.box
     [:div.box-header
      [:h3.box-title "List of Mutations"]]
-    [:div {:class "box-body table-responsive"}
-     [:table {:class "table table-bordered table-striped"}
+    [:div {:class "box-body"}
+     [:div.table-responsive
+     [:table {:class "table table-bordered table-striped dataTable"}
       [:thead
        [:tr
         (when (is-admin-or-super-admin) [:th ""])
@@ -993,7 +1007,7 @@
                                    [:td (.-senddate mt)]
                                    [:td (.-receiveddate mt)]
                                    ]))]]]
-    [:div{:class "col-xs-6 col-centered col-max"}] [shared-state 0]]])
+     [:div.col-sm-6.col-md-offset-5 [shared-state 0]]]]])

 (defroute mutations-list "/mutations" []
@@ -1031,7 +1045,9 @@
 (defn revenue-form-validator [data-set]
   (first (b/validate data-set
                      :serialnumber [[v/required :message "Field is required Must be number"]]
-                     :year [[v/required :message "Field is required"]]
+                     :year [[v/required :message "Field is required"]
+                            [year-after? :message "Year must greater than 1900"]
+                            [year-before? :message "Year must less than 9999"]]
                      :racknumber [[v/required :message "Field is required"]]
                      :description [[v/required :message "Field is required"]])))

@@ -1218,19 +1234,18 @@
   (secretary/dispatch! "/revenue/add"))

+
 (defn render-revenue [revenues]
-  [:div
+  [:div.col-md-12
    [:div {:class "box"}
     [:div {:class "box-header"}
-     [:h3 "List of Revenue Records"]]
-    [:div.row
-     [:div.col-md-12
+     [:h3.box-title "List of Revenue Records"]]
+    [:div.box-body
       [:div.form-group
        [:input {:type "button" :value "Add"
                 :class "btn btn-primary" :on-click revenue-add}]]
-      [:div {:class "box-body"}
-
-       [:table {:class "table table-bordered table-striped dataTable" :border "2" :width "100px" :style {:table-layout "fixed"}}
+      [:div.table-responsive
+       [:table {:class "table table-bordered table-striped dataTable"}
         [:thead
          [:tr
           (when (is-admin-or-super-admin)[:th " "])
@@ -1244,19 +1259,23 @@
           [:th "Description"]]]
         [:tbody
          (doall (for [mt revenues]
-                  ^{:key (.-id mt)} [:tr
-
-                                     (when (is-admin-or-super-admin)[:td [button {:bs-style "success"
-                                                                                :on-click  #(revenue-update(.-id mt))} "Update"]])
-                                     (when (is-admin-or-super-admin)[:td  [button {:bs-style "danger" :on-click #(revenue-delete(.-id mt))} "Delete"]])
-                                     [:td (.-serialnumber mt)]
-                                     [:td (.-subdivisionname mt)]
-                                     [:td (.-villagename mt)]
-                                     ;; [:td (.-tehsil mt)]
-                                     [:td (.-year mt)]
-                                     [:td (.-racknumber mt)]
-                                     [:td (.-description mt)]]))]]
-       [:div{:class "col-xs-6 col-centered col-max"} [shared-state 0]]]]]]])
+                  ^{:key (.-id mt)}
+                  [:tr
+                   (when (is-admin-or-super-admin)
+                     [:td [button {:bs-style "success"
+                                   :on-click  #(revenue-update(.-id mt))} "Update"]])
+                   (when (is-admin-or-super-admin)
+                     [:td  [button {:bs-style "danger"
+                                    :on-click #(revenue-delete(.-id mt))} "Delete"]])
+                   [:td (.-serialnumber mt)]
+                   [:td (.-subdivisionname mt)]
+                   [:td (.-villagename mt)]
+                   ;; [:td (.-tehsil mt)]
+                   [:td (.-year mt)]
+                   [:td (.-racknumber mt)]
+                   [:td (.-description mt)]
+                   ]))]]]
+       [:div.col-sm-6.col-md-offset-5 [shared-state 0]]]]])

 (defroute revenue-list "/revenue" []
@@ -1278,7 +1297,9 @@
                      :serialnumber [[v/required :message "Field is required Must be number"]]
                      :subdivisionname [[v/required :message "Field is required"]]
                      :tehsil [[v/required :message "Field is required"]]
-                     :year [[v/required :message "Field is required"]]
+                     :year [[v/required :message "Field is required"]
+                            [year-after? :message "Year must greater than 1900"]
+                            [year-before? :message "Year must less than 9999"]]
                      :racknumber [[v/required :message "Field is required"]]
                      :description [[v/required :message "Field is required"]])))

@@ -1438,20 +1459,15 @@
   (secretary/dispatch! "/khasragirdwani/add"))

 (defn render-khasragirdwani [khasragirdwanis]
-  [:div
+  [:div.col-sm-12
    [:div {:class "box"}
     [:div {:class "box-header"}
-     [:h3 "List of Khasragirdwani Records"]]
-    [:div.row
-     [:div.col-sm-12
+     [:h3.box-title "List of Khasragirdwani Records"]]
+    [:div.box-body
       [:div.form-group
        [:input {:type "button" :value "Add"
-                :class "btn btn-primary" :on-click khasragirdwani-add}]
-       ;; [:input {:id "getall" :type "button" :value "Refresh"
-       ;;          :class "btn btn-primary" :on-click get-all-click}]
-       ]
-      [:div {:class "box-body"}
-
+                :class "btn btn-primary" :on-click khasragirdwani-add}]]
+      [:div.table-responsive
        [:table {:class "table table-bordered table-striped dataTable"}
         [:thead
          [:tr
@@ -1467,21 +1483,23 @@
           ]]
         [:tbody
          (doall (for [mt khasragirdwanis]
-                  ^{:key (.-id mt)} [:tr
-
-                                     (when (is-admin-or-super-admin)[:td [button {:bs-style "success"
-                                                                                :on-click  #(khasragirdwani-update(.-id mt))} "Update"]])
-                                     (when (is-admin-or-super-admin)[:td  [button {:bs-style "danger" :on-click #(khasragirdwani-delete(.-id mt))} "Delete"]])
-                                     [:td (.-serialnumber mt)]
-                                     [:td (.-villagename mt)]
-                                     [:td (.-subdivisionname mt)]
-                                     [:td (.-tehsil mt)]
-                                     [:td (.-year mt)]
-                                     [:td (.-racknumber mt)]
-                                     [:td (.-description mt)]]))]]
-       [:div{:class "col-xs-6 col-centered col-max"} [shared-state 0]]]]]]])
-
-
+                  ^{:key (.-id mt)}
+                  [:tr
+                   (when (is-admin-or-super-admin)
+                     [:td [button {:bs-style "success"
+                                   :on-click  #(khasragirdwani-update(.-id mt))} "Update"]])
+                   (when (is-admin-or-super-admin)
+                     [:td  [button {:bs-style "danger"
+                                    :on-click #(khasragirdwani-delete(.-id mt))} "Delete"]])
+                   [:td (.-serialnumber mt)]
+                   [:td (.-villagename mt)]
+                   [:td (.-subdivisionname mt)]
+                   [:td (.-tehsil mt)]
+                   [:td (.-year mt)]
+                   [:td (.-racknumber mt)]
+                   [:td (.-description mt)]
+                   ]))]]]
+       [:div.col-sm-6.col-md-offset-5 [shared-state 0]]]]])

 (defroute khasragirdwani-list "/khasragirdwani" []
   (if (nil? (get-value! :user)) (set-page! [login])
@@ -1502,7 +1520,9 @@
                      :serialnumber [[v/required :message "Field is required Must be number"]]
                      :subdivisionname [[v/required :message "Field is required"]]
                      :tehsil [[v/required :message "Field is required"]]
-                     :year [[v/required :message "Field is required"]]
+                     :year [[v/required :message "Field is required"]
+                            [year-after? :message "Year must greater than 1900"]
+                            [year-before? :message "Year must less than 9999"]]
                      :racknumber [[v/required :message "Field is required"]]
                      :description [[v/required :message "Field is required"]])))

@@ -1655,24 +1675,19 @@
   (secretary/dispatch! "/masavi/add"))

 (defn render-masavi [masavis]
-  [:div
+  [:div.col-md-12
    [:div {:class "box"}
     [:div {:class "box-header"}
-     [:h3 "List of Masavi Records"]]
-    [:div.row
-     [:div.col-md-12
+     [:h3.box-title "List of Masavi Records"]]
+    [:div.box-body
       [:div.form-group
        [:input {:type "button" :value "Add"
-                :class "btn btn-primary" :on-click masavi-add}]
-       ;; [:input {:id "getall" :type "button" :value "Refresh"
-       ;;          :class "btn btn-primary" :on-click get-all-click}]
-       ]
-      [:div {:class "box-body"}
-
+                :class "btn btn-primary" :on-click masavi-add}]]
+      [:div.table-responsive
        [:table {:class "table table-bordered table-striped dataTable"}
         [:thead
          [:tr
-          (when (is-admin-or-super-admin)[:th " "])
+          (when (is-admin-or-super-admin)[:th " "])
           (when (is-admin-or-super-admin)[:th " "])
           [:th "S.No"]
           [:th "Name of the Village"]
@@ -1684,21 +1699,23 @@
          ]]
         [:tbody
          (doall (for [mt masavis]
-                  ^{:key (.-id mt)} [:tr
-                                     (when (is-admin-or-super-admin)[:td [button {:bs-style "success"
-                                                                                :on-click  #(masavi-update(.-id mt))} "Update"]])
-                                     (when (is-admin-or-super-admin)[:td  [button {:bs-style "danger"
-                                                                                :on-click #(masavi-delete(.-id mt))} "Delete"]])
-                                     [:td (.-serialnumber mt)]
-                                     [:td (.-villagename mt)]
-                                     [:td (.-subdivisionname mt)]
-                                     [:td (.-tehsil mt)]
-                                     [:td (.-year mt)]
-                                     [:td (.-racknumber mt)]
-                                     [:td (.-description mt)]
-                                     ]))]]
-       [:div{:class "col-xs-6 col-centered col-max"} [shared-state 0]]]]]]])
-
+                  ^{:key (.-id mt)}
+                  [:tr
+                   (when (is-admin-or-super-admin)
+                     [:td [button {:bs-style "success"
+                                   :on-click  #(masavi-update(.-id mt))} "Update"]])
+                   (when (is-admin-or-super-admin)
+                     [:td  [button {:bs-style "danger"
+                                    :on-click #(masavi-delete(.-id mt))} "Delete"]])
+                   [:td (.-serialnumber mt)]
+                   [:td (.-villagename mt)]
+                   [:td (.-subdivisionname mt)]
+                   [:td (.-tehsil mt)]
+                   [:td (.-year mt)]
+                   [:td (.-racknumber mt)]
+                   [:td (.-description mt)]
+                   ]))]]]
+       [:div.col-sm-6.col-md-offset-5 [shared-state 0]]]]])

 (defroute masavi-list "/masavi" []
   (if (nil? (get-value! :user)) (set-page! [login])
@@ -1719,7 +1736,9 @@
                      :serialnumber [[v/required :message "Field is required Must be number"]]
                      :subdivisionname [[v/required :message "Field is required"]]
                      :tehsil [[v/required :message "Field is required"]]
-                     :year [[v/required :message "Field is required"]]
+                     :year [[v/required :message "Field is required"]
+                            [year-after? :message "Year must greater than 1900"]
+                            [year-before? :message "Year must less than 9999"]]
                      :racknumber [[v/required :message "Field is required"]]
                      :description [[v/required :message "Field is required"]])))

@@ -1874,49 +1893,47 @@
     (http-get-auth (str serverhost "villages") onres)))

 (defn render-consolidation [consolidations]
-  [:div
+  [:div.col-md-12
    [:div {:class "box"}
     [:div {:class "box-header"}
-     [:h3 "List of Consolidation Records"]]
-    [:div.row
-     [:div.col-md-12
-      [:div.form-group
-       [:input {:type "button" :value "Add"
-                :class "btn btn-primary" :on-click consolidation-add}]
-       ;; [:input {:id "getall" :type "button" :value "Refresh"
-       ;;          :class "btn btn-primary" :on-click get-all-click}]
-       ]
-      [:div {:class "box-body"}
-
-       [:table {:class "table table-bordered table-striped dataTable"}
-        [:thead
-         [:tr
-          (when (is-admin-or-super-admin)[:th " "])
-          (when (is-admin-or-super-admin)[:th " "])
-          [:th "S.No"]
-          [:th "Name of the Village"]
-          [:th "Sub Division Name"]
-          [:th "Tehsil"]
-          [:th "Year"]
-          [:th "Rack Number"]
-          [:th "Description"]
-          ]]
-        [:tbody
-         (doall (for [mt consolidations]
-                  ^{:key (.-id mt)} [:tr
-                                     (when (is-admin-or-super-admin)[:td [button {:bs-style "success"
-                                                                                :on-click  #(consolidation-update(.-id mt))} "Update"]])
-                                     (when (is-admin-or-super-admin)[:td  [button {:bs-style "danger"
-                                                                                :on-click #(consolidation-delete(.-id mt))} "Delete"]])
-                                     [:td (.-serialnumber mt)]
-                                     [:td (.-villagename mt)]
-                                     [:td (.-subdivisionname mt)]
-                                     [:td (.-tehsil mt)]
-                                     [:td (.-year mt)]
-                                     [:td (.-racknumber mt)]
-                                     [:td (.-description mt)]
-                                  ]))]]
-       [:div{:class "col-xs-6 col-centered col-max"} [shared-state 0]]]]]]])
+     [:h3.box-title "List of Consolidation Records"]]
+    [:div.box-body
+     [:div.form-group
+      [:input {:type "button" :value "Add"
+               :class "btn btn-primary" :on-click consolidation-add}]]
+     [:div.table-responsive
+      [:table {:class "table table-bordered table-striped dataTable"}
+       [:thead
+        [:tr
+         (when (is-admin-or-super-admin)[:th " "])
+         (when (is-admin-or-super-admin)[:th " "])
+         [:th "S.No"]
+         [:th "Name of the Village"]
+         [:th "Sub Division Name"]
+         [:th "Tehsil"]
+         [:th "Year"]
+         [:th "Rack Number"]
+         [:th "Description"]
+         ]]
+       [:tbody
+        (doall (for [mt consolidations]
+                 ^{:key (.-id mt)}
+                 [:tr
+                  (when (is-admin-or-super-admin)
+                    [:td [button {:bs-style "success"
+                                  :on-click  #(consolidation-update(.-id mt))} "Update"]])
+                  (when (is-admin-or-super-admin)
+                    [:td  [button {:bs-style "danger"
+                                   :on-click #(consolidation-delete(.-id mt))} "Delete"]])
+                  [:td (.-serialnumber mt)]
+                  [:td (.-villagename mt)]
+                  [:td (.-subdivisionname mt)]
+                  [:td (.-tehsil mt)]
+                  [:td (.-year mt)]
+                  [:td (.-racknumber mt)]
+                  [:td (.-description mt)]
+                  ]))]]]
+       [:div.col-sm-6.col-md-offset-5 [shared-state 0]]]]])

 (defroute consolidation-list "/consolidation" []
   (if (nil? (get-value! :user)) (set-page! [login])
@@ -1937,7 +1954,9 @@
                      :serialnumber [[v/required :message "Field is required Must be number"]]
                      :subdivisionname [[v/required :message "Field is required"]]
                      :tehsil [[v/required :message "Field is required"]]
-                     :year [[v/required :message "Field is required"]]
+                     :year [[v/required :message "Field is required"]
+                            [year-after? :message "Year must greater than 1900"]
+                            [year-before? :message "Year must less than 9999"]]
                      :racknumber [[v/required :message "Field is required"]]
                      :description [[v/required :message "Field is required"]])))

@@ -2089,21 +2108,18 @@

 (defn fieldbook-add [event]
   (secretary/dispatch! "/fieldbook/add"))
+
+
 (defn render-fieldbook [fieldbooks]
-  [:div
+  [:div.col-md-12
    [:div {:class "box"}
     [:div {:class "box-header"}
-     [:h3 "List of Field Book Records"]]
-    [:div.row
-     [:div.col-md-12
+     [:h3.box-title "List of Field Book Records"]]
+    [:div.box-body
       [:div.form-group
        [:input {:type "button" :value "Add"
-                :class "btn btn-primary" :on-click fieldbook-add}]
-       ;; [:input {:id "getall" :type "button" :value "Refresh"
-       ;;          :class "btn btn-primary" :on-click get-all-click}]
-       ]
-      [:div {:class "box-body"}
-
+                :class "btn btn-primary" :on-click fieldbook-add}]]
+      [:div.table-responsive
        [:table {:class "table table-bordered table-striped dataTable"}
         [:thead
          [:tr
@@ -2119,20 +2135,23 @@
           ]]
         [:tbody
          (doall(for [mt fieldbooks]
-                 ^{:key (.-id mt)} [:tr
-                                    (when (is-admin-or-super-admin)[:td [button {:bs-style "success"
-                                                                             :on-click  #(fieldbook-update(.-id mt))} "Update"]])
-                                    (when (is-admin-or-super-admin)[:td  [button {:bs-style "danger"
-                                                                                :on-click #(fieldbook-delete(.-id mt))} "Delete"]])
-                                    [:td (.-serialnumber mt)]
-                                    [:td (.-villagename mt)]
-                                    [:td (.-subdivisionname mt)]
-                                    [:td (.-tehsil mt)]
-                                    [:td (.-year mt)]
-                                    [:td (.-racknumber mt)]
-                                    [:td (.-description mt)]
-                                   ]))]]
-       [:div{:class "col-xs-6 col-centered col-max"} [shared-state 0]]]]]]])
+                 ^{:key (.-id mt)}
+                 [:tr
+                  (when (is-admin-or-super-admin)
+                    [:td [button {:bs-style "success"
+                                  :on-click  #(fieldbook-update(.-id mt))} "Update"]])
+                  (when (is-admin-or-super-admin)
+                    [:td  [button {:bs-style "danger"
+                                   :on-click #(fieldbook-delete(.-id mt))} "Delete"]])
+                  [:td (.-serialnumber mt)]
+                  [:td (.-villagename mt)]
+                  [:td (.-subdivisionname mt)]
+                  [:td (.-tehsil mt)]
+                  [:td (.-year mt)]
+                  [:td (.-racknumber mt)]
+                  [:td (.-description mt)]
+                  ]))]]]
+       [:div.col-sm-6.col-md-offset-5 [shared-state 0]]]]])

@@ -2155,7 +2174,9 @@
                      :subject [[v/required :message "Field is required"]]
                      :title [[v/required :message "Field is required"]]
                      :remarks [[v/required :message "Field is required"]]
-                     :dispatcheddate [[v/required :message "Field is required"]]
+                     :dispatcheddate [[v/required :message "Field is required"]
+                                      [year-after? :message "Year must greater than 1900"]
+                                      [year-before? :message "Year must less than 9999"]]
                      ;; :receiveddate [[v/required :message "Field is required"]]
                      )))

@@ -2284,20 +2305,16 @@
     (http-get-auth (str serverhost "villages") onres)))

 (defn render-misc [miscs]
-  [:div
+  [:div.col-md-12
    [:div {:class "box"}
     [:div {:class "box-header"}
-     [:h3 "List of Misc Records"]]
-    [:div.row
-     [:div.col-md-12
-      (when (is-admin-or-super-admin)
-        [:div.form-group
-         [:input {:type "button" :value "Add"
-                  :class "btn btn-primary" :on-click misc-add}]
-         ;; [:input {:id "getall" :type "button" :value "Refresh"
-         ;;          :class "btn btn-primary" :on-click get-all-click}]
-         ])
-      [:div {:class "box-body"}
+     [:h3.box-title "List of Misc Records"]]
+    [:div.box-body
+     (when (is-admin-or-super-admin)
+       [:div.form-group
+        [:input {:type "button" :value "Add"
+                 :class "btn btn-primary" :on-click misc-add}]])
+      [:div.table-responsive
        [:table {:class "table table-bordered table-striped dataTable"}
         [:thead
          [:tr
@@ -2312,18 +2329,20 @@
            ]]
         [:tbody
          (doall (for [mt miscs]
-                  ^{:key (.-id mt)} [:tr
-                                     [:td [button {:bs-style "success"
-                                               :on-click  #(misc-update(.-id mt))} "Update"]]
-                                     (when (is-admin-or-super-admin)[:td  [button {:bs-style "danger"
-                                                                                :on-click #(misc-delete(.-id mt))} "Delete"]])
-                                     [:td (.-filenumber mt)]
-                                     [:td (.-subject mt)]
-                                     [:td (.-title mt)]
-                                     [:td (.-remarks mt)]
-                                     [:td (.-dispatcheddate mt)]
-                                     [:td (.-receiveddate mt)]]))]]
-       [:div{:class "col-xs-6 col-centered col-max"} [shared-state 0]]]]]]])
+                  ^{:key (.-id mt)}
+                  [:tr
+                   [:td [button {:bs-style "success"
+                                 :on-click  #(misc-update(.-id mt))} "Update"]]
+                   (when (is-admin-or-super-admin)
+                     [:td  [button {:bs-style "danger"
+                                    :on-click #(misc-delete(.-id mt))} "Delete"]])
+                   [:td (.-filenumber mt)]
+                   [:td (.-subject mt)]
+                   [:td (.-title mt)]
+                   [:td (.-remarks mt)]
+                   [:td (.-dispatcheddate mt)]
+                   [:td (.-receiveddate mt)]]))]]]
+       [:div.col-sm-6.col-md-offset-5 [shared-state 0]]]]])

 (defroute misc-list "/misc" []
   (if (nil? (get-value! :user)) (set-page! [login])
@@ -2338,19 +2357,37 @@
 ;; ---------------------------------------------------------
 ;; o2register-records

+
+(defn o2-year-after? [date]
+  (let [year (js/parseInt date)]
+    (tt/after? (tt/date-time year)  (tt/date-time 1900))))
+
+(defn o2-year-before? [date]
+  (let [year (js/parseInt date)]
+    (tt/before?  (tt/date-time year) (tt/date-time 9999))))
+
 (defn o2register-form-validator [data-set]
   (first (b/validate data-set
                      :serialnumber [[v/required :message "Field is required Must be number"]]
                      :subdivisionname [[v/required :message "Field is required"]]
-                     :dateofinstitution [[v/required :message "Field is required"]]
+                     :dateofinstitution [[v/required :message "Field is required"]
+                                         [year-after? :message "Year must greater than 1900"]
+                                         [year-before? :message "Year must less than 9999"]]
                      :sourceofreceipt [[v/required :message "Field is required"]]
                      :nameofthefirstparty [[v/required :message "Field is required"]]
-                     :dateofreceiptfrompanchayat [[v/required :message "Field is required"]]
-                     :dateandgistoffinalorder [[v/required :message "Field is required"]]
+                     :dateofreceiptfrompanchayat [[v/required :message "Field is required"]
+                                                  [year-after? :message "Year must greater than 1900"]
+                                                  [year-before? :message "Year must less than 9999"]]
+                     :dateandgistoffinalorder [[v/required :message "Field is required"]
+                                               [year-after? :message "Year must greater than 1900"]
+                                               [year-before? :message "Year must less than 9999"]]
                      :racknumber [[v/required :message "Field is required"]]
-                     :startingyear [[v/required :message "Field is required Must be number"]]
-                     :endingyear [[v/required :message "Field is required Must be number"]])))
-
+                     :startingyear [[v/required :message "Field is required Must be number"]
+                                    [o2-year-after? :message "Year must greater than 1900"]
+                                    [o2-year-before? :message "Year must less than 9999"]]
+                     :endingyear [[v/required :message "Field is required Must be number"]
+                                  [o2-year-after? :message "Year must greater than 1900"]
+                                  [o2-year-before? :message "Year must less than 9999"]])))

 (defn o2register-input-int-row [id label ttype data-set focus]
   (let [input-focus (r/atom nil)]
@@ -2378,8 +2415,6 @@
                            [:b (str (first ((o2register-form-validator @data-set) id)))]])
                         [:div])]])))

-
-
 (defn set-o2-fields [data-set mutdata]
   (do
     (swap! data-set assoc :subdivisionname (.-subdivisionname mutdata))
@@ -2388,7 +2423,6 @@
     (swap! data-set assoc :racknumber (.-nameofthefirstparty mutdata))
     (swap! data-set assoc :mutationid (int (.-id mutdata)))
     (swap! data-set assoc :villagename (.-villagename mutdata))))
-

 (defn reset-o2-fields [data-set]
   (do
@@ -2557,57 +2591,53 @@
   (secretary/dispatch! "/o2register/add"))

 (defn render-o2register [o2registers]
-  [:div
-   [:div {:class "box"}
-    [:div {:class "box-header"}
-     [:h3 "List of O2 Register Records"]]
-    [:div.row
-     [:div.col-md-12
-      [:div.form-group
-       [:input {:type "button" :value "Add"
-                :class "btn btn-primary" :on-click o2register-add}]
-       ;; [:input {:id "getall" :type "button" :value "Refresh"
-       ;;          :class "btn btn-primary" :on-click get-all-click}]
-       ]
-      [:div {:class "box-body"}
-
-       [:table {:class "table table-bordered table-striped dataTable"}
-        [:thead
-         [:tr
-          (when (is-admin-or-super-admin) [:th " "])
-          (when (is-admin-or-super-admin) [:th " "])
-          [:th "S.No"]
-          [:th "Sub Division Name"]
-          [:th "Date of Institution"]
-          [:th "Source of Receipt"]
-          [:th "Village Name"]
-          [:th "Name of the First Party"]
-          [:th "Date of Receipt"]
-          [:th "Date of Gist Final Order"]
-          [:th "Rack NUmber"]
-          [:th "Starting Year"]
-          [:th "Ending Year"]
-         ]]
-        [:tbody
-         (doall (for [mt o2registers]
-                  ^{:key (.-id mt)} [:tr
-                                     (when (is-admin-or-super-admin)[:td [button {:bs-style "success"
-                                                                                :on-click  #(o2register-update(.-id mt))} "Update"]])
-                                     (when (is-admin-or-super-admin)[:td  [button {:bs-style "danger"
-                                                                                :on-click #(o2register-delete(.-id mt))} "Delete"]])
-                                     [:td (.-serialnumber mt)]
-                                     [:td (.-subdivisionname mt)]
-                                     [:td (.-dateofinstitution mt)]
-                                     [:td (.-sourceofreceipt mt)]
-                                     [:td (.-villagename mt)]
-                                     [:td (.-nameofthefirstparty mt)]
-                                     [:td (.-dateofreceiptfrompanchayat mt)]
-                                     [:td (.-dateandgistoffinalorder mt)]
-                                     [:td (.-racknumber mt)]
-                                     [:td (.-startingyear mt)]
-                                     [:td (.-endingyear mt)]
-                ]))]]
-       [:div{:class "col-xs-6 col-centered col-max"} [shared-state 0]]]]]]])
+  [:div.col-md-12
+   [:div.box
+    [:div.box-header
+     [:h3.box-title "List of O2 Register Records"]]
+      [:div.box-body
+       [:div.form-group
+        [:input {:type "button" :value "Add"
+                 :class "btn btn-primary" :on-click o2register-add}]]
+       [:div.table-responsive
+        [:table {:class "table table-bordered table-striped dataTable"}
+         [:thead
+          [:tr
+           (when (is-admin-or-super-admin) [:th " "])
+           (when (is-admin-or-super-admin) [:th " "])
+           [:th "S.No"]
+           [:th "Sub Division Name"]
+           [:th "Date of Institution"]
+           [:th "Source of Receipt"]
+           [:th "Village Name"]
+           [:th "Name of the First Party"]
+           [:th "Date of Receipt"]
+           [:th "Date of Gist Final Order"]
+           [:th "Rack NUmber"]
+           [:th "Starting Year"]
+           [:th "Ending Year"]
+           ]]
+         [:tbody
+          (doall (for [mt o2registers]
+                   ^{:key (.-id mt)}
+                   [:tr
+                    (when (is-admin-or-super-admin)[:td [button {:bs-style "success"
+                                                                 :on-click  #(o2register-update(.-id mt))} "Update"]])
+                    (when (is-admin-or-super-admin)[:td  [button {:bs-style "danger"
+                                                                  :on-click #(o2register-delete(.-id mt))} "Delete"]])
+                    [:td (.-serialnumber mt)]
+                    [:td (.-subdivisionname mt)]
+                    [:td (.-dateofinstitution mt)]
+                    [:td (.-sourceofreceipt mt)]
+                    [:td (.-villagename mt)]
+                    [:td (.-nameofthefirstparty mt)]
+                    [:td (.-dateofreceiptfrompanchayat mt)]
+                    [:td (.-dateandgistoffinalorder mt)]
+                    [:td (.-racknumber mt)]
+                    [:td (.-startingyear mt)]
+                    [:td (.-endingyear mt)]
+                    ]))]]]
+       [:div.col-sm-6.col-md-offset-5  [shared-state 0]]]]])

 (defroute o2register-list "/o2register" []
   (if (nil? (get-value! :user)) (set-page! [login])
@@ -2626,7 +2656,9 @@
   (first (b/validate data-set
                      :subdivisionname [[v/required :message "Field is required"]]
                      :khatakhatuninumber [[v/required :message "Field is required"]]
-                     :numberanddateoforder [[v/required :message "Field is required"]]
+                     :numberanddateoforder [[v/required :message "Field is required"]
+                                            [year-after? :message "Year must greater than 1900"]
+                                            [year-before? :message "Year must less than 9999"]]
                      :khasranumber [[v/required :message "Field is required"]]
                      :area [[v/required :message "Field is required"]]
                      :revenuerentofshareofplotstransferred [[v/required :message "Field is required"]]
@@ -2789,20 +2821,15 @@

 (defn render-o4register [o4registers]
-  [:div
+  [:div.col-md-12
    [:div {:class "box"}
     [:div {:class "box-header"}
-     [:h3 "List of O4 Register Records"]]
-    [:div.row
-     [:div.col-md-12
+     [:h3.box-title "List of O4 Register Records"]]
+    [:div.box-body
       [:div.form-group
        [:input {:type "button" :value "Add"
-                :class "btn btn-primary" :on-click o4register-add}]
-       ;; [:input {:id "getall" :type "button" :value "Refresh"
-       ;;          :class "btn btn-primary" :on-click get-all-click}]
-       ]
-      [:div {:class "box-body"}
-
+                :class "btn btn-primary" :on-click o4register-add}]]
+      [:div.table-responsive
        [:table {:class "table table-bordered table-striped dataTable"}
         [:thead
          [:tr
@@ -2818,23 +2845,23 @@
           ]]
         [:tbody
          (doall (for [mt o4registers]
-                  ^{:key (.-id mt)} [:tr
-                                     (when (is-admin-or-super-admin)[:td [button {:bs-style "success"
-                                                                                :on-click  #(o4register-update(.-id mt))} "Update"]])
-                                     (when (is-admin-or-super-admin)[:td  [button {:bs-style "danger"
-                                                                                :on-click #(o4register-delete(.-id mt))} "Delete"]])
-                                     [:td (.-subdivisionname mt)]
-                                     [:td (.-khatakhatuninumber mt)]
-                                     [:td (.-numberanddateoforder mt)]
-                                     [:td (.-khasranumber mt)]
-                                     [:td (.-area mt)]
-                                     [:td (.-revenuerentofshareofplotstransferred mt)]
-                                     [:td (.-nameanddescriptionofthepersonsremoved mt)]
-                                      ]))]]
-       [:div{:class "col-xs-6 col-centered col-max"} [shared-state 0]]]]]]])
-
-
-
+                  ^{:key (.-id mt)}
+                  [:tr
+                   (when (is-admin-or-super-admin)
+                     [:td [button {:bs-style "success"
+                                   :on-click  #(o4register-update(.-id mt))} "Update"]])
+                   (when (is-admin-or-super-admin)
+                     [:td  [button {:bs-style "danger"
+                                    :on-click #(o4register-delete(.-id mt))} "Delete"]])
+                   [:td (.-subdivisionname mt)]
+                   [:td (.-khatakhatuninumber mt)]
+                   [:td (.-numberanddateoforder mt)]
+                   [:td (.-khasranumber mt)]
+                   [:td (.-area mt)]
+                   [:td (.-revenuerentofshareofplotstransferred mt)]
+                   [:td (.-nameanddescriptionofthepersonsremoved mt)]
+                   ]))]]]
+       [:div.col-sm-6.col-md-offset-5 [shared-state 0]]]]])

 (defroute o4register-list "/o4register" []
   (if (nil? (get-value! :user)) (set-page! [login])
@@ -2853,9 +2880,13 @@
 (defn o6register-form-validator [data-set]
   (first (b/validate data-set
                      :subdivisionname [[v/required :message "Field is required"]]
-                     :year [[v/required :message "Field is required"]]
+                     :year [[v/required :message "Field is required"]
+                            [year-after? :message "Year must greater than 1900"]
+                            [year-before? :message "Year must less than 9999"]]
                      :mehsilnumber [[v/required :message "Field is required"]]
-                     :dateoforderlevy [[v/required :message "Field is required"]]
+                     :dateoforderlevy [[v/required :message "Field is required"]
+                                       [year-after? :message "Year must greater than 1900"]
+                                       [year-before? :message "Year must less than 9999"]]
                      :nameofpersonwhomrecoveryismade [[v/required :message "Field is required"]])))

@@ -3032,20 +3063,15 @@
   (secretary/dispatch! "/o6register/add"))

 (defn render-o6register [o6registers]
-  [:div
+  [:div.col-md-12
    [:div {:class "box"}
     [:div {:class "box-header"}
-     [:h3 "List of O6 Register Records"]]
-    [:div.row
-     [:div.col-md-12
+     [:h3.box-title "List of O6 Register Records"]]
+    [:div.box-body
       [:div.form-group
        [:input {:type "button" :value "Add"
-                :class "btn btn-primary" :on-click o6register-add}]
-       ;; [:input {:id "getall" :type "button" :value "Refresh"
-       ;;          :class "btn btn-primary" :on-click get-all-click}]
-       ]
-      [:div {:class "box-body"}
-
+                :class "btn btn-primary" :on-click o6register-add}]]
+      [:div.table-responsive
        [:table {:class "table table-bordered table-striped dataTable"}
         [:thead
          [:tr
@@ -3053,30 +3079,29 @@
           (when (is-admin-or-super-admin) [:th " "])
           [:th "Sub Divison Name"]
           [:th "Year"]
-          [:th  "Mehsil Number"]
+          [:th "Mehsil Number"]
           [:th "Date of Orederlevy"]
           [:th "Village Name"]
-          [:th "name of Person Whom Recovery is Made"]
-
+          [:th "Name of Person Whom Recovery is Made"]
           ]]
         [:tbody
          (doall (for [mt o6registers]
-                  ^{:key (.-id mt)} [:tr
-                                     (when (is-admin-or-super-admin)[:td [button {:bs-style "success"
-                                                                                :on-click  #(o6register-update(.-id mt))} "Update"]])
-                                     (when (is-admin-or-super-admin)[:td  [button {:bs-style "danger"
-                                                                                :on-click #(o6register-delete(.-id mt))}"Delete"]])
-                                     [:td (.-subdivisionname mt)]
-                                     [:td (.-year mt)]
-                                     [:td (.-mehsilnumber mt)]
-                                     [:td (.-dateoforderlevy mt)]
-                                     [:td (.-villagename mt)]
-                                     [:td (.-nameofpersonwhomrecoveryismade mt)]
-                                      ]))]]
-       [:div{:class "col-xs-6 col-centered col-max"} [shared-state 0]]]]]]])
-
-
-
+                  ^{:key (.-id mt)}
+                  [:tr
+                   (when (is-admin-or-super-admin)
+                     [:td [button {:bs-style "success"
+                                   :on-click  #(o6register-update(.-id mt))} "Update"]])
+                   (when (is-admin-or-super-admin)
+                     [:td  [button {:bs-style "danger"
+                                    :on-click #(o6register-delete(.-id mt))}"Delete"]])
+                   [:td (.-subdivisionname mt)]
+                   [:td (.-year mt)]
+                   [:td (.-mehsilnumber mt)]
+                   [:td (.-dateoforderlevy mt)]
+                   [:td (.-villagename mt)]
+                   [:td (.-nameofpersonwhomrecoveryismade mt)]
+                   ]))]]]
+       [:div.col-sm-6.col-md-offset-5 [shared-state 0]]]]])

 (defroute o6register-list "/o6register" []
   (if (nil? (get-value! :user)) (set-page! [login])


tested app endpoints - registration, activation token and password reset

--- src/io/aviso/rook/core.clj
+++ src/io/aviso/rook/core.clj
@@ -148,6 +148,8 @@
      path-spec is a tuple of [method path]
      function-key is a a keyword with the same name as a function in <namespace>"
   [namespace]
+  (when-not (find-ns namespace)
+    (require namespace))
   (concat
     (remove nil?
             (map function-entry


remove update metadata broker logic, for the moment it will be kept static

--- kafka-clj/src/kafka_clj/client.clj
+++ kafka-clj/src/kafka_clj/client.clj
@@ -334,21 +334,6 @@

         ;from the producers-ref if any new brokers add them to the metadata-producers-ref
         ;this will only include
-        update-metadata-producers (fn []
-                                    (let [producers (-> producer-ref deref vals flatten distinct)
-                                          metadata-producer-map (reduce (fn [m {:keys [host port]}] (assoc m {:host host :port port} producer)) {} @metadata-producers-ref)
-
-                                          new-meta-producers (reduce
-                                                               (fn [m {:keys [host port]}]
-                                                                 (let [k {:host host :port port}]
-                                                                   (if-not (and (get metadata-producer-map k) (get m k))
-                                                                     (assoc m {:host host :port port} (metadata-request-producer host port conf))
-                                                                     m)))
-                                                                     {}
-                                                                     (-> brokers-metadata deref vals flatten))]
-                                      (prn "new meta producers: " (count new-meta-producers))
-                                      (dosync (alter metadata-producers-ref (fn [coll]
-                                                                              (apply conj coll (vals new-meta-producers)))))))

         ;try each metadata-producer-ref entry in search of metadata
         ;update the producers (ref) with the new metadata found
@@ -376,8 +361,7 @@
 										                  (delete-from-retry-cache connector (:key-val retry-msg)))))
 										         (catch Exception e (error e e))))]

-    (.scheduleWithFixedDelay scheduled-service ^Runnable (fn [] (try (update-metadata-producers) (catch Exception e (error e e)))
-                                                                (try (update-metadata) (catch Exception e (error e e)))) 0 10000 TimeUnit/MILLISECONDS)
+    (.scheduleWithFixedDelay scheduled-service ^Runnable (fn [] (try (update-metadata) (catch Exception e (error e e)))) 0 10000 TimeUnit/MILLISECONDS)
     ;listen to any producer errors, this can be sent from any producer
     ;update metadata, close the producer and write the messages in its buff cache to the
     (if (= producer-retry-strategy :default)


Refactoring tests.

Refactoring tests.

Using ARE instead of IS.

--- test/ahnentafel/gedcom_test.clj
+++ test/ahnentafel/gedcom_test.clj
@@ -12,12 +12,14 @@
     (is (nil? (read-resource "does-not-exist.ged")))))

 (deftest parsing-lines
-  (testing "well formed lines"
-    (is (= {:level 0 :tag "HEAD" :value nil :xref nil} (parse-line "0 HEAD")))
-    (is (= {:level 2 :tag "HEAD" :value nil :xref nil} (parse-line "2 HEAD")))
-    (is (= {:level 10 :tag "HEAD" :value nil :xref nil} (parse-line "10 HEAD")))
-    (is (= {:level 2 :tag "DATE" :value "29 FEB 2000" :xref nil} (parse-line "2 DATE 29 FEB 2000")))
-    (is (= {:level 0 :tag "INDI" :value nil :xref "@FATHER@"} (parse-line "0 @FATHER@ INDI"))))
+  (testing "valid lines"
+    (are [line expected] (= expected (parse-line line))
+         "0 HEAD" {:level 0 :tag "HEAD" :value nil :xref nil}
+         "2 HEAD" {:level 2 :tag "HEAD" :value nil :xref nil}
+         "10 HEAD" {:level 10 :tag "HEAD" :value nil :xref nil}
+         "2 DATE 29 FEB 2000" {:level 2 :tag "DATE" :value "29 FEB 2000" :xref nil}
+         "2 DATE 29 FEB 2000" {:level 2 :tag "DATE" :value "29 FEB 2000" :xref nil}
+         "0 @FATHER@ INDI" {:level 0 :tag "INDI" :value nil :xref "@FATHER@"}))

   (testing "error cases"
     (is (thrown? ahnentafel.ParseError (parse-line "abc def")))


More robust fn? implementation (based on goog/isFunction)

--- lib/shin/cljs/cljs/core.cljs
+++ lib/shin/cljs/cljs/core.cljs
@@ -1574,7 +1574,10 @@
   (if x true false))

 (defn fn? [f]
-  (or (*js-bop == "function" (*js-uop typeof f)) (satisfies? Fn f)))
+  (or
+    (*js-bop == "[object Function]"
+             (.call (.-toString (.-prototype js/Object)) f))
+    (satisfies? Fn f)))

 (deftype MetaFn [afn meta]
   IMeta


drop Closure require code gen when using eval-str

--- src/main/cljs/cljs/js.cljs
+++ src/main/cljs/cljs/js.cljs
@@ -347,11 +347,15 @@
            (if-not (identical? eof form)
              (let [aenv (assoc aenv :ns (ana/get-namespace ana/*cljs-ns*))
                    ast  (ana/analyze aenv form)]
-               (.append sb (with-out-str (comp/emit ast)))
                (if (= :ns (:op ast))
-                 (ns-side-effects true bound-vars aenv ast opts
-                   (fn [_] (compile-loop)))
-                 (recur)))
+                 (do
+                   (.append sb
+                     (str "goog.provide(\"" (munge (:name ast)) "\");\n"))
+                   (ns-side-effects true bound-vars aenv ast opts
+                     (fn [_] (compile-loop))))
+                 (do
+                   (.append sb (with-out-str (comp/emit ast)))
+                   (recur))))
              (let [js-source (.toString sb)]
                (when (:verbose opts)
                  (debug-prn js-source))


add load-ns and load-ns!

add load-ns and load-ns!

--- src/main/cljs/cljs/js.cljs
+++ src/main/cljs/cljs/js.cljs
@@ -95,6 +95,12 @@
    (env/default-compiler-env))
   ([init]
    (doto (empty-state) (swap! init))))
+
+(defn load-ns [pure-state ns cache]
+  (assoc-in pure-state [:ana/namespaces ns] cache))
+
+(defn load-ns! [state ns cache]
+  (assoc-in state [:ana/namespaces ns] cache))

 (defn sm-data []
   (atom


Minor refactoring

Minor refactoring

--- src/main/clojure/fleet.clj
+++ src/main/clojure/fleet.clj
@@ -28,21 +28,21 @@
   :file-path nil
   })

-(defn fleet-
-  ([args template-str]
-    (fleet- args template-str {}))
-  ([args template-str options]
-    (let [opts (merge default-opts options)]
-      (partial
-        (load-fleet-string
-          (build args (parse template-str))
-          (opts :file-path) (opts :file-name))
-        (make-runtime (escape-fn (opts :escaping)))))))
+(defn -fleet
+  [args template-str options]
+  (let [opts (merge default-opts options)]
+    (partial
+      (load-fleet-string
+        (build args (parse template-str))
+        (opts :file-path) (opts :file-name))
+      (make-runtime (escape-fn (opts :escaping))))))

 (defmacro fleet
   "Creates anonymous function from template containing in template-str."
-  [args & more]
-  `(fleet- '~args ~@more))
+  ([args template-str]
+    `(-fleet '~args ~template-str {}))
+  ([args template-str options]
+    `(-fleet '~args ~template-str ~options)))

 ;;;;;;;;;; template namespace ;;;;;;;;;;

@@ -84,7 +84,7 @@
       (let [ns (build-ns root-ns ns)
             arg-names [(last names) 'data]
             opts {:escaping escape, :file-path file-path, :file-name file-name}
-            tpl (within-ns ns (fleet- arg-names content opts))
+            tpl (within-ns ns (-fleet arg-names content opts))
             wrapper (fn ([] (tpl nil nil)) ([a] (tpl a a)) ([a data] (tpl a data)))]
         (doseq [n names]
           (when-not @(ns-resolve ns n)


ough... use SecureRandom, dummy

ough... use SecureRandom, dummy

--- src/naclj/key_protocol.clj
+++ src/naclj/key_protocol.clj
@@ -3,7 +3,7 @@
             [naclj.hash-protocol :as hp]
             [naclj.hash-blake2b])
 	(:import
-	  (java.util.Random)
+	  (java.security.SecureRandom)
             ))

 ;;
@@ -105,8 +105,8 @@

 (defrecord TRandomGeneratorJava [random-generator])

-(defmethod make-random-generator :java.util.Random [provider]
-  (map->TRandomGeneratorJava {:random-generator (java.util.Random.)}))
+(defmethod make-random-generator :java.security.SecureRandom [provider]
+  (map->TRandomGeneratorJava {:random-generator (java.security.SecureRandom.)}))

 (extend-type TRandomGeneratorJava
   IRandomGenerator
@@ -127,7 +127,7 @@

 (defmethod make-key :default
   [provider function & {:keys [size] :as xs}]
-  (map->TGenericKey :key-bs (random-bytes (make-random-generator :java.util.Random) size)
+  (map->TGenericKey :key-bs (random-bytes (make-random-generator :java.security.SecureRandom) size)
                     :provider :sodium))

 ;;;


util/s3.clj: use context instead of environment vars

--- src/org/altlaw/util/s3.clj
+++ src/org/altlaw/util/s3.clj
@@ -1,5 +1,6 @@
 (ns org.altlaw.util.s3
-  (:require [org.altlaw.util.zip :as zip])
+  (:require [org.altlaw.util.zip :as zip]
+            [org.altlaw.util.context :as context])
   (:import (org.jets3t.service.impl.rest.httpclient RestS3Service)
            (org.jets3t.service.model S3Bucket S3Object)
            (org.jets3t.service.security AWSCredentials)
@@ -9,8 +10,8 @@

 (def #^{:private true} get-s3
      (memoize (fn [] (RestS3Service.
-                      (AWSCredentials. (System/getenv "AWS_ACCESS_KEY_ID")
-                                       (System/getenv "AWS_SECRET_ACCESS_KEY"))))))
+                      (AWSCredentials. (context/aws-access-key-id)
+                                       (context/aws-secret-access-key))))))

 (def #^{:private true} get-bucket
      (memoize (fn [x]


minor change

minor change

--- src/pomodoro/pomodoro.cljs
+++ src/pomodoro/pomodoro.cljs
@@ -172,6 +172,7 @@
     om/IDisplayName
     (display-name [_] "pom-view")

+    ;; Update timer and app state here
     om/IWillMount
     (will-mount [_]
       (js/setInterval


add-watch on  :currentIndex

add-watch on  :currentIndex

--- examples/lesson-carousel-starter-kit/src/carousel/core.cljs
+++ examples/lesson-carousel-starter-kit/src/carousel/core.cljs
@@ -124,7 +124,7 @@
                         :anchor anchor}))
                    image-names)
         pager {:node     pager-node
-               :currentIndex 0
+               :currentIndex (atom 0)
                :threashold 4000
                :pages pages
                :pageWidth 0}]
@@ -158,14 +158,27 @@
     (.. FamousEngine (requestUpdate (clj->js {:onUpdate (fn [time]
                                                           (println time)
                                                           (this-as this
-                                                                   (.. FamousEngine (requestUpdateOnNextTick this)))
+                                                                   ;(.. FamousEngine (requestUpdateOnNextTick this))
+                                                                   )
                                                           )})))
+    (add-watch (:currentIndex pager) :watcher (fn [key atom old-state new-state]
+                                                (prn "-- Atom Changed --")
+                                                (prn "key" key)
+                                                (prn "atom" atom)
+                                                (prn "old-state" old-state)
+                                                (prn "new-state" new-state)))
     (go
       (while true
         (let [[v channel] (alts! [back-clicks next-clicks])]
           (cond
-            (= channel back-clicks) (println "back")
-            (= channel next-clicks) (println "next")))))))
+            (= channel back-clicks) (let [current-index (:currentIndex pager)]
+                                      (println "back" @current-index)
+                                      (swap! current-index dec)
+                                      )
+            (= channel next-clicks) (let [current-index (:currentIndex pager)]
+                                      (println "back" @current-index)
+                                      (swap! current-index inc)
+                                      )))))))

 (Carousel "body" {})
 (.. FamousEngine init)


revert to previous revision

revert to previous revision

--- examples/lesson-carousel-starter-kit/src/carousel/core.cljs
+++ examples/lesson-carousel-starter-kit/src/carousel/core.cljs
@@ -40,34 +40,27 @@
 (defn Dots [node options]
   (let [numPages (:numPages options)
         dotWidth (or (:dotWidth options) 10)
-        spacing (or (:spacing options) 5)
         dots (for [i (range numPages)
                    :let [dotNode (.. node addChild)]]
                (do
-                 (.. dotNode
-                     (setSizeMode 1 1)
-                     (setAbsoluteSize dotWidth dotWidth))
-                 (Dot dotNode)))
-        layoutDots (fn [size]
-                     (let [totalDotSize (+ (* dotWidth numPages)
-                                           (* spacing (- numPages 1)))
-                           start (->  (- (first size) totalDotSize) (/ 2))
-                           ]
-                       (doseq [i (range numbPages)
-                               :let [x (+ start (* i (+ dotWidth spacing)))
-                                     dot (nth dots i)]]
-                         (..  (:node dot) (setPosition x 0 0 )))))
-        dots-obj {:node node
-                  :dots dots
-                  :dotWidth dotWidth
-                  :spacing  spacing
-                  :numPages numPages}
+                 (.. dotNode (setSizeMode 1 1))
+                 (.. dotNode (setAbsoluteSize dotWidth dotWidth))
+                 (Dot dotNode)
+                 ))
         resizeComponent {:onSizeChange (fn [size]
-                                         (layoutDots size))}
-        ]
+                                         )}]
     (.. (first dots) select)
     (.. node (addComponent resizeComponent))
-    dots-obj))
+
+    {:node node
+     :dots dots
+     :dotWidth dotWidth
+     :spacing  (or (:spacing options) 5)
+     :numPages numPages
+     :layoutDots (fn [size]
+                   )
+     })
+  )

 (defn Carousel [selector data]


Raise the npc health bar

Raise the npc health bar

--- resources/isometric-rpg/core.clj
+++ resources/isometric-rpg/core.clj
@@ -99,8 +99,8 @@
           pct (/ (:health player) (+ (:health player) (:wounds player)))]
       (shape bar
              :set-color (color :red)
-             :rect 0 0 bar-w bar-h
+             :rect 0 20 bar-w bar-h
              :set-color (color :green)
-             :rect 0 0 bar-w (* bar-h pct)))))
+             :rect 0 20 bar-w (* bar-h pct)))))

 (set-game-screen! main-screen player-health-screen)


show times by story for current day by default

--- src/cljs/iwaswhere_web/ui/charts/pomodoros.cljs
+++ src/cljs/iwaswhere_web/ui/charts/pomodoros.cljs
@@ -25,17 +25,20 @@

 (defn time-by-stories-list
   "Render list of times spent on individual stories, plus the total."
-  [mouse-over]
+  [day-stats]
   (let [options (subscribe [:options])
         stories (reaction (:stories @options))]
-    (fn [mouse-over]
-      (let [stories @stories]
-        [:div.story-time
-         [:div [:strong "Total time"] ": " (u/duration-string (:total-time mouse-over))]
-         (for [[story v] (:time-by-story mouse-over)]
-           (let [story-name (or (:story-name (get stories story)) "No story")]
-             ^{:key story}
-             [:div [:strong story-name] ": " (u/duration-string v)]))]))))
+    (fn [day-stats]
+      (let [stories @stories
+            dur (u/duration-string (:total-time day-stats))
+            date (:date-string day-stats)]
+        (when date
+          [:div.story-time
+           [:div [:strong date] ": " dur]
+           (for [[story v] (:time-by-story day-stats)]
+             (let [story-name (or (:story-name (get stories story)) "No story")]
+               ^{:key story}
+               [:div [:strong story-name] ": " (u/duration-string v)]))])))))

 (defn pomodoro-bar-chart
   [pomodoro-stats chart-h title y-scale put-fn]
@@ -51,8 +54,9 @@
            [bars indexed local :total-time chart-h 0.0025 put-fn]
            [cc/path "M 0 50 l 600 0 z"]
            [cc/path "M 0 100 l 600 0 z"]]]
-         (when-let [mouse-over (:mouse-over @local)]
-           [time-by-stories-list mouse-over])
+         (if-let [mouse-over (:mouse-over @local)]
+           [time-by-stories-list mouse-over]
+           [time-by-stories-list (second (last pomodoro-stats))])
          [:svg
           {:viewBox (str "0 0 600 " chart-h)}
           [:g


Don't perform IO (S3 upload and ZooKeeper) commit on go-thread.

--- src/uswitch/bifrost/s3.clj
+++ src/uswitch/bifrost/s3.clj
@@ -1,7 +1,7 @@
 (ns uswitch.bifrost.s3
   (:require [com.stuartsierra.component :refer (Lifecycle system-map using start stop)]
             [clojure.tools.logging :refer (info warn error debug)]
-            [clojure.core.async :refer (<! >! go-loop chan close! alts! timeout >!!)]
+            [clojure.core.async :refer (<! >! go-loop thread chan close! alts! timeout >!! <!!)]
             [clojure.java.io :refer (file)]
             [aws.sdk.s3 :refer (put-object bucket-exists? create-bucket)]
             [metrics.timers :refer (time! timer)]
@@ -88,30 +88,30 @@
     (when-not (bucket-exists? credentials bucket)
       (info "Creating" bucket "bucket")
       (create-bucket credentials bucket))
-    (go-loop
-     []
-     (let [msg (<! rotated-event-ch)]
-       (if (nil? msg)
+    (thread
+     (loop []
+       (let [msg (<! rotated-event-ch)]
+         (if (nil? msg)

-         (debug "Terminating S3 uploader")
+           (debug "Terminating S3 uploader")

-         (let [{:keys [topic partition file-path first-offset last-offset]} msg]
-           (debug "Attempting to acquire semaphore to begin upload" {:file-path file-path})
-           (>! semaphore :token)
-           (info "Starting S3 upload of" file-path)
-           (loop [state nil]
-             (let [{:keys [goto pause]} (progress-s3-upload state
-                                                            credentials bucket consumer-properties
-                                                            topic partition
-                                                            first-offset last-offset
-                                                            file-path)]
-               (<! (timeout (or pause 0)))
-               (if (= :done goto)
-                 (info "Terminating stepping S3 upload machine.")
-                 (recur goto))))
-           (info "Done uploading to S3:" file-path)
-           (<! semaphore)
-           (recur)))))
+           (let [{:keys [topic partition file-path first-offset last-offset]} msg]
+             (debug "Attempting to acquire semaphore to begin upload" {:file-path file-path})
+             (>!! semaphore :token)
+             (info "Starting S3 upload of" file-path)
+             (loop [state nil]
+               (let [{:keys [goto pause]} (progress-s3-upload state
+                                                              credentials bucket consumer-properties
+                                                              topic partition
+                                                              first-offset last-offset
+                                                              file-path)]
+                 (<!! (timeout (or pause 0)))
+                 (if (= :done goto)
+                   (info "Terminating stepping S3 upload machine.")
+                   (recur goto))))
+             (info "Done uploading to S3:" file-path)
+             (<!! semaphore)
+             (recur))))))
     rotated-event-ch))

 (defn s3-upload-spawner [config]


Don't send delegate parameter when it's not needed

--- src-cljs/frontend/utils/bitbucket.cljs
+++ src-cljs/frontend/utils/bitbucket.cljs
@@ -7,10 +7,12 @@
   "https://bitbucket.org")

 (defn auth-url []
-  (let [state {"return-to" (str js/window.location.pathname
-                                js/window.location.hash)
-               "token" (utils/oauth-csrf-token)
-               "delegate" (str js/window.location.protocol "//" js/window.location.host)}
+  (let [auth-host (aget js/window "renderContext" "auth_host")
+        state (merge {"return-to" (str js/window.location.pathname
+                                       js/window.location.hash)
+                      "token" (utils/oauth-csrf-token)}
+                     (when (not= auth-host js/window.location.host)
+                       {"delegate" (str js/window.location.protocol "//" js/window.location.host)}))
         state-str (.stringify js/JSON (clj->js state))]
     (-> (url (http-endpoint) "site/oauth2/authorize")
         (assoc :query {"state"        state-str


PDOK-1650 polygonpateches in test

PDOK-1650 polygonpateches in test

--- src/test/clojure/pdok/featured/feature_test.clj
+++ src/test/clojure/pdok/featured/feature_test.clj
@@ -20,6 +20,7 @@
 (def gml-one-curve (slurp (resource "gml/gml-one-curve.gml")))

 (def gml-surface-with-more-elements (slurp (resource "gml/gml-surface-with-more-elements.gml")))
+(def gml-object-surface-with-more-elements {"type" "gml" "gml" gml-surface-with-more-elements})

 (deftest test-as-jts-with-curves
  (is (re-find #"curve" (as-gml gml-object-with-hole)))


Coils can now partially recover from a server restart

Items can be added and deleted after a server restart

--- src/webapp/framework/client/system_globals.cljs
+++ src/webapp/framework/client/system_globals.cljs
@@ -24,8 +24,6 @@

-
-(def record-pointer-locally
   "
  This determines whether the mouse pointer events are
  recorded for the local Coils debugger. For an example
@@ -47,6 +45,8 @@

  (defonce ^:dynamic *record-pointer-locally* false)
   "
+(defonce record-pointer-locally
+
   (atom true))

@@ -54,7 +54,6 @@

-(def record-ui
   "
  This determines whether the mouse pointer events are
  recorded for the local Coils debugger. For an example
@@ -76,16 +75,15 @@

  (defonce ^:dynamic *record-pointer-locally* false)
   "
+(defonce record-ui
   (atom nil))

-record-ui
-
-
-
-
-
-
-(def start-component
+
+
+
+
+
+
   "
  This is a reference to the first component of a Coils
  app that must be loaded
@@ -117,7 +115,7 @@
   :you will see:

-(def  ^:export setup
+(defonce   ^:export setup
   {
    :start-component
    main-view
@@ -129,6 +127,7 @@

   "

+(defonce start-component
   (atom nil))

@@ -137,24 +136,24 @@

-(def playbackmode
   "
   If set to true then this means that the user interface is being replayed based on
   the server side recording
   "
+(defonce playbackmode
   (atom false))

-(def call-stack
   "
   This is supposed to be a vector which lists the debug IDs of what has
   been called, eg:

   [1 45 99 103]
   "
+(defonce call-stack
   (atom
    []))

@@ -164,7 +163,6 @@

-(def data-accesses
   "
   This shows where the UI and DATA trees change. The list contains
   the debug IDs of where an action reads or writes this part of
@@ -193,6 +191,7 @@
   - {:tree UI, :path [:values]} does not even exist

   "
+(defonce data-accesses
   (atom
    {}))

@@ -203,43 +202,49 @@

-(def data-state
-  "
-  The data tree
-  "
+"
+The data tree
+"
+(defonce data-state
   (atom
-   {}))
-
-
-
-
-(def app-state
-  "
-  The UI tree
-  "
+    {}))
+
+
+
+
+"
+The UI tree
+"
+(defonce app-state
   (atom
-   {}))
-
-
-
-
-
-(def app-watch-on?
-  "
- Whenever the application UI changes then we record the event,
- unless the app-watch-on? is set to false
-  "
+    {}))
+
+
+
+
+
+
+
+"
+Whenever the application UI changes then we record the event,
+unless the app-watch-on? is set to false
+"
+(defonce app-watch-on?
   (atom true))

-(def ui-watchers
-  "
-  This is a list of all the code that waits for things to happen
-  on the UI tree
-  "
+
+
+
+
+"
+This is a list of all the code that waits for things to happen
+on the UI tree
+"
+(defonce ui-watchers
   (atom []))

@@ -247,21 +252,29 @@

-(def data-watchers
-  "
-  This is a list of all the code that waits for things to happen
-  on the DATA tree
-  "
-
+
+
+
+
+"
+This is a list of all the code that waits for things to happen
+on the DATA tree
+"
+(defonce data-watchers
   (atom []))

-(def ab-tests
-  "
-  The list of all the AB tests
-  "
+
+
+
+
+
+"
+The list of all the AB tests
+"
+(defonce ab-tests
   (atom {}))

@@ -269,10 +282,15 @@

-(def ab-goals
+
+
+
+
+
   "
   The list of all the AB goals
   "
+(defonce ab-goals
   (atom {}))

@@ -280,20 +298,32 @@

-(def init-state-fns
+
+
+
+
+
   "
   This holds all the fns to call at the start of the
   webapp
   "
+(defonce init-state-fns
   (atom []))

-(defn subtree-different?
+
+
+
+
+
+
+
   "
   This checks to see if a subtree of a tree is
   different
   "
+(defn subtree-different?
   [orig-val new-val path]
   (let [
         orig-subset    (get-in orig-val  path)
@@ -308,10 +338,10 @@

-(def blank-app-state
   "
   The initial starting state for the UI tree
   "
+(defonce  blank-app-state
   {
    :data
    {
@@ -336,10 +366,17 @@

+
+
+
+
+
+
+
+  "
+  Resets the UI to be blank
+  "
 (defn reset-app-state
-  "
-  Resets the UI to be blank
-  "
   []
   (reset!  app-state  blank-app-state))

@@ -350,10 +387,12 @@

-(def init-fn
+
+
   "
   An Initialise function called when the web app first starts up
   "
+(defonce  init-fn
   (atom nil))

@@ -364,12 +403,12 @@

-(def playback-app-state
   "
   This holds the UI state of the web applications when
   it is being played back. I'm not sure why we didn't just
   use the normal app state for this?
   "
+(defonce  playback-app-state
   (atom
    {}
    ))
@@ -377,10 +416,17 @@

-(def playback-controls-state
+
+
+
+
+
+
+
   "
   The react/Om UI state for the debugger
   "
+(defonce  playback-controls-state
   (atom
    {:ui
     {
@@ -404,10 +450,15 @@

+
+
+
+
+
+"
+  Reset the app state for playback using the initial blank state
+  "
 (defn reset-playback-app-state
-  "
-  Reset the app state for playback using the initial blank state
-  "
   []
   (reset!  playback-app-state  blank-app-state))

@@ -418,10 +469,13 @@

+
+
+
+  "
+  Updates the data tree
+  "
 (defn  update-data
-  "
-  Updates the data tree
-  "
   [path value]
    (reset! data-state (assoc-in @data-state path value)))

@@ -434,9 +488,11 @@

+
+
+  "
+  "
 (defn add-init-state-fn
-  "
-  "
   [nm init-state-fn]
   (do
     ;(.log js/console (str "Init function added: " nm))
@@ -456,9 +512,9 @@

+  "
+  "
 (defn  set-ab-tests
-  "
-  "
   [tree]
   (do
     (reset! ab-tests tree)
@@ -467,13 +523,13 @@

-(def data-session-id (atom nil))
-
-
-
+(defonce  data-session-id (atom nil))
+
+
+
+  "
+  "
 (defn  set-ab-goals
-  "
-  "
   [tree]
    (reset! ab-goals tree))

@@ -486,9 +542,9 @@

-(def touch-id
-  "
-  "
+  "
+  "
+(defonce  touch-id
   (atom 0))

@@ -497,9 +553,9 @@

+  "
+  "
 (defn touch
-  "
-  "
   [path]
     (reset! app-state (assoc-in @app-state
                                 (conj path
@@ -512,9 +568,9 @@

+  "
+  "
 (defn touch-data
-  "
-  "
   [path]
   (reset! data-state (assoc-in @data-state
                                (conj path
@@ -529,9 +585,9 @@

-(def debug-event-timeline
-  "
-  "
+  "
+  "
+(defonce  debug-event-timeline
   (atom {}))
 ;(map #(str %1) @debug-event-timeline)
 ;(keys (get @debug-event-timeline 49))
@@ -545,9 +601,9 @@

-(def component-usage
-  "
-  "
+"
+"
+(defonce  component-usage
   (atom
                       {}
                       ))
@@ -558,9 +614,9 @@

-(def debugger-ui
-  "
-  "
+  "
+  "
+(defonce  debugger-ui
   (atom {
          :mode                     "show-event"
          :react-components         []
@@ -579,9 +635,9 @@

-(def debug-count
-  "
-  "
+  "
+  "
+(defonce  debug-count
   (atom 0))

@@ -590,9 +646,9 @@

+"
+"
 (defn add-debug-event
-  "
-  "
   [& {:keys [
                                  event-type
                                  old
@@ -730,7 +786,7 @@
 ; We do this because otherwise the application keeps
 ; receiving events otherwise
 ;-----------------------------------------------------
-(def data-and-ui-events-on? (atom true))
+(defonce  data-and-ui-events-on? (atom true))
 (add-watch debugger-ui
            :change-debugger-ui

@@ -799,56 +855,56 @@

-(def gui-calls
-  "
-  A UI state history of all the GUI components
-
-  {
-      'main-view: []'
-            ....
-
-      'splash-screen: [:ui :splash-screen]'
-            [
-               {:show true}
-               {:show false, :click false}
-               {:show true}
-             ]
-
-      'letter-a: [:ui :splash-screen]'
-            ....
-
-      'letter-a: [:ui]'
-            ....
-
-      'browser-menu: []'
-            ....
-
-      'text-graph: [:ui :companies]'
-           [
-               nil
-               {:values [{company apple.com inbound 3}
-                         {company were.com inbound 1}
-                         ]}
-           ]
-      'browser-menu:'
-            ....
-
-      'text-graph:'
-            ....
-  }
-
-  This can be removed as it is not used by the system
-  anywhere
-  "
+"
+A UI state history of all the GUI components
+
+{
+'main-view: []'
+....
+
+'splash-screen: [:ui :splash-screen]'
+[
+{:show true}
+{:show false, :click false}
+{:show true}
+]
+
+'letter-a: [:ui :splash-screen]'
+....
+
+'letter-a: [:ui]'
+....
+
+'browser-menu: []'
+....
+
+'text-graph: [:ui :companies]'
+[
+nil
+{:values [{company apple.com inbound 3}
+{company were.com inbound 1}
+]}
+]
+'browser-menu:'
+....
+
+'text-graph:'
+....
+}
+
+This can be removed as it is not used by the system
+anywhere
+"
+(defonce  gui-calls
   (atom {}))

  ;(get @gui-calls "text-graph: [:ui :companies]")

-(def paths-for-refresh (atom {}))
-
-(def data-views (atom  {}))
+(defonce  paths-for-refresh (atom {}))
+
+(defonce  data-views (atom  {}))

 (count @data-views)
@@ -879,7 +935,7 @@

-(def global-om-state (atom nil))
+(defonce  global-om-state (atom nil))

@@ -890,7 +946,7 @@
 ; -----------------------------------------------------
 ; This is used to send requests to the data windows
 ; -----------------------------------------------------
-(def client-data-window-requests   (chan))
+(defonce  client-data-window-requests   (chan))

 ;                         |
 ;                         |
@@ -906,7 +962,7 @@
 ; -----------------------------------------------------
 ; list of the views and their associated queries
 ; -----------------------------------------------------
-(def client-data-windows  (atom {}))
+(defonce  client-data-windows  (atom {}))
 ; -----------------------------------------------------
 ; client-data-windows
 ;        |
@@ -963,7 +1019,7 @@
 ; -----------------------------------------------------
 ; This is used to get data into a cache
 ; -----------------------------------------------------
-(def client-query-cache-requests  (chan))
+(defonce  client-query-cache-requests  (chan))

 ;                         |
 ;                         |
@@ -979,7 +1035,7 @@
 ; -----------------------------------------------------
 ; list of the query cached record IDs
 ; -----------------------------------------------------
-(def client-query-cache              (atom {}))
+(defonce  client-query-cache              (atom {}))
 ; -----------------------------------------------------
 ; client-query-cache
 ;        |
@@ -1007,7 +1063,7 @@
 ; -----------------------------------------------------
 ; used to get data into the record cache
 ; -----------------------------------------------------
-(def client-record-cache-requests (chan))
+(defonce  client-record-cache-requests (chan))

 ;                         |
 ;                         |
@@ -1063,20 +1119,20 @@
 ;        |                   |          |
 ;        |
 ; -----------------------------------------------------
-(def client-record-cache              (atom {}))
-
-
-
-
-
-
-
-
-
-
-(def ui-paths-mapped-to-data-windows                  (atom {})) ; list of the UI paths and their associated views
+(defonce  client-record-cache              (atom {}))
+
+
+
+
+
+
+
+
+
+
+(defonce  ui-paths-mapped-to-data-windows                  (atom {})) ; list of the UI paths and their associated views

 ; -----------------------------------------------------
 ;
 ; -----------------------------------------------------
-(def client-datasource-fields            (atom {})) ; list of the data sources and their fields
+(defonce  client-datasource-fields            (atom {})) ; list of the data sources and their fields


Whitespace.

Whitespace.

--- src/active/clojure/test_condition.cljc
+++ src/active/clojure/test_condition.cljc
@@ -11,14 +11,15 @@
                (~?condition-predicate con#)
                (ct/do-report {:type :pass :message ~?msg
                               :expected ~?condition-predicate})
-
-
+
+
                :else
                (ct/do-report {:type :fail
                               :message "invalid condition"
                               :expected (list ~?condition-predicate con#)
                               :actual (list 'not (list ~?condition-predicate con#))})]
-
+
+
               (let [val# ~?expr]
                 (ct/do-report {:type :fail
                                :message "condition expected"


Fix button failing to fade in IE8. References #47.

--- src/app/cljs/one/sample/animation.cljs
+++ src/app/cljs/one/sample/animation.cljs
@@ -75,12 +75,14 @@
   submit button is clicked and the form has valid input."
   []
   (let [e {:effect :fade :start 1 :end 0 :time 500}]
-   (play-animation (parallel (bind form e)
-                    (bind label e)      ; Since the label won't fade in IE
-                    (bind cloud
-                          {:effect :color :time 500} ; Dummy animation for delay purposes
-                          {:effect :fade-in-and-show :time 600}))
-                   {:before #(gforms/setDisabled (by-id "name-input") true)})))
+    (play-animation (parallel (bind form e)
+                              (bind label e) ; Since the label won't fade in IE
+                              (bind cloud
+                                    {:effect :color :time 500} ; Dummy animation for delay purposes
+                                    {:effect :fade-in-and-show :time 600}))
+                    {:before #(gforms/setDisabled (by-id "name-input") true)
+                     ;; We need this next one because IE8 won't hide the button
+                     :after #(set-styles! (by-id "greet-button") {:display "none"})})))

 (defn show-form
   "Move the greeting cloud out of view and show the form. Run when the
@@ -91,7 +93,10 @@
                                           {:effect :color :time 300} ; Dummy animation for delay purposes
                                           form-in)
                                     (bind label fade-in move-down)))
-                  {:after #(do
+                  {;; Because IE8 won't hide the button, we need to
+                   ;; toggle it between displaying inline and none
+                   :before #(set-styles! (by-id "greet-button") {:display "inline"})
+                   :after #(do
                              (gforms/setDisabled (by-id "name-input") false)
                              (.focus (by-id "name-input") ()))}))


debug js error

debug js error

--- src/cljs/salava/badge/ui/evidence.cljs
+++ src/cljs/salava/badge/ui/evidence.cljs
@@ -241,7 +241,6 @@
          message (cursor state [:evidence :message])
          input-mode (cursor state [:input_mode])
          {:keys [image_file name]} data]
-    (fn []

     [:div {:id "badge-settings" :class "row flip"}
      [:div {:class "col-md-3 badge-image modal-left"}
@@ -332,7 +331,7 @@
                                   (.preventDefault %)
                                   (swap! state assoc :tab [se/settings-tab-content (dissoc data :evidence) state init-data]
                                          :tab-no 2))}
-          (t :core/Cancel)]]]]]])))
+          (t :core/Cancel)]]]]]]))

 (defn evidence-list [data state init-data]
   (let [evidence-name-atom (cursor state [:evidence :name])
@@ -426,7 +425,8 @@
      [:div.form-group
       [:div.col-md-9 {:class "new-evidence"}
        [:i.fa.fa-plus]
-       [:a {:on-click #(do (.preventDefault %)
+       [:a {:href "#"
+            :on-click #(do (.preventDefault %)
                          (swap! state assoc :evidence nil
                                 :show-preview false
                                 :show-form false
@@ -434,7 +434,7 @@
                                 :tab [evidence-form data state init-data]
                                 :tab-no 2)
                          #_(swap! state assoc :tab [evidence-form data state init-data] :tab-no 2))} (t :badge/Addnewevidence)]]]
-     (when-not (empty? (:evidences data)) [:div.form-group
+     #_(when-not (empty? (:evidences data)) [:div.form-group
                                            [:div.col-md-12 [evidence-list data state init-data]]])]))

 (defn evidence [data state init-data]


Changed reference to use cmr-elastic-utils-lib.

--- src/cmr/indexer/data/elasticsearch.clj
+++ src/cmr/indexer/data/elasticsearch.clj
@@ -7,7 +7,7 @@
             [clj-http.client :as client]
             [cmr.common.log :as log :refer (debug info warn error)]
             [cmr.common.services.errors :as errors]
-            [cmr.transmit.elasticsearch :as es]
+            [cmr.elastic-utils.elasticsearch :as es]
             [cmr.transmit.index-set :as index-set]
             [cmr.indexer.data.index-set :as idx-set]
             [cmr.system-trace.core :refer [deftracefn]]


organizing query2

organizing query2

--- src/com/billpiel/mem_tracer/query2.clj
+++ src/com/billpiel/mem_tracer/query2.clj
@@ -1,9 +1,104 @@
 (ns com.billpiel.mem-tracer.query2
   (require [com.billpiel.mem-tracer.trace :as tr]
-           [clojure.zip :as z]
-           [com.billpiel.mem-tracer.util.tree-query :as tq]))
-
-
+           [clojure.zip :as z]))
+
+;; === zipper iterators
+
+(defn iter-while-identity
+  [f v]
+  (->> v
+       (iterate f)
+       (take-while identity)))
+
+(defn right-sib-zips
+  [z]
+  (->> z
+       (iter-while-identity z/right)
+       rest))
+
+(defn left-sib-zips
+  [z]
+  (->> z
+       (iter-while-identity z/left)
+       rest))
+
+(defn all-sib-zips [z]
+  (->> z
+       z/leftmost
+       right-sib-zips
+       (filter #(not (= % z)))))
+
+(defn parent-zips
+  [z]
+  (->> z
+       (iter-while-identity z/up)
+       rest))
+
+(defn children-zips [z]
+  (->> z
+       z/down
+       (iter-while-identity z/right)))
+
+
+;; === tags
+
+(defn get-tags
+  [node pred-map]
+  (vec (for [[kw pred] pred-map
+             :when (pred node)]
+         kw)))
+
+(defn get-tag-map
+  [tree pred-map]
+  (reduce (fn [tag-map node]
+            (assoc tag-map
+                   (:id node)
+                   (get-tags node pred-map)))
+          {}
+          (tree-seq map? :children tree)))
+
+(defn mk-get-tag-fn
+  [tag-map]
+  (fn [tree]
+    (-> tree
+        :id
+        tag-map)))
+
+;; === zippers
+
+(defn tree->zipper
+  [tree]
+  (z/zipper map?
+            #(-> % :children not-empty)
+            #(assoc % :children %2)
+            tree))
+
+(defn traverse-assoc-zipper
+  [zipr]
+  (if (z/end? zipr)
+    (-> zipr z/root)
+    (recur (-> zipr
+               (z/edit assoc :zipper zipr)
+               z/next))))
+
+(defn traverse-tree-assoc-zipper
+  [tree]
+  (-> tree
+      tree->zipper
+      traverse-assoc-zipper))
+
+;; move this to trace or utils?
+(defn traverse-tree
+  [tree f]
+  (assoc (f tree)
+         :children (mapv #(traverse-tree % f)
+                         (:children tree))))
+
+(defn traverse-tree-dissoc-zipper
+  [tree]
+  (traverse-tree tree #(dissoc % :zipper)))
+
+;; === query

 (defn query-tree
   [qry-fn tree]
@@ -15,69 +110,6 @@
       [e']
       (:children e'))))

-
-(defn get-tags
-  [node pred-map]
-  (vec (for [[kw pred] pred-map
-             :when (pred node)]
-         kw)))
-
-#_ (defn tag-tree
-  [tree pred-map-fn]
-  (-> tree
-      (with-meta {::tags (get-tags tree)})
-      (update-in [:children] #(mapv tag-tree
-                                    %))))
-
-(defn get-tag-map
-  [tree pred-map]
-  (reduce (fn [tag-map node]
-            (assoc tag-map
-                   (:id node)
-                   (get-tags node pred-map)))
-          {}
-          (tree-seq map? :children tree)))
-
-(defn mk-get-tag-fn
-  [tag-map]
-  (fn [tree]
-    (-> tree
-        :id
-        tag-map)))
-
-(defn tree->zipper
-  [tree]
-  (z/zipper map?
-            #(-> % :children not-empty)
-            #(assoc % :children %2)
-            tree))
-
-(defn traverse-assoc-zipper
-  [zipr]
-  (if (z/end? zipr)
-    (-> zipr z/root)
-    (recur (-> zipr
-               (z/edit assoc :zipper zipr)
-               z/next))))
-
-
-(defn traverse-tree-assoc-zipper
-  [tree]
-  (-> tree
-      tree->zipper
-      traverse-assoc-zipper))
-
-;; move this to trace or utils
-(defn traverse-tree
-  [tree f]
-  (assoc (f tree)
-         :children (mapv #(traverse-tree % f)
-                         (:children tree))))
-
-(defn traverse-tree-dissoc-zipper
-  [tree]
-  (traverse-tree tree #(dissoc % :zipper)))
-
 (defn query-dos
   [tree pred-map pred-final-fn] ;; pred-final-fn takes a node (w/ :zipper) and fn to retrieve tags from a node
   (let [tag-map (get-tag-map tree pred-map)
@@ -97,6 +129,7 @@
   ([tree pred-map pred-final-fn] (query-dos tree pred-map pred-final-fn)))

+;; === helpers

 (defn some-zippers
   [zipr-seq node tags-fn pred-fn]
@@ -105,18 +138,26 @@
        (map tags-fn)
        (some pred-fn)))

-(defn lazy-ancestor-zipr-seq
-  [node]
-  (->> node
-       :zipper
-       tq/parent-zips))
-
-(defn lazy-ancestor-tag-seq
-  [node tags-fn]
-  (->> node
-       lazy-ancestor-zipr-seq
-       (map z/node)
-       (map tags-fn)))
+(defmacro defn-zipper->>
+  [name & body]
+  `(defn ~name
+     [node#]
+     (->> node#
+          :zipper
+          ~@body)))
+
+(defmacro defn-tags-functor
+  [name & body]
+  `(defn ~name
+     [node# tags-fn#]
+     (->> node#
+          ~@body
+          (map z/node)
+          (map tags-fn#))))
+
+(defn-zipper->> lazy-ancestor-tag-seq parent-zips)
+
+(defn-tags-functor lazy-ancestor-tag-seq lazy-ancestor-zipr-seq)

 (defn some-tags
   [tag-set tag-seq]


Changing correlation id from kebab case to snake (#304)

--- server/src/spacon/entity/msg.clj
+++ server/src/spacon/entity/msg.clj
@@ -34,17 +34,17 @@
         (log/error "Could not parse protobuf into map b/c"
                    (.getLocalizedMessage e))))))

-(defn- make-protobuf [context correlation-id jwt to action payload]
+(defn- make-protobuf [context correlationId jwt to action payload]
   (-> (MessagePbf$Msg/newBuilder)
       (.setContext context)
       (.setTo to)
       (.setJwt jwt)
       (.setAction action)
       (.setPayload payload)
-      (.setCorrelationId correlation-id)
+      (.setCorrelationId correlationId)
       (.build)))

-(defrecord Msg [correlation-id jwt to action payload])
+(defrecord Msg [correlationId jwt to action payload])

 (defn from-bytes
   "Deserializes the protobuf byte array into an ConnectMessage record"


(PDB-2073) Split get-json test helper

(PDB-2073) Split get-json test helper

... into get-json and get-url, for tests that want to do json
deserialization differently.

--- test/puppetlabs/puppetdb/testutils/services.clj
+++ test/puppetlabs/puppetdb/testutils/services.clj
@@ -123,13 +123,15 @@
 (defn pdb-cmd-url []
   (assoc *base-url* :prefix "/pdb/cmd" :version :v1))

-(defn get-json [base-url suffix & [opts]]
+(defn get-url [base-url suffix & [opts]]
   (let [opts (or opts {:throw-exceptions true
                        :throw-entire-message? true})]
     (-> (str (base-url->str base-url) suffix)
         (client/get opts)
-        :body
-        (json/parse-string true))))
+        :body)))
+
+(defn get-json [base-url suffix & [opts]]
+  (json/parse-string (get-url base-url suffix opts) true))

 (defn get-reports [base-url certname]
   (get-json base-url "/reports"


[skip ci] docstring update

[skip ci] docstring update

--- src/main/cljc/mikron/runtime/core.cljc
+++ src/main/cljc/mikron/runtime/core.cljc
@@ -83,7 +83,7 @@
       `(register-schema! ~schema-name ~(apply schema* {} schema+global-options)))))

 (def ^:dynamic ^:private *buffer*
-  "The default buffer with 10Kb size."
+  "The default buffer with a 10Kb size."
   (buffer/allocate 10000))

 (defn allocate-buffer


Don't shadow core/key

Don't shadow core/key

--- src/refactor_nrepl/ns/dependencies.clj
+++ src/refactor_nrepl/ns/dependencies.clj
@@ -54,12 +54,12 @@
            sym-from-file))
         used-syms))

-(defn- prune-key [libspec key used-syms]
-  (let [val (key libspec)]
+(defn- prune-key [libspec k used-syms]
+  (let [val (k libspec)]
     (if (and val (not (keyword val)))
       (assoc libspec key
              (filter (partial referred-symbol-in-use? (:ns libspec) used-syms)
-                     (key libspec)))
+                     (k libspec)))
       libspec)))

 (defn- remove-unused-syms-and-specs


Bug in result map...

Bug in result map...

--- services/featureCounts.clj
+++ services/featureCounts.clj
@@ -15,7 +15,7 @@
              {:name "featureCounts"
               :value bams-csv-pair
               :exit exit
-              :err })))
+              :err err})))

  :description "Function wrapping featureCounts taking bams-csv-pair file. gtf is a gene-transfer-format annotation and must be sorted to match the bam files and feature-type is the feature class of the gtf (gene, CDS, exon, ...)"
 }


Support cmd.config options

Support cmd.config options

--- services/featureCounts.clj
+++ services/featureCounts.clj
@@ -9,9 +9,17 @@
                  strain (-> bams first fs/basename (str/split #"-") first)
                  refnm ((cmn/get-exp-info eid :ncbi-sample-xref) strain)
                  gtf (fs/join (cmn/get-exp-info eid :refs) (str refnm ".gtf"))
+                 main ["-a" gtf, "-o" csv]
+                 argcard ((get-toolinfo "featureCounts" eid) :argcard)
+                 defaults ["-t" feature-type]
+                 cmdargs ((cmn/get-exp-info eid :cmdsargs) "featureCounts" {})
+                 optargs (pg/merge-arg-sets argcard defaults cmdargs)
+                 theargs (concat main optargs)
+
                  ret (apply pg/featureCounts
-                            (concat ["-a" gtf "-o" csv "-t" feature-type]
-                                    bams [{:verbose true :throw false}]))
+                            (concat theargs
+                                    bams
+                                    [{:verbose true :throw false}]))
                  exit-code @(ret :exit-code)
                  exit (if (= 0 exit-code) :success exit-code)
                  err (-> (ret :stderr) (str/split #"\n") last)]
@@ -20,5 +28,11 @@
               :exit exit
               :err err})))

+ ;; Cardinalities of arguments
+ ;;
+ :argcard {"-a" 1, "-t" 1,
+           "-o" 1, "-R" 1
+           "-L" 0}
+
  :description "Function wrapping featureCounts taking bams-csv-pair file. gtf is a gene-transfer-format annotation and must be sorted to match the bam files and feature-type is the feature class of the gtf (gene, CDS, exon, ...)"
 }


fix bug

fix bug

--- src-cljs/frontend/controllers/controls.cljs
+++ src-cljs/frontend/controllers/controls.cljs
@@ -334,7 +334,7 @@
                         {:layer/path (svg/points->path points)})
                       (when (or (= :circle (get-in state state/current-tool-path))
                                 ;; TODO: hack to preserve border-radius for re-editing circles
-                                (layers/circle layer))
+                                (layers/circle? layer))
                         {:layer/rx (Math/abs (- (:layer/start-x layer)
                                                 (:layer/current-x layer)))
                          :layer/ry (Math/abs (- (:layer/start-y layer)


remove comment

remove comment

--- src-cljs/frontend/controllers/controls.cljs
+++ src-cljs/frontend/controllers/controls.cljs
@@ -671,9 +671,7 @@
 (defmethod control-event :overlay-username-toggled
   [browser-state message _ state]
   (-> state
-      (update-in state/overlay-username-opened-path not)
-      ; (assoc-in state/info-button-learned-path true)
-      ))
+      (update-in state/overlay-username-opened-path not)))

 (defmethod post-control-event! :overlay-info-toggled
   [browser-state message _ previous-state current-state]


Add verbose /api logging

Add verbose /api logging

--- src/yetibot/core/webapp/routes/api.clj
+++ src/yetibot/core/webapp/routes/api.clj
@@ -23,8 +23,10 @@
      ; e.g. 'yetibot.core.adapters.slack/*target*
      (symbol (str adapter-ns) "*target*")]))

-(defn api [{:keys [chat-source command token] :as params}]
+(defn api [{:keys [chat-source command token] :as params} req]
   (info "/api called with params:" params)
+  (info "/api request:" req)
+  (when-let [body (:body req)] (info "/api body:" (slurp body)))
   (cond
     (empty? chat-source) "chat-source parameter is required!"
     (empty? command) "command parameter is required!"
@@ -47,5 +49,5 @@
             (str "invalid chat-source:" chat-source))))

 (defroutes api-routes
-  (GET "/api" [& params] (api params))
-  (POST "/api" [& params] (api params)))
+  (GET "/api" [& params :as req] (api params req))
+  (POST "/api" [& params :as req] (api params req)))


Use newly-factored mixins to share styles to invite page

--- src/braid/core/client/invites/views/invite_page_styles.cljs
+++ src/braid/core/client/invites/views/invite_page_styles.cljs
@@ -7,16 +7,6 @@
 (def invite-page
   [:>.page.invite
    [:>.content
-    mixins/flex
-    {:flex-direction "column"
-     :align-items "center"}
+    (mixins/settings-container-style)
     [:>.invite
-     {:background-color "white"
-      :border-radius (px 10)
-      :padding (rem 1)
-      :font-size (rem 0.9)
-      :width "50%"}
-     [:button (mixins/settings-button)]
-     [:.invite-link
-      [:>input
-       {:width "100%"}]]]]])
+     (mixins/settings-item-style)]]])


Add refactor-nrepl

Add refactor-nrepl

--- lein/profiles.clj
+++ lein/profiles.clj
@@ -1,2 +1,2 @@
-{:user {:plugins [[cider/cider-nrepl "0.9.0"]]
-        :dependencies [[org.clojure/tools.nrepl "0.2.10"]]}}
+{:user {:plugins [[cider/cider-nrepl "0.9.0"] [refactor-nrepl "1.1.0"]]
+        :dependencies [[org.clojure/tools.nrepl "0.2.7"]]}}


lein: bumps

lein: bumps

--- lein_profiles.clj
+++ lein_profiles.clj
@@ -1,8 +1,8 @@
 {:user {:plugins [
-                  [lein-ring "0.9.4"]
+                  [lein-ring "0.9.6"]
                   [lein-ancient "0.6.7"]
                   [jonase/eastwood "0.2.1"]
-                  [cider/cider-nrepl "0.9.0-SNAPSHOT"]
+                  [cider/cider-nrepl "0.9.0"]
                   ]}}
 {:dev {:dependencies
        [[com.cemerick/pomegranate "0.3.0"]]


fix deps

fix deps

--- basic0/project.clj
+++ basic0/project.clj
@@ -7,8 +7,7 @@
   :java-source-paths ["src/java"]
   :compile-path "war/WEB-INF/classes"
   :target-path "war/WEB-INF/lib"
-  :dependencies [;;[org.clojure/clojure "1.5.1"]
-                 ;; uncomment if you don't already have jetty-runner:
-                 ;; [org.eclipse.jetty/jetty-runner "9.0.5.v20130815"]
+  :dependencies [[org.clojure/clojure "1.5.1"]
+                 [org.eclipse.jetty/jetty-runner "9.0.5.v20130815"]
                  [javax.servlet/servlet-api "2.5"]]
   :plugins [[lein-migae "0.1.7"]])


improve logs

improve logs

--- src/clj/algorithms_clj/macro_initiation.clj
+++ src/clj/algorithms_clj/macro_initiation.clj
@@ -209,20 +209,27 @@
 ;; Example 4-a: Adding logs around functions
 ;; --------------------------------------------------------

+(defn log-enter-message
+  [fct-name arg-list arg-values]
+  (str
+    "Entering the function " fct-name " with args "
+    (mapv vector arg-list arg-values)))
+
 (defmacro defn-log
   [name bindings body]
-  `(defn ~name
-     ~bindings
-     (println "Entering the function with args:" ~@bindings)
-     ~body))
-
-(defn-log add-log
+  (let [fct-name (-> &form first str)]
+    `(defn ~name
+       ~bindings
+       (println (log-enter-message ~fct-name (quote ~bindings) ~bindings))
+       ~body)))
+
+(defn-log add-with-log
   [a b]
   (+ a b))

 (defn test-add-log
   []
-  (add-log 1 2))
+  (add-with-log 1 2))

 ;; --------------------------------------------------------
 ;; Example 4-b: Adding logs based on run time option (no overhead)


fixed servertest -> serverspec

fixed servertest -> serverspec

--- src/dda/pallet/dda_serverspec_crate/app.clj
+++ src/dda/pallet/dda_serverspec_crate/app.clj
@@ -23,8 +23,6 @@
    [dda.pallet.dda-serverspec-crate.infra :as infra]
    [dda.pallet.dda-serverspec-crate.domain :as domain]))

-(def with-servertest infra/with-serverspec)
-
 (def with-serverspec infra/with-serverspec)

 (def InfraResult domain/InfraResult)
@@ -39,8 +37,6 @@
   {:group-specific-config
      {group-key config}})

-(def with-servertest infra/with-servertest)
-
 (defn app-configuration
   [domain-config & {:keys [group-key] :or {group-key :dda-servertest-group}}]
   (s/validate domain/ServerTestDomainConfig domain-config)
@@ -50,4 +46,4 @@
   [app-config :- ServertestAppConfig]
   (group/group-spec
     app-config [(config-crate/with-config app-config)
-                with-servertest]))
+                with-serverspec]))


Get this thang working :D

Get this thang working :D

--- src/doctopus/storage/impls/permanent_fs.clj
+++ src/doctopus/storage/impls/permanent_fs.clj
@@ -34,8 +34,8 @@
   "Returns the routes this serves"
   [key]
   (let [file-handle (binding [fs/*cwd* root] (fs/file key))
-        file-name (.getPath file-handle)]
-    [(str key "/") (bidi-ring/->Files {:dir file-name})]))
+        file-name (str (.getPath file-handle) "/")]
+    [key {"/" (bidi-ring/->Files {:dir file-name})}]))

 (defn remove-fn
   [key]