delete badge evidences

delete badge evidences

--- src/clj/salava/badge/main.clj
+++ src/clj/salava/badge/main.clj
@@ -271,7 +271,7 @@
                      (select-multi-language-badge-content {:id (:badge_id my-badge)} (u/get-db ctx)))
         evidences (badge-evidences ctx badge-id)]
     (assoc my-badge :content content
-                    :evidences evidences)))
+      :evidences evidences)))

 (defn get-badge
@@ -438,11 +438,13 @@
     (if (badge-owner? ctx user-badge-id user-id)
       (let [data {:id          user-badge-id
                   :visibility   visibility
-                  :rating       rating}]
+                  :rating       rating}
+            evidences (badge-evidences ctx user-badge-id)]
         (if (and (private? ctx) (= "public" visibility))
           (throw+ {:status "error" :user-badge-id user-badge-id :user-id user-id :message "trying save badge visibilty as public in private mode"}) )
         (update-badge-settings! data (u/get-db ctx))
         (save-badge-tags! ctx tags user-badge-id)
+        (if-not (empty? evidences) (toggle-show-all-evidences! ctx user-badge-id 1 user-id ))
         (send-badge-info-to-obf ctx user-badge-id user-id)
         (badge-publish-update! ctx user-badge-id visibility)
         (if (or (= "internal" visibility) (= "public" visibility))
@@ -465,6 +467,13 @@
       {:status "success"})
     {:status "error"}))

