Minor code refactoring in projects/dump-*-data functions

--- src/clj/org/openforis/ceo/db/projects.clj
+++ src/clj/org/openforis/ceo/db/projects.clj
@@ -983,7 +983,10 @@
             text-headers       (concat plot-base-headers
                                        (get-ext-plot-headers project-id))
             number-headers     (get-value-distribution-headers sample-value-group)
-            headers-out        (str/join "," (map #(-> % name csv-quotes) (concat text-headers number-headers)))
+            headers-out        (->> (concat text-headers number-headers)
+                                    (map #(-> % name csv-quotes))
+                                    (str/join ",")
+                                    (str "\uFEFF")) ; Prefix headers with a UTF-8 tag
             data-rows          (map (fn [row]
                                       (let [samples       (tc/jsonb->clj (:samples row))
                                             ext-plot-data (tc/jsonb->clj (:ext_plot_data row))]
@@ -1009,7 +1012,7 @@
                    "Content-Disposition" (str "attachment; filename="
                                               (prepare-file-name (:name project-info) "plot")
                                               ".csv")}
-         :body (str/join "\n" (conj data-rows (str "\uFEFF" headers-out)))})
+         :body (str/join "\n" (cons headers-out data-rows))})
       (data-response "Project not found."))))

 (defn- get-ext-sample-headers
@@ -1056,7 +1059,10 @@
                                        (get-ext-plot-headers project-id)
                                        (get-ext-sample-headers project-id)
                                        (map question-key sample-value-group))
-            headers-out        (str/join "," (map #(-> % name csv-quotes) text-headers))
+            headers-out        (->> text-headers
+                                    (map #(-> % name csv-quotes))
+                                    (str/join ",")
+                                    (str "\uFEFF")) ; Prefix headers with a UTF-8 tag
             data-rows          (map (fn [row]
                                       (let [value           (tc/jsonb->clj (:value row))
                                             ext-plot-data   (tc/jsonb->clj (:ext_plot_data row))
@@ -1081,5 +1087,5 @@
                    "Content-Disposition" (str "attachment; filename="
                                               (prepare-file-name (:name project-info) "sample")
                                               ".csv")}
-         :body (str/join "\n" (conj data-rows (str "\uFEFF" headers-out)))})
+         :body (str/join "\n" (cons headers-out data-rows))})
       (data-response "Project not found."))))


Update comment

Update comment

--- src/clj/org/openforis/ceo/db/projects.clj
+++ src/clj/org/openforis/ceo/db/projects.clj
@@ -445,7 +445,7 @@
                                samples-per-plot
                                sample-resolution]
   ;; TODO Right now you have to have a sample shape or csv file if you have a plot shape file.
-  ;;      Update create random / gridded to work on boundary so any plot type can have random, gridded, center.
+  ;;      Update create random / gridded to work on boundary so any plot type can have random and gridded.
   (doseq [[x y] (case sample-distribution
                   "center"
                   [plot-center]


Use forloop macro in main x,y loop - gains us another 30000 pixels per second...

--- src/cljs/fractals_clojurescript/core.cljs
+++ src/cljs/fractals_clojurescript/core.cljs
@@ -87,17 +87,17 @@
       escape-radius-squared (* escape-radius escape-radius)
       max-iterations        (:max-iterations @app-state)]

-  (doseq [x (range width)]
-    (doseq [y (range height)]
-      (let [real       (+ (* x-size (/ x width)) x0)
+  (forloop
+   [(x 0) (< x width)  (inc x)]
+   (forloop
+    [(y 0) (< y height) (inc y)]

-            imaginary  (+ (* y-size (/ y height)) y0)
+    (let [real       (+ (* x-size (/ x width)) x0)
+          imaginary  (+ (* y-size (/ y height)) y0)
+          iterations (iteration-count escape-radius-squared max-iterations [real imaginary])
+          intensity  (* 255 (/ iterations max-iterations))]

-            iterations (iteration-count escape-radius-squared max-iterations [real imaginary])
-
-            intensity  (* 255 (/ iterations max-iterations))]
-
-        (dot! x y intensity intensity intensity)))))
+      (dot! x y intensity intensity intensity)))))

 (.putImageData context idata 0 0)


refactor endorsements

refactor endorsements

