Update core.clj

Update core.clj

--- src/iyye/bios/core.clj
+++ src/iyye/bios/core.clj
@@ -19,6 +19,7 @@
             [iyye.bios.resource :as resource]
             [iyye.bios.persistence :as persistence]
             [iyye.bios.noun-words :as nouns]
+            [iyye.bios.task :as task]
             [clojure.tools.logging :as log]
             [clojure.tools.cli :refer [parse-opts]]
             [clojure.string :as str]))
@@ -27,8 +28,6 @@

 ; wake sleep state machine
 (defn main-loop []
-  (nouns/add-word "iyye.days" #(list @resource/num-days) nil)
-  (while true
     (let [current-day (resource/create-day)]
       (resource/start-day current-day)

@@ -42,7 +41,9 @@
         (while (not (resource/is-night-over? current-night))
           (Thread/sleep DAY_CHECK_TIME_MILLIS))

-        (resource/stop-night current-night)))))
+        (resource/stop-night current-night))))
+
+(def main-task {:name "iyye.bios.main" :function main-loop :task-future (ref 0) :parent nil :children (ref (list))})

 (defn- load-state [name]
   (log/info "first day load")
@@ -115,5 +116,6 @@
         "load"  (if (persistence/iyye-exists? (:name options)) (load-state (:name options)) (exit -1 "Does not exist")))))

   (doall  (iolist/init-io))
+  (nouns/add-word "iyye.days" #(list @resource/num-days) nil)
   ; Start in a thread so that I can use REPL too
-  (-> (Thread. main-loop) .start))
+  (task/start-task main-task))


Add eastwood to lein profiles.

Add eastwood to lein profiles.

--- dotfiles/lein/profiles.clj
+++ dotfiles/lein/profiles.clj
@@ -1 +1,2 @@
-{:user {:plugins [[cider/cider-nrepl "0.8.2"]]}}
+{:user {:plugins [[jonase/eastwood "0.2.1"]
+                  [cider/cider-nrepl "0.8.2"]]}}


Lisätty menukakkeita

Lisätty menukakkeita

--- mtg-pairings-wer/src/mtg_pairings/core.clj
+++ mtg-pairings-wer/src/mtg_pairings/core.clj
@@ -10,27 +10,61 @@

 (def server-address  (text ""))

+
 (defn select-file []
   (text! database-location
          (choose-file :success-fn (fn [fc file] (.getAbsolutePath file)))))

+
 (def database-button (button :text "..."
                        :listen [:action #(select-file)]))
+
+(defn upload-results []
+  ())
+
+(def upload-button (button :text "Upload"
+                     :listen [:action #(upload-results)]))
+
+(def about-window
+  (frame
+    :on-close :dispose
+    :title "About MTG pairings"
+    :size [100 :by 100]
+    :content (border-panel
+               :north "This is the WER database sniffer and result uploader"
+               :south (button :text "Close"))))

-
+
+(defn about-handler [event]
+  (-> (about-window)
+    pack!
+    show!))
+
+(defn exit-handler [event]
+  (System/exit 0))
+
+
+(def about-action (menu-item :text "About" :listen [:action about-handler]))
+
+(def exit-action (menu-item :text "Exit" :listen [:action exit-handler]))
+

 (defn main-window []
   (frame
     :on-close :dispose
     :title "MTG pairings database sniffer"
     :size [300 :by 300]
+    :menubar (menubar :items
+               [(menu :text "File" :items [about-action exit-action])])
     :content (grid-panel
                :columns 3
                :border "Settings"
                :vgap 5
                :hgap 5
-               :items ["Database file" database-location database-button
-                       "Server address" server-address])
+               :items ["Database file:" database-location database-button
+                       "Server address:" server-address ""
+                       "" "" ""
+                       "Upload results:" upload-button])
                ))


Make "Accept" a primary button

Make "Accept" a primary button

--- src-cljs/frontend/components/account.cljs
+++ src-cljs/frontend/components/account.cljs
@@ -223,7 +223,8 @@
                                                     posting, but we do encourage you to talk with your coworkers!"]]]))
                             :actions [(button/button {:on-click close-fn} "Cancel")
                                       (button/button
-                                       {:on-click #(do
+                                       {:primary? true
+                                        :on-click #(do
                                                      (set-beta-program-preference! owner true)
                                                      ((om/get-shared owner :track-event) {:event-type :beta-accept-terms-clicked})
                                                      (close-fn))}


hold off on invite ui until it's wired up

--- src-cljs/frontend/components/overlay.cljs
+++ src-cljs/frontend/components/overlay.cljs
@@ -89,10 +89,11 @@
                            :role "button"}
              (common/icon :clock)
              [:span "Your Documents"]]
-            [:a.menu-item {:on-click #(cast! :invite-menu-opened)
-                           :role "button"}
-             (common/icon :users)
-             [:span "Invite Collaborators"]]
+            ;; TODO finish wiring up invite stuff -dk (12/09/14)
+            ;; [:a.menu-item {:on-click #(cast! :invite-menu-opened)
+            ;;                :role "button"}
+            ;;  (common/icon :users)
+            ;;  [:span "Invite Collaborators"]]
             [:a.menu-item {:on-click #(cast! :shortcuts-menu-opened)
                            :role "button"}
              (common/icon :command)
@@ -138,7 +139,11 @@
            [:article.menu-view-frame
             [:h2 "What is Precursor?"]
             [:p "No-nonsense prototyping—perfect for wireframing, sketching, and brainstorming. "
-                [:a {:on-click #(cast! :invite-menu-opened)
+                ;; TODO finish wiring up invite stuff -dk (12/09/14)
+                ;; [:a {:on-click #(cast! :invite-menu-opened)
+                ;;      :role "button"}
+                ;;  "Invite"]
+                [:a {:on-click #(cast! :invite-link-clicked)
                      :role "button"
                      :title "In chat, type \"/invite their@email.com\""}
                  "Invite"]


Easy performance optimizations with type hints.

--- Spraff/src/spraff/core.clj
+++ Spraff/src/spraff/core.clj
@@ -37,16 +37,16 @@
         :pre [v]
         :post [% (= v %)]
     }
-
-    (locking (:lock c)
-        (if-let [result
-            (if-let [wr (.get (:whm c) v)]
-                (if-let [ret (.get wr)]
-                    ret))]
-            result
-            (do
-                (.put (:whm c) v (new java.lang.ref.WeakReference v))
-                (canonical-get c v) ))))
+    (let [^java.util.WeakHashMap whm (:whm c)]
+        (locking (:lock c)
+            (if-let [result
+                (if-let [^java.lang.ref.WeakReference wr (.get whm v)]
+                    (if-let [ret (.get wr)]
+                        ret))]
+                result
+                (do
+                    (.put whm v (new java.lang.ref.WeakReference v))
+                    (canonical-get c v) )))))

 (def canon (let [c (make-canonicalizer)]
     (fn [v] (canonical-get c v))))
@@ -251,8 +251,8 @@
                     }
                 })
                 :channels [channel])
-            (with-open [in (reader corpus-file)]
-                (dorun (map #(update-state! % state-ref) (line-seq in))))))))
-
-
-
+            (time (with-open [in (reader corpus-file)]
+                (dorun (map #(update-state! % state-ref) (line-seq in)))))))))
+
+
+


Refactor map-view to make it a pure function of the :transit-journey cursor, making rendering multiple maps efficient

--- src/cljs/travel_site/components/city.cljs
+++ src/cljs/travel_site/components/city.cljs
@@ -19,6 +19,12 @@

 (defn geojson->goog-latlng [[lng lat]]
   (js/google.maps.LatLng. lat lng))
+
+(defn get-start-location [transit-directions]
+  (-> transit-directions :directions :routes (get 0) :legs (get 0) :start_location))
+
+(defn get-end-location [transit-directions]
+  (-> transit-directions :directions :routes (get 0) :legs (get 0) :end_location))

 (defn transit-directions-view [transit-directions owner]
@@ -119,53 +125,46 @@
         []
         all-directions))))

-(defn create-renderers [owner all-directions]
+(defn make-transit-journey [waypoints journey all-directions]
+  (annotate-directions
+    (-> journey :start-place :address)
+    (-> journey :end-place :address)
+    waypoints
+    all-directions))
+
+(defn create-renderers [owner transit-directions]
   (reduce
     (fn [renderers [index directions]]
       (let [renderer (js/google.maps.DirectionsRenderer.
                        #js {:polylineOptions #js {:strokeColor (next-color index)}
                             :suppressMarkers true})]
         (.setMap renderer (om/get-state owner :google-map))
-        (.setDirections renderer (clj->js (:directions directions)))
+        (.setDirections renderer (clj->js (-> directions :directions clj->js)))
         (conj renderers renderer)))
     []
-    (map vector (range) all-directions)))
-
-(defn gen-new-renderers [owner waypoints journey all-directions]
-  (let [all-renderers (create-renderers owner all-directions)]
-    (om/set-state! owner :all-renderers all-renderers)
-    (om/update!
-      (models/transit-journey)
-      (annotate-directions
-        (-> journey :start-place :address)
-        (-> journey :end-place :address)
-        waypoints
-        all-directions))))
-
-(defn get-start-location [transit-directions]
-  (-> transit-directions :directions :routes (get 0) :legs (get 0) :start_location))
-
-(defn get-end-location [transit-directions]
-  (-> transit-directions :directions :routes (get 0) :legs (get 0) :end_location))
-
-(defn create-markers [owner]
+    (map vector (range) transit-directions)))
+
+(defn gen-new-renderers [owner transit-directions]
+  (let [all-renderers (create-renderers owner transit-directions)]
+    (om/set-state! owner :all-renderers all-renderers)))
+
+(defn create-markers [owner transit-journey]
   (reduce
     (fn [partial-markers [place-id location]]
       (conj
         partial-markers
         (js/google.maps.Marker.
-          #js {:position location
+          #js {:position location
                :map (om/get-state owner :google-map)
-               :title (str place-id)
-               :label (str (inc place-id))
-               })))
+               :title (str place-id)
+               :label (str (inc place-id))})))
     []
-    (vec
+    (vec
       (map vector
            "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
            (conj
-             (vec (map get-start-location (models/transit-journey)))
-             (get-end-location (last (models/transit-journey))))))))
+             (vec (map get-start-location transit-journey))
+             (get-end-location (last transit-journey)))))))

 ;; TODO - make sure that this doesn't cause a memory leak
 ;; since I don't actually delete the object
@@ -178,16 +177,19 @@
         nil
         old-markers))))

-(defn gen-new-markers [owner]
-  (let [all-markers (create-markers owner)]
+(defn gen-new-markers [owner transit-journey]
+  (let [all-markers (create-markers owner transit-journey)]
     (om/set-state! owner :all-markers all-markers)))

+(defn valid-journey? [journey]
+  (and (not (empty? (-> journey :start-place :coords))) (not (empty? (-> journey :end-place :coords)))))
+
 (defn update-journey-plan [owner]
-  (let [[current-city journey] (om/get-props owner)
+  (let [{:keys [current-city journey transit-journey]} (om/get-props owner)
         waypoints (attractions/get-waypoints
                     (-> journey :waypoint-attraction-ids)
                     (-> current-city :attractions :data)) ]
-    (when (and (not (empty? (-> journey :start-place :coords))) (not (empty? (-> journey :end-place :coords))))
+    (when (valid-journey? journey)
       (.route
         (om/get-state owner :google-directions-service)
         #js {:origin (-> journey :start-place :coords clj->js)
@@ -206,36 +208,37 @@
                   (if (> msg-count 0)
                     (recur (dec msg-count) (conj partial-directions (<! response-channel)))
                     (do
-                      (remove-old-renderers owner)
-                      (remove-old-markers owner)
-                      (gen-new-renderers owner waypoints journey partial-directions)
-                      (gen-new-markers owner))))))))))))
-
-(defn attraction-map-view [[current-city journey] owner]
+                      (om/update!
+                        transit-journey
+                        (make-transit-journey waypoints journey partial-directions)))))))))))))
+
+(defn attraction-map-view [[current-city journey transit-journey] owner]
   (reify
     ;; initialize the google maps objects and store them as local state to the map view
     om/IDidMount
     (did-mount [_]
       (let [google-map-container (om/get-node owner)
             google-directions-service (js/google.maps.DirectionsService.)
-            google-directions-renderer (js/google.maps.DirectionsRenderer.)
             google-city-center (geojson->goog-latlng (-> current-city :city :data :center :coordinates))]
         (let [google-map (js/google.maps.Map.
                            google-map-container
                            #js {:center google-city-center
                                 :zoom 9})]
-          (.setMap google-directions-renderer google-map)
           (om/set-state! owner :google-map google-map)
           (om/set-state! owner :google-directions-service google-directions-service)
-          (om/set-state! owner :google-directions-renderer google-directions-renderer)
-          (update-journey-plan owner))))
+          (gen-new-renderers owner transit-journey)
+          (gen-new-markers owner transit-journey))))

     ;; recompute the route upon journey update
     om/IDidUpdate
