Исправление ошибок в воде интервала дат

Исправление ошибок в воде интервала дат

--- radiolamp-6P3S/src/r6p3s/cpt/input_date_interval.cljs
+++ radiolamp-6P3S/src/r6p3s/cpt/input_date_interval.cljs
@@ -66,8 +66,8 @@
     (render-state [_ {:keys [chan-update]}]
       (let [app-v @app]
         (dom/div #js {:className class-name :style style}
-                 (dom/div nil

+                 (dom/div #js {:className "col-xs-12 col-sm-12 col-md-12 col-lg-12"}
                           (dom/div #js {:className "col-xs-12 col-sm-6 col-md-6 col-lg-6"}
                                    (om/build input/component-form-group (app :from-date)
                                              {:opts {:label       "с даты"
@@ -82,8 +82,9 @@
                                                      :spec-input  {:type                      "date" :placeholder "yyyy-MM-dd"
                                                                    :onChange-valid?-fn        common-input/vldfn-not-empty-date
                                                                    :onChange-updated-valid-fn #(put! chan-update 1)}}})))
+
                  (when (or (get-in app-v [:from-date :text-warning]) (get-in app-v [:to-date :text-warning]))
-                   (dom/div #js {:className "text-info"
-                                 :style #js {:textAlign "center"}}
-                            (glyphicon/render "info-sign")
-                            " Необходиме вводить в дату в формате yyyy-MM-dd, наример 2016-11-01")))))))
+                   (dom/p #js {:className "text-warning"
+                               :style #js {:textAlign "center"}}
+                          (glyphicon/render "info-sign")
+                          " Необходиме вводить в дату в формате yyyy-MM-dd, наример 2016-11-01")))))))


CMR-4891: Updated project metadata for Clojars.

--- site-templates/project.clj
+++ site-templates/project.clj
@@ -1,6 +1,6 @@
 (defproject gov.nasa.earthdata/cmr-site-templates "0.1.0-SNAPSHOT"
-  :description "FIXME: write description"
-  :url "https://github.com/cmr-exchange/cmr-site-templates"
+  :description "Selmer templates for CMR documentation, directory pages, and various static web content"
+  :url "https://github.com/nasa/Common-Metadata-Repository/site-templates"
   :license {
     :name "Apache License, Version 2.0"
     :url "http://www.apache.org/licenses/LICENSE-2.0"}


Fix for javascript read binary method

Fix for javascript read binary method

Signed-off-by: Yen-Chin Lee <082d453d72dce940e12089a4ad48b97cfe1f3ec4@gmail.com>

--- src/emulator_4917/core.cljc
+++ src/emulator_4917/core.cljc
@@ -151,10 +151,10 @@
              (.toByteArray out))
            :cljs
            (->  (nodejs/require "fs")
-                (.readFileSync file "ascii")
+                (.readFileSync file "binary")
                 .toString
-                gcrypt/stringToByteArray)
-           ))))
+                gcrypt/stringToByteArray))
+        )))

 (defn -main [& args]
   (let [arg1 (nth args 0)]


Adding exception handling to the couchbase side

--- src/hasta_la_vista/core.clj
+++ src/hasta_la_vista/core.clj
@@ -95,6 +95,17 @@
   ;return
   client-connection)

+(defn get-batch
+  [client-conn design-document-name view-name query-options batch-size]
+  (client/lazy-query client-conn design-document-name view-name query-options batch-size))
+
+(defn get-ids
+  [batch]
+  (try
+    {:ok (doall (map client/view-id batch)) }
+  (catch Exception e
+    {:error "Exception" :fn "get-ids" :exception (.getMessage e) })))
+
 (defn exit [n]
   (log/info "init :: stop")
   (System/exit n))
@@ -150,7 +161,7 @@
             ^ManyToManyChannel    stat-chan             (chan)
             ^ManyToManyChannel    work-chan             (chan)
             ^PersistentHashMap    client-config         (get-in config [:ok :couchbase-client])
-            ^CouchbaseCljClient   client                (connect client-config)
+            ^CouchbaseCljClient   client-conn           (connect client-config)
             ^PersistentArrayMap   view-config           (get-in config [:ok :couchbase-view])
             ^String               design-document-name  (:design-document-name view-config)
             ^String               view-name             (:view-name view-config)
@@ -161,7 +172,7 @@
             ^Long                 channel-timeout       (get-in config [:ok :hasta-la-vista :channel-timeout  ])
                                                                                ]

-      (log/info (client/get-available-servers client))
+      (log/info (client/get-available-servers client-conn))

       ;; creating N async threads
       (dotimes [i thread-count]
@@ -183,9 +194,15 @@
       ;; send in all of the ids batch-size amount a time
       (thread
         (Thread/sleep 100)
-        (doseq [r (client/lazy-query client design-document-name view-name query-options batch-size)]
-          (let [ids (map client/view-id r)]
-            (blocking-producer work-chan ids))))
+        (doseq [batch (get-batch client-conn design-document-name view-name query-options batch-size)]
+          (let [ids (get-ids batch)]
+            (cond
+              (:ok ids)
+                (blocking-producer work-chan (:ok ids))
+              (:error ids)
+                (log/error (:error ids))
+              :else
+                (log/error "Neither ok nor error??")))))

       ;; wait till the last message is read in the main thread
       (while true
@@ -197,7 +214,7 @@
                 ;else - timeout
                 (do
                   (log/info "Channel timed out. Stopping...")
-                  (client/shutdown client)
+                  (client/shutdown client-conn)
                   (exit 0)))))))

     ;; end main


cleanup

cleanup

--- Clojure-Websockets/MainApp/src/cljs/birdwatch/core.cljs
+++ Clojure-Websockets/MainApp/src/cljs/birdwatch/core.cljs
@@ -30,7 +30,7 @@
 (cloud/mount-wordcloud state-pub state-in-chan {:n 250 :every-ms 5000})
 (ts-c/mount-ts-chart   state-pub {:every-ms 1000})