+(defn delete-badge-evidences! [db badge-id user-id]
+  (if-let [evidences (select-user-badge-evidence {:user_badge_id badge-id} db)]
+    (when-not (empty? evidences)
+        (delete-all-badge-evidences! {:user_badge_id badge-id} db)
+        (doseq [evidence evidences
+                :let [name (str "evidence_id:"(:id evidence))]]
+          (delete-user-evidence-property! {:name name :user_id user-id} db)))))

 (defn delete-badge-with-db! [db user-badge-id]
   (delete-badge-tags! {:user_badge_id user-badge-id} db)
@@ -482,11 +491,14 @@
       [tr-cn (u/get-datasource ctx)]
       (do
         #_(db/delete-badge-endorsements ctx badge-id)
-        (delete-badge-with-db! {:connection tr-cn} badge-id)))
+        (delete-badge-with-db! {:connection tr-cn} badge-id)
+        (delete-badge-evidences! {:connection tr-cn} badge-id user-id)))
     (if (some #(= :social %) (get-in ctx [:config :core :plugins]))
       (so/delete-connection-badge-by-badge-id! ctx user-id badge-id ))
     {:status "success" :message "Badge deleted"}
-    (catch Object _ {:status "error" :message ""})))
+    (catch Object _
+      (log/error _)
+      {:status "error" :message ""})))

 (defn badges-images-names
   "Get badge images and names. Return a map."


display "no results"

display "no results"

--- src/cljs/crawler_ui/core.cljs
+++ src/cljs/crawler_ui/core.cljs
@@ -45,13 +45,15 @@
     (render [this]
       (dom/div nil
         (dom/h2 nil "Results")
-        (dom/table nil
-                   (dom/thead nil
-                              (dom/tr nil
-                                      (dom/th nil "Size")
-                                      (dom/th nil "Url")))
-                   (apply dom/tbody nil
-                          (om/build-all result-view (sort-by #(get % "name") (:results data)))))))))
+        (if-not (seq (:results data))
+          (dom/div nil "No results :(")
+          (dom/table nil
+                     (dom/thead nil
+                                (dom/tr nil
+                                        (dom/th nil "Size")
+                                        (dom/th nil "Url")))
+                     (apply dom/tbody nil
+                            (om/build-all result-view (sort-by #(get % "name") (:results data))))))))))

 (defn statistics-value-view [value owner]
   (reify


remove constants in favor of passed variables

--- src/cljs/ontheway/modern.cljs
+++ src/cljs/ontheway/modern.cljs
@@ -15,34 +15,26 @@
             [ontheway.mapquest :as mapquest]
             [ontheway.yelp :as yelp]))

-;; Bootstrap to setup leaflet/clojurescript lib, blade
+;; Setup
+
+;; bootstrap to setup leaflet/clojurescript lib, blade
 (blade/bootstrap)
-
-;; Declare constants
-
-;; (def tile-url "https://{s}.tiles.mapbox.com/v3/{id}/{z}/{x}/{y}.png")
-(def tile-url "http://server.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}")
-(def mappy (-> L (.map "mappy")))
-(def directions-layer (-> L (.layerGroup [])))
-(def biz-layer (-> L (.layerGroup [])))
-(def biz-layer-items (atom {}))
-(def autocompleteFrom (google.maps.places.Autocomplete.
-                       (dom/getElement "directions-from")))
-(def autocompleteTo (google.maps.places.Autocomplete.
-                     (dom/getElement "directions-to")))
-
-(def my-lat)
-(def my-lng)

 ;; set the more options collapser to not toggle
 (.collapse (js/$ ".collapse") {:toggle false})

-;; Allows handling Nodelist like a seq
+;; allows handling Nodelist like a seq
 (extend-type js/NodeList
   ISeqable
   (-seq [array] (array-seq array 0)))

 ;; Form fields
+
+(def autocompleteFrom (google.maps.places.Autocomplete.
+                       (dom/getElement "directions-from")))
+
+(def autocompleteTo (google.maps.places.Autocomplete.
+                     (dom/getElement "directions-to")))

 (defn from-query [lat lng]
   (if-let [node (.getPlace autocompleteFrom)]
@@ -152,6 +144,11 @@

 ;; Map configuration/alteration

+(def tile-url (str "http://server.arcgisonline.com"
+                   "/ArcGIS/rest/services/Canvas"
+                   "/World_Light_Gray_Base/MapServer/tile"
+                   "/{z}/{y}/{x}"))
+
 (defn setup-map [m lat lng]
   (-> m (.setView [lat lng] 12))
   (-> L (.tileLayer tile-url {:maxZoom 16 ;; this is the limitation of the tile
@@ -163,32 +160,32 @@
               [[(:sw-lat map-bounds) (:sw-lng map-bounds)]
                [(:ne-lat map-bounds) (:ne-lng map-bounds)]]))

-(defn add-numbered-marker [layer lat lng num]
+(defn add-numbered-marker [layer layer-items lat lng num]
   (let [NumberedDivIcon (.-NumberedDivIcon js/L)
         marker (-> L (.marker [lat, lng]
                               {:icon (NumberedDivIcon. {:number (str num)})})
                    (.on "click" #(aset js/window "location"
                                        (str "#" (section-id num)))))
         new-layer (.addLayer layer marker)]
-    (swap! biz-layer-items assoc num new-layer)))
-
-(defn add-numbered-marker-active [layer lat lng num]
+    (swap! layer-items assoc num new-layer)))
+
+(defn add-numbered-marker-active [layer layer-items lat lng num]
   (let [NumberedDivIconActive (.-NumberedDivIconActive js/L)
         marker (-> L (.marker [lat, lng]
                               {:icon (NumberedDivIconActive. {:number (str num)})})
                    (.on "click" #(aset js/window "location"
                                        (str "#" (section-id num)))))
         new-layer (.addLayer layer marker)]
-    (swap! biz-layer-items assoc num new-layer)))
-
-(defn remove-marker [layer num]
-  (let [marker (get @biz-layer-items num)]
-    (swap! biz-layer-items dissoc num)
+    (swap! layer-items assoc num new-layer)))
+
+(defn remove-marker [layer layer-items num]
+  (let [marker (get @layer-items num)]
+    (swap! layer-items dissoc num)
     (.removeLayer layer marker)))

 ;; Draw directions/markers

-(defn draw-directions [m directions]
+(defn draw-directions [m directions directions-layer]
   (let [{:keys [start-point end-point lines map-bounds]} directions
         start-circle (-> L (.circle (vec start-point) 8 {:color "green"}))
         end-circle (-> L (.circle (vec end-point) 8 {:color "red"}))
@@ -197,16 +194,16 @@
       (.addLayer directions-layer l))
     (.addTo directions-layer m)))

-(defn draw-yelp-markers [m numbered-biz]
+(defn draw-yelp-markers [m numbered-biz layer layer-items]
   (doseq [biz numbered-biz]
     (let [{:keys [id name url]} biz
           {:keys [latitude longitude]} (-> biz :location :coordinate)]
-      (add-numbered-marker biz-layer latitude longitude id)))
-  (.addTo biz-layer m))
+      (add-numbered-marker layer layer-items latitude longitude id)))
+  (.addTo layer m))

 ;; Yelp sidebar

-(defn create-biz-sidebar [start-point end-point numbered-biz]
+(defn create-biz-sidebar [start-point end-point numbered-biz layer layer-items]
   (dommy/append! (sel1 :#biz-container)
                  (biz-template start-point end-point numbered-biz))
   (doseq [biz numbered-biz]
@@ -219,25 +216,25 @@
       (go
        (while true
          (<! mouseover)
-         (remove-marker biz-layer id)
-         (add-numbered-marker-active biz-layer latitude longitude id)))
+         (remove-marker layer layer-items id)
+         (add-numbered-marker-active layer layer-items latitude longitude id)))
       (go
        (while true
          (<! mouseout)
-         (remove-marker biz-layer id)
-         (add-numbered-marker biz-layer latitude longitude id))))))
+         (remove-marker layer layer-items id)
+         (add-numbered-marker layer layer-items latitude longitude id))))))

 ;; Yelp/Directions setup

-(defn fetch-draw-directions [m to from transport-type category]
+(defn fetch-draw-directions [m to from transport-type directions-layer]
   (go
    (let [{:keys [lat-lngs start-point end-point map-bounds] :as directions}
          (<! (mapquest/directions to from transport-type))]
-     (draw-directions m directions)
+     (draw-directions m directions directions-layer)
      (reset-map m map-bounds)
      directions)))

-(defn draw-yelp-info [m directions category]
+(defn draw-yelp-info [m directions category layer layer-items]
   (go
    (let [{:keys [lat-lngs start-point end-point map-bounds]} directions]
      (let [numbered-biz (<! (yelp/find-and-rank-businesses
@@ -245,15 +242,18 @@
        (if (empty? numbered-biz)
          (dommy/append! (sel1 :#map-text-container) (no-biz-template))
          (do
-           (draw-yelp-markers m numbered-biz)
-           (create-biz-sidebar start-point end-point numbered-biz)
+           (draw-yelp-markers m numbered-biz layer layer-items)
+           (create-biz-sidebar start-point end-point numbered-biz layer layer-items)
            (expand-biz-sidebar)) ;; reduce map size to allow for biz sidebar
          (reset-map m map-bounds))))))

 ;; Full page rendering after button submit

-(defn setup-button-click [lat lng]
-  (let [clicks (u/listen (dom/getElement "btn-go") "click")]
+(defn setup-button-click [lat lng map]
+  (let [clicks (u/listen (dom/getElement "btn-go") "click")
+        directions-layer (-> L (.layerGroup []))
+        biz-layer (-> L (.layerGroup []))
+        biz-layer-items (atom {})]
     (go (while true
           ;; wait for a click
           (<! clicks)
@@ -277,9 +277,11 @@
                 from (from-query lat lng)
                 transport-type (transportation-query)
                 category (category-query)
-                directions (<! (fetch-draw-directions mappy to from
-                                                      transport-type category))]
-            (<! (draw-yelp-info mappy directions category))
+                directions (<! (fetch-draw-directions map to from
+                                                      transport-type
+                                                      directions-layer))]
+            (<! (draw-yelp-info map directions category
+                                biz-layer biz-layer-items))
             ;; stop loading spinner
             (stop-spinner)
             )))))
@@ -289,6 +291,7 @@
 (go
  (let [coords    (.-coords (<! (u/get-position)))
        latitude  (.-latitude coords)
-       longitude (.-longitude coords)]
-   (setup-map mappy latitude longitude)
-   (setup-button-click latitude longitude)))
+       longitude (.-longitude coords)
+       map (-> L (.map "mappy"))]
+   (setup-map map latitude longitude)
+   (setup-button-click latitude longitude map)))


No need for manual recursion anymore

No need for manual recursion anymore

--- src/clojure_ruby/evaluate.clj
+++ src/clojure_ruby/evaluate.clj
@@ -69,7 +69,5 @@
 (defn evaluate-all [stmts]
   (let [variables (atom {})]
     (core/register-global-variables variables)
-    (loop [stmts stmts]
-      (when-let [[stmt & stmts] stmts]
-        (evaluate variables stmt)
-        (recur stmts)))))
+    (doseq [stmt stmts]
+      (evaluate variables stmt))))


fix mutable cells (not sure what problem was

--- src/com/rpl/specter/impl.cljc
+++ src/com/rpl/specter/impl.cljc
@@ -315,12 +315,10 @@

 ;; cell implementation idea taken from prismatic schema library
 (defprotocol PMutableCell
-  (get_cell [cell])
   (set_cell [cell x]))

 (deftype MutableCell [^:volatile-mutable q]
   PMutableCell
-  (get_cell [this] q)
   (set_cell [this x] (set! q x)))

 (defn mutable-cell
@@ -331,7 +329,7 @@
   (set_cell cell val))

 (defn get-cell [cell]
-  (get_cell cell))
+  (field cell 'q))

 (defn update-cell! [cell afn]
   (let [ret (afn (get-cell cell))]


Naming.

Naming.

--- src/fm/simrunner/input.clj
+++ src/fm/simrunner/input.clj
@@ -10,7 +10,7 @@
     [fm.simrunner.gui.rendering :as rdg]))

 (defn- on-input [id {app-state :state :as app} & [_ value]]
-  (swap! app-state mod/update id value)
+  (swap! app-state mod/update-value id value)
   (rdg/render! app))

 (defn- handle-input? [{app-state :state}]


Defonce and privatize workflows.

Defonce and privatize workflows.

--- src/incise/deploy/core.clj
+++ src/incise/deploy/core.clj
@@ -3,7 +3,7 @@
             [taoensso.timbre :refer [fatal]])
   (:refer-clojure :exclude [get]))

-(def workflows (atom {}))
+(defonce ^:private workflows (atom {}))

 (defn get [& args]
   (apply clojure.core/get @workflows args))


Session still not fixed.

Session still not fixed.

--- src/kixi/hecuba/routes.clj
+++ src/kixi/hecuba/routes.clj
@@ -138,9 +138,11 @@

    ;; Main Application
    (GET (compojure-route :app) []
-        (friend/wrap-authorize
-         app-page
-         #{:kixi.hecuba.security/user}))
+        app-page
+        ;; (friend/wrap-authorize
+        ;;  app-page
+        ;;  #{:kixi.hecuba.security/user})
+        )

    ;; AMON API Routes
    (amon-api-routes store)


Rename result-type

Rename result-type

--- src/lt/objs/langs/clj.cljs
+++ src/lt/objs/langs/clj.cljs
@@ -402,7 +402,8 @@
                                                            :command :editor.eval.clj
                                                            :data {:code code
                                                                   :ns "user"
-                                                                  :meta {:result-type :pomegranate}}}))))
+                                                                  :meta {:result-type :dependencies}}}))))
+
 (object/behavior* ::depend-on
                   :triggers #{:depend-on+}
                   :reaction (fn [this other-deps & this-deps]


Update instance types

Update instance types

--- src/maestro/validators.clj
+++ src/maestro/validators.clj
@@ -42,19 +42,20 @@
     "c3.8xlarge"
     "c3.large"
     "c3.xlarge"
-    "c4.large"
-    "c4.xlarge"
     "c4.2xlarge"
     "c4.4xlarge"
     "c4.8xlarge"
+    "c4.large"
+    "c4.xlarge"
     "cc2.8xlarge"
     "cg1.4xlarge"
     "cr1.8xlarge"
-    "d2.xlarge"
     "d2.2xlarge"
     "d2.4xlarge"
     "d2.8xlarge"
+    "d2.xlarge"
     "g2.2xlarge"
+    "g2.8xlarge"
     "hi1.4xlarge"
     "hs1.8xlarge"
     "i2.2xlarge"
@@ -65,14 +66,19 @@
     "m3.large"
     "m3.medium"
     "m3.xlarge"
+    "m4.10xlarge"
+    "m4.2xlarge"
+    "m4.4xlarge"
+    "m4.large"
+    "m4.xlarge"
     "r3.2xlarge"
     "r3.4xlarge"
     "r3.8xlarge"
     "r3.large"
     "r3.xlarge"
+    "t2.medium"
     "t2.micro"
-    "t2.small"
-    "t2.medium"})
+    "t2.small"})

 (defn allowed-instances
   [virtualisation-type]


*eval-fn* takes 1 arg

*eval-fn* takes 1 arg

--- src/main/cljs/cljs/js.cljs
+++ src/main/cljs/cljs/js.cljs
@@ -177,10 +177,9 @@
               *ns*             (:*ns* bound-vars)
               r/*data-readers* (:*data-readers* bound-vars)
               env/*compiler*   env]
-      (*eval-fn*
-        (with-out-str
-          (comp/emit (ana/analyze ana-env form nil opts)))
-        cb))))
+      (cb (*eval-fn*
+            (with-out-str
+              (comp/emit (ana/analyze ana-env form nil opts))))))))

 (defn eval
   ([env form cb] (eval env form nil cb))


more tweaks

more tweaks

--- src/main/cljs/cljs/js.cljs
+++ src/main/cljs/cljs/js.cljs
@@ -350,14 +350,15 @@
              (do
                (when (:source-map opts)
                  (let [t   (.valueOf (js/Date.))
-                       src (str "repl-" t ".cljs")]
+                       src (str "repl-" t ".cljs")
+                       smd @comp/*source-map-data*]
                    (.append sb
                      (str "\n//# sourceURL=repl-" t ".js"
                           "\n//# sourceMappingURL=data:application/json;base64,"
                           (base64/encodeString
                             (sm/encode
-                              {src (:source-map @comp/*source-map-data*)}
-                              {:lines (+ (:gen-line @comp/*source-map-data*) 3)
+                              {src (:source-map smd)}
+                              {:lines (+ (:gen-line smd) 3)
                                :file (str "repl-" t ".js")
                                :sources-content [(or (:source (meta form))
                                                      ;; handle strings / primitives without metadata


normalize :type to a keyword

normalize :type to a keyword

--- src/matross/tasks/core.clj
+++ src/matross/tasks/core.clj
@@ -1,6 +1,6 @@
 (ns matross.tasks.core)

-(defmulti get-task :type)
+(defmulti get-task #(keyword (:type %1)))

 (defrecord TaskResult [succeeded? changed? data])


Partition admin checklist steps into groups :pineapple:

--- src/metabase/api/setup.clj
+++ src/metabase/api/setup.clj
@@ -89,7 +89,9 @@
         (response-invalid :general (.getMessage e))))))

-(defn- admin-checklist []
+;;; Admin Checklist
+
+(defn- admin-checklist-values []
   (let [has-dbs?           (db/exists? Database)
         has-dashboards?    (db/exists? 'Dashboard)
         has-pulses?        (db/exists? 'Pulse)
@@ -101,44 +103,53 @@
         num-cards          (db/select-one-count 'Card)
         num-users          (db/select-one-count 'User)]
     [{:name        "Add a database"
+      :group       "Get connected"
       :description "TODO - Write something good here"
       :completed   has-dbs?
       :triggered   :always}
      {:name        "Set email credentials"
+      :group       "Get connected"
       :description "TODO - Write something good here"
       :completed   (email/email-configured?)
       :triggered   :always}
      {:name        "Set slack credentials"
+      :group       "Get connected"
       :description "TODO - Write something good here"
       :completed   (slack/slack-configured?)
       :triggered   :always}
      {:name        "Invite other users"
+      :group       "Get connected"
       :description "TODO - Write something good here"
-      :completed   (> num-users 1)
+      :completed   (>= num-users 1)
       :triggered   (or has-dashboards?
                        has-pulses?
-                       (> num-cards 5))}
+                       (>= num-cards 5))}
      {:name        "Hide tables"
+      :group       "Curate your data"
       :description "TODO - Write something good here"
       :completed   has-hidden-tables?
-      :triggered   (> num-tables 20)}
+      :triggered   (>= num-tables 20)}
      {:name        "Organize questions"
+      :group       "Curate your data"
       :description "TODO - Write something good here"
       :completed   (not has-labels?)
-      :triggered   (> num-cards 30)}
+      :triggered   (>= num-cards 30)}
      {:name        "Create metrics"
+      :group       "Curate your data"
       :description "TODO - Write something good here"
       :completed   has-metrics?
-      :triggered   (> num-cards 30)}
+      :triggered   (>= num-cards 30)}
      {:name        "Create segments"
+      :group       "Curate your data"
       :description "TODO - Write something good here"
       :completed   has-segments?
-      :triggered   (> num-cards 30)}
+      :triggered   (>= num-cards 30)}
      {:name        "Create getting started guide"
+      :group       "Curate your data"
       :description "TODO - Write something good here"
       :completed   false                               ; TODO - how do we determine this?
-      :triggered   (and (> num-cards 10)
-                        (> num-users 5))}]))
+      :triggered   (and (>= num-cards 10)
+                        (>= num-users 5))}]))

 (defn- add-next-step-info
   "Add `is_next_step` key to all the STEPS from `admin-checklist`.
@@ -156,11 +167,21 @@
                (or found-next-step? is-next-step?)
                more)))))

+(defn- partition-steps-into-groups
+  "Partition the admin checklist steps into a sequence of groups."
+  [steps]
+  (for [[{group-name :group}, :as tasks] (partition-by :group steps)]
+    {:name  group-name
+     :tasks tasks}))
+
+(defn- admin-checklist []
+  (partition-steps-into-groups (add-next-step-info (admin-checklist-values))))
+
 (defendpoint GET "/admin_checklist"
-  "Return a map of various \"admin checklist\" steps and whether they've been completed. You must be a superuser to see this!"
+  "Return various \"admin checklist\" steps and whether they've been completed. You must be a superuser to see this!"
   []
   (check-superuser)
-  (add-next-step-info (admin-checklist)))
+  (admin-checklist))

 (define-routes)


Add `run-server` reference to migration guide

--- src/org/httpkit/server.clj
+++ src/org/httpkit/server.clj
@@ -6,8 +6,10 @@
 ;;;; Ring server

 (defn run-server
-  "Starts Ring-compatible HTTP server and returns a nullary function that stops
-  the server."
+  "Starts (mostly*) Ring-compatible HTTP server and returns a nullary function
+  that stops the server.
+
+  * See http://http-kit.org/migration.html for differences."
   [handler {:keys [port thread ip max-body max-line worker-name-prefix queue-size]
             :or   {ip "0.0.0.0"  ; which ip (if has many ips) to bind
                    port 8090     ; which port listen incomming request


optimizing scope

optimizing scope

--- src/overtone/gui/scope.clj
+++ src/overtone/gui/scope.clj
@@ -1,12 +1,12 @@
 (ns overtone.gui.scope
-  (:import
+  (:import
     (java.awt Graphics Dimension Color BasicStroke)
     (java.awt.geom Rectangle2D$Float Path2D$Float)
-     (javax.swing JFrame JPanel)
+     (javax.swing JFrame JPanel)
     (com.sun.scenario.scenegraph JSGPanel SGText SGShape SGGroup SGTransform SGComponent
                                  SGAbstractShape$Mode)
      (com.sun.scenario.scenegraph.event SGMouseAdapter))
-  (:use
+  (:use
      [overtone.core event sc synth ugen util time-utils]
     clojure.set
     clojure.stacktrace)
@@ -17,7 +17,7 @@
 (defonce scope* (ref {:buf false
                       :buf-size 0
                       :bus 0
-                      :fps 15
+                      :fps 10
                       :status :off
                       :runner nil
                       :panel nil
@@ -37,48 +37,91 @@
   (defsynth scoper-outer [buf 0]
     (scope-out (sin-osc 200) buf))

-  (defsynth freq-scope-zero [in-bus 0 fft-buf 0 scope-buf 1
+;		// linear
+;	SynthDef("freqScope0", { arg in=0, fftbufnum=0, scopebufnum=1, rate=4, phase=1, dbFactor = 0.02;
+;		var signal, chain, result, phasor, numSamples, mul, add;
+;		mul = 0.00285;
+;		numSamples = (BufSamples.kr(fftbufnum) - 2) * 0.5; // 1023 (bufsize=2048)
+;		signal = In.ar(in);
+;		chain = FFT(fftbufnum, signal, hop: 0.75, wintype:1);
+;		chain = PV_MagSmear(chain, 1);
+;		// -1023 to 1023, 0 to 2046, 2 to 2048 (skip first 2 elements DC and Nyquist)
+;		phasor = LFSaw.ar(rate/BufDur.kr(fftbufnum), phase, numSamples, numSamples + 2);
+;		phasor = phasor.round(2); // the evens are magnitude
+;		ScopeOut.ar( ((BufRd.ar(1, fftbufnum, phasor, 1, 1) * mul).ampdb * dbFactor) + 1, scopebufnum);
+;	}).send(server);
+
+  (defsynth freq-scope-zero [in-bus 0 fft-buf 0 scope-buf 1
                              rate 4 phase 1 db-factor 0.02]
     (let [n-samples (* 0.5 (- (buf-samples fft-buf) 2))
           signal (in in-bus)
-          chain (pv-mag-smear (fft fft-buf signal 0.5 :hann) 1)
-          phas  (lf-saw (/ rate (buf-dur fft-buf)) phase n-samples (+ 2 n-samples))
-          phas (round phas 2)]
-      (scope-out (buf-rd 1 fft-buf phas 1 1) scope-buf))))
+          chain  (pv-mag-smear (fft fft-buf signal 0.75 :hann) 1)
+          phasor (+ (+ n-samples 2)
+                    (* n-samples
+                       (lf-saw (/ rate (buf-dur fft-buf)) phase)))
+          phasor (round phasor 2)]
+      (scope-out (* db-factor (ampdb (* 0.00285 (buf-rd 1 fft-buf phasor 1 1))))
+                 scope-buf))))
+
+;	// logarithmic
+;	SynthDef("freqScope1", { arg in=0, fftbufnum=0, scopebufnum=1, rate=4, phase=1, dbFactor = 0.02;
+;		var signal, chain, result, phasor, halfSamples, mul, add;
+;		mul = 0.00285;
+;		halfSamples = BufSamples.kr(fftbufnum) * 0.5;
+;		signal = In.ar(in);
+;		chain = FFT(fftbufnum, signal, hop: 0.75, wintype:1);
+;		chain = PV_MagSmear(chain, 1);
+;		phasor = halfSamples.pow(LFSaw.ar(rate/BufDur.kr(fftbufnum), phase, 0.5, 0.5)) * 2; // 2 to bufsize
+;		phasor = phasor.round(2); // the evens are magnitude
+;		ScopeOut.ar( ((BufRd.ar(1, fftbufnum, phasor, 1, 1) * mul).ampdb * dbFactor) + 1, scopebufnum);
+;	}).send(server);
+;
+;(def scope-buf (buffer 2048))
+
+;(defsynth mellow [out-bus 20 freq 440 len 20]
+;  (out out-bus
+;  (* (x-line:kr 0.8 0.01 len :free) 0.1
+;    (+ (sin-osc (/ freq 2))
+;       (rlpf (saw (+ freq (* (sin-osc 6) 6))) 440 0.2)))))
+;

 (if (connected?)
   (define-synths)
   (on :connected define-synths))

 (defonce x-array (int-array (:width @scope*)))
-(defonce _x-init (dotimes [i (:width @scope*)]
+(defonce _x-init (dotimes [i (:width @scope*)]
                    (aset x-array i i)))

 (defonce y-array (int-array (:width @scope*)))
-(defonce _y-init (dotimes [i (:width @scope*)]
+(defonce _y-init (dotimes [i (:width @scope*)]
                    (aset y-array i (/ (:height @scope*) 2))))

 (def X-PADDING 5)
 (def Y-PADDING 10)

 (defn- update-scope []
-  (let [frames (buffer-data (:buf @scope*))
-        step (int (/ (:buf-size @scope*) (:width @scope*)))
-        y-scale (/ (- (:height @scope*) (* 2 Y-PADDING)) 2)
-        y-shift (+ (/ (:height @scope*) 2) Y-PADDING)]
-    (doseq [x x-array]
-      (aset #^ints y-array x
-            (int (+ y-shift (* y-scale (aget #^floats frames (* x step))))))))
+  (let [{:keys [buf buf-size width height panel]} @scope*
+        frames (buffer-data (:buf @scope*))
+        step (int (/ buf-size width))
+        y-scale (/ (- height (* 2 Y-PADDING)) 2)
+        y-shift (+ (/ height 2) Y-PADDING)]
+    (dotimes [x width]
+      (aset #^ints y-array x
+            (int (+ y-shift
+                    (* y-scale
+                       (aget #^floats frames (unchecked-multiply x step))))))))
   (.repaint (:panel @scope*)))

 (defn- paint-scope [g]
-  (.setColor #^Graphics g #^Color (:background @scope*))
-  (.fillRect #^Graphics g 0 0 (:width @scope*) (:height @scope*))
-  (.setColor #^Graphics g #^Color (Color. 100 100 100))
-  (.drawRect #^Graphics g 0 0 (:width @scope*) (:height @scope*))
-
-  (.setColor #^Graphics g #^Color (:color @scope*))
-  (.drawPolyline #^Graphics g #^ints x-array #^ints y-array (int (:width @scope*))))
+  (let [{:keys [background width height color]} @scope*]
+    (.setColor #^Graphics g #^Color background)
+    (.fillRect #^Graphics g 0 0 width height)
+    (.setColor #^Graphics g #^Color (Color. 100 100 100))
+    (.drawRect #^Graphics g 0 0 width height)
+
+    (.setColor #^Graphics g #^Color color)
+    (.drawPolyline #^Graphics g #^ints x-array #^ints y-array width)))

 (defn- clean-scope []
   (dosync
@@ -86,34 +129,45 @@
       (buffer-free (:buf @scope*)))
     (if-let [s (:bus-synth @scope*)]
       (kill s))
-    (alter scope* assoc :buf nil :buf-size 0 :tmp-buf false
-           :bus nil :bus-synth nil)))
-
-(defn scope-buf
+    (alter scope* assoc :buf nil :buf-size 0 :tmp-buf false
+           :bus nil :bus-synth nil))
+  (dotimes [i (:width @scope*)]
+    (aset y-array i (/ (:height @scope*) 2)))
+  (.repaint (:panel @scope*)))
+
+(defn scope-buf
   "Set a buffer to view in the scope."
   [buf]
   (clean-scope)
-  (dosync (alter scope* assoc
+  (dosync (alter scope* assoc
                  :buf buf
                  :buf-size (count (buffer-data buf))))
   (update-scope))

 (defn- wait-for-buffer [b]
   (loop [i 0]
-    (cond
+    (cond
       (= 20 i) nil
-      (not (buffer-ready? b)) (do
+      (not (buffer-ready? b)) (do
                                 (java.lang.Thread/sleep 50)
                                 (recur (inc i))))))
+
+(def scope-bus-buf* (ref nil))

 (defn scope-bus
   "Set a bus to view in the scope."
   [bus]
   (clean-scope)
-  (let [buf (buffer 2048)
+  (let [buf (or @scope-bus-buf* (buffer 2048))
+        _ (println "buf: " buf)
         _ (wait-for-buffer buf)
-        bus-synth (bus->buf bus (:id buf))]; :target 0 :position :tail)]
-    (dosync (alter scope* assoc
+        bus-synth (bus->buf :target 0 :position :tail bus buf)]
+    (println "bus-synth: " bus-synth)
+    (if (not @scope-bus-buf*)
+      (dosync (ref-set scope-bus-buf* buf)))
+    (println "scope-bus-buf: " @scope-bus-buf*)
+    (dosync
+      (alter scope* assoc
                    :buf buf
                    :buf-size 2048
                    :bus bus
@@ -126,10 +180,12 @@
   )

 (defn scope-panel []
-  (let [p (proxy [JPanel] []
+  (let [p (proxy [JPanel] [true]
             (paint [g] (paint-scope g)))]
     (dosync (alter scope* assoc :panel p))
-    (.setMinimumSize p (Dimension. 600 400))
+    (doto p
+      ;(.setIgnoreRepaint true)
+      (.setMinimumSize (Dimension. 600 400)))
     p))

 (dotimes [i (:width @scope*)] (aset x-array i i))
@@ -143,8 +199,8 @@
       (.show))))

 (defn scope-on []
-  (dosync (alter scope* assoc
-                 :status :on
+  (dosync (alter scope* assoc
+                 :status :on
                  :runner (periodic update-scope (/ 1000 (:fps @scope*))))))

 (defn scope-off []
@@ -152,7 +208,7 @@
   (dosync (alter scope* assoc
                  :status :off
                  :runner nil)))
-
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Testing
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -162,7 +218,7 @@

 (defonce test-frame (JFrame. "scope"))
 (defonce test-panel (JSGPanel.))
-(defonce _test-scope (do
+(defonce _test-scope (do
              (.setPreferredSize test-panel (Dimension. 600 400))
              (.add (.getContentPane test-frame) test-panel)
              (.setScene test-panel (scope))
@@ -180,7 +236,7 @@

 (defn test-scope []
   (if (not (connected?))
-    (do
+    (do
       (boot)
       (on :examples-ready go-go-scope))
     (go-go-scope))


WIP comment

WIP comment

--- src/oxcart/core_redefs.clj
+++ src/oxcart/core_redefs.clj
@@ -28,6 +28,12 @@
                             deftype defprotocol extend-type
                             extend-protocol proxy]))

+
+;; FIXME:
+;;   This is currently dead code. Do I need a custom implementation of
+;;   ns? I don't think I do but I may... at present rather than using
+;;   a custom ns eval simply drops forms from ns. This may or may not
+;;   be a problem, so the below is retained.

 (defmacro oxcart.core-redefs/ns
   "Oxcart's alternative implementation of the ns macro. See


New function: read-components

New function: read-components

--- src/hurvinek/db_interface.clj
+++ src/hurvinek/db_interface.clj
@@ -172,3 +172,13 @@
                 (println e)
                 e))))

+(defn read-components
+    "Read list of all components for selected group."
+    [group-id]
+    (try
+        (jdbc/query db-spec/hurvinek-db
+                        ["select id, name from components where group_id=? order by name" group-id])
+        (catch Exception e
+            (println e)
+            nil)))
+


Remove unnecessary duplication

Remove unnecessary duplication

--- common/src/play_clj/global.clj
+++ common/src/play_clj/global.clj
@@ -15,7 +15,6 @@
     :width `(.getWidth (Gdx/graphics))
     :height `(.getHeight (Gdx/graphics))
     :is-fullscreen? `(.isFullscreen (Gdx/graphics))
-    :is-touched? `(.isTouched (Gdx/input))
     :x `(.getX (Gdx/input))
     :y `(.getY (Gdx/input))
     nil))
@@ -52,6 +51,6 @@

 (defmacro is-touched?
   ([]
-    `(game :is-touched?))
+    `(.isTouched (Gdx/input)))
   ([key]
-    `(and (game :is-touched?) ~(resolve-touch key))))
+    `(and (is-touched?) ~(resolve-touch key))))


whitespace

whitespace

--- test/babel/test/it.cljc
+++ test/babel/test/it.cljc
@@ -329,10 +329,10 @@

 (deftest casa-generate
   (let [result (generate {:synsem {:cat :noun
-                                               :agr {:number :sing}
-                                               :sem {:pred :house
-                                                     :mod '()
-                                                     :spec {:def :def}}}})]
+                                   :agr {:number :sing}
+                                   :sem {:pred :house
+                                         :mod '()
+                                         :spec {:def :def}}}})]
     (is (= (morph result) "la casa"))
     (is (= (get-in result [:synsem :sem :mod]) '()))))


fix flaky test

fix flaky test

--- test/java_time_test.clj
+++ test/java_time_test.clj
@@ -775,8 +775,9 @@
        (is (= 2018 (j/as year-month-under-test :year)))
        (is (= 3 (j/as year-month-under-test :month-of-year)))
        (is (thrown? Exception (j/as year-month-under-test :day-of-month))))
-      (let [zoned-date-time-test (j/zoned-date-time 2018 3)]
-       (is (= 1519830000 (j/as zoned-date-time-test :instant-seconds)))))
+      (let [zoned-date-time-test (j/with-clock (j/system-clock "UTC")
+                                   (j/zoned-date-time 2018 3))]
+       (is (= 1519862400 (j/as zoned-date-time-test :instant-seconds)))))

     (testing "multiple"
       (is (= [2015 1 1] (j/as (j/local-date 2015 1 1) :year :month-of-year :day-of-month))))


Add test for Turkish lower case issue

Add test for Turkish lower case issue

--- test/toucan/db_test.clj
+++ test/toucan/db_test.clj
@@ -1,5 +1,6 @@
 (ns toucan.db-test
-  (:require [expectations :refer :all]
+  (:require [clojure.java.jdbc :as jdbc]
+            [expectations :refer :all]
             [toucan
              [db :as db]
              [test-setup :as test]]
@@ -8,7 +9,8 @@
              [category :refer [Category]]
              [phone-number :refer [PhoneNumber]]
              [user :refer [User]]
-             [venue :refer [Venue]]]))
+             [venue :refer [Venue]]])
+  (:import java.util.Locale))

 ;; Test overriding quoting-style
 (expect
@@ -162,6 +164,23 @@
              :order-by [:id]
              :limit    1}))

+;; Test that identifiers are correctly lower cased in Turkish locale (#59)
+(expect
+  :id
+  (let [connection      (db/connection)
+        original-locale (Locale/getDefault)]
+    (try
+      (Locale/setDefault (Locale/forLanguageTag "tr"))
+      (jdbc/execute! connection "DROP TABLE IF EXISTS heroes")
+      (jdbc/execute! connection "CREATE TABLE heroes (\"ID\" SERIAL PRIMARY KEY, \"NAME\" VARCHAR(256))")
+      (jdbc/execute! connection "INSERT INTO heroes (\"NAME\") VALUES ('Batman')")
+      (let [first-row (first (db/query {:select [:ID] :from [:heroes]}))]
+        ;; If `db/query` (jdbc) uses `clojure.string/lower-case`, `:ID` will be converted to `:ıd` in Turkish locale
+        (first (keys first-row)))
+      (finally
+        (jdbc/execute! connection "DROP TABLE IF EXISTS heroes")
+        (Locale/setDefault original-locale)))))
+
 (defn- transduce-to-set
   "Process `reducible-query-result` using a transducer that puts the rows from the resultset into a set"
   [reducible-query-result]


Add XDMBinary type test

Add XDMBinary type test

--- test/uruk/core_test.clj
+++ test/uruk/core_test.clj
@@ -671,13 +671,16 @@
                                       return
                                       cts:polygon($points)"
                                {:shape :single!}))))))
-
-  ;; (testing "...XDM types"    ;; TODO
-  ;;   ;; FIXME
-
-  ;;   ;; XDMBinary
-  ;;   (comment (execute-xquery session "xquery version \"1.0-ml\"; xdmp:document-load(\"/path/to/mlfavicon.png\");")
-  ;;            (execute-xquery session "xquery version \"1.0-ml\"; doc(\"/path/to/mlfavicon.png\");")))
+
+  (testing "...XDM types"
+    (let [path-to-img "/path/to/resources/ml-favicon.png"] ;; FIXME path on your system
+      (testing "......XDMBinary"
+        (= (Class/forName "[B")
+           (.getClass (with-open [sess (create-session db)]
+                        (execute-xquery sess (str "xquery version \"1.0-ml\";
+                                                   xdmp:external-binary(\""
+                                                  path-to-img "\");")
+                                        {:shape :single!})))))))

   (testing "...XS types"
     (testing "......XSAnyURI"


complain when pixels haven't yet been calibrated

git-svn-id: 03a8048b5ee8463be5048a3801110fb50f378627@10521 d0ab736e-dc22-4aeb-8dc9-08def0aa14fd

--- plugins/SlideExplorer2/src/slide_explorer/main.clj
+++ plugins/SlideExplorer2/src/slide_explorer/main.clj
@@ -3,6 +3,7 @@
            (java.awt.geom AffineTransform Point2D$Double)
            (java.util.prefs Preferences)
            (java.util.concurrent Executors)
+           (javax.swing JOptionPane)
            (org.micromanager AcquisitionEngine2010 MMStudioMainFrame)
            (org.micromanager.utils ImageUtils JavaUtils)
            (org.micromanager.acquisition TaggedImageQueue))
@@ -71,9 +72,8 @@
   "Set the current location to the origin of the
    stage to pixel transform."
   []
-  (affine/set-destination-origin
-    (get-stage-to-pixel-transform)
-    (.getXYStagePosition mm/gui)))
+  (when-let [transform (get-stage-to-pixel-transform)]
+    (affine/set-destination-origin transform (.getXYStagePosition mm/gui))))

 (defn pixel-size-um
   "Compute the pixel size from a stage-to-pixel transform."
@@ -260,6 +260,18 @@
 (defn load-settings [dir]
   (read-string (slurp (io/file dir "metadata.txt"))))

+(defn pixels-not-calibrated []
+  (let [answer  (JOptionPane/showConfirmDialog
+                  nil
+                  "The current magnification setting needs to be calibrated.
+Would you like to run automatic pixel calibration?"
+                  "Pixel calibration required."
+                  JOptionPane/YES_NO_OPTION)]
+    (when (= answer JOptionPane/YES_OPTION)
+      (doto (eval '(org.micromanager.pixelcalibrator.PixelCalibratorPlugin.))
+        (.setApp (MMStudioMainFrame/getInstance));
+        .show))))
+
 ; Overall scheme
 ; the GUI is generally reactive.
 ; vars:
@@ -287,55 +299,57 @@
   "The main function that starts a slide explorer window."
   ([dir new?]
     (mm/load-mm (MMStudioMainFrame/getInstance))
-    (let [settings (if-not new? (load-settings dir) {:tile-dimensions [512 512]})
-          acquired-images (atom #{})
-          memory-tiles (tile-cache/create-tile-cache 200 dir (not new?))
-          [screen-state panel] (view/show memory-tiles settings)]
-      (when new?
-        (mm/core waitForDevice (mm/core getXYStageDevice))
-        (let [acq-settings (create-acquisition-settings)
-              affine-stage-to-pixel (origin-here-stage-to-pixel-transform)
-              z-origin (mm/core getPosition (mm/core getFocusDevice))
-              first-seq (acquire-at (affine/inverse-transform
-                                      (Point. 0 0) affine-stage-to-pixel)
-                                    z-origin
-                                    acq-settings)
-              explore-fn #(explore memory-tiles screen-state acquired-images
-                                   affine-stage-to-pixel)
-              stage (mm/core getXYStageDevice)]
-          (.mkdirs dir)
-          (def mt memory-tiles)
-          (def pnl panel)
-          (def affine affine-stage-to-pixel)
-          (user-controls/handle-double-click
-            panel
-            (partial navigate screen-state affine-stage-to-pixel))
-          (positions/handle-positions panel screen-state affine-stage-to-pixel)
-          (user-controls/handle-mode-keys panel screen-state)
-          (reactive/handle-update
-            current-xy-positions
-            (fn [_ new-pos-map]
-              (let [[x y] (new-pos-map (mm/core getXYStageDevice))
-                    pixel (affine/transform (Point2D$Double. x y)
-                                            affine-stage-to-pixel)]
-                (swap! screen-state assoc :xy-stage-position
-                       (affine/point-to-vector pixel)))))
-          (swap! screen-state merge
-                 {:acq-settings acq-settings
-                  :pixel-size-um (pixel-size-um affine-stage-to-pixel)
-                  :z-origin z-origin
-                  :slice-size-um 1.0
-                  :dir dir
-                  :mode :explore
-                  :channels (initial-lut-maps first-seq)
-                  :tile-dimensions [(mm/core getImageWidth)
-                                    (mm/core getImageHeight)]})
-          (add-watch screen-state "explore" (fn [_ _ old new] (when-not (= old new)
-                                                                (explore-fn))))
-          (explore-fn)))
-      (save-settings dir @screen-state)
-      (def ss screen-state)
-      (def ai acquired-images)))
+    (if (and new? (not (origin-here-stage-to-pixel-transform)))
+      (pixels-not-calibrated)
+      (let [settings (if-not new? (load-settings dir) {:tile-dimensions [512 512]})
+            acquired-images (atom #{})
+            memory-tiles (tile-cache/create-tile-cache 200 dir (not new?))
+            [screen-state panel] (view/show memory-tiles settings)]
+        (when new?
+          (mm/core waitForDevice (mm/core getXYStageDevice))
+          (let [acq-settings (create-acquisition-settings)
+                affine-stage-to-pixel (origin-here-stage-to-pixel-transform)
+                z-origin (mm/core getPosition (mm/core getFocusDevice))
+                first-seq (acquire-at (affine/inverse-transform
+                                        (Point. 0 0) affine-stage-to-pixel)
+                                      z-origin
+                                      acq-settings)
+                explore-fn #(explore memory-tiles screen-state acquired-images
+                                     affine-stage-to-pixel)
+                stage (mm/core getXYStageDevice)]
+            (.mkdirs dir)
+            (def mt memory-tiles)
+            (def pnl panel)
+            (def affine affine-stage-to-pixel)
+            (user-controls/handle-double-click
+              panel
+              (partial navigate screen-state affine-stage-to-pixel))
+            (positions/handle-positions panel screen-state affine-stage-to-pixel)
+            (user-controls/handle-mode-keys panel screen-state)
+            (reactive/handle-update
+              current-xy-positions
+              (fn [_ new-pos-map]
+                (let [[x y] (new-pos-map (mm/core getXYStageDevice))
+                      pixel (affine/transform (Point2D$Double. x y)
+                                              affine-stage-to-pixel)]
+                  (swap! screen-state assoc :xy-stage-position
+                         (affine/point-to-vector pixel)))))
+            (swap! screen-state merge
+                   {:acq-settings acq-settings
+                    :pixel-size-um (pixel-size-um affine-stage-to-pixel)
+                    :z-origin z-origin
+                    :slice-size-um 1.0
+                    :dir dir
+                    :mode :explore
+                    :channels (initial-lut-maps first-seq)
+                    :tile-dimensions [(mm/core getImageWidth)
+                                      (mm/core getImageHeight)]})
+            (add-watch screen-state "explore" (fn [_ _ old new] (when-not (= old new)
+                                                                  (explore-fn))))
+            (explore-fn)))
+        (save-settings dir @screen-state)
+        (def ss screen-state)
+        (def ai acquired-images))))
   ([]
     (go (io/file (str "tmp" (rand-int 10000000))) true)))


Simplify the cleanup indentation logic slightly

--- src/io/aviso/rook/swagger.clj
+++ src/io/aviso/rook/swagger.clj
@@ -40,7 +40,7 @@
     (= 1 (count lines))
     input

-    [lines' (mapv count-indentation (rest lines))
+    [lines' (mapv count-indentation lines)
      non-zero-indents (->> lines'
                            (map first)
                            (filter pos?))]
@@ -56,8 +56,6 @@

     :else
     (apply str
-           (first lines)
-           "\n"
            (interpose "\n"
                       (for [[indent line] lines']
                         (if (zero? indent)


let meta+click open menu

let meta+click open menu

--- src-cljs/frontend/controllers/controls.cljs
+++ src-cljs/frontend/controllers/controls.cljs
@@ -878,7 +878,7 @@
   (-> state
     (assoc-in [:pan :position] {:x x :y y})))

-(defn mouse-depressed-intents [state button ctrl? shift? outside-canvas?]
+(defn mouse-depressed-intents [state button ctrl? shift? meta? outside-canvas?]
   (let [tool (get-in state state/current-tool-path)
         drawing-text? (and (keyword-identical? :text tool)
                            (get-in state [:drawing :in-progress?]))]
@@ -891,6 +891,7 @@
        (keyboard/pan-shortcut-active? state) [:pan]
        (= button 2) [:open-radial]
        (and (= button 0) ctrl? (not shift?)) [:open-radial]
+       (and (= button 0) meta? (not shift?)) [:open-radial]
        (get-in state [:layer-properties-menu :opened?]) [:submit-layer-properties]
        (contains? #{:pen :rect :circle :line :select} tool) [:start-drawing]
        (and (keyword-identical? tool :text) (not drawing-text?)) [:start-drawing]
@@ -904,10 +905,10 @@
 (declare handle-text-layer-finished-after)

 (defmethod control-event :mouse-depressed
-  [browser-state message [x y {:keys [button type ctrl? shift? outside-canvas?]}] state]
+  [browser-state message [x y {:keys [button type ctrl? shift? meta? outside-canvas?]}] state]
   (if (empty? (:frontend-id-state state))
     state
-    (let [intents (mouse-depressed-intents state button ctrl? shift? outside-canvas?)
+    (let [intents (mouse-depressed-intents state button ctrl? shift? meta? outside-canvas?)
           new-state (-> state
                       (update-mouse x y)
                       (assoc-in [:mouse-down] true)
@@ -923,10 +924,10 @@
               new-state intents))))

 (defmethod post-control-event! :mouse-depressed
-  [browser-state message [x y {:keys [button ctrl? shift? outside-canvas?]}] previous-state current-state]
+  [browser-state message [x y {:keys [button ctrl? shift? meta? outside-canvas?]}] previous-state current-state]
   (when-not (empty? (:frontend-id-state previous-state))
     ;; use previous state so that we're consistent with the control-event
-    (let [intents (mouse-depressed-intents previous-state button ctrl? shift? outside-canvas?)]
+    (let [intents (mouse-depressed-intents previous-state button ctrl? shift? meta? outside-canvas?)]
       (doseq [intent intents]
         (case intent
           :finish-text-layer (handle-text-layer-finished-after previous-state current-state)
@@ -1020,7 +1021,7 @@
         (drop-layers)))))

 (defmethod post-control-event! :mouse-released
-  [browser-state message [x y {:keys [button type ctrl?]}] previous-state current-state]
+  [browser-state message [x y {:keys [button type ctrl? meta?]}] previous-state current-state]
   (let [cast! #(put! (get-in current-state [:comms :controls]) %)
         db           (:db current-state)
         was-drawing? (or (get-in previous-state [:drawing :in-progress?])
@@ -1035,6 +1036,7 @@
      (and (not= type "touchend")
           (not= button 2)
           (not (and (= button 0) ctrl?))
+          (not (and (= button 0) meta?))
           (get-in current-state [:radial :open?]))
      (cast! [:radial-closed])


Handling exceptions from view functions as 500 and finding matching error views.

--- src/main/clojure/plugboard/webfunction/plugboards.clj
+++ src/main/clojure/plugboard/webfunction/plugboards.clj
@@ -100,14 +100,25 @@
             content-type (:content-type cf) ; TODO: Add a bit of
                                         ; destructuring here.
             headers (merge (get-headers-from-webfn webfn)
-                           (get-in state [:response :headers]))
-            body (get-body status state req webfn content-type)]
-        (if (map? body)
-          {:status status :headers (merge headers (:headers body)) :body (:body body)}
-          {:status status :headers headers :body body}))
+                           (get-in state [:response :headers]))]
+        (try
+          (let [body (get-body status state req webfn content-type)]
+            (if (map? body)
+              {:status status :headers (merge headers (:headers body)) :body (:body body)}
+              {:status status :headers headers :body body}))
+          (catch Exception e
+            (let [status 500
+                  matching-webfns (filter (by-status status) webfns)]
+              (if-let [^ContentFunction cf (first matching-webfns)]
+                (let [body (get-body status (assoc state :exception e) req (:webfn cf) content-type)]
+                  (if (map? body)
+                    {:status status :headers (merge headers (:headers body)) :body (:body body)}
+                    {:status status :headers headers :body body}))
+                ;; Otherwise just rethrow
+                (throw e))))))
       ;; If there is no web-fn...
       {:status status
-       :headers (get-in state [:response :headers])
+       :headers (assoc (get-in state [:response :headers] "Content-Type" "text/html"))
        :body "
No webfunctions match request
"})))

 ;; This creates a handler that can be wrapped in ring middleware.
@@ -170,8 +181,8 @@
    (fn [state dlg] (= \/ (last (get-in state [:request :uri]))))
    plugboard/resource-moved-permanently?
    (fn [state dlg] [true
-                   (let [location (str (get-in state [:request :uri]) path)]
-                     (set-header state "Location" location))])})
+                    (let [location (str (get-in state [:request :uri]) path)]
+                      (set-header state "Location" location))])})

 (defn redirect-to-new-resource []
   {plugboard/redirect? (fn [state dlg] true)})


update old code for custom 'sel fields which is no longer needed.

--- src/metabase/api/result.clj
+++ src/metabase/api/result.clj
@@ -35,7 +35,7 @@
 ;; Returns the data response for a given query result as a CSV file
 (def query-result-csv
   (GET "/:id/csv" [id]
-    (let-404 [{:keys [result_data query_id] :as query-execution} (eval `(sel :one ~all-fields :id ~id))]
+    (let-404 [{:keys [result_data query_id] :as query-execution} (sel :one all-fields :id id)]
       ;; NOTE - this endpoint requires there to be a saved query associated with this execution
       (check-404 query_id)
       (let-404 [{{can_read :can_read name :name} :query} (hydrate query-execution :query)]


Remove unneeded (and circular) import

Remove unneeded (and circular) import

--- src/braid/core/client/ui/styles/thread.cljs
+++ src/braid/core/client/ui/styles/thread.cljs
@@ -3,7 +3,6 @@
    [braid.core.client.ui.styles.misc :refer [drag-and-drop]]
    [braid.core.client.ui.styles.mixins :as mixins]
    [braid.core.client.ui.styles.vars :as vars]
-   [braid.popovers.api :as popovers]
    [garden.arithmetic :as m]
    [garden.units :refer [px em rem]]))


login page cleanup

login page cleanup

--- src/cljs/swarmpit/component/page_login.cljs
+++ src/cljs/swarmpit/component/page_login.cljs
@@ -93,7 +93,7 @@
       {:className "Swarmpit-login-form-submit"
        :disabled  (not canSubmit?)
        :type      "submit"
-       :variant   "raised"
+       :variant   "contained"
        :fullWidth true
        :color     "primary"
        :onClick   #(login-handler local-state)} "Sign in")))
@@ -116,10 +116,15 @@
             [:img {:src    "img/swarmpit.png"
                    :width  "100%"
                    :height "100%"}])
+          (when (not-empty message)
+            (html
+              [:span {:style {:display    "flex"
+                              :alignItems "center"
+                              :color      "#d32f2f"
+                              :padding    20}}
+               icon/error message]))
           (html
-            [:form.Swarmpit-login-form {:key "Swarmpit-login-form"}
-             (when (not-empty message)
-               (comp/form-helper-text {:error true} message))
+            [:div.Swarmpit-login-form {:key "Swarmpit-login-form"}
              (form-username username local-state)
              (form-password password local-state)
              (form-button local-state)])))]]))


4clojure:: impl the trees-to-tables function: simulating the get-in map function

--- src/clojure_learning/4clojure-exercises.clj
+++ src/clojure_learning/4clojure-exercises.clj
@@ -2704,3 +2704,87 @@
 (reduction conj [1] [2 3 4])     ;; ([1] [1 2] [1 2 3] [1 2 3 4])
 (reduction + 0 '(1 2 3))

+;;;;;;;;;;;;;;;;;;;;;
+;; Happy Numbers
+;; Difficulty: Medium
+;; A Happy number is any number which when: split by digits, applying square on each digit
+;; and then sum the numbers and recursive going the next cycle again yields 1.
+;; A sad number is one that loops endesly.
+;; For example, 19 is happy, as the associated sequence is:
+;;     1**2 + 9**2 = 82
+;;     8**2 + 2**2 = 68
+;;     6**2 + 8**2 = 100
+;;     1**2 + 0**2 + 0**2 = 1.
+(defn happy-number?
+  ([x] (happy-number? x []))
+  ([x init]
+  (letfn [(pow-of-two [x] (reduce * [x x]))
+          (to-int [c] (- (int c) (int \0)))
+          (pow-and-sum
+            [digits]
+             (reduce +
+                (map (comp pow-of-two to-int) digits)))]
+    (let [curr (pow-and-sum (str x))]
+      (if-let [happy (= 1 curr)]
+        happy
+        (if (and ((comp not nil?) (last init)) (> curr (pow-of-two (last init))))
+          false
+          (recur (pow-and-sum (str curr)) (conj init curr))))))))
+
+;; notes: the init acc persists across the recursion the last pow-and-sum digit; if the digit starts
+;; and powers itself -> wrong path -> it is not a happy number, since it should be reduced not increased.
+;; we start from [0] to avoid nil checking and avoid incidental complexity for nil checking;
+;; once the recursion processed: 3 -> 9 -> 81; we store this in the acc and break the recursion if > (last acc) curr.
+
+(happy-number? 19) ;; true ;;  curr 100 ;; last-init 82
+(happy-number? 20) ;; false ;; curr 37  ;; last-init 4
+(happy-number? 7)  ;; true  ;; curr 130 ;; last-init 49
+(happy-number? 3)  ;; false
+(happy-number? 2)  ;; false
+(happy-number? 986543210)  ;; true
+
+;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Trees into tables
+;; Difficulty:	Easy
+;; Topics:	seqs maps
+;; Because Clojure's for macro allows you to "walk" over multiple sequences in a nested fashion,
+;; it is excellent for transforming all sorts of sequences.
+;; If you don't want a sequence as your final output (say you want a map), you are often
+;; still best-off using for, because you can produce a sequence and feed it into a map, for example.
+(for [x (range 1 3) y (range 5 7)] [x y]) ;; ([1 5] [1 6] [2 5] [2 6])
+
+;; (= (__ '{a {p 1, q 2}
+;;          b {m 3, n 4}})
+;;    '{[a p] 1, [a q] 2
+;;      [b m] 3, [b n] 4})
+
+;; solution:
+(defn trees-to-tables
+  [big-hash]
+  (letfn [(get-path [[key-entry m]]
+             (map (fn [x y z]
+                    [[x y] z])
+                  (repeat (count m) key-entry)
+                  (keys m)
+                  (vals m)))]
+    (into {} (apply
+                concat
+                  (map get-path big-hash)))))
+
+;; demo:
+(trees-to-tables '{a {p 1, q 2} b {m 3, n 4}})
+;; {[a p] 1, [a q] 2, [b m] 3, [b n] 4}
+
+;; refactoring -> using mapcat instead of [concat] + [map]
+(defn trees-to-tables
+  [big-hash]
+  (letfn [(get-path [[key-entry m]]
+             (map (fn [x y z]
+                    [[x y] z])
+                  (repeat (count m) key-entry)
+                  (keys m)
+                  (vals m)))]
+    (into {} (mapcat get-path big-hash))))
+
+
+(into {} '([[a p] 1] [[a q] 2])) ;; {[a p] 1, [a q] 2}


Work in progress!

Work in progress!

--- src/com/madeye/clojure/callgraph/loader.clj
+++ src/com/madeye/clojure/callgraph/loader.clj
@@ -35,7 +35,7 @@
       "C" (parse-class line)
       nil)))

-(defn- load-data
+(defn load-data
   [cgfile]
   (let [calldata (str/split-lines (slurp cgfile))]
     (map parse-line calldata)))
@@ -52,22 +52,50 @@
   [method-name]
   (CGMethod. method-name))

+(defn get-class-from-callgraph
+  [cg class-name]
+  (get (:classes cg) (keyword class-name)))
+
 (defn add-method-to-class
   [cgclass method-name]
   (if (not (contains? (:methods cgclass) method-name))
     (assoc cgclass :methods (assoc (:methods cgclass) (keyword method-name) (create-method method-name)))
     cgclass))

+(defn add-class-to-callgraph
+  [cg cgclass]
+  (assoc cg :classes (assoc (:classes cg) (keyword (:name cgclass)) cgclass)))
+
+(defn add-class-to-callgraph-if-not-exists
+  [cg cgclass]
+  (if (nil? (get-class-from-callgraph cg (:name cgclass)))
+    (assoc cg :classes (assoc (:classes cg) (keyword (:name cgclass)) cgclass))))
+
 (defn add-method-to-callgraph
-  [cg class-name method-name])
+  [cg class-name method-name]
+  (let [existing (get-class-from-callgraph cg class-name)]
+    (if (not (nil? existing))
+      (add-class-to-callgraph cg (add-method-to-class existing method-name))
+      (add-class-to-callgraph cg (add-method-to-class (create-class class-name) method-name)))))

-(defn add-class-to-callgraph
-  [cg class-name]
-  (if (not (contains? (:classes cg) class-name))
-    (assoc cg :classes (assoc (:classes cg) (keyword class-name) (create-class class-name)))))
+(defn- process-callgraph-class-row
+  [cg row]
+  (-> cg
+      (add-class-to-callgraph-if-not-exists (create-class (:src-class row)))
+      (add-class-to-callgraph-if-not-exists (create-class (:dest-class row)))))
+
+(defn- process-callgraph-method-row
+  [cg row]
+  cg)
+
+(defn process-callgraph-row
+  [cg row]
+  (case (:type row)
+    :class (process-callgraph-class-row cg row)
+    :method (process-callgraph-method-row cg row)))

 (defn parse-callgraph
   [cgfile]
   (let [data (load-data cgfile)
         class-names (clojure.set/union (set (map :dest-class data)) (set (map :src-class data)))]
-    (reduce #(add-class-to-callgraph %1 %2) (create-callgraph) class-names)))
+    (reduce #(add-class-to-callgraph %1 (create-class %2)) (create-callgraph) class-names)))


[#202] Improve implementation of clojure.core/range

--- priv/clojure/core.clj
+++ priv/clojure/core.clj
@@ -2841,15 +2841,15 @@
   start. When start is equal to end, returns empty list."
   {:added "1.0"
    :static true}
-  ([] (range 0 999999999999 1))
+  ([] (iterate inc 0))
   ([end] (range 0 end 1))
   ([start end] (range start end 1))
   ([start end step]
    (lazy-seq
-    (let [comp (cond (or (zero? step) (= start end)) not=
-                     (pos? step) <
-                     (neg? step) >)]
-      (when (comp start end)
+    (let [comp (cond (or (zero? step) (= start end)) (not= start end)
+                     (pos? step) (< start end)
+                     (neg? step) (> start end))]
+      (when comp
         (cons start
               (range (+ start step) end)))
       #_(loop [i start]


remove hardcoded uuid for cloud entry point; remove debugging statement

--- ssclj/jar/src/main/clojure/com/sixsq/slipstream/ssclj/resources/root.clj
+++ ssclj/jar/src/main/clojure/com/sixsq/slipstream/ssclj/resources/root.clj
@@ -60,7 +60,6 @@
   (try
     (a/can-modify? resource request)
     (let [ops [{:rel (:edit c/action-uri) :href resource-url}]]
-      (println "ROOT SETTING OPERATIONS ops" ops)
       (assoc resource :operations ops))
     (catch Exception e
       (dissoc resource :operations))))
@@ -76,13 +75,13 @@
   []
   (let [record (u/update-timestamps
                  {:acl         resource-acl
-                  :id          resource-url ;; TODO : special case id is given and resource is a "singleton"
+                  :id          resource-url
                   :resourceURI resource-uri})]
     (db/add resource-name record {:user-roles ["ANON"]})))

 (defn retrieve-impl
   [{:keys [base-uri] :as request}]
-  (r/response (-> (db/retrieve (str resource-url "/1") {})
+  (r/response (-> (db/retrieve resource-url {})
                   ;; (a/can-view? request)
                   (assoc :baseURI base-uri)
                   (merge resource-links)
@@ -94,7 +93,7 @@

 (defn edit-impl
   [{:keys [body] :as request}]
-  (let [current (-> (db/retrieve (str resource-url "/1") {})
+  (let [current (-> (db/retrieve resource-url {})
                     (assoc :acl resource-acl)
                     (a/can-modify? request))
         updated (-> body


[#124] Fix bug in main.clj

[#124] Fix bug in main.clj

--- priv/clojure/main.clj
+++ priv/clojure/main.clj
@@ -45,9 +45,8 @@
         clojure-fn? (and file (or (clojerl.String/ends_with.e file ".clj")
                                   (clojerl.String/ends_with.e file ".cljc")
                                   (= file "NO_SOURCE_FILE")))]
-    (str (if clojure-fn?
-           (demunge (module el))
-           (str (module el) "/" (function el)))
+    (str (if clojure-fn? (demunge (module el)) (module el))
+         "/" (function el)
          " (" (filename el) ":" (line-number el) ")")))

 ;;;;;;;;;;;;;;;;;;; end of redundantly copied from clojure.repl to avoid dep ;;;;;;;;;;;;;;
@@ -140,10 +139,9 @@
 (defn repl-caught
   "Default :caught hook for repl"
   [ex]
-  (let [tr (erlang/get_stacktrace.e)
-        el (when-not (zero? (count tr)) (nth tr 0))]
+  (let [tr (erlang/get_stacktrace.e)]
     (binding [*out* *err*]
-      (prn ex)
+      (println "Error:" ex)
       (doall (map #(-> % stack-element-str println) tr)))))

 (def ^{:doc "A sequence of lib specs that are applied to `require`


Fix boards infos in org response.

Fix boards infos in org response.

--- src/oc/storage/api/orgs.clj
+++ src/oc/storage/api/orgs.clj
@@ -241,7 +241,7 @@
                              org-id (:uuid org)
                              boards (board-res/list-boards-by-org conn org-id [:created-at :updated-at :authors :viewers :access :publisher-board :author :description])
                              boards-with-entries-count (map #(assoc % :total-count (entry-res/list-entries-by-board conn (:uuid %) {:count true})) boards)
-                             boards-with-last-entry-at (map #(assoc % :last-entry-at (:created-at (entry-res/last-entry-of-board conn (:uuid %)))) boards)
+                             boards-with-last-entry-at (map #(assoc % :last-entry-at (:created-at (entry-res/last-entry-of-board conn (:uuid %)))) boards-with-entries-count)
                              board-access (map #(board-with-access-level org % user) boards-with-last-entry-at)
                              allowed-boards (filter :access-level board-access)
                              author-access-boards (filter #(= (:access-level %) :author) board-access)


Validate Java version when booting up the env.


WIP; Modified stormspec in accordance with changes to conv-man from last commit

--- src/polismath/stormspec.clj
+++ src/polismath/stormspec.clj
@@ -26,50 +26,45 @@
 ;(matrix/matrix [[1 2 3] [4 5 6]])

-(defn create-and-run-base-system!
-  [config]
-  (->> config system/base-system (utils/apply-kwargs component/system-map) component/start))
-
-(storm/defspout poll-spout ["type" "zid" "batch"]
-  ;; Should fork timestamp key on type as well XXX
-  {:params [system-config type timestamp-key] :prepare true}
+(storm/defspout poll-spout ["message-type" "zid" "batch"]
+  ;; Should fork timestamp key on message-type as well XXX
+  {:params [system-config message-type timestamp-key] :prepare true}
   [conf context collector]
   (let [last-timestamp (atom 0)
         ;; Need config for storm to be set under keys of :vote and :mod, so the spouts are configurable
         ;; more simply from this; But I guess some of these things should maybe not be constructable this
         ;; way...
         ;system (-> system-config system/base-system component/system-map component/start)
-        {:as spout-config :keys [polling-interval]} (-> system-config :storm :spouts type)
-        system (create-and-run-base-system! system-config)
+        {:as spout-config :keys [polling-interval]} (-> system-config :storm :spouts message-type)
+        system (system/create-and-run-base-system! system-config)
         postgres (-> system :postgres)]
     (storm/spout
       (nextTuple []
-        (log/info "Polling" type ">" @last-timestamp)
-        (let [poll-function (get {:votes postgres/poll :moderation postgres/mod-poll} type)
+        (log/info "Polling" message-type ">" @last-timestamp)
+        (let [poll-function (get {:votes postgres/poll :moderation postgres/mod-poll} message-type)
               results (poll-function postgres @last-timestamp)
               grouped-batches (group-by :zid results)]
           ; For each chunk of votes, for each conversation, send to the appropriate spout
           (doseq [[zid batch] grouped-batches]
-            (storm/emit-spout! collector [type zid batch]))
+            (storm/emit-spout! collector [message-type zid batch]))
           ; Update timestamp if needed
           (swap! last-timestamp
                  (fn [last-ts] (apply max 0 last-ts (map timestamp-key results)))))
         (Thread/sleep polling-interval))
       (ack [id]))))

-;; XXX Should build a recompute trigger spout, which just sends a recompute message type with nil batch payload
+;; XXX Should build a recompute trigger spout, which just sends a recompute message message-type with nil batch payload

 (storm/defbolt conv-update-bolt []
   {:params [system-config] :prepare true}
   [conf context collector]
-  (let [system (create-and-run-base-system! system-config)
-        ;system (-> system-config system/base-system component/system-map component/start)
+  (let [system (system/create-and-run-base-system! system-config)
         conv-man (:conversation-manager system)]
     (storm/bolt
       (execute [tuple]
         (let [[message-type zid batch] (.getValues tuple)]
           ;; XXX Need to think more about recompute...
-          (cm/queue-message-batch! conv-man message-type zid batch (-> system-config :recompute)))
+          (cm/queue-message-batch! conv-man message-type zid batch))
         (storm/ack! collector tuple)))))

 (defn make-topology


cleanup

cleanup

--- src/babel/italiano/morphology.cljc
+++ src/babel/italiano/morphology.cljc
@@ -418,257 +418,239 @@

 ;; TODO: replace 'a' and 'b' with 'left' and 'right': latter easier to talk about
 (defn get-string [a & [ b ]]
-  (cond (and (nil? b)
-             (seq? a))
-        (let [result (get-string-1 a)]
-          (if (string? result)
-            (trim result)
-            result))
+  (let [a (if (nil? a) "" a)
+        b (if (nil? b) "" b)
+        a (get-string-1 a)
+        b (get-string-1 b)
+        info-a (log/debug (str "get-string: a: " a))
+        info-b (if b (log/debug (str "get-string: b: " b)))

-        true
-        (let [a (if (nil? a) "" a)
-              b (if (nil? b) "" b)
-              a (get-string-1 a)
-              b (get-string-1 b)
-              info-a (log/debug (str "get-string: a: " a))
-              info-b (if b (log/debug (str "get-string: b: " b)))
-
-              it-b (log/debug "it-a is string? " (string? (get-in a '(:italiano))))
-              it-b (log/debug "it-b is string? " (string? (get-in b '(:italiano))))
-
-              cat-a (log/debug (str "cat a:" (get-in a '(:cat))))
-              cat-b (log/debug (str "cat b:" (get-in b '(:cat))))
-
-              ]
-          (cond
-
-           (and (= a "gli")
-                (string? (get-in b '(:italiano)))
-                (not (or (re-find #"^[aeiou]" (get-in b '(:italiano)))
-                         (re-find #"^s[t]" (get-in b '(:italiano))))))
-           (trim (str "i " b))
-
-           (and (= a "i")
-                (string? (get-in b '(:italiano)))
-                (or (re-find #"^[aeiou]" (get-in b '(:italiano)))
-                    (re-find #"^s[t]" (get-in b '(:italiano)))))
-           (trim (str "gli " b))
-
-           (and (= a "il")
-                (string? b)
-                (or (re-find #"^[aeiou]" b)
-                    (re-find #"^s[t]" b)))
-           (trim (str "lo " b))
-
-           (and (= a "lo")
-                (string? b)
-                (not (or (re-find #"^[aeiou]" b)
-                         (re-find #"^s[t]" b))))
-           (trim (str "il " b))
-
-           ;; TODO: cleanup & remove.
-           (and false ;; going to throw out this logic: will use :initial and rule schemata instead.
-                (= :verb (get-in a '(:cat)))
-                (= :noun (get-in b '(:cat)))
-                (= :acc (get-in b '(:case))))
-           ;; flip order in this case:
-           ;; i.e. "vedo ti" => "ti vedo".
-           {:a (if (nil? b) :top b)
-            :b (if (nil? a) :top a)}
-
-           (and (string? a)
-                (= a "di")
-                (string? b)
-                (re-find #"^il (mio|tio|suo|nostro|vostro|loro)\b" b))
-           (str a " " (string/replace b #"^il " ""))
-
-           (and (string? a)
-                (= a "di")
-                (string? b)
-                (re-find #"^la (mia|tia|sua|nostra|vostra|loro)\b" b))
-           (str a " " (string/replace b #"^la " ""))
-
-           (and (string? a)
-                (= a "di")
-                (string? b)
-                (re-find #"^i (miei|tuoi|suoi|nostri|vostri|loro)\b" b))
-           (str a " " (string/replace b #"^i " ""))
-
-           (and (string? a)
-                (= a "di")
-                (string? b)
-                (re-find #"^le (mie|tue|sue|nostre|vostre|loro)\b" b))
-           (str a " " (string/replace b #"^le " ""))
-
-           (and (= a "di i")
-                (string? b)
-                (re-find #"^[aeiou]" b))
-           (str "degli " b)
-
-           (and (= a "di i")
-                (string? b)
-                (re-find #"^s[t]" b))
-           (str "degli " b)
-
-           (and (= a "di i")
-                (string? b))
-           (str "dei " b)
-
-           (and (= (get-in a '(:italiano)) "di i")
-                (string? b))
-           (str "dei " b)
-
-           (and (= (get-in a '(:italiano)) "di i")
-                (string? (get-in b '(:italiano))))
-           (str "dei " (get-string-1 (get-in b '(:italiano))))
-
-           (and (= a "di il")
-                (string? b))
-           (get-string "del" b)  ;; allows this to feed next rule:
-
-           (and (= a "del")
-                (string? b)
-                (re-find #"^[aeiou]" b))
-           (str "dell'" b)
-
-           (and (= a "di la")
-                (string? b))
-           (get-string "della" b) ;; allows this to feed next rule:
-
-           (and (= a "della")
-                (string? b)
-                (re-find #"^[aeiou]" b))
-           (str "dell'" b)
-
-           (and (= a "di le")
-                (string? b))
-           (str "delle " b)
-
-           (and (= a "i")
-                (string? b)
-                (re-find #"^[aeiou]" b))
-           (str "gli " b)
-
-           (and (= a "i")
-                (string? (get-in b '(:italiano)))
-                (re-find #"^[aeiou]" (get-in b '(:italiano))))
-           (str "gli " b)
-
-           (and (= a "i")
-                (string? b)
-                (re-find #"^s[t]" b))
-           (str "gli " b)
-
-           (and (= a "ci")
-                (string? b)
-                (re-find #"^[eè]" b))
-           (str "c'" b)
-
-           ;; handle e.g. "io lo ho visto" => "io l'ho visto"
-           (and (string? a)
-                (re-find #"^l[ao]$" a)
-                (string? b)
-                (re-find #"^[aeiouh]" b))
-           (str "l'" b)
-
-           ;; 4) handle e.g. "aiutari + ti" => "aiutarti"
-           (and (string? a)
-                (or (re-find #"are$" a)
-                    (re-find #"ere$" a)
-                    (re-find #"ire$" a))
-                (or (= b "ci")
-                    (= b "mi")
-                    (= b "la")
-                    (= b "le")
-                    (= b "li")
-                    (= b "lo")
-                    (= b "ti")
-                    (= b "vi")))
-           (str (string/replace a #"[e]$" "")
-                b)
-
-           (and (= a "un")
-                (string? b)
-                (re-find #"^s[t]" b))
-           (str "uno " b)
-
-           (and (= a "una")
-                (string? b)
-                (re-find #"^[aeiou]" b))
-           (str "un'" b)
-
-           (and (= a "il")
-                (string? b)
-                (re-find #"^[aeiou]" b))
-           (str "l'" b)
-
-           (and (= a "il")
-                (string? b)
-                (re-find #"^s[ct]" b))
-           (str "lo " b)
-
-           (and (= a "la")
-                (string? b)
-                (re-find #"^[aeiou]" b))
-           (str "l'" b)
-
-           (and (= a "quell[ao]")
-                (string? b)
-                (re-find #"^[aeiou]" b))
-           (str "quell'" b)
-
-           (and (= a "quelli")
-                (string? b)
-                (re-find #"^(st|sc|[aeiou])" b))
-           (str "quegli " b)
-
-           (and (= a "quest[aeio]")
-                (string? b)
-                (re-find #"^[aeiou]" b))
-           (str "quest'" b)
-
-           ;; prepositional phrases
-           (and (= a "a")
-                (string? b)
-                (re-find #"^il " b))
-           (str "al " (string/replace b #"^il " ""))
-
-           (and (= a "a")
-                (string? b)
-                (re-find #"^i " b))
-           (str "ai " (string/replace b #"^i " ""))
-
-           (and (= a "a")
-                (string? b)
-                (re-find #"^le " b))
-           (str "alle " (string/replace b #"^le " ""))
-
-           (and (= a "a")
-                (string? b)
-                (re-find #"^la " b))
-           (str "alla " (string/replace b #"^la " ""))
-
-           (and (string? a) (string? b))
-           (trim (str a " " b))
-
-           (and (string? a) (string? (get-in b '(:italiano))))
-           (trim (str a " " (get-in b '(:italiano))))
-
-           (and (string? (get-in a '(:italiano)))
-                (string? b))
-           (trim (str (get-in a '(:italiano)) " " b))
-
-           (and (string? a)
-                (map? b))
-           (trim (str a " .."))
-
-           (and (string? b)
-                (map? a))
-           (trim (str " .." b))
-
-           true
-           {:a (if (nil? a) :top a)
-            :b (if (nil? b) :top b)}))))
+        it-b (log/debug "it-a is string? " (string? (get-in a '(:italiano))))
+        it-b (log/debug "it-b is string? " (string? (get-in b '(:italiano))))
+
+        cat-a (log/debug (str "cat a:" (get-in a '(:cat))))
+        cat-b (log/debug (str "cat b:" (get-in b '(:cat))))
+
+        ]
+    (cond
+
+      (and (= a "gli")
+           (string? (get-in b '(:italiano)))
+           (not (or (re-find #"^[aeiou]" (get-in b '(:italiano)))
+                    (re-find #"^s[t]" (get-in b '(:italiano))))))
+      (trim (str "i " b))
+
+      (and (= a "i")
+           (string? (get-in b '(:italiano)))
+           (or (re-find #"^[aeiou]" (get-in b '(:italiano)))
+               (re-find #"^s[t]" (get-in b '(:italiano)))))
+      (trim (str "gli " b))
+
+      (and (= a "il")
+           (string? b)
+           (or (re-find #"^[aeiou]" b)
+               (re-find #"^s[t]" b)))
+      (trim (str "lo " b))
+
+      (and (= a "lo")
+           (string? b)
+           (not (or (re-find #"^[aeiou]" b)
+                    (re-find #"^s[t]" b))))
+      (trim (str "il " b))
+
+      (and (string? a)
+           (= a "di")
+           (string? b)
+           (re-find #"^il (mio|tio|suo|nostro|vostro|loro)\b" b))
+      (str a " " (string/replace b #"^il " ""))
+
+      (and (string? a)
+           (= a "di")
+           (string? b)
+           (re-find #"^la (mia|tia|sua|nostra|vostra|loro)\b" b))
+      (str a " " (string/replace b #"^la " ""))
+
+      (and (string? a)
+           (= a "di")
+           (string? b)
+           (re-find #"^i (miei|tuoi|suoi|nostri|vostri|loro)\b" b))
+      (str a " " (string/replace b #"^i " ""))
+
+      (and (string? a)
+           (= a "di")
+           (string? b)
+           (re-find #"^le (mie|tue|sue|nostre|vostre|loro)\b" b))
+      (str a " " (string/replace b #"^le " ""))
+
+      (and (= a "di i")
+           (string? b)
+           (re-find #"^[aeiou]" b))
+      (str "degli " b)
+
+      (and (= a "di i")
+           (string? b)
+           (re-find #"^s[t]" b))
+      (str "degli " b)
+
+      (and (= a "di i")
+           (string? b))
+      (str "dei " b)
+
+      (and (= (get-in a '(:italiano)) "di i")
+           (string? b))
+      (str "dei " b)
+
+      (and (= (get-in a '(:italiano)) "di i")
+           (string? (get-in b '(:italiano))))
+      (str "dei " (get-string-1 (get-in b '(:italiano))))
+
+      (and (= a "di il")
+           (string? b))
+      (get-string "del" b)  ;; allows this to feed next rule:
+
+      (and (= a "del")
+           (string? b)
+           (re-find #"^[aeiou]" b))
+      (str "dell'" b)
+
+      (and (= a "di la")
+           (string? b))
+      (get-string "della" b) ;; allows this to feed next rule:
+
+      (and (= a "della")
+           (string? b)
+           (re-find #"^[aeiou]" b))
+      (str "dell'" b)
+
+      (and (= a "di le")
+           (string? b))
+      (str "delle " b)
+
+      (and (= a "i")
+           (string? b)
+           (re-find #"^[aeiou]" b))
+      (str "gli " b)
+
+      (and (= a "i")
+           (string? (get-in b '(:italiano)))
+           (re-find #"^[aeiou]" (get-in b '(:italiano))))
+      (str "gli " b)
+
+      (and (= a "i")
+           (string? b)
+           (re-find #"^s[t]" b))
+      (str "gli " b)
+
+      (and (= a "ci")
+           (string? b)
+           (re-find #"^[eè]" b))
+      (str "c'" b)
+
+      ;; handle e.g. "io lo ho visto" => "io l'ho visto"
+      (and (string? a)
+           (re-find #"^l[ao]$" a)
+           (string? b)
+           (re-find #"^[aeiouh]" b))
+      (str "l'" b)
+
+      ;; 4) handle e.g. "aiutari + ti" => "aiutarti"
+      (and (string? a)
+           (or (re-find #"are$" a)
+               (re-find #"ere$" a)
+               (re-find #"ire$" a))
+           (or (= b "ci")
+               (= b "mi")
+               (= b "la")
+               (= b "le")
+               (= b "li")
+               (= b "lo")
+               (= b "ti")
+               (= b "vi")))
+      (str (string/replace a #"[e]$" "")
+           b)
+
+      (and (= a "un")
+           (string? b)
+           (re-find #"^s[t]" b))
+      (str "uno " b)
+
+      (and (= a "una")
+           (string? b)
+           (re-find #"^[aeiou]" b))
+      (str "un'" b)
+
+      (and (= a "il")
+           (string? b)
+           (re-find #"^[aeiou]" b))
+      (str "l'" b)
+
+      (and (= a "il")
+           (string? b)
+           (re-find #"^s[ct]" b))
+      (str "lo " b)
+
+      (and (= a "la")
+           (string? b)
+           (re-find #"^[aeiou]" b))
+      (str "l'" b)
+
+      (and (= a "quell[ao]")
+           (string? b)
+           (re-find #"^[aeiou]" b))
+      (str "quell'" b)
+
+      (and (= a "quelli")
+           (string? b)
+           (re-find #"^(st|sc|[aeiou])" b))
+      (str "quegli " b)
+
+      (and (= a "quest[aeio]")
+           (string? b)
+           (re-find #"^[aeiou]" b))
+      (str "quest'" b)
+
+      ;; prepositional phrases
+      (and (= a "a")
+           (string? b)
+           (re-find #"^il " b))
+      (str "al " (string/replace b #"^il " ""))
+
+      (and (= a "a")
+           (string? b)
+           (re-find #"^i " b))
+      (str "ai " (string/replace b #"^i " ""))
+
+      (and (= a "a")
+           (string? b)
+           (re-find #"^le " b))
+      (str "alle " (string/replace b #"^le " ""))
+
+      (and (= a "a")
+           (string? b)
+           (re-find #"^la " b))
+      (str "alla " (string/replace b #"^la " ""))
+
+      (and (string? a) (string? b))
+      (trim (str a " " b))
+
+      (and (string? a) (string? (get-in b '(:italiano))))
+      (trim (str a " " (get-in b '(:italiano))))
+
+      (and (string? (get-in a '(:italiano)))
+           (string? b))
+      (trim (str (get-in a '(:italiano)) " " b))
+
+      (and (string? a)
+           (map? b))
+      (throw (Exception. (str "couldn't determine how to stringify this map:(b): " b)))
+
+      (and (string? b)
+           (map? a))
+      (throw (Exception. (str "couldn't determine how to stringify this map:(a): " a)))
+
+      true
+      {:a (if (nil? a) :top a)
+       :b (if (nil? b) :top b)})))

 (defn fo [input]
   (cond


Formatting

Formatting

--- src/braid/client/mobile/views.cljs
+++ src/braid/client/mobile/views.cljs
@@ -60,7 +60,6 @@
        [:div.card
         [:div.head

-
          [braid.client.ui.views.thread/thread-tags-view thread]

          (when @open?
@@ -112,8 +111,7 @@
       [:div.inbox.page
        [header-view toggle-draw-ch]
        [:div.threads
-        [swipe-view (conj @threads
-                          @temp-thread) thread-view]]])))
+        [swipe-view (conj @threads @temp-thread) thread-view]]])))

 (defn main-view []
   (let [toggle-draw-ch (a/chan)]


don't require nothing be after inline replacements

--- src/chat/client/views/helpers.cljs
+++ src/chat/client/views/helpers.cljs
@@ -52,8 +52,7 @@
     ; using Javascript split beacuse we don't want the match to be in the last
     ; component
     (let [[pre _ post] (seq (.split s re 3))]
-      (if (and (or (string/blank? pre) (re-matches #".*\s$" pre))
-            (or (string/blank? post) (re-matches #"^\s.*" post)))
+      (if (or (string/blank? pre) (re-matches #".*\s$" pre))
       ; XXX: find a way to use return a seq & use mapcat instead of this hack
       (dom/span #js {:className "dummy"} pre (replace-fn match) post)
       s))


delete file

delete file

--- src/cljc/just_married/payment.cljc
+++ src/cljc/just_married/payment.cljc
@@ -1,12 +0,0 @@
-(ns just-married.payment
-  (:require
-   [stripe.transfer :as transfer]
-   [stripe.account :as account]
-   [clojure.data.json :as json]))
-
-(defn handle-payment
-  [data]
-  "Handle a payment call"
-  ;; data contains
-  {:status 201
-   :body (json/write-str ())})


Add corret tutorial video for linkedin Add profile

--- src/cljs/salava/core/ui/share.cljs
+++ src/cljs/salava/core/ui/share.cljs
@@ -8,7 +8,8 @@
             [reagent-modals.modals :as m :refer [close-modal!]]
             [salava.core.i18n :refer [t]]
             ))
-(def video-link "")
+(def video-link-fi "")
+(def video-link-en "")

 (defn clipboard-button [target status]

@@ -86,6 +87,13 @@
         use-lng (if (some #(= % user-lng) btn-lngs) user-lng "en")]
     [:img {:src (str "/img/linkedin-addprofile/" use-lng ".png") :alt "LinkedIn Add to Profile button"}]) )

+(defn tutorial-video []
+  (let [user-lng (session/get-in [:user :language])]
+    [:div.col-md-6.image-view
+     [:label {:class " sub-heading"} (t :core/Tutorialvideo) ]
+     [:div.embed-responsive.embed-responsive-16by9
+      {:dangerouslySetInnerHTML {:__html (md->html (if (= "fi" user-lng) video-link-fi video-link-en))}}]])
+  )

 (defn certificate-badge-helper [{:keys [name authory licence url datefrom dateto] :as certification} view-atom]
   (create-class {:reagent-render
@@ -106,11 +114,8 @@
                             [input-button (t :core/Licensenumber) "licence" licence]
                             [input-date datefrom dateto]
                             [input-button (t :core/Certificationurl) "url" url]]]
-
-                          [:div.col-md-6.image-view
-                           [:label {:class " sub-heading"} (t :core/Tutorialvideo) ]
-                           [:div.embed-responsive.embed-responsive-16by9
-                            {:dangerouslySetInnerHTML {:__html (md->html video-link)}}]]]])
+                          (tutorial-video)
+                          ]])
                  :component-will-unmount (fn []
                                            (reset! view-atom :start))}))

@@ -145,10 +150,8 @@
                             [input-button (t :core/Licensenumber) "licence" licence]
                             [input-date datefrom dateto]
                             [input-button (t :core/Certificationurl) "url" url]]]
-                          [:div.col-md-6.image-view
-                           [:label {:class " sub-heading"} (t :core/Tutorialvideo) ]
-                           [:div.embed-responsive.embed-responsive-16by9
-                            {:dangerouslySetInnerHTML {:__html (md->html video-link)}}]]]]]
+                          (tutorial-video)
+                          ]]]
    [:div.modal-footer
     #_[:button {:type         "button"
               :class        "btn btn-primary"


fix manual referrer

fix manual referrer

--- src/cljs/salava/user/ui/login.cljs
+++ src/cljs/salava/user/ui/login.cljs
@@ -27,11 +27,14 @@
   (let [blocks (plugin-fun (session/get :plugins) "block" fn-name)]
     [:div (doall (map #(%) blocks))]))

+(defn referrer-helper [referrer]
+  (-> (string/split referrer #"/app") last))
+
 (defn follow-up-url []

   (let [
          verification-key (verification-token js/window.location.search)
-         manual-referrer (session/get :referrer)
+         manual-referrer (referrer-helper (session/get :referrer))
          referrer js/document.referrer
          site-url (str (session/get :site-url) (base-path))
          path (if (and referrer site-url (string/starts-with? referrer site-url)) (string/replace referrer site-url "") )]


login, disabled gdpr

login, disabled gdpr

--- src/cljs/salava/user/ui/login.cljs
+++ src/cljs/salava/user/ui/login.cljs
@@ -99,14 +99,16 @@

 (defn login [state]
   (let [{:keys [email password]} @state
-        f (fn [] (toggle-accept-terms state))]
+        f (fn [] (toggle-accept-terms state))
+        terms-enabled? (session/get :terms-enabled?)]
     (ajax/POST
       (path-for "/obpv1/user/login")
       {:params  {:email    email
                  :password password}
        :handler (fn [data]
                   (cond
-                    (and (= (:status data) "success") (= (:terms data) "accepted")) (js-navigate-to (follow-up-url))
+                    (and (= (:status data) "success")(or (= (:terms data) "accepted") (= false (:terms data)))) (js-navigate-to (follow-up-url))
+                    ;(and (= (:status data) "success") (= (:terms data) "accepted")) (js-navigate-to (follow-up-url))
                     (and (= (:status data) "success") (nil? (:terms data))) (do (swap! state assoc :user-id (:id data))  (m/modal![terms-and-conditions-modal state f "Login"] {:size :lg}))
                     (and (= (:status data) "success") (= (:terms data) "declined")) (do (swap! state assoc :user-id (:id data)) (m/modal![terms-and-conditions-modal state f "Login"] {:size :lg}))
                     :else (swap! state assoc :error-message (:message data))


fixed a typo in docs/config

fixed a typo in docs/config

--- docs/config.clj
+++ docs/config.clj
@@ -4,7 +4,7 @@
 ;; This lives in ~/.overtone/config.clj
 ;;
 ;; This example shouldn't be perceived as being typical - it's a
-;; contrived example which uses all the posible keys (typically with
+;; contrived example which uses all the possible keys (typically with
 ;; their default values) in an attempt to introduce their existence
 ;; and explain their meaning and usage.


(PDB-4701) Improve error message

(PDB-4701) Improve error message

catches ast processing errors and adds the full ast query to the error message

--- src/puppetlabs/puppetdb/query_eng/default_reports.clj
+++ src/puppetlabs/puppetdb/query_eng/default_reports.clj
@@ -3,7 +3,10 @@
    [clojure.core.match :as cm]
    [clojure.set :as set]
    [clojure.string :as str]
-   [puppetlabs.puppetdb.query-eng.engine :as eng :refer [user-name->query-rec-name]]))
+   [puppetlabs.i18n.core :refer [tru trs]]
+   [puppetlabs.puppetdb.query-eng.engine :as eng :refer [user-name->query-rec-name]])
+  (:import
+    (clojure.lang ExceptionInfo)))

 (defn is-page-order-opt?
   [page-order-opts]
@@ -47,9 +50,9 @@
    [["subquery" entity expr]] false

    :else (throw
-          ;; FIXME: better info
-          (ex-info (str "Unrecognized ast clause: " (pr-str ast))
-                   {:kind ::unrecognized-ast-syntax}))))
+          (ex-info "Unrecognized ast clause."
+                   {:kind ::unrecognized-ast-syntax
+                    :clause ast}))))

 (defn qrec-tables
   [qrec]
@@ -164,9 +167,9 @@
      `["subquery" ~entity ~expr])

    :else (throw
-          ;; FIXME: better info
-          (ex-info (str "Unrecognized ast clause: " (pr-str ast))
-                   {:kind ::unrecognized-ast-syntax}))))
+          (ex-info "Unrecognized ast clause."
+                   {:kind ::unrecognized-ast-syntax
+                    :clause ast}))))

 (defn maybe-add-agent-report-filter
   "Returns [qrec ast] after adjusting the top-level filter in the ast
@@ -183,18 +186,27 @@

 (defn maybe-add-agent-report-filter-to-query
   [qrec ast]
-  (cm/match
-    [ast]
-    ;; Top level 'extract' has had the preceding 'from' removed and it
-    ;; only valid at the very top level of the query, not in subqueries
-    [["extract" fields & (page-order-opts :guard is-page-order-opt?)]]
-    (let [[_ expr] (maybe-add-agent-report-filter qrec ::elide)]
-      (if (= ::elide expr)
-        `["extract" ~fields ~@page-order-opts]
-        `["extract" ~fields ~expr ~@page-order-opts]))
+  (try
+    (cm/match
+      [ast]
+      ;; Top level 'extract' has had the preceding 'from' removed and it
+      ;; only valid at the very top level of the query, not in subqueries
+      [["extract" fields & (page-order-opts :guard is-page-order-opt?)]]
+      (let [[_ expr] (maybe-add-agent-report-filter qrec ::elide)]
+        (if (= ::elide expr)
+          `["extract" ~fields ~@page-order-opts]
+          `["extract" ~fields ~expr ~@page-order-opts]))

     [["extract" fields expr & page-order-opts]]
     (let [[_ expr] (maybe-add-agent-report-filter qrec expr)]
       `["extract" ~fields ~expr ~@page-order-opts])

-    :else (second (maybe-add-agent-report-filter qrec ast))))
+    :else (second (maybe-add-agent-report-filter qrec ast)))
+    (catch ExceptionInfo e
+      (let [data (ex-data e)
+            failed-ast-clause (:clause e)]
+      (when (not= ::unrecognized-ast-syntax (:kind data))
+        (throw e))
+      (throw
+        (ex-info (trs "Unrecognized ast clause '{0}' in ast query '{1}'" (pr-str failed-ast-clause) ast)
+                 {:kind ::unrecognized-ast-syntax}))))))


Set a type tag in generated record code, to help extern inference.

--- src/active/clojure/cljs/record_cljs_internals.cljc
+++ src/active/clojure/cljs/record_cljs_internals.cljc
@@ -171,7 +171,7 @@
                ksym (gensym "k")
                default-interfaces+methods
                {'IEquiv
-                [(core/let [this (gensym 'this) other (gensym 'other)]
+                [(core/let [this (gensym 'this) other (with-meta (gensym 'other) {:tag '`~rname})]
                     `(~'-equiv [~this ~other]
                       (and (some? ~other)
                            (identical? (.-constructor ~this)


remove dead code

remove dead code

--- src/clj/backtype/storm/scheduler/EvenScheduler.clj
+++ src/clj/backtype/storm/scheduler/EvenScheduler.clj
@@ -41,8 +41,7 @@
                            (map vector
                                 reassign-executors
                                 ;; for some reason it goes into infinite loop without limiting the repeat-seq
-                                (repeat-seq (count reassign-executors) reassign-slots)))
-        stay-assignment (into {} (mapcat (fn [[node+port executors]] (for [executor executors] [executor node+port])) alive-assigned))]
+                                (repeat-seq (count reassign-executors) reassign-slots)))]
     (when-not (empty? reassignment)
       (log-message "Available slots: " (pr-str available-slots))
       )


adding some scoping

adding some scoping

--- src/midje/util/exceptions.clj
+++ src/midje/util/exceptions.clj
@@ -7,11 +7,10 @@
  ;;; Writing

-(def line-separator (System/getProperty "line.separator"))
+(def line-separator ^{:private true} (System/getProperty "line.separator"))

 (defn user-error [& lines]
   (Error. (join line-separator lines)))
-

  ;;; Reading
@@ -19,14 +18,14 @@
 (defn stacktrace-as-strings [ex]
   (map #(.toString %) (.getStackTrace ex)))

-(defn remove-matches [re strings]
-  (remove #(re-find re %) strings))
+(letfn [(remove-matches [re strings]
+          (remove #(re-find re %) strings))]

-(defn without-clojure-strings [all-strings]
-  (remove-matches #"^java\.|^clojure\.|^sun\.|^swank\.|^user\$eval" all-strings))
-
-(defn without-midje-or-clojure-strings [all-strings]
-  (remove-matches #"^java\.|^clojure\.|^sun\.|^swank\.|^user\$eval|^midje" all-strings))
+  (defn without-clojure-strings [all-strings]
+    (remove-matches #"^java\.|^clojure\.|^sun\.|^swank\.|^user\$eval" all-strings))
+
+  (defn without-midje-or-clojure-strings [all-strings]
+    (remove-matches #"^java\.|^clojure\.|^sun\.|^swank\.|^user\$eval|^midje" all-strings)))

 (defn user-error-exception-lines [ex]
   (cons (.toString ex)


[PDOK-1949] UNION -> UNION ALL, expensive sort removed from query

--- src/main/clojure/pdok/featured/timeline.clj
+++ src/main/clojure/pdok/featured/timeline.clj
@@ -116,7 +116,7 @@
    (let [clause (map->where-clause selector)
          query (str "SELECT feature FROM " (qualified-history) " "
                     "WHERE " clause
-                    " UNION "
+                    " UNION ALL "
                     "SELECT feature FROM " (qualified-current) " "
                     "WHERE " clause)]
      (execute-query-result-on-channel timeline query result-channel))))


Restore workspace scroll with space.

Restore workspace scroll with space.

--- src/uxbox/ui/workspace.cljs
+++ src/uxbox/ui/workspace.cljs
@@ -45,7 +45,7 @@
   (letfn [(handle-scroll-interaction []
             (let [stoper (->> uuc/actions-s
                               (rx/map :type)
-                              (rx/filter #(not= % :scroll/viewport))
+                              (rx/filter #(empty? %))
                               (rx/take 1))
                   local (:rum/local own)
                   initial @uuwb/mouse-viewport-a]
@@ -70,7 +70,7 @@
         sub1 (as-> uuc/actions-s $
               (rx/map :type $)
               (rx/dedupe $)
-              (rx/filter #(= :scroll/viewport %) $)
+              (rx/filter #(= "ui.workspace.scroll" %) $)
               (rx/on-value $ handle-scroll-interaction))
         sub2 (udp/watch-page-changes pageid)]
     (set! (.-scrollLeft el) uuwb/canvas-start-scroll-x)


Moved metadata to beginning of file for streaming

--- src/video_server/ffmpeg.clj
+++ src/video_server/ffmpeg.clj
@@ -150,5 +150,6 @@
    (audio-options spec)
    (subtitle-options spec)
    "-f" (ffmpeg-format (:format spec))
+   "-movflags" "+faststart"
    (:output spec)])


Rollback kibit suggestion as i get a runtime expection using or as function instead as a macro.

--- src/oc/storage/api/boards.clj
+++ src/oc/storage/api/boards.clj
@@ -101,7 +101,7 @@
     (try
       (let [notifications (:private-notifications board-map)
             entry-data (map #(valid-entry-with-board?
-                               conn (update-in % [:status] or "published") author) (:entries board-map))
+                               conn (assoc % :status (or (:status %) "published")) author) (:entries board-map))
             board-data (-> board-map
                         (dissoc :private-notifications :note)
                         (assoc :entries entry-data))]


Disable publisher board creation if they are not enabled.

--- src/oc/storage/api/boards.clj
+++ src/oc/storage/api/boards.clj
@@ -86,12 +86,16 @@
                         (update :name #(if (:publisher-board board-map)
                                          (:name author)
                                          %)))]
-        (if (and (:disallow-public-board (or (:content-visibility org) {}))
-                 (= (:access board-data) "public"))
-          [false, {:reason :disallowed-public-board}]
-          {:new-board (api-common/rep (board-res/->board (:uuid org) board-data author))
-           :existing-org (api-common/rep org)
-           :notifications (api-common/rep notifications)}))
+        (cond (and (:disallow-public-board (or (:content-visibility org) {}))
+                         (= (:access board-data) "public"))
+              [false, {:reason :disallowed-public-board}]
+              (and (:publisher-board board-data)
+                   (not config/publisher-board-enabled?))
+              [false, {:reason :disallowed-publisher-board}]
+              :else
+              {:new-board (api-common/rep (board-res/->board (:uuid org) board-data author))
+               :existing-org (api-common/rep org)
+               :notifications (api-common/rep notifications)}))

       (catch clojure.lang.ExceptionInfo e
         [false, {:reason (.getMessage e)}])) ; Not a valid new board


fix spelling error

fix spelling error

--- src/overtone/config/store.clj
+++ src/overtone/config/store.clj
@@ -65,7 +65,7 @@
         (println "Warning - old config directory detected. Moved to ~/.overtone-old and replaced with new, empty config.")
         (mv! root (str root "-old")))))

-(defonce __ENSIRE-DIRS___
+(defonce __ENSURE-DIRS___
   (ensure-dir-structure))

 (defonce __ENSURE-CONFIG__


discover File's .mkdirs() method!

discover File's .mkdirs() method!

--- src/overtone/helpers/file.clj
+++ src/overtone/helpers/file.clj
@@ -201,13 +201,8 @@
   subdirectories if necessary"
   [path]
   (let [path  (resolve-tilde-path path)
-        root  (absolute-path? path)
-        split (split-on-char path (file-separator))]
-    (loop [sub-path (str root (first split))
-           to-do    (next split)]
-      (mkdir! sub-path)
-      (when to-do
-        (recur (mk-path sub-path (first to-do)) (next to-do))))))
+        f  (File. path)]
+    (.mkdirs f)))

 (defn rm-rf!
   "Removes a file or dir and all its subdirectories. Similar to rm -rf on *NIX"