-    (did-update [_ [prev-city prev-journey] _]
-      (let [[city journey] (om/get-props owner)]
-        (if-not (journey-same? journey prev-journey)
-          (update-journey-plan owner))
+    (did-update [_ [prev-city prev-journey prev-transit-journey] _]
+      (let [[city journey transit-journey] (om/get-props owner)]
+        (when (valid-journey? journey)
+          (when-not (= transit-journey prev-transit-journey)
+            (remove-old-markers owner)
+            (remove-old-renderers owner)
+            (gen-new-renderers owner transit-journey)
+            (gen-new-markers owner transit-journey)))
         (if-not (= (-> city :city :data :center :coordinates) (-> prev-city :city :data :center :coordinates))
           (.setCenter (om/get-state owner :google-map) (geojson->goog-latlng (-> current-city :city :data :center :coordinates))))))

@@ -245,12 +248,19 @@

 (defn city-view [{:keys [current-city journey transit-journey]} owner]
   (reify
+    om/IDidMount
+    (did-mount [_]
+      (let [google-directions-service (js/google.maps.DirectionsService.)]
+        (om/set-state! owner :google-directions-service google-directions-service))
+      (update-journey-plan owner))
+
     ;; A bit hacky, but register a listener on the root city component whose job is to sync
     ;; changes in the journey state to the url. Not sure of a better way to do it.
     ;; Perhaps better to put it in a different component...
     om/IDidUpdate
     (did-update [_ next-props _]
       (when-not (journey-same? (:journey (om/get-props owner)) (:journey next-props))
+        (update-journey-plan owner)
         (router/go-to-hash
           (http/encode-url-parameters
             (str "/city/" (-> current-city :city :data :id))
@@ -272,5 +282,5 @@
                                                             (-> current-city :attractions :data)])]]
               [:div {:class "ui fourteen wide column row basic segment"}
                [:div {:class "fourteen wide column"}
-                (om/build attraction-map-view [current-city journey])]]
+                (om/build attraction-map-view [current-city journey transit-journey])]]
               ]]))))


Tweak to handle RGB in branch point counter, still is too dirty

--- src/plugins/Scripts/Funimage/Morphology/Branch_Point_Counter.clj
+++ src/plugins/Scripts/Funimage/Morphology/Branch_Point_Counter.clj
@@ -6,15 +6,20 @@
 (def directory (ij.IJ/getDirectory "image"))

 ; Requires the plugin from:
-; morphology update site
+; morphology update site
 ; and
 ; http://jvsmicroscope.uta.fi/?q=skeleton_intersections

-(ij.IJ/run imp "Subtract Background..." "rolling=25")
-(def channels (ij.plugin.ChannelSplitter/split imp))

-(def mask (second channels))
-(.setTitle mask (str "C2-" orig-name ))
+(if (= (.getType imp) ij.ImagePlus/COLOR_RGB)
+  (do (ij.IJ/run imp "8-bit" "")
+    (def mask imp))
+  (do (def channels (ij.plugin.ChannelSplitter/split imp))
+
+    (def mask (second channels))
+    (.setTitle mask (str "C2-" orig-name ))))
+
+(ij.IJ/run mask "Subtract Background..." "rolling=25")

 (dotimes [step smoothing-steps]
   (ij.IJ/run mask "Smooth" ""))
@@ -29,10 +34,10 @@
   (let [rt (ij.measure.ResultsTable/getResultsTable)]
     {:num-regions (.getCounter rt)
      :area (apply + (map #(.getValue rt "Area" %) (range (.getCounter rt))))}))
-
+
 ;(let [rm (ij.plugin.frame.RoiManager.)
 ;      num-rois (.getCount rm)]
-
+

 (def new-mask (ij.WindowManager/getImage (str "Mask of " (str "C2-" orig-name ))))

@@ -58,7 +63,7 @@
       rt (.getResultsTable tp)
       ;tmp (println (clojure.string/join "\t" (.getHeadings rt)))
       line (.getLine tp 0)
-      [image-name num-intersections] (clojure.string/split line #"\t")
+      [image-name num-intersections] (clojure.string/split line #"\t")
       ;image-name (.getValue rt "Image name" 0)
       ;num-intersections (.getValue rt "Num of intersections" 0)
       ]
@@ -69,4 +74,4 @@
 ;(println "saving as" (str (string/replace (string/replace orig-name ".tif" "") " " "_") "_labeled_branches.tif"))
 ;(ij.IJ/saveAsTiff imp (str directory "/" (string/replace orig-name ".tif" "") "_labeled_branches.tif"))

-;(ij.IJ/run "Close All")+;(ij.IJ/run "Close All")


simplify interactive shapes illustration

--- src-cljs/frontend/components/landing.cljs
+++ src-cljs/frontend/components/landing.cljs
@@ -72,15 +72,14 @@
       [:div.property-dropdown-targets
        [:div.art-interact-target
         [:div.art-interact-placeholder "with"]
-        [:div.art-interact-ibeam "|"]
-        [:div.art-interact-more "..."]]
+        [:div.art-interact-ibeam]
+        [:div.art-interact-more
+         (common/icon :ellipsis)]]
        [:div.property-dropdown-target.selected
         [:div.art-interact-item "home page"]]
        [:div.property-dropdown-target "blog page"]
        [:div.property-dropdown-target "about page"]
-       [:div.property-dropdown-target "contact page"]
-       [:div.property-dropdown-target "jobs page"]
-       [:div.property-dropdown-target "team page"]]]]]))
+       [:div.property-dropdown-target "contact page"]]]]]))

 (def artwork-team
   (html


close client/server explicitly in test

close client/server explicitly in test

--- storm-netty/test/clj/backtype/storm/messaging/netty_unit_test.clj
+++ storm-netty/test/clj/backtype/storm/messaging/netty_unit_test.clj
@@ -22,6 +22,8 @@
         resp (.recv server 0)]
     (is (= task (.task resp)))
     (is (= req_msg (String. (.message resp))))
+    (.close client)
+    (.close server)
     (.term context)))

 (deftest test-large-msg
@@ -38,6 +40,8 @@
         resp (.recv server 0)]
     (is (= task (.task resp)))
     (is (= req_msg (String. (.message resp))))
+    (.close client)
+    (.close server)
     (.term context)))

 (deftest test-server-delayed
@@ -55,6 +59,8 @@
         resp (.recv server 0)]
     (is (= task (.task resp)))
     (is (= req_msg (String. (.message resp))))
+    (.close client)
+    (.close server)
     (.term context)))

 (deftest test-batch
@@ -74,4 +80,6 @@
             resp (.recv server 0)
             resp_msg (String. (.message resp))]
         (is (= req_msg resp_msg))))
+    (.close client)
+    (.close server)
     (.term context)))


Changed string building using json/generate-string instead of 'format' fn in bootstrap_util.clj

--- system-int-test/src/cmr/system_int_test/utils/bootstrap_util.clj
+++ system-int-test/src/cmr/system_int_test/utils/bootstrap_util.clj
@@ -21,7 +21,7 @@
                    {:method :post
                     :query-params {:synchronous true}
                     :url (url/bulk-index-provider-url)
-                    :body (format "{\"provider_id\": \"%s\"}" provider-id)
+                    :body (json/generate-string {:provider_id provider-id})
                     :content-type :json
                     :accept :json
                     :throw-exceptions false
@@ -36,7 +36,7 @@
                    {:method :post
                     :query-params {:synchronous true}
                     :url (url/bulk-index-collection-url)
-                    :body (format "{\"provider_id\": \"%s\", \"collection_id\": \"%s\"}" provider-id collection-id)
+                    :body (json/generate-string {:provider_id provider-id :collection_id collection-id})
                     :content-type :json
                     :accept :json
                     :throw-exceptions false


CMR-1863 Updates translation tests to work with new example records.

--- system-int-test/test/cmr/system_int_test/ingest/translation_test.clj
+++ system-int-test/test/cmr/system_int_test/ingest/translation_test.clj
@@ -10,7 +10,7 @@
             [cmr.umm-spec.test.generate-and-parse :as gap]))

 ;; Borrowing from the example records defined in generate-and-parse.
-(def example-record (get gap/example-records "Range Dates"))
+(def example-record (first (vals gap/example-records)))

 (comment


RDC - Update other tests to use local bindings instead of hardcodings.

--- test/icfp2015/board_test.clj
+++ test/icfp2015/board_test.clj
@@ -17,21 +17,21 @@

   (testing "translate east"
     (let [unit { :members #{ [0 0] [1 1] } :pivot [0 1] }
-          f    (translate 1 0)
+          f    (apply translate east)
           actual-unit (f unit)
           expected-unit { :members #{ [1 0] [2 1] } :pivot [1 1] }]
       (is (= expected-unit actual-unit))))

   (testing "translate southwest"
     (let [unit { :members #{ [0 0] [1 1] } :pivot [0 1] }
-          f    (translate 0 1)
+          f    (apply translate southwest)
           actual-unit (f unit)
           expected-unit { :members #{ [0 1] [1 2] } :pivot [0 2] }]
       (is (= expected-unit actual-unit))))

   (testing "translate southeast"
     (let [unit { :members #{ [0 0] [1 1] } :pivot [0 1] }
-          f    (translate 1 1)
+          f    (apply translate southeast)
           actual-unit (f unit)
           expected-unit { :members #{ [1 1] [2 2] } :pivot [1 2] }]
       (is (= expected-unit actual-unit))))))
@@ -94,21 +94,3 @@
                            :current-unit nil }
           actual-board (lock-current-unit board)]
       (is (= expected-board actual-board)))))
-
-(deftest clear-rows-test
-  (testing "no rows cleared if no full rows"
-    (let [board { :width 5
-                  :height 5
-                  :filled #{ [0 0] [1 1] [2 2] [3 3] [4 4] } }
-          actual-board (clear-rows board)
-          expected-board board]
-      (is (= expected-board actual-board))))
-  (testing "rows cleared if full rows"
-    (let [board { :width 5
-                  :height 5
-                  :filled #{ [4 0] [4 1] [4 2] [4 3] [4 4] } }
-          actual-board (clear-rows board)
-          expected-board { :width 5
-                           :height 5
-                           :filled #{} } ]
-      (is (= expected-board actual-board)))))


CMR-4103: Addressed more PR comments.

CMR-4103: Addressed more PR comments.

--- indexer-app/src/cmr/indexer/data/concepts/collection.clj
+++ indexer-app/src/cmr/indexer/data/concepts/collection.clj
@@ -50,8 +50,9 @@
       :else
       (errors/internal-error! (str "Unknown spatial representation [" coord-sys "]")))))

-(defn- apply-function-to-all-values-in-map [m f]
+(defn- apply-function-to-all-values-in-map
   "Applies function f to all the values in map m."
+  [m f]
   (reduce-kv (fn [m k v] (assoc m k (f v))) {} m))

 (defn- collection-temporal-elastic
@@ -211,10 +212,12 @@
         {:keys [granule-start-date granule-end-date]} (cgac/get-coll-gran-aggregates context concept-id)
         last-3-days (t/interval (t/minus (tk/now) (t/days 3)) (tk/now))
         granule-end-date (when-not (and granule-end-date (t/within? last-3-days granule-end-date))
-                           granule-end-date)]
                            ;; If the granule end date is within the last 3 days we indicate that
                            ;; the collection has no end date. This allows NRT collections to be
                            ;; found even if the collection has been reindexed recently.
+                           ;; otherwise, use granule-end-date
+                           granule-end-date)]
+
     (merge {:concept-id concept-id
             :doi doi
             :doi.lowercase doi-lowercase


Fix style

Fix style

--- test/obb_rules_api/turn_test.clj
+++ test/obb_rules_api/turn_test.clj
@@ -55,5 +55,4 @@
                             (assoc :p2-focused-board true))
             [focus-result response] (sim/turn-ok :p2 focus-board)]
         (is (focus-result :p2-focused-board))
-        (is (= (result-board direct-result) (result-board focus-result)))
-      ))))
+        (is (= (result-board direct-result) (result-board focus-result)))))))


My fold-right is actually not really lazy as I currently have no idea how to mimic named parameter from scala. Solved 5.6 anyway

--- src/fpinscala/strictness_and_laziness.clj
+++ src/fpinscala/strictness_and_laziness.clj
@@ -83,9 +83,9 @@
 ;auxiliary - direct translation from book
 (defn fold-right [z f s]
   (let [[h & t] s]
-    (if t
+    (if h
       (f h (fold-right z f t))
-      (if h (f h z) z))))
+      z)))
 ;it would be more concise should I have used core.match

 ;example - exists via f-r - also direct translation from book
