Worked on pprint a bit and added a hyperlink handler.

--- src/cassidy/shon.clj
+++ src/cassidy/shon.clj
@@ -81,6 +81,9 @@
     (-write-str (seq x))
     (throw (Exception. (str "Don't know how to write SHON of " (class x))))))

+(defn- write-hyperlink [x]
+  (html [:a {:href (str x)} (str x)]))
+
 (defn write-shon-specified [x]
   (let [{:keys [tag attrs value]} x
         v [tag]
@@ -117,6 +120,9 @@
 (extend java.util.Map          SHONWriter {:-write-str write-dl})
 (extend java.util.Collection   SHONWriter {:-write-str write-ul})

+;; html things
+(extend java.net.URL           SHONWriter {:-write-str write-hyperlink})
+(extend java.net.URI           SHONWriter {:-write-str write-hyperlink})
 (extend java.lang.Object       SHONWriter {:-write-str write-generic})

 (defn write-str [x & options]
@@ -127,6 +133,14 @@
               *value-fn* value-fn]
       (-write-str x))))

-(defn pprint [x]
-  (let [transform-fn (compile-xslt (io/resource "Identity.xslt"))]
-    (println (str (transform-fn (compile-xml x))))))
+(defn pprint
+  "Pretty prints an object as a SHON string."
+  [x & options]
+  (let [{:keys [key-fn value-fn]
+         :or {key-fn default-write-key-fn
+              value-fn default-value-fn}} options
+              transform-fn (compile-xslt (io/resource "Identity.xslt"))]
+    (if-let [xml (try (compile-xml (write-str x :key-fn key-fn :value-fn value-fn))
+                      (catch Exception e nil))]
+      (println (str (transform-fn xml)))
+      (clojure.pprint/pprint x))))


delaney.clj: wrote a native (dual) function

--- clojure/org/gavrog/clojure/delaney.clj
+++ clojure/org/gavrog/clojure/delaney.clj
@@ -336,6 +336,14 @@
         (if-let [b (v ds i (inc i) D)] (aset-int vs i D b))))
     (org.gavrog.joss.dsyms.basic.DSymbol. ops vs)))