-(def state-comp (toolbox/component-with-channels-2
+(def state-comp (toolbox/component-single-in-mult-out
                   state/init-component
                   {:in-chan [:buffer 1]
                    :out-chans {:state-pub-out [:sliding 1] :qry-out [:buffer 1]}}
@@ -41,7 +41,7 @@
 (pipe (-> state-comp :out-chans :state-pub-out) state-pub-chan)

 ;;; Initialization of WebSocket communication.
-(def ws-comp (toolbox-ws/component (buffer 1000) (buffer 1000)))
+(def ws-comp (toolbox-ws/component))
 (pipe (:out-chan ws-comp) state-in-chan)
 (pipe qry-chan (:in-chan ws-comp))

@@ -52,4 +52,4 @@
 (toolbox-r/init-components state-pub state-in-chan
                            [[cv/count-view "tweet-count"] [cv/users-count-view "users-count"]
                             [cv/total-count-view "total-tweet-count"] [sv/search-view "search"]
-                            [pag/pagination-view "pagination"] [st/sort-view "sort-buttons"]])+                            [pag/pagination-view "pagination"] [st/sort-view "sort-buttons"]])


Use File object, not path string

Use File object, not path string

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

--- buildscripts/buildcheck/src/buildcheck/core.clj
+++ buildscripts/buildcheck/src/buildcheck/core.clj
@@ -38,7 +38,7 @@
   (old-files
     (filter
       #(.. % getName (endsWith ".jar"))
-      (file-seq (File. dir)))
+      (file-seq dir))
     time-limit-hours))

 (defn report-build-errors [bits mode]


removed obsolete tunnel-simple

removed obsolete tunnel-simple

--- src/cljc/ow/starbuck/tunnel_simple.cljc
+++ src/cljc/ow/starbuck/tunnel_simple.cljc
@@ -1,10 +0,0 @@
-(ns ow.starbuck.tunnel-simple
-  (:require [ow.starbuck.protocols :as p]
-            [ow.starbuck.message-router :as mr]))
-
-(defrecord TunnelSimple [remote-ruleset]
-
-  p/Tunnel
-
-  (send [this msg]
-    (mr/advance remote-ruleset msg)))


Fixes on search keyboard navigation

Fixes on search keyboard navigation

--- src/cljs/daveconservatoire/site/ui.cljs
+++ src/cljs/daveconservatoire/site/ui.cljs
@@ -13,6 +13,7 @@
             [fulcro.client.data-fetch :as df]
             [fulcro.client.mutations :as um]
             [cljs.spec.alpha :as s]
+            [pushy.core :as pushy]
             [daveconservatoire.site.ui.listeners :as l]
             [clojure.string :as str])
   (:import goog.i18n.DateTimeFormat
@@ -356,9 +357,11 @@
                                           ::l/event      "keydown"
                                           ::l/on-trigger (l/handle-key-events
                                                            {:escape #(um/set-value! this :lesson/search [])
-                                                            :return #(let [{:keys [url/slug]} (nth search (:ui/selected-index search-cursor))]
-                                                                       (om/transact! this `[(app/set-route ~{::r/handler ::r/lesson
-                                                                                ::r/params  {::r/slug slug}})]))})})))
+                                                            :return #(let [{:keys [ui/search-cursor lesson/search]} (om/props this)
+                                                                           {:keys [url/slug]} (nth search (:ui/selected-index search-cursor))
+                                                                           path (r/path-for {::r/handler ::r/lesson
+                                                                                ::r/params  {::r/slug slug}})]
+                                                                       (pushy/set-token! daveconservatoire.site.main/history path))})})))
                   (if (signed-in? props)
                     (user-menu-status this)
                     (if (> score 0)


rename getstarted to get-started

rename getstarted to get-started

--- src/cljs/daveconservatoire/site/ui.cljs
+++ src/cljs/daveconservatoire/site/ui.cljs
@@ -278,13 +278,12 @@
       (dom/p #js {}
         (dom/small #js {} person)))))

-(defn getstarted [{}]
+(defn get-started []
   (dom/div #js {:className "strip"}
     (dom/h1 #js {:className "center"} "Ready to learn something great?")
     (dom/h3 #js {:className "center about_strip"} "Everyone is musical and everyone can learn to play, compose and enjoy music.  All you need to do is . . . ")
     (dom/div #js {:className "pad45"})
     (dom/a #js {:href "/course/music-theory" :className "big_button"} "Get Started")))
-

 (om/defui ^:once LoginPage
   Object
@@ -369,7 +368,7 @@
               (testimonial {:quote "Watching your videos made music seem a lot less like sorcery, they do make it much more magical though." :person "Kristian Theisson, Dave Conservatoire student"})
               (testimonial {:quote "Wishing you all the best with Dave Conservatoire. I'll be sure to share it with my colleagues." :person "Martin Bean, Vice Chancellor, Open University"})
               (testimonial {:quote "The stuff you're doing is super cool! I hope we get the chance to meet and/or collaborate in the not-too-far-off future." :person "Salman Khan, Founder, Khan Academy"}))))
-        (getstarted {})))))
+        (get-started)))))

 (defmethod r/route->component ::r/about [_] AboutPage)


Remove handlers and components from spike

--- src/cljs/event_planner/pages/index.cljs
+++ src/cljs/event_planner/pages/index.cljs
@@ -10,41 +10,11 @@
                                    subscribe]]))

 (register-handler
- :clicked
- (fn
-   [db _]
-   (POST "/api/event"
-         {:handler #(dispatch [:event-response %1])
-          :error-handler #(dispatch [:event-response %1])
-          :format :json
-          :params {:recurring true
-                   :title "Some Time in the Future"
-                   :days-of-week ["Monday"]
-                   :start-time 9
-                   :end-time 17}})
-   (update-in db [:clicks] inc)))
-
-(register-handler
  :event-response
  (fn
    [db [_ event]]
    (let [event-id (:id event 1)]
      (assoc-in db [:events event-id] event))))
-
-;; Subscriptions on database
-
-(register-sub
- :clicks
- (fn
-   [db _]
-   (reaction (:clicks @db))))
-
-(register-sub
- :event
- (fn
-   [db [_ id]]
-   (reaction (get-in @db [:events id]))))
-

 (def days ["Sunday"
            "Monday"
@@ -88,14 +58,7 @@

 (defn index-page []
-  (let [clicks (subscribe [:clicks])]
+  (let []
     [:div
-     [:p "I am a component!"]
-     [:p "I have so many clicks: " @clicks]
-     [:p.someclass
-      "I have " [:em "bold"]
-      [:span {:style {:color "red"}} " and red "] "text."]
-     [:button {:type "button"
-               :on-click #(dispatch [:clicked])} "Click Me!"]
      [:a {:href "/events/1"} "Event 1"]
      [recurring-event-form]]))


cli parser: print stack trace on null pointer exception

--- src/clojure/zensols/actioncli/parse.clj
+++ src/clojure/zensols/actioncli/parse.clj
@@ -231,13 +231,16 @@
   (let [msg (.getMessage e)]
     (if *log-error* (log/error e "action line parse error"))
     (binding [*out* *err*]
-      (if (instance? java.io.FileNotFoundException e)
-        (println (format "%sio error: %s" (program-fmt) msg))
-        (println (format "%serror: %s"
-                         (program-fmt)
-                         (if ex-data
-                           (.getMessage e)
-                           (.toString e)))))))
+      (cond (instance? java.io.FileNotFoundException e)
+            (println (format "%sio error: %s" (program-fmt) msg))
+            (instance? NullPointerException e)
+            (.printStackTrace e)
+            :else
+            (println (format "%serror: %s"
+                             (program-fmt)
+                             (if ex-data
+                               (.getMessage e)
+                               (.toString e)))))))
   (log/debugf "dumping JVM: %s, rethrow: %s"
               *dump-jvm-on-error* *rethrow-error*)
   (if *dump-jvm-on-error*


minor optimization, use conj instead of concat for vector

--- src/adventofcode1/twentyfour.clj
+++ src/adventofcode1/twentyfour.clj
@@ -346,7 +346,7 @@
   "The map `m` contains `k` to several `v`.
    Add the new value `v` to `m`."
   [m [k v]]
-  (assoc m k (vec (concat (or (get m k) []) [v]))))
+  (assoc m k (conj (or (get m k) []) v)))

 (defn into-assoc-duplicates
   "The map `m` contains `k` to several `v`.


Use inc/dec for clarity (thanks, Kibit)

Use inc/dec for clarity (thanks, Kibit)

--- src/afterglow/effects/params.clj
+++ src/afterglow/effects/params.clj
@@ -381,11 +381,11 @@
                               (cond
                                 (< phase fade-in)
                                 (let [fade-phase (/ phase fade-in)]
-                                  (+ base (/ (- (Math/cos (+ (* Math/PI (+ (/ fade-phase 2) 1.5)))) 1) 2)))
+                                  (+ base (/ (dec (Math/cos (+ (* Math/PI (+ (/ fade-phase 2) 1.5))))) 2)))

                                 (> phase fade-out)
                                 (let [fade-phase (/ (- phase fade-out) fade-in)]
-                                  (+ base (/ (+ (Math/cos (+ (* Math/PI (inc (/ fade-phase 2))))) 1) 2)))
+                                  (+ base (/ (inc (Math/cos (+ (* Math/PI (inc (/ fade-phase 2)))))) 2)))

                                 :else
                                 base))


Added support for URIs in text

Added support for URIs in text

--- src/statuses/views/main.clj
+++ src/statuses/views/main.clj
@@ -16,7 +16,7 @@

 (defn nav-links []
   (let [elems [ "/statuses/updates"  "Everything"
-                (str "/statuses/search?q=" (user)) "Mentions"
+                (str "/statuses/search?q=@" (user)) "Mentions"
                 "/statuses/info" "Server info" ]]
     (map (fn [[url text]] [:li (link-to url text)]) (partition 2 elems))))

@@ -25,11 +25,15 @@
         human  (format/unparse (format/formatter "yyyy-MM-dd HH:mm") time)]
     [:time {:datetime rfc822} human]))

+(def uri #"\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'\".,<>?«»“”‘’]))")
+
 (defn linkify [text]
   (let [handle  (fn [[_ m]] (str "@" m ""))
-        hashtag (fn [[_ m]] (str "#" m ""))]
+        hashtag (fn [[_ m]] (str "#" m ""))
+        anchor  (fn [[m _]] (str "" m ""))]
     (-> text
         (clojure.string/replace #"@(\w*)" handle)
+        (clojure.string/replace uri anchor)
         (clojure.string/replace #"#(\w*)" hashtag))))


testin ip gen

testin ip gen

--- test/celestial/integration/proxmox.clj
+++ test/celestial/integration/proxmox.clj
@@ -1,10 +1,10 @@
 (ns celestial.integration.proxmox
   "Integration tests assume a proxmox vm with local address make sure to configure it"
-  (:require [taoensso.carmine :as car])
-  (:use midje.sweet
-        proxmox.provider
+  (:require
+    [proxmox.generators :as g :refer (initialize-range long-to-ip list-used-ips)]
+    [taoensso.carmine :as car])
+  (:use midje.sweet proxmox.provider
         [celestial.redis :only (wcar clear-all)]
-        [proxmox.generators :only (initialize-range long-to-ip)]
         [flatland.useful.map :only  (dissoc-in*)]
         [celestial.common :only (slurp-edn)]
         [celestial.model :only (vconstruct)]
@@ -44,9 +44,10 @@
      (.delete ct))))

 (with-state-changes [(before :facts (clear-all))]
-  (fact "used up ips marking" :integration :redis
+  (fact "used up ips marking" :integration :redis :ip
     (with-conf
-      (do
-        (initialize-range)
-        (map #(-> % Long/parseLong long-to-ip) (wcar (car/zrangebyscore "ips" 1 1))) =>
-            ["192.168.5.170" "192.168.5.171" "192.168.5.173"]))))
+     (g/gen-ip {})  => {:ip_address "192.168.5.100"}
+     (g/list-used-ips) => ["192.168.5.100" "192.168.5.170" "192.168.5.171" "192.168.5.173"]
+     (g/release-ip "192.168.5.100")
+     (g/list-used-ips) => ["192.168.5.170" "192.168.5.171" "192.168.5.173"]
+      )))


added tests for oxford function

added tests for oxford function

--- test/clojure/contrib/humanize_test.clj
+++ test/clojure/contrib/humanize_test.clj
@@ -77,3 +77,41 @@
     (let [string "abcdefghijklmnopqrstuvwxyz"]
       (is (= (truncate string 14) "abcdefghijk..."))
       (is (= (truncate string 14 "...kidding") "abcd...kidding")))))
+
+(deftest oxford-test
+  (let [items ["apple", "orange", "banana", "pear", "pineapple", "strawberry"]]
+    (testing "should return an empty string when given an empty list."
+      (is (= (oxford []) "")))
+
+    (testing "should return a string version of a list that has only one value."
+      (is (= (oxford [(items 0)]) (items 0))))
+
+    (testing "should return items separated by `and' when given a list of values"
+      (is (= (oxford (take 2 items)) (str (items 0) " and " (items 1))))
+      (is (= (oxford (take 3 items)) (str (items 0) ", "
+                                          (items 1) " and " (items 2))))
+      (is (= (oxford (take 4 items)) (str (items 0) ", "
+                                          (items 1) ", "
+                                          (items 2) " and " (items 3)))))
+
+    (testing "should truncate a large list of items with proper pluralization"
+      (is (= (oxford (take 5 items)) (str (items 0) ", "
+                                          (items 1) ", "
+                                          (items 2) ", "
+                                          (items 3) " and " 1 " other")))
+      (is (= (oxford (take 5 items)
+                     :maximum-display 2)
+             (str (items 0) ", "
+                  (items 1) " and " 3 " others"))))
+
+    (testing "should accept custom trucation strings"
+      (let [truncate-noun "fruit"]
+        (is (oxford (take 5 items)
+                    :truncate-noun truncate-noun)
+            (str (items 0) ", "
+                 (items 1) ", "
+                 (items 2) " and " 2 " other " (pluralize 2 truncate-noun)))
+        (is (oxford (take 3 items)
+                    :truncate-string truncate-noun)
+            (str (items 0) ", "
+                 (items 1) " and " (items 2)))))))


remove empty unit test.

remove empty unit test.

--- test/metabase/models/activity_test.clj
+++ test/metabase/models/activity_test.clj
@@ -1,5 +0,0 @@
-(ns metabase.models.activity-test
-  (:require [expectations :refer :all]
-            [korma.core :refer [table]]
-            [metabase.events.activity-feed :refer :all]
-            [metabase.test.data.users :refer :all]))


Delete a comment that is outdated enough to be misleading, especially now that there's a decent docstring.

--- src/useful/experimental.clj
+++ src/useful/experimental.clj
@@ -58,33 +58,6 @@
     `(if ~test
        (let [~@(interleave names thens)] ~@forms)
        (let [~@(interleave names elses)] ~@forms))))
-
-(comment
-  (record-stub StubLayer
-               (fn pr-stub
-                 ([fn-name this args]
-                    (println fn-name "called with" (pr-str args)))
-                 ([fn-name this args ret]
-                    (pr-stub fn-name this args)
-                    (println "==> return" ret)))
-               {Layer {:default :forward
-                       :exceptions #{append-node!}}
-                Append {:default :stub}})
-  ;; expand to
-  (defrecord StubLayer [impl])
-  (let [print-stub (fn pr-stub
-                     ([fn-name args]
-                        (println fn-name "called with" (pr-str args)))
-                     ([fn-name args ret]
-                        (pr-stub fn-name args)
-                        (println "==> return" ret)))]
-    (extend StubLayer
-      Layer
-      {:append-node! (fn [this node whatever]
-                       (print-stub "append-node!" this (list node whatever)))
-       :open (fn [this]
-               (print-stub "open" this (list) (jiraph.layer/open (:impl this))))})))
-

 (letfn [(mapify [coll] (into {} coll)) ;; just for less-deep indenting
         (symbol ([ns sym]              ;; annoying that (symbol 'x 'y) fails


Fix :servlet-name option doc, re: the default value

--- web/src/immutant/web.clj
+++ web/src/immutant/web.clj
@@ -37,8 +37,7 @@
      * :virtual-host  Virtual host name[s] (a String or a List of Strings) [nil]
      * :dispatch?     Invoke handlers in worker thread pool [true]
      * :servlet-name  The name to register the servlet under (gets passed to
-                      ServletInfo, valid for servlets only)
-                      [The simple class name of the servlet]
+                      ServletInfo, valid for servlets only) [the :path]

    Note the web server only binds to the loopback interface, by
    default. To expose your handler to the network, set :host to an


:provides is not a required option

:provides is not a required option

--- sidecar/src/figwheel_sidecar/schemas/cljs_options.clj
+++ sidecar/src/figwheel_sidecar/schemas/cljs_options.clj
@@ -189,9 +189,9 @@

 (def-key ::foreign-libs (s/every
                          (strict-keys
-                          :req-un [::file
-                                   ::provides]
+                          :req-un [::file]
                           :opt-un [::file-min
+                                   ::provides
                                    ::requires
                                    ::module-type
                                    ::preprocess])


Move set innerhtml to jquery

Move set innerhtml to jquery

--- src/cheating_countdown/core.cljs
+++ src/cheating_countdown/core.cljs
@@ -80,8 +80,7 @@
 (defn update-deadline
   [app new-deadline]
   (do
-    (set! (.-innerHTML(.getElementById js/document "deadline-display"))
-        (:deadline @app))
+    (-> (js/jQuery "#deadline-display") (.html (:deadline @app)))
     (om/update! app :deadline new-deadline)))

 ;;Display code for timer component


Don't quote getEnv

Don't quote getEnv

--- src/clj/made_merits/service/github/boyscouting/scraper.clj
+++ src/clj/made_merits/service/github/boyscouting/scraper.clj
@@ -18,5 +18,5 @@
       (hash-map :project repo
                 :results (detector/detect
                            (:body
-                             (client/get (to-url repo) {:oauth-token ~(get (System/getenv) "GITHUB_OAUTH_SECRET")})))))
+                             (client/get (to-url repo) {:oauth-token (get (System/getenv) "GITHUB_OAUTH_SECRET")})))))
     repos))


CMR-3551: Removed debug statements

CMR-3551: Removed debug statements

--- ingest-app/src/cmr/ingest/validation/validation.clj
+++ ingest-app/src/cmr/ingest/validation/validation.clj
@@ -157,8 +157,6 @@
                                                                  (= (:replacement_value %) coll-plat-sn))
                                                      humanizer)))))
         updated-collection (update collection plat-key concat platform-aliases)]
-    (println "========humanizer is: " humanizer "===============")
-    (println "=====platform-aliases: " platform-aliases "===============")
     updated-collection ))

 (defn validate-granule-umm-spec


Now safeguarding around missing metrics file

--- src/aeolian/core.clj
+++ src/aeolian/core.clj
@@ -1,5 +1,6 @@
 (ns aeolian.core
-	(:require [aeolian.parser :as parser]))
+	(:require [aeolian.parser :as parser]
+						[clojure.java.io :as io]))

 (def c-major-notes ["C" "E" "G" "B" "z" "c" "e" "g" "b" "z" "c'" "e'" "g'" "b'" "z"])
 (def c-major-chords ["\"C\"" "\"F\"" "\"G\"" "\"Am\""])
@@ -39,9 +40,16 @@
 		)
 	)

+(defn- generate-notation-from [metrics-file-name]
+	(println (str "Generating ABC Notation from " metrics-file-name "..."))
+	(with-open [rdr (clojure.java.io/reader metrics-file-name)]
+     (let [notation-file-name (generate-notation 4 (line-seq rdr) (str metrics-file-name ".abc"))]
+     	(println (str "Generated " notation-file-name))))
+	)
+
 (defn -main [& args]
-	(println (str "Generating ABC Notation from " (first args) "..."))
-	(with-open [rdr (clojure.java.io/reader (first args))]
-     (let [notation-file-name (generate-notation 4 (line-seq rdr) (str (first args) ".abc"))]
-     	(println (str "Generated " notation-file-name))))
-	)+	(if-let [metrics-file-name (first args)]
+		(if (.exists (io/as-file metrics-file-name))
+			(generate-notation-from metrics-file-name)
+			(println (str "Error: cannot find metrics file - " metrics-file-name)))
+		(println "Error: no metrics file supplied")))


added a bit of ns support.

added a bit of ns support.

--- src/api_test/xml.clj
+++ src/api_test/xml.clj
@@ -24,8 +24,16 @@
 (def ns-request "<?xml version='1.0' encoding='UTF-8'?><v1:getSubBasicInfoRequest xmlns:v1='http://integration.sprint.com/integration/interfaces/getSubBasicInfoBt/v1' xmlns:can='http://integration.sprint.com/v2/common/CanonicalDataModel.xsd'><can:mqMessageHeader><can:messageHeaderVersion>1</can:messageHeaderVersion><can:serviceName>getSubBasicInfoBt</can:serviceName><can:serviceVersion>1</can:serviceVersion><can:dialogTypeCode>2</can:dialogTypeCode><can:dialogSubTypeCode>1</can:dialogSubTypeCode><can:dialogReference>DSA-MSG</can:dialogReference><can:applicationGroup>99S</can:applicationGroup><can:componentGroup>Subscription</can:componentGroup><can:componentName>querySubscriberBasicInfoBt</can:componentName><can:reqSentDateTime>2016-12-19T01:54:09</can:reqSentDateTime><can:applicationUserId>DSAUSER</can:applicationUserId></can:mqMessageHeader><Data><Info><ptn>3094335396</ptn></Info><AddressInfo>true</AddressInfo><DetailInfo>true</DetailInfo></Data></v1:getSubBasicInfoRequest>" )

 (def xml (parse ns-request))
-
-;(pr xml)
+(def zipper (zip/xml-zip xml))
+(def e-xml (map #(pr (str "tag=" (:tag %))) zipper ))
+
+(pr e-xml)
+
+
+
+
+(get-value "can:mqMessageHeader>can:serviceName" ns-request)
+(pr xml)
 ;(get-value "can:
 ;(pr (class (xml/find-xmlns xml)))
 ;(xml/declare-ns :xml.dav "DAV:")
@@ -95,7 +103,7 @@

 (def zipper (zip/xml-zip (parse test-request)))
-
+(pr zipper)
 (def fmatch (map #(zx/tag= %) '(:x)))
 (def match (map #(zx/tag= %) '(:b :c :d)))

@@ -175,6 +183,12 @@
         zipper (zip/xml-zip (parse message))]
     (apply zx/xml1-> zipper (conj (into [] matches) zx/text))))

+(defn get-name
+  [elt]
+  (if (= (class elt) javax.xml.namespace.QName)
+    (str (.getPrefix elt) ":" (.getLocalPart elt))
+    (name elt)))
+
 (defn print-values
   "print set values out of input message"
   [message-file]
@@ -188,10 +202,9 @@
             (do
               (loop [zz z path (str " \"" (zip/node z) "\"")]
                 (if-not (zip/up zz)
-                  (println (str/replace path #"request>(.*)> (\".*\")" "\t| \"$1\" | $2 |"))
+                  (println (str/replace path #".*?>(.*)> (\".*\")" "\t| \"$1\" | $2 |")) ; strips root off .*> for brevity.
                   (do
-                    (println (.getPrefix (:tag (first (zip/up zz)))))
-                    (recur (zip/up zz) (str (name (:tag (zip/node (zip/up zz)))) ">" path)))))))
+                    (recur (zip/up zz) (str (get-name (:tag (zip/node (zip/up zz)))) ">" path)))))))
           (recur (zip/next z)))))))


Fix cljs tests

Fix cljs tests

--- src/test/clojure/clojure/test/check/clojure_test_test.cljc
+++ src/test/clojure/clojure/test/check/clojure_test_test.cljc
@@ -57,7 +57,7 @@
 (defn ^:private capture-clojure-test-reports
   [func]
   (let [log (atom [])]
-    (with-redefs [clojure.test/report #(swap! log conj %)]
+    (with-redefs [test/report #(swap! log conj %)]
       (func))
     @log))


Server form

Server form

--- src/airhead_cljs/core.cljs
+++ src/airhead_cljs/core.cljs
@@ -1,17 +1,33 @@
 (ns airhead-cljs.core
-    (:require [reagent.core :as reagent]))
+  (:require-macros [cljs.core.async.macros :refer [go]])
+  (:require [reagent.core :as r]))
+
+(def state (r/atom {:server "http://localhost:8080"}))
+
+
+(defn change-server! [event]
+  (swap! state
+         assoc :server
+         (-> event .-target .-value)))

 ;; -------------------------
 ;; Views

+(defn server-form []
+  [:div
+   [:input {:type "text"
+            :value (:server @state)
+            :on-change change-server!}]])
+
 (defn home-page []
-  [:div [:h2 "Welcome to Reagent"]])
+  [:div [:h1 "Airhead"]
+   [server-form]])

 ;; -------------------------
 ;; Initialize app

 (defn mount-root []
-  (reagent/render [home-page] (.getElementById js/document "app")))
+  (r/render [home-page] (.getElementById js/document "app")))

 (defn init! []
   (mount-root))


Extract git url function

Extract git url function

--- src/cider_ci/repository/repositories/fetch_and_update.clj
+++ src/cider_ci/repository/repositories/fetch_and_update.clj
@@ -82,6 +82,12 @@
          :deleted (delete-removed-branches tx git-branches (:git_url repository))}))))

+;### git url ##################################################################
+
+(defn git-url [repository]
+  (:git_url repository)
+  )
+
 ;### GIT Stuff ################################################################

 (defn- update-git-server-info [repository]
@@ -106,12 +112,12 @@
     (let [dir (git.repositories/path repository)]
       (system/exec-with-success-or-throw ["rm" "-rf" dir])
       (system/exec-with-success-or-throw
-        ["git" "clone" "--mirror" (:git_url repository) dir]
+        ["git" "clone" "--mirror" (git-url repository) dir]
         {:timeout "30 Minutes"}))))

 (defn- git-fetch [repository path]
   (system/exec-with-success-or-throw
-    ["git" "fetch" (:git_url repository) "--force" "--tags" "--prune"  "+*:*"]
+    ["git" "fetch" (git-url repository) "--force" "--tags" "--prune"  "+*:*"]
     {:timeout "10 Minutes", :dir path, :env {"TERM" "VT-100"}}))

 (defn  git-fetch-or-initialize [repository]


Implement Always Be Running

Implement Always Be Running

--- src/clj/game/cards-resources.clj
+++ src/clj/game/cards-resources.clj
@@ -6,20 +6,28 @@

    "Activist Support"
    {:events
-    {:corp-turn-begins {:req (req (not tagged)) :msg "take 1 tag" :effect (effect (gain :runner :tag 1))}
-     :runner-turn-begins {:req (req (zero? (:bad-publicity corp))) :msg "give the Corp 1 bad publicity"
-                           :effect (effect (gain :corp :bad-publicity 1))}}}
+    {:corp-turn-begins {:req (req (not tagged))
+                        :msg "take 1 tag"
+                        :effect (effect (gain :runner :tag 1))}
+     :runner-turn-begins {:req (req (zero? (:bad-publicity corp)))
+                          :msg "give the Corp 1 bad publicity"
+                          :effect (effect (gain :corp :bad-publicity 1))}}}

    "Adjusted Chronotype"
    {:events {:runner-loss {:req (req (and (some #{:click} target)
                                            (empty? (filter #(= :click %)
                                                            (mapcat first (turn-events state side :runner-loss))))))
-                            :msg "gain [Click]" :effect (effect (gain :runner :click 1))}}}
+                           :msg "gain [Click]" :effect (effect (gain :runner :click 1))}}}

    "Aesops Pawnshop"
    {:abilities [{:msg (msg "trash " (:title target) " and gain 3 [Credits]")
-                  :choices {:req #(and (= (:side %) "Runner") (:installed %))}
-                  :effect (effect (gain :credit 3) (trash target))}]}
+                 :choices {:req #(and (= (:side %) "Runner") (:installed %))}
+                 :effect (effect (gain :credit 3) (trash target))}]}
+
+   "Always Be Running"
+   {:abilities [{:once :per-turn
+                 :cost [:click 2]
+                 :msg (msg "break 1 subroutine")}]}

    "All-nighter"
    {:abilities [{:cost [:click 1] :effect (effect (trash card {:cause :ability-cost}) (gain :click 2))


Remove final periods in msg statements

Remove final periods in msg statements

--- src/clj/game/cards-resources.clj
+++ src/clj/game/cards-resources.clj
@@ -764,7 +764,7 @@
                                  ((toast state :runner (str "Unable to pay for " (:title c) ".")) false))
                                ((toast state :runner "Not currently accessing a card with a trash cost.") false))))
                  :msg (msg (let [c (:card (first (get-in @state [:runner :prompt])))]
-                             (str "pay " (trash-cost state side c) " [Credits] and remove " (:title c) " from the game.")))
+                             (str "pay " (trash-cost state side c) " [Credits] and remove " (:title c) " from the game")))
                  :effect (req (let [c (:card (first (get-in @state [:runner :prompt])))]
                                 (move state :corp c :rfg)
                                 (pay state :runner card :credit (trash-cost state side c))
@@ -781,7 +781,7 @@
                                    {; only allow targeting cards that were trashed this turn -- not perfect, but good enough?
                                     :choices {:req #(some (fn [c] (= (:cid %) (:cid c)))
                                                           (map first (turn-events state side :runner-trash)))}
-                                    :msg (msg "remove " (:title target) " from the game.")
+                                    :msg (msg "remove " (:title target) " from the game")
                                     :effect (req (move state :corp target :rfg)
                                                  (update! state side (dissoc card :slums-active))
                                                  (swap! state update-in [side :prompt] rest)


Store dependencies for quartz jobs in context instead of JobDetailMap as they're not serializable.

--- src/clj/hatnik/worker/worker.clj
+++ src/clj/hatnik/worker/worker.clj
@@ -105,8 +105,10 @@
 (j/defjob UpdateActionsJob [ctx]
   (try
     (timbre/info "Running UpdateActions job")
-    (let [data (into {} (.getMergedJobDataMap ctx))]
-      (update-all-actions (data "db") (data "perform-action") (data "utils")))
+    (let [data (.. ctx getScheduler getContext)]
+      (update-all-actions (get data "db")
+                          (get data "perform-action")
+                          (get data "utils")))
     (catch Exception e
       (timbre/error e "Error while executing UpdateActionsJob"))))

@@ -119,13 +121,9 @@
     (timbre/info "Initialising quartz and starting job. Quartz config:"
                  (:quartz config))
     (let [scheduler (-> (qs/initialize) qs/start)
-          data (org.quartz.JobDataMap. {"db" db
-                                        "perform-action" perform-action
-                                        "utils" utils})
           job (j/build
                (j/of-type UpdateActionsJob)
-               (j/with-identity (j/key "jobs.updateactions.1"))
-               (.usingJobData data))
+               (j/with-identity (j/key "jobs.updateactions.1")))
           start-at (DateBuilder/futureDate (-> config
                                                :quartz
                                                :initial-delay-in-seconds)
@@ -139,6 +137,10 @@
                                        (-> config
                                            :quartz
                                            :interval-in-seconds)))))]
+      (.putAll (.getContext scheduler)
+               {"db" db
+                "perform-action" perform-action
+                "utils" utils})
       (qs/schedule scheduler job trigger)
       (assoc component :scheduler scheduler)))

@@ -151,9 +153,8 @@

 (comment

-  (def worker (map->Worker {:config (hatnik.config/get-config)}))
-
-  (component/start worker)
+  (def worker (-> (map->Worker {:config (hatnik.config/get-config)})
+                  component/start))

   (component/stop worker)


dont display user information

dont display user information

--- src/clj/hsm/controllers/user.clj
+++ src/clj/hsm/controllers/user.clj
@@ -34,16 +34,18 @@

 (defhtml user-part
   [id user admin? c-star c-follow c-followers]
-  (panel [:a {:href (str "/user2/" id)} (:login user)]
-    [:img.img-responsive.img-rounded {:src (:image user)}]
-    [:h3 [:span (:login user)]
-      [:a.pad10 {:href (str "https://github.com/" (:login user))} [:i.fa.fa-github]]]
-    [:h5 [:span (:name user)]]
-    [:p [:a {:href (:blog user)}(:blog user)]]
-    [:p (:company user)]
-    [:p (:location user)]
-    [:p (:type user)]
-    [:a {:href (str "mailto://" (:email user))} (:email user)]
+  (panel "A User" ;[:a {:href (str "/user2/" id)} (:login user)]
+    ; [:img.img-responsive.img-rounded {:src (:image user)}]
+    [:h3 ;[:span (:login user)]
+      "A User"
+      ; [:a.pad10 {:href (str "https://github.com/" (:login user))} [:i.fa.fa-github]]
+      ]
+    [:h5 "A User"] ;[:span (:name user)]]
+    ; [:p [:a {:href (:blog user)}(:blog user)]]
+    ; [:p (:company user)]
+    ; [:p (:location user)]
+    ; [:p (:type user)]
+    ; [:a {:href (str "mailto://" (:email user))} (:email user)]
     [:hr]

     [:h3 [:a {:href (str "/user2/" id "/starred")} c-star ]" starred "]
@@ -114,7 +116,8 @@
             ; (log/warn user-repos)
           (if is-json
             (json-resp user)
-            (layout {:website host :title (format "%s - %s " (:login user) (:name user))}
+            (layout {:website host :title "A User" ;(format "%s - %s " (:login user) (:name user))
+          }
               [:div.row
                     [:div.col-lg-3
                       (left-menu host platform (str "/user2/" id))]
@@ -207,9 +210,9 @@
       (if is-json
         (json-resp (:followers user-extras))
         (layout {:website host
-                :title (format "%s - %s " (:login user) (:name user))
-                :desription (format "%s (%s) followed by these users " (:login user) (:name user))
-                :keywords (str/join "," [(:login user) (:name user) (format "%s followers" (:name user))])}
+                :title "A User" ;(format "%s - %s " (:login user) (:name user))
+                ; :desription (format "%s (%s) followed by these users " (:login user) (:name user))
+                ; :keywords (str/join "," [(:login user) (:name user) (format "%s followers" (:name user))])}
             [:div.row
               [:div.col-lg-3
                 (user-part id user admin? c-star c-follow c-followers)]
@@ -239,9 +242,9 @@
       (if is-json
         (json-resp (:following user-extras))
         (layout {:website host
-                 :title (format "%s (%s) following these users " (:login user) (:name user))
-                  :description (format "%s (%s) following these users " (:login user) (:name user))
-                  :keywords (str/join "," [(:login user) (:name user) (format "%s following" (:name user))])
+                 :title "A User" ;(format "%s (%s) following these users " (:login user) (:name user))
+                  ; :description (format "%s (%s) following these users " (:login user) (:name user))
+                  ; :keywords (str/join "," [(:login user) (:name user) (format "%s following" (:name user))])
                }
             [:div.col-lg-3
               (user-part id user admin? c-star c-follow c-followers)]
@@ -271,7 +274,9 @@
       (layout {:website host :title "User does not exist"} "User opted-out.")
       (if is-json
             (json-resp (:starred user-extras))
-            (layout {:website host :title (format "%s - %s " (:login user) (:name user))}
+            (layout {:website host :title "A User"
+                ; (format "%s - %s " (:login user) (:name user))
+              }
                 [:div.col-lg-3
                   (user-part id user admin? c-star c-follow c-followers)]
                 [:div.col-lg-9


revise ignore account logic

revise ignore account logic

--- src/clj_money/import/gnucash.clj
+++ src/clj_money/import/gnucash.clj
@@ -65,13 +65,13 @@
     :xpath "act:name"}
    {:attribute :type
     :xpath "act:type"
-    :transform-fn #((get account-types-map % :equity))}
+    :transform-fn #(get account-types-map % :equity)}
    {:attribute :id
     :xpath "act:id"}
    {:attribute :parent-id
     :xpath "act:parent"}])

-(def ^:private ignored-accounts #{"Assets" "Liabilities" "Equity" "Income" "Expenses"})
+(def ^:private ignored-accounts #{"Root Account" "Assets" "Liabilities" "Equity" "Income" "Expenses"})

 (defn- include-account?
   [account]


flesh out logic to get commodity account value

--- src/clj_money/models/reports.clj
+++ src/clj_money/models/reports.clj
@@ -8,7 +8,11 @@
             [clj-money.models.helpers :refer [with-storage]]
             [clj-money.models.accounts :as accounts]
             [clj-money.models.budgets :as budgets]
-            [clj-money.models.transactions :as transactions]))
+            [clj-money.models.transactions :as transactions]
+            [clj-money.models.commodities :as commodities]
+            [clj-money.models.prices :as prices]
+            [clj-money.models.lots :as lots]
+            [clj-money.models.lot-transactions :as lot-transactions]))

 (declare set-balance-deltas)
 (defn- set-balance-delta
@@ -66,12 +70,27 @@

 (defmethod ^:private account-value-as-of :commodity
   [storage-spec account as-of]
-
-  (throw (java.lang.RuntimeException. "Not implemented"))
-
-  #_(let [commodity (commodities/select storage-spec {:symbol (:name account)})
-        price (prices/last-price-before (:id commodity) as-of)
-        shares (lots/shares-as-of (:id account) (:id commodity), as-of)]
+  ; TODO We need a more reliable way to get the commodity
+  ; probalby we should store extra values in the account, like
+  ; {:id 123
+  ;  :name "AAPL"
+  ;  :type :asset
+  ;  :content-type :commodity
+  ;  :extras {:commodity-id 456}}
+  (let [commodity (first (commodities/search storage-spec
+                                             {:entity-id (:entity-id account)
+                                              :symbol (:name account)}))
+        price (:price (prices/most-recent storage-spec (:id commodity) as-of))
+        grouped-lot-transactions (->> {:account-id (:parent-id account) ; The lots are associated with the commodities account
+                                       :commodity-id (:id commodity)}
+                                      (lots/search storage-spec)
+                                      (mapcat #(lot-transactions/select storage-spec {:lot-id (:id %)}))
+                                      (filter #(>= 0 (compare (:trade-date %) as-of)))
+                                      (group-by :action))
+        shares (apply - (map #(->> (% grouped-lot-transactions)
+                                   (map :shares)
+                                   (reduce :+ 0M))
+                             [:buy :sell]))]
     (* shares price)))

 (declare set-balances)


Add ROT.Display canvas view

Add ROT.Display canvas view

--- src/cljs/caves_of_cljs/core.cljs
+++ src/cljs/caves_of_cljs/core.cljs
@@ -13,9 +13,23 @@
 ;; -------------------------
 ;; Views

-(defn home-page []
+(defn canvas [state]
+  (reagent/create-class
+   {:component-did-mount (fn [this]
+                           (let [console (js/ROT.Display.
+                                          #js {:width 40
+                                               :height 15})]
+                             (-> this
+                                 (.getDOMNode)
+                                 (.appendChild (.getContainer console)))
+                             (swap! state assoc :console console)))
+    :component-will-unmount (fn [this] (swap! state dissoc :console))
+    :component-function (fn [state] [:div])}))
+
+(defn home-page [state]
   [:div [:h2 "Caves of Clojurescript"]
-   [:div [:a {:href "#/about"} "go to the about page"]]])
+   [:div [:a {:href "#/about"} "go to the about page"]]
+   [canvas state]])

 (defn about-page []
   [:div [:h2 "About caves-of-cljs"]
@@ -24,10 +38,10 @@
 (defmulti page #(:current-page (deref %)))

 (defmethod page nil [state]
-  [home-page])
+  [home-page state])

 (defmethod page :home [state]
-  [home-page])
+  [home-page state])

 (defmethod page :about [state]
   [about-page])


Refactor the code, add documentation.

Refactor the code, add documentation.

--- src/cljs/idealist/event-bus.cljs
+++ src/cljs/idealist/event-bus.cljs
@@ -1,8 +1,7 @@
 (ns idealist.event-bus
   (:require [om.core :as om :include-macros true]
-            [om.dom :as dom :include-macros true]
-            [cljs.core.async :as async :refer [<! >!]])
-  (:require-macros [cljs.core.async.macros :refer [go go-loop]]))
+            [cljs.core.async :as async])
+  (:require-macros [cljs.core.async.macros :as async]))

 ;; =============================================================================
 ;; Event handling protocol. Use it in your components if you're interested
@@ -14,6 +13,9 @@
 ;; TODO: xform
 ;; TODO: Terminate loop.
 ;;
+
+;; =============================================================================
+;; Helper functions.

 (defn- init-event-bus!
   "Adds support for triggering events and, if the component reified IGotEvent, support for handling events
@@ -35,26 +37,27 @@
         (async/tap fork branch)
         (async/tap fork downstream)
         (om/set-state! this ::event-bus upstream)
-        (go-loop []
-                 (let [e (<! branch)] ;; TODO: Termination.
+        (async/go-loop []
+                 (let [e (async/<! branch)]
                    (got-event c e))
                  (recur))))))

 (defn- before-will-mount!
-  "Overrides componentWillMount pure method to call the fn before its body."
-  [methods fn]
+  "Overrides componentWillMount pure method to call function f before its body."
+  [methods f]
   (let [prev-will-mount (:componentWillMount methods)]
     (-> methods
         (assoc :dly_prevWillMount prev-will-mount)
-        (assoc :componentWillMount fn))))
+        (assoc :componentWillMount #(this-as this
+                                             (do
+                                               (f this)
+                                               ((.-dly_prevWillMount this))))))))

 (defn- make-descriptor
   "Creates a custom descriptor with support for an event bus."
   []
-  (let [methods (before-will-mount! om/pure-methods (fn []
-                                                      (this-as this
-                                                               (init-event-bus! this)
-                                                               ((.-dly_prevWillMount this)))))
+  (let [methods (before-will-mount! om/pure-methods (fn [this]
+                                                      (init-event-bus! this)))
         descriptor (om/specify-state-methods! (clj->js methods))]
     descriptor))

@@ -69,6 +72,9 @@
                        (and om/*parent* (om/get-state om/*parent* ::event-bus))
                        event-bus)]
       (om/build* f x (update-in m [:init-state] merge {::event-bus parent-bus})))))
+
+;; =============================================================================
+;; Public functions.

 (defn root>
   "Uset this instead of om.core/root to add support for event bus functionality.


Constants for pieces and piece types in clj-chess.board.

Also renamed color-white and color-black to just white and black.

--- src/clojure/clj_chess/board.cljc
+++ src/clojure/clj_chess/board.cljc
@@ -3,8 +3,29 @@
   #?(:cljs (:require [jschess.chess :as jsc])
      :clj (:import (chess Board Move PieceColor Piece Square))))

-(def color-white #?(:clj PieceColor/WHITE :cljs 0))
-(def color-black #?(:clj PieceColor/BLACK :cljs 1))
+(def white #?(:clj PieceColor/WHITE :cljs 0))
+(def black #?(:clj PieceColor/BLACK :cljs 1))
+
+(def pawn 1)
+(def knight 2)
+(def bishop 3)
+(def rook 4)
+(def queen 5)
+(def king 6)
+
+(def white-pawn 1)
+(def white-knight 2)
+(def white-bishop 3)
+(def white-rook 4)
+(def white-queen 5)
+(def white-king 6)
+(def black-pawn 9)
+(def black-knight 10)
+(def black-bishop 11)
+(def black-rook 12)
+(def black-queen 13)
+(def black-king 14)
+(def blocker 23)

 (defn square-make [file rank]
@@ -117,7 +138,7 @@
 (defn side-to-move
   "The current side to move, :white or :black."
   [board]
-  (if (= (.getSideToMove board) color-white)
+  (if (= (.getSideToMove board) white)
     :white
     :black))

@@ -375,7 +396,7 @@
     (cond
       (is-kingside-castle? move) (assoc map :rook-from (+ to 1) :rook-to (- to 1))
       (is-queenside-castle? move) (assoc map :rook-from (- to 2) :rook-to (+ to 1))
-      (move-is-ep? move) (assoc map :captured-piece (if (= stm color-white) :bp :wp)
+      (move-is-ep? move) (assoc map :captured-piece (if (= stm white) :bp :wp)
                                   :capture-square (square-make (square-file to)
                                                                (square-rank from)))
       (and (move-is-promotion? move) (not (.isEmpty board to)))


Doc fix for ref-adapter

Doc fix for ref-adapter

--- src/clojure/neko/ui/adapters.clj
+++ src/clojure/neko/ui/adapters.clj
@@ -14,7 +14,7 @@
   data. Returns an Adapter object that displays ref-type contents.
   When ref-type is updated, Adapter gets updated as well.

-  `create-view-fn` is a nullary function. `update-view-fn` is
+  `create-view-fn` is a function of context. `update-view-fn` is
   a function of four arguments: element position, view to update,
   parent view container and the respective data element from the
   ref-type. `access-fn` argument is optional, it is called on the


Revert use of POST when querying CMR for variables.

--- src/cmr/opendap/ous/variable.clj
+++ src/cmr/opendap/ous/variable.clj
@@ -215,15 +215,20 @@
   variables, if params does not contain any."
   [search-endpoint user-token {variable-ids :variables}]
   (if (seq variable-ids)
-    (let [url (str search-endpoint "/variables")
-          payload (build-query variable-ids)]
-      (log/debug "Variables query to CMR:" payload)
-      (request/async-post
+    (let [url (str search-endpoint "/variables"
+              "?"
+              (build-query variable-ids))
+          ;payload (build-query variable-ids)
+          ]
+      ;(log/debug "Variables query to CMR:" payload)
+      (log/debug "Variables query to CMR:" url)
+      (request/async-get
        url
        (-> {}
            (request/add-token-header user-token)
            (request/add-accept "application/vnd.nasa.cmr.umm+json")
-           (request/add-payload payload))
+           ;(request/add-payload payload)
+           )
        response/json-handler))
     (deliver (promise) [])))


(PDB-4832) Update schema diff tests for new report partition idx

--- test/puppetlabs/puppetdb/scf/migrate_partitioning_test.clj
+++ test/puppetlabs/puppetdb/scf/migrate_partitioning_test.clj
@@ -694,6 +694,19 @@
                                                :user "pdb_test"}
                                   :same nil}
                                  {:left-only nil
+                                  :right-only
+                                  {:schema "public"
+                                   :table table-name
+                                   :index (str "idx_reports_id_" part-name)
+                                   :index_keys ["id"]
+                                   :type "btree"
+                                   :unique? true
+                                   :functional? false
+                                   :is_partial false
+                                   :primary? false
+                                   :user "pdb_test"}
+                                  :same nil}
+                                 {:left-only nil
                                   :right-only {:schema "public"
                                                :table table-name
                                                :index (str "reports_job_id_idx_" part-name)
@@ -1263,4 +1276,4 @@
                                                        :deferrable? "NO"}
                                           :same nil}]))
                                     dates))}
-           (diff-schema-maps before-migration (schema-info-map *db*))))))+           (diff-schema-maps before-migration (schema-info-map *db*))))))


More type fiddling.

More type fiddling.

Signed-off-by: James Reeves <9dadf8ecafa226c8f7c16002bdcb090267879343@weavejester.com>

--- src/compojure/server/grizzly.clj
+++ src/compojure/server/grizzly.clj
@@ -31,10 +31,11 @@
   are setup."
   [#^GrizzlyWebServer server url-or-path servlet]
   (let [[host path] (get-host-and-path url-or-path)
-        #^Servlet ss (cast Servlet servlet)
         #^ServletAdapter adapter (if (instance? ServletAdapter servlet)
                                    servlet
-                                   (ServletAdapter. ss))]
+                                   ;; Otherwise, assume it's a servlet.
+                                   (let [#^Servlet ss (cast Servlet servlet)]
+                                     (ServletAdapter. ss)))]
     (.addGrizzlyAdapter server adapter (into-array [path]))))

 (defn- #^GrizzlyWebServer create-server


add missing {:obj :unspec} as lexical compilation rule

--- src/babel/latin.cljc
+++ src/babel/latin.cljc
@@ -22,6 +22,14 @@

 (def lexicon
   (-> (edn2lexicon (resource "babel/latin/lexicon.edn"))
+
+
+      (default ;; intransitive verbs' :obj is :unspec.
+       {:synsem {:cat :verb
+                 :subcat {:1 {:top :top}
+                          :2 '()}
+                 :sem {:obj :unspec}}})
+
       (verb-pred-defaults encyc/verb-pred-defaults)))

 (defn parse [surface]


logging improvements

logging improvements

--- src/babel/parse.cljc
+++ src/babel/parse.cljc
@@ -106,11 +106,12 @@
                                                             right-strings)
                                       left-signs (lazy-cat left-lexemes (filter map? left))
                                       right-signs (lazy-cat right-lexemes (filter map? right))
-                                      debug (log/debug (str "#lexemes found for left:'" (string/join "','" left-strings) "':"
-                                                            (count left-lexemes)))
-                                      debug (log/debug (str "#lexemes found for right:'" (string/join "','" right-strings) "':"
-                                                            (count right-lexemes)))
-
+                                      debug (if (not (empty? left-lexemes))
+                                              (log/debug (str "#lexemes found for left:'" (string/join "','" left-strings) "':"
+                                                              (count left-lexemes))))
+                                      debug (if (not (empty? right-lexemes))
+                                              (log/debug (str "#lexemes found for right:'" (string/join "','" right-strings) "':"
+                                                              (count right-lexemes))))
                                       ]
                                   (lazy-cat
                                    (if (and (not (empty? left-signs))


Add some type hints.

Add some type hints.

--- src/blobble/core.clj
+++ src/blobble/core.clj
@@ -19,7 +19,6 @@
 ;; ## Blob Record

 ;; Blobs have the following two primary attributes:
-;;
 ;;
 ;; - `:id`        `Multihash` with the digest identifying the content
 ;; - `:content`   read-only Java `ByteBuffer` with opaque content
@@ -91,7 +90,7 @@
 (defn open
   "Opens an input stream to read the content of the blob."
   [blob]
-  (.rewind (:content blob))
+  (.rewind ^ByteBuffer (:content blob))
   (bytes/to-input-stream (:content blob)))

@@ -181,7 +180,7 @@
         after (:after opts prefix)]
     (cond->> ids
       after  (drop-while #(pos? (compare after (encoder %))))
-      prefix (take-while #(.startsWith (encoder %) prefix))
+      prefix (take-while #(.startsWith ^String (encoder %) prefix))
       limit  (take limit))))

@@ -190,7 +189,7 @@
   [blob]
   (or
     (when-let [content (:content blob)]
-      (.capacity content))
+      (.capacity ^ByteBuffer content))
     (:stat/size blob)))


add 200 status to dry run for store-token (#1500)

--- token-syncer/src/token_syncer/main.clj
+++ token-syncer/src/token_syncer/main.clj
@@ -69,7 +69,8 @@
                     (fn store-token-dry-run-version [cluster-url token token-etag token-description]
                       (log/info "[dry-run] store-token" token "on" cluster-url "with etag" token-etag
                                 "and description" token-description)
-                      {:status "dry-run"})
+                      {:body {:message "dry-run"}
+                       :status 200})
                     (partial waiter/store-token api-http-client))}))

 (def base-command-config


Add shortened versions of :dependencies and :dev-dependencies.

--- src/cake/project.clj
+++ src/cake/project.clj
@@ -131,6 +131,8 @@
                :jar-name     (or (:jar-name opts) artifact-version)
                :war-name     (or (:war-name opts) artifact-version)
                :uberjar-name (or (:uberjar-name opts) (str artifact-version "-standalone")))
+        (assoc-or :dependencies (:deps opts))
+        (assoc-or :dev-dependencies (:dev-deps opts))
         (update :dependencies     dep-map)
         (update :ext-dependencies dep-map)
         (update :dev-dependencies dep-map)


CMR-2112 Remove debug code part 2

CMR-2112 Remove debug code part 2

--- umm-spec-lib/test/cmr/umm_spec/test/generate_and_parse.clj
+++ umm-spec-lib/test/cmr/umm_spec/test/generate_and_parse.clj
@@ -77,7 +77,6 @@
             :when (not @failed-atom)
             :let [metadata (slurp example-file)
                   umm (core/parse-metadata test-context :collection metadata-format metadata)]]
-
       ;; input file is valid
       (check-failure
        (is (empty? (core/validate-xml :collection metadata-format metadata))


trying to compile

trying to compile

--- src/clj/neb/cell.clj
+++ src/clj/neb/cell.clj
@@ -130,11 +130,11 @@
               nested-schema (when (and (not nested-map-format?) (not require-packing?)) (:f (schema-by-sname array-format)))
               repeat-func (cond
                             nested-map-format?
-                            #(recur-nested array-format)
+                            (fn [] (recur-nested array-format))
                             nested-schema
-                            #(recur-nested nested-schema)
+                            (fn [] (recur-nested nested-schema))
                             require-packing?
-                            #(:d (recur-nested [[:d array-format]])))]
+                            (fn [] (:d (recur-nested [[:d array-format]]))))]
           (.advancePointer cell-reader type_lengths/intLen)
           (apply
             array-func
@@ -171,11 +171,11 @@
                        nested-schema (when (and (not nested-map-format?) (not require-packing?)) (:f (schema-by-sname array-format)))
                        map-func (cond
                                   nested-map-format?
-                                  (partial recur-nested array-format)
+                                  (fn [x] (recur-nested array-format x))
                                   nested-schema
-                                  (partial recur-nested nested-schema)
+                                  (fn [x] (recur-nested nested-schema x))
                                   require-packing?
-                                  #(recur-nested [[:d array-format]] {:d %}))
+                                  (fn [x] (recur-nested [[:d array-format]] {:d x})))
                        array-content
                        (doall (map map-func array-items))]
                    (apply array-func array-name array-format array-header array-content))


Extract global statsd

Extract global statsd

--- src/clojure/core.clj
+++ src/clojure/core.clj
@@ -1,6 +1,6 @@
 (ns the-nature-of-sound.core
   (:require [clojure.java.io :as io]
-            [dynne.sampled-sound :as sample])
+            [dynne.sampled-sound :as ssample])
   (:import [xtract]
            [xtractJNI]
            [xtract_mel_filter]
@@ -50,7 +50,7 @@
         xtract-vs (xtract/new_double-array len)]
     (doall
      (map-indexed
-      (fn [idx f] (xtract/double_array_setitem xtract-vs idx (double f)))
+      (fn [idx v] (xtract/double_array_setitem xtract-vs idx v))
       vs))
     xtract-vs))

@@ -64,16 +64,12 @@

 (defn- xtract-args [& args] (xtract/doublea_to_voidp (clojure->c-double args)))

-(defn with-result [t xtract-fn]
-  (let [r t]
-    (xtract-fn r)
-    (let [out (nth (vec r) 0)]
-      out)))
-
-(defn spectral-inharmonicity [peaks-data block-size & args]
-  (with-result
-    (double-array [0])
-    (fn [r] (xtract/xtract_spectral_inharmonicity peaks-data block-size (apply xtract-args args) r))))
+(defn with-result
+  ([xtract-fn] (with-result (double-array [0]) xtract-fn))
+  ([r xtract-fn]
+   (xtract-fn r)
+   (first (vec r))
+   ))

 (defn mean [vs]
   (let [result (double-array 1)
@@ -133,11 +129,21 @@
         file-sample-rate     (.getSampleRate base-file-format)]
     file-sample-rate))

-(defn extract-fundemental-frequency
-  [wave-data block-size sample-rate]
-    (let [r (double-array 1)]
-      (xtract/xtract_wavelet_f0 wave-data block-size (xtract-args sample-rate) r)
-      (first r)))
+(defn extract-spectral-inharmonicity
+  [peaks-data block-size f0]
+  (if (> f0 0.0)
+    (with-result
+      (fn [r] (xtract/xtract_spectral_inharmonicity peaks-data block-size (xtract-args f0) r)))
+    0.0))
+
+(defn extract-fundemental-frequency [wav-data block-size sample-rate]
+  (let [r (double-array 1)]
+    (xtract/xtract_wavelet_f0 wav-data block-size (xtract-args sample-rate) r)
+
+;;    (when (> (first r) 0.0) (println :---------------------> (first r)))
+    (first r)
+    )
+)

 (defn extract-spectrum
   "Extract frequency domain spectrum from time domain signal"
@@ -174,7 +180,7 @@
     peaks))

 (defn extract-rms-amp
-  "Extract the RMS amplitude"
+  "Extract the RMS amplitude of an input vector"
   [wav-data block-size sample-ratio]
   (let [rms (double-array 1)]
     (xtract/xtract_rms_amplitude wav-data block-size (xtract-args sample-ratio) rms)
@@ -204,13 +210,12 @@
          half-block-size (/ block-size 2)
          SAMPLE_RATE_RATIO (/ SAMPLE_RATE block-size)

-         s           (ssample/read-sound sample-path block-size)
+         s           (ssample/read-sound sample-path)
          data-chunks (ssample/chunks s SAMPLE_RATE)
          ;;TODO: Merging channels?
          ;;with sliding window, overlap
-         data (partition block-size half-block-size (mapcat (fn [bit] bit) (flatten (flatten ch))))         ;;seperate
-         ;;data (partition block-size (mapcat (fn [bit] bit) (flatten (flatten ch))))
-
+         data (partition block-size half-block-size (mapcat (fn [bit] bit) (flatten (flatten data-chunks))))         ;;seperate
+         ;;data (partition block-size (mapcat (fn [bit] bit) (flatten (flatten data-chunks))))
          mel-filters  (xtract/create_filterbank  MFCC_FREQ_BANDS block-size)

          ;;bark-band-limits (xtract/new_int_array 0)
@@ -225,7 +230,6 @@
                               MFCC_FREQ_BANDS
                               (xtract_mel_filter/.getFilters mel-filters))

-     (xtract/xtract_init_wavelet_f0_state)

      ;;public static int xtract_init_bark(int N, double sr, SWIGTYPE_p_int band_limits) {
      ;;(xtract/xtract_init_bark block-size SAMPLERATE bark-band-limits)
@@ -234,10 +238,14 @@
      (let [full-window (xtract/xtract_init_window block-size xtract-hann)
            half-window (xtract/xtract_init_window half-block-size xtract-hann)]

+       (xtract/xtract_init_wavelet_f0_state)
+
        (let [stats
              (map-indexed
               (fn [idx v]

+
+;;                (println v)
                 (let [wav-data (clojure->c-double v)
                       f0       (extract-fundemental-frequency wav-data block-size SAMPLE_RATE)
                       cents    (frequency->cents f0)
@@ -247,7 +255,7 @@

                       spectrum               (extract-fft-spectrum wav-data block-size SAMPLE_RATE full-window)
                       peaks                  (extract-peaks spectrum block-size SAMPLE_RATE_RATIO 10.0)
-                      spectral-inharmonicity (spectral-inharmonicity peaks block-size f0 0.5 NUM_HARMONICS 0)
+                      spectral-inharmonicity (extract-spectral-inharmonicity peaks block-size f0)

                       rms                    (extract-rms-amp wav-data block-size SAMPLE_RATE_RATIO)

@@ -322,32 +330,58 @@
          (vec (flatten stats))
          )))))

+
+(defn global-stats-reduce [fields]
+  (fn [acc frame]
+    (let [frame-stats (first (vals frame))]
+      (reduce
+       (fn [local-acc field]
+         (let [v (get frame-stats field)
+               v (if (and (= (type v) Double) (.isNaN v))
+                   0.0
+                   v)]
+
+           (assoc local-acc field
+                  (+ (get local-acc field 0.0)
+                     v))))
+       acc
+       fields))))
+
 (defn global-stats [frame-stats]
   (let [n (count frame-stats)
         fields (-> frame-stats first vals first (dissoc :todo) keys)
-        totals (reduce
-                (fn [acc frame]
-                  (let [frame-stats (first (vals frame))]
-                    (reduce
-                     (fn [local-acc field]
-                       (let [v (get frame-stats field)]
-                         (assoc local-acc field
-                                (+ (get local-acc field 0.0)
-                                   v))))
-                     acc
-                     fields)))
-                {}
-                frame-stats)]
+        totals (reduce (global-stats-reduce fields) {} frame-stats)
+
+        f0-frames (remove (fn [frame] (let [stats (first (vals frame))]
+                                        (= (:f0 stats) 0.0)
+                                       )) frame-stats)
+        n-f0s (count f0-frames)
+        f0-totals (reduce (global-stats-reduce fields) {} f0-frames)]

     (-> {}
-        (assoc :rms-amplitude-mean (/ (:rms-amplitude totals) n))
-        (assoc :spectral-centroid-mean (/ (:spectral-centroid totals) n)))
-    ))
+        (assoc :rms-amplitude-mean          (/ (:rms-amplitude totals) n))
+        (assoc :spectral-centroid-mean      (/ (:spectral-centroid totals) n))
+        (assoc :spectral-irregularity-mean  (/ (:spectral-irregularity totals) n))
+        (assoc :spectral-kurtosis-mean      (/ (:spectral-kurtosis totals) n))
+
+        ;;Only over non 0 frequencies
+        (assoc :spectral-inharmonicity-mean (/ (:spectral-inharmonicity f0-totals) n-f0s))
+        (assoc :midi-mean (/ (:midi f0-totals) n-f0s))
+        (assoc :f0-mean   (/ (:f0 f0-totals) n-f0s))
+        )))
+
+  (dotimes [i 1]
+    (let [frame-stats (peek-inside "test/fixtures/test.wav")]
+;;      (doseq [frame frame-stats] (println frame))
+
+
+      (println :global (global-stats frame-stats))
+      ))

 (comment

-  (dotimes [i 1000000]
-    (let [frame-stats (peek-inside "test/fixtures/test.wav")]
+  (dotimes [i 1]
+    (lDet [frame-stats (peek-inside "test/fixtures/test.wav")]
       ;;(doseq [frame frame-stats] (println frame))
       (println :global (global-stats frame-stats))
       ))


(TK-293) Add extensions argument to cert creation helper

--- test/puppetlabs/trapperkeeper/authorization/testutils.clj
+++ test/puppetlabs/trapperkeeper/authorization/testutils.clj
@@ -20,9 +20,13 @@
    (assoc (request path method ip) :ssl-client-cert certificate)))

 (defn create-certificate
-  [cn]
-  (let [cacert (ssl/gen-self-signed-cert "my ca" 41 {:keylength 512})]
-    (:cert (ssl/gen-cert cn cacert 42 {:keylength 512}))))
+  [cn & [extensions]]
+  (let [cacert (ssl/gen-self-signed-cert "my ca" 41 {:keylength 512})
+        opts {:keylength 512}
+        opts (if (nil? extensions)
+               opts
+               (assoc opts :extensions extensions))]
+    (:cert (ssl/gen-cert cn cacert 42 opts))))

 (def test-domain-cert (create-certificate "test.domain.org"))
 (def test-other-cert (create-certificate "www.other.org"))


Lisätty unicast hosts parametri

Lisätty unicast hosts parametri

--- clj-test-utils/src/clj_test_utils/elasticsearch_mock_utils.clj
+++ clj-test-utils/src/clj_test_utils/elasticsearch_mock_utils.clj
@@ -12,6 +12,7 @@
                                    (.withElasticVersion "6.0.0")
                                    (.withSetting PopularProperties/HTTP_PORT port)
                                    (.withSetting PopularProperties/CLUSTER_NAME "elasticsearch")
+                                   (.withSetting "discovery.zen.ping.unicast.hosts" (java.util.ArrayList. [(str  "127.0.0.1:" port)]))
                                    (.build)))
       (.start @embedded-elastic))


Fixed issue #5

Fixed issue #5

--- src/alfresco_technical_validation/binary_validation.clj
+++ src/alfresco_technical_validation/binary_validation.clj
@@ -439,8 +439,12 @@
                                          ]
                         RETURN n.name AS ClassName, COLLECT(DISTINCT m.name) AS APIs
                          ORDER BY n.name
-                       ")]
-    (standard-validation "STB18" res false "The technology does not manually demarcate transactions.")))
+                       ")
+        message (str "The following classes manually demarcate transactions:\n"
+                     (s/join "\n" (map #(get % "ClassName") res)))]
+    (declare-result "STB18"
+                    (empty? res)
+                    (if (empty? res) "The technology does not manually demarcate transactions." message))))

 (defn- stb22-minimise-threadlocals
   []


Updated configuration REST API handler - verbose show configuration

--- src/emender_jenkins/rest_api.clj
+++ src/emender_jenkins/rest_api.clj
@@ -81,8 +81,12 @@

 (defn configuration-handler
     [request]
-    (let [response (-> request :configuration)]
-        (send-response response request)))
+    (if (config/verbose-show-configuration? request)
+        (let [response (-> request :configuration)]
+            (send-response response request))
+        (let [response (-> request :configuration
+                           (assoc-in [:jenkins :jenkins-auth] "********"))]
+            (send-response response request))))

 (defn system-banners
     [request uri]


fix order of arguments

fix order of arguments

--- src/babel/stringutils.cljc
+++ src/babel/stringutils.cljc
@@ -11,7 +11,7 @@
     (let [regexp-pair (first regexp-list)
           regexp-from (first regexp-pair)
           regexp-to (second regexp-pair)
-          result (string/replace regexp-from regexp-to target)]
+          result (string/replace target regexp-from regexp-to)]
       (if (= result target)
         (replace-from-list (rest regexp-list) target)
         result))


Remove log from transaction list

Remove log from transaction list

--- src/freecoin/views/transaction_list.clj
+++ src/freecoin/views/transaction_list.clj
@@ -28,13 +28,10 @@
 (ns freecoin.views.transaction-list
   (:require [freecoin.routes :as routes]
             [freecoin.db.wallet :as wallet]
-            [clojure.tools.logging :as log]
             [freecoin.config :as config]))

 (defn build [list wallet-store & [owner-wallet]]
   (let [title (str "Transaction list" (when (not (nil? owner-wallet)) (str " for " (:name owner-wallet))))]
-    (log/info "owner-wallet" owner-wallet)
-
     {:title title
      :heading title
      :body-class "func--transactions-page--body"


continue work on issuer filtering

continue work on issuer filtering

--- src/cljs/salava/extra/application/ui/application.cljs
+++ src/cljs/salava/extra/application/ui/application.cljs
@@ -271,14 +271,31 @@
           :control-class   "form-control"}]]])))

-(defn issuer-badges [issuer-name state]
+;TODO Refactor
+(defn reset-issuer-applications [state]
+  (let [{:keys [user-id country-selected name recipient-name issuer-name order tags show-followed-only]} @state]
+    (ajax/GET
+      (path-for (str "/obpv1/application/"))
+      {:params {:country (trim country-selected)
+                :name (subs-hashtag name)
+                :tags (map #(subs-hashtag %) tags)
+                :issuer ""
+                :order (trim order)
+                :followed show-followed-only}
+       :handler (fn [data]
+                  (swap! state assoc :all-issuer-applications (:applications data) ))})))
+
+;TODO Refactor
+(defn issuer-applications [issuer-name state]
   (swap! state assoc :issuer-name issuer-name)
   (fetch-badge-adverts state))

-
-;TODO FIX to run on the background and calculate badge count for each issuer
-(defn issuer-badge-count [issuer-name state]
-  (count (filter #(= issuer-name (:issuer_content_name %)) (:applications @state))))
+;TODO Refactor
+(defn issuer-applications-count [issuer-name state]
+  (reset-issuer-applications state)
+  (count (filter #(= issuer-name (:issuer_content_name %)) (:all-issuer-applications @state))))
+
+

 (defn- issuer-image [path]
   (when (not-empty path)
@@ -314,7 +331,7 @@
            [:div.pull-right  [:a {:href "#"}[:i {:class "fa fa-bookmark-o"}] (str " " (t :extra-application/Addtofavourites))]]]
           ]]]])))

-
+;TODO Fix login, make issuer-list-more dynamic
 (defn issuer-content [state]
   (let [applications (cursor state [:all-applications])
         issuer-name (cursor state [:issuer-content :name])]
@@ -326,11 +343,11 @@
            [:a {:style {:cursor "pointer" :text-align "center"} :data-dismiss "modal" :on-click #(do
                                                                                (swap! state assoc :show-issuer-info false
                                                                                :issuer-content {:name (t :core/All) #_(t :badge/Issuers)})
-                                                                                (issuer-badges "" state))} (t :core/All)]]
+                                                                                (issuer-applications "" state))} (t :core/All)]]
           (doall
             (for [app (sort-by :issuer_content_name (distinct-by :issuer_content_name @applications))
                   :let [{:keys [issuer_content_name issuer_image issuer_content_url issuer_content_id]} app
-                        badges-count #_(issuer-badges-behind-scenes issuer_content_name state) (issuer-badge-count issuer_content_name state)
+                        badges-count (issuer-applications-count issuer_content_name state)
                         ;testing
                         banner (if (even? (count issuer_content_name)) true false)]]
               [:a { :key issuer_content_id
@@ -340,7 +357,7 @@
                                  (.preventDefault %)
                                  (swap! state assoc :show-issuer-info true
                                         :issuer-content {:id issuer_content_id :name issuer_content_name :image issuer_image :url issuer_content_url :banner banner})
-                                 (issuer-badges issuer_content_name state)
+                                 (issuer-applications issuer_content_name state)

                                  )}
                [:div {:style {:padding "5px"}} (if issuer_image
@@ -493,7 +510,7 @@
                (let [{:keys [applications countries user-country]} data]
                  (swap! state assoc :applications applications
                         :countries countries
-                        :all-applications applications
+                        :all-applications applications ;; use original applications list to build issuer list
                         )))}))


The base-url should have been taken from the dynamic params Also using the right charset to produce the qrcode

--- src/freecoin/handlers/qrcode.clj
+++ src/freecoin/handlers/qrcode.clj
@@ -3,11 +3,11 @@
 ;; part of Decentralized Citizen Engagement Technologies (D-CENT)
 ;; R&D funded by the European Commission (FP7/CAPS 610349)

-;; Copyright (C) 2015 Dyne.org foundation
-;; Copyright (C) 2015 Thoughtworks, Inc.
+;; Copyright (C) 2017 Dyne.org foundation

 ;; Sourcecode designed, written and maintained by
 ;; Denis Roio <jaromil@dyne.org>
+;; Aspasia Beneti <aspra@dyne.org>

 ;; This program is free software: you can redistribute it and/or modify
 ;; it under the terms of the GNU Affero General Public License as published by
@@ -24,16 +24,16 @@

 (ns freecoin.handlers.qrcode
   (:require [liberator.core :as lc]
-            [freecoin.params :as param]
+            [freecoin.config :as config]
             [freecoin.auth :as auth]
             [freecoin-lib.db.wallet :as wallet]
             [freecoin.context-helpers :as ch]
             [clj.qrgen :as qr]
             [taoensso.timbre :as log]))

-
 (lc/defresource qr-participant-sendto [wallet-store]
   :allowed-methods [:get]
+
   :available-media-types ["image/png"]

   :authorized? #(auth/is-signed-in %)
@@ -44,7 +44,7 @@
   :handle-ok
   (fn [ctx]
     (if-let [email (get-in ctx [:request :params :email])]
-      (qr/as-input-stream
-       (qr/from (format "http://%s:%d/send/to/%s"
-                        (:address param/host)
-                        (:port param/host) email))))))
+      (let [base-url (-> (config/create-config) config/base-url)]
+        (qr/as-input-stream
+         (qr/from (str base-url "/send/to/" email)
+                  :charset "ISO-8859-1"))))))


woooo fakeclient doesn't break anything

woooo fakeclient doesn't break anything

--- src/bitsplit_cli/core.cljs
+++ src/bitsplit_cli/core.cljs
@@ -1,6 +1,7 @@
 (ns bitsplit-cli.core
     (:use [cljs.core.async :only (chan put! <!)]
           [bitsplit-cli.filesystem :only (->File)]
+          [bitsplit-cli.client :only (->FakeClient)]
           [bitsplit-cli.commands :only (execute)])
     (:use-macros
         [cljs.core.async.macros :only (go-loop)]))
@@ -10,7 +11,7 @@
 (set! (.-colors prompt) false)

 (def storage (->File "FAKE"))
-; (def client (->Bitcoind ""))
+(def client (->FakeClient ""))

 (defn- read-prompt [message]
     (let [return (chan 1)]
@@ -33,7 +34,7 @@
     (execute {
         :storage storage
         :command "list"
-        ; :client client
+        :client client
         })
     (go-loop [command (<! (read-in))]
         (if-not (exit? command)
@@ -41,7 +42,7 @@
                 (execute {
                     :storage storage
                     :command command
-                    ; :client client
+                    :client client
                     })
                 (recur (<! (read-in)))))))

@@ -53,7 +54,7 @@
             :command (->> args
                         (map #(str % " "))
                         (apply str))
-            ; :client client
+            :client client
             })))

 (set! *main-cli-fn* -main)


workflows route renders

workflows route renders

--- src-cljs/frontend/routes.cljs
+++ src-cljs/frontend/routes.cljs
@@ -214,6 +214,20 @@

   (defroute v1-build #"/(gh|bb)/([^/]+)/([^/]+)/(\d+)"
     [short-vcs-type org repo build-num _ maybe-fragment]
+    ;; normal destructuring for this broke the closure compiler
+    (let [fragment-args (-> maybe-fragment
+                            :_fragment
+                            parse-build-page-fragment
+                            (select-keys [:tab :action-id :container-id]))]
+      (open-to-inner! app nav-ch :build (merge fragment-args
+                                               {:vcs_type (vcs/->lengthen-vcs short-vcs-type)
+                                                :project-name (str org "/" repo)
+                                                :build-num (js/parseInt build-num)
+                                                :org org
+                                                :repo repo}))))
+
+  (defroute v1-workflow-job #"/(gh|bb)/([^/]+)/([^/]+)/workflows/([^/]+)/jobs/(\d+)"
+    [short-vcs-type org repo workflow-id build-num _ maybe-fragment]
     ;; normal destructuring for this broke the closure compiler
     (let [fragment-args (-> maybe-fragment
                             :_fragment


Add todo

Add todo

--- src/afterglow/effects/fun.clj
+++ src/afterglow/effects/fun.clj
@@ -20,6 +20,7 @@
   "The default color to flash on beats that are not down beats."
   (colors/darken (colors/create-color :yellow) 30))

+;; TODO take a metronome parameter and support dynamic parameters!
 (defn metronome-cue
   "Returns an effect function which flashes the supplied fixtures to
   the beats of the show metronome, emphasizing the down beat, which is
@@ -27,8 +28,9 @@
   color of the flashes can be controlled by the :down-beat-color
   and :other-beat-color arguments (defaulting to red with lightness
   70, and yellow with lightness 20, respectively)."
-  [fixtures & {:keys [down-beat-color other-beat-color] :or {down-beat-color default-down-beat-color
-                                                             other-beat-color default-other-beat-color}}]
+  [show fixtures & {:keys [down-beat-color other-beat-color]
+                    :or {down-beat-color default-down-beat-color
+                         other-beat-color default-other-beat-color}}]
   (let [heads (find-rgb-heads fixtures)
         running (atom true)
         f (fn [show snapshot target previous-assignment]


more work on ranging

more work on ranging

--- src/chess_clojure/core.clj
+++ src/chess_clojure/core.clj
@@ -44,6 +44,7 @@
 ;;

 (def debug false)
+
 (defn string->board[string]
   (assert (string? string))
   (let [lines (vec (reverse (clojure.string/split-lines string)))
@@ -137,19 +138,16 @@
         (white-piece? piece)
         :white
         ))
-(defn is-rook?[x]
-  (contains? #{"R" "r"} x)
-  )
-
-(defn is-piece?[x]
-  (or (black-piece? x) (white-piece? x)))
+
+
+

 (defn is-pawn?[x]
   (contains? #{"P" "p"} x)
   )

 (defn occupied-by-enemy? [board location color]
-  (comment
+  (when debug
     (println "occupied-by-enemy?")
     (println board)
     (println  location)
@@ -161,8 +159,6 @@
 (defn off-board? [[x y]]
   (or (< x  0) (> x  7) (< y 0) (> y 7)))

-(defn is-bishop?[board loc]
-  (#{"b" "B"} (get board loc)))

 (defn is-board?[x]
   (map? x))
@@ -174,7 +170,8 @@
         x (range 0 8)
         ]
     [x y]))
-(println locations-helper)
+
+;;(println locations-helper)

 ;; From wikipedia:
@@ -195,19 +192,22 @@
 (defn board->string[board]
   (assert is-board? board)
   (str
-  (reduce (fn[accum location]
-            (str accum
-                 (get board location " ")
-
-                 (if (= 7 (first location))
-                   "\n")
-                 (if (and (= 7 (first location))
-                          (not= 0 (second location)))
-                       (str (second location) " ")))
-            ) "8 " locations-helper)
-      "  abcdefgh"
+    (reduce (fn[accum location]
+              (str accum
+                   (get board location " ")
+
+                   (if (= 7 (first location))
+                     "\n")
+                   (if (and (= 7 (first location))
+                            (not= 0 (second location)))
+                     (str (second location) " ")))
+              ) "8 " locations-helper)
+    "  abcdefgh"
     ))
-(println (board->string starting-board))
+
+
+;;(println (board->string starting-board))
+
 ;;; to print board 0 7, 1 7,     7,7 cr
 ;;;                0 6 .........7 6 cr
 ;;;                ...
@@ -219,26 +219,9 @@
   (is (=
         starting-board-string
         (board->string
-        (string->board starting-board-string)))))
+          (string->board starting-board-string)))))
 (defn on-board?[loc] (not (off-board? loc)))

-(defn bishop-non-captures[board location]
-  (assert (is-bishop? board location))
-  (assert (is-board? board))
-  (assert (valid-location? location))
-  (let [[x y] location]
-    (into []  ;
-          (map (fn[loc2] [location loc2])
-               (apply concat
-                      (for [op1  [+ -] op2 [+ -]]  ;; to generate 4 diagonals
-                        (take-while (fn[loc]
-                                      (and
-                                        (on-board? loc)
-                                        (not (occupied? board loc))))
-                                    (for [z (drop 1(range))]  [(op1 x z) (op2 y z)])
-                                    )
-                        ))))))
-
 (defn rook-right[x y z] [ (+ x z) y ])

 (defn rook-left[x y z] [ (- x z) y ])
@@ -255,9 +238,30 @@

 (defn bishop-sw[x y z] [ (- x z) (- y z)])

-(def bishop-rules [bishop-ne bishop-nw bishop-se bishop-sw])
-(def rook-rules [rook-right rook-left rook-up rook-down])
-
+(def rook-rules
+       [rook-right rook-left rook-up rook-down])
+
+(def bishop-rules
+[bishop-ne bishop-nw bishop-se bishop-sw])
+
+
+(def pieces-info
+  {
+   :r {:rules rook-rules
+       :ranging true}
+   :n {
+       }
+   :b {:rules
+       bishop-rules
+       :ranging true}
+   :q {:rules
+       (concat bishop-rules rook-rules)
+       :ranging true }
+   :k {
+       }
+   :p {
+       }
+   })

 (def is-ranging? #{"q" "Q" "b" "B" "r" "R"})

@@ -276,8 +280,8 @@
         ]
     (when debug
       (println x y)
-     (println (board->string board))
-    (println location))
+      (println (board->string board))
+      (println location))
     (loop [locs-to-test (for [z (drop 1(range))]  ;; lazy seq of locations to test
                           (direction-fn x y z))
            ]
@@ -297,35 +301,29 @@

 (defn ranging-captures[board location rules]
   {:pre  []
-   :post [(set? %)]
    }
   "return set of locations for captures that the rook or bishop at location can make"
+  (when true (println "entering ranging-captures"))
   (assert (is-ranging? (get board location)))
   (assert (is-board? board))
   (assert (valid-location? location))
   (let [color (get-color (get board location))
         [x y] location
         ]
-    (set
-     (map (fn[loc-to-capture] (vector location loc-to-capture))
-          (remove nil?
-                 (map
-                   (partial ranging-capture-in-direction board location)
-                   rules
-                   ))))))
-
-(defn bishop-captures[board location]
-  (ranging-captures board location bishop-rules)
-)
-
-;; (test-rook-moves)
-
-;; (test-rook-captures)
+    (map (fn[loc2] (vector location loc2))
+         (remove nil?
+      (map (fn[loc-to-capture] (vector location loc-to-capture))
+           (remove nil?
+                   (map
+                     (partial ranging-capture-in-direction board location)
+                     rules
+                     )))))))
+

 ;; z will range from 1 to infinity

-(defn look-for-non-capture-in-direction[board location direction-fn]
+(defn ranging-non-capture-in-direction[board location direction-fn]
   ;; location is the location of the friendly piece in question
   ;; direction-fn generate locations to test using a function applied to the range 1..infinity
   ;; Finished when
@@ -340,8 +338,8 @@
         ]
     (when debug
       (println x y)
-     (println (board->string board))
-    (println location))
+      (println (board->string board))
+      (println location))
     (loop [locs-to-test (for [z (drop 1(range))]  ;; lazy seq of locations to test
                           (direction-fn x y z))
            accum []
@@ -353,9 +351,9 @@
           (off-board? loc-to-test)
           accum
           (occupied? board loc-to-test)
-           accum
+          accum
           true  ;; location is empty
-          (recur  (next locs-to-test) (conj accum loc-to-test) )))
+          (recur  (next locs-to-test) (conj accum (vector location loc-to-test)) )))
       )))

 ;; (f a b) -> a
@@ -366,94 +364,37 @@

 (defn ranging-non-captures[board location rules]
   {:pre  [(vector? rules)]
-   :post [(set? %)]
    }
-  "return set of locations for moves that the piece can make according to the rules which is an array of functions"
+  "return moves that the piece can make according to the rules which is an array of functions"
+  "[loc loc2]"
   (assert (is-ranging? (get board location)))
   (assert (is-board? board))
   (assert (valid-location? location))
   (let [color (get-color (get board location))
         [x y] location
         ]
-    (set (remove nil?
-                 (map
-                   (partial ranging-capture-in-direction board location)
+         (remove empty?
+                 (mapcat
+                   (partial ranging-non-capture-in-direction board location)
                    rules
-                   )))))
-
-
-(defn rook-captures[board location]
-  {:pre  []
-   :post [(set? %)]
-   }
-  (ranging-captures board location rook-rules))
-
-(defn rook-non-captures[board location]
-  {:pre  []
-   :post [(set? %)]
-   }
-  (ranging-non-captures board location rook-rules))
-
-
-; (test-bishop-captures)
-(defn test-bishop-captures[]
-  (let [board (string->board (join "\n"
-
-                                   ["       "
-                                    "     p"
-                                    "  p   "
-                                    "   B   b"
-                                    "  pnQ  "
-                                    "          "]))
-        ]
-    (when debug
-      (println (board->string board))
-      )
-    (is (=
-          #{[2 1] [5 4] [2 3]}
-          (bishop-captures board [3 2])))
-    ))
-;;(def debug false)
-(defn test-rook-non-captures[]
-  (let [board (string->board (join "\n"
-                                   ["   p    "
-                                    "  pR   b"
-                                    "  pQ    "
-                                    "        "]))
-        ]
-    (when debug
-     (println (board->string board))
-      )
-    (is (=
-          #{[2 2] [3 3] [7 2]}
-          (rook-non-captures board [3 2])))
-    ))
-(test-rook-non-captures)
-(defn test-rook-captures[]
-  (let [board (string->board (join "\n"
-                                   ["   p  "
-                                    "  pR   b"
-                                    "  pnQ  "
-                                    " "]))
-        ]
-    ;;    (println board)
-    ;;  (println (board->string board))
-    (is (=
-          #{[2 2] [3 3] [7 2] [3 1]}
-          (rook-captures board [3 2])))
-    ))
-
-(defn rook-moves[board location]
-  (apply concat
-         ((juxt rook-non-captures rook-captures)
-          board location))
-  )
-(defn bishop-moves[board location]
-  (apply concat
-         ((juxt bishop-non-captures bishop-captures)
-          board location))
-  )
-
+                   ))))
+
+(defn piece-info-at-location[board location]
+  (get pieces-info
+       (keyword (clojure.string/lower-case (get board location)))
+       ))
+
+
+(defn ranging-moves[board location]
+  (when true (println "ranging-moves")
+    (println "location is" location)
+    (println board)
+    )
+  (let [piece-info (piece-info-at-location board location)]
+    (when true (println "piece-info is" piece-info))
+        (apply concat
+           ((juxt ranging-captures ranging-non-captures)
+     board location (:rules piece-info)))))

 (defn pawn-captures[board [x y :as location]]
@@ -517,18 +458,35 @@
     (black-piece? piece)
     ))

+(def debug false)
+;;(println (checkmated? starting-board :white))
 (defn moves[board white-or-black]
-  (remove nil? (mapcat (fn[[loc piece :as z]]
-                         (case piece
-                           ("p" "P")
+  (when debug
+    (println "entering moves")
+    (println "board is" board)
+    (println "white-or-black" white-or-black)
+    )
+  (mapcat
+                 (fn[[loc piece :as z]]
+                   (let [
+                         debug true
+                         piece-info (get pieces-info
+                                         (keyword (clojure.string/lower-case piece)))]
+                     (when debug
+                       (println "piece-info is" piece-info)
+                       (println "piece is" piece))
+                     (assert piece-info)
+                     (cond (:ranging piece-info)
+                           (ranging-moves board loc)
+                           (is-pawn? piece)
                            (pawn-moves board loc)
-                           ("b" "B")
-                           (bishop-moves board loc)
-                           nil
-                           )) (filter (fn[[_ piece]]
-                                        (is-color?  piece white-or-black)) board)
-                       )))
-
+                           true
+                          nil
+                           ))) (filter (fn[[_ piece]]
+                                         (is-color?  piece white-or-black)) board)
+          ))
+;;(use 'clojure.stacktrace)
+;; (print-stack-trace *e)

 (defn -main
   "I don't do a whole lot ... yet."
@@ -541,7 +499,10 @@
     :black
     :white))

+
+;;  (checkmated? starting-board :white)
 (defn checkmated?[board color]
+  (when debug (println "in checkmated?, board is" board))
   "Return true if color has checkmated the opponent"
   (assert is-color? color)
   (assert is-board? board)
@@ -553,32 +514,23 @@
         ]
     (when debug
       (println "in checkmated?")
-        (println (moves board color)))
+      (println (moves board color)))
     (some #(when (= (second %) king-location) true) (moves board color))

     ))

 ;;;;;;;;;;;;;; TESTS ;;;;;;;;;;;;;;;;;;;;;;;;;;;

-(defn test-rook-captures2[]
-  (is (=
-       #{[[1 0] [0 0]]}
-        (rook-captures (string->board (str "BR\n"
-                                           "kR")) [1 0])))
-  )
-;; (test-rook-captures2)
-(defn test-rook-moves[]
-  (let [board (string->board (join "\n"
-                                   ["  "
-                                    " R"
-                                    "  "]))
-        ]
-    (println (rook-non-captures board [1 1])))
-  )
+(defn test-moves[]
+  (println "test-moves")
+  (moves (string->board "R") :white)
+  )
+;; (println (test-moves))
 (defn test-checkmated[]
   ;; white checkmates black
   (assert (not (checkmated? (string->board "BR\nkR") :white)))
-  (assert (checkmated? (string->board "BR\n k") :white))
+  (assert (checkmated? (string->board (str "BR\n"
+                                           " k")) :white))
   )
 ;; (test-checkmated)
 (defn test-starting-moves[]
@@ -586,13 +538,9 @@
     (map #(move->algebraic-notation board %)
          (moves starting-board :black))))
 (defn run-tests[]
-(test-rook-captures2)
-  (test-rook-moves)
   (test-pawn-moves)
   (test-checkmated)
-  (test-bishop-captures)
-  (test-rook-captures)
-(test-board->string)
+  (test-board->string)
   (test-starting-moves)
   )
 ;;(run-tests)