@@ -119,3 +119,13 @@
 ;fpins
 ;conceptually the same
 ;-----------------------------------------------------------------------
+
+;5.6
+;mine
+(defn head-option-fr
+  "headOption from fpins via f-r"
+  [s]
+  (fold-right {:val nil :none true} (fn [v _] (if v {:val v :none false})) s))
+;fpins
+;conceptually the same - woo-hoo :)
+;-----------------------------------------------------------------------


Fix releasing held cues on non-origin pages.

We were adding page origin values, but the coordinates we were receiving
were the ones we had sent to the show updates code, so they were already
correct, and thus getting messed up.

--- src/afterglow/web/routes/show_control.clj
+++ src/afterglow/web/routes/show_control.clj
@@ -637,7 +637,7 @@
   [page-info kind req]
   (let [[left bottom] (:view page-info)
         [_ column row] (clojure.string/split kind #"-")
-        [x y] (map + (map #(Integer/valueOf %) [column row]) [left bottom])
+        [x y] (map + (map #(Integer/valueOf %) [column row]) [left bottom])  ; Translate relative page coordinates
         [cue active] (show/find-cue-grid-active-effect (:show page-info) x y)
         shift (get-in req [:params :shift])]
     (if cue
@@ -661,9 +661,8 @@
 (defn- handle-cue-release-event
   "Process a mouse up after clicking a momentary cue grid cell."
   [page-info kind]
-  (let [[left bottom] (:view page-info)
-        [_ column row id] (clojure.string/split kind #"-")
-        [x y] (map + (map #(Integer/valueOf %) [column row]) [left bottom])
+  (let [[_ column row id] (clojure.string/split kind #"-")
+        [x y] (map #(Integer/valueOf %) [column row])  ; The actual cue coordinates are sent
         id (Integer/valueOf id)
         [cue active] (show/find-cue-grid-active-effect (:show page-info) x y)]
     (swap! clients update-in [(:id page-info)] dissoc :holding)


add all of the possible options for a request

--- src/appengine_magic/services/urlfetch.clj
+++ src/appengine_magic/services/urlfetch.clj
@@ -1,5 +1,11 @@
 (ns appengine-magic.services.urlfetch
-  (:import [com.google.appengine.api.urlfetch URLFetchServiceFactory]))
+  (:import [com.google.appengine.api.urlfetch
+            URLFetchServiceFactory
+            FetchOptions
+            FetchOptions$Builder
+            HTTPRequest
+            HTTPMethod])
+  (:require [clojure.contrib.string :as string]))

 (defonce *urlfetch-service* (atom nil))

@@ -7,9 +13,6 @@
   (do (when (nil? @*urlfetch-service*)
 	(reset! *urlfetch-service* (URLFetchServiceFactory/getURLFetchService)))
       @*urlfetch-service*))
-
-(defn- urlify [url]
-  (if (string? url) (java.net.URL. url) url))

 (defrecord HTTPResponse [content
 			 final-url
@@ -20,6 +23,14 @@
   (zipmap (map #(keyword (.getName %)) headers)
 	  (map #(.getValue %) headers)))

+(defn- make-headers [header-map]
+  (map
+   (fn [[name-key val]]
+     (com.google.appengine.api.urlfetch.HTTPHeader.
+      (string/as-str name-key)
+      val))
+   header-map))
+
 (defn- parse-response
   [^com.google.appengine.api.urlfetch.HTTPResponse r]
   (HTTPResponse. (.getContent r)
@@ -27,11 +38,60 @@
 		 (parse-headers (.getHeaders r))
 		 (.getResponseCode r)))

-(defn fetch [url]
-  (parse-response (.fetch (get-urlfetch-service) (urlify url))))
+(defn make-request
+  [url &
+   {:keys [method headers payload allow-truncate follow-redirects deadline]
+    :or {method :get
+          headers {}
+          payload nil
+          allow-truncate FetchOptions/DEFAULT_ALLOW_TRUNCATE
+          follow-redirects FetchOptions/DEFAULT_FOLLOW_REDIRECTS
+          deadline FetchOptions/DEFAULT_DEADLINE}}]
+  (let [fetch-options (FetchOptions$Builder/withDefaults)]
+    (if allow-truncate
+      (.allowTruncate fetch-options)
+      (.disallowTruncate fetch-options))
+    (if follow-redirects
+      (.followRedirects fetch-options)
+      (.doNotFollowRedirects fetch-options))
+    (.setDeadline fetch-options deadline)
+    (let [url-obj    (if (string? url) (java.net.URL. url) url)
+          method-obj (method {:delete HTTPMethod/DELETE
+                              :get    HTTPMethod/GET
+                              :head   HTTPMethod/HEAD
+                              :post   HTTPMethod/POST
+                              :put    HTTPMethod/PUT})
+          request    (HTTPRequest. url-obj method-obj fetch-options)]
+      (doseq [h (make-headers headers)] (.addHeader request h))
+      (when-not (nil? payload)
+        (.setPayload request payload))
+      request)))

-(defn fetch-async [url]
-  (let [f (.fetchAsync (get-urlfetch-service) (urlify url))]
+(defn fetch
+  "Fetch a URL using AppEngine's URLFetch service.
+
+  url can be either a string or a java.net.URL object.
+
+  Optional parameters:
+    :method           :get (the default), :delete, :head, :post or :put.
+    :headers          A map from :name to string.
+    :payload          Java byte array
+    :allow-truncate   If true, allow appengine to truncate a big response
+                      without error. If false, throw an exception instead.
+    :follow-redirects Self-explanatory boolean.
+    :deadline         Deadline for the request, in seconds.
+
+  Note that :allow-truncate, :follow-redirects and :deadline use the
+  AppEngine defaults, whatever they are."
+
+  [url & opts]
+  (parse-response (.fetch (get-urlfetch-service)
+                          (apply make-request url opts))))
+
+(defn fetch-async
+  "Just like fetch, but returns a future-like object."
+  [url & opts]
+  (let [f (.fetchAsync (get-urlfetch-service) (apply make-request url opts))]
     (reify
      clojure.lang.IDeref
       (deref [_] (parse-response (.get f)))


complete gcc bug patches

complete gcc bug patches

--- src/atom_finder/questions/bug_patches.clj
+++ src/atom_finder/questions/bug_patches.clj
@@ -44,7 +44,7 @@
     ))

 '((-<>>
-   "tmp/bug-lines_gcc_2018-01-04_03.txt_partial"
+   "tmp/bug-lines_gcc_2018-01-04_03.txt"
    read-lines
    (map (fn [commit]
           (merge (dissoc commit :original :changed)
@@ -58,8 +58,6 @@
                              )
                  {:all-changed (->> commit :changed vals (reduce +))}
                  )))
-   ;(take 3)
-   ;(map prn)
-   (maps-to-csv "src/analysis/data/bug-lines_gcc_2018-01-04_03.csv_partial")
+   (maps-to-csv "src/analysis/data/bug-lines_gcc_2018-01-04_03.csv")
    time-mins
    ))


make info from spotify fulltext-searchable

--- src/clj/iwaswhere_web/fulltext_search.clj
+++ src/clj/iwaswhere_web/fulltext_search.clj
@@ -15,7 +15,7 @@
 (defn add-to-index
   "Adds entry to Lucene index. Removes older version of the same entry first."
   [{:keys [msg-payload]}]
-  (let [indexable [:timestamp :md :story-name :saga-name :location]
+  (let [indexable [:timestamp :md :story-name :saga-name :location :spotify]
         entry (select-keys msg-payload indexable)]
     (remove-from-index {:msg-payload entry})
     (clucy/add index entry)))


fix load

fix load

--- src/cljs/just_married/home/countdown.cljs
+++ src/cljs/just_married/home/countdown.cljs
@@ -4,6 +4,8 @@
             [cljs-time.core :as time]
             [cljs-time.format :refer [unparse-duration]]
             [goog.date.duration :as duration]))
+
+(def ^:private reload-time-ms 1000)

 (def fatidic-time
   (time/date-time 2018 05 27 11 30))
@@ -32,9 +34,6 @@
   []
   (time/interval (time/now) fatidic-time))

-(defonce time-left
-  (r/atom (get-time-left)))
-
 (defn extract
   [interval]
   (let [[days hours minutes]
@@ -43,6 +42,9 @@
     {:days days
      :hours hours
      :minutes minutes}))
+
+(defonce time-left
+  (r/atom (extract (get-time-left))))

 (defn reset-left-time
   []
@@ -58,7 +60,7 @@
   []
   (r/with-let [timer-fn
                (js/setInterval
-                #(swap! time-left reset-left-time) 1000)]
+                #(swap! time-left reset-left-time) reload-time-ms)]

     [:div.timer {:class ["col-xs" "row"]}
      [:div (str (or-zero :days) " " (tr :days))]


new warning color! (#1073)

new warning color! (#1073)

Courtesy of Lou, our new visual designer!

--- src/cljs/main/broadfcui/common/style.cljs
+++ src/cljs/main/broadfcui/common/style.cljs
@@ -14,7 +14,7 @@
              :state-exception "#e85c46"
              :state-running "#67688a"
              :state-success "#7aac20"
-             :state-warning "#ebaf3b"
+             :state-warning "#ffa726"
              :tag-background "#d4ecff"
              :tag-foreground "#2c3c4d"
              :text-light "#666"


update interface placeholder token in project.clj

--- resources/project.clj
+++ resources/project.clj
@@ -5,7 +5,7 @@
             :url "http://www.eclipse.org/legal/epl-v10.html"}
   :dependencies [[org.clojure/clojure "1.7.0"]
                  [org.clojure/clojurescript "1.7.145"]
-                 [org.omcljs/om "0.9.0"]
+                 [$REACT_INTERFACE$]
                  [org.omcljs/ambly "0.6.0"]]
 :plugins [[lein-cljsbuild "1.1.0"]]
 :cljsbuild {:builds {:dev {:source-paths ["src"]


Fixed bug where entering the same link twice would create multiple productids.

--- src/hackerati_interval_web_app/schema.clj
+++ src/hackerati_interval_web_app/schema.clj
@@ -46,8 +46,10 @@
   ([userid url]
      (add-link! userid url "Description not provided."))
   ([userid url description]
-     (let [productid ((insert products (values {:url url})) :generated_key)]
-       (insert tracked-links (values {:userid userid :productid productid :description description})))))
+     (if-let [productid (-> products (select (where {:url url})) first :productid)]
+       (insert tracked-links (values {:userid userid :productid productid :description description}))
+       (let [productid ((insert products (values {:url url})) :generated_key)]
+        (insert tracked-links (values {:userid userid :productid productid :description description}))))))

 (defn add-price!
   ([{productid :productid price :price}]


finding paths with similar keys

finding paths with similar keys

--- src/strictly_specking/parse_spec.clj
+++ src/strictly_specking/parse_spec.clj
@@ -1,7 +1,8 @@
 (ns strictly-specking.parse-spec
   (:require
    [clojure.set :as set]
-   [clojure.spec :as s]))
+   [clojure.spec :as s]
+   [strictly-specking.fuzzy :refer [similar-key]]))

   ;; we are dealing with a datatype
   ;; a list of paths Monoid
@@ -234,11 +235,11 @@
    (path-predicate #(= (name (first %)) (name to)))
    (s/describe from)))

-
 ;; this only works for the name part
 (defn find-key-path-like-key [from to]
   (poss-path
-   (path-predicate #(= (name (first %)) (name to)))
+   (path-predicate #(similar-key (keyword (name (first %)))
+                                 to))
    (s/describe from)))

 #_(find-key-path-without-ns :strictly-specking.test-schema/compiler


Display path information in package subcommand output

Signed-off-by: Gregory Haskins <640d9fe47775e6723f0355b7315e38f7d98d3539@gmail.com>

--- src/obcc/dar/write.clj
+++ src/obcc/dar/write.clj
@@ -95,6 +95,7 @@

 (defn write [rootpath filespec outputfile]
   (println "Writing CCA to:" (.getAbsolutePath outputfile))
+  (println "Using path" rootpath (str filespec))
   (let [files (buildfiles rootpath filespec)
         header (fl/protobuf Header :magic "com.obc.deterministic-archive" :version 1)
         entries (buildentries files)


Tidy up docstring formating.

Tidy up docstring formating.

--- src/tabular/grafter/tabular/melt.clj
+++ src/tabular/grafter/tabular/melt.clj
@@ -4,28 +4,46 @@
    [grafter.tabular.common :refer :all]))

 (defn mapcat-rows
-  "Transforms a dataset by performing a mapcat operation on the rows. Each row in the input is transformed to
-  multiple rows in the output by the given transform function.
-  dataset: The dataset to transform.
-  columns: The collection of columns in the output dataset.
-  f: function (Row -> Seqable Row) which transforms each row in the input into a sequence of new rows in the output. Each output row should contain the
-  columns passed in the columns parameter."
+  "Transforms a dataset by performing a mapcat operation on the
+  rows. Each row in the input is transformed to multiple rows in the
+  output by the given transform function.  dataset: The dataset to
+  transform.  columns: The collection of columns in the output
+  dataset.  f: function (Row -> Seqable Row) which transforms each row
+  in the input into a sequence of new rows in the output. Each output
+  row should contain the columns passed in the columns parameter."
   [dataset columns f]
   (-> (make-dataset (mapcat f (:rows dataset)) columns)
       (with-meta (meta dataset))))

 (defn- melt-gen
   "Generalised version of melt.
-  dataset: The dataset to melt.
-  pivot-keys: The collection of fixed columns in the output table.
-  generated-column-names: The collection of new columns in the output table. The output table will have (concat pivot-keys generated-column-names) columns.
-  col-partition-fn: Function to group the non-fixed columns into a number of partitions. A new row will be created for every partition in every row in the input
-  table. For example, if the input table has 4 rows, and col-partition-fn creates 3 groups for the non-fixed columns in the input, then the output table will
-  contain 3 * 4 = 12 rows.
-  row-builder-fn: Function (ColumnPartition -> Row -> RowFragment). This function is used to create the variable fragment of an output row given the source
-  row in the input table and the correspdoning column partition returned from col-partition-fn. The row in the output table is created by merging the variable
-  fragment returned from this function with the fixed part defined by the pivot-keys. The returned fragment should contain values for the column names in the
-  generated-column-names parameter."
+
+  Takes the following arguments:
+
+  - dataset: The dataset to melt.
+
+  - pivot-keys: The collection of fixed columns in the output table.
+
+  - generated-column-names: The collection of new columns in the
+  output table. The output table will have (concat pivot-keys
+  generated-column-names) columns.
+
+  - col-partition-fn: Function to group the non-fixed columns into a
+  number of partitions. A new row will be created for every partition
+  in every row in the input table. For example, if the input table has
+  4 rows, and col-partition-fn creates 3 groups for the non-fixed
+  columns in the input, then the output table will contain 3 * 4 = 12
+  rows.
+
+  - row-builder-fn: Function (ColumnPartition -> Row -> RowFragment).
+  This function is used to create the variable fragment of an output
+  row given the source row in the input table and the correspdoning
+  column partition returned from col-partition-fn. The row in the
+  output table is created by merging the variable fragment returned
+  from this function with the fixed part defined by the
+  pivot-keys. The returned fragment should contain values for the
+  column names in the generated-column-names parameter."
+
   [dataset pivot-keys generated-column-names col-partition-fn row-builder-fn]
   (let [canonicalise-key (partial resolve-column-id dataset)
         pivot-keys (map canonicalise-key (lift->vector pivot-keys))
@@ -41,31 +59,41 @@

 (defn melt
   "Melt an object into a form suitable for easy casting, like a melt function in R.
-  It accepts multiple pivot keys (identifier variables that are reproduced for each
-  row in the output).
+  It accepts multiple pivot keys (identifier variables that are
+  reproduced for each row in the output).
+
   (use '(incanter core charts datasets))
   (view (with-data (melt (get-dataset :flow-meter) :Subject)
   (line-chart :Subject :value :group-by :variable :legend true)))
-  See http://www.statmethods.net/management/reshape.html for more examples."
+
+  See http://www.statmethods.net/management/reshape.html for more
+  examples."
   [dataset pivot-keys]
   (letfn [(col-partition [cols] (map (fn [c] [c]) cols))
           (build-row [[c] row] {:variable c :value (c row)})]
     (melt-gen dataset pivot-keys [:variable :value] col-partition build-row)))

 (defn ^:no-doc melt-column-groups
-  "Melts a dataset into groups defined by the list of given column names. Given a collection of pivot columns and a collection
-  of group column names, this splits each row in the input into a collection of groups and creates a row in the output for each
-  group. The groups are all the length of the column name group and it is an error if the size of the group does not divide the number
-  of non-fixed columns exactly.
+  "Melts a dataset into groups defined by the list of given column
+  names. Given a collection of pivot columns and a collection of group
+  column names, this splits each row in the input into a collection of
+  groups and creates a row in the output for each group. The groups
+  are all the length of the column name group and it is an error if
+  the size of the group does not divide the number of non-fixed
+  columns exactly.

   For example, given an input table:
+
   ----------------------------------------------------------------------------------------------------
   | :measure | :q1-2013 | :q2-2013 | :q3-2013 | :q4-2013 | :q1-2014 | :q2-2014 | :q3-2014 | :q4-2014 |
   |--------------------------------------------------------------------------------------------------|
   | :sales   | 100      | 250      | 200      | 400      | 90       | 200      | 150      | 600      |
   ----------------------------------------------------------------------------------------------------

-  This can be seen as a table with a fixed :measure column and two groups containing four financial quarters. This table can be converted with
+  This can be seen as a table with a fixed :measure column and two
+  groups containing four financial quarters. This table can be
+  converted with
+
   (melt-column-groups [:sales] [:q1 :q2 :q3 :q4])

   into the table:
@@ -76,10 +104,15 @@
   | :sales   | 100    | 250   | 200   | 400   |
   | :sales   | 90     | 200   | 150   | 600   |
   ---------------------------------------------
-
-  dataset: The input dataset to melt.
-  pivot-keys: The fixed group of columns to copy to each output row.
-  output-column-names: Collection of column names that defines the gropus from the input row."
+
+  Takes the arguments:
+
+  - dataset: The input dataset to melt.
+
+  - pivot-keys: The fixed group of columns to copy to each output row.
+
+  - output-column-names: Collection of column names that defines the
+  gropus from the input row."
   [dataset pivot-keys output-column-names]
   (let [output-column-names (lift->vector output-column-names)]
     (letfn [(col-partition [cols]
@@ -91,5 +124,5 @@
               (partition (count output-column-names) cols))
             (build-row [cols row]
               (let [col-map (zipmap cols output-column-names)]
-                (map-keys col-map (select-keys row cols))))]
+                (map-keys col-map (select-keys row cols))))]
       (melt-gen dataset pivot-keys output-column-names col-partition build-row))))


Ensure type annotations exist for generated constraints to avoid reflection.

--- src/main/clojure/clara/rules/compiler.clj
+++ src/main/clojure/clara/rules/compiler.clj
@@ -187,6 +187,13 @@
                              (= \? (first (name item))))]
               (keyword  item))))

+(defn- add-meta
+  "Helper function to add metadata."
+  [fact-symbol fact-type]
+  (if (class? fact-type)
+    (vary-meta fact-symbol assoc :tag (symbol (.getName ^Class fact-type)))
+    fact-symbol))
+
 (defn compile-condition
   "Returns a function definition that can be used in alpha nodes to test the condition."
   [type destructured-fact constraints result-binding env]
@@ -212,11 +219,7 @@
         ;; Initial bindings used in the return of the compiled condition expresion.
         initial-bindings (if result-binding {result-binding '?__fact__}  {})]

-    `(fn [~(if (symbol? type)
-             (with-meta
-               '?__fact__
-               {:tag (symbol (.getName type))})  ; Add type hint to avoid runtime refection.
-             '?__fact__)
+    `(fn [~(add-meta '?__fact__ type)
           ~destructured-env] ;; TODO: add destructured environment parameter...
        (let [~@assignments
              ~'?__bindings__ (atom ~initial-bindings)]


CMR-614: Added tests for searching collection by dif-entry-id.

--- test/cmr/system_int_test/search/collection_identifier_search_test.clj
+++ test/cmr/system_int_test/search/collection_identifier_search_test.clj
@@ -152,12 +152,7 @@

            ;; Ignore case
            [c1-p1 c1-p2] "S1_v1" {:ignore-case true}
-           [] "S1_v1" {:ignore-case false})
-
-      (is (d/refs-match?
-            [c1-p1 c1-p2]
-            (search/find-refs :collection {:dif-entry-id "S1_V1"}))
-          "dif_entry_id should be an alias for entry id"))
+           [] "S1_v1" {:ignore-case false}))

     (testing "Entry title"
       (are [items v options]
@@ -208,7 +203,7 @@
 (deftest processing-level-search-test
   (let [[c1-p1 c2-p1 c3-p1 c4-p1] (for [n (range 1 5)]
                                     (d/ingest "PROV1" (dc/collection {})))
-        ;; include preocessing level id
+        ;; include processing level id
         [c1-p2 c2-p2 c3-p2 c4-p2] (for [n (range 1 5)]
                                     (d/ingest "PROV2" (dc/collection {:processing-level-id (str n "B")})))
         all-prov2-colls [c1-p2 c2-p2 c3-p2 c4-p2]]
@@ -295,4 +290,38 @@
               :errors [(msg/invalid-pattern-opt-setting-msg #{:concept-id :echo-collection-id :echo-granule-id})]}
              (search/find-refs :granule {:concept_id "C*" "options[concept_id]" {:pattern true}}))))))

-
+(deftest dif-entry-id-search-test
+  (let [coll1 (d/ingest "PROV1" (dc/collection {:short-name "S1"
+                                                :version-id "V1"}))
+        coll2 (d/ingest "PROV1" (dc/collection {:entry-id "S2"}) :dif)
+        coll3 (d/ingest "PROV2" (dc/collection {:associated-difs ["S3"]}))
+        coll4 (d/ingest "PROV2" (dc/collection {:associated-difs ["SL4" "DIF-1"]}))
+        coll5 (d/ingest "PROV2" (dc/collection {:entry-id "T2"}) :dif)]
+    (index/refresh-elastic-index)
+    (testing "dif entry id search"
+      (are [items id options]
+           (let [params (merge {:dif-entry-id id}
+                               (when options
+                                 {"options[dif-entry-id]" options}))]
+             (d/refs-match? items (search/find-refs :collection params)))
+
+           [coll1] "S1_V1" {}
+           [coll2] "S2" {}
+           [coll3] "S3" {}
+           [] "S1" {}
+           ;; Multiple values
+           [coll2 coll3] ["S2" "S3"] {}
+           [coll4] ["SL4" "DIF-1"] {}
+           [coll2 coll3] ["S2" "S3"] {:and false}
+           [] ["S2" "S3"] {:and true}
+
+           ;; Wildcards
+           [coll1 coll2 coll3 coll4] "S*" {:pattern true}
+           [] "S*" {:pattern false}
+           [] "S*" {}
+           [coll2 coll3] "S?" {:pattern true}
+           [] "*Q*" {:pattern true}
+
+           ;; Ignore case
+           [coll2] "s2" {:ignore-case true}
+           [] "s2" {:ignore-case false}))))


Add test for begin/end shapes inside with-graphics macro.

--- test/cljx/snippets/shape/vertex.cljx
+++ test/cljx/snippets/shape/vertex.cljx
@@ -46,6 +46,20 @@
       (q/end-shape close-mode)
       (q/end-shape))))

+(defsnippet begin-shape-end-shape-in-graphics {:renderer :p2d}
+  (let [gr (q/create-graphics 400 400 :p2d)]
+    (q/with-graphics gr
+      (q/stroke 255 0 0)
+      (q/begin-shape :triangles)
+      (q/vertex 200 40)
+      (q/vertex 320 120)
+      (q/vertex 320 280)
+      (q/vertex 200 360)
+      (q/vertex 80 280)
+      (q/vertex 80 120)
+      (q/end-shape))
+    (q/image gr 0 0)))
+
 (defsnippet bezier-vertex {:renderer :p3d}
   (q/camera -400 250 -100 500 250 0 0 0 1)
   (q/begin-shape)


Use the test-yml repo, commits from it, and the correct url.

--- test/circle/backend/build/test_config.clj
+++ test/circle/backend/build/test_config.clj
@@ -71,14 +71,14 @@

 (fact "build-from-url works"
   (let [project test/test-project
-        vcs_revision "78f58846a049bb6772dcb298163b52c4657c7d45"
+        vcs_revision "4f679c95a755108a35adc6663c8e54035ce1c66d"
         b (build-from-url (-> project :vcs_url)
                           :vcs-revision vcs_revision
                           :job-name :build)]
     (run/configure b) => anything
     b => ref?
     @b => (contains {:vcs_url string?
-                     :vcs_revision "78f58846a049bb6772dcb298163b52c4657c7d45"
+                     :vcs_revision "4f679c95a755108a35adc6663c8e54035ce1c66d"
                      :vcs-private-key string?
                      :build_num pos?})

@@ -120,10 +120,10 @@
 (fact "build-from-json works"
   (let [build (build-from-json test/circle-dummy-project-json)]
     (ref? build) => true
-    (-> @build :vcs_revision) => "78f58846a049bb6772dcb298163b52c4657c7d45"))
+    (-> @build :vcs_revision) => "4f679c95a755108a35adc6663c8e54035ce1c66d"))

 (fact "build-from-url works for yaml configs"
-  (build-from-url "https://github.com/circleci/circle") => ref?)
+  (build-from-url "https://github.com/circleci/test-yml") => ref?)

 (fact "parse-spec-actions support different kinds of newline"
   (-> :setup ((parse-spec-actions {:setup "1\n2"}))) => (maps-containing {:name "1"} {:name "2"})
@@ -139,7 +139,7 @@
     (-> (build-from-json json) (run/configure) (deref) :job-name) => :build))

 (fact "circle deploys have :lb-name"
-  (-> (circle.backend.build.config/build-from-url "https://github.com/circleci/circle" :job-name :deploy)
+  (-> (circle.backend.build.config/build-from-url "https://github.com/circleci/test-yml" :job-name :deploy)
       (run/configure)
       (deref)
       :lb-name) => truthy)


Revert "Change JVM options. remove MaxPermSize and add +UseStringDeduplication (#763)" (#785)

Our integration test environment is based around mesos docker 1.3, which
ends up running JDK7, which requires the old options.

This reverts commit 46f0867cada4cea32e426bc80035643a226c32a1.

--- scheduler/project.clj
+++ scheduler/project.clj
@@ -207,9 +207,7 @@

   :main cook.components
   :jvm-opts ["-Dpython.cachedir.skip=true"
-             "-XX:+UseG1GC"
-             "-XX:+UseStringDeduplication"
-             "-XX:+PrintStringDeduplicationStatistics"
+             "-XX:MaxPermSize=500M"
              ;"-Dsun.security.jgss.native=true"
              ;"-Dsun.security.jgss.lib=/opt/mitkrb5/lib/libgssapi_krb5.so"
              ;"-Djavax.security.auth.useSubjectCredsOnly=false"


Grid name editor.

Grid name editor.

--- sonic-jam/src/sonic_jam/core.cljs
+++ sonic-jam/src/sonic_jam/core.cljs
@@ -279,6 +279,33 @@
 (def sample-param-editor
   (param-editor-builder "sample-params"))

+(defn text-editor-builder [key]
+  (fn [{:keys [cursor id set-state-ch]} owner]
+    (reify
+      om/IInitState
+      (init-state [_]
+        {:state (if (and (contains? cursor key)
+                         (not (= "" (get cursor key))))
+                  :init :editing)
+         :value (get cursor key)})
+      om/IRenderState
+      (render-state [_ state]
+        (condp = (:state state)
+          :init
+          (dom/span #js {:onClick #(om/update-state! owner (fn [s] (merge s {:state :editing})))
+                         :style #js {:color (:link theme)}}
+                    (get cursor key))
+          :editing
+          (dom/input #js {:type "text" :value (:value state)
+                          :onChange #(handle-change % owner state :value)
+                          :onKeyDown #(when (= 13 (.-which %))
+                                        (om/update-state! owner (fn [s] (merge s {:state :init})))
+                                        (om/transact! cursor (fn [c] (assoc c key (:value state))))
+                                        (go (>! set-state-ch id)))}))))))
+
+(def name-editor
+  (text-editor-builder "name"))
+
 (defn select-editor-builder
   ([key options-ref]
    (let [default-commit-fn (fn [{:keys [cursor id set-state-ch key value]}]
@@ -694,8 +721,10 @@
           :open (dom/table nil
                            (dom/tbody nil
                                       (dom/tr nil
-                                              (dom/td nil (str name " "))
                                               (dom/td nil (closer "{"))
+                                              (dom/td nil " name: ")
+                                              (dom/td nil (om/build name-editor inputs))
+                                              (dom/td nil " ")
                                               (dom/td nil " bpc: ")
                                               (dom/td nil (om/build bpc-editor inputs))
                                               (dom/td nil " ")


don't wait to build menu component

don't wait to build menu component

--- src-cljs/frontend/components/app.cljs
+++ src-cljs/frontend/components/app.cljs
@@ -68,8 +68,7 @@
                                                :camera (:camera app)}
                         {:react-key "signup-animation"}))

-            (when overlay-visible?
-              (om/build overlay/overlay app {:react-key "overlay"}))
+            (om/build overlay/overlay app {:react-key "overlay"})

             [:div.inner (merge {:class (when (empty? (:frontend-id-state app)) "loading")
                                 :key "inner"}


Better map popup layout.

Better map popup layout.

--- src-cljs/kixi/hecuba/widgets/map.cljs
+++ src-cljs/kixi/hecuba/widgets/map.cljs
@@ -34,30 +34,19 @@
         img-url (:uri (first photos))
         entity-url (str "/search#" entity_id)
         tech-icons (apply str (for [i (:technology_icons property_data) :when i]
-                                (str "
"
-                                     "
")))]
+                                (str "")))]
     (str "

" title "

-

-

-

-

-
-                        view
-

-

-                      " full-address "
-

-

-

-                      " tech-icons "
-

-

+

+
" full-address "

+
" tech-icons "

+
+                view

")))


Project selection (didn't work)

Project selection (didn't work)

--- src-cljs/kixi/hecuba/main_om.cljs
+++ src-cljs/kixi/hecuba/main_om.cljs
@@ -46,6 +46,12 @@
           :table {:cols (distinct (mapcat keys rows))
                   :rows rows}}))

+(defn select-project [id]
+  (println "Selecting project!" id)
+  (GET (str "/projects/" id)
+      {:handler (fn [data] (set-table-data! :properties (:children data)))
+       :headers {"Accept" "application/edn"}}))
+
 (defn select-programme [id]
   (GET (str "/programmes/" id)
       {:handler (fn [data]
@@ -57,12 +63,8 @@
                         {:handler (fn [data]
                                     (set-table-data! :properties (:children data))
                                     )
-                         :headers {"Accept" "application/edn"}})
-                    )
-
-                  )
-       :headers {"Accept" "application/edn"}})
-  )
+                         :headers {"Accept" "application/edn"}})))
+       :headers {"Accept" "application/edn"}}))

 (GET "/programmes/" {:handler (handle-get :programmes) :headers {"Accept" "application/edn"}})

@@ -112,7 +114,7 @@
              (om/build table tabdata {:opts (fn [id] (select-programme id))}))
            (dom/h1 nil "Projects")
            (when-let [tabdata (get-in data [:projects :table])]
-             (om/build table tabdata  {:opts (fn [id] nil)}))
+             (om/build table tabdata  {:opts (fn [id] (select-project id))}))
            (dom/h1 nil "Properties")
            (when-let [tabdata (get-in data [:properties :table])]
              (om/build table tabdata  {:opts (fn [id] nil)})))))


Fix shapes loading in load-feed!

Fix shapes loading in load-feed!

--- env/dev/clj/gtfve/datomic.clj
+++ env/dev/clj/gtfve/datomic.clj
@@ -225,5 +225,5 @@
   (load-routes! (str path "routes.txt") conn)
   (load-stops! (str path "stops.txt") conn)
   (load-calendar! (str path "calendar.txt") conn)
-  (load-shapes! (str path "shapes.txt"))
+  (load-shapes! (str path "shapes.txt") conn)
   (load-frequencies! (str path "frequencies.txt") conn))


update boot-cljs

update boot-cljs

--- resources/leiningen/new/tenzing/build.boot
+++ resources/leiningen/new/tenzing/build.boot
@@ -1,7 +1,7 @@
 (set-env!
  :source-paths    {{{source-paths}}}
  :resource-paths  #{"resources"}
- :dependencies '[[adzerk/boot-cljs      "0.0-2411-3" :scope "test"]
+ :dependencies '[[adzerk/boot-cljs      "0.0-2411-5" :scope "test"]
                  [adzerk/boot-cljs-repl "0.1.7"      :scope "test"]
                  [adzerk/boot-reload    "0.2.0"      :scope "test"]{{{deps}}}])


[#526] Make sure new tenants use TLS on db connections

--- backend/src/akvo/lumen/admin/util.clj
+++ backend/src/akvo/lumen/admin/util.clj
@@ -17,5 +17,5 @@
           database (env :pgdatabase)
           user (env :pguser)
           password (env :pgpassword)}}]
-   (format "jdbc:postgresql://%s/%s?user=%s&password=%s&sslmode=require"
+   (format "jdbc:postgresql://%s/%s?user=%s&password=%s&ssl=true"
            host database user password)))


Fix: Cannot import shinken adapter in config

I believe this is why I couldn't import the shinken adapter in my config...

--- src/riemann/config.clj
+++ src/riemann/config.clj
@@ -38,6 +38,7 @@
         [riemann.hipchat :only [hipchat]]
         [riemann.slack :only [slack]]
         [riemann.stackdriver :only [stackdriver]]
+        [riemann.shinken :only [shinken]]
         riemann.streams))

 (def core "The currently running core."


Added incanter to the api module for easy use in the REPL.

--- src/simulacrum/api.clj
+++ src/simulacrum/api.clj
@@ -4,6 +4,7 @@
             [clojure.string :as string]
             [clj-http.client :as client]
             [net.cgrand.enlive-html :as html]
+            [incanter.core :as incanter]
             [simulacrum.bigfive :as bigfive]
             [simulacrum.const :as const]
             [simulacrum.ipip :as ipip]


Fix fixtures.

Fix fixtures.

--- src/uxbox/fixtures.clj
+++ src/uxbox/fixtures.clj
@@ -16,7 +16,6 @@
             [uxbox.persistence :as up]
             [uxbox.migrations]
             [uxbox.util.transit :as t]
-            [uxbox.util.snappy :as snappy]
             [uxbox.services.users :as susers]
             [uxbox.services.projects :as sproj]
             [uxbox.services.pages :as spag])
@@ -40,7 +39,7 @@
                       {:username (str "user" i)
                        :id (mk-uuid "user" i)
                        :fullname (str "User " i)
-                       :metadata {}
+                       :metadata (data-encode {})
                        :password password
                        :email (str "user" i ".test@uxbox.io")}))


CMR-731: Removed erroneous temporal validations.

--- test/cmr/system_int_test/search/granule_periodic_temporal_search_test.clj
+++ test/cmr/system_int_test/search/granule_periodic_temporal_search_test.clj
@@ -135,22 +135,3 @@
            [gran3 gran4 gran5 gran6 gran7 gran8 gran9 gran10 gran16 gran17 gran19]
            "2000-04-03T00:00:00Z" "2002-01-02T00:00:00Z" 93 2))))

-
-;; Just some symbolic invalid temporal testing, more complete test coverage is in unit tests
-(deftest search-temporal-error-scenarios
-  (testing "search with temporal_start_day and no temporal_start is invalid."
-    (try
-      (search/find-refs :granule {"temporal[]" ", , 32"})
-      (catch clojure.lang.ExceptionInfo e
-        (let [status (get-in (ex-data e) [:object :status])
-              body (get-in (ex-data e) [:object :body])]
-          (is (= 400 status))
-          (is (re-find #"temporal_start_day must be accompanied by a temporal_start" body))))))
-  (testing "search with temporal_end_day and no temporal_end is invalid."
-    (try
-      (search/find-refs :granule {"temporal[]" ", , , 32"})
-      (catch clojure.lang.ExceptionInfo e
-        (let [status (get-in (ex-data e) [:object :status])
-              body (get-in (ex-data e) [:object :body])]
-          (is (= 400 status))
-          (is (re-find #"temporal_end_day must be accompanied by a temporal_end" body)))))))


Fix namespace issue

Fix namespace issue

--- src/leiningen/new/lein_quick_om/main.cljs
+++ src/leiningen/new/lein_quick_om/main.cljs
@@ -1,4 +1,4 @@
-(ns {{name}}.core
+(ns {{name}}.main
   (:require-macros [cljs.core.async.macros :refer [go]])
   (:require [om.core :as om]
             [om.dom :as dom]


Changed next event date to 11/4-5

Changed next event date to 11/4-5

Signed-off-by: Tom Marble <b248307e886b80bf9cb4014595572a835b049bf4@info9.net>

--- src/main/cljs/clojurebridgemn/client.cljs
+++ src/main/cljs/clojurebridgemn/client.cljs
@@ -589,7 +589,7 @@
      ;; [:i [:a {:href "https://www.eventbrite.com/e/clojurebridge-mn-fallwinter-2015-tickets-19159690149"} "Sign up now"]]
      ;;  " for our Fall/Winter workshop November 13-14!"
      ;; "Save the date! Our next ClojureBridgeMN workshop is scheduled for 11/13-14"
-     "Stay tuned for our next ClojureBridgeMN workshop (tentatively scheduled for June 25-26)"
+     "Stay tuned for our next ClojureBridgeMN workshop (tentatively scheduled for November 4-5)"
      ]
     }
    :logos
@@ -805,7 +805,7 @@
      ;; "Stay tuned for more information about our upcoming workshop at "
      ;; [:a {:href "http://vidku.com"} "Vidku"]
      ;; " on September 11-12!"
-     "Stay tuned for our next ClojureBridgeMN workshop (tentatively scheduled for June 25-26)"
+     "Stay tuned for our next ClojureBridgeMN workshop (tentatively scheduled for November 4-5)"
      [:br]
      [:br]
      "Want to connect with the local Clojure community?"


?monad? stuff going well, but need to figure out how to apply two monads to the same monad, but only apply this one once ? - so we can split by two dimensions and count/union by one...

--- src/main/clojure/org/dada/demo/whales.clj
+++ src/main/clojure/org/dada/demo/whales.clj
@@ -351,9 +351,6 @@
 ;;        )
 ;;    ))

-;; (import java.util.NavigableSet)
-;; (import java.util.TreeSet)
-
 ;; (def #^NavigableSet pivot-years
 ;;      (TreeSet.
 ;;       (list
@@ -463,9 +460,9 @@
 	       (hook tgt-model tgt-key)
 	       (applicator
 		(fn [src-model src-key]
-		    (println "HERE" src-model src-key)
-		    (connect src-model tgt-model)))
-	       tgt-model))
+		    (println "UNION: " src-key src-model)
+		    (connect src-model tgt-model)
+		    tgt-model))))
 	 ])
       ))

@@ -480,44 +477,97 @@
 	 (fn [hook]
 	     (applicator
 	      (fn [src-model src-key]
-		  (println "COUNT(): " src-model src-key tgt-key)
+		  (println "COUNT: " src-key src-model)
 		  (let [tgt-model (do-reduce-count src-model src-key-type src-key tgt-metadata tgt-key)]
 		    (insert *metamodel* tgt-model)
 		    ;;(connect src-model tgt-model)
 		    (hook tgt-model tgt-key)
-		    tgt-model))))])))
-
-(defn msplit [chain split-key mutable]
-  (fn []
-      (let [[downstream-metadata-accessor applicator] (chain)
-	    [src-metadata src-key] (downstream-metadata-accessor)]
-	[ ;;n get metadata / key
-	 (fn [] [src-metadata split-key])
-	 ;; apply
-	 (fn [hook]
-	     (applicator
-	      (fn [src-model src-key]
-		  (dsplit src-model split-key mutable
-			  (fn [tgt-model tgt-key]
-			      (insert *metamodel* tgt-model)
-			      (hook tgt-model tgt-key)
-			      tgt-model)))))
-	 ])
-      ))
+		    tgt-model)))
+	     )]
+	)))
+
+(defn msplit
+  ([chain split-key mutable]
+   (msplit chain split-key mutable list))
+  ([chain split-key mutable split-fn]
+   (fn []
+       (let [[downstream-metadata-accessor applicator] (chain)
+	     [src-metadata src-key] (downstream-metadata-accessor)]
+	 [ ;;n get metadata / key
+	  (fn [] [src-metadata split-key])
+	  ;; apply
+	  (fn [hook]
+	      (applicator
+	       (fn [src-model src-key]
+		   (println "SPLIT: " src-key src-model)
+		   (dsplit src-model split-key mutable split-fn identity
+			   (fn [tgt-model tgt-key]
+			       (insert *metamodel* tgt-model)
+			       (hook tgt-model tgt-key)
+			       tgt-model))
+		   src-model)))
+	  ])
+       )))

 ;; next step e.g. (select [a <model.field> b <model.field> c <model.field>] from [model....] where [(= a 10)...]....)

 (defn execute [monad]
   ((second (monad)) (fn [model key])))