+;; === Functions that build specific DSymbol instances
+
+(defn dual [ds]
+  (let [ds (dsymbol ds)]
+    (DSymbol. (dim ds)
+              (size ds)
+              (into {} (for [[i s] (.s# ds)] [(- (dim ds) i) s]))
+              (into {} (for [[i v] (.v# ds)] [(- (dim ds) 1 i) v])))))

 ;; === Wrapped Java methods

@@ -348,9 +356,6 @@

 (defn minimal [ds]
   (-> ds java-dsymbol .minimal dsymbol))
-
-(defn dual [ds]
-  (-> ds java-dsymbol .dual dsymbol))

 (defn invariant [ds]
   (into [] (.invariant (java-dsymbol ds))))


made so the exact line is clear

made so the exact line is clear

--- src/cgws/notcore.clj
+++ src/cgws/notcore.clj
@@ -240,12 +240,18 @@
           ; the flat file which is supposed to be a symlink to the location which is specified inside its contents
           rel_symlink (get_all_symlinks_from_repo repo-path branch)
           ;_ (println (str (.toString (.getAbsolutePath repo-path)) *separator* rel_symlink));repo-path rel_symlink)
-          x (println "a");XXX: wtf, if I comment out this line, it throws?
+          ;x (println "a")
+          ;_ (println repo-path);XXX: wtf, if I comment out this line, it throws below?!
           ;^{:tag java.io.File}
           ^java.io.File abs_symlink
             (q/newClass fileClass
             ;(new java.io.File
-              (str (.toString (.getAbsolutePath repo-path)) *separator* rel_symlink)
+              (str
+                (.toString
+                  (.getAbsolutePath repo-path);IllegalArgumentException Don't know how to create ISeq from: java.io.File
+                  )
+                *separator*
+                rel_symlink)
             )
           ]
     (cond (.isFile abs_symlink);when core.symlinks=false  all symlinks are just files after checkout


update doc string and comments

update doc string and comments

--- src/client/core.cljs
+++ src/client/core.cljs
@@ -302,6 +302,7 @@
     (swap! state assoc :board new-board)))

 (defn go-go-collapse!
+  "Starts the collapse animation if we need to, returning nil or the animation channel."
   []
   (let [board (:board @state)
         rows (get-filled-row-indices board)]
@@ -312,10 +313,10 @@
         ; blink n times
         (doseq [i (range 3)]

-          (<! (timeout 100))                      ; resume here in 0.5 seconds
+          (<! (timeout 100))                      ; resume here later
           (swap! state assoc :flashing-rows rows) ; flash rows

-          (<! (timeout 100))                      ; resume here in 0.5 seconds
+          (<! (timeout 100))                      ; resume here later
           (swap! state update-in
                  [:flashing-rows] empty))         ; unflash rows

@@ -330,6 +331,9 @@
         piece (:piece @state)
         board (:board @state)]
     (swap! state assoc :board (write-piece-to-board piece x y board))
+
+    ; If collapse routine returns a channel...
+    ; then wait for it before spawning a new piece.
     (if-let [collapse-anim (go-go-collapse!)]
       (go (<! collapse-anim) (spawn-piece!))
       (spawn-piece!))))


:bug: Fixes dashboard file search

:bug: Fixes dashboard file search

--- backend/src/app/services/queries/files.clj
+++ backend/src/app/services/queries/files.clj
@@ -64,19 +64,12 @@
       where p.team_id = uuid_nil()
         and p.deleted_at is null
    )
-   select distinct
-          file.*,
-          array_agg(page.id) over pages_w as pages,
-          first_value(page.data) over pages_w as data
-     from file
-    inner join projects as pr on (file.project_id = pr.id)
-     left join page on (file.id = page.file_id)
-    where file.name ilike ('%' || ? || '%')
-      and file.deleted_at is null
-   window pages_w as (partition by file.id order by page.created_at
-                      range between unbounded preceding
-                                and unbounded following)
-    order by file.created_at asc")
+   select distinct f.*
+     from file as f
+    inner join projects as pr on (f.project_id = pr.id)
+    where f.name ilike ('%' || ? || '%')
+      and f.deleted_at is null
+    order by f.created_at asc")

 (s/def ::search-files
   (s/keys :req-un [::profile-id ::team-id ::search-term]))


Add date pickers.

Add date pickers.

--- src-cljs/kixi/hecuba/chart.cljs
+++ src-cljs/kixi/hecuba/chart.cljs
@@ -21,71 +21,53 @@
     (doall result-seq)))

-;;;;;;;;;;; Data ;;;;;;;;;;;
-
-(def mock-data {"01"
-                [{"device_id" "01" "device_name" "External temperature" "month" "01/01/2011" "reading" 0.8}
-                 {"device_id" "01" "device_name" "External temperature" "month" "01/02/2011" "reading" 0.9}
-                 {"device_id" "01" "device_name" "External temperature" "month" "01/03/2011" "reading" 0.8}
-                 {"device_id" "01" "device_name" "External temperature" "month" "01/04/2011" "reading" 0.75}
-                 {"device_id" "01" "device_name" "External temperature" "month" "01/05/2011" "reading" 0.65}
-                 {"device_id" "01" "device_name" "External temperature" "month" "01/06/2011" "reading" 0.50}
-                 {"device_id" "01" "device_name" "External temperature" "month" "01/07/2011" "reading" 0.55}
-                 {"device_id" "01" "device_name" "External temperature" "month" "01/08/2011" "reading" 0.6}
-                 {"device_id" "01" "device_name" "External temperature" "month" "01/09/2011" "reading" 0.66}
-                 {"device_id" "01" "device_name" "External temperature" "month" "01/10/2011" "reading" 0.68}
-                 {"device_id" "01" "device_name" "External temperature" "month" "01/11/2011" "reading" 0.71}
-                 {"device_id" "01" "device_name" "External temperature" "month" "01/12/2011" "reading" 0.9}]
-                "02"
-                [{"device_id" "02" "device_name" "External humidity" "month" "01/01/2011" "reading" 6}
-                 {"device_id" "02" "device_name" "External humidity" "month" "01/02/2011" "reading" 10}
-                 {"device_id" "02" "device_name" "External humidity" "month" "01/03/2011" "reading" 12}
-                 {"device_id" "02" "device_name" "External humidity" "month" "01/04/2011" "reading" 15}
-                 {"device_id" "02" "device_name" "External humidity" "month" "01/05/2011" "reading" 18}
-                 {"device_id" "02" "device_name" "External humidity" "month" "01/06/2011" "reading" 20}
-                 {"device_id" "02" "device_name" "External humidity" "month" "01/07/2011" "reading" 25}
-                 {"device_id" "02" "device_name" "External humidity" "month" "01/08/2011" "reading" 31}
-                 {"device_id" "02" "device_name" "External humidity" "month" "01/09/2011" "reading" 20}
-                 {"device_id" "02" "device_name" "External humidity" "month" "01/10/2011" "reading" 17}
-                 {"device_id" "02" "device_name" "External humidity" "month" "01/11/2011" "reading" 12}
-                 {"device_id" "02" "device_name" "External humidity" "month" "01/12/2011" "reading" 9}]})
-
 ;;;;;;;;; Utils ;;;;;;;;;;;;;;;;;;;;;;

 (def truthy? (complement #{"false"}))

-;;;;;;;;;;; Component 1:  Form containing list of devices for both axis plots ;;;;;;;;;;
+(defn url [entity-id device-id start-date end-date]
+  (str "/3/entities/" entity-id "/devices/" device-id "/measurements?startDate=" start-date "&endDate" end-date) )

-#_(defn device-form
+;;;;; Date picker component ;;;;;;;
+
+(defn date-picker
   [cursor owner]
   (reify
     om/IRenderState
-    (render-state [_ {:keys [clicked]}]
-      (dom/table #js {:id "form-table" :cellSpacing "10"}
-           (let [cols {:left "Left axis plots" :right "Right axis plots"}]
-             (dom/tr nil
-                  (into-array
-                   (for [col cols]
-                     (dom/td nil
-                          (dom/h4 nil (val col))
-                          #_(dom/form nil
-                               (into-array
-                                (for [device cursor]
-                                  (let [id (str (:hecuba/name device))
-                                        name (str (:name device))
-                                        axis (first col)]
-                                    (dom/div nil
-                                         (dom/input #js
-                                              {:type "checkbox"
-                                               :onChange
-                                               (fn [e]
-                                                 (let [checked (= (.. e -target -checked) true)]
-                                                   (put! clicked
-                                                         {:id id
-                                                          :axis axis
-                                                          :checked checked})))})
-                                         (dom/label nil name)
-                                         (dom/br #js {})))))))))))))))
+    (render-state [_ {:keys [selected]}]
+      (dom/table #js {:id "date-table"}
+                 (dom/tr nil
+                         (dom/td nil
+                                 (dom/h4 nil "Start date")
+                                 (dom/input #js
+                                            {:type "text"
+                                             :id "dateFrom"
+                                             :ref "dateFrom"}))
+                         (dom/td nil
+                                 (dom/h4 nil "End date")
+                                 (dom/input #js
+                                            {:type "text"
+                                             :id "dateTo"
+                                             :ref "dateTo"}))
+                         (dom/td nil
+                                 (dom/h4 nil)
+                                 (dom/button #js {:type "button"
+                                                  :onClick (fn [e]
+                                                             (let [start (-> (om/get-node owner "dateFrom")
+                                                                             .-value)
+                                                                   end   (-> (om/get-node owner "dateTo")
+                                                                             .-value)]
+                                                               ;; TODO this doesn't work. Can't read cursor here.
+                                                               ;; Can't read cursor in will-mount of chart-item either.
+                                                               ;; the only place where cursor can be read is render.
+                                                               ;; but this causes infinite loop because getting measurements updates
+                                                               ;; the state and triggers re-render.
+                                                               (put! selected {:entity-id (get-in cursor [:entity-id])
+                                                                               :sensor (get-in cursor [:sensor])
+                                                                               :start-date start :end-date end})
+                                                               ))}
+                                             "Select dates")))))))
+

 ;;;;;;;;;;;;; Component 2: Chart ;;;;;;;;;;;;;;;;

@@ -94,51 +76,43 @@
   (reify
     om/IWillMount
     (will-mount [_]
-      (let [clicked-items (om/get-state owner [:clicked])]
+      (let [clicked-items (om/get-state owner [:selected])]
         (go (while true
-              (let [sel (<! clicked-items)
-                    checked         (str (get sel :checked))
-                    axis            (get sel :axis)
-                    id              (str (get sel :id))]
-                (println "Consumed axis: " (str axis)
-                         ". Id " (str id)
-                         ". Checked: " (str checked))
-                (om/set-state! owner [:selected axis id] (truthy? checked)))))
-
-        ))
-
+              (let [sel        (<! clicked-items)
+                    start-date (get sel :start-date)
+                    end-date   (get sel :end-date)
+                    entity-id  (get sel :entity-id)
+                    device-id  (get-in sel [:sensor :deviceId])
+                    url        (url entity-id device-id start-date end-date)
+                    ]
+                 (GET url {:handler #(om/transact! cursor [:measurements] (constantly %))
+                                   :headers {"Accept" "application/json"}
+                                   :response-format :json
+                                   :keywords? true})
+                )))))
     om/IRender
-    (render [_]
-      (dom/div nil
-               #_(dom/h2 nil "Units")
-               #_(apply dom/div nil
-                      (for [sensor (get-in cursor [:sensors])]
-                        (apply dom/div nil
-                                 (dom/h3 nil (:type sensor))
-                                 (for [m (filter #(= (:type %) (:type sensor))
-                                                 (get-in cursor [:measurements]))]
-                                   (dom/p nil (str (:timestamp m) " - "(:value m)))
-                                   )
-                                 )))
-               (dom/div #js {:id "chart" :width 500 :height 550})))
-
+    (render [_]
+      (prn "[I render]")
+       (dom/div nil
+                 (dom/div #js {:id "chart" :width 500 :height 550})))
     om/IDidUpdate
     (did-update [this prev-props prev-state root-node]
       (let [n (.getElementById js/document "chart")]
         (while (.hasChildNodes n)
           (.removeChild n (.-lastChild n))))
-      (let [Chart (.-chart dimple)
-            svg (.newSvg dimple "#chart" 500 500)
-            #_left-keys #_(map first (filter second (om/get-state owner [:selected :left])))
-            sensor-type (:type (first (get-in cursor [:sensors])))
-            data (filter #(= (:type %) sensor-type) (get-in cursor [:measurements]))
+      (prn "[I did update]")
+      (let [Chart      (.-chart dimple)
+            svg        (.newSvg dimple "#chart" 500 500)
+            type       (get-in cursor [:sensor :type])
+            data       (get-in cursor [:measurements])
             dimple-chart (.setBounds (Chart. svg) 60 30 350 350)
             x (.addCategoryAxis dimple-chart "x" "timestamp")
             y (.addMeasureAxis dimple-chart "y" "value")
-            s (.addSeries dimple-chart (name sensor-type) js/dimple.plot.line (clj->js [x y]))]
-          (aset s "data" (clj->js data))
-          (.addLegend dimple-chart 60 10 300 20 "right")
-          (.draw dimple-chart)))))
+            s (if (not (empty? data )) (.addSeries dimple-chart (name type) js/dimple.plot.line (clj->js [x y])))]
+        (.log js/console data)
+        (if (not (nil? s)) (aset s "data" (clj->js data)))
+        (.addLegend dimple-chart 60 10 300 20 "right")
+        (.draw dimple-chart)))))

 ;;;;;;;;;;; Bootstrap ;;;;;;;;;;;;

@@ -146,16 +120,14 @@
   (reify
     om/IInitState
     (init-state [_]
-      {:chans {:clicked (chan (sliding-buffer 1))}})
+      {:chans {:selected (chan (sliding-buffer 1))}})
     om/IRenderState
     (render-state [_ {:keys [chans]}]
       (dom/div nil
            (dom/h3 #js {:key "head"} (str "Metering data - " (get-in cursor [:property])))
            (dom/p nil "Note: When you select something to plot on a given axis, you will only be able to plot other items of the same unit on that axis.")
-           ;; Builds chart component
+           (om/build date-picker cursor {:key :hecuba/name :init-state chans})
            (om/build chart-item cursor {:key :hecuba/name :init-state chans})
-           ;; Builds table containing form components for left and right axis
-           (println "Devices is" (:devices cursor))
-           #_(dom/div #js {:id "device-form"}
-                (om/build device-form (:devices cursor)
-                    {:key :hecuba/name :init-state chans}))))))
+          ))))
+
+


Fix tag filtering

Fix tag filtering

--- src/datemo/routes.clj
+++ src/datemo/routes.clj
@@ -39,11 +39,16 @@
       (:db/ident)
       (name)))

-(defn get-tags [metadata]
-  (def tags (get-in-metadata :metadata/tags metadata))
-  (if (or (nil? tags) (is-empty-metadata (first tags)))
-    []
-    (mapv #(name (:tag/name %)) tags)))
+(defn get-tags
+  ([metadata] (get-tags metadata true))
+  ([metadata return-strings?]
+    (def tags (get-in-metadata :metadata/tags metadata))
+    (if (or (nil? tags) (is-empty-metadata (first tags)))
+      []
+      (mapv #(if return-strings?
+               (name (:tag/name %))
+               (:tag/name %))
+            tags))))

 (defn gen-tags-meta [tags]
   (if (empty? tags)
@@ -131,8 +136,8 @@
 (defn filter-by-tags [res tags]
   (filterv
     (fn [r]
-      (let [metadata (-> (first r) (:arb/metadata) (first))
-            tagset (mapv #(:tag/name %) (:metadata/tags metadata))
+      (let [metadata (as-> (first r) x (:arb/metadata x) )
+            tagset (get-tags metadata false)
             tags-to-find (mapv #(keyword %) (if (vector? tags) tags [tags]))
             matched (filterv #(>= (.indexOf tagset %) 0) tags-to-find)]
         (> (count matched) 0)))


Fix broken app.

Fix broken app.

--- src/decl_ui/core.cljs
+++ src/decl_ui/core.cljs
@@ -29,7 +29,7 @@

   (load-ui {:title (atom "This is title") :results (atom ["result1" "result2"])} "{:text \"Click me\"
            :pressed 0
-           :query-result #react (ui/query)
+           :query-result #= (ui/query)
            :x #bind :title}"
            "[:div [:button#click {:on-click ui/handle-click} #bind :text]
               [:div \"Change text\"]


Rename fn

Rename fn

--- src/discuss/find.cljs
+++ src/discuss/find.cljs
@@ -15,7 +15,7 @@
 (defn statement-handler
   "Called when received a response in the search."
   [response]
-  (let [res (com/success-handler response)]
+  (let [res (com/process-response response)]
     (lib/update-state-item! :discussion :search (fn [_] res))))

 (defn find-statement


add root-node to context right after it is created

--- examples/lesson-carousel-starter-kit/src/carousel/core.cljs
+++ examples/lesson-carousel-starter-kit/src/carousel/core.cljs
@@ -1,8 +1,8 @@
 (ns ^:figwheel-always carousel.core
-  (:require-macros [cljs.core.async.macros :refer [go]])
-  (:require [com.famous.Famous]
-            [carousel.util :refer [events->chan get-children]]
-            [cljs.core.async :refer [>! <! put! chan alts!]]))
+    (:require-macros [cljs.core.async.macros :refer [go]])
+    (:require [com.famous.Famous]
+              [carousel.util :refer [events->chan get-children]]
+              [cljs.core.async :refer [>! <! put! chan alts!]]))

 (enable-console-print!)

@@ -26,239 +26,239 @@
 (defonce ABSOLUTE (.. Size -ABSOLUTE))

 (defn create-pages [root-node simulation]
-      (let [url-base "http://demo.famo.us.s3.amazonaws.com/hub/apps/carousel/Museo_del_Prado_-_Goya_-_Caprichos_-_No._"
-            image-names ["01_-_Autorretrato._Francisco_Goya_y_Lucientes2C_pintor_thumb.jpg"
-                         "02_-_El_si_pronuncian_y_la_mano_alargan_al_primero_que_llega_thumb.jpg"
-                         "03_-_Que_viene_el_Coco_thumb.jpg"
-                         "04_-_El_de_la_rollona_thumb.jpg"
-                         "05_-_Tal_para_qual_thumb.jpg"
-                         "06_-_Nadie_se_conoce_thumb.jpg"
-                         "07_-_Ni_asi_la_distingue_thumb.jpg"
-                         "09_-_Tantalo_thumb.jpg"
-                         "10_-_El_amor_y_la_muerte_thumb.jpg"
-                         "11_-_Muchachos_al_avC3ADo_thumb.jpg"
-                         "12_-_A_caza_de_dientes_thumb.jpg"
-                         "13_-_Estan_calientes_thumb.jpg"]
-            pages (map (fn [image-name]
-                           (let [_image-url (str url-base image-name)
-                                 image-url (str "url('" _image-url "')")
-                                 image-node (.. root-node addChild)
-                                 el (DOMElement. image-node)
-                                 box (FamousBox. (clj->js {:mass 100 :size [100 100 100]}))
-                                 anchor (Vec3. 1 0 0)
-                                 spring (Spring. nil box (clj->js {:period 0.5 :dampingRatio 0.5 :anchor anchor}))
-                                 quaternion (.. (Quaternion.) (fromEuler 0 (/ (.. js/Math -PI) -2) 0))
-                                 rotational-spring (RotationalSpring. nil box (clj->js {:period 1 :dampingRatio 0.2 :anchor quaternion}))]
-                                (.. image-node
-                                    (setSizeMode ABSOLUTE ABSOLUTE ABSOLUTE)
-                                    (setAbsoluteSize 500 500 0)
-                                    (setAlign 0.5 0.5)
-                                    (setMountPoint 0.5 0.5)
-                                    (setOrigin 0.5 0.5))
-                                (.. el
-                                    (setProperty "backgroundImage" image-url)
-                                    (setProperty "background-repeat" "no-repeat")
-                                    (setProperty "background-size" "cover"))
-
-                                {:node              image-node
-                                 :el                el
-                                 :box               box
-                                 :spring            spring
-                                 :quaternion        quaternion
-                                 :rotational-spring rotational-spring
-                                 :anchor            anchor}))
-                       image-names)]
-           (doseq [{:keys [box spring rotational-spring]} pages]
-                  (.. simulation (add box spring rotational-spring)))
-
-           pages))
+  (let [url-base "http://demo.famo.us.s3.amazonaws.com/hub/apps/carousel/Museo_del_Prado_-_Goya_-_Caprichos_-_No._"
+        image-names ["01_-_Autorretrato._Francisco_Goya_y_Lucientes2C_pintor_thumb.jpg"
+                     "02_-_El_si_pronuncian_y_la_mano_alargan_al_primero_que_llega_thumb.jpg"
+                     "03_-_Que_viene_el_Coco_thumb.jpg"
+                     "04_-_El_de_la_rollona_thumb.jpg"
+                     "05_-_Tal_para_qual_thumb.jpg"
+                     "06_-_Nadie_se_conoce_thumb.jpg"
+                     "07_-_Ni_asi_la_distingue_thumb.jpg"
+                     "09_-_Tantalo_thumb.jpg"
+                     "10_-_El_amor_y_la_muerte_thumb.jpg"
+                     "11_-_Muchachos_al_avC3ADo_thumb.jpg"
+                     "12_-_A_caza_de_dientes_thumb.jpg"
+                     "13_-_Estan_calientes_thumb.jpg"]
+        pages (map (fn [image-name]
+                     (let [_image-url (str url-base image-name)
+                           image-url (str "url('" _image-url "')")
+                           image-node (.. root-node addChild)
+                           el (DOMElement. image-node)
+                           box (FamousBox. (clj->js {:mass 100 :size [100 100 100]}))
+                           anchor (Vec3. 1 0 0)
+                           spring (Spring. nil box (clj->js {:period 0.5 :dampingRatio 0.5 :anchor anchor}))
+                           quaternion (.. (Quaternion.) (fromEuler 0 (/ (.. js/Math -PI) -2) 0))
+                           rotational-spring (RotationalSpring. nil box (clj->js {:period 1 :dampingRatio 0.2 :anchor quaternion}))]
+                       (.. image-node
+                           (setSizeMode ABSOLUTE ABSOLUTE ABSOLUTE)
+                           (setAbsoluteSize 500 500 0)
+                           (setAlign 0.5 0.5)
+                           (setMountPoint 0.5 0.5)
+                           (setOrigin 0.5 0.5))
+                       (.. el
+                           (setProperty "backgroundImage" image-url)
+                           (setProperty "background-repeat" "no-repeat")
+                           (setProperty "background-size" "cover"))
+
+                       {:node              image-node
+                        :el                el
+                        :box               box
+                        :spring            spring
+                        :quaternion        quaternion
+                        :rotational-spring rotational-spring
+                        :anchor            anchor}))
+                   image-names)]
+    (doseq [{:keys [box spring rotational-spring]} pages]
+      (.. simulation (add box spring rotational-spring)))
+
+    pages))

 (defn make-tree []
-      [:node {:id "root"}
-       [[:node {:id            "back"
-                :size-mode     [ABSOLUTE ABSOLUTE]
-                :absolute-size [40 40]
-                :align         [0 0.5 0]
-                :position      [40 0 0]
-                :mount-point   [0 0.5 0]
-                :components    [[:DOMElement {:color         "white"
-                                              :fontSize      "40px"
-                                              :lineHeight    "40px"
-                                              :cursor        "pointer"
-                                              :textHighlight "none"
-                                              :zIndex        "2"
-                                              :content       "<"}]]}]
-        [:node {:id            "next"
-                :size-mode     [ABSOLUTE ABSOLUTE]
-                :absolute-size [40 40]
-                :align         [1 0.5 0]
-                :position      [-40 0 0]
-                :mount-point   [1 0.5 0]
-                :components    [[:DOMElement {:color         "white"
-                                              :fontSize      "40px"
-                                              :lineHeight    "40px"
-                                              :cursor        "pointer"
-                                              :textHighlight "none"
-                                              :zIndex        "2"
-                                              :content       ">"}]]}]
-
-        [:node {:id "pager"}
-         (let [url-base "http://demo.famo.us.s3.amazonaws.com/hub/apps/carousel/Museo_del_Prado_-_Goya_-_Caprichos_-_No._"
-                image-names ["01_-_Autorretrato._Francisco_Goya_y_Lucientes2C_pintor_thumb.jpg"
-                             "02_-_El_si_pronuncian_y_la_mano_alargan_al_primero_que_llega_thumb.jpg"
-                             "03_-_Que_viene_el_Coco_thumb.jpg"
-                             "04_-_El_de_la_rollona_thumb.jpg"
-                             "05_-_Tal_para_qual_thumb.jpg"
-                             "06_-_Nadie_se_conoce_thumb.jpg"
-                             "07_-_Ni_asi_la_distingue_thumb.jpg"
-                             "09_-_Tantalo_thumb.jpg"
-                             "10_-_El_amor_y_la_muerte_thumb.jpg"
-                             "11_-_Muchachos_al_avC3ADo_thumb.jpg"
-                             "12_-_A_caza_de_dientes_thumb.jpg"
-                             "13_-_Estan_calientes_thumb.jpg"
-                             ]]
-            (for [image-name image-names
-                  :let [url-base "http://demo.famo.us.s3.amazonaws.com/hub/apps/carousel/Museo_del_Prado_-_Goya_-_Caprichos_-_No._"
-                        image-url (str url-base image-name)
-                        url (str "url('" image-url "')")]]
-              [:node {:size-mode     [ABSOLUTE ABSOLUTE ABSOLUTE]
-                      :absolute-size [500 500 0]
-                      :align         [0.5 0.5]
-                      :mount-point   [0.5 0.5]
-                      :origin        [0.5 0.5]
-                      :components    [[:DOMElement {:backgroundImage   url
-                                                    :background-repeat "no-repeat"
-                                                    :background-size   "cover"}]]}]))]
-        [:node {:id            "dots"
-                :size-mode     [ABSOLUTE ABSOLUTE]
-                :absolute-size [20 20]
-                :position      [0 -50 0]
-                :align         [0.5 1 0]
-                :mount-point   [0.5 1 0]}
-         (for [i (range 5)]
-              [:node {:size-mode     [ABSOLUTE ABSOLUTE]
-                      :absolute-size [5 5]
-                      :components    [[:DOMElement {:borderRadius "5px"
-                                                    :border       "2px solid white"
-                                                    :boxSizing    "border-box"}]]}])]]])
+  [:node {:id "root"}
+   [[:node {:id            "back"
+            :size-mode     [ABSOLUTE ABSOLUTE]
+            :absolute-size [40 40]
+            :align         [0 0.5 0]
+            :position      [40 0 0]
+            :mount-point   [0 0.5 0]
+            :components    [[:DOMElement {:color         "white"
+                                          :fontSize      "40px"
+                                          :lineHeight    "40px"
+                                          :cursor        "pointer"
+                                          :textHighlight "none"
+                                          :zIndex        "2"
+                                          :content       "<"}]]}]
+    [:node {:id            "next"
+            :size-mode     [ABSOLUTE ABSOLUTE]
+            :absolute-size [40 40]
+            :align         [1 0.5 0]
+            :position      [-40 0 0]
+            :mount-point   [1 0.5 0]
+            :components    [[:DOMElement {:color         "white"
+                                          :fontSize      "40px"
+                                          :lineHeight    "40px"
+                                          :cursor        "pointer"
+                                          :textHighlight "none"
+                                          :zIndex        "2"
+                                          :content       ">"}]]}]
+
+    [:node {:id "pager"}
+     (let [url-base "http://demo.famo.us.s3.amazonaws.com/hub/apps/carousel/Museo_del_Prado_-_Goya_-_Caprichos_-_No._"
+           image-names ["01_-_Autorretrato._Francisco_Goya_y_Lucientes2C_pintor_thumb.jpg"
+                        "02_-_El_si_pronuncian_y_la_mano_alargan_al_primero_que_llega_thumb.jpg"
+                        "03_-_Que_viene_el_Coco_thumb.jpg"
+                        "04_-_El_de_la_rollona_thumb.jpg"
+                        "05_-_Tal_para_qual_thumb.jpg"
+                        "06_-_Nadie_se_conoce_thumb.jpg"
+                        "07_-_Ni_asi_la_distingue_thumb.jpg"
+                        "09_-_Tantalo_thumb.jpg"
+                        "10_-_El_amor_y_la_muerte_thumb.jpg"
+                        "11_-_Muchachos_al_avC3ADo_thumb.jpg"
+                        "12_-_A_caza_de_dientes_thumb.jpg"
+                        "13_-_Estan_calientes_thumb.jpg"
+                        ]]
+       (for [image-name image-names
+             :let [url-base "http://demo.famo.us.s3.amazonaws.com/hub/apps/carousel/Museo_del_Prado_-_Goya_-_Caprichos_-_No._"
+                   image-url (str url-base image-name)
+                   url (str "url('" image-url "')")]]
+         [:node {:size-mode     [ABSOLUTE ABSOLUTE ABSOLUTE]
+                 :absolute-size [500 500 0]
+                 :align         [0.5 0.5]
+                 :mount-point   [0.5 0.5]
+                 :origin        [0.5 0.5]
+                 :components    [[:DOMElement {:backgroundImage   url
+                                               :background-repeat "no-repeat"
+                                               :background-size   "cover"}]]}]))]
+    [:node {:id            "dots"
+            :size-mode     [ABSOLUTE ABSOLUTE]
+            :absolute-size [20 20]
+            :position      [0 -50 0]
+            :align         [0.5 1 0]
+            :mount-point   [0.5 1 0]}
+     (for [i (range 5)]
+       [:node {:size-mode     [ABSOLUTE ABSOLUTE]
+               :absolute-size [5 5]
+               :components    [[:DOMElement {:borderRadius "5px"
+                                             :border       "2px solid white"
+                                             :boxSizing    "border-box"}]]}])]]])

 (defn make-nodes [node-as-vec]
-      (let [attributes (nth node-as-vec 1)
-            node (Node.)
-            size-mode (clj->js (:size-mode attributes))
-            absolute-size (clj->js (:absolute-size attributes))
-            align (clj->js (:align attributes))
-            position (clj->js (:position attributes))
-            components (:components attributes)
-            mount-point (clj->js (:mount-point attributes))
-            origin (clj->js (:origin attributes))
-            children (get-children node-as-vec)]
-           (.apply (.-setSizeMode node) node size-mode)
-           (.apply (.-setAbsoluteSize node) node absolute-size)
-           (.apply (.-setAlign node) node align)
-           (.apply (.-setPosition node) node position)
-           (.apply (.-setMountPoint node) node mount-point)
-           (.apply (.-setOrigin node) node origin)
-
-           (if-not (empty? components)
-                   (doseq [component components
-                           :let [dom-element (DOMElement. node)
-                                 properties (nth component 1)]]
-                          (doseq [p properties
-                                  :let [name (name (first p))
-                                        value (second p)]]
-                                 (if (= name "content")
-                                   (.. dom-element (setContent value))
-                                   (.. dom-element (setProperty name value))))))
-
-           (if-not (empty? children)
-                   (doseq [n (nth node-as-vec 2)
-                           :let [a-child-node (make-nodes n)]]
-                          (.. node (addChild a-child-node))))
-
-           node))
+  (let [attributes (nth node-as-vec 1)
+        node (Node.)
+        size-mode (clj->js (:size-mode attributes))
+        absolute-size (clj->js (:absolute-size attributes))
+        align (clj->js (:align attributes))
+        position (clj->js (:position attributes))
+        components (:components attributes)
+        mount-point (clj->js (:mount-point attributes))
+        origin (clj->js (:origin attributes))
+        children (get-children node-as-vec)]
+    (.apply (.-setSizeMode node) node size-mode)
+    (.apply (.-setAbsoluteSize node) node absolute-size)
+    (.apply (.-setAlign node) node align)
+    (.apply (.-setPosition node) node position)
+    (.apply (.-setMountPoint node) node mount-point)
+    (.apply (.-setOrigin node) node origin)
+
+    (if-not (empty? components)
+      (doseq [component components
+              :let [dom-element (DOMElement. node)
+                    properties (nth component 1)]]
+        (doseq [p properties
+                :let [name (name (first p))
+                      value (second p)]]
+          (if (= name "content")
+            (.. dom-element (setContent value))
+            (.. dom-element (setProperty name value))))))
+
+    (if-not (empty? children)
+      (doseq [n (nth node-as-vec 2)
+              :let [a-child-node (make-nodes n)]]
+        (.. node (addChild a-child-node))))
+
+    node))

 (defn Carousel []
-      (let [simulation (PhysicsEngine.)
-            tree (make-tree)
-            root-node (make-nodes tree)
-            children (.. root-node getChildren)
-            context (.. FamousEngine (createScene "body"))
-
-            back-node (first children)
-            back-clicks (events->chan back-node "tap")
-
-            next-node (second children)
-            next-clicks (events->chan next-node "tap")
-
-            pages (.. children (slice 2 (count children)))
-            _ (println "count= " (count children))
-
-            dot-container-node (last children)
-            dot-nodes (.. dot-container-node getChildren)
-            resize (clj->js {:onSizeChange (fn [^Float32Array size]
-                                               "NOTE: this call back is called only once because root-dot setSizeMode is ABSOLUTE (value of 1)"
-                                               (let [size (IndexedSeq. size 0)
-                                                     dotWidth 10
-                                                     numPages 5
-                                                     spacing 5
-                                                     totalDotSize (+ (* numPages dotWidth)
-                                                                     (* spacing (dec numPages)))
-                                                     start-x (/ (- (nth size 0) totalDotSize)
-                                                                2)]
-                                                    (doseq [n (range (count dot-nodes))
-                                                            :let [dot-node (nth dot-nodes n)]]
-                                                           (.. dot-node (setPosition (+ start-x
-                                                                                (* n
-                                                                                (+ dotWidth spacing)))
-                                                                                0
-                                                                                0)))))})
-            current-index (atom 0)]
-           (.. dot-container-node (addComponent resize))
-           (.. context (addChild root-node))
-
-
-           ;(add-watch current-index :watcher (fn [key atom old-index new-index]
-           ;                                      (let [old-page (nth pages old-index)
-           ;                                            new-page (nth pages new-index)]
-           ;                                           (.. (:anchor old-page) (set 1 0 0))
-           ;                                           (.. (:quaternion old-page) (fromEuler 0 (/ (.. js/Math -PI) -2) 0))
-           ;                                           (.. (:anchor new-page) (set 0 0 0))
-           ;                                           (.. (:quaternion new-page) (set 1 0 0 0)))))
-
-           (go
-             (while true
-                    (let [[v channel] (alts! [back-clicks next-clicks])]
-                         (cond
-                           (= channel back-clicks) (do
-                                                     (println "back" @current-index)
-                                                     (swap! current-index dec)
-                                                     )
-                           (= channel next-clicks) (do
-                                                     (println "next" @current-index)
-                                                     (swap! current-index inc)
-                                                     )))))
-
-           ;; (.. FamousEngine (requestUpdate (clj->js {:onUpdate (fn [time]
-           ;;                                                       (.. simulation (update time))
-           ;;                                                       (doseq [page pages
-           ;;                                                               :let [physics-transform (.. simulation (getTransform (:box page)))
-           ;;                                                                     p (.. physics-transform -position)
-           ;;                                                                     r (.. physics-transform -rotation)
-           ;;                                                                     node (:node page)]]
-           ;;                                                         (.. node
-           ;;                                                             (setPosition (* 0 1446) 0 0)
-           ;;                                                             (setRotation (nth r 0) (nth r 1) (nth r 2) (nth r 3))
-           ;;                                                             )
-           ;;                                                         )
-
-           ;;                                                       (this-as this
-           ;;                                                                (.. FamousEngine (requestUpdateOnNextTick this)))
-           ;;                                                       )})))
-           )
-
-      )
+  (let [simulation (PhysicsEngine.)
+        context (.. FamousEngine (createScene "body"))
+        tree (make-tree)
+        root-node (make-nodes tree)
+        _ (.. context (addChild root-node))
+        children (.. root-node getChildren)
+
+        back-node (first children)
+        back-clicks (events->chan back-node "tap")
+
+        next-node (second children)
+        next-clicks (events->chan next-node "tap")
+
+        pages (.. children (slice 2 (count children)))
+
+        dot-container-node (last children)
+        dot-nodes (.. dot-container-node getChildren)
+        resize (clj->js {:onSizeChange (fn [^Float32Array size]
+                                         "NOTE: this call back is called only once because root-dot setSizeMode is ABSOLUTE (value of 1)"
+                                         (let [size (IndexedSeq. size 0)
+                                               dotWidth 10
+                                               numPages 5
+                                               spacing 5
+                                               totalDotSize (+ (* numPages dotWidth)
+                                                               (* spacing (dec numPages)))
+                                               start-x (/ (- (nth size 0) totalDotSize)
+                                                          2)]
+                                           (doseq [n (range (count dot-nodes))
+                                                   :let [dot-node (nth dot-nodes n)]]
+                                             (.. dot-node (setPosition (+ start-x
+                                                                          (* n
+                                                                             (+ dotWidth spacing)))
+                                                                       0
+                                                                       0)))))})
+        current-index (atom 0)]
+    (.. dot-container-node (addComponent resize))
+
+
+
+                                        ;(add-watch current-index :watcher (fn [key atom old-index new-index]
+                                        ;                                      (let [old-page (nth pages old-index)
+                                        ;                                            new-page (nth pages new-index)]
+                                        ;                                           (.. (:anchor old-page) (set 1 0 0))
+                                        ;                                           (.. (:quaternion old-page) (fromEuler 0 (/ (.. js/Math -PI) -2) 0))
+                                        ;                                           (.. (:anchor new-page) (set 0 0 0))
+                                        ;                                           (.. (:quaternion new-page) (set 1 0 0 0)))))
+
+    (go
+      (while true
+        (let [[v channel] (alts! [back-clicks next-clicks])]
+          (cond
+            (= channel back-clicks) (do
+                                      (println "back" @current-index)
+                                      (swap! current-index dec)
+                                      )
+            (= channel next-clicks) (do
+                                      (println "next" @current-index)
+                                      (swap! current-index inc)
+                                      )))))
+
+    ;; (.. FamousEngine (requestUpdate (clj->js {:onUpdate (fn [time]
+    ;;                                                       (.. simulation (update time))
+    ;;                                                       (doseq [page pages
+    ;;                                                               :let [physics-transform (.. simulation (getTransform (:box page)))
+    ;;                                                                     p (.. physics-transform -position)
+    ;;                                                                     r (.. physics-transform -rotation)
+    ;;                                                                     node (:node page)]]
+    ;;                                                         (.. node
+    ;;                                                             (setPosition (* 0 1446) 0 0)
+    ;;                                                             (setRotation (nth r 0) (nth r 1) (nth r 2) (nth r 3))
+    ;;                                                             )
+    ;;                                                         )
+
+    ;;                                                       (this-as this
+    ;;                                                                (.. FamousEngine (requestUpdateOnNextTick this)))
+    ;;                                                       )})))
+    )
+
+  )

 (Carousel)
 (.. FamousEngine init)


Rework review comments for updating statistics for updated-tiles.

--- src/main/clojure/pdok/featured/processor.clj
+++ src/main/clojure/pdok/featured/processor.clj
@@ -351,21 +351,14 @@
     (pers/append-to-stream persistence version action collection id validity geometry attributes)
     feature))

-(defn- add-updated-tiles [statistics feature]
-  (if-let [tiles (tiles/nl (:geometry feature))]
-    (swap! statistics update :updatedTiles #(clojure.set/union % tiles))
-    )
-  )
-
 (defn- update-statistics [{:keys [statistics]} feature]
   (when statistics
     (swap! statistics update :n-processed inc)
     (when (:src feature) (swap! statistics update :n-src inc))
-    (when (:geometry feature) (add-updated-tiles statistics feature))
+    (when (:geometry feature) (swap! statistics update :updated-tiles #(clojure.set/union % (tiles/nl (:geometry feature)))))
     (when (:invalid? feature)
       (swap! statistics update :n-errored inc)
-      (swap! statistics update :errored #(conj % (:id feature))))
-    )
+      (swap! statistics update :errored #(conj % (:id feature)))))
   )

 (defn consume* [processor features]
@@ -444,5 +437,5 @@
              :projectors initialized-projectors
              :batch-size batch-size
              :invalids (volatile! #{})
-             :statistics (atom {:n-src 0 :n-processed 0 :n-errored 0 :errored '() :replayed 0 :updatedTiles #{}})}
+             :statistics (atom {:n-src 0 :n-processed 0 :n-errored 0 :errored '() :replayed 0 :updated-tiles #{}})}
             options))))


Calling the response handler should not be lazy!

--- src/appengine_magic/servlet.clj
+++ src/appengine_magic/servlet.clj
@@ -125,7 +125,7 @@

 (defn make-servlet-service-method [ring-handler]
   (fn [^HttpServlet servlet, ^HttpServletRequest request, ^HttpServletResponse response]
-    (let [response-map (ring-handler (make-request-map servlet request response))]
+    (let [response-map (doall (ring-handler (make-request-map servlet request response)))]
       (when-not response-map
         (throw (RuntimeException. "handler returned nil (no response map)")))
       (adapt-servlet-response response response-map))))


Remove println

Remove println

--- ccw.core/src/clj/ccw/repl/view_helpers.clj
+++ ccw.core/src/clj/ccw/repl/view_helpers.clj
@@ -41,7 +41,6 @@
   (let [colored-style #(let [s (StyleRange.)
                              color-rgb (ccw.editors.clojure.ClojureSourceViewer/getRGBColor (.getCombinedPreferenceStore (CCWPlugin/getDefault)) %)
                              color (CCWPlugin/getColor color-rgb)]
-                         (println "color: " color)
                          (when color (set! (.foreground s) color))
                          s)
         error-rgb-key (ccw.preferences.PreferenceConstants/getTokenPreferenceKey ccw.preferences.PreferenceConstants/replLogError)


add :vocab2model key with value of type: (fn [vocab-items filter-lexicon-fn])

--- src/babel/italiano/grammar.cljc
+++ src/babel/italiano/grammar.cljc
@@ -708,6 +708,8 @@
           [tree])
         with-defaults))))

+(declare model-with-vocab-items)
+
 ;; TODO: factor out language-independent parts of this to babel.lexiconfn.
 (defn model-plus-lexicon
   "create a language model for Italian with the supplied lexicon."
@@ -733,7 +735,7 @@
         debug (log/info "  finalizing..")]

     (->
-     ;; Create the model in stages; we need stages because some closures need a model
+     ;; Create the model in stages. We need to do this because some closures need a model
      ;; as a parameter, so they use as the model what precedes it in the list of
      ;; stages.
      {:index-fn (fn [spec] (lookup-spec spec indices index-lexicon-on-paths))
@@ -754,7 +756,11 @@

      ((fn [model]
         (merge model
-               {:bolts
+               {:vocab2model
+                (fn [vocab-items filter-lexicon-fn]
+                  (model-with-vocab-items vocab-items filter-lexicon-fn model))
+
+                :bolts
                 (merge
                  (let [depth 2
                        spec
@@ -780,13 +786,12 @@
                     (lightning-bolts model
                                      spec
                                      0 depth)}))})))
-
      ((fn [model]
         (merge model
                {:generate-fn (fn [spec] (generate/generate spec model))}))))))

 (defn model-with-vocab-items [vocab-items filter-lexicon-fn model]
-  (let [input-lexicon (map vocab-entry-to-lexeme vocab-items)
+  (let [input-lexicon (reduce merge (map vocab-entry-to-lexeme vocab-items))
         synthetic-noun (edn2lexicon input-lexicon)
         new-lexicon (merge-with concat
                                 synthetic-noun


comment out adverb-phrase (for now)

comment out adverb-phrase (for now)

--- src/babel/italiano/grammar.cljc
+++ src/babel/italiano/grammar.cljc
@@ -225,26 +225,26 @@
                              {:rule "intensifier-phrase"
                               :synsem head-synsem}))

-                   (let [parent-subcat (atom :top)
-                         sem (atom :top)
-                         infl (atom :top)
-                         comp-synsem (atom {:sem sem
-                                            :infl infl
-                                            :subcat {:1 parent-subcat}})]
-                     (unify
-                      head-first
-                      {:head {:synsem {:cat :adverb
-                                       :sem sem
-                                       :subcat {:1 comp-synsem}}}
-                       :first :head
-                       :comp {:synsem comp-synsem}
-                       :synsem {:cat :verb
-                                :infl infl
-                                :aux false
-                                :sem sem
-                                :subcat parent-subcat}
-                       :schema-symbol 'h11
-                       :rule "adverb-phrase"}))
+;                   (let [parent-subcat (atom :top)
+;                         sem (atom :top)
+;                         infl (atom :top)
+;                         comp-synsem (atom {:sem sem
+;                                            :infl infl
+;                                            :subcat {:1 parent-subcat}})]
+;                     (unify
+;                      head-first
+;                      {:head {:synsem {:cat :adverb
+;                                       :sem sem
+;                                       :subcat {:1 comp-synsem}}}
+;                       :first :head
+;                       :comp {:synsem comp-synsem}
+;                       :synsem {:cat :verb
+;                                :infl infl
+;                                :aux false
+;                                :sem sem
+;                                :subcat parent-subcat}
+;                       :schema-symbol 'h11
+;                       :rule "adverb-phrase"}))

                    ;; nbar where head (noun) is first ('h' in h11)
                    (unify h11-comp-subcat-1


Don't run ETL in debug mode

Don't run ETL in debug mode

--- src/clj/cglossa/data_import.clj
+++ src/clj/cglossa/data_import.clj
@@ -8,8 +8,7 @@
             [cheshire.core :as cheshire]))

 (def ^:private corpora-config-template
-  {:config       {:log "debug"},
-   :begin        [{:console
+  {:begin        [{:console
                    {:commands
                     ["CONNECT remote:localhost/Glossa admin admin;"
                      "TRUNCATE CLASS Corpus;"]}}],
@@ -24,8 +23,7 @@
                    :indexes [{:class "Corpus", :fields ["code:string"], :type "UNIQUE"}]}}})

 (def ^:private metadata-categories-config-template
-  {:config       {:log "debug"},
-   :begin        [{:console
+  {:begin        [{:console
                    {:commands
                     ["CONNECT remote:localhost/Glossa admin admin;"
                      "TRUNCATE CLASS MetadataCategory;"
@@ -50,8 +48,7 @@
                              {:class "MetadataCategory", :fields ["corpus_cat:string"], :type "UNIQUE"}]}}})

 (def ^:private tids-config-template
-  {:config       {:log "debug"},
-   :begin        [{:console
+  {:begin        [{:console
                    {:commands
                     ["CONNECT remote:localhost/Glossa admin admin;"
                      "TRUNCATE CLASS MetadataValue;"
@@ -75,8 +72,7 @@
                    :indexes [{:class "MetadataCategory", :fields ["corpus_cat:string"], :type "UNIQUE"}]}}})

 (def ^:private metadata-values-config-template
-  {:config       {:log "debug"},
-   :source       {:file {:path :WILL-BE-REPLACED}},
+  {:source       {:file {:path :WILL-BE-REPLACED}},
    :extractor    {:row {}},
    :transformers [{:csv {:separator "\t"}}
                   {:vertex {:class "MetadataValue"}}


Add a function for getting an xml feed

Add a function for getting an xml feed

--- src/clj/comic_reader/scrape.clj
+++ src/clj/comic_reader/scrape.clj
@@ -20,6 +20,9 @@
                    {:name (trim name)
                     :url (str canonical-url url)})})])

+(defn fetch-feed [url]
+  (html/xml-resource (java.net.URL. url)))
+
 (defn fetch-url [url]
   (html/html-resource (java.net.URL. url)))


per run, not per turn

per run, not per turn

--- src/clj/game/cards-upgrades.clj
+++ src/clj/game/cards-upgrades.clj
@@ -102,7 +102,7 @@
                        (when (< clicknew clickold)
                          (resolve-ability ref side
                            {:req (req this-server)
-                            :msg "force the Runner to lose all credits" :once :per-turn
+                            :msg "force the Runner to lose all credits" :once :per-run
                             :effect (effect (lose :runner :credit :all))}
                           card nil))))))
     :leave-play (req (remove-watch state (keyword (str "heinlein" (:cid card)))))}


html5 template in index

html5 template in index

--- src/clj/iwaswhere_web/index.clj
+++ src/clj/iwaswhere_web/index.clj
@@ -1,45 +1,42 @@
 (ns iwaswhere-web.index
   "This namespace takes care of rendering the static HTML into which the
    React / Reagent components are mounted on the client side at runtime."
-  (:require [hiccup.core :refer [html]]
+  (:require [hiccup.page :refer [html5 include-css include-js]]
             [compojure.route :as r]
             [iwaswhere-web.routes.upload-qr :as qr]
             [iwaswhere-web.files :as f]
             [iwaswhere-web.routes.images :as ir]
             [iwaswhere-web.routes.map-tile :as mt]))

-(defn stylesheet [url] [:link {:href url :rel "stylesheet"}])
-
 (defn index-page
   "Generates index page HTML with the specified page title."
   [_]
-  (html
-    [:html
-     {:lang "en"}
-     [:head
-      [:meta {:name "viewport" :content "width=device-width, initial-scale=1"}]
-      [:title "iWasWhere"]
-      ; Download from https://github.com/christiannaths/Redacted-Font
-      ; then uncomment in _entry.scss and recompile CSS for redacted fron
-      (stylesheet "/redacted-font/fonts/web/stylesheet.css")
-      (stylesheet "/webjars/normalize-css/5.0.0/normalize.css")
-      (stylesheet "/webjars/github-com-mrkelly-lato/0.3.0/css/lato.css")
-      (stylesheet "https://fonts.googleapis.com/css?family=Oswald:300,400")
-      (stylesheet "/webjars/fontawesome/4.7.0/css/font-awesome.css")
-      (stylesheet "/webjars/leaflet/0.7.7/dist/leaflet.css")
-      (stylesheet "/css/iwaswhere.css")]
-     [:body
-      [:div#reframe]
-      ;; Currently, from http://www.orangefreesounds.com/old-clock-ringing-short/
-      ;; TODO: record own alarm clock
-      [:audio#ringer {:autoPlay false :loop false}
-       [:source {:src "/mp3/old-clock-ringing-short.mp3" :type "audio/mp4"}]]
-      [:audio#ticking-clock {:autoPlay false :loop false}
-       [:source {:src "/mp3/tick.ogg" :type "audio/ogg"}]]
-      [:script {:src "/webjars/intl/1.2.4/dist/Intl.min.js"}]
-      [:script {:src "/webjars/intl/1.2.4/locale-data/jsonp/en.js"}]
-      [:script {:src "/webjars/randomcolor/0.4.4/randomColor.js"}]
-      [:script {:src "/js/build/iwaswhere.js"}]]]))
+  (html5
+    {:lang "en"}
+    [:head
+     [:meta {:name "viewport" :content "width=device-width, initial-scale=1"}]
+     [:title "iWasWhere"]
+     ; Download from https://github.com/christiannaths/Redacted-Font
+     ; then uncomment in _entry.scss and recompile CSS for redacted fron
+     (include-css "/redacted-font/fonts/web/stylesheet.css")
+     (include-css "/webjars/normalize-css/5.0.0/normalize.css")
+     (include-css "/webjars/github-com-mrkelly-lato/0.3.0/css/lato.css")
+     (include-css "https://fonts.googleapis.com/css?family=Oswald:300,400")
+     (include-css "/webjars/fontawesome/4.7.0/css/font-awesome.css")
+     (include-css "/webjars/leaflet/0.7.7/dist/leaflet.css")
+     (include-css "/css/iwaswhere.css")]
+    [:body
+     [:div#reframe]
+     ;; Currently, from http://www.orangefreesounds.com/old-clock-ringing-short/
+     ;; TODO: record own alarm clock
+     [:audio#ringer {:autoPlay false :loop false}
+      [:source {:src "/mp3/old-clock-ringing-short.mp3" :type "audio/mp4"}]]
+     [:audio#ticking-clock {:autoPlay false :loop false}
+      [:source {:src "/mp3/tick.ogg" :type "audio/ogg"}]]
+     (include-js "/webjars/intl/1.2.4/dist/Intl.min.js")
+     (include-js "/webjars/intl/1.2.4/locale-data/jsonp/en.js")
+     (include-js "/webjars/randomcolor/0.4.4/randomColor.js")
+     (include-js "/js/build/iwaswhere.js")]))

 (defn routes-fn
   "Adds routes for serving media files. This routes function will receive the


Handy link to /todos in admin

Handy link to /todos in admin

--- src/clj_crud/admin_accounts.clj
+++ src/clj_crud/admin_accounts.clj
@@ -37,7 +37,7 @@
                                            (html/set-attr :href self-link))
                             [:td.name :a] (html/do->
                                            (html/content name)
-                                           (html/set-attr :href self-link))
+                                           (html/set-attr :href todos-link))
                             [:td.created_at] (html/content (str (java.util.Date. created_at)))
                             [:td.updated_at] (html/content (str (java.util.Date. updated_at)))
                             [:td.admin] (html/content (if admin "Admin" "User"))


Disable `Timetable Builder` tab when Exhibit3 is initializing

Otherwise the DOM for the Exhibit3 page may be screwed up due to the
user switching to the `Timetable Builder` page and the Exhibit3 elements
being hidden.

Major changes
- Refactor click event handler for the `Timetable Builder` tab to a
  function named `timetable-builder-tab-click-handler`
- Upon successfully entering the `initialize-exhibit3` function, unbind
  the original click event handler for the `Timetable Builder` tab. This
  prevents the user from switching tabs, so the Exhibit3 stuff can be
  properly rendered.
- Rebind the original click event handler 3s after Exhibit3 has been
  initialized, and we can be sure that the DOM is properly rendered

Signed-off-by: Pang Yan Han <22594c345857f664c61cd411f607c4d40a9d4af9@gmail.com>

--- src/cljs/cljs_nusmods/main.cljs
+++ src/cljs/cljs_nusmods/main.cljs
@@ -1,7 +1,7 @@
 (ns ^{:doc "main entry point for the cljs-nusmods project"}
   cljs-nusmods.main
   (:use [jayq.core :only [$ $deferred $when attr document-ready done hide is one
-                          parent prevent resolve show]])
+                          parent prevent resolve show unbind]])
   (:require [cljs-nusmods.module-array-repr     :as module-array-repr]
             [cljs-nusmods.aux-module-array-repr :as aux-module-array-repr]
             [cljs-nusmods.lesson-array-repr     :as lesson-array-repr]
@@ -223,13 +223,28 @@
        :private true}
   MODULE-FINDER-SCRIPTS-DLED? false)

+(defn- timetable-builder-tab-click-handler
+  "Click event handler for the `Timetable Builder` tab"
+  []
+  (hide ($ :#module-finder))
+  (.removeClass (parent ($ :#module-finder-tab-link)) "active")
+  (.addClass (parent ($ :#timetable-builder-tab-link)) "active")
+  (show ($ :#timetable-builder))
+  (select2/shift-select2-container-to "module-finder-sidebar"
+                                      "timetable-builder-controls")
+  (aset js/window "ActiveTab" TIMETABLE-TAB-INDEX))
+
 (defn- initialize-exhibit3 [MODULES AUXMODULES]
   "Initialize Exhibit3 database and UI for Module Finder page"
   (if (and (not (aget js/window "Exhibit3_Initialized"))
            (aget js/window "Exhibit3_Loaded")
            MODULE-FINDER-SCRIPTS-DLED?
            (= (aget js/window "ActiveTab") MODULEFINDER-TAB-INDEX))
-    (do
+    (let [$timetable-builder-tab-link ($ :#timetable-builder-tab-link)]
+      ; Unbind the click event handler for `Timetable Builder` tab link so
+      ; the user cannot switch tabs when we are initializing Exhibit3 here and
+      ; screw things up
+      (unbind $timetable-builder-tab-link "click")
       (aux-module-array-repr/init!)
       (let [modulesArray (build-modules-array MODULES AUXMODULES)
             itemsArray   (add-aux-info-to-exhibit-items
@@ -249,7 +264,12 @@
                                  "moduleType" (js-obj "valueType" "item"))
                   "items"      itemsArray))
         (.configureFromDOM myExhibit)
-        (aset js/window "Exhibit3_Initialized" true)))))
+        (aset js/window "Exhibit3_Initialized" true)
+        ; rebind click event handler for `Timetable Builder` tab link
+        (js/setTimeout (fn []
+                         (.click $timetable-builder-tab-link
+                                 timetable-builder-tab-click-handler))
+                       3000)))))

 (defn- build-lessons-map-from-module-timetable
   "Builds a Clojure Map representation of a module's lessons used internally
@@ -417,14 +437,7 @@
                                                   "module-finder-sidebar")))

     (.click ($ :#timetable-builder-tab-link)
-            (fn []
-              (hide ($ :#module-finder))
-              (.removeClass (parent ($ :#module-finder-tab-link)) "active")
-              (.addClass (parent ($ :#timetable-builder-tab-link)) "active")
-              (show ($ :#timetable-builder))
-              (select2/shift-select2-container-to "module-finder-sidebar"
-                                                  "timetable-builder-controls")
-              (aset js/window "ActiveTab" TIMETABLE-TAB-INDEX)))
+            timetable-builder-tab-click-handler)

     ; Add module lesson groups from the hash of the url
     (let [urlHash (aget (aget js/document "location") "hash")]


Write helper functions for filtering and displaying comics

--- src/cljs/comic_reader/main.cljs
+++ src/cljs/comic_reader/main.cljs
@@ -42,6 +42,23 @@
                     #(r/comics-path
                       {:site (name (:id %))}))
                    site-list)]]))))
+
+(defn comic-buttons [site comic-list]
+  (map (id-btn-for-callback
+        (fn [item]
+          (r/read-path {:site site
+                        :comic (:id item)
+                        :chapter 1
+                        :page 1})))
+       comic-list))
+
+(defn filter-comics [cl-filter comic-list]
+  (if cl-filter
+    (let [filter-re (re-pattern cl-filter)]
+      (filter (fn [{:keys [name]}]
+                (re-find filter-re name))
+              comic-list))
+    comic-list))

 (defn comic-list []
   (let [site (rf/subscribe [:site])


fixes

fixes

--- src/cljs/tumblrsearch/core.cljs
+++ src/cljs/tumblrsearch/core.cljs
@@ -54,7 +54,9 @@
               ; 200 response - ok
               (put! ajax-chan {:error false
                                :search-term search-term
-                               :items (js->clj (.. % -response) :keywordize-keys true)})
+                               :items (filter
+                                        #(= (:type %) "photo")
+                                        (js->clj (.. % -response) :keywordize-keys true))})
               ; otherwise error
               (put! ajax-chan {:error true})))))

@@ -99,7 +101,7 @@
     om/IRenderState
     (render-state [this state]
       (dom/div nil
-               (dom/h1 nil "Tumblr Search")
+               (dom/h1 nil "Tumblr img Search")
                ; input
                (dom/input
                  #js {:type "text"
@@ -143,34 +145,36 @@
            (om/build-all
              item-view
              (->> (:current-items data)
-                  (filter #(= (:type %) "photo"))
-                  ((fn [items]
-                    (loop [is items coll [] idx 0 offsets (vec (repeat col-n 0))]
-                      (if (empty? is) coll
-                        (let [item  (first is)
-                              title (s/replace (:slug item)  #"-"  " ")
-                              photo (-> item :photos first :alt_sizes second)]
-                          (if (or (nil? (:height photo)) (nil? (:width photo)))
-                            ; nil size found - drop the image
-                            (recur (rest is) coll idx offsets)
-                            ; ok
-                            (let [offset-n    (mod idx col-n)
-                                  offset-x    (+ left-offset (* IMGSIZE offset-n))
-                                  offset-y    (offsets offset-n)
-                                  new-height  (int (* (:height photo) (/ IMGSIZE (:width photo))))
-                                  new-offsets (update-in offsets [offset-n] #(+ % new-height))
-                                  new-item {:index idx
-                                            :title title
-                                            :photo photo
-                                            :post_url (:post_url item)
-                                            :x offset-x
-                                            :y offset-y
-                                            }]
-                              (recur
-                                (rest is)
-                                (conj coll new-item)
-                                (inc idx)
-                                new-offsets)))))))))))))
+                  #(loop [items   %
+                          coll    []
+                          idx     0
+                          offsets (zipmap (range col-n) (repeat 0))]
+                     (if (empty? items) coll
+                       (let [item  (first items)
+                             title (s/replace (:slug item)  #"-"  " ")
+                             photo (-> item :photos first :alt_sizes second)]
+                         (if (or (nil? (:height photo)) (nil? (:width photo)))
+                           ; nil size found - drop the image
+                           (recur (rest items) coll idx offsets)
+                           ; ok
+                           (let [offset-n    (mod idx col-n)
+                                 offset      (apply min-key second offsets)
+                                 offset-x    (+ left-offset (* IMGSIZE (first offset)))
+                                 offset-y    (second offset)
+                                 new-height  (int (* (:height photo) (/ IMGSIZE (:width photo))))
+                                 new-offsets (update-in offsets [(first offset)] #(+ % new-height))
+                                 new-item {:index idx
+                                           :title title
+                                           :photo photo
+                                           :post_url (:post_url item)
+                                           :x offset-x
+                                           :y offset-y
+                                           }]
+                             (recur
+                               (rest itemss)
+                               (conj coll new-item)
+                               (inc idx)
+                               new-offsets)))))))))))

 ;; Loading ------------------------------------------------
@@ -274,10 +278,18 @@
       (when
         (and
           (= :loaded (:current-state @data))
-          (> 100
-            (- (.. js/document -body -offsetHeight)
-               (+ (.. js/window -innerHeight)
-                  (.. js/window -scrollY)))))
+          (let [body (.. js/document -body)
+                html  (.. js/document -documentElement)
+                height (max (.. body -scrollHeight)
+                            (.. body -offsetHeight)
+                            (.. html -clientHeight)
+                            (.. html -scrollHeight)
+                            (.. html -offsetHeight)
+                            )]
+            (> 100
+               (- height
+                  (+ (.. js/window -innerHeight)
+                     (.. js/window -scrollY))))))
         (om/transact! data #(assoc % :current-state :loading))
         (go (async-search @data ajax-chan))))))


Add backward compatibility for buddy.core.hmac namespace.

--- src/clojure/buddy/core/hmac.clj
+++ src/clojure/buddy/core/hmac.clj
@@ -13,157 +13,13 @@
 ;; limitations under the License.

 (ns buddy.core.hmac
-  "Hash-based Message Authentication Codes (HMACs)"
-  (:require [buddy.core.codecs :refer :all]
-            [buddy.core.util :refer [concat-byte-arrays]]
-            [buddy.core.hash :refer [sha512]]
-            [clojure.java.io :as io])
-  (:import javax.crypto.Mac
-           javax.crypto.spec.SecretKeySpec
-           java.security.MessageDigest
-           java.util.Arrays))
+  "Hash-based Message Authentication Codes (HMACs)
+This namespace is now deprecated in favour of buddy.core.mac.hmac
+and mantained for backward comaptibility."
+  (:require buddy.core.mac.hmac))

-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Low level private function with all logic for make
-;; hmac for distinct types.
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(defmacro pullall [ns]
+  `(do ~@(for [i (map first (ns-publics ns))]
+           `(def ~i ~(symbol (str ns "/" i))))))

-(defn- make-hmac-for-plain-data
-  [^bytes data, pkey, ^String algorithm]
-  (let [bkey (->byte-array pkey)
-        sks  (SecretKeySpec. bkey algorithm)
-        mac  (Mac/getInstance algorithm)]
-    (.init mac sks)
-    (.doFinal mac data)))
-
-(defn- verify-hmac-for-plain-data
-  [^bytes data, ^bytes signature, pkey, ^String algorithm]
-  (let [sig (make-hmac-for-plain-data data pkey algorithm)]
-    (Arrays/equals sig signature)))
-
-(defn- make-hmac-for-stream
-  [^java.io.InputStream stream, pkey, ^String algorithm]
-  (let [bkey (->byte-array pkey)
-        sks  (SecretKeySpec. bkey algorithm)
-        bfr  (byte-array 5120)
-        mac  (Mac/getInstance algorithm)]
-    (.init mac sks)
-    (loop []
-      (let [readed (.read stream bfr 0 5120)]
-        (when-not (= readed -1)
-          (.update mac bfr 0 readed)
-          (recur))))
-    (.doFinal mac)))
-
-(defn- verify-hmac-for-stream
-  [^java.io.InputStream stream, ^bytes signature, pkey, ^String algorithm]
-  (let [sig (make-hmac-for-stream stream pkey algorithm)]
-    (Arrays/equals sig signature)))
-
-(defprotocol HMac
-  "Unified protocol for calculate a keyed-hash message.
-It comes with default implementations for bytes, String,
-InputStream, File, URL and URI."
-  (make-hmac [data key algorithm] "Calculate hmac for data using key and algorithm.")
-  (verify-hmac [data signature key algorithm] "Verify hmac for data using key and algorithm."))
-
-(alter-meta! #'make-hmac assoc :no-doc true :private true)
-(alter-meta! #'verify-hmac assoc :no-doc true :private true)
-
-(extend-protocol HMac
-  (Class/forName "[B")
-  (make-hmac [^bytes data ^String key ^String algorithm]
-    (make-hmac-for-plain-data data key algorithm))
-  (verify-hmac [^bytes data ^bytes signature ^String key ^String algorithm]
-    (verify-hmac-for-plain-data data signature key algorithm))
-
-  java.lang.String
-  (make-hmac [^String data ^String key ^String algorithm]
-    (make-hmac-for-plain-data (->byte-array data) key algorithm))
-  (verify-hmac [^String data ^bytes signature ^String key ^String algorithm]
-    (verify-hmac-for-plain-data (->byte-array data) signature key algorithm))
-
-  java.io.InputStream
-  (make-hmac [^java.io.InputStream data ^String key ^String algorithm]
-    (make-hmac-for-stream data key algorithm))
-  (verify-hmac [^java.io.InputStream data ^bytes signature ^String key ^String algorithm]
-    (verify-hmac-for-stream data signature key algorithm))
-
-  java.io.File
-  (make-hmac [^java.io.File data ^String key ^String algorithm]
-    (make-hmac-for-stream (io/input-stream data) key algorithm))
-  (verify-hmac [^java.io.File data ^bytes signature ^String key ^String algorithm]
-    (verify-hmac-for-stream (io/input-stream data) signature key algorithm))
-
-  java.net.URL
-  (make-hmac [^java.net.URL data ^String key ^String algorithm]
-    (make-hmac-for-stream (io/input-stream data) key algorithm))
-  (verify-hmac [^java.net.URL data ^bytes signature ^String key ^String algorithm]
-    (verify-hmac-for-stream (io/input-stream data) signature key algorithm))
-
-  java.net.URI
-  (make-hmac [^java.net.URI data ^String key ^String algorithm]
-    (make-hmac-for-stream (io/input-stream data) key algorithm))
-  (verify-hmac [^java.net.URI data ^bytes signature ^String key ^String algorithm]
-    (verify-hmac-for-stream (io/input-stream data) signature key algorithm)))
-
-(defn- make-salted-hmac
-  "Generic function that implement salted variant
-of keyed-hash message authentication code (hmac).
-This is a low level function and always return bytes."
-  [data ^String key salt ^String algorithm]
-  (let [key (concat-byte-arrays (->byte-array key)
-                                (->byte-array salt))]
-    (make-hmac data (sha512 key) algorithm)))
-
-(defn- verify-salted-hmac
-  [data ^bytes signature ^String key salt ^String algorithm]
-  (let [key (concat-byte-arrays (->byte-array key)
-                                (->byte-array salt))]
-    (verify-hmac data signature (sha512 key) algorithm)))
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; High level interface
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-(defn hmac
-  [data ^String key ^String algorithm]
-  (make-hmac data key algorithm))
-
-(defn hmac-verify
-  [data ^bytes signature ^String key ^String algorithm]
-  (verify-hmac data signature key algorithm))
-
-(defn shmac
-  "Generic function that exposes a high level
-interface for salted variant of keyed-hash message
-authentication code algorithm."
-  [data, key, salt, ^String algorithm]
-  (make-salted-hmac data key salt algorithm))
-
-(defn shmac-verify
-  "Generic function that exposes a high level
-interface for salted variant of keyed-hash message
-authentication code verification algorithm."
-  [data ^bytes signature ^String key ^String salt ^String algorithm]
-  (verify-salted-hmac data signature key salt algorithm))
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Most used aliases
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-;; Alias for hmac + sha2 hash algorithms
-(def hmac-sha256 #(hmac %1 %2 "HmacSHA256"))
-(def hmac-sha384 #(hmac %1 %2 "HmacSHA384"))
-(def hmac-sha512 #(hmac %1 %2 "HmacSHA512"))
-(def hmac-sha256-verify #(hmac-verify %1 %2 %3 "HmacSHA256"))
-(def hmac-sha384-verify #(hmac-verify %1 %2 %3 "HmacSHA384"))
-(def hmac-sha512-verify #(hmac-verify %1 %2 %3 "HmacSHA512"))
-
-;; Alias for salted hmac + sha2 hash algorithms
-(def shmac-sha256 #(shmac %1 %2 %3 "HmacSHA256"))
-(def shmac-sha384 #(shmac %1 %2 %3 "HmacSHA384"))
-(def shmac-sha512 #(shmac %1 %2 %3 "HmacSHA512"))
-(def shmac-sha256-verify #(shmac-verify %1 %2 %3 %4 "HmacSHA256"))
-(def shmac-sha384-verify #(shmac-verify %1 %2 %3 %4 "HmacSHA384"))
-(def shmac-sha512-verify #(shmac-verify %1 %2 %3 %4 "HmacSHA512"))
+(pullall buddy.core.mac.hmac)


Bug fix for using one-arg version of register-dep.

--- src/clojure/freactive/core.cljc
+++ src/clojure/freactive/core.cljc
@@ -19,19 +19,21 @@
        (-get-binding-fns [this]))

      (def ^:private iwatchable-binding-fns
-       (BindingInfo. cljs.core/-deref cljs.core/-add-watch cljs.core/-remove-watch nil))
+       (BindingInfo. cljs.core/-deref cljs.core/-add-watch cljs.core/-remove-watch (fn [])))

      (defn get-binding-fns [iref]
-       (if (satisfies? IReactive iref)
-         (-get-binding-fns iref)
-         iwatchable-binding-fns))
+       (cond (satisfies? IReactive iref)
+             (-get-binding-fns iref)
+             (and (satisfies? IDeref iref) (satisfies? IWatchable iref))
+             iwatchable-binding-fns))

      (def ^:dynamic *register-dep* nil)

      (defn register-dep
        ([dep]
         (when-let [rdep *register-dep*]
-          (rdep (goog/getUid dep) (get-binding-fns dep))))
+          (when-let [binding-fns (get-binding-fns dep)]
+            (rdep dep (goog/getUid dep) binding-fns))))
        ([dep id binding-info]
         (when-let [rdep *register-dep*]
           (rdep dep id binding-info)))))
@@ -206,7 +208,8 @@
         (set! dirty true)
         (clean-fn this))))
   (updateChild [this key f args]
-    (binding [*change-ks* [key]]
+    (binding [*change-ks* ;; TODO: (conj *change-ks* key)
+              [key]]
       (apply swap-fn this update key f args))
     this)
   (assocChild [this key val]


[Add] condition

[Add] condition

--- src/clj_elm/core.clj
+++ src/clj_elm/core.clj
@@ -9,7 +9,8 @@
 (defn sign
   "The signum function for a real number x."
   ([x]
-   {:pre [(number? x)]}
+   {:pre [(number? x)]
+    :post [(< (Math/abs %) 2)]}
    (cond
      (> x 0) 1
      (= x 0) 0
@@ -87,7 +88,7 @@

 (defn train-model
   ([dataset L & {:keys [norm] :or {norm false}}]
-   ;; {:pre [(instance? DataSet dataset) (integer? L)]}
+   {:pre [(instance? DataSet dataset) (integer? L)]}
    (let [normf (if norm data/normalize identity)
          d (data/num-of-feature dataset)
          ass (make-ass d L)
@@ -142,7 +143,7 @@

 (defn select-count
   ([cond coll]
-   {:pre [(coll? coll)]}
+   {:pre [(fn? cond) (coll? coll)]}
    (count (filter cond coll))))

 (defn _cross-validate


Fix cross-varidate.

Fix cross-varidate.

--- src/clj_elm/core.clj
+++ src/clj_elm/core.clj
@@ -132,7 +132,7 @@
                        eva))))))

 (defn ^Number cross-validate
-  ([^DataSet dataset ^Integer k ^Integer L]
+  ([^DataSet dataset ^Integer L ^Integer k]
    {:pre [(instance? DataSet dataset) (integer? k) (integer? L)]}
    (let [norm-dataset (DataSet. (:classes dataset) (data/normalize (:features dataset)))
          numd (count (:classes norm-dataset)) ; number of data


Implemented working is-file-staged fn. TEST ALL PASSING AGAIN.

--- src/clj_git/core.clj
+++ src/clj_git/core.clj
@@ -33,7 +33,12 @@
        (filter is-file-modified)))

 (defn is-file-staged [filename]
-  false)
+  (let [head-tree (tree-to-files (:tree (commit (head))))
+        tree-entry      (->> head-tree (filter #(= (:name %) filename)) (first))
+        index-entry     (->> (read-index) (filter #(= (:name %) filename)) (first))
+        hash-from-head  (:hash tree-entry)
+        hash-from-index (:hash index-entry)]
+    (not= hash-from-head hash-from-index)))

 ; Creates a new commit object (and all required tree objects)
 ; from the current index


samples

samples

--- src/clojure/core.clj
+++ src/clojure/core.clj
@@ -190,7 +190,7 @@
                                   r {:spectral-inharmonicity spectral-inharmonicity
                                      :midi midi
                                      :f0 f0}]
-                              [idx r]))
+                              {(* idx SAMPLERATE) r}))
                               ;;(println "Magnitude Spectrum: " (pr-str (double->clojure spectrum block-size)))
                           )))))
                 s))


Don't make gurantees about the munged characters

--- src/grimoire/util.clj
+++ src/grimoire/util.clj
@@ -6,9 +6,9 @@
             [cemerick.url :refer [url-encode]]))

 (defn munge
-  "This is the munge function as used by the current version of Grimoire. Munges
-  the characters #\"[.?/]\" and nothing more. Should only be applied to
-  symbols. Namespaces, packages, groups and soforth need not be name munged."
+  "This is the munge function as used by the current version of
+  Grimoire. Should only be applied to symbols. Namespaces, packages,
+  groups and soforth need not be name munged."
   [s]
   (-> s
       (url-encode)


Fix output file extenstion if input file doesn't use .main.less extenstion

--- src/less4clj/core.clj
+++ src/less4clj/core.clj
@@ -175,11 +175,11 @@

 (defn less-compile-to-file [path target-dir relative-path options]
   (let [input-file (io/file path)
-        output-file (io/file target-dir (string/replace relative-path #"\.main\.less$" ".css"))
-        source-map-output (io/file target-dir (string/replace relative-path #"\.main\.less$" ".css.map"))
+        output-file (io/file target-dir (string/replace relative-path #"(\.main)?\.less$" ".css"))
+        source-map-output (io/file target-dir (string/replace relative-path #"(\.main)?\.less$" ".css.map"))
         {:keys [output source-map] :as result} (less-compile input-file options)]
     (when output
       (io/make-parents output-file)
-      (spit output-file (string/replace output #"(/\*# sourceMappingURL=.*)\.main\.css\.map( \*/)" "$1.css.map$2"))
+      (spit output-file (string/replace output #"(/\*# sourceMappingURL=.*)(\.main)?\.css\.map( \*/)" "$1.css.map$2"))
       (when source-map (spit source-map-output source-map)))
     result))


Re-enable validate-ackable

Re-enable validate-ackable

--- src/onyx/peer/task_lifecycle.clj
+++ src/onyx/peer/task_lifecycle.clj
@@ -210,8 +210,8 @@

 (defn tag-messages [task-type replica peer-replica-view id event]
   (if (= task-type :input)
-    (let [; _ (validate-ackable! peers event)
-          candidates (:acker-candidates @peer-replica-view)]
+    (let [candidates (:acker-candidates @peer-replica-view)
+          _ (validate-ackable! candidates event)]
       (assoc event
              :onyx.core/batch
              (map (fn [segment]


logging helpers

logging helpers

--- src/pc/admin/migrate_storage.clj
+++ src/pc/admin/migrate_storage.clj
@@ -115,12 +115,17 @@
     :data))

 (defn start-transaction-queue-consumer []
+  (reset! queue-consumer-interrupt false)
   (future (while (not @queue-consumer-interrupt)
+            (log/info "starting transaction loop")
             (loop [t (fetch-transaction)]
-              (when t
+              (when (seq t)
+                (log/infof "transacting %s" t)
                 (swap! popped-transactions conj t)
                 @(d/transact (pcd/conn) t)
-                (recur (fetch-transaction))))
+                (when-not @queue-consumer-interrupt
+                  (recur (fetch-transaction)))))
+            (log/info "no more transactions, sleeping for 100 ms")
             (Thread/sleep 100))))

 ;; sequence of events:


Turning off CSRF

Turning off CSRF

--- src/trumpet_server/site/elefant.clj
+++ src/trumpet_server/site/elefant.clj
@@ -10,4 +10,4 @@
            (route/not-found (slurp (io/resource "404.html"))))

 (def elefant-site
-  (wrap-defaults site site-defaults))+  (wrap-defaults site (assoc-in site-defaults [:security :anti-forgery] false))) ; Turn off CSRF


Fix bug introduced in previous commit.

Fix bug introduced in previous commit.

--- src/uxbox/ui/workspace/selrect.cljs
+++ src/uxbox/ui/workspace/selrect.cljs
@@ -48,20 +48,21 @@

 (defn shapes-selrect-render
   [own shapes]
-  (let [[width height x y] (sh/group-size-and-position shapes)]
-    (html
-     [:g.controls
-      [:rect {:x x :y y :width width :height height
-              :style {:stroke "black" :fill "transparent"
-                      :stroke-opacity "0.5"}}]
-      [:circle.top-left (merge default-selection-props
-                               {:cx x :cy y})]
-      [:circle.top-right (merge default-selection-props
-                                {:cx (+ x width) :cy y})]
-      [:circle.bottom-left (merge default-selection-props
-                                  {:cx x :cy (+ y height)})]
-      [:circle.bottom-right (merge default-selection-props
-                                   {:cx (+ x width) :cy (+ y height)})]])))
+  (when (seq shapes)
+    (let [[width height x y] (sh/group-size-and-position shapes)]
+      (html
+       [:g.controls
+        [:rect {:x x :y y :width width :height height
+                :style {:stroke "black" :fill "transparent"
+                        :stroke-opacity "0.5"}}]
+        [:circle.top-left (merge default-selection-props
+                                 {:cx x :cy y})]
+        [:circle.top-right (merge default-selection-props
+                                  {:cx (+ x width) :cy y})]
+        [:circle.bottom-left (merge default-selection-props
+                                    {:cx x :cy (+ y height)})]
+        [:circle.bottom-right (merge default-selection-props
+                                     {:cx (+ x width) :cy (+ y height)})]]))))

 (def ^:static shapes-selrect
   (mx/component


Don't clobber previously completed tasks when satisfying a new dependency.

--- src/overtone/deps.clj
+++ src/overtone/deps.clj
@@ -1,5 +1,5 @@
 (ns
-    ^{:doc "A basic dependency system for specifying the execution of
+    ^{:doc "A basic dependency system for specifying the execution of
            fns once dependencies have been met."
       :author "Sam Aaron & Jeff Rose"}
   overtone.deps
@@ -21,25 +21,22 @@
                          [task-deps task])])))

 (defn- satisfy*
-  [{:keys [satisfied tasks]} new-deps]
+  [{:keys [satisfied tasks completed]} new-deps]
   (let [satisfied (set/union satisfied new-deps)
-        [t-done t-todo]
-        (reduce
-          (fn [[done todo] [task-deps task]]
-                (if (set/superset? satisfied task-deps)
-                  (do
-                    (task)
-                    [(conj done [task-deps task]) todo])
-                  [done (conj todo [task-deps task])]))
-          [[] []]
-          tasks)]
+        execute-tasks (fn [[done todo] [task-deps task]]
+                        (if (set/superset? satisfied task-deps)
+                          (do
+                            (task)
+                            [(conj done [task-deps task]) todo])
+                          [done (conj todo [task-deps task])]))
+        [t-done t-todo] (reduce execute-tasks [completed []] tasks)]
     {:satisfied satisfied
-     :tasks t-todo
-     :completed t-done}))
+     :completed t-done
+     :tasks t-todo}))

-(defn on-deps
-  "Specify that a function should be called once one or more dependencies
-  have been satisfied. The function is run immediately if the deps have
+(defn with-deps
+  "Specify that a function should be called once one or more dependencies
+  have been satisfied. The function is run immediately if the deps have
   already been satisfied, otherwise it will run as soon as they are."
   [deps handler]
   (send-off deps* on-deps*


add optional debugging output

add optional debugging output

--- sample/src/sample/btree.clj
+++ sample/src/sample/btree.clj
@@ -28,11 +28,13 @@
   (valAt [this k not-found]
     (let [idx (loop [ks     (keys m)
                      lastki nil]
+                #_(println "LOOP1" lastki ks)
                 (if (not-empty ks)
                   (let [n   (count ks)
                         i   (int (/ n 2))
                         ki  (get (vec ks) i)
                         cmp (compare ki k)]
+                    #_(println "LOOP2" n i ki cmp)
                     (cond
                       (> cmp 0) (recur (take i ks)       (if (= kind :find-floor)   lastki ki))  ;; traverse left
                       (< cmp 0) (recur (drop (inc i) ks) (if (= kind :find-ceiling) lastki ki))  ;; traverse right


Update external_config.clj

Update external_config.clj

--- integration/dda/pallet/dda_managed_vm/app/external_config.clj
+++ integration/dda/pallet/dda_managed_vm/app/external_config.clj
@@ -75,6 +75,18 @@
                           :private-key (:gpg-private-key user)
                           :passphrase (:gpg-passphrase user)}}}}))

+(defn user-config-test []
+  (let [{:keys [user]} (ex-config user-config-path)
+        map {(keyword (-> (ex-config user-config-path) :user :name))
+             {:clear-password (-> (ex-config user-config-path) :user :password)}}]
+    (println (-> map :lukas))
+    (if (contains? user :shh)
+      (merge map {:ssh user})
+      (merge map {}))
+    (if (contains? user :gpg)
+      (merge map {:gpg user})
+      (merge map {}))))
+
 (defn vm-config []
   (let [file user-config-path]
    {:vm-user :myuser


renamed key to snakeoil

renamed key to snakeoil


fixed tests.

fixed tests.

--- jar-prslib/test/clj/sixsq/slipstream/prs/javawrapper_test.clj
+++ jar-prslib/test/clj/sixsq/slipstream/prs/javawrapper_test.clj
@@ -50,9 +50,9 @@

 (deftest test-comps-from-app
   (is (= 3 (count (comps-from-app app))))
-  (is (contains? (first (comps-from-app app)) :uri))
+  (is (contains? (first (comps-from-app app)) :module))
   (is (= "module/image1" (->> (comps-from-app app)
-                              (sort-by :uri)
+                              (sort-by :module)
                               (first)
-                              :uri)))
+                              :module)))
   )


Ensmallify the loading svg card

Ensmallify the loading svg card

--- test/cljs/comic_reader/ui_test.cljs
+++ test/cljs/comic_reader/ui_test.cljs
@@ -8,7 +8,8 @@
 (defcard-rg loading-card
   "## Loading
    This is the loading svg used everywhere on the site."
-  (ui/loading))
+  [:div {:style {"width" "4em"}}
+   (ui/loading)])

 (defcard-rg four-oh-four-card
   (ui/four-oh-four))


src/riemann/xymon.clj: xymon-batch: fixed docstring

--- src/riemann/xymon.clj
+++ src/riemann/xymon.clj
@@ -156,7 +156,7 @@
 (defn xymon-batch
   "
   Returns a function which accepts multiple events and send them to
-  xymon as 'combo' messages. Filters events without nil :state
+  xymon as 'combo' messages. Filters events with nil :state
   or :service.
   "
   [opts]


Fix another.

Fix another.

--- test/onyx/peer/multi_input_test.clj
+++ test/onyx/peer/multi_input_test.clj
@@ -105,16 +105,16 @@
    [:inc :out]])

 (defn inject-in-1-ch [event lifecycle]
-  {:core.async/chan in-1-chan})
+  {:core.async/chan in-chan-1})

 (defn inject-in-2-ch [event lifecycle]
-  {:core.async/chan in-2-chan})
+  {:core.async/chan in-chan-2})

 (defn inject-in-3-ch [event lifecycle]
-  {:core.async/chan in-3-chan})
+  {:core.async/chan in-chan-3})

 (defn inject-in-4-ch [event lifecycle]
-  {:core.async/chan in-4-chan})
+  {:core.async/chan in-chan-4})

 (defn inject-out-ch [event lifecycle]
   {:core.async/chan out-chan})


Add a test to cover the newly discovered nil case

--- test/re-frame/interceptor_test.cljs
+++ test/re-frame/interceptor_test.cljs
@@ -45,6 +45,20 @@
       (is (= (get-effect a :db)          ;; test after
              {:1 {:2 :4}})))))

+(deftest test-path-with-nil-db
+  (let [db  {:1 {:2 :target}}
+        p  (path [:1 :2])]    ;; a two level path
+
+    (let [b4 (-> (context [] [] db)
+                 ((:before p)))           ;; before
+          a (-> b4
+                (assoc-effect :db nil)   ;; <-- db becomes nil
+                ((:after p)))]           ;; after
+
+      (is (= (get-coeffect b4 :db))      ;; test before
+          :target)
+      (is (= (get-effect a :db)          ;; test after
+             {:1 {:2 nil}})))))

 (deftest test-db-handler-interceptor
   (let [event   [:a :b]


[fix 5981] fix "thank you" pop after every login

Signed-off-by: yenda <96f164ad4d9b2b0dacf8ebee2bb1eeb3aa69adf1@status.im>

--- src/status_im/accounts/core.cljs
+++ src/status_im/accounts/core.cljs
@@ -17,7 +17,7 @@
       (utils/show-popup
        (i18n/label :mainnet-is-default-alert-title)
        (i18n/label :mainnet-is-default-alert-text)
-       #(re-frame/dispatch [:accounts.ui/update-mainnet-warning-shown])))))
+       #(re-frame/dispatch [:accounts.ui/mainnet-warning-shown])))))

 (defn- chat-send? [transaction]
   (and (seq transaction)


update version

update version

--- kafka-clj/project.clj
+++ kafka-clj/project.clj
@@ -1,4 +1,4 @@
-(defproject kafka-clj "3.6.4-SNAPSHOT"
+(defproject kafka-clj "3.6.4"
   :description "fast kafka library implemented in clojure"
   :url "https://github.com/gerritjvv/kafka-fast"
   :license {:name "Eclipse Public License"


Desired data

Desired data

--- src/tango/export2.clj
+++ src/tango/export2.clj
@@ -110,12 +110,25 @@
 (def raw-xml-2
   (xml/parse (java.io.FileInputStream. "test/tango/examples/real-example.xml")))

+(def class-results [{:class-name "Disco Freestyle B-klass J Po"
+                     :result {:ajudicators [{:number 2}
+                                            {:number 4}
+                                            {:number 5}]
+                              :dances [{:name "X-Quick Forward"}
+                                       {:name "Quick"}]
+                              :result-array [{:dancer-number 30
+                                              :marks [true false true]}
+                                             {:dancer-number 31
+                                              :marks [true true true]}
+                                             {:dancer-number 32
+                                              :marks [false false true]}]}
+                       ])

 (defn fix-class [class]
   (clojure.walk/postwalk
     (fn [form]
       (cond
-        (= (:tag form) :Results) (merge form {:attrs   {:Qty 997}
+        (= (:tag form) :Results) (merge form {:attrs   {:Qty (inc (count (:content form)))}
                                               ;; TODO - ML fixar och noterar saknad data
                                               :content (conj (vec (:content form))
                                                              (xml/element :Result {:Round "Awsome"}))
@@ -128,7 +141,7 @@
     (fn [form]
       (cond
         (= (:tag form) :Class) (if (= (:Name (:attrs form))
-                                      "Disco Freestyle A-klass J Fl")
+                                      "Disco Freestyle B-klass J Po")
                                  (fix-class form)
                                  ;(xml/element :Class {:Name "Changed Class"})
                                  form)
@@ -163,4 +176,4 @@
 ;                          m))
 ;
 ;          :else form))
-;      cmp)))+;      cmp)))