--- src/cljs/salava/badge/ui/endorsement.cljs
+++ src/cljs/salava/badge/ui/endorsement.cljs
@@ -38,7 +38,7 @@
     (path-for (str "/obpv1/badge/user/endorsement/" (:id @state)))
     {:handler (fn [data]
                 (swap! state assoc :user-badge-endorsements data)
-                (when (some #(= (:endorser_id %) (:endorser-id @state)) data)
+                (when (some #(= (:issuer_id %) (:endorser-id @state)) data)
                   (swap! state assoc :show-link "none"
                          :show-content "none"
                          :show-endorsement-status "block")))}))
@@ -47,7 +47,7 @@
   (let [state (atom {:id badge-id})]
     (init-user-badge-endorsement state)
     (fn []
-      (let [endorsements (:user-badge-endorsements @state)
+      (let [endorsements (filter #(= (:status %) "accepted") (:user-badge-endorsements @state))
             badge-endorsements? (pos? (count @badge-endorsements))]
         (when (seq endorsements)
           [:div;.row {:id "badge-contents"}
@@ -343,11 +343,11 @@
                        )}[:i.fa.fa-thumbs-o-up {:style {:vertical-align "unset"}}] (t :badge/Endorsethisbadge)]
      [:div {:style {:display @(cursor state [:show-endorsement-status])}} [:i.fa.fa-thumbs-up] (endorsement-text state)]]))

-(defn profile-link-inline [id first_name last_name picture]
+(defn profile-link-inline [id issuer_name picture]
   [:div [:a {:href "#"
              :on-click #(mo/open-modal [:user :profile] {:user-id id})}
          [:img {:src (profile-picture picture)}]
-         (str first_name " " last_name " ")]  (t :badge/Hasendorsedyou)])
+         (str issuer_name " ")]  (t :badge/Hasendorsedyou)])

 (defn pending-endorsements []
   (let [state (atom {:user-id (-> (session/get :user) :id)})]
@@ -355,13 +355,13 @@
     (fn []
       [:div#endorsebadge
        (reduce (fn [r endorsement]
-                 (let [{:keys [id user_badge_id image_file name content first_name last_name profile_picture endorser_id description]} endorsement]
+                 (let [{:keys [id user_badge_id image_file name content profile_picture issuer_id description issuer_name]} endorsement]
                    (conj r
                          [:div
                           [:div.col-md-12
                            [:div.thumbnail
                             [:div.endorser.col-md-12
-                             [profile-link-inline endorser_id first_name last_name profile_picture id]
+                             [profile-link-inline issuer_id issuer_name profile_picture id]
                              [:hr.line]
                              ]
                             [:div.caption.row.flip
@@ -419,7 +419,7 @@
          [:div#endorsebadge

           (reduce (fn [r endorsement]
-                    (let [{:keys [id user_badge_id image_file name content first_name last_name profile_picture endorser_id status]} endorsement]
+                    (let [{:keys [id user_badge_id image_file name content issuer_name first_name last_name profile_picture endorser_id status]} endorsement]
                       (conj r [:div.panel.panel-default.endorsement
                                [:div.panel-heading {:id (str "heading" id)}
                                 [:div.panel-title
@@ -459,7 +459,7 @@
                     ) [:div] @(cursor state [:user-badge-endorsements]))]]))))

 (defn profile [element-data]
-  (let [{:keys [id first_name last_name profile_picture status label]} element-data
+  (let [{:keys [id first_name last_name profile_picture status label issuer_name]} element-data
         current-user (session/get-in [:user :id])]
     [:div.endorsement-profile.panel-default
      [:a {:href "#" :on-click #(mo/open-modal [:user :profile] {:user-id id})}
@@ -468,15 +468,15 @@
         [:div.profile-image
          [:img.img-responsive.img-thumbnail
           {:src (profile-picture profile_picture)
-           :alt (str first_name " " last_name)}]]]
+           :alt (or issuer_name (str first_name " " last_name))}]]]
        [:div.col-md-8
-        [:h4 (str first_name " " last_name)]
+        [:h4 (or issuer_name (str first_name " " last_name))]
         (when (= status "pending") [:p [:span.label.label-info label]])]]]]))

 (defn user-endorsement-content [params]
   (fn []
     (let [{:keys [endorsement state]} @params
-          {:keys [id profile_picture name first_name last_name image_file content user_badge_id endorser_id endorsee_id status]} endorsement]
+          {:keys [id profile_picture name first_name last_name image_file content user_badge_id issuer_id issuer_name endorsee_id status]} endorsement]
       [:div.row.flip {:id "badge-info"}
        [:div.col-md-3
         [:div.badge-image [:img.badge-image {:src (str "/" image_file)}]]]
@@ -495,12 +495,13 @@
                                                                    (delete-endorsement id user_badge_id nil nil))
                                                       :data-dismiss "modal"} [:i.fa.fa-trash] (t :badge/Deleteendorsement)]
                                                  ]])]
-          [:div.col-md-8.col-md-pull-4 [profile {:id (or endorsee_id endorser_id)
+          [:div.col-md-8.col-md-pull-4 [profile {:id (or endorsee_id issuer_id)
                                                  :profile_picture profile_picture
                                                  :first_name first_name
                                                  :last_name last_name
+                                                 :issuer_name issuer_name
                                                  :status status
-                                                 :label (if endorser_id
+                                                 :label (if issuer_id
                                                           (t :badge/pendingreceived)
                                                           (t :badge/pendinggiven)
                                                           )}]]]
@@ -606,8 +607,8 @@
      [:div.panel-body
       [:div.table  {:summary (t :badge/Endorsements)}
        (reduce (fn [r endorsement]
-                 (let [{:keys [id endorsee_id endorser_id profile_picture first_name last_name name image_file content status user_badge_id mtime]} endorsement
-                       endorser (str first_name " " last_name)]
+                 (let [{:keys [id endorsee_id issuer_id profile_picture issuer_name first_name last_name name image_file content status user_badge_id mtime]} endorsement
+                       endorser (or issuer_name (str first_name " " last_name))]
                    (conj r [:div.list-item.row.flip
                             [:a {:href "#" :on-click #(do
                                                         (.preventDefault %)
@@ -616,12 +617,12 @@
                              [:div.col-md-8.col-md-pull-4 [:div.media
                                                            [:div;.row
                                                             [:div.labels
-                                                             (if endorser_id
+                                                             (if issuer_id
                                                                [:span.label.label-success (t :badge/Endorsedyou)]
                                                                [:span.label.label-primary (t :badge/Youendorsed)])
                                                              (if (= "pending" status)
                                                                [:span.label.label-info
-                                                                (if endorser_id
+                                                                (if issuer_id
                                                                   (t :badge/pendingreceived)
                                                                   (t :badge/pendinggiven)
                                                                   )])]


Add IAuthorization implementation for token backend.

--- src/clojure/buddy/auth/backends/token.clj
+++ src/clojure/buddy/auth/backends/token.clj
@@ -60,4 +60,14 @@
     (authenticate [_ request token]
       (let [rsq (authfn request token)]
         (if (response? rsq) rsq
-            (assoc request :identity rsq))))))
+            (assoc request :identity rsq))))
+
+    proto/IAuthorization
+    (handle-unauthorized [_ request metadata]
+      (if unauthorized-handler
+        (unauthorized-handler request metadata)
+        (if (authenticated? request)
+          (-> (response "Permission denied")
+              (status 403))
+          (-> (response "Unauthorized")
+              (status 401)))))))


do not blacklist broker pipe errored connections

--- src/clojure/tcp_driver/routing/policy.clj
+++ src/clojure/tcp_driver/routing/policy.clj
@@ -5,8 +5,7 @@
   (:require [schema.core :as s]
             [fun-utils.cache :as cache]
             [clojure.set :as clj-set]
-            [tcp-driver.io.conn :as tcp-conn])
-  (:import (clojure.lang Atom)))
+            [tcp-driver.io.conn :as tcp-conn]))

 ;;;;;;;;;;;;;;;;;
@@ -37,7 +36,11 @@
   (-hosts [this] @hosts-at)

   (-on-error! [this host throwable]
-    (-blacklist! this host))
+
+     ;;only blacklist when not a broken pipe.
+     ;;note that the calling code must close the connection, otherwise errors will repeat
+    (when-not (.contains ^String (str throwable) "Broken")
+              (-blacklist! this host)))

   (-add-host! [_ host]
     (ensure-host-address-schema! host)


add test thread-pool metrics emission

add test thread-pool metrics emission

--- test-hystrix/preflex/hystrix_main.clj
+++ test-hystrix/preflex/hystrix_main.clj
@@ -51,7 +51,8 @@
         o-reporter (h/make-metrics-reporter metrics-collectors
                      {:circuit-breaker     circuit-breaker
                       :execution-semaphore execution-semaphore})
-        metrics-source (h/make-hystrix-command-metrics-source "sample" o-reporter o-reporter)
+        command-metrics-source (h/make-hystrix-command-metrics-source "sample-command" o-reporter o-reporter)
+        th-pool-metrics-source (h/make-hystrix-thread-pool-metrics-source "sample-thread-pool" o-reporter)
         command (->> primary
                   (r/wrap-thread-pool thread-pool thread-pool-options)
                   (r/wrap-semaphore execution-semaphore semaphore-options)
@@ -65,8 +66,13 @@
            :headers {"Content-Type" "text/html"}
            :body    "hello HTTP!"})
       (ssec/streaming-middleware sseh/generate-stream {:request-matcher (partial ssec/uri-match "/hystrix.stream")
-                                                       :chunk-generator (-> (fn [_] (json/generate-string
-                                                                                (metrics-source)) )
+                                                       :chunk-generator (-> (fn [_] (str
+                                                                                (json/generate-string
+                                                                                (command-metrics-source))
+                                                                                \newline
+                                                                                \newline
+                                                                                (json/generate-string
+                                                                                (th-pool-metrics-source))) )
                                                                           (ssew/wrap-delay 1000)
                                                                           ssew/wrap-sse-event
                                                                           ssew/wrap-pst)}))))


implement max-size

implement max-size

skip content extraction if file is too large

--- src/fscrawler_tika_convert/core.clj
+++ src/fscrawler_tika_convert/core.clj
@@ -57,12 +57,13 @@

 (defn handle-message
-  [ch metadata ^bytes payload]
+  [options ch metadata ^bytes payload]
   (let [body (json/read-json (String. payload "UTF-8"))
         ;; {:keys [directory relpath] body}
         routing-key (:routing-key metadata)
         exchange (:exchange metadata)
         directory (:directory body)
+        size (get-in body [:entry :stat :st_size])
         relpath (:relpath (:entry body))
         delivery-tag (:delivery-tag metadata)
         fp (string/join File/separator [directory relpath])
@@ -72,11 +73,18 @@
     (reap/register-future!
      (future
        (try
-         (let [converted (convert fp)]
+         (let [converted (if (< size (:max-size options))
+                           (convert fp)
+                           (do
+                             (logging/info "skipping content-extraction, file too large" fp)
+                             nil))
+               new-body (if converted
+                          (assoc body "tika-content" converted)
+                          body)]
            (lb/publish ch
                        exchange
                        (routing-key-string-with-command routing-key "import_file")
-                       (json/write-str (assoc body "tika-content" converted)))
+                       (json/write-str new-body))
            (lb/ack ch delivery-tag))
          (catch Exception err
            (logging/info "got exception while handling" fp err)
@@ -107,7 +115,7 @@
         ch           (lch/open conn)
         queue-name   (initialize-rabbitmq-structures ch "extract_content" "nextbot" filesystem)]
     (lb/qos ch (+ number-of-cores 4))
-    (lcons/blocking-subscribe ch queue-name handle-message :auto-ack false)))
+    (lcons/blocking-subscribe ch queue-name (partial handle-message options) :auto-ack false)))

 (defn run-forever


msg relay

msg relay

--- src/inspect/main/window_manager.cljs
+++ src/inspect/main/window_manager.cljs
@@ -65,18 +65,18 @@
   (when-let [active-window (active-window current-state)]
     (.-webContents active-window)))

-(defn relay [web-contents msg-type msg-payload msg-meta]
-  (let [serializable [msg-type {:msg-payload msg-payload
-                                :msg-meta    msg-meta}]]
-    (info "Relaying" (str msg-type) (:window-id msg-meta))
-    (.send web-contents "relay" (pr-str serializable))))
-
 (defn relay-msg [{:keys [current-state msg-type msg-meta msg-payload]}]
   (let [window-id (:window-id msg-meta)
-        web-contents (or
-                       (web-contents current-state))]
-    (when web-contents
-      (relay web-contents msg-type msg-payload msg-meta)))
+        window-ids (if (= window-id :broadcast)
+                     (keys (:windows current-state))
+                     [window-id])]
+    (doseq [window-id window-ids]
+      (let [window (get-in current-state [:windows window-id])
+            web-contents (when window (.-webContents window))
+            serializable [msg-type {:msg-payload msg-payload :msg-meta msg-meta}]]
+        (when web-contents
+          (info "Relaying" msg-type window-id)
+          (.send web-contents "relay" (pr-str serializable))))))
   {})

 (defn dev-tools [{:keys [current-state]}]
@@ -86,15 +86,18 @@
   {})

 (defn close-window [{:keys [current-state]}]
-  (when-let [active-window (active-window current-state)]
-    (info "Closing:" (:active current-state))
-    (.close active-window))
-  {})
+  (if-let [active-window (active-window current-state)]
+    (let [active (:active current-state)
+          new-state (update-in current-state [:windows] dissoc active)]
+      (info "Closing:" (:active current-state))
+      (.close active-window)
+      {:new-state new-state})
+    {}))

 (defn activate [{:keys [current-state]}]
   (info "Activate APP")
   (when (empty? (:windows current-state))
-    {:send-to-self [:window/new "view.html"]}))
+    {:send-to-self [:window/new {:url "view.html"}]}))

 (defn cmp-map
   [cmp-id relay-types]


missing arguments in cljs tests

missing arguments in cljs tests

--- test/cljs/lambdacd/pipeline_test.cljs
+++ test/cljs/lambdacd/pipeline_test.cljs
@@ -51,11 +51,12 @@
 (defn step-label [step]
   (sel1 step :span))

+(def some-step-id-to-display 10)

 (deftest build-step-test
   (testing "rendering of a single build-step"
     (tu/with-mounted-component
-      (pipeline/build-step-component some-build-step  1)
+      (pipeline/build-step-component some-build-step 1 some-step-id-to-display)
       (fn [c div]
         (is (dom/found-in div #"some-step"))
         (is (dom/having-class "build-step" (step-label (first (steps div)))))
@@ -63,7 +64,7 @@
         (is (dom/containing-link-to div (route/for-build-and-step-id 1 [1 2 3]))))))
   (testing "rendering of a container build-step"
     (tu/with-mounted-component
-      (pipeline/build-step-component some-container-build-step  1)
+      (pipeline/build-step-component some-container-build-step 1 some-step-id-to-display)
       (fn [c div]
         (is (dom/found-in div #"some-container"))
         (is (dom/found-in (first (steps div)) #"some-step"))
@@ -72,7 +73,7 @@
         (is (dom/containing-ordered-list (first (steps div)))))))
   (testing "rendering of a parallel build-step"
     (tu/with-mounted-component
-      (pipeline/build-step-component some-parallel-build-step  1)
+      (pipeline/build-step-component some-parallel-build-step 1 some-step-id-to-display)
       (fn [c div]
         (is (dom/found-in div #"some-parallel-step"))
         (is (dom/found-in (first (steps div)) #"some-other-step"))


Improve ensure-dependencies-defined

Improve ensure-dependencies-defined

Now, it correctly returns whether *all* the dependencies of the function
are defined or not.

--- test/comic_reader/sites/test_util.clj
+++ test/comic_reader/sites/test_util.clj
@@ -1,6 +1,7 @@
 (ns comic-reader.sites.test-util
   (:require [clojure.string :as str]
             [clojure.test :refer :all]
+            [clojure.template :as template]
             [comic-reader.sites :refer :all]
             [clojure.template :refer [do-template]]
             [clj-http.client :as client]
@@ -102,6 +103,11 @@
     manga-url
     manga-list-url))

+(defmacro and-template [argv expr & values]
+  (let [c (count argv)]
+    `(and ~@(map (fn [a] (template/apply-template argv expr a))
+                 (partition c values)))))
+
 (defmacro are-with-msg [argv expr & args]
   (if (or
        ;; (are [] true) is meaningless but ok
@@ -110,7 +116,7 @@
        (and (pos? (count argv))
             (pos? (count args))
             (zero? (mod (count args) (count argv)))))
-    `(do-template ~argv ~expr ~@args)
+    `(and-template ~argv ~expr ~@args)
     (throw (IllegalArgumentException. "The number of args doesn't match are's argv."))))

 (defn get-doc-string [sym]


fix names

fix names

--- src/gamma_driver/impl/resource.cljs
+++ src/gamma_driver/impl/resource.cljs
@@ -53,14 +53,14 @@
     (.bindBuffer gl ggl/ARRAY_BUFFER buffer)
     (let [data (:data spec)
           data (if (.-length data)
-            data
-            (js/Float32Array. (clj->js (flatten data))))]
+                 data
+                 (js/Float32Array. (clj->js (flatten data))))]
       (.bufferData
-       gl
-       ggl/ARRAY_BUFFER
-       data
-       (or ({:static-draw ggl/STATIC_DRAW :dynamic-draw ggl/DYNAMIC_DRAW} (:usage spec))
-           ggl/STATIC_DRAW)))
+        gl
+        ggl/ARRAY_BUFFER
+        data
+        (or ({:static-draw ggl/STATIC_DRAW :dynamic-draw ggl/DYNAMIC_DRAW} (:usage spec))
+            ggl/STATIC_DRAW)))
     (assoc spec :array-buffer buffer)))

@@ -70,15 +70,15 @@
   (let [buffer (or (:element-array-buffer spec) (.createBuffer gl))]
     (.bindBuffer gl ggl/ELEMENT_ARRAY_BUFFER buffer)
     (let [data (:data spec)
-          data (if (.-buffer (:data input))
-            (:data input)
-            (js/Uint16Array. (clj->js (flatten data))))]
+          data (if (.-buffer data)
+                 data
+                 (js/Uint16Array. (clj->js (flatten data))))]
       (.bufferData
-       gl
-       ggl/ELEMENT_ARRAY_BUFFER
-       data
-       (or ({:static-draw ggl/STATIC_DRAW :dynamic-draw ggl/DYNAMIC_DRAW} (:usage spec))
-           ggl/STATIC_DRAW)))
+        gl
+        ggl/ELEMENT_ARRAY_BUFFER
+        data
+        (or ({:static-draw ggl/STATIC_DRAW :dynamic-draw ggl/DYNAMIC_DRAW} (:usage spec))
+            ggl/STATIC_DRAW)))
     (assoc spec :element-array-buffer buffer)))


Renamed filtered-articles more appropriately.

--- src/lambda_blog/templates/recent.clj
+++ src/lambda_blog/templates/recent.clj
@@ -5,7 +5,7 @@
             [lambda-blog.utils :refer [path]]
             [s-html.tags :refer [a div h1 hr]]))

-(defn filtered-articles [entry-filter]
+(defn filtered-entries [entry-filter]
   (partial static-page-template
            (fn [{:keys [entries]}]
              [(map (juxt entry-summary (constantly (hr)))
@@ -16,10 +16,10 @@
                   row
                   well)])))

-(def recent-articles (filtered-articles #(take 15 %)))
+(def recent-entries (filtered-entries #(take 15 %)))

-(defn articles-by-tag [tag entity]
-  ((filtered-articles #(filter (fn [{:keys [tags]}]
-                                 (contains? tags tag))
-                               %))
+(defn entries-by-tag [tag entity]
+  ((filtered-entries #(filter (fn [{:keys [tags]}]
+                                (contains? tags tag))
+                              %))
    entity))


Update words.clj

Update words.clj

--- src/iyye/subcon/knowledge/words.clj
+++ src/iyye/subcon/knowledge/words.clj
@@ -22,15 +22,16 @@
     ;[iyye.subcon.knowledge.relation :as relation]
     ))

+(def action-words (ref []))
+(def noun-words (ref []))
 (def types-words (ref []))
 (def relations-words (ref []))
 (def instances-words (ref []))
 (def adjective-words (ref []))
-(def action-words (ref []))

 (defrecord Iyye_ModalPredicate [AccordingTo When Time Prob])
 (defrecord Iyye_Atom [Name Uname])
-(defrecord Iyye_Relation [atom Predicate Inputs Function])
+(defrecord Iyye_Relation [atom Predicate Types Function])
 (defrecord Iyye_Type [atom SubtypeOf Subtypes])
 (defrecord Iyye_Instance [atom type])

@@ -50,27 +51,32 @@
         relation (->Iyye_Relation action-atom Reason Types Function)]
     relation))

+(defn create-iyye-instance [values])
+
 (defn load-iyye-atom-from-db [uname]
   )

 (defn load-iyye-type-from-db [name]
   )

+(defn get-iyye-type [name]
+  (if ()
+    ()
+    (load-iyye-type-from-db name))
+  )
+
 ;(dosync (alter types-words conj type))
 ;(persistence/write-noun-to-db (into {} type))

-(defn create-iyye-instance [values])
-
-
 (defn action [cmd params IO]
   (let [actions
-        (for [action @action-words :when (= (:Name action) cmd)]
-          action)]
+        (for [action @action-words :when (= (:Name action) cmd)] action)
+        params-list (map #(for [word @noun-words :when (= (:Name word) %)] word) params)]
     (case (count actions)
       0 (ioframes/process-output IO (str "failed to parse: no matching action to " cmd))
       1 (let [action (first actions)]
-          (if (compare params (:Types action))
+          (if (compare (map :Type params-list) (:Types action))
             ((:Function action) params)
             (ioframes/process-output IO (str "failed to parse: types mismatch " cmd ": " action ":" params))))
       (ioframes/process-output IO (str "failed to parse: too many matched action to " cmd ": " actions)))))


Preserve npm string-style requires for cljr-clean-ns

bugfix

--- src/refactor_nrepl/ns/rebuild.clj
+++ src/refactor_nrepl/ns/rebuild.clj
@@ -97,16 +97,22 @@
     :all
     (sort dependency-comparator referred)))

+(defn- type-preserving [f x]
+  (when x
+    (when-let [r (f x)]
+      (cond
+        (string? x) (str r)
+        (symbol? x) (symbol r)))))
+
 (defn- ns-prefix
   "Extracts the prefix from a libspec."
   [{:keys [ns]}]
-  (if (prefix ns)
-    (symbol (prefix ns))
-    :none))
+  (or (type-preserving prefix ns)
+      :none))

 (defn- ns-suffix
   [{:keys [ns]}]
-  (-> ns suffix symbol))
+  (type-preserving suffix ns))

 (defn- by-prefix
   [libspecs]
@@ -139,7 +145,7 @@
   [libspecs]
   (vec
    (for [libspec libspecs]
-     (create-libspec (update-in libspec [:ns] #(-> % suffix symbol))))))
+     (create-libspec (assoc libspec :ns (ns-suffix libspec))))))

 (defn- create-libspec-vectors-with-prefix
   [libspecs]


Anti is the artwork.

Anti is the artwork.


Don't quieten row-row.

Don't quieten row-row.

--- src/kolmogorov_music/kolmogorov.clj
+++ src/kolmogorov_music/kolmogorov.clj
@@ -64,7 +64,7 @@
        (canon/canon (canon/simple 4))
        (where :pitch (comp scale/A scale/major))))

-(comment
+(comment
   (live/play row-row)
   (live/jam (var row-row))
 )
@@ -169,7 +169,7 @@

 (defmethod live/play-note :default
   [{hertz :pitch seconds :duration}]
-  (when hertz (instrument/overchauffeur (midi->hz hertz) seconds 0.02)))
+  (when hertz (instrument/overchauffeur (midi->hz hertz) seconds)))

 (defn copyright-infringement-song
   ([skip-to]


cjls.core macro file uses cljc extension not clj

--- src/main/clojure/cljs/compiler.cljc
+++ src/main/clojure/cljs/compiler.cljc
@@ -1056,7 +1056,7 @@
             (let [ext (util/ext src)
                   {:keys [ns] :as ns-info} (ana/parse-ns src)]
               (if-let [cached (and (= (:optimizations opts) :none)
-                                   (not= ext "clj")
+                                   (not= ext "cljc")
                                    (= ns 'cljs.core)
                                    (io/resource "cljs/core.aot.js"))]
                ;; no need to bother with analysis cache reading, handled by


CLJS-1404: var resolution for @param and @return type

--- src/main/clojure/cljs/compiler.cljc
+++ src/main/clojure/cljs/compiler.cljc
@@ -475,37 +475,63 @@
     (emits "(function(){throw " throw "})()")
     (emitln "throw " throw ";")))

-(defn munge-param [line]
-  (if (re-find #"@param" line)
-    (let [[p t n & xs] (map string/trim
-                         (string/split (string/trim line) #" "))]
+(defn resolve-type [env t]
+  (str (:name (ana/resolve-var env (symbol t)))))
+
+(defn resolve-types [env ts]
+  (let [ts (-> ts string/trim (subs 1 (dec (count ts))))
+        xs (string/split ts #"\|")]
+    (str
+      "{"
+      (->> (map #(resolve-type env %) xs)
+        (map munge)
+        (string/join "|"))
+      "}")))
+
+(defn munge-param-return [env line]
+  (cond
+    (re-find #"@param" line)
+    (let [[p ts n & xs] (map string/trim
+                          (string/split (string/trim line) #" "))]
       (if (and (= "@param" p)
-               t #?(:clj  (.startsWith ^String t "{")
-                    :cljs (gstring/startsWith t "{")))
-        (string/join " " (concat [p t (munge n)] xs))
+               ts #?(:clj  (.startsWith ^String ts "{")
+                     :cljs (gstring/startsWith ts "{")))
+        (string/join " " (concat [p (resolve-types env ts) (munge n)] xs))
         line))
-    line))
+
+    (re-find #"@return" line)
+    (let [[p ts & xs] (map string/trim
+                        (string/split (string/trim line) #" "))]
+      (if (and (= "@return" p)
+               ts #?(:clj  (.startsWith ^String ts "{")
+                     :cljs (gstring/startsWith ts "{")))
+        (string/join " " (concat [p (resolve-types env ts)] xs))
+        line))
+
+    :else line))

 (defn emit-comment
   "Emit a nicely formatted comment string."
-  [doc jsdoc]
-  (let [docs (when doc [doc])
-        docs (if jsdoc (concat docs jsdoc) docs)
-        docs (remove nil? docs)]
-    (letfn [(print-comment-lines [e]
-              (let [[x & ys] (map munge-param (string/split-lines e))]
-                (emitln " * " (string/replace x "*/" "* /"))
-                (doseq [next-line ys]
-                  (emitln " * "
-                    (-> next-line
-                      (string/replace #"^   " "")
-                      (string/replace "*/" "* /"))))))]
-      (when (seq docs)
-        (emitln "/**")
-        (doseq [e docs]
-          (when e
-            (print-comment-lines e)))
-        (emitln " */")))))
+  ([doc jsdoc]
+    (emit-comment nil doc jsdoc))
+  ([env doc jsdoc]
+   (let [docs (when doc [doc])
+         docs (if jsdoc (concat docs jsdoc) docs)
+         docs (remove nil? docs)]
+     (letfn [(print-comment-lines [e]
+               (let [[x & ys] (map #(munge-param-return env %) (string/split-lines e))]
+                 (emitln " * " (string/replace x "*/" "* /"))
+                 (doseq [next-line ys]
+                   (emitln " * "
+                     (-> next-line
+                       (string/replace #"^   " "")
+                       (string/replace "*/" "* /"))))))]
+       (when (seq docs)
+         (emitln "/**")
+         (doseq [e docs]
+           (when e
+             (print-comment-lines e)))
+         (emitln " */"))))))

 (defn valid-define-value? [x]
   (or (string? x)
@@ -527,7 +553,7 @@
 (defmethod emit* :def
   [{:keys [name var init env doc jsdoc export test var-ast]}]
   (let [mname (munge name)]
-    (emit-comment doc (concat jsdoc (:jsdoc init)))
+    (emit-comment env doc (concat jsdoc (:jsdoc init)))
     (when (:def-emits-var env)
       (when (= :return (:context env))
         (emitln "return ("))


Fixed up sentence and paragraph processing.

--- src/hxgm30/language/syntagmata/lang/core.clj
+++ src/hxgm30/language/syntagmata/lang/core.clj
@@ -41,25 +41,25 @@
            (rand/syllable (syntagmata/stats (select lang-freqs)) :final)))))

 (defn sentence
-  ([stats]
-    (sentence stats (rand-int 10)))
-  ([stats words]
+  ([lang-freqs]
+    (sentence lang-freqs (rand-int 10)))
+  ([lang-freqs words]
     (str
       (->> words
            inc
            range
-           (map (fn [_] (word stats)))
+           (map (fn [_] (word lang-freqs)))
            (string/join " ")
            string/capitalize)
       ".")))

 (defn paragraph
-  ([stats]
-    (paragraph stats (rand-int 10)))
-  ([stats sentence-count]
+  ([lang-freqs]
+    (paragraph lang-freqs (rand-int 10)))
+  ([lang-freqs sentence-count]
     (str
       (->> sentence-count
            inc
            range
-           (map (fn [_] (sentence stats))))
-      " ")))
+           (map (fn [_] (sentence lang-freqs)))
+           (string/join " ")))))


Sorted count count lists by current number of votes

--- src/mafia_votecount/models.clj
+++ src/mafia_votecount/models.clj
@@ -2,17 +2,9 @@
   (:require [clojure.string :as string])
   (:use [korma.db]
         [korma.core]))
-
-(def db
-(let [db-uri (java.net.URI. (System/getenv "DATABASE_URL"))]
-        (->> (string/split (.getUserInfo db-uri) #":")
-          (#(identity {:db (last (string/split (System/getenv "DATABASE_URL") #"\/"))
-                       :classname "org.postgresql.Driver"
-                       :subprotocol "postgresql"
-                       :user (% 0)
-                       :password (% 1)
-                       :subname "//ec2-107-20-222-114.compute-1.amazonaws.com:5432/dbsa7cb9rv7jtk"})))))
-
+
+(def db (h2 {:db "./resources/database"}))
+
 (defdb korma-db db)

 (declare game host player vote)


Remove nonsense

Remove nonsense

--- src/main/clojure/conexp/contrib/nonsense.clj
+++ src/main/clojure/conexp/contrib/nonsense.clj
@@ -1,90 +0,0 @@
-;; Copyright ⓒ the conexp-clj developers; all rights reserved.
-;; The use and distribution terms for this software are covered by the
-;; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
-;; which can be found in the file LICENSE at the root of this distribution.
-;; By using this software in any fashion, you are agreeing to be bound by
-;; the terms of this license.
-;; You must not remove this notice, or any other, from this software.
-
-(ns conexp.contrib.nonsense
-  "What it says."
-  (:use [conexp.base :only (floor, illegal-argument)]))
-
-;;; Doomsday Algorithm
-
-(defn- doomsday-of-year
-  "Returns the doomsday of the year given."
-  [year]
-  (mod (+ 2 year
-          (floor (/ year 4))
-          (- (floor (/ year 100)))
-          (floor (/ year 400)))
-       7))
-
-(defn- leap-year?
-  "Returns true iff year is a leap year."
-  [year]
-  (or (zero? (mod year 400))
-      (and (zero? (mod year 4))
-           (not (zero? (mod year 100))))))
-
-(defn- doomsday-in-month
-  "Returns number of day in month doomsday occurs on."
-  [year month]
-  (condp = month
-    1  (if (leap-year? year) 4 3)
-    2  (if (leap-year? year) 29 28)
-    3  0
-    4  4
-    5  9
-    6  6
-    7  11
-    8  8
-    9  5
-    10 10
-    11 7
-    12 12
-    (illegal-argument month " is not a valid month.")))
-
-(defn- number->weekday
-  "Converts number to weekday."
-  [n]
-  ({0 "Sunday",
-    1 "Monday",
-    2 "Tuesday",
-    3 "Wednesday",
-    4 "Thursday",
-    5 "Friday",
-    6 "Saturday"}
-   (mod n 7)))
-
-(defn weekday-of-date
-  "Returns the day of week of the given date, in Gregorian calendar."
-  [year month day]
-  (let [doomsday (doomsday-of-year year),
-        doomsday-in-month (doomsday-in-month year month)]
-    (number->weekday (+ doomsday (- day doomsday-in-month)))))
-
-;;;
-
-(defn prime?
-  "Returns true iff n is prime with a certainty of (- 1 (/ 1 (expt 2 1000)))"
-  [n]
-  (let [actual-number (if (instance? BigInteger n)
-                        n
-                        (BigInteger. (str n)))]
-    (.isProbablePrime ^java.math.BigInteger actual-number 1000)))
-
-(defn crossfoot
-  "Returns the crossfoot of n."
-  [n]
-  (reduce + (map #(Integer/parseInt (str %)) (str n))))
-
-(defn factorial
-  "Returns n!."
-  [n]
-  (reduce * (range 2 (inc n))))
-
-;;;
-
-nil


One more time...

One more time...

--- src/simplex_clj/models/schema.clj
+++ src/simplex_clj/models/schema.clj
@@ -12,8 +12,8 @@
    :delimiters "`"}))

 (defn create-posts-table-x
-  []
-   (sql/with-connection db-spec
+  [db-cred]
+   (sql/with-connection db-cred
     (sql/create-table
       :clj
       [:id :integer "unsigned" "PRIMARY KEY" "AUTO_INCREMENT"]


breaking up `fail-at` to hopefully make it more readable.

--- src/midje/internal_ideas/report.clj
+++ src/midje/internal_ideas/report.clj
@@ -49,11 +49,14 @@
             :else               (pr-str form)))

         (fail-at [m]
-          [(str "\n" (color/fail "FAIL") " "
-             (when-let [doc (:description m)] (str (pr-str doc) " "))
-             "at " (midje-position-string (:position m)))
-           (when-let [substitutions (:binding-note m)]
-             (str "With table substitutions: " substitutions))])
+          (let [description (when-let [doc (:description m)]
+                              (str (pr-str doc) " "))
+                position (midje-position-string (:position m))
+                table-substitutions (when-let [substitutions (:binding-note m)]
+                                      (str "With table substitutions: " substitutions))]
+            (list
+              (str "\n" (color/fail "FAIL") " " description "at " position)
+              table-substitutions)))

         (indented [lines]
           (map (partial str "        ") lines))]


improve re-frame db spec report

improve re-frame db spec report

--- src/status_im/utils/handlers.cljs
+++ src/status_im/utils/handlers.cljs
@@ -29,6 +29,40 @@
              (log/debug "Handling re-frame event: " (first (get-coeffect context :event)))
              context)))

+(defn- check-spec-msg-path-problem [problem]
+  (let [pred (:pred problem)]
+    (str "Spec: " (-> problem :via last) "\n"
+         "Predicate: " (subs (str (:pred problem)) 0 50))))
+
+(defn- check-spec-msg-path-problems [path path-problems]
+  (str "Key path: " path "\n"
+       "Val: " (pr-str (-> path-problems first :val)) "\n\n"
+       "Number of problems: " (count path-problems) "\n\n"
+       (->> path-problems
+            (map check-spec-msg-path-problem)
+            (interpose "\n\n")
+            (apply str))))
+
+(defn- check-spec-msg [event-id db]
+  (let [explain-data (spec/explain-data :status-im.ui.screens.db/db db)
+        problems     (::spec/problems explain-data)
+        db-root-keys (->> problems (map (comp first :in)) set)
+        heading      #(str "\n\n------\n" % "\n------\n\n")
+        msg          (str "re-frame db spec check failed."
+                          (heading "SUMMARY")
+                          "After event id: " event-id "\n"
+                          "Number of problems: " (count problems) "\n\n"
+                          "Failing root db keys:\n"
+                          (->> db-root-keys (interpose "\n") (apply str))
+                          (heading "PROBLEMS")
+                          (->> problems
+                               (group-by :in)
+                               (map (fn [[path path-problems]]
+                                      (check-spec-msg-path-problems path path-problems)))
+                               (interpose "\n\n-----\n\n")
+                               (apply str)))]
+    msg))
+
 (def check-spec
   "throw an exception if db doesn't match the spec"
   (->interceptor
@@ -36,11 +70,12 @@
    :after
    (fn check-handler
      [context]
-     (let [new-db (get-effect context :db)
-           v (get-coeffect context :event)]
+     (let [new-db   (get-effect context :db)
+           event-id (-> (get-coeffect context :event) first)]
        (when (and new-db (not (spec/valid? :status-im.ui.screens.db/db new-db)))
-         (throw (ex-info (str "spec check failed on: " (first v) "\n " (spec/explain-str :status-im.ui.screens.db/db new-db)) {})))
+         (throw (ex-info (check-spec-msg event-id new-db) {})))
        context))))
+

 (defn register-handler
   ([name handler] (register-handler name nil handler))


Make fancy route definitions

Make fancy route definitions

--- src/storemi/routes/authorship.clj
+++ src/storemi/routes/authorship.clj
@@ -23,7 +23,7 @@
       enforce]]))

 (defn user-owns-story [req]
-  (when-not
+  (when-not
     (st/story-match-by (sess/username req) req)
     {:error "User does not own story"}))

@@ -60,7 +60,7 @@
   (let [title (get-in request [:params :title])
         synopsis (get-in request [:params :synopsis])
         username (sess/username request)
-        story (st/create-story
+        story (st/create-story
                 username title synopsis)]
     (-> (url/story-edit username (:id story))
         redirect
@@ -122,46 +122,39 @@
                       (assoc-in [:params :data] data))]
       (handler request))))

-;; TODO: GET, POST and others actually can take a
-;; function directly instead of an expresssion.
-;; Thus, rewrite to obliterate redundancies.
-
 (def the-routes
   (routes
-    (POST url/story-create-path request
-         (submit-story request))
+    (POST url/story-create-path -> submit-story)

-    (GET url/story-create-path request
-         (page/story-create request))
+    (GET url/story-create-path -> page/story-create)

-    (POST url/story-edit-path _
-         (wrap-parse-script resubmit-story))
+    (POST url/story-edit-path
+          -> (wrap-parse-script resubmit-story))

-    (GET url/story-edit-path request
-         (coerce enforce-user-owned-story page/story-edit))
+    (GET url/story-edit-path
+         -> (coerce enforce-user-owned-story page/story-edit))

-    (POST url/story-delete-path request
-         (delete-story request))
-    (GET url/story-delete-path request
+    (POST url/story-delete-path -> delete-story)
+
+    (GET url/story-delete-path ->
          (coerce enforce-user-owned-story page/story-delete))

-    (GET url/user-index-path request
-         (user-index request))
+    (GET url/user-index-path -> user-index)

-    (GET url/story-index-path request
-         (page/story-index request))
+    (GET url/story-index-path -> page/story-index)

-    (GET url/story-data-path request
-         (story-data request))
+    (GET url/story-data-path -> story-data)

-    (GET url/story-path request
-         (coerce enforce-user-story page/story))
-    (GET url/chapter-path request
-         (coerce enforce-user-story page/story))
-    (GET url/scene-path request
-         (coerce enforce-user-story page/story))
-    ))
+    (GET url/story-path
+         -> (coerce enforce-user-story page/story))
+
+    (GET url/chapter-path
+         -> (coerce enforce-user-story page/story))
+
+    (GET url/scene-path
+         -> (coerce enforce-user-story page/story))))

+


more deps

more deps

--- webapp/project.clj
+++ webapp/project.clj
@@ -5,9 +5,9 @@
             :url "http://www.eclipse.org/legal/epl-v10.html"}
   :dependencies [[org.clojure/clojure "1.6.0"]
                  [hiccup "1.0.5"]
-                 [compojure "1.1.5"]
-                 [ring "1.3.0"]
-                 [com.novemberain/monter "2.0.0"]
+                 [compojure "1.1.9"]
+                 [ring "1.3.1"]
+                 [com.novemberain/monger "2.0.0"]
 ]
   :plugins [[lein-ring "0.8.11"]]
   :main ^:skip-aot webapp.core


Fix compilation errors.

Fix compilation errors.

--- src/org/spootnik/cyanite/rollup.clj
+++ src/org/spootnik/cyanite/rollup.clj
@@ -1,5 +1,7 @@
 (ns org.spootnik.cyanite.rollup
-  "Implements rollup finders for different strategies.")
+  "Implements rollup finders for different strategies."
+  (:require [org.spootnik.cyanite.util :refer [now]]
+            [clojure.tools.logging :refer [info error debug]]))

 (defprotocol RollupFinder
   (find-rollup [this from to]))
@@ -11,23 +13,23 @@
          rollup-def)))

 (defn precise-rollup-finder
+  "Find most precise storage period given the oldest point wanted"
   [{:keys [rollups]}]
   (info "creating precise rollup finder")
   (reify
     RollupFinder
     (find-rollup
-      "Find most precise storage period given the oldest point wanted"
       [this from to]
       (let [within-fn (get-within-fn from)]
         (some within-fn (sort-by :rollup rollups))))))

 (defn resolution-rollup-finder
+  "Find most suitable rollup for given resolution"
   [{:keys [rollups resolution]}]
   (info "creating resolution rollup finder")
   (reify
     RollupFinder
     (find-rollup
-      "Find most suitable rollup for given resolution"
       [this from to]
       (let [within-fn (get-within-fn from)
             sorted-rollups (sort-by :rollup rollups)


fix typo

fix typo

--- src/overtone/sc/examples/demand.clj
+++ src/overtone/sc/examples/demand.clj
@@ -69,7 +69,7 @@
    (let [vals (dwhite 0 15 INF)
          trig (impulse:kr (mouse-x 1 40 1))
          val (demand:kr trig 0 vals)
-         poll (poll trig val \"diwhite val:\")
+         poll (poll trig val \"dwhite val:\")
          freq (+ 340 (* 30 val))]
      (* 0.1 (sin-osc freq)))"
    contributor "Sam Aaron"))


use curly quotes

use curly quotes

quote marks are getting curled left by default, at least this way
they’ll each curl the correct direction

--- src/pc/views/blog/blue_ocean_made_of_ink.clj
+++ src/pc/views/blog/blue_ocean_made_of_ink.clj
@@ -12,7 +12,7 @@
          ", we've been receiving a lot of feedback.
          When it's positive I'm inspired, and when it's critical I'm motivated.
          We've even received encouragement from founders of more popular prototyping tools.
-         This type of praise often brings up the question, \"Aren't they competition?\""]]
+         This type of praise often brings up the question, “Aren't they competition?”"]]

     [:article
      [:blockquote "Our true competition is not the small trickle of non-Tesla electric cars being produced, but rather the enormous flood of gasoline cars pouring out of the world's factories every day."]]


(PDB-3099) implicit facts->inventory relationship

We had the other half of this covered already.

--- src/puppetlabs/puppetdb/query_eng/engine.clj
+++ src/puppetlabs/puppetdb/query_eng/engine.clj
@@ -403,7 +403,7 @@

                :relationships {;; Parents - direct
                                "factsets" {:columns ["certname"]}
-
+                               "inventory" {:columns ["certname"]}
                                ;; Parents - transitive
                                "nodes" {:columns ["certname"]}
                                "environments" {:local-columns ["environment"]


Better error message when moving file fails

--- src/refactor_nrepl/rename_file_or_dir.clj
+++ src/refactor_nrepl/rename_file_or_dir.clj
@@ -129,7 +129,9 @@
   "Actually rename a file."
   [old-path new-path]
   (fs/mkdirs (fs/parent new-path))
-  (fs/rename old-path new-path)
+  (when-not (fs/rename old-path new-path)
+    (throw (ex-info "Failed renaming file!"
+                    {:old-path old-path :new-path new-path})))
   (loop [dir (.getParentFile (File. old-path))]
     (when (empty? (.listFiles dir))
       (.delete dir)


Keep the schema spec open

Keep the schema spec open

--- src/spec/cljc/mikron/compiler/core_spec.cljc
+++ src/spec/cljc/mikron/compiler/core_spec.cljc
@@ -98,7 +98,4 @@
                   :exts   (s/keys* :opt-un [::diff-paths ::interp-paths ::processor-types]))
            (s/conformer
              (fn [{:keys [exts] :as schema-args}]
-               (reduce (fn [schema-args ext]
-                         (assoc schema-args ext (get exts ext)))
-                       (dissoc schema-args :exts)
-                       #{:diff-paths :interp-paths :processor-types}))))))
+               (dissoc (merge schema-args exts) :exts))))))


improve verbage

improve verbage

--- src-cljs/cljsbuild_ui/pages/main.cljs
+++ src-cljs/cljsbuild_ui/pages/main.cljs
@@ -314,8 +314,8 @@
   ;; or being stopped in the middle of compiling
   (doall (map #(mark-missing! prj-key %) bld-ids)))

-(defn- show-lein-startup! [prj-key bld-id]
-  (swap! state assoc-in [:projects prj-key :builds bld-id :state] :lein-startup))
+(defn- show-warming-up! [prj-key bld-id]
+  (swap! state assoc-in [:projects prj-key :builds bld-id :state] :warming-up))

 ;;------------------------------------------------------------------------------
 ;; Compiler Interface
@@ -375,7 +375,7 @@
   (swap! state assoc-in [:projects prj-key :state] :auto)

   ;; update the BuildRows state
-  (doall (map #(show-lein-startup! prj-key %) bld-ids))
+  (doall (map #(show-warming-up! prj-key %) bld-ids))

   (remove-compiled-info! prj-key)

@@ -388,7 +388,7 @@
   (swap! state assoc-in [:projects prj-key :state] :once)

   ;; update the BuildRows state
-  (doall (map #(show-lein-startup! prj-key %) bld-ids))
+  (doall (map #(show-warming-up! prj-key %) bld-ids))

   (remove-compiled-info! prj-key)

@@ -596,8 +596,8 @@
         [:i.fa.fa-exclamation-triangle] (warnings-state (count warnings))]
     :done-with-error
       [:span.errors-2718a [:i.fa.fa-times] "Compiling failed"]
-    :lein-startup
-      [:span [:i.fa.fa-gear.fa-spin] "Leiningen starting..."]
+    :warming-up
+      [:span [:i.fa.fa-gear.fa-spin] "Warming up..."]
     :missing
       [:span [:i.fa.fa-minus-circle] "Output missing"]
     :waiting


Comment out side nav

Comment out side nav

--- src-cljs/frontend/components/app.cljs
+++ src-cljs/frontend/components/app.cljs
@@ -122,7 +122,7 @@
                         {:opts {:keymap keymap
                                 :error-ch (get-in app [:comms :errors])}})
               (when (and inner? logged-in?)
-                (om/build aside/aside-nav (dissoc app-without-container-data :current-build-data)))
+                #_(om/build aside/aside-nav (dissoc app-without-container-data :current-build-data)))

               (om/build page app)])))))))


change name to available tiles

change name to available tiles

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

--- plugins/SlideExplorer2/src/slide_explorer/display.clj
+++ plugins/SlideExplorer2/src/slide_explorer/display.clj
@@ -90,8 +90,8 @@
 (defn add-tile [tile-map indices]
   (assoc tile-map indices (get-tile indices)))

-(defn add-to-visible-tiles [visible-tiles indices]
-  (send-off visible-tiles add-tile indices))
+(defn add-to-available-tiles [available-tiles indices]
+  (send-off available-tiles add-tile indices))

 ;; gui utilities

@@ -185,19 +185,19 @@
                            RenderingHints/VALUE_ANTIALIAS_ON
                            RenderingHints/VALUE_ANTIALIAS_OFF)))))

-(defn paint-tiles [^Graphics2D g visible-tiles]
-  (doseq [[[nx ny nz nt nc nzoom] tagged-image] visible-tiles]
+(defn paint-tiles [^Graphics2D g available-tiles]
+  (doseq [[[nx ny nz nt nc nzoom] tagged-image] available-tiles]
     (let [[x y] (tile-to-pixels [nx ny] [512 512])]
       (when tagged-image
         (.drawImage g (awt-image tagged-image)
                     x y nil)))))

-(defn paint-screen [canvas screen-state visible-tiles]
+(defn paint-screen [canvas screen-state available-tiles]
   (let [g (.getGraphics canvas)]
     (doto g
       (.translate (:x @screen-state) (:y @screen-state))
       enable-anti-aliasing
-      (paint-tiles @visible-tiles)
+      (paint-tiles @available-tiles)
       (.translate (- (:x @screen-state)) (- (:y @screen-state)))
       (.setColor (Color. 0x00A08F))
       (.fillOval (- (+ (/ (:width @screen-state) 2)
@@ -261,10 +261,10 @@
     (fn [_ _ _ _]
       (.repaint canvas))))

-(defn main-canvas [screen-state visible-tiles]
+(defn main-canvas [screen-state available-tiles]
   (doto
     (proxy [Canvas] []
-      (paint [^Graphics g] (paint-screen this screen-state visible-tiles)))
+      (paint [^Graphics g] (paint-screen this screen-state available-tiles)))
     (.setBackground Color/BLACK)))

 (defn main-frame []
@@ -274,10 +274,10 @@

 (defn show []
   (let [screen-state (atom (sorted-map :x 0 :y 0 :z 0 :zoom 0))
-        visible-tiles (agent {})
-        canvas (main-canvas screen-state visible-tiles)
+        available-tiles (agent {})
+        canvas (main-canvas screen-state available-tiles)
         frame (main-frame)]
-    (def vt visible-tiles)
+    (def at available-tiles)
     (def ss screen-state)
     (def f frame)
     (.add (.getContentPane frame) canvas)
@@ -287,12 +287,12 @@
     (handle-resize canvas screen-state)
     (handle-zoom frame screen-state)
     (display-follow canvas screen-state)
-    (display-follow canvas visible-tiles)
+    (display-follow canvas available-tiles)
     frame))

 (defn test-tile [nx ny]
-  (add-to-visible-tiles vt [nx ny 0 0 0 0]))
+  (add-to-available-tiles vt [nx ny 0 0 0 0]))

 (defn test-tiles [nx ny]
   (doseq [i (range nx) j (range ny)]


Fix link to move a post back into unread, ie delete the dismiss-at value.

--- src/oc/storage/api/entries.clj
+++ src/oc/storage/api/entries.clj
@@ -1071,11 +1071,11 @@
         [org-slug board-slug entry-uuid]
         (pool/with-pool [conn db-pool]
           (inbox conn org-slug board-slug entry-uuid :dismiss)))
-      (ANY "/orgs/:org-slug/boards/:board-slug/entries/:entry-uuid/inbox/unread"
+      (ANY "/orgs/:org-slug/boards/:board-slug/entries/:entry-uuid/unread"
         [org-slug board-slug entry-uuid]
         (pool/with-pool [conn db-pool]
           (inbox conn org-slug board-slug entry-uuid :unread)))
-      (ANY "/orgs/:org-slug/boards/:board-slug/entries/:entry-uuid/inbox/unread/"
+      (ANY "/orgs/:org-slug/boards/:board-slug/entries/:entry-uuid/unread/"
         [org-slug board-slug entry-uuid]
         (pool/with-pool [conn db-pool]
           (inbox conn org-slug board-slug entry-uuid :unread)))


fix typo

fix typo

--- src/polismath/conversation.clj
+++ src/polismath/conversation.clj
@@ -76,9 +76,10 @@
      :group-clusters
             (plmb/fnk [conv rating-mat proj opts']
               (kmeans (assoc rating-mat :matrix proj)
-                (:grop-k opts')
+                (:group-k opts')
                 :last-clusters (:group-clusters conv)
                 :cluster-iters (:group-iters opts')))}))
+

 (def med-conv-update-graph2


CMR-8464: Fixed AQL granule search with ECHOCollectionID and ECHOGranuleID.

--- search-app/src/cmr/search/services/aql/conversion.clj
+++ search-app/src/cmr/search/services/aql/conversion.clj
@@ -1,20 +1,22 @@
 (ns cmr.search.services.aql.conversion
   "Contains functions for parsing and converting aql to query conditions"
-  (:require [clojure.string :as str]
-            [clojure.data.xml :as x]
-            [clojure.java.io :as io]
-            [clojure.set :as set]
-            [cmr.common.xml :as cx]
-            [cmr.common.util :as u]
-            [cmr.common.services.errors :as errors]
-            [cmr.search.services.messages.common-messages :as msg]
-            [clj-time.core :as t]
-            [cmr.search.models.query :as qm]
-            [cmr.common-app.services.search.query-model :as cqm]
-            [cmr.common-app.services.search.group-query-conditions :as gc]
-            [cmr.search.services.parameters.conversion :as pc]
-            [cmr.common-app.services.search.params :as common-params]
-            [cmr.search.services.parameters.parameter-validation :as pv]))
+  (:require
+   [clj-time.core :as t]
+   [clojure.data.xml :as x]
+   [clojure.java.io :as io]
+   [clojure.set :as set]
+   [clojure.string :as string]
+   [cmr.common-app.services.search.group-query-conditions :as gc]
+   [cmr.common-app.services.search.params :as common-params]
+   [cmr.common-app.services.search.query-model :as cqm]
+   [cmr.common.concepts :as cc]
+   [cmr.common.services.errors :as errors]
+   [cmr.common.util :as u]
+   [cmr.common.xml :as cx]
+   [cmr.search.models.query :as qm]
+   [cmr.search.services.messages.common-messages :as msg]
+   [cmr.search.services.parameters.conversion :as pc]
+   [cmr.search.services.parameters.parameter-validation :as pv]))

 (def aql-elem->converter-attrs
   "A mapping of aql element names to query condition types based on concept-type"
@@ -58,8 +60,8 @@
              :dayNightFlag {:name :day-night :type :day-night}
              :ECHOLastUpdate {:name :updated-since :type :date-range}
              :onlineOnly {:name :downloadable :type :boolean}
-             :ECHOCollectionID {:name :collection-concept-id :type :string}
-             :ECHOGranuleID {:name :concept-id :type :string}
+             :ECHOCollectionID {:name :collection-concept-id :type :collection-query :coll-tag :ECHOCollectionID}
+             :ECHOGranuleID {:name :concept-id :type :granule-concept-id}
              :ProducerGranuleID {:name :producer-gran-id :type :string}
              :sensorName {:name :sensor :type :string}
              :sourceName {:name :platform :type :string}
@@ -122,9 +124,9 @@
   "Validates the aql pattern string, throws service error if the string contains backslash
   followed by characters other than backslash, % or _"
   [pattern]
-  (let [pattern (str/replace pattern "\\\\" "")
+  (let [pattern (string/replace pattern "\\\\" "")
         invalid-chars (->> ;; Split on \
-                           (str/split pattern (re-pattern "\\\\"))
+                           (string/split pattern (re-pattern "\\\\"))
                            ;; Drop everything before the first \
                            (drop 1)
                            ;; Get the first character following each \
@@ -144,28 +146,28 @@
   (validate-aql-pattern value)
   (-> value
       ;; Escape * and ?
-      (str/replace "*" "\\*")
-      (str/replace "?" "\\?")
+      (string/replace "*" "\\*")
+      (string/replace "?" "\\?")

       ;; Replace a non-escaped percent with *
-      (str/replace #"([^\\\\])(%)" "$1*")
+      (string/replace #"([^\\\\])(%)" "$1*")
       ;; Replace a percent at the beginning of a string with *
-      (str/replace #"^%" "*")
+      (string/replace #"^%" "*")
       ;; Replace any escaped percents with just percents
-      (str/replace "\\%" "%")
+      (string/replace "\\%" "%")

       ;; Replace a non-escaped _ with ?
-      (str/replace #"([^\\])(_)" "$1?")
+      (string/replace #"([^\\])(_)" "$1?")
       ;; Replace a _ at the beginning of a string with ?
-      (str/replace #"^_" "?")
+      (string/replace #"^_" "?")
       ;; Replace any escaped _ with just _
-      (str/replace "\\_" "_")))
+      (string/replace "\\_" "_")))

 (defn aql-elem-case-sensitive?
   "Returns true if the given AQL element has attributes that indicates it should be case sensitive,
   Otherwise return false."
   [elem]
-  (= "N" (str/upper-case (get-in elem [:attrs :caseInsensitive] "N"))))
+  (= "N" (string/upper-case (get-in elem [:attrs :caseInsensitive] "N"))))

 (defn- string-value-elem->condition
   "Converts a string value element to query condition"
@@ -211,7 +213,7 @@

 (defn element->num-range
   [concept-type element]
-  (let [string-double-fn #(when-not (str/blank? %) (Double. (remove-outer-single-quotes %)))
+  (let [string-double-fn #(when-not (string/blank? %) (Double. (remove-outer-single-quotes %)))
         range-val (-> (cx/attrs-at-path element [:range])
                       (set/rename-keys {:lower :min-value :upper :max-value})
                       (update-in [:min-value] string-double-fn)
@@ -259,6 +261,20 @@
         condition (element->condition :collection (assoc element :tag coll-elem-name))]
     (qm/->CollectionQueryCondition condition)))

+(defmethod element->condition :granule-concept-id
+  [concept-type element]
+  (let [gran-condition (string-element->condition concept-type element)
+        provider-ids (->> element
+                          :content
+                          first
+                          :content
+                          (map (comp :provider-id cc/parse-concept-id))
+                          distinct)
+        coll-query-condition (qm/->CollectionQueryCondition
+                              (common-params/parameter->condition
+                               {} :collection :provider provider-ids {}))]
+    (gc/and-conds [coll-query-condition gran-condition])))
+
 (defmethod element->condition :equator-crossing-date
   [concept-type element]
   (let [[start-date stop-date] (parse-date-range-element (cx/element-at-path element [:dateRange]))]


Added steps to history output format.

Added steps to history output format.

--- test/staircase/test/histories.clj
+++ test/staircase/test/histories.clj
@@ -75,5 +75,5 @@
           (is (= "changed the title" (:title retrieved))))
         (testing "Changed, and did not add a history"
           (is (= 1 (count hists)))
-          (is (= {:owner "quux@bar.org" :title "changed the title" :description "A testing history" :id new-id} (hists 0))))))))
+          (is (= {:steps 0 :owner "quux@bar.org" :title "changed the title" :description "A testing history" :id new-id} (hists 0))))))))


CMR-3430: Cleaned up an extra empty line.

--- system-int-test/test/cmr/system_int_test/search/collection_keyword_search_test.clj
+++ system-int-test/test/cmr/system_int_test/search/collection_keyword_search_test.clj
@@ -520,7 +520,6 @@
   (let [coll1 (d/ingest "PROV1"
                         (-> exp-conv/example-collection-record
                             (assoc :AncillaryKeywords ["CMR2652AKW1" "CMR2652AKW2"])
-
                             (assoc :DirectoryNames
                                    [(um/map->DirectoryNameType
                                      {:ShortName "CMR2654DNSN1" :LongName "CMR2654DNLN1"})])


Add support for multiple Slack configurations

--- src/yetibot/core/adapters/slack.clj
+++ src/yetibot/core/adapters/slack.clj
@@ -19,24 +19,29 @@
     [yetibot.core.chat :refer [chat-data-structure send-msg-for-each
                                register-chat-adapter] :as chat]))

-(defn config [] (get-config :yetibot :adapters :slack))
-
-(defonce conn (atom nil))
+(defn all-config
+  "Can be a single slack configuration map or a collection of multiple
+   configurations."
+  [] (get-config :yetibot :adapters :slack))
+
+;; dynamic vars are per-slack config
+(defonce ^{:dynamic true} *conn* (atom nil))
+(defonce ^{:dynamic true} *config* nil)

 (defn self
-  "Slack acount for yetibot from `rtm.start` (represented at (-> @conn :start)).
-   You must call `start` in order to define `conn`."
+  "Slack acount for yetibot from `rtm.start` (represented at (-> @*conn* :start)).
+   You must call `start` in order to define `*conn*`."
   []
-  (-> @conn :start :self))
+  (-> @*conn* :start :self))

 (defn slack-config []
-  (let [c (config)]
+  (let [c *config*]
     {:api-url (:endpoint c) :token (:token c)}))

 (def ^{:dynamic true
        :doc "the channel or user that a message came from"} *target*)

-(defn rooms [] (:rooms (config)))
+(defn rooms [] (:rooms *config*))

 ;;;;

@@ -160,9 +165,9 @@
   (filter #((-> % :members set) user-id) chans-or-grps))

 (defn reset-users-from-conn []
-  (let [groups (-> @conn :start :groups)
-        channels (-> @conn :start :channels)
-        users (-> @conn :start :users)]
+  (let [groups (-> @*conn* :start :groups)
+        channels (-> @*conn* :start :channels)
+        users (-> @*conn* :start :users)]
     (dorun
       (map
         (fn [{:keys [id] :as user}]
@@ -186,26 +191,36 @@
 ;; start/stop

 (defn stop []
-  (when @conn
-    (slack/send-event (:dispatcher @conn) :close))
-  (reset! conn nil))
+  (when @*conn*
+    (log/info "Closing" @*conn*)
+    (slack/send-event (:dispatcher @*conn*) :close))
+  (reset! *conn* nil))

 (defn start []
   (stop)
-  (reset! conn (slack/connect (slack-config)
-                              :on-connect on-connect
-                              :on-error on-error
-                              :on-close on-close
-                              :presence_change on-presence-change
-                              :channel_joined on-channel-joined
-                              :group_joined on-channel-joined
-                              :channel_left on-channel-left
-                              :group_left on-channel-left
-                              :manual_presence_change on-manual-presence-change
-                              :message on-message
-                              :hello on-hello))
-
-  (reset-users-from-conn))
+  (let [ac (all-config)
+        ; make it a vector if it isn't already
+        configs (if (map? ac) [ac] ac)]
+    (dorun
+      (map
+        (fn [config]
+          (binding [*config* config
+                    *conn* (atom nil)]
+            (log/info "setting up" *config*)
+            (reset! *conn* (slack/connect (slack-config)
+                                          :on-connect on-connect
+                                          :on-error on-error
+                                          :on-close on-close
+                                          :presence_change on-presence-change
+                                          :channel_joined on-channel-joined
+                                          :group_joined on-channel-joined
+                                          :channel_left on-channel-left
+                                          :group_left on-channel-left
+                                          :manual_presence_change on-manual-presence-change
+                                          :message on-message
+                                          :hello on-hello))
+            (reset-users-from-conn)))
+        configs))))

 (defn list-channels [] (channels/list (slack-config)))


Improve testing of (broken) default handling

--- tests/eval/multi-methods/bat.cljc
+++ tests/eval/multi-methods/bat.cljc
@@ -14,8 +14,8 @@
   (str "str: " x ", " y ", " (first xs) " and " (second xs)))
 (defmethod-joke bat [N N] [x y & xs]
   (str "numbers: " x " and " y))
-;; (defmethod-joke bat :default [x y & xs]
-;;   (str "default:" x " then " y " and finally " xs))
+(defmethod-joke bat :default [x y & xs]
+  (str "default:" x " then " y " and finally " xs))

 ;; you call it like this...

@@ -33,3 +33,17 @@

 (println (bat :hey :there))
 ;; => IllegalArgumentException No method in multimethod 'bat' for dispatch value: [clojure.lang.Keyword clojure.lang.Keyword]  clojure.lang.MultiFn.getFn (MultiFn.java:156)
+
+
+;; identity form returns the same value passed
+(ns-unmap *ns* 'factorial)
+(defmulti-joke factorial identity)
+
+(defmethod-joke factorial 0 [_]  1)
+(defmethod-joke factorial :default [num]
+    (* num (factorial (dec num))))
+
+(println (factorial 0)) ; => 1
+(println (factorial 1)) ; => 1
+(println (factorial 3)) ; => 6
+(println (factorial 7)) ; => 5040


Simplifying the expressions

Simplifying the expressions

--- src/clj/algorithms_clj/derivative.clj
+++ src/clj/algorithms_clj/derivative.clj
@@ -19,22 +19,45 @@
   [expr]
   (or
     (= (first expr) '*) ;; Works with simple quote
-    (= (first expr) `*) ;; Works with ` quote
+    (= (first expr) `*) ;; Works with syntax quote
     ))

 (defn sum?
   [expr]
   (or
     (= (first expr) '+) ;; Works with simple quote
-    (= (first expr) `+) ;; Works with ` quote
+    (= (first expr) `+) ;; Works with syntax quote
     ))
+
+(defn make-sum
+  "Simplify the sum, adding the constants together"
+  [terms]
+  (let [parts (group-by number? terms)
+        number-sum (reduce + (parts true))]
+    (cond
+      (empty? (parts true)) (list* '+ (parts false))
+      (empty? (parts false)) number-sum
+      :else (list* '+ number-sum (parts false))
+      )))
+
+(defn make-product
+  "Simplify the product, multiplying the constants together"
+  [terms]
+  (let [parts (group-by number? terms)
+        product (reduce * (parts true))]
+    (cond
+      (empty? (parts true)) (list* '* (parts false))
+      (empty? (parts false)) product
+      (zero? product) 0
+      :else (list* '* product (parts false))
+      )))

 (declare derivative)

 (defn derivative-prod
   [terms var]
   (for [r (rotations terms)]
-    (list* '* (derivative (first r) var) (rest r))
+    (make-product (conj (rest r) (derivative (first r) var)))
     ))

 (defn derivative
@@ -43,8 +66,8 @@
   (cond
     (number? expr) 0
     (symbol? expr) (if (= expr var) 1 0)
-    (sum? expr) (list* '+ (map  #(derivative % var) (rest expr)))
-    (prod? expr) (list* '+ (derivative-prod (rest expr) var))
+    (sum? expr) (make-sum (map  #(derivative % var) (rest expr)))
+    (prod? expr) (make-sum (derivative-prod (rest expr) var))
     ))

 ;; ---------------------------------------------------------------
@@ -58,11 +81,19 @@
   (prn (derivative 'x 'x))
   (prn (derivative 'x 'y))
   (prn (derivative `x `x))
-
+  (println "------------------")
+  (prn (make-sum ['x 'y]))
+  (prn (make-sum [1 2 3]))
+  (prn (make-sum [1 0 'x 5 'y]))
+  (println "------------------")
+  (prn (make-product ['x 'y]))
+  (prn (make-product [1 'x 0]))
+  (prn (make-product [2 'y 'x 5]))
+  (println "------------------")
   (prn (derivative (list '+ 'x 1) 'x))
   (prn (derivative `(+ x 1) `x))
   (prn (derivative `(* x 2) `x))
-
+  (println "------------------")
   (prn (derivative `(+ x (* x x y)) `x))
   )


Remove magic number 64 from pick-color function

--- src/cljs/goya/components/drawing.cljs
+++ src/cljs/goya/components/drawing.cljs
@@ -96,8 +96,8 @@
 ;; =============================================================================
 ;; Pick color

-(defn pick-color [app doc-x doc-y]
-  (let [index (geometry/flatten-to-index doc-x doc-y 64)
+(defn pick-color [app doc-x doc-y doc-width]
+  (let [index (geometry/flatten-to-index doc-x doc-y doc-width)
         color (nth (get-in @app [:main-app :image-data]) index)]
     (om/update! app [:tools :paint-color] color)))

@@ -385,6 +385,7 @@
                   [x y] (unpack-event e)
                   zoom-factor (get-in @app [:zoom-factor])
                   [doc-x doc-y] (geometry/screen-to-doc x y zoom-factor)
+                  doc-width (get-in @app [:main-app :canvas-width])
                   paint-tool (get-in @app [:tools :paint-tool])]

                   (when (= event-type "mousedown")
@@ -422,7 +423,7 @@
                     (when (= paint-tool :fill)
                       (visit-pixels-for-fill-tool doc-x doc-y (get-in @app [:main-app :image-data])))
                     (when (= paint-tool :picker)
-                      (pick-color app doc-x doc-y))
+                      (pick-color app doc-x doc-y doc-width))
                     (when (and (= paint-tool :selection) (not (om/get-state owner :user-is-moving-selection)))
                       (make-selection app owner doc-x doc-y))
                     (when (and (= paint-tool :selection) (om/get-state owner :user-is-moving-selection))


Removing commented out code and fixing logging message.

--- src/cmr/bootstrap/data/bulk_index.clj
+++ src/cmr/bootstrap/data/bulk_index.clj
@@ -28,7 +28,7 @@
 (defn- index-granules-for-collection
   "Index the granules for the given collection."
   [system provider-id collection-id]
-  (info (str "Indexing granule data for collection" collection-id))
+  (info "Indexing granule data for collection" collection-id))
   (let [db (get-in system [:metadata-db :db])
         params {:concept-type :granule
                 :provider-id provider-id
@@ -41,10 +41,6 @@
   "Index the granule data for every collection for a given provider."
   [system provider-id]
   (info "Indexing granule data for provider" provider-id)
-  #_(dorun (pmap
-           (partial index-granules-for-collection system provider-id)
-           (get-provider-collection-list system provider-id)))
-
   (doseq [collection-id (get-provider-collection-list system provider-id)]
     (index-granules-for-collection system provider-id collection-id))


Fix async require on async cljs

Fix async require on async cljs

--- src/com/wsscode/common/async_cljs.clj
+++ src/com/wsscode/common/async_cljs.clj
@@ -1,4 +1,5 @@
-(ns com.wsscode.common.async-cljs)
+(ns com.wsscode.common.async-cljs
+  (:require [cljs.core.async :as async]))

 (defmacro if-cljs
   [then else]


Accept either project name or project directory.

This preserves the original treatment of the `project` parameter while allowing
for it to alternatively specify the path to a directory containing `project.clj`
for an ezbake project.

Signed-off-by: Wayne <b9526479d8e75eec48092197447318d86d2194ec@puppetlabs.com>

--- src/puppetlabs/ezbake/core.clj
+++ src/puppetlabs/ezbake/core.clj
@@ -125,6 +125,15 @@
       (if (fs/directory? f)
         (fs/copy-dir f staging-dir)
         (fs/copy+ f (format "%s/%s" staging-dir (fs/base-name f)))))))
+
+(defn get-project-file
+  [project]
+  (let [project-file-by-dir (.toString (fs/file project "project.clj"))
+        project-file-by-name (.toString (fs/file "configs/" project
+                                                 (str project ".clj")))]
+    (if (fs/file? project-file-by-dir)
+      project-file-by-dir
+      project-file-by-name)))

 (defn cp-project-file
   [project-file template-vars]
@@ -503,10 +512,10 @@
   (exit 1 (str/join \newline ["Unrecognized option:" action "" (usage)])))

 (defn ezbake-init
-  [action project-dir template-vars]
+  [action project template-vars]
   (clean)
   (fs/mkdirs staging-dir)
-  (let [project-file (.toString (fs/file project-dir "project.clj"))
+  (let [project-file (get-project-file project)
         template-vars (->> template-vars
                         (map #(str/split % #"="))
                         (into {}))]
@@ -524,11 +533,11 @@
 (defn -main
   [& args]
   (if (>= (count args) 2)
-    (let [[action project-dir & template-vars] args]
+    (let [[action project & template-vars] args]
       (if-not (every? (partial re-find #"=") template-vars)
         (exit 1 "Arguments after the project name are expected to be variable bindings of the form <variable>=<value>")
         (try
-          (ezbake-init action project-dir template-vars)
+          (ezbake-init action project template-vars)
           (finally
             ;; this is required in order to make the threads started by sh/sh terminate,
             ;; and thus allow the jvm to exit


+irregular imperfect for lexical compilation

--- src/babel/francais/lexicon.cljc
+++ src/babel/francais/lexicon.cljc
@@ -104,7 +104,13 @@
              :français {:exception false
                         :present {:regular false
                                   :conjugated false}}
-             :d-verb-irreg true})
+             :d-verb-irreg-present true})
+
+   (default {:synsem {:cat :verb}
+             :français {:exception false
+                        :imperfect {:regular false
+                                    :conjugated false}}
+             :d-verb-irreg-imperfect true})

    ;; Verbs are *not* aux unless explicitly stated as such..
    (default {:synsem {:cat :verb


Make ratom-flush placeholder function a simple fn

--- src/reagent/impl/batching.cljs
+++ src/reagent/impl/batching.cljs
@@ -40,7 +40,7 @@

 ;; Set from ratom.cljs
-(defonce ratom-flush identity)
+(defonce ratom-flush (fn []))

 (deftype RenderQueue [^:mutable ^boolean scheduled?]
   Object


adjusted indentation in filter.

adjusted indentation in filter.

--- src/clj/forma/trends/filter.clj
+++ src/clj/forma/trends/filter.clj
@@ -18,6 +18,8 @@

 ;; De-seasonalize time-series

+;; TODO: What's a monthly dummy vector? Can you describe why we need
+;; these?
 (defn seasonal-rows [n]
   "lazy sequence of monthly dummy vectors."
   (->> (cycle (cons 1 (repeat 11 0)))
@@ -145,10 +147,9 @@
   [bad-set reli-coll val-coll]
   (let [avg (act-on-good average
                          (mask bad-set reli-coll val-coll))]
-    (replace-index-set
-     (bad-ends bad-set reli-coll)
-     avg
-     val-coll)))
+    (replace-index-set (bad-ends bad-set reli-coll)
+                       avg
+                       val-coll)))

 ;; TODO: This function works, but it's ugly.  Clean up. And put in
 ;; pre- and post-conditions.
@@ -162,22 +163,16 @@
   is not true, then an adjustment will have to be made to this function."
   [bad-set good-set quality-coll value-coll]
   (if (empty? (filter bad-set quality-coll)) nil
-      (let [bad-end-set (bad-ends
-                         bad-set
-                         quality-coll)
-            new-qual (replace-index-set
-                      bad-end-set
-                      (first good-set)
-                      quality-coll)
-            new-vals (neutralize-ends
-                      bad-set
-                      quality-coll
-                      value-coll)
-            good-seq (positions
-                      (complement bad-set)
-                      new-qual)]
+      (let [bad-end-set (bad-ends bad-set quality-coll)
+            new-qual (replace-index-set bad-end-set
+                                        (first good-set)
+                                        quality-coll)
+            new-vals (neutralize-ends bad-set
+                                      quality-coll
+                                      value-coll)
+            good-seq (positions (complement bad-set)
+                                new-qual)]
         (vec (flatten
               (vector (map (partial stretch-ts new-vals)
                            (partition 2 1 good-seq))
                       (nth new-vals (last good-seq))))))))
-


refactor Akamatsu Mem Chip to use :in-play

--- src/clj/game/cards-hardware.clj
+++ src/clj/game/cards-hardware.clj
@@ -2,7 +2,7 @@

 (def cards-hardware
   {"Akamatsu Mem Chip"
-   {:effect (effect (gain :memory 1)) :leave-play (effect (lose :memory 1))}
+   {:in-play [:memory 1]}

    "Archives Interface"
    {:events {:no-action {:effect (req (toast state :runner "Click Archives Interface to remove 1 card in Archives from the game instead of accessing it" "info")
@@ -79,7 +79,7 @@
                                      :hand-size-modification bonus))))))
       :leave-play (req (remove-watch state (keyword (str "brainchip" (:cid card))))
                        (lose state :runner
-                             :memory (runner-points @state)
+                             :memory (runner-points @state)
                              :hand-size-modification (runner-points @state)))})

    "Capstone"


automate Trope adding cards to Stack

automate Trope adding cards to Stack

stealing the method from Jackson Howard

--- src/clj/game/cards-programs.clj
+++ src/clj/game/cards-programs.clj
@@ -414,6 +414,13 @@
    "Trope"
    {:events {:runner-turn-begins {:effect (effect (add-prop card :counter 1))}}
     :abilities [{:label "Remove Trope from the game to reshuffle cards from Heap back into Stack"
-                 :cost [:click 1] :msg (msg "reshuffle " (:counter card) " card" (when (> (:counter card) 1) "s")
-                                            " in the Heap back into their Stack")
-                 :effect (effect (move card :rfg))}]}})
+                 :effect (effect
+                          (move card :rfg)
+                          (resolve-ability
+                           {:show-discard true
+                            :choices {:max (:counter card) :req #(and (:side % "Runner") (= (:zone %) [:discard]))}
+                            :msg (msg "shuffle " (join ", " (map :title targets))
+                                      " into their Stack")
+                            :effect (req (doseq [c targets] (move state side c :deck))
+                                         (shuffle! state side :deck))}
+                           card nil))}]}})


Showing games as links to /game/:id

Showing games as links to /game/:id

--- src/cljs/battlesnake/lobby.cljs
+++ src/cljs/battlesnake/lobby.cljs
@@ -40,7 +40,8 @@
 (defn game-list []
   [:ul
    (for [game @all-games]
-     [:li (game :name)])])
+     [:li
+      [:a {:href (str "/game/" (game :id))} (game :name)]])])

 (defn lobby []
   [:div


Feature merge of async auto-complete

Feature merge of async auto-complete

--- src/cljs/farsight_orb/core.cljs
+++ src/cljs/farsight_orb/core.cljs
@@ -28,7 +28,8 @@
                           :events []
                           :connected false
                           :players []
-                          :auto-complete-results []}))
+                          :auto-complete-results []
+                          :ac-chan (chan)}))

 (defn submit-new-text [data owner]
   (let [new-text (-> (om/get-node owner "new-text") .-value)]
@@ -66,13 +67,20 @@
           nil)
         (recur (:event (<! ch-chsk))))))

+(defn autocomplete-results-loop
+  "Handle auto-complete results asynchronously"
+  [app owner]
+  (go (while true
+        (let [result (<! (:ac-chan app))]
+        (om/transact! app :auto-complete-results #(conj % result))))))
+
 (defn update-player-search [value app]
-  (if (empty? value)
-    (om/update! app :auto-complete-results [])
-    (let [pattern (re-pattern value)
-           results (filter
-                     #(re-find pattern (clojure.string/lower-case %)) (:players app))]
-        (om/update! app :auto-complete-results results))))
+  (om/update! app :auto-complete-results [])
+  (if (not (empty? value))
+    (let [pattern (re-pattern (clojure.string/lower-case value))]
+      (doseq [player (:players app)]
+        (if (re-find pattern (clojure.string/lower-case player))
+          (put! (:ac-chan app) player))))))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

@@ -92,7 +100,8 @@
                                  res))}))
     om/IWillMount
     (will-mount [this]
-                (event-loop app owner))
+      (event-loop app owner)
+      (autocomplete-results-loop app owner))
     om/IRenderState
     (render-state [this state]
             (if (not (:connected app))
@@ -108,8 +117,7 @@
                                                   :onInput #(update-player-search (.. % -target -value) app)}))
                                (g/row {:class "player-search-results"}
                                       (dom/h2 "Results")
-                                      (if (empty? (:auto-complete-results @app-state))
-                                        (dom/span "No results.")
+                                      (if (not (empty? (:auto-complete-results @app-state)))
                                         (dom/ul
                                          (map
                                           #(dom/li %)


Clojure impl: Rewrite function docstrings: fix grammar and semantics.

--- src/clojure/srcs/dnsresolvd.clj
+++ src/clojure/srcs/dnsresolvd.clj
@@ -35,19 +35,19 @@
     (:import [java.net Inet6Address])
 )

-;##
-; Performs DNS lookup action for the given hostname,
-; i.e. (in this case) IP address retrieval by hostname.
-;
-; Args:
-;     hostname: The effective hostname to look up for.
-;
-; Returns:
-;     The list containing IP address of the analyzing host/service
-;     and corresponding IP version (family) used to look up in DNS:
-;     "4" for IPv4-only hosts, "6" for IPv6-capable hosts.
-;
-(defn dns-lookup [hostname]
+(defn dns-lookup
+    "Performs DNS lookup action for the given hostname,
+    i.e. (in this case) IP address retrieval by hostname.
+
+    Args:
+        hostname: The effective hostname to look up for.
+
+    Returns:
+        The list containing IP address of the analyzed host/service
+        and a corresponding IP version (family) used to look up in DNS:
+        "4" for IPv4-only hosts, "6" for IPv6-capable hosts.
+    " [hostname]
+
     ; Trying to get an A record (IPv4) for the host or its AAAA record (IPv6).
     (try
         (let [hostent (InetAddress/getByName hostname)]
@@ -72,7 +72,7 @@
         req: The incoming HTTP request object.

     Returns:
-        TODO: TBD.
+        The HTTP status code, response headers, and a body of the response.
     " [req]

     (let [mtd (get req :request-method)]
@@ -190,7 +190,8 @@
             (write-str resp-buffer0)
     )]

-    ; Returning HTTP status code, response headers, and a body of the response.
+    ; Returning the HTTP status code, response headers,
+    ; and a body of the response.
     (with-channel req channel (send! channel { ; <== Async mode !
         :status  (AUX/RSC-HTTP-200-OK)
         :headers (AUX/add-response-headers fmt)
@@ -213,7 +214,7 @@
               as the first element.

     Returns:
-        The exit code indicating the daemon overall execution status.
+        The exit code indicating the daemon overall termination status.
     " [args]

     (let [port-number (nth args 0)]


fix give a fuck endpoint

fix give a fuck endpoint

--- src/clojure_web_app/handler.clj
+++ src/clojure_web_app/handler.clj
@@ -13,7 +13,7 @@
             [environ.core :refer [env]]
             [ring.middleware.defaults :refer [wrap-defaults site-defaults]]))

-(def fucks-given 0)
+(def fucks-given (atom 0))

 (defroutes app-routes
            (GET "/rest/fuel-near-me" [lat lon limit distance fuel]
@@ -21,9 +21,10 @@
                (response (service/nearby-fuel-prices lat lon limit distance fuel (get-ip-from request)))))
            (GET "/rest/my-location" []
              (fn [request] (response (service/location-by-ip (get-ip-from request)))))
-           (GET "/rest/fuck", [] (fn []
-                                   (do (def fucks-given (inc fucks-given))
-                                       {:status 201 :body {:fucksGiven fucks-given}})))
+           (GET "/rest/fuck", []
+             (fn [_]
+               (do (swap! fucks-given inc)
+                   (response {:fucksGiven @fucks-given}))))
            (GET "/" [] (clojure.java.io/resource "public/index.html"))
            (route/not-found (clojure.java.io/resource "public/404.html")))


refactoring duplication in tests

refactoring duplication in tests

--- test-cljs/complico/test/prices.cljs
+++ test-cljs/complico/test/prices.cljs
@@ -72,29 +72,23 @@
   (is (= (prices/convert-price "£" "2.99" mock-price-conversion-funcs) "1"))
   (is (= (prices/convert-price "£" "3.99" mock-price-conversion-funcs) "2")))

-(defn single-elem-with-price []
-  (hipo/create [:div "£0"]))
+(defn create-elem-with-text [text]
+  (hipo/create [:div text]))

 (deftest should-replace-price-on-elem
-  (-> (single-elem-with-price)
+  (-> (create-elem-with-text "£0")
     (prices/replace-price-on-elem!)
     (dom-helper/get-text-from-node)
     (confirm-text-was-set-to "£XXX")))

-(defn single-elem-with-price-and-trailing-text []
-  (hipo/create [:div "£0 trailing text should stay here"]))
-
 (deftest should-replace-price-on-elem-and-leave-trailing-text
-  (-> (single-elem-with-price-and-trailing-text)
+  (-> (create-elem-with-text "£0 trailing text")
     (prices/replace-price-on-elem!)
     (dom-helper/get-text-from-node)
-    (confirm-text-was-set-to "£XXX trailing text should stay here")))
-
-(defn single-elem-with-multiple-prices []
-  (hipo/create [:div "£0 £0"]))
+    (confirm-text-was-set-to "£XXX trailing text")))

 (deftest should-replace-multiple-prices-on-elem
-  (-> (single-elem-with-multiple-prices)
+  (-> (create-elem-with-text "£0 £0")
     (prices/replace-price-on-elem!)
     (dom-helper/get-text-from-node)
     (confirm-text-was-set-to "£XXX £XXX")))


set query as a required parameter for search (#513)

--- src/ctia/http/routes/common.clj
+++ src/ctia/http/routes/common.clj
@@ -78,7 +78,6 @@
                          :observable.type
                          :observable.value])))

-
 (def sighting-sort-fields
   (apply s/enum (concat default-entity-sort-fields
                         [:observed_time.start
@@ -180,7 +179,6 @@
    and the full resource as body"
   (http-res/created id resource))

-
 ;; These are the filter params, per entity.  We place them here since
 ;; they are used across entity routes.  For example, the
 ;; `ctia/indicator:ID/sightings/search` handler needs to know how to
@@ -201,7 +199,7 @@
    PagingParams
    BaseEntityFilterParams
    SourcableEntityFilterParams
-   {(s/optional-key :query) s/Str
+   {:query s/Str
     (s/optional-key :sort_by) exploit-target-sort-fields}))

 (s/defschema IncidentSearchParams
@@ -209,7 +207,7 @@
    PagingParams
    BaseEntityFilterParams
    SourcableEntityFilterParams
-   {(s/optional-key :query) s/Str
+   {:query s/Str
     (s/optional-key :confidence) s/Str
     (s/optional-key :status) s/Str
     (s/optional-key :reporter) s/Str
@@ -227,7 +225,7 @@
    PagingParams
    BaseEntityFilterParams
    SourcableEntityFilterParams
-   {(s/optional-key :query) s/Str
+   {:query s/Str
     (s/optional-key :indicator_type) s/Str
     (s/optional-key :tags) s/Int
     (s/optional-key :kill_chain_phases) s/Str
@@ -241,7 +239,7 @@
    PagingParams
    BaseEntityFilterParams
    SourcableEntityFilterParams
-   {(s/optional-key :query) s/Str
+   {:query s/Str
     (s/optional-key :disposition_name) s/Str
     (s/optional-key :disposition) s/Int
     (s/optional-key :priority) s/Int
@@ -254,7 +252,7 @@
    PagingParams
    BaseEntityFilterParams
    SourcableEntityFilterParams
-   {(s/optional-key :query) s/Str
+   {:query s/Str
     (s/optional-key :relationship_type) s/Str
     (s/optional-key :source_ref) s/Str
     (s/optional-key :target_ref) s/Str
@@ -265,7 +263,7 @@
    PagingParams
    BaseEntityFilterParams
    SourcableEntityFilterParams
-   {(s/optional-key :query) s/Str
+   {:query s/Str
     (s/optional-key :sensor) s/Str
     (s/optional-key :observables.value) s/Str
     (s/optional-key :observables.type) s/Str
@@ -277,7 +275,7 @@
    PagingParams
    BaseEntityFilterParams
    SourcableEntityFilterParams
-   {(s/optional-key :query) s/Str
+   {:query s/Str
     (s/optional-key :ttp_type) s/Str
     (s/optional-key :intended_effect) s/Str
     (s/optional-key :behavior.malware_type.type) s/Str
@@ -302,7 +300,7 @@
    PagingParams
    BaseEntityFilterParams
    SourcableEntityFilterParams
-   {(s/optional-key :query) s/Str
+   {:query s/Str
     (s/optional-key :actor_type) s/Str
     (s/optional-key :motivation) s/Str
     (s/optional-key :sophistication) s/Str
@@ -315,7 +313,7 @@
    PagingParams
    BaseEntityFilterParams
    SourcableEntityFilterParams
-   {(s/optional-key :query) s/Str
+   {:query s/Str
     (s/optional-key :campaign_type) s/Str
     (s/optional-key :confidence) s/Str
     (s/optional-key :activity) s/Str
@@ -327,7 +325,7 @@
    PagingParams
    BaseEntityFilterParams
    SourcableEntityFilterParams
-   {(s/optional-key :query) s/Str
+   {:query s/Str
     (s/optional-key :stage) s/Str
     (s/optional-key :coa_type) s/Str
     (s/optional-key :impact) s/Str


attempt to fix boolean uniforms

attempt to fix boolean uniforms

--- src/gamma_driver/common/variable.cljs
+++ src/gamma_driver/common/variable.cljs
@@ -45,10 +45,10 @@
         type (:type uniform)
         data (:data input)]
     (case type
-      :bool (.uniform1fv gl location data)
-      :bvec2 (.uniform2fv gl location data)
-      :bvec3 (.uniform3fv gl location data)
-      :bvec4 (.uniform4fv gl location data)
+      :bool (.uniform1iv gl location data)
+      :bvec2 (.uniform2iv gl location data)
+      :bvec3 (.uniform3iv gl location data)
+      :bvec4 (.uniform4iv gl location data)
       :float (.uniform1fv gl location data)
       :vec2 (.uniform2fv gl location data)
       :vec3 (.uniform3fv gl location data)


Can do inserts and deletes on alternative schemas

Still need to handle updates though

--- src/webapp/framework/server/systemfns.clj
+++ src/webapp/framework/server/systemfns.clj
@@ -1266,19 +1266,6 @@

-;zzz
-(defn !get-record-result
-  [{:keys [
-           db-table
-           id
-           fields
-           data-session-id
-           realtime
-           ]}]
-      ;(println (str " !get-record-result DATA_SESSION_ID: " data-session-id))
-      ;(println (str " !get-record-result realtime: " realtime))
-  {:value
-   (get-record   db-table  id  fields  realtime  data-session-id)})

@@ -1830,6 +1817,31 @@

+
+
+;zzz
+(defn !get-record-result
+  [{:keys [
+            db-table
+            id
+            fields
+            data-session-id
+            realtime
+            ]}]
+  (let [
+         schema-name        (get-schema-name-for-session-id   data-session-id)
+         full-table-name    (str schema-name "." db-table)
+         ]
+    ;(println (str " !get-record-result DATA_SESSION_ID: " data-session-id))
+    ;(println (str " !get-record-result realtime: " realtime))
+    {:value
+     (get-record   full-table-name  id  fields  realtime  data-session-id)}))
+
+
+
+
+
+
 (defn delete-recursively [fname]
   (let [func (fn [func f]
                (when (.isDirectory f)


Three new tests: format-from-to-date-for-week

--- test/clj_calendar/calendar_test.clj
+++ test/clj_calendar/calendar_test.clj
@@ -602,3 +602,30 @@
             (.set calendar 2000 11 11 00 00 00)
             (is (= "2000-12-16" (get-last-day-of-week-formatted calendar))))))

+(deftest test-format-from-to-date-for-week-1
+    "Check the function clj-calendar.calendar/format-from-to-date-for-week"
+    (testing "the function clj-calendar.calendar/format-from-to-date-for-week"
+        (is (= "1999-12-19 - 1999-12-25" (format-from-to-date-for-week 2000 0)))
+        (is (= "1999-12-26 - 2000-01-01" (format-from-to-date-for-week 2000 1)))))
+
+(deftest test-format-from-to-date-for-week-2
+    "Check the function clj-calendar.calendar/format-from-to-date-for-week"
+    (testing "the function clj-calendar.calendar/format-from-to-date-for-week"
+        (is (= "2000-01-02 - 2000-01-08" (format-from-to-date-for-week 2000 2)))
+        (is (= "2000-01-09 - 2000-01-15" (format-from-to-date-for-week 2000 3)))
+        (is (= "2000-01-16 - 2000-01-22" (format-from-to-date-for-week 2000 4)))
+        (is (= "2000-01-23 - 2000-01-29" (format-from-to-date-for-week 2000 5)))
+        (is (= "2000-01-30 - 2000-02-05" (format-from-to-date-for-week 2000 6)))
+        (is (= "2000-02-06 - 2000-02-12" (format-from-to-date-for-week 2000 7)))
+        (is (= "2000-02-13 - 2000-02-19" (format-from-to-date-for-week 2000 8)))
+        (is (= "2000-02-20 - 2000-02-26" (format-from-to-date-for-week 2000 9)))
+        (is (= "2000-02-27 - 2000-03-04" (format-from-to-date-for-week 2000 10)))))
+
+(deftest test-format-from-to-date-for-week-3
+    "Check the function clj-calendar.calendar/format-from-to-date-for-week"
+    (testing "the function clj-calendar.calendar/format-from-to-date-for-week"
+        (is (= "2000-12-03 - 2000-12-09" (format-from-to-date-for-week 2000 50)))
+        (is (= "2000-12-10 - 2000-12-16" (format-from-to-date-for-week 2000 51)))
+        (is (= "2000-12-17 - 2000-12-23" (format-from-to-date-for-week 2000 52)))
+        (is (= "2000-12-24 - 2000-12-30" (format-from-to-date-for-week 2000 53)))))
+


Add media types for HLS and MPEG-DASH

Add media types for HLS and MPEG-DASH

The originally registered media type for .m3u8 is
application/vnd.apple.mpegurl, but the de facto standard of the past
several years is application/x-mpegurl, and this is what Apple
currently recommends.

--- ring-core/src/ring/util/mime_type.clj
+++ ring-core/src/ring/util/mime_type.clj
@@ -49,9 +49,11 @@
    "lha"      "application/octet-stream"
    "lzh"      "application/octet-stream"
    "mov"      "video/quicktime"
+   "m3u8"     "application/x-mpegurl"
    "m4v"      "video/mp4"
    "mp3"      "audio/mpeg"
    "mp4"      "video/mp4"
+   "mpd"      "application/dash+xml"
    "mpe"      "video/mpeg"
    "mpeg"     "video/mpeg"
    "mpg"      "video/mpeg"
@@ -80,6 +82,7 @@
    "tar"      "application/x-tar"
    "tif"      "image/tiff"
    "tiff"     "image/tiff"
+   "ts"       "video/mp2t"
    "ttf"      "application/x-font-ttf"
    "txt"      "text/plain"
    "webm"     "video/webm"


small fix

small fix

--- src/cljs/salava/extra/application/ui/application.cljs
+++ src/cljs/salava/extra/application/ui/application.cljs
@@ -369,7 +369,7 @@
     (init-data state {:country "all" :order "mtime" :issuer-name "" :name ""})
     (fn []
       [:div.badges
-       [:p.header (t :social/Latestearnablebadges)]
+       [:p.header (t :social/Newestearnablebadges)]
        (reduce (fn [r application]
                  (conj r [:a {:href "#" :on-click #(do
                                                      (.preventDefault %)