+;;--------------------------------------------------------------------------------
+
 (def my-whales (mlift whales "my-whales"))

+;; count up whales by type...
 (execute
  (munion
   (mcount
    (msplit my-whales :type false)
    "count()")
-  "Whales.union(count(split(:type)))"))
+  "union(count(split(whales, :type)))")
+ )
+
+;; count up whales by time by type
+(def #^NavigableSet years
+     (TreeSet.
+      (list
+       (Date. 0 0 1)
+       (Date. 1 0 1)
+       (Date. 2 0 1)
+       (Date. 3 0 1)
+       (Date. 4 0 1)
+       (Date. 5 0 1)
+       (Date. 6 0 1)
+       (Date. 7 0 1)
+       (Date. 8 0 1)
+       (Date. 9 0 1))))
+
+(execute
+ ;; (msplit
+ (munion
+  (mcount
+   (msplit my-whales :time false (fn [time] (list (or (.lower years time) time))))
+   "count(split(whales, :time))")
+  "union(count(split(whales, :time)))")
+ ;;  :type
+ ;;  false)
+ )
+
+
+
+;; (execute
+;;  (munion
+;; ;;  (msplit
+;;    (mcount
+;;     (msplit
+;;      my-whales
+;;      :type false)
+;;     "count(split(:time))")
+;; ;;   :time
+;; ;;   false
+;; ;;   (fn [time] (list (or (.lower years time) time))))
+;;   "union(split(count(:type(split(:time)))))")
+;;  )

 ;;--------------------------------------------------------------------------------


fix aside-menu, broken by FF flex bug

fix aside-menu, broken by FF flex bug

--- frontend/components/aside.cljs
+++ frontend/components/aside.cljs
@@ -11,6 +11,7 @@
             [frontend.utils.github :as gh-utils]
             [frontend.utils.vcs-url :as vcs-url]
             [frontend.utils.seq :refer [select-in]]
+            [goog.style]
             [om.core :as om :include-macros true]
             [om.dom :as dom :include-macros true])
   (:require-macros [frontend.utils :refer [html]]))
@@ -131,6 +132,8 @@
 (defn activity [app owner opts]
   (reify
     om/IDisplayName (display-name [_] "Aside Activity")
+    om/IInitState (init-state [_] {:scrollbar-width 0})
+    om/IDidMount (did-mount [_] (om/set-state! owner :scrollbar-width (goog.style/getScrollbarWidth)))
     om/IRender
     (render [_]
       (let [slim-aside? (get-in app state/slim-aside-path)
@@ -142,7 +145,7 @@
          [:nav.aside-left-menu
           (om/build context-menu app)
           [:div.aside-activity.open
-           [:div.wrapper
+           [:div.wrapper {:style {:width (str (+ 210 (om/get-state owner :scrollbar-width)) "px")}}
             [:header
              [:select {:name "toggle-all-branches"
                        :on-change #(put! controls-ch [:show-all-branches-toggled


get rid of ul/li and just use anchors for pills

--- frontend/components/build.cljs
+++ frontend/components/build.cljs
@@ -55,18 +55,18 @@
        (let [container-id (container-model/id container)
              controls-ch (om/get-shared owner [:comms :controls])
              status (container-model/status container build-running?)]
-         [:li {:class (when (= container-id current-container-id) "active")}
-          [:a.container-selector
-           {:on-click #(put! controls-ch [:container-selected {:container-id container-id}])
-            :class (container-model/status->classes status)}
-           (str (:index container))
-           (case status
-             :failed (common/ico :fail-light)
-             :success (common/ico :pass-light)
-             :canceled (common/ico :fail-light)
-             :running (common/ico :logo-light)
-             :waiting (common/ico :none-light)
-             nil)]])))))
+        [:a.container-selector
+         {:on-click #(put! controls-ch [:container-selected {:container-id container-id}])
+          :class (concat (container-model/status->classes status)
+                         (when (= container-id current-container-id) ["active"]))}
+         (str (:index container))
+         (case status
+           :failed (common/ico :fail-light)
+           :success (common/ico :pass-light)
+           :canceled (common/ico :fail-light)
+           :running (common/ico :logo-light)
+           :waiting (common/ico :none-light)
+           nil)])))))

 (defn container-pills [data owner]
   (reify
@@ -80,7 +80,7 @@
                             (empty? (remove :filler-action (mapcat :actions containers))))]
         (html
          [:div.containers (when hide-pills? {:style {:display "none"}})
-          [:ul.container-list
+          [:div.container-list
            (for [container containers]
              (om/build container-pill
                        {:container container


chan type checker

chan type checker

--- src/bitsplit_cli/utils/async.cljs
+++ src/bitsplit_cli/utils/async.cljs
@@ -29,4 +29,9 @@
 (defn empty-chan []
     (let [c (chan)]
         (close! c)
-        c))+        c))
+
+(def chan?
+  (let [ctype (type (chan))]
+    (fn [thing]
+      (= (type thing) ctype))))


CMR-354: Refactored to address pull request comments.

--- src/cmr/search/services/parameters/legacy_parameters.clj
+++ src/cmr/search/services/parameters/legacy_parameters.clj
@@ -21,21 +21,28 @@
    :day-night-flag :day-night
    :browse-only :browsable})

+(def sort-key-replacements
+  "A map of legacy sort keys with all variations of +/- to use for substitutions."
+  (into {} (mapcat (fn [[a orig]]
+                     (let [a (name a)
+                           orig (name orig)]
+                       [[a orig]
+                        [(str "+" a) (str "+" orig)]
+                        [(str "-" a) (str "-" orig)]]))
+                   param-aliases)))
+
+
 (defn merger
   "Make a sequence from supplied values."
   [v1 v2]
   (let [make-seq #(if (sequential? %) % [%])]
     (concat (make-seq v1) (make-seq v2))))

-(defn- replace-lagacy-sort-key
-  "Replace legacy sort key with CMR version."
+(defn- replace-legacy-sort-key
+  "Replace legacy sort key with CMR version. Takes a sort key with +,-, or nothing as a prefix
+  and replaces the appropriate part."
   [sort-key]
-  (reduce (fn [memo, legacy-param]
-            (s/replace memo
-                       (name legacy-param)
-                       (name (legacy-param param-aliases))))
-          sort-key
-          (keys param-aliases)))
+  (get sort-key-replacements sort-key sort-key))

 (defn- replace-legacy-sort-keys
   "Replace legacy sort keys with CMR versions."
@@ -43,8 +50,8 @@
   (if-let [sort-key (:sort-key params)]
     (assoc params :sort-key
            (if (sequential? sort-key)
-             (map replace-lagacy-sort-key sort-key)
-             (replace-lagacy-sort-key sort-key)))
+             (map replace-legacy-sort-key sort-key)
+             (replace-legacy-sort-key sort-key)))
     params))

 (defn replace-parameter-aliases


adding ram and cpu

adding ram and cpu

--- src/kvm/clone.clj
+++ src/kvm/clone.clj
@@ -45,19 +45,35 @@
 (defn clear-all-macs [xml]
   (zip/xml-zip (tree-edit xml interface? clear-mac)))

-;; (def connection (connect "qemu+ssh://ronen@localhost/system"))
+(defn vcpu? [loc]
+   (= :vcpu (:tag (zip/node loc))))
+
+(defn set-cpu [xml cpu]
+  (zip/xml-zip
+    (tree-edit xml vcpu? (fn [node] (assoc node :content (list cpu))))))
+
+(defn ram? [loc]
+  (let [tag (:tag (zip/node loc))]
+    (or (= tag :memory ) (= tag :currentMemory))))
+
+(defn set-ram [xml ram]
+  (zip/xml-zip
+    (tree-edit xml ram? (fn [node] (assoc node :content (list (* ram 1024)))))))

 (defn domain-zip [c id]
   (-> (get-domain c id) xml-desc parse))

-(defn clone-domain [c id name]
+(defn clone-root [root name cpu ram]
+  (-> root
+    (set-name name) clear-uuid clear-all-macs (set-cpu cpu) (set-ram ram)))
+
+; see clone https://github.com/xebialabs/overcast/blob/master/src/main/java/com/xebialabs/overcast/support/libvirt/DomainWrapper.java
+(defn clone-domain [c id {:keys [name cpu ram]}]
   (let [root (domain-zip c id) volumes (clone-disks c name root)
-        cloned-root (-> root (set-name name) clear-uuid clear-all-macs (update-disks volumes))
-        cloned-domain (.domainDefineXML c (xml/emit-str cloned-root))
-        ]
+        target-root (update-disks (clone-root root name cpu ram) volumes)
+        cloned-domain (.domainDefineXML c (xml/emit-str target-root))]
     (.create cloned-domain)))

-;; (clone-domain connection "ubuntu-15.04"  "dar")
-;; (doall (map #(vector (.getID %) (.getName %)) (domain-list connection)))
-; see clone https://github.com/xebialabs/overcast/blob/master/src/main/java/com/xebialabs/overcast/support/libvirt/DomainWrapper.java
+;; (def connection (connect "qemu+ssh://ronen@localhost/system"))
+(clone-domain connection "ubuntu-15.04" {:name "dar" :cpu 2 :ram 2048})


fix first-green-build check

fix first-green-build check

--- frontend/models/build.cljs
+++ frontend/models/build.cljs
@@ -150,7 +150,7 @@

 (defn display-build-invite [build]
-  (:first_green_build build))
+  (:is_first_green_build build))

 (defn config-errors? [build]
   (:circle_yml build))


Fully-qualified Java class belongs in type hint.

--- src/appengine_magic/services/mail.clj
+++ src/appengine_magic/services/mail.clj
@@ -77,7 +77,7 @@
 (defrecord #^{:private true} MessagePart [filename content-type data])

-(defn- deconstruct-message [#^MimeMessage message]
+(defn- deconstruct-message [#^javax.mail.internet.MimeMessage message]
   (let [all-subparts (fn [part]
                        (map #(.getBodyPart part %) (range (.getCount part))))
         subparts (fn subparts [part]


poker.clj cleaned

poker.clj cleaned

--- exercises/poker/src/poker.clj
+++ exercises/poker/src/poker.clj
@@ -1,42 +1,3 @@
-(ns poker
-  (:require [clojure.string :as cs]))
+(ns poker)

-(defn times [x xs]
-  (count (filter #{x} xs)))
-
-(defn rank-hand [hand]
-  (let [h   (cs/split (cs/replace hand #"10" "T") #" ")
-        r   (map #(.indexOf (seq "..23456789TJQKA") (first %)) h)
-        nr  (distinct r)
-        gs  (reverse (sort-by vec (map vector (map #(times % r) nr) nr)))
-        cs  (mapv first gs)
-        rs  (if (= (mapv second gs) [14,5,4,3,2]) [5,4,3,2,1] (mapv second gs))
-        srt (and (= 5 (count cs)) (= 4 (- (apply max cs) (apply min cs))))
-        fsh (= 1 (count (distinct (map last h))))]
-    (cond (= 5 cs)         [9 rs]
-          (and srt fsh)    [8 rs]
-          (= cs [4 1])     [7 rs]
-          (= cs [3 2])     [6 rs]
-          fsh              [5 rs]
-          srt              [4 rs]
-          (= cs [3 1 1])   [3 rs]
-          (= cs [2 2 1])   [2 rs]
-          (= cs [2 1 1 1]) [1 rs]
-          :else            [0 rs])))
-
-(defn greater-than [xs ys]
-  (or (> (first xs) (first ys))
-      (->> (map compare (second xs) (second ys))
-           (take-while (partial not= -1))
-           (some (partial = 1)))))
-
-(defn best-hands [hands]
-  (loop [m [0 []], r [], hs hands]
-    (if (empty? hs)
-      r
-      (let [[x xs] ((juxt first rest) hs)
-            rank   (rank-hand x)]
-        (cond
-          (or (empty? r) (greater-than rank m)) (recur rank [x] xs)
-          (= rank m)                            (recur m (conj r x) xs)
-          :else                                 (recur m r xs))))))
+(defn best-hands [hands])


format date, statusm cleanup

format date, statusm cleanup

--- src/clj/swarmpit/docker/mapper/inbound.clj
+++ src/clj/swarmpit/docker/mapper/inbound.clj
@@ -1,6 +1,13 @@
 (ns swarmpit.docker.mapper.inbound
   "Map docker domain to swarmpit domain"
+  (:import (java.text SimpleDateFormat))
   (:require [clojure.string :as str]))
+
+(def date-format (SimpleDateFormat. "yyyy-MM-dd'T'HH:mm:ss"))
+
+(defn date
+  [date]
+  (str (.parse date-format date)))

 (defn ->node
   [node]
@@ -39,8 +46,8 @@
       :id id
       :taskName task-name
       :version (get-in task [:Version :Index])
-      :createdAt (get task :CreatedAt)
-      :updatedAt (get task :UpdatedAt)
+      :createdAt (date (get task :CreatedAt))
+      :updatedAt (date (get task :UpdatedAt))
       :image image-name
       :imageDigest image-digest
       :state (get-in task [:Status :State])
@@ -79,21 +86,26 @@
                  :value (second variable)})))
        (into [])))

+(defn ->service-replicas-running
+  [service-tasks]
+  (-> (filter #(= (get-in % [:Status :State]) "running") service-tasks)
+      (count)))
+
 (defn ->service-replicas-state
-  [replicas replicas-running service-mode]
+  [service-replicas service-replicas-running service-mode]
   (if (= service-mode "replicated")
-    (str replicas-running " / " replicas)
-    (str replicas-running " / " replicas-running)))
+    (str service-replicas-running " / " service-replicas)
+    (str service-replicas-running " / " service-replicas-running)))

 (defn ->service-state
-  [replicas replicas-running service-mode]
+  [service-replicas service-replicas-running service-mode]
   (case service-mode
-    "replicated" (if (zero? replicas-running)
+    "replicated" (if (zero? service-replicas-running)
                    "not running"
-                   (if (= replicas-running replicas)
+                   (if (= service-replicas-running service-replicas)
                      "running"
                      "partly running"))
-    "global" (if (zero? replicas-running)
+    "global" (if (zero? service-replicas-running)
                "not running"
                "running")))

@@ -102,11 +114,9 @@
   (let [service-mode (str/lower-case (name (first (keys (get-in service [:Spec :Mode])))))
         service-name (get-in service [:Spec :Name])
         service-id (get service :ID)
-        service-tasks (-> (filter #(= (:ServiceID %) service-id) tasks)
-                          (->tasks nodes service-name service-mode))
+        service-tasks (filter #(= (:ServiceID %) service-id) tasks)
         replicas (get-in service [:Spec :Mode :Replicated :Replicas])
-        replicas-running (-> (filter #(= (:state %) "running") service-tasks)
-                             (count))
+        replicas-running (->service-replicas-running service-tasks)
         image (get-in service [:Spec :TaskTemplate :ContainerSpec :Image])
         image-info (str/split image #"@")
         image-name (first image-info)
@@ -114,19 +124,20 @@
     (array-map
       :id service-id
       :version (get-in service [:Version :Index])
-      :createdAt (get service :CreatedAt)
-      :updatedAt (get service :UpdatedAt)
+      :createdAt (date (get service :CreatedAt))
+      :updatedAt (date (get service :UpdatedAt))
       :image image-name
       :imageDigest image-digest
       :serviceName service-name
       :mode service-mode
       :replicas replicas
-      :replicasState (->service-replicas-state replicas replicas-running service-mode)
       :state (->service-state replicas replicas-running service-mode)
+      :status {:info   (->service-replicas-state replicas replicas-running service-mode)
+               :update (some? (get-in service [:UpdateStatus :State]))}
       :ports (->service-ports service)
       :volumes (->service-volumes service)
       :variables (->service-variables service)
-      :tasks service-tasks)))
+      :tasks (->tasks service-tasks nodes service-name service-mode))))

 (defn ->services
   [services tasks nodes]
@@ -140,7 +151,7 @@
     (array-map
       :id (get network :Id)
       :networkName (get network :Name)
-      :created (get network :Created)
+      :created (date (get network :Created))
       :driver (get network :Driver)
       :internal (get network :Internal)
       :subnet (:Subnet config)


Improve error message for invalid concept/role names

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

--- src/conexp/contrib/dl/framework/syntax.clj
+++ src/conexp/contrib/dl/framework/syntax.clj
@@ -217,9 +217,10 @@
 (defnk make-dl
   "Constructs a description logic from the given arguments."
   [name concepts roles constr :extends nil]
-  (when (exists [name (concat concepts roles)]
-          (not (Character/isUpperCase ^Character (first (str name)))))
-    (illegal-argument "Concept and role names must start with a capital letter. (sorry for that)"))
+  (when-let [invalid (first (filter #(not (Character/isUpperCase ^Character (first (str %))))
+                                    (concat concepts roles)))]
+    (illegal-argument "Invalid Concept or Role name \"" invalid "\". "
+                      "Concept and role names must start with a capital letter. (sorry for that)"))

   (when (not (empty? (intersection (set concepts) (set roles))))
     (illegal-argument "Concept and role names must be disjoint."))


replace proxy with reify

replace proxy with reify

--- dada-core/src/main/clojure/org/dada/core.clj
+++ dada-core/src/main/clojure/org/dada/core.clj
@@ -227,13 +227,13 @@

 (defn ^Metadata seq-metadata [length]
   (new MetadataImpl
-       (proxy [Creator] [] (create [args] args))
+       (reify Creator (create [_ args] args))
        [0]
        nil
        [1]
-       (proxy [Metadata$VersionComparator][] (compareTo [[_ v1] [_ v2]] (- v1 v2)))
+       (reify Metadata$VersionComparator (compareTo [_ [_ v1] [_ v2]] (- v1 v2)))
        (map
-	(fn [i] (Attribute. i Object (= i 0) (proxy [Getter] [] (get [s] (nth s i)))))
+	(fn [i] (Attribute. i Object (= i 0) (reify Getter (get [_ s] (nth s i)))))
 	(range length))))

@@ -331,8 +331,8 @@

 (defmacro make-version-comparator [input-type version-keys version-comparator]
   `(let [version-fn# (make-key-fn ~input-type ~version-keys)]
-     (proxy [Metadata$VersionComparator] []
- 	    (compareTo [lhs# rhs#] (~version-comparator (version-fn# lhs#) (version-fn# rhs#))))))
+     (reify Metadata$VersionComparator
+ 	    (compareTo [_ lhs# rhs#] (~version-comparator (version-fn# lhs#) (version-fn# rhs#))))))

 (def prim->ref
      {'int 'Integer
@@ -476,8 +476,8 @@
 			 [:name]	;primary-keys
                          nil            ;primary-getter
 			 []		;version-keys
-			 (proxy [Metadata$VersionComparator][](compareTo [old new] -1)) ;version-comparator
-			 [(Attribute. :name String false (proxy [Getter][] (get [^Model model] (.getName model))))])) ;attributes
+			 (reify Metadata$VersionComparator (compareTo [_ old new] -1)) ;version-comparator
+			 [(Attribute. :name String false (reify Getter (get [_ model] (.getName ^Model model))))])) ;attributes

 ;; TODO: I like the earmuffs on this var, but have no intention of
 ;; rebinding its root at runtime - hence I need the :dynamic hint to


display artist-bg on album-detail page.

display artist-bg on album-detail page.

I know we discussed it, was just playing around and it was pretty easy

--- src/cljs/cljspazzer/client/pages.cljs
+++ src/cljs/cljspazzer/client/pages.cljs
@@ -137,7 +137,8 @@
          (not (nil? active-album))
          [:div.pure-u-1
           [:div.album-detail
-           (album-detail active-artist active-album)]])]])))
+           (album-detail active-artist active-album)]
+          [:div.artist-bg {:style {:background-image artist-image-url}}]])]])))

 (defn delete-mount [mount]
   (fn [e]


Remove dead code

Remove dead code

--- src/cljs/mdr2/productions/repair.cljs
+++ src/cljs/mdr2/productions/repair.cljs
@@ -121,11 +121,6 @@
  (fn [db [_ id]]
    (get-in db [:productions :repair id])))

-(rf/reg-sub
- ::valid?
- (fn [db [_ id]]
-   (validation/library-signature? (get-in db [:productions :repair id :library_signature]))))
-
 (defn buttons [id]
   (let [admin? @(rf/subscribe [::auth/is-admin?])]
     (if @(rf/subscribe [::notifications/button-loading? id :repair])


Add or-nil to arguments ns

Add or-nil to arguments ns

--- src/main/clojure/com/stuartsierra/lazytest/arguments.clj
+++ src/main/clojure/com/stuartsierra/lazytest/arguments.clj
@@ -44,6 +44,11 @@
   [coll]
   (vec (map second (partition 2 coll))))

+(defn or-nil
+  "True if value is nil or (pred value) is true."
+  [pred value]
+  (or (nil? value) (pred value)))
+

 ;;; ASSERTIONS


Updated core.clj

Updated core.clj

--- src-cljs/valent/core.clj
+++ src-cljs/valent/core.clj
@@ -1,6 +1,6 @@
 (ns valent.core)

 (defn foo
-  "I don't do a whole lot."
+  "I don't do a whole lot. But I do it good."
   [x]
   (println x "Hello, World!"))


rm description for now

rm description for now

--- src/tailrecursion/boot/middleware/pom.clj
+++ src/tailrecursion/boot/middleware/pom.clj
@@ -35,7 +35,7 @@

 (defn ^Model build-model [boot pom]
   (let [{:keys [repositories dependencies directories]} boot
-        {:keys [project version description]} pom
+        {:keys [project version]} pom
         [group artifact] (extract-ids project)]
     (doto (Model.)
       (.setGroupId group)


Stop generating random files for IJavaScript Strings

In autobuild scenarios under Node.js the old behavior polluted the
output directory with random files. Instead construct a stable name
from the first 7 letters of the SHA-1 of the string.


Remove kryo from schema.

Remove kryo from schema.

--- src/clj/forma/schema.clj
+++ src/clj/forma/schema.clj
@@ -53,25 +53,7 @@
         :end-idx   end-idx
         :series    (vec series)})))

-(gen-class :name forma.kryo.RecordComparator
-           :prefix "fields-"
-           :methods
-           [^{:static true}
-            [recordCompare [java.util.Map java.util.Map java.util.List] int]])
-
-(defn fields-recordCompare
-  [m1 m2 fn-seq]
-  (loop [[f & more] fn-seq]
-    (let [val (compare (f m1) (f m2))]
-      (if (and more (zero? val))
-        (recur more)
-        val))))
-
-(defrecord TimeSeriesValue [start-idx end-idx series]
-  Comparable
-  (compareTo [m1 m2]
-    (forma.kryo.RecordComparator/recordCompare
-     m1 m2 [:start-idx :end-idx (comp vec :series)])))
+(defrecord TimeSeriesValue [start-idx end-idx series])

 (defn ts-record
   ([start-idx series]
@@ -112,11 +94,7 @@
    :count      "number of fires on the given day."})

 ;; Record to hold a FireValue.
-(defrecord FireValue [temp-330 conf-50 both-preds count]
-  Comparable
-  (compareTo [m1 m2]
-    (forma.kryo.RecordComparator/recordCompare
-     m1 m2 [:temp-330 :conf-50 :both-preds :count])))
+(defrecord FireValue [temp-330 conf-50 both-preds count])

 (defn fire-value
   "Creates a `fire-value` object with counts of fires meeting certain criteria:
@@ -177,11 +155,7 @@
    :t-stat      "t-statistic for the relevant month."})

 (defrecord FormaValue
-    [fire-value short-drop param-break long-drop t-stat]
-  Comparable
-  (compareTo [m1 m2]
-    (forma.kryo.RecordComparator/recordCompare
-     m1 m2 [:t-stat :fire :short :param-break :long])))
+    [fire-value short-drop param-break long-drop t-stat])

 (defn forma-value
   "Returns a vector containing a FireValue, short-term drop,
@@ -196,13 +170,7 @@
 (defrecord NeighborValue
     [fire-value neighbor-count avg-short-drop min-short-drop
      avg-param-break min-param-break avg-long-drop min-long-drop
-     avg-t-stat min-t-stat]
-  Comparable
-  (compareTo [m1 m2]
-    (forma.kryo.RecordComparator/recordCompare
-     m1 m2 [:neighbor-count :fire-value :avg-short-drop :min-short-drop
-            :avg-param-break :min-param-break :avg-long-drop :min-long-drop
-            :avg-t-stat :min-t-stat])))
+     avg-t-stat min-t-stat])

 (defn neighbor-value
   "Accepts either a forma value or a sequence of sub-values."


CMR-183: Renamed function to use -> convention and replace doall + map with doseq.

--- src/cmr/common/cache.clj
+++ src/cmr/common/cache.clj
@@ -8,7 +8,7 @@
   "The key used to store the general cache in the system cache map."
   :general)

-(defn cache-from-context
+(defn context->cache
   "Get the cache for the given key from the context"
   [context cache-key]
   (get-in context [:system :caches cache-key]))
@@ -65,13 +65,13 @@
 (defn reset-caches
   "Clear all caches."
   [context]
-  (doall (map (fn [[k v]]
-                (debug "Clearing cache " k)
-                (reset-cache v))
-              (get-in context [:system :caches]))))
+  (doseq [[k v] (get-in context [:system :caches])]
+    (fn [[k v]]
+      (debug "Clearing cache " k)
+      (reset-cache v))))

 (defn update-cache
-  "Update the cache contents with the output of the given funciton, f. f takes the
+  "Update the cache contents with the output of the given function, f. f takes the
   current cache as its input and returns the new cache."
   [cmr-cache f]
   (swap! (:atom cmr-cache) f)


Refactor arg list and remove (declare ...)

--- src/com/puppetlabs/puppetdb/query.clj
+++ src/com/puppetlabs/puppetdb/query.clj
@@ -74,7 +74,18 @@
         [com.puppetlabs.jdbc :only [valid-jdbc-query?]]
         [clojure.core.match :only [match]]))

-(declare compile-term)
+(defn compile-term
+  "Compile a single query term, using `ops` as the set of legal operators. This
+  function basically just checks that the operator is known, and then
+  dispatches to the function implementing it."
+  [ops [op & args :as term]]
+  (when-not (sequential? term)
+    (throw (IllegalArgumentException. (format "%s is not well-formed: queries must be an array" term))))
+  (when-not op
+    (throw (IllegalArgumentException. (format "%s is not well-formed: queries must contain at least one operator" term))))
+  (if-let [f (ops op)]
+    (apply f args)
+    (throw (IllegalArgumentException. (format "%s is not well-formed: query operator %s is unknown" term op)))))

 (defn compile-boolean-operator*
   "Compile a term for the boolean operator `op` (AND or OR) applied to
@@ -126,11 +137,11 @@
   "Compile a v2 NOT operator, applied to `term`. This term simply negates the
   value of `term`. Basically this function just serves as error checking for
   `negate-term*`."
-  [ops & [term & _ :as args]]
+  [ops & terms]
   {:post [(string? (:where %))]}
-  (when-not (= (count args) 1)
-    (throw (IllegalArgumentException. (format "'not' takes exactly one argument, but %d were supplied" (count args)))))
-  (negate-term* ops term))
+  (when-not (= (count terms) 1)
+    (throw (IllegalArgumentException. (format "'not' takes exactly one argument, but %d were supplied" (count terms)))))
+  (negate-term* ops (first terms)))

 (def fact-columns #{"certname" "name" "value"})

@@ -433,16 +444,3 @@
       ;; select-resources uses a different set of operators-v2, of course
       (= op "select-resources") (partial resource-query->sql resource-operators-v2)
       (= op "select-facts") (partial fact-query->sql fact-operators-v2))))
-
-(defn compile-term
-  "Compile a single query term, using `ops` as the set of legal operators. This
-  function basically just checks that the operator is known, and then
-  dispatches to the function implementing it."
-  [ops [op & args :as term]]
-  (when-not (sequential? term)
-    (throw (IllegalArgumentException. (format "%s is not well-formed: queries must be an array" term))))
-  (when-not op
-    (throw (IllegalArgumentException. (format "%s is not well-formed: queries must contain at least one operator" term))))
-  (if-let [f (ops op)]
-    (apply f args)
-    (throw (IllegalArgumentException. (format "%s is not well-formed: query operator %s is unknown" term op)))))


Change route for "join" page

Change route for "join" page

--- src/braid/core/client/routes.cljs
+++ src/braid/core/client/routes.cljs
@@ -44,6 +44,10 @@
   (dispatch [:set-page-loading true])
   (dispatch [:search-history [query (uuid group-id)]]))

+(defroute join-group-path "/groups/:group-id/join" [group-id]
+  (dispatch [:braid.core.client.gateway.events/initialize :join-group])
+  (dispatch [:set-group-and-page [nil {:type :login}]]))
+
 (defroute page-path "/groups/:group-id/:page-id" [group-id page-id]
   (dispatch [:set-group-and-page [(uuid group-id) {:type (keyword page-id)}]]))

@@ -52,7 +56,3 @@

 (defroute index-path "/" {}
   (dispatch [:redirect-from-root]))
-
-(defroute join-group-path "/join/:group-id" [group-id]
-  (dispatch [:braid.core.client.gateway.events/initialize :join-group])
-  (dispatch [:set-group-and-page [nil {:type :login}]]))


insert row trigger made

insert row trigger made

The insert row trigger logs when a new row is added to a realtime table

--- src/webapp/framework/server/systemfns.clj
+++ src/webapp/framework/server/systemfns.clj
@@ -542,10 +542,50 @@

+
+
+
+(defn make-log-table-trigger-function []
+    (let [coils-trigger-fn-exists-result      (korma.core/exec-raw
+                                                  ["select exists(select * from pg_proc where proname = 'trigger_function_afterinsert');" []]
+                                                  :results)
+
+          coils-trigger-fn-exists   (= "t"  coils-trigger-fn-exists-result)
+
+          sql-to-create-trigger-fn "
+CREATE OR REPLACE FUNCTION trigger_function_afterInsert()\n
+      RETURNS trigger AS
+$BODY$
+      BEGIN
+           INSERT INTO coils_realtime_log
+                 (record_timestamp,  record_table_name,  record_id,  record_operation,  record_status)
+           VALUES
+                 ( now(),   TG_TABLE_NAME ,  NEW.id,  'INSERT',  'WAITING');
+           RETURN NULL;
+      END;
+$BODY$
+LANGUAGE plpgsql;
+"
+          ]
+
+        (println "Coils trigger function exists: " coils-trigger-fn-exists)
+        (if (not coils-trigger-fn-exists )
+            (korma.core/exec-raw   [sql-to-create-trigger-fn []]   [])
+            nil
+            )
+        )
+    )
+
+
+
+
+
+
 (defn do-real [& {:keys [:table-name]}]
   (println "table name: " table-name)
   (make-admin-table )
   (make-log-table   )
+  ( make-log-table-trigger-function)
   (create-realtime-trigger  :table-name  table-name)
 )


Update copyright for new calendar year

Update copyright for new calendar year

--- src/clj/chili_dog_night/views.clj
+++ src/clj/chili_dog_night/views.clj
@@ -39,7 +39,7 @@

 (defn footer []
   [:footer.ph3.ph5-ns{:role "contentinfo"}
-   [:p "© 2016 Chili Dog Night Productions"]])
+   [:p "© 2016,2017 Chili Dog Night Productions"]])

 (defn common [title head body]
   (h/html5 {:lang "en"}


Event registration

Event registration

--- src/cljs/elevent_client/core.cljs
+++ src/cljs/elevent_client/core.cljs
@@ -481,10 +481,11 @@
                               @events-db
                               @attendees-db
                               (get-in @session [:user :UserId]))
-        unattending-events (difference (d/q '[:find [?event-id ...]
-                                              :where [?event-id]]
-                                            @events-db)
-                                       attending-events)]
+        unattending-events (difference (into #{}
+                                             (d/q '[:find [?event-id ...]
+                                                    :where [?event-id]]
+                                                  @events-db))
+                                       (into #{} attending-events))]
     [:div.sixteen.wide.column
      [:div.ui.segment
       [:div
@@ -611,6 +612,64 @@
              {:type :submit :on-click #(create-event @form)}
              "Add"]]]]]))))

+(defn event-register-page [event-id]
+  (let [form (atom {:Email (get-in @session [:user :Email])
+                    :FirstName (get-in @session [:user :FirstName])
+                    :LastName (get-in @session [:user :LastName])})
+        validator (validation-set (presence-of :Email)
+                                  (presence-of :FirstName)
+                                  (presence-of :LastName)
+                                  (format-of :Email :format #"@"))
+        event (d/entity @events-db event-id)]
+    (fn []
+      (let [{:keys [Email FirstName LastName]}
+            @form
+
+            errors
+            (validator @form)
+
+            register
+            (fn [form]
+              (attendees-endpoint :create
+                                  {:UserId (get-in @session [:user :UserId])
+                                   :EventId event-id}
+                                  #(js/location.replace (events-route))))]
+        [:div.ui.stackable.page.grid
+         [:div.sixteen.wide.column
+          [:div.ui.segment
+           [:div.ui.vertical.segment
+            [:h2.ui.dividing.header
+             (str "Register for " (:Name event))]
+            [:div.meta
+             [:strong "Date:"]
+             (let [start (from-string (:StartDate event))
+                   end   (from-string (:EndDate   event))]
+               (str " " (unparse datetime-formatter start)
+                    (when (after? end start)
+                      (str " to " (unparse datetime-formatter end)))))]
+            [:div.meta
+             [:strong "Venue:"]
+             " "
+             (:Venue event)]
+            [:div.description
+             (:Description event)]]
+           [:div.ui.vertical.segment
+            [:form.ui.form
+             [:div.one.field
+              [:div.required.field
+               [:label "Email"]
+               [input-atom :text (r/wrap Email swap! form assoc :Email)]]]
+             [:div.two.fields
+              [:div.required.field
+               [:label "First Name"]
+               [input-atom :text (r/wrap FirstName swap! form assoc :FirstName)]]
+              [:div.required.field
+               [:label "Last Name"]
+               [input-atom :text (r/wrap LastName swap! form assoc :LastName)]]]]
+            [:button.ui.primary.button
+             {:type :submit :on-click #(register @form)}
+             "Register"]]]]]))))
+
 (defn sign-in-page []
   (let [form (atom {})
         validator (validation-set (format-of :email :format #"@")